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

33 lines
755 B
Kotlin
Raw Normal View History

package org.session.libsession.snode
data class SnodeMessage(
2021-05-13 02:33:34 +02:00
/**
* The hex encoded public key of the recipient.
*/
val recipient: String,
2021-05-13 02:33:34 +02:00
/**
2021-06-02 01:38:22 +02:00
* The base64 encoded content of the message.
2021-05-13 02:33:34 +02:00
*/
val data: String,
2021-05-13 02:33:34 +02:00
/**
* The time to live for the message in milliseconds.
*/
val ttl: Long,
2021-05-13 02:33:34 +02:00
/**
* When the proof of work was calculated.
*
* **Note:** Expressed as milliseconds since 00:00:00 UTC on 1 January 1970.
*/
val timestamp: Long
) {
2021-04-26 02:26:31 +02:00
internal fun toJSON(): Map<String, String> {
2021-04-26 02:26:31 +02:00
return mapOf(
"pubKey" to recipient,
2021-05-13 02:33:34 +02:00
"data" to data,
"ttl" to ttl.toString(),
"timestamp" to timestamp.toString(),
2021-04-26 02:26:31 +02:00
)
}
}