From ffe7880c33a03805c6d4c9a6341f3202bf76e21c Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 17 May 2024 15:02:08 +0800 Subject: [PATCH] feat: upgrade to OA v4 beta --- package-lock.json | 573 ++++++++++++++++-- package.json | 2 +- src/DefaultTemplate.tsx | 6 +- src/components/renderer/SvgRenderer.tsx | 35 +- .../renderer/fixtures/svgRendererSamples.ts | 76 +-- src/types.ts | 3 +- 6 files changed, 557 insertions(+), 138 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7b50b5..ba2624b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/free-solid-svg-icons": "^5.15.3", "@fortawesome/react-fontawesome": "^0.1.14", - "@govtechsg/open-attestation": "^6.6.0", + "@govtechsg/open-attestation": "^6.10.0-beta.1", "bs58": "^5.0.0", "crypto-browserify": "^3.12.0", "debug": "^4.3.1", @@ -144,6 +144,20 @@ "node": ">=16.0.0" } }, + "node_modules/@aws-crypto/sha256-universal": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-universal/-/sha256-universal-5.2.0.tgz", + "integrity": "sha512-fnBT+9QvcJLXHOuGAPSq3FNVxOsE2lvuJiRjJidaIyeabASmvJWzFEIw9xJaLBY7JPqtD9faMIGCVZv39IbXrg==", + "dependencies": { + "@aws-crypto/sha256-browser": "^5.2.0", + "@aws-sdk/hash-node": "^3.110.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/@aws-crypto/supports-web-crypto": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", @@ -162,6 +176,19 @@ "tslib": "^2.6.2" } }, + "node_modules/@aws-sdk/hash-node": { + "version": "3.374.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-node/-/hash-node-3.374.0.tgz", + "integrity": "sha512-5GmU64bwoQhkebMv7NzHa+Mw+p7ZmrKz9e3A6hKClxVGeZFE/+jME46gMuFYzO0iz3WqX4CCzUVOhNbS0x8EMQ==", + "deprecated": "This package has moved to @smithy/hash-node", + "dependencies": { + "@smithy/hash-node": "^1.0.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/types": { "version": "3.535.0", "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.535.0.tgz", @@ -2399,6 +2426,19 @@ "node": ">=0.1.90" } }, + "node_modules/@digitalbazaar/http-client": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@digitalbazaar/http-client/-/http-client-3.4.1.tgz", + "integrity": "sha512-Ahk1N+s7urkgj7WvvUND5f8GiWEPfUw0D41hdElaqLgu8wZScI8gdI0q+qWw5N1d35x7GCRH2uk9mi+Uzo9M3g==", + "dependencies": { + "ky": "^0.33.3", + "ky-universal": "^0.11.0", + "undici": "^5.21.2" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -3668,6 +3708,14 @@ "integrity": "sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==", "dev": true }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "engines": { + "node": ">=14" + } + }, "node_modules/@floating-ui/core": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.0.tgz", @@ -3766,46 +3814,52 @@ } }, "node_modules/@govtechsg/open-attestation": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/@govtechsg/open-attestation/-/open-attestation-6.6.0.tgz", - "integrity": "sha512-dMkw9o7GbBxzJ/6nuGjJ09oBOqBhLn7EK/H/10h+oQAzAXwh09cGztQx8at5Regya1ppi+WaLRUwSr9esiDoGw==", + "version": "6.10.0-beta.1", + "resolved": "https://registry.npmjs.org/@govtechsg/open-attestation/-/open-attestation-6.10.0-beta.1.tgz", + "integrity": "sha512-kAFElRnfO4n10ff1CuKzsAJjKHkVQz5KclpjTAeL4hUaH9GAqiKN7z2v0PByEbvKbBJU8p6yg9+DL7VyQkd/tQ==", "hasInstallScript": true, "dependencies": { + "@aws-crypto/sha256-universal": "^5.2.0", "@govtechsg/jsonld": "^0.1.0", - "ajv": "^8.6.2", - "ajv-formats": "^2.1.0", + "buffer": "^6.0.3", "cross-fetch": "^3.1.5", "debug": "^4.3.2", - "ethers": "^5.4.3", + "ethers": "^5.7.2", "flatley": "^5.2.0", "js-base64": "^3.6.1", "js-sha3": "^0.8.0", + "jsonld": "^8.3.2", "lodash": "^4.17.21", + "randombytes": "^2.1.0", "runtypes": "^6.3.2", "uuid": "^8.3.2", - "validator": "^13.7.0" + "validator": "^13.7.0", + "zod": "^3.22.4" } }, - "node_modules/@govtechsg/open-attestation/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "node_modules/@govtechsg/open-attestation/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "node_modules/@govtechsg/open-attestation/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", @@ -7060,6 +7114,66 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@smithy/hash-node": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-1.1.0.tgz", + "integrity": "sha512-yiNKDGMzrQjnpnbLfkYKo+HwIxmBAsv0AI++QIJwvhfkLpUTBylelkv6oo78/YqZZS6h+bGfl0gILJsKE2wAKQ==", + "dependencies": { + "@smithy/types": "^1.2.0", + "@smithy/util-buffer-from": "^1.1.0", + "@smithy/util-utf8": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/hash-node/node_modules/@smithy/is-array-buffer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-1.1.0.tgz", + "integrity": "sha512-twpQ/n+3OWZJ7Z+xu43MJErmhB/WO/mMTnqR6PwWQShvSJ/emx5d1N59LQZk6ZpTAeuRWrc+eHhkzTp9NFjNRQ==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/hash-node/node_modules/@smithy/types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/hash-node/node_modules/@smithy/util-buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-1.1.0.tgz", + "integrity": "sha512-9m6NXE0ww+ra5HKHCHig20T+FAwxBAm7DIdwc/767uGWbRcY720ybgPacQNB96JMOI7xVr/CDa3oMzKmW4a+kw==", + "dependencies": { + "@smithy/is-array-buffer": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/hash-node/node_modules/@smithy/util-utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-1.1.0.tgz", + "integrity": "sha512-p/MYV+JmqmPyjdgyN2UxAeYDj9cBqCjp0C/NsTWnnjoZUVqoeZ6IrW915L9CAKWVECgv9lVQGc4u/yz26/bI1A==", + "dependencies": { + "@smithy/util-buffer-from": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@smithy/is-array-buffer": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", @@ -11272,6 +11386,17 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "optional": true }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -11411,6 +11536,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, "dependencies": { "ajv": "^8.0.0" }, @@ -11427,6 +11553,7 @@ "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -11441,7 +11568,8 @@ "node_modules/ajv-formats/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true }, "node_modules/ajv-keywords": { "version": "3.5.2", @@ -12285,7 +12413,6 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, "funding": [ { "type": "github", @@ -14284,6 +14411,14 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, "node_modules/data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", @@ -16427,6 +16562,14 @@ "@ethersproject/wordlists": "5.7.0" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -16922,7 +17065,8 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-diff": { "version": "1.3.0", @@ -16996,6 +17140,28 @@ "pend": "~1.2.0" } }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/fetch-retry": { "version": "5.0.6", "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.6.tgz", @@ -17381,6 +17547,17 @@ "node": ">= 6" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -18540,7 +18717,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, "funding": [ { "type": "github", @@ -24218,6 +24394,20 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonld": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/jsonld/-/jsonld-8.3.2.tgz", + "integrity": "sha512-MwBbq95szLwt8eVQ1Bcfwmgju/Y5P2GdtlHE2ncyfuYjIdEhluUVyj1eudacf1mOkWIoS9GpDBTECqhmq7EOaA==", + "dependencies": { + "@digitalbazaar/http-client": "^3.4.1", + "canonicalize": "^1.0.1", + "lru-cache": "^6.0.0", + "rdf-canonize": "^3.4.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -24282,6 +24472,58 @@ "node": ">=6" } }, + "node_modules/ky": { + "version": "0.33.3", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.33.3.tgz", + "integrity": "sha512-CasD9OCEQSFIam2U8efFK81Yeg8vNMTBUqtMOHlrcWQHqUX3HeCl9Dr31u4toV7emlH8Mymk5+9p0lL6mKb/Xw==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/ky?sponsor=1" + } + }, + "node_modules/ky-universal": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/ky-universal/-/ky-universal-0.11.0.tgz", + "integrity": "sha512-65KyweaWvk+uKKkCrfAf+xqN2/epw1IJDtlyCPxYffFCMR8u1sp2U65NtWpnozYfZxQ6IUzIlvUcw+hQ82U2Xw==", + "dependencies": { + "abort-controller": "^3.0.0", + "node-fetch": "^3.2.10" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/ky-universal?sponsor=1" + }, + "peerDependencies": { + "ky": ">=0.31.4", + "web-streams-polyfill": ">=3.2.1" + }, + "peerDependenciesMeta": { + "web-streams-polyfill": { + "optional": true + } + } + }, + "node_modules/ky-universal/node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, "node_modules/lazy-universal-dotenv": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/lazy-universal-dotenv/-/lazy-universal-dotenv-4.0.0.tgz", @@ -26477,6 +26719,24 @@ "node": ">= 0.10.5" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-emoji": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", @@ -31208,6 +31468,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, "engines": { "node": ">=6" } @@ -32274,6 +32535,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -34735,6 +34997,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -35089,6 +35362,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -35445,7 +35719,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "dev": true, "engines": { "node": ">= 8" } @@ -37143,6 +37416,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", @@ -37210,6 +37491,17 @@ "tslib": "^2.6.2" } }, + "@aws-crypto/sha256-universal": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-universal/-/sha256-universal-5.2.0.tgz", + "integrity": "sha512-fnBT+9QvcJLXHOuGAPSq3FNVxOsE2lvuJiRjJidaIyeabASmvJWzFEIw9xJaLBY7JPqtD9faMIGCVZv39IbXrg==", + "requires": { + "@aws-crypto/sha256-browser": "^5.2.0", + "@aws-sdk/hash-node": "^3.110.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + } + }, "@aws-crypto/supports-web-crypto": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", @@ -37228,6 +37520,15 @@ "tslib": "^2.6.2" } }, + "@aws-sdk/hash-node": { + "version": "3.374.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-node/-/hash-node-3.374.0.tgz", + "integrity": "sha512-5GmU64bwoQhkebMv7NzHa+Mw+p7ZmrKz9e3A6hKClxVGeZFE/+jME46gMuFYzO0iz3WqX4CCzUVOhNbS0x8EMQ==", + "requires": { + "@smithy/hash-node": "^1.0.1", + "tslib": "^2.5.0" + } + }, "@aws-sdk/types": { "version": "3.535.0", "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.535.0.tgz", @@ -38787,6 +39088,16 @@ "dev": true, "optional": true }, + "@digitalbazaar/http-client": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@digitalbazaar/http-client/-/http-client-3.4.1.tgz", + "integrity": "sha512-Ahk1N+s7urkgj7WvvUND5f8GiWEPfUw0D41hdElaqLgu8wZScI8gdI0q+qWw5N1d35x7GCRH2uk9mi+Uzo9M3g==", + "requires": { + "ky": "^0.33.3", + "ky-universal": "^0.11.0", + "undici": "^5.21.2" + } + }, "@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -39508,6 +39819,11 @@ "integrity": "sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==", "dev": true }, + "@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==" + }, "@floating-ui/core": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.0.tgz", @@ -39583,40 +39899,36 @@ } }, "@govtechsg/open-attestation": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/@govtechsg/open-attestation/-/open-attestation-6.6.0.tgz", - "integrity": "sha512-dMkw9o7GbBxzJ/6nuGjJ09oBOqBhLn7EK/H/10h+oQAzAXwh09cGztQx8at5Regya1ppi+WaLRUwSr9esiDoGw==", + "version": "6.10.0-beta.1", + "resolved": "https://registry.npmjs.org/@govtechsg/open-attestation/-/open-attestation-6.10.0-beta.1.tgz", + "integrity": "sha512-kAFElRnfO4n10ff1CuKzsAJjKHkVQz5KclpjTAeL4hUaH9GAqiKN7z2v0PByEbvKbBJU8p6yg9+DL7VyQkd/tQ==", "requires": { + "@aws-crypto/sha256-universal": "^5.2.0", "@govtechsg/jsonld": "^0.1.0", - "ajv": "^8.6.2", - "ajv-formats": "^2.1.0", + "buffer": "^6.0.3", "cross-fetch": "^3.1.5", "debug": "^4.3.2", - "ethers": "^5.4.3", + "ethers": "^5.7.2", "flatley": "^5.2.0", "js-base64": "^3.6.1", "js-sha3": "^0.8.0", + "jsonld": "^8.3.2", "lodash": "^4.17.21", + "randombytes": "^2.1.0", "runtypes": "^6.3.2", "uuid": "^8.3.2", - "validator": "^13.7.0" + "validator": "^13.7.0", + "zod": "^3.22.4" }, "dependencies": { - "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" } } }, @@ -41968,6 +42280,53 @@ "@sinonjs/commons": "^3.0.0" } }, + "@smithy/hash-node": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-1.1.0.tgz", + "integrity": "sha512-yiNKDGMzrQjnpnbLfkYKo+HwIxmBAsv0AI++QIJwvhfkLpUTBylelkv6oo78/YqZZS6h+bGfl0gILJsKE2wAKQ==", + "requires": { + "@smithy/types": "^1.2.0", + "@smithy/util-buffer-from": "^1.1.0", + "@smithy/util-utf8": "^1.1.0", + "tslib": "^2.5.0" + }, + "dependencies": { + "@smithy/is-array-buffer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-1.1.0.tgz", + "integrity": "sha512-twpQ/n+3OWZJ7Z+xu43MJErmhB/WO/mMTnqR6PwWQShvSJ/emx5d1N59LQZk6ZpTAeuRWrc+eHhkzTp9NFjNRQ==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-1.1.0.tgz", + "integrity": "sha512-9m6NXE0ww+ra5HKHCHig20T+FAwxBAm7DIdwc/767uGWbRcY720ybgPacQNB96JMOI7xVr/CDa3oMzKmW4a+kw==", + "requires": { + "@smithy/is-array-buffer": "^1.1.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-1.1.0.tgz", + "integrity": "sha512-p/MYV+JmqmPyjdgyN2UxAeYDj9cBqCjp0C/NsTWnnjoZUVqoeZ6IrW915L9CAKWVECgv9lVQGc4u/yz26/bI1A==", + "requires": { + "@smithy/util-buffer-from": "^1.1.0", + "tslib": "^2.5.0" + } + } + } + }, "@smithy/is-array-buffer": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", @@ -45014,6 +45373,14 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "optional": true }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, "accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -45121,6 +45488,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, "requires": { "ajv": "^8.0.0" }, @@ -45129,6 +45497,7 @@ "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -45139,7 +45508,8 @@ "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true } } }, @@ -45786,8 +46156,7 @@ "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "batch": { "version": "0.6.1", @@ -47322,6 +47691,11 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, + "data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==" + }, "data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", @@ -48930,6 +49304,11 @@ "@ethersproject/wordlists": "5.7.0" } }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -49336,7 +49715,8 @@ "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "fast-diff": { "version": "1.3.0", @@ -49404,6 +49784,15 @@ "pend": "~1.2.0" } }, + "fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "requires": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + } + }, "fetch-retry": { "version": "5.0.6", "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.6.tgz", @@ -49703,6 +50092,14 @@ "mime-types": "^2.1.12" } }, + "formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "requires": { + "fetch-blob": "^3.1.2" + } + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -50593,8 +50990,7 @@ "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { "version": "4.0.6", @@ -54792,6 +55188,17 @@ "universalify": "^2.0.0" } }, + "jsonld": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/jsonld/-/jsonld-8.3.2.tgz", + "integrity": "sha512-MwBbq95szLwt8eVQ1Bcfwmgju/Y5P2GdtlHE2ncyfuYjIdEhluUVyj1eudacf1mOkWIoS9GpDBTECqhmq7EOaA==", + "requires": { + "@digitalbazaar/http-client": "^3.4.1", + "canonicalize": "^1.0.1", + "lru-cache": "^6.0.0", + "rdf-canonize": "^3.4.0" + } + }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -54838,6 +55245,32 @@ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true }, + "ky": { + "version": "0.33.3", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.33.3.tgz", + "integrity": "sha512-CasD9OCEQSFIam2U8efFK81Yeg8vNMTBUqtMOHlrcWQHqUX3HeCl9Dr31u4toV7emlH8Mymk5+9p0lL6mKb/Xw==" + }, + "ky-universal": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/ky-universal/-/ky-universal-0.11.0.tgz", + "integrity": "sha512-65KyweaWvk+uKKkCrfAf+xqN2/epw1IJDtlyCPxYffFCMR8u1sp2U65NtWpnozYfZxQ6IUzIlvUcw+hQ82U2Xw==", + "requires": { + "abort-controller": "^3.0.0", + "node-fetch": "^3.2.10" + }, + "dependencies": { + "node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "requires": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + } + } + } + }, "lazy-universal-dotenv": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/lazy-universal-dotenv/-/lazy-universal-dotenv-4.0.0.tgz", @@ -56420,6 +56853,11 @@ "minimatch": "^3.0.2" } }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + }, "node-emoji": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", @@ -59866,7 +60304,8 @@ "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true }, "puppeteer-core": { "version": "2.1.1", @@ -60643,7 +61082,8 @@ "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true }, "require-main-filename": { "version": "2.0.0", @@ -62575,6 +63015,14 @@ "which-boxed-primitive": "^1.0.2" } }, + "undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "requires": { + "@fastify/busboy": "^2.0.0" + } + }, "undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -62823,6 +63271,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "requires": { "punycode": "^2.1.0" } @@ -63095,8 +63544,7 @@ "web-streams-polyfill": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "dev": true + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" }, "webidl-conversions": { "version": "3.0.1", @@ -64419,6 +64867,11 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true }, + "zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==" + }, "zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/package.json b/package.json index 4dc0364..e778d17 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/free-solid-svg-icons": "^5.15.3", "@fortawesome/react-fontawesome": "^0.1.14", - "@govtechsg/open-attestation": "^6.6.0", + "@govtechsg/open-attestation": "^6.10.0-beta.1", "bs58": "^5.0.0", "crypto-browserify": "^3.12.0", "debug": "^4.3.1", diff --git a/src/DefaultTemplate.tsx b/src/DefaultTemplate.tsx index 25f8f90..1ad8794 100644 --- a/src/DefaultTemplate.tsx +++ b/src/DefaultTemplate.tsx @@ -3,7 +3,7 @@ import { TemplateProps, TemplateWithComponent } from "./types"; import { EmotionJSX } from "@emotion/react/types/jsx-namespace"; import { isV2Document, isV3Document, isV4Document } from "./utils"; import { JsonView } from "./JsonView"; -import { v4OpenAttestationDocument } from "./components/renderer/SvgRenderer"; +import type { v4 } from "@govtechsg/open-attestation"; interface DefaultTemplateProps { title: string; @@ -60,9 +60,9 @@ export function extractTemplateInfo(document: TemplateProps["document"]): Templa }; } } else if (isV4Document(document)) { - const docAsAny = document as v4OpenAttestationDocument; // TODO: Update to v4 + const docAsAny = document as v4.OpenAttestationDocument; const renderMethod = docAsAny.renderMethod?.find((method) => method.type === "SvgRenderingTemplate2023"); - if (renderMethod !== undefined) { + if (renderMethod?.type === "SvgRenderingTemplate2023") { return { name: renderMethod.name ?? "", type: renderMethod.type, diff --git a/src/components/renderer/SvgRenderer.tsx b/src/components/renderer/SvgRenderer.tsx index b9a1522..3e59e1f 100644 --- a/src/components/renderer/SvgRenderer.tsx +++ b/src/components/renderer/SvgRenderer.tsx @@ -2,34 +2,15 @@ import React, { CSSProperties, useEffect, useState } from "react"; import { Sha256 } from "@aws-crypto/sha256-browser"; import bs58 from "bs58"; import { ConnectionFailureTemplate, DefaultTemplate, NoTemplate, TamperedSvgTemplate } from "../../DefaultTemplate"; -import type { v2 } from "@govtechsg/open-attestation"; +import type { v4 } from "@govtechsg/open-attestation"; import handlebars from "handlebars"; -interface RenderMethod { +export type SvgRenderMethod = { + type: "SvgRenderingTemplate2023"; id: string; - type: string; - name?: string; - css3MediaQuery?: string; - digestMultibase?: string; -} - -// TODO: Replace temporary interface with v4.OpenAttestationDocument -export interface v4OpenAttestationDocument { - credentialSubject: { - id?: string; - type?: string[] | string; - }; - issuer: { - id: string; - identityProof: { - identifier: string; - identityProofType: v2.IdentityProofType; - }; - name: string; - type?: string[] | string; - }; - renderMethod?: RenderMethod[]; -} + name?: string | undefined; + digestMultibase?: string | undefined; +}; type InvalidSvgTemplateDisplayResult = | { @@ -66,7 +47,7 @@ export type DisplayResult = InvalidSvgTemplateDisplayResult | ValidSvgTemplateDi export interface SvgRendererProps { /** The OpenAttestation v4 document to display */ - document: v4OpenAttestationDocument; // TODO: Update to OpenAttestationDocument + document: v4.OpenAttestationDocument; /** Override the img style */ style?: CSSProperties; /** Override the img className */ @@ -105,7 +86,7 @@ const SvgRenderer = React.forwardRef( status: "LOADING", }); - const renderMethod = document.renderMethod?.find((method) => method.type === SVG_RENDERER_TYPE); + const renderMethod = document.renderMethod?.find((method) => method.type === SVG_RENDERER_TYPE) as SvgRenderMethod; const svgInDoc = renderMethod?.id ?? ""; useEffect(() => { setToDisplay({ status: "LOADING" }); diff --git a/src/components/renderer/fixtures/svgRendererSamples.ts b/src/components/renderer/fixtures/svgRendererSamples.ts index ce70223..a574422 100644 --- a/src/components/renderer/fixtures/svgRendererSamples.ts +++ b/src/components/renderer/fixtures/svgRendererSamples.ts @@ -1,20 +1,18 @@ import { v2 } from "@govtechsg/open-attestation"; +import type { v4 } from "@govtechsg/open-attestation"; -// TODO: Update types to v4.OpenAttestationDocument -export const v4WithSvgUrlAndDigestMultibase = { +export const v4WithSvgUrlAndDigestMultibase: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, renderMethod: [ { id: "http://mockbucket.com/static/svg_test.svg", @@ -31,20 +29,18 @@ export const v4WithSvgUrlAndDigestMultibase = { }, }; -export const v4WithEmbeddedSvgAndDigestMultibase = { +export const v4WithEmbeddedSvgAndDigestMultibase: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, renderMethod: [ { id: ` @@ -72,20 +68,18 @@ export const v4WithEmbeddedSvgAndDigestMultibase = { }, }; -export const v4WithTamperedEmbeddedSvgAndDigestMultibase = { +export const v4WithTamperedEmbeddedSvgAndDigestMultibase: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, renderMethod: [ { id: ` @@ -113,20 +107,18 @@ export const v4WithTamperedEmbeddedSvgAndDigestMultibase = { }, }; -export const v4WithOnlyTamperedEmbeddedSvg = { +export const v4WithOnlyTamperedEmbeddedSvg: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, renderMethod: [ { id: ` @@ -153,20 +145,18 @@ export const v4WithOnlyTamperedEmbeddedSvg = { }, }; -export const v4MalformedEmbeddedSvg = { +export const v4MalformedEmbeddedSvg: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, renderMethod: [ { id: "", @@ -214,20 +204,18 @@ export const v2WithSvgUrlAndDigestMultibase = { }, }; -export const v4WithNoRenderMethod = { +export const v4WithNoRenderMethod: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, credentialSubject: { id: "urn:uuid:a013fb9d-bb03-4056-b696-05575eceaf42", type: ["SvgExample"], @@ -236,27 +224,25 @@ export const v4WithNoRenderMethod = { }, }; -export const v4NotUsingSvgRenderMethod = { +export const v4NotUsingSvgRenderMethod: v4.OpenAttestationDocument = { "@context": [ - "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json", ], + type: ["VerifiableCredential", "OpenAttestationCredential"], issuer: { id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90", type: "OpenAttestationIssuer", name: "Government Technology Agency of Singapore (GovTech)", - // identityProof: { identityProofType: v4.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, - identityProof: { identityProofType: v2.IdentityProofType.DNSDid, identifier: "example.openattestation.com" }, + identityProof: { identityProofType: "DNS-DID", identifier: "example.openattestation.com" }, }, renderMethod: [ { id: "http://mockbucket.com/static/svg_test.mp3", - type: "SomeOtherRendererType", - name: "Certificate", + type: "OpenAttestationEmbeddedRenderer", + templateName: "Certificate", }, ], - // credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: v4.CredentialStatusType.None }, - credentialStatus: { type: "OpenAttestationCredentialStatus", credentialStatusType: "NONE" }, credentialSubject: { id: "urn:uuid:a013fb9d-bb03-4056-b696-05575eceaf42", type: ["SvgExample"], diff --git a/src/types.ts b/src/types.ts index 22347d7..c2b207e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,5 @@ import { ComponentType } from "react"; import type { v2, WrappedDocument, OpenAttestationDocument, v3 } from "@govtechsg/open-attestation"; -import { v4OpenAttestationDocument } from "./components/renderer/SvgRenderer"; export type Attachment = v2.Attachment | v3.Attachment; export interface Renderer { @@ -8,7 +7,7 @@ export interface Renderer { } export interface TemplateProps { - document: D | v4OpenAttestationDocument; // TODO: Remove after OpenAttestation library has been updated with v4 types + document: D; wrappedDocument?: WrappedDocument; handleObfuscation: (field: string) => void; }