Disable authenticated retrieval for now
This commit is contained in:
parent
c90009d5fd
commit
140f07df96
|
@ -413,22 +413,22 @@ public final class SnodeAPI : NSObject {
|
||||||
|
|
||||||
private static func getMessagesInternal(from snode: Snode, associatedWith publicKey: String) -> RawResponsePromise {
|
private static func getMessagesInternal(from snode: Snode, associatedWith publicKey: String) -> RawResponsePromise {
|
||||||
let storage = SNSnodeKitConfiguration.shared.storage
|
let storage = SNSnodeKitConfiguration.shared.storage
|
||||||
guard let userED25519KeyPair = storage.getUserED25519KeyPair() else { return Promise(error: Error.noKeyPair) }
|
// guard let userED25519KeyPair = storage.getUserED25519KeyPair() else { return Promise(error: Error.noKeyPair) }
|
||||||
// Get last message hash
|
// Get last message hash
|
||||||
storage.pruneLastMessageHashInfoIfExpired(for: snode, associatedWith: publicKey)
|
storage.pruneLastMessageHashInfoIfExpired(for: snode, associatedWith: publicKey)
|
||||||
let lastHash = storage.getLastMessageHash(for: snode, associatedWith: publicKey) ?? ""
|
let lastHash = storage.getLastMessageHash(for: snode, associatedWith: publicKey) ?? ""
|
||||||
// Construct signature
|
// Construct signature
|
||||||
let timestamp = UInt64(Int64(NSDate.millisecondTimestamp()) + SnodeAPI.clockOffset)
|
// let timestamp = UInt64(Int64(NSDate.millisecondTimestamp()) + SnodeAPI.clockOffset)
|
||||||
let ed25519PublicKey = userED25519KeyPair.publicKey.toHexString()
|
// let ed25519PublicKey = userED25519KeyPair.publicKey.toHexString()
|
||||||
let verificationData = ("retrieve" + String(timestamp)).data(using: String.Encoding.utf8)!
|
// let verificationData = ("retrieve" + String(timestamp)).data(using: String.Encoding.utf8)!
|
||||||
let signature = sodium.sign.signature(message: Bytes(verificationData), secretKey: userED25519KeyPair.secretKey)!
|
// let signature = sodium.sign.signature(message: Bytes(verificationData), secretKey: userED25519KeyPair.secretKey)!
|
||||||
// Make the request
|
// Make the request
|
||||||
let parameters: JSON = [
|
let parameters: JSON = [
|
||||||
"pubKey" : Features.useTestnet ? publicKey.removing05PrefixIfNeeded() : publicKey,
|
"pubKey" : Features.useTestnet ? publicKey.removing05PrefixIfNeeded() : publicKey,
|
||||||
"lastHash" : lastHash,
|
"lastHash" : lastHash,
|
||||||
"timestamp" : timestamp,
|
// "timestamp" : timestamp,
|
||||||
"pubkey_ed25519" : ed25519PublicKey,
|
// "pubkey_ed25519" : ed25519PublicKey,
|
||||||
"signature" : signature.toBase64()!
|
// "signature" : signature.toBase64()!
|
||||||
]
|
]
|
||||||
return invoke(.getMessages, on: snode, associatedWith: publicKey, parameters: parameters)
|
return invoke(.getMessages, on: snode, associatedWith: publicKey, parameters: parameters)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue