diff --git a/src/rust-crypto/verification.ts b/src/rust-crypto/verification.ts index bac4694441c..cca1b4aa6b4 100644 --- a/src/rust-crypto/verification.ts +++ b/src/rust-crypto/verification.ts @@ -15,9 +15,10 @@ limitations under the License. */ import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; -import { Emoji, QrState } from "@matrix-org/matrix-sdk-crypto-wasm"; +import { QrState } from "@matrix-org/matrix-sdk-crypto-wasm"; import { + GeneratedSas, ShowQrCodeCallbacks, ShowSasCallbacks, VerificationPhase, @@ -659,18 +660,23 @@ export class RustSASVerifier extends BaseRustVerifer implem /** if we can now show the callbacks, do so */ protected onChange(): void { if (this.callbacks === null) { - const emoji: Array | undefined = this.inner.emoji(); - const decimal = this.inner.decimals() as [number, number, number] | undefined; + const emoji = this.inner.emoji(); + const decimal = this.inner.decimals(); if (emoji === undefined && decimal === undefined) { return; } + const sas: GeneratedSas = {}; + if (emoji) { + sas.emoji = emoji.map((e) => [e.symbol, e.description]); + } + if (decimal) { + sas.decimal = [decimal[0], decimal[1], decimal[2]]; + } + this.callbacks = { - sas: { - decimal: decimal, - emoji: emoji?.map((e) => [e.symbol, e.description]), - }, + sas, confirm: async (): Promise => { const requests: Array = await this.inner.confirm(); for (const m of requests) {