Merge pull request #630 from vector-im/bwindels/otk-count-cleanup

Missing OTK count in sync doesn't mean 0, but rather no change
This commit is contained in:
Bruno Windels 2022-01-05 14:29:51 +01:00 committed by GitHub
commit 196e3726cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,7 @@ export class Account {
// We need to keep a pool of one time public keys on the server so that // We need to keep a pool of one time public keys on the server so that
// other devices can start conversations with us. But we can only store // other devices can start conversations with us. But we can only store
// a finite number of private keys in the olm Account object. // a finite number of private keys in the olm Account object.
// To complicate things further then can be a delay between a device // To complicate things further there can be a delay between a device
// claiming a public one time key from the server and it sending us a // claiming a public one time key from the server and it sending us a
// message. We need to keep the corresponding private key locally until // message. We need to keep the corresponding private key locally until
// we receive the message. // we receive the message.
@ -231,7 +231,7 @@ export class Account {
writeSync(deviceOneTimeKeysCount, txn, log) { writeSync(deviceOneTimeKeysCount, txn, log) {
// we only upload signed_curve25519 otks // we only upload signed_curve25519 otks
const otkCount = deviceOneTimeKeysCount.signed_curve25519 || 0; const otkCount = deviceOneTimeKeysCount.signed_curve25519;
if (Number.isSafeInteger(otkCount) && otkCount !== this._serverOTKCount) { if (Number.isSafeInteger(otkCount) && otkCount !== this._serverOTKCount) {
txn.session.set(SERVER_OTK_COUNT_SESSION_KEY, otkCount); txn.session.set(SERVER_OTK_COUNT_SESSION_KEY, otkCount);
log.set("otkCount", otkCount); log.set("otkCount", otkCount);