mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
feat: add all namespaces to delete all messages request and signature verification data
This commit is contained in:
parent
db277e1d30
commit
4d14ec0564
@ -28,6 +28,7 @@ import org.session.libsignal.utilities.HTTP
|
|||||||
import org.session.libsignal.utilities.Hex
|
import org.session.libsignal.utilities.Hex
|
||||||
import org.session.libsignal.utilities.JsonUtil
|
import org.session.libsignal.utilities.JsonUtil
|
||||||
import org.session.libsignal.utilities.Log
|
import org.session.libsignal.utilities.Log
|
||||||
|
import org.session.libsignal.utilities.Namespace
|
||||||
import org.session.libsignal.utilities.Snode
|
import org.session.libsignal.utilities.Snode
|
||||||
import org.session.libsignal.utilities.ThreadUtils
|
import org.session.libsignal.utilities.ThreadUtils
|
||||||
import org.session.libsignal.utilities.prettifiedDescription
|
import org.session.libsignal.utilities.prettifiedDescription
|
||||||
@ -740,13 +741,14 @@ object SnodeAPI {
|
|||||||
retryIfNeeded(maxRetryCount) {
|
retryIfNeeded(maxRetryCount) {
|
||||||
getNetworkTime(snode).bind { (_, timestamp) ->
|
getNetworkTime(snode).bind { (_, timestamp) ->
|
||||||
val signature = ByteArray(Sign.BYTES)
|
val signature = ByteArray(Sign.BYTES)
|
||||||
val verificationData = (Snode.Method.DeleteAll.rawValue + timestamp.toString()).toByteArray()
|
val verificationData = (Snode.Method.DeleteAll.rawValue + Namespace.ALL + timestamp.toString()).toByteArray()
|
||||||
sodium.cryptoSignDetached(signature, verificationData, verificationData.size.toLong(), userED25519KeyPair.secretKey.asBytes)
|
sodium.cryptoSignDetached(signature, verificationData, verificationData.size.toLong(), userED25519KeyPair.secretKey.asBytes)
|
||||||
val deleteMessageParams = mapOf(
|
val deleteMessageParams = mapOf(
|
||||||
"pubkey" to userPublicKey,
|
"pubkey" to userPublicKey,
|
||||||
"pubkey_ed25519" to userED25519KeyPair.publicKey.asHexString,
|
"pubkey_ed25519" to userED25519KeyPair.publicKey.asHexString,
|
||||||
"timestamp" to timestamp,
|
"timestamp" to timestamp,
|
||||||
"signature" to Base64.encodeBytes(signature)
|
"signature" to Base64.encodeBytes(signature),
|
||||||
|
"namespace" to Namespace.ALL,
|
||||||
)
|
)
|
||||||
invoke(Snode.Method.DeleteAll, snode, deleteMessageParams, userPublicKey).map {
|
invoke(Snode.Method.DeleteAll, snode, deleteMessageParams, userPublicKey).map {
|
||||||
rawResponse -> parseDeletions(userPublicKey, timestamp, rawResponse)
|
rawResponse -> parseDeletions(userPublicKey, timestamp, rawResponse)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.session.libsignal.utilities
|
package org.session.libsignal.utilities
|
||||||
|
|
||||||
object Namespace {
|
object Namespace {
|
||||||
|
const val ALL = "all"
|
||||||
const val DEFAULT = 0
|
const val DEFAULT = 0
|
||||||
const val UNAUTHENTICATED_CLOSED_GROUP = -10
|
const val UNAUTHENTICATED_CLOSED_GROUP = -10
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user