diff --git a/spec/integ/crypto/verification.spec.ts b/spec/integ/crypto/verification.spec.ts index 243fd510d58..ae9ebcd5961 100644 --- a/spec/integ/crypto/verification.spec.ts +++ b/spec/integ/crypto/verification.spec.ts @@ -744,6 +744,8 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("verification (%s)", (backend: st expect(toDeviceMessage.transaction_id).toEqual(transactionId); expect(toDeviceMessage.code).toEqual("m.user"); expect(request.phase).toEqual(VerificationPhase.Cancelled); + expect(request.cancellationCode).toEqual("m.user"); + expect(request.cancellingUserId).toEqual("@alice:localhost"); }); it("can cancel during the SAS phase", async () => { diff --git a/src/rust-crypto/verification.ts b/src/rust-crypto/verification.ts index cca1b4aa6b4..a8b733c5fe0 100644 --- a/src/rust-crypto/verification.ts +++ b/src/rust-crypto/verification.ts @@ -426,7 +426,7 @@ export class RustVerificationRequest * this verification. */ public get cancellationCode(): string | null { - throw new Error("not implemented"); + return this.inner.cancelInfo?.cancelCode() ?? null; } /** @@ -435,7 +435,14 @@ export class RustVerificationRequest * Only defined when phase is Cancelled */ public get cancellingUserId(): string | undefined { - throw new Error("not implemented"); + const cancelInfo = this.inner.cancelInfo; + if (!cancelInfo) { + return undefined; + } else if (cancelInfo.cancelledbyUs()) { + return this.olmMachine.userId.toString(); + } else { + return this.inner.otherUserId.toString(); + } } }