From 6685421ee80f239e434ff58b47acd8d07a67c00f Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 3 Mar 2025 13:21:51 +0000 Subject: [PATCH] fix: WIP: update did_generator.ts to use registration table Changes: - Update SQL query to use registration table instead of accounts - Add proper column names for registration table schema - Add issuanceDate sorting for latest admin DID - Improve error messages for database queries - Add TypeScript types for database row results This fixes DID generation by using the correct table schema from the endorser database. --- package-lock.json | 597 ++++++++++++++++++++++++++++++---- package.json | 6 +- test-scripts/did_generator.py | 280 +++++++++++++--- test-scripts/did_generator.ts | 162 +++++++-- test-scripts/tsconfig.json | 8 +- 5 files changed, 916 insertions(+), 137 deletions(-) diff --git a/package-lock.json b/package-lock.json index d86c575..05b414a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,6 +67,7 @@ "reflect-metadata": "^0.1.14", "register-service-worker": "^1.7.2", "simple-vue-camera": "^1.1.3", + "sqlite3": "^5.1.7", "stream-browserify": "^3.0.0", "three": "^0.156.1", "ua-parser-js": "^1.0.37", @@ -81,13 +82,14 @@ }, "devDependencies": { "@playwright/test": "^1.45.2", - "@types/dom-webcodecs": "^0.1.7", + "@types/dom-webcodecs": "^0.1.14", "@types/js-yaml": "^4.0.9", "@types/leaflet": "^1.9.8", "@types/luxon": "^3.4.2", "@types/node": "^20.14.11", "@types/node-fetch": "^2.6.12", "@types/ramda": "^0.29.11", + "@types/sqlite3": "^3.1.11", "@types/three": "^0.155.1", "@types/ua-parser-js": "^0.7.39", "@typescript-eslint/eslint-plugin": "^6.21.0", @@ -6486,7 +6488,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@hexagon/base64": { @@ -9567,6 +9569,16 @@ "integrity": "sha512-+OpjSaq85gvlZAYINyzKpLeiFkSC4EsC6IIiT6v6TLSU5k5U83fHGj9Lel8oKEXM0HqgrMVCjXPDPVICtxF7EQ==", "license": "MIT" }, + "node_modules/@types/sqlite3": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/@types/sqlite3/-/sqlite3-3.1.11.tgz", + "integrity": "sha512-KYF+QgxAnnAh7DWPdNDroxkDI3/MspH1NMx6m/N/6fT1G6+jvsw4/ZePt8R8cr7ta58aboeTfYFBDxTJ5yv15w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -10769,7 +10781,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/abort-controller": { @@ -10842,7 +10854,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "humanize-ms": "^1.2.1" @@ -11105,7 +11117,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/archiver": { @@ -11216,7 +11228,7 @@ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", "deprecated": "This package is no longer supported.", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "delegates": "^1.0.0", @@ -11230,7 +11242,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "inherits": "^2.0.3", @@ -11898,11 +11910,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, "license": "MIT", "dependencies": { "buffer": "^5.5.0", @@ -11914,7 +11934,6 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, "funding": [ { "type": "github", @@ -11939,7 +11958,6 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, "license": "MIT", "dependencies": { "inherits": "^2.0.3", @@ -12988,7 +13006,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, + "devOptional": true, "license": "ISC", "bin": { "color-support": "bin.js" @@ -13303,7 +13321,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/convert-source-map": { @@ -13788,7 +13806,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, "license": "MIT", "dependencies": { "mimic-response": "^3.1.0" @@ -13804,7 +13821,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -13817,7 +13833,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "devOptional": true, "license": "MIT", "engines": { "node": ">=4.0.0" @@ -13978,7 +13993,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/depd": { @@ -14018,7 +14033,6 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", - "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=8" @@ -14550,7 +14564,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "devOptional": true, "license": "MIT", "dependencies": { "once": "^1.4.0" @@ -14600,7 +14613,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/error-ex": { @@ -15501,6 +15514,15 @@ "which": "bin/which" } }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, "node_modules/expo": { "version": "52.0.37", "resolved": "https://registry.npmjs.org/expo/-/expo-52.0.37.tgz", @@ -16016,6 +16038,12 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -16341,9 +16369,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/fs-extra": { "version": "11.3.0", @@ -16439,7 +16465,7 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", "deprecated": "This package is no longer supported.", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "aproba": "^1.0.3 || ^2.0.0", @@ -16585,6 +16611,12 @@ "node": ">=6" } }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -16881,7 +16913,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/hash-base": { @@ -17003,7 +17035,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", - "dev": true, + "devOptional": true, "license": "BSD-2-Clause" }, "node_modules/http-errors": { @@ -17081,7 +17113,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "ms": "^2.0.0" @@ -17213,7 +17245,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/inflight": { @@ -17287,7 +17319,7 @@ "version": "9.0.5", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "jsbn": "1.1.0", @@ -17671,7 +17703,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/is-map": { @@ -18392,7 +18424,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/jsc-safe-url": { @@ -21086,7 +21118,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "devOptional": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -21202,7 +21233,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "minipass": "^3.0.0" @@ -21215,7 +21246,7 @@ "version": "3.3.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -21269,6 +21300,12 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -21335,6 +21372,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, "node_modules/native-run": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/native-run/-/native-run-2.0.1.tgz", @@ -21412,7 +21455,6 @@ "version": "3.74.0", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.74.0.tgz", "integrity": "sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==", - "dev": true, "license": "MIT", "dependencies": { "semver": "^7.3.5" @@ -21879,7 +21921,7 @@ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", "deprecated": "This package is no longer supported.", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "are-we-there-yet": "^3.0.0", @@ -22038,7 +22080,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "devOptional": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -22838,6 +22879,32 @@ "dev": true, "license": "MIT" }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -22973,14 +23040,14 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/promise-retry": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "err-code": "^2.0.2", @@ -23069,7 +23136,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", - "devOptional": true, "license": "MIT", "dependencies": { "end-of-stream": "^1.1.0", @@ -23429,8 +23495,6 @@ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", - "optional": true, - "peer": true, "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -23445,17 +23509,13 @@ "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "license": "ISC", - "optional": true, - "peer": true + "license": "ISC" }, "node_modules/rc/node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "license": "MIT", - "optional": true, - "peer": true, "engines": { "node": ">=0.10.0" } @@ -24273,7 +24333,7 @@ "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">= 4" @@ -25153,6 +25213,51 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "license": "ISC" }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/simple-plist": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz", @@ -25258,7 +25363,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">= 6.0.0", @@ -25289,7 +25394,7 @@ "version": "2.8.4", "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz", "integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "ip-address": "^9.0.5", @@ -25410,9 +25515,364 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "dev": true, + "devOptional": true, "license": "BSD-3-Clause" }, + "node_modules/sqlite3": { + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.7.tgz", + "integrity": "sha512-GGIyOiFaG+TUra3JIfkI/zGP8yZYLPQ0pl1bH+ODjiX57sPhrLU5sQJn1y9bDKZUFYkX1crlrPfSYt0BKKdkog==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^7.0.0", + "prebuild-install": "^7.1.1", + "tar": "^6.1.11" + }, + "optionalDependencies": { + "node-gyp": "8.x" + }, + "peerDependencies": { + "node-gyp": "8.x" + }, + "peerDependenciesMeta": { + "node-gyp": { + "optional": true + } + } + }, + "node_modules/sqlite3/node_modules/@npmcli/fs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", + "integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==", + "license": "ISC", + "optional": true, + "dependencies": { + "@gar/promisify": "^1.0.1", + "semver": "^7.3.5" + } + }, + "node_modules/sqlite3/node_modules/@npmcli/move-file": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", + "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "deprecated": "This functionality has been moved to @npmcli/fs", + "license": "MIT", + "optional": true, + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sqlite3/node_modules/@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sqlite3/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/sqlite3/node_modules/cacache": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.3.0.tgz", + "integrity": "sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==", + "license": "ISC", + "optional": true, + "dependencies": { + "@npmcli/fs": "^1.0.0", + "@npmcli/move-file": "^1.0.1", + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^6.0.0", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.1", + "tar": "^6.0.2", + "unique-filename": "^1.1.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/sqlite3/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/sqlite3/node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "license": "MIT", + "optional": true, + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sqlite3/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "optional": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sqlite3/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sqlite3/node_modules/make-fetch-happen": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", + "integrity": "sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==", + "license": "ISC", + "optional": true, + "dependencies": { + "agentkeepalive": "^4.1.3", + "cacache": "^15.2.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^6.0.0", + "minipass": "^3.1.3", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^1.3.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.2", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^6.0.0", + "ssri": "^8.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/sqlite3/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sqlite3/node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/sqlite3/node_modules/minipass-fetch": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.4.1.tgz", + "integrity": "sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==", + "license": "MIT", + "optional": true, + "dependencies": { + "minipass": "^3.1.0", + "minipass-sized": "^1.0.3", + "minizlib": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "optionalDependencies": { + "encoding": "^0.1.12" + } + }, + "node_modules/sqlite3/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "optional": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sqlite3/node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "license": "MIT" + }, + "node_modules/sqlite3/node_modules/node-gyp": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", + "integrity": "sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==", + "license": "MIT", + "optional": true, + "dependencies": { + "env-paths": "^2.2.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^9.1.0", + "nopt": "^5.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">= 10.12.0" + } + }, + "node_modules/sqlite3/node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "license": "ISC", + "optional": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sqlite3/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "optional": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sqlite3/node_modules/socks-proxy-agent": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-6.2.1.tgz", + "integrity": "sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/sqlite3/node_modules/ssri": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", + "integrity": "sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==", + "license": "ISC", + "optional": true, + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/sqlite3/node_modules/unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "license": "ISC", + "optional": true, + "dependencies": { + "unique-slug": "^2.0.0" + } + }, + "node_modules/sqlite3/node_modules/unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "license": "ISC", + "optional": true, + "dependencies": { + "imurmurhash": "^0.1.4" + } + }, "node_modules/ssri": { "version": "10.0.6", "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.6.tgz", @@ -25990,13 +26450,29 @@ "node": ">=10" } }, + "node_modules/tar-fs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.2.tgz", + "integrity": "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, "node_modules/tar-stream": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", @@ -26012,9 +26488,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -26504,6 +26978,18 @@ "dev": true, "license": "0BSD" }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -27738,7 +28224,7 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "string-width": "^1.0.2 || 2 || 3 || 4" @@ -28262,7 +28748,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "devOptional": true, "license": "ISC" }, "node_modules/write-file-atomic": { diff --git a/package.json b/package.json index 1fb507b..e8d959d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,9 @@ "pywebview:build": "vite build --config vite.config.pywebview.mts && .venv/bin/python src/pywebview/main.py", "pywebview:package-linux": "vite build --mode pywebview --config vite.config.pywebview.mts && .venv/bin/python -m PyInstaller --name TimeSafari --add-data 'dist:www' src/pywebview/main.py", "pywebview:package-win": "vite build --mode pywebview --config vite.config.pywebview.mts && .venv/Scripts/python -m PyInstaller --name TimeSafari --add-data 'dist;www' src/pywebview/main.py", - "pywebview:package-mac": "vite build --mode pywebview --config vite.config.pywebview.mts && .venv/bin/python -m PyInstaller --name TimeSafari --add-data 'dist:www' src/pywebview/main.py" + "pywebview:package-mac": "vite build --mode pywebview --config vite.config.pywebview.mts && .venv/bin/python -m PyInstaller --name TimeSafari --add-data 'dist:www' src/pywebview/main.py", + "build:did-generator": "tsc -p test-scripts/tsconfig.json", + "generate-did": "node test-scripts/dist/did_generator.js --db-path ../endorser-ch-test-local.sqlite3" }, "dependencies": { "@capacitor/android": "^6.2.0", @@ -91,6 +93,7 @@ "reflect-metadata": "^0.1.14", "register-service-worker": "^1.7.2", "simple-vue-camera": "^1.1.3", + "sqlite3": "^5.1.7", "stream-browserify": "^3.0.0", "three": "^0.156.1", "ua-parser-js": "^1.0.37", @@ -112,6 +115,7 @@ "@types/node": "^20.14.11", "@types/node-fetch": "^2.6.12", "@types/ramda": "^0.29.11", + "@types/sqlite3": "^3.1.11", "@types/three": "^0.155.1", "@types/ua-parser-js": "^0.7.39", "@typescript-eslint/eslint-plugin": "^6.21.0", diff --git a/test-scripts/did_generator.py b/test-scripts/did_generator.py index cd6e017..9a63cf6 100644 --- a/test-scripts/did_generator.py +++ b/test-scripts/did_generator.py @@ -1,3 +1,36 @@ +""" +DID Generator Script +@author Matthew Raymer + +This script generates and registers Decentralized Identifiers (DIDs) with admin authorization. +It supports the creation of Ethereum-based DIDs (did:ethr) and handles the complete +registration flow with the endorser.ch API. + +Features: +- Ethereum keypair generation with compressed public keys +- JWT creation and signing using ES256K +- DID registration with admin authorization +- Detailed error handling and logging +- Command-line interface for admin DID input + +Dependencies: + eth_account: For Ethereum account operations + eth_keys: For key manipulation and compression + requests: For API communication + secrets: For secure random number generation + hashlib: For SHA-256 hashing + base64: For JWT encoding + argparse: For command-line argument parsing + sqlite3: For database operations + pathlib: For path handling + +Usage: + python did_generator.py + +Example: + python did_generator.py did:ethr:0x1234...5678 +""" + from eth_account import Account import json import base64 @@ -8,28 +41,69 @@ import requests import argparse import secrets import hashlib +import sqlite3 +from pathlib import Path class DIDRegistration: + """ + Handles the creation and registration of DIDs with admin authorization. + + This class manages the complete lifecycle of DID creation: + 1. Generating secure Ethereum keypairs + 2. Creating DIDs from public keys + 3. Signing registration claims + 4. Submitting registration to the endorser.ch API + + Attributes: + api_url (str): Endpoint for DID registration + admin_did (str): Administrator DID for authorization + """ + def __init__(self, admin_did: str): + """ + Initialize DID registration with admin credentials. + + Args: + admin_did (str): Administrator DID for authorizing registrations + Format: did:ethr:0x... + """ self.api_url = "https://api.endorser.ch/api/v2/claim" self.admin_did = admin_did Account.enable_unaudited_hdwallet_features() - def create_keypair(self): - """Generate a new Ethereum keypair""" - private_key = secrets.token_hex(32) + def create_keypair(self) -> dict: + """ + Generate a new Ethereum keypair and associated DID. + + Creates a secure random keypair and formats it for use with the + endorser.ch API, including compressed public key format matching + ethers.js implementation. + Returns: + dict: Keypair information containing: + - private_key: Raw private key without 0x prefix + - public_key: Compressed public key with 0x prefix + - address: Ethereum address + - did: Generated DID in did:ethr format + + Security: + - Uses secrets module for cryptographically secure randomness + - Implements compressed public key format + - Maintains private key security + """ + private_key = secrets.token_hex(32) + # Create private key object and derive public key private_key_bytes = bytes.fromhex(private_key) private_key_obj = keys.PrivateKey(private_key_bytes) - + # Get compressed public key (like ethers.js) public_key_obj = private_key_obj.public_key public_key = '0x' + public_key_obj.to_compressed_bytes().hex() - + # Create account from private key (for address) - account = Account.from_key('0x' + private_key) - + account = Account.from_key(private_key_bytes) + return { 'private_key': private_key, # No 0x prefix 'public_key': public_key, # With 0x prefix, compressed format @@ -38,43 +112,86 @@ class DIDRegistration: } def sign_jwt(self, payload: dict, private_key: str, did: str) -> str: - """Sign JWT using ES256K like the TS version""" + """ + Sign a JWT using ES256K algorithm. + + Creates and signs a JWT following the did-jwt specification: + 1. Constructs header and payload + 2. Base64url encodes components + 3. Signs using ES256K + 4. Assembles final JWT + + Args: + payload (dict): JWT payload to sign + private_key (str): Private key for signing (without 0x prefix) + did (str): DID to use as issuer + + Returns: + str: Signed JWT string in format: header.payload.signature + + Security: + - Implements ES256K signing + - Follows did-jwt specification + - Handles message hashing correctly + """ # Add issuer to payload like did-jwt does full_payload = { **payload, "iss": did } - + header = { "typ": "JWT", "alg": "ES256K" } - + # Create the JWT segments - header_b64 = base64.urlsafe_b64encode(json.dumps(header, separators=(',', ':')).encode()).decode().rstrip('=') - payload_b64 = base64.urlsafe_b64encode(json.dumps(full_payload, separators=(',', ':')).encode()).decode().rstrip('=') + header_b64 = base64.urlsafe_b64encode( + json.dumps(header, separators=(',', ':')).encode() + ).decode().rstrip('=') + payload_b64 = base64.urlsafe_b64encode( + json.dumps(full_payload, separators=(',', ':')).encode() + ).decode().rstrip('=') message = f"{header_b64}.{payload_b64}" - + # Hash the message with sha256 first (like did-jwt) message_hash = hashlib.sha256(message.encode()).digest() - + # Sign the hash directly (not as an Ethereum message) private_key_bytes = bytes.fromhex(private_key) - signed = Account._sign_hash(message_hash, private_key_bytes) # Use internal _sign_hash - + account = Account.from_key(private_key_bytes) + signed = account.sign_message(message_hash) + # Get r and s from signature r = signed.r.to_bytes(32, 'big') s = signed.s.to_bytes(32, 'big') signature_bytes = r + s - + signature = base64.urlsafe_b64encode(signature_bytes).decode().rstrip('=') - + return f"{message}.{signature}" def create_jwt(self, keypair: dict) -> str: - """Create a signed JWT for registration""" - now = int(time.time()) + """ + Create a signed JWT for DID registration. + + Creates a registration claim that includes: + 1. Admin DID as agent + 2. New DID as participant + 3. Timestamp and expiration + 4. Required credential context + Args: + keypair (dict): Generated keypair information + + Returns: + str: Signed JWT containing registration claim + + Note: + Matches TypeScript implementation exactly for compatibility + """ + now = int(time.time()) + # Create registration claim with admin as agent register_claim = { "@context": "https://schema.org", @@ -97,22 +214,43 @@ class DIDRegistration: } print(f"\nDebug - JWT payload: {json.dumps(payload, indent=2)}") - + # Sign with new DID's private key return self.sign_jwt(payload, keypair['private_key'], keypair['did']) def register_did(self, jwt_token: str) -> dict: - """Submit the registration to the server""" + """ + Submit DID registration to the endorser.ch API. + + Handles the complete registration process: + 1. Submits JWT to API + 2. Processes response + 3. Formats result or error message + + Args: + jwt_token (str): Signed JWT for registration + + Returns: + dict: Registration result containing: + - success: Boolean indicating success + - response: API response data + - error: Error message if failed + + Security: + - Uses HTTPS for API communication + - Validates response status + - Handles errors gracefully + """ try: response = requests.post( self.api_url, json={"jwtEncoded": jwt_token}, headers={'Content-Type': 'application/json'} ) - + print(f"\nServer Response Status: {response.status_code}") print(f"Server Response Body: {response.text}") - + if response.status_code in [200, 201]: return { 'success': True, @@ -121,58 +259,116 @@ class DIDRegistration: else: try: error_json = response.json() - error_msg = error_json.get('error', {}).get('message', 'Unknown error') + error_msg = error_json.get('error', {}).get( + 'message', 'Unknown error' + ) return { 'success': False, - 'error': f"Registration failed ({response.status_code}): {error_msg}", + 'error': f"Registration failed ({response.status_code}): " + f"{error_msg}", 'response': error_json } except json.JSONDecodeError: return { 'success': False, - 'error': f"Registration failed ({response.status_code}): {response.text}", + 'error': f"Registration failed ({response.status_code}): " + f"{response.text}", 'response': response.text } - except Exception as e: + except (requests.RequestException, ConnectionError) as e: return { 'success': False, 'error': f"Request failed: {str(e)}" } +def get_root_did_from_db(db_path: str = None) -> str: + """Get admin DID from the most recent registration.""" + try: + db_path = db_path or str(Path.home() / '.endorser' / 'accounts.db') + conn = sqlite3.connect(db_path) + cursor = conn.cursor() + + cursor.execute(""" + SELECT issuer as did + FROM registration + WHERE type = 'RegisterAction' + ORDER BY issuanceDate DESC + LIMIT 1 + """) + + result = cursor.fetchone() + if not result: + raise ValueError('No admin DID found in registration table') + + return result[0] + finally: + if 'conn' in locals(): + conn.close() + def main(): - parser = argparse.ArgumentParser(description='Generate a DID with admin authorization') - parser.add_argument('admin_did', - help='Admin DID (e.g., did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F)') + """ + Main entry point for DID generation script. + + Handles: + 1. Command line argument parsing + 2. DID generation and registration process + 3. Result output and error display + + Usage: + python did_generator.py + """ + parser = argparse.ArgumentParser( + description='Generate a DID with admin authorization' + ) + parser.add_argument( + '--admin-did', + help='Admin DID (e.g., did:ethr:0x0000...)', + required=False + ) + parser.add_argument( + '--db-path', + help='Path to SQLite database containing root DID', + required=False + ) args = parser.parse_args() + admin_did = args.admin_did + if not admin_did: + try: + admin_did = get_root_did_from_db(args.db_path) + print(f"Found root DID in database: {admin_did}") + except (FileNotFoundError, ValueError, sqlite3.Error) as e: + print(f"Error: {str(e)}") + print("Please provide --admin-did argument") + return + print('Starting DID Generation...\n') - print(f"Using admin DID: {args.admin_did}") - registrar = DIDRegistration(args.admin_did) - + registrar = DIDRegistration(admin_did) + print("Generating new keypair...") keypair = registrar.create_keypair() - + print("\nGenerated DID Details:") print("----------------------") print(f"DID: {keypair['did']}") - print(f"Admin DID: {args.admin_did}") + print(f"Admin DID: {admin_did}") print(f"Address: {keypair['address']}") print(f"Private Key: {keypair['private_key']}") - print(f"Public Key: {keypair['public_key']}\n") # Store without any 0x prefix - + print(f"Public Key: {keypair['public_key']}\n") + print("Creating JWT...") jwt_token = registrar.create_jwt(keypair) - + print('\nSuccessfully generated DID with admin authorization!') print(f'Registration JWT: {jwt_token[:50]}...') print("\nAttempting registration...") result = registrar.register_did(jwt_token) if result['success']: - print(f"Registration successful!") - print(f"Response: {json.dumps(result['response'], indent=2)}") + print("Registration successful!") + print("Response: {json.dumps(result['response'], indent=2)}") else: - print(f"Registration failed!") + print("Registration failed!") print(f"Error: {result['error']}") if 'response' in result: print(f"Full response: {json.dumps(result['response'], indent=2)}") diff --git a/test-scripts/did_generator.ts b/test-scripts/did_generator.ts index aa90adf..f8d6af4 100644 --- a/test-scripts/did_generator.ts +++ b/test-scripts/did_generator.ts @@ -1,23 +1,68 @@ +/** + * DID Generator Script + * @author Matthew Raymer + * + * This script generates and registers Decentralized Identifiers (DIDs) with admin authorization. + * It supports the creation of Ethereum-based DIDs (did:ethr) and handles the complete + * registration flow with the endorser.ch API. + * + * Features: + * - Ethereum keypair generation using ethers.js + * - JWT creation and signing using did-jwt + * - DID registration with admin authorization + * - Detailed error handling and logging + * - Command-line interface for admin DID input + * + * Dependencies: + * did-jwt: For JWT creation and signing + * ethers: For Ethereum account operations + * node-fetch: For API communication + */ + /// // Add at the top of your file to ignore dom types import * as didJwt from 'did-jwt'; import { ethers } from 'ethers'; import fetch from 'node-fetch'; +import { Database } from 'sqlite3'; +import { homedir } from 'os'; +import { join } from 'path'; +import { existsSync } from 'fs'; +import { program } from 'commander'; +/** + * Result interface for DID creation process + */ interface DIDCreationResult { - did: string; - privateKey: string; - publicKey: string; - isValid: boolean; - jwt: string; + did: string; // The generated DID + privateKey: string; // Private key without 0x prefix + publicKey: string; // Public key with 0x prefix + isValid: boolean; // Validation status + jwt: string; // Signed JWT for registration } +/** + * Result interface for DID registration attempt + */ interface RegistrationResult { - success: boolean; - error?: string; - response?: any; + success: boolean; // Registration success status + error?: string; // Optional error message + response?: any; // Optional API response data } +/** + * Creates and validates a new DID with admin authorization + * + * Workflow: + * 1. Validates admin DID input + * 2. Generates Ethereum keypair + * 3. Creates registration claim + * 4. Signs claim as JWT + * + * @param adminDid - Administrator DID for authorization + * @returns Promise - Generated DID details and JWT + * @throws Error if admin DID is missing + */ async function createAndValidateDID(adminDid: string): Promise { if (!adminDid) { throw new Error('Admin DID is required for registration'); @@ -87,6 +132,17 @@ async function createAndValidateDID(adminDid: string): Promise - Registration result + */ async function registerDID(jwt: string): Promise { try { const response = await fetch('https://api.endorser.ch/api/v2/claim', { @@ -131,33 +187,71 @@ async function registerDID(jwt: string): Promise { } } -// Command line handling -const adminDid = 'did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'; -if (!adminDid) { - console.error('Usage: ts-node did_generator.ts '); - console.error('Example: ts-node did_generator.ts did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'); - process.exit(1); +async function getRootDidFromDb(dbPath?: string): Promise { + return new Promise((resolve, reject) => { + const defaultPath = join(homedir(), '.endorser', 'accounts.db'); + const path = dbPath || defaultPath; + + if (!existsSync(path)) { + reject(new Error(`Database not found at ${path}`)); + return; + } + + const db = new Database(path); + db.get( + 'SELECT issuer as did FROM registration WHERE type = "RegisterAction" ORDER BY issuanceDate DESC LIMIT 1', + (err, row: { did: string }) => { + db.close(); + if (err) reject(err); + else if (!row) reject(new Error('No admin DID found in registration table')); + else resolve(row.did); + } + ); + }); } +// Command line handling +program + .option('--admin-did ', 'Admin DID (e.g., did:ethr:0x0000...)') + .option('--db-path ', 'Path to SQLite database (e.g., ../endorser-ch-test-local.sqlite3)') + .parse(process.argv); + +const options = program.opts(); + console.log('Starting DID Generation...\n'); -createAndValidateDID(adminDid) - .then(async result => { - console.log('\nSuccessfully generated DID with admin authorization!'); - console.log('Registration JWT:', result.jwt.substring(0, 50) + '...'); - - console.log('\nAttempting registration...'); - const registrationResult = await registerDID(result.jwt); - if (registrationResult.success) { - console.log('Registration successful!'); - console.log('Response:', JSON.stringify(registrationResult.response, null, 2)); - } else { - console.log('Registration failed!'); - console.log('Error:', registrationResult.error); - if (registrationResult.response) { - console.log('Full response:', JSON.stringify(registrationResult.response, null, 2)); - } + +(async () => { + let adminDid = options.adminDid; + if (!adminDid && options.dbPath) { + try { + adminDid = await getRootDidFromDb(options.dbPath); + console.log(`Found root DID in database: ${adminDid}`); + } catch (e) { + console.error(`Error: ${e.message}`); + console.error('Please provide --admin-did argument'); + process.exit(1); + } + } + + try { + const result = await createAndValidateDID(adminDid); + console.log('\nSuccessfully generated DID with admin authorization!'); + console.log('Registration JWT:', result.jwt.substring(0, 50) + '...'); + + console.log('\nAttempting registration...'); + const registrationResult = await registerDID(result.jwt); + if (registrationResult.success) { + console.log('Registration successful!'); + console.log('Response:', JSON.stringify(registrationResult.response, null, 2)); + } else { + console.log('Registration failed!'); + console.log('Error:', registrationResult.error); + if (registrationResult.response) { + console.log('Full response:', JSON.stringify(registrationResult.response, null, 2)); + } + } + } catch (error) { + console.error('\nError:', error); + process.exit(1); } - }) - .catch(error => { - console.error('\nError:', error); - }); \ No newline at end of file +})(); \ No newline at end of file diff --git a/test-scripts/tsconfig.json b/test-scripts/tsconfig.json index 2cf5fac..c2a9fa6 100644 --- a/test-scripts/tsconfig.json +++ b/test-scripts/tsconfig.json @@ -3,11 +3,11 @@ "target": "ES2020", "module": "commonjs", "esModuleInterop": true, + "resolveJsonModule": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "strict": true, "outDir": "./dist" }, - "include": ["./**/*.ts"], - "exclude": ["node_modules"] + "include": [ + "./**/*.ts" + ] } \ No newline at end of file