2020-12-02 06:38:12 +01:00
|
|
|
package org.session.libsession.snode
|
|
|
|
|
|
|
|
data class SnodeMessage(
|
2021-05-13 02:33:34 +02:00
|
|
|
/**
|
|
|
|
* The hex encoded public key of the recipient.
|
|
|
|
*/
|
2020-12-02 06:38:12 +01:00
|
|
|
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
|
|
|
*/
|
2020-12-02 06:38:12 +01:00
|
|
|
val data: String,
|
2021-05-13 02:33:34 +02:00
|
|
|
/**
|
|
|
|
* The time to live for the message in milliseconds.
|
|
|
|
*/
|
2020-12-02 06:38:12 +01:00
|
|
|
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.
|
|
|
|
*/
|
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(
|
2022-05-18 02:20:57 +02:00
|
|
|
"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
|
|
|
)
|
2020-12-02 06:38:12 +01:00
|
|
|
}
|
|
|
|
}
|