Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions crates/robonode-client/src/authenticate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl Client {

/// Input data for the authenticate request.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticateRequest<'a> {
/// An opaque liveness data, containing the FaceScan to match the identity with and
/// the rest of the parameters necessary to conduct a liveness check.
Expand All @@ -34,6 +35,7 @@ pub struct AuthenticateRequest<'a> {

/// Input data for the authenticate request.
#[derive(Debug, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticateResponse {
/// An opaque auth ticket generated for this authentication attempt.
pub auth_ticket: Box<[u8]>,
Expand Down Expand Up @@ -63,8 +65,8 @@ mod tests {
#[test]
fn request_serialization() {
let expected_request = serde_json::json!({
"liveness_data": [1, 2, 3],
"liveness_data_signature": [4, 5, 6],
"livenessData": [1, 2, 3],
"livenessDataSignature": [4, 5, 6],
});

let actual_request = serde_json::to_value(&AuthenticateRequest {
Expand All @@ -79,8 +81,8 @@ mod tests {
#[test]
fn response_deserialization() {
let sample_response = serde_json::json!({
"auth_ticket": [1, 2, 3],
"auth_ticket_signature": [4, 5, 6],
"authTicket": [1, 2, 3],
"authTicketSignature": [4, 5, 6],
});

let response: AuthenticateResponse = serde_json::from_value(sample_response).unwrap();
Expand All @@ -102,8 +104,8 @@ mod tests {
liveness_data_signature: b"123",
};
let sample_response = serde_json::json!({
"auth_ticket": b"456",
"auth_ticket_signature": b"789",
"authTicket": b"456",
"authTicketSignature": b"789",
});

let expected_response: AuthenticateResponse =
Expand Down
6 changes: 4 additions & 2 deletions crates/robonode-client/src/enroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl Client {

/// Input data for the enroll request.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EnrollRequest<'a> {
/// The public key to be used as an identity.
pub public_key: &'a [u8],
Expand All @@ -30,6 +31,7 @@ pub struct EnrollRequest<'a> {

/// The enroll-specific error condition.
#[derive(Error, Debug, PartialEq)]

pub enum EnrollError {
/// The face scan or public key were already enrolled.
#[error("already enrolled")]
Expand All @@ -49,8 +51,8 @@ mod tests {
#[test]
fn request_serialization() {
let expected_request = serde_json::json!({
"liveness_data": [1, 2, 3],
"public_key": [4, 5, 6],
"livenessData": [1, 2, 3],
"publicKey": [4, 5, 6],
});

let actual_request = serde_json::to_value(&EnrollRequest {
Expand Down
9 changes: 5 additions & 4 deletions crates/robonode-client/src/get_facetec_device_sdk_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl Client {

/// Input data for the get facetec device sdk params request.
#[derive(Debug, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct GetFacetecDeviceSdkParamsResponse {
/// The public FaceMap encription key.
pub public_face_map_encryption_key: String,
Expand All @@ -48,8 +49,8 @@ mod tests {
#[test]
fn response_deserialization() {
let sample_response = serde_json::json!({
"public_face_map_encryption_key": "my encryption key",
"device_key_identifier": "my device key identifier",
"publicFaceMapEncryptionKey": "my encryption key",
"deviceKeyIdentifier": "my device key identifier",
});

let response: GetFacetecDeviceSdkParamsResponse =
Expand All @@ -68,8 +69,8 @@ mod tests {
let mock_server = MockServer::start().await;

let sample_response = serde_json::json!({
"public_face_map_encryption_key": "my encryption key",
"device_key_identifier": "my device key identifier",
"publicFaceMapEncryptionKey": "my encryption key",
"deviceKeyIdentifier": "my device key identifier",
});

let expected_response: GetFacetecDeviceSdkParamsResponse =
Expand Down
5 changes: 3 additions & 2 deletions crates/robonode-client/src/get_facetec_session_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl Client {

/// Input data for the get facetec session token request.
#[derive(Debug, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct GetFacetecSessionTokenResponse {
/// The FaceTec Session Token.
pub session_token: String,
Expand All @@ -46,7 +47,7 @@ mod tests {
#[test]
fn response_deserialization() {
let sample_response = serde_json::json!({
"session_token": "my session token",
"sessionToken": "my session token",
});

let response: GetFacetecSessionTokenResponse =
Expand All @@ -64,7 +65,7 @@ mod tests {
let mock_server = MockServer::start().await;

let sample_response = serde_json::json!({
"session_token": "my sesion token",
"sessionToken": "my sesion token",
});

let expected_response: GetFacetecSessionTokenResponse =
Expand Down
2 changes: 2 additions & 0 deletions crates/robonode-server/src/logic/op_authenticate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use super::{common::*, Logic, Signer, Verifier};

/// The request of the authenticate operation.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Request {
/// The liveness data that the validator owner provided.
pub liveness_data: OpaqueLivenessData,
Expand All @@ -25,6 +26,7 @@ pub struct Request {

/// The response of the authenticate operation.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Response {
/// An opaque auth ticket generated for this authentication attempt.
/// Contains a public key that matched with the provided FaceScan and a nonce to prevent replay
Expand Down
1 change: 1 addition & 0 deletions crates/robonode-server/src/logic/op_enroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use super::{common::*, Logic, Signer};

/// The request for the enroll operation.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Request {
/// The public key of the validator.
pub public_key: Vec<u8>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{Logic, Signer};

/// The response for the get facetec device sdk params operation.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Response {
/// The public FaceMap encription key.
pub public_face_map_encryption_key: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use super::{Logic, Signer};

/// The response for the get facetec session token operation.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Response {
/// The session token returned by the FaceTec Server.
pub session_token: String,
Expand Down