2020-12-02 06:38:12 +01:00
|
|
|
package org.session.libsession.snode
|
|
|
|
|
2021-04-20 09:22:36 +02:00
|
|
|
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
|
|
|
|
2020-12-02 06:38:12 +01:00
|
|
|
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-20 09:22:36 +02:00
|
|
|
val timestamp: Long
|
2020-12-02 06:38:12 +01:00
|
|
|
) {
|
2021-04-26 02:26:31 +02:00
|
|
|
|
2020-12-02 06:38:12 +01:00
|
|
|
internal fun toJSON(): Map<String, String> {
|
2021-04-26 02:26:31 +02:00
|
|
|
return mapOf(
|
|
|
|
"pubKey" to if (SnodeAPI.useTestnet) recipient.removing05PrefixIfNeeded() else recipient,
|
2020-12-02 06:38:12 +01:00
|
|
|
"data" to data,
|
|
|
|
"ttl" to ttl.toString(),
|
|
|
|
"timestamp" to timestamp.toString(),
|
2021-04-28 09:41:30 +02:00
|
|
|
"nonce" to ""
|
2021-04-26 02:26:31 +02:00
|
|
|
)
|
2020-12-02 06:38:12 +01:00
|
|
|
}
|
|
|
|
}
|