From bb73b968258e9221811db6f609ef804d1bf55c58 Mon Sep 17 00:00:00 2001 From: DaevMithran Date: Wed, 22 Mar 2023 13:13:31 +0530 Subject: [PATCH 1/2] docs: Add swagger --- README.md | 12 +- package-lock.json | 60 ++++- package.json | 6 +- src/app.ts | 16 +- src/controllers/credentials.ts | 86 ++++---- src/services/credentials.ts | 1 + swagger.json | 385 +++++++++++++++++++++++++++++++++ 7 files changed, 511 insertions(+), 55 deletions(-) create mode 100644 swagger.json diff --git a/README.md b/README.md index e19f282f..3bd6368e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The purpose of this service is to issue and verify credentials. This service by ### Issue a credential -- **Endpoint** POST `/api/credentials/issue` +- **Endpoint** POST `/1.0/api/credentials/issue` - **Accepts**: `application/json` - **Request Body**: JSON object with following fields - `attributes` - A json object with all the credential attributes @@ -23,22 +23,24 @@ The purpose of this service is to issue and verify credentials. This service by - `@context` - context of the issued credential (optional) - `expirationDate` - Date of expiration of the JWT (optional) - **Success Response Code**: 200 -- **Error Response Code** - 400 +- **Invalid Request Response Code** - 400 +- **Internal Error Response Code** - 500 ### Verify a Credential -- **Endpoint** POST `/api/credentials/verify` +- **Endpoint** POST `/1.0/api/credentials/verify` - **Accepts**: `application/json` - **Request Body**: JSON object with following fields: - `credential` - A verifiable credential or the JWT string - **Success Response Code** - 200 -- **Error Response Codes**: +- **Invalid Request Response Code**: - 400: Bad request body - 405: Wrong content type +- **Internal Error Response Code** - 500 ### Health Check -- **Endpoint**: `/api/credentials` (This endpoint only returns a "PONG" as response with status code 200) +- **Endpoint**: `/` (This endpoint redirects to the swagger api docs) ## 🧑‍💻🛠 Developer Guide diff --git a/package-lock.json b/package-lock.json index de209928..71572a62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cheqd/credential-service", - "version": "1.5.0", + "version": "2.0.0-develop.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@cheqd/credential-service", - "version": "1.5.0", + "version": "2.0.0-develop.1", "license": "Apache-2.0", "dependencies": { "@cheqd/did-provider-cheqd": "^3.0.4", @@ -23,7 +23,8 @@ "express": "^4.18.2", "express-validator": "^6.15.0", "helmet": "^6.0.1", - "node-cache": "^5.1.2" + "node-cache": "^5.1.2", + "swagger-ui-express": "^4.6.1" }, "devDependencies": { "@semantic-release/changelog": "^6.0.2", @@ -38,6 +39,7 @@ "@types/helmet": "^4.0.0", "@types/jest": "^29.2.5", "@types/node": "^18.11.18", + "@types/swagger-ui-express": "^4.1.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.48.0", "@typescript-eslint/parser": "^5.48.0", @@ -7742,6 +7744,16 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "devOptional": true }, + "node_modules/@types/swagger-ui-express": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.3.tgz", + "integrity": "sha512-jqCjGU/tGEaqIplPy3WyQg+Nrp6y80DCFnDEAvVKWkJyv0VivSSDCChkppHRHAablvInZe6pijDFMnavtN0vqA==", + "dev": true, + "dependencies": { + "@types/express": "*", + "@types/serve-static": "*" + } + }, "node_modules/@types/uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", @@ -24083,6 +24095,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/swagger-ui-dist": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.18.1.tgz", + "integrity": "sha512-n7AT4wzKIPpHy/BGflJOepGMrbY/7Cd5yVd9ptVczaJGAKScbVJrZxFbAE2ZSZa8KmqdQ0+pOs3/5mWY5tSMZQ==" + }, + "node_modules/swagger-ui-express": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.6.2.tgz", + "integrity": "sha512-MHIOaq9JrTTB3ygUJD+08PbjM5Tt/q7x80yz9VTFIatw8j5uIWKcr90S0h5NLMzFEDC6+eVprtoeA5MDZXCUKQ==", + "dependencies": { + "swagger-ui-dist": ">=4.11.0" + }, + "engines": { + "node": ">= v0.10.32" + }, + "peerDependencies": { + "express": ">=4.0.0" + } + }, "node_modules/symbol-observable": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", @@ -31582,6 +31613,16 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "devOptional": true }, + "@types/swagger-ui-express": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.3.tgz", + "integrity": "sha512-jqCjGU/tGEaqIplPy3WyQg+Nrp6y80DCFnDEAvVKWkJyv0VivSSDCChkppHRHAablvInZe6pijDFMnavtN0vqA==", + "dev": true, + "requires": { + "@types/express": "*", + "@types/serve-static": "*" + } + }, "@types/uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", @@ -44339,6 +44380,19 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "devOptional": true }, + "swagger-ui-dist": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.18.1.tgz", + "integrity": "sha512-n7AT4wzKIPpHy/BGflJOepGMrbY/7Cd5yVd9ptVczaJGAKScbVJrZxFbAE2ZSZa8KmqdQ0+pOs3/5mWY5tSMZQ==" + }, + "swagger-ui-express": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.6.2.tgz", + "integrity": "sha512-MHIOaq9JrTTB3ygUJD+08PbjM5Tt/q7x80yz9VTFIatw8j5uIWKcr90S0h5NLMzFEDC6+eVprtoeA5MDZXCUKQ==", + "requires": { + "swagger-ui-dist": ">=4.11.0" + } + }, "symbol-observable": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", diff --git a/package.json b/package.json index d9b3715c..05a812ba 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "author": "Cheqd Foundation Limited (https://github.com/cheqd)", "repository": "https://github.com/cheqd/credential-service.git", "scripts": { - "build": "esbuild src/index.ts --platform=node --bundle --minify --outdir=dist", + "build": "esbuild src/index.ts --platform=node --bundle --minify --outdir=dist --external:swagger-ui-express", "start": "node dist/index.js", "format": "prettier --write '*.{json,js}' 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'", "lint": "eslint --max-warnings=0 src && prettier --check '*.{json,js}' 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'", @@ -43,7 +43,8 @@ "express": "^4.18.2", "express-validator": "^6.15.0", "helmet": "^6.0.1", - "node-cache": "^5.1.2" + "node-cache": "^5.1.2", + "swagger-ui-express": "^4.6.1" }, "devDependencies": { "@semantic-release/changelog": "^6.0.2", @@ -59,6 +60,7 @@ "@types/jest": "^29.2.5", "@types/node": "^18.11.18", "@types/uuid": "^9.0.0", + "@types/swagger-ui-express": "^4.1.3", "@typescript-eslint/eslint-plugin": "^5.48.0", "@typescript-eslint/parser": "^5.48.0", "buffer": "6.0.3", diff --git a/src/app.ts b/src/app.ts index 2bff2283..ec48dc55 100644 --- a/src/app.ts +++ b/src/app.ts @@ -4,6 +4,8 @@ import { CredentialController } from './controllers/credentials' import { StoreController } from './controllers/store' import cors from 'cors' import { CORS_ERROR_MSG } from './types/constants' +import * as swagger from 'swagger-ui-express' +import * as swaggerJson from '../swagger.json' require('dotenv').config() @@ -30,22 +32,22 @@ class App { return callback(null, true) } })) + this.express.use('/api-docs', swagger.serve, swagger.setup(swaggerJson)) } private routes() { const app = this.express - const URL_CREDENTIAL_PREFIX = '/api/credentials' - const URL_STORE_PREFIX = '/store' + const URL_PREFIX = '/1.0/api' - app.get('/', (req, res) => res.json({ ping: 'pong' })) + app.get('/', (req, res) => res.redirect('api-docs')) // credentials - app.post(`${URL_CREDENTIAL_PREFIX}/issue`, CredentialController.issueValidator, new CredentialController().issue) - app.post(`${URL_CREDENTIAL_PREFIX}/verify`, CredentialController.verifyValidator, new CredentialController().verify) + app.post(`${URL_PREFIX}/credentials/issue`, CredentialController.issueValidator, new CredentialController().issue) + app.post(`${URL_PREFIX}/credentials/verify`, CredentialController.verifyValidator, new CredentialController().verify) // store - app.post(`${URL_STORE_PREFIX}/`, new StoreController().set) - app.get(`${URL_CREDENTIAL_PREFIX}/:id`, new StoreController().get) + app.post(`${URL_PREFIX}/store`, new StoreController().set) + app.get(`${URL_PREFIX}/store/:id`, new StoreController().get) // 404 for all other requests app.all('*', (req, res) => res.status(400).send('Bad request')) diff --git a/src/controllers/credentials.ts b/src/controllers/credentials.ts index 001cae62..8fdd595f 100644 --- a/src/controllers/credentials.ts +++ b/src/controllers/credentials.ts @@ -5,43 +5,53 @@ import { check, validationResult } from 'express-validator' export class CredentialController { - public static issueValidator = [ - check('subjectDid') - .exists().withMessage('subjectDid is required') - .isString().withMessage('subjectDid should be a string') - .contains('did:').withMessage('subjectDid should be a DID'), - check('attributes') - .exists().withMessage('attributes are required') - .isObject().withMessage('attributes should be an object'), - check('type').optional().isArray().withMessage('type should be a string array'), - check('@context').optional().isArray().withMessage('@context should be a string array'), - check('expirationDate').optional().isDate().withMessage('Invalid expiration date') - ] - - public static verifyValidator = [ - check('credential').exists().withMessage('W3c verifiable credential was not provided') - ] - - public async issue(request: Request, response: Response) { - const result = validationResult(request); - if (!result.isEmpty()) { - return response.status(400).json({ error: result.array()[0].msg }) - } - - response.json(await Credentials.instance.issue_credential(request.body)) - } - - public async verify(request: Request, response: Response) { - if (request?.headers && (!request.headers['content-type'] || request.headers['content-type'] != 'application/json')) { - return response.status(405).json({ error: 'Unsupported media type.' }) - } - - const result = validationResult(request); - if (!result.isEmpty()) { - return response.status(400).json({ error: result.array()[0].msg }) - } - - return response.json(await Credentials.instance.verify_credentials(request.body.credential)) - } + public static issueValidator = [ + check('subjectDid') + .exists().withMessage('subjectDid is required') + .isString().withMessage('subjectDid should be a string') + .contains('did:').withMessage('subjectDid should be a DID'), + check('attributes') + .exists().withMessage('attributes are required') + .isObject().withMessage('attributes should be an object'), + check('type').optional().isArray().withMessage('type should be a string array'), + check('@context').optional().isArray().withMessage('@context should be a string array'), + check('expirationDate').optional().isDate().withMessage('Invalid expiration date') + ] + + public static verifyValidator = [ + check('credential').exists().withMessage('W3c verifiable credential was not provided') + ] + + public async issue(request: Request, response: Response) { + const result = validationResult(request); + if (!result.isEmpty()) { + return response.status(400).json({ error: result.array()[0].msg }) + } + try { + response.json(await Credentials.instance.issue_credential(request.body)) + } catch (error) { + response.status(500).json({ + error: `Internal error: ${error}` + }) + } + } + + public async verify(request: Request, response: Response) { + if (request?.headers && (!request.headers['content-type'] || request.headers['content-type'] != 'application/json')) { + return response.status(405).json({ error: 'Unsupported media type.' }) + } + + const result = validationResult(request); + if (!result.isEmpty()) { + return response.status(400).json({ error: result.array()[0].msg }) + } + try { + return response.json(await Credentials.instance.verify_credentials(request.body.credential)) + } catch (error) { + response.status(500).json({ + error: `Internal error: ${error}` + }) + } + } } diff --git a/src/services/credentials.ts b/src/services/credentials.ts index c812e74d..139ef743 100644 --- a/src/services/credentials.ts +++ b/src/services/credentials.ts @@ -148,6 +148,7 @@ export class Credentials { credential } ) + delete(result.payload) return result } diff --git a/swagger.json b/swagger.json new file mode 100644 index 00000000..1d4eb4b1 --- /dev/null +++ b/swagger.json @@ -0,0 +1,385 @@ +{ + "openapi": "3.0.0", + "servers": [ + { + "url": "/1.0/api/" + } + ], + "info": { + "description": "Api's to issue and verify jwt credentials using cheqd and veramo sdk", + "version": "1.0.0", + "title": "Cheqd Credential Service" + }, + "tags": [ + { + "name": "Credentials", + "externalDocs": { + "url": "https://github.com/cheqd/credential-service#readme" + } + } + ], + "paths": { + "/credentials/issue": { + "post": { + "tags": [ + "Credentials" + ], + "summary": "Issue a JWT credential", + "description": "

