Skip to content

Commit 0ec1884

Browse files
committed
Remove MSC3903 v1 support
This is a breaking change in code marked unstable/experimental
1 parent 47a0b62 commit 0ec1884

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ import { crypto, subtleCrypto, TextEncoder } from "../../crypto/crypto";
3030
import { generateDecimalSas } from "../../crypto/verification/SASDecimal";
3131
import { UnstableValue } from "../../NamespacedValue";
3232

33-
const ECDH = new UnstableValue(
33+
const ECDH_V2 = new UnstableValue(
3434
"m.rendezvous.v2.curve25519-aes-sha256",
3535
"org.matrix.msc3903.rendezvous.v2.curve25519-aes-sha256",
3636
);
3737

3838
export interface ECDHv2RendezvousCode extends RendezvousCode {
3939
rendezvous: {
4040
transport: RendezvousTransportDetails;
41-
algorithm: typeof ECDH.name | typeof ECDH.altName;
41+
algorithm: typeof ECDH_V2.name | typeof ECDH_V2.altName;
4242
key: string;
4343
};
4444
}
4545

4646
export type MSC3903ECDHPayload = PlainTextPayload | EncryptedPayload;
4747

4848
export interface PlainTextPayload {
49-
algorithm: typeof ECDH.name | typeof ECDH.altName;
49+
algorithm: typeof ECDH_V2.name | typeof ECDH_V2.altName;
5050
key?: string;
5151
}
5252

@@ -90,11 +90,11 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
9090
throw new Error("Code already generated");
9191
}
9292

93-
await this.transport.send({ algorithm: ECDH.name });
93+
await this.transport.send({ algorithm: ECDH_V2.name });
9494

9595
const rendezvous: ECDHv2RendezvousCode = {
9696
rendezvous: {
97-
algorithm: ECDH.name,
97+
algorithm: ECDH_V2.name,
9898
key: encodeUnpaddedBase64(this.ourPublicKey),
9999
transport: await this.transport.details(),
100100
},
@@ -123,7 +123,7 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
123123
}
124124
const res = rawRes as Partial<PlainTextPayload>;
125125
const { key, algorithm } = res;
126-
if (!algorithm || !ECDH.matches(algorithm) || !key) {
126+
if (!algorithm || !ECDH_V2.matches(algorithm) || !key) {
127127
throw new RendezvousError(
128128
"Unsupported algorithm: " + algorithm,
129129
RendezvousFailureReason.UnsupportedAlgorithm,
@@ -134,7 +134,7 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
134134
} else {
135135
// send our public key unencrypted
136136
await this.transport.send({
137-
algorithm: ECDH.name,
137+
algorithm: ECDH_V2.name,
138138
key: encodeUnpaddedBase64(this.ourPublicKey),
139139
});
140140
}
@@ -145,7 +145,7 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
145145

146146
const initiatorKey = isInitiator ? this.ourPublicKey : this.theirPublicKey!;
147147
const recipientKey = isInitiator ? this.theirPublicKey! : this.ourPublicKey;
148-
let aesInfo = ECDH.name;
148+
let aesInfo = ECDH_V2.name;
149149
aesInfo += `|${encodeUnpaddedBase64(initiatorKey)}`;
150150
aesInfo += `|${encodeUnpaddedBase64(recipientKey)}`;
151151

0 commit comments

Comments
 (0)