KeyVerificationState enum

QR key verification You create possible methods from client.verificationMethods on device A and send a request using request.start() which calls sendRequest() your client now is in waitingAccept state, where ideally your client would now show some waiting indicator.

On device B you now get a m.key.verification.request, you check the methods from the request payload and see if anything is possible. If not you cancel the request. (should this be cancelled? couldn't another device handle this?) you the set the state to askAccept.

Your client would now show a button to accept/decline the request. The user can then use acceptVerification()to accept the verification which then sends a m.key.verification.ready. This also calls generateQrCode() in it which populates the request.qrData depending on the qr mode. B now sets the state askChoice

On device A you now get the ready event, which setups the possibleMethods and qrData on A's side. Similarly A now sets their state to askChoice

At his point both sides are on the askChoice state.

BACKWARDS COMPATIBILITY HACK: To work well with sdks prior to QR verification (0.20.5 and older), start will be sent with ready itself if only sas is supported. This avoids weird glare issues faced with start from both sides if clients are not on the same sdk version (0.20.5 vs next) https://matrix.to/#/!KBwfdofYJUmnsVoqwn:famedly.de/$wlHXlLQJdfrqKAF5KkuQrXydwOhY_uyqfH4ReasZqnA?via=neko.dev&via=famedly.de&via=lihotzki.de Here your clients would ideally show a list of the possibleMethods and the user can choose one. For QR specifically, you can show the QR code on the device which supports showing the qr code and the device which supports scanning can scan this code.

Assuming device A scans device B's code, device A would now send a m.key.verification.start, you do this using the continueVerificatio() method. You can pass m.reciprocate.v1 or m.sas.v1 here, and also attach the qrData here. This then calls verifyQrData() internally, which sets the randomSharedSecretForQRCode to the one from the QR code. Device A is now set to showQRSuccess state and shows a green sheild. (Maybe add a text below saying tell device B you scanned the code successfully.)

(some keys magic happens here, check verifyQrData(), verifyKeysQR() to know more)

On device B you get the m.key.verification.start event. The secret sent in the start request is then verified, device B is then set to the confirmQRScan state. Your device should show a dialog to confirm from B that A's device shows the green shield (is in the done state). Once B confirms this physically, you call the acceptQRScanConfirmation() function, which then does some keys magic and sets B's state to done.

A gets the m.key.verification.done messsage and sends a done back, both users can now dismiss the verification dialog safely.

Inheritance
Available extensions

Values

askChoice → const KeyVerificationState
askAccept → const KeyVerificationState
askSSSS → const KeyVerificationState
waitingAccept → const KeyVerificationState
askSas → const KeyVerificationState
showQRSuccess → const KeyVerificationState
confirmQRScan → const KeyVerificationState
waitingSas → const KeyVerificationState
done → const KeyVerificationState
error → const KeyVerificationState

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<KeyVerificationState>
A constant List of the values in this enum, in order of their declaration.