Changeset View
Changeset View
Standalone View
Standalone View
shared/comm-opaque2/src/grpc.rs
- This file was added.
use log::info; | |||||
use opaque_ke::errors::ProtocolError; | |||||
use tonic::Status; | |||||
pub fn protocol_error_to_grpc_status(error: ProtocolError) -> tonic::Status { | |||||
match error { | |||||
ProtocolError::IdentityGroupElementError => { | |||||
info!("Failed to validate password"); | |||||
Status::aborted("server error") | |||||
} | |||||
ProtocolError::InvalidLoginError => { | |||||
info!("Failed to login"); | |||||
Status::aborted("login failed") | |||||
} | |||||
ProtocolError::LibraryError(_) => { | |||||
info!("Opaque error"); | |||||
Status::invalid_argument("internal error") | |||||
} | |||||
ProtocolError::ReflectedValueError => { | |||||
info!("OPRF value was reflected"); | |||||
Status::invalid_argument("invalid server response") | |||||
} | |||||
ProtocolError::SerializationError => { | |||||
info!("Invalid argument"); | |||||
Status::invalid_argument("invalid argument") | |||||
} | |||||
} | |||||
} |