From 6a5a71caadc493916e9c87899a8e3b5ab8421724 Mon Sep 17 00:00:00 2001 From: Shai Mishali Date: Mon, 16 Oct 2023 16:02:33 +0300 Subject: [PATCH] [fix] Derive symmetric key correctly --- OpenHaystack/OpenHaystack/HaystackApp/Model/Accessory.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenHaystack/OpenHaystack/HaystackApp/Model/Accessory.swift b/OpenHaystack/OpenHaystack/HaystackApp/Model/Accessory.swift index cafc7c3..82f32ed 100644 --- a/OpenHaystack/OpenHaystack/HaystackApp/Model/Accessory.swift +++ b/OpenHaystack/OpenHaystack/HaystackApp/Model/Accessory.swift @@ -214,7 +214,7 @@ class Accessory: ObservableObject, Codable, Identifiable, Equatable, Hashable { /// Derive FindMyKeys until we have symmetric key from one week before now while self.lastDerivationTimestamp < Date() - TimeInterval(7 * 24 * 60 * 60) { self.lastDerivationTimestamp.addTimeInterval(self.updateInterval) - self.oldestRelevantSymmetricKey = Accessory.kdf(inputData: self.symmetricKey, sharedInfo: "update".data(using: .ascii)!, bytesToReturn: 32) + self.oldestRelevantSymmetricKey = Accessory.kdf(inputData: self.oldestRelevantSymmetricKey, sharedInfo: "update".data(using: .ascii)!, bytesToReturn: 32) } /// we need to generate Keys from seven days in the past until now and 10 extra keys in case of desynchronization