mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 17:59:51 +02:00
Resend key requests when the keys change
This commit is contained in:
parent
bedfd48a65
commit
e103f6f072
1 changed files with 5 additions and 1 deletions
|
@ -116,7 +116,9 @@ object CryptDataHandler {
|
||||||
database.cryptContainer().updateMetadata(updatedMetadata)
|
database.cryptContainer().updateMetadata(updatedMetadata)
|
||||||
|
|
||||||
if (updatedMetadata.status == CryptContainerMetadata.ProcessingStatus.MissingKey && header != null) {
|
if (updatedMetadata.status == CryptContainerMetadata.ProcessingStatus.MissingKey && header != null) {
|
||||||
if (database.cryptContainerKeyRequest().byCryptContainerId(currentItem.cryptContainerId) == null) {
|
val existingRequest = database.cryptContainerKeyRequest().byCryptContainerId(currentItem.cryptContainerId)
|
||||||
|
|
||||||
|
if (existingRequest == null || existingRequest.requestTimeCryptContainerGeneration < header.generation) {
|
||||||
val signingKey = DeviceSigningKey.getPublicAndPrivateKeySync(database)!!.let { Curve25519.getPrivateKey(it) }
|
val signingKey = DeviceSigningKey.getPublicAndPrivateKeySync(database)!!.let { Curve25519.getPrivateKey(it) }
|
||||||
val requestKeyPair = Curve25519.generateKeyPair()
|
val requestKeyPair = Curve25519.generateKeyPair()
|
||||||
val sequenceNumber = database.config().getNextSigningSequenceNumberAndIncrementIt()
|
val sequenceNumber = database.config().getNextSigningSequenceNumberAndIncrementIt()
|
||||||
|
@ -143,6 +145,8 @@ object CryptDataHandler {
|
||||||
), database
|
), database
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (existingRequest != null) database.cryptContainerKeyRequest().delete(existingRequest)
|
||||||
|
|
||||||
database.cryptContainerKeyRequest().insert(
|
database.cryptContainerKeyRequest().insert(
|
||||||
CryptContainerPendingKeyRequest(
|
CryptContainerPendingKeyRequest(
|
||||||
cryptContainerId = currentItem.cryptContainerId,
|
cryptContainerId = currentItem.cryptContainerId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue