Changeset View
Changeset View
Standalone View
Standalone View
keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
use super::*; | use super::*; | ||||
#[napi] | #[napi] | ||||
#[instrument(skip_all)] | #[instrument(skip_all)] | ||||
pub async fn register_user( | pub async fn register_user( | ||||
user_id: String, | user_id: String, | ||||
signing_public_key: String, | signing_public_key: String, | ||||
username: String, | username: String, | ||||
password: String, | password: String, | ||||
session_initialization_info: HashMap<String, String>, | session_initialization_info: HashMap<String, String>, | ||||
) -> Result<String> { | ) -> Result<String> { | ||||
let channel = get_identity_service_channel().await?; | let channel = get_identity_service_channel().await?; | ||||
let token: MetadataValue<_> = AUTH_TOKEN | let token: MetadataValue<_> = IDENTITY_SERVICE_CONFIG | ||||
.identity_auth_token | |||||
.parse() | .parse() | ||||
.map_err(|_| Error::from_status(Status::GenericFailure))?; | .map_err(|_| Error::from_status(Status::GenericFailure))?; | ||||
let mut identity_client = | let mut identity_client = | ||||
IdentityServiceClient::with_interceptor(channel, |mut req: Request<()>| { | IdentityServiceClient::with_interceptor(channel, |mut req: Request<()>| { | ||||
req.metadata_mut().insert("authorization", token.clone()); | req.metadata_mut().insert("authorization", token.clone()); | ||||
Ok(req) | Ok(req) | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 206 Lines • Show Last 20 Lines |