diff --git a/spec/integ/sliding-sync-sdk.spec.ts b/spec/integ/sliding-sync-sdk.spec.ts index 50fe0652e..37fcd879f 100644 --- a/spec/integ/sliding-sync-sdk.spec.ts +++ b/spec/integ/sliding-sync-sdk.spec.ts @@ -671,32 +671,17 @@ describe("SlidingSyncSdk", () => { // TODO: more assertions? }); - it("can update OTK counts", () => { - client!.crypto!.updateOneTimeKeyCount = jest.fn(); + it("can update OTK counts and unused fallback keys", () => { + client!.crypto!.processKeyCounts = jest.fn(); ext.onResponse({ device_one_time_keys_count: { signed_curve25519: 42, }, - }); - expect(client!.crypto!.updateOneTimeKeyCount).toHaveBeenCalledWith(42); - ext.onResponse({ - device_one_time_keys_count: { - not_signed_curve25519: 42, - // missing field -> default to 0 - }, - }); - expect(client!.crypto!.updateOneTimeKeyCount).toHaveBeenCalledWith(0); - }); - - it("can update fallback keys", () => { - ext.onResponse({ device_unused_fallback_key_types: ["signed_curve25519"], }); - expect(client!.crypto!.getNeedsNewFallback()).toEqual(false); - ext.onResponse({ - device_unused_fallback_key_types: ["not_signed_curve25519"], - }); - expect(client!.crypto!.getNeedsNewFallback()).toEqual(true); + expect(client!.crypto!.processKeyCounts).toHaveBeenCalledWith({ signed_curve25519: 42 }, [ + "signed_curve25519", + ]); }); }); diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 4c10b1c16..3c787a0c2 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -1817,31 +1817,6 @@ export class Crypto extends TypedEventEmitter, unusedFallbackKeys?: string[]): Promise { if (oneTimeKeysCounts !== undefined) { this.updateOneTimeKeyCount(oneTimeKeysCounts["signed_curve25519"] || 0); @@ -3232,7 +3221,7 @@ export class Crypto extends TypedEventEmitter