Clean up old one-time prekeys.

This commit is contained in:
Greyson Parrelli
2023-08-11 12:38:03 -04:00
committed by Cody Henthorne
parent 389b439e9a
commit d6adfea9b1
18 changed files with 572 additions and 11 deletions

View File

@@ -79,6 +79,14 @@ class BufferedKyberPreKeyStore(private val selfServiceId: ServiceId) : SignalSer
error("Not expected in this flow")
}
override fun markAllOneTimeKyberPreKeysStaleIfNecessary(staleTime: Long) {
error("Not expected in this flow")
}
override fun deleteAllStaleOneTimeKyberPreKeys(threshold: Long, minCount: Int) {
error("Not expected in this flow")
}
fun flushToDisk(persistentStore: SignalServiceAccountDataStore) {
for (id in removedIfNotLastResort) {
persistentStore.markKyberPreKeyUsed(id)

View File

@@ -141,10 +141,26 @@ class BufferedSignalServiceAccountDataStore(selfServiceId: ServiceId) : SignalSe
return kyberPreKeyStore.markKyberPreKeyUsed(kyberPreKeyId)
}
override fun deleteAllStaleOneTimeEcPreKeys(threshold: Long, minCount: Int) {
error("Should not happen during the intended usage pattern of this class")
}
override fun markAllOneTimeEcPreKeysStaleIfNecessary(staleTime: Long) {
error("Should not happen during the intended usage pattern of this class")
}
override fun removeKyberPreKey(kyberPreKeyId: Int) {
kyberPreKeyStore.removeKyberPreKey(kyberPreKeyId)
}
override fun markAllOneTimeKyberPreKeysStaleIfNecessary(staleTime: Long) {
kyberPreKeyStore.markAllOneTimeKyberPreKeysStaleIfNecessary(staleTime)
}
override fun deleteAllStaleOneTimeKyberPreKeys(threshold: Long, minCount: Int) {
kyberPreKeyStore.deleteAllStaleOneTimeKyberPreKeys(threshold, minCount)
}
override fun loadLastResortKyberPreKeys(): List<KyberPreKeyRecord> {
return kyberPreKeyStore.loadLastResortKyberPreKeys()
}