Add documentation

This commit is contained in:
Niels Andriesse 2021-05-13 10:33:34 +10:00
parent 115bc9b159
commit 288d76d292
2 changed files with 23 additions and 13 deletions

View File

@ -71,11 +71,11 @@ object OnionRequestEncryption {
} }
is OnionRequestAPI.Destination.Server -> { is OnionRequestAPI.Destination.Server -> {
payload = mutableMapOf( payload = mutableMapOf(
"host" to rhs.host, "host" to rhs.host,
"target" to rhs.target, "target" to rhs.target,
"method" to "POST", "method" to "POST",
"protocol" to rhs.scheme, "protocol" to rhs.scheme,
"port" to rhs.port "port" to rhs.port
) )
} }
} }

View File

@ -3,23 +3,33 @@ package org.session.libsession.snode
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
data class SnodeMessage( data class SnodeMessage(
// The hex encoded public key of the recipient. /**
* The hex encoded public key of the recipient.
*/
val recipient: String, val recipient: String,
// The content of the message. /**
* The content of the message.
*/
val data: String, val data: String,
// The time to live for the message in milliseconds. /**
* The time to live for the message in milliseconds.
*/
val ttl: Long, val ttl: Long,
// When the proof of work was calculated. /**
* When the proof of work was calculated.
*
* **Note:** Expressed as milliseconds since 00:00:00 UTC on 1 January 1970.
*/
val timestamp: Long val timestamp: Long
) { ) {
internal fun toJSON(): Map<String, String> { internal fun toJSON(): Map<String, String> {
return mapOf( return mapOf(
"pubKey" to if (SnodeAPI.useTestnet) recipient.removing05PrefixIfNeeded() else recipient, "pubKey" to if (SnodeAPI.useTestnet) recipient.removing05PrefixIfNeeded() else recipient,
"data" to data, "data" to data,
"ttl" to ttl.toString(), "ttl" to ttl.toString(),
"timestamp" to timestamp.toString(), "timestamp" to timestamp.toString(),
"nonce" to "" "nonce" to ""
) )
} }
} }