Changeset View
Changeset View
Standalone View
Standalone View
keyserver/addons/rust-node-addon/src/identity_client/login_user.rs
Show All 9 Lines | async fn login_user_wallet( | ||||
mut session_initialization_info: HashMap<String, String>, | mut session_initialization_info: HashMap<String, String>, | ||||
social_proof: String, | social_proof: String, | ||||
) -> Result<String> { | ) -> Result<String> { | ||||
let channel = get_identity_service_channel().await?; | let channel = get_identity_service_channel().await?; | ||||
let token: MetadataValue<_> = IDENTITY_SERVICE_CONFIG | let token: MetadataValue<_> = IDENTITY_SERVICE_CONFIG | ||||
.identity_auth_token | .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 = IdentityKeyserverServiceClient::with_interceptor( | ||||
IdentityServiceClient::with_interceptor(channel, |mut req: Request<()>| { | channel, | ||||
|mut req: Request<()>| { | |||||
req.metadata_mut().insert("authorization", token.clone()); | req.metadata_mut().insert("authorization", token.clone()); | ||||
Ok(req) | Ok(req) | ||||
}); | }, | ||||
); | |||||
// Create a LoginRequest channel and use ReceiverStream to turn the | // Create a LoginRequest channel and use ReceiverStream to turn the | ||||
// MPSC receiver into a Stream for outbound messages | // MPSC receiver into a Stream for outbound messages | ||||
let (tx, rx) = mpsc::channel(1); | let (tx, rx) = mpsc::channel(1); | ||||
let stream = ReceiverStream::new(rx); | let stream = ReceiverStream::new(rx); | ||||
let request = Request::new(stream); | let request = Request::new(stream); | ||||
let mut response_stream = identity_client | let mut response_stream = identity_client | ||||
Show All 37 Lines | async fn login_user_pake( | ||||
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<_> = IDENTITY_SERVICE_CONFIG | let token: MetadataValue<_> = IDENTITY_SERVICE_CONFIG | ||||
.identity_auth_token | .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 = IdentityKeyserverServiceClient::with_interceptor( | ||||
IdentityServiceClient::with_interceptor(channel, |mut req: Request<()>| { | channel, | ||||
|mut req: Request<()>| { | |||||
req.metadata_mut().insert("authorization", token.clone()); | req.metadata_mut().insert("authorization", token.clone()); | ||||
Ok(req) | Ok(req) | ||||
}); | }, | ||||
); | |||||
// Create a LoginRequest channel and use ReceiverStream to turn the | // Create a LoginRequest channel and use ReceiverStream to turn the | ||||
// MPSC receiver into a Stream for outbound messages | // MPSC receiver into a Stream for outbound messages | ||||
let (tx, rx) = mpsc::channel(1); | let (tx, rx) = mpsc::channel(1); | ||||
let stream = ReceiverStream::new(rx); | let stream = ReceiverStream::new(rx); | ||||
let request = Request::new(stream); | let request = Request::new(stream); | ||||
// `response` is the Stream for inbound messages | // `response` is the Stream for inbound messages | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |