From edb5ff09e92c8c5bf4a1e353a27684ed3a8b8edc Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:27:34 +1100 Subject: [PATCH] fix: add optional namespace in signature and params --- .../main/java/org/session/libsession/snode/SnodeAPI.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 f875971692..e878c85769 100644 --- a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt +++ b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt @@ -373,7 +373,8 @@ object SnodeAPI { val ed25519PublicKey = userEd25519KeyPair.publicKey.asHexString val timestamp = System.currentTimeMillis() + clockOffset val signature = ByteArray(Sign.BYTES) - val verificationData = "retrieve$namespace$timestamp".toByteArray() + val verificationData = if (namespace == 0) "retrieve$timestamp".toByteArray() + else "retrieve$namespace$timestamp".toByteArray() try { sodium.cryptoSignDetached( signature, @@ -385,8 +386,11 @@ object SnodeAPI { return null } params["timestamp"] = timestamp -// params["pubkey_ed25519"] = ed25519PublicKey + params["pubkey_ed25519"] = ed25519PublicKey params["signature"] = Base64.encodeBytes(signature) + if (namespace != 0) { + params["namespace"] = namespace + } return SnodeBatchRequestInfo( Snode.Method.Retrieve.rawValue, params