diff --git a/src/static/swagger.json b/src/static/swagger.json index 076e0991..964f0694 100644 --- a/src/static/swagger.json +++ b/src/static/swagger.json @@ -1,932 +1,549 @@ { "openapi": "3.0.0", - "servers": [ - { - "url": "/" - } - ], "info": { - "title": "Credential Service for cheqd network", + "title": "Credential Service API for cheqd network", "version": "2.0.0", - "description": "API service to create and manage DIDs and credentials on cheqd network." + "description": "API service to create and manage DIDs, Verifiable Credentials, and DID-Linked Resources", + "contact": { + "name": "Cheqd Foundation Limited", + "url": "https://github.com/cheqd/credential-service", + "email": "support-github@cheqd.io" + }, + "license": { + "name": "Apache 2.0", + "url": "https://github.com/cheqd/credential-service/blob/main/LICENSE" + } + }, + "externalDocs": { + "description": "Credential Service API Documentation", + "url": "https://docs.cheqd.io/identity" }, - "tags": [ + "servers": [ { - "name": "Credential", - "externalDocs": { - "url": "https://github.com/cheqd/credential-service#readme" - } + "url": "/" } ], - "components": { - "securitySchemes": { - "bearerAuth": { - "type": "http", - "scheme": "bearer", - "bearerFormat": "JWT" - } - }, - "schemas": { - "CredentialRequest": { - "description": "Input fields for the create operation.", - "type": "object", - "additionalProperties": false, - "properties": { - "issuerDid": { - "description": "This input field is the Issuer's DID.", - "type": "string" - }, - "subjectDid": { - "description": "This input field is the holder's DID.", - "type": "string" - }, - "attributes": { - "description": "Json input of the attributes.", - "type": "object" - }, - "@context": { - "description": "Additional contexts to be included in the credential.", - "type": "array", - "items": { - "type": "string" + "paths": { + "/credential/issue": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Issue a credential.", + "description": "This endpoint issues a credential. As input it takes the list of attributes, subjectDid, context and expiration date of the credential to be issued.", + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRequest" + } } - }, - "type": { - "description": "Additional type property to be included in the credential.", - "type": "array", - "items": { - "type": "string" + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Credential" + } + } } }, - "expirationDate": { - "description": "Optional expiration date according to the specification." + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } + } }, - "format": { - "description": "Select one of the supported credential formats, jwt by default.", - "type": "string", - "enum": [ - "jwt", - "lds" - ] + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "credentialStatus": { - "description": "Optional field to support revocation or suspension, which takes statusListName and statusListPurpose as inputs.", - "type": "object", - "required": [ - "statusPurpose", - "statusListName" - ], - "properties": { - "statusPurpose": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - }, - "statusListName": { - "type": "string" - }, - "statusListIndex": { - "type": "number" - }, - "statusListVersion": { - "type": "string" - }, - "statusListRangeStart": { - "type": "number" - }, - "statusListRangeEnd": { - "type": "number" - }, - "indexNotIn": { - "type": "number" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } } } } - }, - "required": [ - "issuerDid", - "subjectDid", - "attributes" + } + } + }, + "/credential/verify": { + "post": { + "tags": [ + "Credential" ], - "example": { - "issuerDid": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", - "attributes": { - "gender": "male", - "name": "Bob" - }, - "@context": [ - "https://schema.org" - ], - "type": [ - "Person" - ], - "format": "jwt", - "credentialStatus": { - "statusPurpose": "revocation", - "statusListName": "employee-credentials", - "statusListIndex": 10 + "summary": "Verify a credential.", + "description": "This endpoint verifies the credential. As input it takes the entire credential itself or just the JWT string.", + "operationId": "verify", + "security": [ + { + "bearerAuth": [] } - } - }, - "Credential": { - "description": "Input fields for the update operation.", - "type": "object", - "additionalProperties": false, - "properties": { - "@context": { - "type": "array", - "items": { - "type": "string" - } - }, - "type": { - "type": "array", - "items": { - "type": "string" + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialVerifyRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialVerifyRequest" + } } - }, - "expirationDate": { - "type": "string" - }, - "issuer": { - "type": "object", - "properties": { - "id": { - "type": "string" + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IVerifyResult" + } } } }, - "credentialSubject": { - "type": "object", - "properties": { - "id": { - "type": "string" + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } } } }, - "credentialStatus": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "statusListIndex": { - "type": "string" - }, - "statusPurpose": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - }, - "type": { - "type": "string", - "enum": [ - "StatusList2021Entry" - ] + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } } } - }, - "issuanceDate": { - "type": "string" - }, - "proof": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "jwt": { - "type": "string" + } + } + } + }, + "/credential/revoke": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Revoke a credential.", + "description": "This endpoint verifies the credential. As input it takes the entire credential itself or just the JWT string.", + "operationId": "revoke", + "security": [ + { + "bearerAuth": [] + } + ], + "parameters": [ + { + "in": "query", + "name": "publish", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" } } } }, - "example": { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://schema.org", - "https://veramo.io/contexts/profile/v1" - ], - "credentialSubject": { - "gender": "male", - "id": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", - "name": "Bob" - }, - "credentialStatus": { - "id": "https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20", - "statusIndex": 20, - "statusPurpose": "suspension", - "type": "StatusList2021Entry" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevocationResult" + } + } + } }, - "issuanceDate": "2023-06-08T13:49:28.000Z", - "issuer": { - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } + } }, - "proof": { - "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg", - "type": "JwtProof2020" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "type": [ - "VerifiableCredential", - "Person" - ] - } - }, - "CredentialRevokeRequest": { - "type": "object", - "properties": { - "credential": { - "description": "This input field takes the credential object or the JWT string", - "oneOf": [ - { - "type": "object" - }, - { - "type": "string" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } } - ] - } - } - }, - "RevocationResult": { - "properties": { - "revoked": { - "type": "boolean" + } } } - }, - "SuspensionResult": { - "properties": { - "suspended": { - "type": "boolean" - }, - "statusList": { - "type": "string" + } + }, + "/credential/suspend": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Suspend a credential.", + "description": "This endpoint suspends the credential. As input it takes the entire credential itself.", + "operationId": "suspend", + "security": [ + { + "bearerAuth": [] } - } - }, - "UnSuspensionResult": { - "properties": { - "unsuspended": { - "type": "boolean" - }, - "statusList": { - "type": "string" + ], + "parameters": [ + { + "in": "query", + "name": "publish", + "schema": { + "type": "boolean" + } } - } - }, - "CredentialVerifyRequest": { - "type": "object", - "properties": { - "credential": { - "description": "This input field takes the credential object or the JWT string.\\", - "allOf": [ - { - "type": "object" - }, - { - "type": "string" + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" } - ] + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + } } - } - }, - "IVerifyResult": { - "type": "object", - "properties": { - "verified": { - "type": "boolean" - }, - "issuer": { - "type": "string" + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuspensionResult" + } + } + } }, - "signer": { - "type": "object" + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } + } }, - "jwt": { - "type": "string" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "verifiableCredential": { - "type": "object" - } - }, - "example": { - "verified": true, - "polices": {}, - "issuer": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "signer": { - "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", - "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt", - "type": "Ed25519VerificationKey2018" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } + } } } - }, - "PresentationRequest": { - "type": "object", - "required": [ - "presentation" + } + }, + "/credential/reinstate": { + "post": { + "tags": [ + "Credential" ], - "properties": { - "presentation": { - "description": "This input field takes the presentation object or the JWT string.", - "allOf": [ - { - "type": "string" - }, - { - "type": "object" - } - ] + "summary": "Reinstate a credential.", + "description": "This endpoint reinstates the credential. As input it takes the entire credential itself.", + "operationId": "reinstate", + "security": [ + { + "bearerAuth": [] } - } - }, - "CredentialStatusCreateRequest": { - "allOf": [ + ], + "parameters": [ { - "type": "object", - "required": [ - "did", - "statusListName" - ], - "properties": { - "did": { - "description": "The DID of the status list publisher.", - "type": "string" - }, - "statusListName": { - "description": "The name of the status list to be created.", - "type": "string" - }, - "length": { - "description": "The length of the status list to be created. The default and minimum length is 140000 which is 16kb." - }, - "encoding": { - "description": "The encoding format of the statusList to be published.", - "type": "string", - "default": "base64url", - "enum": [ - "base64url", - "base64", - "hex" - ] - }, - "statusListVersion": { - "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList.", - "type": "string" - }, - "alsoKnownAs": { - "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", - "type": "array", - "items": { - "type": "object", - "properties": { - "uri": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - } + "in": "query", + "name": "publish", + "schema": { + "type": "boolean" } } ], - "example": { - "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "statusListName": "cheqd-employee-credentials" - } - }, - "CredentialStatusResult": { - "type": "object", - "properties": { - "success": { - "type": "object", - "properties": { - "created": { - "type": "boolean" - }, - "resource": { - "type": "object", - "metadata": { - "encoding": "base64url", - "encrypted": false - } - }, - "resourceMetadata": { - "type": "object" - }, - "statusList2021": { - "type": "object", - "properties": { - "statusList2021": { - "type": "object", - "properties": { - "encodedList": { - "type": "string" - }, - "type": { - "type": "string" - }, - "validFrom": { - "type": "string" - } - } - } - } - }, - "metadata": { - "type": "string", - "properties": { - "encoding": { - "type": "string" - }, - "encrypted": { - "type": "boolean" - } - } + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" } } } }, - "example": { - "created": true, - "resource": { - "StatusList2021": { - "encodedList": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", - "type": "StatusList2021Revocation", - "validFrom": "2023-06-26T11:45:19.349Z" - }, - "metadata": { - "encoding": "base64url", - "encrypted": false + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnSuspensionResult" + } + } } }, - "resourceMetadata": { - "checksum": "909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2", - "created": "2023-06-26T11:45:20Z", - "mediaType": "application/json", - "nextVersionId": null, - "previousVersionId": null, - "resourceCollectionId": "7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "resourceId": "5945233a-a4b5-422b-b893-eaed5cedd2dc", - "resourceName": "cheqd-revocation-1", - "resourceType": "StatusList2021Revocation", - "resourceURI": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc", - "resourceVersion": "2023-06-26T11:45:19.349Z" + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } + } + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } + } } } - }, - "CredentialStatusPublishRequest": { - "allOf": [ + } + }, + "/presentation/verify": { + "post": { + "tags": [ + "Presentation" + ], + "summary": "Verify a credential presentation.", + "description": "This endpoint verifies the credential presentation. As input it takes the entire presentation itself.", + "operationId": "presentation", + "security": [ { - "type": "object", - "required": [ - "did", - "encodedList", - "statusListName", - "encoding" - ], - "properties": { - "did": { - "description": "The DID of the status list publisher.", - "type": "string" - }, - "statusListName": { - "description": "The name of the statusList to be published", - "type": "string" - }, - "encodedList": { - "description": "The encoding format of the statusList provided", - "type": "string", - "enum": [ - "base64url", - "base64", - "hex" - ] - }, - "statusListVersion": { - "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList", - "type": "string" - }, - "alsoKnownAs": { - "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", - "type": "array", - "items": { - "type": "object", - "properties": { - "uri": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - } - } + "bearerAuth": [] } ], - "example": { - "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "name": "cheqd-employee-credentials", - "version": "2023", - "data": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", - "encoding": "base64url" - } - }, - "CredentialStatusUpdateRequest": { - "type": "object", - "required": [ - "did", - "statusListName", - "indices" - ], - "properties": { - "did": { - "description": "The DID of the status list publisher.", - "type": "string" - }, - "statusListName": { - "description": "The name of the status list to be created.", - "type": "string" - }, - "indices": { - "description": "Provide the list of indices to be updated.", - "type": "array", - "items": { - "type": "number" + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/PresentationRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/PresentationRequest" + } } - }, - "statusListVersion": { - "description": "The input field is OPTIONAL, If present uses the provided statusListVersion for the update operation.", - "type": "string" - } - } - }, - "KeyResult": { - "type": "object", - "properties": { - "kid": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Ed25519", - "Secp256k1" - ] - }, - "publicKeyHex": { - "type": "string" } - } - }, - "DidDocument": { - "description": "This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See https://identity.foundation/did-registration/#diddocument.", - "type": "object", - "properties": { - "@context": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string" - }, - "controllers": { - "type": "array", - "items": { - "type": "string" + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IVerifyResult" + } + } } }, - "authentication": { - "type": "array", - "items": { - "type": "string" + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } } }, - "assertionMethod": { - "type": "array", - "items": { - "type": "string" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "capabilityInvocation": { - "type": "array", - "items": { - "type": "string" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } } - }, - "capabilityDelegation": { - "type": "array", - "items": { - "type": "string" + } + } + } + }, + "/account": { + "post": { + "tags": [ + "Account" + ], + "summary": "Create a client.", + "description": "This endpoint verifies the JWT token and creates a customer if they don't exist.", + "security": [ + { + "bearerAuth": [] + } + ], + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Customer" + } + } } }, - "keyAgreement": { - "type": "array", - "items": { - "type": "string" + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } } }, - "verificationMethod": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VerificationMethod" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "service": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } } } - }, - "example": { - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "controller": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - ], - "verificationMethod": [ - { - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", - "type": "Ed25519VerificationKey2018", - "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" - } - ], - "authentication": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1" - ] } }, - "DidCreateRequest": { - "type": "object", - "properties": { - "network": { - "type": "string", - "enum": [ - "testnet", - "mainnet" - ] - }, - "methodSpecificIdAlgo": { - "type": "string", - "enum": [ - "uuid", - "base58btc" - ] - }, - "verificationMethodType": { - "type": "string", - "enum": [ - "Ed25519VerificationKey2018", - "JsonWebKey2020", - "Ed25519VerificationKey2020" - ] - }, - "serviceEndpoint": { - "type": "string" - }, - "assertionMethod": { - "description": "An assertion method is required to issue JSONLD credentials.", - "type": "boolean", - "default": true - }, - "didDocument": { - "$ref": "#/components/schemas/DidDocument" - } - } - }, - "DidResult": { - "type": "object", - "properties": { - "did": { - "type": "string" - }, - "controllerKeyId": { - "type": "string" - }, - "keys": { - "type": "array", - "items": { - "type": "object" - } - }, - "services": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" - } - } - } - }, - "VerificationMethod": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "controller": { - "type": "string" - }, - "publicKeyMultibase": { - "type": "string" - }, - "publicKeyJwk": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "example": { - "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "id": "did:cheqd:testnet :7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", - "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt", - "type": "Ed25519VerificationKey2018" - } - }, - "Service": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#rand" - }, - "type": { - "type": "string", - "example": "rand" - }, - "serviceEndpoint": { - "type": "array", - "items": { - "type": "string", - "example": "https://rand.in" - } - } - } - }, - "DidUpdateRequest": { - "type": "object", - "properties": { - "did": { - "type": "string" - }, - "service": { - "type": "array", - "description": "This input field assigns the provided service array to the DID Document.", - "items": { - "$ref": "#/components/schemas/Service" - } - }, - "verificationMethod": { - "type": "array", - "description": "This input field assigns the provided verificationMethod array to the DID Document.", - "items": { - "$ref": "#/components/schemas/VerificationMethod" - } - }, - "authentication": { - "description": "This input field assigns the provided authentication array to the DID Document.", - "type": "array", - "items": { - "type": "string" - } - }, - "didDocument": { - "$ref": "#/components/schemas/DidDocument" - } - } - }, - "CreateResourceRequest": { - "description": "Input fields for the resource creation", - "type": "object", - "additionalProperties": false, - "required": [ - "name", - "type", - "data", - "encoding" - ], - "properties": { - "data": { - "description": "Provide encoded string for the resource data.", - "type": "string" - }, - "encoding": { - "description": "The encoding format of the resource data.", - "type": "string", - "enum": [ - "base64url", - "base64", - "hex" - ] - }, - "name": { - "description": "Resource name.", - "type": "string" - }, - "alsoKnownAs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "uri": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - }, - "version": { - "type": "string" - } - }, - "example": { - "data": "SGVsbG8gV29ybGQ=", - "name": "ResourceName", - "type": "TextDocument" - } - }, - "Customer": { - "type": "object", - "properties": { - "customerId": { - "type": "string" - }, - "address": { - "type": "string" - } - } - }, - "InvalidRequest": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - }, - "UnauthorizedError": { - "description": "Access token is missing or invalid", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Unauthorized Error" - } - } - } - } - }, - "paths": { - "/credential/issue": { - "post": { + "get": { "tags": [ - "Credential" + "Account" ], - "summary": "Issue a credential.", - "description": "This endpoint issues a credential. As input it takes the list of attributes, subjectDid, context and expiration date of the credential to be issued.", + "summary": "Fetch a client.", + "description": "This endpoint verifies the JWT token and returns the customer if it exists.", "security": [ { "bearerAuth": [] } ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialRequest" - } - } - } - }, "responses": { "200": { "description": "The request was successful.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Credential" + "$ref": "#/components/schemas/Customer" } } } @@ -963,40 +580,24 @@ } } }, - "/credential/verify": { + "/key/create": { "post": { "tags": [ - "Credential" + "Key" ], - "summary": "Verify a credential.", - "description": "This endpoint verifies the credential. As input it takes the entire credential itself or just the JWT string.", - "operationId": "verify", + "summary": "Create a key pair.", "security": [ { "bearerAuth": [] } ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialVerifyRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialVerifyRequest" - } - } - } - }, "responses": { "200": { "description": "The request was successful.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IVerifyResult" + "$ref": "#/components/schemas/KeyResult" } } } @@ -1033,14 +634,12 @@ } } }, - "/credential/revoke": { - "post": { + "/key/{kid}": { + "get": { "tags": [ - "Credential" + "Key" ], - "summary": "Revoke a credential.", - "description": "This endpoint verifies the credential. As input it takes the entire credential itself or just the JWT string.", - "operationId": "revoke", + "summary": "Fetch a key pair.", "security": [ { "bearerAuth": [] @@ -1048,36 +647,21 @@ ], "parameters": [ { - "in": "query", - "name": "publish", - "required": true, + "name": "kid", + "in": "path", "schema": { - "type": "boolean", - "default": true - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } + "type": "string" }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - } + "required": true } - }, + ], "responses": { "200": { "description": "The request was successful.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RevocationResult" + "$ref": "#/components/schemas/KeyResult" } } } @@ -1114,38 +698,28 @@ } } }, - "/credential/suspend": { + "/did/create": { "post": { "tags": [ - "Credential" + "DID" ], - "summary": "Suspend a credential.", - "description": "This endpoint suspends the credential. As input it takes the entire credential itself.", - "operationId": "suspend", + "summary": "Create a DID.", + "description": "This endpoint creates a DID by taking a set of input parameters or the whole didDocument itself.", "security": [ { "bearerAuth": [] } ], - "parameters": [ - { - "in": "query", - "name": "publish", - "schema": { - "type": "boolean" - } - } - ], "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" + "$ref": "#/components/schemas/DidCreateRequest" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" + "$ref": "#/components/schemas/DidCreateRequest" } } } @@ -1156,7 +730,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SuspensionResult" + "$ref": "#/components/schemas/DidResult" } } } @@ -1193,38 +767,28 @@ } } }, - "/credential/reinstate": { + "/did/update": { "post": { "tags": [ - "Credential" + "DID" ], - "summary": "Reinstate a credential.", - "description": "This endpoint reinstates the credential. As input it takes the entire credential itself.", - "operationId": "reinstate", + "summary": "Update a DID.", + "description": "This endpoint updates a DID by taking DID document or the particular fields needed to be updated.", "security": [ { "bearerAuth": [] } ], - "parameters": [ - { - "in": "query", - "name": "publish", - "schema": { - "type": "boolean" - } - } - ], "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" + "$ref": "#/components/schemas/DidUpdateRequest" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" + "$ref": "#/components/schemas/DidUpdateRequest" } } } @@ -1235,7 +799,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnSuspensionResult" + "$ref": "#/components/schemas/DidResult" } } } @@ -1272,40 +836,35 @@ } } }, - "/presentation/verify": { + "/did/deactivate/{did}": { "post": { "tags": [ - "Presentation" + "DID" ], - "summary": "Verify a credential presentation.", - "description": "This endpoint verifies the credential presentation. As input it takes the entire presentation itself.", - "operationId": "presentation", + "summary": "Deactivate a DID.", + "description": "This endpoint deactivates a DID by taking DID document or a verification method as an input.", "security": [ { "bearerAuth": [] } ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/PresentationRequest" - } + "parameters": [ + { + "in": "path", + "name": "did", + "schema": { + "type": "string" }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresentationRequest" - } - } + "required": true } - }, + ], "responses": { "200": { "description": "The request was successful.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IVerifyResult" + "$ref": "#/components/schemas/DidResult" } } } @@ -1342,81 +901,39 @@ } } }, - "/account": { + "/resource/create/{did}": { "post": { "tags": [ - "Account" + "Resource" ], - "summary": "Create a client.", - "description": "This endpoint verifies the JWT token and creates a customer if they don't exist.", - "security": [ + "summary": "Create a Resource.", + "parameters": [ { - "bearerAuth": [] + "in": "path", + "name": "did", + "schema": { + "type": "string" + }, + "required": true } ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Customer" - } - } - } - }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" - } + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CreateResourceRequest" } - } - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateResourceRequest" } } } - } - }, - "get": { - "tags": [ - "Account" - ], - "summary": "Fetch a client.", - "description": "This endpoint verifies the JWT token and returns the customer if it exists.", - "security": [ - { - "bearerAuth": [] - } - ], + }, "responses": { "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Customer" - } - } - } + "description": "The request was successful." }, "400": { "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", @@ -1450,12 +967,13 @@ } } }, - "/key/create": { - "post": { + "/did/list": { + "get": { "tags": [ - "Key" + "DID" ], - "summary": "Create a key pair.", + "summary": "Fetch DIDs from wallet.", + "description": "This endpoint returns the list of DIDs controlled by the account.", "security": [ { "bearerAuth": [] @@ -1467,7 +985,10 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/KeyResult" + "type": "array", + "items": { + "type": "string" + } } } } @@ -1504,21 +1025,17 @@ } } }, - "/key/{kid}": { + "/did/{did}": { "get": { "tags": [ - "Key" - ], - "summary": "Fetch a key pair.", - "security": [ - { - "bearerAuth": [] - } + "DID" ], + "summary": "Resolve a DID.", + "description": "This endpoint resolved a DID.", "parameters": [ { - "name": "kid", "in": "path", + "name": "did", "schema": { "type": "string" }, @@ -1531,7 +1048,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/KeyResult" + "$ref": "#/components/schemas/DidDocument" } } } @@ -1568,28 +1085,45 @@ } } }, - "/did/create": { + "/credential-status/create": { "post": { "tags": [ - "DID" + "Credential Status" ], - "summary": "Create a DID.", - "description": "This endpoint creates a DID by taking a set of input parameters or the whole didDocument itself.", - "security": [ + "summary": "Create status list 2021.", + "parameters": [ { - "bearerAuth": [] - } + "in": "query", + "name": "statusPurpose", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + }, + { + "in": "query", + "name": "encrypted", + "required": true, + "schema": { + "type": "boolean", + "default": false + } + } ], "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { - "$ref": "#/components/schemas/DidCreateRequest" + "$ref": "#/components/schemas/CredentialStatusCreateRequest" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/DidCreateRequest" + "$ref": "#/components/schemas/CredentialStatusCreateRequest" } } } @@ -1600,7 +1134,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DidResult" + "$ref": "#/components/schemas/CredentialStatusResult" } } } @@ -1637,28 +1171,45 @@ } } }, - "/did/update": { + "/credential-status/publish": { "post": { "tags": [ - "DID" + "Credential Status" ], - "summary": "Update a DID.", - "description": "This endpoint updates a DID by taking DID document or the particular fields needed to be updated.", - "security": [ + "summary": "Publish status list 2021.", + "parameters": [ { - "bearerAuth": [] + "in": "query", + "name": "statusPurpose", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + }, + { + "in": "query", + "name": "encrypted", + "required": true, + "schema": { + "type": "boolean", + "default": false + } } ], "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { - "$ref": "#/components/schemas/DidUpdateRequest" + "$ref": "#/components/schemas/CredentialStatusPublishRequest" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/DidUpdateRequest" + "$ref": "#/components/schemas/CredentialStatusPublishRequest" } } } @@ -1669,7 +1220,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DidResult" + "$ref": "#/components/schemas/CredentialStatusResult" } } } @@ -1706,26 +1257,38 @@ } } }, - "/did/deactivate/{did}": { - "post": { + "/credential-status/search": { + "get": { "tags": [ - "DID" - ], - "summary": "Deactivate a DID.", - "description": "This endpoint deactivates a DID by taking DID document or a verification method as an input.", - "security": [ - { - "bearerAuth": [] - } + "Credential Status" ], + "summary": "Fetch statusList's published by a DID.", "parameters": [ { - "in": "path", + "in": "query", "name": "did", + "required": true, "schema": { "type": "string" - }, - "required": true + } + }, + { + "in": "query", + "name": "statusPurpose", + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + }, + { + "in": "query", + "name": "statusListName", + "schema": { + "type": "string" + } } ], "responses": { @@ -1734,7 +1297,24 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/DidResult" + "type": "array", + "items": { + "type": "object", + "properties": { + "statusListName": { + "type": "string" + }, + "statusListVersion": { + "type": "string" + }, + "statusListId": { + "type": "string" + }, + "statusListNextVersion": { + "type": "string" + } + } + } } } } @@ -1771,39 +1351,59 @@ } } }, - "/resource/create/{did}": { + "/credential-status/update": { "post": { "tags": [ - "Resource" + "Credential Status" ], - "summary": "Create a Resource.", + "summary": "Update status list 2021.", "parameters": [ { - "in": "path", - "name": "did", + "in": "query", + "name": "statusPurpose", + "required": true, "schema": { - "type": "string" - }, - "required": true + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + }, + { + "in": "query", + "name": "encrypted", + "required": true, + "schema": { + "type": "boolean", + "default": false + } } ], "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { - "$ref": "#/components/schemas/CreateResourceRequest" + "$ref": "#/components/schemas/CredentialStatusUpdateRequest" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CreateResourceRequest" + "$ref": "#/components/schemas/CredentialStatusUpdateRequest" } } } }, "responses": { "200": { - "description": "The request was successful." + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusResult" + } + } + } }, "400": { "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", @@ -1836,476 +1436,882 @@ } } } + } + }, + "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } }, - "/did/list": { - "get": { - "tags": [ - "DID" - ], - "summary": "Fetch DIDs from wallet.", - "description": "This endpoint returns the list of DIDs controlled by the account.", - "security": [ - { - "bearerAuth": [] + "schemas": { + "CredentialRequest": { + "description": "Input fields for the create operation.", + "type": "object", + "additionalProperties": false, + "properties": { + "issuerDid": { + "description": "This input field is the Issuer's DID.", + "type": "string" + }, + "subjectDid": { + "description": "This input field is the holder's DID.", + "type": "string" + }, + "attributes": { + "description": "Json input of the attributes.", + "type": "object" + }, + "@context": { + "description": "Additional contexts to be included in the credential.", + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "description": "Additional type property to be included in the credential.", + "type": "array", + "items": { + "type": "string" + } + }, + "expirationDate": { + "description": "Optional expiration date according to the specification." + }, + "format": { + "description": "Select one of the supported credential formats, jwt by default.", + "type": "string", + "enum": [ + "jwt", + "lds" + ] + }, + "credentialStatus": { + "description": "Optional field to support revocation or suspension, which takes statusListName and statusListPurpose as inputs.", + "type": "object", + "required": [ + "statusPurpose", + "statusListName" + ], + "properties": { + "statusPurpose": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + }, + "statusListName": { + "type": "string" + }, + "statusListIndex": { + "type": "number" + }, + "statusListVersion": { + "type": "string" + }, + "statusListRangeStart": { + "type": "number" + }, + "statusListRangeEnd": { + "type": "number" + }, + "indexNotIn": { + "type": "number" + } + } } + }, + "required": [ + "issuerDid", + "subjectDid", + "attributes" ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { + "example": { + "issuerDid": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "attributes": { + "gender": "male", + "name": "Bob" + }, + "@context": [ + "https://schema.org" + ], + "type": [ + "Person" + ], + "format": "jwt", + "credentialStatus": { + "statusPurpose": "revocation", + "statusListName": "employee-credentials", + "statusListIndex": 10 + } + } + }, + "Credential": { + "description": "Input fields for the update operation.", + "type": "object", + "additionalProperties": false, + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "type": "array", + "items": { + "type": "string" + } + }, + "expirationDate": { + "type": "string" + }, + "issuer": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "credentialSubject": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "credentialStatus": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "statusListIndex": { + "type": "string" + }, + "statusPurpose": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + }, + "type": { + "type": "string", + "enum": [ + "StatusList2021Entry" + ] + } + } + }, + "issuanceDate": { + "type": "string" + }, + "proof": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "jwt": { + "type": "string" + } + } + } + }, + "example": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org", + "https://veramo.io/contexts/profile/v1" + ], + "credentialSubject": { + "gender": "male", + "id": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "name": "Bob" + }, + "credentialStatus": { + "id": "https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20", + "statusIndex": 20, + "statusPurpose": "suspension", + "type": "StatusList2021Entry" + }, + "issuanceDate": "2023-06-08T13:49:28.000Z", + "issuer": { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + }, + "proof": { + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg", + "type": "JwtProof2020" + }, + "type": [ + "VerifiableCredential", + "Person" + ] + } + }, + "CredentialRevokeRequest": { + "type": "object", + "properties": { + "credential": { + "description": "This input field takes the credential object or the JWT string", + "oneOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + } + }, + "RevocationResult": { + "properties": { + "revoked": { + "type": "boolean" + } + } + }, + "SuspensionResult": { + "properties": { + "suspended": { + "type": "boolean" + }, + "statusList": { + "type": "string" + } + } + }, + "UnSuspensionResult": { + "properties": { + "unsuspended": { + "type": "boolean" + }, + "statusList": { + "type": "string" + } + } + }, + "CredentialVerifyRequest": { + "type": "object", + "properties": { + "credential": { + "description": "This input field takes the credential object or the JWT string.\\", + "allOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + } + }, + "IVerifyResult": { + "type": "object", + "properties": { + "verified": { + "type": "boolean" + }, + "issuer": { + "type": "string" + }, + "signer": { + "type": "object" + }, + "jwt": { + "type": "string" + }, + "verifiableCredential": { + "type": "object" + } + }, + "example": { + "verified": true, + "polices": {}, + "issuer": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "signer": { + "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", + "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt", + "type": "Ed25519VerificationKey2018" + } + } + }, + "PresentationRequest": { + "type": "object", + "required": [ + "presentation" + ], + "properties": { + "presentation": { + "description": "This input field takes the presentation object or the JWT string.", + "allOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + } + }, + "CredentialStatusCreateRequest": { + "allOf": [ + { + "type": "object", + "required": [ + "did", + "statusListName" + ], + "properties": { + "did": { + "description": "The DID of the status list publisher.", + "type": "string" + }, + "statusListName": { + "description": "The name of the status list to be created.", + "type": "string" + }, + "length": { + "description": "The length of the status list to be created. The default and minimum length is 140000 which is 16kb." + }, + "encoding": { + "description": "The encoding format of the statusList to be published.", + "type": "string", + "default": "base64url", + "enum": [ + "base64url", + "base64", + "hex" + ] + }, + "statusListVersion": { + "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList.", + "type": "string" + }, + "alsoKnownAs": { + "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "description": { + "type": "string" + } + } + } + } + } + } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials" + } + }, + "CredentialStatusResult": { + "type": "object", + "properties": { + "success": { + "type": "object", + "properties": { + "created": { + "type": "boolean" + }, + "resource": { + "type": "object", + "metadata": { + "encoding": "base64url", + "encrypted": false + } + }, + "resourceMetadata": { + "type": "object" + }, + "statusList2021": { + "type": "object", + "properties": { + "statusList2021": { + "type": "object", + "properties": { + "encodedList": { + "type": "string" + }, + "type": { + "type": "string" + }, + "validFrom": { + "type": "string" + } + } + } + } + }, + "metadata": { + "type": "string", + "properties": { + "encoding": { "type": "string" + }, + "encrypted": { + "type": "boolean" } } } } + } + }, + "example": { + "created": true, + "resource": { + "StatusList2021": { + "encodedList": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", + "type": "StatusList2021Revocation", + "validFrom": "2023-06-26T11:45:19.349Z" + }, + "metadata": { + "encoding": "base64url", + "encrypted": false + } }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" + "resourceMetadata": { + "checksum": "909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2", + "created": "2023-06-26T11:45:20Z", + "mediaType": "application/json", + "nextVersionId": null, + "previousVersionId": null, + "resourceCollectionId": "7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "resourceId": "5945233a-a4b5-422b-b893-eaed5cedd2dc", + "resourceName": "cheqd-revocation-1", + "resourceType": "StatusList2021Revocation", + "resourceURI": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc", + "resourceVersion": "2023-06-26T11:45:19.349Z" + } + } + }, + "CredentialStatusPublishRequest": { + "allOf": [ + { + "type": "object", + "required": [ + "did", + "encodedList", + "statusListName", + "encoding" + ], + "properties": { + "did": { + "description": "The DID of the status list publisher.", + "type": "string" + }, + "statusListName": { + "description": "The name of the statusList to be published", + "type": "string" + }, + "encodedList": { + "description": "The encoding format of the statusList provided", + "type": "string", + "enum": [ + "base64url", + "base64", + "hex" + ] + }, + "statusListVersion": { + "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList", + "type": "string" + }, + "alsoKnownAs": { + "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "description": { + "type": "string" + } + } } } } + } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "name": "cheqd-employee-credentials", + "version": "2023", + "data": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", + "encoding": "base64url" + } + }, + "CredentialStatusUpdateRequest": { + "type": "object", + "required": [ + "did", + "statusListName", + "indices" + ], + "properties": { + "did": { + "description": "The DID of the status list publisher.", + "type": "string" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "statusListName": { + "description": "The name of the status list to be created.", + "type": "string" }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } - } + "indices": { + "description": "Provide the list of indices to be updated.", + "type": "array", + "items": { + "type": "number" } + }, + "statusListVersion": { + "description": "The input field is OPTIONAL, If present uses the provided statusListVersion for the update operation.", + "type": "string" } } - } - }, - "/did/{did}": { - "get": { - "tags": [ - "DID" - ], - "summary": "Resolve a DID.", - "description": "This endpoint resolved a DID.", - "parameters": [ - { - "in": "path", - "name": "did", - "schema": { - "type": "string" - }, - "required": true + }, + "KeyResult": { + "type": "object", + "properties": { + "kid": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Ed25519", + "Secp256k1" + ] + }, + "publicKeyHex": { + "type": "string" } - ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidDocument" - } - } + } + }, + "DidDocument": { + "description": "This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See https://identity.foundation/did-registration/#diddocument.", + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" } }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" - } - } + "id": { + "type": "string" + }, + "controllers": { + "type": "array", + "items": { + "type": "string" } }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "authentication": { + "type": "array", + "items": { + "type": "string" + } }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } - } + "assertionMethod": { + "type": "array", + "items": { + "type": "string" } - } - } - } - }, - "/credential-status/create": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Create status list 2021.", - "parameters": [ - { - "in": "query", - "name": "statusPurpose", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] + }, + "capabilityInvocation": { + "type": "array", + "items": { + "type": "string" } }, - { - "in": "query", - "name": "encrypted", - "required": true, - "schema": { - "type": "boolean", - "default": false + "capabilityDelegation": { + "type": "array", + "items": { + "type": "string" } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateRequest" - } + }, + "keyAgreement": { + "type": "array", + "items": { + "type": "string" + } + }, + "verificationMethod": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VerificationMethod" + } + }, + "service": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" } } }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusResult" - } - } + "example": { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "controller": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + ], + "verificationMethod": [ + { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" } + ], + "authentication": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1" + ] + } + }, + "DidCreateRequest": { + "type": "object", + "properties": { + "network": { + "type": "string", + "enum": [ + "testnet", + "mainnet" + ] }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" - } - } - } + "methodSpecificIdAlgo": { + "type": "string", + "enum": [ + "uuid", + "base58btc" + ] }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "verificationMethodType": { + "type": "string", + "enum": [ + "Ed25519VerificationKey2018", + "JsonWebKey2020", + "Ed25519VerificationKey2020" + ] }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } - } - } + "serviceEndpoint": { + "type": "string" + }, + "assertionMethod": { + "description": "An assertion method is required to issue JSONLD credentials.", + "type": "boolean", + "default": true + }, + "didDocument": { + "$ref": "#/components/schemas/DidDocument" } } - } - }, - "/credential-status/publish": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Publish status list 2021.", - "parameters": [ - { - "in": "query", - "name": "statusPurpose", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] + }, + "DidResult": { + "type": "object", + "properties": { + "did": { + "type": "string" + }, + "controllerKeyId": { + "type": "string" + }, + "keys": { + "type": "array", + "items": { + "type": "object" } }, - { - "in": "query", - "name": "encrypted", - "required": true, - "schema": { - "type": "boolean", - "default": false + "services": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" } } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusPublishRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusPublishRequest" - } + } + }, + "VerificationMethod": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "controller": { + "type": "string" + }, + "publicKeyMultibase": { + "type": "string" + }, + "publicKeyJwk": { + "type": "array", + "items": { + "type": "string" } } }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusResult" - } - } - } - }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" - } - } - } - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "example": { + "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "id": "did:cheqd:testnet :7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", + "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt", + "type": "Ed25519VerificationKey2018" + } + }, + "Service": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#rand" }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } - } + "type": { + "type": "string", + "example": "rand" + }, + "serviceEndpoint": { + "type": "array", + "items": { + "type": "string", + "example": "https://rand.in" } } } - } - }, - "/credential-status/search": { - "get": { - "tags": [ - "Credential Status" - ], - "summary": "Fetch statusList's published by a DID.", - "parameters": [ - { - "in": "query", - "name": "did", - "required": true, - "schema": { - "type": "string" + }, + "DidUpdateRequest": { + "type": "object", + "properties": { + "did": { + "type": "string" + }, + "service": { + "type": "array", + "description": "This input field assigns the provided service array to the DID Document.", + "items": { + "$ref": "#/components/schemas/Service" } }, - { - "in": "query", - "name": "statusPurpose", - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] + "verificationMethod": { + "type": "array", + "description": "This input field assigns the provided verificationMethod array to the DID Document.", + "items": { + "$ref": "#/components/schemas/VerificationMethod" } }, - { - "in": "query", - "name": "statusListName", - "schema": { + "authentication": { + "description": "This input field assigns the provided authentication array to the DID Document.", + "type": "array", + "items": { "type": "string" } + }, + "didDocument": { + "$ref": "#/components/schemas/DidDocument" } + } + }, + "CreateResourceRequest": { + "description": "Input fields for the resource creation", + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "type", + "data", + "encoding" ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "statusListName": { - "type": "string" - }, - "statusListVersion": { - "type": "string" - }, - "statusListId": { - "type": "string" - }, - "statusListNextVersion": { - "type": "string" - } - } - } - } - } - } + "properties": { + "data": { + "description": "Provide encoded string for the resource data.", + "type": "string" }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" - } - } - } + "encoding": { + "description": "The encoding format of the resource data.", + "type": "string", + "enum": [ + "base64url", + "base64", + "hex" + ] }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "name": { + "description": "Resource name.", + "type": "string" }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" + "alsoKnownAs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" }, - "example": { - "error": "Internal Error" + "description": { + "type": "string" } } } + }, + "version": { + "type": "string" } + }, + "example": { + "data": "SGVsbG8gV29ybGQ=", + "name": "ResourceName", + "type": "TextDocument" } - } - }, - "/credential-status/update": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Update status list 2021.", - "parameters": [ - { - "in": "query", - "name": "statusPurpose", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - } + }, + "Customer": { + "type": "object", + "properties": { + "customerId": { + "type": "string" }, - { - "in": "query", - "name": "encrypted", - "required": true, - "schema": { - "type": "boolean", - "default": false - } + "address": { + "type": "string" } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateRequest" - } - } + } + }, + "InvalidRequest": { + "type": "object", + "properties": { + "error": { + "type": "string" } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusResult" - } - } - } - }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Invalid Request" - } - } - } - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } - } - } + } + }, + "UnauthorizedError": { + "description": "Access token is missing or invalid", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Unauthorized Error" } } } } - } + }, + "tags": [] } \ No newline at end of file