Page MenuHomePhabricator

D12151.diff
No OneTemporary

D12151.diff

diff --git a/keyserver/addons/rust-node-addon/rust-binding-types.js b/keyserver/addons/rust-node-addon/rust-binding-types.js
--- a/keyserver/addons/rust-node-addon/rust-binding-types.js
+++ b/keyserver/addons/rust-node-addon/rust-binding-types.js
@@ -61,6 +61,7 @@
+getFarcasterUsers: (
farcasterIds: $ReadOnlyArray<string>,
) => Promise<$ReadOnlyArray<FarcasterUser>>,
+ +generateNonce: () => Promise<string>,
};
export type { RustNativeBindingAPI };
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
@@ -3,6 +3,7 @@
pub mod get_farcaster_users;
pub mod get_inbound_keys_for_user;
pub mod login;
+pub mod nonce;
pub mod prekey;
pub mod register_user;
pub mod remove_reserved_usernames;
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/nonce.rs b/keyserver/addons/rust-node-addon/src/identity_client/nonce.rs
new file mode 100644
--- /dev/null
+++ b/keyserver/addons/rust-node-addon/src/identity_client/nonce.rs
@@ -0,0 +1,19 @@
+use super::*;
+
+use grpc_clients::identity::protos::unauth::Empty;
+use tracing::debug;
+
+#[napi]
+#[instrument(skip_all)]
+pub async fn generate_nonce() -> Result<String> {
+ // Set up the gRPC client that will be used to talk to the Identity service
+ let mut identity_client = get_identity_client().await?;
+
+ debug!("Getting nonce from Identity service");
+ let response = identity_client
+ .generate_nonce(Empty {})
+ .await
+ .map_err(handle_grpc_error)?;
+
+ Ok(response.into_inner().nonce)
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 4:03 PM (19 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2601559
Default Alt Text
D12151.diff (1 KB)

Event Timeline