diff --git a/next-gen-signing-service/examples/zkp/flow.http b/next-gen-signing-service/examples/zkp/flow.http index de5fd1a..4583a11 100644 --- a/next-gen-signing-service/examples/zkp/flow.http +++ b/next-gen-signing-service/examples/zkp/flow.http @@ -48,13 +48,14 @@ GET http://localhost:8000/zkp/keypair exports.issuer_sk = response.parsedBody.secret_key }} -GET http://localhost:8000/zkp/issue - ?data={{data}} - &issuer_pk={{issuer_pk}} +POST http://localhost:8000/zkp/issue + ?issuer_pk={{issuer_pk}} &issuer_sk={{issuer_sk}} &issuer_id={{issuer_id}} &issuer_key_id={{issuer_key_id}} +{{data}} + {{ exports.credential = response.parsedBody.encoded; }} @@ -71,22 +72,26 @@ GET http://localhost:8000/zkp/proving-keys )) }} -GET http://localhost:8000/zkp/present - ?credential={{credential}} - &definition={{definition}} - &proving_keys={{proving_keys}} - &issuer_pk={{issuer_pk}} +POST http://localhost:8000/zkp/present + ?issuer_pk={{issuer_pk}} &issuer_id={{issuer_id}} &issuer_key_id={{issuer_key_id}} +{ + "credential": "{{credential}}", + "definition": "{{definition}}", + "proving_keys": "{{proving_keys}}" +} + {{ exports.proof = response.parsedBody.proof }} -GET http://localhost:8000/zkp/verify - ?proof={{proof}} - &issuer_pk={{issuer_pk}} +POST http://localhost:8000/zkp/verify + ?issuer_pk={{issuer_pk}} &verifying_keys={{verifying_keys}} &definition={{definition}} &issuer_id={{issuer_id}} - &issuer_key_id={{issuer_key_id}} \ No newline at end of file + &issuer_key_id={{issuer_key_id}} + +{{proof}} \ No newline at end of file diff --git a/next-gen-signing-service/src/main.rs b/next-gen-signing-service/src/main.rs index 1295c70..764fb2e 100644 --- a/next-gen-signing-service/src/main.rs +++ b/next-gen-signing-service/src/main.rs @@ -82,7 +82,7 @@ mod zkp_routes { Engine, BASE64_URL_SAFE_NO_PAD, }; use rand::rngs::OsRng; - use rocket::{get, serde::json::Json}; + use rocket::{get, post, serde::json::Json}; use serde_json::{json, Value}; use crate::KeyPair; @@ -100,7 +100,10 @@ mod zkp_routes { Json(key_pair) } - #[get("/issue?&&&&&")] + #[post( + "/issue?&&&&", + data = "" + )] pub async fn issue( data: String, issuer_pk: String, @@ -146,20 +149,19 @@ mod zkp_routes { Json(circuits) } - #[get( - "/present?&&&&&" - )] + #[post("/present?&&", data = "")] pub async fn present( - credential: String, - definition: String, - proving_keys: String, + data: Json, issuer_pk: String, issuer_id: String, issuer_key_id: String, ) -> Json { let mut rng = OsRng; - println!("{credential}"); + let credential = data["credential"].as_str().unwrap().to_string(); + let definition = data["definition"].as_str().unwrap().to_string(); + let proving_keys = data["proving_keys"].as_str().unwrap().to_string(); + let credential = zkp::Credential::deserialize_encoded(&credential); let reqs = { @@ -190,7 +192,10 @@ mod zkp_routes { })) } - #[get("/verify?&&&&&")] + #[post( + "/verify?&&&&", + data = "" + )] pub async fn verify( proof: String, issuer_pk: String,