Skip to content

Commit

Permalink
Fix type error introduced by crypto-wasm 4.0.0 (#4026)
Browse files Browse the repository at this point in the history
* Fix type error introduced by crypto-wasm 4.0.0

* fix imports
  • Loading branch information
richvdh authored Jan 23, 2024
1 parent c993785 commit 3c28cfc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/rust-crypto/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -659,18 +660,23 @@ export class RustSASVerifier extends BaseRustVerifer<RustSdkCryptoJs.Sas> implem
/** if we can now show the callbacks, do so */
protected onChange(): void {
if (this.callbacks === null) {
const emoji: Array<Emoji> | 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<void> => {
const requests: Array<OutgoingRequest> = await this.inner.confirm();
for (const m of requests) {
Expand Down

0 comments on commit 3c28cfc

Please sign in to comment.