POST /createZkpToken
Generate a Zero-Knowledge Proof (ZKP) token based on a Verifiable Credential and condition.
{{baseUrl}}/createZkpToken
Headers
Header | Type | Description |
---|---|---|
x-api-key | string | The API key required for authentication. |
Request Body
Parameter | Type | Description |
---|---|---|
credential | object | The Verifiable Credential data, including subject information, issuer, and proof. |
zkpCondition | object | The condition for the Zero-Knowledge Proof, such as age requirements. |
privateKey | string | The private key used to generate the ZKP token. |
Sample Request Body:
{
"credential": {
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"id": "DegreeCredential8fa09780-23b2-4b9c-a7b5-c9d292fd9826",
"type": [
"VerifiableCredential",
"DegreeCredential"
],
"version": "DegreeCredential",
"credentialSchema": {
"id": "http://ssi-stage.myearth.id/schema/DegreeCredential",
"type": "JsonSchemaValidator2018"
},
"issuer": "did:earthid:testnet:HwetGVKwLAu12HRZaCKcMxdijsjxdSc7Lw1KSzC6FYDR:0.0.5021630",
"credentialSubject": [
{
"id": "did:earthid:testnet:CqfgWPDd67TBe3wieHhhD9y9M6AderRRJnozU12DdP2t:0.0.5021687",
"degree": "Bachelor of Computer Science",
"dateOfBirth": "01-01-2000",
"city": "Delhi"
}
],
"issuanceDate": "2024-10-23T10:03:50.676Z",
"expirationDate": "+020245-10-23T10:03:50.676Z",
"proof": {
"type": "HederaConsensusProof",
"creator": "did:earthid:testnet:HwetGVKwLAu12HRZaCKcMxdijsjxdSc7Lw1KSzC6FYDR:0.0.5021630",
"created": "2024-10-23T10:03:50.676Z"
}
},
"zkpCondition": {
"age": 18
},
"privateKey": "59a85d6d233ffaf32d25d801dfb83a63dd9d6635ff2b8654b589f827bf95304f"
}
Click Send
and wait for the response.
Response (Success - 200)
Parameter | Type | Description |
---|---|---|
success | boolean | Indicates if the ZKP token creation was successful. |
zkpToken | string | The generated Zero-Knowledge Proof token. |
zkpData | object | Detailed data about the ZKP, including condition. |
message | string | A success message indicating the ZKP token was created successfully. |
Sample Response Body:
{
"success": true,
"zkpToken": "3044022070683c64ca3b3da060c93fadab41b352bdf75c9e3176e402bc897017b4fdf23802206790e49cd934a015217633237731a78eedfa9192c4d4ab3d4377b232844bee6a",
"zkpData": {
"condition": {
"age": 18
},
"conditionMet": true,
"calculatedAge": 24
},
"message": "ZKP token created successfully"
}
Response (Success - 200)
Parameter | Type | Description |
---|---|---|
message | string | A success message indicating the VP and attributes were verified. |
Sample Response Body:
{
"message": "VP and attributes successfully verified."
}
Response (Server Error - 500)
Parameter | Type | Description |
---|---|---|
error | string | Describes the error that occurred. |
Sample Response Body:
{
"error": "Server error"
}