mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Disable authenticated retrieval for now
This commit is contained in:
parent
2c1a473af4
commit
3911fce75f
@ -278,26 +278,26 @@ object SnodeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getRawMessages(snode: Snode, publicKey: String): RawResponsePromise {
|
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
|
// Get last message hash
|
||||||
val lastHashValue = database.getLastMessageHashValue(snode, publicKey) ?: ""
|
val lastHashValue = database.getLastMessageHashValue(snode, publicKey) ?: ""
|
||||||
// Construct signature
|
// Construct signature
|
||||||
val timestamp = Date().time + SnodeAPI.clockOffset
|
// val timestamp = Date().time + SnodeAPI.clockOffset
|
||||||
val ed25519PublicKey = userED25519KeyPair.publicKey.asHexString
|
// val ed25519PublicKey = userED25519KeyPair.publicKey.asHexString
|
||||||
val verificationData = "retrieve$timestamp".toByteArray()
|
// val verificationData = "retrieve$timestamp".toByteArray()
|
||||||
val signature = ByteArray(Sign.BYTES)
|
// val signature = ByteArray(Sign.BYTES)
|
||||||
try {
|
// try {
|
||||||
sodium.cryptoSignDetached(signature, verificationData, verificationData.size.toLong(), userED25519KeyPair.secretKey.asBytes)
|
// sodium.cryptoSignDetached(signature, verificationData, verificationData.size.toLong(), userED25519KeyPair.secretKey.asBytes)
|
||||||
} catch (exception: Exception) {
|
// } catch (exception: Exception) {
|
||||||
return Promise.ofFail(Error.SigningFailed)
|
// return Promise.ofFail(Error.SigningFailed)
|
||||||
}
|
// }
|
||||||
// Make the request
|
// Make the request
|
||||||
val parameters = mapOf(
|
val parameters = mapOf(
|
||||||
"pubKey" to if (useTestnet) publicKey.removing05PrefixIfNeeded() else publicKey,
|
"pubKey" to if (useTestnet) publicKey.removing05PrefixIfNeeded() else publicKey,
|
||||||
"lastHash" to lastHashValue,
|
"lastHash" to lastHashValue,
|
||||||
"timestamp" to timestamp,
|
// "timestamp" to timestamp,
|
||||||
"pubkey_ed25519" to ed25519PublicKey,
|
// "pubkey_ed25519" to ed25519PublicKey,
|
||||||
"signature" to Base64.encodeBytes(signature)
|
// "signature" to Base64.encodeBytes(signature)
|
||||||
)
|
)
|
||||||
return invoke(Snode.Method.GetMessages, snode, publicKey, parameters)
|
return invoke(Snode.Method.GetMessages, snode, publicKey, parameters)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user