Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3488470
D6460.id22888.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
817 B
Referenced Files
None
Subscribers
None
D6460.id22888.diff
View Options
diff --git a/keyserver/addons/rust-node-addon/src/tunnelbroker_client.rs b/keyserver/addons/rust-node-addon/src/tunnelbroker_client.rs
--- a/keyserver/addons/rust-node-addon/src/tunnelbroker_client.rs
+++ b/keyserver/addons/rust-node-addon/src/tunnelbroker_client.rs
@@ -64,4 +64,23 @@
});
TunnelbrokerClient { tx }
}
+
+ #[napi]
+ pub async fn publish(
+ &self,
+ to_device_id: String,
+ payload: String,
+ ) -> napi::Result<()> {
+ let messages =
+ vec![tunnelbroker::tunnelbroker_pb::MessageToTunnelbrokerStruct {
+ to_device_id,
+ payload,
+ blob_hashes: vec![],
+ }];
+
+ if let Err(_) = tunnelbroker::publish_messages(&self.tx, messages).await {
+ return Err(napi::Error::from_status(napi::Status::GenericFailure));
+ }
+ Ok(())
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 10:02 AM (20 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675824
Default Alt Text
D6460.id22888.diff (817 B)
Attached To
Mode
D6460: [keyserver] Adding Tunnelbroker-client napi-rs publish class method
Attached
Detach File
Event Timeline
Log In to Comment