diff --git a/app/main.ts b/app/main.ts index fe804025d..3262313ae 100644 --- a/app/main.ts +++ b/app/main.ts @@ -385,12 +385,6 @@ async function prepareUrl( config.get('directoryCDSIUrl') || undefined, directoryCDSIMRENCLAVE: config.get('directoryCDSIMRENCLAVE') || undefined, - directoryCDSHUrl: - config.get('directoryCDSHUrl') || undefined, - directoryCDSHPublicKey: - config.get('directoryCDSHPublicKey') || undefined, - directoryCDSHCodeHashes: - config.get | null>('directoryCDSHCodeHashes') || undefined, }); if (!directoryConfig.success) { throw new Error( diff --git a/config/default.json b/config/default.json index 86aed6eb9..7e127f521 100644 --- a/config/default.json +++ b/config/default.json @@ -7,9 +7,6 @@ "directoryTrustAnchor": null, "directoryCDSIUrl": "https://cdsi.staging.signal.org", "directoryCDSIMRENCLAVE": "ef4787a56a154ac6d009138cac17155acd23cfe4329281252365dd7c252e7fbf", - "directoryCDSHUrl": null, - "directoryCDSHPublicKey": null, - "directoryCDSHCodeHashes": null, "cdn": { "0": "https://cdn-staging.signal.org", "2": "https://cdn2-staging.signal.org" diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 6d8d5a4ba..7f45af3f4 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -48,7 +48,6 @@ import type { import type { CDSBase } from './cds/CDSBase'; import { LegacyCDS } from './cds/LegacyCDS'; import type { LegacyCDSPutAttestationResponseType } from './cds/LegacyCDS'; -import { CDSH } from './cds/CDSH'; import { CDSI } from './cds/CDSI'; import type WebSocketResource from './WebsocketResources'; import { SignalService as Proto } from '../protobuf'; @@ -1206,32 +1205,6 @@ export function initialize({ }, }); } - if (directoryType === 'cdsh') { - const { - directoryCDSHUrl, - directoryCDSHPublicKey, - directoryCDSHCodeHashes, - } = directoryConfig; - - cds = new CDSH({ - logger: log, - proxyUrl, - - url: directoryCDSHUrl, - publicKey: directoryCDSHPublicKey, - codeHashes: directoryCDSHCodeHashes, - certificateAuthority, - version, - - async getAuth() { - return (await _ajax({ - call: 'directoryAuthV2', - httpType: 'GET', - responseType: 'json', - })) as CDSAuthType; - }, - }); - } let fetchForLinkPreviews: linkPreviewFetch.FetchFn; if (proxyUrl) { diff --git a/ts/textsecure/cds/CDSH.ts b/ts/textsecure/cds/CDSH.ts deleted file mode 100644 index 4025794ca..000000000 --- a/ts/textsecure/cds/CDSH.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2021-2022 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import { HsmEnclaveClient } from '@signalapp/libsignal-client'; -import type { connection as WebSocket } from 'websocket'; - -import * as Bytes from '../../Bytes'; -import { CDSHSocket } from './CDSHSocket'; -import type { CDSSocketManagerBaseOptionsType } from './CDSSocketManagerBase'; -import { CDSSocketManagerBase } from './CDSSocketManagerBase'; - -export type CDSHOptionsType = Readonly<{ - publicKey: string; - codeHashes: ReadonlyArray; -}> & - CDSSocketManagerBaseOptionsType; - -export class CDSH extends CDSSocketManagerBase { - private readonly publicKey: Buffer; - - private readonly codeHashes: Array; - - constructor(options: CDSHOptionsType) { - super(options); - - this.publicKey = Buffer.from(Bytes.fromHex(options.publicKey)); - this.codeHashes = options.codeHashes.map(hash => - Buffer.from(Bytes.fromHex(hash)) - ); - } - - protected override getSocketUrl(): string { - const { publicKey: publicKeyHex, codeHashes } = this.options; - - return ( - `${this.options.url}/discovery/${publicKeyHex}/` + - `${codeHashes.join(',')}` - ); - } - - protected override createSocket(socket: WebSocket): CDSHSocket { - const enclaveClient = HsmEnclaveClient.new(this.publicKey, this.codeHashes); - - return new CDSHSocket({ - logger: this.logger, - socket, - enclaveClient, - }); - } -} diff --git a/ts/textsecure/cds/CDSHSocket.ts b/ts/textsecure/cds/CDSHSocket.ts deleted file mode 100644 index 1e505b338..000000000 --- a/ts/textsecure/cds/CDSHSocket.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021-2022 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import type { HsmEnclaveClient } from '@signalapp/libsignal-client'; - -import { strictAssert } from '../../util/assert'; -import { CDSSocketBase, CDSSocketState } from './CDSSocketBase'; -import type { CDSSocketBaseOptionsType } from './CDSSocketBase'; - -export type CDSHSocketOptionsType = Readonly<{ - enclaveClient: HsmEnclaveClient; -}> & - CDSSocketBaseOptionsType; - -export class CDSHSocket extends CDSSocketBase { - public override async handshake(): Promise { - strictAssert( - this.state === CDSSocketState.Open, - 'CDSH handshake called twice' - ); - this.state = CDSSocketState.Handshake; - - // Handshake - this.socket.sendBytes(this.options.enclaveClient.initialRequest()); - - const { done, value: message } = await this.socketIterator.next(); - strictAssert(!done, 'Expected CDSH handshake response'); - - this.options.enclaveClient.completeHandshake(message); - this.state = CDSSocketState.Established; - } - - protected override async sendRequest( - version: number, - request: Buffer - ): Promise { - this.socket.sendBytes( - this.options.enclaveClient.establishedSend( - Buffer.concat([Buffer.from([version]), request]) - ) - ); - } - - protected override async decryptResponse( - ciphertext: Buffer - ): Promise { - return this.options.enclaveClient.establishedRecv(ciphertext); - } -} diff --git a/ts/types/RendererConfig.ts b/ts/types/RendererConfig.ts index 13119da40..68bc43259 100644 --- a/ts/types/RendererConfig.ts +++ b/ts/types/RendererConfig.ts @@ -42,13 +42,6 @@ const directoryMirroredCDSIConfigSchema = z.object({ directoryCDSIMRENCLAVE: configRequiredStringSchema, }); -const directoryCDSHConfigSchema = z.object({ - directoryType: z.literal('cdsh'), - directoryCDSHCodeHashes: z.array(z.string().nonempty()), - directoryCDSHPublicKey: configRequiredStringSchema, - directoryCDSHUrl: configRequiredStringSchema, -}); - export const directoryConfigSchema = z .object({ // Unknown defaults @@ -58,16 +51,11 @@ export const directoryConfigSchema = z directoryCDSIUrl: configOptionalUnknownSchema, directoryCDSIMRENCLAVE: configOptionalUnknownSchema, - - directoryCDSHCodeHashes: configOptionalUnknownSchema, - directoryCDSHPublicKey: configOptionalUnknownSchema, - directoryCDSHUrl: configOptionalUnknownSchema, }) .and( directoryLegacyConfigSchema .or(directoryMirroredCDSIConfigSchema) .or(directoryCDSIConfigSchema) - .or(directoryCDSHConfigSchema) ); export type DirectoryConfigType = z.infer;