mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Make sure prekey ids are non-zero
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
@@ -2653,7 +2653,7 @@ export class SignalProtocolStore extends EventEmitter {
|
||||
[pni]: registrationId,
|
||||
}),
|
||||
(async () => {
|
||||
const newId = wrappingAdd24(signedPreKey.id(), 1);
|
||||
const newId = Math.max(1, wrappingAdd24(signedPreKey.id(), 1));
|
||||
log.warn(`${logId}: Updating next signed pre key id to ${newId}`);
|
||||
await itemStorage.put(SIGNED_PRE_KEY_ID_KEY[ServiceIdKind.PNI], newId);
|
||||
})(),
|
||||
@@ -2671,7 +2671,7 @@ export class SignalProtocolStore extends EventEmitter {
|
||||
if (!lastResortKyberPreKey) {
|
||||
return;
|
||||
}
|
||||
const newId = wrappingAdd24(lastResortKyberPreKey.id(), 1);
|
||||
const newId = Math.max(1, wrappingAdd24(lastResortKyberPreKey.id(), 1));
|
||||
log.warn(`${logId}: Updating next kyber pre key id to ${newId}`);
|
||||
await itemStorage.put(KYBER_KEY_ID_KEY[ServiceIdKind.PNI], newId);
|
||||
})(),
|
||||
|
||||
@@ -477,7 +477,7 @@ export default class AccountManager extends EventTarget {
|
||||
signalProtocolStore.storePreKeys(ourServiceId, toSave),
|
||||
itemStorage.put(
|
||||
PRE_KEY_ID_KEY[serviceIdKind],
|
||||
wrappingAdd24(startId, count)
|
||||
Math.max(1, wrappingAdd24(startId, count))
|
||||
),
|
||||
]);
|
||||
|
||||
@@ -529,7 +529,7 @@ export default class AccountManager extends EventTarget {
|
||||
signalProtocolStore.storeKyberPreKeys(ourServiceId, toSave),
|
||||
itemStorage.put(
|
||||
KYBER_KEY_ID_KEY[serviceIdKind],
|
||||
wrappingAdd24(startId, count)
|
||||
Math.max(1, wrappingAdd24(startId, count))
|
||||
),
|
||||
]);
|
||||
|
||||
@@ -689,7 +689,7 @@ export default class AccountManager extends EventTarget {
|
||||
|
||||
await itemStorage.put(
|
||||
SIGNED_PRE_KEY_ID_KEY[serviceIdKind],
|
||||
wrappingAdd24(signedKeyId, 1)
|
||||
Math.max(1, wrappingAdd24(signedKeyId, 1))
|
||||
);
|
||||
|
||||
return key;
|
||||
@@ -761,7 +761,7 @@ export default class AccountManager extends EventTarget {
|
||||
|
||||
await itemStorage.put(
|
||||
KYBER_KEY_ID_KEY[serviceIdKind],
|
||||
wrappingAdd24(kyberKeyId, 1)
|
||||
Math.max(1, wrappingAdd24(kyberKeyId, 1))
|
||||
);
|
||||
|
||||
return record;
|
||||
|
||||
Reference in New Issue
Block a user