diff --git a/SignalServiceKit/src/Loki/API/LokiAPI+Message.swift b/SignalServiceKit/src/Loki/API/LokiAPI+Message.swift index 2d280d2d2..188a965bc 100644 --- a/SignalServiceKit/src/Loki/API/LokiAPI+Message.swift +++ b/SignalServiceKit/src/Loki/API/LokiAPI+Message.swift @@ -40,7 +40,8 @@ public extension LokiAPI { if isPoWRequired { // The storage server takes a time interval in milliseconds let now = NSDate.ows_millisecondTimeStamp() - if let nonce = ProofOfWork.calculate(data: data, pubKey: destination, timestamp: now, ttl: ttl) { + let ttlInSeconds = ttl / 1000 + if let nonce = ProofOfWork.calculate(data: data, pubKey: destination, timestamp: now, ttl: ttlInSeconds) { let result = Message(destination: destination, data: data, ttl: ttl, timestamp: now, nonce: nonce) seal.fulfill(result) } else { diff --git a/SignalServiceKit/src/Loki/Crypto/ProofOfWork.swift b/SignalServiceKit/src/Loki/Crypto/ProofOfWork.swift index 7d2afd2a2..ccebf790e 100644 --- a/SignalServiceKit/src/Loki/Crypto/ProofOfWork.swift +++ b/SignalServiceKit/src/Loki/Crypto/ProofOfWork.swift @@ -63,7 +63,7 @@ public enum ProofOfWork { /// - data: The message data /// - pubKey: The message recipient /// - timestamp: The timestamp - /// - ttl: The message time to live + /// - ttl: The message time to live, in **seconds** /// - Returns: A nonce string or `nil` if it failed public static func calculate(data: String, pubKey: String, timestamp: UInt64, ttl: UInt64) -> String? { let payload = createPayload(pubKey: pubKey, data: data, timestamp: timestamp, ttl: ttl)