1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Element R: Implement requestOwnUserVerification (#3508)

Part of https://github.com/vector-im/element-web/issues/25319.
This commit is contained in:
Richard van der Hoff
2023-06-26 15:17:35 +01:00
committed by GitHub
parent 96e484a3fe
commit bd66e3859d
2 changed files with 53 additions and 3 deletions

View File

@@ -584,7 +584,19 @@ export class RustCrypto implements CryptoBackend {
* @returns a VerificationRequest when the request has been sent to the other party.
*/
public async requestOwnUserVerification(): Promise<VerificationRequest> {
throw new Error("not implemented");
const userIdentity: RustSdkCryptoJs.OwnUserIdentity | undefined = await this.olmMachine.getIdentity(
new RustSdkCryptoJs.UserId(this.userId),
);
if (userIdentity === undefined) {
throw new Error("cannot request verification for this device when there is no existing cross-signing key");
}
const [request, outgoingRequest]: [RustSdkCryptoJs.VerificationRequest, RustSdkCryptoJs.ToDeviceRequest] =
await userIdentity.requestVerification(
this.supportedVerificationMethods?.map(verificationMethodIdentifierToMethod),
);
await this.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);
return new RustVerificationRequest(request, this.outgoingRequestProcessor);
}
/**