From 042f5f7fa36714f9c08f9f2fb8eb958674acb9c5 Mon Sep 17 00:00:00 2001 From: abdulla-ashurov Date: Mon, 10 Jul 2023 18:37:52 +0500 Subject: [PATCH] Update swagger-jsdoc comments. --- package.json | 2 +- src/controllers/credentials.ts | 209 ----------- src/controllers/customer.ts | 38 -- src/controllers/issuer.ts | 181 ---------- src/controllers/revocation.ts | 137 -------- src/static/swagger.json | 622 +++++++++++++++++---------------- src/swagger.cjs | 5 + src/types/swagger-types.ts | 551 +++++++++++++++++++++++++++++ 8 files changed, 887 insertions(+), 858 deletions(-) create mode 100644 src/types/swagger-types.ts diff --git a/package.json b/package.json index 620ce534..27100d30 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ } }, "scripts": { - "prebuild": "swagger-jsdoc -d src/swagger.cjs -o src/static/swagger.json ./src/controllers/*.ts", + "prebuild": "swagger-jsdoc -d src/swagger.cjs -o src/static/swagger.json ./src/controllers/*.ts ./src/types/swagger-types.ts", "build": "tsc", "start": "node dist/index.js", "format": "prettier --write '*.{json,js}' 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'", diff --git a/src/controllers/credentials.ts b/src/controllers/credentials.ts index 0505dffd..a6e67cce 100644 --- a/src/controllers/credentials.ts +++ b/src/controllers/credentials.ts @@ -6,216 +6,7 @@ import { check, query, validationResult } from 'express-validator' import { Credentials } from '../services/credentials.js' import { Identity } from '../services/identity/index.js' -/** - * @openapi - * - * components: - * schemas: - * CredentialRequest: - * description: Input fields for the create operation. - * type: object - * additionalProperties: false - * properties: - * issuerDid: - * description: This input field is the Issuer's DID. - * type: string - * example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 - * subjectDid: - * description: This input field is the holder's DID. - * type: string - * example: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK - * attributes: - * description: Json input of the attributes. - * type: object - * example: - * gender: male - * name: bob - * '@context': - * description: Additional contexts to be included in the credential. - * type: array - * items: - * type: string - * example: - * - https://schema.org - * type: - * description: Additional type property to be included in the credential. - * type: array - * items: - * type: string - * example: - * - Person - * expirationDate: - * description: Optional expiration date according to the https://www.w3.org/TR/vc-data-model/#expiration specification. - * format: - * description: Select one of the supported credential formats, jwt by default. - * type: string - * enum: - * - jwt - * - lds - * example: jwt - * 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 - * example: revocation - * statusListName: - * type: string - * example: employee-credentials - * statusListIndex: - * type: number - * example: 10 - * statusListVersion: - * type: string - * statusListRangeStart: - * type: number - * statusListRangeEnd: - * type: number - * indexNotIn: - * type: number - * required: [issuerDid, subjectDid, attributes] - * Credential: - * description: Input fields for the update operation. - * type: object - * additionalProperties: false - * properties: - * '@context': - * type: array - * items: - * type: string - * example: - * - https://www.w3.org/2018/credentials/v1 - * - https://schema.org - * - https://veramo.io/contexts/profile/v1 - * type: - * type: array - * items: - * type: string - * example: - * - VerifiableCredential - * - Person - * expirationDate: - * type: string - * issuer: - * type: object - * properties: - * id: - * type: string - * example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 - * credentialSubject: - * type: object - * properties: - * id: - * type: string - * example: - * gender: male - * id: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK - * name: Bob - * credentialStatus: - * type: object - * properties: - * id: - * type: string - * example: https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20 - * statusListIndex: - * type: string - * example: 20 - * statusPurpose: - * type: string - * enum: - * - revocation - * - suspension - * example: suspension - * type: - * type: string - * enum: - * - StatusList2021Entry - * example: StatusList2021Entry - * issuanceDate: - * type: string - * example: 2023-06-08T13:49:28.000Z - * proof: - * type: object - * properties: - * type: - * type: string - * example: JwtProof2020 - * jwt: - * type: string - * example: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg - * CredentialRevokeRequest: - * type: object - * properties: - * credential: - * description: This input field takes the credential object or the JWT string - * oneOf: - * - type: object - * - type: string - * RevocationResult: - * properties: - * revoked: - * type: boolean - * SuspensionResult: - * properties: - * suspended: - * type: boolean - * statusList: - * type: string - * UnSuspensionResult: - * properties: - * unsuspended: - * type: boolean - * statusList: - * type: string - * CredentialVerifyRequest: - * type: object - * properties: - * credential: - * description: This input field takes the credential object or the JWT string.\ - * allOf: - * - type: object - * - type: string - * IVerifyResult: - * type: object - * properties: - * verified: - * type: boolean - * example: true - * issuer: - * type: string - * example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 - * signer: - * type: object - * 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 - * jwt: - * type: string - * verifiableCredential: - * type: object - * PresentationRequest: - * type: object - * required: - * - presentation - * properties: - * presentation: - * description: This input field takes the presentation object or the JWT string. - * allOf: - * - type: string - * - type: object - */ - export class CredentialController { - public static issueValidator = [ check(['subjectDid', 'issuerDid']) .exists().withMessage('DID is required') diff --git a/src/controllers/customer.ts b/src/controllers/customer.ts index 9e3b6a0e..ccd25934 100644 --- a/src/controllers/customer.ts +++ b/src/controllers/customer.ts @@ -3,44 +3,6 @@ import type { Request, Response } from 'express' import { CustomerService } from '../services/customer.js' import { LogToHelper } from '../middleware/auth/logto.js' -/** - * @openapi - * - * tags: - * name: Account - */ - -/** - * @openapi - * - * components: - * securitySchemes: - * bearerAuth: - * type: http - * scheme: bearer - * bearerFormat: JWT - * schemas: - * Customer: - * type: object - * properties: - * customerId: - * type: string - * address: - * type: string - * InvalidRequest: - * type: object - * properties: - * error: - * type: string - * UnauthorizedError: - * description: Access token is missing or invalid - * type: object - * properties: - * error: - * type: string - * example: Unauthorized Error - */ - export class CustomerController { /** diff --git a/src/controllers/issuer.ts b/src/controllers/issuer.ts index 4ed1d248..fc08c33c 100644 --- a/src/controllers/issuer.ts +++ b/src/controllers/issuer.ts @@ -9,187 +9,6 @@ import { MsgCreateResourcePayload } from '@cheqd/ts-proto/cheqd/resource/v2/inde import { Identity } from '../services/identity/index.js' import { generateDidDoc, isValidService, isValidVerificationMethod, validateSpecCompliantPayload } from '../helpers/helpers.js' -/** - * @openapi - * - * components: - * schemas: - * KeyResult: - * type: object - * properties: - * kid: - * type: string - * type: - * type: string - * enum: [ Ed25519, Secp256k1 ] - * publicKeyHex: - * type: string - * DidDocument: - * description: This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See https://identity.foundation/did-registration/#diddocument. - * type: object - * properties: - * context: - * type: array - * items: - * type: string - * id: - * type: string - * example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 - * controllers: - * 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' - * DidResult: - * type: object - * properties: - * did: - * type: string - * controllerKeyId: - * type: string - * keys: - * type: array - * items: - * type: object - * services: - * type: array - * items: - * $ref: '#/components/schemas/Service' - * VerificationMethod: - * type: object - * properties: - * id: - * type: string - * 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 - * publicKeyMultibase: - * type: string - * example: BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt - * publicKeyJwk: - * type: array - * items: - * type: string - * Service: - * type: object - * properties: - * id: - * type: string - * example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#rand - * type: - * type: string - * example: rand - * serviceEndpoint: - * type: array - * items: - * type: string - * example: https://rand.in - * DidUpdateRequest: - * type: object - * properties: - * did: - * type: string - * service: - * type: array - * description: This input field assigns the provided service array to the DID Document. - * items: - * $ref: '#/components/schemas/Service' - * verificationMethod: - * type: array - * description: This input field assigns the provided verificationMethod array to the DID Document. - * items: - * $ref: '#/components/schemas/VerificationMethod' - * authentication: - * description: This input field assigns the provided authentication array to the DID Document. - * type: array - * items: - * type: string - * didDocument: - * $ref: '#/components/schemas/DidDocument' - */ - -/** - * @openapi - * - * components: - * schemas: - * CreateResourceRequest: - * description: Input fields for the resource creation - * type: object - * additionalProperties: false - * required: - * - name - * - type - * - data - * - encoding - * properties: - * data: - * description: Provide encoded string for the resource data. - * type: string - * encoding: - * description: The encoding format of the resource data. - * type: string - * enum: - * - base64url - * - base64 - * - hex - * name: - * description: Resource name. - * type: string - * alsoKnownAs: - * type: array - * items: - * type: object - * properties: - * uri: - * type: string - * description: - * type: string - * version: - * type: string - * example: - * data: SGVsbG8gV29ybGQ= - * name: ResourceName - * type: TextDocument -*/ - export class IssuerController { public static createValidator = [ diff --git a/src/controllers/revocation.ts b/src/controllers/revocation.ts index cb2f8912..988e3585 100644 --- a/src/controllers/revocation.ts +++ b/src/controllers/revocation.ts @@ -5,143 +5,6 @@ import { fromString } from 'uint8arrays' import { Identity } from '../services/identity/index.js' import { Veramo } from '../services/identity/agent.js' import { ResourceMetadata, StatusList2021ResourceTypes } from '../types/types.js' - -/** - * @openapi - * components: - * schemas: - * CredentialStatusCreateRequest: - * allOf: - * - type: object - * required: - * - did - * - statusListName - * properties: - * did: - * description: The DID of the status list publisher. - * type: string - * example: did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e - * statusListName: - * description: The name of the status list to be created. - * type: string - * example: cheqd-employee-credentials - * length: - * description: The length of the status list to be created. The default and minimum length is 140000 which is 16kb. - * encoding: - * description: The encoding format of the statusList to be published. - * type: string - * default: base64url - * enum: - * - base64url - * - base64 - * - hex - * statusListVersion: - * description: This input field is OPTIONAL, If present assigns the version to be assigned to the statusList. - * type: string - * alsoKnownAs: - * description: The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri. - * type: array - * items: - * type: object - * properties: - * uri: - * type: string - * description: - * type: string - * CredentialStatusResult: - * type: object - * properties: - * success: - * type: object - * properties: - * created: - * type: boolean - * example: true - * resource: - * type: object - * example: - * StatusList2021: - * encodedList: H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA - * type: StatusList2021Revocation - * validFrom: 2023-06-26T11:45:19.349Z - * metadata: - * encoding: base64url - * encrypted: false - * resourceMetadata: - * type: object - * example: - * 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 - * 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 - * CredentialStatusPublishRequest: - * allOf: - * - type: object - * required: - * - did - * - encodedList - * - statusListName - * - encoding - * properties: - * did: - * description: The DID of the status list publisher. - * type: string - * example: did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e - * statusListName: - * description: The name of the statusList to be published - * type: string - * example: cheqd-employee-credentials - * encodedList: - * description: The encoding format of the statusList provided - * type: string - * enum: - * - base64url - * - base64 - * - hex - * example: base64url - * statusListVersion: - * description: This input field is OPTIONAL, If present assigns the version to be assigned to the statusList - * type: string - * example: 2023 - * 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 - */ - export class RevocationController { static statusListValidator = [ diff --git a/src/static/swagger.json b/src/static/swagger.json index fbd5a2d7..5c578dce 100644 --- a/src/static/swagger.json +++ b/src/static/swagger.json @@ -1,5 +1,10 @@ { "openapi": "3.0.0", + "servers": [ + { + "url": "/" + } + ], "info": { "title": "Credential Service for cheqd network", "version": "2.0.0", @@ -11,12 +16,16 @@ "externalDocs": { "url": "https://github.com/cheqd/credential-service#readme" } - }, - { - "name": "Account" } ], "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + }, "schemas": { "CredentialRequest": { "description": "Input fields for the create operation.", @@ -25,44 +34,32 @@ "properties": { "issuerDid": { "description": "This input field is the Issuer's DID.", - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "type": "string" }, "subjectDid": { "description": "This input field is the holder's DID.", - "type": "string", - "example": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK" + "type": "string" }, "attributes": { "description": "Json input of the attributes.", - "type": "object", - "example": { - "gender": "male", - "name": "bob" - } + "type": "object" }, "@context": { "description": "Additional contexts to be included in the credential.", "type": "array", "items": { "type": "string" - }, - "example": [ - "https://schema.org" - ] + } }, "type": { "description": "Additional type property to be included in the credential.", "type": "array", "items": { "type": "string" - }, - "example": [ - "Person" - ] + } }, "expirationDate": { - "description": "Optional expiration date according to the https://www.w3.org/TR/vc-data-model/#expiration specification." + "description": "Optional expiration date according to the specification." }, "format": { "description": "Select one of the supported credential formats, jwt by default.", @@ -70,8 +67,7 @@ "enum": [ "jwt", "lds" - ], - "example": "jwt" + ] }, "credentialStatus": { "description": "Optional field to support revocation or suspension, which takes statusListName and statusListPurpose as inputs.", @@ -86,12 +82,10 @@ "enum": [ "revocation", "suspension" - ], - "example": "revocation" + ] }, "statusListName": { - "type": "string", - "example": "employee-credentials" + "type": "string" }, "statusListIndex": { "type": "number", @@ -116,7 +110,26 @@ "issuerDid", "subjectDid", "attributes" - ] + ], + "example": { + "issuerDid": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "attributes": null, + "gender": "male", + "name": "Bob", + "@context": [ + "https://schema.org" + ], + "type": [ + "Person" + ], + "format": "jwt", + "credentialStatus": { + "statusPurpose": "revocation", + "statusListName": "employee-credentials", + "statusListIndex": 10 + } + } }, "Credential": { "description": "Input fields for the update operation.", @@ -127,22 +140,13 @@ "type": "array", "items": { "type": "string" - }, - "example": [ - "https://www.w3.org/2018/credentials/v1", - "https://schema.org", - "https://veramo.io/contexts/profile/v1" - ] + } }, "type": { "type": "array", "items": { "type": "string" - }, - "example": [ - "VerifiableCredential", - "Person" - ] + } }, "expirationDate": { "type": "string" @@ -151,8 +155,7 @@ "type": "object", "properties": { "id": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "type": "string" } } }, @@ -162,58 +165,76 @@ "id": { "type": "string" } - }, - "example": { - "gender": "male", - "id": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", - "name": "Bob" } }, "credentialStatus": { "type": "object", "properties": { "id": { - "type": "string", - "example": "https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20" + "type": "string" }, "statusListIndex": { - "type": "string", - "example": 20 + "type": "string" }, "statusPurpose": { "type": "string", "enum": [ "revocation", "suspension" - ], - "example": "suspension" + ] }, "type": { "type": "string", "enum": [ "StatusList2021Entry" - ], - "example": "StatusList2021Entry" + ] } } }, "issuanceDate": { - "type": "string", - "example": "2023-06-08T13:49:28.000Z" + "type": "string" }, "proof": { "type": "object", "properties": { "type": { - "type": "string", - "example": "JwtProof2020" + "type": "string" }, "jwt": { - "type": "string", - "example": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg" + "type": "string" } } } + }, + "example": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org", + "https://veramo.io/contexts/profile/v1" + ], + "credentialSubject": { + "gender": "male", + "id": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "name": "Bob" + }, + "credentialStatus": { + "id": "https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20", + "statusIndex": 20, + "statusPurpose": "suspension", + "type": "StatusList2021Entry" + }, + "issuanceDate": "2023-06-08T13:49:28.000Z", + "issuer": { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + }, + "proof": { + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg", + "type": "JwtProof2020" + }, + "type": [ + "VerifiableCredential", + "Person" + ] } }, "CredentialRevokeRequest": { @@ -279,21 +300,13 @@ "type": "object", "properties": { "verified": { - "type": "boolean", - "example": true + "type": "boolean" }, "issuer": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "type": "string" }, "signer": { - "type": "object", - "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" - } + "type": "object" }, "jwt": { "type": "string" @@ -301,6 +314,17 @@ "verifiableCredential": { "type": "object" } + }, + "example": { + "verified": true, + "polices": {}, + "issuer": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "signer": { + "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", + "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt", + "type": "Ed25519VerificationKey2018" + } } }, "PresentationRequest": { @@ -322,33 +346,199 @@ } } }, - "Customer": { - "type": "object", - "properties": { - "customerId": { - "type": "string" - }, - "address": { - "type": "string" + "CredentialStatusCreateRequest": { + "allOf": [ + { + "type": "object", + "required": [ + "did", + "statusListName" + ], + "properties": { + "did": { + "description": "The DID of the status list publisher.", + "type": "string" + }, + "statusListName": { + "description": "The name of the status list to be created.", + "type": "string" + }, + "length": { + "description": "The length of the status list to be created. The default and minimum length is 140000 which is 16kb." + }, + "encoding": { + "description": "The encoding format of the statusList to be published.", + "type": "string", + "default": "base64url", + "enum": [ + "base64url", + "base64", + "hex" + ] + }, + "statusListVersion": { + "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList.", + "type": "string" + }, + "alsoKnownAs": { + "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "description": { + "type": "string" + } + } + } + } + } } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials" } }, - "InvalidRequest": { + "CredentialStatusResult": { "type": "object", "properties": { - "error": { - "type": "string" + "success": { + "type": "object", + "properties": { + "created": { + "type": "boolean" + }, + "resource": { + "type": "object", + "metadata": { + "encoding": "base64url", + "encrypted": false + } + }, + "resourceMetadata": { + "type": "object" + }, + "statusList2021": { + "type": "object", + "properties": { + "statusList2021": { + "type": "object", + "properties": { + "encodedList": { + "type": "string" + }, + "type": { + "type": "string" + }, + "validFrom": { + "type": "string" + } + } + } + } + }, + "metadata": { + "type": "string", + "properties": { + "encoding": { + "type": "string" + }, + "encrypted": { + "type": "boolean" + } + } + } + } + } + }, + "example": { + "created": true, + "resource": { + "StatusList2021": { + "encodedList": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", + "type": "StatusList2021Revocation", + "validFrom": "2023-06-26T11:45:19.349Z" + }, + "metadata": { + "encoding": "base64url", + "encrypted": false + } + }, + "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" } } }, - "UnauthorizedError": { - "description": "Access token is missing or invalid", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Unauthorized Error" + "CredentialStatusPublishRequest": { + "allOf": [ + { + "type": "object", + "required": [ + "did", + "encodedList", + "statusListName", + "encoding" + ], + "properties": { + "did": { + "description": "The DID of the status list publisher.", + "type": "string" + }, + "statusListName": { + "description": "The name of the statusList to be published", + "type": "string" + }, + "encodedList": { + "description": "The encoding format of the statusList provided", + "type": "string", + "enum": [ + "base64url", + "base64", + "hex" + ] + }, + "statusListVersion": { + "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList", + "type": "string" + }, + "alsoKnownAs": { + "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "description": { + "type": "string" + } + } + } + } + } } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "name": "cheqd-employee-credentials", + "version": 2023, + "data": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", + "encoding": "base64url" } }, "KeyResult": { @@ -373,33 +563,26 @@ "description": "This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See https://identity.foundation/did-registration/#diddocument.", "type": "object", "properties": { - "context": { + "@context": { "type": "array", "items": { "type": "string" } }, "id": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "type": "string" }, "controllers": { "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", @@ -437,6 +620,23 @@ "$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" + ] } }, "DidResult": { @@ -466,20 +666,16 @@ "type": "object", "properties": { "id": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-0" + "type": "string" }, "type": { - "type": "string", - "example": "Ed25519VerificationKey2018" + "type": "string" }, "controller": { - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "type": "string" }, "publicKeyMultibase": { - "type": "string", - "example": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt" + "type": "string" }, "publicKeyJwk": { "type": "array", @@ -487,6 +683,12 @@ "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": { @@ -593,198 +795,34 @@ "type": "TextDocument" } }, - "CredentialStatusCreateRequest": { - "allOf": [ - { - "type": "object", - "required": [ - "did", - "statusListName" - ], - "properties": { - "did": { - "description": "The DID of the status list publisher.", - "type": "string", - "example": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e" - }, - "statusListName": { - "description": "The name of the status list to be created.", - "type": "string", - "example": "cheqd-employee-credentials" - }, - "length": { - "description": "The length of the status list to be created. The default and minimum length is 140000 which is 16kb." - }, - "encoding": { - "description": "The encoding format of the statusList to be published.", - "type": "string", - "default": "base64url", - "enum": [ - "base64url", - "base64", - "hex" - ] - }, - "statusListVersion": { - "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList.", - "type": "string" - }, - "alsoKnownAs": { - "description": "The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri.", - "type": "array", - "items": { - "type": "object", - "properties": { - "uri": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - } - } + "Customer": { + "type": "object", + "properties": { + "customerId": { + "type": "string" + }, + "address": { + "type": "string" } - ] + } }, - "CredentialStatusResult": { + "InvalidRequest": { "type": "object", "properties": { - "success": { - "type": "object", - "properties": { - "created": { - "type": "boolean", - "example": true - }, - "resource": { - "type": "object", - "example": { - "StatusList2021": { - "encodedList": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA", - "type": "StatusList2021Revocation", - "validFrom": "2023-06-26T11:45:19.349Z" - }, - "metadata": { - "encoding": "base64url", - "encrypted": false - } - } - }, - "resourceMetadata": { - "type": "object", - "example": { - "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" - } - } - }, - "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" - } - } - } - } + "error": { + "type": "string" } } }, - "CredentialStatusPublishRequest": { - "allOf": [ - { - "type": "object", - "required": [ - "did", - "encodedList", - "statusListName", - "encoding" - ], - "properties": { - "did": { - "description": "The DID of the status list publisher.", - "type": "string", - "example": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e" - }, - "statusListName": { - "description": "The name of the statusList to be published", - "type": "string", - "example": "cheqd-employee-credentials" - }, - "encodedList": { - "description": "The encoding format of the statusList provided", - "type": "string", - "enum": [ - "base64url", - "base64", - "hex" - ], - "example": "base64url" - }, - "statusListVersion": { - "description": "This input field is OPTIONAL, If present assigns the version to be assigned to the statusList", - "type": "string", - "example": 2023 - }, - "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" - } - } - } - } - } + "UnauthorizedError": { + "description": "Access token is missing or invalid", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Unauthorized Error" } - ] - } - }, - "securitySchemes": { - "bearerAuth": { - "type": "http", - "scheme": "bearer", - "bearerFormat": "JWT" + } } } }, diff --git a/src/swagger.cjs b/src/swagger.cjs index 5a37e18f..691d480d 100644 --- a/src/swagger.cjs +++ b/src/swagger.cjs @@ -1,5 +1,10 @@ module.exports = { openapi: '3.0.0', + servers: [ + { + url: '/' + } + ], info: { // API information (required) title: 'Credential Service for cheqd network', // Title (required) diff --git a/src/types/swagger-types.ts b/src/types/swagger-types.ts new file mode 100644 index 00000000..5e6d9f8b --- /dev/null +++ b/src/types/swagger-types.ts @@ -0,0 +1,551 @@ +/** + * @openapi + * + * components: + * securitySchemes: + * bearerAuth: + * type: http + * scheme: bearer + * bearerFormat: JWT + * schemas: + * CredentialRequest: + * description: Input fields for the create operation. + * type: object + * additionalProperties: false + * properties: + * issuerDid: + * description: This input field is the Issuer's DID. + * type: string + * subjectDid: + * description: This input field is the holder's DID. + * type: string + * attributes: + * description: Json input of the attributes. + * type: object + * '@context': + * description: Additional contexts to be included in the credential. + * type: array + * items: + * type: string + * type: + * description: Additional type property to be included in the credential. + * type: array + * items: + * type: string + * expirationDate: + * description: Optional expiration date according to the specification. + * format: + * description: Select one of the supported credential formats, jwt by default. + * type: string + * enum: + * - jwt + * - lds + * credentialStatus: + * description: Optional field to support revocation or suspension, which takes statusListName and statusListPurpose as inputs. + * type: object + * required: + * - statusPurpose + * - statusListName + * properties: + * statusPurpose: + * type: string + * enum: + * - revocation + * - suspension + * statusListName: + * type: string + * statusListIndex: + * type: number + * example: 10 + * statusListVersion: + * type: string + * statusListRangeStart: + * type: number + * statusListRangeEnd: + * type: number + * indexNotIn: + * type: number + * 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 + * Credential: + * description: Input fields for the update operation. + * type: object + * additionalProperties: false + * properties: + * '@context': + * type: array + * items: + * type: string + * type: + * type: array + * items: + * type: string + * expirationDate: + * type: string + * issuer: + * type: object + * properties: + * id: + * type: string + * credentialSubject: + * type: object + * properties: + * id: + * type: string + * credentialStatus: + * type: object + * properties: + * id: + * type: string + * statusListIndex: + * type: string + * statusPurpose: + * type: string + * enum: + * - revocation + * - suspension + * type: + * type: string + * enum: + * - StatusList2021Entry + * issuanceDate: + * type: string + * proof: + * type: object + * properties: + * type: + * type: string + * jwt: + * type: string + * example: + * '@context': + * - https://www.w3.org/2018/credentials/v1 + * - https://schema.org + * - https://veramo.io/contexts/profile/v1 + * credentialSubject: + * gender: male + * id: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK + * name: Bob + * credentialStatus: + * id: https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20 + * statusIndex: 20 + * statusPurpose: suspension + * type: StatusList2021Entry + * issuanceDate: 2023-06-08T13:49:28.000Z + * issuer: + * id: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 + * proof: + * jwt: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg + * type: JwtProof2020 + * type: + * - VerifiableCredential + * - Person + * CredentialRevokeRequest: + * type: object + * properties: + * credential: + * description: This input field takes the credential object or the JWT string + * oneOf: + * - type: object + * - type: string + * RevocationResult: + * properties: + * revoked: + * type: boolean + * SuspensionResult: + * properties: + * suspended: + * type: boolean + * statusList: + * type: string + * UnSuspensionResult: + * properties: + * unsuspended: + * type: boolean + * statusList: + * type: string + * CredentialVerifyRequest: + * type: object + * properties: + * credential: + * description: This input field takes the credential object or the JWT string.\ + * allOf: + * - type: object + * - type: string + * IVerifyResult: + * type: object + * properties: + * verified: + * type: boolean + * issuer: + * type: string + * signer: + * type: object + * jwt: + * type: string + * verifiableCredential: + * type: object + * example: + * verified: true + * polices: {} + * issuer: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 + * signer: + * controller: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 + * id: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1 + * publicKeyBase58: BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt + * type: Ed25519VerificationKey2018 + * PresentationRequest: + * type: object + * required: + * - presentation + * properties: + * presentation: + * description: This input field takes the presentation object or the JWT string. + * allOf: + * - type: string + * - type: object + * CredentialStatusCreateRequest: + * allOf: + * - type: object + * required: + * - did + * - statusListName + * properties: + * did: + * description: The DID of the status list publisher. + * type: string + * statusListName: + * description: The name of the status list to be created. + * type: string + * length: + * description: The length of the status list to be created. The default and minimum length is 140000 which is 16kb. + * encoding: + * description: The encoding format of the statusList to be published. + * type: string + * default: base64url + * enum: + * - base64url + * - base64 + * - hex + * statusListVersion: + * description: This input field is OPTIONAL, If present assigns the version to be assigned to the statusList. + * type: string + * alsoKnownAs: + * description: The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri. + * type: array + * items: + * type: object + * properties: + * uri: + * type: string + * description: + * type: string + * example: + * did: did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e + * statusListName: cheqd-employee-credentials + * CredentialStatusResult: + * type: object + * properties: + * success: + * type: object + * properties: + * created: + * type: boolean + * resource: + * type: object + * metadata: + * encoding: base64url + * encrypted: false + * resourceMetadata: + * type: object + * statusList2021: + * type: object + * properties: + * statusList2021: + * type: object + * properties: + * encodedList: + * type: string + * type: + * type: string + * validFrom: + * type: string + * metadata: + * type: string + * properties: + * encoding: + * type: string + * encrypted: + * type: boolean + * example: + * created: true + * resource: + * StatusList2021: + * encodedList: H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA + * type: StatusList2021Revocation + * validFrom: 2023-06-26T11:45:19.349Z + * metadata: + * encoding: base64url + * encrypted: false + * resourceMetadata: + * checksum: 909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2 + * created: 2023-06-26T11:45:20Z + * mediaType: application/json + * nextVersionId: null + * previousVersionId: null + * resourceCollectionId: 7c2b990c-3d05-4ebf-91af-f4f4d0091d2e + * resourceId: 5945233a-a4b5-422b-b893-eaed5cedd2dc + * resourceName: cheqd-revocation-1 + * resourceType: StatusList2021Revocation + * resourceURI: did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc + * resourceVersion: 2023-06-26T11:45:19.349Z + * CredentialStatusPublishRequest: + * allOf: + * - type: object + * required: + * - did + * - encodedList + * - statusListName + * - encoding + * properties: + * did: + * description: The DID of the status list publisher. + * type: string + * statusListName: + * description: The name of the statusList to be published + * type: string + * encodedList: + * description: The encoding format of the statusList provided + * type: string + * enum: + * - base64url + * - base64 + * - hex + * statusListVersion: + * description: This input field is OPTIONAL, If present assigns the version to be assigned to the statusList + * type: string + * alsoKnownAs: + * description: The input field is OPTIONAL. If present, the value MUST be a set where each item in the set is a uri. + * type: array + * items: + * type: object + * properties: + * uri: + * type: string + * description: + * type: string + * example: + * did: did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e + * name: cheqd-employee-credentials + * version: 2023 + * data: H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA + * encoding: base64url + * KeyResult: + * type: object + * properties: + * kid: + * type: string + * type: + * type: string + * enum: [ Ed25519, Secp256k1 ] + * publicKeyHex: + * type: string + * DidDocument: + * description: This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See https://identity.foundation/did-registration/#diddocument. + * type: object + * properties: + * '@context': + * type: array + * items: + * type: string + * id: + * type: string + * controllers: + * type: array + * items: + * type: string + * authentication: + * type: array + * items: + * type: string + * 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 + * DidResult: + * type: object + * properties: + * did: + * type: string + * controllerKeyId: + * type: string + * keys: + * type: array + * items: + * type: object + * services: + * type: array + * items: + * $ref: '#/components/schemas/Service' + * VerificationMethod: + * type: object + * properties: + * id: + * type: string + * type: + * type: string + * controller: + * type: string + * publicKeyMultibase: + * type: string + * publicKeyJwk: + * type: array + * items: + * type: string + * example: + * controller: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0 + * id: did:cheqd:testnet :7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1 + * publicKeyBase58: BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt + * type: Ed25519VerificationKey2018 + * Service: + * type: object + * properties: + * id: + * type: string + * example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#rand + * type: + * type: string + * example: rand + * serviceEndpoint: + * type: array + * items: + * type: string + * example: https://rand.in + * DidUpdateRequest: + * type: object + * properties: + * did: + * type: string + * service: + * type: array + * description: This input field assigns the provided service array to the DID Document. + * items: + * $ref: '#/components/schemas/Service' + * verificationMethod: + * type: array + * description: This input field assigns the provided verificationMethod array to the DID Document. + * items: + * $ref: '#/components/schemas/VerificationMethod' + * authentication: + * description: This input field assigns the provided authentication array to the DID Document. + * type: array + * items: + * type: string + * didDocument: + * $ref: '#/components/schemas/DidDocument' + * CreateResourceRequest: + * description: Input fields for the resource creation + * type: object + * additionalProperties: false + * required: + * - name + * - type + * - data + * - encoding + * properties: + * data: + * description: Provide encoded string for the resource data. + * type: string + * encoding: + * description: The encoding format of the resource data. + * type: string + * enum: + * - base64url + * - base64 + * - hex + * name: + * description: Resource name. + * type: string + * alsoKnownAs: + * type: array + * items: + * type: object + * properties: + * uri: + * type: string + * description: + * type: string + * version: + * type: string + * example: + * data: SGVsbG8gV29ybGQ= + * name: ResourceName + * type: TextDocument + * Customer: + * type: object + * properties: + * customerId: + * type: string + * address: + * type: string + * InvalidRequest: + * type: object + * properties: + * error: + * type: string + * UnauthorizedError: + * description: Access token is missing or invalid + * type: object + * properties: + * error: + * type: string + * example: Unauthorized Error + */