This endpoint creates a DID. As input it takes the list of attributes, subjectDid, context and expiration date of the credential to be issued.

", + "operationId": "issue", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CredentialRequest" + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Credential" + } + } + } + }, + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } + } + }, + "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" + } + } + } + } + } + } + }, + "/credentials/verify": { + "post": { + "tags": [ + "Credentials" + ], + "summary": "Verify a JWT credential", + "description": "

This endpoint verifies the JWT credential. As input it takes the entire credential itself or just the JWT string

", + "operationId": "verify", + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "credential": { + "type": "string", + "example": "" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "The request was successful", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IVerifyResult" + } + } + } + }, + "400": { + "description": "A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Invalid Request" + } + } + } + }, + "500": { + "description": "An internal error has occurred. Additional state information plus metadata may be available in the response body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvalidRequest" + }, + "example": { + "error": "Internal Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "CredentialRequest": { + "description": "Input fields for the create operation.", + "type": "object", + "additionalProperties": false, + "properties": { + "subjectDid": { + "description": "This input field is the holder's DID", + "type": "string" + }, + "attributes": { + "type": "object" + }, + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "type": "array", + "items": { + "type": "string" + } + }, + "expirationDate": { + "type": "string" + } + }, + "required": [ + "subjectId", + "attributes" + ], + "example": { + "subjectDid": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK", + "attributes": { + "gender": "male", + "name": "Bob", + "@context": [ + "https://schema.org/Person" + ], + "type": [ + "Person" + ] + } + } + }, + "Credential": { + "description": "Input fields for the update operation.", + "type": "object", + "additionalProperties": false, + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "type": "array", + "items": { + "type": "string" + } + }, + "expirationDate": { + "type": "string" + }, + "issuer": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "credentialSubject": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "issuanceDate": { + "type": "string" + }, + "proof": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "jwt": { + "type": "string" + } + } + } + }, + "example": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org/Person" + ], + "type": [ + "VerifiableCredential", + "Person" + ], + "issuer": { + "id": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228" + }, + "credentialSubject": { + "id": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK" + }, + "issuanceDate": "2023-03-22T07:00:47.749Z", + "gender": "male", + "name": "Bob", + "proof": { + "type": "JwtProof2020", + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc2NoZW1hLm9yZy9QZXJzb24iXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlBlcnNvbiJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIn19LCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc2NoZW1hLm9yZy9QZXJzb24iXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlBlcnNvbiJdLCJpc3N1ZXIiOnsiaWQiOiJkaWQ6Y2hlcWQ6bWFpbm5ldDo4NzkwODY5ZS02MjRjLTQzMjUtOThkZi1jMzBlMGU0NzMyMjgifSwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyJ9LCJpc3N1YW5jZURhdGUiOiIyMDIzLTAzLTIyVDA3OjAwOjQ3Ljc0OVoiLCJnZW5kZXIiOiJtYWxlIiwibmFtZSI6IkJvYiIsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwibmJmIjoxNjc5NDY4NDQ3LCJpc3MiOiJkaWQ6Y2hlcWQ6bWFpbm5ldDo4NzkwODY5ZS02MjRjLTQzMjUtOThkZi1jMzBlMGU0NzMyMjgifQ.P_DulspWdCOzCrlQz8i0JYHQx5l5OHeMYWZ_GgozY1PACpy9MMFS_t04dUYcfWbK6RK89NbgyDza1H8M0Ji3Aw" + } + } + }, + "InvalidRequest": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + } + }, + "IVerifyResult": { + "type": "object", + "properties": { + "verified": { + "type": "boolean" + }, + "didResolutionResult": { + "type": "object" + }, + "issuer": { + "type": "string" + }, + "signer": { + "type": "object" + }, + "jwt": { + "type": "string" + }, + "verifiableCredential": { + "type": "object" + } + }, + "example": { + "verified": true, + "didResolutionResult": { + "didDocumentMetadata": { + "created": "2023-03-17T10:36:09.353270749Z", + "updated": "1970-01-01T00:00:00Z", + "versionId": "5181e19a-7f2c-4c02-b033-dd739811e893" + }, + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-03-22T07:10:59Z", + "did": { + "didString": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228", + "methodSpecificId": "8790869e-624c-4325-98df-c30e0e473228", + "method": "cheqd" + } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228", + "verificationMethod": [ + { + "id": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228", + "publicKeyBase58": "334yXce19pCbMskUtTmgouKmY9SKMoo8XmZMS1tG6aZx" + } + ], + "authentication": [ + "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228#key-1" + ], + "assertionMethod": [ + "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228#key-1" + ] + }, + "@context": "https://w3id.org/did-resolution/v1" + }, + "issuer": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228", + "signer": { + "id": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228", + "publicKeyBase58": "334yXce19pCbMskUtTmgouKmY9SKMoo8XmZMS1tG6aZx" + }, + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vdmVyYW1vLmlvL2NvbnRleHRzL3Byb2ZpbGUvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDprZXk6ejZNa3JNc3B3eUUxejJYa2ZjRGFmWEFoZ0tZSjhuYlNOQ2ZaekI4V2laY3ZyTGtGIn19LCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vdmVyYW1vLmlvL2NvbnRleHRzL3Byb2ZpbGUvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJpc3N1ZXIiOnsiaWQiOiJkaWQ6Y2hlcWQ6bWFpbm5ldDo4NzkwODY5ZS02MjRjLTQzMjUtOThkZi1jMzBlMGU0NzMyMjgifSwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6a2V5Ono2TWtyTXNwd3lFMXoyWGtmY0RhZlhBaGdLWUo4bmJTTkNmWnpCOFdpWmN2ckxrRiJ9LCJpc3N1YW5jZURhdGUiOiIyMDIzLTAzLTIxVDEzOjI0OjA0LjMwNVoiLCJyZXNlcnZhdGlvbklkIjoiMTIzIiwicmVzZXJ2YXRpb25TdGF0dXMiOiJodHRwczovL3NjaGVtYS5vcmcvUmVzZXJ2YXRpb25Db25maXJtZWQiLCJwcm92aWRlciI6eyJicmFuZCI6IkV2ZW50QnJpdGUiLCJpbWFnZSI6Ii9kaWQ6Y2hlcWQ6dGVzdG5ldDpmNDFlNDhjYy0wYWI0LTQ3NTAtOWJhOS02ZmY5ZTVjODAwNmMvcmVzb3VyY2VzLyJ9LCJyZXNlcnZhdGlvbkZvciI6eyJAdHlwZSI6IkV2ZW50IiwibmFtZSI6IkludGVybmV0IElkZW50aXR5IFdvcmtzaG9wIElJV1hYWFYiLCJzdGFydERhdGUiOiIyMDIyLTExLTE2VDE2OjAwOjAwIiwiZW5kRGF0ZSI6IjIwMjItMTEtMThUMDA6MDA6MDAiLCJsb2NhdGlvbiI6IkNvbXB1dGVyIEhpc3RvcnkgTXVzZXVtLCAxNDAxIE4gU2hvcmVsaW5lIEJsdmQsIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIiwibG9nbyI6Ii9kaWQ6Y2hlcWQ6dGVzdG5ldDpmNDFlNDhjYy0wYWI0LTQ3NTAtOWJhOS02ZmY5ZTVjODAwNmMvcmVzb3VyY2VzLyJ9LCJzdWIiOiJkaWQ6a2V5Ono2TWtyTXNwd3lFMXoyWGtmY0RhZlhBaGdLWUo4bmJTTkNmWnpCOFdpWmN2ckxrRiIsIm5iZiI6MTY3OTQwNTA0NCwiaXNzIjoiZGlkOmNoZXFkOm1haW5uZXQ6ODc5MDg2OWUtNjI0Yy00MzI1LTk4ZGYtYzMwZTBlNDczMjI4In0.3qOT0wdQ5IHDVlL2TgQ7svxn-z-pXkMWqmHpCIMZK5E_WBgQiCZnwIymWiiPaPBVLsh-vkxKewP6WQTbx0QGBQ", + "policies": {}, + "verifiableCredential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://veramo.io/contexts/profile/v1" + ], + "type": [ + "VerifiableCredential" + ], + "issuer": { + "id": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228" + }, + "credentialSubject": { + "id": "did:key:z6MkrMspwyE1z2XkfcDafXAhgKYJ8nbSNCfZzB8WiZcvrLkF" + }, + "issuanceDate": "2023-03-21T13:24:04.305Z", + "reservationId": "123", + "reservationStatus": "https://schema.org/ReservationConfirmed", + "provider": { + "brand": "EventBrite", + "image": "/did:cheqd:testnet:f41e48cc-0ab4-4750-9ba9-6ff9e5c8006c/resources/" + }, + "reservationFor": { + "@type": "Event", + "name": "Internet Identity Workshop IIWXXXV", + "startDate": "2022-11-16T16:00:00", + "endDate": "2022-11-18T00:00:00", + "location": "Computer History Museum, 1401 N Shoreline Blvd, Mountain View, CA 94043", + "logo": "/did:cheqd:testnet:f41e48cc-0ab4-4750-9ba9-6ff9e5c8006c/resources/" + }, + "sub": "did:key:z6MkrMspwyE1z2XkfcDafXAhgKYJ8nbSNCfZzB8WiZcvrLkF", + "nbf": 1679405044, + "iss": "did:cheqd:mainnet:8790869e-624c-4325-98df-c30e0e473228", + "proof": { + "type": "JwtProof2020", + "jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vdmVyYW1vLmlvL2NvbnRleHRzL3Byb2ZpbGUvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDprZXk6ejZNa3JNc3B3eUUxejJYa2ZjRGFmWEFoZ0tZSjhuYlNOQ2ZaekI4V2laY3ZyTGtGIn19LCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vdmVyYW1vLmlvL2NvbnRleHRzL3Byb2ZpbGUvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJpc3N1ZXIiOnsiaWQiOiJkaWQ6Y2hlcWQ6bWFpbm5ldDo4NzkwODY5ZS02MjRjLTQzMjUtOThkZi1jMzBlMGU0NzMyMjgifSwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6a2V5Ono2TWtyTXNwd3lFMXoyWGtmY0RhZlhBaGdLWUo4bmJTTkNmWnpCOFdpWmN2ckxrRiJ9LCJpc3N1YW5jZURhdGUiOiIyMDIzLTAzLTIxVDEzOjI0OjA0LjMwNVoiLCJyZXNlcnZhdGlvbklkIjoiMTIzIiwicmVzZXJ2YXRpb25TdGF0dXMiOiJodHRwczovL3NjaGVtYS5vcmcvUmVzZXJ2YXRpb25Db25maXJtZWQiLCJwcm92aWRlciI6eyJicmFuZCI6IkV2ZW50QnJpdGUiLCJpbWFnZSI6Ii9kaWQ6Y2hlcWQ6dGVzdG5ldDpmNDFlNDhjYy0wYWI0LTQ3NTAtOWJhOS02ZmY5ZTVjODAwNmMvcmVzb3VyY2VzLyJ9LCJyZXNlcnZhdGlvbkZvciI6eyJAdHlwZSI6IkV2ZW50IiwibmFtZSI6IkludGVybmV0IElkZW50aXR5IFdvcmtzaG9wIElJV1hYWFYiLCJzdGFydERhdGUiOiIyMDIyLTExLTE2VDE2OjAwOjAwIiwiZW5kRGF0ZSI6IjIwMjItMTEtMThUMDA6MDA6MDAiLCJsb2NhdGlvbiI6IkNvbXB1dGVyIEhpc3RvcnkgTXVzZXVtLCAxNDAxIE4gU2hvcmVsaW5lIEJsdmQsIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIiwibG9nbyI6Ii9kaWQ6Y2hlcWQ6dGVzdG5ldDpmNDFlNDhjYy0wYWI0LTQ3NTAtOWJhOS02ZmY5ZTVjODAwNmMvcmVzb3VyY2VzLyJ9LCJzdWIiOiJkaWQ6a2V5Ono2TWtyTXNwd3lFMXoyWGtmY0RhZlhBaGdLWUo4bmJTTkNmWnpCOFdpWmN2ckxrRiIsIm5iZiI6MTY3OTQwNTA0NCwiaXNzIjoiZGlkOmNoZXFkOm1haW5uZXQ6ODc5MDg2OWUtNjI0Yy00MzI1LTk4ZGYtYzMwZTBlNDczMjI4In0.3qOT0wdQ5IHDVlL2TgQ7svxn-z-pXkMWqmHpCIMZK5E_WBgQiCZnwIymWiiPaPBVLsh-vkxKewP6WQTbx0QGBQ" + } + } + } + } + } + } +} \ No newline at end of file From de509b5226347c8d7f98a0f9861dad601a2907a3 Mon Sep 17 00:00:00 2001 From: DaevMithran Date: Wed, 22 Mar 2023 13:25:04 +0530 Subject: [PATCH 2/2] build: Update dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bbfd58bb..18b13484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,9 @@ ENV RESOLVER_URL ${RESOLVER_URL} # We don't have the node_modules directory # this image only has the output worker.js file. -RUN chown -R node:node /home/node/app && \ +# Install pre-requisites +RUN npm install swagger-ui-express@4.5.0 && \ + chown -R node:node /home/node/app && \ apk update && \ apk add --no-cache bash ca-certificates