Use sender+timestamp to cache receipts and read syncs

This commit is contained in:
Scott Nonnenberg 2023-11-02 06:28:49 -07:00 committed by GitHub
parent 8f6fe60342
commit 0b08fc9e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 5 deletions

View file

@ -0,0 +1,16 @@
// Copyright 2016 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
// This function is necessary because the only thing we can guarantee will be unique is
// three pieces of data: sender, deviceId, and timestamp.
// Because we don't care which device interacted with our message, we collapse this down
// to: sender + timestamp.
export function generateCacheKey({
sender,
timestamp,
}: {
sender: string;
timestamp: number;
}): string {
return `cacheKey-${sender}-${timestamp}`;
}