Require PQ pre-keys from the server

This commit is contained in:
Alex Bakon
2025-05-19 10:45:43 -04:00
committed by GitHub
parent 70cdf8c537
commit 33c1c39da4
3 changed files with 16 additions and 13 deletions

View File

@@ -220,7 +220,7 @@
"@indutny/parallel-prettier": "3.0.0",
"@indutny/rezip-electron": "2.0.1",
"@napi-rs/canvas": "0.1.61",
"@signalapp/mock-server": "11.3.0",
"@signalapp/mock-server": "11.3.1",
"@storybook/addon-a11y": "8.4.4",
"@storybook/addon-actions": "8.4.4",
"@storybook/addon-controls": "8.4.4",

10
pnpm-lock.yaml generated
View File

@@ -424,8 +424,8 @@ importers:
specifier: 0.1.61
version: 0.1.61
'@signalapp/mock-server':
specifier: 11.3.0
version: 11.3.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)
specifier: 11.3.1
version: 11.3.1(bufferutil@4.0.9)(utf-8-validate@5.0.10)
'@storybook/addon-a11y':
specifier: 8.4.4
version: 8.4.4(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))
@@ -2540,8 +2540,8 @@ packages:
'@signalapp/libsignal-client@0.72.1':
resolution: {integrity: sha512-YFIxrp8KVo0+q3lZBw/CEFbnPNbUsmfD3JRLu1cWH2nDLbAGwVzmbOGAzhXDzui5jO2PyEr8wXKqRpVbNKy1pw==}
'@signalapp/mock-server@11.3.0':
resolution: {integrity: sha512-X/yqrDySJ51bRngjMJrIGDhOU/LQ7OI9vJFNrs0835bgdBPGQO1pyufndzKLJpPehMECzGIP0UCE9YZU1X6NIg==}
'@signalapp/mock-server@11.3.1':
resolution: {integrity: sha512-nh/ynnz/3728M0Eh4BAa0kVcpSml6nyF9Vb2AV3WhlZ1VYJe5+IlshXfs57XwNghg4bHhOr9hVxIKuw/QK6ptg==}
'@signalapp/parchment-cjs@3.0.1':
resolution: {integrity: sha512-hSBMQ1M7wE4GcC8ZeNtvpJF+DAJg3eIRRf1SiHS3I3Algav/sgJJNm6HIYm6muHuK7IJmuEjkL3ILSXgmu0RfQ==}
@@ -12040,7 +12040,7 @@ snapshots:
type-fest: 4.26.1
uuid: 11.0.2
'@signalapp/mock-server@11.3.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
'@signalapp/mock-server@11.3.1(bufferutil@4.0.9)(utf-8-validate@5.0.10)':
dependencies:
'@indutny/parallel-prettier': 3.0.0(prettier@3.3.3)
'@signalapp/libsignal-client': 0.60.2

View File

@@ -141,6 +141,11 @@ async function handleServerKeys(
`getKeysForIdentifier/${serviceId}: Missing signed prekey for deviceId ${deviceId}`
);
}
if (!pqPreKey) {
throw new Error(
`getKeysForIdentifier/${serviceId}: Missing signed PQ prekey for deviceId ${deviceId}`
);
}
const protocolAddress = ProtocolAddress.new(serviceId, deviceId);
const preKeyId = preKey?.keyId || null;
const preKeyObject = preKey
@@ -153,13 +158,11 @@ async function handleServerKeys(
Buffer.from(response.identityKey)
);
const pqPreKeyId = pqPreKey?.keyId || null;
const pqPreKeyPublic = pqPreKey
? KEMPublicKey.deserialize(Buffer.from(pqPreKey.publicKey))
: null;
const pqPreKeySignature = pqPreKey
? Buffer.from(pqPreKey.signature)
: null;
const pqPreKeyId = pqPreKey.keyId;
const pqPreKeyPublic = KEMPublicKey.deserialize(
Buffer.from(pqPreKey.publicKey)
);
const pqPreKeySignature = Buffer.from(pqPreKey.signature);
const preKeyBundle = PreKeyBundle.new(
registrationId,