Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement getting verification cancellation info in Rust crypto #3947

Merged
merged 6 commits into from
Jan 25, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/rust-crypto/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,12 @@ export class RustVerificationRequest
* this verification.
*/
public get cancellationCode(): string | null {
throw new Error("not implemented");
const cancelInfo = this.inner.cancelInfo;
if (cancelInfo) {
return cancelInfo.cancelCode().toString();
} else {
return null;
}
}

/**
Expand All @@ -434,7 +439,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();
}
}
}

Expand Down
Loading