forked from trent_larson/crowd-funder-for-time-pwa
feat(test-scripts): add registration attempt to TypeScript DID generator
- Added registration attempt to TypeScript DID generator to match Python version - Added node-fetch and types for HTTP request - Both scripts now show same UNREGISTERED_USER error from server - Cleaned up package.json devDependencies formatting
This commit is contained in:
215
package-lock.json
generated
215
package-lock.json
generated
@@ -81,10 +81,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.45.2",
|
||||
"@types/dom-webcodecs": "^0.1.7",
|
||||
"@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/three": "^0.155.1",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
@@ -8110,9 +8112,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@react-native/metro-babel-transformer/node_modules/recast": {
|
||||
"version": "0.23.10",
|
||||
"resolved": "https://registry.npmjs.org/recast/-/recast-0.23.10.tgz",
|
||||
"integrity": "sha512-mbCmRMJUKCJ1h41V0cu2C26ULBURwuoZ34C9rChjcDaeJ/4Kv5al3O2HPwTs2m0wQ1vGhMY+tguhzU1aE8md1A==",
|
||||
"version": "0.23.11",
|
||||
"resolved": "https://registry.npmjs.org/recast/-/recast-0.23.11.tgz",
|
||||
"integrity": "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
@@ -8296,9 +8298,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz",
|
||||
"integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.9.tgz",
|
||||
"integrity": "sha512-qZdlImWXur0CFakn2BJ2znJOdqYZKiedEPEVNTBrpfPjc/YuTGcaYZcdmNFTkUj3DU0ZM/AElcM8Ybww3xVLzA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -8310,9 +8312,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm64": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz",
|
||||
"integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.9.tgz",
|
||||
"integrity": "sha512-4KW7P53h6HtJf5Y608T1ISKvNIYLWRKMvfnG0c44M6In4DQVU58HZFEVhWINDZKp7FZps98G3gxwC1sb0wXUUg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -8324,9 +8326,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz",
|
||||
"integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.9.tgz",
|
||||
"integrity": "sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -8338,9 +8340,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-x64": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz",
|
||||
"integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.9.tgz",
|
||||
"integrity": "sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -8352,9 +8354,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-freebsd-arm64": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz",
|
||||
"integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.9.tgz",
|
||||
"integrity": "sha512-2lzjQPJbN5UnHm7bHIUKFMulGTQwdvOkouJDpPysJS+QFBGDJqcfh+CxxtG23Ik/9tEvnebQiylYoazFMAgrYw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -8366,9 +8368,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-freebsd-x64": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz",
|
||||
"integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.9.tgz",
|
||||
"integrity": "sha512-SLl0hi2Ah2H7xQYd6Qaiu01kFPzQ+hqvdYSoOtHYg/zCIFs6t8sV95kaoqjzjFwuYQLtOI0RZre/Ke0nPaQV+g==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -8380,9 +8382,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz",
|
||||
"integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.9.tgz",
|
||||
"integrity": "sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -8394,9 +8396,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz",
|
||||
"integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.9.tgz",
|
||||
"integrity": "sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -8408,9 +8410,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz",
|
||||
"integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.9.tgz",
|
||||
"integrity": "sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -8422,9 +8424,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz",
|
||||
"integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.9.tgz",
|
||||
"integrity": "sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -8436,9 +8438,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-loongarch64-gnu": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz",
|
||||
"integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.9.tgz",
|
||||
"integrity": "sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
@@ -8450,9 +8452,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz",
|
||||
"integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.9.tgz",
|
||||
"integrity": "sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -8464,9 +8466,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz",
|
||||
"integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.9.tgz",
|
||||
"integrity": "sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
@@ -8478,9 +8480,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-s390x-gnu": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz",
|
||||
"integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.9.tgz",
|
||||
"integrity": "sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -8492,9 +8494,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz",
|
||||
"integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.9.tgz",
|
||||
"integrity": "sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -8506,9 +8508,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz",
|
||||
"integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.9.tgz",
|
||||
"integrity": "sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -8520,9 +8522,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz",
|
||||
"integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.9.tgz",
|
||||
"integrity": "sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -8534,9 +8536,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz",
|
||||
"integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.9.tgz",
|
||||
"integrity": "sha512-KB48mPtaoHy1AwDNkAJfHXvHp24H0ryZog28spEs0V48l3H1fr4i37tiyHsgKZJnCmvxsbATdZGBpbmxTE3a9w==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -8548,9 +8550,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz",
|
||||
"integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.9.tgz",
|
||||
"integrity": "sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -9319,9 +9321,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/dom-webcodecs": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.13.tgz",
|
||||
"integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ==",
|
||||
"version": "0.1.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.14.tgz",
|
||||
"integrity": "sha512-ba9aF0qARLLQpLihONIRbj8VvAdUxO+5jIxlscVcDAQTcJmq5qVr781+ino5qbQUJUmO21cLP2eLeXYWzao5Vg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/emscripten": {
|
||||
@@ -9456,14 +9458,25 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.17.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.19.tgz",
|
||||
"integrity": "sha512-LEwC7o1ifqg/6r2gn9Dns0f1rhK+fPFDoMiceTJ6kWmVk6bgXBI/9IOWfVan4WiAavK9pIVWdX0/e3J+eEUh5A==",
|
||||
"version": "20.17.22",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.22.tgz",
|
||||
"integrity": "sha512-9RV2zST+0s3EhfrMZIhrz2bhuhBwxgkbHEwP2gtGWPjBzVQjifMzJ9exw7aDZhR1wbpj8zBrfp3bo8oJcGiUUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.19.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
"version": "2.6.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz",
|
||||
"integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"form-data": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-forge": {
|
||||
"version": "1.3.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz",
|
||||
@@ -13237,9 +13250,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/config-file-ts/node_modules/typescript": {
|
||||
"version": "5.7.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
|
||||
"integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
|
||||
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
@@ -13301,13 +13314,13 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/core-js-compat": {
|
||||
"version": "3.40.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.40.0.tgz",
|
||||
"integrity": "sha512-0XEDpr5y5mijvw8Lbc6E5AkjrHfp7eEoPlu36SWeAbcL8fn1G1ANe8DBlo2XoNN89oVpxWwOjYIPVzR4ZvsKCQ==",
|
||||
"version": "3.41.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.41.0.tgz",
|
||||
"integrity": "sha512-RFsU9LySVue9RTwdDVX/T0e2Y6jRYWXERKElIjpuEOEnxaXffI0X7RUwVzfYLfzuLXSNJDYoRYUAmRUcyln20A==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"browserslist": "^4.24.3"
|
||||
"browserslist": "^4.24.4"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
@@ -22836,9 +22849,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.2.tgz",
|
||||
"integrity": "sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==",
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
|
||||
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -23717,9 +23730,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-native/node_modules/recast": {
|
||||
"version": "0.23.10",
|
||||
"resolved": "https://registry.npmjs.org/recast/-/recast-0.23.10.tgz",
|
||||
"integrity": "sha512-mbCmRMJUKCJ1h41V0cu2C26ULBURwuoZ34C9rChjcDaeJ/4Kv5al3O2HPwTs2m0wQ1vGhMY+tguhzU1aE8md1A==",
|
||||
"version": "0.23.11",
|
||||
"resolved": "https://registry.npmjs.org/recast/-/recast-0.23.11.tgz",
|
||||
"integrity": "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
@@ -24422,9 +24435,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz",
|
||||
"integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==",
|
||||
"version": "4.34.9",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.9.tgz",
|
||||
"integrity": "sha512-nF5XYqWWp9hx/LrpC8sZvvvmq0TeTjQgaZHYmAgwysT9nh8sWnZhBnM8ZyVbbJFIQBLwHDNoMqsBZBbUo4U8sQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -24438,25 +24451,25 @@
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.34.8",
|
||||
"@rollup/rollup-android-arm64": "4.34.8",
|
||||
"@rollup/rollup-darwin-arm64": "4.34.8",
|
||||
"@rollup/rollup-darwin-x64": "4.34.8",
|
||||
"@rollup/rollup-freebsd-arm64": "4.34.8",
|
||||
"@rollup/rollup-freebsd-x64": "4.34.8",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.34.8",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.34.8",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.34.8",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.34.8",
|
||||
"@rollup/rollup-linux-loongarch64-gnu": "4.34.8",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.34.8",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.34.8",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.34.8",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.34.8",
|
||||
"@rollup/rollup-linux-x64-musl": "4.34.8",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.34.8",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.34.8",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.34.8",
|
||||
"@rollup/rollup-android-arm-eabi": "4.34.9",
|
||||
"@rollup/rollup-android-arm64": "4.34.9",
|
||||
"@rollup/rollup-darwin-arm64": "4.34.9",
|
||||
"@rollup/rollup-darwin-x64": "4.34.9",
|
||||
"@rollup/rollup-freebsd-arm64": "4.34.9",
|
||||
"@rollup/rollup-freebsd-x64": "4.34.9",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.34.9",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.34.9",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.34.9",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.34.9",
|
||||
"@rollup/rollup-linux-loongarch64-gnu": "4.34.9",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.34.9",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.34.9",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.34.9",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.34.9",
|
||||
"@rollup/rollup-linux-x64-musl": "4.34.9",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.34.9",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.34.9",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.34.9",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -105,10 +105,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.45.2",
|
||||
"@types/dom-webcodecs": "^0.1.7",
|
||||
"@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/three": "^0.155.1",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<!-- Back -->
|
||||
<button
|
||||
class="text-lg text-center px-2 py-1 absolute -left-2 -top-1"
|
||||
@click="$router.go(-1)"
|
||||
@click="$router.back()"
|
||||
>
|
||||
<font-awesome icon="chevron-left" class="fa-fw" />
|
||||
</button>
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { AxiosInstance } from "axios";
|
||||
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
@@ -39,6 +40,10 @@ import * as libsUtil from "../libs/util";
|
||||
import { errorStringForLog } from "../libs/endorserServer";
|
||||
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
|
||||
|
||||
/**
|
||||
* View component for adding or editing raw claim data
|
||||
* Allows direct JSON editing of claim data with validation and submission
|
||||
*/
|
||||
@Component({
|
||||
components: { QuickNav },
|
||||
})
|
||||
@@ -46,70 +51,139 @@ export default class ClaimAddRawView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
$route!: RouteLocationNormalizedLoaded;
|
||||
$router!: Router;
|
||||
|
||||
axios!: AxiosInstance;
|
||||
|
||||
accountIdentityStr: string = "null";
|
||||
activeDid = "";
|
||||
apiServer = "";
|
||||
claimStr = "";
|
||||
|
||||
/**
|
||||
* Lifecycle hook that initializes the view
|
||||
* Workflow:
|
||||
* 1. Retrieves active DID and API server from settings
|
||||
* 2. Checks for existing claim data from query params:
|
||||
* - If "claim" param exists: Parses and formats JSON
|
||||
* - If "claimJwtId" param exists: Fetches claim data from API
|
||||
* 3. Populates textarea with formatted claim data
|
||||
*/
|
||||
async mounted() {
|
||||
await this.initializeSettings();
|
||||
await this.loadClaimData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize settings from active account
|
||||
*/
|
||||
private async initializeSettings() {
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Load claim data from query parameters or API
|
||||
*/
|
||||
private async loadClaimData() {
|
||||
// Try loading from direct claim parameter
|
||||
if (await this.loadClaimFromQueryParam()) return;
|
||||
|
||||
// Try loading from claim JWT ID
|
||||
await this.loadClaimFromJwtId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to load claim from query parameter
|
||||
* @returns true if claim was loaded successfully
|
||||
*/
|
||||
private async loadClaimFromQueryParam(): Promise<boolean> {
|
||||
this.claimStr = (this.$route.query["claim"] as string) || "";
|
||||
if (this.claimStr) {
|
||||
try {
|
||||
const veriClaim = JSON.parse(this.claimStr);
|
||||
this.claimStr = JSON.stringify(veriClaim, null, 2);
|
||||
} catch (e) {
|
||||
// ignore a parse error
|
||||
}
|
||||
} else {
|
||||
// there may be no link that uses this, meaning you'd have to enter it in a browser
|
||||
const claimJwtId = (this.$route.query["claimJwtId"] as string) || "";
|
||||
if (claimJwtId) {
|
||||
const urlPath = libsUtil.isGlobalUri(claimJwtId)
|
||||
? "/api/claim/byHandle/"
|
||||
: "/api/claim/";
|
||||
const url = this.apiServer + urlPath + encodeURIComponent(claimJwtId);
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
if (!this.claimStr) return false;
|
||||
|
||||
try {
|
||||
const response = await this.axios.get(url, { headers });
|
||||
if (response.status === 200) {
|
||||
const claim = response.data?.claim;
|
||||
claim.lastClaimId = serverUtil.stripEndorserPrefix(claimJwtId);
|
||||
this.claimStr = JSON.stringify(claim, null, 2);
|
||||
} else {
|
||||
throw {
|
||||
message: "Got an error loading that claim.",
|
||||
response: {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
// url is in "fetch" response but not in AxiosResponse
|
||||
},
|
||||
};
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
logConsoleAndDb(
|
||||
"Error retrieving claim: " + errorStringForLog(error),
|
||||
true,
|
||||
);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "Got an error retrieving claim data.",
|
||||
},
|
||||
3000,
|
||||
);
|
||||
}
|
||||
}
|
||||
try {
|
||||
const veriClaim = JSON.parse(this.claimStr);
|
||||
this.claimStr = JSON.stringify(veriClaim, null, 2);
|
||||
return true;
|
||||
} catch (e) {
|
||||
// ignore parse error
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load claim data from JWT ID via API
|
||||
*/
|
||||
private async loadClaimFromJwtId() {
|
||||
const claimJwtId = (this.$route.query["claimJwtId"] as string) || "";
|
||||
if (!claimJwtId) return;
|
||||
|
||||
const urlPath = libsUtil.isGlobalUri(claimJwtId)
|
||||
? "/api/claim/byHandle/"
|
||||
: "/api/claim/";
|
||||
const url = this.apiServer + urlPath + encodeURIComponent(claimJwtId);
|
||||
|
||||
try {
|
||||
const response = await this.fetchClaimData(url, claimJwtId);
|
||||
this.formatClaimResponse(response, claimJwtId);
|
||||
} catch (error: unknown) {
|
||||
this.handleClaimError(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch claim data from API
|
||||
*/
|
||||
private async fetchClaimData(url: string, claimJwtId: string) {
|
||||
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||
return await this.axios.get(url, { headers });
|
||||
}
|
||||
|
||||
/**
|
||||
* Format successful claim response data
|
||||
*/
|
||||
private formatClaimResponse(response: any, claimJwtId: string) {
|
||||
if (response.status === 200) {
|
||||
const claim = response.data?.claim;
|
||||
claim.lastClaimId = serverUtil.stripEndorserPrefix(claimJwtId);
|
||||
this.claimStr = JSON.stringify(claim, null, 2);
|
||||
} else {
|
||||
throw {
|
||||
message: "Got an error loading that claim.",
|
||||
response: {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle error loading claim data
|
||||
*/
|
||||
private handleClaimError(error: unknown) {
|
||||
logConsoleAndDb(
|
||||
"Error retrieving claim: " + errorStringForLog(error),
|
||||
true,
|
||||
);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "Got an error retrieving claim data.",
|
||||
},
|
||||
3000,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the edited claim data
|
||||
* Workflow:
|
||||
* 1. Parses JSON from textarea
|
||||
* 2. Sends to server via createAndSubmitClaim
|
||||
* 3. Shows success/error notification
|
||||
* @throws Will show error notification if submission fails
|
||||
*/
|
||||
async submitClaim() {
|
||||
const fullClaim = JSON.parse(this.claimStr);
|
||||
const result = await serverUtil.createAndSubmitClaim(
|
||||
|
||||
@@ -70,12 +70,9 @@ echo "\nTesting Other Routes:"
|
||||
# Test claim routes
|
||||
echo "\nTesting Claim Routes:"
|
||||
test_link "timesafari://claim/01JMAAFZRNSRTQ0EBSD70A8E1H"
|
||||
test_link "timesafari://claim/01JMAAFZRNSRTQ0EBSD70A8E1H?view=details"
|
||||
test_link "timesafari://claim-cert/01JMAAFZRNSRTQ0EBSD70A8E1H"
|
||||
|
||||
echo "\nTesting Additional Claim Routes:"
|
||||
test_link "timesafari://claim/123?view=certificate"
|
||||
test_link "timesafari://claim/123?view=raw"
|
||||
test_link "timesafari://claim-add-raw/123?claimJwtId=jwt123"
|
||||
|
||||
# Test project routes
|
||||
|
||||
181
test-scripts/did_generator.py
Normal file
181
test-scripts/did_generator.py
Normal file
@@ -0,0 +1,181 @@
|
||||
from eth_account import Account
|
||||
import json
|
||||
import base64
|
||||
from eth_account.messages import encode_defunct
|
||||
from eth_keys import keys
|
||||
import time
|
||||
import requests
|
||||
import argparse
|
||||
import secrets
|
||||
import hashlib
|
||||
|
||||
class DIDRegistration:
|
||||
def __init__(self, admin_did: str):
|
||||
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)
|
||||
|
||||
# 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)
|
||||
|
||||
return {
|
||||
'private_key': private_key, # No 0x prefix
|
||||
'public_key': public_key, # With 0x prefix, compressed format
|
||||
'address': account.address,
|
||||
'did': f"did:ethr:{account.address}"
|
||||
}
|
||||
|
||||
def sign_jwt(self, payload: dict, private_key: str, did: str) -> str:
|
||||
"""Sign JWT using ES256K like the TS version"""
|
||||
# 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('=')
|
||||
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
|
||||
|
||||
# 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 registration claim with admin as agent
|
||||
register_claim = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "RegisterAction",
|
||||
"agent": { "did": self.admin_did },
|
||||
"participant": { "did": keypair['did'] },
|
||||
"object": "endorser.ch"
|
||||
}
|
||||
|
||||
# Match the TypeScript vcPayload exactly - no iss field
|
||||
payload = {
|
||||
"iat": now,
|
||||
"exp": now + 300,
|
||||
"sub": "RegisterAction",
|
||||
"vc": {
|
||||
"@context": ["https://www.w3.org/2018/credentials/v1"],
|
||||
"type": ["VerifiableCredential"],
|
||||
"credentialSubject": register_claim
|
||||
}
|
||||
}
|
||||
|
||||
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"""
|
||||
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,
|
||||
'response': response.json()
|
||||
}
|
||||
else:
|
||||
try:
|
||||
error_json = response.json()
|
||||
error_msg = error_json.get('error', {}).get('message', 'Unknown error')
|
||||
return {
|
||||
'success': False,
|
||||
'error': f"Registration failed ({response.status_code}): {error_msg}",
|
||||
'response': error_json
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
return {
|
||||
'success': False,
|
||||
'error': f"Registration failed ({response.status_code}): {response.text}",
|
||||
'response': response.text
|
||||
}
|
||||
except Exception as e:
|
||||
return {
|
||||
'success': False,
|
||||
'error': f"Request failed: {str(e)}"
|
||||
}
|
||||
|
||||
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)')
|
||||
args = parser.parse_args()
|
||||
|
||||
print('Starting DID Generation...\n')
|
||||
print(f"Using admin DID: {args.admin_did}")
|
||||
registrar = DIDRegistration(args.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"Address: {keypair['address']}")
|
||||
print(f"Private Key: {keypair['private_key']}")
|
||||
print(f"Public Key: {keypair['public_key']}\n") # Store without any 0x prefix
|
||||
|
||||
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)}")
|
||||
else:
|
||||
print(f"Registration failed!")
|
||||
print(f"Error: {result['error']}")
|
||||
if 'response' in result:
|
||||
print(f"Full response: {json.dumps(result['response'], indent=2)}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
163
test-scripts/did_generator.ts
Normal file
163
test-scripts/did_generator.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
/// <reference types="node" />
|
||||
// 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';
|
||||
|
||||
interface DIDCreationResult {
|
||||
did: string;
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
isValid: boolean;
|
||||
jwt: string;
|
||||
}
|
||||
|
||||
interface RegistrationResult {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
response?: any;
|
||||
}
|
||||
|
||||
async function createAndValidateDID(adminDid: string): Promise<DIDCreationResult> {
|
||||
if (!adminDid) {
|
||||
throw new Error('Admin DID is required for registration');
|
||||
}
|
||||
|
||||
console.log('Using admin DID:', adminDid);
|
||||
|
||||
// 1. Generate keypair
|
||||
console.log('Generating new keypair...');
|
||||
const wallet = ethers.Wallet.createRandom();
|
||||
const did = `did:ethr:${wallet.address}`;
|
||||
const privateKey = wallet.privateKey.slice(2);
|
||||
const publicKey = wallet.publicKey;
|
||||
|
||||
// Create registration claim with admin as agent
|
||||
const registerClaim = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "RegisterAction",
|
||||
agent: { did: adminDid },
|
||||
participant: { did: did },
|
||||
object: "endorser.ch"
|
||||
};
|
||||
|
||||
const vcPayload = {
|
||||
iat: Math.floor(Date.now() / 1000),
|
||||
exp: Math.floor(Date.now() / 1000) + 300,
|
||||
sub: "RegisterAction",
|
||||
vc: {
|
||||
"@context": ["https://www.w3.org/2018/credentials/v1"],
|
||||
type: ["VerifiableCredential"],
|
||||
credentialSubject: registerClaim
|
||||
}
|
||||
};
|
||||
|
||||
console.log('\nGenerated DID Details:');
|
||||
console.log('----------------------');
|
||||
console.log('DID:', did);
|
||||
console.log('Admin DID:', adminDid);
|
||||
console.log('Address:', wallet.address);
|
||||
console.log('Private Key:', wallet.privateKey);
|
||||
console.log('Public Key:', wallet.publicKey);
|
||||
|
||||
console.log('\nDebug Details:');
|
||||
console.log('-------------');
|
||||
console.log('Private Key (hex):', privateKey); // Should be without 0x
|
||||
console.log('Public Key (hex):', publicKey); // Should be with 0x
|
||||
console.log('Header:', {
|
||||
typ: "JWT",
|
||||
alg: "ES256K"
|
||||
});
|
||||
console.log('Payload:', vcPayload);
|
||||
|
||||
// Create and sign JWT
|
||||
console.log('\nCreating JWT...');
|
||||
const signer = didJwt.SimpleSigner(privateKey);
|
||||
const jwt = await didJwt.createJWT(vcPayload, {
|
||||
issuer: did,
|
||||
signer: signer
|
||||
});
|
||||
|
||||
console.log('\nJWT Parts:');
|
||||
const [header, payload, signature] = jwt.split('.');
|
||||
console.log('Header (base64):', header);
|
||||
console.log('Payload (base64):', payload);
|
||||
console.log('Signature (base64):', signature);
|
||||
|
||||
return { did, privateKey, publicKey, isValid: true, jwt };
|
||||
}
|
||||
|
||||
async function registerDID(jwt: string): Promise<RegistrationResult> {
|
||||
try {
|
||||
const response = await fetch('https://api.endorser.ch/api/v2/claim', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ jwtEncoded: jwt }),
|
||||
});
|
||||
|
||||
console.log(`\nServer Response Status: ${response.status}`);
|
||||
const responseText = await response.text();
|
||||
console.log(`Server Response Body: ${responseText}`);
|
||||
|
||||
if (response.ok) {
|
||||
return {
|
||||
success: true,
|
||||
response: JSON.parse(responseText)
|
||||
};
|
||||
} else {
|
||||
try {
|
||||
const errorJson = JSON.parse(responseText);
|
||||
const errorMsg = errorJson.error?.message || 'Unknown error';
|
||||
return {
|
||||
success: false,
|
||||
error: `Registration failed (${response.status}): ${errorMsg}`,
|
||||
response: errorJson
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
success: false,
|
||||
error: `Registration failed (${response.status}): ${responseText}`,
|
||||
response: responseText
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
success: false,
|
||||
error: `Request failed: ${e}`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Command line handling
|
||||
const adminDid = 'did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F';
|
||||
if (!adminDid) {
|
||||
console.error('Usage: ts-node did_generator.ts <admin-did>');
|
||||
console.error('Example: ts-node did_generator.ts did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('\nError:', error);
|
||||
});
|
||||
5
test-scripts/requirements.txt
Normal file
5
test-scripts/requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
eth-account>=0.8.0
|
||||
eth-keys>=0.4.0
|
||||
PyJWT>=2.8.0
|
||||
requests>=2.31.0
|
||||
cryptography>=41.0.0
|
||||
13
test-scripts/tsconfig.json
Normal file
13
test-scripts/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": ["./**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
3
test-scripts/types.d.ts
vendored
Normal file
3
test-scripts/types.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare type AudioSampleFormat = any;
|
||||
declare type EncodedAudioChunkType = any;
|
||||
declare type ImageBufferSource = any;
|
||||
Reference in New Issue
Block a user