# ol.trixnity.verification

Verification state snapshots and active verification flows.

## Upstream Mapping

This namespace maps to Trixnity’s `VerificationService`.

The public wrappers here cover:

* creating device and user verification requests
* accepting requests, starting and accepting SAS, confirming or rejecting SAS,
  and cancelling active verifications
* the current active device verification and its relieved flow
* the current active user verifications and their relieved flow
* self-verification method discovery

Use [`ol.trixnity.key`](api/ol-trixnity-key.adoc) for trust and key-management APIs that often
accompany verification workflows.

## current-active-device-verification

```clojure
(current-active-device-verification client)
```

Returns the current active device verification, or nil when none is active.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L30-L33)

---

## active-device-verification

```clojure
(active-device-verification client)
```

Returns a relieved Missionary flow of the current active device verification.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L35-L39)

---

## current-active-user-verifications

```clojure
(current-active-user-verifications client)
```

Returns the current active user verifications as a vector.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L41-L44)

---

## active-verification-snapshots

```clojure
(active-verification-snapshots client)
```

Returns active device and user verification snapshots as a vector.

Device verification, when present, appears first, followed by active user
verifications in Trixnity order. Each snapshot contains a stable
`::mx/verification-id` suitable for [`ready!`](#ready!), [`start-sas!`](#start-sas!),
[`accept-sas!`](#accept-sas!), [`confirm!`](#confirm!), [`no-match!`](#no-match!), and [`cancel!`](#cancel!).

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L46-L57)

---

## status

```clojure
(status client)
```

Returns active verification snapshots.

Alias for [`active-verification-snapshots`](#active-verification-snapshots).

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L59-L64)

---

## active-user-verifications

```clojure
(active-user-verifications client)
```

Returns a relieved Missionary flow of the current active user verifications.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L66-L70)

---

## start-device-verification!

```clojure
(start-device-verification! client user-id device-id)
```

Creates a device verification request and returns a Missionary task.

`user-id` is the target Matrix user id. `device-id` is the target Matrix
device id. The task resolves to a normalized active-verification snapshot.

Maps to Trixnity `VerificationService.createDeviceVerificationRequest`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L72-L85)

---

## start-user-verification!

```clojure
(start-user-verification! client user-id)
```

Creates a user verification request and returns a Missionary task.

The task resolves to a normalized active-verification snapshot. Maps to
Trixnity `VerificationService.createUserVerificationRequest`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L87-L94)

---

## get-active-user-verification!

```clojure
(get-active-user-verification! client room-id event-id)
```

Gets or creates an active user verification for a room request event.

`room-id` and `event-id` identify a Matrix verification request event. The
task resolves to a normalized active-verification snapshot or nil. Maps to
Trixnity `VerificationService.getActiveUserVerification`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L96-L108)

---

## ready!

```clojure
(ready! client verification-id)
```

Sends `m.key.verification.ready` for an incoming verification request.

`verification-id` must come from an active-verification snapshot. The task
resolves to the updated snapshot. Maps to Trixnity
`ActiveVerificationState.TheirRequest.ready`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L110-L118)

---

## start-sas!

```clojure
(start-sas! client verification-id)
```

Starts SAS verification for a ready verification request.

`verification-id` must come from an active-verification snapshot. The task
resolves to the updated snapshot. Maps to Trixnity
`ActiveVerificationState.Ready.start(VerificationMethod.Sas)`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L120-L128)

---

## accept-sas!

```clojure
(accept-sas! client verification-id)
```

Accepts an incoming SAS start event.

`verification-id` must come from an active-verification snapshot. The task
resolves to the updated snapshot. Maps to Trixnity
`ActiveSasVerificationState.TheirSasStart.accept`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L130-L138)

---

## accept!

```clojure
(accept! client verification-id)
```

Accepts the current incoming verification step.

`verification-id` must come from an active-verification snapshot. This maps
to Trixnity’s available incoming action for the current state: request
`ready` or SAS `accept`. Prefer [`ready!`](#ready!) or [`accept-sas!`](#accept-sas!) when the
caller already knows the state.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L140-L149)

---

## confirm!

```clojure
(confirm! client verification-id)
```

Confirms that the SAS comparison matches.

`verification-id` must come from an active-verification snapshot. The task
resolves to the updated snapshot. Maps to Trixnity
`ActiveSasVerificationState.ComparisonByUser.match`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L151-L159)

---

## no-match!

```clojure
(no-match! client verification-id)
```

Rejects the SAS comparison as a mismatch.

`verification-id` must come from an active-verification snapshot. The task
resolves to the updated snapshot. Maps to Trixnity
`ActiveSasVerificationState.ComparisonByUser.noMatch`.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L161-L169)

---

## cancel!

```clojure
(cancel! client verification-id)
(cancel! client verification-id reason)
```

Cancels an active verification and returns a Missionary task.

`verification-id` must come from an active-verification snapshot. With
`reason`, passes that Matrix cancellation reason through to Trixnity.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L171-L185)

---

## get-self-verification-methods

```clojure
(get-self-verification-methods client)
```

Returns a Missionary flow of available self-verification methods.

Upstream models this as a state machine that distinguishes unmet
preconditions, no-cross-signing-yet, already-cross-signed, and available
self-verification methods.

[source,window=_blank](https://github.com/outskirtslabs/trixnity-clj/blob/main/src/clj/ol/trixnity/verification.clj#L187-L194)
