session-android/libsession/src/main/java/org/session/libsession/snode/SnodeMessage.kt

24 lines
776 B
Kotlin
Raw Normal View History

package org.session.libsession.snode
2021-04-15 02:42:47 +02:00
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
data class SnodeMessage(
// The hex encoded public key of the recipient.
val recipient: String,
// The content of the message.
val data: String,
// The time to live for the message in milliseconds.
val ttl: Long,
// When the proof of work was calculated.
2021-04-15 02:42:47 +02:00
val timestamp: Long
) {
internal fun toJSON(): Map<String, String> {
return mutableMapOf(
2021-04-15 02:42:47 +02:00
"pubKey" to if (SnodeAPI.useTestnet) recipient.removing05PrefixIfNeeded() else recipient,
"data" to data,
"ttl" to ttl.toString(),
"timestamp" to timestamp.toString(),
2021-04-15 02:42:47 +02:00
"nonce" to "")
}
}