Skip to content
Open
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
23 changes: 21 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ impl RpcServer for RpcServerImpl {
match submit_request.proof_request_type {
ProofRequest::Register { .. }
| ProofRequest::RegisterId { .. }
| ProofRequest::RegisterAadhaar { .. } => {
| ProofRequest::RegisterAadhaar { .. }
| ProofRequest::RegisterKyc { .. } => {
if !cfg!(feature = "register") && !cfg!(feature = "cherrypick") {
self.store.remove_agreement(&uuid).await;
return invalid_proof_type_response;
Expand All @@ -225,7 +226,8 @@ impl RpcServer for RpcServerImpl {
}
ProofRequest::Disclose { .. }
| ProofRequest::DiscloseId { .. }
| ProofRequest::DiscloseAadhaar { .. } => {
| ProofRequest::DiscloseAadhaar { .. }
| ProofRequest::DiscloseKyc { .. } => {
if !cfg!(feature = "disclose") && !cfg!(feature = "cherrypick") {
self.store.remove_agreement(&uuid).await;
return invalid_proof_type_response;
Expand Down Expand Up @@ -320,6 +322,23 @@ impl RpcServer for RpcServerImpl {
user_defined_data.as_str(),
*version as i32,
),
ProofRequest::RegisterKyc {
endpoint_type,
endpoint,
..
} => (endpoint_type.as_ref(), endpoint.as_ref(), "", 1),
ProofRequest::DiscloseKyc {
endpoint_type,
endpoint,
user_defined_data,
version,
..
} => (
Some(endpoint_type),
Some(endpoint),
user_defined_data.as_str(),
*version as i32,
),
};

if let Err(e) = create_proof_status(
Expand Down
28 changes: 28 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ pub enum ProofRequest {
#[serde(default = "default_version")]
version: u32,
},
#[serde(rename_all = "camelCase")]
RegisterKyc {
circuit: Circuit,
endpoint_type: Option<EndpointType>,
endpoint: Option<String>,
},
#[serde(rename_all = "camelCase")]
DiscloseKyc {
circuit: Circuit,
endpoint_type: EndpointType,
endpoint: String,
#[serde(default = "default_user_defined_data")]
user_defined_data: String,
#[serde(default = "default_version")]
version: u32,
},
}

impl ProofRequest {
Expand All @@ -124,6 +140,8 @@ impl ProofRequest {
ProofRequest::DiscloseId { circuit, .. } => circuit,
ProofRequest::RegisterAadhaar { circuit, .. } => circuit,
ProofRequest::DiscloseAadhaar { circuit, .. } => circuit,
ProofRequest::RegisterKyc { circuit, .. } => circuit,
ProofRequest::DiscloseKyc { circuit, .. } => circuit,
}
}
}
Expand All @@ -138,6 +156,8 @@ pub enum ProofType {
DiscloseId,
RegisterAadhaar,
DiscloseAadhaar,
RegisterKyc,
DiscloseKyc,
}

impl Into<ProofType> for &ProofRequest {
Expand All @@ -151,6 +171,8 @@ impl Into<ProofType> for &ProofRequest {
ProofRequest::DiscloseId { .. } => ProofType::DiscloseId,
ProofRequest::RegisterAadhaar { .. } => ProofType::RegisterAadhaar,
ProofRequest::DiscloseAadhaar { .. } => ProofType::DiscloseAadhaar,
ProofRequest::RegisterKyc { .. } => ProofType::RegisterKyc,
ProofRequest::DiscloseKyc { .. } => ProofType::DiscloseKyc,
}
}
}
Expand All @@ -166,6 +188,8 @@ impl std::fmt::Display for ProofType {
ProofType::DiscloseId => write!(f, "disclose_id"),
ProofType::RegisterAadhaar => write!(f, "register_aadhaar"),
ProofType::DiscloseAadhaar => write!(f, "disclose_aadhaar"),
ProofType::RegisterKyc => write!(f, "register_kyc"),
ProofType::DiscloseKyc => write!(f, "disclose_kyc"),
}
}
}
Expand All @@ -181,6 +205,8 @@ impl Into<i32> for &ProofType {
ProofType::DiscloseId => 5,
ProofType::RegisterAadhaar => 6,
ProofType::DiscloseAadhaar => 7,
ProofType::RegisterKyc => 8,
ProofType::DiscloseKyc => 9,
}
}
}
Expand All @@ -197,6 +223,8 @@ impl TryFrom<i32> for ProofType {
5 => Ok(ProofType::DiscloseId),
6 => Ok(ProofType::RegisterAadhaar),
7 => Ok(ProofType::DiscloseAadhaar),
8 => Ok(ProofType::RegisterKyc),
9 => Ok(ProofType::DiscloseKyc),
_ => Err(()),
}
}
Expand Down