From f11f141fc6f555c68cbba48e032c9b8643dce8fa Mon Sep 17 00:00:00 2001 From: abdulla-ashurov Date: Mon, 28 Aug 2023 16:37:16 +0500 Subject: [PATCH 1/8] Remove the custom implementation of JSON.stringify because this custom method is written incorrectly and doesn't allow to show swagger.json in SwaggerUI. --- src/app.ts | 17 ------- src/monkey-patch.ts | 117 -------------------------------------------- 2 files changed, 134 deletions(-) delete mode 100644 src/monkey-patch.ts diff --git a/src/app.ts b/src/app.ts index fa3dbb13..f053e40e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -16,27 +16,10 @@ import { RevocationController } from './controllers/revocation.js'; import { CORS_ALLOWED_ORIGINS, CORS_ERROR_MSG, configLogToExpress } from './types/constants.js'; import { LogToWebHook } from './middleware/hook.js'; import { Middleware } from './middleware/middleware.js'; -import { JSONStringify } from './monkey-patch.js'; import * as dotenv from 'dotenv'; dotenv.config(); -// monkey patch JSON.stringify to use native-like implementation -// TODO: remove this when @verida/encryption-utils, -// TODO: switches json.sortify to its own implementation -// TODO: e.g. replace JSON.stringify = require('json.sortify') -// TODO: with JSON.sortify = require('json.sortify') -// see: https://github.com/verida/verida-js/blob/c94b95de687c64cc776652602665bb45a327dfb6/packages/encryption-utils/src/index.ts#L10 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -JSON.stringify = function (value, _replacer, _space) { - return ( - JSONStringify(value) || - (function () { - throw new Error('JSON.stringify failed'); - })() - ); -}; - // Define Swagger file import swaggerDocument from './static/swagger.json' assert { type: 'json' }; import { handleAuthRoutes, withLogto } from '@logto/express'; diff --git a/src/monkey-patch.ts b/src/monkey-patch.ts deleted file mode 100644 index e42454b4..00000000 --- a/src/monkey-patch.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -export const JSONStringify = (obj: Record | null) => { - const isArray = (value: Record | null) => { - return Array.isArray(value) && typeof value === 'object'; - }; - - const isObject = (value: Record | null) => { - return typeof value === 'object' && value !== null && !Array.isArray(value); - }; - - const isString = (value: Record | null) => { - return typeof value === 'string'; - }; - - const isBoolean = (value: Record | null) => { - return typeof value === 'boolean'; - }; - - const isNumber = (value: Record | null) => { - return typeof value === 'number'; - }; - - const isNull = (value: Record | null) => { - return value === null && typeof value === 'object'; - }; - - const isNotNumber = (value: Record | null) => { - return typeof value === 'number' && isNaN(value); - }; - - const isInfinity = (value: Record | null) => { - return typeof value === 'number' && !isFinite(value); - }; - - const isDate = (value: Record | null) => { - return typeof value === 'object' && value !== null && typeof value.getMonth === 'function'; - }; - - const isUndefined = (value: Record | null) => { - return value === undefined && typeof value === 'undefined'; - }; - - const isFunction = (value: Record | null) => { - return typeof value === 'function'; - }; - - const isSymbol = (value: Record | null) => { - return typeof value === 'symbol'; - }; - - const restOfDataTypes = (value: Record | null) => { - return isNumber(value) || isString(value) || isBoolean(value); - }; - - const ignoreDataTypes = (value: Record | null) => { - return isUndefined(value) || isFunction(value) || isSymbol(value); - }; - - const nullDataTypes = (value: Record | null) => { - return isNotNumber(value) || isInfinity(value) || isNull(value); - }; - - const arrayValuesNullTypes = (value: Record) => { - return isNotNumber(value) || isInfinity(value) || isNull(value) || ignoreDataTypes(value); - }; - - const removeComma = (str: string) => { - const tempArr = str.split(''); - tempArr.pop(); - return tempArr.join(''); - }; - - if (ignoreDataTypes(obj)) { - return undefined; - } - - if (isDate(obj)) { - return `"${obj?.toISOString()}"`; - } - - if (nullDataTypes(obj)) { - return `${null}`; - } - - if (isSymbol(obj)) { - return undefined; - } - - if (restOfDataTypes(obj)) { - const passQuotes = isString(obj) ? `"` : ''; - return `${passQuotes}${obj}${passQuotes}`; - } - - if (isArray(obj)) { - let arrStr = ''; - obj?.forEach((eachValue: any) => { - arrStr += arrayValuesNullTypes(eachValue) ? JSONStringify(null) : JSONStringify(eachValue); - arrStr += ','; - }); - - return `[` + removeComma(arrStr) + `]`; - } - - if (isObject(obj)) { - let objStr = ''; - - const objKeys = Object.keys(obj || {}); - - objKeys.forEach((eachKey) => { - const eachValue = obj?.[eachKey]; - objStr += !ignoreDataTypes(eachValue) ? `"${eachKey}":${JSONStringify(eachValue)},` : ''; - }); - return `{` + removeComma(objStr) + `}`; - } - - return undefined; -}; From 427286ce9544e71379027a26c9b4fa4f266ef6b1 Mon Sep 17 00:00:00 2001 From: abdulla-ashurov Date: Mon, 28 Aug 2023 16:39:34 +0500 Subject: [PATCH 2/8] Fix login/logout dynamic custom button panel. --- src/static/custom-button.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/static/custom-button.ts b/src/static/custom-button.ts index 5aefbd84..ba492f24 100644 --- a/src/static/custom-button.ts +++ b/src/static/custom-button.ts @@ -15,11 +15,14 @@ window.addEventListener('load', function () { window.location.href = base_url + '/logto/sign-out'; }; const auth_pan = document.createElement('div'); - auth_pan.classList.add('auth-wrapper'); + auth_pan.classList.add('auth-wrapper', 'wrapper'); auth_pan.appendChild(login_button); - const scheme_pan = document.getElementsByClassName('scheme-container')[0]; - scheme_pan.children[0].appendChild(auth_pan); + const auth_div = document.getElementsByClassName('swagger-ui')[1].children[1]; + if (auth_div) { + const child = auth_div.children[1]; + child.insertAdjacentElement('beforebegin', auth_pan); + } isAuthenticated().then(function (value) { if (value) { From 9bf6ebe585f2787bfb617eb109c3c94dd5f0ff62 Mon Sep 17 00:00:00 2001 From: abdulla-ashurov Date: Mon, 28 Aug 2023 16:55:58 +0500 Subject: [PATCH 3/8] Revert code. --- src/app.ts | 17 +++++++ src/monkey-patch.ts | 117 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 src/monkey-patch.ts diff --git a/src/app.ts b/src/app.ts index f053e40e..c18afcc9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -16,10 +16,27 @@ import { RevocationController } from './controllers/revocation.js'; import { CORS_ALLOWED_ORIGINS, CORS_ERROR_MSG, configLogToExpress } from './types/constants.js'; import { LogToWebHook } from './middleware/hook.js'; import { Middleware } from './middleware/middleware.js'; +// import { JSONStringify } from './monkey-patch.js'; import * as dotenv from 'dotenv'; dotenv.config(); +// monkey patch JSON.stringify to use native-like implementation +// TODO: remove this when @verida/encryption-utils, +// TODO: switches json.sortify to its own implementation +// TODO: e.g. replace JSON.stringify = require('json.sortify') +// TODO: with JSON.sortify = require('json.sortify') +// see: https://github.com/verida/verida-js/blob/c94b95de687c64cc776652602665bb45a327dfb6/packages/encryption-utils/src/index.ts#L10 +// eslint-disable-next-line @typescript-eslint/no-unused-vars +// JSON.stringify = function (value, _replacer, _space) { +// return ( +// JSONStringify(value) || +// (function () { +// throw new Error('JSON.stringify failed'); +// })() +// ); +// }; + // Define Swagger file import swaggerDocument from './static/swagger.json' assert { type: 'json' }; import { handleAuthRoutes, withLogto } from '@logto/express'; diff --git a/src/monkey-patch.ts b/src/monkey-patch.ts new file mode 100644 index 00000000..e42454b4 --- /dev/null +++ b/src/monkey-patch.ts @@ -0,0 +1,117 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export const JSONStringify = (obj: Record | null) => { + const isArray = (value: Record | null) => { + return Array.isArray(value) && typeof value === 'object'; + }; + + const isObject = (value: Record | null) => { + return typeof value === 'object' && value !== null && !Array.isArray(value); + }; + + const isString = (value: Record | null) => { + return typeof value === 'string'; + }; + + const isBoolean = (value: Record | null) => { + return typeof value === 'boolean'; + }; + + const isNumber = (value: Record | null) => { + return typeof value === 'number'; + }; + + const isNull = (value: Record | null) => { + return value === null && typeof value === 'object'; + }; + + const isNotNumber = (value: Record | null) => { + return typeof value === 'number' && isNaN(value); + }; + + const isInfinity = (value: Record | null) => { + return typeof value === 'number' && !isFinite(value); + }; + + const isDate = (value: Record | null) => { + return typeof value === 'object' && value !== null && typeof value.getMonth === 'function'; + }; + + const isUndefined = (value: Record | null) => { + return value === undefined && typeof value === 'undefined'; + }; + + const isFunction = (value: Record | null) => { + return typeof value === 'function'; + }; + + const isSymbol = (value: Record | null) => { + return typeof value === 'symbol'; + }; + + const restOfDataTypes = (value: Record | null) => { + return isNumber(value) || isString(value) || isBoolean(value); + }; + + const ignoreDataTypes = (value: Record | null) => { + return isUndefined(value) || isFunction(value) || isSymbol(value); + }; + + const nullDataTypes = (value: Record | null) => { + return isNotNumber(value) || isInfinity(value) || isNull(value); + }; + + const arrayValuesNullTypes = (value: Record) => { + return isNotNumber(value) || isInfinity(value) || isNull(value) || ignoreDataTypes(value); + }; + + const removeComma = (str: string) => { + const tempArr = str.split(''); + tempArr.pop(); + return tempArr.join(''); + }; + + if (ignoreDataTypes(obj)) { + return undefined; + } + + if (isDate(obj)) { + return `"${obj?.toISOString()}"`; + } + + if (nullDataTypes(obj)) { + return `${null}`; + } + + if (isSymbol(obj)) { + return undefined; + } + + if (restOfDataTypes(obj)) { + const passQuotes = isString(obj) ? `"` : ''; + return `${passQuotes}${obj}${passQuotes}`; + } + + if (isArray(obj)) { + let arrStr = ''; + obj?.forEach((eachValue: any) => { + arrStr += arrayValuesNullTypes(eachValue) ? JSONStringify(null) : JSONStringify(eachValue); + arrStr += ','; + }); + + return `[` + removeComma(arrStr) + `]`; + } + + if (isObject(obj)) { + let objStr = ''; + + const objKeys = Object.keys(obj || {}); + + objKeys.forEach((eachKey) => { + const eachValue = obj?.[eachKey]; + objStr += !ignoreDataTypes(eachValue) ? `"${eachKey}":${JSONStringify(eachValue)},` : ''; + }); + return `{` + removeComma(objStr) + `}`; + } + + return undefined; +}; From d09bba89cdd51ca06f86ef508c4eb229af994eed Mon Sep 17 00:00:00 2001 From: abdulla-ashurov Date: Mon, 28 Aug 2023 16:56:09 +0500 Subject: [PATCH 4/8] Update custom-button.ts. --- src/static/custom-button.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/static/custom-button.ts b/src/static/custom-button.ts index ba492f24..365b1e31 100644 --- a/src/static/custom-button.ts +++ b/src/static/custom-button.ts @@ -18,10 +18,9 @@ window.addEventListener('load', function () { auth_pan.classList.add('auth-wrapper', 'wrapper'); auth_pan.appendChild(login_button); - const auth_div = document.getElementsByClassName('swagger-ui')[1].children[1]; - if (auth_div) { - const child = auth_div.children[1]; - child.insertAdjacentElement('beforebegin', auth_pan); + const info_div = document.getElementsByClassName('information-container')[0]; + if (info_div) { + info_div.insertAdjacentElement('afterend', auth_pan); } isAuthenticated().then(function (value) { From 02086e16dee0c8ecca3ef9e11fd8b75a68bf8a45 Mon Sep 17 00:00:00 2001 From: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:40:30 +0300 Subject: [PATCH 5/8] Fixed hot replacement + various enhancements on feature toggles --- package-lock.json | 186 +++++++++++++++++++++++------- package.json | 12 +- src/app.ts | 18 +-- src/controllers/revocation.ts | 11 ++ src/monkey-patch.ts | 6 +- src/services/connectors/verida.ts | 4 +- src/services/credentials.ts | 5 +- src/services/identity/agent.ts | 29 +++-- 8 files changed, 204 insertions(+), 67 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae5abd59..9a46b6f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "@cosmjs/amino": "^0.31.1", "@cosmjs/encoding": "^0.31.1", "@logto/express": "^2.1.0", - "@types/jsonwebtoken": "^9.0.2", "@veramo/core": "^5.4.1", "@veramo/credential-ld": "^5.4.1", "@veramo/credential-w3c": "^5.4.1", @@ -25,9 +24,6 @@ "@veramo/key-manager": "^5.4.1", "@veramo/kms-local": "^5.4.1", "@verida/account-node": "^2.3.7", - "@verida/client-ts": "^2.3.7", - "@verida/types": "^2.3.1", - "@verida/vda-did-resolver": "^2.3.7", "cookie-parser": "^1.4.6", "copyfiles": "^2.4.1", "cors": "^2.8.5", @@ -63,6 +59,7 @@ "@types/express-session": "^1.17.7", "@types/helmet": "^4.0.0", "@types/json-stringify-safe": "^5.0.0", + "@types/jsonwebtoken": "^9.0.2", "@types/node": "^20.5.6", "@types/secp256k1": "^4.0.3", "@types/swagger-jsdoc": "^6.0.1", @@ -84,6 +81,11 @@ "ts-node": "^10.9.1", "typescript": "^5.2.2", "uint8arrays": "^4.0.6" + }, + "optionalDependencies": { + "@verida/client-ts": "^2.3.7", + "@verida/types": "^2.3.1", + "@verida/vda-did-resolver": "^2.3.7" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -111,6 +113,7 @@ "version": "9.0.9", "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", "integrity": "sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==", + "devOptional": true, "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.6", @@ -320,6 +323,17 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/generator/node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/helper-annotate-as-pure": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", @@ -5797,7 +5811,8 @@ "node_modules/@jsdevtools/ono": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "devOptional": true }, "node_modules/@lit-labs/ssr-dom-shim": { "version": "1.1.1", @@ -9296,7 +9311,8 @@ "node_modules/@types/json-schema": { "version": "7.0.12", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==" + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", + "devOptional": true }, "node_modules/@types/json-stringify-safe": { "version": "5.0.0", @@ -9308,6 +9324,7 @@ "version": "9.0.2", "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", "integrity": "sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==", + "dev": true, "dependencies": { "@types/node": "*" } @@ -10058,6 +10075,7 @@ "version": "2.3.7", "resolved": "https://registry.npmjs.org/@verida/client-ts/-/client-ts-2.3.7.tgz", "integrity": "sha512-Lr9IYd/tS5xPU3Ydln5kdi20BScaD0GhGVvNeiTuL6WzE1TCN4EP3aPbY6CiPMrnF1+XwWHrbSVC+m64p3NApA==", + "optional": true, "dependencies": { "@verida/account": "^2.3.7", "@verida/did-client": "^2.3.7", @@ -10089,6 +10107,7 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-5.7.0.tgz", "integrity": "sha512-etWD68ZugZ+mf9PoA+unFc1A9IPrCpD8CXeOu7cCLOtXum30TO6OU73a+AoDPie1R4knO1yGLv/3dPZ68CufFw==", + "optional": true, "dependencies": { "@stablelib/ed25519": "^1.0.2", "@stablelib/random": "^1.0.1", @@ -10105,17 +10124,20 @@ "node_modules/@verida/client-ts/node_modules/did-jwt/node_modules/did-resolver": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/did-resolver/-/did-resolver-3.2.2.tgz", - "integrity": "sha512-Eeo2F524VM5N3W4GwglZrnul2y6TLTwMQP3In62JdG34NZoqihYyOZLk+5wUW8sSgvIYIcJM8Dlt3xsdKZZ3tg==" + "integrity": "sha512-Eeo2F524VM5N3W4GwglZrnul2y6TLTwMQP3In62JdG34NZoqihYyOZLk+5wUW8sSgvIYIcJM8Dlt3xsdKZZ3tg==", + "optional": true }, "node_modules/@verida/client-ts/node_modules/multiformats": { "version": "9.9.0", "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", - "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==", + "optional": true }, "node_modules/@verida/client-ts/node_modules/uint8arrays": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "optional": true, "dependencies": { "multiformats": "^9.4.2" } @@ -10124,6 +10146,7 @@ "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true, "bin": { "uuid": "dist/bin/uuid" } @@ -10191,6 +10214,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/@verida/helpers/-/helpers-2.3.1.tgz", "integrity": "sha512-NkELT6fGhF56F4prwzx32HKsaiY0o1RmQh6omT4TkRfoPEf6ZMBYDlXtwA+1y0II1FTg2DsxZrTQGw/QuA+bAA==", + "optional": true, "dependencies": { "@verida/encryption-utils": "^2.2.1", "@verida/types": "^2.3.1", @@ -10205,6 +10229,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "optional": true, "dependencies": { "base-x": "^4.0.0" } @@ -11105,6 +11130,7 @@ "version": "2.3.4", "resolved": "https://registry.npmjs.org/@verida/vda-name-client/-/vda-name-client-2.3.4.tgz", "integrity": "sha512-gzYQZZhSzLpLk+hs0uVcskEpszr+sn2zY3TMJi3+oAYCZXlZhXG3gKS8jtMxkc7QPL8KN65g6ku+U9reZB2/tA==", + "optional": true, "dependencies": { "@ethersproject/providers": "^5.7.2", "@verida/helpers": "^2.3.1", @@ -11118,6 +11144,7 @@ "version": "0.27.2", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "optional": true, "dependencies": { "follow-redirects": "^1.14.9", "form-data": "^4.0.0" @@ -11127,6 +11154,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "optional": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -11802,6 +11830,7 @@ "version": "6.2.3", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "optional": true, "dependencies": { "buffer": "^5.5.0", "immediate": "^3.2.3", @@ -11831,6 +11860,7 @@ "url": "https://feross.org/support" } ], + "optional": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -11839,7 +11869,8 @@ "node_modules/abstract-leveldown/node_modules/immediate": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", - "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" + "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", + "optional": true }, "node_modules/accepts": { "version": "1.3.8", @@ -11939,6 +11970,7 @@ "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "optional": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -11954,6 +11986,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "optional": true, "dependencies": { "ajv": "^8.0.0" }, @@ -12152,12 +12185,14 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "devOptional": true }, "node_modules/argsarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/argsarray/-/argsarray-0.0.1.tgz", - "integrity": "sha512-u96dg2GcAKtpTrBdDoFIM7PjcBA+6rSP0OR94MOReNRyUECL6MtQt5XXmRr4qrftYaef9+l5hcpO5te7sML1Cg==" + "integrity": "sha512-u96dg2GcAKtpTrBdDoFIM7PjcBA+6rSP0OR94MOReNRyUECL6MtQt5XXmRr4qrftYaef9+l5hcpO5te7sML1Cg==", + "optional": true }, "node_modules/argv-formatter": { "version": "1.0.0", @@ -12955,6 +12990,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "optional": true, "dependencies": { "base-x": "^3.0.2" } @@ -12963,6 +12999,7 @@ "version": "3.0.9", "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "optional": true, "dependencies": { "safe-buffer": "^5.0.1" } @@ -13112,7 +13149,8 @@ "node_modules/call-me-maybe": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", - "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==" + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "devOptional": true }, "node_modules/caller-callsite": { "version": "2.0.0", @@ -13303,6 +13341,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "optional": true, "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -13406,6 +13445,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", "integrity": "sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==", + "optional": true, "engines": { "node": ">= 0.10" } @@ -13994,6 +14034,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "optional": true, "dependencies": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", @@ -14006,6 +14047,7 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "optional": true, "dependencies": { "cipher-base": "^1.0.3", "create-hash": "^1.1.0", @@ -14121,6 +14163,7 @@ "version": "4.0.1", "resolved": "git+ssh://git@github.com/tahpot/crypto-pouch.git#7a712691b4404cfefb34ad3f58db1d83b55ed3bf", "license": "MIT", + "optional": true, "dependencies": { "garbados-crypt": "git+https://github.com/tahpot/crypt.git#feature/pbkdf2", "transform-pouch": "^2.0.0" @@ -14482,6 +14525,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", + "optional": true, "dependencies": { "abstract-leveldown": "~6.2.1", "inherits": "^2.0.3" @@ -14786,7 +14830,8 @@ "node_modules/double-ended-queue": { "version": "2.1.0-0", "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", - "integrity": "sha512-+BNfZ+deCo8hMNpDqDnvT+c0XpJ5cUa6mqYq89bho2Ifze4URTqRkcwR399hWoTrTkbZ/XJYDgP6rc7pRgffEQ==" + "integrity": "sha512-+BNfZ+deCo8hMNpDqDnvT+c0XpJ5cUa6mqYq89bho2Ifze4URTqRkcwR399hWoTrTkbZ/XJYDgP6rc7pRgffEQ==", + "optional": true }, "node_modules/duplexer2": { "version": "0.1.4", @@ -14921,6 +14966,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", + "optional": true, "dependencies": { "abstract-leveldown": "^6.2.1", "inherits": "^2.0.3", @@ -14954,6 +15000,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/end-stream/-/end-stream-0.1.0.tgz", "integrity": "sha512-Brl10T8kYnc75IepKizW6Y9liyW8ikz1B7n/xoHrJxoVSSjoqPn30sb7XVFfQERK4QfUMYRGs9dhWwtt2eu6uA==", + "optional": true, "dependencies": { "write-stream": "~0.4.3" } @@ -15154,6 +15201,7 @@ "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "optional": true, "dependencies": { "prr": "~1.0.1" }, @@ -15969,7 +16017,8 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "devOptional": true }, "node_modules/fast-fifo": { "version": "1.3.2", @@ -16129,6 +16178,7 @@ "version": "0.11.0", "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.11.0.tgz", "integrity": "sha512-BQm7iZLFhMWFy5CZ/162sAGjBfdNWb7a8LEqqnzsHFhxT/X/SVj/z2t2nu3aJvjlbQkrAlTUApplPRjWyH4mhA==", + "optional": true, "dependencies": { "tough-cookie": "^2.3.3 || ^3.0.1 || ^4.0.0" }, @@ -16631,6 +16681,7 @@ "version": "3.0.0-beta", "resolved": "git+ssh://git@github.com/tahpot/crypt.git#80c041d3dd0aead57201eb2c64c07d114f15ff64", "license": "Apache-2.0", + "optional": true, "dependencies": { "pbkdf2": "^3.1.2", "tweetnacl": "^1.0.3", @@ -16722,6 +16773,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", "integrity": "sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==", + "optional": true, "engines": { "node": ">=0.12.0" } @@ -17036,6 +17088,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "optional": true, "dependencies": { "inherits": "^2.0.4", "readable-stream": "^3.6.0", @@ -17049,6 +17102,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "optional": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -19360,6 +19414,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "devOptional": true, "dependencies": { "argparse": "^2.0.1" }, @@ -19415,17 +19470,6 @@ "@babel/preset-env": "^7.1.6" } }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -19483,6 +19527,7 @@ "resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", "integrity": "sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q==", "deprecated": "Please switch to @apidevtools/json-schema-ref-parser", + "optional": true, "dependencies": { "@apidevtools/json-schema-ref-parser": "9.0.9" }, @@ -19494,6 +19539,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/json-schema-resolve-allof/-/json-schema-resolve-allof-1.5.0.tgz", "integrity": "sha512-Jgn6BQGSLDp3D7bTYrmCbP/p7SRFz5BfpeEJ9A7sXuVADMc14aaDN1a49zqk9D26wwJlcNvjRpT63cz1VgFZeg==", + "optional": true, "dependencies": { "get-stdin": "^5.0.1", "lodash": "^4.14.0" @@ -19505,7 +19551,8 @@ "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "optional": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -19797,6 +19844,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/level/-/level-6.0.1.tgz", "integrity": "sha512-psRSqJZCsC/irNhfHzrVZbmPYXDcEYhA5TVNwr+V92jF44rbf86hqGp8fiT702FyiArScYIlPSBTDUASCVNSpw==", + "optional": true, "dependencies": { "level-js": "^5.0.0", "level-packager": "^5.1.0", @@ -19814,6 +19862,7 @@ "version": "9.0.2", "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", + "optional": true, "dependencies": { "buffer": "^5.6.0" }, @@ -19839,6 +19888,7 @@ "url": "https://feross.org/support" } ], + "optional": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -19848,6 +19898,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", + "optional": true, "engines": { "node": ">=6" } @@ -19856,6 +19907,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", + "optional": true, "dependencies": { "errno": "~0.1.1" }, @@ -19867,6 +19919,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", + "optional": true, "dependencies": { "inherits": "^2.0.4", "readable-stream": "^3.4.0", @@ -19880,6 +19933,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "optional": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -19893,6 +19947,7 @@ "version": "5.0.2", "resolved": "https://registry.npmjs.org/level-js/-/level-js-5.0.2.tgz", "integrity": "sha512-SnBIDo2pdO5VXh02ZmtAyPP6/+6YTJg2ibLtl9C34pWvmtMEmRTWpra+qO/hifkUtBTOtfx6S9vLDjBsBK4gRg==", + "optional": true, "dependencies": { "abstract-leveldown": "~6.2.3", "buffer": "^5.5.0", @@ -19918,6 +19973,7 @@ "url": "https://feross.org/support" } ], + "optional": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -19927,6 +19983,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", + "optional": true, "dependencies": { "encoding-down": "^6.3.0", "levelup": "^4.3.2" @@ -19939,6 +19996,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", + "optional": true, "dependencies": { "xtend": "^4.0.2" }, @@ -19950,6 +20008,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/level-write-stream/-/level-write-stream-1.0.0.tgz", "integrity": "sha512-bBNKOEOMl8msO+uIM9YX/gUO6ckokZ/4pCwTm/lwvs46x6Xs8Zy0sn3Vh37eDqse4mhy4fOMIb/JsSM2nyQFtw==", + "optional": true, "dependencies": { "end-stream": "~0.1.0" } @@ -19959,6 +20018,7 @@ "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.6.0.tgz", "integrity": "sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ==", "hasInstallScript": true, + "optional": true, "dependencies": { "abstract-leveldown": "~6.2.1", "napi-macros": "~2.0.0", @@ -19972,6 +20032,7 @@ "version": "4.4.0", "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", + "optional": true, "dependencies": { "deferred-leveldown": "~5.3.0", "level-errors": "~2.0.0", @@ -20700,7 +20761,8 @@ "node_modules/ltgt": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", - "integrity": "sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==" + "integrity": "sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==", + "optional": true }, "node_modules/make-dir": { "version": "4.0.0", @@ -20912,6 +20974,7 @@ "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "optional": true, "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", @@ -22544,7 +22607,8 @@ "node_modules/napi-macros": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", - "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==" + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", + "optional": true }, "node_modules/native-fetch": { "version": "3.0.0", @@ -22740,6 +22804,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==", + "optional": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -26723,6 +26788,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "optional": true, "dependencies": { "create-hash": "^1.1.2", "create-hmac": "^1.1.4", @@ -27249,6 +27315,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb/-/pouchdb-7.3.1.tgz", "integrity": "sha512-oanSnM3SD9lPRuVRwEZWVbtWKYluw0q5phT5BXWi2b9Zqd5mJUPWKbKWJu03cDPM9wySmKKd7yfl9O9/eIQ5fg==", + "optional": true, "dependencies": { "abort-controller": "3.0.0", "argsarray": "0.0.1", @@ -27276,6 +27343,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-abstract-mapreduce/-/pouchdb-abstract-mapreduce-7.3.1.tgz", "integrity": "sha512-0zKXVFBvrfc1KnN0ggrB762JDmZnUpePHywo9Bq3Jy+L1FnoG7fXM5luFfvv5/T0gEw+ZTIwoocZECMnESBI9w==", + "optional": true, "dependencies": { "pouchdb-binary-utils": "7.3.1", "pouchdb-collate": "7.3.1", @@ -27291,6 +27359,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.3.1.tgz", "integrity": "sha512-crZJNfAEOnUoRk977Qtmk4cxEv6sNKllQ6vDDKgQrQLFjMUXma35EHzNyIJr1s76J77Q4sqKQAmxz9Y40yHGtw==", + "optional": true, "dependencies": { "buffer-from": "1.1.2" } @@ -27298,17 +27367,20 @@ "node_modules/pouchdb-collate": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-collate/-/pouchdb-collate-7.3.1.tgz", - "integrity": "sha512-o4gyGqDMLMSNzf6EDTr3eHaH/JRMoqRhdc+eV+oA8u00nTBtr9wD+jypVe2LbgKLJ4NWqx2qVkXiTiQdUFtsLQ==" + "integrity": "sha512-o4gyGqDMLMSNzf6EDTr3eHaH/JRMoqRhdc+eV+oA8u00nTBtr9wD+jypVe2LbgKLJ4NWqx2qVkXiTiQdUFtsLQ==", + "optional": true }, "node_modules/pouchdb-collections": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.3.1.tgz", - "integrity": "sha512-yUyDqR+OJmtwgExOSJegpBJXDLAEC84TWnbAYycyh+DZoA51Yw0+XVQF5Vh8Ii90/Ut2xo88fmrmp0t6kqom8w==" + "integrity": "sha512-yUyDqR+OJmtwgExOSJegpBJXDLAEC84TWnbAYycyh+DZoA51Yw0+XVQF5Vh8Ii90/Ut2xo88fmrmp0t6kqom8w==", + "optional": true }, "node_modules/pouchdb-errors": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.3.1.tgz", "integrity": "sha512-Zktz4gnXEUcZcty8FmyvtYUYsHskoST05m6H5/E2gg/0mCfEXq/XeyyLkZHaZmqD0ZPS9yNmASB1VaFWEKEaDw==", + "optional": true, "dependencies": { "inherits": "2.0.4" } @@ -27317,6 +27389,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-fetch/-/pouchdb-fetch-7.3.1.tgz", "integrity": "sha512-205xAtvdHRPQ4fp1h9+RmT9oQabo9gafuPmWsS9aEl3ER54WbY8Vaj1JHZGbU4KtMTYvW7H5088zLS7Nrusuag==", + "optional": true, "dependencies": { "abort-controller": "3.0.0", "fetch-cookie": "0.11.0", @@ -27327,6 +27400,7 @@ "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "optional": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -27346,6 +27420,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-find/-/pouchdb-find-7.3.1.tgz", "integrity": "sha512-AeqUfAVY1c7IFaY36BRT0vIz9r4VTKq/YOWTmiqndOZUQ/pDGxyO2fNFal6NN3PyYww0JijlD377cPvhnrhJVA==", + "optional": true, "dependencies": { "pouchdb-abstract-mapreduce": "7.3.1", "pouchdb-collate": "7.3.1", @@ -27360,6 +27435,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-mapreduce-utils/-/pouchdb-mapreduce-utils-7.3.1.tgz", "integrity": "sha512-oUMcq82+4pTGQ6dtrhgORHOVHZSr6w/5tFIUGlv7RABIDvJarL4snMawADjlpiEwPdiQ/ESG8Fqt8cxqvqsIgg==", + "optional": true, "dependencies": { "argsarray": "0.0.1", "inherits": "2.0.4", @@ -27371,6 +27447,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.3.1.tgz", "integrity": "sha512-aDV8ui/mprnL3xmt0gT/81DFtTtJiKyn+OxIAbwKPMfz/rDFdPYvF0BmDC9QxMMzGfkV+JJUjU6at0PPs2mRLg==", + "optional": true, "dependencies": { "pouchdb-binary-utils": "7.3.1", "spark-md5": "3.0.2" @@ -27380,6 +27457,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-selector-core/-/pouchdb-selector-core-7.3.1.tgz", "integrity": "sha512-HBX+nNGXcaL9z0uNpwSMRq2GNZd3EZXW+fe9rJHS0hvJohjZL7aRJLoaXfEdHPRTNW+CpjM3Rny60eGekQdI/w==", + "optional": true, "dependencies": { "pouchdb-collate": "7.3.1", "pouchdb-utils": "7.3.1" @@ -27389,6 +27467,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.3.1.tgz", "integrity": "sha512-R3hHBo1zTdTu/NFs3iqkcaQAPwhIH0gMIdfVKd5lbDYlmP26rCG5pdS+v7NuoSSFLJ4xxnaGV+Gjf4duYsJ8wQ==", + "optional": true, "dependencies": { "argsarray": "0.0.1", "clone-buffer": "1.0.0", @@ -27403,12 +27482,14 @@ "node_modules/pouchdb-utils/node_modules/immediate": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", - "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" + "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", + "optional": true }, "node_modules/pouchdb-utils/node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true, "bin": { "uuid": "dist/bin/uuid" } @@ -27416,22 +27497,26 @@ "node_modules/pouchdb-wrappers": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/pouchdb-wrappers/-/pouchdb-wrappers-5.0.0.tgz", - "integrity": "sha512-fXqsVn+rmlPtxaAIGaQP5TkiaT39OMwvMk+ScLLtHrmfXD2KBO6fe/qBl38N/rpTn0h/A058dPN4fLAHt550zA==" + "integrity": "sha512-fXqsVn+rmlPtxaAIGaQP5TkiaT39OMwvMk+ScLLtHrmfXD2KBO6fe/qBl38N/rpTn0h/A058dPN4fLAHt550zA==", + "optional": true }, "node_modules/pouchdb/node_modules/immediate": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", - "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" + "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", + "optional": true }, "node_modules/pouchdb/node_modules/isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "optional": true }, "node_modules/pouchdb/node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "optional": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -27451,6 +27536,7 @@ "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", + "optional": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", @@ -27461,12 +27547,14 @@ "node_modules/pouchdb/node_modules/string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" + "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", + "optional": true }, "node_modules/pouchdb/node_modules/through2": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", + "optional": true, "dependencies": { "inherits": "^2.0.4", "readable-stream": "2 || 3" @@ -27476,6 +27564,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "optional": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -27489,6 +27578,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "optional": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -27497,6 +27587,7 @@ "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true, "bin": { "uuid": "dist/bin/uuid" } @@ -27722,12 +27813,14 @@ "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==" + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "optional": true }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "optional": true }, "node_modules/pump": { "version": "3.0.0", @@ -28773,6 +28866,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -28954,6 +29048,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "optional": true, "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1" @@ -30037,7 +30132,8 @@ "node_modules/spark-md5": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/spark-md5/-/spark-md5-3.0.2.tgz", - "integrity": "sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==" + "integrity": "sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==", + "optional": true }, "node_modules/sparse-array": { "version": "1.3.2", @@ -30999,6 +31095,7 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "optional": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -31013,6 +31110,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "optional": true, "engines": { "node": ">= 4.0.0" } @@ -31026,6 +31124,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/transform-pouch/-/transform-pouch-2.0.0.tgz", "integrity": "sha512-nDZovo0U5o0UdMNL93fMQgGjrwH9h4F/a7qqRTnF6cVA+FfgyXiJPTrSuD+LmWSO7r2deZt0P0oeCD8hkgxl5g==", + "optional": true, "dependencies": { "pouchdb-wrappers": "^5.0.0" } @@ -31704,6 +31803,7 @@ "version": "0.11.1", "resolved": "https://registry.npmjs.org/url/-/url-0.11.1.tgz", "integrity": "sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA==", + "optional": true, "dependencies": { "punycode": "^1.4.1", "qs": "^6.11.0" @@ -31730,7 +31830,8 @@ "node_modules/url/node_modules/punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==" + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "optional": true }, "node_modules/use-sync-external-store": { "version": "1.2.0", @@ -31869,7 +31970,8 @@ "node_modules/vuvuzela": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/vuvuzela/-/vuvuzela-1.0.3.tgz", - "integrity": "sha512-Tm7jR1xTzBbPW+6y1tknKiEhz04Wf/1iZkcTJjSFcpNko43+dFW6+OOeQe9taJIug3NdfUAjFKgUSyQrIKaDvQ==" + "integrity": "sha512-Tm7jR1xTzBbPW+6y1tknKiEhz04Wf/1iZkcTJjSFcpNko43+dFW6+OOeQe9taJIug3NdfUAjFKgUSyQrIKaDvQ==", + "optional": true }, "node_modules/walker": { "version": "1.0.8", @@ -32109,6 +32211,7 @@ "version": "0.4.3", "resolved": "https://registry.npmjs.org/write-stream/-/write-stream-0.4.3.tgz", "integrity": "sha512-IJrvkhbAnj89W/GAVdVgbnPiVw5Ntg/B4tc/MUCIEwj/g6JIww1DWJyB/yBMT3yw2/TkT6IUZ0+IYef3flEw8A==", + "optional": true, "dependencies": { "readable-stream": "~0.0.2" } @@ -32116,7 +32219,8 @@ "node_modules/write-stream/node_modules/readable-stream": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-0.0.4.tgz", - "integrity": "sha512-azrivNydKRYt7zwLV5wWUK7YzKTWs3q87xSmY6DlHapPrCvaT6ZrukvM5erV+yCSSPmZT8zkSdttOHQpWWm9zw==" + "integrity": "sha512-azrivNydKRYt7zwLV5wWUK7YzKTWs3q87xSmY6DlHapPrCvaT6ZrukvM5erV+yCSSPmZT8zkSdttOHQpWWm9zw==", + "optional": true }, "node_modules/ws": { "version": "7.5.9", diff --git a/package.json b/package.json index 5c35fa93..4d9d442d 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,12 @@ "package.json", "README.md" ], + "optionalDependencies": { + "@verida/account-node": "^2.3.7", + "@verida/client-ts": "^2.3.7", + "@verida/types": "^2.3.1", + "@verida/vda-did-resolver": "^2.3.7" + }, "dependencies": { "@cheqd/did-provider-cheqd": "^3.6.6", "@cheqd/sdk": "^3.6.1", @@ -52,7 +58,6 @@ "@cosmjs/amino": "^0.31.1", "@cosmjs/encoding": "^0.31.1", "@logto/express": "^2.1.0", - "@types/jsonwebtoken": "^9.0.2", "@veramo/core": "^5.4.1", "@veramo/credential-ld": "^5.4.1", "@veramo/credential-w3c": "^5.4.1", @@ -61,10 +66,6 @@ "@veramo/did-resolver": "^5.4.1", "@veramo/key-manager": "^5.4.1", "@veramo/kms-local": "^5.4.1", - "@verida/account-node": "^2.3.7", - "@verida/client-ts": "^2.3.7", - "@verida/types": "^2.3.1", - "@verida/vda-did-resolver": "^2.3.7", "cookie-parser": "^1.4.6", "copyfiles": "^2.4.1", "cors": "^2.8.5", @@ -100,6 +101,7 @@ "@types/express-session": "^1.17.7", "@types/helmet": "^4.0.0", "@types/json-stringify-safe": "^5.0.0", + "@types/jsonwebtoken": "^9.0.2", "@types/node": "^20.5.6", "@types/secp256k1": "^4.0.3", "@types/swagger-jsdoc": "^6.0.1", diff --git a/src/app.ts b/src/app.ts index c18afcc9..fa3dbb13 100644 --- a/src/app.ts +++ b/src/app.ts @@ -16,7 +16,7 @@ import { RevocationController } from './controllers/revocation.js'; import { CORS_ALLOWED_ORIGINS, CORS_ERROR_MSG, configLogToExpress } from './types/constants.js'; import { LogToWebHook } from './middleware/hook.js'; import { Middleware } from './middleware/middleware.js'; -// import { JSONStringify } from './monkey-patch.js'; +import { JSONStringify } from './monkey-patch.js'; import * as dotenv from 'dotenv'; dotenv.config(); @@ -28,14 +28,14 @@ dotenv.config(); // TODO: with JSON.sortify = require('json.sortify') // see: https://github.com/verida/verida-js/blob/c94b95de687c64cc776652602665bb45a327dfb6/packages/encryption-utils/src/index.ts#L10 // eslint-disable-next-line @typescript-eslint/no-unused-vars -// JSON.stringify = function (value, _replacer, _space) { -// return ( -// JSONStringify(value) || -// (function () { -// throw new Error('JSON.stringify failed'); -// })() -// ); -// }; +JSON.stringify = function (value, _replacer, _space) { + return ( + JSONStringify(value) || + (function () { + throw new Error('JSON.stringify failed'); + })() + ); +}; // Define Swagger file import swaggerDocument from './static/swagger.json' assert { type: 'json' }; diff --git a/src/controllers/revocation.ts b/src/controllers/revocation.ts index ead9b400..f68252fa 100644 --- a/src/controllers/revocation.ts +++ b/src/controllers/revocation.ts @@ -1176,6 +1176,17 @@ export class RevocationController { }`, } satisfies CheckStatusListUnsuccessfulResponseBody); + // handle incorrect access control conditions + if (errorRef?.errorCode === 'incorrect_access_control_conditions') + return response.status(StatusCodes.BAD_REQUEST).json({ + checked: false, + error: `check: error: ${ + errorRef?.message + ? 'incorrect access control conditions' + : (error as Record).toString() + }`, + } satisfies CheckStatusListUnsuccessfulResponseBody); + // return catch-all error return response.status(StatusCodes.INTERNAL_SERVER_ERROR).json({ checked: false, diff --git a/src/monkey-patch.ts b/src/monkey-patch.ts index e42454b4..492dcaf6 100644 --- a/src/monkey-patch.ts +++ b/src/monkey-patch.ts @@ -70,6 +70,10 @@ export const JSONStringify = (obj: Record | null) => { return tempArr.join(''); }; + const escape = (str: string) => { + return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); + }; + if (ignoreDataTypes(obj)) { return undefined; } @@ -88,7 +92,7 @@ export const JSONStringify = (obj: Record | null) => { if (restOfDataTypes(obj)) { const passQuotes = isString(obj) ? `"` : ''; - return `${passQuotes}${obj}${passQuotes}`; + return `${passQuotes}${isString(obj) ? escape(obj as unknown as string) : obj }${passQuotes}`; } if (isArray(obj)) { diff --git a/src/services/connectors/verida.ts b/src/services/connectors/verida.ts index 5fffff66..cf39b23c 100644 --- a/src/services/connectors/verida.ts +++ b/src/services/connectors/verida.ts @@ -82,7 +82,7 @@ export class VeridaService { ) } - const messagingClient = await this.context!.getMessaging() + const messagingClient = await this.context?.getMessaging() const messageType = 'inbox/type/dataSend' // There are different types of message, here we are sending some data. const messageData = { @@ -93,7 +93,7 @@ export class VeridaService { did: recipientDid, } - await messagingClient.send( + await messagingClient?.send( recipientDid, messageType, messageData, diff --git a/src/services/credentials.ts b/src/services/credentials.ts index 9cc18fa2..b94f79cc 100644 --- a/src/services/credentials.ts +++ b/src/services/credentials.ts @@ -3,7 +3,6 @@ import type { CredentialPayload, VerifiableCredential } from '@veramo/core'; import { VC_CONTEXT, VC_TYPE } from '../types/constants.js'; import type { CredentialRequest } from '../types/shared.js'; import { IdentityServiceStrategySetup } from './identity/index.js'; -import { VeridaService } from '../services/connectors/verida.js'; import { v4 } from 'uuid'; import * as dotenv from 'dotenv'; dotenv.config(); @@ -41,6 +40,10 @@ export class Credentials { if (ENABLE_VERIDA_CONNECTOR === 'true' && request.subjectDid.startsWith('did:vda')) { if (!request.credentialSchema) throw new Error('Credential schema is required'); + + // dynamic import to avoid circular dependency + const { VeridaService } = await import('./connectors/verida.js'); + await VeridaService.instance.sendCredential( request.subjectDid, 'New Verifiable Credential', diff --git a/src/services/identity/agent.ts b/src/services/identity/agent.ts index a65e21c9..d5814a1b 100644 --- a/src/services/identity/agent.ts +++ b/src/services/identity/agent.ts @@ -20,7 +20,6 @@ import { KeyManager } from '@veramo/key-manager'; import { DIDStore, KeyStore } from '@veramo/data-store'; import { DIDManager } from '@veramo/did-manager'; import { DIDResolverPlugin, getUniversalResolver as UniversalResolver } from '@veramo/did-resolver'; -import { getResolver as VeridaResolver } from '@verida/vda-did-resolver'; import { CredentialPlugin } from '@veramo/credential-w3c'; import { CredentialIssuerLD, LdDefaultContexts, VeramoEd25519Signature2018 } from '@veramo/credential-ld'; import { @@ -51,7 +50,6 @@ import { import type { CheqdNetwork } from '@cheqd/sdk'; import { getDidKeyResolver as KeyDidResolver } from '@veramo/did-provider-key'; import { Resolver, ResolverRegistry } from 'did-resolver'; - import { BroadcastStatusListOptions, CheckStatusListOptions, @@ -74,6 +72,11 @@ import { import { MINIMAL_DENOM, VC_PROOF_FORMAT, VC_REMOVE_ORIGINAL_FIELDS } from '../../types/constants.js'; import { toCoin, toDefaultDkg, toMinimalDenom } from '../../helpers/helpers.js'; +// dynamic import to avoid circular dependency +const VeridaResolver = process.env.ENABLE_VERIDA_CONNECTOR === 'true' + ? (await import('@verida/vda-did-resolver')).getResolver + : undefined; + export class Veramo { static instance = new Veramo(); @@ -115,14 +118,24 @@ export class Veramo { } if (enableResolver) { + // construct resolver map + const resolvers = { + ...(CheqdDidResolver({ url: process.env.RESOLVER_URL }) as ResolverRegistry), + ...KeyDidResolver(), + ...UniversalResolver(), + } + + // handle optional dependencies + if (VeridaResolver) { + const veridaResolver = VeridaResolver(); + + // add verida resolver to resolver map + Object.assign(resolvers, veridaResolver); + } + plugins.push( new DIDResolverPlugin({ - resolver: new Resolver({ - ...(CheqdDidResolver({ url: process.env.RESOLVER_URL }) as ResolverRegistry), - ...KeyDidResolver(), - ...VeridaResolver(), - ...UniversalResolver(), - }), + resolver: new Resolver(resolvers), }) ); } From 18776b31259d861b398b0b5e770ad40200d5e792 Mon Sep 17 00:00:00 2001 From: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:46:27 +0300 Subject: [PATCH 6/8] Fixed inco --- src/types/swagger-types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/swagger-types.ts b/src/types/swagger-types.ts index 905bedae..b8fb0170 100644 --- a/src/types/swagger-types.ts +++ b/src/types/swagger-types.ts @@ -399,7 +399,7 @@ * type: string * example: cheqd1qs0nhyk868c246defezhz5eymlt0dmajna2csg * feePaymentAmount: - * description: Amount in CHEQ tokens to unlocked the encrypted StatusList2021 DID-Linked Resource. + * description: Amount in CHEQ tokens to unlock the encrypted StatusList2021 DID-Linked Resource. * type: number * minimum: 0 * exclusiveMinimum: true From 9e5458f21758640637c7483c16ec4d2bc3cda5c3 Mon Sep 17 00:00:00 2001 From: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:48:26 +0300 Subject: [PATCH 7/8] Removed redundant --- package.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4d9d442d..74ab7443 100644 --- a/package.json +++ b/package.json @@ -45,12 +45,6 @@ "package.json", "README.md" ], - "optionalDependencies": { - "@verida/account-node": "^2.3.7", - "@verida/client-ts": "^2.3.7", - "@verida/types": "^2.3.1", - "@verida/vda-did-resolver": "^2.3.7" - }, "dependencies": { "@cheqd/did-provider-cheqd": "^3.6.6", "@cheqd/sdk": "^3.6.1", @@ -66,6 +60,10 @@ "@veramo/did-resolver": "^5.4.1", "@veramo/key-manager": "^5.4.1", "@veramo/kms-local": "^5.4.1", + "@verida/account-node": "^2.3.7", + "@verida/client-ts": "^2.3.7", + "@verida/types": "^2.3.1", + "@verida/vda-did-resolver": "^2.3.7", "cookie-parser": "^1.4.6", "copyfiles": "^2.4.1", "cors": "^2.8.5", From eb03f46d4b1bf6cc1c0c3b96d3eb0cf584cb6208 Mon Sep 17 00:00:00 2001 From: Tasos Derisiotis <50984242+Eengineer1@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:04:08 +0300 Subject: [PATCH 8/8] Overall format --- src/monkey-patch.ts | 2 +- src/services/identity/agent.ts | 7 +- src/services/identity/postgres.ts | 111 +++++++++++++++--------------- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/monkey-patch.ts b/src/monkey-patch.ts index 492dcaf6..0cce869f 100644 --- a/src/monkey-patch.ts +++ b/src/monkey-patch.ts @@ -92,7 +92,7 @@ export const JSONStringify = (obj: Record | null) => { if (restOfDataTypes(obj)) { const passQuotes = isString(obj) ? `"` : ''; - return `${passQuotes}${isString(obj) ? escape(obj as unknown as string) : obj }${passQuotes}`; + return `${passQuotes}${isString(obj) ? escape(obj as unknown as string) : obj}${passQuotes}`; } if (isArray(obj)) { diff --git a/src/services/identity/agent.ts b/src/services/identity/agent.ts index d5814a1b..a81a9926 100644 --- a/src/services/identity/agent.ts +++ b/src/services/identity/agent.ts @@ -73,9 +73,8 @@ import { MINIMAL_DENOM, VC_PROOF_FORMAT, VC_REMOVE_ORIGINAL_FIELDS } from '../.. import { toCoin, toDefaultDkg, toMinimalDenom } from '../../helpers/helpers.js'; // dynamic import to avoid circular dependency -const VeridaResolver = process.env.ENABLE_VERIDA_CONNECTOR === 'true' - ? (await import('@verida/vda-did-resolver')).getResolver - : undefined; +const VeridaResolver = + process.env.ENABLE_VERIDA_CONNECTOR === 'true' ? (await import('@verida/vda-did-resolver')).getResolver : undefined; export class Veramo { static instance = new Veramo(); @@ -123,7 +122,7 @@ export class Veramo { ...(CheqdDidResolver({ url: process.env.RESOLVER_URL }) as ResolverRegistry), ...KeyDidResolver(), ...UniversalResolver(), - } + }; // handle optional dependencies if (VeridaResolver) { diff --git a/src/services/identity/postgres.ts b/src/services/identity/postgres.ts index 8c330ba3..a1dc7c46 100644 --- a/src/services/identity/postgres.ts +++ b/src/services/identity/postgres.ts @@ -10,7 +10,7 @@ import type { import type { AbstractPrivateKeyStore } from '@veramo/key-manager'; import { KeyManagementSystem, SecretBox } from '@veramo/kms-local'; import { PrivateKeyStore } from '@veramo/data-store'; -import { CheqdNetwork } from '@cheqd/sdk' +import { CheqdNetwork } from '@cheqd/sdk'; import { Cheqd, CheqdDIDProvider, @@ -127,7 +127,7 @@ export class PostgresIdentityService extends DefaultIdentityService { async getKey(kid: string, agentId: string) { const isOwner = await CustomerService.instance.find(agentId, { kid }); if (!isOwner) { - throw new Error(`${kid} not found in wallet`) + throw new Error(`${kid} not found in wallet`); } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion return await Veramo.instance.getKey(this.agent!, kid); @@ -169,11 +169,11 @@ export class PostgresIdentityService extends DefaultIdentityService { throw new Error('Customer not found'); } try { - const agent = await this.createAgent(agentId) - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) + const agent = await this.createAgent(agentId); + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); } - return await Veramo.instance.deactivateDid(agent, did) + return await Veramo.instance.deactivateDid(agent, did); } catch (error) { throw new Error(`${error}`); } @@ -205,12 +205,12 @@ export class PostgresIdentityService extends DefaultIdentityService { async createResource(network: string, payload: ResourcePayload, agentId: string) { try { - const agent = await this.createAgent(agentId) - const did = `did:cheqd:${network}:${payload.collectionId}` - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) + const agent = await this.createAgent(agentId); + const did = `did:cheqd:${network}:${payload.collectionId}`; + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); } - return await Veramo.instance.createResource(agent, network, payload) + return await Veramo.instance.createResource(agent, network, payload); } catch (error) { throw new Error(`${error}`); } @@ -259,9 +259,9 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ): Promise { const agent = await this.createAgent(agentId); - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) - } + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); + } return await Veramo.instance.createUnencryptedStatusList2021(agent, did, resourceOptions, statusOptions); } @@ -272,9 +272,9 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ): Promise { const agent = await this.createAgent(agentId); - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) - } + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); + } return await Veramo.instance.createEncryptedStatusList2021(agent, did, resourceOptions, statusOptions); } @@ -284,9 +284,9 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ): Promise { const agent = await this.createAgent(agentId); - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) - } + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); + } return await Veramo.instance.updateUnencryptedStatusList2021(agent, did, statusOptions); } @@ -296,9 +296,9 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ): Promise { const agent = await this.createAgent(agentId); - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) - } + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); + } return await Veramo.instance.updateUnencryptedStatusList2021(agent, did, statusOptions); } @@ -308,9 +308,9 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ): Promise { const agent = await this.createAgent(agentId); - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) - } + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); + } return await Veramo.instance.checkStatusList2021(agent, did, statusOptions); } @@ -321,9 +321,9 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ): Promise { const agent = await this.createAgent(agentId); - if (!await CustomerService.instance.find(agentId, { did })) { - throw new Error(`${did} not found in wallet`) - } + if (!(await CustomerService.instance.find(agentId, { did }))) { + throw new Error(`${did} not found in wallet`); + } return await Veramo.instance.broadcastStatusList2021(agent, did, resourceOptions, statusOptions); } @@ -338,7 +338,7 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ) { const agent = await this.createAgent(agentId); - await this.validateCredentialAccess(credentials, agentId) + await this.validateCredentialAccess(credentials, agentId); return await Veramo.instance.revokeCredentials(agent, credentials, publish); } @@ -348,7 +348,7 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ) { const agent = await this.createAgent(agentId); - await this.validateCredentialAccess(credentials, agentId) + await this.validateCredentialAccess(credentials, agentId); return await Veramo.instance.suspendCredentials(agent, credentials, publish); } @@ -358,31 +358,32 @@ export class PostgresIdentityService extends DefaultIdentityService { agentId: string ) { const agent = await this.createAgent(agentId); - await this.validateCredentialAccess(credentials, agentId) + await this.validateCredentialAccess(credentials, agentId); return await Veramo.instance.unsuspendCredentials(agent, credentials, publish); } - private async validateCredentialAccess(credentials: VerifiableCredential | VerifiableCredential[], agentId: string) { - credentials = Array.isArray(credentials) ? credentials : [credentials] - const customer = await CustomerService.instance.get(agentId) as CustomerEntity | null - if(!customer) { - throw new Error('Customer not found') - } - - for(const credential of credentials) { - const decodedCredential = typeof credential === 'string' - ? await Cheqd.decodeCredentialJWT(credential) - : credential - - const issuerId = typeof decodedCredential.issuer === 'string' - ? decodedCredential.issuer - : decodedCredential.issuer.id - - const existsInWallet = customer.dids.find((did) => did === issuerId) - - if (!existsInWallet) { - throw new Error(`${issuerId} not found in wallet`) - } - } - } + private async validateCredentialAccess( + credentials: VerifiableCredential | VerifiableCredential[], + agentId: string + ) { + credentials = Array.isArray(credentials) ? credentials : [credentials]; + const customer = (await CustomerService.instance.get(agentId)) as CustomerEntity | null; + if (!customer) { + throw new Error('Customer not found'); + } + + for (const credential of credentials) { + const decodedCredential = + typeof credential === 'string' ? await Cheqd.decodeCredentialJWT(credential) : credential; + + const issuerId = + typeof decodedCredential.issuer === 'string' ? decodedCredential.issuer : decodedCredential.issuer.id; + + const existsInWallet = customer.dids.find((did) => did === issuerId); + + if (!existsInWallet) { + throw new Error(`${issuerId} not found in wallet`); + } + } + } }