Add LokiAPI.ping(_:)
This commit is contained in:
parent
cdf958ccba
commit
b2309cdf48
|
@ -57,6 +57,10 @@ import PromiseKit
|
|||
return getRandomSnode().then { invoke(.sendMessage, on: $0, with: lokiMessage.toJSON()) } // TODO: Use getSwarm()
|
||||
}
|
||||
|
||||
public static func ping(_ hexEncodedPublicKey: String) -> Promise<RawResponse> {
|
||||
return getRandomSnode().then { invoke(.sendMessage, on: $0, with: [ "destination" : hexEncodedPublicKey ]) } // TODO: Use getSwarm() and figure out correct parameters
|
||||
}
|
||||
|
||||
public static func getSwarm(for hexEncodedPublicKey: String) -> Promise<Set<Target>> {
|
||||
return getRandomSnode().then { invoke(.getSwarm, on: $0, with: [ "pubKey" : hexEncodedPublicKey ]) }.map { rawResponse in return [] } // TODO: Parse targets from raw response
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ public struct LokiMessage {
|
|||
/// The time to live for the message.
|
||||
let ttl: UInt64
|
||||
/// When the proof of work was calculated, if applicable.
|
||||
///
|
||||
/// - Note: Expressed as seconds since 00:00:00 UTC on 1 January 1970.
|
||||
let timestamp: UInt64?
|
||||
/// The base 64 encoded proof of work, if applicable.
|
||||
let nonce: String?
|
||||
|
|
Loading…
Reference in New Issue