From 3911fce75f197c21426ffbfbcc5ad713dd43578b Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 27 Jul 2021 10:38:05 +1000 Subject: [PATCH] Disable authenticated retrieval for now --- .../org/session/libsession/snode/SnodeAPI.kt | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt index 370ba99188..4da3409d04 100644 --- a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt +++ b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt @@ -278,26 +278,26 @@ object SnodeAPI { } fun getRawMessages(snode: Snode, publicKey: String): RawResponsePromise { - val userED25519KeyPair = MessagingModuleConfiguration.shared.getUserED25519KeyPair() ?: return Promise.ofFail(Error.NoKeyPair) +// val userED25519KeyPair = MessagingModuleConfiguration.shared.getUserED25519KeyPair() ?: return Promise.ofFail(Error.NoKeyPair) // Get last message hash val lastHashValue = database.getLastMessageHashValue(snode, publicKey) ?: "" // Construct signature - val timestamp = Date().time + SnodeAPI.clockOffset - val ed25519PublicKey = userED25519KeyPair.publicKey.asHexString - val verificationData = "retrieve$timestamp".toByteArray() - val signature = ByteArray(Sign.BYTES) - try { - sodium.cryptoSignDetached(signature, verificationData, verificationData.size.toLong(), userED25519KeyPair.secretKey.asBytes) - } catch (exception: Exception) { - return Promise.ofFail(Error.SigningFailed) - } +// val timestamp = Date().time + SnodeAPI.clockOffset +// val ed25519PublicKey = userED25519KeyPair.publicKey.asHexString +// val verificationData = "retrieve$timestamp".toByteArray() +// val signature = ByteArray(Sign.BYTES) +// try { +// sodium.cryptoSignDetached(signature, verificationData, verificationData.size.toLong(), userED25519KeyPair.secretKey.asBytes) +// } catch (exception: Exception) { +// return Promise.ofFail(Error.SigningFailed) +// } // Make the request val parameters = mapOf( "pubKey" to if (useTestnet) publicKey.removing05PrefixIfNeeded() else publicKey, "lastHash" to lastHashValue, - "timestamp" to timestamp, - "pubkey_ed25519" to ed25519PublicKey, - "signature" to Base64.encodeBytes(signature) +// "timestamp" to timestamp, +// "pubkey_ed25519" to ed25519PublicKey, +// "signature" to Base64.encodeBytes(signature) ) return invoke(Snode.Method.GetMessages, snode, publicKey, parameters) }