From 9186061d005a7ca03d72756929d6819511c517bd Mon Sep 17 00:00:00 2001 From: DaevMithran Date: Mon, 10 Jul 2023 18:40:29 +0530 Subject: [PATCH] feat: Add credential-status check api --- src/app.ts | 7 +- src/controllers/revocation.ts | 34 +- src/services/identity/IIdentity.ts | 7 +- src/services/identity/agent.ts | 15 + src/services/identity/local.ts | 8 +- src/services/identity/postgres.ts | 9 +- src/static/swagger.json | 4507 ++++++++++++++-------------- src/types/types.ts | 6 +- 8 files changed, 2377 insertions(+), 2216 deletions(-) diff --git a/src/app.ts b/src/app.ts index 7db1db5e..d0ffeee0 100644 --- a/src/app.ts +++ b/src/app.ts @@ -99,10 +99,11 @@ class App { app.post(`/presentation/verify`, CredentialController.presentationValidator, new CredentialController().verifyPresentation) //revocation - app.post('/credential-status/create', RevocationController.queryValidator, RevocationController.statusListValidator, new RevocationController().createStatusList) + app.post('/credential-status/create', RevocationController.commonValidator, RevocationController.statusListValidator, new RevocationController().createStatusList) app.post('/credential-status/update', RevocationController.updateValidator, new RevocationController().updateStatusList) - app.post('/credential-status/publish', RevocationController.queryValidator, new RevocationController().createStatusList) - app.get('/credential-status/search', RevocationController.queryValidator, new RevocationController().fetchStatusList) + app.post('/credential-status/publish', RevocationController.commonValidator, new RevocationController().createStatusList) + app.post('/credential-status/check', RevocationController.commonValidator, RevocationController.checkValidator, new RevocationController().checkStatusList) + app.get('/credential-status/search', RevocationController.commonValidator, new RevocationController().fetchStatusList) // store app.post(`/store`, new StoreController().set) diff --git a/src/controllers/revocation.ts b/src/controllers/revocation.ts index ec23e71d..80cfffaf 100644 --- a/src/controllers/revocation.ts +++ b/src/controllers/revocation.ts @@ -15,7 +15,7 @@ export class RevocationController { check('statusPurpose').optional().isIn(['revocation', 'suspension']).withMessage('invalid statusPurpose') ] - static queryValidator = [ + static commonValidator = [ check('did').isString().withMessage('DID is required') .contains('did:cheqd:').withMessage('Provide a valid cheqd DID'), query('statusPurpose').optional().isString().withMessage('statusPurpose should be a string') @@ -34,6 +34,13 @@ export class RevocationController { query('publish').isBoolean().withMessage('publish should be a boolean value') ] + static checkValidator = [ + check('index').exists().withMessage('Index is required') + .isNumeric().withMessage('Index should be a number'), + check('statusListName').exists().withMessage('StatusListName is required') + .isString().withMessage('Invalid statusListName') + ] + async createStatusList(request: Request, response: Response) { const result = validationResult(request) if (!result.isEmpty()) { @@ -101,7 +108,7 @@ export class RevocationController { } } - async updateStatusList(request: Request, response: Response) { + async updateStatusList(request: Request, response: Response) { const result = validationResult(request) if (!result.isEmpty()) { return response.status(400).json({ error: result.array()[0].msg }) @@ -125,4 +132,27 @@ export class RevocationController { }) } } + + async checkStatusList(request: Request, response: Response) { + const result = validationResult(request) + if (!result.isEmpty()) { + return response.status(400).json({ error: result.array()[0].msg }) + } + + let { did, statusListName, index } = request.body + const statusPurpose = request.query.statusPurpose as 'revocation' | 'suspension' + + try { + let result: any + result = await Identity.instance.checkStatusList2021(did, { statusListIndex: index, statusListName, statusPurpose }, response.locals.customerId) + if (result.error) { + return response.status(400).json(result) + } + return response.status(200).json(result) + } catch (error) { + return response.status(500).json({ + error: `Internal error: ${error}` + }) + } + } } diff --git a/src/services/identity/IIdentity.ts b/src/services/identity/IIdentity.ts index d57394a5..a7b99aa1 100644 --- a/src/services/identity/IIdentity.ts +++ b/src/services/identity/IIdentity.ts @@ -11,8 +11,8 @@ import type { } from '@veramo/core' import type { AbstractPrivateKeyStore } from '@veramo/key-manager' import type { ResourcePayload } from '@cheqd/did-provider-cheqd' -import type { BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateEncryptedStatusList2021Result, CreateStatusList2021Result, RevocationResult, SuspensionResult, UnsuspensionResult } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' -import type { BroadCastStatusListOptions, CreateStatusListOptions, CredentialRequest, StatusOptions, UpdateStatusListOptions, VeramoAgent, VerifyCredentialStatusOptions, VerifyPresentationStatusOptions } from '../../types/types' +import type { BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateEncryptedStatusList2021Result, CreateStatusList2021Result, RevocationResult, StatusCheckResult, SuspensionResult, UnsuspensionResult } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' +import type { BroadCastStatusListOptions, CheckStatusListOptions, CreateStatusListOptions, CredentialRequest, StatusOptions, UpdateStatusListOptions, VeramoAgent, VerifyCredentialStatusOptions, VerifyPresentationStatusOptions } from '../../types/types' export interface IIdentity { agent?: TAgent @@ -35,7 +35,8 @@ export interface IIdentity { createStatusList2021(did: string, resourceOptions: ResourcePayload, statusOptions: CreateStatusListOptions, agentId: string): Promise updateStatusList2021(did: string, statusOptions: UpdateStatusListOptions, publish?: boolean, agentId?: string): Promise broadcastStatusList2021(did: string, resourceOptions: ResourcePayload, statusOptions: BroadCastStatusListOptions, agentId?: string): Promise + checkStatusList2021(did: string, statusOptions: CheckStatusListOptions, agentId?: string): Promise revokeCredentials(credential: VerifiableCredential | VerifiableCredential[], publish: boolean, agentId?: string): Promise suspendCredentials(credential: VerifiableCredential | VerifiableCredential[], publish: boolean, agentId?: string): Promise - reinstateCredentials(credential: VerifiableCredential | VerifiableCredential[], publish: boolean, agentId?: string): Promise + reinstateCredentials(credential: VerifiableCredential | VerifiableCredential[], publish: boolean, agentId?: string): Promise } diff --git a/src/services/identity/agent.ts b/src/services/identity/agent.ts index 962d805a..77f4e854 100644 --- a/src/services/identity/agent.ts +++ b/src/services/identity/agent.ts @@ -29,6 +29,7 @@ import { CheqdNetwork } from '@cheqd/sdk' import { Resolver, ResolverRegistry } from 'did-resolver' import type { ICheqdBroadcastStatusList2021Args, + ICheqdCheckCredentialStatusWithStatusList2021Args, ICheqdCreateStatusList2021Args, ICheqdDeactivateIdentifierArgs, ICheqdRevokeBulkCredentialsWithStatusList2021Args, @@ -37,6 +38,7 @@ import type { } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' import { BroadCastStatusListOptions, + CheckStatusListOptions, cheqdDidRegex, CreateAgentRequest, CreateStatusListOptions, @@ -384,4 +386,17 @@ export class Veramo { }) } } + + async checkStatusList2021(agent: VeramoAgent, did: string, statusOptions: CheckStatusListOptions) { + return await agent.cheqdCheckCredentialStatus({ + statusOptions: { + issuerDid: did, + ...statusOptions, + }, + decryptionOptions: { + accessControlConditions: [] + }, + bootstrapOptions: {} + } satisfies ICheqdCheckCredentialStatusWithStatusList2021Args) + } } diff --git a/src/services/identity/local.ts b/src/services/identity/local.ts index 87eb5564..37275cc6 100644 --- a/src/services/identity/local.ts +++ b/src/services/identity/local.ts @@ -9,10 +9,10 @@ import { import { AbstractPrivateKeyStore, MemoryPrivateKeyStore } from '@veramo/key-manager' import { KeyManagementSystem } from '@veramo/kms-local' import { CheqdDIDProvider, ResourcePayload } from '@cheqd/did-provider-cheqd' -import { BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateEncryptedStatusList2021Result, CreateStatusList2021Result, ICheqdBroadcastEncryptedStatusList2021Args } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' +import { BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateEncryptedStatusList2021Result, CreateStatusList2021Result, ICheqdBroadcastEncryptedStatusList2021Args, StatusCheckResult } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' import { CheqdNetwork } from '@cheqd/sdk' -import { BroadCastStatusListOptions, CreateStatusListOptions, CredentialRequest, DefaultRPCUrl, StatusOptions, UpdateStatusListOptions, VeramoAgent, VerifyCredentialStatusOptions, VerifyPresentationStatusOptions } from '../../types/types.js' +import { BroadCastStatusListOptions, CheckStatusListOptions, CreateStatusListOptions, CredentialRequest, DefaultRPCUrl, StatusOptions, UpdateStatusListOptions, VeramoAgent, VerifyCredentialStatusOptions, VerifyPresentationStatusOptions } from '../../types/types.js' import { Connection } from '../../database/connection/connection.js' import { IIdentity } from './IIdentity.js' import { Veramo } from './agent.js' @@ -166,6 +166,10 @@ export class LocalIdentity implements IIdentity { return await Veramo.instance.broadcastStatusList2021(this.initAgent(), did, resourceOptions, statusOptions) } + async checkStatusList2021(did: string, statusOptions: CheckStatusListOptions): Promise { + return await Veramo.instance.checkStatusList2021(this.initAgent(), did, statusOptions) + } + async revokeCredentials(credentials: VerifiableCredential | VerifiableCredential[], publish: boolean) { return await Veramo.instance.revokeCredentials(this.initAgent(), credentials, publish) } diff --git a/src/services/identity/postgres.ts b/src/services/identity/postgres.ts index bf02d63c..0af45bc1 100644 --- a/src/services/identity/postgres.ts +++ b/src/services/identity/postgres.ts @@ -16,7 +16,7 @@ import { KeyManagementSystem, SecretBox } from '@veramo/kms-local' import { PrivateKeyStore } from '@veramo/data-store' import { CheqdDIDProvider, ResourcePayload } from '@cheqd/did-provider-cheqd' import { CheqdNetwork } from '@cheqd/sdk' -import { BroadCastStatusListOptions, cheqdDidRegex, CreateStatusListOptions, CredentialRequest, DefaultRPCUrl, StatusOptions, UpdateStatusListOptions, VeramoAgent, VerifyCredentialStatusOptions, VerifyPresentationStatusOptions } from '../../types/types.js' +import { BroadCastStatusListOptions, CheckStatusListOptions, cheqdDidRegex, CreateStatusListOptions, CredentialRequest, DefaultRPCUrl, StatusOptions, UpdateStatusListOptions, VeramoAgent, VerifyCredentialStatusOptions, VerifyPresentationStatusOptions } from '../../types/types.js' import { Connection } from '../../database/connection/connection.js' import { CustomerEntity } from '../../database/entities/customer.entity.js' import { IIdentity } from './IIdentity.js' @@ -24,7 +24,7 @@ import { CustomerService } from '../customer.js' import { Veramo } from './agent.js' import * as dotenv from 'dotenv' -import { BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateEncryptedStatusList2021Result, CreateStatusList2021Result } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd.js' +import { BulkRevocationResult, BulkSuspensionResult, BulkUnsuspensionResult, CreateEncryptedStatusList2021Result, CreateStatusList2021Result, StatusCheckResult } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd.js' dotenv.config() const { @@ -234,6 +234,11 @@ export class PostgresIdentity implements IIdentity { return await Veramo.instance.updateStatusList2021(agent, did, statusOptions, publish) } + async checkStatusList2021(did: string, statusOptions: CheckStatusListOptions, agentId: string): Promise { + const agent = await this.createAgent(agentId) + return await Veramo.instance.checkStatusList2021(agent, did, statusOptions) + } + async broadcastStatusList2021(did: string, resourceOptions: ResourcePayload, statusOptions: BroadCastStatusListOptions, agentId: string): Promise { const agent = await this.createAgent(agentId) return await Veramo.instance.broadcastStatusList2021(agent, did, resourceOptions, statusOptions) diff --git a/src/static/swagger.json b/src/static/swagger.json index 9cffaa3b..a63d2b34 100644 --- a/src/static/swagger.json +++ b/src/static/swagger.json @@ -1,2315 +1,2418 @@ { "openapi": "3.0.0", "servers": [ - { - "url": "/" - } + { + "url": "/" + } ], "info": { - "description": "API service to create and manage DIDs and credentials on cheqd network.", - "version": "2.0.0", - "title": "Credential Service for cheqd network" + "description": "API service to create and manage DIDs and credentials on cheqd network.", + "version": "2.0.0", + "title": "Credential Service for cheqd network" }, "tags": [ - { - "name": "Credential", - "externalDocs": { - "url": "https://github.com/cheqd/credential-service#readme" - } + { + "name": "Credential", + "externalDocs": { + "url": "https://github.com/cheqd/credential-service#readme" } + } ], "paths": { - "/key/create": { - "post": { - "tags": [ - "Key" - ], - "summary": "Create a Keypair", - "security": [ - { - "bearerAuth": [] - } - ], - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/KeyResult" - } - } - } - }, - "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" - } - } - } - } + "/key/create": { + "post": { + "tags": [ + "Key" + ], + "summary": "Create a Keypair", + "security": [ + { + "bearerAuth": [] + } + ], + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KeyResult" + } + } + } + }, + "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" + } } + } } - }, - "/key/{kid}": { - "get": { - "tags": [ - "Key" - ], - "summary": "Fetch keypair", - "security": [ - { - "bearerAuth": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "kid", - "schema": { - "type": "string" - }, - "required": true - } - ], - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/KeyResult" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/key/{kid}": { + "get": { + "tags": [ + "Key" + ], + "summary": "Fetch keypair", + "security": [ + { + "bearerAuth": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "kid", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KeyResult" + } } + } + }, + "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" + } + } + } } - }, - "/did/create": { - "post": { - "tags": [ - "DID" - ], - "summary": "Create a DID", - "description": "

This endpoint creates a DID by taking a set of input parameters or the whole didDocument itself

", - "security": [ - { - "bearerAuth": [] - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/DIDCreateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DIDCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidResult" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/did/create": { + "post": { + "tags": [ + "DID" + ], + "summary": "Create a DID", + "description": "

This endpoint creates a DID by taking a set of input parameters or the whole didDocument itself

", + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DIDCreateRequest" } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DIDCreateRequest" + } + } } - }, - "/did/update": { - "post": { - "tags": [ - "DID" - ], - "summary": "Update a DID", - "description": "

