mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-07 00:13:10 +00:00
Cleaning and adjusting types
This commit is contained in:
parent
e718a19713
commit
02ce74d520
107
Cargo.lock
generated
107
Cargo.lock
generated
@ -236,7 +236,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
"rand_core",
|
"rand_core 0.6.4",
|
||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -302,6 +302,18 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fuchsia-cprng"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gcc"
|
||||||
|
version = "0.3.55"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generic-array"
|
name = "generic-array"
|
||||||
version = "0.14.6"
|
version = "0.14.6"
|
||||||
@ -320,7 +332,7 @@ checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -463,7 +475,7 @@ dependencies = [
|
|||||||
"libsecp256k1-core",
|
"libsecp256k1-core",
|
||||||
"libsecp256k1-gen-ecmult",
|
"libsecp256k1-gen-ecmult",
|
||||||
"libsecp256k1-gen-genmult",
|
"libsecp256k1-gen-genmult",
|
||||||
"rand",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
"sha2",
|
"sha2",
|
||||||
"typenum",
|
"typenum",
|
||||||
@ -673,6 +685,29 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.3.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand 0.4.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||||
|
dependencies = [
|
||||||
|
"fuchsia-cprng",
|
||||||
|
"libc",
|
||||||
|
"rand_core 0.3.1",
|
||||||
|
"rdrand",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.8.5"
|
version = "0.8.5"
|
||||||
@ -681,7 +716,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rand_chacha",
|
"rand_chacha",
|
||||||
"rand_core",
|
"rand_core 0.6.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -691,9 +726,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core",
|
"rand_core 0.6.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.4.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.6.4"
|
version = "0.6.4"
|
||||||
@ -703,6 +753,15 @@ dependencies = [
|
|||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rdrand"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@ -720,12 +779,31 @@ version = "0.6.27"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rust-crypto"
|
||||||
|
version = "0.2.36"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
|
||||||
|
dependencies = [
|
||||||
|
"gcc",
|
||||||
|
"libc",
|
||||||
|
"rand 0.3.23",
|
||||||
|
"rustc-serialize",
|
||||||
|
"time",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-hash"
|
name = "rustc-hash"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-serialize"
|
||||||
|
version = "0.3.24"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
@ -882,6 +960,17 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time"
|
||||||
|
version = "0.1.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@ -982,6 +1071,8 @@ dependencies = [
|
|||||||
"libsecp256k1",
|
"libsecp256k1",
|
||||||
"multiaddr",
|
"multiaddr",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"rand 0.8.5",
|
||||||
|
"rust-crypto",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sscanf",
|
"sscanf",
|
||||||
@ -995,6 +1086,12 @@ dependencies = [
|
|||||||
"bindgen",
|
"bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.10.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
|||||||
@ -12,6 +12,8 @@ hex = "0.4"
|
|||||||
libsecp256k1 = "0.7"
|
libsecp256k1 = "0.7"
|
||||||
multiaddr = "0.14"
|
multiaddr = "0.14"
|
||||||
once_cell = "1.15"
|
once_cell = "1.15"
|
||||||
|
rand = "0.8"
|
||||||
|
rust-crypto = "0.2"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
sscanf = "0.3"
|
sscanf = "0.3"
|
||||||
|
|||||||
@ -32,7 +32,7 @@ pub fn waku_decode_symmetric(
|
|||||||
.to_str()
|
.to_str()
|
||||||
.expect("Response should always succeed to load to a &str");
|
.expect("Response should always succeed to load to a &str");
|
||||||
let response: JsonResponse<DecodedPayload> =
|
let response: JsonResponse<DecodedPayload> =
|
||||||
serde_json::from_str(result).expect("JsonResponse should always succeed to deserialize");
|
serde_json::from_str(result).map_err(|e| format!("{e}"))?;
|
||||||
response.into()
|
response.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +60,6 @@ pub fn waku_decode_asymmetric(
|
|||||||
.to_str()
|
.to_str()
|
||||||
.expect("Response should always succeed to load to a &str");
|
.expect("Response should always succeed to load to a &str");
|
||||||
let response: JsonResponse<DecodedPayload> =
|
let response: JsonResponse<DecodedPayload> =
|
||||||
serde_json::from_str(result).expect("JsonResponse should always succeed to deserialize");
|
serde_json::from_str(result).map_err(|e| format!("{e}"))?;
|
||||||
response.into()
|
response.into()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,7 +130,7 @@ impl WakuMessage {
|
|||||||
/// Try decode the message with an expected asymmetric key
|
/// Try decode the message with an expected asymmetric key
|
||||||
///
|
///
|
||||||
/// wrapper around [`crate::decrypt::waku_decode_asymmetric`]
|
/// wrapper around [`crate::decrypt::waku_decode_asymmetric`]
|
||||||
pub fn try_decode_asymmentric(&self, asymmetric_key: &SecretKey) -> Result<DecodedPayload> {
|
pub fn try_decode_asymmetric(&self, asymmetric_key: &SecretKey) -> Result<DecodedPayload> {
|
||||||
waku_decode_asymmetric(self, asymmetric_key)
|
waku_decode_asymmetric(self, asymmetric_key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,8 @@ mod node;
|
|||||||
|
|
||||||
pub use node::{
|
pub use node::{
|
||||||
waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic, waku_new,
|
waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic, waku_new,
|
||||||
Initialized, Protocol, Running, WakuNodeConfig, WakuNodeHandle, WakuPeerData, WakuPeers,
|
waku_store_query, Initialized, Protocol, Running, WakuNodeConfig, WakuNodeHandle, WakuPeerData,
|
||||||
|
WakuPeers,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use general::{
|
pub use general::{
|
||||||
|
|||||||
@ -25,6 +25,7 @@ use crate::general::{
|
|||||||
pub use config::WakuNodeConfig;
|
pub use config::WakuNodeConfig;
|
||||||
pub use peers::{Protocol, WakuPeerData, WakuPeers};
|
pub use peers::{Protocol, WakuPeerData, WakuPeers};
|
||||||
pub use relay::{waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic};
|
pub use relay::{waku_create_content_topic, waku_create_pubsub_topic, waku_dafault_pubsub_topic};
|
||||||
|
pub use store::waku_store_query;
|
||||||
|
|
||||||
/// Shared flag to check if a waku node is already running in the current process
|
/// Shared flag to check if a waku node is already running in the current process
|
||||||
static WAKU_NODE_INITIALIZED: Mutex<bool> = Mutex::new(false);
|
static WAKU_NODE_INITIALIZED: Mutex<bool> = Mutex::new(false);
|
||||||
@ -173,7 +174,7 @@ impl WakuNodeHandle<Running> {
|
|||||||
pubsub_topic: Option<WakuPubSubTopic>,
|
pubsub_topic: Option<WakuPubSubTopic>,
|
||||||
public_key: &PublicKey,
|
public_key: &PublicKey,
|
||||||
signing_key: Option<&SecretKey>,
|
signing_key: Option<&SecretKey>,
|
||||||
timeout: Duration,
|
timeout: Option<Duration>,
|
||||||
) -> Result<MessageId> {
|
) -> Result<MessageId> {
|
||||||
relay::waku_relay_publish_encrypt_asymmetric(
|
relay::waku_relay_publish_encrypt_asymmetric(
|
||||||
message,
|
message,
|
||||||
@ -191,9 +192,9 @@ impl WakuNodeHandle<Running> {
|
|||||||
&self,
|
&self,
|
||||||
message: &WakuMessage,
|
message: &WakuMessage,
|
||||||
pubsub_topic: Option<WakuPubSubTopic>,
|
pubsub_topic: Option<WakuPubSubTopic>,
|
||||||
symmetric_key: &Key<Aes256Gcm>,
|
symmetric_key: &PublicKey,
|
||||||
signing_key: Option<&SecretKey>,
|
signing_key: Option<&SecretKey>,
|
||||||
timeout: Duration,
|
timeout: Option<Duration>,
|
||||||
) -> Result<MessageId> {
|
) -> Result<MessageId> {
|
||||||
relay::waku_relay_publish_encrypt_symmetric(
|
relay::waku_relay_publish_encrypt_symmetric(
|
||||||
message,
|
message,
|
||||||
|
|||||||
@ -114,7 +114,7 @@ pub fn waku_relay_publish_encrypt_asymmetric(
|
|||||||
pubsub_topic: Option<WakuPubSubTopic>,
|
pubsub_topic: Option<WakuPubSubTopic>,
|
||||||
public_key: &PublicKey,
|
public_key: &PublicKey,
|
||||||
signing_key: Option<&SecretKey>,
|
signing_key: Option<&SecretKey>,
|
||||||
timeout: Duration,
|
timeout: Option<Duration>,
|
||||||
) -> Result<MessageId> {
|
) -> Result<MessageId> {
|
||||||
let pk = hex::encode(public_key.serialize());
|
let pk = hex::encode(public_key.serialize());
|
||||||
let sk = signing_key
|
let sk = signing_key
|
||||||
@ -140,10 +140,14 @@ pub fn waku_relay_publish_encrypt_asymmetric(
|
|||||||
CString::new(sk)
|
CString::new(sk)
|
||||||
.expect("CString should build properly from hex encoded signing key")
|
.expect("CString should build properly from hex encoded signing key")
|
||||||
.into_raw(),
|
.into_raw(),
|
||||||
|
timeout
|
||||||
|
.map(|timeout| {
|
||||||
timeout
|
timeout
|
||||||
.as_millis()
|
.as_millis()
|
||||||
.try_into()
|
.try_into()
|
||||||
.expect("Duration as milliseconds should fit in a i32"),
|
.expect("Duration as milliseconds should fit in a i32")
|
||||||
|
})
|
||||||
|
.unwrap_or(0),
|
||||||
))
|
))
|
||||||
.to_str()
|
.to_str()
|
||||||
.expect("Response should always succeed to load to a &str")
|
.expect("Response should always succeed to load to a &str")
|
||||||
@ -158,11 +162,11 @@ pub fn waku_relay_publish_encrypt_asymmetric(
|
|||||||
pub fn waku_relay_publish_encrypt_symmetric(
|
pub fn waku_relay_publish_encrypt_symmetric(
|
||||||
message: &WakuMessage,
|
message: &WakuMessage,
|
||||||
pubsub_topic: Option<WakuPubSubTopic>,
|
pubsub_topic: Option<WakuPubSubTopic>,
|
||||||
symmetric_key: &Key<Aes256Gcm>,
|
symmetric_key: &PublicKey,
|
||||||
signing_key: Option<&SecretKey>,
|
signing_key: Option<&SecretKey>,
|
||||||
timeout: Duration,
|
timeout: Option<Duration>,
|
||||||
) -> Result<MessageId> {
|
) -> Result<MessageId> {
|
||||||
let symk = hex::encode(symmetric_key.as_slice());
|
let symk = hex::encode(symmetric_key.serialize());
|
||||||
let sk = signing_key
|
let sk = signing_key
|
||||||
.map(|signing_key| hex::encode(signing_key.serialize()))
|
.map(|signing_key| hex::encode(signing_key.serialize()))
|
||||||
.unwrap_or_else(String::new);
|
.unwrap_or_else(String::new);
|
||||||
@ -186,10 +190,14 @@ pub fn waku_relay_publish_encrypt_symmetric(
|
|||||||
CString::new(sk)
|
CString::new(sk)
|
||||||
.expect("CString should build properly from hex encoded signing key")
|
.expect("CString should build properly from hex encoded signing key")
|
||||||
.into_raw(),
|
.into_raw(),
|
||||||
|
timeout
|
||||||
|
.map(|timeout| {
|
||||||
timeout
|
timeout
|
||||||
.as_millis()
|
.as_millis()
|
||||||
.try_into()
|
.try_into()
|
||||||
.expect("Duration as milliseconds should fit in a i32"),
|
.expect("Duration as milliseconds should fit in a i32")
|
||||||
|
})
|
||||||
|
.unwrap_or(0),
|
||||||
))
|
))
|
||||||
.to_str()
|
.to_str()
|
||||||
.expect("Response should always succeed to load to a &str")
|
.expect("Response should always succeed to load to a &str")
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
|
use aes_gcm::{Aes256Gcm, KeyInit};
|
||||||
|
use libsecp256k1::PublicKey;
|
||||||
use multiaddr::Multiaddr;
|
use multiaddr::Multiaddr;
|
||||||
|
use rand::thread_rng;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::{Duration, SystemTime};
|
use std::time::{Duration, SystemTime};
|
||||||
@ -39,10 +42,31 @@ pub fn main() -> Result<(), String> {
|
|||||||
assert!(node.peer_count()? >= NODES.len());
|
assert!(node.peer_count()? >= NODES.len());
|
||||||
|
|
||||||
assert!(node.relay_enough_peers(None)?);
|
assert!(node.relay_enough_peers(None)?);
|
||||||
|
let sk = libsecp256k1::SecretKey::random(&mut thread_rng());
|
||||||
|
let pk = PublicKey::from_secret_key(&sk);
|
||||||
|
let ssk = Aes256Gcm::generate_key(&mut thread_rng());
|
||||||
|
|
||||||
waku_set_event_callback(|signal| match signal.event() {
|
let content = "Hi from 🦀!";
|
||||||
|
let content_callback = content.clone();
|
||||||
|
|
||||||
|
waku_set_event_callback(move |signal| match signal.event() {
|
||||||
Event::WakuMessage(message) => {
|
Event::WakuMessage(message) => {
|
||||||
println!("Message with id [{}] received", message.message_id());
|
println!("Message with id [{}] received", message.message_id());
|
||||||
|
let message = message.waku_message();
|
||||||
|
let payload = if let Ok(message) = message.try_decode_asymmetric(&sk) {
|
||||||
|
println!("Asymemetry message");
|
||||||
|
message.data().to_vec()
|
||||||
|
} else if let Ok(message) = message.try_decode_symmetric(&ssk) {
|
||||||
|
println!("Symemetry message");
|
||||||
|
message.data().to_vec()
|
||||||
|
} else {
|
||||||
|
println!("Unencoded message");
|
||||||
|
message.payload().to_vec()
|
||||||
|
};
|
||||||
|
let message_content: String =
|
||||||
|
String::from_utf8(payload).expect("Message should be able to be read");
|
||||||
|
println!("Message content: {message_content}");
|
||||||
|
assert_eq!(message_content, content_callback);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
println!("Wtf is this event?");
|
println!("Wtf is this event?");
|
||||||
@ -59,7 +83,7 @@ pub fn main() -> Result<(), String> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let message = WakuMessage::new(
|
let message = WakuMessage::new(
|
||||||
"Hi from 🦀!",
|
content,
|
||||||
content_topic,
|
content_topic,
|
||||||
1,
|
1,
|
||||||
SystemTime::now()
|
SystemTime::now()
|
||||||
@ -70,7 +94,11 @@ pub fn main() -> Result<(), String> {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
node.relay_publish_message(&message, None, None)?;
|
// node.relay_publish_message(&message, None, None)?;
|
||||||
|
|
||||||
|
node.relay_publish_encrypt_asymmetric(&message, None, &pk, Some(&sk), None)?;
|
||||||
|
// node.relay_publish_encrypt_symmetric(&message, None, &pk, None, None)?;
|
||||||
|
|
||||||
std::thread::sleep(Duration::from_secs(2));
|
std::thread::sleep(Duration::from_secs(2));
|
||||||
node.stop()?;
|
node.stop()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user