Skip to content

Commit

Permalink
Some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed Jun 14, 2024
1 parent eb6ca82 commit 87fccf3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/bioauth-flow-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,19 @@ where
}

/// Do enroll with provided liveness data.
async fn do_enroll(&self, liveness_data: LivenessData) -> Result<Option<String>, EnrollError> {
async fn do_enroll(&self, liveness_data: LivenessData) -> Result<EnrollResponse, EnrollError> {
info!("Bioauth flow - enrolling in progress");

let public_key =
rpc_validator_key_logic::validator_public_key(&self.validator_key_extractor)
.map_err(EnrollError::KeyExtraction)?;
.map_err(EnrollError::KeyExtraction)?;

let (opaque_liveness_data, signature) = self
.sign(public_key.clone(), &liveness_data)
.await
.map_err(EnrollError::Sign)?;

let EnrollResponse { scan_result_blob } = self
let response = self
.robonode_client
.as_ref()
.enroll(EnrollRequest {
Expand All @@ -267,7 +267,7 @@ where

info!("Bioauth flow - enrolling complete");

Ok(scan_result_blob)
Ok(response)
}

/// Do authenticate with provided liveness data.
Expand All @@ -281,7 +281,7 @@ where

let public_key =
rpc_validator_key_logic::validator_public_key(&self.validator_key_extractor)
.map_err(AuthenticateError::KeyExtraction).map_err(errtype)?;
.map_err(AuthenticateError::KeyExtraction).map_err(errtype)?;

let (opaque_liveness_data, signature) = self
.sign(public_key, &liveness_data)
Expand Down Expand Up @@ -400,7 +400,7 @@ where
async fn enroll_v2(&self, liveness_data: LivenessData) -> RpcResult<EnrollResult> {
self.deny_unsafe.check_if_safe()?;

let scan_result_blob = self.do_enroll(liveness_data).await?;
let EnrollResponse { scan_result_blob } = self.do_enroll(liveness_data).await?;

Ok(EnrollResult { scan_result_blob })
}
Expand Down

0 comments on commit 87fccf3

Please sign in to comment.