Skip to content

Commit

Permalink
Remove MSC3903 v1 support
Browse files Browse the repository at this point in the history
This is a breaking change in code marked unstable/experimental
  • Loading branch information
hughns committed Mar 2, 2023
1 parent 47a0b62 commit 0ec1884
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/rendezvous/channels/MSC3903ECDHv2RendezvousChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ 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",
);

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;
};
}

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;
}

Expand Down Expand Up @@ -90,11 +90,11 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
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(),
},
Expand Down Expand Up @@ -123,7 +123,7 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
}
const res = rawRes as Partial<PlainTextPayload>;
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,
Expand All @@ -134,7 +134,7 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {
} else {
// send our public key unencrypted
await this.transport.send({
algorithm: ECDH.name,
algorithm: ECDH_V2.name,
key: encodeUnpaddedBase64(this.ourPublicKey),
});
}
Expand All @@ -145,7 +145,7 @@ export class MSC3903ECDHv2RendezvousChannel<T> implements RendezvousChannel<T> {

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)}`;

Expand Down

0 comments on commit 0ec1884

Please sign in to comment.