This endpoint updates a DID by taking DID document or the particular fields needed to be updated

", - "security": [ - { - "bearerAuth": [] - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/DIDUpdateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DIDUpdateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidResult" - } - } - } - }, - "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" - } - } - } - } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidResult" + } } + } + }, + "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" + } + } + } } - }, - "/did/deactivate/{did}": { - "post": { - "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": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "did", - "schema": { - "type": "string" - }, - "required": true - } - ], - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidResult" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/did/update": { + "post": { + "tags": [ + "DID" + ], + "summary": "Update a DID", + "description": "

This endpoint updates a DID by taking DID document or the particular fields needed to be updated

", + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DIDUpdateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DIDUpdateRequest" } + } } - }, - "/did/list": { - "get": { - "tags": [ - "DID" - ], - "summary": "Fetch DIDs from wallet", - "description": "

This endpoint returns the list of DIDs controlled by the account

", - "security": [ - { - "bearerAuth": [] - } - ], - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "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" - } - } - } - }, - "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" - } - } - } - } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidResult" + } + } + } + }, + "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" + } + } + } } - }, - "/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 - } - ], - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidDocument" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/did/deactivate/{did}": { + "post": { + "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": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "did", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidResult" + } } + } + }, + "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" + } + } + } } - }, - "/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" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Credential" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/did/list": { + "get": { + "tags": [ + "DID" + ], + "summary": "Fetch DIDs from wallet", + "description": "

This endpoint returns the list of DIDs controlled by the account

", + "security": [ + { + "bearerAuth": [] + } + ], + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "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" + } + } + } + }, + "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" + } } + } } - }, - "/credential/verify": { - "post": { - "tags": [ - "Credential" - ], - "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", - "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" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/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 + } + ], + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidDocument" + } + } + } + }, + "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" + } } + } } - }, - "/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" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RevocationResult" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/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" + } + } } - }, - "/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": [] - } - ], - "parameters": [ - { - "in": "query", - "name": "publish", - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SuspensionResult" - } - } - } - }, - "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" - } - } - } - } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Credential" + } + } + } + }, + "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" + } } + } } - }, - "/credential/reinstate": { - "post": { - "tags": [ - "Credential" - ], - "summary": "Reinstate a credential", - "description": "

This endpoint reinstates the credential. As input it takes the entire credential itself

", - "operationId": "reinstate", - "security": [ - { - "bearerAuth": [] - } - ], - "parameters": [ - { - "in": "query", - "name": "publish", - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnSuspensionResult" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/credential/verify": { + "post": { + "tags": [ + "Credential" + ], + "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", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialVerifyRequest" } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialVerifyRequest" + } + } } - }, - "/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", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/PresentationRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresentationRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IVerifyResult" - } - } - } - }, - "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" - } - } - } - } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IVerifyResult" + } + } + } + }, + "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" + } + } + } } - }, - "/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" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/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" } + } + } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevocationResult" + } + } + } }, - "get": { - "tags": [ - "Account" - ], - "summary": "Fetch 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" - } - } - } - }, - "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" - } - } - } - } + "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" + } + } + } } - }, - "/resource/create/{did}": { - "post": { - "tags": [ - "Resource" - ], - "summary": "Create a Resource", - "parameters": [ - { - "in": "path", - "name": "did", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CreateResourceRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateResourceRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The resource is created successfully" - }, - "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" - } - } - } - } + } + } + }, + "/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": [] + } + ], + "parameters": [ + { + "in": "query", + "name": "publish", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + } } - }, - "/credential-status/create": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Create statuslist 2021", - "parameters": [ - { - "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/CredentialStatusCreateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "StatusList is created successfully", - "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" - } - } - } - } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuspensionResult" + } } + } + }, + "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" + } + } + } } - }, - "/credential-status/update": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Publish statuslist 2021", - "parameters": [ - { - "in": "query", - "name": "statusAction", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revoke", - "suspend", - "reinstate" - ] - } - }, - { - "in": "query", - "name": "publish", - "required": true, - "schema": { - "type": "boolean", - "default": true - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "StatusList is published successfully", - "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" - } - } - } - } + } + } + }, + "/credential/reinstate": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Reinstate a credential", + "description": "

This endpoint reinstates the credential. As input it takes the entire credential itself

", + "operationId": "reinstate", + "security": [ + { + "bearerAuth": [] + } + ], + "parameters": [ + { + "in": "query", + "name": "publish", + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" } + } } - }, - "/credential-status/publish": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Publish statuslist 2021", - "parameters": [ - { - "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/CredentialStatusPublishRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusPublishRequest" - } - } - } - }, - "responses": { - "200": { - "description": "StatusList is published successfully", - "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" - } - } - } - } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnSuspensionResult" + } + } + } + }, + "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" + } } + } } - }, - "/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" - } - }, - { - "in": "query", - "name": "statusPurpose", - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - } - }, - { - "in": "query", - "name": "statusListName", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "StatusList is fetched successfully", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "statusListName": { - "type": "string" - }, - "statusListVersion": { - "type": "string" - }, - "statusListId": { - "type": "string" - }, - "statusListNextVersion": { - "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" - } - } - } - }, - "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" - } - } - } - } + } + } + }, + "/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", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/PresentationRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/PresentationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IVerifyResult" + } + } + } + }, + "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" + } } + } } + } } - }, - "components": { - "securitySchemes": { - "bearerAuth": { - "type": "http", - "scheme": "bearer", - "bearerFormat": "JWT" + }, + "/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" + } + } + } + }, + "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" + } + } + } + } + } }, - "schemas": { - "DidResult": { - "type": "object", - "properties": { - "did": { - "type": "string" - }, - "controllerKeyId": { - "type": "string" - }, - "keys": { - "type": "array", - "items": { - "type": "object" - } - }, - "services": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" - } - } + "get": { + "tags": [ + "Account" + ], + "summary": "Fetch 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" + } } + } }, - "KeyResult": { - "type": "object", - "properties": { - "kid": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Ed25519", - "Secp256k1" - ] - }, - "publicKeyHex": { - "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" + } } + } }, - "DidDocument": { - "description": "This input field contains a complete DID document", - "type": "object", - "properties": { - "context": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - }, - "controller": { - "type": "array", - "items": { - "type": "string" - }, - "example": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - ] - }, - "authentication": { - "type": "array", - "items": { - "type": "string" - }, - "example": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-0" - ] - }, - "assertionMethod": { - "type": "array", - "items": { - "type": "string" - } - }, - "capabilityInvocation": { - "type": "array", - "items": { - "type": "string" - } - }, - "capabilityDelegation": { - "type": "array", - "items": { - "type": "string" - } - }, - "keyAgreement": { - "type": "array", - "items": { - "type": "string" - } - }, - "verificationMethod": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VerificationMethod" - } - }, - "service": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" - } - } - }, - "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" - ] + "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" + } + } + } + } + } + } + }, + "/resource/create/{did}": { + "post": { + "tags": [ + "Resource" + ], + "summary": "Create a Resource", + "parameters": [ + { + "in": "path", + "name": "did", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CreateResourceRequest" } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateResourceRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The resource is created successfully" }, - "VerificationMethod": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-0" - }, - "type": { - "type": "string", - "example": "Ed25519VerificationKey2018" - }, - "controller": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - }, - "publicKeyBase58": { - "type": "string", - "example": "so1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" - }, - "publicKeyMultibase": { - "type": "string", - "example": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" - }, - "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" + "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" + } } + } }, - "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" - ] - } + "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" + } } + } + } + } + } + }, + "/credential-status/create": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Create statuslist 2021", + "parameters": [ + { + "in": "query", + "name": "statusPurpose", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } }, - "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", - "type": "string" - }, - "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" - }, - "statusListVersipon": { - "type": "string" - }, - "statusListRangeStart": { - "type": "number" - }, - "statusListRangeEnd": { - "type": "number" - }, - "indexNotIn": { - "type": "number" - } - }, - "example": { - "statusPurpose": "revocation", - "statusListName": "employee-credentials" - } - } - }, - "required": [ - "issuerDid", - "subjectDid", - "attributes" - ], - "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 - } + { + "in": "query", + "name": "encrypted", + "required": true, + "schema": { + "type": "boolean", + "default": false + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "StatusList is created successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusResult" + } } + } }, - "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", - "statusListIndex": "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" - ] + "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" + } + } + } + } + } + } + }, + "/credential-status/update": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Publish statuslist 2021", + "parameters": [ + { + "in": "query", + "name": "statusAction", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revoke", + "suspend", + "reinstate" + ] + } + }, + { + "in": "query", + "name": "publish", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateRequest" } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "StatusList is published successfully", + "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" + } + } + } + } + } + } + }, + "/credential-status/publish": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Publish statuslist 2021", + "parameters": [ + { + "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/CredentialStatusPublishRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusPublishRequest" + } + } + } + }, + "responses": { + "200": { + "description": "StatusList is published successfully", + "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" }, - "Customer": { - "type": "object", - "properties": { - "customerId": { - "type": "string" - }, - "address": { - "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" + } } + } + } + } + } + }, + "/credential-status/check": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Check Credential Status of an index in statuslist 2021", + "parameters": [ + { + "in": "query", + "name": "statusPurpose", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } }, - "InvalidRequest": { - "type": "object", - "properties": { - "error": { - "type": "string" - } + { + "in": "query", + "name": "encrypted", + "required": true, + "schema": { + "type": "boolean", + "default": false + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCheckRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCheckRequest" + } + } + } + }, + "responses": { + "200": { + "description": "StatusList is published successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IVerifyResult" + } } + } }, - "UnauthorizedError": { - "description": "Access token is missing or invalid", - "type": "object", - "properties": { - "error": { - "type": "string" - } - }, - "example": { - "error": "Unauthorized Error" + "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" + } } + } }, - "IVerifyResult": { - "type": "object", - "properties": { - "verified": { - "type": "boolean" - }, - "issuer": { - "type": "string" - }, - "signer": { - "type": "object" - }, - "jwt": { - "type": "string" - }, - "verifiableCredential": { - "type": "object" - } - }, - "example": { - "verified": true, - "policies": {}, - "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" - } + "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" + } } + } + } + } + } + }, + "/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" + } }, - "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" - }, - "type": { - "description": "Resource type", - "type": "string" - }, - "alsoKnownAs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "uri": { - "type": "string" - }, - "description": { - "type": "string" - } - } + { + "in": "query", + "name": "statusPurpose", + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + }, + { + "in": "query", + "name": "statusListName", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "StatusList is fetched successfully", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "statusListName": { + "type": "string" + }, + "statusListVersion": { + "type": "string" + }, + "statusListId": { + "type": "string" + }, + "statusListNextVersion": { + "type": "string" } - }, - "version": { - "type": "string" + } } - }, - "example": { - "data": "SGVsbG8gV29ybGQ=", - "name": "ResourceName", - "type": "TextDocument" + } } + } }, - "RevocationResult": { - "properties": { - "revoked": { - "type": "boolean" - } + "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" + } } + } }, - "SuspensionResult": { - "properties": { - "suspended": { - "type": "boolean" - }, - "statusList": { - "type": "string" - } - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "UnSuspensionResult": { - "properties": { - "unsuspended": { - "type": "boolean" - }, - "statusList": { - "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" + } } + } + } + } + } + } + }, + "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + }, + "schemas": { + "DidResult": { + "type": "object", + "properties": { + "did": { + "type": "string" }, - "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" - } + "controllerKeyId": { + "type": "string" + }, + "keys": { + "type": "array", + "items": { + "type": "object" + } + }, + "services": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + } + } + }, + "KeyResult": { + "type": "object", + "properties": { + "kid": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Ed25519", + "Secp256k1" + ] + }, + "publicKeyHex": { + "type": "string" + } + } + }, + "DidDocument": { + "description": "This input field contains a complete DID document", + "type": "object", + "properties": { + "context": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + }, + "controller": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + ] + }, + "authentication": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-0" + ] + }, + "assertionMethod": { + "type": "array", + "items": { + "type": "string" + } + }, + "capabilityInvocation": { + "type": "array", + "items": { + "type": "string" + } + }, + "capabilityDelegation": { + "type": "array", + "items": { + "type": "string" + } + }, + "keyAgreement": { + "type": "array", + "items": { + "type": "string" + } + }, + "verificationMethod": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VerificationMethod" + } + }, + "service": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + } + }, + "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" + ] + } + }, + "VerificationMethod": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-0" + }, + "type": { + "type": "string", + "example": "Ed25519VerificationKey2018" + }, + "controller": { + "type": "string", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + }, + "publicKeyBase58": { + "type": "string", + "example": "so1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" + }, + "publicKeyMultibase": { + "type": "string", + "example": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" + }, + "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" + ] + } + } + }, + "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", + "type": "string" + }, + "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" + }, + "statusListVersipon": { + "type": "string" + }, + "statusListRangeStart": { + "type": "number" + }, + "statusListRangeEnd": { + "type": "number" + }, + "indexNotIn": { + "type": "number" } + }, + "example": { + "statusPurpose": "revocation", + "statusListName": "employee-credentials" + } + } + }, + "required": [ + "issuerDid", + "subjectDid", + "attributes" + ], + "example": { + "issuerDid": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "attributes": { + "gender": "male", + "name": "Bob" }, - "DIDUpdateRequest": { - "type": "object", - "properties": { - "did": { - "type": "string" - }, - "service": { - "type": "array", - "description": "This input field assigns the provided service array to the didDocument", - "items": { - "$ref": "#/components/schemas/Service" - } - }, - "verificationMethod": { - "type": "array", - "description": "This input field assigns the provided verificationMethod array to the didDocument", - "items": { - "$ref": "#/components/schemas/VerificationMethod" - } - }, - "authentication": { - "description": "This input field assigns the provided authentication array to the didDocument", - "type": "array", - "items": { - "type": "string" - } - }, - "didDocument": { - "$ref": "#/components/schemas/DidDocument" - } + "@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" } + } }, - "CredentialVerifyRequest": { - "type": "object", - "properties": { - "credential": { - "description": "This input field takes the credential object or the JWT string", - "allOf": [ - { - "type": "object" - }, - { - "type": "string" - } - ] - } + "credentialSubject": { + "type": "object", + "properties": { + "id": { + "type": "string" } + } }, - "CredentialRevokeRequest": { - "type": "object", - "properties": { - "credential": { - "description": "This input field takes the credential object or the JWT string", - "oneOf": [ - { - "type": "object" - }, - { - "type": "string" - } - ] - } + "credentialStatus": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "statusListIndex": { + "type": "string" + }, + "statusPurpose": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + }, + "type": { + "type": "string", + "enum": [ + "StatusList2021Entry" + ] } + } }, - "CredentialStatusCreateRequest": { - "allOf": [ - { - "type": "object", - "required": [ - "did", - "statusListName" - ], - "properties": { - "did": { - "description": "The DID of the statuslist publisher", - "type": "string" - }, - "statusListName": { - "description": "The name of the statusList to be created", - "type": "string" - }, - "length": { - "description": "The length of the statusList to be created, The default and minimum length is 140000 which is 16kb", - "type": "number" - }, - "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" + "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", + "statusListIndex": "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" + ] + } + }, + "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": { + "error": "Unauthorized Error" + } + }, + "IVerifyResult": { + "type": "object", + "properties": { + "verified": { + "type": "boolean" + }, + "issuer": { + "type": "string" + }, + "signer": { + "type": "object" + }, + "jwt": { + "type": "string" + }, + "verifiableCredential": { + "type": "object" + } + }, + "example": { + "verified": true, + "policies": {}, + "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" + } + } + }, + "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" + ] }, - "CredentialStatusUpdateRequest": { + "name": { + "description": "Resource name", + "type": "string" + }, + "type": { + "description": "Resource type", + "type": "string" + }, + "alsoKnownAs": { + "type": "array", + "items": { "type": "object", - "required": [ - "did", - "statusListName", - "indices" - ], "properties": { - "did": { - "description": "The DID of the statuslist publisher", - "type": "string" - }, - "statusListName": { - "description": "The name of the statusList to be created", + "uri": { + "type": "string" + }, + "description": { + "type": "string" + } + } + } + }, + "version": { + "type": "string" + } + }, + "example": { + "data": "SGVsbG8gV29ybGQ=", + "name": "ResourceName", + "type": "TextDocument" + } + }, + "RevocationResult": { + "properties": { + "revoked": { + "type": "boolean" + } + } + }, + "SuspensionResult": { + "properties": { + "suspended": { + "type": "boolean" + }, + "statusList": { + "type": "string" + } + } + }, + "UnSuspensionResult": { + "properties": { + "unsuspended": { + "type": "boolean" + }, + "statusList": { + "type": "string" + } + } + }, + "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" + } + } + }, + "DIDUpdateRequest": { + "type": "object", + "properties": { + "did": { + "type": "string" + }, + "service": { + "type": "array", + "description": "This input field assigns the provided service array to the didDocument", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "verificationMethod": { + "type": "array", + "description": "This input field assigns the provided verificationMethod array to the didDocument", + "items": { + "$ref": "#/components/schemas/VerificationMethod" + } + }, + "authentication": { + "description": "This input field assigns the provided authentication array to the didDocument", + "type": "array", + "items": { + "type": "string" + } + }, + "didDocument": { + "$ref": "#/components/schemas/DidDocument" + } + } + }, + "CredentialVerifyRequest": { + "type": "object", + "properties": { + "credential": { + "description": "This input field takes the credential object or the JWT string", + "allOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + } + }, + "CredentialRevokeRequest": { + "type": "object", + "properties": { + "credential": { + "description": "This input field takes the credential object or the JWT string", + "oneOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + } + }, + "CredentialStatusCreateRequest": { + "allOf": [ + { + "type": "object", + "required": [ + "did", + "statusListName" + ], + "properties": { + "did": { + "description": "The DID of the statuslist publisher", + "type": "string" + }, + "statusListName": { + "description": "The name of the statusList to be created", + "type": "string" + }, + "length": { + "description": "The length of the statusList to be created, The default and minimum length is 140000 which is 16kb", + "type": "number" + }, + "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" - }, - "indices": { - "description": "Provide the list of indices to be updated", - "type": "array", - "items": { - "type": "number" - } - }, - "statusListVersion": { - "description": "This input field is OPTIONAL, If present uses the provided statusListVersion for the update operation", + }, + "description": { "type": "string" + } } + } } + } + } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials" + } + }, + "CredentialStatusUpdateRequest": { + "type": "object", + "required": [ + "did", + "statusListName", + "indices" + ], + "properties": { + "did": { + "description": "The DID of the statuslist publisher", + "type": "string" }, - "CredentialStatusPublishRequest": { - "allOf": [ - { - "type": "object", - "required": [ - "did", - "encodedList", - "statusListName", - "encoding" - ], - "properties": { - "did": { - "description": "The DID of the statuslist publisher", - "type": "string" - }, - "statusListName": { - "description": "The name of the statusList to be published", - "type": "string" - }, - "encodedList": { - "description": "Provide encoded string for the resource data", - "type": "string" - }, - "encoding": { - "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" - } + "statusListName": { + "description": "The name of the statusList to be created", + "type": "string" }, - "PresentationRequest": { - "type": "object", - "required": [ - "presentation" - ], - "properties": { - "presentation": { - "description": "This input field takes the presentation object or the JWT string", - "allOf": [ - { - "type": "string" - }, - { - "type": "object" - } - ] - } - } + "indices": { + "description": "Provide the list of indices to be updated", + "type": "array", + "items": { + "type": "number" + } }, - "CredentialStatusResult": { - "type": "object", - "properties": { - "success": { - "type": "object", - "properties": { - "created": { - "type": "boolean" - }, - "resourceNetadata": { - "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" - } - } - } - } + "statusListVersion": { + "description": "This input field is OPTIONAL, If present uses the provided statusListVersion for the update operation", + "type": "string" + } + } + }, + "CredentialStatusPublishRequest": { + "allOf": [ + { + "type": "object", + "required": [ + "did", + "encodedList", + "statusListName", + "encoding" + ], + "properties": { + "did": { + "description": "The DID of the statuslist publisher", + "type": "string" + }, + "statusListName": { + "description": "The name of the statusList to be published", + "type": "string" + }, + "encodedList": { + "description": "Provide encoded string for the resource data", + "type": "string" + }, + "encoding": { + "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" + } + }, + "PresentationRequest": { + "type": "object", + "required": [ + "presentation" + ], + "properties": { + "presentation": { + "description": "This input field takes the presentation object or the JWT string", + "allOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + } + }, + "CredentialStatusResult": { + "type": "object", + "properties": { + "success": { + "type": "object", + "properties": { + "created": { + "type": "boolean" + }, + "resourceNetadata": { + "type": "object" }, - "example": { - "created": true, - "resource": { - "StatusList2021": { - "encodedList": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", - "type": "StatusList2021Revocation", - "validFrom": "2023-06-26T11:45:19.349Z" + "statusList2021": { + "type": "object", + "properties": { + "StatusList2021": { + "type": "object", + "properties": { + "encodedList": { + "type": "string" }, - "metadata": { - "encoding": "base64url", - "encrypted": false + "type": { + "type": "string" + }, + "validFrom": { + "type": "string" } + } + } + } + }, + "metadata": { + "type": "string", + "properties": { + "encoding": { + "type": "string" }, - "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" + "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 + } + }, + "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" + } + } + }, + "CredentialStatusCheckRequest": { + "type": "object", + "properties": { + "did": { + "description": "The DID of the statuslist publisher", + "type": "string" + }, + "statusListName": { + "description": "The name of the statusList to be published", + "type": "string" + }, + "index": { + "description": "Provide the statusList index to be verified", + "type": "number" } + } } + } } -} \ No newline at end of file + } \ No newline at end of file diff --git a/src/types/types.ts b/src/types/types.ts index 53b6403e..538cad05 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -8,7 +8,7 @@ import { W3CVerifiableCredential, TAgent } from '@veramo/core' -import { AccessControlConditionBalanceArgs, AccessControlConditionMemoNonceArgs, ICheqd, ICheqdStatusList2021Options } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' +import { AccessControlConditionBalanceArgs, AccessControlConditionMemoNonceArgs, ICheqd, ICheqdCheckCredentialWithStatusList2021StatusOptions, ICheqdStatusList2021Options } from '@cheqd/did-provider-cheqd/build/types/agent/ICheqd' import { ICredentialIssuerLD } from '@veramo/credential-ld' import { AbstractIdentifierProvider } from '@veramo/did-manager' import { AbstractKeyManagementSystem } from '@veramo/key-manager' @@ -174,4 +174,6 @@ export interface UpdateStatusListOptions { statusListName: string statusListVersion?: string statusAction: 'revoke' | 'suspend' | 'reinstate' -} \ No newline at end of file +} + +export type CheckStatusListOptions = Omit \ No newline at end of file