Skip to main content

POST /createZkpToken

Generate a Zero-Knowledge Proof (ZKP) token based on a Verifiable Credential and condition.

{{baseUrl}}/createZkpToken

Headers

HeaderTypeDescription
x-api-keystringThe API key required for authentication.

Request Body

ParameterTypeDescription
credentialobjectThe Verifiable Credential data, including subject information, issuer, and proof.
zkpConditionobjectThe condition for the Zero-Knowledge Proof, such as age requirements.
privateKeystringThe 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)

ParameterTypeDescription
successbooleanIndicates if the ZKP token creation was successful.
zkpTokenstringThe generated Zero-Knowledge Proof token.
zkpDataobjectDetailed data about the ZKP, including condition.
messagestringA 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)

ParameterTypeDescription
messagestringA success message indicating the VP and attributes were verified.

Sample Response Body:

{
"message": "VP and attributes successfully verified."
}

Response (Server Error - 500)

ParameterTypeDescription
errorstringDescribes the error that occurred.

Sample Response Body:

{
"error": "Server error"
}