From 01e6ab832c1084013842c031a5fa2e64c96298f0 Mon Sep 17 00:00:00 2001 From: Benyam Seifu <45682486+benyam7@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:08:41 +0300 Subject: [PATCH] fix: switch to x-api-key header authentication [DEV-4062] (#556) * update swagger admin and api options * generate new swagger files for admin and api * remove customJs from swagger * remove user info fetcher since switching to x-api-key * fix: update playwright tests to use "api-key" for authentication [DEV-4071] (#557) * update auth.setup.ts and no-auth.setup.ts * update example.env * export TEST_USER_API_KEY for CI env * set x-api-key only for authenticated user tests * revert changes on no-auth.setup.ts * skip /admin/swagger * Update example.env * update swagger types * generate swagger * fix: remaining * fix incorrect usage way of required * fix indentation * generate swagger-admin * Update swagger-admin.json * hope this passes * keep description --------- Co-authored-by: Ankur Banerjee --- .github/workflows/build.yml | 1 + example.env | 6 + playwright.config.ts | 4 + src/app.ts | 13 +- src/controllers/admin/api-key.ts | 4 +- src/controllers/admin/prices.ts | 2 +- src/controllers/admin/product.ts | 4 - src/controllers/admin/subscriptions.ts | 42 +- src/controllers/api/account.ts | 8 +- src/middleware/auth/auth-gaurd.ts | 2 +- .../auth/user-info-fetcher/swagger-ui.ts | 2 +- src/static/swagger-admin-options.json | 14 + src/static/swagger-admin.json | 1732 ++--- src/static/swagger-api-options.json | 16 +- src/static/swagger-api.json | 6055 +++++++++-------- src/types/swagger-admin-types.ts | 25 +- src/types/swagger-api-types.ts | 29 +- tests/e2e/auth.setup.ts | 41 +- tests/e2e/no-auth.setup.ts | 5 +- 19 files changed, 4045 insertions(+), 3960 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68afaadd1..4d28b1e16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,6 +58,7 @@ jobs: RESOLVER_URL: ${{ vars.RESOLVER_URL }} TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }} TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }} + TEST_USER_API_KEY: ${{ secrets.TEST_USER_API_KEY }} TESTNET_RPC_URL: ${{ vars.TESTNET_RPC_URL }} VERIDA_PRIVATE_KEY: ${{ secrets.VERIDA_PRIVATE_KEY }} CREDS_DECRYPTION_SECRET: ${{ secrets.CREDS_DECRYPTION_SECRET }} diff --git a/example.env b/example.env index 51ea758f6..73160f8c3 100644 --- a/example.env +++ b/example.env @@ -41,3 +41,9 @@ ISSUER_PRIVATE_KEY_HEX="akjvncanv....avoa" ISSUER_PUBLIC_KEY_HEX="alnvca...dvncioa" ISSUER_DID="did:cheqd:testnet:afcnoa...adv" DEFAULT_FEE_PAYER_MNEMONIC="sketch mountain ....." + + +# TEST_RUNNER +TEST_USER_EMAIL='test@cheqd.io' +TEST_USER_PASSWORD='...' +TEST_USER_API_KEY='caas_...' diff --git a/playwright.config.ts b/playwright.config.ts index f35fead8f..c6dfd9746 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -78,6 +78,10 @@ export default defineConfig({ ...devices['Desktop Chrome'], // Use prepared auth state. storageState: STORAGE_STATE_AUTHENTICATED, + extraHTTPHeaders: { + // Add x-api-key token to all authenticated requests. + 'x-api-key': `${process.env.TEST_USER_API_KEY}`, + }, }, dependencies: ['Setup authenticated user'], }, diff --git a/src/app.ts b/src/app.ts index d6ba26af3..264c3e089 100644 --- a/src/app.ts +++ b/src/app.ts @@ -34,13 +34,6 @@ import { WebhookController } from './controllers/admin/webhook.js'; import { APIKeyController } from './controllers/admin/api-key.js'; import { OrganisationController } from './controllers/admin/organisation.js'; -let swaggerOptions = {}; -if (process.env.ENABLE_AUTHENTICATION === 'true') { - swaggerOptions = { - customJs: '/static/custom-button.js', - }; -} - class App { public express: express.Application; @@ -109,11 +102,7 @@ class App { this.express.use(auth.handleError); this.express.use(async (req, res, next) => await auth.accessControl(req, res, next)); - this.express.use( - '/swagger', - swaggerUi.serveFiles(swaggerAPIDocument, swaggerOptions), - swaggerUi.setup(swaggerAPIDocument, swaggerOptions) - ); + this.express.use('/swagger', swaggerUi.serveFiles(swaggerAPIDocument), swaggerUi.setup(swaggerAPIDocument)); if (process.env.STRIPE_ENABLED === 'true') { this.express.use( '/admin/swagger', diff --git a/src/controllers/admin/api-key.ts b/src/controllers/admin/api-key.ts index 82edd8732..fb35c96fb 100644 --- a/src/controllers/admin/api-key.ts +++ b/src/controllers/admin/api-key.ts @@ -108,7 +108,7 @@ export class APIKeyController { * content: * application/json: * schema: - * $ref: '#/components/schemas/APIKeyCreateResponseBody' + * $ref: '#/components/schemas/APIKeyResponse' * 400: * $ref: '#/components/schemas/APIKeyCreateUnsuccessfulResponseBody' * 401: @@ -230,7 +230,7 @@ export class APIKeyController { * @openapi * * /admin/api-key/revoke: - * delete: + * post: * summary: Revoke an existing API key * description: Revoke an existing API key * tags: [API Key] diff --git a/src/controllers/admin/prices.ts b/src/controllers/admin/prices.ts index 9a463257f..2b13369a3 100644 --- a/src/controllers/admin/prices.ts +++ b/src/controllers/admin/prices.ts @@ -27,7 +27,7 @@ export class PriceController { * schema: * type: string * description: The product id. If passed - returns filtered by this product list of prices. - * required: false + * * responses: * 200: * description: A list of prices diff --git a/src/controllers/admin/product.ts b/src/controllers/admin/product.ts index 0a9535fa1..814bf910d 100644 --- a/src/controllers/admin/product.ts +++ b/src/controllers/admin/product.ts @@ -50,7 +50,6 @@ export class ProductController { * schema: * type: boolean * description: If setup to true - returns the list of products with prices inside. Default - true - * required: false * - in: query * name: limit * schema: @@ -58,13 +57,11 @@ export class ProductController { * minimum: 1 * maximum: 100 * description: Restrict the response to only include items from 1 to 100. Default - 10 - * required: false * - in: query * name: cursor * schema: * type: string * description: Cursor for pagination, this only goes forward, i.e., Stripe's equivalent of 'starting_after' - * required: false * responses: * 200: * description: A list of products @@ -141,7 +138,6 @@ export class ProductController { * schema: * type: boolean * description: If setup to true - returns the product with prices inside. Default - true - * required: false * responses: * 200: * description: A product diff --git a/src/controllers/admin/subscriptions.ts b/src/controllers/admin/subscriptions.ts index 8edd179e4..883bcfa69 100644 --- a/src/controllers/admin/subscriptions.ts +++ b/src/controllers/admin/subscriptions.ts @@ -488,30 +488,30 @@ export class SubscriptionController { * @openapi * * /admin/subscription/resume: - * post: - * summary: Resume a subscription - * description: Resumes an existing subscription - * tags: [Subscription] - * requestBody: - * content: - * application/json: - * schema: - * $ref: '#/components/schemas/SubscriptionResumeRequestBody' - * responses: - * 200: - * description: The request was successful. + * post: + * summary: Resume a subscription + * description: Resumes an existing subscription + * tags: [Subscription] + * requestBody: * content: * application/json: * schema: - * $ref: '#/components/schemas/SubscriptionResumeResponseBody' - * 400: - * $ref: '#/components/schemas/InvalidRequest' - * 401: - * $ref: '#/components/schemas/UnauthorizedError' - * 500: - * $ref: '#/components/schemas/InternalError' - * 404: - * $ref: '#/components/schemas/NotFoundError' + * $ref: '#/components/schemas/SubscriptionResumeRequestBody' + * responses: + * 200: + * description: The request was successful. + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/SubscriptionResumeResponseBody' + * 400: + * $ref: '#/components/schemas/InvalidRequest' + * 401: + * $ref: '#/components/schemas/UnauthorizedError' + * 500: + * $ref: '#/components/schemas/InternalError' + * 404: + * $ref: '#/components/schemas/NotFoundError' */ @validate @syncOne diff --git a/src/controllers/api/account.ts b/src/controllers/api/account.ts index 76f4439e0..46e521bdc 100644 --- a/src/controllers/api/account.ts +++ b/src/controllers/api/account.ts @@ -100,8 +100,8 @@ export class AccountController { * description: The request was successful. * content: * application/json: - * idToken: - * type: string + * schema: + * $ref: '#/components/schemas/QueryIdTokenResponseBody' * 400: * $ref: '#/components/schemas/InvalidRequest' * 401: @@ -396,8 +396,8 @@ export class AccountController { * description: The request was successful. * content: * application/json: - * idToken: - * type: string + * schema: + * $ref: '#/components/schemas/QueryIdTokenResponseBody' * 400: * $ref: '#/components/schemas/InvalidRequest' * 401: diff --git a/src/middleware/auth/auth-gaurd.ts b/src/middleware/auth/auth-gaurd.ts index 3dd27993f..d10447c4f 100644 --- a/src/middleware/auth/auth-gaurd.ts +++ b/src/middleware/auth/auth-gaurd.ts @@ -16,7 +16,7 @@ export class APIGuard { private userInfoFetcher: IUserInfoFetcher; private oauthProvider: IOAuthProvider; private static bearerTokenIdentifier = 'Bearer'; - private pathSkip = ['/swagger', '/static', '/logto', '/account/bootstrap', '/admin/webhook']; + private pathSkip = ['/swagger', '/admin/swagger', '/static', '/logto', '/account/bootstrap', '/admin/webhook']; constructor(authRuleRepository: AuthRuleRepository, oauthProvider: IOAuthProvider) { this.authRuleRepository = authRuleRepository; diff --git a/src/middleware/auth/user-info-fetcher/swagger-ui.ts b/src/middleware/auth/user-info-fetcher/swagger-ui.ts index 297ad47df..a690f1d04 100644 --- a/src/middleware/auth/user-info-fetcher/swagger-ui.ts +++ b/src/middleware/auth/user-info-fetcher/swagger-ui.ts @@ -23,7 +23,7 @@ export class SwaggerUserInfoFetcher extends UserInfoHelper implements IUserInfoF // If the user is not authenticated - return error if (!request.user.isAuthenticated) { return response.status(StatusCodes.UNAUTHORIZED).json({ - error: "Unauthorized error: Seems like you are not authenticated. Please follow the authentication process using 'LogIn' button", + error: "Unauthorized error: Seems like you are not authenticated. Please follow the authentication process using 'Authorize' button", } satisfies UnsuccessfulResponseBody); } // Tries to get customerId from the logTo user structure diff --git a/src/static/swagger-admin-options.json b/src/static/swagger-admin-options.json index 909b87133..8c50e6967 100644 --- a/src/static/swagger-admin-options.json +++ b/src/static/swagger-admin-options.json @@ -27,5 +27,19 @@ { "name": "API Key" } + ], + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "x-api-key", + "in": "header" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } ] } diff --git a/src/static/swagger-admin.json b/src/static/swagger-admin.json index 3d05c126f..4cacbfa9a 100644 --- a/src/static/swagger-admin.json +++ b/src/static/swagger-admin.json @@ -28,380 +28,632 @@ "name": "API Key" } ], - "paths": { - "/admin/api-key/create": { - "post": { - "summary": "Create a new API key", - "description": "Create a new API key", - "tags": [ - "API Key" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyCreateRequestBody" - } + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "x-api-key", + "in": "header" + } + }, + "schemas": { + "PriceListResponseBody": { + "description": "A list of active prcies from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/list)", + "type": "object", + "properties": { + "prices": { + "type": "array", + "items": { + "type": "object", + "description": "A price object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/object)" } } - }, - "responses": { - "201": { - "description": "A new API key has been created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyCreateResponseBody" - } - } + } + }, + "ProductListResponseBody": { + "type": "object", + "properties": { + "products": { + "type": "array", + "items": { + "type": "object", + "description": "A product object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/object)" } - }, - "400": { - "$ref": "#/components/schemas/APIKeyCreateUnsuccessfulResponseBody" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" } } - } - }, - "/admin/api-key/update": { - "post": { - "summary": "Update an existing API key", - "description": "Update an existing API key", - "tags": [ - "API Key" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyUpdateRequestBody" - } - } + }, + "ProductGetResponseBody": { + "description": "A product with or without prices inside. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/retrieve)", + "type": "object" + }, + "InvalidRequest": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "InvalidRequest" } - }, - "responses": { - "200": { - "description": "The API key has been updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyUpdateResponseBody" - } - } - } + } + }, + "InternalError": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Internal Error" + } + } + }, + "UnauthorizedError": { + "description": "Access token is missing or invalid", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Unauthorized Error" + } + } + }, + "SubscriptionCreateRequestBody": { + "description": "The request body for creating a subscription", + "type": "object", + "properties": { + "price": { + "type": "string", + "description": "The price id", + "example": "price_1234567890" }, - "400": { - "$ref": "#/components/schemas/APIKeyUpdateUnsuccessfulResponseBody" + "successURL": { + "type": "string", + "description": "The URL to redirect to after the customer sucessfully completes the checkout", + "example": "https://example.com/success" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "cancelURL": { + "type": "string", + "description": "The URL to redirect to after the customer cancels the checkout", + "example": "https://example.com/cancel" }, - "500": { - "$ref": "#/components/schemas/InternalError" + "quantity": { + "type": "number", + "description": "The quantity of the product", + "example": 1 + }, + "trialPeriodDays": { + "type": "number", + "description": "The number of days the customer has to pay for the product", + "example": 7 + }, + "idempotencyKey": { + "type": "string", + "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.", + "example": "abcdefghijklmnopqrstuvwxyz" } } - } - }, - "/admin/api-key/revoke": { - "delete": { - "summary": "Revoke an existing API key", - "description": "Revoke an existing API key", - "tags": [ - "API Key" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyRevokeRequestBody" + }, + "SubscriptionCreateResponseBody": { + "description": "The response body for creating a subscription", + "type": "object", + "properties": { + "subscription": { + "type": "object", + "description": "An object with link to checkout session. For more information see the [Stripe API documentation](https://docs.stripe.com/api/checkout/sessions/object)", + "properties": { + "sessionURL": { + "type": "string", + "description": "URL which user should follow to manage subscription" } } } - }, - "responses": { - "200": { - "description": "The API key has been revoked", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyRevokeResponseBody" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/APIKeyRevokeUnsuccessfulResponseBody" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" + } + }, + "SubscriptionUpdateRequestBody": { + "description": "The request body for updating a subscription", + "type": "object", + "properties": { + "returnURL": { + "type": "string", + "description": "URL which is used to redirect to the page with ability to update the subscription" } } - } - }, - "/admin/api-key/list": { - "get": { - "summary": "List all API keys", - "description": "List all API keys", - "tags": [ - "API Key" - ], - "responses": { - "200": { - "description": "A list of API keys", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyListResponseBody" - } + }, + "SubscriptionUpdateResponseBody": { + "description": "The response body for updating a subscription", + "type": "object", + "properties": { + "subscription": { + "type": "object", + "description": "Object with redirect url inside", + "properties": { + "sessionURL": { + "type": "string", + "description": "URL with session URL rediect to" } } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "404": { - "$ref": "#/components/schemas/NotFoundError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" } } - } - }, - "/admin/api-key/get": { - "get": { - "summary": "Get an API key", - "description": "Get an API key. If the API key is not provided, the latest not revoked API key it returns.", - "tags": [ - "API Key" - ], - "parameters": [ - { - "name": "apiKey", - "in": "query", - "required": false, - "schema": { - "type": "string" + }, + "SubscriptionGetRequestBody": { + "description": "The request body for getting a subscription", + "type": "object", + "properties": { + "subscriptionId": { + "type": "string", + "description": "The subscription id", + "example": "sub_1234567890" + } + } + }, + "SubscriptionGetResponseBody": { + "description": "The response body for getting a subscription", + "type": "object", + "properties": { + "subscription": { + "type": "object", + "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object)" + } + } + }, + "SubscriptionListRequestBody": { + "description": "The request body for listing subscriptions", + "type": "object", + "properties": { + "customerId": { + "type": "string", + "description": "The Stripe customer id", + "example": "cus_1234567890" + } + } + }, + "SubscriptionListResponseBody": { + "description": "The response body for listing subscriptions", + "type": "object", + "properties": { + "subscriptions": { + "type": "array", + "items": { + "type": "object", + "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]" } } - ], - "responses": { - "200": { + } + }, + "SubscriptionCancelRequestBody": { + "description": "The request body for canceling a subscription", + "type": "object", + "properties": { + "subscriptionId": { + "type": "string", + "description": "The subscription id", + "example": "sub_1234567890" + } + } + }, + "SubscriptionCancelResponseBody": { + "description": "The response body for canceling a subscription", + "type": "object", + "properties": { + "subscription": { + "type": "object", + "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]" + }, + "idempotencyKey": { + "type": "string", + "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.", + "example": "abcdefghijklmnopqrstuvwxyz" + } + } + }, + "SubscriptionResumeRequestBody": { + "description": "The request body for resuming a subscription", + "type": "object", + "properties": { + "subscriptionId": { + "type": "string", + "description": "The subscription id", + "example": "sub_1234567890" + }, + "idempotencyKey": { + "type": "string", + "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.", + "example": "abcdefghijklmnopqrstuvwxyz" + } + } + }, + "SubscriptionResumeResponseBody": { + "description": "The response body for resuming a subscription", + "type": "object", + "properties": { + "subscription": { + "type": "object", + "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]" + } + } + }, + "APIKeyResponse": { + "description": "The general view for API key in response", + "type": "object", + "properties": { + "apiKey": { + "type": "string", "description": "The API key", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIKeyGetResponseBody" - } - } + "example": "abcdefghijklmnopqrstuvwxyz" + }, + "createdAt": { + "type": "string", + "description": "The creation date of the API key", + "example": "2000-10-31T01:23:45Z", + "format": "date-time" + }, + "name": { + "type": "string", + "description": "The name of the API key", + "example": "My API Key" + }, + "expiresAt": { + "type": "string", + "description": "The expiration date of the API key", + "example": "2000-10-31T01:23:45Z", + "format": "date-time" + }, + "revoked": { + "type": "boolean", + "description": "The status of the API key", + "example": false + } + } + }, + "APIKeyCreateRequestBody": { + "description": "The request body for creating an API key", + "type": "object", + "properties": { + "expiresAt": { + "type": "string", + "description": "The expiration date of the API key", + "example": "2000-10-31T01:23:45Z", + "format": "date-time" + }, + "name": { + "type": "string", + "description": "The name of the API key", + "example": "My API Key" + } + }, + "required": [ + "name" + ] + }, + "APIKeyCreateResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/APIKeyResponse" + }, + { + "description": "The response body for creating an API key" + } + ] + }, + "APIKeyCreateUnsuccessfulResponseBody": { + "description": "The response body for an unsuccessful API key creation", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "API key creation unsuccessful" + } + } + }, + "APIKeyUpdateRequestBody": { + "description": "The request body for updating an API key", + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "The API key", + "example": "abcdefghijklmnopqrstuvwxyz" + }, + "name": { + "type": "string", + "description": "The name of the API key", + "example": "My API Key" + }, + "expiresAt": { + "type": "string", + "description": "The expiration date of the API key", + "example": "2000-10-31T01:23:45Z", + "format": "date-time" + }, + "revoked": { + "type": "boolean", + "description": "The status of the API key", + "example": false, + "default": false + } + }, + "required": [ + "apiKey" + ] + }, + "APIKeyUpdateResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/APIKeyResponse" + }, + { + "description": "The response body for an successful API key update" + } + ] + }, + "APIKeyUpdateUnsuccessfulResponseBody": { + "description": "The response body for an unsuccessful API key update", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "API key update unsuccessful" + } + } + }, + "APIKeyRevokeRequestBody": { + "description": "The request body for revoking an API key", + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "The API key", + "example": "abcdefghijklmnopqrstuvwxyz" + } + }, + "required": [ + "apiKey" + ] + }, + "APIKeyRevokeResponseBody": { + "description": "The response body for revoking an API key", + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "The API key", + "example": "abcdefghijklmnopqrstuvwxyz" + }, + "revoked": { + "type": "boolean", + "description": "The status of the API key", + "example": true + } + }, + "required": [ + "apiKey" + ] + }, + "APIKeyRevokeUnsuccessfulResponseBody": { + "description": "The response body for an unsuccessful API key revocation", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "API key revocation unsuccessful" + } + } + }, + "APIKeyListResponseBody": { + "description": "The response body for listing API keys", + "type": "object", + "properties": { + "apiKeys": { + "type": "array", + "items": { + "$ref": "#/components/schemas/APIKeyResponse" } + } + } + }, + "APIKeyGetRequestBody": { + "description": "The request body for getting an API key", + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "The API key", + "example": "abcdefghijklmnopqrstuvwxyz" + } + }, + "required": [ + "apiKey" + ] + }, + "APIKeyGetResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/APIKeyResponse" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + { + "description": "The response body for getting an API key" + } + ] + }, + "OrganisationResponseBody": { + "description": "The response body for an organisation", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the organisation", + "example": "Cheqd" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "email": { + "type": "string", + "description": "The email of the organisation", + "example": "cheqd@example.com", + "format": "email", + "nullable": true, + "default": null }, - "404": { - "$ref": "#/components/schemas/NotFoundError" + "description": { + "type": "string", + "description": "The description of the organisation", + "example": "Cheqd organisation", + "nullable": true, + "default": null }, - "500": { - "$ref": "#/components/schemas/InternalError" + "cosmosAddress": { + "type": "string", + "description": "The cosmos address of the organisation", + "example": "cheqd1hwzvac94udsk8x4mf6htt544lev4jltkwgxp7u" + } + } + }, + "NotFoundError": { + "description": "The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Not Found Error" } } } - }, - "/admin/organisation/update": { + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "paths": { + "/admin/api-key/create": { "post": { - "summary": "Update an organisation", - "description": "Update an organisation", - "tags": [ - "Organisation" - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "Cheqd" - }, - "email": { - "type": "string", - "example": "cheqd@example.com", - "format": "email" - }, - "description": { - "type": "string", - "example": "Cheqd organisation" - } - } + "summary": "Create a new API key", + "description": "Create a new API key", + "tags": [ + "API Key" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIKeyCreateRequestBody" } } } }, "responses": { - "200": { - "description": "A successful response", + "201": { + "description": "A new API key has been created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganisationResponseBody" + "$ref": "#/components/schemas/APIKeyResponse" } } } }, "400": { - "$ref": "#/components/schemas/InvalidRequest" + "$ref": "#/components/schemas/APIKeyCreateUnsuccessfulResponseBody" }, "401": { "$ref": "#/components/schemas/UnauthorizedError" }, - "404": { - "$ref": "#/components/schemas/NotFoundError" - }, "500": { "$ref": "#/components/schemas/InternalError" } } } }, - "/admin/organisation/get": { - "get": { - "summary": "Get an organisation", - "description": "Get an organisation", + "/admin/api-key/update": { + "post": { + "summary": "Update an existing API key", + "description": "Update an existing API key", "tags": [ - "Organisation" + "API Key" ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIKeyUpdateRequestBody" + } + } + } + }, "responses": { "200": { - "description": "A successful response", + "description": "The API key has been updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganisationResponseBody" + "$ref": "#/components/schemas/APIKeyUpdateResponseBody" } } } }, "400": { - "$ref": "#/components/schemas/InvalidRequest" + "$ref": "#/components/schemas/APIKeyUpdateUnsuccessfulResponseBody" }, "401": { "$ref": "#/components/schemas/UnauthorizedError" }, - "404": { - "$ref": "#/components/schemas/NotFoundError" - }, "500": { "$ref": "#/components/schemas/InternalError" } } } }, - "/admin/price/list": { - "get": { - "summary": "Get a list of prices", - "description": "Get a list of prices", + "/admin/api-key/revoke": { + "post": { + "summary": "Revoke an existing API key", + "description": "Revoke an existing API key", "tags": [ - "Price" + "API Key" ], - "parameters": [ - { - "in": "query", - "name": "productId", - "schema": { - "type": "string", - "description": "The product id. If passed - returns filtered by this product list of prices.", - "required": false + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIKeyRevokeRequestBody" + } } } - ], + }, "responses": { "200": { - "description": "A list of prices", + "description": "The API key has been revoked", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PriceListResponseBody" + "$ref": "#/components/schemas/APIKeyRevokeResponseBody" } } } }, "400": { - "$ref": "#/components/schemas/InvalidRequest" + "$ref": "#/components/schemas/APIKeyRevokeUnsuccessfulResponseBody" }, "401": { "$ref": "#/components/schemas/UnauthorizedError" }, - "404": { - "$ref": "#/components/schemas/NotFoundError" - }, "500": { "$ref": "#/components/schemas/InternalError" } } } }, - "/admin/product/list": { + "/admin/api-key/list": { "get": { - "summary": "Get a list of products", - "description": "Get a list of products which are on a Stripe side", + "summary": "List all API keys", + "description": "List all API keys", "tags": [ - "Product" - ], - "parameters": [ - { - "in": "query", - "name": "prices", - "schema": { - "type": "boolean", - "description": "If setup to true - returns the list of products with prices inside. Default - true", - "required": false - } - }, - { - "in": "query", - "name": "limit", - "schema": { - "type": "integer", - "minimum": 1, - "maximum": 100, - "description": "Restrict the response to only include items from 1 to 100. Default - 10", - "required": false - } - }, - { - "in": "query", - "name": "cursor", - "schema": { - "type": "string", - "description": "Cursor for pagination, this only goes forward, i.e., Stripe's equivalent of 'starting_after'", - "required": false - } - } + "API Key" ], "responses": { "200": { - "description": "A list of products", + "description": "A list of API keys", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProductListResponseBody" + "$ref": "#/components/schemas/APIKeyListResponseBody" } } } @@ -421,40 +673,30 @@ } } }, - "/admin/product/get/{productId}": { + "/admin/api-key/get": { "get": { - "summary": "Get a product", - "description": "Get a product by id", + "summary": "Get an API key", + "description": "Get an API key. If the API key is not provided, the latest not revoked API key it returns.", "tags": [ - "Product" + "API Key" ], "parameters": [ { - "in": "path", - "name": "productId", - "schema": { - "type": "string", - "description": "The product id which identifies the product in Stripe" - }, - "required": true - }, - { + "name": "apiKey", "in": "query", - "name": "prices", + "required": false, "schema": { - "type": "boolean", - "description": "If setup to true - returns the product with prices inside. Default - true", - "required": false + "type": "string" } } ], "responses": { "200": { - "description": "A product", + "description": "The API key", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProductGetResponseBody" + "$ref": "#/components/schemas/APIKeyGetResponseBody" } } } @@ -474,108 +716,45 @@ } } }, - "/admin/subscription/create": { + "/admin/organisation/update": { "post": { - "summary": "Create a subscription", - "description": "Creates a new subscription for an existing customer", + "summary": "Update an organisation", + "description": "Update an organisation", "tags": [ - "Subscription" + "Organisation" ], "requestBody": { + "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SubscriptionCreateRequestBody" - } - } - } - }, - "responses": { - "201": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionCreateResponseBody" + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "Cheqd" + }, + "email": { + "type": "string", + "example": "cheqd@example.com", + "format": "email" + }, + "description": { + "type": "string", + "example": "Cheqd organisation" + } } } } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/admin/subscription/update": { - "post": { - "summary": "Update a subscription", - "description": "Updates an existing subscription", - "tags": [ - "Subscription" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionUpdateRequestBody" - } - } } }, "responses": { "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionUpdateResponseBody" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/admin/subscription/list": { - "get": { - "summary": "Get a list of subscriptions", - "description": "Get a list of subscriptions", - "tags": [ - "Subscription" - ], - "parameters": [ - { - "in": "query", - "name": "paymentProviderId", - "schema": { - "type": "string", - "description": "The customer id. If passed - returns filtered by this customer list of subscriptions." - } - } - ], - "responses": { - "200": { - "description": "A list of subscriptions", + "description": "A successful response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SubscriptionListResponseBody" + "$ref": "#/components/schemas/OrganisationResponseBody" } } } @@ -595,20 +774,20 @@ } } }, - "/admin/subscription/get": { - "get": { - "summary": "Get a subscription", - "description": "Get a subscription", + "/admin/organisation/get": { + "get": { + "summary": "Get an organisation", + "description": "Get an organisation", "tags": [ - "Subscription" + "Organisation" ], "responses": { "200": { - "description": "The request was successful.", + "description": "A successful response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SubscriptionGetResponseBody" + "$ref": "#/components/schemas/OrganisationResponseBody" } } } @@ -628,29 +807,30 @@ } } }, - "/admin/subscription/cancel": { - "post": { - "summary": "Cancel a subscription", - "description": "Cancels an existing subscription", + "/admin/price/list": { + "get": { + "summary": "Get a list of prices", + "description": "Get a list of prices", "tags": [ - "Subscription" + "Price" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionCancelRequestBody" - } + "parameters": [ + { + "in": "query", + "name": "productId", + "schema": { + "type": "string", + "description": "The product id. If passed - returns filtered by this product list of prices." } } - }, + ], "responses": { "200": { - "description": "The request was successful.", + "description": "A list of prices", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SubscriptionCancelResponseBody" + "$ref": "#/components/schemas/PriceListResponseBody" } } } @@ -670,519 +850,353 @@ } } }, - "/admin/subscription/resume": {}, - "post": { - "summary": "Resume a subscription", - "description": "Resumes an existing subscription", - "tags": [ - "Subscription" - ], - "requestBody": { - "content": { - "application/json": { + "/admin/product/list": { + "get": { + "summary": "Get a list of products", + "description": "Get a list of products which are on a Stripe side", + "tags": [ + "Product" + ], + "parameters": [ + { + "in": "query", + "name": "prices", "schema": { - "$ref": "#/components/schemas/SubscriptionResumeRequestBody" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionResumeResponseBody" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "404": { - "$ref": "#/components/schemas/NotFoundError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "components": { - "schemas": { - "PriceListResponseBody": { - "description": "A list of active prcies from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/list)", - "type": "object", - "properties": { - "prices": { - "type": "array", - "items": { - "type": "object", - "description": "A price object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/prices/object)" - } - } - } - }, - "ProductListResponseBody": { - "type": "object", - "properties": { - "products": { - "type": "array", - "items": { - "type": "object", - "description": "A product object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/object)" + "type": "boolean", + "description": "If setup to true - returns the list of products with prices inside. Default - true" } - } - } - }, - "ProductGetResponseBody": { - "description": "A product with or without prices inside. For more information see the [Stripe API documentation](https://docs.stripe.com/api/products/retrieve)", - "type": "object" - }, - "InvalidRequest": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "InvalidRequest" - } - } - }, - "InternalError": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Internal Error" - } - } - }, - "UnauthorizedError": { - "description": "Access token is missing or invalid", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Unauthorized Error" - } - } - }, - "SubscriptionCreateRequestBody": { - "description": "The request body for creating a subscription", - "type": "object", - "properties": { - "price": { - "type": "string", - "description": "The price id", - "example": "price_1234567890" - }, - "successURL": { - "type": "string", - "description": "The URL to redirect to after the customer sucessfully completes the checkout", - "example": "https://example.com/success" - }, - "cancelURL": { - "type": "string", - "description": "The URL to redirect to after the customer cancels the checkout", - "example": "https://example.com/cancel" - }, - "quantity": { - "type": "number", - "description": "The quantity of the product", - "example": 1 - }, - "trialPeriodDays": { - "type": "number", - "description": "The number of days the customer has to pay for the product", - "example": 7 }, - "idempotencyKey": { - "type": "string", - "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.", - "example": "abcdefghijklmnopqrstuvwxyz" - } - } - }, - "SubscriptionCreateResponseBody": { - "description": "The response body for creating a subscription", - "type": "object", - "properties": { - "subscription": { - "type": "object", - "description": "An object with link to checkout session. For more information see the [Stripe API documentation](https://docs.stripe.com/api/checkout/sessions/object)", - "properties": { - "sessionURL": { - "type": "string", - "description": "URL which user should follow to manage subscription" - } + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "description": "Restrict the response to only include items from 1 to 100. Default - 10" } - } - } - }, - "SubscriptionUpdateRequestBody": { - "description": "The request body for updating a subscription", - "type": "object", - "properties": { - "returnURL": { - "type": "string", - "description": "URL which is used to redirect to the page with ability to update the subscription" - } - } - }, - "SubscriptionUpdateResponseBody": { - "description": "The response body for updating a subscription", - "type": "object", - "properties": { - "subscription": { - "type": "object", - "description": "Object with redirect url inside", - "properties": { - "sessionURL": { - "type": "string", - "description": "URL with session URL rediect to" - } + }, + { + "in": "query", + "name": "cursor", + "schema": { + "type": "string", + "description": "Cursor for pagination, this only goes forward, i.e., Stripe's equivalent of 'starting_after'" } } - } - }, - "SubscriptionGetRequestBody": { - "description": "The request body for getting a subscription", - "type": "object", - "properties": { - "subscriptionId": { - "type": "string", - "description": "The subscription id", - "example": "sub_1234567890" - } - } - }, - "SubscriptionGetResponseBody": { - "description": "The response body for getting a subscription", - "type": "object", - "properties": { - "subscription": { - "type": "object", - "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object)" - } - } - }, - "SubscriptionListRequestBody": { - "description": "The request body for listing subscriptions", - "type": "object", - "properties": { - "customerId": { - "type": "string", - "description": "The Stripe customer id", - "example": "cus_1234567890" - } - } - }, - "SubscriptionListResponseBody": { - "description": "The response body for listing subscriptions", - "type": "object", - "properties": { - "subscriptions": { - "type": "array", - "items": { - "type": "object", - "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]" + ], + "responses": { + "200": { + "description": "A list of products", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProductListResponseBody" + } + } } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "404": { + "$ref": "#/components/schemas/NotFoundError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "SubscriptionCancelRequestBody": { - "description": "The request body for canceling a subscription", - "type": "object", - "properties": { - "subscriptionId": { - "type": "string", - "description": "The subscription id", - "example": "sub_1234567890" - } - } - }, - "SubscriptionCancelResponseBody": { - "description": "The response body for canceling a subscription", - "type": "object", - "properties": { - "subscription": { - "type": "object", - "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]" + } + }, + "/admin/product/get/{productId}": { + "get": { + "summary": "Get a product", + "description": "Get a product by id", + "tags": [ + "Product" + ], + "parameters": [ + { + "in": "path", + "name": "productId", + "schema": { + "type": "string", + "description": "The product id which identifies the product in Stripe" + }, + "required": true }, - "idempotencyKey": { - "type": "string", - "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.", - "example": "abcdefghijklmnopqrstuvwxyz" + { + "in": "query", + "name": "prices", + "schema": { + "type": "boolean", + "description": "If setup to true - returns the product with prices inside. Default - true" + } } - } - }, - "SubscriptionResumeRequestBody": { - "description": "The request body for resuming a subscription", - "type": "object", - "properties": { - "subscriptionId": { - "type": "string", - "description": "The subscription id", - "example": "sub_1234567890" + ], + "responses": { + "200": { + "description": "A product", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProductGetResponseBody" + } + } + } }, - "idempotencyKey": { - "type": "string", - "description": "The idempotency key. It helps to prevent duplicate requests. In case if there was a request with the same idempotency key, the response will be the same as for the first request.", - "example": "abcdefghijklmnopqrstuvwxyz" + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "404": { + "$ref": "#/components/schemas/NotFoundError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "SubscriptionResumeResponseBody": { - "description": "The response body for resuming a subscription", - "type": "object", - "properties": { - "subscription": { - "type": "object", - "description": "A subscription object from Stripe. For more information see the [Stripe API documentation](https://docs.stripe.com/api/subscriptions/object]" + } + }, + "/admin/subscription/create": { + "post": { + "summary": "Create a subscription", + "description": "Creates a new subscription for an existing customer", + "tags": [ + "Subscription" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionCreateRequestBody" + } + } } - } - }, - "APIKeyResponse": { - "description": "The general view for API key in response", - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "The API key", - "example": "abcdefghijklmnopqrstuvwxyz" - }, - "createdAt": { - "type": "string", - "description": "The creation date of the API key", - "example": "2000-10-31T01:23:45Z", - "format": "date-time" + }, + "responses": { + "201": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionCreateResponseBody" + } + } + } }, - "name": { - "type": "string", - "description": "The name of the API key", - "example": "My API Key" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "expiresAt": { - "type": "string", - "description": "The expiration date of the API key", - "example": "2000-10-31T01:23:45Z", - "format": "date-time" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "revoked": { - "type": "boolean", - "description": "The status of the API key", - "example": false + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "APIKeyCreateRequestBody": { - "description": "The request body for creating an API key", - "type": "object", - "properties": { - "expiresAt": { - "type": "string", - "description": "The expiration date of the API key", - "example": "2000-10-31T01:23:45Z", - "format": "date-time" - }, - "name": { - "type": "string", - "description": "The name of the API key", - "example": "My API Key" + } + }, + "/admin/subscription/update": { + "post": { + "summary": "Update a subscription", + "description": "Updates an existing subscription", + "tags": [ + "Subscription" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionUpdateRequestBody" + } + } } }, - "required": [ - "name" - ] - }, - "APIKeyCreateResponseBody": { - "description": "The response body for creating an API key", - "type": "object", - "schema": { - "ref": "#/components/schemas/APIKeyResponse" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionUpdateResponseBody" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } } - }, - "APIKeyCreateUnsuccessfulResponseBody": { - "description": "The response body for an unsuccessful API key creation", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "API key creation unsuccessful" + } + }, + "/admin/subscription/list": { + "get": { + "summary": "Get a list of subscriptions", + "description": "Get a list of subscriptions", + "tags": [ + "Subscription" + ], + "parameters": [ + { + "in": "query", + "name": "paymentProviderId", + "schema": { + "type": "string", + "description": "The customer id. If passed - returns filtered by this customer list of subscriptions." + } } - } - }, - "APIKeyUpdateRequestBody": { - "description": "The request body for updating an API key", - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "The API key", - "example": "abcdefghijklmnopqrstuvwxyz" + ], + "responses": { + "200": { + "description": "A list of subscriptions", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionListResponseBody" + } + } + } }, - "name": { - "type": "string", - "description": "The name of the API key", - "example": "My API Key" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "expiresAt": { - "type": "string", - "description": "The expiration date of the API key", - "example": "2000-10-31T01:23:45Z", - "format": "date-time" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "revoked": { - "type": "boolean", - "description": "The status of the API key", - "example": false, - "default": false + "404": { + "$ref": "#/components/schemas/NotFoundError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } - }, - "required": [ - "apiKey" - ] - }, - "APIKeyUpdateResponseBody": { - "description": "The response body for an unsuccessful API key update", - "type": "object", - "schema": { - "ref": "#/components/schemas/APIKeyResponse" } - }, - "APIKeyUpdateUnsuccessfulResponseBody": { - "description": "The response body for an unsuccessful API key update", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "API key update unsuccessful" + } + }, + "/admin/subscription/get": { + "get": { + "summary": "Get a subscription", + "description": "Get a subscription", + "tags": [ + "Subscription" + ], + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionGetResponseBody" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "404": { + "$ref": "#/components/schemas/NotFoundError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "APIKeyRevokeRequestBody": { - "description": "The request body for revoking an API key", - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "The API key", - "example": "abcdefghijklmnopqrstuvwxyz" + } + }, + "/admin/subscription/cancel": { + "post": { + "summary": "Cancel a subscription", + "description": "Cancels an existing subscription", + "tags": [ + "Subscription" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionCancelRequestBody" + } + } } }, - "required": [ - "apiKey" - ] - }, - "APIKeyRevokeResponseBody": { - "description": "The response body for revoking an API key", - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "The API key", - "example": "abcdefghijklmnopqrstuvwxyz" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionCancelResponseBody" + } + } + } }, - "revoked": { - "type": "boolean", - "description": "The status of the API key", - "example": true - } - }, - "required": [ - "apiKey" - ] - }, - "APIKeyRevokeUnsuccessfulResponseBody": { - "description": "The response body for an unsuccessful API key revocation", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "API key revocation unsuccessful" + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "404": { + "$ref": "#/components/schemas/NotFoundError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "APIKeyListResponseBody": { - "description": "The response body for listing API keys", - "type": "object", - "properties": { - "apiKeys": { - "type": "array", - "items": { - "type": "object", + } + }, + "/admin/subscription/resume": { + "post": { + "summary": "Resume a subscription", + "description": "Resumes an existing subscription", + "tags": [ + "Subscription" + ], + "requestBody": { + "content": { + "application/json": { "schema": { - "ref": "#/components/schemas/APIKeyResponse" + "$ref": "#/components/schemas/SubscriptionResumeRequestBody" } } } - } - }, - "APIKeyGetRequestBody": { - "description": "The request body for getting an API key", - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "The API key", - "example": "abcdefghijklmnopqrstuvwxyz" - } }, - "required": [ - "apiKey" - ] - }, - "APIKeyGetResponseBody": { - "description": "The response body for getting an API key", - "type": "object", - "schema": { - "ref": "#/components/schemas/APIKeyResponse" - } - }, - "OrganisationResponseBody": { - "description": "The response body for an organisation", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the organisation", - "example": "Cheqd" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionResumeResponseBody" + } + } + } }, - "email": { - "type": "string", - "description": "The email of the organisation", - "example": "cheqd@example.com", - "format": "email", - "nullable": true, - "default": null + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "description": { - "type": "string", - "description": "The description of the organisation", - "example": "Cheqd organisation", - "nullable": true, - "default": null + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "cosmosAddress": { - "type": "string", - "description": "The cosmos address of the organisation", - "example": "cheqd1hwzvac94udsk8x4mf6htt544lev4jltkwgxp7u" - } - } - }, - "NotFoundError": { - "description": "The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Not Found Error" + "404": { + "$ref": "#/components/schemas/NotFoundError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } } } diff --git a/src/static/swagger-api-options.json b/src/static/swagger-api-options.json index 65171aa72..0897396ba 100644 --- a/src/static/swagger-api-options.json +++ b/src/static/swagger-api-options.json @@ -40,5 +40,19 @@ "externalDocs": { "description": "cheqd Studio API Documentation", "url": "https://docs.cheqd.io/identity" - } + }, + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "x-api-key", + "in": "header" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ] } diff --git a/src/static/swagger-api.json b/src/static/swagger-api.json index a14c987f7..3aa895c5b 100644 --- a/src/static/swagger-api.json +++ b/src/static/swagger-api.json @@ -41,3521 +41,3554 @@ "description": "cheqd Studio API Documentation", "url": "https://docs.cheqd.io/identity" }, - "paths": { - "/account": { - "get": { - "tags": [ - "Account" - ], - "summary": "Fetch custodian-mode client details.", - "description": "This endpoint returns the custodian-mode client details for authenticated users.", - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Customer" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "x-api-key", + "in": "header" } }, - "/account/idtoken": { - "get": { - "tags": [ - "Account" - ], - "summary": "Fetch IdToken.", - "description": "This endpoint returns IdToken as JWT with list of user roles inside", - "deprecated": true, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "idToken": { - "type": "string" + "schemas": { + "AlsoKnownAs": { + "type": "object", + "properties": { + "alsoKnownAs": { + "type": "array", + "description": "Optional field to assign a set of alternative URIs where the DID-Linked Resource can be fetched from.", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string", + "format": "uri", + "description": "URI where the DID-Linked Resource can be fetched from. Can be any type of URI (e.g., DID, HTTPS, IPFS, etc.)" + }, + "description": { + "type": "string", + "description": "Optional description of the URI." } } } + } + } + }, + "CredentialRequest": { + "description": "Input fields for the creating a Verifiable Credential.", + "type": "object", + "additionalProperties": false, + "properties": { + "issuerDid": { + "description": "DID of the Verifiable Credential issuer. This needs to be a `did:cheqd` DID.", + "type": "string", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "subjectDid": { + "description": "DID of the Verifiable Credential holder/subject. This needs to be a `did:key` DID.", + "type": "string", + "example": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "attributes": { + "description": "JSON object containing the attributes to be included in the credential.", + "type": "object", + "example": { + "name": "Bob", + "gender": "male" + } }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/account/create": { - "post": { - "tags": [ - "Account" - ], - "summary": "Create an client for an authenticated user.", - "description": "This endpoint creates a client in the custodian-mode for an authenticated user", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/AccountCreateRequest" - } + "@context": { + "description": "Optional properties to be included in the `@context` property of the credential.", + "type": "array", + "items": { + "type": "string" }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccountCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "idToken": { - "type": "string" - } - } - } + "example": [ + "https://schema.org/schema.jsonld", + "https://veramo.io/contexts/profile/v1" + ] }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "type": { + "description": "Optional properties to be included in the `type` property of the credential.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "Person" + ] }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "expirationDate": { + "description": "Optional expiration date according to the VC Data Model specification.", + "type": "string", + "format": "date-time", + "example": "2023-06-08T13:49:28.000Z" }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/credential-status/create/unencrypted": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Create an unencrypted StatusList2021 credential status list.", - "description": "This endpoint creates an unencrypted StatusList2021 credential status list. The StatusList is published as a DID-Linked Resource on ledger. As input, it can can take input parameters needed to create the status list via a form, or a pre-assembled status list in JSON format. Status lists can be created as either encrypted or unencrypted; and with purpose as either revocation or suspension.", - "parameters": [ - { - "in": "query", - "name": "statusPurpose", - "description": "The purpose of the status list. Can be either revocation or suspension. Once this is set, it cannot be changed. A new status list must be created to change the purpose.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateUnencryptedRequest" + "format": { + "description": "Format of the Verifiable Credential. Defaults to VC-JWT.", + "type": "string", + "enum": [ + "jwt", + "jsonld" + ], + "example": "jwt" + }, + "credentialStatus": { + "description": "Optional `credentialStatus` properties for VC revocation or suspension. Takes `statusListName` and `statusListPurpose` as inputs.", + "type": "object", + "required": [ + "statusPurpose", + "statusListName" + ], + "properties": { + "statusPurpose": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + }, + "statusListName": { + "type": "string" + }, + "statusListIndex": { + "type": "number" + }, + "statusListVersion": { + "type": "string", + "format": "date-time" + }, + "statusListRangeStart": { + "type": "number" + }, + "statusListRangeEnd": { + "type": "number" + }, + "indexNotIn": { + "type": "number" } }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateUnencryptedRequest" - } + "example": { + "statusPurpose": "revocation", + "statusListName": "employee-credentials" } } }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateUnencryptedResult" - } - } - } + "required": [ + "issuerDid", + "subjectDid", + "attributes" + ], + "example": { + "issuerDid": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "attributes": { + "gender": "male", + "name": "Bob" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" + "@context": [ + "https://schema.org" + ], + "type": [ + "Person" + ], + "format": "jwt", + "credentialStatus": { + "statusPurpose": "revocation", + "statusListName": "employee-credentials", + "statusListIndex": 10 } } - } - }, - "/credential-status/create/encrypted": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Create an encrypted StatusList2021 credential status list.", - "description": "This endpoint creates an encrypted StatusList2021 credential status list. The StatusList is published as a DID-Linked Resource on ledger. As input, it can can take input parameters needed to create the status list via a form, or a pre-assembled status list in JSON format. Status lists can be created as either encrypted or unencrypted; and with purpose as either revocation or suspension.", - "parameters": [ - { - "in": "query", - "name": "statusPurpose", - "description": "The purpose of the status list. Can be either revocation or suspension. Once this is set, it cannot be changed. A new status list must be created to change the purpose.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateEncryptedFormRequest" - } + }, + "Credential": { + "description": "Input fields for revoking/suspending a Verifiable Credential.", + "type": "object", + "additionalProperties": false, + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateEncryptedJsonRequest" + "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", + "format": "date-time", + "example": "2023-06-08T13:49:28.000Z" + }, + "issuer": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "DID", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" } } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCreateEncryptedResult" - } + }, + "credentialSubject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "DID", + "example": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK" } } }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "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": "number", + "example": 20 + }, + "statusPurpose": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ], + "example": "suspension" + }, + "type": { + "type": "string", + "enum": [ + "StatusList2021Entry" + ] + } + } }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "issuanceDate": { + "type": "string", + "format": "date-time", + "example": "2023-06-08T13:49:28.000Z" }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/credential-status/update/unencrypted": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Update an existing unencrypted StatusList2021 credential status list.", - "parameters": [ - { - "in": "query", - "name": "statusAction", - "description": "The update action to be performed on the unencrypted status list, can be revoke, suspend or reinstate", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revoke", - "suspend", - "reinstate" - ] - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateUnencryptedRequest" + "proof": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "jwt": { + "type": "string" } }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateUnencryptedRequest" - } + "example": { + "type": "JwtProof2020", + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg" } } }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateUnencryptedResult" - } - } - } + "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" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "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" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "issuanceDate": "2023-06-08T13:49:28.000Z", + "issuer": { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" }, - "500": { - "$ref": "#/components/schemas/InternalError" + "proof": { + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg", + "type": "JwtProof2020" + }, + "type": [ + "VerifiableCredential", + "Person" + ] + } + }, + "CredentialRevokeRequest": { + "type": "object", + "properties": { + "credential": { + "description": "Verifiable Credential to be revoked as a VC-JWT string or a JSON object.", + "oneOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + }, + "symmetricKey": { + "description": "The symmetric key used to encrypt the StatusList2021 DID-Linked Resource. Required if the StatusList2021 DID-Linked Resource is encrypted.", + "type": "string" } } - } - }, - "/credential-status/update/encrypted": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Update an existing encrypted StatusList2021 credential status list.", - "parameters": [ - { - "in": "query", - "name": "statusAction", - "description": "The update action to be performed on the encrypted status list, can be revoke, suspend or reinstate", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revoke", - "suspend", - "reinstate" - ] - } + }, + "RevocationResult": { + "properties": { + "revoked": { + "type": "boolean", + "example": true } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateEncryptedFormRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateEncryptedJsonRequest" - } - } + } + }, + "SuspensionResult": { + "properties": { + "suspended": { + "type": "boolean", + "example": true } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusUpdateEncryptedResult" - } + } + }, + "UnsuspensionResult": { + "properties": { + "unsuspended": { + "type": "boolean", + "example": true + } + } + }, + "CredentialVerifyRequest": { + "type": "object", + "properties": { + "credential": { + "description": "Verifiable Credential to be verified as a VC-JWT string or a JSON object.", + "type": "object" + }, + "policies": { + "description": "Custom verification policies to execute when verifying credential.", + "type": "object", + "properties": { + "issuanceDate": { + "description": "Policy to skip the `issuanceDate` (`nbf`) timestamp check when set to `false`.", + "type": "boolean", + "default": true + }, + "expirationDate": { + "description": "Policy to skip the `expirationDate` (`exp`) timestamp check when set to `false`.", + "type": "boolean", + "default": true + }, + "audience": { + "description": "Policy to skip the audience check when set to `false`.", + "type": "boolean", + "default": false } } + } + } + }, + "VerifyPresentationResult": { + "type": "object", + "properties": { + "verified": { + "type": "boolean" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "issuer": { + "type": "string" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "signer": { + "type": "object" }, - "500": { - "$ref": "#/components/schemas/InternalError" + "jwt": { + "type": "string" + }, + "verifiableCredential": { + "type": "object" } } - } - }, - "/credential-status/check": { - "post": { - "tags": [ - "Credential Status" - ], - "summary": "Check a StatusList2021 index for a given Verifiable Credential.", - "description": "This endpoint checks a StatusList2021 index for a given Verifiable Credential and reports whether it is revoked or suspended. It offers a standalone method for checking an index without passing the entire Verifiable Credential or Verifiable Presentation.", - "parameters": [ - { - "in": "query", - "name": "statusPurpose", - "description": "The purpose of the status list. Can be either revocation or suspension.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCheckRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCheckRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusCheckResult" - } - } - } + }, + "VerifyCredentialResult": { + "type": "object", + "properties": { + "verified": { + "type": "boolean" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "issuer": { + "type": "string" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "signer": { + "type": "object" }, - "500": { - "$ref": "#/components/schemas/InternalError" + "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" } } - } - }, - "/credential-status/search": { - "get": { - "tags": [ - "Credential Status" + }, + "PresentationCreateRequest": { + "type": "object", + "required": [ + "credentials" ], - "summary": "Fetch StatusList2021 DID-Linked Resource based on search criteria.", - "parameters": [ - { - "in": "query", - "name": "did", - "description": "The DID of the issuer of the status list.", - "required": true, - "schema": { - "type": "string" + "properties": { + "credentials": { + "description": "Verifiable Credentials to be used for VP-JWT creation as a VP-JWT strings or a JSON objectsf.", + "type": "array", + "items": { + "type": "object" } }, - { - "in": "query", - "name": "statusPurpose", - "description": "The purpose of the status list. Can be either revocation or suspension.", - "schema": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ] - } + "holderDid": { + "description": "DID of holder", + "type": "string" }, - { - "in": "query", - "name": "statusListName", - "description": "The name of the StatusList2021 DID-Linked Resource.", - "schema": { - "type": "string" - } + "verifierDid": { + "description": "DID of verifier", + "type": "string" } + } + }, + "PresentationVerifyRequest": { + "type": "object", + "required": [ + "presentation" ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialStatusListSearchResult" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "properties": { + "presentation": { + "description": "Verifiable Presentation to be verified as a VP-JWT string or a JSON object.", + "type": "object" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "verifierDid": { + "description": "Provide an optional verifier DID (also known as 'domain' parameter), if the verifier DID in the presentation is not managed in the wallet.", + "type": "string" }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/credential/issue": { - "post": { - "tags": [ - "Credential" - ], - "summary": "Issue a Verifiable Credential", - "description": "This endpoint issues a Verifiable Credential. As input it takes the list of issuerDid, subjectDid, attributes, and other parameters of the credential to be issued.", - "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" - } + "makeFeePayment": { + "description": "Automatically make fee payment (if required) based on payment conditions to unlock encrypted StatusList2021 DID-Linked Resource.", + "type": "boolean", + "default": false + }, + "policies": { + "description": "Custom verification policies to execute when verifying presentation.", + "type": "object", + "properties": { + "issuanceDate": { + "description": "Policy to skip the `issuanceDate` (`nbf`) timestamp check when set to `false`.", + "type": "boolean", + "default": true + }, + "expirationDate": { + "description": "Policy to skip the `expirationDate` (`exp`) timestamp check when set to `false`.", + "type": "boolean", + "default": true + }, + "audience": { + "description": "Policy to skip the audience check when set to `false`.", + "type": "boolean", + "default": false } } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" } } - } - }, - "/credential/verify": { - "post": { - "tags": [ - "Credential" - ], - "summary": "Verify a Verifiable Credential.", - "description": "This endpoint verifies a Verifiable Credential passed to it. As input, it can take the VC-JWT as a string or the entire credential itself.", - "operationId": "verify", - "parameters": [ + }, + "CredentialStatusCreateBody": { + "allOf": [ { - "in": "query", - "name": "verifyStatus", - "description": "If set to `true` the verification will also check the status of the credential. Requires the VC to have a `credentialStatus` property.", - "schema": { - "type": "boolean", - "default": false + "type": "object", + "required": [ + "did", + "statusListName" + ], + "properties": { + "did": { + "description": "DID of the StatusList2021 publisher.", + "type": "string", + "format": "uri" + }, + "statusListName": { + "description": "The name of the StatusList2021 DID-Linked Resource 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.", + "type": "integer", + "minimum": 0, + "exclusiveMinimum": true, + "default": 140000 + }, + "encoding": { + "description": "The encoding format of the StatusList2021 DiD-Linked Resource to be created.", + "type": "string", + "default": "base64url", + "enum": [ + "base64url", + "base64", + "hex" + ] + }, + "statusListVersion": { + "description": "Optional field to assign a human-readable version in the StatusList2021 DID-Linked Resource.", + "type": "string" + } } }, { - "in": "query", - "name": "fetchRemoteContexts", - "description": "When dealing with JSON-LD you also MUST provide the proper contexts. Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are a custom context.", - "schema": { - "type": "boolean", - "default": false - } - }, + "$ref": "#/components/schemas/AlsoKnownAs" + } + ] + }, + "CredentialStatusCreateUnencryptedRequest": { + "allOf": [ { - "in": "query", - "name": "allowDeactivatedDid", - "description": "If set to `true` allow to verify credential which based on deactivated DID.", - "schema": { - "type": "boolean", - "default": false - } + "$ref": "#/components/schemas/CredentialStatusCreateBody" } ], - "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/VerifyCredentialResult" + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials", + "length": 140000, + "encoding": "base64url" + } + }, + "CredentialStatusUnencryptedResult": { + "type": "object", + "properties": { + "resource": { + "type": "object", + "properties": { + "StatusList2021": { + "type": "object", + "properties": { + "encodedList": { + "type": "string", + "example": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA" + }, + "type": { + "type": "string", + "example": "StatusList2021Revocation" + }, + "validFrom": { + "type": "string", + "format": "date-time", + "example": "2023-06-26T11:45:19.349Z" + } + } + }, + "metadata": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "StatusList2021Revocation" + }, + "encoding": { + "type": "string", + "example": "base64url" + }, + "encrypted": { + "type": "boolean", + "example": false + } } } } }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" + "resourceMetadata": { + "type": "object", + "example": { + "resourceURI": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc", + "resourceCollectionId": "7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "resourceId": "5945233a-a4b5-422b-b893-eaed5cedd2dc", + "resourceName": "cheqd-employee-credentials", + "resourceType": "StatusList2021Revocation", + "mediaType": "application/json", + "resourceVersion": "1.0.0", + "created": "2023-06-26T11:45:20Z", + "checksum": "909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2", + "previousVersionId": null, + "nextVersionId": null + } } } - } - }, - "/credential/revoke": { - "post": { - "tags": [ - "Credential" - ], - "summary": "Revoke a Verifiable Credential.", - "description": "This endpoint revokes a given Verifiable Credential. As input, it can take the VC-JWT as a string or the entire credential itself. The StatusList2021 resource should already be setup in the VC and `credentialStatus` property present in the VC.", - "operationId": "revoke", - "parameters": [ + }, + "CredentialStatusCreateUnencryptedResult": { + "allOf": [ { - "in": "query", - "name": "publish", - "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", - "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" - } + "type": "object", + "properties": { + "created": { + "type": "boolean", + "example": true } } }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + { + "$ref": "#/components/schemas/CredentialStatusUnencryptedResult" + } + ] + }, + "CredentialStatusEncryptedPaymentConditionsBody": { + "type": "object", + "properties": { + "feePaymentAddress": { + "description": "The cheqd/Cosmos payment address where payments to unlock the encrypted StatusList2021 DID-Linked Resource need to be sent.", + "type": "string", + "example": "cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "feePaymentAmount": { + "description": "Amount in CHEQ tokens to unlock the encrypted StatusList2021 DID-Linked Resource.", + "type": "number", + "minimum": 0, + "exclusiveMinimum": true, + "default": 20 }, - "500": { - "$ref": "#/components/schemas/InternalError" + "feePaymentWindow": { + "description": "Time window (in minutes) within which the payment to unlock the encrypted StatusList2021 DID-Linked Resource is considered valid.", + "type": "number", + "minimum": 0, + "exclusiveMinimum": true, + "default": 10 } } - } - }, - "/credential/suspend": { - "post": { - "tags": [ - "Credential" - ], - "summary": "Suspend a Verifiable Credential.", - "description": "This endpoint suspends a given Verifiable Credential. As input, it can take the VC-JWT as a string or the entire credential itself.", - "operationId": "suspend", - "parameters": [ - { - "in": "query", - "name": "publish", - "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" + }, + "CredentialStatusEncryptedPaymentConditionsJson": { + "type": "object", + "properties": { + "paymentConditions": { + "allOf": [ + { + "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsBody" } - } + ] } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SuspensionResult" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + } + }, + "CredentialStatusCreateEncryptedFormRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/CredentialStatusCreateBody" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + { + "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsBody" }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/credential/reinstate": { - "post": { - "tags": [ - "Credential" - ], - "summary": "Reinstate a suspended Verifiable Credential.", - "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", - "operationId": "reinstate", - "parameters": [ { - "in": "query", - "name": "publish", - "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CredentialRevokeRequest" - } - } + "type": "object", + "required": [ + "feePaymentAddress", + "feePaymentAmount", + "feePaymentWindow" + ] } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnsuspensionResult" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + ] + }, + "CredentialStatusCreateEncryptedJsonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/CredentialStatusCreateBody" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + { + "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsJson" }, - "500": { - "$ref": "#/components/schemas/InternalError" + { + "type": "object", + "required": [ + "paymentConditions" + ] } - } - } - }, - "/did/create": { - "post": { - "tags": [ - "DID" ], - "summary": "Create a DID Document.", - "description": "This endpoint creates a DID and associated DID Document. As input, it can take the DID Document parameters via a form, or the fully-assembled DID Document itself.", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/DidCreateRequestFormBased" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidCreateRequestJson" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidResult" - } - } + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials-encrypted", + "paymentConditions": [ + { + "feePaymentAddress": "cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg", + "feePaymentAmount": 20, + "feePaymentWindow": 10 } - }, - "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": "InvalidRequest" + ] + } + }, + "CredentialStatusEncryptedResult": { + "type": "object", + "properties": { + "resource": { + "type": "object", + "properties": { + "StatusList2021": { + "type": "object", + "properties": { + "encodedList": { + "type": "string", + "example": "496fdfbeb745b4db03fcdb40566f9c4c4a1c0f184b31255e641b6e7bdfb9b6946c12be87ca3763be0393c00b67ac1e8737c106b32f46ef59c765754415b5e8cc7c65fccaa3374620430ea476301a5e0dd63340e7a27a68bc627518471f22e4a2" + }, + "type": { + "type": "string", + "example": "StatusList2021Revocation" + }, + "validFrom": { + "type": "string", + "format": "date-time", + "example": "2023-06-26T11:45:19.349Z" + } } - } - } - }, - "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" - }, + }, + "metadata": { + "type": "object", + "properties": { + "type": { + "type": "string", + "example": "StatusList2021Revocation" + }, + "encoding": { + "type": "string", + "example": "base64url" + }, + "encrypted": { + "type": "boolean", + "example": true + }, + "encryptedSymmetricKey": { + "type": "string", + "example": "b11182dc524b8181f9a6aef4c4ad0a1c14e40033b9112dffd8d1bcf6cc3b85abc07ded2205ee94068a99f4202502cb0855f322583fa6ce1534d3a05bf36891766ea2c5f90a982b3040680762977d404d758a2370224a239c8279aa7d21e980931c42055b17ca4c7dbffa4782480a8b6279cf989b2f166d5fdb4b2c1b5a63927200000000000000203018dcaba26df45a415bb599218b27ca853a70289d7a3ed3ed0e3730452e8f8d9af91b6e71312565d2c069341f6660ab" + }, + "paymentConditions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "feePaymentAddress": { + "type": "string", + "example": "cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg" + }, + "feePaymentAmount": { + "type": "string", + "example": "20000000000ncheq" + }, + "intervalInSeconds": { + "type": "number", + "example": 600 + }, + "type": { + "type": "string", + "example": "timelockPayment" + } + } + } + } + } + }, + "resourceMetadata": { + "type": "object", "example": { - "error": "Internal Error" + "resourceURI": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc", + "resourceCollectionId": "7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "resourceId": "5945233a-a4b5-422b-b893-eaed5cedd2dc", + "resourceName": "cheqd-revocation-encrypted-1", + "resourceType": "StatusList2021Revocation", + "mediaType": "application/json", + "resourceVersion": "2023-06-26T11:45:19.349Z", + "created": "2023-06-26T11:45:20Z", + "checksum": "909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2", + "previousVersionId": null, + "nextVersionId": null } + }, + "symmetricKey": { + "type": "string", + "example": "dfe204ee95ae74ea5d74b94c3d8ff782273905b07fbc9f8c3d961c3b43849f18" } } } } - } - }, - "/did/update": { - "post": { - "tags": [ - "DID" - ], - "summary": "Update a DID Document.", - "description": "This endpoint updates a DID Document. As an input, it can take JUST the sections/parameters that need to be updated in the DID Document (in this scenario, it fetches the current DID Document and applies the updated section). Alternatively, it take the fully-assembled DID Document with updated sections as well as unchanged sections.", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/DidUpdateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidUpdateRequest" + }, + "CredentialStatusCreateEncryptedResult": { + "allOf": [ + { + "type": "object", + "properties": { + "created": { + "type": "boolean", + "example": true } } + }, + { + "$ref": "#/components/schemas/CredentialStatusEncryptedResult" } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidUpdateResponse" - } - } - } + ] + }, + "CredentialStatusUpdateBody": { + "type": "object", + "required": [ + "did", + "statusListName", + "indices" + ], + "properties": { + "did": { + "description": "DID of the StatusList2021 publisher.", + "type": "string", + "format": "uri" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "statusListName": { + "description": "The name of the StatusList2021 DID-Linked Resource to be updated.", + "type": "string" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "indices": { + "description": "List of credential status indices to be updated. The indices must be in the range of the status list.", + "type": "array", + "items": { + "type": "integer", + "minimum": 0, + "exclusiveMinimum": false + } }, - "500": { - "$ref": "#/components/schemas/InternalError" + "statusListVersion": { + "description": "Optional field to assign a human-readable version in the StatusList2021 DID-Linked Resource.", + "type": "string" } } - } - }, - "/did/import": { - "post": { - "tags": [ - "DID" - ], - "summary": "Import a DID Document.", - "description": "This endpoint imports a decentralized identifier associated with the user's account for custodian-mode clients.", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/DidImportRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidImportRequest" - } - } + }, + "CredentialStatusUpdateUnencryptedRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/CredentialStatusUpdateBody" } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidResult" - } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials", + "indices": [ + 10, + 3199, + 12109, + 130999 + ] + } + }, + "CredentialStatusUpdateUnencryptedResult": { + "allOf": [ + { + "type": "object", + "properties": { + "updated": { + "type": "boolean", + "example": true } } }, - "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": "InvalidRequest" - } + { + "oneOf": [ + { + "$ref": "#/components/schemas/RevocationResult" + }, + { + "$ref": "#/components/schemas/SuspensionResult" + }, + { + "$ref": "#/components/schemas/UnsuspensionResult" } - } + ] }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + { + "$ref": "#/components/schemas/CredentialStatusUnencryptedResult" + } + ] + }, + "CredentialStatusUpdateEncryptedFormRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/CredentialStatusUpdateBody" }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } + { + "type": "object", + "required": [ + "symmetricKey" + ], + "properties": { + "symmetricKey": { + "description": "The symmetric key used to encrypt the StatusList2021 DID-Linked Resource.", + "type": "string" } } - } - } - } - }, - "/did/deactivate/{did}": { - "post": { - "tags": [ - "DID" - ], - "summary": "Deactivate a DID Document.", - "description": "This endpoint deactivates a DID Document by taking the DID identifier as input. Must be called and signed by the DID owner.", - "parameters": [ + }, { - "in": "path", - "name": "did", - "description": "DID identifier to deactivate.", - "schema": { - "type": "string" - }, - "required": true + "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsBody" } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/DidDeactivateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidDeactivateRequest" + ] + }, + "CredentialStatusUpdateEncryptedJsonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/CredentialStatusUpdateBody" + }, + { + "type": "object", + "required": [ + "symmetricKey" + ], + "properties": { + "symmetricKey": { + "description": "The symmetric key used to encrypt the StatusList2021 DID-Linked Resource.", + "type": "string" } } + }, + { + "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsJson" } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeactivatedDidResolution" - } + ], + "example": { + "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", + "statusListName": "cheqd-employee-credentials-encrypted", + "indices": [ + 10, + 3199, + 12109, + 130999 + ], + "symmetricKey": "dfe204ee95ae74ea5d74b94c3d8ff782273905b07fbc9f8c3d961c3b43849f18" + } + }, + "CredentialStatusUpdateEncryptedResult": { + "allOf": [ + { + "type": "object", + "properties": { + "updated": { + "type": "boolean", + "example": true } } }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + { + "oneOf": [ + { + "$ref": "#/components/schemas/RevocationResult" + }, + { + "$ref": "#/components/schemas/SuspensionResult" + }, + { + "$ref": "#/components/schemas/UnsuspensionResult" + } + ] }, - "500": { - "$ref": "#/components/schemas/InternalError" + { + "$ref": "#/components/schemas/CredentialStatusEncryptedResult" } - } - } - }, - "/did/list": { - "get": { - "tags": [ - "DID" + ] + }, + "CredentialStatusCheckRequest": { + "type": "object", + "required": [ + "did", + "statusListName", + "index" ], - "summary": "Fetch DIDs associated with an account.", - "description": "This endpoint returns the list of DIDs controlled by the account.", - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } + "properties": { + "did": { + "description": "DID of the StatusList2021 publisher.", + "type": "string", + "format": "uri" }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "statusListName": { + "description": "The name of the StatusList2021 DID-Linked Resource to be checked.", + "type": "string" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "index": { + "description": "Credential status index to be checked for revocation or suspension.", + "type": "integer", + "minimum": 0, + "exclusiveMinimum": false }, - "500": { - "$ref": "#/components/schemas/InternalError" + "makeFeePayment": { + "description": "Automatically make fee payment (if required) based on payment conditions to unlock encrypted StatusList2021 DID-Linked Resource.", + "type": "boolean", + "default": true } } - } - }, - "/did/search/{did}": { - "get": { - "tags": [ - "DID" - ], - "summary": "Resolve a DID Document.", - "description": "Resolve a DID Document by DID identifier. Also supports DID Resolution Queries as defined in the W3C DID Resolution specification.", - "parameters": [ + }, + "CredentialStatusCheckResult": { + "oneOf": [ { - "in": "path", - "name": "did", - "description": "DID identifier to resolve.", - "schema": { - "type": "string" - }, - "required": true, - "example": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "$ref": "#/components/schemas/CredentialStatusCheckRevocationResult" }, { - "in": "query", - "name": "metadata", - "description": "Return only metadata of DID Document instead of actual DID Document.", - "schema": { - "type": "boolean" - } + "$ref": "#/components/schemas/CredentialStatusCheckSuspensionResult" + } + ] + }, + "CredentialStatusCheckRevocationResult": { + "type": "object", + "properties": { + "checked": { + "type": "boolean", + "example": true }, - { - "in": "query", - "name": "versionId", - "description": "Unique UUID version identifier of DID Document. Allows for fetching a specific version of the DID Document. See cheqd DID Method Specification for more details.", - "schema": { - "type": "string", - "format": "uuid" - }, - "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" + "revoked": { + "type": "boolean", + "example": false + } + } + }, + "CredentialStatusCheckSuspensionResult": { + "type": "object", + "properties": { + "checked": { + "type": "boolean", + "example": true }, + "suspended": { + "type": "boolean", + "example": false + } + } + }, + "CredentialStatusListSearchResult": { + "allOf": [ { - "in": "query", - "name": "versionTime", - "description": "Returns the closest version of the DID Document *at* or *before* specified time. See DID Resolution handling for `did:cheqd` for more details.", - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "1970-01-01T00:00:00Z" - }, - { - "in": "query", - "name": "transformKeys", - "description": "This directive transforms the Verification Method key format from the version in the DID Document to the specified format chosen below.", - "schema": { - "type": "string", - "enum": [ - "Ed25519VerificationKey2018", - "Ed25519VerificationKey2020", - "JsonWebKey2020" - ] + "type": "object", + "properties": { + "found": { + "type": "boolean", + "example": true + } } }, { - "in": "query", - "name": "service", - "description": "Query DID Document for a specific Service Endpoint by Service ID (e.g., `service-1` in `did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1`). This will typically redirect to the Service Endpoint based on DID Resolution specification algorithm.", - "schema": { - "type": "string" - }, - "example": "service-1" - }, - { - "in": "query", - "name": "relativeRef", - "description": "Relative reference is a query fragment appended to the Service Endpoint URL. **Must** be used along with the `service` query property above. See DID Resolution specification algorithm for more details.", - "schema": { - "type": "string" - }, - "example": "/path/to/file" - } - ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidResolution" - } + "oneOf": [ + { + "$ref": "#/components/schemas/CredentialStatusUnencryptedResult" + }, + { + "$ref": "#/components/schemas/CredentialStatusEncryptedResult" } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + ] + } + ] + }, + "KeyImportRequest": { + "type": "object", + "properties": { + "alias": { + "type": "string" }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "type": { + "type": "string", + "enum": [ + "Ed25519", + "Secp256k1" + ] }, - "500": { - "$ref": "#/components/schemas/InternalError" + "privateKeyHex": { + "type": "string" } } - } - }, - "/key/create": { - "post": { - "tags": [ - "Key" - ], - "summary": "Create an identity key pair.", - "description": "This endpoint creates an identity key pair associated with the user's account for custodian-mode clients.", - "parameters": [ - { - "name": "type", - "description": "Key type of the identity key pair to create.", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "Ed25519", - "Secp256k1" - ] - } + }, + "KeyResult": { + "type": "object", + "properties": { + "kid": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Ed25519", + "Secp256k1" + ] + }, + "publicKeyHex": { + "type": "string" } - ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/KeyResult" - } - } + } + }, + "DidDocument": { + "description": "This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See Universal DID Registrar specification.", + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" } }, - "400": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "InvalidRequest" - } - } + "id": { + "type": "string" + }, + "controllers": { + "type": "array", + "items": { + "type": "string" } }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "verificationMethod": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VerificationMethod" + } }, - "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" - } - } + "service": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" } - } - } - } - }, - "/key/import": { - "post": { - "tags": [ - "Key" - ], - "summary": "Import an identity key pair.", - "description": "This endpoint imports an identity key pair associated with the user's account for custodian-mode clients.", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/KeyImportRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/KeyImportRequest" - } + }, + "authentication": { + "type": "array", + "items": { + "type": "string" } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/KeyResult" - } - } + }, + "assertionMethod": { + "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": "InvalidRequest" - } - } + "capabilityInvocation": { + "type": "array", + "items": { + "type": "string" } }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "capabilityDelegation": { + "type": "array", + "items": { + "type": "string" + } }, - "500": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "example": { - "error": "Internal Error" - } - } + "keyAgreement": { + "type": "array", + "items": { + "type": "string" } } - } - } - }, - "/key/read/{kid}": { - "get": { - "tags": [ - "Key" - ], - "summary": "Fetch an identity key pair.", - "description": "This endpoint fetches an identity key pair's details for a given key ID. Only the user account associated with the custodian-mode client can fetch the key pair.", - "parameters": [ - { - "name": "kid", - "description": "Key ID of the identity key pair to fetch.", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - } - ], - "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": "InvalidRequest" - } - } + }, + "example": { + "@context": [ + "https://www.w3.org/ns/did/v1" + ], + "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": "z6MkkVbyHJLLjdjU5B62DaJ4mkdMdUkttf9UqySSkA9bVTeZ" } - }, - "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" - } - } + ], + "authentication": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1", + "type": "LinkedDomains", + "serviceEndpoint": [ + "https://example.com" + ] } - } + ] } - } - }, - "/presentation/create": { - "post": { - "tags": [ - "Presentation" - ], - "summary": "!!! WARN. Such endpoint is made mostly for testing purposes and it is not supposed to be used in production !!! Create a Verifiable Presentation from credential(s).", - "description": "This endpoint creates a Verifiable Presentation from credential(s). As input, it can take the credential(s) as a string or the entire credential(s) itself. \n !!! WARN. Such endpoint is made only for testing purposes !!!", - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/PresentationCreateRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresentationCreateRequest" - } + }, + "DidDocumentWithoutVerificationMethod": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresentationCreateResult" - } - } + }, + "id": { + "type": "string" + }, + "controllers": { + "type": "array", + "items": { + "type": "string" } }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" + "service": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" + "authentication": { + "type": "array", + "items": { + "type": "string" + } }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/presentation/verify": { - "post": { - "tags": [ - "Presentation" - ], - "summary": "Verify a Verifiable Presentation generated from credential(s).", - "description": "This endpoint verifies the Verifiable Presentation generated from credential(s). As input, it can take the Verifiable Presentation JWT as a string or the entire Verifiable Presentation itself.", - "parameters": [ - { - "in": "query", - "name": "verifyStatus", - "description": "If set to `true` the verification will also check the status of the presentation. Requires the VP to have a `credentialStatus` property.", - "schema": { - "type": "boolean", - "default": false + "assertionMethod": { + "type": "array", + "items": { + "type": "string" } }, - { - "in": "query", - "name": "fetchRemoteContexts", - "description": "When dealing with JSON-LD you also MUST provide the proper contexts. * Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are a custom context.", - "schema": { - "type": "boolean", - "default": false + "capabilityInvocation": { + "type": "array", + "items": { + "type": "string" } }, - { - "in": "query", - "name": "allowDeactivatedDid", - "description": "If set to `true` allow to verify credential which based on deactivated DID.", - "schema": { - "type": "boolean", - "default": false + "capabilityDelegation": { + "type": "array", + "items": { + "type": "string" } - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/PresentationVerifyRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresentationVerifyRequest" - } + }, + "keyAgreement": { + "type": "array", + "items": { + "type": "string" } } }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VerifyPresentationResult" - } - } + "example": { + "@context": [ + "https://www.w3.org/ns/did/v1" + ], + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "controller": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + ], + "authentication": [ + "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1", + "type": "LinkedDomains", + "serviceEndpoint": [ + "https://example.com" + ] } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/resource/create/{did}": { - "post": { - "tags": [ - "Resource" - ], - "summary": "Create a DID-Linked Resource.", - "description": "This endpoint creates a DID-Linked Resource. As input, it can take the DID identifier and the resource parameters via a form, or the fully-assembled resource itself.", - "parameters": [ - { - "in": "path", - "name": "did", - "description": "DID identifier to link the resource to.", - "schema": { - "type": "string" - }, - "required": true - } - ], - "requestBody": { - "content": { - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "#/components/schemas/CreateResourceRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateResourceRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ResourceMetadata" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - }, - "/resource/search/{did}": { - "get": { - "tags": [ - "Resource" - ], - "summary": "Get a DID-Linked Resource.", - "description": "This endpoint returns the DID-Linked Resource for a given DID identifier and resource identifier.", - "parameters": [ - { - "in": "path", - "name": "did", - "description": "DID identifier", - "schema": { - "type": "string" - }, - "required": true, - "example": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - }, - { - "in": "query", - "name": "resourceId", - "description": "Fetch a DID-Linked Resource by Resource ID unique identifier. Since this is a unique identifier, other Resource query parameters are not required. See DID-Linked Resources for more details.", - "schema": { - "type": "string", - "format": "uuid" - }, - "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" - }, - { - "in": "query", - "name": "resourceName", - "description": "Filter a DID-Linked Resource query by Resource Name. See DID-Linked Resources for more details.", - "schema": { - "type": "string" - }, - "example": "cheqd-issuer-logo" - }, - { - "in": "query", - "name": "resourceType", - "description": "Filter a DID-Linked Resource query by Resource Type. See DID-Linked Resources for more details.", - "schema": { - "type": "string" - }, - "example": "CredentialArtwork" - }, - { - "in": "query", - "name": "resourceVersion", - "description": "Filter a DID-Linked Resource query by Resource Version, which is an optional free-text field used by issuers (e.g., \"v1\", \"Final Version\", \"1st January 1970\" etc). See DID-Linked Resources for more details.", - "schema": { - "type": "string" - }, - "example": "v1" - }, - { - "in": "query", - "name": "resourceVersionTime", - "description": "Filter a DID-Linked Resource query which returns the closest version of the Resource *at* or *before* specified time. See DID-Linked Resources for more details.", - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "1970-01-01T00:00:00Z" - }, - { - "in": "query", - "name": "checksum", - "description": "Request integrity check against a given DID-Linked Resource by providing a SHA-256 checksum hash. See DID-Linked Resources for more details.", - "schema": { - "type": "string" - }, - "example": "dc64474d062ed750a66bad58cb609928de55ed0d81defd231a4a4bf97358e9ed" - }, - { - "in": "query", - "name": "resourceMetadata", - "description": "Return only metadata of DID-Linked Resource instead of actual DID-Linked Resource. Mutually exclusive with some of the other parameters.", - "schema": { - "type": "boolean" - } - } - ], - "responses": { - "200": { - "description": "The request was successful.", - "content": { - "any": { - "schema": { - "type": "object" - } - } - } - }, - "400": { - "$ref": "#/components/schemas/InvalidRequest" - }, - "401": { - "$ref": "#/components/schemas/UnauthorizedError" - }, - "500": { - "$ref": "#/components/schemas/InternalError" - } - } - } - } - }, - "components": { - "schemas": { - "AlsoKnownAs": { - "type": "object", - "properties": { - "alsoKnownAs": { - "type": "array", - "description": "Optional field to assign a set of alternative URIs where the DID-Linked Resource can be fetched from.", - "items": { - "type": "object", - "properties": { - "uri": { - "type": "string", - "format": "uri", - "description": "URI where the DID-Linked Resource can be fetched from. Can be any type of URI (e.g., DID, HTTPS, IPFS, etc.)" - }, - "description": { - "type": "string", - "description": "Optional description of the URI." - } - } - } - } + ] } }, - "CredentialRequest": { - "description": "Input fields for the creating a Verifiable Credential.", + "DidCreateRequestFormBased": { "type": "object", - "additionalProperties": false, "properties": { - "issuerDid": { - "description": "DID of the Verifiable Credential issuer. This needs to be a `did:cheqd` DID.", + "network": { + "description": "Network to create the DID on (testnet or mainnet)", "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" + "enum": [ + "testnet", + "mainnet" + ] }, - "subjectDid": { - "description": "DID of the Verifiable Credential holder/subject. This needs to be a `did:key` DID.", + "identifierFormatType": { + "description": "Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See cheqd DID method documentation for more details.", "type": "string", - "example": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK" + "enum": [ + "uuid", + "base58btc" + ] }, - "attributes": { - "description": "JSON object containing the attributes to be included in the credential.", - "type": "object", - "example": { - "name": "Bob", - "gender": "male" - } + "verificationMethodType": { + "description": "Type of verification method to use for the DID. See DID Core specification for more details. Only the types listed below are supported.", + "type": "string", + "enum": [ + "Ed25519VerificationKey2018", + "JsonWebKey2020", + "Ed25519VerificationKey2020" + ] }, - "@context": { - "description": "Optional properties to be included in the `@context` property of the credential.", + "service": { + "description": "It's a list of special objects which are designed to build the actual service. It's almost the same as in DID Core specification, but instead of `id` it utilises `idFragment` field for making the right `id` for each service. !!! WARN. Cause swagger-ui does not handle x-ww-form based arrays correctly, please frame all your services in brackets while using swagger UI. !!!", "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "idFragment": { + "type": "string" + }, + "type": { + "type": "string" + }, + "serviceEndpoint": { + "type": "array", + "items": { + "type": "string" + } + } + } }, "example": [ - "https://schema.org/schema.jsonld", - "https://veramo.io/contexts/profile/v1" + { + "idFragment": "service-1", + "type": "LinkedDomains", + "serviceEndpoint": [ + "https://example.com" + ] + } ] }, - "type": { - "description": "Optional properties to be included in the `type` property of the credential.", + "key": { + "description": "The unique identifier in hexadecimal public key format used in the verification method to create the DID.", + "type": "string" + }, + "@context": { "type": "array", "items": { "type": "string" }, "example": [ - "Person" + "https://www.w3.org/ns/did/v1" ] - }, - "expirationDate": { - "description": "Optional expiration date according to the VC Data Model specification.", + } + } + }, + "DidCreateRequestJson": { + "type": "object", + "properties": { + "network": { + "description": "Network to create the DID on (testnet or mainnet)", "type": "string", - "format": "date-time", - "example": "2023-06-08T13:49:28.000Z" + "enum": [ + "testnet", + "mainnet" + ] }, - "format": { - "description": "Format of the Verifiable Credential. Defaults to VC-JWT.", + "identifierFormatType": { + "description": "Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See cheqd DID method documentation for more details.", "type": "string", "enum": [ - "jwt", - "jsonld" - ], - "example": "jwt" + "uuid", + "base58btc" + ] }, - "credentialStatus": { - "description": "Optional `credentialStatus` properties for VC revocation or suspension. Takes `statusListName` and `statusListPurpose` as inputs.", + "assertionMethod": { + "description": "Usually a reference to a Verification Method. An Assertion Method is required to issue JSON-LD credentials. See DID Core specification for more details.", + "type": "boolean", + "default": true + }, + "options": { "type": "object", - "required": [ - "statusPurpose", - "statusListName" - ], "properties": { - "statusPurpose": { + "key": { "type": "string", - "enum": [ - "revocation", - "suspension" - ] - }, - "statusListName": { - "type": "string" - }, - "statusListIndex": { - "type": "number" + "example": "8255ddadd75695e01f3d98fcec8ccc7861a030b317d4326b0e48a4d579ddc43a" }, - "statusListVersion": { + "verificationMethodType": { + "description": "Type of verification method to use for the DID. See DID Core specification for more details. Only the types listed below are supported.", "type": "string", - "format": "date-time" - }, - "statusListRangeStart": { - "type": "number" - }, - "statusListRangeEnd": { - "type": "number" - }, - "indexNotIn": { - "type": "number" + "enum": [ + "Ed25519VerificationKey2018", + "JsonWebKey2020", + "Ed25519VerificationKey2020" + ] } - }, - "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 + "didDocument": { + "$ref": "#/components/schemas/DidDocumentWithoutVerificationMethod" } } }, - "Credential": { - "description": "Input fields for revoking/suspending a Verifiable Credential.", + "DidImportRequest": { "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" - ] + "did": { + "type": "string", + "description": "DID to be imported", + "format": "uri" }, - "type": { + "keys": { "type": "array", + "description": "List of keys required to import the DID", "items": { - "type": "string" - }, - "example": [ - "VerifiableCredential", - "Person" - ] - }, - "expirationDate": { - "type": "string", - "format": "date-time", - "example": "2023-06-08T13:49:28.000Z" - }, - "issuer": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "DID", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - } + "$ref": "#/components/schemas/KeyImportRequest" } - }, - "credentialSubject": { + } + }, + "required": [ + "did", + "keys" + ] + }, + "PresentationCreateResult": { + "type": "object", + "properties": { + "vp": { "type": "object", - "properties": { - "id": { - "type": "string", - "format": "DID", - "example": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK" - } - } + "description": "Verifiable Presentation which could be provided to the verifier." }, - "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": "number", - "example": 20 - }, - "statusPurpose": { - "type": "string", - "enum": [ - "revocation", - "suspension" - ], - "example": "suspension" - }, - "type": { - "type": "string", - "enum": [ - "StatusList2021Entry" - ] - } - } + "nbf": { + "type": "integer", + "description": "Unix timestamp of the earliest time that the Verifiable Presentation is valid." }, - "issuanceDate": { + "iss": { "type": "string", - "format": "date-time", - "example": "2023-06-08T13:49:28.000Z" + "description": "DID of the issuer of the Verifiable Presentation. (Here it's supposed to be a holder DID)" }, - "proof": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "jwt": { - "type": "string" - } + "aud": { + "type": "array", + "items": { + "type": "string" }, - "example": { - "type": "JwtProof2020", - "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg" - } + "description": "DID of the verifier of the Verifiable Presentation." } }, "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" + "vp": { + "@context": [ + "https://www.w3.org/2018/credentials/v1" + ], + "type": [ + "VerifiablePresentation" + ], + "verifiableCredential": [ + "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc2NoZW1hLm9yZy9zY2hlbWEuanNvbmxkIiwiaHR0cHM6Ly92ZXJhbW8uaW8vY29udGV4dHMvcHJvZmlsZS92MSIsImh0dHBzOi8vdzNpZC5vcmcvdmMtc3RhdHVzLWxpc3QtMjAyMS92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUGVyc29uIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7Im5hbWUiOiJCb2IiLCJnZW5kZXIiOiJtYWxlIn0sImNyZWRlbnRpYWxTdGF0dXMiOnsiaWQiOiJodHRwczovL3Jlc29sdmVyLmNoZXFkLm5ldC8xLjAvaWRlbnRpZmllcnMvZGlkOmNoZXFkOnRlc3RuZXQ6OTBkNWMxNDEtNzI0Zi00N2FkLTlhZTctYTdjMzNhOWU1NjQzP3Jlc291cmNlTmFtZT1zdXNwZW5zaW9uRW4mcmVzb3VyY2VUeXBlPVN0YXR1c0xpc3QyMDIxU3VzcGVuc2lvbiMxMzMzOCIsInR5cGUiOiJTdGF0dXNMaXN0MjAyMUVudHJ5Iiwic3RhdHVzUHVycG9zZSI6InN1c3BlbnNpb24iLCJzdGF0dXNMaXN0SW5kZXgiOiIxMzMzOCJ9fSwic3ViIjoiZGlkOmtleTp6Nk1raGFYZ0JaRHZvdERrTDUyNTdmYWl6dGlHaUMyUXRLTEdwYm5uRUd0YTJkb0siLCJuYmYiOjE3MDA0NzM0MTYsImlzcyI6ImRpZDpjaGVxZDp0ZXN0bmV0OjkwZDVjMTQxLTcyNGYtNDdhZC05YWU3LWE3YzMzYTllNTY0MyJ9.-14Ril1pZEy2HEEo48gTJr2yOtGxBhUGTFmzVdjAtyhFRsW5zZg9onHt6V9JQ8BaiYBlTkP9GzTnJ-O6hdiyCw" + ] }, - "type": [ - "VerifiableCredential", - "Person" + "nbf": 1700744275, + "iss": "did:cheqd:testnet:4b846d0f-2f6c-4ab6-9fe2-5b8db301c83c", + "aud": [ + "did:cheqd:testnet:8c71e9b6-c5a3-4250-8c58-fa591533cd22" ] } }, - "CredentialRevokeRequest": { + "DidResult": { "type": "object", "properties": { - "credential": { - "description": "Verifiable Credential to be revoked as a VC-JWT string or a JSON object.", - "oneOf": [ - { - "type": "object" - }, - { - "type": "string" - } - ] + "did": { + "type": "string" }, - "symmetricKey": { - "description": "The symmetric key used to encrypt the StatusList2021 DID-Linked Resource. Required if the StatusList2021 DID-Linked Resource is encrypted.", + "controllerKeyId": { "type": "string" - } - } - }, - "RevocationResult": { - "properties": { - "revoked": { - "type": "boolean", - "example": true - } - } - }, - "SuspensionResult": { - "properties": { - "suspended": { - "type": "boolean", - "example": true - } - } - }, - "UnsuspensionResult": { - "properties": { - "unsuspended": { - "type": "boolean", - "example": true - } - } - }, - "CredentialVerifyRequest": { - "type": "object", - "properties": { - "credential": { - "description": "Verifiable Credential to be verified as a VC-JWT string or a JSON object.", - "type": "object" }, - "policies": { - "description": "Custom verification policies to execute when verifying credential.", - "type": "object", - "properties": { - "issuanceDate": { - "description": "Policy to skip the `issuanceDate` (`nbf`) timestamp check when set to `false`.", - "type": "boolean", - "default": true - }, - "expirationDate": { - "description": "Policy to skip the `expirationDate` (`exp`) timestamp check when set to `false`.", - "type": "boolean", - "default": true - }, - "audience": { - "description": "Policy to skip the audience check when set to `false`.", - "type": "boolean", - "default": false - } + "keys": { + "type": "array", + "items": { + "type": "object" + } + }, + "services": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" } } } }, - "VerifyPresentationResult": { + "DidUpdateResponse": { "type": "object", "properties": { - "verified": { - "type": "boolean" - }, - "issuer": { + "did": { "type": "string" }, - "signer": { - "type": "object" + "controllerKeyId": { + "type": "string", + "description": "The default key id of which is the key associated with the first verificationMethod" }, - "jwt": { - "type": "string" + "keys": { + "type": "array", + "description": "The list of keys associated with the list of verificationMethod's of DIDDocument", + "items": { + "type": "object" + } }, - "verifiableCredential": { - "type": "object" + "services": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "controllerKeyRefs": { + "type": "array", + "description": "The list of keyRefs which were used for signing the transaction", + "items": { + "type": "string" + } + }, + "controllerKeys": { + "type": "array", + "description": "The list of all possible keys, inlcuding all controller's keys", + "items": { + "type": "string" + } } } }, - "VerifyCredentialResult": { + "VerificationMethod": { "type": "object", "properties": { - "verified": { - "type": "boolean" + "id": { + "type": "string" }, - "issuer": { + "type": { "type": "string" }, - "signer": { - "type": "object" + "controller": { + "type": "string" }, - "jwt": { + "publicKeyMultibase": { "type": "string" }, - "verifiableCredential": { - "type": "object" + "publicKeyJwk": { + "type": "array", + "items": { + "type": "string" + } } }, "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" - } + "controller": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", + "id": "did:cheqd:testnet :7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1", + "publicKeyBase58": "BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt", + "type": "Ed25519VerificationKey2018" } }, - "PresentationCreateRequest": { + "Service": { + "description": "Communicating or interacting with the DID subject or associated entities via one or more service endpoints. See DID Core specification for more details.", "type": "object", - "required": [ - "credentials" - ], "properties": { - "credentials": { - "description": "Verifiable Credentials to be used for VP-JWT creation as a VP-JWT strings or a JSON objectsf.", + "id": { + "description": "DID appended with Service fragment ID (e.g., `#service-1` in `did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1`)", + "type": "string", + "example": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1" + }, + "type": { + "description": "Service type as defined in DID Specification Registries.", + "type": "string", + "example": "LinkedDomains" + }, + "serviceEndpoint": { + "description": "Service endpoint as defined in DID Core Specification.", "type": "array", "items": { - "type": "object" + "type": "string", + "example": "https://example.com" } - }, - "holderDid": { - "description": "DID of holder", - "type": "string" - }, - "verifierDid": { - "description": "DID of verifier", - "type": "string" } } }, - "PresentationVerifyRequest": { + "DidUpdateRequest": { "type": "object", - "required": [ - "presentation" - ], "properties": { - "presentation": { - "description": "Verifiable Presentation to be verified as a VP-JWT string or a JSON object.", - "type": "object" + "did": { + "description": "DID identifier to be updated.", + "type": "string", + "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" }, - "verifierDid": { - "description": "Provide an optional verifier DID (also known as 'domain' parameter), if the verifier DID in the presentation is not managed in the wallet.", - "type": "string" + "service": { + "type": "array", + "description": "Service section of the DID Document.", + "items": { + "$ref": "#/components/schemas/Service" + } }, - "makeFeePayment": { - "description": "Automatically make fee payment (if required) based on payment conditions to unlock encrypted StatusList2021 DID-Linked Resource.", - "type": "boolean", - "default": false + "verificationMethod": { + "type": "array", + "description": "Verification Method section of the DID Document.", + "items": { + "$ref": "#/components/schemas/VerificationMethod" + } }, - "policies": { - "description": "Custom verification policies to execute when verifying presentation.", - "type": "object", - "properties": { - "issuanceDate": { - "description": "Policy to skip the `issuanceDate` (`nbf`) timestamp check when set to `false`.", - "type": "boolean", - "default": true - }, - "expirationDate": { - "description": "Policy to skip the `expirationDate` (`exp`) timestamp check when set to `false`.", - "type": "boolean", - "default": true - }, - "audience": { - "description": "Policy to skip the audience check when set to `false`.", - "type": "boolean", - "default": false - } + "authentication": { + "description": "Authentication section of the DID Document.", + "type": "array", + "items": { + "type": "string" + } + }, + "publicKeyHexs": { + "description": "List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.", + "type": "array", + "items": { + "type": "string" } + }, + "didDocument": { + "$ref": "#/components/schemas/DidDocument" } } }, - "CredentialStatusCreateBody": { - "allOf": [ - { - "type": "object", - "required": [ - "did", - "statusListName" - ], - "properties": { - "did": { - "description": "DID of the StatusList2021 publisher.", - "type": "string", - "format": "uri" - }, - "statusListName": { - "description": "The name of the StatusList2021 DID-Linked Resource 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.", - "type": "integer", - "minimum": 0, - "exclusiveMinimum": true, - "default": 140000 - }, - "encoding": { - "description": "The encoding format of the StatusList2021 DiD-Linked Resource to be created.", - "type": "string", - "default": "base64url", - "enum": [ - "base64url", - "base64", - "hex" - ] - }, - "statusListVersion": { - "description": "Optional field to assign a human-readable version in the StatusList2021 DID-Linked Resource.", - "type": "string" - } + "DidDeactivateRequest": { + "type": "object", + "properties": { + "publicKeyHexs": { + "description": "List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.", + "type": "array", + "items": { + "type": "string" } - }, - { - "$ref": "#/components/schemas/AlsoKnownAs" - } - ] - }, - "CredentialStatusCreateUnencryptedRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/CredentialStatusCreateBody" } - ], - "example": { - "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "statusListName": "cheqd-employee-credentials", - "length": 140000, - "encoding": "base64url" } }, - "CredentialStatusUnencryptedResult": { + "CreateResourceRequest": { + "description": "Input fields for DID-Linked Resource creation.", "type": "object", + "additionalProperties": false, + "required": [ + "name", + "type", + "data", + "encoding" + ], "properties": { - "resource": { - "type": "object", - "properties": { - "StatusList2021": { - "type": "object", - "properties": { - "encodedList": { - "type": "string", - "example": "H4sIAAAAAAAAA-3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAADwaDhDr_xcRAAA" - }, - "type": { - "type": "string", - "example": "StatusList2021Revocation" - }, - "validFrom": { - "type": "string", - "format": "date-time", - "example": "2023-06-26T11:45:19.349Z" - } - } - }, - "metadata": { - "type": "object", - "properties": { - "type": { - "type": "string", - "example": "StatusList2021Revocation" - }, - "encoding": { - "type": "string", - "example": "base64url" - }, - "encrypted": { - "type": "boolean", - "example": false - } + "data": { + "description": "Encoded string containing the data to be stored in the DID-Linked Resource.", + "type": "string" + }, + "encoding": { + "description": "Encoding format used to encode the data.", + "type": "string", + "enum": [ + "base64url", + "base64", + "hex" + ] + }, + "name": { + "description": "Name of DID-Linked Resource.", + "type": "string" + }, + "type": { + "description": "Type of DID-Linked Resource. This is NOT the same as the media type, which is calculated automatically ledger-side.", + "type": "string" + }, + "alsoKnownAs": { + "description": "Optional field to assign a set of alternative URIs where the DID-Linked Resource can be fetched from.", + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "description": { + "type": "string" } } } }, - "resourceMetadata": { - "type": "object", - "example": { - "resourceURI": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc", - "resourceCollectionId": "7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "resourceId": "5945233a-a4b5-422b-b893-eaed5cedd2dc", - "resourceName": "cheqd-employee-credentials", - "resourceType": "StatusList2021Revocation", - "mediaType": "application/json", - "resourceVersion": "1.0.0", - "created": "2023-06-26T11:45:20Z", - "checksum": "909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2", - "previousVersionId": null, - "nextVersionId": null + "version": { + "description": "Optional field to assign a human-readable version in the DID-Linked Resource.", + "type": "string" + }, + "publicKeyHexs": { + "description": "List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.", + "type": "array", + "items": { + "type": "string" } } + }, + "example": { + "data": "SGVsbG8gV29ybGQ=", + "encoding": "base64url", + "name": "ResourceName", + "type": "TextDocument" } }, - "CredentialStatusCreateUnencryptedResult": { - "allOf": [ - { - "type": "object", - "properties": { - "created": { - "type": "boolean", - "example": true - } - } + "ResourceList": { + "type": "object", + "properties": { + "@context": { + "type": "string", + "example": "https://w3id.org/did-resolution/v1" }, - { - "$ref": "#/components/schemas/CredentialStatusUnencryptedResult" + "contentMetadata": { + "type": "object" + }, + "contentStream": { + "type": "object" + }, + "dereferencingMetadata": { + "$ref": "#/components/schemas/DereferencingMetadata" } - ] + } }, - "CredentialStatusEncryptedPaymentConditionsBody": { + "DereferencingMetadata": { "type": "object", "properties": { - "feePaymentAddress": { - "description": "The cheqd/Cosmos payment address where payments to unlock the encrypted StatusList2021 DID-Linked Resource need to be sent.", + "contentType": { "type": "string", - "example": "cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg" + "example": "application/did+ld+json" }, - "feePaymentAmount": { - "description": "Amount in CHEQ tokens to unlock the encrypted StatusList2021 DID-Linked Resource.", - "type": "number", - "minimum": 0, - "exclusiveMinimum": true, - "default": 20 + "did": { + "$ref": "#/components/schemas/DidProperties" }, - "feePaymentWindow": { - "description": "Time window (in minutes) within which the payment to unlock the encrypted StatusList2021 DID-Linked Resource is considered valid.", - "type": "number", - "minimum": 0, - "exclusiveMinimum": true, - "default": 10 + "retrieved": { + "type": "string", + "example": "2021-09-01T12:00:00Z" } } }, - "CredentialStatusEncryptedPaymentConditionsJson": { + "DidResolution": { "type": "object", "properties": { - "paymentConditions": { - "allOf": [ - { - "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsBody" - } - ] + "@context": { + "type": "string", + "example": "https://w3id.org/did-resolution/v1" + }, + "didDidResolutionMetadata": { + "$ref": "#/components/schemas/DidResolutionMetadata" + }, + "didDocument": { + "$ref": "#/components/schemas/DidDocument" + }, + "didDocumentMetadata": { + "$ref": "#/components/schemas/DidDocumentMetadata" } } }, - "CredentialStatusCreateEncryptedFormRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/CredentialStatusCreateBody" + "DeactivatedDidResolution": { + "type": "object", + "properties": { + "@context": { + "type": "string", + "example": "https://w3id.org/did-resolution/v1" }, - { - "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsBody" + "didDidResolutionMetadata": { + "$ref": "#/components/schemas/DidResolutionMetadata" }, - { - "type": "object", - "required": [ - "feePaymentAddress", - "feePaymentAmount", - "feePaymentWindow" - ] + "didDocument": { + "$ref": "#/components/schemas/DidDocument" + }, + "didDocumentMetadata": { + "$ref": "#/components/schemas/DeactivatedDidDocumentMetadata" } - ] + } }, - "CredentialStatusCreateEncryptedJsonRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/CredentialStatusCreateBody" + "DidDocumentMetadata": { + "type": "object", + "properties": { + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" }, - { - "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsJson" + "deactivated": { + "type": "boolean", + "example": false }, - { - "type": "object", - "required": [ - "paymentConditions" - ] + "updated": { + "type": "string", + "example": "2021-09-10T12:00:00Z" + }, + "versionId": { + "type": "string", + "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" + }, + "linkedResourceMetadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceMetadata" + } } - ], - "example": { - "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "statusListName": "cheqd-employee-credentials-encrypted", - "paymentConditions": [ - { - "feePaymentAddress": "cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg", - "feePaymentAmount": 20, - "feePaymentWindow": 10 + } + }, + "DeactivatedDidDocumentMetadata": { + "type": "object", + "properties": { + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "deactivated": { + "type": "boolean", + "example": true + }, + "updated": { + "type": "string", + "example": "2021-09-10T12:00:00Z" + }, + "versionId": { + "type": "string", + "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" + }, + "linkedResourceMetadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceMetadata" } - ] + } } }, - "CredentialStatusEncryptedResult": { + "ResourceMetadata": { "type": "object", "properties": { - "resource": { - "type": "object", - "properties": { - "StatusList2021": { - "type": "object", - "properties": { - "encodedList": { - "type": "string", - "example": "496fdfbeb745b4db03fcdb40566f9c4c4a1c0f184b31255e641b6e7bdfb9b6946c12be87ca3763be0393c00b67ac1e8737c106b32f46ef59c765754415b5e8cc7c65fccaa3374620430ea476301a5e0dd63340e7a27a68bc627518471f22e4a2" - }, - "type": { - "type": "string", - "example": "StatusList2021Revocation" - }, - "validFrom": { - "type": "string", - "format": "date-time", - "example": "2023-06-26T11:45:19.349Z" - } - } - }, - "metadata": { - "type": "object", - "properties": { - "type": { - "type": "string", - "example": "StatusList2021Revocation" - }, - "encoding": { - "type": "string", - "example": "base64url" - }, - "encrypted": { - "type": "boolean", - "example": true - }, - "encryptedSymmetricKey": { - "type": "string", - "example": "b11182dc524b8181f9a6aef4c4ad0a1c14e40033b9112dffd8d1bcf6cc3b85abc07ded2205ee94068a99f4202502cb0855f322583fa6ce1534d3a05bf36891766ea2c5f90a982b3040680762977d404d758a2370224a239c8279aa7d21e980931c42055b17ca4c7dbffa4782480a8b6279cf989b2f166d5fdb4b2c1b5a63927200000000000000203018dcaba26df45a415bb599218b27ca853a70289d7a3ed3ed0e3730452e8f8d9af91b6e71312565d2c069341f6660ab" - }, - "paymentConditions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "feePaymentAddress": { - "type": "string", - "example": "cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg" - }, - "feePaymentAmount": { - "type": "string", - "example": "20000000000ncheq" - }, - "intervalInSeconds": { - "type": "number", - "example": 600 - }, - "type": { - "type": "string", - "example": "timelockPayment" - } - } - } - } - } - }, - "resourceMetadata": { - "type": "object", - "example": { - "resourceURI": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e/resources/5945233a-a4b5-422b-b893-eaed5cedd2dc", - "resourceCollectionId": "7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "resourceId": "5945233a-a4b5-422b-b893-eaed5cedd2dc", - "resourceName": "cheqd-revocation-encrypted-1", - "resourceType": "StatusList2021Revocation", - "mediaType": "application/json", - "resourceVersion": "2023-06-26T11:45:19.349Z", - "created": "2023-06-26T11:45:20Z", - "checksum": "909e22e371a41afbb96c330a97752cf7c8856088f1f937f87decbef06cbe9ca2", - "previousVersionId": null, - "nextVersionId": null - } - }, - "symmetricKey": { - "type": "string", - "example": "dfe204ee95ae74ea5d74b94c3d8ff782273905b07fbc9f8c3d961c3b43849f18" + "resourceURI": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47/resources/398cee0a-efac-4643-9f4c-74c48c72a14b" + }, + "resourceCollectionId": { + "type": "string", + "example": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + }, + "resourceId": { + "type": "string", + "example": "398cee0a-efac-4643-9f4c-74c48c72a14b" + }, + "resourceName": { + "type": "string", + "example": "cheqd-issuer-logo" + }, + "resourceType": { + "type": "string", + "example": "CredentialArtwork" + }, + "mediaType": { + "type": "string", + "example": "image/png" + }, + "resourceVersion": { + "type": "string", + "example": "1.0" + }, + "checksum": { + "type": "string", + "example": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559" + }, + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "nextVersionId": { + "type": "string", + "example": "d4829ac7-4566-478c-a408-b44767eddadc" + }, + "previousVersionId": { + "type": "string", + "example": "ad7a8442-3531-46eb-a024-53953ec6e4ff" + } + } + }, + "DidResolutionMetadata": { + "type": "object", + "properties": { + "contentType": { + "allOf": [ + { + "$ref": "#/components/schemas/ContentType" } - } + ], + "example": "application/did+ld+json" + }, + "retrieved": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "did": { + "$ref": "#/components/schemas/DidProperties" } } }, - "CredentialStatusCreateEncryptedResult": { - "allOf": [ - { - "type": "object", - "properties": { - "created": { - "type": "boolean", - "example": true + "ContentType": { + "type": "string", + "enum": [ + "application/did+json", + "application/did+ld+json", + "application/ld+json", + "application/json" + ] + }, + "DidProperties": { + "type": "object", + "properties": { + "didString": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + }, + "method": { + "type": "string", + "example": "cheqd" + }, + "methodSpecificId": { + "type": "string", + "example": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + } + } + }, + "Customer": { + "type": "object", + "properties": { + "customer": { + "type": "object", + "properties": { + "customerId": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "paymentAccount": { + "type": "object", + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + "QueryIdTokenResponseBody": { + "type": "object", + "properties": { + "idToken": { + "type": "string" + } + } + }, + "AccountCreateRequest": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "primaryEmail": { + "type": "string" + } + } + } + } + }, + "InvalidRequest": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "InvalidRequest" + } + } + }, + "InternalError": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Internal Error" + } + } + }, + "UnauthorizedError": { + "description": "Access token is missing or invalid", + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Unauthorized Error" + } + } + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "paths": { + "/account": { + "get": { + "tags": [ + "Account" + ], + "summary": "Fetch custodian-mode client details.", + "description": "This endpoint returns the custodian-mode client details for authenticated users.", + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Customer" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/account/idtoken": { + "get": { + "tags": [ + "Account" + ], + "summary": "Fetch IdToken.", + "description": "This endpoint returns IdToken as JWT with list of user roles inside", + "deprecated": true, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIdTokenResponseBody" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/account/create": { + "post": { + "tags": [ + "Account" + ], + "summary": "Create an client for an authenticated user.", + "description": "This endpoint creates a client in the custodian-mode for an authenticated user", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/AccountCreateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccountCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIdTokenResponseBody" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential-status/create/unencrypted": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Create an unencrypted StatusList2021 credential status list.", + "description": "This endpoint creates an unencrypted StatusList2021 credential status list. The StatusList is published as a DID-Linked Resource on ledger. As input, it can can take input parameters needed to create the status list via a form, or a pre-assembled status list in JSON format. Status lists can be created as either encrypted or unencrypted; and with purpose as either revocation or suspension.", + "parameters": [ + { + "in": "query", + "name": "statusPurpose", + "description": "The purpose of the status list. Can be either revocation or suspension. Once this is set, it cannot be changed. A new status list must be created to change the purpose.", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateUnencryptedRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateUnencryptedRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateUnencryptedResult" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential-status/create/encrypted": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Create an encrypted StatusList2021 credential status list.", + "description": "This endpoint creates an encrypted StatusList2021 credential status list. The StatusList is published as a DID-Linked Resource on ledger. As input, it can can take input parameters needed to create the status list via a form, or a pre-assembled status list in JSON format. Status lists can be created as either encrypted or unencrypted; and with purpose as either revocation or suspension.", + "parameters": [ + { + "in": "query", + "name": "statusPurpose", + "description": "The purpose of the status list. Can be either revocation or suspension. Once this is set, it cannot be changed. A new status list must be created to change the purpose.", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateEncryptedFormRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateEncryptedJsonRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCreateEncryptedResult" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential-status/update/unencrypted": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Update an existing unencrypted StatusList2021 credential status list.", + "parameters": [ + { + "in": "query", + "name": "statusAction", + "description": "The update action to be performed on the unencrypted status list, can be revoke, suspend or reinstate", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revoke", + "suspend", + "reinstate" + ] + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateUnencryptedRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateUnencryptedRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateUnencryptedResult" + } + } + } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential-status/update/encrypted": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Update an existing encrypted StatusList2021 credential status list.", + "parameters": [ + { + "in": "query", + "name": "statusAction", + "description": "The update action to be performed on the encrypted status list, can be revoke, suspend or reinstate", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revoke", + "suspend", + "reinstate" + ] + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateEncryptedFormRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateEncryptedJsonRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusUpdateEncryptedResult" + } } } }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential-status/check": { + "post": { + "tags": [ + "Credential Status" + ], + "summary": "Check a StatusList2021 index for a given Verifiable Credential.", + "description": "This endpoint checks a StatusList2021 index for a given Verifiable Credential and reports whether it is revoked or suspended. It offers a standalone method for checking an index without passing the entire Verifiable Credential or Verifiable Presentation.", + "parameters": [ { - "$ref": "#/components/schemas/CredentialStatusEncryptedResult" + "in": "query", + "name": "statusPurpose", + "description": "The purpose of the status list. Can be either revocation or suspension.", + "required": true, + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } } - ] - }, - "CredentialStatusUpdateBody": { - "type": "object", - "required": [ - "did", - "statusListName", - "indices" ], - "properties": { - "did": { - "description": "DID of the StatusList2021 publisher.", - "type": "string", - "format": "uri" + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCheckRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCheckRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusCheckResult" + } + } + } }, - "statusListName": { - "description": "The name of the StatusList2021 DID-Linked Resource to be updated.", - "type": "string" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "indices": { - "description": "List of credential status indices to be updated. The indices must be in the range of the status list.", - "type": "array", - "items": { - "type": "integer", - "minimum": 0, - "exclusiveMinimum": false - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "statusListVersion": { - "description": "Optional field to assign a human-readable version in the StatusList2021 DID-Linked Resource.", - "type": "string" + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "CredentialStatusUpdateUnencryptedRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/CredentialStatusUpdateBody" - } + } + }, + "/credential-status/search": { + "get": { + "tags": [ + "Credential Status" ], - "example": { - "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "statusListName": "cheqd-employee-credentials", - "indices": [ - 10, - 3199, - 12109, - 130999 - ] - } - }, - "CredentialStatusUpdateUnencryptedResult": { - "allOf": [ + "summary": "Fetch StatusList2021 DID-Linked Resource based on search criteria.", + "parameters": [ { - "type": "object", - "properties": { - "updated": { - "type": "boolean", - "example": true - } + "in": "query", + "name": "did", + "description": "The DID of the issuer of the status list.", + "required": true, + "schema": { + "type": "string" } }, { - "oneOf": [ - { - "$ref": "#/components/schemas/RevocationResult" - }, - { - "$ref": "#/components/schemas/SuspensionResult" - }, - { - "$ref": "#/components/schemas/UnsuspensionResult" - } - ] + "in": "query", + "name": "statusPurpose", + "description": "The purpose of the status list. Can be either revocation or suspension.", + "schema": { + "type": "string", + "enum": [ + "revocation", + "suspension" + ] + } }, { - "$ref": "#/components/schemas/CredentialStatusUnencryptedResult" + "in": "query", + "name": "statusListName", + "description": "The name of the StatusList2021 DID-Linked Resource.", + "schema": { + "type": "string" + } } - ] - }, - "CredentialStatusUpdateEncryptedFormRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/CredentialStatusUpdateBody" + ], + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialStatusListSearchResult" + } + } + } }, - { - "type": "object", - "required": [ - "symmetricKey" - ], - "properties": { - "symmetricKey": { - "description": "The symmetric key used to encrypt the StatusList2021 DID-Linked Resource.", - "type": "string" + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential/issue": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Issue a Verifiable Credential", + "description": "This endpoint issues a Verifiable Credential. As input it takes the list of issuerDid, subjectDid, attributes, and other parameters of the credential to be issued.", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Credential" + } } } }, - { - "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsBody" + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } - ] - }, - "CredentialStatusUpdateEncryptedJsonRequest": { - "allOf": [ + } + } + }, + "/credential/verify": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Verify a Verifiable Credential.", + "description": "This endpoint verifies a Verifiable Credential passed to it. As input, it can take the VC-JWT as a string or the entire credential itself.", + "operationId": "verify", + "parameters": [ { - "$ref": "#/components/schemas/CredentialStatusUpdateBody" + "in": "query", + "name": "verifyStatus", + "description": "If set to `true` the verification will also check the status of the credential. Requires the VC to have a `credentialStatus` property.", + "schema": { + "type": "boolean", + "default": false + } }, { - "type": "object", - "required": [ - "symmetricKey" - ], - "properties": { - "symmetricKey": { - "description": "The symmetric key used to encrypt the StatusList2021 DID-Linked Resource.", - "type": "string" - } + "in": "query", + "name": "fetchRemoteContexts", + "description": "When dealing with JSON-LD you also MUST provide the proper contexts. Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are a custom context.", + "schema": { + "type": "boolean", + "default": false } }, { - "$ref": "#/components/schemas/CredentialStatusEncryptedPaymentConditionsJson" + "in": "query", + "name": "allowDeactivatedDid", + "description": "If set to `true` allow to verify credential which based on deactivated DID.", + "schema": { + "type": "boolean", + "default": false + } } ], - "example": { - "did": "did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e", - "statusListName": "cheqd-employee-credentials-encrypted", - "indices": [ - 10, - 3199, - 12109, - 130999 - ], - "symmetricKey": "dfe204ee95ae74ea5d74b94c3d8ff782273905b07fbc9f8c3d961c3b43849f18" - } - }, - "CredentialStatusUpdateEncryptedResult": { - "allOf": [ - { - "type": "object", - "properties": { - "updated": { - "type": "boolean", - "example": true + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialVerifyRequest" } - } - }, - { - "oneOf": [ - { - "$ref": "#/components/schemas/RevocationResult" - }, - { - "$ref": "#/components/schemas/SuspensionResult" - }, - { - "$ref": "#/components/schemas/UnsuspensionResult" + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialVerifyRequest" } - ] - }, - { - "$ref": "#/components/schemas/CredentialStatusEncryptedResult" + } } - ] - }, - "CredentialStatusCheckRequest": { - "type": "object", - "required": [ - "did", - "statusListName", - "index" - ], - "properties": { - "did": { - "description": "DID of the StatusList2021 publisher.", - "type": "string", - "format": "uri" + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyCredentialResult" + } + } + } }, - "statusListName": { - "description": "The name of the StatusList2021 DID-Linked Resource to be checked.", - "type": "string" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "index": { - "description": "Credential status index to be checked for revocation or suspension.", - "type": "integer", - "minimum": 0, - "exclusiveMinimum": false + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "makeFeePayment": { - "description": "Automatically make fee payment (if required) based on payment conditions to unlock encrypted StatusList2021 DID-Linked Resource.", - "type": "boolean", - "default": true + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "CredentialStatusCheckResult": { - "oneOf": [ - { - "$ref": "#/components/schemas/CredentialStatusCheckRevocationResult" - }, + } + }, + "/credential/revoke": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Revoke a Verifiable Credential.", + "description": "This endpoint revokes a given Verifiable Credential. As input, it can take the VC-JWT as a string or the entire credential itself. The StatusList2021 resource should already be setup in the VC and `credentialStatus` property present in the VC.", + "operationId": "revoke", + "parameters": [ { - "$ref": "#/components/schemas/CredentialStatusCheckSuspensionResult" - } - ] - }, - "CredentialStatusCheckRevocationResult": { - "type": "object", - "properties": { - "checked": { - "type": "boolean", - "example": true - }, - "revoked": { - "type": "boolean", - "example": false + "in": "query", + "name": "publish", + "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", + "required": true, + "schema": { + "type": "boolean", + "default": true + } } - } - }, - "CredentialStatusCheckSuspensionResult": { - "type": "object", - "properties": { - "checked": { - "type": "boolean", - "example": true - }, - "suspended": { - "type": "boolean", - "example": false + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + } } - } - }, - "CredentialStatusListSearchResult": { - "allOf": [ - { - "type": "object", - "properties": { - "found": { - "type": "boolean", - "example": true + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevocationResult" + } } } }, - { - "oneOf": [ - { - "$ref": "#/components/schemas/CredentialStatusUnencryptedResult" - }, - { - "$ref": "#/components/schemas/CredentialStatusEncryptedResult" - } - ] - } - ] - }, - "KeyImportRequest": { - "type": "object", - "properties": { - "alias": { - "type": "string" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "type": { - "type": "string", - "enum": [ - "Ed25519", - "Secp256k1" - ] + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "privateKeyHex": { - "type": "string" + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "KeyResult": { - "type": "object", - "properties": { - "kid": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Ed25519", - "Secp256k1" - ] - }, - "publicKeyHex": { - "type": "string" + } + }, + "/credential/suspend": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Suspend a Verifiable Credential.", + "description": "This endpoint suspends a given Verifiable Credential. As input, it can take the VC-JWT as a string or the entire credential itself.", + "operationId": "suspend", + "parameters": [ + { + "in": "query", + "name": "publish", + "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", + "schema": { + "type": "boolean" + } } - } - }, - "DidDocument": { - "description": "This input field contains either a complete DID document, or an incremental change (diff) to a DID document. See Universal DID Registrar specification.", - "type": "object", - "properties": { - "@context": { - "type": "array", - "items": { - "type": "string" + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } } - }, - "id": { - "type": "string" - }, - "controllers": { - "type": "array", - "items": { - "type": "string" + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuspensionResult" + } + } } }, - "verificationMethod": { - "type": "array", - "items": { - "$ref": "#/components/schemas/VerificationMethod" - } + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "service": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "authentication": { - "type": "array", - "items": { - "type": "string" + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/credential/reinstate": { + "post": { + "tags": [ + "Credential" + ], + "summary": "Reinstate a suspended Verifiable Credential.", + "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", + "operationId": "reinstate", + "parameters": [ + { + "in": "query", + "name": "publish", + "description": "Set whether the StatusList2021 resource should be published to the ledger or not. If set to `false`, the StatusList2021 publisher should manually publish the resource.", + "schema": { + "type": "boolean" } - }, - "assertionMethod": { - "type": "array", - "items": { - "type": "string" + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRevokeRequest" + } } - }, - "capabilityInvocation": { - "type": "array", - "items": { - "type": "string" + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnsuspensionResult" + } + } } }, - "capabilityDelegation": { - "type": "array", - "items": { - "type": "string" - } + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "keyAgreement": { - "type": "array", - "items": { - "type": "string" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/did/create": { + "post": { + "tags": [ + "DID" + ], + "summary": "Create a DID Document.", + "description": "This endpoint creates a DID and associated DID Document. As input, it can take the DID Document parameters via a form, or the fully-assembled DID Document itself.", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DidCreateRequestFormBased" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidCreateRequestJson" + } } } }, - "example": { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], - "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": "z6MkkVbyHJLLjdjU5B62DaJ4mkdMdUkttf9UqySSkA9bVTeZ" - } - ], - "authentication": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://example.com" - ] - } - ] - } - }, - "DidDocumentWithoutVerificationMethod": { - "type": "object", - "properties": { - "@context": { - "type": "array", - "items": { - "type": "string" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidResult" + } + } } }, - "id": { - "type": "string" - }, - "controllers": { - "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": "InvalidRequest" + } + } } }, - "service": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "authentication": { - "type": "array", - "items": { - "type": "string" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } + } + } + } + } + }, + "/did/update": { + "post": { + "tags": [ + "DID" + ], + "summary": "Update a DID Document.", + "description": "This endpoint updates a DID Document. As an input, it can take JUST the sections/parameters that need to be updated in the DID Document (in this scenario, it fetches the current DID Document and applies the updated section). Alternatively, it take the fully-assembled DID Document with updated sections as well as unchanged sections.", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DidUpdateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidUpdateRequest" + } } - }, - "assertionMethod": { - "type": "array", - "items": { - "type": "string" + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidUpdateResponse" + } + } } }, - "capabilityInvocation": { - "type": "array", - "items": { - "type": "string" - } + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "capabilityDelegation": { - "type": "array", - "items": { - "type": "string" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "keyAgreement": { - "type": "array", - "items": { - "type": "string" + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/did/import": { + "post": { + "tags": [ + "DID" + ], + "summary": "Import a DID Document.", + "description": "This endpoint imports a decentralized identifier associated with the user's account for custodian-mode clients.", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DidImportRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidImportRequest" + } } } }, - "example": { - "@context": [ - "https://www.w3.org/ns/did/v1" - ], - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0", - "controller": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - ], - "authentication": [ - "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://example.com" - ] + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidResult" + } + } } - ] - } - }, - "DidCreateRequestFormBased": { - "type": "object", - "properties": { - "network": { - "description": "Network to create the DID on (testnet or mainnet)", - "type": "string", - "enum": [ - "testnet", - "mainnet" - ] - }, - "identifierFormatType": { - "description": "Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See cheqd DID method documentation for more details.", - "type": "string", - "enum": [ - "uuid", - "base58btc" - ] - }, - "verificationMethodType": { - "description": "Type of verification method to use for the DID. See DID Core specification for more details. Only the types listed below are supported.", - "type": "string", - "enum": [ - "Ed25519VerificationKey2018", - "JsonWebKey2020", - "Ed25519VerificationKey2020" - ] }, - "service": { - "description": "It's a list of special objects which are designed to build the actual service. It's almost the same as in DID Core specification, but instead of `id` it utilises `idFragment` field for making the right `id` for each service. !!! WARN. Cause swagger-ui does not handle x-ww-form based arrays correctly, please frame all your services in brackets while using swagger UI. !!!", - "type": "array", - "items": { - "type": "object", - "properties": { - "idFragment": { - "type": "string" - }, - "type": { - "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" }, - "serviceEndpoint": { - "type": "array", - "items": { - "type": "string" - } + "example": { + "error": "InvalidRequest" } } - }, - "example": [ - { - "idFragment": "service-1", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://example.com" - ] - } - ] + } }, - "key": { - "description": "The unique identifier in hexadecimal public key format used in the verification method to create the DID.", - "type": "string" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "@context": { - "type": "array", - "items": { + "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 Document.", + "description": "This endpoint deactivates a DID Document by taking the DID identifier as input. Must be called and signed by the DID owner.", + "parameters": [ + { + "in": "path", + "name": "did", + "description": "DID identifier to deactivate.", + "schema": { "type": "string" }, - "example": [ - "https://www.w3.org/ns/did/v1" - ] + "required": true } - } - }, - "DidCreateRequestJson": { - "type": "object", - "properties": { - "network": { - "description": "Network to create the DID on (testnet or mainnet)", - "type": "string", - "enum": [ - "testnet", - "mainnet" - ] - }, - "identifierFormatType": { - "description": "Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See cheqd DID method documentation for more details.", - "type": "string", - "enum": [ - "uuid", - "base58btc" - ] - }, - "assertionMethod": { - "description": "Usually a reference to a Verification Method. An Assertion Method is required to issue JSON-LD credentials. See DID Core specification for more details.", - "type": "boolean", - "default": true - }, - "options": { - "type": "object", - "properties": { - "key": { - "type": "string", - "example": "8255ddadd75695e01f3d98fcec8ccc7861a030b317d4326b0e48a4d579ddc43a" - }, - "verificationMethodType": { - "description": "Type of verification method to use for the DID. See DID Core specification for more details. Only the types listed below are supported.", - "type": "string", - "enum": [ - "Ed25519VerificationKey2018", - "JsonWebKey2020", - "Ed25519VerificationKey2020" - ] + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/DidDeactivateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidDeactivateRequest" } } - }, - "didDocument": { - "$ref": "#/components/schemas/DidDocumentWithoutVerificationMethod" } - } - }, - "DidImportRequest": { - "type": "object", - "properties": { - "did": { - "type": "string", - "description": "DID to be imported", - "format": "uri", - "required": true - }, - "keys": { - "type": "array", - "description": "List of keys required to import the DID", - "required": true, - "items": { - "$ref": "#/components/schemas/KeyImportRequest" + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeactivatedDidResolution" + } + } } + }, + "400": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "PresentationCreateResult": { - "type": "object", - "properties": { - "vp": { - "type": "object", - "description": "Verifiable Presentation which could be provided to the verifier." + } + }, + "/did/list": { + "get": { + "tags": [ + "DID" + ], + "summary": "Fetch DIDs associated with an account.", + "description": "This endpoint returns the list of DIDs controlled by the account.", + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } }, - "nbf": { - "type": "integer", - "description": "Unix timestamp of the earliest time that the Verifiable Presentation is valid." + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "iss": { - "type": "string", - "description": "DID of the issuer of the Verifiable Presentation. (Here it's supposed to be a holder DID)" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "aud": { - "type": "array", - "items": { + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/did/search/{did}": { + "get": { + "tags": [ + "DID" + ], + "summary": "Resolve a DID Document.", + "description": "Resolve a DID Document by DID identifier. Also supports DID Resolution Queries as defined in the W3C DID Resolution specification.", + "parameters": [ + { + "in": "path", + "name": "did", + "description": "DID identifier to resolve.", + "schema": { "type": "string" }, - "description": "DID of the verifier of the Verifiable Presentation." - } - }, - "example": { - "vp": { - "@context": [ - "https://www.w3.org/2018/credentials/v1" - ], - "type": [ - "VerifiablePresentation" - ], - "verifiableCredential": [ - "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc2NoZW1hLm9yZy9zY2hlbWEuanNvbmxkIiwiaHR0cHM6Ly92ZXJhbW8uaW8vY29udGV4dHMvcHJvZmlsZS92MSIsImh0dHBzOi8vdzNpZC5vcmcvdmMtc3RhdHVzLWxpc3QtMjAyMS92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUGVyc29uIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7Im5hbWUiOiJCb2IiLCJnZW5kZXIiOiJtYWxlIn0sImNyZWRlbnRpYWxTdGF0dXMiOnsiaWQiOiJodHRwczovL3Jlc29sdmVyLmNoZXFkLm5ldC8xLjAvaWRlbnRpZmllcnMvZGlkOmNoZXFkOnRlc3RuZXQ6OTBkNWMxNDEtNzI0Zi00N2FkLTlhZTctYTdjMzNhOWU1NjQzP3Jlc291cmNlTmFtZT1zdXNwZW5zaW9uRW4mcmVzb3VyY2VUeXBlPVN0YXR1c0xpc3QyMDIxU3VzcGVuc2lvbiMxMzMzOCIsInR5cGUiOiJTdGF0dXNMaXN0MjAyMUVudHJ5Iiwic3RhdHVzUHVycG9zZSI6InN1c3BlbnNpb24iLCJzdGF0dXNMaXN0SW5kZXgiOiIxMzMzOCJ9fSwic3ViIjoiZGlkOmtleTp6Nk1raGFYZ0JaRHZvdERrTDUyNTdmYWl6dGlHaUMyUXRLTEdwYm5uRUd0YTJkb0siLCJuYmYiOjE3MDA0NzM0MTYsImlzcyI6ImRpZDpjaGVxZDp0ZXN0bmV0OjkwZDVjMTQxLTcyNGYtNDdhZC05YWU3LWE3YzMzYTllNTY0MyJ9.-14Ril1pZEy2HEEo48gTJr2yOtGxBhUGTFmzVdjAtyhFRsW5zZg9onHt6V9JQ8BaiYBlTkP9GzTnJ-O6hdiyCw" - ] + "required": true, + "example": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" }, - "nbf": 1700744275, - "iss": "did:cheqd:testnet:4b846d0f-2f6c-4ab6-9fe2-5b8db301c83c", - "aud": [ - "did:cheqd:testnet:8c71e9b6-c5a3-4250-8c58-fa591533cd22" - ] - } - }, - "DidResult": { - "type": "object", - "properties": { - "did": { - "type": "string" + { + "in": "query", + "name": "metadata", + "description": "Return only metadata of DID Document instead of actual DID Document.", + "schema": { + "type": "boolean" + } }, - "controllerKeyId": { - "type": "string" + { + "in": "query", + "name": "versionId", + "description": "Unique UUID version identifier of DID Document. Allows for fetching a specific version of the DID Document. See cheqd DID Method Specification for more details.", + "schema": { + "type": "string", + "format": "uuid" + }, + "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" }, - "keys": { - "type": "array", - "items": { - "type": "object" - } + { + "in": "query", + "name": "versionTime", + "description": "Returns the closest version of the DID Document *at* or *before* specified time. See DID Resolution handling for `did:cheqd` for more details.", + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "1970-01-01T00:00:00Z" }, - "services": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" + { + "in": "query", + "name": "transformKeys", + "description": "This directive transforms the Verification Method key format from the version in the DID Document to the specified format chosen below.", + "schema": { + "type": "string", + "enum": [ + "Ed25519VerificationKey2018", + "Ed25519VerificationKey2020", + "JsonWebKey2020" + ] } + }, + { + "in": "query", + "name": "service", + "description": "Query DID Document for a specific Service Endpoint by Service ID (e.g., `service-1` in `did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1`). This will typically redirect to the Service Endpoint based on DID Resolution specification algorithm.", + "schema": { + "type": "string" + }, + "example": "service-1" + }, + { + "in": "query", + "name": "relativeRef", + "description": "Relative reference is a query fragment appended to the Service Endpoint URL. **Must** be used along with the `service` query property above. See DID Resolution specification algorithm for more details.", + "schema": { + "type": "string" + }, + "example": "/path/to/file" } - } - }, - "DidUpdateResponse": { - "type": "object", - "properties": { - "did": { - "type": "string" + ], + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidResolution" + } + } + } }, - "controllerKeyId": { - "type": "string", - "description": "The default key id of which is the key associated with the first verificationMethod" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "keys": { - "type": "array", - "description": "The list of keys associated with the list of verificationMethod's of DIDDocument", - "items": { - "type": "object" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" + }, + "500": { + "$ref": "#/components/schemas/InternalError" + } + } + } + }, + "/key/create": { + "post": { + "tags": [ + "Key" + ], + "summary": "Create an identity key pair.", + "description": "This endpoint creates an identity key pair associated with the user's account for custodian-mode clients.", + "parameters": [ + { + "name": "type", + "description": "Key type of the identity key pair to create.", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "Ed25519", + "Secp256k1" + ] + } + } + ], + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KeyResult" + } + } } }, - "services": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Service" + "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": "InvalidRequest" + } + } } }, - "controllerKeyRefs": { - "type": "array", - "description": "The list of keyRefs which were used for signing the transaction", - "items": { - "type": "string" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "controllerKeys": { - "type": "array", - "description": "The list of all possible keys, inlcuding all controller's keys", - "items": { - "type": "string" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } } } } - }, - "VerificationMethod": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "controller": { - "type": "string" - }, - "publicKeyMultibase": { - "type": "string" - }, - "publicKeyJwk": { - "type": "array", - "items": { - "type": "string" + } + }, + "/key/import": { + "post": { + "tags": [ + "Key" + ], + "summary": "Import an identity key pair.", + "description": "This endpoint imports an identity key pair associated with the user's account for custodian-mode clients.", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/KeyImportRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/KeyImportRequest" + } } } }, - "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": { - "description": "Communicating or interacting with the DID subject or associated entities via one or more service endpoints. See DID Core specification for more details.", - "type": "object", - "properties": { - "id": { - "description": "DID appended with Service fragment ID (e.g., `#service-1` in `did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1`)", - "type": "string", - "example": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1" - }, - "type": { - "description": "Service type as defined in DID Specification Registries.", - "type": "string", - "example": "LinkedDomains" - }, - "serviceEndpoint": { - "description": "Service endpoint as defined in DID Core Specification.", - "type": "array", - "items": { - "type": "string", - "example": "https://example.com" - } - } - } - }, - "DidUpdateRequest": { - "type": "object", - "properties": { - "did": { - "description": "DID identifier to be updated.", - "type": "string", - "example": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" - }, - "service": { - "type": "array", - "description": "Service section of the DID Document.", - "items": { - "$ref": "#/components/schemas/Service" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KeyResult" + } + } } }, - "verificationMethod": { - "type": "array", - "description": "Verification Method section of the DID Document.", - "items": { - "$ref": "#/components/schemas/VerificationMethod" + "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": "InvalidRequest" + } + } } }, - "authentication": { - "description": "Authentication section of the DID Document.", - "type": "array", - "items": { - "type": "string" - } + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "publicKeyHexs": { - "description": "List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.", - "type": "array", - "items": { - "type": "string" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } } - }, - "didDocument": { - "$ref": "#/components/schemas/DidDocument" } } - }, - "DidDeactivateRequest": { - "type": "object", - "properties": { - "publicKeyHexs": { - "description": "List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.", - "type": "array", - "items": { + } + }, + "/key/read/{kid}": { + "get": { + "tags": [ + "Key" + ], + "summary": "Fetch an identity key pair.", + "description": "This endpoint fetches an identity key pair's details for a given key ID. Only the user account associated with the custodian-mode client can fetch the key pair.", + "parameters": [ + { + "name": "kid", + "description": "Key ID of the identity key pair to fetch.", + "in": "path", + "schema": { "type": "string" - } + }, + "required": true } - } - }, - "CreateResourceRequest": { - "description": "Input fields for DID-Linked Resource creation.", - "type": "object", - "additionalProperties": false, - "required": [ - "name", - "type", - "data", - "encoding" ], - "properties": { - "data": { - "description": "Encoded string containing the data to be stored in the DID-Linked Resource.", - "type": "string" - }, - "encoding": { - "description": "Encoding format used to encode the data.", - "type": "string", - "enum": [ - "base64url", - "base64", - "hex" - ] - }, - "name": { - "description": "Name of DID-Linked Resource.", - "type": "string" - }, - "type": { - "description": "Type of DID-Linked Resource. This is NOT the same as the media type, which is calculated automatically ledger-side.", - "type": "string" + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KeyResult" + } + } + } }, - "alsoKnownAs": { - "description": "Optional field to assign a set of alternative URIs where the DID-Linked Resource can be fetched from.", - "type": "array", - "items": { - "type": "object", - "properties": { - "uri": { - "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" }, - "description": { - "type": "string" + "example": { + "error": "InvalidRequest" } } } }, - "version": { - "description": "Optional field to assign a human-readable version in the DID-Linked Resource.", - "type": "string" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "publicKeyHexs": { - "description": "List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.", - "type": "array", - "items": { - "type": "string" + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } } } - }, - "example": { - "data": "SGVsbG8gV29ybGQ=", - "encoding": "base64url", - "name": "ResourceName", - "type": "TextDocument" } - }, - "ResourceList": { - "type": "object", - "properties": { - "@context": { - "type": "string", - "example": "https://w3id.org/did-resolution/v1" + } + }, + "/presentation/create": { + "post": { + "tags": [ + "Presentation" + ], + "summary": "!!! WARN. Such endpoint is made mostly for testing purposes and it is not supposed to be used in production !!! Create a Verifiable Presentation from credential(s).", + "description": "This endpoint creates a Verifiable Presentation from credential(s). As input, it can take the credential(s) as a string or the entire credential(s) itself. \n !!! WARN. Such endpoint is made only for testing purposes !!!", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/PresentationCreateRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/PresentationCreateRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PresentationCreateResult" + } + } + } }, - "contentMetadata": { - "type": "object" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "contentStream": { - "type": "object" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "dereferencingMetadata": { - "$ref": "#/components/schemas/DereferencingMetadata" + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "DereferencingMetadata": { - "type": "object", - "properties": { - "contentType": { - "type": "string", - "example": "application/did+ld+json" + } + }, + "/presentation/verify": { + "post": { + "tags": [ + "Presentation" + ], + "summary": "Verify a Verifiable Presentation generated from credential(s).", + "description": "This endpoint verifies the Verifiable Presentation generated from credential(s). As input, it can take the Verifiable Presentation JWT as a string or the entire Verifiable Presentation itself.", + "parameters": [ + { + "in": "query", + "name": "verifyStatus", + "description": "If set to `true` the verification will also check the status of the presentation. Requires the VP to have a `credentialStatus` property.", + "schema": { + "type": "boolean", + "default": false + } }, - "did": { - "$ref": "#/components/schemas/DidProperties" + { + "in": "query", + "name": "fetchRemoteContexts", + "description": "When dealing with JSON-LD you also MUST provide the proper contexts. * Set this to `true` ONLY if you want the `@context` URLs to be fetched in case they are a custom context.", + "schema": { + "type": "boolean", + "default": false + } }, - "retrieved": { - "type": "string", - "example": "2021-09-01T12:00:00Z" + { + "in": "query", + "name": "allowDeactivatedDid", + "description": "If set to `true` allow to verify credential which based on deactivated DID.", + "schema": { + "type": "boolean", + "default": false + } } - } - }, - "DidResolution": { - "type": "object", - "properties": { - "@context": { - "type": "string", - "example": "https://w3id.org/did-resolution/v1" - }, - "didDidResolutionMetadata": { - "$ref": "#/components/schemas/DidResolutionMetadata" - }, - "didDocument": { - "$ref": "#/components/schemas/DidDocument" - }, - "didDocumentMetadata": { - "$ref": "#/components/schemas/DidDocumentMetadata" + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/PresentationVerifyRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/PresentationVerifyRequest" + } + } } - } - }, - "DeactivatedDidResolution": { - "type": "object", - "properties": { - "@context": { - "type": "string", - "example": "https://w3id.org/did-resolution/v1" + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyPresentationResult" + } + } + } }, - "didDidResolutionMetadata": { - "$ref": "#/components/schemas/DidResolutionMetadata" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "didDocument": { - "$ref": "#/components/schemas/DidDocument" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "didDocumentMetadata": { - "$ref": "#/components/schemas/DeactivatedDidDocumentMetadata" + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "DidDocumentMetadata": { - "type": "object", - "properties": { - "created": { - "type": "string", - "example": "2021-09-01T12:00:00Z" - }, - "deactivated": { - "type": "boolean", - "example": false - }, - "updated": { - "type": "string", - "example": "2021-09-10T12:00:00Z" - }, - "versionId": { - "type": "string", - "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" - }, - "linkedResourceMetadata": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ResourceMetadata" + } + }, + "/resource/create/{did}": { + "post": { + "tags": [ + "Resource" + ], + "summary": "Create a DID-Linked Resource.", + "description": "This endpoint creates a DID-Linked Resource. As input, it can take the DID identifier and the resource parameters via a form, or the fully-assembled resource itself.", + "parameters": [ + { + "in": "path", + "name": "did", + "description": "DID identifier to link the resource to.", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/CreateResourceRequest" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateResourceRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceMetadata" + } + } } - } - } - }, - "DeactivatedDidDocumentMetadata": { - "type": "object", - "properties": { - "created": { - "type": "string", - "example": "2021-09-01T12:00:00Z" - }, - "deactivated": { - "type": "boolean", - "example": true }, - "updated": { - "type": "string", - "example": "2021-09-10T12:00:00Z" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "versionId": { - "type": "string", - "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "linkedResourceMetadata": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ResourceMetadata" - } + "500": { + "$ref": "#/components/schemas/InternalError" } } - }, - "ResourceMetadata": { - "type": "object", - "properties": { - "resourceURI": { - "type": "string", - "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47/resources/398cee0a-efac-4643-9f4c-74c48c72a14b" - }, - "resourceCollectionId": { - "type": "string", - "example": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + } + }, + "/resource/search/{did}": { + "get": { + "tags": [ + "Resource" + ], + "summary": "Get a DID-Linked Resource.", + "description": "This endpoint returns the DID-Linked Resource for a given DID identifier and resource identifier.", + "parameters": [ + { + "in": "path", + "name": "did", + "description": "DID identifier", + "schema": { + "type": "string" + }, + "required": true, + "example": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0" }, - "resourceId": { - "type": "string", - "example": "398cee0a-efac-4643-9f4c-74c48c72a14b" + { + "in": "query", + "name": "resourceId", + "description": "Fetch a DID-Linked Resource by Resource ID unique identifier. Since this is a unique identifier, other Resource query parameters are not required. See DID-Linked Resources for more details.", + "schema": { + "type": "string", + "format": "uuid" + }, + "example": "3ccde6ba-6ba5-56f2-9f4f-8825561a9860" }, - "resourceName": { - "type": "string", + { + "in": "query", + "name": "resourceName", + "description": "Filter a DID-Linked Resource query by Resource Name. See DID-Linked Resources for more details.", + "schema": { + "type": "string" + }, "example": "cheqd-issuer-logo" }, - "resourceType": { - "type": "string", + { + "in": "query", + "name": "resourceType", + "description": "Filter a DID-Linked Resource query by Resource Type. See DID-Linked Resources for more details.", + "schema": { + "type": "string" + }, "example": "CredentialArtwork" }, - "mediaType": { - "type": "string", - "example": "image/png" - }, - "resourceVersion": { - "type": "string", - "example": "1.0" - }, - "checksum": { - "type": "string", - "example": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559" + { + "in": "query", + "name": "resourceVersion", + "description": "Filter a DID-Linked Resource query by Resource Version, which is an optional free-text field used by issuers (e.g., \"v1\", \"Final Version\", \"1st January 1970\" etc). See DID-Linked Resources for more details.", + "schema": { + "type": "string" + }, + "example": "v1" }, - "created": { - "type": "string", - "example": "2021-09-01T12:00:00Z" + { + "in": "query", + "name": "resourceVersionTime", + "description": "Filter a DID-Linked Resource query which returns the closest version of the Resource *at* or *before* specified time. See DID-Linked Resources for more details.", + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "1970-01-01T00:00:00Z" }, - "nextVersionId": { - "type": "string", - "example": "d4829ac7-4566-478c-a408-b44767eddadc" + { + "in": "query", + "name": "checksum", + "description": "Request integrity check against a given DID-Linked Resource by providing a SHA-256 checksum hash. See DID-Linked Resources for more details.", + "schema": { + "type": "string" + }, + "example": "dc64474d062ed750a66bad58cb609928de55ed0d81defd231a4a4bf97358e9ed" }, - "previousVersionId": { - "type": "string", - "example": "ad7a8442-3531-46eb-a024-53953ec6e4ff" + { + "in": "query", + "name": "resourceMetadata", + "description": "Return only metadata of DID-Linked Resource instead of actual DID-Linked Resource. Mutually exclusive with some of the other parameters.", + "schema": { + "type": "boolean" + } } - } - }, - "DidResolutionMetadata": { - "type": "object", - "properties": { - "contentType": { - "allOf": [ - { - "$ref": "#/components/schemas/ContentType" + ], + "responses": { + "200": { + "description": "The request was successful.", + "content": { + "any": { + "schema": { + "type": "object" + } } - ], - "example": "application/did+ld+json" - }, - "retrieved": { - "type": "string", - "example": "2021-09-01T12:00:00Z" - }, - "did": { - "$ref": "#/components/schemas/DidProperties" - } - } - }, - "ContentType": { - "type": "string", - "enum": [ - "application/did+json", - "application/did+ld+json", - "application/ld+json", - "application/json" - ] - }, - "DidProperties": { - "type": "object", - "properties": { - "didString": { - "type": "string", - "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + } }, - "method": { - "type": "string", - "example": "cheqd" + "400": { + "$ref": "#/components/schemas/InvalidRequest" }, - "methodSpecificId": { - "type": "string", - "example": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" - } - } - }, - "Customer": { - "type": "object", - "properties": { - "customerId": { - "type": "string", - "example": "6w5drpiiwhhs" + "401": { + "$ref": "#/components/schemas/UnauthorizedError" }, - "address": { - "type": "string", - "example": "cheqd1wgsvqwlkmdp60f4dek26ak0sjw6au3ytd3pz7f" - } - } - }, - "AccountCreateRequest": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "primaryEmail": { - "type": "string" - } - } - } - } - }, - "InvalidRequest": { - "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "InvalidRequest" - } - } - }, - "InternalError": { - "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Internal Error" - } - } - }, - "UnauthorizedError": { - "description": "Access token is missing or invalid", - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "Unauthorized Error" + "500": { + "$ref": "#/components/schemas/InternalError" } } } diff --git a/src/types/swagger-admin-types.ts b/src/types/swagger-admin-types.ts index b0f66e221..7db0f8b0d 100644 --- a/src/types/swagger-admin-types.ts +++ b/src/types/swagger-admin-types.ts @@ -213,10 +213,9 @@ * required: * - name * APIKeyCreateResponseBody: - * description: The response body for creating an API key - * type: object - * schema: - * ref: '#/components/schemas/APIKeyResponse' + * allOf: + * - $ref: '#/components/schemas/APIKeyResponse' + * - description: The response body for creating an API key * APIKeyCreateUnsuccessfulResponseBody: * description: The response body for an unsuccessful API key creation * type: object @@ -249,10 +248,9 @@ * required: * - apiKey * APIKeyUpdateResponseBody: - * description: The response body for an unsuccessful API key update - * type: object - * schema: - * ref: '#/components/schemas/APIKeyResponse' + * allOf: + * - $ref: '#/components/schemas/APIKeyResponse' + * - description: The response body for an successful API key update * APIKeyUpdateUnsuccessfulResponseBody: * description: The response body for an unsuccessful API key update * type: object @@ -298,9 +296,7 @@ * apiKeys: * type: array * items: - * type: object - * schema: - * ref: '#/components/schemas/APIKeyResponse' + * $ref: '#/components/schemas/APIKeyResponse' * APIKeyGetRequestBody: * description: The request body for getting an API key * type: object @@ -312,10 +308,9 @@ * required: * - apiKey * APIKeyGetResponseBody: - * description: The response body for getting an API key - * type: object - * schema: - * ref: '#/components/schemas/APIKeyResponse' + * allOf: + * - $ref: '#/components/schemas/APIKeyResponse' + * - description: The response body for getting an API key * OrganisationResponseBody: * description: The response body for an organisation * type: object diff --git a/src/types/swagger-api-types.ts b/src/types/swagger-api-types.ts index d3e2d5016..39ac0a618 100644 --- a/src/types/swagger-api-types.ts +++ b/src/types/swagger-api-types.ts @@ -916,13 +916,15 @@ * type: string * description: DID to be imported * format: uri - * required: true * keys: * type: array * description: List of keys required to import the DID - * required: true * items: * $ref: '#/components/schemas/KeyImportRequest' + * + * required: + * - did + * - keys * PresentationCreateResult: * type: object * properties: @@ -1273,12 +1275,23 @@ * Customer: * type: object * properties: - * customerId: - * type: string - * example: 6w5drpiiwhhs - * address: - * type: string - * example: cheqd1wgsvqwlkmdp60f4dek26ak0sjw6au3ytd3pz7f + * customer: + * type: object + * properties: + * customerId: + * type: string + * name: + * type: string + * paymentAccount: + * type: object + * properties: + * address: + * type: string + * QueryIdTokenResponseBody: + * type: object + * properties: + * idToken: + * type: string * AccountCreateRequest: * type: object * properties: diff --git a/tests/e2e/auth.setup.ts b/tests/e2e/auth.setup.ts index d535b832c..56d3f4794 100644 --- a/tests/e2e/auth.setup.ts +++ b/tests/e2e/auth.setup.ts @@ -8,24 +8,29 @@ setup('Authenticate as user', async ({ page }) => { // Perform authentication steps. Replace these actions with your own. // Push Log-in button await page.goto(`${process.env.APPLICATION_BASE_URL}/swagger`); - await page.getByRole('button', { name: 'Log in' }).click(); - await page.waitForURL(`${process.env.LOGTO_ENDPOINT}/sign-in`, { - waitUntil: 'domcontentloaded', - }); - - // Fill out the form and submit - await page.getByPlaceholder('Email / Username').fill(process.env.TEST_USER_EMAIL); - await page.getByRole('button', { name: 'Sign in' }).click(); - await page.getByPlaceholder('Password').fill(process.env.TEST_USER_PASSWORD); - await page.getByRole('button', { name: 'Continue' }).click(); - await page.waitForURL(`${process.env.APPLICATION_BASE_URL}/swagger/`, { - waitUntil: 'domcontentloaded', - timeout: 45000, - }); - await expect(page.getByRole('button', { name: 'Log out' })).toBeVisible(); - - const response = await page.goto(`${process.env.APPLICATION_BASE_URL}/account`); - expect(response.ok()).toBe(true); + + // step 1: click on "Authorize" button + await page.locator('button.btn.authorize.unlocked:has(span:has-text("Authorize"))').click(); + + // step 2: Wait for a modal to pop up + await page.waitForSelector('div.modal-ux'); + + // step 3: find a input and write "TEST_USER_API_KEY" + + await page.fill('div.wrapper section input[type="text"]', process.env.TEST_USER_API_KEY); + + // step 4: click on "Authorize" button + await page.click('button.btn.modal-btn.auth.authorize.button[aria-label="Apply credentials"][type="submit"]'); + + // step 5: assert "Logout" button is visible + const logOutButton = await page.locator( + 'button.btn.modal-btn.auth.button[aria-label="Remove authorization"]:has-text("Logout")' + ); + + await expect(logOutButton).toBeVisible(); + + // Step 5: click on "Close" button + await page.locator('button.btn.modal-btn.auth.btn-done.button').click(); // End of authentication steps. diff --git a/tests/e2e/no-auth.setup.ts b/tests/e2e/no-auth.setup.ts index e2741a1d3..249154469 100644 --- a/tests/e2e/no-auth.setup.ts +++ b/tests/e2e/no-auth.setup.ts @@ -5,11 +5,12 @@ import { StatusCodes } from 'http-status-codes'; dotenv.config(); -setup('Unauthenticated user', async ({ page }) => { +setup('Unauthenticated user', async ({ page, request }) => { // Check that current user is really unauthenticated await page.goto(`${process.env.APPLICATION_BASE_URL}/swagger`); - await expect(page.getByRole('button', { name: 'Log in' })).toBeVisible(); + const authorizeButton = await page.locator('button.btn.authorize.unlocked:has(span:has-text("Authorize"))'); + await expect(authorizeButton).toBeVisible(); const response = await page.goto(`${process.env.APPLICATION_BASE_URL}/account`); expect(response.ok()).not.toBe(true);