From 08b2aeb23746ef2228d918910b2fe5d159048888 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 29 Jul 2022 09:17:59 -0700 Subject: [PATCH] Move back to libsignal-client v0.18.1 --- package.json | 2 +- ts/SignalProtocolStore.ts | 30 ++++++++++---------- ts/test-electron/SignalProtocolStore_test.ts | 14 +++++---- ts/textsecure/AccountManager.ts | 4 +-- ts/textsecure/cds/CDSISocket.ts | 5 +++- yarn.lock | 10 ++++++- 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 8b1282963..f98a0d21d 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "@indutny/frameless-titlebar": "2.3.5", "@popperjs/core": "2.9.2", "@react-spring/web": "9.4.5", - "@signalapp/libsignal-client": "0.19.1", + "@signalapp/libsignal-client": "0.18.1", "@sindresorhus/is": "0.8.0", "@types/fabric": "4.5.3", "abort-controller": "3.0.0", diff --git a/ts/SignalProtocolStore.ts b/ts/SignalProtocolStore.ts index db6bfb8d0..d2b892598 100644 --- a/ts/SignalProtocolStore.ts +++ b/ts/SignalProtocolStore.ts @@ -7,7 +7,7 @@ import { z } from 'zod'; import { Direction, - IdentityKeyPair, + // IdentityKeyPair, PreKeyRecord, PrivateKey, PublicKey, @@ -32,7 +32,7 @@ import type { IdentityKeyIdType, KeyPairType, OuterSignedPrekeyType, - PniKeyMaterialType, + // PniKeyMaterialType, PreKeyIdType, PreKeyType, SenderKeyIdType, @@ -1978,35 +1978,34 @@ export class SignalProtocolStore extends EventsMixin { ]); } - async updateOurPniKeyMaterial( - pni: UUID, - { - identityKeyPair: identityBytes, - signedPreKey: signedPreKeyBytes, - registrationId, - }: PniKeyMaterialType - ): Promise { - log.info(`SignalProtocolStore.updateOurPniKeyMaterial(${pni})`); + async updateOurPniKeyMaterial(pni: UUID): /* { + identityKeyPair: identityBytes, + signedPreKey: signedPreKeyBytes, + registrationId, + }: PniKeyMaterialType + */ + Promise { + throw new Error( + `TODO: SignalProtocolStore.updateOurPniKeyMaterial(${pni}) is not implemented!` + ); + /* + log.info(`SignalProtocolStore.updateOurPniKeyMaterial(${pni})`); const identityKeyPair = IdentityKeyPair.deserialize( Buffer.from(identityBytes) ); const signedPreKey = SignedPreKeyRecord.deserialize( Buffer.from(signedPreKeyBytes) ); - const { storage } = window; - const pniPublicKey = identityKeyPair.publicKey.serialize(); const pniPrivateKey = identityKeyPair.privateKey.serialize(); - // Update caches this.ourIdentityKeys.set(pni.toString(), { pubKey: pniPublicKey, privKey: pniPrivateKey, }); this.ourRegistrationIds.set(pni.toString(), registrationId); - // Update database await Promise.all([ storage.put('identityKeyMap', { @@ -2031,6 +2030,7 @@ export class SignalProtocolStore extends EventsMixin { signedPreKey.timestamp() ), ]); + */ } async removeAllData(): Promise { diff --git a/ts/test-electron/SignalProtocolStore_test.ts b/ts/test-electron/SignalProtocolStore_test.ts index d1e3f7d84..d7a2b14cb 100644 --- a/ts/test-electron/SignalProtocolStore_test.ts +++ b/ts/test-electron/SignalProtocolStore_test.ts @@ -7,12 +7,12 @@ import chai, { assert } from 'chai'; import chaiAsPromised from 'chai-as-promised'; import { Direction, - IdentityKeyPair, - PrivateKey, - PublicKey, + // IdentityKeyPair, + // PrivateKey, + // PublicKey, SenderKeyRecord, SessionRecord, - SignedPreKeyRecord, + // SignedPreKeyRecord, } from '@signalapp/libsignal-client'; import { signal } from '../protobuf/compiled'; @@ -20,12 +20,12 @@ import { sessionStructureToBytes } from '../util/sessionTranslation'; import * as durations from '../util/durations'; import { Zone } from '../util/Zone'; -import * as Bytes from '../Bytes'; +// import * as Bytes from '../Bytes'; import { getRandomBytes, constantTimeEqual } from '../Crypto'; import { clampPrivateKey, setPublicKeyTypeByte, - generateSignedPreKey, + // generateSignedPreKey, } from '../Curve'; import type { SignalProtocolStore } from '../SignalProtocolStore'; import { GLOBAL_ZONE } from '../SignalProtocolStore'; @@ -1774,6 +1774,7 @@ describe('SignalProtocolStore', () => { assert.strictEqual(items.length, 0); }); }); + /* describe('removeOurOldPni/updateOurPniKeyMaterial', () => { beforeEach(async () => { await store.storePreKey(ourUuid, 2, testKey); @@ -1850,4 +1851,5 @@ describe('SignalProtocolStore', () => { // Note: signature is ignored. }); }); + */ }); diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index 5128b5e08..097e0002b 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -862,8 +862,8 @@ export default class AccountManager extends EventTarget { if (keyMaterial) { await storage.protocol.updateOurPniKeyMaterial( - new UUID(pni), - keyMaterial + new UUID(pni) + // keyMaterial ); // Intentionally not awaiting since this is processed on encrypted queue diff --git a/ts/textsecure/cds/CDSISocket.ts b/ts/textsecure/cds/CDSISocket.ts index 49bc87b69..44f63a7c9 100644 --- a/ts/textsecure/cds/CDSISocket.ts +++ b/ts/textsecure/cds/CDSISocket.ts @@ -1,7 +1,7 @@ // Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { Cds2Client } from '@signalapp/libsignal-client'; +import type { Cds2Client } from '@signalapp/libsignal-client'; import { strictAssert } from '../../util/assert'; import { SignalService as Proto } from '../../protobuf'; @@ -23,6 +23,8 @@ export class CDSISocket extends CDSSocketBase { ); this.state = CDSSocketState.Handshake; + throw new Error('TODO: CDSISocket: Cds2Client is not available!'); + /* { const { done, value: attestationMessage } = await this.socketIterator.next(); @@ -40,6 +42,7 @@ export class CDSISocket extends CDSSocketBase { earliestValidTimestamp ); } + */ this.socket.sendBytes(this.cdsClient.initialRequest()); diff --git a/yarn.lock b/yarn.lock index 89e840ff9..e3b767c74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1745,7 +1745,15 @@ "@react-spring/shared" "~9.4.5" "@react-spring/types" "~9.4.5" -"@signalapp/libsignal-client@0.19.1", "@signalapp/libsignal-client@^0.19.1": +"@signalapp/libsignal-client@0.18.1": + version "0.18.1" + resolved "https://registry.yarnpkg.com/@signalapp/libsignal-client/-/libsignal-client-0.18.1.tgz#6b499cdcc952f1981c6367f68484cf3275be3b31" + integrity sha512-43NcTYpahImlWHBDaNFmn7QaeXZHkFkTtb4m+ZWgzU0mkS1M8V+orGen2XuDvNiu+9HQmW4Lg7FV1deXhWtIRA== + dependencies: + node-gyp-build "^4.2.3" + uuid "^8.3.0" + +"@signalapp/libsignal-client@^0.19.1": version "0.19.1" resolved "https://registry.yarnpkg.com/@signalapp/libsignal-client/-/libsignal-client-0.19.1.tgz#ccc12f0f034fe522940ba176a4518b4a05162b6d" integrity sha512-x6qMjLxoq39oXnoUI8vA1Pd+fitEuYdA828LwBZIY0gxdBVv4D2DNB2kmyiGH2KtqHucnsRSz216gBOWbI2Q/g==