From 0ec18845dc50855a71d84e6caec729d97a60831e Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Thu, 2 Mar 2023 12:03:45 +0000 Subject: [PATCH] Remove MSC3903 v1 support This is a breaking change in code marked unstable/experimental --- .../channels/MSC3903ECDHv2RendezvousChannel.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts b/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts index cd1ac47be8b..be60ee5c9aa 100644 --- a/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts +++ b/src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts @@ -30,7 +30,7 @@ import { crypto, subtleCrypto, TextEncoder } from "../../crypto/crypto"; import { generateDecimalSas } from "../../crypto/verification/SASDecimal"; import { UnstableValue } from "../../NamespacedValue"; -const ECDH = new UnstableValue( +const ECDH_V2 = new UnstableValue( "m.rendezvous.v2.curve25519-aes-sha256", "org.matrix.msc3903.rendezvous.v2.curve25519-aes-sha256", ); @@ -38,7 +38,7 @@ const ECDH = new UnstableValue( export interface ECDHv2RendezvousCode extends RendezvousCode { rendezvous: { transport: RendezvousTransportDetails; - algorithm: typeof ECDH.name | typeof ECDH.altName; + algorithm: typeof ECDH_V2.name | typeof ECDH_V2.altName; key: string; }; } @@ -46,7 +46,7 @@ export interface ECDHv2RendezvousCode extends RendezvousCode { export type MSC3903ECDHPayload = PlainTextPayload | EncryptedPayload; export interface PlainTextPayload { - algorithm: typeof ECDH.name | typeof ECDH.altName; + algorithm: typeof ECDH_V2.name | typeof ECDH_V2.altName; key?: string; } @@ -90,11 +90,11 @@ export class MSC3903ECDHv2RendezvousChannel implements RendezvousChannel { throw new Error("Code already generated"); } - await this.transport.send({ algorithm: ECDH.name }); + await this.transport.send({ algorithm: ECDH_V2.name }); const rendezvous: ECDHv2RendezvousCode = { rendezvous: { - algorithm: ECDH.name, + algorithm: ECDH_V2.name, key: encodeUnpaddedBase64(this.ourPublicKey), transport: await this.transport.details(), }, @@ -123,7 +123,7 @@ export class MSC3903ECDHv2RendezvousChannel implements RendezvousChannel { } const res = rawRes as Partial; const { key, algorithm } = res; - if (!algorithm || !ECDH.matches(algorithm) || !key) { + if (!algorithm || !ECDH_V2.matches(algorithm) || !key) { throw new RendezvousError( "Unsupported algorithm: " + algorithm, RendezvousFailureReason.UnsupportedAlgorithm, @@ -134,7 +134,7 @@ export class MSC3903ECDHv2RendezvousChannel implements RendezvousChannel { } else { // send our public key unencrypted await this.transport.send({ - algorithm: ECDH.name, + algorithm: ECDH_V2.name, key: encodeUnpaddedBase64(this.ourPublicKey), }); } @@ -145,7 +145,7 @@ export class MSC3903ECDHv2RendezvousChannel implements RendezvousChannel { const initiatorKey = isInitiator ? this.ourPublicKey : this.theirPublicKey!; const recipientKey = isInitiator ? this.theirPublicKey! : this.ourPublicKey; - let aesInfo = ECDH.name; + let aesInfo = ECDH_V2.name; aesInfo += `|${encodeUnpaddedBase64(initiatorKey)}`; aesInfo += `|${encodeUnpaddedBase64(recipientKey)}`;