From b03b1ba2cbbf225d0ac52ebc11fc028300796032 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 12:21:50 -0800 Subject: [PATCH 01/11] wip --- package-lock.json | 6439 +++++------------ package.json | 3 + packages/bls-verify/package.json | 4 +- packages/bls-verify/src/index.ts | 16 +- .../bls-verify/src/vendor/amcl-js/index.js | 1 - .../src/vendor/amcl-js/package.json | 15 - .../bls-verify/src/vendor/amcl-js/readme.md | 62 - .../bls-verify/src/vendor/amcl-js/src/aes.js | 882 --- .../bls-verify/src/vendor/amcl-js/src/big.js | 1505 ---- .../bls-verify/src/vendor/amcl-js/src/bls.js | 184 - .../src/vendor/amcl-js/src/bls192.js | 183 - .../src/vendor/amcl-js/src/bls256.js | 188 - .../bls-verify/src/vendor/amcl-js/src/ctx.js | 1203 --- .../bls-verify/src/vendor/amcl-js/src/ecdh.js | 447 -- .../bls-verify/src/vendor/amcl-js/src/ecp.js | 1966 ----- .../bls-verify/src/vendor/amcl-js/src/ecp2.js | 1094 --- .../bls-verify/src/vendor/amcl-js/src/ecp4.js | 970 --- .../bls-verify/src/vendor/amcl-js/src/ecp8.js | 1172 --- .../bls-verify/src/vendor/amcl-js/src/ff.js | 1024 --- .../bls-verify/src/vendor/amcl-js/src/fp.js | 833 --- .../bls-verify/src/vendor/amcl-js/src/fp12.js | 1069 --- .../bls-verify/src/vendor/amcl-js/src/fp16.js | 594 -- .../bls-verify/src/vendor/amcl-js/src/fp2.js | 483 -- .../bls-verify/src/vendor/amcl-js/src/fp24.js | 1131 --- .../bls-verify/src/vendor/amcl-js/src/fp4.js | 722 -- .../bls-verify/src/vendor/amcl-js/src/fp48.js | 1225 ---- .../bls-verify/src/vendor/amcl-js/src/fp8.js | 737 -- .../bls-verify/src/vendor/amcl-js/src/gcm.js | 471 -- .../src/vendor/amcl-js/src/hash256.js | 235 - .../src/vendor/amcl-js/src/hash384.js | 361 - .../src/vendor/amcl-js/src/hash512.js | 364 - .../bls-verify/src/vendor/amcl-js/src/hmac.js | 764 -- .../bls-verify/src/vendor/amcl-js/src/hpke.js | 297 - .../bls-verify/src/vendor/amcl-js/src/mpin.js | 274 - .../src/vendor/amcl-js/src/mpin192.js | 275 - .../src/vendor/amcl-js/src/mpin256.js | 276 - .../bls-verify/src/vendor/amcl-js/src/nhs.js | 766 -- .../bls-verify/src/vendor/amcl-js/src/pair.js | 1076 --- .../src/vendor/amcl-js/src/pair4.js | 819 --- .../src/vendor/amcl-js/src/pair8.js | 918 --- .../bls-verify/src/vendor/amcl-js/src/rand.js | 197 - .../src/vendor/amcl-js/src/rom_curve.js | 2705 ------- .../src/vendor/amcl-js/src/rom_field.js | 1101 --- .../bls-verify/src/vendor/amcl-js/src/rsa.js | 290 - .../bls-verify/src/vendor/amcl-js/src/sha3.js | 392 - .../src/vendor/amcl-js/src/share.js | 152 - .../src/vendor/amcl-js/src/uint64.js | 67 - 47 files changed, 1929 insertions(+), 34023 deletions(-) delete mode 100644 packages/bls-verify/src/vendor/amcl-js/index.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/package.json delete mode 100644 packages/bls-verify/src/vendor/amcl-js/readme.md delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/aes.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/big.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/bls.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/bls192.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/bls256.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ctx.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecdh.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp2.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp4.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp8.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ff.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp12.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp16.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp2.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp24.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp4.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp48.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp8.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/gcm.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hash256.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hash384.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hash512.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hmac.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hpke.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/mpin.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/mpin192.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/mpin256.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/nhs.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/pair.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/pair4.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/pair8.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rand.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rom_field.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rsa.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/sha3.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/share.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/uint64.js diff --git a/package-lock.json b/package-lock.json index de4820d5d..c7b8ee476 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "@dfinity/agent-monorepo", "version": "0.20.2", "license": "Apache-2.0", + "dependencies": { + "@noble/curves": "^1.2.0" + }, "devDependencies": { "@jest/types": "^29.6.3", "@size-limit/preset-small-lib": "^9.0.0", @@ -80,18 +83,16 @@ }, "e2e/browser/node_modules/@types/node": { "version": "18.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } }, "e2e/browser/node_modules/size-limit": { "version": "8.2.6", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-8.2.6.tgz", - "integrity": "sha512-zpznim/tX/NegjoQuRKgWTF4XiB0cn2qt90uJzxYNTFAqexk4b94DOAkBD3TwhC6c3kw2r0KcnA5upziVMZqDg==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -143,9 +144,8 @@ }, "e2e/node/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", - "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.4.0", "@typescript-eslint/scope-manager": "5.62.0", @@ -177,9 +177,8 @@ }, "e2e/node/node_modules/@typescript-eslint/parser": { "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", - "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", @@ -204,9 +203,8 @@ }, "e2e/node/node_modules/escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -216,9 +214,8 @@ }, "e2e/node/node_modules/eslint-plugin-jsdoc": { "version": "39.9.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.9.1.tgz", - "integrity": "sha512-Rq2QY6BZP2meNIs48aZ3GlIlJgBqFCmR55+UBvaDkA3ZNQ0SvQXOs2QKkubakEijV8UbIVbVZKsOVN8G3MuqZw==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "@es-joy/jsdoccomment": "~0.36.1", "comment-parser": "1.3.1", @@ -237,9 +234,8 @@ }, "e2e/node/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -252,9 +248,8 @@ }, "e2e/node/node_modules/size-limit": { "version": "8.2.6", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-8.2.6.tgz", - "integrity": "sha512-zpznim/tX/NegjoQuRKgWTF4XiB0cn2qt90uJzxYNTFAqexk4b94DOAkBD3TwhC6c3kw2r0KcnA5upziVMZqDg==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -699,9 +694,8 @@ }, "node_modules/@babel/runtime": { "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", - "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", "dev": true, + "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -762,6 +756,7 @@ }, "node_modules/@colors/colors": { "version": "1.5.0", + "dev": true, "license": "MIT", "engines": { "node": ">=0.1.90" @@ -789,9 +784,8 @@ }, "node_modules/@cypress/request": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", - "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -818,9 +812,8 @@ }, "node_modules/@cypress/request/node_modules/form-data": { "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -832,9 +825,8 @@ }, "node_modules/@cypress/xvfb": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", - "integrity": "sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^3.1.0", "lodash.once": "^4.1.1" @@ -842,9 +834,8 @@ }, "node_modules/@cypress/xvfb/node_modules/debug": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.1" } @@ -901,9 +892,8 @@ }, "node_modules/@es-joy/jsdoccomment": { "version": "0.36.1", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.36.1.tgz", - "integrity": "sha512-922xqFsTpHs6D0BUiG4toiyPOMc8/jafnWKxz1KWgS4XzKPy2qXf1Pe6UFuNSCQqt6tOuhAWXBNuuyUhJmw9Vg==", "dev": true, + "license": "MIT", "dependencies": { "comment-parser": "1.3.1", "esquery": "^1.4.0", @@ -913,530 +903,193 @@ "node": "^14 || ^16 || ^17 || ^18 || ^19" } }, - "node_modules/@esbuild/android-arm": { + "node_modules/@esbuild/darwin-arm64": { "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", - "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", "cpu": [ - "arm" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "darwin" ], "engines": { "node": ">=12" } }, - "node_modules/@esbuild/android-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", - "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", - "cpu": [ - "arm64" - ], + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, - "node_modules/@esbuild/android-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", - "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", - "cpu": [ - "x64" - ], + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", - "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", - "cpu": [ - "arm64" - ], + "node_modules/@eslint/eslintrc": { + "version": "2.1.3", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", - "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", - "cpu": [ - "x64" - ], + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.23.0", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", - "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", - "cpu": [ - "arm64" - ], + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", - "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", - "cpu": [ - "x64" - ], + "node_modules/@eslint/js": { + "version": "8.53.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@esbuild/linux-arm": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", - "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", - "cpu": [ - "arm" - ], + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.13", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, "engines": { - "node": ">=12" + "node": ">=10.10.0" } }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", - "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", - "cpu": [ - "arm64" - ], + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", - "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", - "cpu": [ - "ia32" - ], + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "BSD-3-Clause" }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", - "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", - "cpu": [ - "loong64" - ], + "node_modules/@iarna/toml": { + "version": "2.2.5", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "ISC" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", - "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", - "cpu": [ - "mips64el" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" } }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", - "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", - "cpu": [ - "ppc64" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", - "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", - "cpu": [ - "riscv64" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", - "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", - "cpu": [ - "s390x" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", - "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", - "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", - "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", - "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", - "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", - "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", - "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.23.0", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "8.53.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@iarna/toml": { - "version": "2.2.5", - "dev": true, - "license": "ISC" - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { - "version": "1.0.10", - "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.1", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { - "version": "2.3.0", + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", "dev": true, "license": "MIT", "dependencies": { @@ -2007,9 +1660,8 @@ }, "node_modules/@jest/test-sequencer": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", - "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", "dev": true, + "license": "MIT", "dependencies": { "@jest/test-result": "^29.7.0", "graceful-fs": "^4.2.9", @@ -2270,15 +1922,13 @@ }, "node_modules/@lezer/common": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.1.1.tgz", - "integrity": "sha512-aAPB9YbvZHqAW+bIwiuuTDGB4DG0sYNRObGLxud8cW7osw1ZQxfDuTZ8KQiqfZ0QJGcR34CvpTMDXEyo/+Htgg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@lezer/lr": { "version": "1.3.14", - "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.3.14.tgz", - "integrity": "sha512-z5mY4LStlA3yL7aHT/rqgG614cfcvklS+8oFRFBYrs4YaWLJyKKM4+nN6KopToX0o9Hj6zmH6M5kinOYuy06ug==", "dev": true, + "license": "MIT", "dependencies": { "@lezer/common": "^1.0.0" } @@ -2296,87 +1946,20 @@ }, "node_modules/@lmdb/lmdb-darwin-arm64": { "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-2.8.5.tgz", - "integrity": "sha512-KPDeVScZgA1oq0CiPBcOa3kHIqU+pTOwRFDIhxvmf8CTNvqdZQYp5cCKW0bUk69VygB2PuTiINFWbY78aR2pQw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, - "node_modules/@lmdb/lmdb-darwin-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-2.8.5.tgz", - "integrity": "sha512-w/sLhN4T7MW1nB3R/U8WK5BgQLz904wh+/SmA2jD8NnF7BLLoUgflCNxOeSPOWp8geP6nP/+VjWzZVip7rZ1ug==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-2.8.5.tgz", - "integrity": "sha512-c0TGMbm2M55pwTDIfkDLB6BpIsgxV4PjYck2HiOX+cy/JWiBXz32lYbarPqejKs9Flm7YVAKSILUducU9g2RVg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-2.8.5.tgz", - "integrity": "sha512-vtbZRHH5UDlL01TT5jB576Zox3+hdyogvpcbvVJlmU5PdL3c5V7cj1EODdh1CHPksRl+cws/58ugEHi8bcj4Ww==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-2.8.5.tgz", - "integrity": "sha512-Xkc8IUx9aEhP0zvgeKy7IQ3ReX2N8N1L0WPcQwnZweWmOuKfwpS3GRIYqLtK5za/w3E60zhFfNdS+3pBZPytqQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-win32-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.8.5.tgz", - "integrity": "sha512-4wvrf5BgnR8RpogHhtpCPJMKBmvyZPhhUtEwMJbXh0ni2BucpfF07jlmyM11zRqQ2XIq6PbC2j7W7UCCcm1rRQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@mischnic/json-sourcemap": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@mischnic/json-sourcemap/-/json-sourcemap-0.1.1.tgz", - "integrity": "sha512-iA7+tyVqfrATAIsIRWQG+a7ZLLD0VaOCKV2Wd/v4mqIU3J9c4jx9p7S0nw1XH3gJCKNBOOwACOPYYSUu9pgT+w==", "dev": true, + "license": "MIT", "dependencies": { "@lezer/common": "^1.0.0", "@lezer/lr": "^1.0.0", @@ -2388,86 +1971,19 @@ }, "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.2.tgz", - "integrity": "sha512-9bfjwDxIDWmmOKusUcqdS4Rw+SETlp9Dy39Xui9BEGEk19dDwH0jhipwFzEff/pFg95NKymc6TOTbRKcWeRqyQ==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.2.tgz", - "integrity": "sha512-lwriRAHm1Yg4iDf23Oxm9n/t5Zpw1lVnxYU3HnJPTi2lJRkKTrps1KVgvL6m7WvmhYVt/FIsssWay+k45QHeuw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.2.tgz", - "integrity": "sha512-MOI9Dlfrpi2Cuc7i5dXdxPbFIgbDBGgKR5F2yWEa6FVEtSWncfVNKW5AKjImAQ6CZlBK9tympdsZJ2xThBiWWA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.2.tgz", - "integrity": "sha512-FU20Bo66/f7He9Fp9sP2zaJ1Q8L9uLPZQDub/WlUip78JlPeMbVL8546HbZfcW9LNciEXc8d+tThSJjSC+tmsg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.2.tgz", - "integrity": "sha512-gsWNDCklNy7Ajk0vBBf9jEx04RUxuDQfBse918Ww+Qb9HCPoGzS+XJTLe96iN3BVK7grnLiYghP/M4L8VsaHeA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.2.tgz", - "integrity": "sha512-O+6Gs8UeDbyFpbSh2CPEz/UOrrdWPTBYNblZK5CxxLisYt4kGX3Sc+czffFonyjiGSq3jWLwJS/CCJc7tBr4sQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@noble/curves": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", - "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "license": "MIT", "dependencies": { "@noble/hashes": "1.3.2" }, @@ -2692,9 +2208,8 @@ }, "node_modules/@opencensus/core": { "version": "0.0.9", - "resolved": "https://registry.npmjs.org/@opencensus/core/-/core-0.0.9.tgz", - "integrity": "sha512-31Q4VWtbzXpVUd2m9JS6HEaPjlKvNMOiF7lWKNmXF84yUcgfAFL5re7/hjDmdyQbOp32oGc+RFV78jXIldVz6Q==", "dev": true, + "license": "Apache-2.0", "dependencies": { "continuation-local-storage": "^3.2.1", "log-driver": "^1.2.7", @@ -2708,28 +2223,24 @@ }, "node_modules/@opencensus/core/node_modules/semver": { "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } }, "node_modules/@opencensus/core/node_modules/uuid": { "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, + "license": "MIT", "bin": { "uuid": "bin/uuid" } }, "node_modules/@opencensus/propagation-b3": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@opencensus/propagation-b3/-/propagation-b3-0.0.8.tgz", - "integrity": "sha512-PffXX2AL8Sh0VHQ52jJC4u3T0H6wDK6N/4bg7xh4ngMYOIi13aR1kzVvX1sVDBgfGwDOkMbl4c54Xm3tlPx/+A==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@opencensus/core": "^0.0.8", "uuid": "^3.2.1" @@ -2740,9 +2251,8 @@ }, "node_modules/@opencensus/propagation-b3/node_modules/@opencensus/core": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@opencensus/core/-/core-0.0.8.tgz", - "integrity": "sha512-yUFT59SFhGMYQgX0PhoTR0LBff2BEhPrD9io1jWfF/VDbakRfs6Pq60rjv0Z7iaTav5gQlttJCX2+VPxFWCuoQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "continuation-local-storage": "^3.2.1", "log-driver": "^1.2.7", @@ -2756,28 +2266,24 @@ }, "node_modules/@opencensus/propagation-b3/node_modules/semver": { "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } }, "node_modules/@opencensus/propagation-b3/node_modules/uuid": { "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, + "license": "MIT", "bin": { "uuid": "bin/uuid" } }, "node_modules/@parcel/bundler-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/bundler-default/-/bundler-default-2.10.2.tgz", - "integrity": "sha512-XlVGsScK5PgIFXNJ0Yx/+nHu1RFCuslCbrb8MIs0yqS790yzvyJF2QHX5WAr7Qc5powij/+2tfBHiViauWwVpA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/graph": "3.0.2", @@ -2797,9 +2303,8 @@ }, "node_modules/@parcel/cache": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/cache/-/cache-2.10.2.tgz", - "integrity": "sha512-B69e5n+bBzYoaJdUOviYeUT7N1iXI3IC5G8dAxKNZ9Zgn+pjZ5BwltbfmP47+NTfQ7LqM8Ea4UJxysQsLdwb+Q==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/fs": "2.10.2", "@parcel/logger": "2.10.2", @@ -2819,9 +2324,8 @@ }, "node_modules/@parcel/codeframe": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/codeframe/-/codeframe-2.10.2.tgz", - "integrity": "sha512-EZrYSIlVg4qiBLHRRqC/BGN2MLG0SKnw4u7kpviwz63I+v36ghqmHGOomwfn4x13nDL+EgOFz4/+Q7QpbMTKug==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0" }, @@ -2835,9 +2339,8 @@ }, "node_modules/@parcel/codeframe/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -2850,9 +2353,8 @@ }, "node_modules/@parcel/codeframe/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -2866,9 +2368,8 @@ }, "node_modules/@parcel/codeframe/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -2878,24 +2379,21 @@ }, "node_modules/@parcel/codeframe/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/codeframe/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/codeframe/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -2905,9 +2403,8 @@ }, "node_modules/@parcel/compressor-raw": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/compressor-raw/-/compressor-raw-2.10.2.tgz", - "integrity": "sha512-zIbtmL7vGfWkvBwD29zVdDosFR1eKHa29SpPOQXYLmDO0EVdwzYcTQq2OrlZM07o759QUqwXJfuAYxwcBNRTYg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -2922,9 +2419,8 @@ }, "node_modules/@parcel/config-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/config-default/-/config-default-2.10.2.tgz", - "integrity": "sha512-BGn7G5MT6VXpnI5Rj8fzHT1ij0YElge3l2KVGSOJ5crho2Fmz7UKmm8kJ9kdcLrzHWOIH07T100YoQuAwKVQaA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/bundler-default": "2.10.2", "@parcel/compressor-raw": "2.10.2", @@ -2968,9 +2464,8 @@ }, "node_modules/@parcel/core": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/core/-/core-2.10.2.tgz", - "integrity": "sha512-c6hh13oYk9w5creiQ9yCz9GLQ17ZRMonULhJ46J0yoFArynVhNTJ9B5xVst7rS/chOTY8jU0jSdJuxQCR4fjkg==", "dev": true, + "license": "MIT", "dependencies": { "@mischnic/json-sourcemap": "^0.1.0", "@parcel/cache": "2.10.2", @@ -3008,18 +2503,16 @@ }, "node_modules/@parcel/core/node_modules/base-x": { "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.0.1" } }, "node_modules/@parcel/core/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3032,9 +2525,8 @@ }, "node_modules/@parcel/diagnostic": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/diagnostic/-/diagnostic-2.10.2.tgz", - "integrity": "sha512-FwtphyiV/TJEiYIRYXBOloXp7XhTW37ifRSLr7RdLbDVyn/P9q/7l0+ORlnOL+WuKwbDQtY+dXYLh/ijTsq7qQ==", "dev": true, + "license": "MIT", "dependencies": { "@mischnic/json-sourcemap": "^0.1.0", "nullthrows": "^1.1.1" @@ -3049,9 +2541,8 @@ }, "node_modules/@parcel/events": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/events/-/events-2.10.2.tgz", - "integrity": "sha512-Dp8Oqh5UvSuIASfiHP8jrEtdtzzmTKiOG/RkSL3mtp2tK3mu6dZLJZbcdJXrvBTg7smtRiznkrIOJCawALC7AQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12.0.0" }, @@ -3062,9 +2553,8 @@ }, "node_modules/@parcel/fs": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/fs/-/fs-2.10.2.tgz", - "integrity": "sha512-80SXdFGDJtil9tTbWrYiZRfQ5ehMAT/dq6eY4EYcFg+MvSiwBL/4GfYMfqXn6AamuSVeQlsFCPpunFLNl9YDDA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/rust": "2.10.2", "@parcel/types": "2.10.2", @@ -3085,9 +2575,8 @@ }, "node_modules/@parcel/graph": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@parcel/graph/-/graph-3.0.2.tgz", - "integrity": "sha512-cPxCN3+QF+5l4BJ0wnLeb3DPJarWQoD3W984CfuEYy/8Zgo2oayd31soZzkevyTYtp7H4tJKo+I79i2TJdNq5Q==", "dev": true, + "license": "MIT", "dependencies": { "nullthrows": "^1.1.1" }, @@ -3101,9 +2590,8 @@ }, "node_modules/@parcel/logger": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/logger/-/logger-2.10.2.tgz", - "integrity": "sha512-5lufBuBnXDs3hjAaptmeEAxpH0eHe0+2hJvlVv5lE/RwHR7vDjh+FDwzPfCLWNM3TQhPQdZPdHcDsuA539GHcw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/events": "2.10.2" @@ -3118,9 +2606,8 @@ }, "node_modules/@parcel/markdown-ansi": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/markdown-ansi/-/markdown-ansi-2.10.2.tgz", - "integrity": "sha512-uZrysHjJ+0vbQNK2bhKy8yoVso8KnoW6O/SW8MiGQ4lpDJdqHShkW08wZUKr4sjl7h/WVFdNsDdgvi2/ANwoRQ==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0" }, @@ -3134,9 +2621,8 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -3149,9 +2635,8 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3165,9 +2650,8 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -3177,24 +2661,21 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/markdown-ansi/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/markdown-ansi/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3204,9 +2685,8 @@ }, "node_modules/@parcel/namer-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/namer-default/-/namer-default-2.10.2.tgz", - "integrity": "sha512-wjn3MCus0w9IOjCtQsp5fgb8hgITyxMr0OPF9cBVAhVJI1X9vvd4RurHuLJ3MjvlCqrP1en09yg3ME7VO1kPuA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3223,9 +2703,8 @@ }, "node_modules/@parcel/node-resolver-core": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@parcel/node-resolver-core/-/node-resolver-core-3.1.2.tgz", - "integrity": "sha512-xvIBgYBRQGmCkfwK/yxVSDtPEvWDVH9poQcGpKHT1jqstYju5crXro0acni5nYF0hWZu7Kttrp9G9fXJQWBksw==", "dev": true, + "license": "MIT", "dependencies": { "@mischnic/json-sourcemap": "^0.1.0", "@parcel/diagnostic": "2.10.2", @@ -3245,9 +2724,8 @@ }, "node_modules/@parcel/node-resolver-core/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3260,9 +2738,8 @@ }, "node_modules/@parcel/optimizer-css": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-css/-/optimizer-css-2.10.2.tgz", - "integrity": "sha512-05H/Ng90TErSFZkNaUwi7gNCf2gLWi3/w07oIzHu1wjRjjKjZidqaQqZtHTEYoO9ffmhK14Xwh9q4IpOTa0sbQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3283,9 +2760,8 @@ }, "node_modules/@parcel/optimizer-htmlnano": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-htmlnano/-/optimizer-htmlnano-2.10.2.tgz", - "integrity": "sha512-9Sg2xLsfX7CPLd1AO3uVa/Kh9EROKVNHMnmNxlzmO2+LEOU/M1OHalvt4bhC7I+cNFPLN5BePdBv3QMYpO0yyA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "htmlnano": "^2.0.0", @@ -3304,18 +2780,16 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/commander": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, "node_modules/@parcel/optimizer-htmlnano/node_modules/css-select": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.0.1", @@ -3329,9 +2803,8 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/css-tree": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", "dev": true, + "license": "MIT", "dependencies": { "mdn-data": "2.0.14", "source-map": "^0.6.1" @@ -3342,9 +2815,8 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/csso": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", "dev": true, + "license": "MIT", "dependencies": { "css-tree": "^1.1.2" }, @@ -3354,15 +2826,13 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/mdn-data": { "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true + "dev": true, + "license": "CC0-1.0" }, "node_modules/@parcel/optimizer-htmlnano/node_modules/svgo": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", "dev": true, + "license": "MIT", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", @@ -3381,9 +2851,8 @@ }, "node_modules/@parcel/optimizer-image": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-image/-/optimizer-image-2.10.2.tgz", - "integrity": "sha512-X8q7mvWJEIXsEMYHYKbwIRUJvI0W41YWCEW7Ohmn0SSi+KuiO8BW5JEPKs7HboO9bX+i6Yxa/T1h9HgRXhdUug==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3405,9 +2874,8 @@ }, "node_modules/@parcel/optimizer-svgo": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-svgo/-/optimizer-svgo-2.10.2.tgz", - "integrity": "sha512-Ws+xd6nbetMCZHmRj54tIF8wYuu/JwkEvn5BotLE69l3naf2ELtsQ+PHg9G5jUa+PnSNMHhykIhBOqjxhTeq/w==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3425,18 +2893,16 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/commander": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, "node_modules/@parcel/optimizer-svgo/node_modules/css-select": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.0.1", @@ -3450,9 +2916,8 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/css-tree": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", "dev": true, + "license": "MIT", "dependencies": { "mdn-data": "2.0.14", "source-map": "^0.6.1" @@ -3463,9 +2928,8 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/csso": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", "dev": true, + "license": "MIT", "dependencies": { "css-tree": "^1.1.2" }, @@ -3475,15 +2939,13 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/mdn-data": { "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true + "dev": true, + "license": "CC0-1.0" }, "node_modules/@parcel/optimizer-svgo/node_modules/svgo": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", "dev": true, + "license": "MIT", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", @@ -3502,9 +2964,8 @@ }, "node_modules/@parcel/optimizer-swc": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-swc/-/optimizer-swc-2.10.2.tgz", - "integrity": "sha512-/4yMgMgLvF4yCHh0QnZlTUTpKobuFK/lNhB1i5yrtiipRaYcS+OgtakB83grfK+x1KwTbYjzXZBILwqu6GKJDQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3524,9 +2985,8 @@ }, "node_modules/@parcel/package-manager": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/package-manager/-/package-manager-2.10.2.tgz", - "integrity": "sha512-c91YYsIxjX3YhMvtPT7v2MpDOn/Qyw13bi1+0Ftd2JNjUZPlm8+xKizlmgvdi75dgs7dGIUVpvrGLU9LoKthCA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/fs": "2.10.2", @@ -3550,9 +3010,8 @@ }, "node_modules/@parcel/package-manager/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3565,9 +3024,8 @@ }, "node_modules/@parcel/packager-css": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-css/-/packager-css-2.10.2.tgz", - "integrity": "sha512-+X4dV7mBdOhXSHeg5gAkk0Qju6A1oezYIancqDC17zoFzbHUfD13nHNDOXrEfMNFVWy93lB8vLJwchH54MDMwQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3586,9 +3044,8 @@ }, "node_modules/@parcel/packager-html": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-html/-/packager-html-2.10.2.tgz", - "integrity": "sha512-GonfLzuzEkelJde89sq9P9LowLJrFNkuEt33nRokc1Q5TPNOWfTYb6difjuVIMr/j0c4nWlOzUrkGJsyo++F7w==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/types": "2.10.2", @@ -3607,9 +3064,8 @@ }, "node_modules/@parcel/packager-js": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-js/-/packager-js-2.10.2.tgz", - "integrity": "sha512-SgKJqIvMt+UJM0x3F21yBVsgdHbTnOnBrNJ7VoY3nujQX5fa+pxTf0emWuX1vSUDbBaJOmO/pC9rKwWP5enqfQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3631,9 +3087,8 @@ }, "node_modules/@parcel/packager-js/node_modules/globals": { "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -3646,9 +3101,8 @@ }, "node_modules/@parcel/packager-js/node_modules/type-fest": { "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -3658,9 +3112,8 @@ }, "node_modules/@parcel/packager-raw": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-raw/-/packager-raw-2.10.2.tgz", - "integrity": "sha512-+/O2DeMIB9d+1+zCPOkaf2aTl2rN5TFod/UcMzG/HGFlDVqhkV9xgfwV4rV+Vso5TlyHA4p53BFgvGWQBQJAQw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -3675,9 +3128,8 @@ }, "node_modules/@parcel/packager-svg": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-svg/-/packager-svg-2.10.2.tgz", - "integrity": "sha512-eQx3VJpuuDcen+DcLxlPn95txlnbpEH8TES+Ezym/LFyD8oQQfok/VFHy/iGoG4r1CtH0/c7lFUJE8+LZdwYmQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/types": "2.10.2", @@ -3695,9 +3147,8 @@ }, "node_modules/@parcel/packager-wasm": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-wasm/-/packager-wasm-2.10.2.tgz", - "integrity": "sha512-Y/UyyOePb3WmWy2WtmXn4QLLrb7wjWL/ZhVgvhFiQft4lCbdGBGz1BiKEzhFkkN2IGdX06XZolmKCQieAM6zlQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -3712,9 +3163,8 @@ }, "node_modules/@parcel/plugin": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/plugin/-/plugin-2.10.2.tgz", - "integrity": "sha512-1u+GJhuqqlYjMAQLBbMExfFCbsbtuSAm6wXmMmTse5cBpFqxgsMumMeztAhcTy0oMnMhbZg2AKZV0XVSMrIgng==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/types": "2.10.2" }, @@ -3728,9 +3178,8 @@ }, "node_modules/@parcel/profiler": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/profiler/-/profiler-2.10.2.tgz", - "integrity": "sha512-YQugGhf12u83O0RJLWbhkPV772nePPxNZjvFJmV++7buPUpgJW2m1lVOrut/s/8ZZIPqcxJe8dyxSSOtvdG7OQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/events": "2.10.2", @@ -3746,9 +3195,8 @@ }, "node_modules/@parcel/reporter-cli": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-cli/-/reporter-cli-2.10.2.tgz", - "integrity": "sha512-6/cLuiGfMh1ny8ULNOXJkugIvJRVo4tV4XA3vJXH96SYqFSfiWxtHqb6MAVndBy8MezEAv0EsLqc7yR7ygdZJw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/types": "2.10.2", @@ -3767,9 +3215,8 @@ }, "node_modules/@parcel/reporter-cli/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -3782,9 +3229,8 @@ }, "node_modules/@parcel/reporter-cli/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3798,9 +3244,8 @@ }, "node_modules/@parcel/reporter-cli/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -3810,24 +3255,21 @@ }, "node_modules/@parcel/reporter-cli/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/reporter-cli/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/reporter-cli/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3837,9 +3279,8 @@ }, "node_modules/@parcel/reporter-dev-server": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-dev-server/-/reporter-dev-server-2.10.2.tgz", - "integrity": "sha512-mLEcZFPpw0ixlvbT846NwmPEVv1ej7H5dwCQ3r1Ca1nQjyXkmQMM06rdb5M+/gk12WVEDOuienWqBL44Xsz3NA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2" @@ -3855,9 +3296,8 @@ }, "node_modules/@parcel/reporter-tracer": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-tracer/-/reporter-tracer-2.10.2.tgz", - "integrity": "sha512-oreu3vIdN5u9ONSNhqypcK3nR91NoreR4B4vwD/1Rqod1ud2Vb9awJZv7QIrkdnEMmGcr5DQ/R872s7XYWeZnA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -3875,9 +3315,8 @@ }, "node_modules/@parcel/resolver-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/resolver-default/-/resolver-default-2.10.2.tgz", - "integrity": "sha512-ENEq8f4wRQlU7p3tCelXWK6xIsL+57q9hQ+b4eRJOEctjfN1/BguxZDh+P+fIlJ1lkqiX4UB/PUkK97uSI5XTQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/node-resolver-core": "3.1.2", "@parcel/plugin": "2.10.2" @@ -3893,9 +3332,8 @@ }, "node_modules/@parcel/runtime-browser-hmr": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-browser-hmr/-/runtime-browser-hmr-2.10.2.tgz", - "integrity": "sha512-ABlCzDYI16lAZLTTL2g3JZasU/dWuSzRGK5paC6JhIJJwQwPeTwu4PaUoEPKeyk0iE9PzVuXjkBbGuSLXQFmmA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2" @@ -3911,9 +3349,8 @@ }, "node_modules/@parcel/runtime-js": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-js/-/runtime-js-2.10.2.tgz", - "integrity": "sha512-a6TaMVg1Xgy+WJJ0a3sC/Taw5hkN4hmLnz00jg7G6LwoGbBpvjJn8pm4eovkMFJz13RCjmS9q0K+qZnvXh1WYA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3931,9 +3368,8 @@ }, "node_modules/@parcel/runtime-react-refresh": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-react-refresh/-/runtime-react-refresh-2.10.2.tgz", - "integrity": "sha512-9xW3g4FH9iizHWscHD2yEWJOCfYkIYMbWsZoj0EOMILqrRd1OZxHH8FbLYBQKT6swRbZI2mM19veVVBBfxco/Q==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -3951,9 +3387,8 @@ }, "node_modules/@parcel/runtime-service-worker": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-service-worker/-/runtime-service-worker-2.10.2.tgz", - "integrity": "sha512-XY1GrY4r+zu0b/pZiTflZHdk9+I3XoxpExgPcZzep5hnq2UdyXbS4yDhmen7pTcqay5U9NmRw/62YrKL+yPang==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -3970,9 +3405,8 @@ }, "node_modules/@parcel/rust": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/rust/-/rust-2.10.2.tgz", - "integrity": "sha512-v/Cyf3iXlzSc6vgvPiEZzqdKAZ1jJ/aZX7y1YSupDh3RoqJI2bZ93kAOyEi+S7P3kshJkQM0px3YveJFOAMUOA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12.0.0" }, @@ -3983,9 +3417,8 @@ }, "node_modules/@parcel/source-map": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@parcel/source-map/-/source-map-2.1.1.tgz", - "integrity": "sha512-Ejx1P/mj+kMjQb8/y5XxDUn4reGdr+WyKYloBljpppUy8gs42T+BNoEOuRYqDVdgPc6NxduzIDoJS9pOFfV5Ew==", "dev": true, + "license": "MIT", "dependencies": { "detect-libc": "^1.0.3" }, @@ -3995,9 +3428,8 @@ }, "node_modules/@parcel/transformer-babel": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-babel/-/transformer-babel-2.10.2.tgz", - "integrity": "sha512-lmuksSzEBdPL1nVTznsQi5hQ+4mJ7GP+jvOv/Tvx3MjnzIu1G6Fs5MvNpAwBRXmG/F1+0aw/Wa8J38HYfN05dA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4019,9 +3451,8 @@ }, "node_modules/@parcel/transformer-babel/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4034,9 +3465,8 @@ }, "node_modules/@parcel/transformer-css": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-css/-/transformer-css-2.10.2.tgz", - "integrity": "sha512-WxKe1YherQrX0vEfxAsBALEIsztGStmfXF0GAMeynE4q/w1iHQdTzu29tqLrJY7x532Ric8TxnwO8zR0r89DJg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4057,9 +3487,8 @@ }, "node_modules/@parcel/transformer-html": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-html/-/transformer-html-2.10.2.tgz", - "integrity": "sha512-Zkg1HHdYp14ecdtNF+s4d/e1lr8/PAQgBTYhyEVLVC1N7uivjjZ9XClxZlHuZImbQvX3q3PgZS+PocIizhY4rQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4082,9 +3511,8 @@ }, "node_modules/@parcel/transformer-html/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4097,9 +3525,8 @@ }, "node_modules/@parcel/transformer-image": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-image/-/transformer-image-2.10.2.tgz", - "integrity": "sha512-sR2kTsPykYRujKR7ISn0d6Fhem1pMQoqm0cFTrtC9Te5pfIjZ72NfM9clP7jPK660Gd2DYudhUa48y+qKBfCAw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -4116,9 +3543,8 @@ }, "node_modules/@parcel/transformer-js": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-js/-/transformer-js-2.10.2.tgz", - "integrity": "sha512-qcVLyikhSVf3oHhzReECkKdPU5uHVH4L0TC5O9ahlsq2IUTqR8Swq+9wUgUN0S2aYFTWreH05bQwBCNrLzF/eQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4146,15 +3572,13 @@ }, "node_modules/@parcel/transformer-js/node_modules/regenerator-runtime": { "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/transformer-js/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4167,9 +3591,8 @@ }, "node_modules/@parcel/transformer-json": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-json/-/transformer-json-2.10.2.tgz", - "integrity": "sha512-iVgwuaLNqH3jgoBzMds63zd9FULvYb/s/5Hq9JZJ6pCZrOQoPruurgAW8A/t2IE4CSFkDDNoFvRpjsq1WBsSvA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "json5": "^2.2.0" @@ -4185,9 +3608,8 @@ }, "node_modules/@parcel/transformer-postcss": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-postcss/-/transformer-postcss-2.10.2.tgz", - "integrity": "sha512-2/ehCZgj5TOmsAIeGiLwrm6gO/M+X4fZ/O71MhpmXd8zr08j25T0VdSdw5UyopsBvtPYM7DI/FJCviZc7AigCg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4209,9 +3631,8 @@ }, "node_modules/@parcel/transformer-postcss/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4224,9 +3645,8 @@ }, "node_modules/@parcel/transformer-posthtml": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-posthtml/-/transformer-posthtml-2.10.2.tgz", - "integrity": "sha512-0jvqqXfrLqPYBD62aWIMldDnZ9hO/esX6TGKNhAO+85ljeaS2+QZ5XLLb8uPJq8UXB4olhsoEGyGtJSByigndg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -4247,9 +3667,8 @@ }, "node_modules/@parcel/transformer-posthtml/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4262,9 +3681,8 @@ }, "node_modules/@parcel/transformer-raw": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-raw/-/transformer-raw-2.10.2.tgz", - "integrity": "sha512-h6SoIZ3u+Lq8z8SEEAVsHg4IQbUtkBWCln5SG4qfjGiclUDDA2hcG7grsP06Wb6/U7oEc8n0ksTtaG4dekYIxw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -4279,9 +3697,8 @@ }, "node_modules/@parcel/transformer-react-refresh-wrap": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-react-refresh-wrap/-/transformer-react-refresh-wrap-2.10.2.tgz", - "integrity": "sha512-1jpzaEbKwJnDUmF8Kgf3/XvT9BnUWIQ7FWkg5EL5kEx6tq2KLKdzD17nFigNj8fr2V+faX0Qa63h+e3OOpnMAA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -4298,9 +3715,8 @@ }, "node_modules/@parcel/transformer-svg": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-svg/-/transformer-svg-2.10.2.tgz", - "integrity": "sha512-SsCjiM9LZwGne3LUn+GuwhyqklAnr7CER6D0ozdpw+tPOeODsXZXNSktvtpE1Qbia61c/zdlU0yOEuhkeXz29w==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4322,9 +3738,8 @@ }, "node_modules/@parcel/transformer-svg/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4337,9 +3752,8 @@ }, "node_modules/@parcel/types": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/types/-/types-2.10.2.tgz", - "integrity": "sha512-fwHJu03ROcc4/Kr/00VfOQUD6aV+6FBLN5bDW1+Xblgrpkb1MSUGTWRuz0YH5X6xhkVigC1llCIR2uHSwA+YBg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/cache": "2.10.2", "@parcel/diagnostic": "2.10.2", @@ -4352,9 +3766,8 @@ }, "node_modules/@parcel/utils": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/utils/-/utils-2.10.2.tgz", - "integrity": "sha512-XLUhTh0UkPB5n8r7agX9iIz9f+3JsBIVsmqltsJYX7n/GAa6EQtqrIYyZu8cEFeZlZw3zaf7wTmf9xJppdlj7Q==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/codeframe": "2.10.2", "@parcel/diagnostic": "2.10.2", @@ -4375,9 +3788,8 @@ }, "node_modules/@parcel/utils/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -4390,9 +3802,8 @@ }, "node_modules/@parcel/utils/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -4406,9 +3817,8 @@ }, "node_modules/@parcel/utils/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -4418,24 +3828,21 @@ }, "node_modules/@parcel/utils/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/utils/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/utils/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -4445,10 +3852,8 @@ }, "node_modules/@parcel/watcher": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.3.0.tgz", - "integrity": "sha512-pW7QaFiL11O0BphO+bq3MgqeX/INAk9jgBldVDYjlQPO4VddoZnF22TcF9onMhnLVHuNqBJeRf+Fj7eezi/+rQ==", "dev": true, - "hasInstallScript": true, + "license": "MIT", "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", @@ -4477,34 +3882,13 @@ "@parcel/watcher-win32-x64": "2.3.0" } }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.3.0.tgz", - "integrity": "sha512-f4o9eA3dgk0XRT3XhB0UWpWpLnKgrh1IwNJKJ7UJek7eTYccQ8LR7XUWFKqw6aEq5KUNlCcGvSzKqSX/vtWVVA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/@parcel/watcher-darwin-arm64": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.3.0.tgz", - "integrity": "sha512-mKY+oijI4ahBMc/GygVGvEdOq0L4DxhYgwQqYAz/7yPzuGi79oXrZG52WdpGA1wLBPrYb0T8uBaGFo7I6rvSKw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -4517,241 +3901,38 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.3.0.tgz", - "integrity": "sha512-20oBj8LcEOnLE3mgpy6zuOq8AplPu9NcSSSfyVKgfOhNAc4eF4ob3ldj0xWjGGbOF7Dcy1Tvm6ytvgdjlfUeow==", - "cpu": [ - "x64" - ], + "node_modules/@parcel/watcher/node_modules/node-addon-api": { + "version": "7.0.0", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT" + }, + "node_modules/@parcel/workers": { + "version": "2.10.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@parcel/diagnostic": "2.10.2", + "@parcel/logger": "2.10.2", + "@parcel/profiler": "2.10.2", + "@parcel/types": "2.10.2", + "@parcel/utils": "2.10.2", + "nullthrows": "^1.1.1" + }, "engines": { - "node": ">= 10.0.0" + "node": ">= 12.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.3.0.tgz", - "integrity": "sha512-7LftKlaHunueAEiojhCn+Ef2CTXWsLgTl4hq0pkhkTBFI3ssj2bJXmH2L67mKpiAD5dz66JYk4zS66qzdnIOgw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.3.0.tgz", - "integrity": "sha512-1apPw5cD2xBv1XIHPUlq0cO6iAaEUQ3BcY0ysSyD9Kuyw4MoWm1DV+W9mneWI+1g6OeP6dhikiFE6BlU+AToTQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.3.0.tgz", - "integrity": "sha512-mQ0gBSQEiq1k/MMkgcSB0Ic47UORZBmWoAWlMrTW6nbAGoLZP+h7AtUM7H3oDu34TBFFvjy4JCGP43JlylkTQA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.3.0.tgz", - "integrity": "sha512-LXZAExpepJew0Gp8ZkJ+xDZaTQjLHv48h0p0Vw2VMFQ8A+RKrAvpFuPVCVwKJCr5SE+zvaG+Etg56qXvTDIedw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.3.0.tgz", - "integrity": "sha512-P7Wo91lKSeSgMTtG7CnBS6WrA5otr1K7shhSjKHNePVmfBHDoAOHYRXgUmhiNfbcGk0uMCHVcdbfxtuiZCHVow==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.3.0.tgz", - "integrity": "sha512-+kiRE1JIq8QdxzwoYY+wzBs9YbJ34guBweTK8nlzLKimn5EQ2b2FSC+tAOpq302BuIMjyuUGvBiUhEcLIGMQ5g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.3.0.tgz", - "integrity": "sha512-35gXCnaz1AqIXpG42evcoP2+sNL62gZTMZne3IackM+6QlfMcJLy3DrjuL6Iks7Czpd3j4xRBzez3ADCj1l7Aw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.3.0.tgz", - "integrity": "sha512-FJS/IBQHhRpZ6PiCjFt1UAcPr0YmCLHRbTc00IBTrelEjlmmgIVLeOx4MSXzx2HFEy5Jo5YdhGpxCuqCyDJ5ow==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-x64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.3.0.tgz", - "integrity": "sha512-dLx+0XRdMnVI62kU3wbXvbIRhLck4aE28bIGKbRGS7BJNt54IIj9+c/Dkqb+7DJEbHUZAX1bwaoM8PqVlHJmCA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher/node_modules/node-addon-api": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.0.0.tgz", - "integrity": "sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==", - "dev": true - }, - "node_modules/@parcel/workers": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/workers/-/workers-2.10.2.tgz", - "integrity": "sha512-LvifdeORXKGGyhwOwnYxn1AsJ5u6Ihk2RJUxsVA4WYEjz2PSsmLAUDdp48ovssSMnTb9P2g4RrbEG1mJjYtBGA==", - "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.10.2", - "@parcel/logger": "2.10.2", - "@parcel/profiler": "2.10.2", - "@parcel/types": "2.10.2", - "@parcel/utils": "2.10.2", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.10.2" + }, + "peerDependencies": { + "@parcel/core": "^2.10.2" } }, "node_modules/@peculiar/asn1-cms": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.3.8.tgz", - "integrity": "sha512-Wtk9R7yQxGaIaawHorWKP2OOOm/RZzamOmSWwaqGphIuU6TcKYih0slL6asZlSSZtVoYTrBfrddSOD/jTu9vuQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4762,15 +3943,13 @@ }, "node_modules/@peculiar/asn1-cms/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-csr": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.3.8.tgz", - "integrity": "sha512-ZmAaP2hfzgIGdMLcot8gHTykzoI+X/S53x1xoGbTmratETIaAbSWMiPGvZmXRA0SNEIydpMkzYtq4fQBxN1u1w==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4780,15 +3959,13 @@ }, "node_modules/@peculiar/asn1-csr/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-ecc": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.3.8.tgz", - "integrity": "sha512-Ah/Q15y3A/CtxbPibiLM/LKcMbnLTdUdLHUgdpB5f60sSvGkXzxJCu5ezGTFHogZXWNX3KSmYqilCrfdmBc6pQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4798,15 +3975,13 @@ }, "node_modules/@peculiar/asn1-ecc/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-pfx": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.3.8.tgz", - "integrity": "sha512-XhdnCVznMmSmgy68B9pVxiZ1XkKoE1BjO4Hv+eUGiY1pM14msLsFZ3N7K46SoITIVZLq92kKkXpGiTfRjlNLyg==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-cms": "^2.3.8", "@peculiar/asn1-pkcs8": "^2.3.8", @@ -4818,15 +3993,13 @@ }, "node_modules/@peculiar/asn1-pfx/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-pkcs8": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.3.8.tgz", - "integrity": "sha512-rL8k2x59v8lZiwLRqdMMmOJ30GHt6yuHISFIuuWivWjAJjnxzZBVzMTQ72sknX5MeTSSvGwPmEFk2/N8+UztFQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4836,15 +4009,13 @@ }, "node_modules/@peculiar/asn1-pkcs8/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-pkcs9": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.3.8.tgz", - "integrity": "sha512-+nONq5tcK7vm3qdY7ZKoSQGQjhJYMJbwJGbXLFOhmqsFIxEWyQPHyV99+wshOjpOjg0wUSSkEEzX2hx5P6EKeQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-cms": "^2.3.8", "@peculiar/asn1-pfx": "^2.3.8", @@ -4858,15 +4029,13 @@ }, "node_modules/@peculiar/asn1-pkcs9/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-rsa": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.3.8.tgz", - "integrity": "sha512-ES/RVEHu8VMYXgrg3gjb1m/XG0KJWnV4qyZZ7mAg7rrF3VTmRbLxO8mk+uy0Hme7geSMebp+Wvi2U6RLLEs12Q==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4876,14 +4045,12 @@ }, "node_modules/@peculiar/asn1-rsa/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-schema": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.3.8.tgz", - "integrity": "sha512-ULB1XqHKx1WBU/tTFIA+uARuRoBVZ4pNdOA878RDrRbBfBGcSzi5HBkdScC6ZbHn8z7L8gmKCgPC1LHRrP46tA==", + "license": "MIT", "dependencies": { "asn1js": "^3.0.5", "pvtsutils": "^1.3.5", @@ -4892,14 +4059,12 @@ }, "node_modules/@peculiar/asn1-schema/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "license": "0BSD" }, "node_modules/@peculiar/asn1-x509": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.3.8.tgz", - "integrity": "sha512-voKxGfDU1c6r9mKiN5ZUsZWh3Dy1BABvTM3cimf0tztNwyMJPhiXY94eRTgsMQe6ViLfT6EoXxkWVzcm3mFAFw==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "asn1js": "^3.0.5", @@ -4910,9 +4075,8 @@ }, "node_modules/@peculiar/asn1-x509-attr": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.3.8.tgz", - "integrity": "sha512-4Z8mSN95MOuX04Aku9BUyMdsMKtVQUqWnr627IheiWnwFoheUhX3R4Y2zh23M7m80r4/WG8MOAckRKc77IRv6g==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4922,15 +4086,13 @@ }, "node_modules/@peculiar/asn1-x509-attr/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-x509/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/json-schema": { "version": "1.1.12", @@ -4958,9 +4120,8 @@ }, "node_modules/@peculiar/x509": { "version": "1.9.5", - "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.9.5.tgz", - "integrity": "sha512-6HBrlgoyH8sod0PTjQ8hzOL4/f5L94s5lwiL9Gr0P5HiSO8eeNgKoiB+s7VhDczE2aaloAgDXFjoQHVEcTg4mg==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-cms": "^2.3.6", "@peculiar/asn1-csr": "^2.3.6", @@ -4977,9 +4138,8 @@ }, "node_modules/@pm2/agent": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-2.0.3.tgz", - "integrity": "sha512-xkqqCoTf5VsciMqN0vb9jthW7olVAi4KRFNddCc7ZkeJZ3i8QwZANr4NSH2H5DvseRFHq7MiPspRY/EWAFWWTg==", "dev": true, + "license": "AGPL-3.0", "dependencies": { "async": "~3.2.0", "chalk": "~3.0.0", @@ -4998,9 +4158,8 @@ }, "node_modules/@pm2/agent/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -5013,9 +4172,8 @@ }, "node_modules/@pm2/agent/node_modules/chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5026,9 +4184,8 @@ }, "node_modules/@pm2/agent/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -5038,36 +4195,31 @@ }, "node_modules/@pm2/agent/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@pm2/agent/node_modules/dayjs": { "version": "1.8.36", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.36.tgz", - "integrity": "sha512-3VmRXEtw7RZKAf+4Tv1Ym9AGeo8r8+CjDi26x+7SYQil1UqtqdaokhzoEJohqlzt0m5kacJSDhJQkG/LWhpRBw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@pm2/agent/node_modules/eventemitter2": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz", - "integrity": "sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@pm2/agent/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@pm2/agent/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5080,9 +4232,8 @@ }, "node_modules/@pm2/agent/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -5092,9 +4243,8 @@ }, "node_modules/@pm2/agent/node_modules/ws": { "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -5113,9 +4263,8 @@ }, "node_modules/@pm2/io": { "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@pm2/io/-/io-5.0.2.tgz", - "integrity": "sha512-XAvrNoQPKOyO/jJyCu8jPhLzlyp35MEf7w/carHXmWKddPzeNOFSEpSEqMzPDawsvpxbE+i918cNN+MwgVsStA==", "dev": true, + "license": "Apache-2", "dependencies": { "@opencensus/core": "0.0.9", "@opencensus/propagation-b3": "0.0.8", @@ -5134,18 +4283,16 @@ }, "node_modules/@pm2/io/node_modules/async": { "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, + "license": "MIT", "dependencies": { "lodash": "^4.17.14" } }, "node_modules/@pm2/io/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5158,15 +4305,13 @@ }, "node_modules/@pm2/io/node_modules/tslib": { "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/@pm2/js-api": { "version": "0.6.7", - "resolved": "https://registry.npmjs.org/@pm2/js-api/-/js-api-0.6.7.tgz", - "integrity": "sha512-jiJUhbdsK+5C4zhPZNnyA3wRI01dEc6a2GhcQ9qI38DyIk+S+C8iC3fGjcjUbt/viLYKPjlAaE+hcT2/JMQPXw==", "dev": true, + "license": "Apache-2", "dependencies": { "async": "^2.6.3", "axios": "^0.21.0", @@ -5180,18 +4325,16 @@ }, "node_modules/@pm2/js-api/node_modules/async": { "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, + "license": "MIT", "dependencies": { "lodash": "^4.17.14" } }, "node_modules/@pm2/js-api/node_modules/ws": { "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -5210,9 +4353,8 @@ }, "node_modules/@pm2/pm2-version-check": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@pm2/pm2-version-check/-/pm2-version-check-1.0.4.tgz", - "integrity": "sha512-SXsM27SGH3yTWKc2fKR4SYNxsmnvuBQ9dd6QHtEWmiZ/VqaOYPAIlS8+vMcn27YLtAEBGvNRSh3TPNvtjZgfqA==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.3.1" } @@ -5296,9 +4438,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/esbuild": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-9.0.0.tgz", - "integrity": "sha512-y3NY0inaFeLqV6SRXNVILhawQdQcODxF30qft6OalsrqtQtBjt++6ZeahYhUbrVexUEWRh6c7yPCe8RvHn8hlA==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.19.2", "nanoid": "^3.3.6" @@ -5312,9 +4453,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/file": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-9.0.0.tgz", - "integrity": "sha512-oM2UaH2FRq4q22k+R+P6xCpzET10T94LFdSjb9svVu/vOD7NaB9LGcG6se8TW1BExXiyXO4GEhLsBt3uMKM3qA==", "dev": true, + "license": "MIT", "dependencies": { "semver": "7.5.4" }, @@ -5327,10 +4467,9 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/esbuild": { "version": "0.19.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", - "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -5364,9 +4503,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5379,9 +4517,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/size-limit": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-9.0.0.tgz", - "integrity": "sha512-DrA7o2DeRN3s+vwCA9nn7Ck9Y4pn9t0GNUwQRpKqBtBmNkl6LA2s/NlNCdtKHrEkRTeYA1ZQ65mnYveo9rUqgA==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -5399,10 +4536,9 @@ }, "node_modules/@swc/core": { "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.96.tgz", - "integrity": "sha512-zwE3TLgoZwJfQygdv2SdCK9mRLYluwDOM53I+dT6Z5ZvrgVENmY3txvWDvduzkV+/8IuvrRbVezMpxcojadRdQ==", "dev": true, "hasInstallScript": true, + "license": "Apache-2.0", "dependencies": { "@swc/counter": "^0.1.1", "@swc/types": "^0.1.5" @@ -5437,12 +4573,11 @@ }, "node_modules/@swc/core-darwin-arm64": { "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.96.tgz", - "integrity": "sha512-8hzgXYVd85hfPh6mJ9yrG26rhgzCmcLO0h1TIl8U31hwmTbfZLzRitFQ/kqMJNbIBCwmNH1RU2QcJnL3d7f69A==", "cpu": [ "arm64" ], "dev": true, + "license": "Apache-2.0 AND MIT", "optional": true, "os": [ "darwin" @@ -5452,179 +4587,23 @@ "node": ">=10" } }, - "node_modules/@swc/core-darwin-x64": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.96.tgz", - "integrity": "sha512-mFp9GFfuPg+43vlAdQZl0WZpZSE8sEzqL7sr/7Reul5McUHP0BaLsEzwjvD035ESfkY8GBZdLpMinblIbFNljQ==", - "cpu": [ - "x64" - ], + "node_modules/@swc/counter": { + "version": "0.1.2", "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">=10" + "license": "Apache-2.0" + }, + "node_modules/@swc/helpers": { + "version": "0.5.3", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.4.0" } }, - "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.96.tgz", - "integrity": "sha512-8UEKkYJP4c8YzYIY/LlbSo8z5Obj4hqcv/fUTHiEePiGsOddgGf7AWjh56u7IoN/0uEmEro59nc1ChFXqXSGyg==", - "cpu": [ - "arm" - ], + "node_modules/@swc/types": { + "version": "0.1.5", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.96.tgz", - "integrity": "sha512-c/IiJ0s1y3Ymm2BTpyC/xr6gOvoqAVETrivVXHq68xgNms95luSpbYQ28rqaZC8bQC8M5zdXpSc0T8DJu8RJGw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.96.tgz", - "integrity": "sha512-i5/UTUwmJLri7zhtF6SAo/4QDQJDH2fhYJaBIUhrICmIkRO/ltURmpejqxsM/ye9Jqv5zG7VszMC0v/GYn/7BQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.96.tgz", - "integrity": "sha512-USdaZu8lTIkm4Yf9cogct/j5eqtdZqTgcTib4I+NloUW0E/hySou3eSyp3V2UAA1qyuC72ld1otXuyKBna0YKQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-musl": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.96.tgz", - "integrity": "sha512-QYErutd+G2SNaCinUVobfL7jWWjGTI0QEoQ6hqTp7PxCJS/dmKmj3C5ZkvxRYcq7XcZt7ovrYCTwPTHzt6lZBg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.96.tgz", - "integrity": "sha512-hjGvvAduA3Un2cZ9iNP4xvTXOO4jL3G9iakhFsgVhpkU73SGmK7+LN8ZVBEu4oq2SUcHO6caWvnZ881cxGuSpg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.96.tgz", - "integrity": "sha512-Far2hVFiwr+7VPCM2GxSmbh3ikTpM3pDombE+d69hkedvYHYZxtTF+2LTKl/sXtpbUnsoq7yV/32c9R/xaaWfw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.96.tgz", - "integrity": "sha512-4VbSAniIu0ikLf5mBX81FsljnfqjoVGleEkCQv4+zRlyZtO3FHoDPkeLVoy6WRlj7tyrRcfUJ4mDdPkbfTO14g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/counter": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", - "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==", - "dev": true - }, - "node_modules/@swc/helpers": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.3.tgz", - "integrity": "sha512-FaruWX6KdudYloq1AHD/4nU+UsMTdNE8CKyrseXWEcgjDAbvkwJg2QGPAnfIJLIWsjZOSPLOAykK6fuYp4vp4A==", - "dev": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@swc/types": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.5.tgz", - "integrity": "sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==", - "dev": true + "license": "Apache-2.0" }, "node_modules/@szmarczak/http-timer": { "version": "5.0.1", @@ -5679,9 +4658,8 @@ }, "node_modules/@trysound/sax": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", - "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10.13.0" } @@ -5708,9 +4686,8 @@ }, "node_modules/@tsconfig/node17": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node17/-/node17-1.0.3.tgz", - "integrity": "sha512-hgCBRFxS8grt7H1zfUeRdNvGzL3ZETTszOHJ5o5Hr/XBpqrWcMb0Ufec9kJK3zCL2DJ4bflH3VxHF/cESEYF+w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/babel__core": { "version": "7.20.3", @@ -5751,9 +4728,8 @@ }, "node_modules/@types/base64-js": { "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/base64-js/-/base64-js-1.3.2.tgz", - "integrity": "sha512-Q2Xn2/vQHRGLRXhQ5+BSLwhHkR3JVflxVKywH0Q6fVoAiUE8fFYL2pE5/l2ZiOiBDfA8qUqRnSxln4G/NFz1Sg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/bs58check": { "version": "2.1.0", @@ -5765,15 +4741,13 @@ }, "node_modules/@types/chai": { "version": "4.3.10", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-of+ICnbqjmFCiixUnqRulbylyXQrPqIGf/B3Jax1wIF3DvSheysQxAWvqHhZiW3IQrycvokcLcFQlveGp+vyNg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/chai-subset": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.5.tgz", - "integrity": "sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==", "dev": true, + "license": "MIT", "dependencies": { "@types/chai": "*" } @@ -5788,9 +4762,8 @@ }, "node_modules/@types/hdkey": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/hdkey/-/hdkey-2.0.3.tgz", - "integrity": "sha512-U5W3b+f3KqCC7tge4WjV5MDzzYTcwbnufyL7RwEmxH2EyxtbfaQVlS8z6PZDp8XET304EEVhLWG76rF5ygUKHQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -5802,9 +4775,8 @@ }, "node_modules/@types/isomorphic-fetch": { "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.36.tgz", - "integrity": "sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", @@ -5893,9 +4865,8 @@ }, "node_modules/@types/secp256k1": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.6.tgz", - "integrity": "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -5907,15 +4878,13 @@ }, "node_modules/@types/sinonjs__fake-timers": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz", - "integrity": "sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/sizzle": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.6.tgz", - "integrity": "sha512-m04Om5Gz6kbjUwAQ7XJJQ30OdEFsSmAVsvn4NYwcTRyMVpKKa1aPuESw1n2CxS5fYkOQv3nHgDKeNa8e76fUkw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/stack-utils": { "version": "2.0.1", @@ -5924,9 +4893,8 @@ }, "node_modules/@types/text-encoding": { "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@types/text-encoding/-/text-encoding-0.0.36.tgz", - "integrity": "sha512-LfATA7bH+MtAPlOshYgQ1M3n2r0TSB6Ns5ESvKYlVugkKErQg5oFbR2qO7XrKtNsrtzedDvTeqQfyTjdPJH7jw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/tough-cookie": { "version": "4.0.4", @@ -5948,9 +4916,8 @@ }, "node_modules/@types/yauzl": { "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", - "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "@types/node": "*" @@ -6110,9 +5077,8 @@ }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ts-api-utils": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, + "license": "MIT", "engines": { "node": ">=16.13.0" }, @@ -6217,9 +5183,8 @@ }, "node_modules/@typescript-eslint/parser/node_modules/ts-api-utils": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, + "license": "MIT", "engines": { "node": ">=16.13.0" }, @@ -6427,9 +5392,8 @@ }, "node_modules/@vitest/expect": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", - "integrity": "sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==", "dev": true, + "license": "MIT", "dependencies": { "@vitest/spy": "0.34.6", "@vitest/utils": "0.34.6", @@ -6441,9 +5405,8 @@ }, "node_modules/@vitest/runner": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.6.tgz", - "integrity": "sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==", "dev": true, + "license": "MIT", "dependencies": { "@vitest/utils": "0.34.6", "p-limit": "^4.0.0", @@ -6455,9 +5418,8 @@ }, "node_modules/@vitest/runner/node_modules/p-limit": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^1.0.0" }, @@ -6470,9 +5432,8 @@ }, "node_modules/@vitest/runner/node_modules/yocto-queue": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.20" }, @@ -6482,9 +5443,8 @@ }, "node_modules/@vitest/snapshot": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.6.tgz", - "integrity": "sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==", "dev": true, + "license": "MIT", "dependencies": { "magic-string": "^0.30.1", "pathe": "^1.1.1", @@ -6496,9 +5456,8 @@ }, "node_modules/@vitest/spy": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.6.tgz", - "integrity": "sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==", "dev": true, + "license": "MIT", "dependencies": { "tinyspy": "^2.1.1" }, @@ -6508,9 +5467,8 @@ }, "node_modules/@vitest/utils": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.6.tgz", - "integrity": "sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==", "dev": true, + "license": "MIT", "dependencies": { "diff-sequences": "^29.4.3", "loupe": "^2.3.6", @@ -6522,9 +5480,8 @@ }, "node_modules/@vitest/utils/node_modules/diff-sequences": { "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true, + "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } @@ -6567,9 +5524,8 @@ }, "node_modules/abortcontroller-polyfill": { "version": "1.7.5", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", - "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/acorn": { "version": "8.10.0", @@ -6631,9 +5587,8 @@ }, "node_modules/aggregate-error": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", "dev": true, + "license": "MIT", "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" @@ -6663,15 +5618,13 @@ }, "node_modules/amp": { "version": "0.3.1", - "resolved": "https://registry.npmjs.org/amp/-/amp-0.3.1.tgz", - "integrity": "sha512-OwIuC4yZaRogHKiuU5WlMR5Xk/jAcpPtawWL05Gj8Lvm2F6mwoJt4O/bHI+DHwG79vWd+8OFYM4/BzYqyRd3qw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/amp-message": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/amp-message/-/amp-message-0.1.2.tgz", - "integrity": "sha512-JqutcFwoU1+jhv7ArgW38bqrE+LQdcRv4NxNw0mp0JHQyB6tXesWRjtYKlDgHRY2o3JE5UTaBGUK8kSWUdxWUg==", "dev": true, + "license": "MIT", "dependencies": { "amp": "0.3.1" } @@ -6686,9 +5639,8 @@ }, "node_modules/ansi-colors": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -6733,9 +5685,8 @@ }, "node_modules/ansicolors": { "version": "0.3.2", - "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", - "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/anymatch": { "version": "3.1.2", @@ -6751,8 +5702,6 @@ }, "node_modules/arch": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", - "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", "dev": true, "funding": [ { @@ -6767,7 +5716,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/are-docs-informative": { "version": "0.0.2", @@ -6891,18 +5841,16 @@ }, "node_modules/assert-plus": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8" } }, "node_modules/assertion-error": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -6920,22 +5868,21 @@ }, "node_modules/astral-regex": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/async": { "version": "3.2.4", + "dev": true, "license": "MIT" }, "node_modules/async-listener": { "version": "0.6.10", - "resolved": "https://registry.npmjs.org/async-listener/-/async-listener-0.6.10.tgz", - "integrity": "sha512-gpuo6xOyF4D5DE5WvyqZdPA3NGhiT6Qf07l7DCB0wwDEsLvDIbCr6j9S5aj5Ch96dLace5tXVzWBZkxU/c5ohw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "semver": "^5.3.0", "shimmer": "^1.1.0" @@ -6946,9 +5893,8 @@ }, "node_modules/async-listener/node_modules/semver": { "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } @@ -6968,9 +5914,8 @@ }, "node_modules/at-least-node": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "dev": true, + "license": "ISC", "engines": { "node": ">= 4.0.0" } @@ -6988,24 +5933,21 @@ }, "node_modules/aws-sign2": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "*" } }, "node_modules/aws4": { "version": "1.12.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", - "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/axios": { "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "dev": true, + "license": "MIT", "dependencies": { "follow-redirects": "^1.14.0" } @@ -7182,8 +6124,7 @@ }, "node_modules/base-x": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + "license": "MIT" }, "node_modules/base64-arraybuffer": { "version": "0.2.0", @@ -7235,9 +6176,8 @@ }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "tweetnacl": "^0.14.3" } @@ -7272,17 +6212,15 @@ }, "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==", "dev": true, + "license": "MIT", "dependencies": { "file-uri-to-path": "1.0.0" } }, "node_modules/bip39": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", - "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", + "license": "ISC", "dependencies": { "@noble/hashes": "^1.2.0" } @@ -7299,9 +6237,8 @@ }, "node_modules/blessed": { "version": "0.1.81", - "resolved": "https://registry.npmjs.org/blessed/-/blessed-0.1.81.tgz", - "integrity": "sha512-LoF5gae+hlmfORcG1M5+5XZi4LBmvlXTzwJWzUlPryN/SJdSflZvROM2TwkT0GMpq7oqT48NRd4GS7BiVBc5OQ==", "dev": true, + "license": "MIT", "bin": { "blessed": "bin/tput.js" }, @@ -7311,15 +6248,13 @@ }, "node_modules/blob-util": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz", - "integrity": "sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/bluebird": { "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/bn.js": { "version": "4.12.0", @@ -7327,15 +6262,13 @@ }, "node_modules/bodec": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bodec/-/bodec-0.1.0.tgz", - "integrity": "sha512-Ylo+MAo5BDUq1KA3f3R/MFhh+g8cnHmo8bz3YPGhI1znrMaf77ol1sfvYJzsw3nTE+Y2GryfDxBaR+AqpAkEHQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/boolbase": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/borc": { "version": "2.1.2", @@ -7571,9 +6504,8 @@ }, "node_modules/bs-logger": { "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", "dev": true, + "license": "MIT", "dependencies": { "fast-json-stable-stringify": "2.x" }, @@ -7583,16 +6515,14 @@ }, "node_modules/bs58": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "license": "MIT", "dependencies": { "base-x": "^4.0.0" } }, "node_modules/bs58check": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz", - "integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==", + "license": "MIT", "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^5.0.0" @@ -7630,9 +6560,8 @@ }, "node_modules/buffer-crc32": { "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -7666,9 +6595,8 @@ }, "node_modules/cac": { "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -7700,9 +6628,8 @@ }, "node_modules/cachedir": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", - "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -7753,9 +6680,8 @@ }, "node_modules/cardinal": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", - "integrity": "sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==", "dev": true, + "license": "MIT", "dependencies": { "ansicolors": "~0.3.2", "redeyed": "~2.1.0" @@ -7766,15 +6692,13 @@ }, "node_modules/caseless": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/chai": { "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", "dev": true, + "license": "MIT", "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.3", @@ -7816,24 +6740,21 @@ }, "node_modules/charenc": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": "*" } }, "node_modules/charm": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/charm/-/charm-0.1.2.tgz", - "integrity": "sha512-syedaZ9cPe7r3hoQA9twWYKu5AIyCswN5+szkmPBe9ccdLrj4bYaCnLVPTLd2kgVRc7+zoX4tyPgRnFKCj5YjQ==", - "dev": true + "dev": true, + "license": "MIT/X11" }, "node_modules/check-error": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, + "license": "MIT", "dependencies": { "get-func-name": "^2.0.2" }, @@ -7843,9 +6764,8 @@ }, "node_modules/check-more-types": { "version": "2.24.0", - "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", - "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } @@ -7889,9 +6809,8 @@ }, "node_modules/chrome-trace-event": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", - "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0" } @@ -7903,8 +6822,7 @@ }, "node_modules/cipher-base": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "license": "MIT", "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -7917,9 +6835,8 @@ }, "node_modules/clean-stack": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -7937,9 +6854,8 @@ }, "node_modules/cli-color": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz", - "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.61", @@ -7975,9 +6891,8 @@ }, "node_modules/cli-table3": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", "dev": true, + "license": "MIT", "dependencies": { "string-width": "^4.2.0" }, @@ -7990,8 +6905,6 @@ }, "node_modules/cli-tableau": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/cli-tableau/-/cli-tableau-2.0.1.tgz", - "integrity": "sha512-he+WTicka9cl0Fg/y+YyxcN6/bfQ/1O3QmgxRXDhABKqLzvoOSM4fMzp39uMyLBulAFuywD2N7UaoQE7WaADxQ==", "dev": true, "dependencies": { "chalk": "3.0.0" @@ -8002,9 +6915,8 @@ }, "node_modules/cli-tableau/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -8017,9 +6929,8 @@ }, "node_modules/cli-tableau/node_modules/chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8030,9 +6941,8 @@ }, "node_modules/cli-tableau/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -8042,24 +6952,21 @@ }, "node_modules/cli-tableau/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cli-tableau/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/cli-tableau/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8069,9 +6976,8 @@ }, "node_modules/cli-truncate": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", "dev": true, + "license": "MIT", "dependencies": { "slice-ansi": "^3.0.0", "string-width": "^4.2.0" @@ -8106,18 +7012,16 @@ }, "node_modules/clone": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8" } }, "node_modules/co": { "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", "dev": true, + "license": "MIT", "engines": { "iojs": ">= 1.0.0", "node": ">= 0.12.0" @@ -8143,12 +7047,12 @@ }, "node_modules/colorette": { "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/colors": { "version": "1.0.3", + "dev": true, "license": "MIT", "engines": { "node": ">=0.1.90" @@ -8171,18 +7075,16 @@ }, "node_modules/comment-parser": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", - "integrity": "sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12.0.0" } }, "node_modules/common-tags": { "version": "1.8.2", - "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", - "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", "dev": true, + "license": "MIT", "engines": { "node": ">=4.0.0" } @@ -8194,9 +7096,8 @@ }, "node_modules/concurrently": { "version": "7.6.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.6.0.tgz", - "integrity": "sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "date-fns": "^2.29.1", @@ -8221,9 +7122,8 @@ }, "node_modules/concurrently/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -8236,9 +7136,8 @@ }, "node_modules/concurrently/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8252,9 +7151,8 @@ }, "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8264,9 +7162,8 @@ }, "node_modules/concurrently/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -8276,24 +7173,21 @@ }, "node_modules/concurrently/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/concurrently/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/concurrently/node_modules/supports-color": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8344,9 +7238,8 @@ }, "node_modules/continuation-local-storage": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz", - "integrity": "sha512-jx44cconVqkCEEyLSKWwkvUXwO561jXMa3LPjTPsm5QR22PA0/mhe33FT4Xb5y74JDvt/Cq+5lm8S8rskLv9ZA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "async-listener": "^0.6.0", "emitter-listener": "^1.1.1" @@ -8362,15 +7255,13 @@ }, "node_modules/core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cosmiconfig": { "version": "8.3.6", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", - "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", "dev": true, + "license": "MIT", "dependencies": { "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", @@ -8394,8 +7285,7 @@ }, "node_modules/create-hash": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "license": "MIT", "dependencies": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", @@ -8511,9 +7401,8 @@ }, "node_modules/croner": { "version": "4.1.97", - "resolved": "https://registry.npmjs.org/croner/-/croner-4.1.97.tgz", - "integrity": "sha512-/f6gpQuxDaqXu+1kwQYSckUglPaOrHdbIlBAu0YuW8/Cdb45XwXYNUBXg3r/9Mo6n540Kn/smKcZWko5x99KrQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { "version": "7.0.3", @@ -8530,9 +7419,8 @@ }, "node_modules/crypt": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": "*" } @@ -8564,9 +7452,8 @@ }, "node_modules/css-select": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "dependencies": { @@ -8582,9 +7469,8 @@ }, "node_modules/css-select/node_modules/dom-serializer": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8598,9 +7484,8 @@ }, "node_modules/css-select/node_modules/domhandler": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "dependencies": { @@ -8615,9 +7500,8 @@ }, "node_modules/css-select/node_modules/domutils": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", - "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "dependencies": { @@ -8631,9 +7515,8 @@ }, "node_modules/css-select/node_modules/entities": { "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "engines": { @@ -8645,9 +7528,8 @@ }, "node_modules/css-tree": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", - "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8660,9 +7542,8 @@ }, "node_modules/css-what": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", - "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">= 6" }, @@ -8672,9 +7553,8 @@ }, "node_modules/csso": { "version": "5.0.5", - "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", - "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8687,9 +7567,8 @@ }, "node_modules/csso/node_modules/css-tree": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", - "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8703,9 +7582,8 @@ }, "node_modules/csso/node_modules/mdn-data": { "version": "2.0.28", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", - "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", "dev": true, + "license": "CC0-1.0", "optional": true, "peer": true }, @@ -8732,22 +7610,21 @@ }, "node_modules/culvert": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/culvert/-/culvert-0.1.2.tgz", - "integrity": "sha512-yi1x3EAWKjQTreYWeSd98431AV+IEE0qoDyOoaHJ7KJ21gv6HtBXHVLX74opVSGqcR8/AbjJBHAHpcOy2bj5Gg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cycle": { "version": "1.0.3", + "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/cypress": { "version": "13.5.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.5.0.tgz", - "integrity": "sha512-oh6U7h9w8wwHfzNDJQ6wVcAeXu31DlIYlNOBvfd6U4CcB8oe4akawQmH+QJVOMZlM42eBoCne015+svVqdwdRQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", @@ -8802,18 +7679,16 @@ }, "node_modules/cypress/node_modules/@types/node": { "version": "18.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/cypress/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -8826,8 +7701,6 @@ }, "node_modules/cypress/node_modules/buffer": { "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "dev": true, "funding": [ { @@ -8843,6 +7716,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -8850,9 +7724,8 @@ }, "node_modules/cypress/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8866,9 +7739,8 @@ }, "node_modules/cypress/node_modules/chalk/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8878,9 +7750,8 @@ }, "node_modules/cypress/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -8890,24 +7761,21 @@ }, "node_modules/cypress/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cypress/node_modules/commander": { "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/cypress/node_modules/execa": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", "dev": true, + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", @@ -8928,9 +7796,8 @@ }, "node_modules/cypress/node_modules/fs-extra": { "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, + "license": "MIT", "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", @@ -8943,9 +7810,8 @@ }, "node_modules/cypress/node_modules/get-stream": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, + "license": "MIT", "dependencies": { "pump": "^3.0.0" }, @@ -8958,27 +7824,24 @@ }, "node_modules/cypress/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/cypress/node_modules/human-signals": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=8.12.0" } }, "node_modules/cypress/node_modules/jsonfile": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, + "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -8988,15 +7851,13 @@ }, "node_modules/cypress/node_modules/proxy-from-env": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", - "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cypress/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -9009,9 +7870,8 @@ }, "node_modules/cypress/node_modules/supports-color": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -9024,18 +7884,16 @@ }, "node_modules/cypress/node_modules/universalify": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10.0.0" } }, "node_modules/d": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", "dev": true, + "license": "ISC", "dependencies": { "es5-ext": "^0.10.50", "type": "^1.0.1" @@ -9043,9 +7901,8 @@ }, "node_modules/dashdash": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, + "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" }, @@ -9088,9 +7945,8 @@ }, "node_modules/date-fns": { "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.21.0" }, @@ -9104,16 +7960,14 @@ }, "node_modules/dayjs": { "version": "1.11.10", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", - "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/deasync": { "version": "0.1.29", - "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.29.tgz", - "integrity": "sha512-EBtfUhVX23CE9GR6m+F8WPeImEE4hR/FW9RkK0PMl9V1t283s0elqsTD8EZjaKX28SY1BW2rYfCgNsAYdpamUw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "bindings": "^1.5.0", "node-addon-api": "^1.7.1" @@ -9124,9 +7978,8 @@ }, "node_modules/deasync/node_modules/node-addon-api": { "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/debug": { "version": "4.3.4", @@ -9176,9 +8029,8 @@ }, "node_modules/dedent": { "version": "1.5.1", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", - "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", "dev": true, + "license": "MIT", "peerDependencies": { "babel-plugin-macros": "^3.1.0" }, @@ -9190,9 +8042,8 @@ }, "node_modules/deep-eql": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, + "license": "MIT", "dependencies": { "type-detect": "^4.0.0" }, @@ -9215,9 +8066,8 @@ }, "node_modules/deepmerge": { "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -9398,9 +8248,8 @@ }, "node_modules/define-lazy-prop": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -9456,9 +8305,8 @@ }, "node_modules/detect-libc": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", "dev": true, + "license": "Apache-2.0", "bin": { "detect-libc": "bin/detect-libc.js" }, @@ -9514,9 +8362,8 @@ }, "node_modules/dom-serializer": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", - "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", "dev": true, + "license": "MIT", "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.2.0", @@ -9528,24 +8375,22 @@ }, "node_modules/dom-serializer/node_modules/entities": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", "dev": true, + "license": "BSD-2-Clause", "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } }, "node_modules/domelementtype": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/fb55" } - ] + ], + "license": "BSD-2-Clause" }, "node_modules/domexception": { "version": "4.0.0", @@ -9560,9 +8405,8 @@ }, "node_modules/domhandler": { "version": "4.3.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", - "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "domelementtype": "^2.2.0" }, @@ -9575,9 +8419,8 @@ }, "node_modules/domutils": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "dom-serializer": "^1.0.1", "domelementtype": "^2.2.0", @@ -9603,18 +8446,16 @@ }, "node_modules/dotenv": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-7.0.0.tgz", - "integrity": "sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=6" } }, "node_modules/dotenv-expand": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", - "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/eastasianwidth": { "version": "0.2.0", @@ -9623,9 +8464,8 @@ }, "node_modules/ecc-jsbn": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, + "license": "MIT", "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -9655,9 +8495,8 @@ }, "node_modules/emitter-listener": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/emitter-listener/-/emitter-listener-1.1.2.tgz", - "integrity": "sha512-Bt1sBAGFHY9DKY+4/2cV6izcKJUf5T7/gkdmkxzX/qv9CcGH8xSwVRW5mtX03SWJtRTWSOpzCuWN9rBFYZepZQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "shimmer": "^1.2.0" } @@ -9688,9 +8527,8 @@ }, "node_modules/enquirer": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", - "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" @@ -9701,9 +8539,8 @@ }, "node_modules/entities": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.12" }, @@ -9831,10 +8668,9 @@ }, "node_modules/es5-ext": { "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", "dev": true, "hasInstallScript": true, + "license": "ISC", "dependencies": { "es6-iterator": "^2.0.3", "es6-symbol": "^3.1.3", @@ -9846,9 +8682,8 @@ }, "node_modules/es6-iterator": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "^0.10.35", @@ -9857,9 +8692,8 @@ }, "node_modules/es6-map": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha512-mz3UqCh0uPCIqsw1SSAkB/p0rOzF/M0V++vyN7JqlPtSW/VsYgQBvVvqMLmfBuyMzTpLnNqi6JmcSizs4jy19A==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "~0.10.14", @@ -9871,9 +8705,8 @@ }, "node_modules/es6-set": { "version": "0.1.6", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.6.tgz", - "integrity": "sha512-TE3LgGLDIBX332jq3ypv6bcOpkLO0AslAQo7p2VqX/1N46YNsvIWgvjojjSEnWEGWMhr1qUbYeTSir5J6mFHOw==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.62", @@ -9888,15 +8721,13 @@ }, "node_modules/es6-set/node_modules/type": { "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/es6-symbol": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "ext": "^1.1.2" @@ -9904,9 +8735,8 @@ }, "node_modules/es6-weak-map": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", "dev": true, + "license": "ISC", "dependencies": { "d": "1", "es5-ext": "^0.10.46", @@ -9950,405 +8780,371 @@ "esbuild-windows-arm64": "0.15.16" } }, - "node_modules/esbuild-android-64": { + "node_modules/esbuild-darwin-arm64": { "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.16.tgz", - "integrity": "sha512-Vwkv/sT0zMSgPSVO3Jlt1pUbnZuOgtOQJkJkyyJFAlLe7BiT8e9ESzo0zQSx4c3wW4T6kGChmKDPMbWTgtliQA==", "cpu": [ - "x64" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "darwin" ], "engines": { "node": ">=12" } }, - "node_modules/esbuild-android-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.16.tgz", - "integrity": "sha512-lqfKuofMExL5niNV3gnhMUYacSXfsvzTa/58sDlBET/hCOG99Zmeh+lz6kvdgvGOsImeo6J9SW21rFCogNPLxg==", - "cpu": [ - "arm64" - ], + "node_modules/escalade": { + "version": "3.1.1", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6" } }, - "node_modules/esbuild-darwin-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.16.tgz", - "integrity": "sha512-wo2VWk/n/9V2TmqUZ/KpzRjCEcr00n7yahEdmtzlrfQ3lfMCf3Wa+0sqHAbjk3C6CKkR3WKK/whkMq5Gj4Da9g==", - "cpu": [ - "x64" - ], + "node_modules/escape-goat": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-darwin-arm64": { - "version": "0.15.16", - "cpu": [ - "arm64" - ], + "node_modules/escape-string-regexp": { + "version": "1.0.5", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], "engines": { - "node": ">=12" + "node": ">=0.8.0" } }, - "node_modules/esbuild-freebsd-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.16.tgz", - "integrity": "sha512-UzIc0xlRx5x9kRuMr+E3+hlSOxa/aRqfuMfiYBXu2jJ8Mzej4lGL7+o6F5hzhLqWfWm1GWHNakIdlqg1ayaTNQ==", - "cpu": [ - "x64" - ], + "node_modules/escodegen": { + "version": "2.1.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, "engines": { - "node": ">=12" + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" } }, - "node_modules/esbuild-freebsd-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.16.tgz", - "integrity": "sha512-8xyiYuGc0DLZphFQIiYaLHlfoP+hAN9RHbE+Ibh8EUcDNHAqbQgUrQg7pE7Bo00rXmQ5Ap6KFgcR0b4ALZls1g==", - "cpu": [ - "arm64" - ], + "node_modules/escodegen/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "BSD-2-Clause", "engines": { - "node": ">=12" + "node": ">=4.0" } }, - "node_modules/esbuild-linux-32": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.16.tgz", - "integrity": "sha512-iGijUTV+0kIMyUVoynK0v+32Oi8yyp0xwMzX69GX+5+AniNy/C/AL1MjFTsozRp/3xQPl7jVux/PLe2ds10/2w==", - "cpu": [ - "ia32" - ], + "node_modules/escope": { + "version": "3.6.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-2-Clause", + "dependencies": { + "es6-map": "^0.1.3", + "es6-weak-map": "^2.0.1", + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, "engines": { - "node": ">=12" + "node": ">=0.4.0" } }, - "node_modules/esbuild-linux-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.16.tgz", - "integrity": "sha512-tuSOjXdLw7VzaUj89fIdAaQT7zFGbKBcz4YxbWrOiXkwscYgE7HtTxUavreBbnRkGxKwr9iT/gmeJWNm4djy/g==", - "cpu": [ - "x64" - ], + "node_modules/eslint": { + "version": "8.53.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.53.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/esbuild-linux-arm": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.16.tgz", - "integrity": "sha512-XKcrxCEXDTOuoRj5l12tJnkvuxXBMKwEC5j0JISw3ziLf0j4zIwXbKbTmUrKFWbo6ZgvNpa7Y5dnbsjVvH39bQ==", - "cpu": [ - "arm" - ], + "node_modules/eslint-plugin-cypress": { + "version": "2.15.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "globals": "^13.20.0" + }, + "peerDependencies": { + "eslint": ">= 3.2.1" } }, - "node_modules/esbuild-linux-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.16.tgz", - "integrity": "sha512-mPYksnfHnemNrvjrDhZyixL/AfbJN0Xn9S34ZOHYdh6/jJcNd8iTsv3JwJoEvTJqjMggjMhGUPJAdjnFBHoH8A==", - "cpu": [ - "arm64" - ], + "node_modules/eslint-plugin-cypress/node_modules/globals": { + "version": "13.23.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-linux-mips64le": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.16.tgz", - "integrity": "sha512-kSJO2PXaxfm0pWY39+YX+QtpFqyyrcp0ZeI8QPTrcFVQoWEPiPVtOfTZeS3ZKedfH+Ga38c4DSzmKMQJocQv6A==", - "cpu": [ - "mips64el" - ], + "node_modules/eslint-plugin-cypress/node_modules/type-fest": { + "version": "0.20.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-linux-ppc64le": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.16.tgz", - "integrity": "sha512-NimPikwkBY0yGABw6SlhKrtT35sU4O23xkhlrTT/O6lSxv3Pm5iSc6OYaqVAHWkLdVf31bF4UDVFO+D990WpAA==", - "cpu": [ - "ppc64" - ], + "node_modules/eslint-plugin-jsdoc": { + "version": "46.8.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-3-Clause", + "dependencies": { + "@es-joy/jsdoccomment": "~0.40.1", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.0", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.5.4", + "spdx-expression-parse": "^3.0.1" + }, "engines": { - "node": ">=12" + "node": ">=16" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" } }, - "node_modules/esbuild-linux-riscv64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.16.tgz", - "integrity": "sha512-ty2YUHZlwFOwp7pR+J87M4CVrXJIf5ZZtU/umpxgVJBXvWjhziSLEQxvl30SYfUPq0nzeWKBGw5i/DieiHeKfw==", - "cpu": [ - "riscv64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/@es-joy/jsdoccomment": { + "version": "0.40.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "comment-parser": "1.4.0", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, "engines": { - "node": ">=12" + "node": ">=16" } }, - "node_modules/esbuild-linux-s390x": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.16.tgz", - "integrity": "sha512-VkZaGssvPDQtx4fvVdZ9czezmyWyzpQhEbSNsHZZN0BHvxRLOYAQ7sjay8nMQwYswP6O2KlZluRMNPYefFRs+w==", - "cpu": [ - "s390x" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/comment-parser": { + "version": "1.4.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 12.0.0" } }, - "node_modules/esbuild-netbsd-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.16.tgz", - "integrity": "sha512-ElQ9rhdY51et6MJTWrCPbqOd/YuPowD7Cxx3ee8wlmXQQVW7UvQI6nSprJ9uVFQISqSF5e5EWpwWqXZsECLvXg==", - "cpu": [ - "x64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-openbsd-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.16.tgz", - "integrity": "sha512-KgxMHyxMCT+NdLQE1zVJEsLSt2QQBAvJfmUGDmgEq8Fvjrf6vSKB00dVHUEDKcJwMID6CdgCpvYNt999tIYhqA==", - "cpu": [ - "x64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=12.0.0" } }, - "node_modules/esbuild-sunos-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.16.tgz", - "integrity": "sha512-exSAx8Phj7QylXHlMfIyEfNrmqnLxFqLxdQF6MBHPdHAjT7fsKaX6XIJn+aQEFiOcE4X8e7VvdMCJ+WDZxjSRQ==", - "cpu": [ - "x64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/semver": { + "version": "7.5.4", "dev": true, - "optional": true, - "os": [ - "sunos" - ], + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, "engines": { - "node": ">=12" + "node": ">=10" } }, - "node_modules/esbuild-windows-32": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.16.tgz", - "integrity": "sha512-zQgWpY5pUCSTOwqKQ6/vOCJfRssTvxFuEkpB4f2VUGPBpdddZfdj8hbZuFRdZRPIVHvN7juGcpgCA/XCF37mAQ==", - "cpu": [ - "ia32" - ], + "node_modules/eslint-plugin-prettier": { + "version": "4.2.1", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">=12.0.0" + }, + "peerDependencies": { + "eslint": ">=7.28.0", + "prettier": ">=2.0.0" + }, + "peerDependenciesMeta": { + "eslint-config-prettier": { + "optional": true + } } }, - "node_modules/esbuild-windows-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.16.tgz", - "integrity": "sha512-HjW1hHRLSncnM3MBCP7iquatHVJq9l0S2xxsHHj4yzf4nm9TU4Z7k4NkeMlD/dHQ4jPlQQhwcMvwbJiOefSuZw==", - "cpu": [ - "x64" - ], + "node_modules/eslint-scope": { + "version": "5.1.1", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, "engines": { - "node": ">=12" + "node": ">=8.0.0" } }, - "node_modules/esbuild-windows-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.16.tgz", - "integrity": "sha512-oCcUKrJaMn04Vxy9Ekd8x23O8LoU01+4NOkQ2iBToKgnGj5eo1vU9i27NQZ9qC8NFZgnQQZg5oZWAejmbsppNA==", - "cpu": [ - "arm64" - ], + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/esbuild/node_modules/@esbuild/android-arm": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.16.tgz", - "integrity": "sha512-nyB6CH++2mSgx3GbnrJsZSxzne5K0HMyNIWafDHqYy7IwxFc4fd/CgHVZXr8Eh+Q3KbIAcAe3vGyqIPhGblvMQ==", - "cpu": [ - "arm" - ], + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/esbuild/node_modules/@esbuild/linux-loong64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.16.tgz", - "integrity": "sha512-SDLfP1uoB0HZ14CdVYgagllgrG7Mdxhkt4jDJOKl/MldKrkQ6vDJMZKl2+5XsEY/Lzz37fjgLQoJBGuAw/x8kQ==", - "cpu": [ - "loong64" - ], + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/escalade": { - "version": "3.1.1", + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">=6" + "node": ">=7.0.0" } }, - "node_modules/escape-goat": { + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=12" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "2.1.0", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">=6.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, - "optionalDependencies": { - "source-map": "~0.6.1" + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/escodegen/node_modules/estraverse": { + "node_modules/eslint/node_modules/estraverse": { "version": "5.3.0", "dev": true, "license": "BSD-2-Clause", @@ -10356,232 +9152,202 @@ "node": ">=4.0" } }, - "node_modules/escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha512-75IUQsusDdalQEW/G/2esa87J7raqdJF+Ca0/Xm5C3Q58Nr4yVYjZGp/P1+2xiEVgXRrA39dpRb8LcshajbqDQ==", + "node_modules/eslint/node_modules/globals": { + "version": "13.23.0", "dev": true, + "license": "MIT", "dependencies": { - "es6-map": "^0.1.3", - "es6-weak-map": "^2.0.1", - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" + "type-fest": "^0.20.2" }, "engines": { - "node": ">=0.4.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint": { - "version": "8.53.0", + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", "dev": true, "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.3", - "@eslint/js": "8.53.0", - "@humanwhocodes/config-array": "^0.11.13", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=8" } }, - "node_modules/eslint-plugin-cypress": { - "version": "2.15.1", + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", "dependencies": { - "globals": "^13.20.0" + "has-flag": "^4.0.0" }, - "peerDependencies": { - "eslint": ">= 3.2.1" + "engines": { + "node": ">=8" } }, - "node_modules/eslint-plugin-cypress/node_modules/globals": { - "version": "13.23.0", + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-cypress/node_modules/type-fest": { - "version": "0.20.2", + "node_modules/espree": { + "version": "9.6.1", "dev": true, - "license": "(MIT OR CC0-1.0)", + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-plugin-jsdoc": { - "version": "46.8.2", + "node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@es-joy/jsdoccomment": "~0.40.1", - "are-docs-informative": "^0.0.2", - "comment-parser": "1.4.0", - "debug": "^4.3.4", - "escape-string-regexp": "^4.0.0", - "esquery": "^1.5.0", - "is-builtin-module": "^3.2.1", - "semver": "^7.5.4", - "spdx-expression-parse": "^3.0.1" + "estraverse": "^5.1.0" }, "engines": { - "node": ">=16" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "node": ">=0.10" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/@es-joy/jsdoccomment": { - "version": "0.40.1", + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "comment-parser": "1.4.0", - "esquery": "^1.5.0", - "jsdoc-type-pratt-parser": "~4.0.0" + "estraverse": "^5.2.0" }, "engines": { - "node": ">=16" + "node": ">=4.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/comment-parser": { - "version": "1.4.0", + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "engines": { - "node": ">= 12.0.0" + "node": ">=4.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { - "version": "4.0.0", + "node_modules/estraverse": { + "version": "4.3.0", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=4.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/jsdoc-type-pratt-parser": { - "version": "4.0.0", + "node_modules/esutils": { + "version": "2.0.3", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "engines": { - "node": ">=12.0.0" + "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/semver": { - "version": "7.5.4", + "node_modules/event-emitter": { + "version": "0.3.5", "dev": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" + "d": "1", + "es5-ext": "~0.10.14" } }, - "node_modules/eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "node_modules/eventemitter2": { + "version": "6.4.7", + "dev": true, + "license": "MIT" + }, + "node_modules/execa": { + "version": "5.1.1", "dev": true, + "license": "MIT", "dependencies": { - "prettier-linter-helpers": "^1.0.0" + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" }, "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "eslint": ">=7.28.0", - "prettier": ">=2.0.0" + "node": ">=10" }, - "peerDependenciesMeta": { - "eslint-config-prettier": { - "optional": true - } + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", + "node_modules/executable": { + "version": "4.1.1", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "pify": "^2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=4" } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", + "node_modules/exit": { + "version": "0.1.2", "dev": true, - "license": "Apache-2.0", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" }, - "funding": { - "url": "https://opencollective.com/eslint" + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/eslint/node_modules/ansi-styles": { + "node_modules/expect/node_modules/ansi-styles": { "version": "4.3.0", "dev": true, "license": "MIT", @@ -10595,7 +9361,7 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/eslint/node_modules/chalk": { + "node_modules/expect/node_modules/chalk": { "version": "4.1.2", "dev": true, "license": "MIT", @@ -10610,7 +9376,7 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/eslint/node_modules/color-convert": { + "node_modules/expect/node_modules/color-convert": { "version": "2.0.1", "dev": true, "license": "MIT", @@ -10621,496 +9387,212 @@ "node": ">=7.0.0" } }, - "node_modules/eslint/node_modules/color-name": { + "node_modules/expect/node_modules/color-name": { "version": "1.1.4", "dev": true, "license": "MIT" }, - "node_modules/eslint/node_modules/escape-string-regexp": { + "node_modules/expect/node_modules/has-flag": { "version": "4.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", + "node_modules/expect/node_modules/jest-util": { + "version": "29.7.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", "engines": { - "node": ">=4.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/eslint/node_modules/globals": { - "version": "13.23.0", + "node_modules/expect/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", "dependencies": { - "type-fest": "^0.20.2" + "has-flag": "^4.0.0" }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", + "node_modules/ext": { + "version": "1.7.0", "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" + "license": "ISC", + "dependencies": { + "type": "^2.7.2" } }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", + "node_modules/ext/node_modules/type": { + "version": "2.7.2", "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } + "license": "ISC" }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", + "node_modules/extend": { + "version": "3.0.2", "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, - "node_modules/espree": { - "version": "9.6.1", + "node_modules/external-editor": { + "version": "3.1.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=4" } }, - "node_modules/esprima": { - "version": "4.0.1", + "node_modules/external-editor/node_modules/iconv-lite": { + "version": "0.4.24", "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { - "node": ">=4" + "node": ">=0.10.0" } }, - "node_modules/esquery": { - "version": "1.5.0", + "node_modules/external-editor/node_modules/tmp": { + "version": "0.0.33", "dev": true, - "license": "BSD-3-Clause", + "license": "MIT", "dependencies": { - "estraverse": "^5.1.0" + "os-tmpdir": "~1.0.2" }, "engines": { - "node": ">=0.10" + "node": ">=0.6.0" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", + "node_modules/extract-zip": { + "version": "2.0.1", "dev": true, "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, "engines": { - "node": ">=4.0" + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" } }, - "node_modules/esrecurse": { - "version": "4.3.0", + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "estraverse": "^5.2.0" + "pump": "^3.0.0" }, "engines": { - "node": ">=4.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", + "node_modules/extsprintf": { + "version": "1.3.0", "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" }, - "node_modules/estraverse": { - "version": "4.3.0", + "node_modules/eyes": { + "version": "0.1.8", "dev": true, - "license": "BSD-2-Clause", "engines": { - "node": ">=4.0" + "node": "> 0.1.90" } }, - "node_modules/esutils": { - "version": "2.0.3", + "node_modules/fake-indexeddb": { + "version": "4.0.0", "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" + "license": "Apache-2.0", + "dependencies": { + "realistic-structured-clone": "^3.0.0" } }, - "node_modules/event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", + "node_modules/fast-deep-equal": { + "version": "3.1.3", "dev": true, - "dependencies": { - "d": "1", - "es5-ext": "~0.10.14" - } + "license": "MIT" }, - "node_modules/eventemitter2": { - "version": "6.4.7", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", - "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==", - "dev": true + "node_modules/fast-diff": { + "version": "1.3.0", + "dev": true, + "license": "Apache-2.0" }, - "node_modules/execa": { - "version": "5.1.1", + "node_modules/fast-glob": { + "version": "3.3.1", "dev": true, "license": "MIT", "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" + "node": ">=8.6.0" } }, - "node_modules/executable": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", - "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", "dev": true, + "license": "ISC", "dependencies": { - "pify": "^2.2.0" + "is-glob": "^4.0.1" }, "engines": { - "node": ">=4" + "node": ">= 6" } }, - "node_modules/exit": { - "version": "0.1.2", + "node_modules/fast-json-patch": { + "version": "3.1.1", "dev": true, - "engines": { - "node": ">= 0.8.0" - } + "license": "MIT" }, - "node_modules/expect": { - "version": "29.7.0", + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", "dev": true, - "license": "MIT", + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.13.0", + "dev": true, + "license": "ISC", "dependencies": { - "@jest/expect-utils": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/expect/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/expect/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/expect/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/expect/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/expect/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/expect/node_modules/jest-util": { - "version": "29.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/expect/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dev": true, - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", - "dev": true - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "node_modules/external-editor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/external-editor/node_modules/iconv-lite": { - "version": "0.4.24", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/external-editor/node_modules/tmp": { - "version": "0.0.33", - "dev": true, - "license": "MIT", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/extract-zip/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "dev": true, - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/eyes": { - "version": "0.1.8", - "engines": { - "node": "> 0.1.90" - } - }, - "node_modules/fake-indexeddb": { - "version": "4.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "realistic-structured-clone": "^3.0.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fast-json-patch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", - "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/fastq": { - "version": "1.13.0", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" + "reusify": "^1.0.4" } }, "node_modules/fb-watchman": { @@ -11123,15 +9605,13 @@ }, "node_modules/fclone": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz", - "integrity": "sha512-GDqVQezKzRABdeqflsgMr7ktzgF9CyS+p2oe0jJqUY6izSSbhPIQJDpoU4PtGcD7VPM9xh/dVrTu6z1nwgmEGw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fd-slicer": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, + "license": "MIT", "dependencies": { "pend": "~1.2.0" } @@ -11160,9 +9640,8 @@ }, "node_modules/figures": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, + "license": "MIT", "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -11186,9 +9665,8 @@ }, "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==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fill-range": { "version": "7.0.1", @@ -11235,8 +9713,6 @@ }, "node_modules/follow-redirects": { "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true, "funding": [ { @@ -11244,6 +9720,7 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], + "license": "MIT", "engines": { "node": ">=4.0" }, @@ -11263,9 +9740,8 @@ }, "node_modules/forever-agent": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "*" } @@ -11396,9 +9872,8 @@ }, "node_modules/get-func-name": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -11427,9 +9902,8 @@ }, "node_modules/get-port": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-4.2.0.tgz", - "integrity": "sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -11476,33 +9950,29 @@ }, "node_modules/getos": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", - "integrity": "sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==", "dev": true, + "license": "MIT", "dependencies": { "async": "^3.2.0" } }, "node_modules/getpass": { "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, + "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" } }, "node_modules/git-node-fs": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/git-node-fs/-/git-node-fs-1.0.0.tgz", - "integrity": "sha512-bLQypt14llVXBg0S0u8q8HmU7g9p3ysH+NvVlae5vILuUvs759665HvmR5+wb04KjHyjFcDRxdYb4kyNnluMUQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/git-sha1": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/git-sha1/-/git-sha1-0.1.2.tgz", - "integrity": "sha512-2e/nZezdVlyCopOCYHeW0onkbZg7xP1Ad6pndPy1rCygeRykefUS6r7oA5cJRGEFvseiaz5a/qUHFVX1dd6Isg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/git-up": { "version": "7.0.0", @@ -11661,9 +10131,8 @@ }, "node_modules/graphene-pk11": { "version": "2.3.2", - "resolved": "https://registry.npmjs.org/graphene-pk11/-/graphene-pk11-2.3.2.tgz", - "integrity": "sha512-fhRM7BF3MYAL6A6xgCLki/CHKfZpO8gRFpddQc/hqdPow6dymVBmgdKK23OE0HbG3LhB2yz8O+GkL2EejqXW7g==", "dev": true, + "license": "MIT", "dependencies": { "pkcs11js": "^1.3.0", "tslib": "^2.4.0" @@ -11763,8 +10232,7 @@ }, "node_modules/hash-base": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "license": "MIT", "dependencies": { "inherits": "^2.0.4", "readable-stream": "^3.6.0", @@ -11776,8 +10244,6 @@ }, "node_modules/hash-base/node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "funding": [ { "type": "github", @@ -11791,7 +10257,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/hash.js": { "version": "1.1.7", @@ -11814,8 +10281,7 @@ }, "node_modules/hdkey": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hdkey/-/hdkey-2.1.0.tgz", - "integrity": "sha512-i9Wzi0Dy49bNS4tXXeGeu0vIcn86xXdPQUpEYg+SO1YiO8HtomjmmRMaRyqL0r59QfcD4PfVbSF3qmsWFwAemA==", + "license": "MIT", "dependencies": { "bs58check": "^2.1.2", "ripemd160": "^2.0.2", @@ -11825,24 +10291,21 @@ }, "node_modules/hdkey/node_modules/base-x": { "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "license": "MIT", "dependencies": { "safe-buffer": "^5.0.1" } }, "node_modules/hdkey/node_modules/bs58": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", "dependencies": { "base-x": "^3.0.2" } }, "node_modules/hdkey/node_modules/bs58check": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "license": "MIT", "dependencies": { "bs58": "^4.0.0", "create-hash": "^1.1.0", @@ -11851,14 +10314,12 @@ }, "node_modules/hdkey/node_modules/node-addon-api": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + "license": "MIT" }, "node_modules/hdkey/node_modules/secp256k1": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "elliptic": "^6.5.4", "node-addon-api": "^2.0.0", @@ -11895,9 +10356,8 @@ }, "node_modules/htmlnano": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/htmlnano/-/htmlnano-2.1.0.tgz", - "integrity": "sha512-jVGRE0Ep9byMBKEu0Vxgl8dhXYOUk0iNQ2pjsG+BcRB0u0oDF5A9p/iBGMg/PGKYUyMD0OAGu8dVT5Lzj8S58g==", "dev": true, + "license": "MIT", "dependencies": { "cosmiconfig": "^8.0.0", "posthtml": "^0.16.5", @@ -11942,8 +10402,6 @@ }, "node_modules/htmlparser2": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", - "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", "dev": true, "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", @@ -11952,6 +10410,7 @@ "url": "https://github.com/sponsors/fb55" } ], + "license": "MIT", "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.2.2", @@ -11979,9 +10438,8 @@ }, "node_modules/http-signature": { "version": "1.3.6", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", - "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, + "license": "MIT", "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^2.0.2", @@ -12136,9 +10594,8 @@ }, "node_modules/indent-string": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -12402,9 +10859,8 @@ }, "node_modules/ipaddr.js": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz", - "integrity": "sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } @@ -12481,9 +10937,8 @@ }, "node_modules/is-buffer": { "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/is-builtin-module": { "version": "3.2.1", @@ -12589,9 +11044,8 @@ }, "node_modules/is-generator-fn": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -12680,9 +11134,8 @@ }, "node_modules/is-json": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-json/-/is-json-2.0.1.tgz", - "integrity": "sha512-6BEnpVn1rcf3ngfmViLM6vjUjGErbdrL4rwlv+u1NO1XO8kqT4YGL8+19Q+Z/bas8tY90BTWMk2+fW1g6hQjbA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/is-map": { "version": "2.0.2", @@ -12759,9 +11212,8 @@ }, "node_modules/is-promise": { "version": "2.2.2", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/is-regex": { "version": "1.1.4", @@ -12927,6 +11379,7 @@ }, "node_modules/isstream": { "version": "0.1.2", + "dev": true, "license": "MIT" }, "node_modules/issue-parser": { @@ -13178,9 +11631,8 @@ }, "node_modules/jest-circus": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", - "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", "dev": true, + "license": "MIT", "dependencies": { "@jest/environment": "^29.7.0", "@jest/expect": "^29.7.0", @@ -13209,9 +11661,8 @@ }, "node_modules/jest-circus/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -13224,9 +11675,8 @@ }, "node_modules/jest-circus/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -13240,9 +11690,8 @@ }, "node_modules/jest-circus/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -13252,24 +11701,21 @@ }, "node_modules/jest-circus/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jest-circus/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/jest-circus/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -13284,9 +11730,8 @@ }, "node_modules/jest-circus/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -13408,9 +11853,8 @@ }, "node_modules/jest-config": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", - "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", "@jest/test-sequencer": "^29.7.0", @@ -13453,9 +11897,8 @@ }, "node_modules/jest-config/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -13468,9 +11911,8 @@ }, "node_modules/jest-config/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -13484,9 +11926,8 @@ }, "node_modules/jest-config/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -13496,24 +11937,21 @@ }, "node_modules/jest-config/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/jest-config/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -13528,9 +11966,8 @@ }, "node_modules/jest-config/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -13666,9 +12103,8 @@ }, "node_modules/jest-each": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", - "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "chalk": "^4.0.0", @@ -13682,9 +12118,8 @@ }, "node_modules/jest-each/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -13697,9 +12132,8 @@ }, "node_modules/jest-each/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -13713,9 +12147,8 @@ }, "node_modules/jest-each/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -13725,24 +12158,21 @@ }, "node_modules/jest-each/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jest-each/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/jest-each/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -13757,9 +12187,8 @@ }, "node_modules/jest-each/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -15385,9 +13814,8 @@ }, "node_modules/js-git": { "version": "0.7.8", - "resolved": "https://registry.npmjs.org/js-git/-/js-git-0.7.8.tgz", - "integrity": "sha512-+E5ZH/HeRnoc/LW0AmAyhU+mNcWBzAKE+30+IDMLSLbbK+Tdt02AdkOKq9u15rlJsDEGFqtgckc8ZM59LhhiUA==", "dev": true, + "license": "MIT", "dependencies": { "bodec": "^0.1.0", "culvert": "^0.1.2", @@ -15413,15 +13841,13 @@ }, "node_modules/jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jsdoc-type-pratt-parser": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-3.1.0.tgz", - "integrity": "sha512-MgtD0ZiCDk9B+eI73BextfRrVQl0oyzRG8B2BjORts6jbunj4ScKPcyXGTbB6eXL4y9TzxCm6hyeLq/2ASzNdw==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.0.0" } @@ -15494,9 +13920,8 @@ }, "node_modules/json-schema": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true + "dev": true, + "license": "(AFL-2.1 OR BSD-3-Clause)" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -15510,9 +13935,8 @@ }, "node_modules/json-stringify-safe": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/json-text-sequence": { "version": "0.1.1", @@ -15547,12 +13971,11 @@ }, "node_modules/jsprim": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", - "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "engines": [ "node >=0.6.0" ], + "license": "MIT", "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -15592,18 +14015,16 @@ }, "node_modules/lazy": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/lazy/-/lazy-1.0.11.tgz", - "integrity": "sha512-Y+CjUfLmIpoUCCRl0ub4smrYtGGr5AOa2AKOaWelGHOGz33X/Y/KizefGqbkwfz44+cnq/+9habclf8vOmu2LA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.2.0" } }, "node_modules/lazy-ass": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", - "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==", "dev": true, + "license": "MIT", "engines": { "node": "> 0.8" } @@ -15630,9 +14051,8 @@ }, "node_modules/lightningcss": { "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.22.1.tgz", - "integrity": "sha512-Fy45PhibiNXkm0cK5FJCbfO8Y6jUpD/YcHf/BtuI+jvYYqSXKF4muk61jjE8YxCR9y+hDYIWSzHTc+bwhDE6rQ==", "dev": true, + "license": "MPL-2.0", "dependencies": { "detect-libc": "^1.0.3" }, @@ -15657,12 +14077,11 @@ }, "node_modules/lightningcss-darwin-arm64": { "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.22.1.tgz", - "integrity": "sha512-ldvElu+R0QimNTjsKpaZkUv3zf+uefzLy/R1R19jtgOfSRM+zjUCUgDhfEDRmVqJtMwYsdhMI2aJtJChPC6Osg==", "cpu": [ "arm64" ], "dev": true, + "license": "MPL-2.0", "optional": true, "os": [ "darwin" @@ -15676,174 +14095,6 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.22.1.tgz", - "integrity": "sha512-5p2rnlVTv6Gpw4PlTLq925nTVh+HFh4MpegX8dPDYJae+NFVjQ67gY7O6iHIzQjLipDiYejFF0yHrhjU3XgLBQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.22.1.tgz", - "integrity": "sha512-1FaBtcFrZqB2hkFbAxY//Pnp8koThvyB6AhjbdVqKD4/pu13Rl91fKt2N9qyeQPUt3xy7ORUvSO+dPk3J6EjXg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.22.1.tgz", - "integrity": "sha512-6rub98tYGfE5I5j0BP8t/2d4BZyu1S7Iz9vUkm0H26snAFHYxLfj3RbQn0xHHIePSetjLnhcg3QlfwUAkD/FYg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.22.1.tgz", - "integrity": "sha512-nYO5qGtb/1kkTZu3FeTiM+2B2TAb7m2DkLCTgQIs2bk2o9aEs7I96fwySKcoHWQAiQDGR9sMux9vkV4KQXqPaQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.22.1.tgz", - "integrity": "sha512-MCV6RuRpzXbunvzwY644iz8cw4oQxvW7oer9xPkdadYqlEyiJJ6wl7FyJOH7Q6ZYH4yjGAUCvxDBxPbnDu9ZVg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.22.1.tgz", - "integrity": "sha512-RjNgpdM20VUXgV7us/VmlO3Vn2ZRiDnc3/bUxCVvySZWPiVPprpqW/QDWuzkGa+NCUf6saAM5CLsZLSxncXJwg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.22.1.tgz", - "integrity": "sha512-ZgO4C7Rd6Hv/5MnyY2KxOYmIlzk4rplVolDt3NbkNR8DndnyX0Q5IR4acJWNTBICQ21j3zySzKbcJaiJpk/4YA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.22.1.tgz", - "integrity": "sha512-4pozV4eyD0MDET41ZLHAeBo+H04Nm2UEYIk5w/ts40231dRFV7E0cjwbnZvSoc1DXFgecAhiC0L16ruv/ZDCpg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/lilconfig": { "version": "2.1.0", "dev": true, @@ -15859,9 +14110,8 @@ }, "node_modules/listr2": { "version": "3.14.0", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", - "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", "dev": true, + "license": "MIT", "dependencies": { "cli-truncate": "^2.1.0", "colorette": "^2.0.16", @@ -15886,10 +14136,9 @@ }, "node_modules/lmdb": { "version": "2.8.5", - "resolved": "https://registry.npmjs.org/lmdb/-/lmdb-2.8.5.tgz", - "integrity": "sha512-9bMdFfc80S+vSldBmG3HOuLVHnxRdNTlpzR6QDnzqCQtCzGUEAGTzBKYMeIM+I/sU4oZfgbcbS7X7F65/z/oxQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "msgpackr": "^1.9.5", "node-addon-api": "^6.1.0", @@ -15911,15 +14160,13 @@ }, "node_modules/lmdb/node_modules/node-addon-api": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", - "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/local-pkg": { "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" }, @@ -15943,10 +14190,9 @@ }, "node_modules/locus": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/locus/-/locus-2.0.4.tgz", - "integrity": "sha512-IZkIsFkcfvO51LWyAXUEeyj5ftH8Bq2akCkiz72CA8UHmuvCIWBmgOl0+ChuNazIQZbPXoC5my6xE/n/DBR2nw==", "dev": true, "hasInstallScript": true, + "license": "LGPL-3.0", "dependencies": { "bindings": "^1.5.0", "cardinal": "^2.1.1", @@ -15989,9 +14235,8 @@ }, "node_modules/lodash.memoize": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -16000,9 +14245,8 @@ }, "node_modules/lodash.once": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.uniqby": { "version": "4.7.0", @@ -16011,9 +14255,8 @@ }, "node_modules/log-driver": { "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", "dev": true, + "license": "ISC", "engines": { "node": ">=0.8.6" } @@ -16099,9 +14342,8 @@ }, "node_modules/log-update": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", - "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-escapes": "^4.3.0", "cli-cursor": "^3.1.0", @@ -16117,9 +14359,8 @@ }, "node_modules/log-update/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -16132,9 +14373,8 @@ }, "node_modules/log-update/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -16144,15 +14384,13 @@ }, "node_modules/log-update/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-update/node_modules/slice-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -16167,9 +14405,8 @@ }, "node_modules/log-update/node_modules/wrap-ansi": { "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -16181,9 +14418,8 @@ }, "node_modules/loupe": { "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", "dev": true, + "license": "MIT", "dependencies": { "get-func-name": "^2.0.1" } @@ -16212,9 +14448,8 @@ }, "node_modules/lru-queue": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", - "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==", "dev": true, + "license": "MIT", "dependencies": { "es5-ext": "~0.10.2" } @@ -16237,9 +14472,8 @@ }, "node_modules/magic-string": { "version": "0.30.5", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", - "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, @@ -16301,9 +14535,8 @@ }, "node_modules/md5": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "charenc": "0.0.2", "crypt": "0.0.2", @@ -16312,8 +14545,7 @@ }, "node_modules/md5.js": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "license": "MIT", "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", @@ -16322,17 +14554,15 @@ }, "node_modules/mdn-data": { "version": "2.0.30", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", - "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "dev": true, + "license": "CC0-1.0", "optional": true, "peer": true }, "node_modules/memoizee": { "version": "0.4.15", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", - "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.53", @@ -16436,9 +14666,8 @@ }, "node_modules/mkdirp": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true, + "license": "MIT", "bin": { "mkdirp": "bin/cmd.js" }, @@ -16448,9 +14677,8 @@ }, "node_modules/mlly": { "version": "1.4.2", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", - "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^8.10.0", "pathe": "^1.1.1", @@ -16460,9 +14688,8 @@ }, "node_modules/module-details-from-path": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", - "integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/mri": { "version": "1.2.0", @@ -16479,19 +14706,17 @@ }, "node_modules/msgpackr": { "version": "1.9.9", - "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.9.9.tgz", - "integrity": "sha512-sbn6mioS2w0lq1O6PpGtsv6Gy8roWM+o3o4Sqjd6DudrL/nOugY+KyJUimoWzHnf9OkO0T6broHFnYE/R05t9A==", "dev": true, + "license": "MIT", "optionalDependencies": { "msgpackr-extract": "^3.0.2" } }, "node_modules/msgpackr-extract": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.2.tgz", - "integrity": "sha512-SdzXp4kD/Qf8agZ9+iTu6eql0m3kWm1A2y1hkpTeVNENutaB0BwHlSvAIaMxwntmRUAUjon2V4L8Z/njd0Ct8A==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "dependencies": { "node-gyp-build-optional-packages": "5.0.7" @@ -16510,9 +14735,8 @@ }, "node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages": { "version": "5.0.7", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz", - "integrity": "sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w==", "dev": true, + "license": "MIT", "optional": true, "bin": { "node-gyp-build-optional-packages": "bin.js", @@ -16537,13 +14761,13 @@ }, "node_modules/mute-stream": { "version": "0.0.8", + "dev": true, "license": "ISC" }, "node_modules/nan": { "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.6", @@ -16582,9 +14806,8 @@ }, "node_modules/needle": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", - "integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^3.2.6", "iconv-lite": "^0.4.4", @@ -16599,18 +14822,16 @@ }, "node_modules/needle/node_modules/debug": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.1" } }, "node_modules/needle/node_modules/iconv-lite": { "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, + "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -16653,14 +14874,12 @@ }, "node_modules/next-tick": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/node-addon-api": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", - "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" + "license": "MIT" }, "node_modules/node-domexception": { "version": "1.0.0", @@ -16729,9 +14948,8 @@ }, "node_modules/node-gyp-build-optional-packages": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.1.1.tgz", - "integrity": "sha512-+P72GAjVAbTxjjwUmwjVrqrdZROD4nf8KgpBoDxqXXTiYZZt/ud60dE5yvCSr9lRO8e8yv6kgJIC0K0PfZFVQw==", "dev": true, + "license": "MIT", "dependencies": { "detect-libc": "^2.0.1" }, @@ -16743,9 +14961,8 @@ }, "node_modules/node-gyp-build-optional-packages/node_modules/detect-libc": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=8" } @@ -16770,9 +14987,8 @@ }, "node_modules/node-webcrypto-p11": { "version": "2.6.3", - "resolved": "https://registry.npmjs.org/node-webcrypto-p11/-/node-webcrypto-p11-2.6.3.tgz", - "integrity": "sha512-re1Q6i+nAYtFtvUQ2Dkeu/q/3GEezWpIvDZ79ftMj6Mt0iw9Id9JSNdzhEhuMs7JuEjcLg7J2029h1RrF48v/g==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.6", "@peculiar/asn1-x509": "^2.3.6", @@ -16821,9 +15037,8 @@ }, "node_modules/nssocket": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/nssocket/-/nssocket-0.6.0.tgz", - "integrity": "sha512-a9GSOIql5IqgWJR3F/JXG4KpJTA3Z53Cj0MeMvGpglytB1nxE4PdFNC0jINe27CS7cGivoynwc054EzCcT3M3w==", "dev": true, + "license": "MIT", "dependencies": { "eventemitter2": "~0.4.14", "lazy": "~1.0.11" @@ -16834,15 +15049,13 @@ }, "node_modules/nssocket/node_modules/eventemitter2": { "version": "0.4.14", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", - "integrity": "sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==", - "dev": true - }, + "dev": true, + "license": "MIT" + }, "node_modules/nth-check": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0" }, @@ -16852,9 +15065,8 @@ }, "node_modules/nullthrows": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz", - "integrity": "sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/nwsapi": { "version": "2.2.2", @@ -16918,9 +15130,8 @@ }, "node_modules/open": { "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", "dev": true, + "license": "MIT", "dependencies": { "default-browser": "^4.0.0", "define-lazy-prop": "^3.0.0", @@ -17086,9 +15297,8 @@ }, "node_modules/ordered-binary": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/ordered-binary/-/ordered-binary-1.4.1.tgz", - "integrity": "sha512-9LtiGlPy982CsgxZvJGNNp2/NnrgEr6EAyN3iIEP3/8vd3YLgAZQHbQ75ZrkfBRGrNg37Dk3U6tuVb+B4Xfslg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/os": { "version": "0.1.2", @@ -17120,9 +15330,8 @@ }, "node_modules/ospath": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz", - "integrity": "sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/p-cancelable": { "version": "3.0.0", @@ -17162,9 +15371,8 @@ }, "node_modules/p-map": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "dev": true, + "license": "MIT", "dependencies": { "aggregate-error": "^3.0.0" }, @@ -17306,15 +15514,13 @@ }, "node_modules/pako": { "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/parcel": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/parcel/-/parcel-2.10.2.tgz", - "integrity": "sha512-wRvsK9v12Nt2/EIjLp/uvxd3UeRSN9DRoSofDn21Ot+rEw4e98ODvbdSHi6dYr82s4oo6mF823ACmOp1hXd4wg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/config-default": "2.10.2", "@parcel/core": "2.10.2", @@ -17344,9 +15550,8 @@ }, "node_modules/parcel/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -17359,9 +15564,8 @@ }, "node_modules/parcel/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -17375,9 +15579,8 @@ }, "node_modules/parcel/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -17387,33 +15590,29 @@ }, "node_modules/parcel/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/parcel/node_modules/commander": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, "node_modules/parcel/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/parcel/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -17459,10 +15658,8 @@ }, "node_modules/parse-stack": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/parse-stack/-/parse-stack-0.1.4.tgz", - "integrity": "sha512-LavgUUPQOilfSoBTt9MEyOznloproJQnrHYLtr2DHJBH2D8cXCRh7DYPNDgnFCBjfCEjOcN92WG+eBfiWM1OoA==", - "deprecated": "Use error-stack-parser instead.", - "dev": true + "dev": true, + "license": "LGPLv3" }, "node_modules/parse-url": { "version": "8.1.0", @@ -17538,30 +15735,26 @@ }, "node_modules/pathe": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", - "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pathval": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/pend": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/performance-now": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/picocolors": { "version": "1.0.0", @@ -17581,9 +15774,8 @@ }, "node_modules/pidusage": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-3.0.2.tgz", - "integrity": "sha512-g0VU+y08pKw5M8EZ2rIGiEBaB8wrQMjYGFfW2QVIfyT8V+fq8YFLkvlz4bz5ljvFDJYNFCWT3PWqcRr2FKO81w==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.2.1" }, @@ -17593,8 +15785,6 @@ }, "node_modules/pidusage/node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -17609,13 +15799,13 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -17630,10 +15820,8 @@ }, "node_modules/pkcs11js": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/pkcs11js/-/pkcs11js-1.3.1.tgz", - "integrity": "sha512-eo7fTeQwYGzX1pFmRaf4ji/WcDW2XKpwqylOwzutsjNWECv6G9PzDHj3Yj5dX9EW/fydMnJG8xvWj/btnQT9TA==", "dev": true, - "hasInstallScript": true, + "license": "MIT", "dependencies": { "nan": "^2.15.0" }, @@ -17703,9 +15891,8 @@ }, "node_modules/pkg-types": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", "dev": true, + "license": "MIT", "dependencies": { "jsonc-parser": "^3.2.0", "mlly": "^1.2.0", @@ -17714,9 +15901,8 @@ }, "node_modules/pm2": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/pm2/-/pm2-5.3.0.tgz", - "integrity": "sha512-xscmQiAAf6ArVmKhjKTeeN8+Td7ZKnuZFFPw1DGkdFPR/0Iyx+m+1+OpCdf9+HQopX3VPc9/wqPQHqVOfHum9w==", "dev": true, + "license": "AGPL-3.0", "dependencies": { "@pm2/agent": "~2.0.0", "@pm2/io": "~5.0.0", @@ -17763,9 +15949,8 @@ }, "node_modules/pm2-axon": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pm2-axon/-/pm2-axon-4.0.1.tgz", - "integrity": "sha512-kES/PeSLS8orT8dR5jMlNl+Yu4Ty3nbvZRmaAtROuVm9nYYGiaoXqqKQqQYzWQzMYWUKHMQTvBlirjE5GIIxqg==", "dev": true, + "license": "MIT", "dependencies": { "amp": "~0.3.1", "amp-message": "~0.1.1", @@ -17778,9 +15963,8 @@ }, "node_modules/pm2-axon-rpc": { "version": "0.7.1", - "resolved": "https://registry.npmjs.org/pm2-axon-rpc/-/pm2-axon-rpc-0.7.1.tgz", - "integrity": "sha512-FbLvW60w+vEyvMjP/xom2UPhUN/2bVpdtLfKJeYM3gwzYhoTEEChCOICfFzxkxuoEleOlnpjie+n1nue91bDQw==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.3.1" }, @@ -17790,9 +15974,8 @@ }, "node_modules/pm2-axon/node_modules/escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -17802,9 +15985,8 @@ }, "node_modules/pm2-deploy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pm2-deploy/-/pm2-deploy-1.0.2.tgz", - "integrity": "sha512-YJx6RXKrVrWaphEYf++EdOOx9EH18vM8RSZN/P1Y+NokTKqYAca/ejXwVLyiEpNju4HPZEk3Y2uZouwMqUlcgg==", "dev": true, + "license": "MIT", "dependencies": { "run-series": "^1.1.8", "tv4": "^1.3.0" @@ -17815,18 +15997,16 @@ }, "node_modules/pm2-multimeter": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/pm2-multimeter/-/pm2-multimeter-0.1.2.tgz", - "integrity": "sha512-S+wT6XfyKfd7SJIBqRgOctGxaBzUOmVQzTAS+cg04TsEUObJVreha7lvCfX8zzGVr871XwCSnHUU7DQQ5xEsfA==", "dev": true, + "license": "MIT/X11", "dependencies": { "charm": "~0.1.1" } }, "node_modules/pm2-sysmonit": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/pm2-sysmonit/-/pm2-sysmonit-1.2.8.tgz", - "integrity": "sha512-ACOhlONEXdCTVwKieBIQLSi2tQZ8eKinhcr9JpZSUAL8Qy0ajIgRtsLxG/lwPOW3JEKqPyw/UaHmTWhUzpP4kA==", "dev": true, + "license": "Apache", "optional": true, "dependencies": { "async": "^3.2.0", @@ -17838,9 +16018,8 @@ }, "node_modules/pm2-sysmonit/node_modules/pidusage": { "version": "2.0.21", - "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-2.0.21.tgz", - "integrity": "sha512-cv3xAQos+pugVX+BfXpHsbyz/dLzX+lr44zNMsYiGxUw+kV5sgQCIcLd1z+0vq+KyC7dJ+/ts2PsfgWfSC3WXA==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "safe-buffer": "^5.2.1" @@ -17851,8 +16030,6 @@ }, "node_modules/pm2-sysmonit/node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -17868,13 +16045,13 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "optional": true }, "node_modules/pm2/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -17887,9 +16064,8 @@ }, "node_modules/pm2/node_modules/chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -17900,9 +16076,8 @@ }, "node_modules/pm2/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -17912,21 +16087,18 @@ }, "node_modules/pm2/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pm2/node_modules/commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pm2/node_modules/enquirer": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-colors": "^4.1.1" }, @@ -17936,24 +16108,21 @@ }, "node_modules/pm2/node_modules/eventemitter2": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz", - "integrity": "sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pm2/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/pm2/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -17966,9 +16135,8 @@ }, "node_modules/pm2/node_modules/source-map-support": { "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -17976,15 +16144,13 @@ }, "node_modules/pm2/node_modules/sprintf-js": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", - "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/pm2/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -17994,8 +16160,6 @@ }, "node_modules/postcss": { "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "dev": true, "funding": [ { @@ -18011,6 +16175,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", @@ -18022,15 +16187,13 @@ }, "node_modules/postcss-value-parser": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/posthtml": { "version": "0.16.6", - "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.16.6.tgz", - "integrity": "sha512-JcEmHlyLK/o0uGAlj65vgg+7LIms0xKXe60lcDOTU7oVX/3LuEuLwrQpW3VJ7de5TaFKiW4kWkaIpJL42FEgxQ==", "dev": true, + "license": "MIT", "dependencies": { "posthtml-parser": "^0.11.0", "posthtml-render": "^3.0.0" @@ -18041,9 +16204,8 @@ }, "node_modules/posthtml-parser": { "version": "0.10.2", - "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.10.2.tgz", - "integrity": "sha512-PId6zZ/2lyJi9LiKfe+i2xv57oEjJgWbsHGGANwos5AvdQp98i6AtamAl8gzSVFGfQ43Glb5D614cvZf012VKg==", "dev": true, + "license": "MIT", "dependencies": { "htmlparser2": "^7.1.1" }, @@ -18053,9 +16215,8 @@ }, "node_modules/posthtml-render": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/posthtml-render/-/posthtml-render-3.0.0.tgz", - "integrity": "sha512-z+16RoxK3fUPgwaIgH9NGnK1HKY9XIDpydky5eQGgAFVXTCSezalv9U2jQuNV+Z9qV1fDWNzldcw4eK0SSbqKA==", "dev": true, + "license": "MIT", "dependencies": { "is-json": "^2.0.1" }, @@ -18065,9 +16226,8 @@ }, "node_modules/posthtml/node_modules/posthtml-parser": { "version": "0.11.0", - "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.11.0.tgz", - "integrity": "sha512-QecJtfLekJbWVo/dMAA+OSwY79wpRmbqS5TeXvXSX+f0c6pW4/SE6inzZ2qkU7oAMCPqIDkZDvd/bQsSFUnKyw==", "dev": true, + "license": "MIT", "dependencies": { "htmlparser2": "^7.1.1" }, @@ -18085,9 +16245,8 @@ }, "node_modules/prettier": { "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin-prettier.js" }, @@ -18100,9 +16259,8 @@ }, "node_modules/prettier-linter-helpers": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, + "license": "MIT", "dependencies": { "fast-diff": "^1.1.2" }, @@ -18112,9 +16270,8 @@ }, "node_modules/pretty-bytes": { "version": "5.6.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", - "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" }, @@ -18164,9 +16321,8 @@ }, "node_modules/pretty-quick": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.3.tgz", - "integrity": "sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^3.0.0", "execa": "^4.0.0", @@ -18367,6 +16523,7 @@ }, "node_modules/prompt": { "version": "1.3.0", + "dev": true, "license": "MIT", "dependencies": { "@colors/colors": "1.5.0", @@ -18381,13 +16538,13 @@ }, "node_modules/prompt/node_modules/async": { "version": "3.2.3", + "dev": true, "license": "MIT" }, "node_modules/promptly": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/promptly/-/promptly-2.2.0.tgz", - "integrity": "sha512-aC9j+BZsRSSzEsXBNBwDnAxujdx19HycZoKgRgzWnS8eOHg1asuf9heuLprfbe739zY3IdUQx+Egv6Jn135WHA==", "dev": true, + "license": "MIT", "dependencies": { "read": "^1.0.4" } @@ -18518,8 +16675,6 @@ }, "node_modules/pure-rand": { "version": "6.0.4", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.4.tgz", - "integrity": "sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==", "dev": true, "funding": [ { @@ -18530,12 +16685,12 @@ "type": "opencollective", "url": "https://opencollective.com/fast-check" } - ] + ], + "license": "MIT" }, "node_modules/pvtsutils": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.5.tgz", - "integrity": "sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA==", + "license": "MIT", "dependencies": { "tslib": "^2.6.1" } @@ -18549,9 +16704,8 @@ }, "node_modules/qs": { "version": "6.10.4", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", - "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.4" }, @@ -18621,9 +16775,8 @@ }, "node_modules/react-error-overlay": { "version": "6.0.9", - "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", - "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/react-is": { "version": "18.2.0", @@ -18632,15 +16785,15 @@ }, "node_modules/react-refresh": { "version": "0.9.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", - "integrity": "sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/read": { "version": "1.0.7", + "dev": true, "license": "ISC", "dependencies": { "mute-stream": "~0.0.4" @@ -18674,9 +16827,8 @@ }, "node_modules/readline-history": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/readline-history/-/readline-history-1.2.0.tgz", - "integrity": "sha512-8R0Vr9jhdtqYSdWGpAvkEopvuPKjAlYELIKoa7+7FO2CBN/b88rYB9r9gFSNtdCUHdAOJslj0KDG75MsiozXIQ==", - "dev": true + "dev": true, + "license": "WTFPL" }, "node_modules/realistic-structured-clone": { "version": "3.0.0", @@ -18703,24 +16855,21 @@ }, "node_modules/redeyed": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", - "integrity": "sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==", "dev": true, + "license": "MIT", "dependencies": { "esprima": "~4.0.0" } }, "node_modules/reflect-metadata": { "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/regenerator-runtime": { "version": "0.14.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", - "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/regexp.prototype.flags": { "version": "1.5.1", @@ -18986,9 +17135,8 @@ }, "node_modules/request-progress": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", - "integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==", "dev": true, + "license": "MIT", "dependencies": { "throttleit": "^1.0.0" } @@ -19003,9 +17151,8 @@ }, "node_modules/require-in-the-middle": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-5.2.0.tgz", - "integrity": "sha512-efCx3b+0Z69/LGJmm9Yvi4cqEdxnoGnxYxGxBghkkTTFeXRtTCmmhO0AnAfHz59k957uTSuy8WaHqOs8wbYUWg==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.1.1", "module-details-from-path": "^1.0.3", @@ -19121,6 +17268,7 @@ }, "node_modules/revalidator": { "version": "0.1.8", + "dev": true, "license": "Apache 2.0", "engines": { "node": ">= 0.4.0" @@ -19128,9 +17276,8 @@ }, "node_modules/rfdc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/rimraf": { "version": "3.0.2", @@ -19148,8 +17295,7 @@ }, "node_modules/ripemd160": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "license": "MIT", "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1" @@ -19157,9 +17303,8 @@ }, "node_modules/rollup": { "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, + "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, @@ -19217,8 +17362,6 @@ }, "node_modules/run-series": { "version": "1.1.9", - "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", - "integrity": "sha512-Arc4hUN896vjkqCYrUXquBFtRZdv1PfLbTYP71efP6butxyQ0kWpiNJyAgsxscmQg1cqvHY32/UCBzXedTpU2g==", "dev": true, "funding": [ { @@ -19233,7 +17376,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/rxjs": { "version": "7.8.1", @@ -19293,9 +17437,8 @@ }, "node_modules/sax": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", - "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/saxes": { "version": "5.0.1", @@ -19310,9 +17453,8 @@ }, "node_modules/secp256k1": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-5.0.0.tgz", - "integrity": "sha512-TKWX8xvoGHrxVdqbYeZM9w+izTF4b9z3NhSaDkdn81btvuh+ivbIMGT/zQvDtTFWhRlThpoz6LEYTr7n8A5GcA==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "elliptic": "^6.5.4", "node-addon-api": "^5.0.0", @@ -19387,8 +17529,7 @@ }, "node_modules/sha.js": { "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "license": "(MIT AND BSD-3-Clause)", "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -19418,9 +17559,8 @@ }, "node_modules/shell-quote": { "version": "1.8.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", - "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -19472,9 +17612,8 @@ }, "node_modules/shimmer": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", - "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/side-channel": { "version": "1.0.4", @@ -19491,9 +17630,8 @@ }, "node_modules/siginfo": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/signal-exit": { "version": "3.0.7", @@ -19511,9 +17649,8 @@ }, "node_modules/size-limit": { "version": "10.0.2", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-10.0.2.tgz", - "integrity": "sha512-ULFHMr+OQjuyqdGSqkDGY3XfnGO0l3cIfJaNe6F6ZqO+QzWUYunZh9DYHovNctsN7R9fR9gzzzW4Ze8TiJ060g==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -19531,9 +17668,8 @@ }, "node_modules/size-limit-node-esbuild": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/size-limit-node-esbuild/-/size-limit-node-esbuild-0.2.0.tgz", - "integrity": "sha512-iiIfHBH/+ZxgsE7YVQDEejAUGZYEu4QIai/QNZloEGxA+cmow79O8uGdu4sK64V8kafryqR1grK7nl7xIGv6rw==", "dev": true, + "license": "MIT", "dependencies": { "@size-limit/esbuild": "^8.1.0", "nanoid": "^3.2.0", @@ -19546,439 +17682,360 @@ "url": "https://opencollective.com/unts" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-arm": { + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-arm64": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", "cpu": [ - "arm" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "darwin" ], "engines": { "node": ">=12" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], + "node_modules/size-limit-node-esbuild/node_modules/@size-limit/esbuild": { + "version": "8.2.6", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "esbuild": "^0.18.6", + "nanoid": "^3.3.6" + }, "engines": { - "node": ">=12" + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "size-limit": "8.2.6" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-x64": { + "node_modules/size-limit-node-esbuild/node_modules/esbuild": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], "dev": true, - "optional": true, - "os": [ - "android" - ], + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, "engines": { "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", - "cpu": [ - "arm64" - ], + "node_modules/size-limit-node-esbuild/node_modules/size-limit": { + "version": "8.2.6", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], + "peer": true, + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, "engines": { - "node": ">=12" + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], + "node_modules/size-limit/node_modules/globby": { + "version": "13.2.2", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, "engines": { - "node": ">=12" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], + "node_modules/size-limit/node_modules/slash": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "cpu": [ - "x64" - ], + "node_modules/slash": { + "version": "3.0.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], + "node_modules/slice-ansi": { + "version": "3.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">=12" + "node": ">=7.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], + "node_modules/smart-buffer": { + "version": "4.2.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 6.0.0", + "npm": ">= 3.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], + "node_modules/socks": { + "version": "2.7.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, "engines": { - "node": ">=12" + "node": ">= 10.13.0", + "npm": ">= 3.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], + "node_modules/socks-proxy-agent": { + "version": "8.0.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, "engines": { - "node": ">=12" + "node": ">= 14" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, "engines": { - "node": ">=12" + "node": ">= 14" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], + "node_modules/socks/node_modules/ip": { + "version": "2.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], + "node_modules/source-map": { + "version": "0.6.1", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "BSD-3-Clause", "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "cpu": [ - "x64" - ], + "node_modules/source-map-js": { + "version": "1.0.2", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "BSD-3-Clause", "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "cpu": [ - "x64" - ], + "node_modules/source-map-support": { + "version": "0.5.13", "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], + "node_modules/spawn-command": { + "version": "0.0.2-1", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], + "node_modules/spdx-exceptions": { + "version": "2.3.0", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "cpu": [ - "x64" - ], + "node_modules/spdx-license-ids": { + "version": "3.0.12", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "CC0-1.0" + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/srcset": { + "version": "4.0.0", + "dev": true, + "license": "MIT", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit-node-esbuild/node_modules/@size-limit/esbuild": { - "version": "8.2.6", + "node_modules/sshpk": { + "version": "1.18.0", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.18.6", - "nanoid": "^3.3.6" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" }, - "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" }, - "peerDependencies": { - "size-limit": "8.2.6" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/esbuild": { - "version": "0.18.20", - "dev": true, - "hasInstallScript": true, + "node_modules/stable": { + "version": "0.1.8", + "dev": true, + "license": "MIT" + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "dev": true, "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.18.20", - "@esbuild/android-arm64": "0.18.20", - "@esbuild/android-x64": "0.18.20", - "@esbuild/darwin-arm64": "0.18.20", - "@esbuild/darwin-x64": "0.18.20", - "@esbuild/freebsd-arm64": "0.18.20", - "@esbuild/freebsd-x64": "0.18.20", - "@esbuild/linux-arm": "0.18.20", - "@esbuild/linux-arm64": "0.18.20", - "@esbuild/linux-ia32": "0.18.20", - "@esbuild/linux-loong64": "0.18.20", - "@esbuild/linux-mips64el": "0.18.20", - "@esbuild/linux-ppc64": "0.18.20", - "@esbuild/linux-riscv64": "0.18.20", - "@esbuild/linux-s390x": "0.18.20", - "@esbuild/linux-x64": "0.18.20", - "@esbuild/netbsd-x64": "0.18.20", - "@esbuild/openbsd-x64": "0.18.20", - "@esbuild/sunos-x64": "0.18.20", - "@esbuild/win32-arm64": "0.18.20", - "@esbuild/win32-ia32": "0.18.20", - "@esbuild/win32-x64": "0.18.20" + "node": "*" } }, - "node_modules/size-limit-node-esbuild/node_modules/size-limit": { - "version": "8.2.6", + "node_modules/stack-utils": { + "version": "2.0.5", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "bytes-iec": "^3.1.1", - "chokidar": "^3.5.3", - "globby": "^11.1.0", - "lilconfig": "^2.1.0", - "nanospinner": "^1.1.0", - "picocolors": "^1.0.0" - }, - "bin": { - "size-limit": "bin.js" + "escape-string-regexp": "^2.0.0" }, "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/size-limit/node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.4.3", "dev": true, + "license": "MIT" + }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "dev": true, + "license": "MIT", "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" + "bl": "^5.0.0" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" @@ -19987,645 +18044,362 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", "dev": true, - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "internal-slot": "^1.0.4" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">= 0.4" } }, - "node_modules/slash": { - "version": "3.0.0", + "node_modules/stream": { + "version": "0.0.2", "dev": true, "license": "MIT", - "engines": { - "node": ">=8" + "dependencies": { + "emitter-component": "^1.1.1" } }, - "node_modules/slice-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "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/string-length": { + "version": "4.0.2", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/string-width": { + "version": "4.2.3", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/string.prototype.trim": { + "version": "1.2.8", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/smart-buffer": { - "version": "4.2.0", + "node_modules/string.prototype.trimend": { + "version": "1.0.7", "dev": true, "license": "MIT", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/socks": { - "version": "2.7.1", + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", "dev": true, "license": "MIT", "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/socks-proxy-agent": { - "version": "8.0.2", + "node_modules/strip-ansi": { + "version": "6.0.1", "dev": true, "license": "MIT", "dependencies": { - "agent-base": "^7.0.2", - "debug": "^4.3.4", - "socks": "^2.7.1" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">= 14" + "node": ">=8" } }, - "node_modules/socks-proxy-agent/node_modules/agent-base": { - "version": "7.1.0", + "node_modules/strip-bom": { + "version": "4.0.0", "dev": true, "license": "MIT", - "dependencies": { - "debug": "^4.3.4" - }, "engines": { - "node": ">= 14" + "node": ">=8" } }, - "node_modules/socks/node_modules/ip": { + "node_modules/strip-final-newline": { "version": "2.0.0", "dev": true, - "license": "MIT" - }, - "node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "node_modules/strip-json-comments": { + "version": "3.1.1", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/source-map-support": { - "version": "0.5.13", + "node_modules/strip-literal": { + "version": "1.3.0", "dev": true, "license": "MIT", "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "acorn": "^8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/spawn-command": { - "version": "0.0.2-1", - "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", - "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", - "dev": true - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "dev": true, - "license": "CC-BY-3.0" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", + "node_modules/supports-color": { + "version": "5.5.0", "dev": true, "license": "MIT", "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "node_modules/spdx-license-ids": { - "version": "3.0.12", - "dev": true, - "license": "CC0-1.0" - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/srcset": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/srcset/-/srcset-4.0.0.tgz", - "integrity": "sha512-wvLeHgcVHKO8Sc/H/5lkGreJQVeYMm9rlmt8PuR1xE31rIuXhuzznUUqAt8MqLhB3MqJdFzlNAfpcWnxiFUcPw==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", + "node_modules/svgo": { + "version": "3.0.3", "dev": true, + "license": "MIT", + "optional": true, + "peer": true, "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^5.1.0", + "css-tree": "^2.2.1", + "csso": "5.0.5", + "picocolors": "^1.0.0" }, "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" + "svgo": "bin/svgo" }, "engines": { - "node": ">=0.10.0" + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/svgo" } }, - "node_modules/stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility", - "dev": true - }, - "node_modules/stack-trace": { - "version": "0.0.10", + "node_modules/svgo/node_modules/commander": { + "version": "7.2.0", + "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { - "node": "*" + "node": ">= 10" } }, - "node_modules/stack-utils": { - "version": "2.0.5", + "node_modules/symbol-tree": { + "version": "3.2.4", "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } + "license": "MIT" }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", + "node_modules/systeminformation": { + "version": "5.21.17", "dev": true, "license": "MIT", + "optional": true, + "os": [ + "darwin", + "linux", + "win32", + "freebsd", + "openbsd", + "netbsd", + "sunos", + "android" + ], + "bin": { + "systeminformation": "lib/cli.js" + }, "engines": { - "node": ">=8" + "node": ">=8.0.0" + }, + "funding": { + "type": "Buy me a coffee", + "url": "https://www.buymeacoffee.com/systeminfo" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "node_modules/std-env": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.4.3.tgz", - "integrity": "sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==", - "dev": true - }, - "node_modules/stdin-discarder": { - "version": "0.1.0", + "node_modules/term-size": { + "version": "2.2.1", "dev": true, "license": "MIT", - "dependencies": { - "bl": "^5.0.0" - }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/stop-iteration-iterator": { - "version": "1.0.0", + "node_modules/test-exclude": { + "version": "6.0.0", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "internal-slot": "^1.0.4" + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" }, "engines": { - "node": ">= 0.4" + "node": ">=8" } }, - "node_modules/stream": { - "version": "0.0.2", + "node_modules/text-encoding": { + "version": "0.7.0", "dev": true, - "license": "MIT", - "dependencies": { - "emitter-component": "^1.1.1" - } + "license": "(Unlicense OR Apache-2.0)" }, - "node_modules/string_decoder": { - "version": "1.3.0", - "license": "MIT", + "node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/throttleit": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "dev": true, + "license": "MIT" + }, + "node_modules/timers-ext": { + "version": "0.1.7", + "dev": true, + "license": "ISC", "dependencies": { - "safe-buffer": "~5.2.0" + "es5-ext": "~0.10.46", + "next-tick": "1" } }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/timsort": { + "version": "0.3.0", + "dev": true, "license": "MIT" }, - "node_modules/string-length": { - "version": "4.0.2", + "node_modules/tinybench": { + "version": "2.5.1", + "dev": true, + "license": "MIT" + }, + "node_modules/tinypool": { + "version": "0.7.0", "dev": true, "license": "MIT", - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, "engines": { - "node": ">=10" + "node": ">=14.0.0" } }, - "node_modules/string-width": { - "version": "4.2.3", + "node_modules/tinyspy": { + "version": "2.2.0", "dev": true, "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, "engines": { - "node": ">=8" + "node": ">=14.0.0" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.8", + "node_modules/titleize": { + "version": "3.0.0", "dev": true, "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, "engines": { - "node": ">= 0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.7", + "node_modules/tmp": { + "version": "0.2.1", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "rimraf": "^3.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8.17.0" } }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strip-literal": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", - "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", - "dev": true, - "dependencies": { - "acorn": "^8.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/svgo": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.3.tgz", - "integrity": "sha512-X4UZvLhOglD5Xrp834HzGHf8RKUW0Ahigg/08yRO1no9t2NxffOkMiQ0WmaMIbaGlVTlSst2zWANsdhz5ybXgA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@trysound/sax": "0.2.0", - "commander": "^7.2.0", - "css-select": "^5.1.0", - "css-tree": "^2.2.1", - "csso": "5.0.5", - "picocolors": "^1.0.0" - }, - "bin": { - "svgo": "bin/svgo" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/svgo" - } - }, - "node_modules/svgo/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/systeminformation": { - "version": "5.21.17", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.17.tgz", - "integrity": "sha512-JZYRCbIjk3WuBV59A9/rTla2rROX+aAJ9uo2Z1dI+bjieORcukClN8rlM1zE9NYKpULSbaGc+KKct/870lO0DA==", - "dev": true, - "optional": true, - "os": [ - "darwin", - "linux", - "win32", - "freebsd", - "openbsd", - "netbsd", - "sunos", - "android" - ], - "bin": { - "systeminformation": "lib/cli.js" - }, - "engines": { - "node": ">=8.0.0" - }, - "funding": { - "type": "Buy me a coffee", - "url": "https://www.buymeacoffee.com/systeminfo" - } - }, - "node_modules/term-size": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", - "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-encoding": { - "version": "0.7.0", - "dev": true, - "license": "(Unlicense OR Apache-2.0)" - }, - "node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==", - "dev": true - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, - "node_modules/timers-ext": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", - "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", - "dev": true, - "dependencies": { - "es5-ext": "~0.10.46", - "next-tick": "1" - } - }, - "node_modules/timsort": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", - "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==", - "dev": true - }, - "node_modules/tinybench": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", - "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", - "dev": true - }, - "node_modules/tinypool": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", - "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.0.tgz", - "integrity": "sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/titleize": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, - "dependencies": { - "rimraf": "^3.0.0" - }, - "engines": { - "node": ">=8.17.0" - } - }, - "node_modules/tmpl": { - "version": "1.0.5", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", + "node_modules/tmpl": { + "version": "1.0.5", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", "dev": true, "license": "MIT", "engines": { @@ -20670,18 +18444,16 @@ }, "node_modules/tree-kill": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dev": true, + "license": "MIT", "bin": { "tree-kill": "cli.js" } }, "node_modules/ts-jest": { "version": "29.1.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", "dev": true, + "license": "MIT", "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", @@ -20722,9 +18494,8 @@ }, "node_modules/ts-jest/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -20737,9 +18508,8 @@ }, "node_modules/ts-jest/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -20753,9 +18523,8 @@ }, "node_modules/ts-jest/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -20765,24 +18534,21 @@ }, "node_modules/ts-jest/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ts-jest/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/ts-jest/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -20797,9 +18563,8 @@ }, "node_modules/ts-jest/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -20812,9 +18577,8 @@ }, "node_modules/ts-jest/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -20878,9 +18642,8 @@ }, "node_modules/tsutils": { "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.8.1" }, @@ -20893,15 +18656,13 @@ }, "node_modules/tsutils/node_modules/tslib": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/tsyringe": { "version": "4.8.0", - "resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.8.0.tgz", - "integrity": "sha512-YB1FG+axdxADa3ncEtRnQCFq/M0lALGLxSZeVNbTU8NqhOVc51nnv2CISTcvc1kyv6EGPtXVr0v6lWeDxiijOA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.9.3" }, @@ -20911,15 +18672,13 @@ }, "node_modules/tsyringe/node_modules/tslib": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "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==", "dev": true, + "license": "Apache-2.0", "dependencies": { "safe-buffer": "^5.0.1" }, @@ -20929,24 +18688,30 @@ }, "node_modules/tv4": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/tv4/-/tv4-1.3.0.tgz", - "integrity": "sha512-afizzfpJgvPr+eDkREK4MxJ/+r8nEEHcmitwgnPUqpaP+FpwQyadnxNoSACbgc/b1LsZYtODGoPiFxQrgJgjvw==", "dev": true, + "license": [ + { + "type": "Public Domain", + "url": "http://geraintluff.github.io/tv4/LICENSE.txt" + }, + { + "type": "MIT", + "url": "http://jsonary.com/LICENSE.txt" + } + ], "engines": { "node": ">= 0.8.0" } }, "node_modules/tweetnacl": { "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true + "dev": true, + "license": "Unlicense" }, "node_modules/tx2": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tx2/-/tx2-1.0.5.tgz", - "integrity": "sha512-sJ24w0y03Md/bxzK4FU8J8JveYYUbSs2FViLJ2D/8bytSiyPRbuE3DyL/9UKYXTZlV3yXq0L8GLlhobTnekCVg==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "json-stringify-safe": "^5.0.1" @@ -20954,9 +18719,8 @@ }, "node_modules/type": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/type-check": { "version": "0.4.0", @@ -21101,9 +18865,8 @@ }, "node_modules/typescript": { "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -21167,9 +18930,8 @@ }, "node_modules/ufo": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz", - "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/unbox-primitive": { "version": "1.0.2", @@ -21316,542 +19078,200 @@ "license": "MIT", "dependencies": { "punycode": "^1.4.1", - "qs": "^6.11.2" - } - }, - "node_modules/url-join": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/url-parse": { - "version": "1.5.10", - "dev": true, - "license": "MIT", - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/url/node_modules/punycode": { - "version": "1.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/url/node_modules/qs": { - "version": "6.11.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/util": { - "version": "0.12.4", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/utility-types": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", - "integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-to-istanbul": { - "version": "9.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/v8-to-istanbul/node_modules/convert-source-map": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/vite": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", - "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", - "dev": true, - "dependencies": { - "esbuild": "^0.18.10", - "postcss": "^8.4.27", - "rollup": "^3.27.1" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@types/node": ">= 14", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } - } - }, - "node_modules/vite-node": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.6.tgz", - "integrity": "sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==", - "dev": true, - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.3.4", - "mlly": "^1.4.0", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": ">=v14.18.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", - "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "qs": "^6.11.2" } }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], + "node_modules/url-join": { + "version": "5.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], + "node_modules/url-parse": { + "version": "1.5.10", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" } }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], + "node_modules/url/node_modules/punycode": { + "version": "1.4.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], + "node_modules/url/node_modules/qs": { + "version": "6.11.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.4" + }, "engines": { - "node": ">=12" + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], + "node_modules/util": { + "version": "0.12.4", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" } }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], + "node_modules/util-deprecate": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/utility-types": { + "version": "3.10.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 4" } }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], + "node_modules/uuid": { + "version": "8.3.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" } }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "cpu": [ - "x64" - ], + "node_modules/v8-to-istanbul": { + "version": "9.1.3", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, "engines": { - "node": ">=12" + "node": ">=10.12.0" } }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "cpu": [ - "x64" - ], + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "2.0.0", "dev": true, - "optional": true, - "os": [ - "sunos" + "license": "MIT" + }, + "node_modules/verror": { + "version": "1.10.0", + "dev": true, + "engines": [ + "node >=0.6.0" ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" } }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], + "node_modules/vite": { + "version": "4.5.0", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + }, + "bin": { + "vite": "bin/vite.js" + }, "engines": { - "node": ">=12" + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], + "node_modules/vite-node": { + "version": "0.34.6", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.4.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, "engines": { - "node": ">=12" + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "cpu": [ - "x64" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "win32" + "darwin" ], "engines": { "node": ">=12" @@ -21859,10 +19279,9 @@ }, "node_modules/vite/node_modules/esbuild": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", - "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -21896,9 +19315,8 @@ }, "node_modules/vitest": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.6.tgz", - "integrity": "sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/chai": "^4.3.5", "@types/chai-subset": "^1.3.3", @@ -21973,18 +19391,16 @@ }, "node_modules/vitest/node_modules/acorn-walk": { "version": "8.3.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", - "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } }, "node_modules/vizion": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/vizion/-/vizion-2.2.1.tgz", - "integrity": "sha512-sfAcO2yeSU0CSPFI/DmZp3FsFE9T+8913nv1xWBOyzODv13fwkn6Vl7HqxGpkr9F608M+8SuFId3s+BlZqfXww==", "dev": true, + "license": "Apache-2.0", "dependencies": { "async": "^2.6.3", "git-node-fs": "^1.0.0", @@ -21997,9 +19413,8 @@ }, "node_modules/vizion/node_modules/async": { "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, + "license": "MIT", "dependencies": { "lodash": "^4.17.14" } @@ -22051,9 +19466,8 @@ }, "node_modules/weak-lru-cache": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.2.tgz", - "integrity": "sha512-DEAoo25RfSYMuTGc9vPJzZcZullwIqRDSI9LOy+fkCJPi6hykCnfKaXTuPBDuXAUcqHXyOgFtHNp/kB2FjYHbw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/web-encoding": { "version": "1.1.5", @@ -22177,9 +19591,8 @@ }, "node_modules/why-is-node-running": { "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", "dev": true, + "license": "MIT", "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" @@ -22272,6 +19685,7 @@ }, "node_modules/winston": { "version": "2.4.6", + "dev": true, "license": "MIT", "dependencies": { "async": "^3.2.3", @@ -22407,9 +19821,8 @@ }, "node_modules/yamljs": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", - "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^1.0.7", "glob": "^7.0.5" @@ -22421,9 +19834,8 @@ }, "node_modules/yamljs/node_modules/argparse": { "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, + "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" } @@ -22455,9 +19867,8 @@ }, "node_modules/yauzl": { "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, + "license": "MIT", "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -23349,8 +20760,8 @@ "devDependencies": { "@types/jest": "^29.5.5", "esbuild": "^0.15.16", - "jest": "^29.7.0", - "size-limit": "^8.1.0" + "size-limit": "^8.1.0", + "vitest": "^0.34.6" } }, "packages/bls-verify/node_modules/size-limit": { @@ -23372,13 +20783,7 @@ "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "packages/bls-verify/src/vendor/amcl-js": { - "version": "3.0.0", - "license": "Apache License 2.0", - "dependencies": { - "prompt": "^1.0.0" - } - }, + "packages/bls-verify/src/vendor/amcl-js": {}, "packages/candid": { "name": "@dfinity/candid", "version": "0.20.2", diff --git a/package.json b/package.json index fb2f9830c..95ef0afaf 100644 --- a/package.json +++ b/package.json @@ -146,5 +146,8 @@ "draft": true, "autoGenerate": true } + }, + "dependencies": { + "@noble/curves": "^1.2.0" } } diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index 5d5b1e467..c0a05c054 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -53,8 +53,8 @@ "devDependencies": { "@types/jest": "^29.5.5", "esbuild": "^0.15.16", - "jest": "^29.7.0", - "size-limit": "^8.1.0" + "size-limit": "^8.1.0", + "vitest": "^0.34.6" }, "size-limit": [ { diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index 7b566c846..189f8fcb6 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -1,6 +1,5 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { CTX } from 'amcl-js'; import { toHex } from './utils'; +import { bls12_381 as bls } from '@noble/curves/bls12-381'; export const blsVerify = async ( primaryKey: Uint8Array | string, @@ -10,16 +9,5 @@ export const blsVerify = async ( const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - const ctx = new CTX('BLS12381'); - if (((ctx as any).BLS as any).init() !== 0) { - throw new Error('Cannot initialize BLS'); - } - - return ( - ((ctx as any).BLS as any).core_verify( - ((ctx as any).BLS as any).stringtobytes(sig), - ((ctx as any).BLS as any).stringtobytes(msg), - ((ctx as any).BLS as any).stringtobytes(pk), - ) == 0 - ); + return bls.verify(sig, msg, pk); }; diff --git a/packages/bls-verify/src/vendor/amcl-js/index.js b/packages/bls-verify/src/vendor/amcl-js/index.js deleted file mode 100644 index b8e38afff..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports.CTX = require('./src/ctx'); diff --git a/packages/bls-verify/src/vendor/amcl-js/package.json b/packages/bls-verify/src/vendor/amcl-js/package.json deleted file mode 100644 index 43addfb1e..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "amcl-js", - "version": "3.0.0", - "description": "AMCL Library", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Michael Scott, Alessandro Budroni, Kealan McCusker, Samuele Andreoli", - "license": "Apache License 2.0", - "dependencies": { - "prompt": "^1.0.0" - } -} diff --git a/packages/bls-verify/src/vendor/amcl-js/readme.md b/packages/bls-verify/src/vendor/amcl-js/readme.md deleted file mode 100644 index ce1ac3802..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/readme.md +++ /dev/null @@ -1,62 +0,0 @@ -# Installation and Testing - -Suppose you want to implement ECDH with NIST256 elliptic curve. First you need to initialize the context: - - var ctx = new CTX("NIST256"); - -then you can call the functions as follows: - - ctx.ECDH.KEY_PAIR_GENERATE(...); - ctx.ECDH.ECPSVDP_DH(...); - -If you need to use more than one elliptic curve in the same program you only need to initialize two different contexts, for example - - var ctx1 = new CTX("NIST256"); - var ctx2 = new CTX("C25519"); - -The following is the list of all elliptic curves supported by MIRACL Core JS - - ['ED25519', 'C25519', 'C41417', 'GOLDILOCKS', 'X448', 'NIST256', 'SECP160R1', 'C1174', 'C1665', 'MDC', 'NIST384','NIST521', 'BRAINPOOL', 'ANSSI', 'HIFIVE', 'JUBJUB', 'NUMS256W', 'SECP256K1','NUMS256E', 'NUMS384W', 'NUMS384E', 'NUMS512W', 'NUMS512E', 'TWEEDLEDUM', 'TWEEDLEDEE', 'BN254', 'BN254CX', 'BLS12383', 'BLS12381', 'FP256BN', 'FP512BN', 'BLS12461', 'BN462', 'BLS24479', 'BLS48556', 'BLS48581', 'BLS48286']; - -This library supports also RSA encryption/decryption and RSA signature. The following is a quick example on how to use RSA. First initialize the context - - var ctx = new CTX("RSA2048"); - -then you can call the RSA functions as follows: - - ctx.RSA.ENCRYPT(...); - ctx.RSA.DECRYPT(...); - -The following is the list of all the RSA security level supported by _MIRACL Core JS_ - - ['RSA2048','RSA3072','RSA4096']; - -MIRACL Core JS supports also SHA256, SHA384, SHA512, SHA3, AES-GCM encryption and a secure random number generator. Those functions are contained in every context initialized with RSA or with an elliptic curve. -If you want to create a context supporting only those general functions then initialize it with no parameter as follows: - - var ctx = new CTX(); - -To use this library in Node.js import it as follows: - -```javascript -var CTX = require('./index.js'); -``` - -It is also possible to use it as a npm package. Install it locally into your project with: - - npm install --save - -As an example in React it is possible to install the library with npm and import it with - -```javascript -const ctx = require('amcl-js').CTX; -``` - -After the import the library is used as described above. - ---- - -To see some running examples, load TestECC.html or TestMPIN.html or TestHPKE.html or TestHTP.html or TestBLS.html or TestNHS.html or BenchtestALL.html into your favourite browser. -You might have to wait a few seconds for the benchmarking scripts to complete. - -For TestMPIN.html the correct PIN number is 1234. diff --git a/packages/bls-verify/src/vendor/amcl-js/src/aes.js b/packages/bls-verify/src/vendor/amcl-js/src/aes.js deleted file mode 100644 index 0ce8d189a..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/aes.js +++ /dev/null @@ -1,882 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var AES = function () { - 'use strict'; - - var AES = function () { - this.Nk = 0; - this.Nr = 0; - this.mode = 0; - this.fkey = []; - this.rkey = []; - this.f = []; - }; - - // AES constants - AES.ECB = 0; - AES.CBC = 1; - AES.CFB1 = 2; - AES.CFB2 = 3; - AES.CFB4 = 5; - AES.OFB1 = 14; - AES.OFB2 = 15; - AES.OFB4 = 17; - AES.OFB8 = 21; - AES.OFB16 = 29; - AES.CTR1 = 30; - AES.CTR2 = 31; - AES.CTR4 = 33; - AES.CTR8 = 37; - AES.CTR16 = 45; - - AES.prototype = { - /* reset cipher */ - reset: function (m, iv) { - /* reset mode, or reset iv */ - var i; - - this.mode = m; - - for (i = 0; i < 16; i++) { - this.f[i] = 0; - } - - if (this.mode != AES.ECB && iv !== null) { - for (i = 0; i < 16; i++) { - this.f[i] = iv[i]; - } - } - }, - - getreg: function () { - var ir = [], - i; - - for (i = 0; i < 16; i++) { - ir[i] = this.f[i]; - } - - return ir; - }, - - increment: function () { - var i; - - for (i = 0; i < 16; i++) { - this.f[i]++; - - if ((this.f[i] & 0xff) != 0) { - break; - } - } - }, - - /* Initialise cipher */ - init: function (m, nk, key, iv) { - /* Key=16 bytes */ - /* Key Scheduler. Create expanded encryption key */ - var CipherKey = [], - b = [], - i, - j, - k, - N, - nr; - - nk /= 4; - - if (nk != 4 && nk != 6 && nk != 8) { - return false; - } - - nr = 6 + nk; - - this.Nk = nk; - this.Nr = nr; - - this.reset(m, iv); - N = 4 * (nr + 1); - - for (i = j = 0; i < nk; i++, j += 4) { - for (k = 0; k < 4; k++) { - b[k] = key[j + k]; - } - CipherKey[i] = AES.pack(b); - } - - for (i = 0; i < nk; i++) { - this.fkey[i] = CipherKey[i]; - } - - for (j = nk, k = 0; j < N; j += nk, k++) { - this.fkey[j] = - this.fkey[j - nk] ^ AES.SubByte(AES.ROTL24(this.fkey[j - 1])) ^ (AES.rco[k] & 0xff); - - if (nk <= 6) { - for (i = 1; i < nk && i + j < N; i++) { - this.fkey[i + j] = this.fkey[i + j - nk] ^ this.fkey[i + j - 1]; - } - } else { - for (i = 1; i < 4 && i + j < N; i++) { - this.fkey[i + j] = this.fkey[i + j - nk] ^ this.fkey[i + j - 1]; - } - if (j + 4 < N) { - this.fkey[j + 4] = this.fkey[j + 4 - nk] ^ AES.SubByte(this.fkey[j + 3]); - } - for (i = 5; i < nk && i + j < N; i++) { - this.fkey[i + j] = this.fkey[i + j - nk] ^ this.fkey[i + j - 1]; - } - } - } - - /* now for the expanded decrypt key in reverse order */ - - for (j = 0; j < 4; j++) { - this.rkey[j + N - 4] = this.fkey[j]; - } - - for (i = 4; i < N - 4; i += 4) { - k = N - 4 - i; - for (j = 0; j < 4; j++) { - this.rkey[k + j] = AES.InvMixCol(this.fkey[i + j]); - } - } - - for (j = N - 4; j < N; j++) { - this.rkey[j - N + 4] = this.fkey[j]; - } - }, - - /* Encrypt a single block */ - ecb_encrypt: function (buff) { - var b = [], - p = [], - q = [], - t, - i, - j, - k; - - for (i = j = 0; i < 4; i++, j += 4) { - for (k = 0; k < 4; k++) { - b[k] = buff[j + k]; - } - p[i] = AES.pack(b); - p[i] ^= this.fkey[i]; - } - - k = 4; - - /* State alternates between p and q */ - for (i = 1; i < this.Nr; i++) { - q[0] = - this.fkey[k] ^ - AES.ftable[p[0] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[1] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[2] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[3] >>> 24) & 0xff]); - q[1] = - this.fkey[k + 1] ^ - AES.ftable[p[1] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[2] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[3] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[0] >>> 24) & 0xff]); - q[2] = - this.fkey[k + 2] ^ - AES.ftable[p[2] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[3] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[0] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[1] >>> 24) & 0xff]); - q[3] = - this.fkey[k + 3] ^ - AES.ftable[p[3] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[0] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[1] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[2] >>> 24) & 0xff]); - - k += 4; - for (j = 0; j < 4; j++) { - t = p[j]; - p[j] = q[j]; - q[j] = t; - } - } - - /* Last Round */ - - q[0] = - this.fkey[k] ^ - (AES.fbsub[p[0] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[1] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[2] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[3] >>> 24) & 0xff] & 0xff); - - q[1] = - this.fkey[k + 1] ^ - (AES.fbsub[p[1] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[2] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[3] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[0] >>> 24) & 0xff] & 0xff); - - q[2] = - this.fkey[k + 2] ^ - (AES.fbsub[p[2] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[3] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[0] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[1] >>> 24) & 0xff] & 0xff); - - q[3] = - this.fkey[k + 3] ^ - (AES.fbsub[p[3] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[0] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[1] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[2] >>> 24) & 0xff] & 0xff); - - for (i = j = 0; i < 4; i++, j += 4) { - b = AES.unpack(q[i]); - for (k = 0; k < 4; k++) { - buff[j + k] = b[k]; - } - } - }, - - /* Decrypt a single block */ - ecb_decrypt: function (buff) { - var b = [], - p = [], - q = [], - t, - i, - j, - k; - - for (i = j = 0; i < 4; i++, j += 4) { - for (k = 0; k < 4; k++) { - b[k] = buff[j + k]; - } - p[i] = AES.pack(b); - p[i] ^= this.rkey[i]; - } - - k = 4; - - /* State alternates between p and q */ - for (i = 1; i < this.Nr; i++) { - q[0] = - this.rkey[k] ^ - AES.rtable[p[0] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[3] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[2] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[1] >>> 24) & 0xff]); - q[1] = - this.rkey[k + 1] ^ - AES.rtable[p[1] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[0] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[3] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[2] >>> 24) & 0xff]); - q[2] = - this.rkey[k + 2] ^ - AES.rtable[p[2] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[1] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[0] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[3] >>> 24) & 0xff]); - q[3] = - this.rkey[k + 3] ^ - AES.rtable[p[3] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[2] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[1] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[0] >>> 24) & 0xff]); - - k += 4; - - for (j = 0; j < 4; j++) { - t = p[j]; - p[j] = q[j]; - q[j] = t; - } - } - - /* Last Round */ - - q[0] = - this.rkey[k] ^ - (AES.rbsub[p[0] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[3] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[2] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[1] >>> 24) & 0xff] & 0xff); - q[1] = - this.rkey[k + 1] ^ - (AES.rbsub[p[1] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[0] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[3] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[2] >>> 24) & 0xff] & 0xff); - q[2] = - this.rkey[k + 2] ^ - (AES.rbsub[p[2] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[1] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[0] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[3] >>> 24) & 0xff] & 0xff); - q[3] = - this.rkey[k + 3] ^ - (AES.rbsub[p[3] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[2] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[1] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[0] >>> 24) & 0xff] & 0xff); - - for (i = j = 0; i < 4; i++, j += 4) { - b = AES.unpack(q[i]); - for (k = 0; k < 4; k++) { - buff[j + k] = b[k]; - } - } - }, - - /* Encrypt using selected mode of operation */ - encrypt: function (buff) { - var st = [], - bytes, - fell_off, - j; - - // Supported Modes of Operation - - fell_off = 0; - - switch (this.mode) { - case AES.ECB: - this.ecb_encrypt(buff); - return 0; - - case AES.CBC: - for (j = 0; j < 16; j++) { - buff[j] ^= this.f[j]; - } - this.ecb_encrypt(buff); - for (j = 0; j < 16; j++) { - this.f[j] = buff[j]; - } - return 0; - - case AES.CFB1: - case AES.CFB2: - case AES.CFB4: - bytes = this.mode - AES.CFB1 + 1; - for (j = 0; j < bytes; j++) { - fell_off = (fell_off << 8) | this.f[j]; - } - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - for (j = bytes; j < 16; j++) { - this.f[j - bytes] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - buff[j] ^= st[j]; - this.f[16 - bytes + j] = buff[j]; - } - return fell_off; - - case AES.OFB1: - case AES.OFB2: - case AES.OFB4: - case AES.OFB8: - case AES.OFB16: - bytes = this.mode - AES.OFB1 + 1; - this.ecb_encrypt(this.f); - for (j = 0; j < bytes; j++) { - buff[j] ^= this.f[j]; - } - return 0; - - case AES.CTR1: - case AES.CTR2: - case AES.CTR4: - case AES.CTR8: - case AES.CTR16: - bytes = this.mode - AES.CTR1 + 1; - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - buff[j] ^= st[j]; - } - this.increment(); - return 0; - - default: - return 0; - } - }, - - /* Decrypt using selected mode of operation */ - decrypt: function (buff) { - var st = [], - bytes, - fell_off, - j; - - // Supported modes of operation - fell_off = 0; - switch (this.mode) { - case AES.ECB: - this.ecb_decrypt(buff); - return 0; - - case AES.CBC: - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - this.f[j] = buff[j]; - } - this.ecb_decrypt(buff); - for (j = 0; j < 16; j++) { - buff[j] ^= st[j]; - st[j] = 0; - } - return 0; - - case AES.CFB1: - case AES.CFB2: - case AES.CFB4: - bytes = this.mode - AES.CFB1 + 1; - for (j = 0; j < bytes; j++) { - fell_off = (fell_off << 8) | this.f[j]; - } - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - for (j = bytes; j < 16; j++) { - this.f[j - bytes] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - this.f[16 - bytes + j] = buff[j]; - buff[j] ^= st[j]; - } - return fell_off; - - case AES.OFB1: - case AES.OFB2: - case AES.OFB4: - case AES.OFB8: - case AES.OFB16: - bytes = this.mode - AES.OFB1 + 1; - this.ecb_encrypt(this.f); - for (j = 0; j < bytes; j++) { - buff[j] ^= this.f[j]; - } - return 0; - - case AES.CTR1: - case AES.CTR2: - case AES.CTR4: - case AES.CTR8: - case AES.CTR16: - bytes = this.mode - AES.CTR1 + 1; - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - buff[j] ^= st[j]; - } - this.increment(); - return 0; - - default: - return 0; - } - }, - - /* Clean up and delete left-overs */ - end: function () { - // clean up - var i; - - for (i = 0; i < 4 * (this.Nr + 1); i++) { - this.fkey[i] = this.rkey[i] = 0; - } - - for (i = 0; i < 16; i++) { - this.f[i] = 0; - } - }, - }; - - /* static functions */ - - AES.ROTL8 = function (x) { - return (x << 8) | (x >>> 24); - }; - - AES.ROTL16 = function (x) { - return (x << 16) | (x >>> 16); - }; - - AES.ROTL24 = function (x) { - return (x << 24) | (x >>> 8); - }; - - AES.pack = function (b) { - /* pack 4 bytes into a 32-bit Word */ - return ((b[3] & 0xff) << 24) | ((b[2] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[0] & 0xff); - }; - - AES.unpack = function (a) { - /* unpack bytes from a word */ - var b = []; - b[0] = a & 0xff; - b[1] = (a >>> 8) & 0xff; - b[2] = (a >>> 16) & 0xff; - b[3] = (a >>> 24) & 0xff; - return b; - }; - - AES.bmul = function (x, y) { - /* x.y= AntiLog(Log(x) + Log(y)) */ - var ix = x & 0xff, - iy = y & 0xff, - lx = AES.ltab[ix] & 0xff, - ly = AES.ltab[iy] & 0xff; - - if (x !== 0 && y !== 0) { - return AES.ptab[(lx + ly) % 255]; - } else { - return 0; - } - }; - - // if (x && y) - - AES.SubByte = function (a) { - var b = AES.unpack(a); - b[0] = AES.fbsub[b[0] & 0xff]; - b[1] = AES.fbsub[b[1] & 0xff]; - b[2] = AES.fbsub[b[2] & 0xff]; - b[3] = AES.fbsub[b[3] & 0xff]; - return AES.pack(b); - }; - - AES.product = function (x, y) { - /* dot product of two 4-byte arrays */ - var xb = AES.unpack(x), - yb = AES.unpack(y); - - return ( - (AES.bmul(xb[0], yb[0]) ^ - AES.bmul(xb[1], yb[1]) ^ - AES.bmul(xb[2], yb[2]) ^ - AES.bmul(xb[3], yb[3])) & - 0xff - ); - }; - - AES.InvMixCol = function (x) { - /* matrix Multiplication */ - var b = [], - y, - m; - - m = AES.pack(AES.InCo); - b[3] = AES.product(m, x); - m = AES.ROTL24(m); - b[2] = AES.product(m, x); - m = AES.ROTL24(m); - b[1] = AES.product(m, x); - m = AES.ROTL24(m); - b[0] = AES.product(m, x); - y = AES.pack(b); - - return y; - }; - - AES.CBC_IV0_ENCRYPT = function (K, M) { - /* ctx.AES CBC encryption, with Null IV and key K */ - /* Input is from an octet string M, output is to an octet string C */ - /* Input is padded as necessary to make up a full final block */ - var a = new AES(), - buff = [], - C = [], - fin, - padlen, - i, - j, - ipt, - opt; - - a.init(AES.CBC, K.length, K, null); - - ipt = opt = 0; - fin = false; - - for (;;) { - for (i = 0; i < 16; i++) { - if (ipt < M.length) { - buff[i] = M[ipt++]; - } else { - fin = true; - break; - } - } - - if (fin) { - break; - } - - a.encrypt(buff); - - for (i = 0; i < 16; i++) { - C[opt++] = buff[i]; - } - } - - /* last block, filled up to i-th index */ - - padlen = 16 - i; - for (j = i; j < 16; j++) { - buff[j] = padlen; - } - a.encrypt(buff); - for (i = 0; i < 16; i++) { - C[opt++] = buff[i]; - } - a.end(); - - return C; - }; - - AES.CBC_IV0_DECRYPT = function (K, C) { - /* padding is removed */ - var a = new AES(), - buff = [], - MM = [], - ipt = 0, - opt = 0, - M, - ch, - fin, - bad, - padlen, - i; - - a.init(AES.CBC, K.length, K, null); - - if (C.length === 0) { - return []; - } - ch = C[ipt++]; - - fin = false; - - for (;;) { - for (i = 0; i < 16; i++) { - buff[i] = ch; - if (ipt >= C.length) { - fin = true; - break; - } else { - ch = C[ipt++]; - } - } - a.decrypt(buff); - if (fin) { - break; - } - - for (i = 0; i < 16; i++) { - MM[opt++] = buff[i]; - } - } - - a.end(); - bad = false; - padlen = buff[15]; - - if (i != 15 || padlen < 1 || padlen > 16) { - bad = true; - } - - if (padlen >= 2 && padlen <= 16) { - for (i = 16 - padlen; i < 16; i++) { - if (buff[i] != padlen) { - bad = true; - } - } - } - - if (!bad) { - for (i = 0; i < 16 - padlen; i++) { - MM[opt++] = buff[i]; - } - } - - M = []; - if (bad) { - return M; - } - - for (i = 0; i < opt; i++) { - M[i] = MM[i]; - } - - return M; - }; - - AES.InCo = [0xb, 0xd, 0x9, 0xe]; /* Inverse Coefficients */ - AES.rco = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47]; - - AES.ptab = [ - 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53, 95, 225, 56, 72, 216, 115, - 149, 164, 247, 2, 6, 10, 30, 34, 102, 170, 229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, - 112, 144, 171, 230, 49, 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205, - 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136, 131, 158, 185, 208, 107, - 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154, 181, 196, 87, 249, 16, 48, 80, 240, 11, - 29, 39, 105, 187, 214, 97, 163, 254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, - 32, 96, 160, 251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65, 195, 94, - 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117, 159, 186, 213, 100, 172, 239, - 42, 126, 130, 157, 188, 223, 122, 142, 137, 128, 155, 182, 193, 88, 232, 35, 101, 175, 234, 37, - 111, 177, 200, 67, 197, 84, 252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, - 202, 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14, 18, 54, 90, 238, - 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23, 57, 75, 221, 124, 132, 151, 162, 253, - 28, 36, 108, 180, 199, 82, 246, 1, - ]; - AES.ltab = [ - 0, 255, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3, 100, 4, 224, 14, 52, 141, 129, - 239, 76, 113, 8, 200, 248, 105, 28, 193, 125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, - 114, 154, 201, 9, 120, 101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142, - 150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56, 102, 221, 253, 48, - 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16, 126, 110, 72, 195, 163, 182, 30, 66, 58, - 107, 40, 84, 250, 133, 61, 186, 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, - 167, 87, 175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232, 44, 215, - 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160, 127, 12, 246, 111, 23, 196, 73, - 236, 216, 67, 31, 45, 164, 118, 123, 183, 204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, - 170, 85, 41, 157, 151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209, - 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171, 68, 17, 146, 217, 35, 32, - 46, 137, 180, 124, 184, 38, 119, 153, 227, 165, 103, 74, 237, 222, 197, 49, 254, 24, 13, 99, - 140, 128, 192, 247, 112, 7, - ]; - AES.fbsub = [ - 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, - 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, - 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, - 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, - 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, - 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, - 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, - 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, - 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, - 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, - 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, - 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, - 176, 84, 187, 22, - ]; - AES.rbsub = [ - 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, - 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, - 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, - 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, - 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, - 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, - 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, - 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, - 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, - 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, - 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, - 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, - 99, 85, 33, 12, 125, - ]; - AES.ftable = [ - 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6, 0xdf2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591, - 0x50303060, 0x3010102, 0xa96767ce, 0x7d2b2b56, 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec, - 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa, 0x15fafaef, 0xeb5959b2, 0xc947478e, 0xbf0f0fb, - 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45, 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b, - 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c, 0x5a36366c, 0x413f3f7e, 0x2f7f7f5, 0x4fcccc83, - 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x8f1f1f9, 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a, - 0xc040408, 0x52c7c795, 0x65232346, 0x5ec3c39d, 0x28181830, 0xa1969637, 0xf05050a, 0xb59a9a2f, - 0x907070e, 0x36121224, 0x9b80801b, 0x3de2e2df, 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea, - 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34, 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b, - 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d, 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413, - 0xf55353a6, 0x68d1d1b9, 0x0, 0x2cededc1, 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6, - 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972, 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85, - 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed, 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511, - 0xcf45458a, 0x10f9f9e9, 0x6020204, 0x817f7ffe, 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b, - 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05, 0xad92923f, 0xbc9d9d21, 0x48383870, 0x4f5f5f1, - 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142, 0x30101020, 0x1affffe5, 0xef3f3fd, 0x6dd2d2bf, - 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3, 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e, - 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a, 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6, - 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3, 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b, - 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428, 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad, - 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14, 0xdb494992, 0xa06060c, 0x6c242448, 0xe45c5cb8, - 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4, 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2, - 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda, 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949, - 0xb46c6cd8, 0xfa5656ac, 0x7f4f4f3, 0x25eaeacf, 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810, - 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c, 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697, - 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e, 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f, - 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc, 0xd8484890, 0x5030306, 0x1f6f6f7, 0x120e0e1c, - 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969, 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27, - 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122, 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433, - 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9, 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5, - 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a, 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0, - 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e, 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c, - ]; - AES.rtable = [ - 0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a, 0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b, - 0x55fa3020, 0xf66d76ad, 0x9176cc88, 0x254c02f5, 0xfcd7e54f, 0xd7cb2ac5, 0x80443526, 0x8fa362b5, - 0x495ab1de, 0x671bba25, 0x980eea45, 0xe1c0fe5d, 0x2752fc3, 0x12f04c81, 0xa397468d, 0xc6f9d36b, - 0xe75f8f03, 0x959c9215, 0xeb7a6dbf, 0xda595295, 0x2d83bed4, 0xd3217458, 0x2969e049, 0x44c8c98e, - 0x6a89c275, 0x78798ef4, 0x6b3e5899, 0xdd71b927, 0xb64fe1be, 0x17ad88f0, 0x66ac20c9, 0xb43ace7d, - 0x184adf63, 0x82311ae5, 0x60335197, 0x457f5362, 0xe07764b1, 0x84ae6bbb, 0x1ca081fe, 0x942b08f9, - 0x58684870, 0x19fd458f, 0x876cde94, 0xb7f87b52, 0x23d373ab, 0xe2024b72, 0x578f1fe3, 0x2aab5566, - 0x728ebb2, 0x3c2b52f, 0x9a7bc586, 0xa50837d3, 0xf2872830, 0xb2a5bf23, 0xba6a0302, 0x5c8216ed, - 0x2b1ccf8a, 0x92b479a7, 0xf0f207f3, 0xa1e2694e, 0xcdf4da65, 0xd5be0506, 0x1f6234d1, 0x8afea6c4, - 0x9d532e34, 0xa055f3a2, 0x32e18a05, 0x75ebf6a4, 0x39ec830b, 0xaaef6040, 0x69f715e, 0x51106ebd, - 0xf98a213e, 0x3d06dd96, 0xae053edd, 0x46bde64d, 0xb58d5491, 0x55dc471, 0x6fd40604, 0xff155060, - 0x24fb9819, 0x97e9bdd6, 0xcc434089, 0x779ed967, 0xbd42e8b0, 0x888b8907, 0x385b19e7, 0xdbeec879, - 0x470a7ca1, 0xe90f427c, 0xc91e84f8, 0x0, 0x83868009, 0x48ed2b32, 0xac70111e, 0x4e725a6c, - 0xfbff0efd, 0x5638850f, 0x1ed5ae3d, 0x27392d36, 0x64d90f0a, 0x21a65c68, 0xd1545b9b, 0x3a2e3624, - 0xb1670a0c, 0xfe75793, 0xd296eeb4, 0x9e919b1b, 0x4fc5c080, 0xa220dc61, 0x694b775a, 0x161a121c, - 0xaba93e2, 0xe52aa0c0, 0x43e0223c, 0x1d171b12, 0xb0d090e, 0xadc78bf2, 0xb9a8b62d, 0xc8a91e14, - 0x8519f157, 0x4c0775af, 0xbbdd99ee, 0xfd607fa3, 0x9f2601f7, 0xbcf5725c, 0xc53b6644, 0x347efb5b, - 0x7629438b, 0xdcc623cb, 0x68fcedb6, 0x63f1e4b8, 0xcadc31d7, 0x10856342, 0x40229713, 0x2011c684, - 0x7d244a85, 0xf83dbbd2, 0x1132f9ae, 0x6da129c7, 0x4b2f9e1d, 0xf330b2dc, 0xec52860d, 0xd0e3c177, - 0x6c16b32b, 0x99b970a9, 0xfa489411, 0x2264e947, 0xc48cfca8, 0x1a3ff0a0, 0xd82c7d56, 0xef903322, - 0xc74e4987, 0xc1d138d9, 0xfea2ca8c, 0x360bd498, 0xcf81f5a6, 0x28de7aa5, 0x268eb7da, 0xa4bfad3f, - 0xe49d3a2c, 0xd927850, 0x9bcc5f6a, 0x62467e54, 0xc2138df6, 0xe8b8d890, 0x5ef7392e, 0xf5afc382, - 0xbe805d9f, 0x7c93d069, 0xa92dd56f, 0xb31225cf, 0x3b99acc8, 0xa77d1810, 0x6e639ce8, 0x7bbb3bdb, - 0x97826cd, 0xf418596e, 0x1b79aec, 0xa89a4f83, 0x656e95e6, 0x7ee6ffaa, 0x8cfbc21, 0xe6e815ef, - 0xd99be7ba, 0xce366f4a, 0xd4099fea, 0xd67cb029, 0xafb2a431, 0x31233f2a, 0x3094a5c6, 0xc066a235, - 0x37bc4e74, 0xa6ca82fc, 0xb0d090e0, 0x15d8a733, 0x4a9804f1, 0xf7daec41, 0xe50cd7f, 0x2ff69117, - 0x8dd64d76, 0x4db0ef43, 0x544daacc, 0xdf0496e4, 0xe3b5d19e, 0x1b886a4c, 0xb81f2cc1, 0x7f516546, - 0x4ea5e9d, 0x5d358c01, 0x737487fa, 0x2e410bfb, 0x5a1d67b3, 0x52d2db92, 0x335610e9, 0x1347d66d, - 0x8c61d79a, 0x7a0ca137, 0x8e14f859, 0x893c13eb, 0xee27a9ce, 0x35c961b7, 0xede51ce1, 0x3cb1477a, - 0x59dfd29c, 0x3f73f255, 0x79ce1418, 0xbf37c773, 0xeacdf753, 0x5baafd5f, 0x146f3ddf, 0x86db4478, - 0x81f3afca, 0x3ec468b9, 0x2c342438, 0x5f40a3c2, 0x72c31d16, 0xc25e2bc, 0x8b493c28, 0x41950dff, - 0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664, 0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0, - ]; - - return AES; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - AES: AES, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/big.js b/packages/bls-verify/src/vendor/amcl-js/src/big.js deleted file mode 100644 index bd318cf77..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/big.js +++ /dev/null @@ -1,1505 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE BIG number class */ -var BIG, DBIG; - -BIG = function (ctx) { - 'use strict'; - - /* General purpose Constructor */ - var BIG = function (x) { - this.w = new Array(BIG.NLEN); - - switch (typeof x) { - case 'object': - this.copy(x); - break; - - case 'number': - this.zero(); - this.w[0] = x; - break; - - default: - this.zero(); - } - }; - - BIG.CHUNK = 32; - BIG.MODBYTES = ctx.config['@NB']; - BIG.BASEBITS = ctx.config['@BASE']; - BIG.NLEN = 1 + Math.floor((8 * BIG.MODBYTES - 1) / BIG.BASEBITS); - BIG.DNLEN = 2 * BIG.NLEN; - BIG.BMASK = (1 << BIG.BASEBITS) - 1; - BIG.BIGBITS = 8 * BIG.MODBYTES; - BIG.NEXCESS = 1 << (BIG.CHUNK - BIG.BASEBITS - 1); - BIG.MODINV = Math.pow(2, -BIG.BASEBITS); - - BIG.prototype = { - /* set to zero */ - zero: function () { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* set to one */ - one: function () { - var i; - - this.w[0] = 1; - for (i = 1; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - get: function (i) { - return this.w[i]; - }, - - set: function (i, x) { - this.w[i] = x; - }, - - /* test for zero */ - iszilch: function () { - var i; - var d = 0; - for (i = 0; i < BIG.NLEN; i++) { - d |= this.w[i]; - } - return (1 & ((d - 1) >> BIG.BASEBITS)) != 0; - }, - - /* test for unity */ - isunity: function () { - var i; - var d = 0; - - for (i = 1; i < BIG.NLEN; i++) { - d |= this.w[i]; - } - - return (1 & ((d - 1) >> BIG.BASEBITS) & (((this.w[0] ^ 1) - 1) >> BIG.BASEBITS)) != 0; - }, - - /* Conditional swap of two BIGs depending on d using XOR - no branches */ - cswap: function (b, d) { - var c = d, - t, - i; - - c = ~(c - 1); - - for (i = 0; i < BIG.NLEN; i++) { - t = c & (this.w[i] ^ b.w[i]); - this.w[i] ^= t; - b.w[i] ^= t; - } - }, - - /* Conditional move of BIG depending on d using XOR - no branches */ - cmove: function (b, d) { - var c = d, - i; - - c = ~(c - 1); - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] ^= (this.w[i] ^ b.w[i]) & c; - } - }, - - /* copy from another BIG */ - copy: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = y.w[i]; - } - - return this; - }, - - /* copy from bottom half of ctx.DBIG */ - hcopy: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = y.w[i]; - } - - return this; - }, - - /* copy from ROM */ - rcopy: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = y[i]; - } - - return this; - }, - - xortop: function (x) { - this.w[BIG.NLEN - 1] ^= x; - }, - - ortop: function (x) { - this.w[BIG.NLEN - 1] |= x; - }, - - /* normalise BIG - force all digits < 2^BASEBITS */ - norm: function () { - var carry = 0, - d, - i; - - for (i = 0; i < BIG.NLEN - 1; i++) { - d = this.w[i] + carry; - this.w[i] = d & BIG.BMASK; - carry = d >> BIG.BASEBITS; - } - - this.w[BIG.NLEN - 1] = this.w[BIG.NLEN - 1] + carry; - - return this.w[BIG.NLEN - 1] >> (8 * BIG.MODBYTES) % BIG.BASEBITS; - }, - - /* quick shift right by less than a word */ - fshr: function (k) { - var r, i; - - r = this.w[0] & ((1 << k) - 1); /* shifted out part */ - - for (i = 0; i < BIG.NLEN - 1; i++) { - this.w[i] = (this.w[i] >> k) | ((this.w[i + 1] << (BIG.BASEBITS - k)) & BIG.BMASK); - } - - this.w[BIG.NLEN - 1] = this.w[BIG.NLEN - 1] >> k; - - return r; - }, - - /* General shift right by k bits */ - shr: function (k) { - var n = k % BIG.BASEBITS, - m = Math.floor(k / BIG.BASEBITS), - i; - - for (i = 0; i < BIG.NLEN - m - 1; i++) { - this.w[i] = (this.w[m + i] >> n) | ((this.w[m + i + 1] << (BIG.BASEBITS - n)) & BIG.BMASK); - } - - this.w[BIG.NLEN - m - 1] = this.w[BIG.NLEN - 1] >> n; - - for (i = BIG.NLEN - m; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* quick shift left by less than a word */ - fshl: function (k) { - var i; - - this.w[BIG.NLEN - 1] = - (this.w[BIG.NLEN - 1] << k) | (this.w[BIG.NLEN - 2] >> (BIG.BASEBITS - k)); - - for (i = BIG.NLEN - 2; i > 0; i--) { - this.w[i] = ((this.w[i] << k) & BIG.BMASK) | (this.w[i - 1] >> (BIG.BASEBITS - k)); - } - - this.w[0] = (this.w[0] << k) & BIG.BMASK; - - return ( - this.w[BIG.NLEN - 1] >> (8 * BIG.MODBYTES) % BIG.BASEBITS - ); /* return excess - only used in FF.java */ - }, - - /* General shift left by k bits */ - shl: function (k) { - var n = k % BIG.BASEBITS, - m = Math.floor(k / BIG.BASEBITS), - i; - - this.w[BIG.NLEN - 1] = this.w[BIG.NLEN - 1 - m] << n; - - if (BIG.NLEN > m + 2) { - this.w[BIG.NLEN - 1] |= this.w[BIG.NLEN - m - 2] >> (BIG.BASEBITS - n); - } - - for (i = BIG.NLEN - 2; i > m; i--) { - this.w[i] = ((this.w[i - m] << n) & BIG.BMASK) | (this.w[i - m - 1] >> (BIG.BASEBITS - n)); - } - - this.w[m] = (this.w[0] << n) & BIG.BMASK; - - for (i = 0; i < m; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* return length in bits */ - nbits: function () { - var k = BIG.NLEN - 1, - bts, - c; - - var t = new BIG(0); - t.copy(this); - t.norm(); - - while (k >= 0 && t.w[k] === 0) { - k--; - } - - if (k < 0) { - return 0; - } - - bts = BIG.BASEBITS * k; - c = t.w[k]; - - while (c !== 0) { - c = Math.floor(c / 2); - bts++; - } - - return bts; - }, - - /* convert this to string */ - toString: function () { - var s = '', - len = this.nbits(), - b, - i; - - if (len % 4 === 0) { - len = Math.floor(len / 4); - } else { - len = Math.floor(len / 4); - len++; - } - - if (len < BIG.MODBYTES * 2) { - len = BIG.MODBYTES * 2; - } - - for (i = len - 1; i >= 0; i--) { - b = new BIG(0); - b.copy(this); - b.shr(i * 4); - s += (b.w[0] & 15).toString(16); - } - - return s; - }, - - /* this+=y */ - add: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] += y.w[i]; - } - - return this; - }, - - /* this|=y */ - or: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] |= y.w[i]; - } - - return this; - }, - - /* return this+x */ - plus: function (x) { - var s = new BIG(0), - i; - - for (i = 0; i < BIG.NLEN; i++) { - s.w[i] = this.w[i] + x.w[i]; - } - - return s; - }, - - /* this+=i, where i is int */ - inc: function (i) { - this.norm(); - this.w[0] += i; - return this; - }, - - /* this-=y */ - sub: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] -= y.w[i]; - } - - return this; - }, - - /* reverse subtract this=x-this */ - rsub: function (x) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = x.w[i] - this.w[i]; - } - - return this; - }, - - /* this-=i, where i is int */ - dec: function (i) { - this.norm(); - this.w[0] -= i; - return this; - }, - - /* return this-x */ - minus: function (x) { - var d = new BIG(0), - i; - - for (i = 0; i < BIG.NLEN; i++) { - d.w[i] = this.w[i] - x.w[i]; - } - - return d; - }, - - /* multiply by small integer */ - imul: function (c) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] *= c; - } - - return this; - }, - - /* convert this BIG to byte array */ - tobytearray: function (b, n) { - var c = new BIG(0), - i; - - c.copy(this); - c.norm(); - - for (i = BIG.MODBYTES - 1; i >= 0; i--) { - b[i + n] = c.w[0] & 0xff; - c.fshr(8); - } - - return this; - }, - - /* convert this to byte array */ - toBytes: function (b) { - this.tobytearray(b, 0); - }, - - /* set this[i]+=x*y+c, and return high part */ - muladd: function (x, y, c, i) { - var prod = x * y + c + this.w[i]; - this.w[i] = prod & BIG.BMASK; - return (prod - this.w[i]) * BIG.MODINV; - }, - - /* multiply by larger int */ - pmul: function (c) { - var carry = 0, - ak, - i; - - for (i = 0; i < BIG.NLEN; i++) { - ak = this.w[i]; - this.w[i] = 0; - carry = this.muladd(ak, c, carry, i); - } - - return carry; - }, - - /* multiply by still larger int - results requires a ctx.DBIG */ - pxmul: function (c) { - var m = new ctx.DBIG(0), - carry = 0, - j; - - for (j = 0; j < BIG.NLEN; j++) { - carry = m.muladd(this.w[j], c, carry, j); - } - - m.w[BIG.NLEN] = carry; - - return m; - }, - - /* divide by 3 */ - div3: function () { - var carry = 0, - ak, - base, - i; - - this.norm(); - base = 1 << BIG.BASEBITS; - - for (i = BIG.NLEN - 1; i >= 0; i--) { - ak = carry * base + this.w[i]; - this.w[i] = Math.floor(ak / 3); - carry = ak % 3; - } - return carry; - }, - - /* set x = x mod 2^m */ - mod2m: function (m) { - var i, wd, bt, msk; - - wd = Math.floor(m / BIG.BASEBITS); - bt = m % BIG.BASEBITS; - msk = (1 << bt) - 1; - this.w[wd] &= msk; - - for (i = wd + 1; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - }, - - /* a=1/a mod 2^256. This is very fast! */ - invmod2m: function () { - var U = new BIG(0), - b = new BIG(0), - c = new BIG(0), - i, - t1, - t2; - - U.inc(BIG.invmod256(this.lastbits(8))); - - for (i = 8; i < BIG.BIGBITS; i <<= 1) { - U.norm(); - b.copy(this); - b.mod2m(i); - t1 = BIG.smul(U, b); - t1.shr(i); - c.copy(this); - c.shr(i); - c.mod2m(i); - - t2 = BIG.smul(U, c); - t2.mod2m(i); - t1.add(t2); - t1.norm(); - b = BIG.smul(t1, U); - t1.copy(b); - t1.mod2m(i); - - t2.one(); - t2.shl(i); - t1.rsub(t2); - t1.norm(); - t1.shl(i); - U.add(t1); - } - - U.mod2m(BIG.BIGBITS); - this.copy(U); - this.norm(); - }, - - /* reduce this mod m */ - mod: function (m1) { - var k = 0, - r = new BIG(0); - var m = new BIG(0); - m.copy(m1); - - this.norm(); - - if (BIG.comp(this, m) < 0) { - return; - } - - do { - m.fshl(1); - k++; - } while (BIG.comp(this, m) >= 0); - - while (k > 0) { - m.fshr(1); - - r.copy(this); - r.sub(m); - r.norm(); - this.cmove(r, 1 - ((r.w[BIG.NLEN - 1] >> (BIG.CHUNK - 1)) & 1)); - - k--; - } - }, - /* this/=m */ - div: function (m1) { - var k = 0, - d = 0, - e = new BIG(1), - b = new BIG(0), - r = new BIG(0); - var m = new BIG(0); - m.copy(m1); - - this.norm(); - b.copy(this); - this.zero(); - - while (BIG.comp(b, m) >= 0) { - e.fshl(1); - m.fshl(1); - k++; - } - - while (k > 0) { - m.fshr(1); - e.fshr(1); - - r.copy(b); - r.sub(m); - r.norm(); - d = 1 - ((r.w[BIG.NLEN - 1] >> (BIG.CHUNK - 1)) & 1); - b.cmove(r, d); - r.copy(this); - r.add(e); - r.norm(); - this.cmove(r, d); - - k--; - } - }, - /* return parity of this */ - parity: function () { - return this.w[0] % 2; - }, - - /* return n-th bit of this */ - bit: function (n) { - if ((this.w[Math.floor(n / BIG.BASEBITS)] & (1 << n % BIG.BASEBITS)) > 0) { - return 1; - } else { - return 0; - } - }, - - /* return last n bits of this */ - lastbits: function (n) { - var msk = (1 << n) - 1; - this.norm(); - return this.w[0] & msk; - }, - - isok: function () { - var ok = true, - i; - - for (i = 0; i < BIG.NLEN; i++) { - if (this.w[i] >> BIG.BASEBITS != 0) { - ok = false; - } - } - - return ok; - }, - - /* Jacobi Symbol (this/p). Returns 0, 1 or -1 */ - jacobi: function (p) { - var m = 0, - t = new BIG(0), - x = new BIG(0), - n = new BIG(0), - zilch = new BIG(0), - one = new BIG(1), - n8, - k; - - if (p.parity() === 0 || BIG.comp(this, zilch) === 0 || BIG.comp(p, one) <= 0) { - return 0; - } - - this.norm(); - x.copy(this); - n.copy(p); - x.mod(p); - - while (BIG.comp(n, one) > 0) { - if (BIG.comp(x, zilch) === 0) { - return 0; - } - - n8 = n.lastbits(3); - k = 0; - - while (x.parity() === 0) { - k++; - x.shr(1); - } - - if (k % 2 == 1) { - m += (n8 * n8 - 1) / 8; - } - - m += ((n8 - 1) * (x.lastbits(2) - 1)) / 4; - t.copy(n); - t.mod(x); - n.copy(x); - x.copy(t); - m %= 2; - } - - if (m === 0) { - return 1; - } else { - return -1; - } - }, - - /* this=1/this mod p. Binary method */ - invmodp: function (p) { - if (this.iszilch()) { - return; - } - var u = new BIG(0), - v = new BIG(0), - x1 = new BIG(1), - x2 = new BIG(0), - t = new BIG(0), - one = new BIG(1); - - this.mod(p); - u.copy(this); - v.copy(p); - - while (BIG.comp(u, one) !== 0 && BIG.comp(v, one) !== 0) { - while (u.parity() === 0) { - u.fshr(1); - t.copy(x1); - t.add(p); - x1.cmove(t, x1.parity()); - x1.norm(); - x1.fshr(1); - } - while (v.parity() === 0) { - v.fshr(1); - t.copy(x2); - t.add(p); - x2.cmove(t, x2.parity()); - x2.norm(); - x2.fshr(1); - } - if (BIG.comp(u, v) >= 0) { - u.sub(v); - u.norm(); - t.copy(x1); - t.add(p); - x1.cmove(t, (BIG.comp(x1, x2) >> 1) & 1); - x1.sub(x2); - x1.norm(); - } else { - v.sub(u); - v.norm(); - t.copy(x2); - t.add(p); - x2.cmove(t, (BIG.comp(x2, x1) >> 1) & 1); - x2.sub(x1); - x2.norm(); - } - } - - this.copy(x1); - this.cmove(x2, BIG.comp(u, one) & 1); - }, - - /* return this^e mod m */ - powmod: function (e1, m) { - var a = new BIG(1), - z = new BIG(0), - s = new BIG(0), - bt; - - var e = new BIG(0); - e.copy(e1); - this.norm(); - e.norm(); - z.copy(e); - s.copy(this); - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - a = BIG.modmul(a, s, m); - } - - if (z.iszilch()) { - break; - } - - s = BIG.modsqr(s, m); - } - - return a; - }, - }; - - BIG.ssn = function (r, a, m) { - var n = BIG.NLEN - 1; - m.w[0] = (m.w[0] >> 1) | ((m.w[1] << (BIG.BASEBITS - 1)) & BIG.BMASK); - r.w[0] = a.w[0] - m.w[0]; - var carry = r.w[0] >> BIG.BASEBITS; - r.w[0] &= BIG.BMASK; - for (var i = 1; i < n; i++) { - m.w[i] = (m.w[i] >> 1) | ((m.w[i + 1] << (BIG.BASEBITS - 1)) & BIG.BMASK); - r.w[i] = a.w[i] - m.w[i] + carry; - carry = r.w[i] >> BIG.BASEBITS; - r.w[i] &= BIG.BMASK; - } - m.w[n] >>= 1; - r.w[n] = a.w[n] - m.w[n] + carry; - return (r.w[n] >> (BIG.CHUNK - 1)) & 1; - }; - - /* convert from byte array to BIG */ - BIG.frombytearray = function (b, n) { - var m = new BIG(0), - i; - - for (i = 0; i < BIG.MODBYTES; i++) { - m.fshl(8); - m.w[0] += b[i + n] & 0xff; - } - - return m; - }; - - BIG.fromBytes = function (b) { - return BIG.frombytearray(b, 0); - }; - - /* return a*b where product fits a BIG */ - BIG.smul = function (a, b) { - var c = new BIG(0), - carry, - i, - j; - - for (i = 0; i < BIG.NLEN; i++) { - carry = 0; - - for (j = 0; j < BIG.NLEN; j++) { - if (i + j < BIG.NLEN) { - carry = c.muladd(a.w[i], b.w[j], carry, i + j); - } - } - } - - return c; - }; - - /* Compare a and b, return 0 if a==b, -1 if ab. Inputs must be normalised */ - BIG.comp = function (a, b) { - var i; - var gt = 0; - var eq = 1; - - for (i = BIG.NLEN - 1; i >= 0; i--) { - gt |= ((b.w[i] - a.w[i]) >> BIG.BASEBITS) & eq; - eq &= ((b.w[i] ^ a.w[i]) - 1) >> BIG.BASEBITS; - } - - return gt + gt + eq - 1; - }; - - /* get 8*MODBYTES size random number */ - BIG.random = function (rng) { - var m = new BIG(0), - j = 0, - r = 0, - i, - b; - - /* generate random BIG */ - for (i = 0; i < 8 * BIG.MODBYTES; i++) { - if (j === 0) { - r = rng.getByte(); - } else { - r >>= 1; - } - - b = r & 1; - m.shl(1); - m.w[0] += b; // m.inc(b); - j++; - j &= 7; - } - return m; - }; - - /* Create random BIG in portable way, one bit at a time */ - BIG.randomnum = function (q, rng) { - var d = new ctx.DBIG(0), - j = 0, - r = 0, - i, - b, - m; - - for (i = 0; i < 2 * q.nbits(); i++) { - if (j === 0) { - r = rng.getByte(); - } else { - r >>= 1; - } - - b = r & 1; - d.shl(1); - d.w[0] += b; - j++; - j &= 7; - } - - m = d.mod(q); - - return m; - }; - - BIG.randtrunc = function (q, trunc, rng) { - var m = BIG.randomnum(q, rng); - if (q.nbits() > trunc) m.mod2m(trunc); - return m; - }; - - /* return a*b as ctx.DBIG */ - BIG.mul = function (a, b) { - var c = new ctx.DBIG(0), - d = new Array(BIG.NLEN), //[], - n, - s, - t, - i, - k, - co; - - for (i = 0; i < BIG.NLEN; i++) { - d[i] = a.w[i] * b.w[i]; - } - - s = d[0]; - t = s; - c.w[0] = t; - - for (k = 1; k < BIG.NLEN; k++) { - s += d[k]; - t = s; - for (i = k; i >= 1 + Math.floor(k / 2); i--) { - t += (a.w[i] - a.w[k - i]) * (b.w[k - i] - b.w[i]); - } - c.w[k] = t; - } - for (k = BIG.NLEN; k < 2 * BIG.NLEN - 1; k++) { - s -= d[k - BIG.NLEN]; - t = s; - for (i = BIG.NLEN - 1; i >= 1 + Math.floor(k / 2); i--) { - t += (a.w[i] - a.w[k - i]) * (b.w[k - i] - b.w[i]); - } - c.w[k] = t; - } - - co = 0; - for (i = 0; i < BIG.DNLEN - 1; i++) { - n = c.w[i] + co; - c.w[i] = n & BIG.BMASK; - co = (n - c.w[i]) * BIG.MODINV; - } - c.w[BIG.DNLEN - 1] = co; - - return c; - }; - - /* return a^2 as ctx.DBIG */ - BIG.sqr = function (a) { - var c = new ctx.DBIG(0), - n, - t, - j, - i, - co; - - c.w[0] = a.w[0] * a.w[0]; - - for (j = 1; j < BIG.NLEN - 1; ) { - t = a.w[j] * a.w[0]; - for (i = 1; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - c.w[j] = t; - j++; - t = a.w[j] * a.w[0]; - for (i = 1; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - t += a.w[j >> 1] * a.w[j >> 1]; - c.w[j] = t; - j++; - } - - for (j = BIG.NLEN - 1 + (BIG.NLEN % 2); j < BIG.DNLEN - 3; ) { - t = a.w[BIG.NLEN - 1] * a.w[j - BIG.NLEN + 1]; - for (i = j - BIG.NLEN + 2; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - c.w[j] = t; - j++; - t = a.w[BIG.NLEN - 1] * a.w[j - BIG.NLEN + 1]; - for (i = j - BIG.NLEN + 2; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - t += a.w[j >> 1] * a.w[j >> 1]; - c.w[j] = t; - j++; - } - - t = a.w[BIG.NLEN - 2] * a.w[BIG.NLEN - 1]; - t += t; - c.w[BIG.DNLEN - 3] = t; - - t = a.w[BIG.NLEN - 1] * a.w[BIG.NLEN - 1]; - c.w[BIG.DNLEN - 2] = t; - - co = 0; - for (i = 0; i < BIG.DNLEN - 1; i++) { - n = c.w[i] + co; - c.w[i] = n & BIG.BMASK; - co = (n - c.w[i]) * BIG.MODINV; - } - c.w[BIG.DNLEN - 1] = co; - - return c; - }; - - BIG.monty = function (m, nd, d) { - var b = new BIG(0), - v = new Array(BIG.NLEN), - dd = new Array(BIG.NLEN), - s, - c, - t, - i, - k; - - t = d.w[0]; - v[0] = ((t & BIG.BMASK) * nd) & BIG.BMASK; - t += v[0] * m.w[0]; - c = d.w[1] + t * BIG.MODINV; - s = 0; - - for (k = 1; k < BIG.NLEN; k++) { - t = c + s + v[0] * m.w[k]; - for (i = k - 1; i > Math.floor(k / 2); i--) { - t += (v[k - i] - v[i]) * (m.w[i] - m.w[k - i]); - } - v[k] = ((t & BIG.BMASK) * nd) & BIG.BMASK; - t += v[k] * m.w[0]; - c = t * BIG.MODINV + d.w[k + 1]; - - dd[k] = v[k] * m.w[k]; - s += dd[k]; - } - - for (k = BIG.NLEN; k < 2 * BIG.NLEN - 1; k++) { - t = c + s; - for (i = BIG.NLEN - 1; i >= 1 + Math.floor(k / 2); i--) { - t += (v[k - i] - v[i]) * (m.w[i] - m.w[k - i]); - } - b.w[k - BIG.NLEN] = t & BIG.BMASK; - c = (t - b.w[k - BIG.NLEN]) * BIG.MODINV + d.w[k + 1]; - - s -= dd[k - BIG.NLEN + 1]; - } - - b.w[BIG.NLEN - 1] = c & BIG.BMASK; - - return b; - }; - - /* return a*b mod m */ - BIG.modmul = function (a1, b1, m) { - var d; - var a = new BIG(0); - a.copy(a1); - var b = new BIG(0); - b.copy(b1); - a.mod(m); - b.mod(m); - d = BIG.mul(a, b); - - return d.mod(m); - }; - - /* return a^2 mod m */ - BIG.modsqr = function (a1, m) { - var d; - var a = new BIG(0); - a.copy(a1); - a.mod(m); - d = BIG.sqr(a); - - return d.mod(m); - }; - - /* return -a mod m */ - BIG.modneg = function (a1, m) { - var a = new BIG(0); - a.copy(a1); - a.mod(m); - a.rsub(m); - a.mod(m); - return a; - }; - - /* return a+b mod m */ - BIG.modadd = function (a1, b1, m) { - var a = new BIG(0); - a.copy(a1); - var b = new BIG(0); - b.copy(b1); - a.mod(m); - b.mod(m); - a.add(b); - a.norm(); - a.mod(m); - return a; - }; - - /* Arazi and Qi inversion mod 256 */ - BIG.invmod256 = function (a) { - var U, t1, t2, b, c; - - t1 = 0; - c = (a >> 1) & 1; - t1 += c; - t1 &= 1; - t1 = 2 - t1; - t1 <<= 1; - U = t1 + 1; - - // i=2 - b = a & 3; - t1 = U * b; - t1 >>= 2; - c = (a >> 2) & 3; - t2 = (U * c) & 3; - t1 += t2; - t1 *= U; - t1 &= 3; - t1 = 4 - t1; - t1 <<= 2; - U += t1; - - // i=4 - b = a & 15; - t1 = U * b; - t1 >>= 4; - c = (a >> 4) & 15; - t2 = (U * c) & 15; - t1 += t2; - t1 *= U; - t1 &= 15; - t1 = 16 - t1; - t1 <<= 4; - U += t1; - - return U; - }; - return BIG; -}; - -/* CORE double length DBIG number class */ -DBIG = function (ctx) { - 'use strict'; - - /* constructor */ - var DBIG = function (x) { - this.w = new Array(BIG.DNLEN); - this.zero(); - this.w[0] = x; - }; - - DBIG.prototype = { - /* set this=0 */ - zero: function () { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] = 0; - } - return this; - }, - - /* set this=b */ - copy: function (b) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] = b.w[i]; - } - return this; - }, - - /* copy from ctx.BIG */ - hcopy: function (b) { - var i; - - for (i = 0; i < ctx.BIG.NLEN; i++) { - this.w[i] = b.w[i]; - } - - for (i = ctx.BIG.NLEN; i < ctx.BIG.DNLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - ucopy: function (b) { - var i; - - for (i = 0; i < ctx.BIG.NLEN; i++) { - this.w[i] = 0; - } - - for (i = ctx.BIG.NLEN; i < ctx.BIG.DNLEN; i++) { - this.w[i] = b.w[i - ctx.BIG.NLEN]; - } - - return this; - }, - - /* normalise this */ - norm: function () { - var carry = 0, - d, - i; - - for (i = 0; i < ctx.BIG.DNLEN - 1; i++) { - d = this.w[i] + carry; - this.w[i] = d & ctx.BIG.BMASK; - carry = d >> ctx.BIG.BASEBITS; - } - this.w[ctx.BIG.DNLEN - 1] = this.w[ctx.BIG.DNLEN - 1] + carry; - - return this; - }, - - /* set this[i]+=x*y+c, and return high part */ - muladd: function (x, y, c, i) { - var prod = x * y + c + this.w[i]; - this.w[i] = prod & ctx.BIG.BMASK; - return (prod - this.w[i]) * ctx.BIG.MODINV; - }, - - /* shift this right by k bits */ - shr: function (k) { - var n = k % ctx.BIG.BASEBITS, - m = Math.floor(k / ctx.BIG.BASEBITS), - i; - - for (i = 0; i < ctx.BIG.DNLEN - m - 1; i++) { - this.w[i] = - (this.w[m + i] >> n) | ((this.w[m + i + 1] << (ctx.BIG.BASEBITS - n)) & ctx.BIG.BMASK); - } - - this.w[ctx.BIG.DNLEN - m - 1] = this.w[ctx.BIG.DNLEN - 1] >> n; - - for (i = ctx.BIG.DNLEN - m; i < ctx.BIG.DNLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* shift this left by k bits */ - shl: function (k) { - var n = k % ctx.BIG.BASEBITS, - m = Math.floor(k / ctx.BIG.BASEBITS), - i; - - this.w[ctx.BIG.DNLEN - 1] = - (this.w[ctx.BIG.DNLEN - 1 - m] << n) | - (this.w[ctx.BIG.DNLEN - m - 2] >> (ctx.BIG.BASEBITS - n)); - - for (i = ctx.BIG.DNLEN - 2; i > m; i--) { - this.w[i] = - ((this.w[i - m] << n) & ctx.BIG.BMASK) | (this.w[i - m - 1] >> (ctx.BIG.BASEBITS - n)); - } - - this.w[m] = (this.w[0] << n) & ctx.BIG.BMASK; - - for (i = 0; i < m; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* Conditional move of ctx.BIG depending on d using XOR - no branches */ - cmove: function (b, d) { - var c = d, - i; - - c = ~(c - 1); - - for (i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] ^= (this.w[i] ^ b.w[i]) & c; - } - }, - - /* this+=x */ - add: function (x) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] += x.w[i]; - } - }, - - /* this-=x */ - sub: function (x) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] -= x.w[i]; - } - }, - - rsub: function (x) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] = x.w[i] - this.w[i]; - } - }, - - /* return number of bits in this */ - nbits: function () { - var k = ctx.BIG.DNLEN - 1, - bts, - c; - - var t = new DBIG(0); - t.copy(this); - t.norm(); - - while (k >= 0 && t.w[k] === 0) { - k--; - } - - if (k < 0) { - return 0; - } - - bts = ctx.BIG.BASEBITS * k; - c = t.w[k]; - - while (c !== 0) { - c = Math.floor(c / 2); - bts++; - } - - return bts; - }, - - /* convert this to string */ - toString: function () { - var s = '', - len = this.nbits(), - b, - i; - - if (len % 4 === 0) { - len = Math.floor(len / 4); - } else { - len = Math.floor(len / 4); - len++; - } - - for (i = len - 1; i >= 0; i--) { - b = new DBIG(0); - b.copy(this); - b.shr(i * 4); - s += (b.w[0] & 15).toString(16); - } - - return s; - }, - - /* reduces this DBIG mod a ctx.BIG, and returns the ctx.BIG */ - mod: function (c) { - var k = 0, - m = new DBIG(0), - dr = new DBIG(0), - r = new ctx.BIG(0); - - this.norm(); - m.hcopy(c); - r.hcopy(this); - - if (DBIG.comp(this, m) < 0) { - return r; - } - - do { - m.shl(1); - k++; - } while (DBIG.comp(this, m) >= 0); - - while (k > 0) { - m.shr(1); - - dr.copy(this); - dr.sub(m); - dr.norm(); - this.cmove(dr, 1 - ((dr.w[ctx.BIG.DNLEN - 1] >> (ctx.BIG.CHUNK - 1)) & 1)); - k--; - } - - r.hcopy(this); - - return r; - }, - - /* this/=c */ - div: function (c) { - var d = 0, - k = 0, - m = new DBIG(0), - dr = new DBIG(0), - r = new ctx.BIG(0), - a = new ctx.BIG(0), - e = new ctx.BIG(1); - - m.hcopy(c); - this.norm(); - - while (DBIG.comp(this, m) >= 0) { - e.fshl(1); - m.shl(1); - k++; - } - - while (k > 0) { - m.shr(1); - e.shr(1); - - dr.copy(this); - dr.sub(m); - dr.norm(); - d = 1 - ((dr.w[ctx.BIG.DNLEN - 1] >> (ctx.BIG.CHUNK - 1)) & 1); - this.cmove(dr, d); - r.copy(a); - r.add(e); - r.norm(); - a.cmove(r, d); - - k--; - } - return a; - }, - - /* split this DBIG at position n, return higher half, keep lower half */ - split: function (n) { - var t = new ctx.BIG(0), - m = n % ctx.BIG.BASEBITS, - carry = this.w[ctx.BIG.DNLEN - 1] << (ctx.BIG.BASEBITS - m), - nw, - i; - - for (i = ctx.BIG.DNLEN - 2; i >= ctx.BIG.NLEN - 1; i--) { - nw = (this.w[i] >> m) | carry; - carry = (this.w[i] << (ctx.BIG.BASEBITS - m)) & ctx.BIG.BMASK; - t.w[i - ctx.BIG.NLEN + 1] = nw; - } - - this.w[ctx.BIG.NLEN - 1] &= (1 << m) - 1; - - return t; - }, - }; - - /* Compare a and b, return 0 if a==b, -1 if ab. Inputs must be normalised */ - DBIG.comp = function (a, b) { - var i; - var gt = 0; - var eq = 1; - for (i = ctx.BIG.DNLEN - 1; i >= 0; i--) { - gt |= ((b.w[i] - a.w[i]) >> ctx.BIG.BASEBITS) & eq; - eq &= ((b.w[i] ^ a.w[i]) - 1) >> ctx.BIG.BASEBITS; - } - - return gt + gt + eq - 1; - }; - - /* convert from byte array to DBIG */ - DBIG.fromBytes = function (b) { - var m = new DBIG(0), - i; - - for (i = 0; i < b.length; i++) { - m.shl(8); - m.w[0] += b[i] & 0xff; - } - - return m; - }; - - return DBIG; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BIG: BIG, - DBIG: DBIG, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/bls.js b/packages/bls-verify/src/vendor/amcl-js/src/bls.js deleted file mode 100644 index 1af3affb8..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/bls.js +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Boneh-Lynn-Shacham signature 128-bit API Functions */ - -var BLS = function (ctx) { - 'use strict'; - - var BLS = { - BLS_OK: 0, - BLS_FAIL: -1, - - BFS: ctx.BIG.MODBYTES, - BGS: ctx.BIG.MODBYTES, - G2_TAB: [], - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - return b; - }, - - init: function () { - var G = ctx.ECP2.generator(); - if (G.is_infinity()) return this.BLS_FAIL; - this.G2_TAB = ctx.PAIR.precomp(G); - return this.BLS_OK; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - /* output u \in F_p */ - hash_to_field: function (hash, hlen, DST, M, ctr) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var L = this.ceil(q.nbits() + ctx.ECP.AESKEY * 8, 8); - var u = []; - var fd = []; - var OKM = ctx.HMAC.XMD_Expand(hash, hlen, L * ctr, DST, M); - - for (var i = 0; i < ctr; i++) { - for (var j = 0; j < L; j++) fd[j] = OKM[i * L + j]; - u[i] = new ctx.FP(ctx.DBIG.fromBytes(fd).mod(q)); - } - return u; - }, - - /* hash a message to an ECP point, using SHA2 */ - bls_hash_to_point: function (M) { - var dst = 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_'; - var u = this.hash_to_field(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, this.asciitobytes(dst), M, 2); - - var P = ctx.ECP.map2point(u[0]); - var P1 = ctx.ECP.map2point(u[1]); - P.add(P1); - P.cfp(); - P.affine(); - return P; - }, - - /* generate key pair, private key S, public key W */ - KeyPairGenerate: function (IKM, S, W) { - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var L = this.ceil(3 * this.ceil(r.nbits(), 8), 2); - var G = ctx.ECP2.generator(); - var LEN = ctx.HMAC.inttobytes(L, 2); - var AIKM = []; - for (var i = 0; i < IKM.length; i++) AIKM[i] = IKM[i]; - AIKM[IKM.length] = 0; - - var salt = 'BLS-SIG-KEYGEN-SALT-'; - var PRK = ctx.HMAC.HKDF_Extract( - ctx.HMAC.MC_SHA2, - ctx.ECP.HASH_TYPE, - this.asciitobytes(salt), - AIKM, - ); - var OKM = ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LEN); - - var dx = ctx.DBIG.fromBytes(OKM); - var s = dx.mod(r); - s.toBytes(S); - // SkToPk - G = ctx.PAIR.G2mul(G, s); - G.toBytes(W, true); - return this.BLS_OK; - }, - - /* Sign message m using private key S to produce signature SIG */ - - core_sign: function (SIG, M, S) { - var D = this.bls_hash_to_point(M); - var s = ctx.BIG.fromBytes(S); - D = ctx.PAIR.G1mul(D, s); - D.toBytes(SIG, true); - return this.BLS_OK; - }, - - /* Verify signature given message m, the signature SIG, and the public key W */ - - core_verify: function (SIG, M, W) { - var HM = this.bls_hash_to_point(M); - - var D = ctx.ECP.fromBytes(SIG); - if (!ctx.PAIR.G1member(D)) return this.BLS_FAIL; - D.neg(); - - var PK = ctx.ECP2.fromBytes(W); - if (!ctx.PAIR.G2member(PK)) return this.BLS_FAIL; - - // Use new multi-pairing mechanism - //var r = ctx.PAIR.initmp(); - //ctx.PAIR.another_pc(r, this.G2_TAB, D); - // ctx.PAIR.another(r,G,D); - //ctx.PAIR.another(r, PK, HM); - //var v = ctx.PAIR.miller(r); - - //.. or alternatively - var G = ctx.ECP2.generator(); - var v = ctx.PAIR.ate2(G, D, PK, HM); - - v = ctx.PAIR.fexp(v); - if (v.isunity()) return this.BLS_OK; - return this.BLS_FAIL; - }, - }; - - return BLS; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BLS: BLS, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/bls192.js b/packages/bls-verify/src/vendor/amcl-js/src/bls192.js deleted file mode 100644 index 61b26ca57..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/bls192.js +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Boneh-Lynn-Shacham signature 192-bit API Functions */ - -var BLS192 = function (ctx) { - 'use strict'; - - var BLS192 = { - BLS_OK: 0, - BLS_FAIL: -1, - - BFS: ctx.BIG.MODBYTES, - BGS: ctx.BIG.MODBYTES, - G2_TAB: [], - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - init: function () { - var G = ctx.ECP4.generator(); - if (G.is_infinity()) return this.BLS_FAIL; - this.G2_TAB = ctx.PAIR4.precomp(G); - return this.BLS_OK; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - /* output u \in F_p */ - hash_to_field: function (hash, hlen, DST, M, ctr) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var L = this.ceil(q.nbits() + ctx.ECP.AESKEY * 8, 8); - var u = []; - var fd = []; - var OKM = ctx.HMAC.XMD_Expand(hash, hlen, L * ctr, DST, M); - - for (var i = 0; i < ctr; i++) { - for (var j = 0; j < L; j++) fd[j] = OKM[i * L + j]; - u[i] = new ctx.FP(ctx.DBIG.fromBytes(fd).mod(q)); - } - return u; - }, - - /* hash a message to an ECP point, using SHA2 */ - bls_hash_to_point: function (M) { - var dst = 'BLS_SIG_ZZZG1_XMD:SHA-384_SVDW_RO_NUL_'; - var u = this.hash_to_field(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, this.asciitobytes(dst), M, 2); - - var P = ctx.ECP.map2point(u[0]); - var P1 = ctx.ECP.map2point(u[1]); - P.add(P1); - P.cfp(); - P.affine(); - return P; - }, - - /* generate key pair, private key S, public key W */ - KeyPairGenerate: function (IKM, S, W) { - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var L = this.ceil(3 * this.ceil(r.nbits(), 8), 2); - var G = ctx.ECP4.generator(); - var LEN = ctx.HMAC.inttobytes(L, 2); - var AIKM = []; - for (var i = 0; i < IKM.length; i++) AIKM[i] = IKM[i]; - AIKM[IKM.length] = 0; - - var salt = 'BLS-SIG-KEYGEN-SALT-'; - var PRK = ctx.HMAC.HKDF_Extract( - ctx.HMAC.MC_SHA2, - ctx.ECP.HASH_TYPE, - this.asciitobytes(salt), - AIKM, - ); - var OKM = ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LEN); - - var dx = ctx.DBIG.fromBytes(OKM); - var s = dx.mod(r); - s.toBytes(S); - // SkToPk - G = ctx.PAIR4.G2mul(G, s); - G.toBytes(W, true); - return this.BLS_OK; - }, - - /* Sign message m using private key S to produce signature SIG */ - - core_sign: function (SIG, M, S) { - var D = this.bls_hash_to_point(M); - var s = ctx.BIG.fromBytes(S); - D = ctx.PAIR4.G1mul(D, s); - D.toBytes(SIG, true); - return this.BLS_OK; - }, - - /* Verify signature given message m, the signature SIG, and the public key W */ - - core_verify: function (SIG, M, W) { - var HM = this.bls_hash_to_point(M); - - var D = ctx.ECP.fromBytes(SIG); - if (!ctx.PAIR4.G1member(D)) return this.BLS_FAIL; - D.neg(); - - var PK = ctx.ECP4.fromBytes(W); - if (!ctx.PAIR4.G2member(PK)) return this.BLS_FAIL; - - // Use new multi-pairing mechanism - var r = ctx.PAIR4.initmp(); - // ctx.PAIR4.another(r,G,D); - ctx.PAIR4.another_pc(r, this.G2_TAB, D); - ctx.PAIR4.another(r, PK, HM); - var v = ctx.PAIR4.miller(r); - - //.. or alternatively - // var v=ctx.PAIR4.ate2(G,D,PK,HM); - v = ctx.PAIR4.fexp(v); - if (v.isunity()) return this.BLS_OK; - return this.BLS_FAIL; - }, - }; - - return BLS192; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BLS192: BLS192, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/bls256.js b/packages/bls-verify/src/vendor/amcl-js/src/bls256.js deleted file mode 100644 index dd4077eba..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/bls256.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Boneh-Lynn-Shacham signature 256-bit API Functions */ - -var BLS256 = function (ctx) { - 'use strict'; - - var BLS256 = { - BLS_OK: 0, - BLS_FAIL: -1, - - BFS: ctx.BIG.MODBYTES, - BGS: ctx.BIG.MODBYTES, - G2_TAB: [], - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - init: function () { - var G = ctx.ECP8.generator(); - if (G.is_infinity()) return this.BLS_FAIL; - this.G2_TAB = ctx.PAIR8.precomp(G); - return this.BLS_OK; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - /* output u \in F_p */ - hash_to_field: function (hash, hlen, DST, M, ctr) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var L = this.ceil(q.nbits() + ctx.ECP.AESKEY * 8, 8); - var u = []; - var fd = []; - var OKM = ctx.HMAC.XMD_Expand(hash, hlen, L * ctr, DST, M); - - for (var i = 0; i < ctr; i++) { - for (var j = 0; j < L; j++) fd[j] = OKM[i * L + j]; - u[i] = new ctx.FP(ctx.DBIG.fromBytes(fd).mod(q)); - } - return u; - }, - - /* hash a message to an ECP point, using SHA2 */ - bls_hash_to_point: function (M) { - var dst = 'BLS_SIG_ZZZG1_XMD:SHA-512_SVDW_RO_NUL_'; - var u = this.hash_to_field(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, this.asciitobytes(dst), M, 2); - - var P = ctx.ECP.map2point(u[0]); - var P1 = ctx.ECP.map2point(u[1]); - P.add(P1); - P.cfp(); - P.affine(); - return P; - }, - - /* generate key pair, private key S, public key W */ - KeyPairGenerate: function (IKM, S, W) { - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var L = this.ceil(3 * this.ceil(r.nbits(), 8), 2); - var G = ctx.ECP8.generator(); - var LEN = ctx.HMAC.inttobytes(L, 2); - var AIKM = []; - for (var i = 0; i < IKM.length; i++) AIKM[i] = IKM[i]; - AIKM[IKM.length] = 0; - - var salt = 'BLS-SIG-KEYGEN-SALT-'; - var PRK = ctx.HMAC.HKDF_Extract( - ctx.HMAC.MC_SHA2, - ctx.ECP.HASH_TYPE, - this.asciitobytes(salt), - AIKM, - ); - var OKM = ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LEN); - - var dx = ctx.DBIG.fromBytes(OKM); - var s = dx.mod(r); - s.toBytes(S); - // SkToPk - G = ctx.PAIR8.G2mul(G, s); - G.toBytes(W, true); - return this.BLS_OK; - }, - - /* Sign message m using private key S to produce signature SIG */ - - core_sign: function (SIG, M, S) { - var D = this.bls_hash_to_point(M); - var s = ctx.BIG.fromBytes(S); - D = ctx.PAIR8.G1mul(D, s); - D.toBytes(SIG, true); - return this.BLS_OK; - }, - - /* Verify signature given message m, the signature SIG, and the public key W */ - - core_verify: function (SIG, M, W) { - var HM = this.bls_hash_to_point(M); - - var D = ctx.ECP.fromBytes(SIG); - if (!ctx.PAIR8.G1member(D)) return this.BLS_FAIL; - D.neg(); - - var PK = ctx.ECP8.fromBytes(W); - if (!ctx.PAIR8.G2member(PK)) return this.BLS_FAIL; - - //if (!ctx.PAIR8.G2member(PK)) alert("Not a member"); - //alert("PK= "+PK.toString()); - - // Use new multi-pairing mechanism - var r = ctx.PAIR8.initmp(); - // ctx.PAIR8.another(r,G,D); - ctx.PAIR8.another_pc(r, this.G2_TAB, D); - ctx.PAIR8.another(r, PK, HM); - var v = ctx.PAIR8.miller(r); - - //.. or alternatively - //var G = ctx.ECP8.generator(); - //var v=ctx.PAIR8.ate2(G,D,PK,HM); - - v = ctx.PAIR8.fexp(v); - if (v.isunity()) return this.BLS_OK; - return this.BLS_FAIL; - }, - }; - - return BLS256; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BLS256: BLS256, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ctx.js b/packages/bls-verify/src/vendor/amcl-js/src/ctx.js deleted file mode 100644 index 5a2a51636..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ctx.js +++ /dev/null @@ -1,1203 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var CTX = function (input_parameter) { - 'use strict'; - - var ctx = this, - CTXLIST, - prepareModule; - - CTXLIST = { - ED25519: { - 'BITS': '256', - 'FIELD': '25519', - 'CURVE': 'ED25519', - '@NB': 32 /* Number of bytes in Modulus */, - '@BASE': 24 /* Number base as power of 2 */, - '@NBT': 255 /* Number of bits in modulus */, - '@M8': 2 /* Modulus mod 8 */, - '@RZ': 1 /* Hash-to-point Z value */, - '@RZ2A': 0 /* Hash-to-point G2 Z value */, - '@RZ2B': 0 /* Hash-to-point G2 Z value */, - '@HC': 0 /* Isogeny degree G1 */, - '@HC2': 0 /* Isogeny degree G2 */, - '@MT': 1 /* Modulus Type (pseudo-mersenne,...) */, - '@QI': 0 /* Fp2 QNR */, - '@TW': 0 /* Tower type */, - '@CT': 1 /* Curve Type (Weierstrass,...) */, - '@CA': -1 /* Curve A parameter */, - '@PF': 0 /* Pairing Friendly */, - '@ST': 0 /* Sextic Twist Type */, - '@SX': 0 /* Sign of x parameter */, - '@AB': 0 /* ATE parameter size */, - '@HT': 32 /* Hash output size */, - '@SH': 9 /* Maximum field excess */, - '@AK': 16 /* AES key size */, - }, - - MDC: { - 'BITS': '256', - 'FIELD': 'MDC', - 'CURVE': 'MDC', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - X448: { - 'BITS': '448', - 'FIELD': 'GOLDILOCKS', - 'CURVE': 'X448', - '@NB': 56, - '@BASE': 23, - '@NBT': 448, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 2, - '@QI': 0, - '@TW': 0, - '@CT': 2, - '@CA': 156326, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - SECP160R1: { - 'BITS': '160', - 'FIELD': 'SECP160R1', - 'CURVE': 'SECP160R1', - '@NB': 20, - '@BASE': 24, - '@NBT': 160, - '@M8': 1, - '@RZ': 3, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - C25519: { - 'BITS': '256', - 'FIELD': '25519', - 'CURVE': 'C25519', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 2, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 2, - '@CA': 486662, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - C13318: { - 'BITS': '256', - 'FIELD': '25519', - 'CURVE': 'C13318', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 2, - '@RZ': 2, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - JUBJUB: { - 'BITS': '256', - 'FIELD': 'JUBJUB', - 'CURVE': 'JUBJUB', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 32, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 5, - '@TW': 0, - '@CT': 1, - '@CA': -1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - SECP256K1: { - 'BITS': '256', - 'FIELD': 'SECP256K1', - 'CURVE': 'SECP256K1', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -11, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 3, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NIST256: { - 'BITS': '256', - 'FIELD': 'NIST256', - 'CURVE': 'NIST256', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -10, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - SM2: { - 'BITS': '256', - 'FIELD': 'SM2', - 'CURVE': 'SM2', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -9, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NIST384: { - 'BITS': '384', - 'FIELD': 'NIST384', - 'CURVE': 'NIST384', - '@NB': 48, - '@BASE': 23, - '@NBT': 384, - '@M8': 1, - '@RZ': -12, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 7, - '@AK': 24, - }, - - BRAINPOOL: { - 'BITS': '256', - 'FIELD': 'BRAINPOOL', - 'CURVE': 'BRAINPOOL', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -3, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - ANSSI: { - 'BITS': '256', - 'FIELD': 'ANSSI', - 'CURVE': 'ANSSI', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -5, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - HIFIVE: { - 'BITS': '336', - 'FIELD': 'HIFIVE', - 'CURVE': 'HIFIVE', - '@NB': 42, - '@BASE': 23, - '@NBT': 336, - '@M8': 2, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 9, - '@AK': 24, - }, - - GOLDILOCKS: { - 'BITS': '448', - 'FIELD': 'GOLDILOCKS', - 'CURVE': 'GOLDILOCKS', - '@NB': 56, - '@BASE': 23, - '@NBT': 448, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 2, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - C41417: { - 'BITS': '416', - 'FIELD': 'C41417', - 'CURVE': 'C41417', - '@NB': 52, - '@BASE': 22, - '@NBT': 414, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 4, - '@AK': 32, - }, - - C1174: { - 'BITS': '256', - 'FIELD': 'C1174', - 'CURVE': 'C1174', - '@NB': 32, - '@BASE': 24, - '@NBT': 251, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - C1665: { - 'BITS': '168', - 'FIELD': 'C1665', - 'CURVE': 'C1665', - '@NB': 21, - '@BASE': 23, - '@NBT': 166, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - NIST521: { - 'BITS': '528', - 'FIELD': 'NIST521', - 'CURVE': 'NIST521', - '@NB': 66, - '@BASE': 23, - '@NBT': 521, - '@M8': 1, - '@RZ': -4, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 8, - '@AK': 32, - }, - - NUMS256W: { - 'BITS': '256', - 'FIELD': '256PM', - 'CURVE': 'NUMS256W', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 7, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NUMS256E: { - 'BITS': '256', - 'FIELD': '256PM', - 'CURVE': 'NUMS256E', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NUMS384W: { - 'BITS': '384', - 'FIELD': '384PM', - 'CURVE': 'NUMS384W', - '@NB': 48, - '@BASE': 23, - '@NBT': 384, - '@M8': 1, - '@RZ': -4, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 7, - '@AK': 24, - }, - - NUMS384E: { - 'BITS': '384', - 'FIELD': '384PM', - 'CURVE': 'NUMS384E', - '@NB': 48, - '@BASE': 23, - '@NBT': 384, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 7, - '@AK': 24, - }, - - NUMS512W: { - 'BITS': '512', - 'FIELD': '512PM', - 'CURVE': 'NUMS512W', - '@NB': 64, - '@BASE': 23, - '@NBT': 512, - '@M8': 1, - '@RZ': -4, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - NUMS512E: { - 'BITS': '512', - 'FIELD': '512PM', - 'CURVE': 'NUMS512E', - '@NB': 64, - '@BASE': 23, - '@NBT': 512, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - TWEEDLEDUM: { - 'BITS': '255', - 'FIELD': 'TWEEDLEDUM', - 'CURVE': 'TWEEDLEDUM', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 33, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 5, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - TWEEDLEDEE: { - 'BITS': '255', - 'FIELD': 'TWEEDLEDEE', - 'CURVE': 'TWEEDLEDEE', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 34, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 5, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - FP256BN: { - 'BITS': '256', - 'FIELD': 'FP256BN', - 'CURVE': 'FP256BN', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 1, - '@SX': 1, - '@AB': 66, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - FP512BN: { - 'BITS': '512', - 'FIELD': 'FP512BN', - 'CURVE': 'FP512BN', - '@NB': 64, - '@BASE': 23, - '@NBT': 512, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 1, - '@SX': 0, - '@AB': 130, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - BN254: { - 'BITS': '256', - 'FIELD': 'BN254', - 'CURVE': 'BN254', - '@NB': 32, - '@BASE': 24, - '@NBT': 254, - '@M8': 1, - '@RZ': -1, - '@RZ2A': -1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 0, - '@SX': 1, - '@AB': 66, - '@HT': 32, - '@SH': 10, - '@AK': 16, - }, - - BN254CX: { - 'BITS': '256', - 'FIELD': 'BN254CX', - 'CURVE': 'BN254CX', - '@NB': 32, - '@BASE': 24, - '@NBT': 254, - '@M8': 1, - '@RZ': -1, - '@RZ2A': -1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 0, - '@SX': 1, - '@AB': 66, - '@HT': 32, - '@SH': 10, - '@AK': 16, - }, - - BN462: { - 'BITS': '464', - 'FIELD': 'BN462', - 'CURVE': 'BN462', - '@NB': 58, - '@BASE': 23, - '@NBT': 462, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 1, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 0, - '@SX': 0, - '@AB': 118, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - BLS12383: { - 'BITS': '384', - 'FIELD': 'BLS12383', - 'CURVE': 'BLS12383', - '@NB': 48, - '@BASE': 23, - '@NBT': 383, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 2, - '@ST': 1, - '@SX': 0, - '@AB': 65, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - BLS24479: { - 'BITS': '480', - 'FIELD': 'BLS24479', - 'CURVE': 'BLS24479', - '@NB': 60, - '@BASE': 23, - '@NBT': 479, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 4, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 3, - '@ST': 1, - '@SX': 0, - '@AB': 49, - '@HT': 48, - '@SH': 4, - '@AK': 24, - }, - - BLS48556: { - 'BITS': '560', - 'FIELD': 'BLS48556', - 'CURVE': 'BLS48556', - '@NB': 70, - '@BASE': 23, - '@NBT': 556, - '@M8': 1, - '@RZ': -1, - '@RZ2A': 2, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 4, - '@ST': 1, - '@SX': 0, - '@AB': 32, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - BLS48286: { - 'BITS': '288', - 'FIELD': 'BLS48286', - 'CURVE': 'BLS48286', - '@NB': 36, - '@BASE': 23, - '@NBT': 286, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 4, - '@ST': 1, - '@SX': 0, - '@AB': 17, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - BLS48581: { - 'BITS': '584', - 'FIELD': 'BLS48581', - 'CURVE': 'BLS48581', - '@NB': 73, - '@BASE': 23, - '@NBT': 581, - '@M8': 1, - '@RZ': 2, - '@RZ2A': 2, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 1, - '@CT': 0, - '@CA': 0, - '@PF': 4, - '@ST': 0, - '@SX': 1, - '@AB': 33, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - BLS12381: { - 'BITS': '381', - 'FIELD': 'BLS12381', - 'CURVE': 'BLS12381', - '@NB': 48, - '@BASE': 23, - '@NBT': 381, - '@M8': 1, - '@RZ': 11, - '@RZ2A': -2, - '@RZ2B': -1, - '@HC': 11, - '@HC2': 3, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 2, - '@ST': 1, - '@SX': 1, - '@AB': 65, - '@HT': 32, - '@SH': 10, - '@AK': 16, - }, - - BLS12461: { - 'BITS': '464', - 'FIELD': 'BLS12461', - 'CURVE': 'BLS12461', - '@NB': 58, - '@BASE': 23, - '@NBT': 461, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 4, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 2, - '@ST': 1, - '@SX': 1, - '@AB': 78, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - RSA2048: { - 'BITS': '1024', - 'TFF': '2048', - '@NB': 128, - '@BASE': 22, - '@ML': 2, - }, - - RSA3072: { - 'BITS': '384', - 'TFF': '3072', - '@NB': 48, - '@BASE': 23, - '@ML': 8, - }, - - RSA4096: { - 'BITS': '512', - 'TFF': '4096', - '@NB': 64, - '@BASE': 23, - '@ML': 8, - }, - }; - - prepareModule = function (moduleName, fileName, propertyName) { - if (!propertyName) { - propertyName = moduleName; - } - - if (typeof require !== 'undefined') { - if (!fileName) { - fileName = moduleName.toLowerCase(); - } - - ctx[propertyName] = require('./' + fileName)[moduleName](ctx); - } else { - ctx[propertyName] = window[moduleName](ctx); - } - }; - - prepareModule('AES'); - prepareModule('GCM'); - prepareModule('UInt64'); - prepareModule('HMAC'); - prepareModule('HASH256'); - prepareModule('HASH384'); - prepareModule('HASH512'); - prepareModule('SHA3'); - prepareModule('RAND'); - prepareModule('SHARE'); - prepareModule('NHS'); - - if (typeof input_parameter === 'undefined') { - return; - } - - ctx.config = CTXLIST[input_parameter]; - - // Set BIG parameters - prepareModule('BIG'); - prepareModule('DBIG', 'big'); - - // Set RSA parameters - if (typeof ctx.config['TFF'] !== 'undefined') { - prepareModule('FF'); - prepareModule('RSA'); - prepareModule('rsa_public_key', 'rsa'); - prepareModule('rsa_private_key', 'rsa'); - return; - } - - // Set Elliptic Curve parameters - if (typeof ctx.config['CURVE'] !== 'undefined') { - prepareModule('ROM_CURVE_' + ctx.config['CURVE'], 'rom_curve', 'ROM_CURVE'); - - prepareModule('ROM_FIELD_' + ctx.config['FIELD'], 'rom_field', 'ROM_FIELD'); - - prepareModule('FP'); - prepareModule('ECP'); - prepareModule('ECDH'); - prepareModule('HPKE'); - - if (ctx.config['@PF'] == 1 || ctx.config['@PF'] == 2) { - prepareModule('FP2'); - prepareModule('FP4'); - prepareModule('FP12'); - prepareModule('ECP2'); - prepareModule('PAIR'); - prepareModule('MPIN'); - prepareModule('BLS'); - } - - if (ctx.config['@PF'] == 3) { - prepareModule('FP2'); - prepareModule('FP4'); - prepareModule('FP8'); - prepareModule('FP24'); - prepareModule('ECP4'); - prepareModule('PAIR4'); - prepareModule('MPIN192'); - prepareModule('BLS192'); - } - - if (ctx.config['@PF'] == 4) { - prepareModule('FP2'); - prepareModule('FP4'); - prepareModule('FP8'); - prepareModule('FP16'); - prepareModule('FP48'); - prepareModule('ECP8'); - prepareModule('PAIR8'); - prepareModule('MPIN256'); - prepareModule('BLS256'); - } - - return; - } -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = CTX; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecdh.js b/packages/bls-verify/src/vendor/amcl-js/src/ecdh.js deleted file mode 100644 index f00493340..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecdh.js +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* ECDH/ECIES/ECDSA API Functions */ - -var ECDH = function (ctx) { - 'use strict'; - - var ECDH = { - INVALID_PUBLIC_KEY: -2, - ERROR: -3, - //INVALID: -4, - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - /* ctx.AES encryption/decryption */ - - IN_RANGE: function (S) { - var r, s; - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.fromBytes(S); - if (s.iszilch()) return false; - if (ctx.BIG.comp(s, r) >= 0) return false; - return true; - }, - - KEY_PAIR_GENERATE: function (RNG, S, W) { - var res = 0, - r, - s, - G, - WP; - // var T=[]; - - G = ctx.ECP.generator(); - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - if (RNG === null) { - s = ctx.BIG.fromBytes(S); - s.mod(r); - } else { - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, RNG); - } - - s.toBytes(S); - - WP = G.mul(s); - WP.toBytes(W, false); // To use point compression on public keys, change to true - - return res; - }, - - PUBLIC_KEY_VALIDATE: function (W) { - var WP = ctx.ECP.fromBytes(W), - res = 0, - r, - q, - nb, - k; - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - if (WP.is_infinity()) { - res = this.INVALID_PUBLIC_KEY; - } - - if (res === 0) { - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - nb = q.nbits(); - k = new ctx.BIG(1); - k.shl(Math.floor((nb + 4) / 2)); - k.add(q); - k.div(r); - - while (k.parity() == 0) { - k.shr(1); - WP.dbl(); - } - - if (!k.isunity()) { - WP = WP.mul(k); - } - - if (WP.is_infinity()) { - res = this.INVALID_PUBLIC_KEY; - } - } - - return res; - }, - - ECPSVDP_DH: function (S, WD, Z, type) { - var res = 0, - r, - s, - i, - W; - - s = ctx.BIG.fromBytes(S); - - W = ctx.ECP.fromBytes(WD); - if (W.is_infinity()) { - res = this.ERROR; - } - - if (res === 0) { - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s.mod(r); - W = W.mul(s); - - if (W.is_infinity()) { - res = this.ERROR; - } else { - if (ctx.ECP.CURVETYPE != ctx.ECP.MONTGOMERY) { - if (type > 0) { - if (type == 1) W.toBytes(Z, true); - else W.toBytes(Z, false); - } else { - W.getX().toBytes(Z); - } - return res; - } else { - W.getX().toBytes(Z); - } - } - } - return res; - }, - - ECPSP_DSA: function (sha, RNG, S, F, C, D) { - var T = [], - i, - r, - s, - f, - c, - d, - u, - vx, - w, - G, - V, - B; - - B = ctx.HMAC.GPhashit(ctx.HMAC.MC_SHA2, sha, ctx.BIG.MODBYTES, 0, F, -1, null); - - G = ctx.ECP.generator(); - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - s = ctx.BIG.fromBytes(S); - f = ctx.BIG.fromBytes(B); - - c = new ctx.BIG(0); - d = new ctx.BIG(0); - V = new ctx.ECP(); - - do { - u = ctx.BIG.randomnum(r, RNG); - w = ctx.BIG.randomnum(r, RNG); /* side channel masking */ - V.copy(G); - V = V.mul(u); - vx = V.getX(); - c.copy(vx); - c.mod(r); - if (c.iszilch()) { - continue; - } - u = ctx.BIG.modmul(u, w, r); - u.invmodp(r); - d = ctx.BIG.modmul(s, c, r); - d.add(f); - d = ctx.BIG.modmul(d, w, r); - d = ctx.BIG.modmul(u, d, r); - } while (d.iszilch()); - - c.toBytes(T); - for (i = 0; i < this.EFS; i++) { - C[i] = T[i]; - } - d.toBytes(T); - for (i = 0; i < this.EFS; i++) { - D[i] = T[i]; - } - - return 0; - }, - - ECPVP_DSA: function (sha, W, F, C, D) { - var B = [], - res = 0, - r, - f, - c, - d, - h2, - G, - WP, - P; - - B = ctx.HMAC.GPhashit(ctx.HMAC.MC_SHA2, sha, ctx.BIG.MODBYTES, 0, F, -1, null); - - G = ctx.ECP.generator(); - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - c = ctx.BIG.fromBytes(C); - d = ctx.BIG.fromBytes(D); - f = ctx.BIG.fromBytes(B); - - if (c.iszilch() || ctx.BIG.comp(c, r) >= 0 || d.iszilch() || ctx.BIG.comp(d, r) >= 0) { - res = this.ERROR; - } - - if (res === 0) { - d.invmodp(r); - f = ctx.BIG.modmul(f, d, r); - h2 = ctx.BIG.modmul(c, d, r); - - WP = ctx.ECP.fromBytes(W); - if (WP.is_infinity()) { - res = this.ERROR; - } else { - P = new ctx.ECP(); - /* - var X=[]; X[0]=new ctx.ECP(); X[1]=new ctx.ECP(); - var e=[]; e[0]=new ctx.BIG(); e[1]=new ctx.BIG(); - X[0].copy(WP); X[1].copy(G); - e[0].copy(h2); e[1].copy(f); - P=ctx.ECP.muln(2,X,e); -*/ - - P.copy(WP); - P = P.mul2(h2, G, f); - - if (P.is_infinity()) { - res = this.ERROR; - } else { - d = P.getX(); - d.mod(r); - if (ctx.BIG.comp(d, c) !== 0) { - res = this.ERROR; - } - } - } - } - - return res; - }, - - ECIES_ENCRYPT: function (sha, P1, P2, RNG, W, M, V, T) { - var Z = [], - VZ = [], - K1 = [], - K2 = [], - U = [], - C = [], - K, - L2, - AC, - i; - - if (this.KEY_PAIR_GENERATE(RNG, U, V) !== 0) { - return C; - } - - if (this.ECPSVDP_DH(U, W, Z, 0) !== 0) { - return C; - } - - for (i = 0; i < 2 * this.EFS + 1; i++) { - VZ[i] = V[i]; - } - - for (i = 0; i < this.EFS; i++) { - VZ[2 * this.EFS + 1 + i] = Z[i]; - } - - K = ctx.HMAC.KDF2(ctx.HMAC.MC_SHA2, sha, VZ, P1, 2 * ctx.ECP.AESKEY); - - for (i = 0; i < ctx.ECP.AESKEY; i++) { - K1[i] = K[i]; - K2[i] = K[ctx.ECP.AESKEY + i]; - } - - C = ctx.AES.CBC_IV0_ENCRYPT(K1, M); - - L2 = ctx.HMAC.inttobytes(P2.length, 8); - - AC = []; - for (i = 0; i < C.length; i++) { - AC[i] = C[i]; - } - for (i = 0; i < P2.length; i++) { - AC[C.length + i] = P2[i]; - } - for (i = 0; i < 8; i++) { - AC[C.length + P2.length + i] = L2[i]; - } - - ctx.HMAC.HMAC1(ctx.HMAC.MC_SHA2, sha, T, T.length, K2, AC); - - return C; - }, - - ncomp: function (T1, T2, n) { - var res = 0; - for (var i = 0; i < n; i++) { - res |= T1[i] ^ T2[i]; - } - if (res == 0) return true; - return false; - }, - - ECIES_DECRYPT: function (sha, P1, P2, V, C, T, U) { - var Z = [], - VZ = [], - K1 = [], - K2 = [], - TAG = new Array(T.length), - M = [], - K, - L2, - AC, - i; - - if (this.ECPSVDP_DH(U, V, Z, 0) !== 0) { - return M; - } - - for (i = 0; i < 2 * this.EFS + 1; i++) { - VZ[i] = V[i]; - } - - for (i = 0; i < this.EFS; i++) { - VZ[2 * this.EFS + 1 + i] = Z[i]; - } - - K = ctx.HMAC.KDF2(ctx.HMAC.MC_SHA2, sha, VZ, P1, 2 * ctx.ECP.AESKEY); - - for (i = 0; i < ctx.ECP.AESKEY; i++) { - K1[i] = K[i]; - K2[i] = K[ctx.ECP.AESKEY + i]; - } - - M = ctx.AES.CBC_IV0_DECRYPT(K1, C); - - if (M.length === 0) { - return M; - } - - L2 = ctx.HMAC.inttobytes(P2.length, 8); - - AC = []; - - for (i = 0; i < C.length; i++) { - AC[i] = C[i]; - } - for (i = 0; i < P2.length; i++) { - AC[C.length + i] = P2[i]; - } - for (i = 0; i < 8; i++) { - AC[C.length + P2.length + i] = L2[i]; - } - - ctx.HMAC.HMAC1(ctx.HMAC.MC_SHA2, sha, TAG, TAG.length, K2, AC); - - if (!this.ncomp(T, TAG, T.length)) { - return []; - } - - return M; - }, - }; - - return ECDH; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - ECDH: ECDH, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp.js deleted file mode 100644 index 28dbb0aae..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp.js +++ /dev/null @@ -1,1966 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Elliptic Curve Point class */ - -var ECP = function (ctx) { - 'use strict'; - - /* Constructor */ - var ECP = function () { - this.x = new ctx.FP(0); - this.y = new ctx.FP(1); - if (ECP.CURVETYPE != ECP.EDWARDS) { - this.z = new ctx.FP(0); - } else { - this.z = new ctx.FP(1); - } - }; - - ECP.WEIERSTRASS = 0; - ECP.EDWARDS = 1; - ECP.MONTGOMERY = 2; - ECP.NOT = 0; - ECP.BN = 1; - ECP.BLS12 = 2; - ECP.BLS24 = 3; - ECP.BLS48 = 4; - ECP.D_TYPE = 0; - ECP.M_TYPE = 1; - ECP.POSITIVEX = 0; - ECP.NEGATIVEX = 1; - - ECP.CURVETYPE = ctx.config['@CT']; - ECP.CURVE_A = ctx.config['@CA']; - ECP.CURVE_PAIRING_TYPE = ctx.config['@PF']; - ECP.SEXTIC_TWIST = ctx.config['@ST']; - ECP.SIGN_OF_X = ctx.config['@SX']; - ECP.ATE_BITS = ctx.config['@AB']; - ECP.HTC_ISO = ctx.config['@HC']; - ECP.HTC_ISO_G2 = ctx.config['@HC2']; - - ECP.HASH_TYPE = ctx.config['@HT']; - ECP.AESKEY = ctx.config['@AK']; - ECP.ALLOW_ALT_COMPRESS = true; - - ECP.prototype = { - /* test this=O point-at-infinity */ - is_infinity: function () { - if (ECP.CURVETYPE == ECP.EDWARDS) { - return this.x.iszilch() && this.y.equals(this.z); - } else if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - return this.x.iszilch() && this.z.iszilch(); - } else if (ECP.CURVETYPE == ECP.MONTGOMERY) { - return this.z.iszilch(); - } - - return true; - }, - - /* conditional swap of this and Q dependant on d */ - cswap: function (Q, d) { - this.x.cswap(Q.x, d); - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.cswap(Q.y, d); - } - this.z.cswap(Q.z, d); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.cmove(Q.y, d); - } - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP(), - m = b >> 31, - babs = (b ^ m) - m; - - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP.teq(babs, 1)); - this.cmove(W[2], ECP.teq(babs, 2)); - this.cmove(W[3], ECP.teq(babs, 3)); - this.cmove(W[4], ECP.teq(babs, 4)); - this.cmove(W[5], ECP.teq(babs, 5)); - this.cmove(W[6], ECP.teq(babs, 6)); - this.cmove(W[7], ECP.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - - equals: function (Q) { - var a, b; - - a = new ctx.FP(0); - b = new ctx.FP(0); - a.copy(this.x); - a.mul(Q.z); - a.reduce(); - b.copy(Q.x); - b.mul(this.z); - b.reduce(); - - if (!a.equals(b)) { - return false; - } - - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - a.copy(this.y); - a.mul(Q.z); - a.reduce(); - b.copy(Q.y); - b.mul(this.z); - b.reduce(); - if (!a.equals(b)) { - return false; - } - } - - return true; - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.copy(P.y); - } - this.z.copy(P.z); - }, - - /* this=-this */ - neg: function () { - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - this.y.neg(); - this.y.norm(); - } else if (ECP.CURVETYPE == ECP.EDWARDS) { - this.x.neg(); - this.x.norm(); - } - - return; - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.one(); - } - - if (ECP.CURVETYPE != ECP.EDWARDS) { - this.z.zero(); - } else { - this.z.one(); - } - }, - - /* set this=(x,y) where x and y are BIGs */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x = new ctx.FP(0); - this.x.bcopy(ix); - - this.y = new ctx.FP(0); - this.y.bcopy(iy); - this.z = new ctx.FP(1); - this.x.norm(); - rhs = ECP.RHS(this.x); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - if (rhs.qr(null) != 1) { - this.inf(); - } - } else { - y2 = new ctx.FP(0); - y2.copy(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - } - }, - - /* set this=x, where x is ctx.BIG, y is derived from sign s */ - setxi: function (ix, s) { - var rhs, ny; - - this.x = new ctx.FP(0); - this.x.bcopy(ix); - this.x.norm(); - rhs = ECP.RHS(this.x); - this.z = new ctx.FP(1); - var hint = new ctx.FP(0); - if (rhs.qr(hint) == 1) { - ny = rhs.sqrt(hint); - if (ny.sign() != s) { - ny.neg(); - ny.norm(); - } - this.y = ny; - } else { - this.inf(); - } - }, - - /* set this=x, y calculated from curve equation */ - setx: function (ix) { - var rhs; - - this.x = new ctx.FP(0); - this.x.bcopy(ix); - this.x.norm(); - rhs = ECP.RHS(this.x); - this.z = new ctx.FP(1); - var hint = new ctx.FP(0); - - if (rhs.qr(hint) == 1) { - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y = rhs.sqrt(hint); - } - } else { - this.inf(); - } - }, - - /* set this to affine - from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP(1); - - if (this.z.equals(one)) { - return; - } - - this.z.inverse(null); - - if (ECP.CURVETYPE == ECP.EDWARDS || ECP.CURVETYPE == ECP.WEIERSTRASS) { - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z = one; - } - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - this.x.mul(this.z); - this.x.reduce(); - this.z = one; - } - }, - - /* extract x as ctx.BIG */ - getX: function () { - var W = new ECP(); - W.copy(this); - W.affine(); - return W.x.redc(); - }, - - /* extract y as ctx.BIG */ - getY: function () { - var W = new ECP(); - W.copy(this); - W.affine(); - return W.y.redc(); - }, - - /* get sign of Y */ - getS: function () { - var W = new ECP(); - W.copy(this); - W.affine(); - return W.y.sign(); - }, - - /* extract x as ctx.FP */ - getx: function () { - return this.x; - }, - - /* extract y as ctx.FP */ - gety: function () { - return this.y; - }, - - /* extract z as ctx.FP */ - getz: function () { - return this.z; - }, - - /* convert to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP(); - W.copy(this); - W.affine(); - W.x.redc().toBytes(t); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - b[i] = t[i]; - } - return; - } - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (compress) { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } else { - W.y.redc().toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i + ctx.BIG.MODBYTES] = t[i]; - } - } else { - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (compress) { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - return; - } - b[0] = 0x04; - W.y.redc().toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i + ctx.BIG.MODBYTES + 1] = t[i]; - } - }, - /* convert to hex string */ - toString: function () { - var W = new ECP(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - - W.affine(); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - return '(' + W.x.redc().toString() + ')'; - } else { - return '(' + W.x.redc().toString() + ',' + W.y.redc().toString() + ')'; - } - }, - - /* this+=this */ - dbl: function () { - var t0, t1, t2, t3, x3, y3, z3, b, C, D, H, J, A, B, AA, BB; - - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - if (ECP.CURVE_A == 0) { - t0 = new ctx.FP(0); - t0.copy(this.y); - t0.sqr(); - t1 = new ctx.FP(0); - t1.copy(this.y); - t1.mul(this.z); - t2 = new ctx.FP(0); - t2.copy(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - - x3 = new ctx.FP(0); - x3.copy(t2); - x3.mul(this.z); - y3 = new ctx.FP(0); - y3.copy(t0); - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t0.sub(t2); - t0.norm(); - y3.mul(t0); - y3.add(x3); - t1.copy(this.x); - t1.mul(this.y); - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - } else { - t0 = new ctx.FP(0); - t0.copy(this.x); - t1 = new ctx.FP(0); - t1.copy(this.y); - t2 = new ctx.FP(0); - t2.copy(this.z); - t3 = new ctx.FP(0); - t3.copy(this.x); - z3 = new ctx.FP(0); - z3.copy(this.z); - y3 = new ctx.FP(0); - x3 = new ctx.FP(0); - b = new ctx.FP(0); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - b.rcopy(ctx.ROM_CURVE.CURVE_B); - } - - t0.sqr(); //1 x^2 - t1.sqr(); //2 y^2 - t2.sqr(); //3 - - t3.mul(this.y); //4 - t3.add(t3); - t3.norm(); //5 - z3.mul(this.x); //6 - z3.add(z3); - z3.norm(); //7 - y3.copy(t2); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - y3.mul(b); //8 - } else { - y3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - y3.sub(z3); //9 *** - x3.copy(y3); - x3.add(y3); - x3.norm(); //10 - - y3.add(x3); //11 - x3.copy(t1); - x3.sub(y3); - x3.norm(); //12 - y3.add(t1); - y3.norm(); //13 - y3.mul(x3); //14 - x3.mul(t3); //15 - t3.copy(t2); - t3.add(t2); //16 - t2.add(t3); //17 - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - z3.mul(b); //18 - } else { - z3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - z3.sub(t2); //19 - z3.sub(t0); - z3.norm(); //20 *** - t3.copy(z3); - t3.add(z3); //21 - - z3.add(t3); - z3.norm(); //22 - t3.copy(t0); - t3.add(t0); //23 - t0.add(t3); //24 - t0.sub(t2); - t0.norm(); //25 - - t0.mul(z3); //26 - y3.add(t0); //27 - t0.copy(this.y); - t0.mul(this.z); //28 - t0.add(t0); - t0.norm(); //29 - z3.mul(t0); //30 - x3.sub(z3); //31 - t0.add(t0); - t0.norm(); //32 - t1.add(t1); - t1.norm(); //33 - z3.copy(t0); - z3.mul(t1); //34 - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - } - } - - if (ECP.CURVETYPE == ECP.EDWARDS) { - C = new ctx.FP(0); - C.copy(this.x); - D = new ctx.FP(0); - D.copy(this.y); - H = new ctx.FP(0); - H.copy(this.z); - J = new ctx.FP(0); - - this.x.mul(this.y); - this.x.add(this.x); - this.x.norm(); - C.sqr(); - D.sqr(); - if (ECP.CURVE_A == -1) { - C.neg(); - } - - this.y.copy(C); - this.y.add(D); - this.y.norm(); - H.sqr(); - H.add(H); - - this.z.copy(this.y); - J.copy(this.y); - - J.sub(H); - J.norm(); - - this.x.mul(J); - C.sub(D); - C.norm(); - this.y.mul(C); - this.z.mul(J); - } - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - A = new ctx.FP(0); - A.copy(this.x); - B = new ctx.FP(0); - B.copy(this.x); - AA = new ctx.FP(0); - BB = new ctx.FP(0); - C = new ctx.FP(0); - - A.add(this.z); - A.norm(); - AA.copy(A); - AA.sqr(); - B.sub(this.z); - B.norm(); - BB.copy(B); - BB.sqr(); - C.copy(AA); - C.sub(BB); - C.norm(); - this.x.copy(AA); - this.x.mul(BB); - - A.copy(C); - A.imul((ECP.CURVE_A + 2) >> 2); - - BB.add(A); - BB.norm(); - this.z.copy(BB); - this.z.mul(C); - } - - return; - }, - - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3, A, B, C, D, E, F, G; - - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - if (ECP.CURVE_A == 0) { - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP(0); - t0.copy(this.x); - t0.mul(Q.x); - t1 = new ctx.FP(0); - t1.copy(this.y); - t1.mul(Q.y); - t2 = new ctx.FP(0); - t2.copy(this.z); - t2.mul(Q.z); - t3 = new ctx.FP(0); - t3.copy(this.x); - t3.add(this.y); - t3.norm(); - t4 = new ctx.FP(0); - t4.copy(Q.x); - t4.add(Q.y); - t4.norm(); - t3.mul(t4); - t4.copy(t0); - t4.add(t1); - - t3.sub(t4); - t3.norm(); - t4.copy(this.y); - t4.add(this.z); - t4.norm(); - x3 = new ctx.FP(0); - x3.copy(Q.y); - x3.add(Q.z); - x3.norm(); - - t4.mul(x3); - x3.copy(t1); - x3.add(t2); - - t4.sub(x3); - t4.norm(); - x3.copy(this.x); - x3.add(this.z); - x3.norm(); - y3 = new ctx.FP(0); - y3.copy(Q.x); - y3.add(Q.z); - y3.norm(); - x3.mul(y3); - y3.copy(t0); - y3.add(t2); - y3.rsub(x3); - y3.norm(); - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - - z3 = new ctx.FP(0); - z3.copy(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - } else { - t0 = new ctx.FP(0); - t0.copy(this.x); - t1 = new ctx.FP(0); - t1.copy(this.y); - t2 = new ctx.FP(0); - t2.copy(this.z); - t3 = new ctx.FP(0); - t3.copy(this.x); - t4 = new ctx.FP(0); - t4.copy(Q.x); - z3 = new ctx.FP(0); - y3 = new ctx.FP(0); - y3.copy(Q.x); - x3 = new ctx.FP(0); - x3.copy(Q.y); - b = new ctx.FP(0); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - b.rcopy(ctx.ROM_CURVE.CURVE_B); - } - t0.mul(Q.x); //1 - t1.mul(Q.y); //2 - t2.mul(Q.z); //3 - - t3.add(this.y); - t3.norm(); //4 - t4.add(Q.y); - t4.norm(); //5 - t3.mul(t4); //6 - t4.copy(t0); - t4.add(t1); //7 - t3.sub(t4); - t3.norm(); //8 - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //9 - x3.add(Q.z); - x3.norm(); //10 - t4.mul(x3); //11 - x3.copy(t1); - x3.add(t2); //12 - - t4.sub(x3); - t4.norm(); //13 - x3.copy(this.x); - x3.add(this.z); - x3.norm(); //14 - y3.add(Q.z); - y3.norm(); //15 - - x3.mul(y3); //16 - y3.copy(t0); - y3.add(t2); //17 - - y3.rsub(x3); - y3.norm(); //18 - z3.copy(t2); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - z3.mul(b); //18 - } else { - z3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - x3.copy(y3); - x3.sub(z3); - x3.norm(); //20 - z3.copy(x3); - z3.add(x3); //21 - - x3.add(z3); //22 - z3.copy(t1); - z3.sub(x3); - z3.norm(); //23 - x3.add(t1); - x3.norm(); //24 - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - y3.mul(b); //18 - } else { - y3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - t1.copy(t2); - t1.add(t2); //26 - t2.add(t1); //27 - - y3.sub(t2); //28 - - y3.sub(t0); - y3.norm(); //29 - t1.copy(y3); - t1.add(y3); //30 - y3.add(t1); - y3.norm(); //31 - - t1.copy(t0); - t1.add(t0); //32 - t0.add(t1); //33 - t0.sub(t2); - t0.norm(); //34 - t1.copy(t4); - t1.mul(y3); //35 - t2.copy(t0); - t2.mul(y3); //36 - y3.copy(x3); - y3.mul(z3); //37 - y3.add(t2); //38 - x3.mul(t3); //39 - x3.sub(t1); //40 - z3.mul(t4); //41 - t1.copy(t3); - t1.mul(t0); //42 - z3.add(t1); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - } - } - - if (ECP.CURVETYPE == ECP.EDWARDS) { - A = new ctx.FP(0); - A.copy(this.z); - B = new ctx.FP(0); - C = new ctx.FP(0); - C.copy(this.x); - D = new ctx.FP(0); - D.copy(this.y); - E = new ctx.FP(0); - F = new ctx.FP(0); - G = new ctx.FP(0); - - A.mul(Q.z); //A=2 - B.copy(A); - B.sqr(); //B=2 - C.mul(Q.x); //C=2 - D.mul(Q.y); //D=2 - - E.copy(C); - E.mul(D); //E=2 - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - b = new ctx.FP(0); - b.rcopy(ctx.ROM_CURVE.CURVE_B); - E.mul(b); - } else { - E.imul(ctx.ROM_CURVE.CURVE_B_I); //E=22222 - } - - F.copy(B); - F.sub(E); //F=22224 - G.copy(B); - G.add(E); //G=22224 - - if (ECP.CURVE_A == 1) { - E.copy(D); - E.sub(C); //E=4 - } - C.add(D); //C=4 - - B.copy(this.x); - B.add(this.y); //B=4 - D.copy(Q.x); - D.add(Q.y); - B.norm(); - D.norm(); //D=4 - B.mul(D); //B=2 - B.sub(C); - B.norm(); - F.norm(); // B=6 - B.mul(F); //B=2 - this.x.copy(A); - this.x.mul(B); - G.norm(); // x=2 - - if (ECP.CURVE_A == 1) { - E.norm(); - C.copy(E); - C.mul(G); //C=2 - } - - if (ECP.CURVE_A == -1) { - C.norm(); - C.mul(G); - } - - this.y.copy(A); - this.y.mul(C); //y=2 - this.z.copy(F); - this.z.mul(G); - } - - return; - }, - - /* Differential Add for Montgomery curves. this+=Q where W is this-Q and is affine. */ - dadd: function (Q, W) { - var A, B, C, D, DA, CB; - - A = new ctx.FP(0); - A.copy(this.x); - B = new ctx.FP(0); - B.copy(this.x); - C = new ctx.FP(0); - C.copy(Q.x); - D = new ctx.FP(0); - D.copy(Q.x); - DA = new ctx.FP(0); - CB = new ctx.FP(0); - - A.add(this.z); - B.sub(this.z); - - C.add(Q.z); - D.sub(Q.z); - - D.norm(); - A.norm(); - DA.copy(D); - DA.mul(A); - C.norm(); - B.norm(); - CB.copy(C); - CB.mul(B); - - A.copy(DA); - A.add(CB); - A.norm(); - A.sqr(); - B.copy(DA); - B.sub(CB); - B.norm(); - B.sqr(); - - this.x.copy(A); - this.z.copy(W.x); - this.z.mul(B); - - // this.x.norm(); - }, - - /* this-=Q */ - sub: function (Q) { - var NQ = new ECP(); - NQ.copy(Q); - NQ.neg(); - this.add(NQ); - }, - - /* constant time multiply by small integer of length bts - use ladder */ - pinmul: function (e, bts) { - var i, b, P, R0, R1; - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - return this.mul(new ctx.BIG(e)); - } else { - P = new ECP(); - R0 = new ECP(); - R1 = new ECP(); - R1.copy(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - P.copy(R1); - P.add(R0); - R0.cswap(R1, b); - R1.copy(P); - R0.dbl(); - R0.cswap(R1, b); - } - - P.copy(R0); - - return P; - } - }, - - // multiply this by the curves cofactor - cfp: function () { - var cf = ctx.ROM_CURVE.CURVE_Cof_I, - c = new ctx.BIG(0); - - if (cf == 1) { - return; - } - if (cf == 4) { - this.dbl(); - this.dbl(); - return; - } - if (cf == 8) { - this.dbl(); - this.dbl(); - this.dbl(); - return; - } - c.rcopy(ctx.ROM_CURVE.CURVE_Cof); - this.copy(this.mul(c)); - }, - - /* return e.this - SPA immune, using Ladder */ - mul: function (e) { - var P, D, R0, R1, mt, t, Q, C, W, w, i, b, nb, s, ns; - - if (e.iszilch() || this.is_infinity()) { - return new ECP(); - } - - P = new ECP(); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - /* use ladder */ - D = new ECP(); - R0 = new ECP(); - R0.copy(this); - R1 = new ECP(); - R1.copy(this); - R1.dbl(); - D.copy(this); - D.affine(); - nb = e.nbits(); - for (i = nb - 2; i >= 0; i--) { - b = e.bit(i); - P.copy(R1); - P.dadd(R0, D); - - R0.cswap(R1, b); - R1.copy(P); - R0.dbl(); - R0.cswap(R1, b); - } - P.copy(R0); - } else { - // fixed size windows - mt = new ctx.BIG(); - t = new ctx.BIG(); - Q = new ECP(); - C = new ECP(); - W = []; - w = []; - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - } - - return P; - }, - - /* Return e.this+f.Q */ - - mul2: function (e, Q, f) { - var te = new ctx.BIG(), - tf = new ctx.BIG(), - mt = new ctx.BIG(), - S = new ECP(), - T = new ECP(), - C = new ECP(), - W = [], - w = [], - i, - s, - ns, - nb, - a, - b; - - te.copy(e); - tf.copy(f); - - // precompute table - W[1] = new ECP(); - W[1].copy(this); - W[1].sub(Q); - W[2] = new ECP(); - W[2].copy(this); - W[2].add(Q); - S.copy(Q); - S.dbl(); - W[0] = new ECP(); - W[0].copy(W[1]); - W[0].sub(S); - W[3] = new ECP(); - W[3].copy(W[2]); - W[3].add(S); - T.copy(this); - T.dbl(); - W[5] = new ECP(); - W[5].copy(W[1]); - W[5].add(T); - W[6] = new ECP(); - W[6].copy(W[2]); - W[6].add(T); - W[4] = new ECP(); - W[4].copy(W[5]); - W[4].sub(S); - W[7] = new ECP(); - W[7].copy(W[6]); - W[7].add(S); - - // if multiplier is odd, add 2, else add 1 to multiplier, and add 2P or P to correction - - s = te.parity(); - te.inc(1); - te.norm(); - ns = te.parity(); - mt.copy(te); - mt.inc(1); - mt.norm(); - te.cmove(mt, s); - T.cmove(this, ns); - C.copy(T); - - s = tf.parity(); - tf.inc(1); - tf.norm(); - ns = tf.parity(); - mt.copy(tf); - mt.inc(1); - mt.norm(); - tf.cmove(mt, s); - S.cmove(Q, ns); - C.add(S); - - mt.copy(te); - mt.add(tf); - mt.norm(); - nb = 1 + Math.floor((mt.nbits() + 1) / 2); - - // convert exponent to signed 2-bit window - for (i = 0; i < nb; i++) { - a = te.lastbits(3) - 4; - te.dec(a); - te.norm(); - te.fshr(2); - b = tf.lastbits(3) - 4; - tf.dec(b); - tf.norm(); - tf.fshr(2); - w[i] = 4 * a + b; - } - w[nb] = 4 * te.lastbits(3) + tf.lastbits(3); - S.copy(W[Math.floor((w[nb] - 1) / 2)]); - - for (i = nb - 1; i >= 0; i--) { - T.select(W, w[i]); - S.dbl(); - S.dbl(); - S.add(T); - } - S.sub(C); /* apply correction */ - - return S; - }, - }; - - // set to group generator - ECP.generator = function () { - var G = new ECP(), - gx = new ctx.BIG(0), - gy = new ctx.BIG(0); - - gx.rcopy(ctx.ROM_CURVE.CURVE_Gx); - - if (ctx.ECP.CURVETYPE != ctx.ECP.MONTGOMERY) { - gy.rcopy(ctx.ROM_CURVE.CURVE_Gy); - G.setxy(gx, gy); - } else { - G.setx(gx); - } - return G; - }; - - /* return 1 if b==c, no branching */ - ECP.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* convert from byte array to ECP */ - ECP.fromBytes = function (b) { - var t = [], - P = new ECP(), - p = new ctx.BIG(0), - px, - py, - i; - var alt = false; - - p.rcopy(ctx.ROM_FIELD.Modulus); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - t[i] = b[i]; - } - px = ctx.BIG.fromBytes(t); - if (ctx.BIG.comp(px, p) >= 0) { - return P; - } - P.setx(px); - return P; - } - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - px = ctx.BIG.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = b[i + ctx.BIG.MODBYTES]; - py = ctx.BIG.fromBytes(t); - P.setxy(px, py); - return P; - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setxi(px, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - return P; - } - } else { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - t[i] = b[i + 1]; - } - px = ctx.BIG.fromBytes(t); - if (ctx.BIG.comp(px, p) >= 0) { - return P; - } - - if (b[0] == 0x04) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - t[i] = b[i + ctx.BIG.MODBYTES + 1]; - } - - py = ctx.BIG.fromBytes(t); - - if (ctx.BIG.comp(py, p) >= 0) { - return P; - } - - P.setxy(px, py); - - return P; - } - - if (b[0] == 0x02 || b[0] == 0x03) { - P.setxi(px, b[0] & 1); - return P; - } - } - - return P; - }; - - /* Calculate RHS of curve equation */ - ECP.RHS = function (x) { - var r = new ctx.FP(0), - b, - cx, - one, - x3; - - //x.norm(); - r.copy(x); - r.sqr(); - - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - // x^3+Ax+B - b = new ctx.FP(0); - b.rcopy(ctx.ROM_CURVE.CURVE_B); - r.mul(x); - if (ECP.CURVE_A == -3) { - cx = new ctx.FP(0); - cx.copy(x); - cx.imul(3); - cx.neg(); - cx.norm(); - r.add(cx); - } - r.add(b); - } else if (ECP.CURVETYPE == ECP.EDWARDS) { - // (Ax^2-1)/(Bx^2-1) - b = new ctx.FP(0); - b.rcopy(ctx.ROM_CURVE.CURVE_B); - - one = new ctx.FP(1); - b.mul(r); - b.sub(one); - b.norm(); - if (ECP.CURVE_A == -1) { - r.neg(); - } - r.sub(one); - r.norm(); - b.inverse(null); - - r.mul(b); - } else if (ECP.CURVETYPE == ECP.MONTGOMERY) { - // x^3+Ax^2+x - x3 = new ctx.FP(0); - x3.copy(r); - x3.mul(x); - r.imul(ECP.CURVE_A); - r.add(x3); - r.add(x); - } - - r.reduce(); - - return r; - }; - - // Generic multi-multiplication, fixed 4-bit window, P=Sigma e_i*X_i - ECP.muln = function (n, X, e) { - var B = []; - var P = new ECP(); - var R = new ECP(); - var S = new ECP(); - var t = new ctx.BIG(); - var mr = new ctx.BIG(); - - for (var i = 0; i < 16; i++) { - B[i] = new ECP(); - } - var mt = new ctx.BIG(); - mt.copy(e[0]); - mt.norm(); - for (var i = 1; i < n; i++) { - // find biggest - t.copy(e[i]); - t.norm(); - var k = ctx.BIG.comp(t, mt); - mt.cmove(t, (k + 1) >> 1); - } - var nb = (mt.nbits() + 3) >> 2; - for (var i = nb - 1; i >= 0; i--) { - for (var j = 0; j < 16; j++) { - B[j].inf(); - } - for (var j = 0; j < n; j++) { - mt.copy(e[j]); - mt.norm(); - mt.shr(4 * i); - var k = mt.lastbits(4); - B[k].add(X[j]); - } - R.inf(); - S.inf(); - for (var j = 15; j >= 1; j--) { - R.add(B[j]); - S.add(R); - } - for (var j = 0; j < 4; j++) { - P.dbl(); - } - P.add(S); - } - return P; - }; - - /* Hunt and Peck a BIG to a curve point - ECP.hap2point = function(h) { - var P = new ECP(); - var x=new ctx.BIG(h); - for (;;) { - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - P.setxi(x, 0); - } else { - P.setx(x); - } - x.inc(1); - x.norm(); - if (!P.is_infinity()) break; - } - return P; - }; */ - - /* Constant time Map to Point */ - ECP.map2point = function (h) { - var P = new ECP(); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - var X1 = new ctx.FP(0); - var X2 = new ctx.FP(0); - var t = new ctx.FP(h); - var w = new ctx.FP(0); - var one = new ctx.FP(1); - var N = new ctx.FP(0); - var D = new ctx.FP(0); - var hint = new ctx.FP(0); - var A = new ctx.FP(ECP.CURVE_A); - t.sqr(); - - if (ctx.FP.PM1D2 == 2) { - t.add(t); - } - if (ctx.FP.PM1D2 == 1) { - t.neg(); - } - if (ctx.FP.PM1D2 > 2) { - t.imul(ctx.FP.PM1D2); - } - t.norm(); - D.copy(t); - D.add(one); - D.norm(); - - X1.copy(A); - X1.neg(); - X1.norm(); - X2.copy(X1); - X2.mul(t); - - w.copy(X1); - w.sqr(); - N.copy(w); - N.mul(X1); - w.mul(A); - w.mul(D); - N.add(w); - t.copy(D); - t.sqr(); - t.mul(X1); - N.add(t); - N.norm(); - - t.copy(N); - t.mul(D); - var qres = t.qr(hint); - w.copy(t); - w.inverse(hint); - D.copy(w); - D.mul(N); - X1.mul(D); - X2.mul(D); - X1.cmove(X2, 1 - qres); - - var a = X1.redc(); - P.setx(a); - } - if (ECP.CURVETYPE == ECP.EDWARDS) { - // Elligator 2 - map to Montgomery, place point, map back - var X1 = new ctx.FP(0); - var X2 = new ctx.FP(0); - var t = new ctx.FP(h); - var w = new ctx.FP(0); - var one = new ctx.FP(1); - var A = new ctx.FP(0); - var w1 = new ctx.FP(0); - var w2 = new ctx.FP(0); - var B = new ctx.FP(0); - B.rcopy(ctx.ROM_CURVE.CURVE_B); - var Y = new ctx.FP(0); - var K = new ctx.FP(0); - var D = new ctx.FP(0); - var hint = new ctx.FP(0); - //var Y3 = new ctx.FP(0); - - var qres, - qnr, - rfc = 0; - - if (ctx.FP.MODTYPE != ctx.FP.GENERALISED_MERSENNE) { - A.copy(B); - if (ECP.CURVE_A == 1) { - A.add(one); - B.sub(one); - } else { - A.sub(one); - B.add(one); - } - A.norm(); - B.norm(); - - A.div2(); - B.div2(); - B.div2(); - - K.copy(B); - K.neg(); - K.norm(); - //K.inverse(null); - K.invsqrt(K, w1); - - rfc = ctx.FP.RIADZ; - if (rfc == 1) { - // RFC7748 - A.mul(K); - K.mul(w1); - //K=K.sqrt(null); - } else { - B.sqr(); - } - } else { - A.copy(new ctx.FP(156326)); - rfc = 1; - } - - t.sqr(); - if (ctx.FP.PM1D2 == 2) { - t.add(t); - qnr = 2; - } - if (ctx.FP.PM1D2 == 1) { - t.neg(); - qnr = -1; - } - if (ctx.FP.PM1D2 > 2) { - t.imul(ctx.FP.PM1D2); - qnr = ctx.FP.PM1D2; - } - t.norm(); - D.copy(t); - D.add(one); - D.norm(); - X1.copy(A); - X1.neg(); - X1.norm(); - X2.copy(X1); - X2.mul(t); - - // Figure out RHS of Montgomery curve in rational form gx1/d^3 - - w.copy(X1); - w.sqr(); - w1.copy(w); - w1.mul(X1); - w.mul(A); - w.mul(D); - w1.add(w); - w2.copy(D); - w2.sqr(); - - if (rfc == 0) { - w.copy(X1); - w.mul(B); - w2.mul(w); - w1.add(w2); - } else { - w2.mul(X1); - w1.add(w2); - } - w1.norm(); - - B.copy(w1); - B.mul(D); - qres = B.qr(hint); - w.copy(B); - w.inverse(hint); - D.copy(w); - D.mul(w1); - X1.mul(D); - X2.mul(D); - D.sqr(); - - w1.copy(B); - w1.imul(qnr); - w.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - w.mul(hint); - w2.copy(D); - w2.mul(h); - - X1.cmove(X2, 1 - qres); - B.cmove(w1, 1 - qres); - hint.cmove(w, 1 - qres); - D.cmove(w2, 1 - qres); - - Y.copy(B.sqrt(hint)); - Y.mul(D); - - /* - Y.copy(B.sqrt(hint)); - Y.mul(D); - - B.imul(qnr); - w.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - hint.mul(w); - - Y3.copy(B.sqrt(hint)); - D.mul(h); - Y3.mul(D); - - X1.cmove(X2,1-qres); - Y.cmove(Y3,1-qres); -*/ - w.copy(Y); - w.neg(); - w.norm(); - Y.cmove(w, qres ^ Y.sign()); - - if (rfc == 0) { - X1.mul(K); - Y.mul(K); - } - - if (ctx.FP.MODTYPE == ctx.FP.GENERALISED_MERSENNE) { - // GOLDILOCKS isogeny - t.copy(X1); - t.sqr(); - w.copy(t); - w.add(one); - w.norm(); - t.sub(one); - t.norm(); - w1.copy(t); - w1.mul(Y); - w1.add(w1); - X2.copy(w1); - X2.add(w1); - X2.norm(); - t.sqr(); - Y.sqr(); - Y.add(Y); - Y.add(Y); - Y.norm(); - B.copy(t); - B.add(Y); - B.norm(); - - w2.copy(Y); - w2.sub(t); - w2.norm(); - w2.mul(X1); - t.mul(X1); - Y.div2(); - w1.copy(Y); - w1.mul(w); - w1.rsub(t); - w1.norm(); - - t.copy(X2); - t.mul(w1); - P = new ECP(); - P.x.copy(t); - t.copy(w2); - t.mul(B); - P.y.copy(t); - t.copy(w1); - t.mul(B); - P.z.copy(t); - - return P; - } else { - w1.copy(X1); - w1.add(one); - w1.norm(); - w2.copy(X1); - w2.sub(one); - w2.norm(); - t.copy(w1); - t.mul(Y); - X1.mul(w1); - - if (rfc == 1) X1.mul(K); - - Y.mul(w2); - P = new ECP(); - P.x.copy(X1); - P.y.copy(Y); - P.z.copy(t); - - return P; - } - } - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - // swu method - var A = new ctx.FP(0); - var B = new ctx.FP(0); - var X1 = new ctx.FP(0); - var X2 = new ctx.FP(0); - var X3 = new ctx.FP(0); - var one = new ctx.FP(1); - var Y = new ctx.FP(0); - var D = new ctx.FP(0); - var t = new ctx.FP(h); - var w = new ctx.FP(0); - var D2 = new ctx.FP(0); - var hint = new ctx.FP(0); - var GX1 = new ctx.FP(0); - //var Y3=new ctx.FP(0); - var sgn = t.sign(); - - if (ECP.CURVE_A != 0 || ECP.HTC_ISO != 0) { - if (ECP.HTC_ISO != 0) { - A.rcopy(ctx.ROM_CURVE.CURVE_Ad); - B.rcopy(ctx.ROM_CURVE.CURVE_Bd); - } else { - A.copy(new ctx.FP(ECP.CURVE_A)); - B.rcopy(ctx.ROM_CURVE.CURVE_B); - } - // SSWU Method - t.sqr(); - t.imul(ctx.FP.RIADZ); - w.copy(t); - w.add(one); - w.norm(); - - w.mul(t); - D.copy(A); - D.mul(w); - - w.add(one); - w.norm(); - w.mul(B); - w.neg(); - w.norm(); - - X2.copy(w); - X3.copy(t); - X3.mul(X2); - - // x^3+Ad^2x+Bd^3 - GX1.copy(X2); - GX1.sqr(); - D2.copy(D); - D2.sqr(); - w.copy(A); - w.mul(D2); - GX1.add(w); - GX1.norm(); - GX1.mul(X2); - D2.mul(D); - w.copy(B); - w.mul(D2); - GX1.add(w); - GX1.norm(); - - w.copy(GX1); - w.mul(D); - var qr = w.qr(hint); - D.copy(w); - D.inverse(hint); - D.mul(GX1); - X2.mul(D); - X3.mul(D); - t.mul(h); - D2.copy(D); - D2.sqr(); - - D.copy(D2); - D.mul(t); - t.copy(w); - t.imul(ctx.FP.RIADZ); - X1.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - X1.mul(hint); - - X2.cmove(X3, 1 - qr); - D2.cmove(D, 1 - qr); - w.cmove(t, 1 - qr); - hint.cmove(X1, 1 - qr); - - Y.copy(w.sqrt(hint)); - Y.mul(D2); - - /* - Y.copy(w.sqrt(hint)); - Y.mul(D2); - - D2.mul(t); - w.imul(ctx.FP.RIADZ); - - X1.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - hint.mul(X1); - - Y3.copy(w.sqrt(hint)); - Y3.mul(D2); - - X2.cmove(X3,1-qr); - Y.cmove(Y3,1-qr); -*/ - var ne = Y.sign() ^ sgn; - w.copy(Y); - w.neg(); - w.norm(); - Y.cmove(w, ne); - - if (ECP.HTC_ISO != 0) { - var k = 0; - var isox = ECP.HTC_ISO; - var isoy = (3 * (isox - 1)) / 2; - // xnum - var xnum = new ctx.FP(0); - xnum.rcopy(ctx.ROM_CURVE.PC[k++]); - for (var i = 0; i < isox; i++) { - xnum.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - xnum.add(w); - xnum.norm(); - } - // xden - var xden = new ctx.FP(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - xden.add(w); - xden.norm(); - for (var i = 0; i < isox - 2; i++) { - xden.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - xden.add(w); - xden.norm(); - } - // ynum - var ynum = new ctx.FP(0); - ynum.rcopy(ctx.ROM_CURVE.PC[k++]); - for (var i = 0; i < isoy; i++) { - ynum.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - ynum.add(w); - ynum.norm(); - } - // yden - var yden = new ctx.FP(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - yden.add(w); - yden.norm(); - for (var i = 0; i < isoy - 1; i++) { - yden.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - yden.add(w); - yden.norm(); - } - ynum.mul(Y); - w.copy(xnum); - w.mul(yden); - P.x.copy(w); - w.copy(ynum); - w.mul(xden); - P.y.copy(w); - w.copy(xden); - w.mul(yden); - P.z.copy(w); - return P; - } else { - var x = X2.redc(); - var y = Y.redc(); - P.setxy(x, y); - return P; - } - } else { - // Shallue and van de Woestijne - var Z = ctx.FP.RIADZ; - X1.copy(new ctx.FP(Z)); - X3.copy(X1); - var A = ECP.RHS(X1); - B.rcopy(ctx.ROM_FIELD.SQRTm3); - B.imul(Z); - - t.sqr(); - Y.copy(A); - Y.mul(t); - t.copy(one); - t.add(Y); - t.norm(); - Y.rsub(one); - Y.norm(); - D.copy(t); - D.mul(Y); - D.mul(B); - - var w = new ctx.FP(A); - ctx.FP.tpo(D, w); - - w.mul(B); - if (w.sign() == 1) { - w.neg(); - w.norm(); - } - w.mul(B); - w.mul(h); - w.mul(Y); - w.mul(D); - - X1.neg(); - X1.norm(); - X1.div2(); - X2.copy(X1); - X1.sub(w); - X1.norm(); - X2.add(w); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - t.sqr(); - t.mul(D); - t.sqr(); - A.mul(t); - X3.add(A); - X3.norm(); - - var rhs = ECP.RHS(X2); - X3.cmove(X2, rhs.qr(null)); - rhs.copy(ECP.RHS(X1)); - X3.cmove(X1, rhs.qr(null)); - rhs.copy(ECP.RHS(X3)); - Y.copy(rhs.sqrt(null)); - - var ne = Y.sign() ^ sgn; - w.copy(Y); - w.neg(); - w.norm(); - Y.cmove(w, ne); - - var x = X3.redc(); - var y = Y.redc(); - P.setxy(x, y); - return P; - } - } - return P; - }; - - /* - ECP.mapit = function(h) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx = ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - var P=ctx.ECP.hap2point(x); - P.cfp(); - return P; - }; -*/ - return ECP; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP = ECP; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp2.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp2.js deleted file mode 100644 index 544ca7601..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp2.js +++ /dev/null @@ -1,1094 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Weierstrass elliptic curve functions over ctx.FP2 */ - -var ECP2 = function (ctx) { - 'use strict'; - - /* Constructor, set this=O */ - var ECP2 = function () { - this.x = new ctx.FP2(0); - this.y = new ctx.FP2(1); - this.z = new ctx.FP2(0); - }; - - ECP2.prototype = { - /* Test this=O? */ - is_infinity: function () { - return this.x.iszilch() && this.z.iszilch(); - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - this.y.copy(P.y); - this.z.copy(P.z); - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - this.y.one(); - this.z.zero(); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - this.y.cmove(Q.y, d); - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP2(), - m, - babs; - - (m = b >> 31), (babs = (b ^ m) - m); - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP2.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP2.teq(babs, 1)); - this.cmove(W[2], ECP2.teq(babs, 2)); - this.cmove(W[3], ECP2.teq(babs, 3)); - this.cmove(W[4], ECP2.teq(babs, 4)); - this.cmove(W[5], ECP2.teq(babs, 5)); - this.cmove(W[6], ECP2.teq(babs, 6)); - this.cmove(W[7], ECP2.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - equals: function (Q) { - var a, b; - - a = new ctx.FP2(0); - a.copy(this.x); - b = new ctx.FP2(0); - b.copy(Q.x); - - a.copy(this.x); - a.mul(Q.z); - a.reduce(); - b.copy(Q.x); - b.mul(this.z); - b.reduce(); - if (!a.equals(b)) { - return false; - } - - a.copy(this.y); - a.mul(Q.z); - a.reduce(); - b.copy(Q.y); - b.mul(this.z); - b.reduce(); - if (!a.equals(b)) { - return false; - } - - return true; - }, - - /* set this=-this */ - neg: function () { - this.y.norm(); - this.y.neg(); - this.y.norm(); - return; - }, - - /* convert this to affine, from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP2(1); - - if (this.z.equals(one)) { - this.x.reduce(); - this.y.reduce(); - return; - } - - this.z.inverse(null); - - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z.copy(one); - }, - - /* extract affine x as ctx.FP2 */ - getX: function () { - var W = new ECP2(); - W.copy(this); - W.affine(); - return W.x; - }, - - /* extract affine y as ctx.FP2 */ - getY: function () { - var W = new ECP2(); - W.copy(this); - W.affine(); - return W.y; - }, - - /* extract projective x */ - getx: function () { - return this.x; - }, - - /* extract projective y */ - gety: function () { - return this.y; - }, - - /* extract projective z */ - getz: function () { - return this.z; - }, - - /* convert this to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP2(); - W.copy(this); - W.affine(); - W.x.toBytes(t); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ctx.ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (!compress) { - W.y.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i + 2 * ctx.BIG.MODBYTES] = t[i]; - } else { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } - } else { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (!compress) { - b[0] = 0x04; - W.y.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i + 2 * ctx.BIG.MODBYTES + 1] = t[i]; - } else { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - } - } - }, - - /* convert this to hex string */ - toString: function () { - var W = new ECP2(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - W.affine(); - return '(' + W.x.toString() + ',' + W.y.toString() + ')'; - }, - - /* set this=(x,y) */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x.copy(ix); - this.y.copy(iy); - this.z.one(); - this.x.norm(); - - rhs = ECP2.RHS(this.x); - - y2 = new ctx.FP2(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - }, - - /* set this=(x,.) */ - setx: function (ix, s) { - var rhs, h; - - this.x.copy(ix); - this.z.one(); - this.x.norm(); - - rhs = ECP2.RHS(this.x); - //alert("Into setx= rhs= "+rhs.toString()); - if (rhs.qr(h) == 1) { - rhs.sqrt(h); - if (rhs.sign() != s) rhs.neg(); - rhs.reduce(); - this.y.copy(rhs); - } else { - this.inf(); - } - }, - - /* set this*=q, where q is Modulus, using Frobenius */ - frob: function (X) { - var X2; - - X2 = new ctx.FP2(X); //X2.copy(X); - X2.sqr(); - this.x.conj(); - this.y.conj(); - this.z.conj(); - this.z.reduce(); - this.x.mul(X2); - this.y.mul(X2); - this.y.mul(X); - }, - - /* this+=this */ - dbl: function () { - var iy, t0, t1, t2, x3, y3; - - iy = new ctx.FP2(0); - iy.copy(this.y); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - iy.mul_ip(); - iy.norm(); - } - - t0 = new ctx.FP2(0); - t0.copy(this.y); - t0.sqr(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.mul_ip(); - } - t1 = new ctx.FP2(0); - t1.copy(iy); - t1.mul(this.z); - t2 = new ctx.FP2(0); - t2.copy(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.mul_ip(); - t2.norm(); - } - - x3 = new ctx.FP2(0); - x3.copy(t2); - x3.mul(this.z); - - y3 = new ctx.FP2(0); - y3.copy(t0); - - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t2.norm(); - t0.sub(t2); - t0.norm(); //y^2-9bz^2 - y3.mul(t0); - y3.add(x3); //(y^2+3z*2)(y^2-9z^2)+3b.z^2.8y^2 - t1.copy(this.x); - t1.mul(iy); // - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); //(y^2-9bz^2)xy2 - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - - return 1; - }, - - /* this+=Q - return 0 for add, 1 for double, -1 for O */ - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3; - - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP2(0); - t0.copy(this.x); - t0.mul(Q.x); // x.Q.x - t1 = new ctx.FP2(0); - t1.copy(this.y); - t1.mul(Q.y); // y.Q.y - - t2 = new ctx.FP2(0); - t2.copy(this.z); - t2.mul(Q.z); - t3 = new ctx.FP2(0); - t3.copy(this.x); - t3.add(this.y); - t3.norm(); //t3=X1+Y1 - t4 = new ctx.FP2(0); - t4.copy(Q.x); - t4.add(Q.y); - t4.norm(); //t4=X2+Y2 - t3.mul(t4); //t3=(X1+Y1)(X2+Y2) - t4.copy(t0); - t4.add(t1); //t4=X1.X2+Y1.Y2 - - t3.sub(t4); - t3.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t3.mul_ip(); - t3.norm(); //t3=(X1+Y1)(X2+Y2)-(X1.X2+Y1.Y2) = X1.Y2+X2.Y1 - } - - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //t4=Y1+Z1 - x3 = new ctx.FP2(0); - x3.copy(Q.y); - x3.add(Q.z); - x3.norm(); //x3=Y2+Z2 - - t4.mul(x3); //t4=(Y1+Z1)(Y2+Z2) - x3.copy(t1); // - x3.add(t2); //X3=Y1.Y2+Z1.Z2 - - t4.sub(x3); - t4.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t4.mul_ip(); - t4.norm(); //t4=(Y1+Z1)(Y2+Z2) - (Y1.Y2+Z1.Z2) = Y1.Z2+Y2.Z1 - } - - x3.copy(this.x); - x3.add(this.z); - x3.norm(); // x3=X1+Z1 - y3 = new ctx.FP2(0); - y3.copy(Q.x); - y3.add(Q.z); - y3.norm(); // y3=X2+Z2 - x3.mul(y3); // x3=(X1+Z1)(X2+Z2) - y3.copy(t0); - y3.add(t2); // y3=X1.X2+Z1+Z2 - y3.rsub(x3); - y3.norm(); // y3=(X1+Z1)(X2+Z2) - (X1.X2+Z1.Z2) = X1.Z2+X2.Z1 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.mul_ip(); - t0.norm(); // x.Q.x - t1.mul_ip(); - t1.norm(); // y.Q.y - } - - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.mul_ip(); - t2.norm(); - } - - z3 = new ctx.FP2(0); - z3.copy(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - y3.mul_ip(); - y3.norm(); - } - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - - return 0; - }, - - /* this-=Q */ - sub: function (Q) { - var D; - var NQ = new ECP2(); - NQ.copy(Q); - NQ.neg(); - D = this.add(NQ); - return D; - }, - - /* P*=e */ - mul: function (e) { - /* fixed size windows */ - var mt = new ctx.BIG(), - t = new ctx.BIG(), - C = new ECP2(), - P = new ECP2(), - Q = new ECP2(), - W = [], - w = [], - i, - nb, - s, - ns; - - if (this.is_infinity()) { - return new ECP2(); - } - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP2(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP2(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - - return P; - }, - - // clear cofactor - cfp: function () { - var fa = new ctx.BIG(0), - fb = new ctx.BIG(0), - x, - T, - K, - X, - xQ, - x2Q; - - // Fast Hashing to G2 - Fuentes-Castaneda, Knapp and Rodriguez-Henriquez - fa.rcopy(ctx.ROM_FIELD.Fra); - fb.rcopy(ctx.ROM_FIELD.Frb); - X = new ctx.FP2(fa, fb); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - X.inverse(null); - X.norm(); - } - - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - T = new ECP2(); - T.copy(this); - T = T.mul(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - T.neg(); - } - K = new ECP2(); - K.copy(T); - K.dbl(); - K.add(T); //K.affine(); - - K.frob(X); - this.frob(X); - this.frob(X); - this.frob(X); - this.add(T); - this.add(K); - T.frob(X); - T.frob(X); - this.add(T); - } - - if (ctx.ECP.CURVE_PAIRING_TYPE > ctx.ECP.BN) { - xQ = this.mul(x); - x2Q = xQ.mul(x); - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - xQ.neg(); - } - - x2Q.sub(xQ); - x2Q.sub(this); - - xQ.sub(this); - xQ.frob(X); - - this.dbl(); - this.frob(X); - this.frob(X); - - this.add(x2Q); - this.add(xQ); - } - }, - }; - - // set to group generator - ECP2.generator = function () { - var G = new ECP2(), - A = new ctx.BIG(0), - B = new ctx.BIG(0), - QX, - QY; - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxb); - QX = new ctx.FP2(0); - QX.bset(A, B); - A.rcopy(ctx.ROM_CURVE.CURVE_Pya); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyb); - QY = new ctx.FP2(0); - QY.bset(A, B); - G.setxy(QX, QY); - return G; - }; - - /* convert from byte array to point */ - ECP2.fromBytes = function (b) { - var t = []; - var alt = false; - var typ = b[0]; - var P = new ECP2(); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ctx.ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - var rx = ctx.FP2.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 2 * ctx.BIG.MODBYTES]; - var ry = ctx.FP2.fromBytes(t); - P.setxy(rx, ry); - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setx(rx, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - } - } else { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 1]; - var rx = ctx.FP2.fromBytes(t); - if (typ == 0x04) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 2 * ctx.BIG.MODBYTES + 1]; - var ry = ctx.FP2.fromBytes(t); - P.setxy(rx, ry); - } else { - P.setx(rx, typ & 1); - } - } - return P; - }; - - /* Calculate RHS of curve equation x^3+B */ - ECP2.RHS = function (x) { - var r, c, b; - - //x.norm(); - r = new ctx.FP2(x); //r.copy(x); - r.sqr(); - - c = new ctx.BIG(0); - c.rcopy(ctx.ROM_CURVE.CURVE_B); - b = new ctx.FP2(c); //b.bseta(c); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b.div_ip(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b.norm(); - b.mul_ip(); - b.norm(); - } - - r.mul(x); - r.add(b); - - r.reduce(); - - return r; - }; - - /* P=u0.Q0+u1*Q1+u2*Q2+u3*Q3 */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - ECP2.mul4 = function (Q, u) { - var W = new ECP2(), - P = new ECP2(), - T = [], - mt = new ctx.BIG(), - t = [], - w = [], - s = [], - i, - j, - k, - nb, - bt, - pb; - - for (i = 0; i < 4; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - //Q[i].affine(); - } - - T[0] = new ECP2(); - T[0].copy(Q[0]); // Q[0] - T[1] = new ECP2(); - T[1].copy(T[0]); - T[1].add(Q[1]); // Q[0]+Q[1] - T[2] = new ECP2(); - T[2].copy(T[0]); - T[2].add(Q[2]); // Q[0]+Q[2] - T[3] = new ECP2(); - T[3].copy(T[1]); - T[3].add(Q[2]); // Q[0]+Q[1]+Q[2] - T[4] = new ECP2(); - T[4].copy(T[0]); - T[4].add(Q[3]); // Q[0]+Q[3] - T[5] = new ECP2(); - T[5].copy(T[1]); - T[5].add(Q[3]); // Q[0]+Q[1]+Q[3] - T[6] = new ECP2(); - T[6].copy(T[2]); - T[6].add(Q[3]); // Q[0]+Q[2]+Q[3] - T[7] = new ECP2(); - T[7].copy(T[3]); - T[7].add(Q[3]); // Q[0]+Q[1]+Q[2]+Q[3] - - // Make it odd - pb = 1 - t[0].parity(); - t[0].inc(pb); - t[0].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 4; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s[i] = 2 * t[0].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w[i] += bt * k; - k *= 2; - } - } - - // Main loop - P.select(T, 2 * w[nb - 1] + 1); - for (i = nb - 2; i >= 0; i--) { - P.dbl(); - W.select(T, 2 * w[i] + s[i]); - P.add(W); - } - - // apply correction - W.copy(P); - W.sub(Q[0]); - P.cmove(W, pb); - return P; - }; - - /* return 1 if b==c, no branching */ - ECP2.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* Hunt and Peck a BIG to a curve point - ECP2.hap2point = function(h) - { - var one=new ctx.BIG(1); - var x=new ctx.BIG(h); - var Q,X2; - for (;;) { - X2 = new ctx.FP2(one, x); - Q = new ECP2(); - Q.setx(X2,0); - if (!Q.is_infinity()) break; - x.inc(1); - x.norm(); - } - return Q; - }; */ - - /* Constant time Map to Point */ - ECP2.map2point = function (H) { - // Shallue and van de Woestijne method. - var sgn, ne; - var NY = new ctx.FP2(1); - var T = new ctx.FP2(H); - sgn = T.sign(); - if (ctx.ECP.HTC_ISO_G2 == 0) { - var Z = new ctx.FP(ctx.FP.RIADZG2A); - var X1 = new ctx.FP2(Z); - var A = ECP2.RHS(X1); - var W = new ctx.FP2(A); - if ( - ctx.FP.RIADZG2A == -1 && - ctx.FP.RIADZG2B == 0 && - ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE && - ctx.ROM_CURVE.CURVE_B_I == 4 - ) { - // special case for BLS12381 - W.copy(new ctx.FP2(2, 1)); - } else { - W.sqrt(null); - } - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_FIELD.SQRTm3); - Z.mul(s); - - T.sqr(); - var Y = new ctx.FP2(A); - Y.mul(T); - T.copy(NY); - T.add(Y); - T.norm(); - Y.rsub(NY); - Y.norm(); - NY.copy(T); - NY.mul(Y); - - NY.pmul(Z); - NY.inverse(null); - - W.pmul(Z); - if (W.sign() == 1) { - W.neg(); - W.norm(); - } - W.pmul(Z); - W.mul(H); - W.mul(Y); - W.mul(NY); - - var X3 = new ctx.FP2(X1); - X1.neg(); - X1.norm(); - X1.div2(); - var X2 = new ctx.FP2(X1); - X1.sub(W); - X1.norm(); - X2.add(W); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - T.sqr(); - T.mul(NY); - T.sqr(); - A.mul(T); - X3.add(A); - X3.norm(); - - Y.copy(ECP2.RHS(X2)); - X3.cmove(X2, Y.qr(null)); - Y.copy(ECP2.RHS(X1)); - X3.cmove(X1, Y.qr(null)); - Y.copy(ECP2.RHS(X3)); - Y.sqrt(null); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var P = new ECP2(); - P.setxy(X3, Y); - return P; - } else { - var Q = new ctx.ECP2(); - var ra = new ctx.FP(0); - var rb = new ctx.FP(0); - ra.rcopy(ctx.ROM_CURVE.CURVE_Adr); - rb.rcopy(ctx.ROM_CURVE.CURVE_Adi); - var Ad = new ctx.FP2(ra, rb); - ra.rcopy(ctx.ROM_CURVE.CURVE_Bdr); - rb.rcopy(ctx.ROM_CURVE.CURVE_Bdi); - var Bd = new ctx.FP2(ra, rb); - var ZZ = new ctx.FP2(ctx.FP.RIADZG2A, ctx.FP.RIADZG2B); - var hint = new ctx.FP(0); - - T.sqr(); - T.mul(ZZ); - var W = new ctx.FP2(T); - W.add(NY); - W.norm(); - - W.mul(T); - var D = new ctx.FP2(Ad); - D.mul(W); - - W.add(NY); - W.norm(); - W.mul(Bd); - W.neg(); - W.norm(); - - var X2 = new ctx.FP2(W); - var X3 = new ctx.FP2(T); - X3.mul(X2); - - var GX1 = new ctx.FP2(X2); - GX1.sqr(); - var D2 = new ctx.FP2(D); - D2.sqr(); - W.copy(Ad); - W.mul(D2); - GX1.add(W); - GX1.norm(); - GX1.mul(X2); - D2.mul(D); - W.copy(Bd); - W.mul(D2); - GX1.add(W); - GX1.norm(); // x^3+Ax+b - - W.copy(GX1); - W.mul(D); - var qr = W.qr(hint); - D.copy(W); - D.inverse(hint); - D.mul(GX1); - X2.mul(D); - X3.mul(D); - T.mul(H); - D2.copy(D); - D2.sqr(); - - D.copy(D2); - D.mul(T); - T.copy(W); - T.mul(ZZ); - - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_CURVE.CURVE_HTPC2); - s.mul(hint); - - X2.cmove(X3, 1 - qr); - W.cmove(T, 1 - qr); - D2.cmove(D, 1 - qr); - hint.cmove(s, 1 - qr); - - var Y = new ctx.FP2(W); - Y.sqrt(hint); - Y.mul(D2); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var k = 0; - var isox = ctx.ECP.HTC_ISO_G2; - var isoy = (3 * (isox - 1)) / 2; - - // xnum - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - var xnum = new ctx.FP2(ra, rb); - k++; - for (var i = 0; i < isox; i++) { - xnum.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - xnum.add(W); - xnum.norm(); - } - - //xden - var xden = new ctx.FP2(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - xden.add(W); - xden.norm(); - for (var i = 0; i < isox - 2; i++) { - xden.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - xden.add(W); - xden.norm(); - } - - //ynum - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - var ynum = new ctx.FP2(ra, rb); - k++; - for (var i = 0; i < isoy; i++) { - ynum.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - ynum.add(W); - ynum.norm(); - } - - //yden - var yden = new ctx.FP2(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - yden.add(W); - yden.norm(); - for (var i = 0; i < isoy - 1; i++) { - yden.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - yden.add(W); - yden.norm(); - } - - ynum.mul(Y); - - T.copy(xnum); - T.mul(yden); - Q.x.copy(T); - T.copy(ynum); - T.mul(xden); - Q.y.copy(T); - T.copy(xden); - T.mul(yden); - Q.z.copy(T); - - return Q; - } - }; - - /* Map octet string to curve point - ECP2.mapit = function(h) - { - var q=new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx=ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - - var Q=ECP2.hap2point(x); - Q.cfp(); - return Q; - };*/ - - return ECP2; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP2 = ECP2; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp4.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp4.js deleted file mode 100644 index a1cb9407b..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp4.js +++ /dev/null @@ -1,970 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Weierstrass elliptic curve functions over ctx.FP4 */ - -var ECP4 = function (ctx) { - 'use strict'; - - /* Constructor, set this=O */ - var ECP4 = function () { - this.x = new ctx.FP4(0); - this.y = new ctx.FP4(1); - this.z = new ctx.FP4(0); - }; - - ECP4.prototype = { - /* Test this=O? */ - is_infinity: function () { - return this.x.iszilch() && this.z.iszilch(); - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - this.y.copy(P.y); - this.z.copy(P.z); - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - this.y.one(); - this.z.zero(); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - this.y.cmove(Q.y, d); - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP4(), - m = b >> 31, - babs = (b ^ m) - m; - - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP4.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP4.teq(babs, 1)); - this.cmove(W[2], ECP4.teq(babs, 2)); - this.cmove(W[3], ECP4.teq(babs, 3)); - this.cmove(W[4], ECP4.teq(babs, 4)); - this.cmove(W[5], ECP4.teq(babs, 5)); - this.cmove(W[6], ECP4.teq(babs, 6)); - this.cmove(W[7], ECP4.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - equals: function (Q) { - var a, b; - - a = new ctx.FP4(this.x); - b = new ctx.FP4(Q.x); - - a.mul(Q.z); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - a.copy(this.y); - a.mul(Q.z); - b.copy(Q.y); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - return true; - }, - - /* set this=-this */ - neg: function () { - this.y.norm(); - this.y.neg(); - this.y.norm(); - return; - }, - - /* convert this to affine, from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP4(1); - - if (this.z.equals(one)) { - this.x.reduce(); - this.y.reduce(); - return; - } - - this.z.inverse(null); - - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z.copy(one); - }, - - /* extract affine x as ctx.FP4 */ - getX: function () { - var W = new ECP4(); - W.copy(this); - W.affine(); - return W.x; - }, - - /* extract affine y as ctx.FP4 */ - getY: function () { - var W = new ECP4(); - W.copy(this); - W.affine(); - return W.y; - }, - - /* extract projective x */ - getx: function () { - return this.x; - }, - - /* extract projective y */ - gety: function () { - return this.y; - }, - - /* extract projective z */ - getz: function () { - return this.z; - }, - - /* convert this to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP4(); - W.copy(this); - W.affine(); - W.x.toBytes(t); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (!compress) { - W.y.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i + 4 * ctx.BIG.MODBYTES] = t[i]; - } else { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } - } else { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (!compress) { - b[0] = 0x04; - W.y.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i + 4 * ctx.BIG.MODBYTES + 1] = t[i]; - } else { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - } - } - }, - - /* convert this to hex string */ - toString: function () { - var W = new ECP4(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - W.affine(); - return '(' + W.x.toString() + ',' + W.y.toString() + ')'; - }, - - /* set this=(x,y) */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x.copy(ix); - this.y.copy(iy); - this.z.one(); - this.x.norm(); - - rhs = ECP4.RHS(this.x); - - y2 = new ctx.FP4(this.y); //y2.copy(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - }, - - /* set this=(x,.) */ - setx: function (ix, s) { - var rhs, h; - - this.x.copy(ix); - this.z.one(); - this.x.norm(); - rhs = ECP4.RHS(this.x); - - if (rhs.qr(h) == 1) { - rhs.sqrt(h); - if (rhs.sign() != s) rhs.neg(); - rhs.reduce(); - this.y.copy(rhs); - } else { - this.inf(); - } - }, - - /* set this*=q, where q is Modulus, using Frobenius */ - frob: function (F, n) { - for (var i = 0; i < n; i++) { - this.x.frob(F[2]); - this.x.pmul(F[0]); - - this.y.frob(F[2]); - this.y.pmul(F[1]); - this.y.times_i(); - - this.z.frob(F[2]); - } - }, - - /* this+=this */ - dbl: function () { - var iy, t0, t1, t2, x3, y3; - - iy = new ctx.FP4(this.y); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - iy.times_i(); - iy.norm(); - } - - t0 = new ctx.FP4(this.y); - t0.sqr(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - } - t1 = new ctx.FP4(iy); - t1.mul(this.z); - t2 = new ctx.FP4(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - x3 = new ctx.FP4(t2); - x3.mul(this.z); - - y3 = new ctx.FP4(t0); - - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t2.norm(); - t0.sub(t2); - t0.norm(); //y^2-9bz^2 - y3.mul(t0); - y3.add(x3); //(y^2+3z*2)(y^2-9z^2)+3b.z^2.8y^2 - t1.copy(this.x); - t1.mul(iy); // - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); //(y^2-9bz^2)xy2 - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - - return 1; - }, - - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3; - - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP4(this.x); - t0.mul(Q.x); // x.Q.x - t1 = new ctx.FP4(this.y); - t1.mul(Q.y); // y.Q.y - - t2 = new ctx.FP4(this.z); - t2.mul(Q.z); - t3 = new ctx.FP4(this.x); - t3.add(this.y); - t3.norm(); //t3=X1+Y1 - t4 = new ctx.FP4(Q.x); - t4.add(Q.y); - t4.norm(); //t4=X2+Y2 - t3.mul(t4); //t3=(X1+Y1)(X2+Y2) - t4.copy(t0); - t4.add(t1); //t4=X1.X2+Y1.Y2 - - t3.sub(t4); - t3.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t3.times_i(); //t3=(X1+Y1)(X2+Y2)-(X1.X2+Y1.Y2) = X1.Y2+X2.Y1 - } - - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //t4=Y1+Z1 - x3 = new ctx.FP4(Q.y); - x3.add(Q.z); - x3.norm(); //x3=Y2+Z2 - - t4.mul(x3); //t4=(Y1+Z1)(Y2+Z2) - x3.copy(t1); // - x3.add(t2); //X3=Y1.Y2+Z1.Z2 - - t4.sub(x3); - t4.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t4.times_i(); //t4=(Y1+Z1)(Y2+Z2) - (Y1.Y2+Z1.Z2) = Y1.Z2+Y2.Z1 - } - - x3.copy(this.x); - x3.add(this.z); - x3.norm(); // x3=X1+Z1 - y3 = new ctx.FP4(Q.x); - y3.add(Q.z); - y3.norm(); // y3=X2+Z2 - x3.mul(y3); // x3=(X1+Z1)(X2+Z2) - y3.copy(t0); - y3.add(t2); // y3=X1.X2+Z1+Z2 - y3.rsub(x3); - y3.norm(); // y3=(X1+Z1)(X2+Z2) - (X1.X2+Z1.Z2) = X1.Z2+X2.Z1 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - t1.times_i(); - } - - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - z3 = new ctx.FP4(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - y3.times_i(); - } - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - - return 0; - }, - - /* this-=Q */ - sub: function (Q) { - var D; - var NQ = new ECP4(); - NQ.copy(Q); - NQ.neg(); - D = this.add(NQ); - return D; - }, - - /* P*=e */ - mul: function (e) { - /* fixed size windows */ - var mt = new ctx.BIG(), - t = new ctx.BIG(), - C = new ECP4(), - P = new ECP4(), - Q = new ECP4(), - W = [], - w = [], - i, - nb, - s, - ns; - - if (this.is_infinity()) { - return new ECP4(); - } - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP4(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP4(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - P.affine(); - - return P; - }, - - cfp: function () { - var F = ECP4.frob_constants(), - x, - xQ, - x2Q, - x3Q, - x4Q; - - /* Fast Hashing to G2 - Fuentes-Castaneda, Knapp and Rodriguez-Henriquez */ - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - xQ = this.mul(x); - x2Q = xQ.mul(x); - x3Q = x2Q.mul(x); - x4Q = x3Q.mul(x); - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - xQ.neg(); - x3Q.neg(); - } - - x4Q.sub(x3Q); - x4Q.sub(this); - - x3Q.sub(x2Q); - x3Q.frob(F, 1); - - x2Q.sub(xQ); - x2Q.frob(F, 2); - - xQ.sub(this); - xQ.frob(F, 3); - - this.dbl(); - this.frob(F, 4); - - this.add(x4Q); - this.add(x3Q); - this.add(x2Q); - this.add(xQ); - - this.affine(); - }, - }; - - // set to group generator - ECP4.generator = function () { - var G = new ECP4(), - A = new ctx.BIG(0), - B = new ctx.BIG(0), - XA, - XB, - X, - YA, - YB, - Y; - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxab); - XA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxbb); - - XB = new ctx.FP2(A, B); - X = new ctx.FP4(XA, XB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyab); - YA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pybb); - - YB = new ctx.FP2(A, B); - Y = new ctx.FP4(YA, YB); - - G.setxy(X, Y); - - return G; - }; - - /* convert from byte array to point */ - ECP4.fromBytes = function (b) { - var t = []; - var alt = false; - var typ = b[0]; - var P = new ECP4(); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - var rx = ctx.FP4.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 4 * ctx.BIG.MODBYTES]; - var ry = ctx.FP4.fromBytes(t); - P.setxy(rx, ry); - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setx(rx, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - } - } else { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 1]; - var rx = ctx.FP4.fromBytes(t); - if (typ == 0x04) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 4 * ctx.BIG.MODBYTES + 1]; - var ry = ctx.FP4.fromBytes(t); - P.setxy(rx, ry); - } else { - P.setx(rx, typ & 1); - } - } - return P; - }; - - /* Calculate RHS of curve equation x^3+B */ - ECP4.RHS = function (x) { - var r, c, b; - - //x.norm(); - r = new ctx.FP4(x); //r.copy(x); - r.sqr(); - - c = new ctx.BIG(0); - c.rcopy(ctx.ROM_CURVE.CURVE_B); - b = new ctx.FP4(c); //b.bseta(c); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b.div_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b.times_i(); - } - - r.mul(x); - r.add(b); - - r.reduce(); - return r; - }; - - /* P=u0.Q0+u1*Q1+u2*Q2+u3*Q3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - ECP4.mul8 = function (Q, u) { - var W = new ECP4(), - P = new ECP4(), - T1 = [], - T2 = [], - mt = new ctx.BIG(), - t = [], - w1 = [], - s1 = [], - w2 = [], - s2 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2; - - for (i = 0; i < 8; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - //Q[i].affine(); - } - - T1[0] = new ECP4(); - T1[0].copy(Q[0]); // Q[0] - T1[1] = new ECP4(); - T1[1].copy(T1[0]); - T1[1].add(Q[1]); // Q[0]+Q[1] - T1[2] = new ECP4(); - T1[2].copy(T1[0]); - T1[2].add(Q[2]); // Q[0]+Q[2] - T1[3] = new ECP4(); - T1[3].copy(T1[1]); - T1[3].add(Q[2]); // Q[0]+Q[1]+Q[2] - T1[4] = new ECP4(); - T1[4].copy(T1[0]); - T1[4].add(Q[3]); // Q[0]+Q[3] - T1[5] = new ECP4(); - T1[5].copy(T1[1]); - T1[5].add(Q[3]); // Q[0]+Q[1]+Q[3] - T1[6] = new ECP4(); - T1[6].copy(T1[2]); - T1[6].add(Q[3]); // Q[0]+Q[2]+Q[3] - T1[7] = new ECP4(); - T1[7].copy(T1[3]); - T1[7].add(Q[3]); // Q[0]+Q[1]+Q[2]+Q[3] - - T2[0] = new ECP4(); - T2[0].copy(Q[4]); // Q[0] - T2[1] = new ECP4(); - T2[1].copy(T2[0]); - T2[1].add(Q[5]); // Q[0]+Q[1] - T2[2] = new ECP4(); - T2[2].copy(T2[0]); - T2[2].add(Q[6]); // Q[0]+Q[2] - T2[3] = new ECP4(); - T2[3].copy(T2[1]); - T2[3].add(Q[6]); // Q[0]+Q[1]+Q[2] - T2[4] = new ECP4(); - T2[4].copy(T2[0]); - T2[4].add(Q[7]); // Q[0]+Q[3] - T2[5] = new ECP4(); - T2[5].copy(T2[1]); - T2[5].add(Q[7]); // Q[0]+Q[1]+Q[3] - T2[6] = new ECP4(); - T2[6].copy(T2[2]); - T2[6].add(Q[7]); // Q[0]+Q[2]+Q[3] - T2[7] = new ECP4(); - T2[7].copy(T2[3]); - T2[7].add(Q[7]); // Q[0]+Q[1]+Q[2]+Q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 8; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - } - - // Main loop - P.select(T1, 2 * w1[nb - 1] + 1); - W.select(T2, 2 * w2[nb - 1] + 1); - P.add(W); - for (i = nb - 2; i >= 0; i--) { - P.dbl(); - W.select(T1, 2 * w1[i] + s1[i]); - P.add(W); - W.select(T2, 2 * w2[i] + s2[i]); - P.add(W); - } - - // apply correction - W.copy(P); - W.sub(Q[0]); - P.cmove(W, pb1); - - W.copy(P); - W.sub(Q[4]); - P.cmove(W, pb2); - - P.affine(); - return P; - }; - - /* return 1 if b==c, no branching */ - ECP4.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* Hunt and Peck a BIG to a curve point - ECP4.hap2point = function(h) - { - var one=new ctx.BIG(1); - var x=new ctx.BIG(h); - var Q,X2,X4; - for (;;) { - X2 = new ctx.FP2(one, x); - X4 = new ctx.FP4(X2); - Q = new ECP4(); - Q.setx(X4,0); - if (!Q.is_infinity()) break; - x.inc(1); - x.norm(); - } - return Q; - }; */ - - /* Constant time Map to Point */ - ECP4.map2point = function (H) { - // Shallue and van de Woestijne method. - var sgn, ne; - var NY = new ctx.FP4(1); - var T = new ctx.FP4(H); - sgn = T.sign(); - - var Z = new ctx.FP(ctx.FP.RIADZG2A); - var X1 = new ctx.FP4(Z); - var A = ECP4.RHS(X1); - var W = new ctx.FP4(A); - - W.sqrt(null); - - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_FIELD.SQRTm3); - Z.mul(s); - - T.sqr(); - var Y = new ctx.FP4(A); - Y.mul(T); - T.copy(NY); - T.add(Y); - T.norm(); - Y.rsub(NY); - Y.norm(); - NY.copy(T); - NY.mul(Y); - - NY.qmul(Z); - NY.inverse(null); - - W.qmul(Z); - if (W.sign() == 1) { - W.neg(); - W.norm(); - } - W.qmul(Z); - W.mul(H); - W.mul(Y); - W.mul(NY); - - var X3 = new ctx.FP4(X1); - X1.neg(); - X1.norm(); - X1.div2(); - var X2 = new ctx.FP4(X1); - X1.sub(W); - X1.norm(); - X2.add(W); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - T.sqr(); - T.mul(NY); - T.sqr(); - A.mul(T); - X3.add(A); - X3.norm(); - - Y.copy(ECP4.RHS(X2)); - X3.cmove(X2, Y.qr(null)); - Y.copy(ECP4.RHS(X1)); - X3.cmove(X1, Y.qr(null)); - Y.copy(ECP4.RHS(X3)); - Y.sqrt(null); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var P = new ECP4(); - P.setxy(X3, Y); - return P; - }; - - /* Map octet string to curve point - ECP4.mapit = function(h) - { - var q=new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx=ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - - var Q=ECP4.hap2point(x); - Q.cfp(); - return Q; - }; */ - - ECP4.frob_constants = function () { - var fa = new ctx.BIG(0), - fb = new ctx.BIG(0), - F = [], - X, - F0, - F1, - F2; - - fa.rcopy(ctx.ROM_FIELD.Fra); - fb.rcopy(ctx.ROM_FIELD.Frb); - X = new ctx.FP2(fa, fb); - - F0 = new ctx.FP2(X); - F0.sqr(); - F2 = new ctx.FP2(F0); - F2.mul_ip(); - F2.norm(); - F1 = new ctx.FP2(F2); - F1.sqr(); - F2.mul(F1); - F1.copy(X); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - F1.mul_ip(); - F1.inverse(null); - F0.copy(F1); - F0.sqr(); - } - F0.mul_ip(); - F0.norm(); - F1.mul(F0); - - F[0] = new ctx.FP2(F0); - F[1] = new ctx.FP2(F1); - F[2] = new ctx.FP2(F2); - return F; - }; - - return ECP4; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP4 = ECP4; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp8.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp8.js deleted file mode 100644 index 7edfaba54..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp8.js +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Weierstrass elliptic curve functions over ctx.FP8 */ - -var ECP8 = function (ctx) { - 'use strict'; - - /* Constructor, set this=O */ - var ECP8 = function () { - this.x = new ctx.FP8(0); - this.y = new ctx.FP8(1); - this.z = new ctx.FP8(0); - }; - - ECP8.prototype = { - /* Test this=O? */ - is_infinity: function () { - return this.x.iszilch() && this.z.iszilch(); - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - this.y.copy(P.y); - this.z.copy(P.z); - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - this.y.one(); - this.z.zero(); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - this.y.cmove(Q.y, d); - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP8(), - m = b >> 31, - babs = (b ^ m) - m; - - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP8.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP8.teq(babs, 1)); - this.cmove(W[2], ECP8.teq(babs, 2)); - this.cmove(W[3], ECP8.teq(babs, 3)); - this.cmove(W[4], ECP8.teq(babs, 4)); - this.cmove(W[5], ECP8.teq(babs, 5)); - this.cmove(W[6], ECP8.teq(babs, 6)); - this.cmove(W[7], ECP8.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - equals: function (Q) { - var a, b; - - a = new ctx.FP8(this.x); - b = new ctx.FP8(Q.x); - - a.mul(Q.z); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - a.copy(this.y); - a.mul(Q.z); - b.copy(Q.y); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - return true; - }, - - /* set this=-this */ - neg: function () { - this.y.norm(); - this.y.neg(); - this.y.norm(); - return; - }, - - /* convert this to affine, from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP8(1); - - if (this.z.equals(one)) { - this.x.reduce(); - this.y.reduce(); - return; - } - - this.z.inverse(null); - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z.copy(one); - }, - - /* extract affine x as ctx.FP8 */ - getX: function () { - var W = new ECP8(); - W.copy(this); - W.affine(); - return W.x; - }, - - /* extract affine y as ctx.FP8 */ - getY: function () { - var W = new ECP8(); - W.copy(this); - W.affine(); - return W.y; - }, - - /* extract projective x */ - getx: function () { - return this.x; - }, - - /* extract projective y */ - gety: function () { - return this.y; - }, - - /* extract projective z */ - getz: function () { - return this.z; - }, - - /* convert this to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP8(); - W.copy(this); - W.affine(); - W.x.toBytes(t); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (!compress) { - W.y.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i + 8 * ctx.BIG.MODBYTES] = t[i]; - } else { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } - } else { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (!compress) { - b[0] = 0x04; - W.y.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i + 8 * ctx.BIG.MODBYTES + 1] = t[i]; - } else { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - } - } - }, - - /* convert this to hex string */ - toString: function () { - var W = new ECP8(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - W.affine(); - return '(' + W.x.toString() + ',' + W.y.toString() + ')'; - }, - - /* set this=(x,y) */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x.copy(ix); - this.y.copy(iy); - this.z.one(); - this.x.norm(); - - rhs = ECP8.RHS(this.x); - - y2 = new ctx.FP8(this.y); //y2.copy(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - }, - - /* set this=(x,.) */ - setx: function (ix, s) { - var rhs, h; - - this.x.copy(ix); - this.z.one(); - this.x.norm(); - rhs = ECP8.RHS(this.x); - - //alert("0. rhs= "+rhs.toString()); - if (rhs.qr(h) == 1) { - rhs.sqrt(h); - //alert("1. rhs= "+rhs.toString()); - if (rhs.sign() != s) rhs.neg(); - rhs.reduce(); - this.y.copy(rhs); - } else { - this.inf(); - } - }, - - /* set this*=q, where q is Modulus, using Frobenius */ - frob: function (F, n) { - for (var i = 0; i < n; i++) { - this.x.frob(F[2]); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - this.x.qmul(F[0]); - this.x.times_i2(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - this.x.qmul(F[0]); - this.x.times_i2(); - } - - this.y.frob(F[2]); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - this.y.qmul(F[1]); - this.y.times_i2(); - this.y.times_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - this.y.qmul(F[1]); - this.y.times_i(); - } - - this.z.frob(F[2]); - } - }, - - /* this+=this */ - dbl: function () { - var iy, t0, t1, t2, x3, y3; - - iy = new ctx.FP8(this.y); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - iy.times_i(); - iy.norm(); - } - - t0 = new ctx.FP8(this.y); - t0.sqr(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - } - t1 = new ctx.FP8(iy); - t1.mul(this.z); - t2 = new ctx.FP8(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - x3 = new ctx.FP8(t2); - x3.mul(this.z); - - y3 = new ctx.FP8(t0); - - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t2.norm(); - t0.sub(t2); - t0.norm(); //y^2-9bz^2 - y3.mul(t0); - y3.add(x3); //(y^2+3z*2)(y^2-9z^2)+3b.z^2.8y^2 - t1.copy(this.x); - t1.mul(iy); // - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); //(y^2-9bz^2)xy2 - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - - return 1; - }, - - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3; - - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP8(this.x); - t0.mul(Q.x); // x.Q.x - t1 = new ctx.FP8(this.y); - t1.mul(Q.y); // y.Q.y - - t2 = new ctx.FP8(this.z); - t2.mul(Q.z); - t3 = new ctx.FP8(this.x); - t3.add(this.y); - t3.norm(); //t3=X1+Y1 - t4 = new ctx.FP8(Q.x); - t4.add(Q.y); - t4.norm(); //t4=X2+Y2 - t3.mul(t4); //t3=(X1+Y1)(X2+Y2) - t4.copy(t0); - t4.add(t1); //t4=X1.X2+Y1.Y2 - - t3.sub(t4); - t3.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t3.times_i(); //t3=(X1+Y1)(X2+Y2)-(X1.X2+Y1.Y2) = X1.Y2+X2.Y1 - } - - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //t4=Y1+Z1 - x3 = new ctx.FP8(Q.y); - x3.add(Q.z); - x3.norm(); //x3=Y2+Z2 - - t4.mul(x3); //t4=(Y1+Z1)(Y2+Z2) - x3.copy(t1); // - x3.add(t2); //X3=Y1.Y2+Z1.Z2 - - t4.sub(x3); - t4.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t4.times_i(); //t4=(Y1+Z1)(Y2+Z2) - (Y1.Y2+Z1.Z2) = Y1.Z2+Y2.Z1 - } - - x3.copy(this.x); - x3.add(this.z); - x3.norm(); // x3=X1+Z1 - y3 = new ctx.FP8(Q.x); - y3.add(Q.z); - y3.norm(); // y3=X2+Z2 - x3.mul(y3); // x3=(X1+Z1)(X2+Z2) - y3.copy(t0); - y3.add(t2); // y3=X1.X2+Z1+Z2 - y3.rsub(x3); - y3.norm(); // y3=(X1+Z1)(X2+Z2) - (X1.X2+Z1.Z2) = X1.Z2+X2.Z1 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - t1.times_i(); - } - - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - z3 = new ctx.FP8(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - y3.times_i(); - } - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - - return 0; - }, - - /* this-=Q */ - sub: function (Q) { - var D; - var NQ = new ECP8(); - NQ.copy(Q); - NQ.neg(); - D = this.add(NQ); - return D; - }, - - /* P*=e */ - mul: function (e) { - /* fixed size windows */ - var mt = new ctx.BIG(), - t = new ctx.BIG(), - C = new ECP8(), - P = new ECP8(), - Q = new ECP8(), - W = [], - w = [], - i, - nb, - s, - ns; - - if (this.is_infinity()) { - return new ECP8(); - } - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP8(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP8(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - P.affine(); - - return P; - }, - /* clear cofactor */ - cfp: function (h) { - var F = ECP8.frob_constants(), - x, - xQ, - x2Q, - x3Q, - x4Q, - x5Q, - x6Q, - x7Q, - x8Q; - - /* Fast Hashing to G2 - Fuentes-Castaneda, Knapp and Rodriguez-Henriquez */ - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - xQ = this.mul(x); - x2Q = xQ.mul(x); - x3Q = x2Q.mul(x); - x4Q = x3Q.mul(x); - x5Q = x4Q.mul(x); - x6Q = x5Q.mul(x); - x7Q = x6Q.mul(x); - x8Q = x7Q.mul(x); - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - xQ.neg(); - x3Q.neg(); - x5Q.neg(); - x7Q.neg(); - } - - x8Q.sub(x7Q); - x8Q.sub(this); - - x7Q.sub(x6Q); - x7Q.frob(F, 1); - - x6Q.sub(x5Q); - x6Q.frob(F, 2); - - x5Q.sub(x4Q); - x5Q.frob(F, 3); - - x4Q.sub(x3Q); - x4Q.frob(F, 4); - - x3Q.sub(x2Q); - x3Q.frob(F, 5); - - x2Q.sub(xQ); - x2Q.frob(F, 6); - - xQ.sub(this); - xQ.frob(F, 7); - - this.dbl(); - this.frob(F, 8); - - this.add(x8Q); - this.add(x7Q); - this.add(x6Q); - this.add(x5Q); - - this.add(x4Q); - this.add(x3Q); - this.add(x2Q); - this.add(xQ); - - this.affine(); - }, - }; - - // set to group generator - ECP8.generator = function () { - var G = new ECP8(), - A = new ctx.BIG(0), - B = new ctx.BIG(0), - XAA, - XAB, - XA, - XBA, - XBB, - XB, - X, - YAA, - YAB, - YA, - YBA, - YBB, - YB, - Y; - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxaaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxaab); - XAA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxaba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxabb); - - XAB = new ctx.FP2(A, B); - XA = new ctx.FP4(XAA, XAB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxbaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxbab); - XBA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxbba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxbbb); - - XBB = new ctx.FP2(A, B); - XB = new ctx.FP4(XBA, XBB); - - X = new ctx.FP8(XA, XB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyaaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyaab); - YAA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyaba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyabb); - - YAB = new ctx.FP2(A, B); - YA = new ctx.FP4(YAA, YAB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pybaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pybab); - YBA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pybba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pybbb); - - YBB = new ctx.FP2(A, B); - YB = new ctx.FP4(YBA, YBB); - - Y = new ctx.FP8(YA, YB); - - G.setxy(X, Y); - - return G; - }; - - /* convert from byte array to point */ - ECP8.fromBytes = function (b) { - var t = []; - var alt = false; - var typ = b[0]; - var P = new ECP8(); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - var rx = ctx.FP8.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 8 * ctx.BIG.MODBYTES]; - var ry = ctx.FP8.fromBytes(t); - P.setxy(rx, ry); - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setx(rx, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - } - } else { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 1]; - var rx = ctx.FP8.fromBytes(t); - if (typ == 0x04) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 8 * ctx.BIG.MODBYTES + 1]; - var ry = ctx.FP8.fromBytes(t); - P.setxy(rx, ry); - } else { - P.setx(rx, typ & 1); - } - } - return P; - }; - - /* Calculate RHS of curve equation x^3+B */ - ECP8.RHS = function (x) { - var r, c, b; - - //x.norm(); - r = new ctx.FP8(x); //r.copy(x); - r.sqr(); - - c = new ctx.BIG(0); - c.rcopy(ctx.ROM_CURVE.CURVE_B); - b = new ctx.FP8(c); //b.bseta(c); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b.div_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b.times_i(); - } - - r.mul(x); - r.add(b); - - r.reduce(); - return r; - }; - - /* P=u0.Q0+u1*Q1+u2*Q2+u3*Q3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - ECP8.mul16 = function (Q, u) { - var W = new ECP8(), - P = new ECP8(), - T1 = [], - T2 = [], - T3 = [], - T4 = [], - mt = new ctx.BIG(), - t = [], - w1 = [], - s1 = [], - w2 = [], - s2 = [], - w3 = [], - s3 = [], - w4 = [], - s4 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2, - pb3, - pb4; - - for (i = 0; i < 16; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - //Q[i].affine(); - } - - T1[0] = new ECP8(); - T1[0].copy(Q[0]); // Q[0] - T1[1] = new ECP8(); - T1[1].copy(T1[0]); - T1[1].add(Q[1]); // Q[0]+Q[1] - T1[2] = new ECP8(); - T1[2].copy(T1[0]); - T1[2].add(Q[2]); // Q[0]+Q[2] - T1[3] = new ECP8(); - T1[3].copy(T1[1]); - T1[3].add(Q[2]); // Q[0]+Q[1]+Q[2] - T1[4] = new ECP8(); - T1[4].copy(T1[0]); - T1[4].add(Q[3]); // Q[0]+Q[3] - T1[5] = new ECP8(); - T1[5].copy(T1[1]); - T1[5].add(Q[3]); // Q[0]+Q[1]+Q[3] - T1[6] = new ECP8(); - T1[6].copy(T1[2]); - T1[6].add(Q[3]); // Q[0]+Q[2]+Q[3] - T1[7] = new ECP8(); - T1[7].copy(T1[3]); - T1[7].add(Q[3]); // Q[0]+Q[1]+Q[2]+Q[3] - - T2[0] = new ECP8(); - T2[0].copy(Q[4]); // Q[0] - T2[1] = new ECP8(); - T2[1].copy(T2[0]); - T2[1].add(Q[5]); // Q[0]+Q[1] - T2[2] = new ECP8(); - T2[2].copy(T2[0]); - T2[2].add(Q[6]); // Q[0]+Q[2] - T2[3] = new ECP8(); - T2[3].copy(T2[1]); - T2[3].add(Q[6]); // Q[0]+Q[1]+Q[2] - T2[4] = new ECP8(); - T2[4].copy(T2[0]); - T2[4].add(Q[7]); // Q[0]+Q[3] - T2[5] = new ECP8(); - T2[5].copy(T2[1]); - T2[5].add(Q[7]); // Q[0]+Q[1]+Q[3] - T2[6] = new ECP8(); - T2[6].copy(T2[2]); - T2[6].add(Q[7]); // Q[0]+Q[2]+Q[3] - T2[7] = new ECP8(); - T2[7].copy(T2[3]); - T2[7].add(Q[7]); // Q[0]+Q[1]+Q[2]+Q[3] - - T3[0] = new ECP8(); - T3[0].copy(Q[8]); // Q[0] - T3[1] = new ECP8(); - T3[1].copy(T3[0]); - T3[1].add(Q[9]); // Q[0]+Q[1] - T3[2] = new ECP8(); - T3[2].copy(T3[0]); - T3[2].add(Q[10]); // Q[0]+Q[2] - T3[3] = new ECP8(); - T3[3].copy(T3[1]); - T3[3].add(Q[10]); // Q[0]+Q[1]+Q[2] - T3[4] = new ECP8(); - T3[4].copy(T3[0]); - T3[4].add(Q[11]); // Q[0]+Q[3] - T3[5] = new ECP8(); - T3[5].copy(T3[1]); - T3[5].add(Q[11]); // Q[0]+Q[1]+Q[3] - T3[6] = new ECP8(); - T3[6].copy(T3[2]); - T3[6].add(Q[11]); // Q[0]+Q[2]+Q[3] - T3[7] = new ECP8(); - T3[7].copy(T3[3]); - T3[7].add(Q[11]); // Q[0]+Q[1]+Q[2]+Q[3] - - T4[0] = new ECP8(); - T4[0].copy(Q[12]); // Q[0] - T4[1] = new ECP8(); - T4[1].copy(T4[0]); - T4[1].add(Q[13]); // Q[0]+Q[1] - T4[2] = new ECP8(); - T4[2].copy(T4[0]); - T4[2].add(Q[14]); // Q[0]+Q[2] - T4[3] = new ECP8(); - T4[3].copy(T4[1]); - T4[3].add(Q[14]); // Q[0]+Q[1]+Q[2] - T4[4] = new ECP8(); - T4[4].copy(T4[0]); - T4[4].add(Q[15]); // Q[0]+Q[3] - T4[5] = new ECP8(); - T4[5].copy(T4[1]); - T4[5].add(Q[15]); // Q[0]+Q[1]+Q[3] - T4[6] = new ECP8(); - T4[6].copy(T4[2]); - T4[6].add(Q[15]); // Q[0]+Q[2]+Q[3] - T4[7] = new ECP8(); - T4[7].copy(T4[3]); - T4[7].add(Q[15]); // Q[0]+Q[1]+Q[2]+Q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - pb3 = 1 - t[8].parity(); - t[8].inc(pb3); - t[8].norm(); - - pb4 = 1 - t[12].parity(); - t[12].inc(pb4); - t[12].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 16; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - s3[nb - 1] = 1; - s4[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - - t[8].fshr(1); - s3[i] = 2 * t[8].parity() - 1; - t[12].fshr(1); - s4[i] = 2 * t[12].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - - w3[i] = 0; - k = 1; - for (j = 9; j < 12; j++) { - bt = s3[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w3[i] += bt * k; - k *= 2; - } - w4[i] = 0; - k = 1; - for (j = 13; j < 16; j++) { - bt = s4[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w4[i] += bt * k; - k *= 2; - } - } - - // Main loop - P.select(T1, 2 * w1[nb - 1] + 1); - W.select(T2, 2 * w2[nb - 1] + 1); - P.add(W); - W.select(T3, 2 * w3[nb - 1] + 1); - P.add(W); - W.select(T4, 2 * w4[nb - 1] + 1); - P.add(W); - for (i = nb - 2; i >= 0; i--) { - P.dbl(); - W.select(T1, 2 * w1[i] + s1[i]); - P.add(W); - W.select(T2, 2 * w2[i] + s2[i]); - P.add(W); - W.select(T3, 2 * w3[i] + s3[i]); - P.add(W); - W.select(T4, 2 * w4[i] + s4[i]); - P.add(W); - } - - // apply correction - W.copy(P); - W.sub(Q[0]); - P.cmove(W, pb1); - - W.copy(P); - W.sub(Q[4]); - P.cmove(W, pb2); - - W.copy(P); - W.sub(Q[8]); - P.cmove(W, pb3); - - W.copy(P); - W.sub(Q[12]); - P.cmove(W, pb4); - - P.affine(); - return P; - }; - - /* return 1 if b==c, no branching */ - ECP8.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* Hunt and Peck a BIG to a curve point - ECP8.hap2point = function(h) - { - var one=new ctx.BIG(1); - var x=new ctx.BIG(h); - var Q,X2,X4,X4; - for (;;) { - X2 = new ctx.FP2(one, x); - X4 = new ctx.FP4(X2); - X8 = new ctx.FP8(X4); - Q = new ECP8(); - Q.setx(X8,0); - if (!Q.is_infinity()) break; - x.inc(1); - x.norm(); - } - return Q; - }; */ - - /* Constant time Map to Point */ - ECP8.map2point = function (H) { - // Shallue and van de Woestijne method. - var sgn, ne; - var NY = new ctx.FP8(1); - var T = new ctx.FP8(H); - sgn = T.sign(); - - var Z = new ctx.FP(ctx.FP.RIADZG2A); - var X1 = new ctx.FP8(Z); - var A = ECP8.RHS(X1); - var W = new ctx.FP8(A); - - W.sqrt(null); - - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_FIELD.SQRTm3); - Z.mul(s); - - T.sqr(); - var Y = new ctx.FP8(A); - Y.mul(T); - T.copy(NY); - T.add(Y); - T.norm(); - Y.rsub(NY); - Y.norm(); - NY.copy(T); - NY.mul(Y); - - NY.tmul(Z); - NY.inverse(null); - - W.tmul(Z); - if (W.sign() == 1) { - W.neg(); - W.norm(); - } - W.tmul(Z); - W.mul(H); - W.mul(Y); - W.mul(NY); - - var X3 = new ctx.FP8(X1); - X1.neg(); - X1.norm(); - X1.div2(); - var X2 = new ctx.FP8(X1); - X1.sub(W); - X1.norm(); - X2.add(W); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - T.sqr(); - T.mul(NY); - T.sqr(); - A.mul(T); - X3.add(A); - X3.norm(); - - Y.copy(ECP8.RHS(X2)); - X3.cmove(X2, Y.qr(null)); - Y.copy(ECP8.RHS(X1)); - X3.cmove(X1, Y.qr(null)); - Y.copy(ECP8.RHS(X3)); - Y.sqrt(null); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var P = new ECP8(); - P.setxy(X3, Y); - return P; - }; - - /* Map octet string to curve point - ECP8.mapit = function(h) - { - var q=new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx=ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - - var Q=ECP8.hap2point(x); - Q.cfp(); - return Q; - }; */ - - ECP8.frob_constants = function () { - var fa = new ctx.BIG(0), - fb = new ctx.BIG(0), - F = [], - X, - F0, - F1, - F2; - - fa.rcopy(ctx.ROM_FIELD.Fra); - fb.rcopy(ctx.ROM_FIELD.Frb); - X = new ctx.FP2(fa, fb); - - F0 = new ctx.FP2(X); - F0.sqr(); - F2 = new ctx.FP2(F0); - F2.mul_ip(); - F2.norm(); - F1 = new ctx.FP2(F2); - F1.sqr(); - F2.mul(F1); - - F2.mul_ip(); - F2.norm(); - - F1.copy(X); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - F1.mul_ip(); - F1.norm(); - F1.inverse(null); - F0.copy(F1); - F0.sqr(); - - F1.mul(F0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - F0.copy(F1); - F0.sqr(); - F1.mul(F0); - F0.mul_ip(); - F0.norm(); - F1.mul_ip(); - F1.norm(); - F1.mul_ip(); - F1.norm(); - } - /* - } - F0.mul_ip(); F0.norm(); - F1.mul(F0); */ - - F[0] = new ctx.FP2(F0); - F[1] = new ctx.FP2(F1); - F[2] = new ctx.FP2(F2); - return F; - }; - - return ECP8; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP8 = ECP8; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ff.js b/packages/bls-verify/src/vendor/amcl-js/src/ff.js deleted file mode 100644 index 772c36c7e..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ff.js +++ /dev/null @@ -1,1024 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE FF number class */ - -var FF = function (ctx) { - 'use strict'; - - /* General purpose Constructor */ - var FF = function (n) { - this.v = new Array(n); - this.length = n; - for (var i = 0; i < n; i++) { - this.v[i] = new ctx.BIG(0); - } - }; - - FF.FFLEN = ctx.config['@ML']; - FF.P_MBITS = ctx.BIG.MODBYTES * 8; - FF.P_OMASK = -1 << FF.P_MBITS % ctx.BIG.BASEBITS; - FF.P_FEXCESS = 1 << (ctx.BIG.BASEBITS * ctx.BIG.NLEN - FF.P_MBITS - 1); - FF.P_TBITS = FF.P_MBITS % ctx.BIG.BASEBITS; - FF.FF_BITS = ctx.BIG.BIGBITS * FF.FFLEN; - FF.HFLEN = FF.FFLEN / 2; /* Useful for half-size RSA private key operations */ - - FF.prototype = { - /* set to zero */ - - P_EXCESS: function () { - return ((this.v[this.length - 1].get(ctx.BIG.NLEN - 1) & FF.P_OMASK) >> FF.P_TBITS) + 1; - }, - - zero: function () { - for (var i = 0; i < this.length; i++) { - this.v[i].zero(); - } - - return this; - }, - - getlen: function () { - return this.length; - }, - - /* set to integer */ - set: function (m) { - this.zero(); - this.v[0].set(0, m & ctx.BIG.BMASK); - this.v[0].set(1, m >> ctx.BIG.BASEBITS); - }, - /* copy from FF b */ - copy: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].copy(b.v[i]); - } - }, - /* copy from FF b */ - rcopy: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].rcopy(b[i]); - } - }, - /* x=y<>n */ - sducopy: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].copy(b.v[this.length + i]); - } - }, - one: function () { - this.v[0].one(); - for (var i = 1; i < this.length; i++) { - this.v[i].zero(); - } - }, - /* test equals 0 */ - iszilch: function () { - for (var i = 0; i < this.length; i++) { - if (!this.v[i].iszilch()) { - return false; - } - } - - return true; - }, - /* shift right by BIGBITS-bit words */ - shrw: function (n) { - for (var i = 0; i < n; i++) { - this.v[i].copy(this.v[i + n]); - this.v[i + n].zero(); - } - }, - - /* shift left by BIGBITS-bit words */ - shlw: function (n) { - for (var i = 0; i < n; i++) { - this.v[n + i].copy(this.v[i]); - this.v[i].zero(); - } - }, - /* extract last bit */ - parity: function () { - return this.v[0].parity(); - }, - - lastbits: function (m) { - return this.v[0].lastbits(m); - }, - - /* recursive add */ - radd: function (vp, x, xp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].copy(x.v[xp + i]); - this.v[vp + i].add(y.v[yp + i]); - } - }, - - /* recursive inc */ - rinc: function (vp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].add(y.v[yp + i]); - } - }, - - /* recursive sub */ - rsub: function (vp, x, xp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].copy(x.v[xp + i]); - this.v[vp + i].sub(y.v[yp + i]); - } - }, - - /* recursive dec */ - rdec: function (vp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].sub(y.v[yp + i]); - } - }, - - /* simple add */ - add: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].add(b.v[i]); - } - }, - - /* simple sub */ - sub: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].sub(b.v[i]); - } - }, - - /* reverse sub */ - revsub: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].rsub(b.v[i]); - } - }, - - /* increment/decrement by a small integer */ - inc: function (m) { - this.v[0].inc(m); - this.norm(); - }, - - dec: function (m) { - this.v[0].dec(m); - this.norm(); - }, - - /* normalise - but hold any overflow in top part unless n<0 */ - rnorm: function (vp, n) { - var trunc = false, - i, - carry; - - if (n < 0) { - /* -v n signals to do truncation */ - n = -n; - trunc = true; - } - - for (i = 0; i < n - 1; i++) { - carry = this.v[vp + i].norm(); - this.v[vp + i].xortop(carry << FF.P_TBITS); - this.v[vp + i + 1].inc(carry); - } - carry = this.v[vp + n - 1].norm(); - - if (trunc) { - this.v[vp + n - 1].xortop(carry << FF.P_TBITS); - } - - return this; - }, - - norm: function () { - this.rnorm(0, this.length); - }, - - /* shift left by one bit */ - shl: function () { - var delay_carry = 0, - i, - carry; - - for (i = 0; i < this.length - 1; i++) { - carry = this.v[i].fshl(1); - this.v[i].inc(delay_carry); - this.v[i].xortop(carry << FF.P_TBITS); - delay_carry = carry; - } - - this.v[this.length - 1].fshl(1); - this.v[this.length - 1].inc(delay_carry); - }, - - /* shift right by one bit */ - shr: function () { - var i, carry; - - for (i = this.length - 1; i > 0; i--) { - carry = this.v[i].fshr(1); - this.v[i - 1].ortop(carry << FF.P_TBITS); - } - - this.v[0].fshr(1); - }, - - /* Convert to Hex String */ - toString: function () { - var s = '', - i; - - this.norm(); - - for (i = this.length - 1; i >= 0; i--) { - s += this.v[i].toString(); - } - - return s; - }, - /* Convert FFs to/from byte arrays */ - toBytes: function (b) { - var i; - - for (i = 0; i < this.length; i++) { - this.v[i].tobytearray(b, (this.length - i - 1) * ctx.BIG.MODBYTES); - } - }, - - /* z=x*y, t is workspace */ - karmul: function (vp, x, xp, y, yp, t, tp, n) { - var nd2, d; - - if (n === 1) { - x.v[xp].norm(); - y.v[yp].norm(); - d = ctx.BIG.mul(x.v[xp], y.v[yp]); - this.v[vp + 1] = d.split(8 * ctx.BIG.MODBYTES); - this.v[vp].copy(d); - - return; - } - - nd2 = n / 2; - this.radd(vp, x, xp, x, xp + nd2, nd2); - this.rnorm(vp, nd2); /* Important - required for 32-bit build */ - this.radd(vp + nd2, y, yp, y, yp + nd2, nd2); - this.rnorm(vp + nd2, nd2); /* Important - required for 32-bit build */ - t.karmul(tp, this, vp, this, vp + nd2, t, tp + n, nd2); - this.karmul(vp, x, xp, y, yp, t, tp + n, nd2); - this.karmul(vp + n, x, xp + nd2, y, yp + nd2, t, tp + n, nd2); - t.rdec(tp, this, vp, n); - t.rdec(tp, this, vp + n, n); - this.rinc(vp + nd2, t, tp, n); - this.rnorm(vp, 2 * n); - }, - - karsqr: function (vp, x, xp, t, tp, n) { - var nd2, d; - - if (n === 1) { - x.v[xp].norm(); - d = ctx.BIG.sqr(x.v[xp]); - this.v[vp + 1].copy(d.split(8 * ctx.BIG.MODBYTES)); - this.v[vp].copy(d); - - return; - } - - nd2 = n / 2; - this.karsqr(vp, x, xp, t, tp + n, nd2); - this.karsqr(vp + n, x, xp + nd2, t, tp + n, nd2); - t.karmul(tp, x, xp, x, xp + nd2, t, tp + n, nd2); - this.rinc(vp + nd2, t, tp, n); - this.rinc(vp + nd2, t, tp, n); - this.rnorm(vp + nd2, n); - }, - - karmul_lower: function (vp, x, xp, y, yp, t, tp, n) { - /* Calculates Least Significant bottom half of x*y */ - var nd2; - - if (n === 1) { - /* only calculate bottom half of product */ - this.v[vp].copy(ctx.BIG.smul(x.v[xp], y.v[yp])); - - return; - } - - nd2 = n / 2; - - this.karmul(vp, x, xp, y, yp, t, tp + n, nd2); - t.karmul_lower(tp, x, xp + nd2, y, yp, t, tp + n, nd2); - this.rinc(vp + nd2, t, tp, nd2); - t.karmul_lower(tp, x, xp, y, yp + nd2, t, tp + n, nd2); - - this.rinc(vp + nd2, t, tp, nd2); - this.rnorm(vp + nd2, -nd2); /* truncate it */ - }, - - karmul_upper: function (x, y, t, n) { - /* Calculates Most Significant upper half of x*y, given lower part */ - var nd2; - - nd2 = n / 2; - this.radd(n, x, 0, x, nd2, nd2); - this.radd(n + nd2, y, 0, y, nd2, nd2); - this.rnorm(n, nd2); - this.rnorm(n + nd2, nd2); - - t.karmul(0, this, n + nd2, this, n, t, n, nd2); /* t = (a0+a1)(b0+b1) */ - this.karmul(n, x, nd2, y, nd2, t, n, nd2); /* z[n]= a1*b1 */ - /* z[0-nd2]=l(a0b0) z[nd2-n]= h(a0b0)+l(t)-l(a0b0)-l(a1b1) */ - t.rdec(0, this, n, n); /* t=t-a1b1 */ - this.rinc(nd2, this, 0, nd2); /* z[nd2-n]+=l(a0b0) = h(a0b0)+l(t)-l(a1b1) */ - this.rdec(nd2, t, 0, nd2); /* z[nd2-n]=h(a0b0)+l(t)-l(a1b1)-l(t-a1b1)=h(a0b0) */ - this.rnorm(0, -n); /* a0b0 now in z - truncate it */ - t.rdec(0, this, 0, n); /* (a0+a1)(b0+b1) - a0b0 */ - this.rinc(nd2, t, 0, n); - - this.rnorm(nd2, n); - }, - - /* return low part of product this*y */ - lmul: function (y) { - var n = this.length, - t = new FF(2 * n), - x = new FF(n); - - x.copy(this); - this.karmul_lower(0, x, 0, y, 0, t, 0, n); - }, - - /* Set b=b mod c */ - mod: function (c) { - var k = 0; - - this.norm(); - if (FF.comp(this, c) < 0) { - return; - } - - do { - c.shl(); - k++; - } while (FF.comp(this, c) >= 0); - - while (k > 0) { - c.shr(); - - if (FF.comp(this, c) >= 0) { - this.sub(c); - this.norm(); - } - - k--; - } - }, - - /* return This mod modulus, N is modulus, ND is Montgomery Constant */ - reduce: function (N, ND) { - /* fast karatsuba Montgomery reduction */ - var n = N.length, - t = new FF(2 * n), - r = new FF(n), - m = new FF(n); - - r.sducopy(this); - m.karmul_lower(0, this, 0, ND, 0, t, 0, n); - this.karmul_upper(N, m, t, n); - m.sducopy(this); - - r.add(N); - r.sub(m); - r.norm(); - - return r; - }, - - /* Set r=this mod b */ - /* this is of length - 2*n */ - /* r,b is of length - n */ - dmod: function (b) { - var n = b.length, - m = new FF(2 * n), - x = new FF(2 * n), - r = new FF(n), - k; - - x.copy(this); - x.norm(); - m.dsucopy(b); - k = ctx.BIG.BIGBITS * n; - - while (FF.comp(x, m) >= 0) { - x.sub(m); - x.norm(); - } - - while (k > 0) { - m.shr(); - - if (FF.comp(x, m) >= 0) { - x.sub(m); - x.norm(); - } - - k--; - } - - r.copy(x); - r.mod(b); - - return r; - }, - - /* Set return=1/this mod p. Binary method - a

= 0) { - u.sub(v); - u.norm(); - - if (FF.comp(x1, x2) >= 0) { - x1.sub(x2); - } else { - t.copy(p); - t.sub(x2); - x1.add(t); - } - - x1.norm(); - } else { - v.sub(u); - v.norm(); - - if (FF.comp(x2, x1) >= 0) { - x2.sub(x1); - } else { - t.copy(p); - t.sub(x1); - x2.add(t); - } - - x2.norm(); - } - } - - if (FF.comp(u, one) === 0) { - this.copy(x1); - } else { - this.copy(x2); - } - }, - - /* nresidue mod m */ - nres: function (m) { - var n = m.length, - d; - - if (n === 1) { - d = new ctx.DBIG(0); - d.hcopy(this.v[0]); - d.shl(ctx.BIG.NLEN * ctx.BIG.BASEBITS); - this.v[0].copy(d.mod(m.v[0])); - } else { - d = new FF(2 * n); - d.dsucopy(this); - this.copy(d.dmod(m)); - } - }, - - redc: function (m, ND) { - var n = m.length, - d; - - if (n === 1) { - d = new ctx.DBIG(0); - d.hcopy(this.v[0]); - this.v[0].copy(ctx.BIG.monty(m.v[0], (1 << ctx.BIG.BASEBITS) - ND.v[0].w[0], d)); - } else { - d = new FF(2 * n); - this.mod(m); - d.dscopy(this); - this.copy(d.reduce(m, ND)); - this.mod(m); - } - }, - - mod2m: function (m) { - for (var i = m; i < this.length; i++) { - this.v[i].zero(); - } - }, - - /* U=1/a mod 2^m - Arazi & Qi */ - invmod2m: function () { - var n = this.length, - b = new FF(n), - c = new FF(n), - U = new FF(n), - t, - i; - - U.zero(); - U.v[0].copy(this.v[0]); - U.v[0].invmod2m(); - - for (i = 1; i < n; i <<= 1) { - b.copy(this); - b.mod2m(i); - t = FF.mul(U, b); - t.shrw(i); - b.copy(t); - c.copy(this); - c.shrw(i); - c.mod2m(i); - c.lmul(U); - c.mod2m(i); - - b.add(c); - b.norm(); - b.lmul(U); - b.mod2m(i); - - c.one(); - c.shlw(i); - b.revsub(c); - b.norm(); - b.shlw(i); - U.add(b); - } - U.norm(); - - return U; - }, - - random: function (rng) { - var n = this.length, - i; - - for (i = 0; i < n; i++) { - this.v[i].copy(ctx.BIG.random(rng)); - } - - /* make sure top bit is 1 */ - while (this.v[n - 1].nbits() < ctx.BIG.MODBYTES * 8) { - this.v[n - 1].copy(ctx.BIG.random(rng)); - } - }, - - /* generate random x */ - randomnum: function (p, rng) { - var n = this.length, - d = new FF(2 * n), - i; - - for (i = 0; i < 2 * n; i++) { - d.v[i].copy(ctx.BIG.random(rng)); - } - - this.copy(d.dmod(p)); - }, - - /* this*=y mod p */ - modmul: function (y, p, nd) { - var ex = this.P_EXCESS(), - ey = y.P_EXCESS(), - n = p.length, - d; - - if (ex + 1 >= Math.floor((FF.P_FEXCESS - 1) / (ey + 1))) { - this.mod(p); - } - - if (n === 1) { - d = ctx.BIG.mul(this.v[0], y.v[0]); - this.v[0].copy(ctx.BIG.monty(p.v[0], (1 << ctx.BIG.BASEBITS) - nd.v[0].w[0], d)); - } else { - d = FF.mul(this, y); - this.copy(d.reduce(p, nd)); - } - }, - - /* this*=y mod p */ - modsqr: function (p, nd) { - var ex = this.P_EXCESS(), - n, - d; - - if (ex + 1 >= Math.floor((FF.P_FEXCESS - 1) / (ex + 1))) { - this.mod(p); - } - n = p.length; - - if (n === 1) { - d = ctx.BIG.sqr(this.v[0]); - this.v[0].copy(ctx.BIG.monty(p.v[0], (1 << ctx.BIG.BASEBITS) - nd.v[0].w[0], d)); - } else { - d = FF.sqr(this); - this.copy(d.reduce(p, nd)); - } - }, - - /* this=this^e mod p using side-channel resistant Montgomery Ladder, for large e */ - skpow: function (e, p) { - var n = p.length, - R0 = new FF(n), - R1 = new FF(n), - ND = p.invmod2m(), - i, - b; - - this.mod(p); - R0.one(); - R1.copy(this); - R0.nres(p); - R1.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES * n - 1; i >= 0; i--) { - b = e.v[Math.floor(i / ctx.BIG.BIGBITS)].bit(i % ctx.BIG.BIGBITS); - - this.copy(R0); - this.modmul(R1, p, ND); - - FF.cswap(R0, R1, b); - R0.modsqr(p, ND); - - R1.copy(this); - FF.cswap(R0, R1, b); - } - - this.copy(R0); - this.redc(p, ND); - }, - - /* this =this^e mod p using side-channel resistant Montgomery Ladder, for short e */ - skspow: function (e, p) { - var n = p.length, - R0 = new FF(n), - R1 = new FF(n), - ND = p.invmod2m(), - i, - b; - - this.mod(p); - R0.one(); - R1.copy(this); - R0.nres(p); - R1.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES - 1; i >= 0; i--) { - b = e.bit(i); - this.copy(R0); - this.modmul(R1, p, ND); - - FF.cswap(R0, R1, b); - R0.modsqr(p, ND); - - R1.copy(this); - FF.cswap(R0, R1, b); - } - this.copy(R0); - this.redc(p, ND); - }, - - /* raise to an integer power - right-to-left method */ - power: function (e, p) { - var n = p.length, - f = true, - w = new FF(n), - ND = p.invmod2m(); - - w.copy(this); - w.nres(p); - - if (e == 2) { - this.copy(w); - this.modsqr(p, ND); - } else { - for (;;) { - if (e % 2 == 1) { - if (f) { - this.copy(w); - } else { - this.modmul(w, p, ND); - } - f = false; - } - e >>= 1; - if (e === 0) { - break; - } - w.modsqr(p, ND); - } - } - - this.redc(p, ND); - }, - - /* this=this^e mod p, faster but not side channel resistant */ - pow: function (e, p) { - var n = p.length, - w = new FF(n), - ND = p.invmod2m(), - i, - b; - - w.copy(this); - this.one(); - this.nres(p); - w.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES * n - 1; i >= 0; i--) { - this.modsqr(p, ND); - b = e.v[Math.floor(i / ctx.BIG.BIGBITS)].bit(i % ctx.BIG.BIGBITS); - if (b === 1) { - this.modmul(w, p, ND); - } - } - - this.redc(p, ND); - }, - - /* double exponentiation r=x^e.y^f mod p */ - pow2: function (e, y, f, p) { - var n = p.length, - xn = new FF(n), - yn = new FF(n), - xy = new FF(n), - ND = p.invmod2m(), - i, - eb, - fb; - - xn.copy(this); - yn.copy(y); - xn.nres(p); - yn.nres(p); - xy.copy(xn); - xy.modmul(yn, p, ND); - this.one(); - this.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES - 1; i >= 0; i--) { - eb = e.bit(i); - fb = f.bit(i); - this.modsqr(p, ND); - - if (eb == 1) { - if (fb == 1) { - this.modmul(xy, p, ND); - } else { - this.modmul(xn, p, ND); - } - } else { - if (fb == 1) { - this.modmul(yn, p, ND); - } - } - } - this.redc(p, ND); - }, - - /* quick and dirty check for common factor with n */ - cfactor: function (s) { - var n = this.length, - x = new FF(n), - y = new FF(n), - r, - g; - - y.set(s); - - x.copy(this); - x.norm(); - - do { - x.sub(y); - x.norm(); - while (!x.iszilch() && x.parity() === 0) { - x.shr(); - } - } while (FF.comp(x, y) > 0); - - g = x.v[0].get(0); - r = FF.igcd(s, g); - if (r > 1) { - return true; - } - - return false; - }, - }; - - /* compare x and y - must be normalised, and of same length */ - FF.comp = function (a, b) { - var i, j; - - for (i = a.length - 1; i >= 0; i--) { - j = ctx.BIG.comp(a.v[i], b.v[i]); - if (j !== 0) { - return j; - } - } - - return 0; - }; - - FF.fromBytes = function (x, b) { - var i; - - for (i = 0; i < x.length; i++) { - x.v[i] = ctx.BIG.frombytearray(b, (x.length - i - 1) * ctx.BIG.MODBYTES); - } - }; - - /* in-place swapping using xor - side channel resistant - lengths must be the same */ - FF.cswap = function (a, b, d) { - var i; - - for (i = 0; i < a.length; i++) { - a.v[i].cswap(b.v[i], d); - } - }; - - /* z=x*y. Assumes x and y are of same length. */ - FF.mul = function (x, y) { - var n = x.length, - z = new FF(2 * n), - t = new FF(2 * n); - - z.karmul(0, x, 0, y, 0, t, 0, n); - - return z; - }; - - /* z=x^2 */ - FF.sqr = function (x) { - var n = x.length, - z = new FF(2 * n), - t = new FF(2 * n); - - z.karsqr(0, x, 0, t, 0, n); - - return z; - }; - - FF.igcd = function (x, y) { - /* integer GCD, returns GCD of x and y */ - var r; - - if (y === 0) { - return x; - } - - while ((r = x % y) !== 0) { - x = y; - y = r; - } - - return y; - }; - - /* Miller-Rabin test for primality. Slow. */ - FF.prime = function (p, rng) { - var n = p.length, - s = 0, - loop, - d = new FF(n), - x = new FF(n), - unity = new FF(n), - nm1 = new FF(n), - sf = 4849845 /* 3*5*.. *19 */, - i, - j; - - p.norm(); - - if (p.cfactor(sf)) { - return false; - } - - unity.one(); - nm1.copy(p); - nm1.sub(unity); - nm1.norm(); - d.copy(nm1); - - while (d.parity() === 0) { - d.shr(); - s++; - } - - if (s === 0) { - return false; - } - - for (i = 0; i < 10; i++) { - x.randomnum(p, rng); - x.pow(d, p); - - if (FF.comp(x, unity) === 0 || FF.comp(x, nm1) === 0) { - continue; - } - - loop = false; - - for (j = 1; j < s; j++) { - x.power(2, p); - - if (FF.comp(x, unity) === 0) { - return false; - } - - if (FF.comp(x, nm1) === 0) { - loop = true; - break; - } - } - if (loop) { - continue; - } - - return false; - } - - return true; - }; - - return FF; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FF: FF, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp.js b/packages/bls-verify/src/vendor/amcl-js/src/fp.js deleted file mode 100644 index 2dee274e0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp.js +++ /dev/null @@ -1,833 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic */ -/* CORE mod p functions */ - -var FP = function (ctx) { - 'use strict'; - - /* General purpose Constructor */ - var FP = function (x) { - if (x instanceof FP) { - this.f = new ctx.BIG(x.f); - this.XES = x.XES; - } else { - if (x instanceof ctx.BIG) { - this.f = new ctx.BIG(x); - } else { - if (x < 0) { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - m.inc(x); - m.norm(); - this.f = new ctx.BIG(m); - } else { - this.f = new ctx.BIG(x); - } - } - this.XES = 1; - //if (x!=0) - if (!this.f.iszilch()) this.nres(); - } - }; - - FP.NOT_SPECIAL = 0; - FP.PSEUDO_MERSENNE = 1; - FP.GENERALISED_MERSENNE = 2; - FP.MONTGOMERY_FRIENDLY = 3; - - FP.ZERO = 0; - FP.ONE = 1; - FP.SPARSEST = 2; - FP.SPARSER = 3; - FP.SPARSE = 4; - FP.DENSE = 5; - - FP.NEGATOWER = 0; - FP.POSITOWER = 1; - - FP.MODBITS = ctx.config['@NBT']; - FP.PM1D2 = ctx.config['@M8']; - FP.RIADZ = ctx.config['@RZ']; - FP.RIADZG2A = ctx.config['@RZ2A']; - FP.RIADZG2B = ctx.config['@RZ2B']; - FP.MODTYPE = ctx.config['@MT']; - FP.QNRI = ctx.config['@QI']; - FP.TOWER = ctx.config['@TW']; - - FP.FEXCESS = (1 << ctx.config['@SH']) - 1; // 2^(BASEBITS*NLEN-MODBITS)-1 - FP.OMASK = -1 << FP.TBITS; - FP.TBITS = FP.MODBITS % ctx.BIG.BASEBITS; - FP.TMASK = (1 << FP.TBITS) - 1; - - FP.BIG_ENDIAN_SIGN = false; - - FP.prototype = { - /* set this=0 */ - zero: function () { - this.XES = 1; - this.f.zero(); - }, - - /* copy from a ctx.BIG in ROM */ - rcopy: function (y) { - this.f.rcopy(y); - this.nres(); - }, - - /* copy from another ctx.BIG */ - bcopy: function (y) { - this.f.copy(y); - this.nres(); - }, - - /* copy from another FP */ - copy: function (y) { - this.XES = y.XES; - this.f.copy(y.f); - }, - - /* conditional swap of a and b depending on d */ - cswap: function (b, d) { - this.f.cswap(b.f, d); - var t, - c = d; - c = ~(c - 1); - t = c & (this.XES ^ b.XES); - this.XES ^= t; - b.XES ^= t; - }, - - /* conditional copy of b to a depending on d */ - cmove: function (b, d) { - var c = d; - - c = ~(c - 1); - - this.f.cmove(b.f, d); - this.XES ^= (this.XES ^ b.XES) & c; - }, - - /* convert to Montgomery n-residue form */ - nres: function () { - var r, d; - - if (FP.MODTYPE != FP.PSEUDO_MERSENNE && FP.MODTYPE != FP.GENERALISED_MERSENNE) { - r = new ctx.BIG(); - r.rcopy(ctx.ROM_FIELD.R2modp); - - d = ctx.BIG.mul(this.f, r); - this.f.copy(FP.mod(d)); - this.XES = 2; - } else { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - this.f.mod(m); - this.XES = 1; - } - - return this; - }, - - /* convert back to regular form */ - redc: function () { - var r = new ctx.BIG(0), - d, - w; - - r.copy(this.f); - - if (FP.MODTYPE != FP.PSEUDO_MERSENNE && FP.MODTYPE != FP.GENERALISED_MERSENNE) { - d = new ctx.DBIG(0); - d.hcopy(this.f); - w = FP.mod(d); - r.copy(w); - } - - return r; - }, - - /* convert this to string */ - toString: function () { - var s = this.redc().toString(); - return s; - }, - - /* test this=0 */ - iszilch: function () { - var c = new FP(0); - c.copy(this); - c.reduce(); - return c.f.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return; - var sx = new ctx.BIG(0); - sx.rcopy(ctx.ROM_FIELD.Modulus); - var fx = this.redc(); - sx.sub(fx); - sx.norm(); - return ctx.BIG.comp(fx, sx); - }, - - toBytes: function (b) { - this.redc().toBytes(b); - }, - - /* test this=1 */ - isunity: function () { - var c = new FP(0); - c.copy(this); - c.reduce(); - return c.redc().isunity(); - }, - - sign: function () { - if (FP.BIG_ENDIAN_SIGN) { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - m.dec(1); - m.fshr(1); - var n = new FP(0); - n.copy(this); - n.reduce(); - var w = n.redc(); - var cp = ctx.BIG.comp(w, m); - return ((cp + 1) & 2) >> 1; - } else { - var c = new FP(0); - c.copy(this); - c.reduce(); - return c.redc().parity(); - } - }, - - /* reduce this mod Modulus */ - reduce: function () { - var q, - carry, - sr, - sb, - m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_FIELD.Modulus); - this.f.norm(); - - if (this.XES > 16) { - q = FP.quo(this.f, m); - carry = r.pmul(q); - r.w[ctx.BIG.NLEN - 1] += carry << ctx.BIG.BASEBITS; // correction - put any carry out back in again - this.f.sub(r); - this.f.norm(); - sb = 2; - } else { - sb = FP.logb2(this.XES - 1); - } - m.fshl(sb); - - while (sb > 0) { - // constant time... - sr = ctx.BIG.ssn(r, this.f, m); // optimized combined shift, subtract and norm - this.f.cmove(r, 1 - sr); - sb--; - } - - this.XES = 1; - }, - - /* set this=1 */ - one: function () { - this.f.one(); - this.nres(); - }, - - /* normalise this */ - norm: function () { - return this.f.norm(); - }, - - /* this*=b mod Modulus */ - mul: function (b) { - var d; - - if (this.XES * b.XES > FP.FEXCESS) { - this.reduce(); - } - - d = ctx.BIG.mul(this.f, b.f); - this.f.copy(FP.mod(d)); - this.XES = 2; - - return this; - }, - - /* this*=c mod Modulus where c is an int */ - imul: function (c) { - var s = false, - d, - n; - - if (c < 0) { - c = -c; - s = true; - } - - if (FP.MODTYPE == FP.PSEUDO_MERSENNE || FP.MODTYPE == FP.GENERALISED_MERSENNE) { - d = this.f.pxmul(c); - this.f.copy(FP.mod(d)); - this.XES = 2; - } else { - if (this.XES * c <= FP.FEXCESS) { - this.f.pmul(c); - this.XES *= c; - } else { - n = new FP(c); - this.mul(n); - } - } - - if (s) { - this.neg(); - this.norm(); - } - return this; - }, - - /* this*=this mod Modulus */ - sqr: function () { - var d, t; - - if (this.XES * this.XES > FP.FEXCESS) { - this.reduce(); - } - - d = ctx.BIG.sqr(this.f); - t = FP.mod(d); - this.f.copy(t); - this.XES = 2; - - return this; - }, - - /* this+=b */ - add: function (b) { - this.f.add(b.f); - this.XES += b.XES; - - if (this.XES > FP.FEXCESS) { - this.reduce(); - } - - return this; - }, - /* this=-this mod Modulus */ - neg: function () { - var m = new ctx.BIG(0), - sb; - - m.rcopy(ctx.ROM_FIELD.Modulus); - - sb = FP.logb2(this.XES - 1); - - m.fshl(sb); - this.XES = (1 << sb) + 1; - this.f.rsub(m); - - if (this.XES > FP.FEXCESS) { - this.reduce(); - } - - return this; - }, - - /* this-=b */ - sub: function (b) { - var n = new FP(0); - - n.copy(b); - n.neg(); - this.add(n); - - return this; - }, - - rsub: function (b) { - var n = new FP(0); - - n.copy(this); - n.neg(); - this.copy(b); - this.add(n); - }, - - /* this/=2 mod Modulus */ - div2: function () { - var p; - p = new ctx.BIG(0); - p.rcopy(ctx.ROM_FIELD.Modulus); - var pr = this.f.parity(); - var w = new ctx.BIG(0); - w.copy(this.f); - this.f.fshr(1); - w.add(p); - w.norm(); - w.fshr(1); - this.f.cmove(w, pr); - return this; - }, - - /* return jacobi symbol (this/Modulus) */ - jacobi: function () { - var p = new ctx.BIG(0), - w = this.redc(); - - p.rcopy(ctx.ROM_FIELD.Modulus); - - return w.jacobi(p); - }, - - /* return TRUE if this==a */ - equals: function (a) { - var ft = new FP(0); - ft.copy(this); - var sd = new FP(0); - sd.copy(a); - ft.reduce(); - sd.reduce(); - - if (ctx.BIG.comp(ft.f, sd.f) === 0) { - return true; - } - - return false; - }, - - /* return this^e mod Modulus */ - pow: function (e) { - var i, - w = [], - tb = [], - t = new ctx.BIG(e), - nb, - lsbs, - r; - this.norm(); - t.norm(); - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - for (i = 0; i < nb; i++) { - lsbs = t.lastbits(4); - t.dec(lsbs); - t.norm(); - w[i] = lsbs; - t.fshr(4); - } - tb[0] = new FP(1); - tb[1] = new FP(this); - for (i = 2; i < 16; i++) { - tb[i] = new FP(tb[i - 1]); - tb[i].mul(this); - } - r = new FP(tb[w[nb - 1]]); - for (i = nb - 2; i >= 0; i--) { - r.sqr(); - r.sqr(); - r.sqr(); - r.sqr(); - r.mul(tb[w[i]]); - } - r.reduce(); - return r; - }, - - // return this^(p-3)/4 or this^(p-5)/8 - // See https://eprint.iacr.org/2018/1038 - fpow: function () { - var i, j, k, bw, w, c, nw, lo, m, n, nd, e; - var xp = []; - var ac = [1, 2, 3, 6, 12, 15, 30, 60, 120, 240, 255]; - // phase 1 - - xp[0] = new FP(this); // 1 - xp[1] = new FP(this); - xp[1].sqr(); // 2 - xp[2] = new FP(xp[1]); - xp[2].mul(this); //3 - xp[3] = new FP(xp[2]); - xp[3].sqr(); // 6 - xp[4] = new FP(xp[3]); - xp[4].sqr(); // 12 - xp[5] = new FP(xp[4]); - xp[5].mul(xp[2]); // 15 - xp[6] = new FP(xp[5]); - xp[6].sqr(); // 30 - xp[7] = new FP(xp[6]); - xp[7].sqr(); // 60 - xp[8] = new FP(xp[7]); - xp[8].sqr(); // 120 - xp[9] = new FP(xp[8]); - xp[9].sqr(); // 240 - xp[10] = new FP(xp[9]); - xp[10].mul(xp[5]); // 255 - - n = FP.MODBITS; - if (FP.MODTYPE == FP.GENERALISED_MERSENNE) - // Goldilocks ONLY - n /= 2; - - e = FP.PM1D2; - - n -= e + 1; - c = (ctx.ROM_FIELD.MConst + (1 << e) + 1) / (1 << (e + 1)); - - nd = 0; - while (c % 2 == 0) { - c /= 2; - n -= 1; - nd++; - } - - bw = 0; - w = 1; - while (w < c) { - w *= 2; - bw += 1; - } - k = w - c; - - i = 10; - var key = new FP(0); - if (k != 0) { - while (ac[i] > k) i--; - key.copy(xp[i]); - k -= ac[i]; - } - while (k != 0) { - i--; - if (ac[i] > k) continue; - key.mul(xp[i]); - k -= ac[i]; - } - - // phase 2 - xp[1].copy(xp[2]); - xp[2].copy(xp[5]); - xp[3].copy(xp[10]); - - j = 3; - m = 8; - nw = n - bw; - var t = new FP(0); - while (2 * m < nw) { - t.copy(xp[j++]); - for (i = 0; i < m; i++) t.sqr(); - xp[j].copy(xp[j - 1]); - xp[j].mul(t); - m *= 2; - } - lo = nw - m; - var r = new FP(xp[j]); - - while (lo != 0) { - m /= 2; - j--; - if (lo < m) continue; - lo -= m; - t.copy(r); - for (i = 0; i < m; i++) t.sqr(); - r.copy(t); - r.mul(xp[j]); - } - - // phase 3 - if (bw != 0) { - for (i = 0; i < bw; i++) r.sqr(); - r.mul(key); - } - - if (FP.MODTYPE == FP.GENERALISED_MERSENNE) { - // Goldilocks ONLY - key.copy(r); - r.sqr(); - r.mul(this); - for (i = 0; i < n + 1; i++) r.sqr(); - r.mul(key); - } - - for (i = 0; i < nd; i++) r.sqr(); - - return r; - }, - - // calculates r=x^(p-1-2^e)/2^{e+1) where 2^e|p-1 - progen: function () { - if (FP.MODTYPE == FP.PSEUDO_MERSENNE || FP.MODTYPE == FP.GENERALISED_MERSENNE) { - this.copy(this.fpow()); - return; - } - var e = FP.PM1D2; - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - m.dec(1); - m.shr(e); - m.dec(1); - m.fshr(1); - - this.copy(this.pow(m)); - }, - - /* this=1/this mod Modulus */ - inverse: function (h) { - var e = FP.PM1D2; - this.norm(); - var s = new FP(this); - for (var i = 0; i < e - 1; i++) { - s.sqr(); - s.mul(this); - } - if (h == null) this.progen(); - else this.copy(h); - - for (var i = 0; i <= e; i++) this.sqr(); - this.mul(s); - this.reduce(); - return this; - }, - - // Calculate both inverse and square root of x, return QR - invsqrt: function (i, s) { - var h = new FP(0); - var qr = this.qr(h); - s.copy(this.sqrt(h)); - i.copy(this); - i.inverse(h); - return qr; - }, - - /* test for Quadratic residue */ - qr: function (h) { - var r = new FP(this); - var e = FP.PM1D2; - r.progen(); - if (h != null) h.copy(r); - - r.sqr(); - r.mul(this); - for (var i = 0; i < e - 1; i++) r.sqr(); - - return r.isunity() ? 1 : 0; - }, - - /* return sqrt(this) mod Modulus */ - sqrt: function (h) { - var e = FP.PM1D2; - var g = new FP(this); - if (h == null) g.progen(); - else g.copy(h); - - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.ROI); - - var v = new FP(m); - - var t = new FP(g); - t.sqr(); - t.mul(this); - - var r = new FP(this); - r.mul(g); - var b = new FP(t); - - for (var k = e; k > 1; k--) { - for (var j = 1; j < k - 1; j++) b.sqr(); - var u = b.isunity() ? 0 : 1; - g.copy(r); - g.mul(v); - r.cmove(g, u); - v.sqr(); - g.copy(t); - g.mul(v); - t.cmove(g, u); - b.copy(t); - } - var sgn = r.sign(); - var nr = new FP(r); - nr.neg(); - nr.norm(); - r.cmove(nr, sgn); - return r; - }, - }; - - // Two for the price of One - See Hamburg https://eprint.iacr.org/2012/309.pdf - // Calculate inverse of i and square root of s, return QR - FP.tpo = function (i, s) { - var w = new FP(s); - var t = new FP(i); - w.mul(i); - t.mul(w); - var qr = t.invsqrt(i, s); - i.mul(w); - s.mul(i); - return qr; - }; - - FP.fromBytes = function (b) { - var t = ctx.BIG.fromBytes(b); - return new FP(t); - }; - - FP.rand = function (rng) { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - var w = ctx.BIG.randomnum(m, rng); - return new FP(w); - }; - - FP.logb2 = function (v) { - var r; - - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - - v = v - ((v >>> 1) & 0x55555555); - v = (v & 0x33333333) + ((v >>> 2) & 0x33333333); - r = (((v + (v >>> 4)) & 0xf0f0f0f) * 0x1010101) >>> 24; - - return r; - }; - - FP.quo = function (n, m) { - var num, - den, - hb = ctx.BIG.CHUNK >> 1; - if (FP.TBITS < hb) { - var sh = hb - FP.TBITS; - num = (n.w[ctx.BIG.NLEN - 1] << sh) | (n.w[ctx.BIG.NLEN - 2] >> (ctx.BIG.BASEBITS - sh)); - den = (m.w[ctx.BIG.NLEN - 1] << sh) | (m.w[ctx.BIG.NLEN - 2] >> (ctx.BIG.BASEBITS - sh)); - } else { - num = n.w[ctx.BIG.NLEN - 1]; - den = m.w[ctx.BIG.NLEN - 1]; - } - return Math.floor(num / (den + 1)); - }; - - /* reduce a ctx.DBIG to a ctx.BIG using a "special" modulus */ - FP.mod = function (d) { - var b = new ctx.BIG(0), - i, - t, - v, - tw, - tt, - lo, - carry, - m, - dd; - - if (FP.MODTYPE == FP.PSEUDO_MERSENNE) { - t = d.split(FP.MODBITS); - b.hcopy(d); - - if (ctx.ROM_FIELD.MConst != 1) { - v = t.pmul(ctx.ROM_FIELD.MConst); - } else { - v = 0; - } - - t.add(b); - t.norm(); - - tw = t.w[ctx.BIG.NLEN - 1]; - t.w[ctx.BIG.NLEN - 1] &= FP.TMASK; - t.inc(ctx.ROM_FIELD.MConst * ((tw >> FP.TBITS) + (v << (ctx.BIG.BASEBITS - FP.TBITS)))); - // b.add(t); - t.norm(); - - return t; - } - - if (FP.MODTYPE == FP.MONTGOMERY_FRIENDLY) { - for (i = 0; i < ctx.BIG.NLEN; i++) { - d.w[ctx.BIG.NLEN + i] += d.muladd( - d.w[i], - ctx.ROM_FIELD.MConst - 1, - d.w[i], - ctx.BIG.NLEN + i - 1, - ); - } - - for (i = 0; i < ctx.BIG.NLEN; i++) { - b.w[i] = d.w[ctx.BIG.NLEN + i]; - } - - b.norm(); - } - - if (FP.MODTYPE == FP.GENERALISED_MERSENNE) { - // GoldiLocks Only - t = d.split(FP.MODBITS); - b.hcopy(d); - b.add(t); - dd = new ctx.DBIG(0); - dd.hcopy(t); - dd.shl(FP.MODBITS / 2); - - tt = dd.split(FP.MODBITS); - lo = new ctx.BIG(); - lo.hcopy(dd); - - b.add(tt); - b.add(lo); - //b.norm(); - tt.shl(FP.MODBITS / 2); - b.add(tt); - - carry = b.w[ctx.BIG.NLEN - 1] >> FP.TBITS; - b.w[ctx.BIG.NLEN - 1] &= FP.TMASK; - b.w[0] += carry; - - b.w[Math.floor(224 / ctx.BIG.BASEBITS)] += carry << 224 % ctx.BIG.BASEBITS; - b.norm(); - } - - if (FP.MODTYPE == FP.NOT_SPECIAL) { - m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - - b.copy(ctx.BIG.monty(m, ctx.ROM_FIELD.MConst, d)); - } - - return b; - }; - - return FP; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP: FP, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp12.js b/packages/bls-verify/src/vendor/amcl-js/src/fp12.js deleted file mode 100644 index 3c1c3f016..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp12.js +++ /dev/null @@ -1,1069 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Fp^12 functions */ - -/* FP12 elements are of the form a+i.b+i^2.c */ - -var FP12 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP12 = function (d, e, f) { - /* - if (!isNaN(d)) - { - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(0); - this.c = new ctx.FP4(0); - if (d==1) this.stype=ctx.FP.ONE; - else this.stype=ctx.FP.SPARSEST; - } - else - { - if (d instanceof FP12) { - this.a = new ctx.FP4(d.a); - this.b = new ctx.FP4(d.b); - this.c = new ctx.FP4(d.c); - } else { - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(e); - this.c = new ctx.FP4(f); - } - this.stype=ctx.FP.DENSE; - } -*/ - if (d instanceof FP12) { - // ignore e, d, which are assumed be undefined in this case - this.a = new ctx.FP4(d.a); - this.b = new ctx.FP4(d.b); - this.c = new ctx.FP4(d.c); - this.stype = ctx.FP.DENSE; - } else if (typeof d !== 'undefined' && typeof e !== 'undefined' && typeof f !== 'undefined') { - // all 3 components set to (can be anything that the FP4 constructor supports) - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(e); - this.c = new ctx.FP4(f); - this.stype = ctx.FP.DENSE; - } else if (typeof d === 'number') { - // first component is number - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(0); - this.c = new ctx.FP4(0); - if (d == 1) this.stype = ctx.FP.ONE; - else this.stype = ctx.FP.SPARSER; - } else { - // other cases, including `new ctx.FP12()` fall back to zero - this.a = new ctx.FP4(0); - this.b = new ctx.FP4(0); - this.c = new ctx.FP4(0); - this.stype = ctx.FP.ZERO; - } - }; - - FP12.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - this.c.reduce(); - }, - - /* normalize all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - this.c.norm(); - }, - - /* test x==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch() && this.c.iszilch(); - }, - - /* test x==1 ? */ - isunity: function () { - var one = new ctx.FP4(1); - return this.a.equals(one) && this.b.iszilch() && this.c.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - this.c.cmove(g.c, d); - d = ~(d - 1); - this.stype ^= (this.stype ^ g.stype) & d; - }, - - /* Constant time select from pre-computed table */ - select: function (g, b) { - var invf = new FP12(0), - m, - babs; - - m = b >> 31; - babs = (b ^ m) - m; - babs = (babs - 1) / 2; - - this.cmove(g[0], FP12.teq(babs, 0)); // conditional move - this.cmove(g[1], FP12.teq(babs, 1)); - this.cmove(g[2], FP12.teq(babs, 2)); - this.cmove(g[3], FP12.teq(babs, 3)); - this.cmove(g[4], FP12.teq(babs, 4)); - this.cmove(g[5], FP12.teq(babs, 5)); - this.cmove(g[6], FP12.teq(babs, 6)); - this.cmove(g[7], FP12.teq(babs, 7)); - - invf.copy(this); - invf.conj(); - this.cmove(invf, m & 1); - }, - - settype: function (w) { - this.stype = w; - }, - - gettype: function () { - return this.stype; - }, - - /* extract a from this */ - geta: function () { - return this.a; - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - /* extract c */ - getc: function () { - return this.c; - }, - - /* return 1 if x==y, else 0 */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b) && this.c.equals(x.c); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - this.c.copy(x.c); - this.stype = x.stype; - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ONE; - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ZERO; - }, - - /* this=conj(this) */ - conj: function () { - this.a.conj(); - this.b.nconj(); - this.c.conj(); - }, - - /* set this from 3 FP4s */ - set: function (d, e, f) { - this.a.copy(d); - this.b.copy(e); - this.c.copy(f); - this.stype = ctx.FP.DENSE; - }, - - /* set this from one ctx.FP4 */ - seta: function (d) { - this.a.copy(d); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.SPARSEST; - }, - - /* Granger-Scott Unitary Squaring */ - usqr: function () { - var A = new ctx.FP4(this.a), - B = new ctx.FP4(this.c), - C = new ctx.FP4(this.b), - D = new ctx.FP4(0); - - this.a.sqr(); - D.copy(this.a); - D.add(this.a); - this.a.add(D); - - A.nconj(); - - A.add(A); - this.a.add(A); - B.sqr(); - B.times_i(); - - D.copy(B); - D.add(B); - B.add(D); - - C.sqr(); - D.copy(C); - D.add(C); - C.add(D); - - this.b.conj(); - this.b.add(this.b); - this.c.nconj(); - - this.c.add(this.c); - this.b.add(B); - this.c.add(C); - this.stype = ctx.FP.DENSE; - this.reduce(); - }, - - /* Chung-Hasan SQR2 method from http://cacr.uwaterloo.ca/techreports/2006/cacr2006-24.pdf */ - sqr: function () { - if (this.stype == ctx.FP.ONE) return; - - var A = new ctx.FP4(this.a), - B = new ctx.FP4(this.b), - C = new ctx.FP4(this.c), - D = new ctx.FP4(this.a); - - A.sqr(); - B.mul(this.c); - B.add(B); - C.sqr(); - D.mul(this.b); - D.add(D); - - this.c.add(this.a); - this.c.add(this.b); - this.c.norm(); - this.c.sqr(); - - this.a.copy(A); - - A.add(B); - A.add(C); - A.add(D); - A.neg(); - B.times_i(); - C.times_i(); - - this.a.add(B); - this.b.copy(C); - this.b.add(D); - this.c.add(A); - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) this.stype = ctx.FP.SPARSE; - else this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP12 full multiplication this=this*y */ - mul: function (y) { - var z0 = new ctx.FP4(this.a), - z1 = new ctx.FP4(0), - z2 = new ctx.FP4(this.b), - z3 = new ctx.FP4(0), - t0 = new ctx.FP4(this.a), - t1 = new ctx.FP4(y.a); - - z0.mul(y.a); - z2.mul(y.b); - - t0.add(this.b); - t1.add(y.b); - - t0.norm(); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - - t1.copy(y.b); - t1.add(y.c); - - t0.norm(); - t1.norm(); - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t1.copy(y.a); - t1.add(y.c); - - t0.norm(); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - t0.copy(this.c); - t0.mul(y.c); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP12 multiplication w=w*y */ - /* catering for special case that arises from special form of ATE pairing line function */ - /* w and y are both sparser line functions - cost = 6m */ - smul: function (y) { - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - var w1 = new ctx.FP2(this.a.geta()); - var w2 = new ctx.FP2(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.b.geta().geta()); - t.mul(y.b.geta().geta()); - w3 = new ctx.FP2(t); - } else { - if (y.stype != ctx.FP.SPARSEST) { - w3 = new ctx.FP2(y.b.geta()); - w3.pmul(this.b.geta().geta()); - } else { - w3 = new ctx.FP2(this.b.geta()); - w3.pmul(y.b.geta().geta()); - } - } - } else { - w3 = new ctx.FP2(this.b.geta()); - w3.mul(y.b.geta()); - } - - var ta = new ctx.FP2(this.a.geta()); - var tb = new ctx.FP2(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP2(ta); - tc.mul(tb); - var t = new ctx.FP2(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.b.geta()); - tb.norm(); - var td = new ctx.FP2(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.b.geta()); - tb.norm(); - var te = new ctx.FP2(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.mul_ip(); - w1.add(w2); - - this.a.geta().copy(w1); - this.a.getb().copy(tc); - this.b.geta().copy(td); - this.b.getb().copy(te); - this.c.geta().copy(w3); - this.c.getb().zero(); - - this.a.norm(); - this.b.norm(); - } else { - var w1 = new ctx.FP2(this.a.geta()); - var w2 = new ctx.FP2(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.c.getb().geta()); - t.mul(y.c.getb().geta()); - w3 = new ctx.FP2(t); - } else { - if (y.type != ctx.FP.SPARSEST) { - w3 = new ctx.FP2(y.c.getb()); - w3.pmul(this.c.getb().geta()); - } else { - w3 = new ctx.FP2(this.c.getb()); - w3.pmul(y.c.getb().geta()); - } - } - } else { - w3 = new ctx.FP2(this.c.getb()); - w3.mul(y.c.getb()); - } - - var ta = new ctx.FP2(this.a.geta()); - var tb = new ctx.FP2(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP2(ta); - tc.mul(tb); - var t = new ctx.FP2(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.c.getb()); - tb.norm(); - var td = new ctx.FP2(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.c.getb()); - tb.norm(); - var te = new ctx.FP2(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.mul_ip(); - w1.add(w2); - this.a.geta().copy(w1); - this.a.getb().copy(tc); - - w3.mul_ip(); - w3.norm(); - this.b.geta().zero(); - this.b.getb().copy(w3); - - te.norm(); - te.mul_ip(); - this.c.geta().copy(te); - this.c.getb().copy(td); - - this.a.norm(); - this.c.norm(); - } - this.stype = ctx.FP.SPARSE; - }, - - /* FP12 full multiplication w=w*y */ - /* Supports sparse multiplicands */ - /* Usually w is denser than y */ - ssmul: function (y) { - if (this.stype == ctx.FP.ONE) { - this.copy(y); - return; - } - if (y.stype == ctx.FP.ONE) return; - - if (y.stype >= ctx.FP.SPARSE) { - var z0 = new ctx.FP4(this.a); - var z1 = new ctx.FP4(0); - var z2 = new ctx.FP4(0); - var z3 = new ctx.FP4(0); - z0.mul(y.a); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - z2.getb().copy(this.b.getb()); - z2.getb().mul(y.b.getb()); - z2.geta().zero(); - if (y.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.getb()); - z2.geta().mul(y.b.geta()); - } - if (this.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.geta()); - z2.geta().mul(y.b.getb()); - } - z2.times_i(); - } else { - z2.copy(this.b); - z2.mul(y.b); - } - } else { - z2.copy(this.b); - z2.mul(y.b); - } - var t0 = new ctx.FP4(this.a); - var t1 = new ctx.FP4(y.a); - t0.add(this.b); - t0.norm(); - t1.add(y.b); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - t1.copy(y.b); - t1.add(y.c); - t1.norm(); - - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - t0.geta().copy(this.c.geta()); - t0.geta().mul(y.c.geta()); - t0.getb().zero(); - if (y.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.geta()); - t0.getb().mul(y.c.getb()); - } - if (this.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.getb()); - t0.getb().mul(y.c.geta()); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } else { - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) { - this.smul(y); - return; - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - // dense by sparser - 13m - var z0 = new ctx.FP4(this.a); - var z2 = new ctx.FP4(this.b); - var z3 = new ctx.FP4(this.b); - var t0 = new ctx.FP4(0); - var t1 = new ctx.FP4(y.a); - z0.mul(y.a); - - if (y.stype == ctx.FP.SPARSEST) z2.qmul(y.b.geta().geta()); - else z2.pmul(y.b.geta()); - - this.b.add(this.a); - t1.real().add(y.b.geta()); - - t1.norm(); - this.b.norm(); - this.b.mul(t1); - z3.add(this.c); - z3.norm(); - if (y.stype == ctx.FP.SPARSEST) z3.qmul(y.b.geta().geta()); - else z3.pmul(y.b.geta()); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - this.b.add(t0); - - this.b.add(t1); - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - z3.norm(); - t0.mul(y.a); - this.c.copy(z2); - this.c.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - var z0 = new ctx.FP4(this.a); - var z1 = new ctx.FP4(0); - var z2 = new ctx.FP4(0); - var z3 = new ctx.FP4(0); - var t0 = new ctx.FP4(this.a); - var t1 = new ctx.FP4(0); - - z0.mul(y.a); - t0.add(this.b); - t0.norm(); - - z1.copy(t0); - z1.mul(y.a); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - - z3.copy(t0); - - if (y.stype == ctx.FP.SPARSEST) z3.qmul(y.c.getb().geta()); - else z3.pmul(y.c.getb()); - z3.times_i(); - - t0.copy(z0); - t0.neg(); - z1.add(t0); - this.b.copy(z1); - z2.copy(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - t0.copy(this.c); - - if (y.stype == ctx.FP.SPARSEST) t0.qmul(y.c.getb().geta()); - else t0.pmul(y.c.getb()); - t0.times_i(); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - } - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* this=1/this */ - inverse: function () { - var f0 = new ctx.FP4(this.a), - f1 = new ctx.FP4(this.b), - f2 = new ctx.FP4(this.a), - f3 = new ctx.FP4(0); - - f0.sqr(); - f1.mul(this.c); - f1.times_i(); - f0.sub(f1); - f0.norm(); - - f1.copy(this.c); - f1.sqr(); - f1.times_i(); - f2.mul(this.b); - f1.sub(f2); - f1.norm(); - - f2.copy(this.b); - f2.sqr(); - f3.copy(this.a); - f3.mul(this.c); - f2.sub(f3); - f2.norm(); - - f3.copy(this.b); - f3.mul(f2); - f3.times_i(); - this.a.mul(f0); - f3.add(this.a); - this.c.mul(f1); - this.c.times_i(); - - f3.add(this.c); - f3.norm(); - f3.inverse(null); - this.a.copy(f0); - this.a.mul(f3); - this.b.copy(f1); - this.b.mul(f3); - this.c.copy(f2); - this.c.mul(f3); - this.stype = ctx.FP.DENSE; - }, - - /* this=this^p, where p=Modulus, using Frobenius */ - frob: function (f) { - var f2 = new ctx.FP2(f), - f3 = new ctx.FP2(f); - - f2.sqr(); - f3.mul(f2); - - this.a.frob(f3); - this.b.frob(f3); - this.c.frob(f3); - - this.b.pmul(f); - this.c.pmul(f2); - this.stype = ctx.FP.DENSE; - }, - - /* trace function */ - trace: function () { - var t = new ctx.FP4(0); - - t.copy(this.a); - t.imul(3); - t.reduce(); - - return t; - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ',' + this.c.toString() + ']'; - }, - - /* convert this to byte array */ - toBytes: function (w) { - var t = []; - this.c.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i] = t[i]; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 4 * ctx.BIG.MODBYTES] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 8 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* set this=this^e */ - pow: function (e) { - var e1, e3, w, nb, i, bt, sf; - e1 = new ctx.BIG(e); - e1.norm(); - e3 = new ctx.BIG(e1); - e3.pmul(3); - e3.norm(); - - sf = new FP12(this); - sf.norm(); - w = new FP12(sf); - if (e3.iszilch()) { - w.one(); - return w; - } - nb = e3.nbits(); - - for (i = nb - 2; i >= 1; i--) { - w.usqr(); - bt = e3.bit(i) - e1.bit(i); - - if (bt == 1) { - w.mul(sf); - } - if (bt == -1) { - sf.conj(); - w.mul(sf); - sf.conj(); - } - } - w.reduce(); - - return w; - }, - - /* constant time powering by small integer of max length bts */ - pinpow: function (e, bts) { - var R = [], - i, - b; - - R[0] = new FP12(1); - R[1] = new FP12(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - R[1 - b].mul(R[b]); - R[b].usqr(); - } - - this.copy(R[0]); - }, - - /* Faster compressed powering for unitary elements */ - compow: function (e, r) { - var fa, fb, f, q, m, a, b, g1, g2, c, cp, cpm1, cpm2; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - - m = new ctx.BIG(q); - m.mod(r); - - a = new ctx.BIG(e); - a.mod(m); - - b = new ctx.BIG(e); - b.div(m); - - g1 = new FP12(0); - g2 = new FP12(0); - g1.copy(this); - - c = g1.trace(); - - if (b.iszilch()) { - c = c.xtr_pow(e); - return c; - } - - g2.copy(g1); - g2.frob(f); - cp = g2.trace(); - g1.conj(); - g2.mul(g1); - cpm1 = g2.trace(); - g2.mul(g1); - cpm2 = g2.trace(); - - c = c.xtr_pow2(cp, cpm1, cpm2, a, b); - return c; - }, - }; - - /* convert from byte array to FP12 */ - FP12.fromBytes = function (w) { - var a, b, c; - var t = []; - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = w[i]; - c = ctx.FP4.fromBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 4 * ctx.BIG.MODBYTES]; - b = ctx.FP4.fromBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 8 * ctx.BIG.MODBYTES]; - a = ctx.FP4.fromBytes(t); - return new FP12(a, b, c); - }; - - /* return 1 if b==c, no branching */ - FP12.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* p=q0^u0.q1^u1.q2^u2.q3^u3 */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - FP12.pow4 = function (q, u) { - var g = [], - r = new FP12(0), - p = new FP12(0), - t = [], - mt = new ctx.BIG(0), - w = [], - s = [], - i, - j, - k, - nb, - bt, - pb; - - for (i = 0; i < 4; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - } - - g[0] = new FP12(q[0]); // q[0] - g[1] = new FP12(g[0]); - g[1].mul(q[1]); // q[0].q[1] - g[2] = new FP12(g[0]); - g[2].mul(q[2]); // q[0].q[2] - g[3] = new FP12(g[1]); - g[3].mul(q[2]); // q[0].q[1].q[2] - g[4] = new FP12(q[0]); - g[4].mul(q[3]); // q[0].q[3] - g[5] = new FP12(g[1]); - g[5].mul(q[3]); // q[0].q[1].q[3] - g[6] = new FP12(g[2]); - g[6].mul(q[3]); // q[0].q[2].q[3] - g[7] = new FP12(g[3]); - g[7].mul(q[3]); // q[0].q[1].q[2].q[3] - - // Make it odd - pb = 1 - t[0].parity(); - t[0].inc(pb); - t[0].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 4; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s[i] = 2 * t[0].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w[i] += bt * k; - k *= 2; - } - } - - // Main loop - p.select(g, 2 * w[nb - 1] + 1); - for (i = nb - 2; i >= 0; i--) { - p.usqr(); - r.select(g, 2 * w[i] + s[i]); - p.mul(r); - } - - // apply correction - r.copy(q[0]); - r.conj(); - r.mul(p); - p.cmove(r, pb); - - p.reduce(); - return p; - }; - - return FP12; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP12: FP12, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp16.js b/packages/bls-verify/src/vendor/amcl-js/src/fp16.js deleted file mode 100644 index 8ce7919e0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp16.js +++ /dev/null @@ -1,594 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^16 functions */ - -/* FP16 elements are of the form a+ib, where i is sqrt(sqrt(-1+sqrt(-1))) */ - -var FP16 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP16 = function (c, d) { - if (c instanceof FP16) { - this.a = new ctx.FP8(c.a); - this.b = new ctx.FP8(c.b); - } else { - this.a = new ctx.FP8(c); - this.b = new ctx.FP8(d); - } - }; - - FP16.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) bf[i + 2 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this==1 ? */ - isunity: function () { - var one = new ctx.FP8(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test is w real? That is in a+ib test b is zero */ - isreal: function () { - return this.b.iszilch(); - }, - - /* extract real part a */ - real: function () { - return this.a; - }, - - geta: function () { - return this.a; - }, - - /* extract imaginary part b */ - getb: function () { - return this.b; - }, - - /* test this=x? */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - /* set from two FP8s */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - /* this=-this */ - neg: function () { - var m = new ctx.FP8(this.a), - t = new ctx.FP8(0); - - this.norm(); - m.add(this.b); - m.neg(); - - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - this.norm(); - }, - - /* this=conjugate(this) */ - conj: function () { - this.b.neg(); - this.norm(); - }, - - /* this=-conjugate(this) */ - nconj: function () { - this.a.neg(); - this.norm(); - }, - - /* this+=x */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP16(x); - m.neg(); - this.add(m); - }, - - /* this*=s where s is FP8 */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=s where s is FP2 */ - qmul: function (s) { - this.a.qmul(s); - this.b.qmul(s); - }, - - /* this*=c where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - var t1 = new ctx.FP8(this.a), - t2 = new ctx.FP8(this.b), - t3 = new ctx.FP8(this.a); - - t3.mul(this.b); - t1.add(this.b); - t1.norm(); - t2.times_i(); - - t2.add(this.a); - t2.norm(); - this.a.copy(t1); - - this.a.mul(t2); - - t2.copy(t3); - t2.times_i(); - t2.add(t3); - - t2.neg(); - - this.a.add(t2); - - this.b.copy(t3); - this.b.add(t3); - - this.norm(); - }, - - /* this*=y */ - mul: function (y) { - var t1 = new ctx.FP8(this.a), - t2 = new ctx.FP8(this.b), - t3 = new ctx.FP8(0), - t4 = new ctx.FP8(this.b); - - t1.mul(y.a); - t2.mul(y.b); - t3.copy(y.b); - t3.add(y.a); - t4.add(this.a); - - t3.norm(); - t4.norm(); - - t4.mul(t3); - - t3.copy(t1); - t3.neg(); - t4.add(t3); - - t3.copy(t2); - t3.neg(); - this.b.copy(t4); - this.b.add(t3); - - t2.times_i(); - this.a.copy(t2); - this.a.add(t1); - - this.norm(); - }, - - /* convert to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function () { - //this.norm(); - - var t1 = new ctx.FP8(this.a), - t2 = new ctx.FP8(this.b); - - t1.sqr(); - t2.sqr(); - t2.times_i(); - t2.norm(); // ?? - t1.sub(t2); - t1.inverse(null); - this.a.mul(t1); - t1.neg(); - t1.norm(); - this.b.mul(t1); - }, - - /* this*=i where i = sqrt(-1+sqrt(-1)) */ - times_i: function () { - var s = new ctx.FP8(this.b), - t = new ctx.FP8(this.a); - - s.times_i(); - this.b.copy(t); - - this.a.copy(s); - this.norm(); - }, - - times_i2: function () { - this.a.times_i(); - this.b.times_i(); - }, - - times_i4: function () { - this.a.times_i2(); - this.b.times_i2(); - }, - - /* this=this^q using Frobenius, where q is Modulus */ - frob: function (f) { - var ff = new ctx.FP2(f); - ff.sqr(); - ff.norm(); - this.a.frob(ff); - this.b.frob(ff); - this.b.qmul(f); - this.b.times_i(); - }, - - /* this=this^e */ - pow: function (e) { - var w = new FP16(this), - z = new ctx.BIG(e), - r = new FP16(1), - bt; - w.norm(); - z.norm(); - for (;;) { - bt = z.parity(); - z.fshr(1); - - if (bt === 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - - w.sqr(); - } - r.reduce(); - - return r; - }, - - /* XTR xtr_a function */ - /* - xtr_A: function(w, y, z) { - var r = new FP16(w), - t = new FP16(w); - - r.sub(y); - r.norm(); - r.pmul(this.a); - t.add(y); - t.norm(); - t.pmul(this.b); - t.times_i(); - - this.copy(r); - this.add(t); - this.add(z); - - this.reduce(); - }, -*/ - /* XTR xtr_d function */ - /* - xtr_D: function() { - var w = new FP16(this); - this.sqr(); - w.conj(); - w.add(w); - this.sub(w); - this.reduce(); - }, -*/ - /* r=x^n using XTR method on traces of FP48s */ - /* - xtr_pow: function(n) { - var sf = new FP16(this); - sf.norm(); - var a = new FP16(3), - b = new FP16(sf), - c = new FP16(b), - t = new FP16(0), - r = new FP16(0), - par, v, nb, i; - - c.xtr_D(); - - - par = n.parity(); - v = new ctx.BIG(n); - v.norm(); - v.fshr(1); - - if (par === 0) { - v.dec(1); - v.norm(); - } - - nb = v.nbits(); - for (i = nb - 1; i >= 0; i--) { - if (v.bit(i) != 1) { - t.copy(b); - sf.conj(); - c.conj(); - b.xtr_A(a, sf, c); - sf.conj(); - c.copy(t); - c.xtr_D(); - a.xtr_D(); - } else { - t.copy(a); - t.conj(); - a.copy(b); - a.xtr_D(); - b.xtr_A(c, sf, t); - c.xtr_D(); - } - } - - if (par === 0) { - r.copy(c); - } else { - r.copy(b); - } - r.reduce(); - - return r; - }, -*/ - /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP48s. See Stam thesis. */ - /* - xtr_pow2: function(ck, ckml, ckm2l, a, b) { - - var e = new ctx.BIG(a), - d = new ctx.BIG(b), - w = new ctx.BIG(0), - cu = new FP16(ck), - cv = new FP16(this), - cumv = new FP16(ckml), - cum2v = new FP16(ckm2l), - r = new FP16(0), - t = new FP16(0), - f2 = 0, - i; - - d.norm(); - e.norm(); - - while (d.parity() === 0 && e.parity() === 0) { - d.fshr(1); - e.fshr(1); - f2++; - } - - while (ctx.BIG.comp(d, e) !== 0) { - if (ctx.BIG.comp(d, e) > 0) { - w.copy(e); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(d, w) <= 0) { - w.copy(d); - d.copy(e); - e.rsub(w); - e.norm(); - - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cum2v.conj(); - cumv.copy(cv); - cv.copy(cu); - cu.copy(t); - - } else if (d.parity() === 0) { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } else if (e.parity() == 1) { - d.sub(e); - d.norm(); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cu.xtr_D(); - cum2v.copy(cv); - cum2v.xtr_D(); - cum2v.conj(); - cv.copy(t); - } else { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } - } - if (ctx.BIG.comp(d, e) < 0) { - w.copy(d); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(e, w) <= 0) { - e.sub(d); - e.norm(); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cumv.copy(cu); - cu.copy(t); - } else if (e.parity() === 0) { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() == 1) { - w.copy(e); - e.copy(d); - w.sub(d); - w.norm(); - d.copy(w); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cumv.conj(); - cum2v.copy(cu); - cum2v.xtr_D(); - cum2v.conj(); - cu.copy(cv); - cu.xtr_D(); - cv.copy(t); - } else { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } - } - } - r.copy(cv); - r.xtr_A(cu, cumv, cum2v); - for (i = 0; i < f2; i++) { - r.xtr_D(); - } - r = r.xtr_pow(d); - return r; - } -*/ - }; - - FP16.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP8.fromBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = bf[i + 8 * ctx.BIG.MODBYTES]; - var ta = ctx.FP8.fromBytes(t); - return new FP16(ta, tb); - }; - - return FP16; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP16: FP16, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp2.js b/packages/bls-verify/src/vendor/amcl-js/src/fp2.js deleted file mode 100644 index baf3edf14..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp2.js +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^2 functions */ - -/* FP2 elements are of the form a+ib, where i is sqrt(-1) */ - -var FP2 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP2 = function (c, d) { - if (c instanceof FP2) { - this.a = new ctx.FP(c.a); - this.b = new ctx.FP(c.b); - } else { - this.a = new ctx.FP(c); - this.b = new ctx.FP(d); - } - }; - - FP2.prototype = { - /* reduce components mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise components of w */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this=0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return 0; - var cmp = this.b.islarger(); - if (cmp != 0) return cmp; - return this.a.islarger(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) bf[i + ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this=1 ? */ - isunity: function () { - var one = new ctx.FP(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test this=x */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* extract a */ - - geta: function () { - return this.a; - }, - - getA: function () { - return this.a.redc(); - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - getB: function () { - return this.b.redc(); - }, - - /* set from pair of FPs */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - /* set from two BIGs */ - bset: function (c, d) { - this.a.bcopy(c); - this.b.bcopy(d); - }, - - /* set from one ctx.BIG */ - bseta: function (c) { - this.a.bcopy(c); - this.b.zero(); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - sign: function () { - var p1 = this.a.sign(); - var p2 = this.b.sign(); - if (ctx.FP.BIG_ENDIAN_SIGN) { - var u = this.b.iszilch() ? 1 : 0; - p2 ^= (p1 ^ p2) & u; - return p2; - } else { - var u = this.a.iszilch() ? 1 : 0; - p1 ^= (p1 ^ p2) & u; - return p1; - } - }, - - /* negate this */ - neg: function () { - var m = new ctx.FP(this.a), - t = new ctx.FP(0); - - m.add(this.b); - m.neg(); - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - }, - - /* conjugate this */ - conj: function () { - this.b.neg(); - this.b.norm(); - }, - - /* this+=a */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP2(x); - m.neg(); - this.add(m); - }, - - rsub: function (x) { - this.neg(); - this.add(x); - }, - - /* this*=s, where s is FP */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=c, where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - var w1 = new ctx.FP(this.a), - w3 = new ctx.FP(this.a), - mb = new ctx.FP(this.b); - - w1.add(this.b); - w3.add(this.a); - w3.norm(); - this.b.mul(w3); - - mb.neg(); - this.a.add(mb); - - this.a.norm(); - w1.norm(); - - this.a.mul(w1); - }, - - /* this*=y */ - /* Now using Lazy reduction - inputs must be normed */ - mul: function (y) { - var p = new ctx.BIG(0), - pR = new ctx.DBIG(0), - A, - B, - C, - D, - E, - F; - - p.rcopy(ctx.ROM_FIELD.Modulus); - pR.ucopy(p); - - if ((this.a.XES + this.b.XES) * (y.a.XES + y.b.XES) > ctx.FP.FEXCESS) { - if (this.a.XES > 1) { - this.a.reduce(); - } - - if (this.b.XES > 1) { - this.b.reduce(); - } - } - - A = ctx.BIG.mul(this.a.f, y.a.f); - B = ctx.BIG.mul(this.b.f, y.b.f); - - C = new ctx.BIG(this.a.f); - D = new ctx.BIG(y.a.f); - - C.add(this.b.f); - C.norm(); - D.add(y.b.f); - D.norm(); - - E = ctx.BIG.mul(C, D); - F = new ctx.DBIG(0); - F.copy(A); - F.add(B); - B.rsub(pR); - - A.add(B); - A.norm(); - E.sub(F); - E.norm(); - - this.a.f.copy(ctx.FP.mod(A)); - this.a.XES = 3; - this.b.f.copy(ctx.FP.mod(E)); - this.b.XES = 2; - }, - - /* this^e */ - /* - pow: function(e) { - var r = new FP2(1), - w = new FP2(this), - z = new ctx.BIG(e), - bt; - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - w.sqr(); - } - - r.reduce(); - this.copy(r); - }, */ - - qr: function (h) { - var c = new FP2(this); - c.conj(); - c.mul(this); - - return c.geta().qr(h); - }, - - /* sqrt(a+ib) = sqrt(a+sqrt(a*a-n*b*b)/2)+ib/(2*sqrt(a+sqrt(a*a-n*b*b)/2)) */ - sqrt: function (h) { - var w1, w2, w3, w4, hint; - - if (this.iszilch()) { - return; - } - - w1 = new ctx.FP(this.b); - w2 = new ctx.FP(this.a); - w3 = new ctx.FP(this.a); - w4 = new ctx.FP(this.a); - hint = new ctx.FP(this.a); - - w1.sqr(); - w2.sqr(); - w1.add(w2); - w1.norm(); - - w1 = w1.sqrt(h); - - w2.copy(this.a); - w2.add(w1); - w2.norm(); - w2.div2(); - - w1.copy(this.b); - w1.div2(); - var qr = w2.qr(hint); - - // tweak hint - w3.copy(hint); - w3.neg(); - w3.norm(); - w4.copy(w2); - w4.neg(); - w4.norm(); - - w2.cmove(w4, 1 - qr); - hint.cmove(w3, 1 - qr); - - this.a.copy(w2.sqrt(hint)); - w3.copy(w2); - w3.inverse(hint); - w3.mul(this.a); - this.b.copy(w3); - this.b.mul(w1); - w4.copy(this.a); - - this.a.cmove(this.b, 1 - qr); - this.b.cmove(w4, 1 - qr); - - /* - this.a.copy(w2.sqrt(hint)); - w3.copy(w2); w3.inverse(hint); - w3.mul(this.a); - this.b.copy(w3); this.b.mul(w1); - - hint.neg(); hint.norm(); - w2.neg(); w2.norm(); - - w4.copy(w2.sqrt(hint)); - w3.copy(w2); w3.inverse(hint); - w3.mul(w4); - w3.mul(w1); - - this.a.cmove(w3,1-qr); - this.b.cmove(w4,1-qr); -*/ - var sgn = this.sign(); - var nr = new FP2(this); - nr.neg(); - nr.norm(); - this.cmove(nr, sgn); - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function (h) { - var w1, w2; - - this.norm(); - - w1 = new ctx.FP(this.a); - w2 = new ctx.FP(this.b); - - w1.sqr(); - w2.sqr(); - w1.add(w2); - w1.inverse(h); - this.a.mul(w1); - w1.neg(); - w1.norm(); - this.b.mul(w1); - }, - - /* this/=2 */ - div2: function () { - this.a.div2(); - this.b.div2(); - }, - - /* this*=sqrt(-1) */ - times_i: function () { - var z = new ctx.FP(this.a); //z.copy(this.a); - this.a.copy(this.b); - this.a.neg(); - this.b.copy(z); - }, - - /* w*=(1+sqrt(-1)) */ - /* where X*2-(1+sqrt(-1)) is irreducible for FP4, assumes p=3 mod 8 */ - mul_ip: function () { - var t = new FP2(this); - var i = ctx.FP.QNRI; - this.times_i(); - while (i > 0) { - t.add(t); - t.norm(); - i--; - } - this.add(t); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.norm(); - this.neg(); - } - }, - - /* w/=(1+sqrt(-1)) */ - div_ip: function () { - var z = new FP2(1 << ctx.FP.QNRI, 1); - z.inverse(null); - this.mul(z); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - }; - - FP2.rand = function (rng) { - return new FP2(ctx.FP.rand(rng), ctx.FP.rand(rng)); - }; - - FP2.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP.fromBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = bf[i + ctx.BIG.MODBYTES]; - var ta = ctx.FP.fromBytes(t); - return new FP2(ta, tb); - }; - - return FP2; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP2: FP2, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp24.js b/packages/bls-verify/src/vendor/amcl-js/src/fp24.js deleted file mode 100644 index 768bf1cd4..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp24.js +++ /dev/null @@ -1,1131 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Fp^24 functions */ - -/* FP24 elements are of the form a+i.b+i^2.c */ - -var FP24 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP24 = function (d, e, f) { - /* - if (!isNaN(d)) - { - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(0); - this.c = new ctx.FP8(0); - if (d==1) this.stype=ctx.FP.ONE; - else this.stype=ctx.FP.SPARSEST; - } - else - { - if (d instanceof FP24) { - this.a = new ctx.FP8(d.a); - this.b = new ctx.FP8(d.b); - this.c = new ctx.FP8(d.c); - } else { - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(e); - this.c = new ctx.FP8(f); - } - this.stype=ctx.FP.DENSE; - } -*/ - - if (d instanceof FP24) { - // ignore e, d, which are assumed be undefined in this case - this.a = new ctx.FP8(d.a); - this.b = new ctx.FP8(d.b); - this.c = new ctx.FP8(d.c); - this.stype = ctx.FP.DENSE; - } else if (typeof d !== 'undefined' && typeof e !== 'undefined' && typeof f !== 'undefined') { - // all 3 components set to (can be anything that the FP8 constructor supports) - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(e); - this.c = new ctx.FP8(f); - this.stype = ctx.FP.DENSE; - } else if (typeof d === 'number') { - // first component is number - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(0); - this.c = new ctx.FP8(0); - if (d == 1) this.stype = ctx.FP.ONE; - else this.stype = ctx.FP.SPARSER; - } else { - // other cases, including `new ctx.FP24()` fall back to zero - this.a = new ctx.FP8(0); - this.b = new ctx.FP8(0); - this.c = new ctx.FP8(0); - this.stype = ctx.FP.ZERO; - } - }; - - FP24.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - this.c.reduce(); - }, - - /* normalize all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - this.c.norm(); - }, - - /* test x==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch() && this.c.iszilch(); - }, - - /* test x==1 ? */ - isunity: function () { - var one = new ctx.FP8(1); - return this.a.equals(one) && this.b.iszilch() && this.c.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - this.c.cmove(g.c, d); - d = ~(d - 1); - this.stype ^= (this.stype ^ g.stype) & d; - }, - - /* Constant time select from pre-computed table */ - select: function (g, b) { - var invf = new FP24(0), - m, - babs; - - m = b >> 31; - babs = (b ^ m) - m; - babs = (babs - 1) / 2; - - this.cmove(g[0], FP24.teq(babs, 0)); // conditional move - this.cmove(g[1], FP24.teq(babs, 1)); - this.cmove(g[2], FP24.teq(babs, 2)); - this.cmove(g[3], FP24.teq(babs, 3)); - this.cmove(g[4], FP24.teq(babs, 4)); - this.cmove(g[5], FP24.teq(babs, 5)); - this.cmove(g[6], FP24.teq(babs, 6)); - this.cmove(g[7], FP24.teq(babs, 7)); - - invf.copy(this); - invf.conj(); - this.cmove(invf, m & 1); - }, - - settype: function (w) { - this.stype = w; - }, - - gettype: function () { - return this.stype; - }, - /* extract a from this */ - geta: function () { - return this.a; - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - /* extract c */ - getc: function () { - return this.c; - }, - - /* return 1 if x==y, else 0 */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b) && this.c.equals(x.c); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - this.c.copy(x.c); - this.stype = x.stype; - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ONE; - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ZERO; - }, - - /* this=conj(this) */ - conj: function () { - this.a.conj(); - this.b.nconj(); - this.c.conj(); - }, - - /* set this from 3 FP8s */ - set: function (d, e, f) { - this.a.copy(d); - this.b.copy(e); - this.c.copy(f); - this.stype = ctx.FP.DENSE; - }, - - /* set this from one ctx.FP8 */ - seta: function (d) { - this.a.copy(d); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.SPARSEST; - }, - - /* Granger-Scott Unitary Squaring */ - usqr: function () { - var A = new ctx.FP8(this.a), - B = new ctx.FP8(this.c), - C = new ctx.FP8(this.b), - D = new ctx.FP8(0); - - this.a.sqr(); - D.copy(this.a); - D.add(this.a); - this.a.add(D); - - A.nconj(); - - A.add(A); - this.a.add(A); - B.sqr(); - B.times_i(); - - D.copy(B); - D.add(B); - B.add(D); - - C.sqr(); - D.copy(C); - D.add(C); - C.add(D); - - this.b.conj(); - this.b.add(this.b); - this.c.nconj(); - - this.c.add(this.c); - this.b.add(B); - this.c.add(C); - this.stype = ctx.FP.DENSE; - this.reduce(); - }, - - /* Chung-Hasan SQR2 method from http://cacr.uwaterloo.ca/techreports/2006/cacr2006-24.pdf */ - sqr: function () { - if (this.stype == ctx.FP.ONE) return; - - var A = new ctx.FP8(this.a), - B = new ctx.FP8(this.b), - C = new ctx.FP8(this.c), - D = new ctx.FP8(this.a); - - A.sqr(); - B.mul(this.c); - B.add(B); - C.sqr(); - D.mul(this.b); - D.add(D); - - this.c.add(this.a); - this.c.add(this.b); - this.c.norm(); - this.c.sqr(); - - this.a.copy(A); - - A.add(B); - A.add(C); - A.add(D); - A.neg(); - B.times_i(); - C.times_i(); - - this.a.add(B); - this.b.copy(C); - this.b.add(D); - this.c.add(A); - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) this.stype = ctx.FP.SPARSE; - else this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP24 full multiplication this=this*y */ - mul: function (y) { - var z0 = new ctx.FP8(this.a), - z1 = new ctx.FP8(0), - z2 = new ctx.FP8(this.b), - z3 = new ctx.FP8(0), - t0 = new ctx.FP8(this.a), - t1 = new ctx.FP8(y.a); - - z0.mul(y.a); - z2.mul(y.b); - - t0.add(this.b); - t1.add(y.b); - - t0.norm(); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - - t1.copy(y.b); - t1.add(y.c); - - t0.norm(); - t1.norm(); - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t1.copy(y.a); - t1.add(y.c); - - t0.norm(); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - t0.copy(this.c); - t0.mul(y.c); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - // z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP24 multiplication w=w*y */ - /* catering for special case that arises from special form of ATE pairing line function */ - /* w and y are both sparser line functions - cost = 6m */ - smul: function (y) { - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - var w1 = new ctx.FP4(this.a.geta()); - var w2 = new ctx.FP4(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.b.geta().geta().geta()); - t.mul(y.b.geta().geta().geta()); - w3 = new ctx.FP4(t); - } else { - if (y.stype != ctx.FP.SPARSEST) { - w3 = new ctx.FP4(y.b.geta()); - w3.qmul(this.b.geta().geta().geta()); - } else { - w3 = new ctx.FP4(this.b.geta()); - w3.qmul(y.b.geta().geta().geta()); - } - } - } else { - w3 = new ctx.FP4(this.b.geta()); - w3.mul(y.b.geta()); - } - - var ta = new ctx.FP4(this.a.geta()); - var tb = new ctx.FP4(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP4(ta); - tc.mul(tb); - var t = new ctx.FP4(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.b.geta()); - tb.norm(); - var td = new ctx.FP4(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.b.geta()); - tb.norm(); - var te = new ctx.FP4(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - - this.a.geta().copy(w1); - this.a.getb().copy(tc); - this.b.geta().copy(td); - this.b.getb().copy(te); - this.c.geta().copy(w3); - this.c.getb().zero(); - - this.a.norm(); - this.b.norm(); - } else { - var w1 = new ctx.FP4(this.a.geta()); - var w2 = new ctx.FP4(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.c.getb().geta().geta()); - t.mul(y.c.getb().geta().geta()); - w3 = new ctx.FP4(t); - } else { - if (y.type != ctx.FP.SPARSEST) { - w3 = new ctx.FP4(y.c.getb()); - w3.qmul(this.c.getb().geta().geta()); - } else { - w3 = new ctx.FP4(this.c.getb()); - w3.qmul(y.c.getb().geta().geta()); - } - } - } else { - w3 = new ctx.FP4(this.c.getb()); - w3.mul(y.c.getb()); - } - - var ta = new ctx.FP4(this.a.geta()); - var tb = new ctx.FP4(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP4(ta); - tc.mul(tb); - var t = new ctx.FP4(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.c.getb()); - tb.norm(); - var td = new ctx.FP4(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.c.getb()); - tb.norm(); - var te = new ctx.FP4(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - this.a.geta().copy(w1); - this.a.getb().copy(tc); - - w3.times_i(); - w3.norm(); - this.b.geta().zero(); - this.b.getb().copy(w3); - - te.norm(); - te.times_i(); - this.c.geta().copy(te); - this.c.getb().copy(td); - - this.a.norm(); - this.c.norm(); - } - this.stype = ctx.FP.SPARSE; - }, - - /* FP24 full multiplication w=w*y */ - /* Supports sparse multiplicands */ - /* Usually w is denser than y */ - ssmul: function (y) { - if (this.stype == ctx.FP.ONE) { - this.copy(y); - return; - } - if (y.stype == ctx.FP.ONE) return; - - if (y.stype >= ctx.FP.SPARSE) { - var z0 = new ctx.FP8(this.a); - var z1 = new ctx.FP8(0); - var z2 = new ctx.FP8(0); - var z3 = new ctx.FP8(0); - z0.mul(y.a); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - z2.getb().copy(this.b.getb()); - z2.getb().mul(y.b.getb()); - z2.geta().zero(); - if (y.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.getb()); - z2.geta().mul(y.b.geta()); - } - if (this.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.geta()); - z2.geta().mul(y.b.getb()); - } - z2.times_i(); - } else { - z2.copy(this.b); - z2.mul(y.b); - } - } else { - z2.copy(this.b); - z2.mul(y.b); - } - var t0 = new ctx.FP8(this.a); - var t1 = new ctx.FP8(y.a); - t0.add(this.b); - t0.norm(); - t1.add(y.b); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - t1.copy(y.b); - t1.add(y.c); - t1.norm(); - - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - t0.geta().copy(this.c.geta()); - t0.geta().mul(y.c.geta()); - t0.getb().zero(); - if (y.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.geta()); - t0.getb().mul(y.c.getb()); - } - if (this.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.getb()); - t0.getb().mul(y.c.geta()); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } else { - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) { - this.smul(y); - return; - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - // dense by sparser - 13m - var z0 = new ctx.FP8(this.a); - var z2 = new ctx.FP8(this.b); - var z3 = new ctx.FP8(this.b); - var t0 = new ctx.FP8(0); - var t1 = new ctx.FP8(y.a); - z0.mul(y.a); - - if (y.stype == ctx.FP.SPARSEST) z2.tmul(y.b.geta().geta().geta()); - else z2.pmul(y.b.geta()); - - this.b.add(this.a); - t1.geta().add(y.b.geta()); - - t1.norm(); - this.b.norm(); - this.b.mul(t1); - z3.add(this.c); - z3.norm(); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.b.geta().geta().geta()); - else z3.pmul(y.b.geta()); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - this.b.add(t0); - - this.b.add(t1); - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - z3.norm(); - t0.mul(y.a); - this.c.copy(z2); - this.c.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - var z0 = new ctx.FP8(this.a); - var z1 = new ctx.FP8(0); - var z2 = new ctx.FP8(0); - var z3 = new ctx.FP8(0); - var t0 = new ctx.FP8(this.a); - var t1 = new ctx.FP8(0); - - z0.mul(y.a); - t0.add(this.b); - t0.norm(); - - z1.copy(t0); - z1.mul(y.a); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - - z3.copy(t0); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.c.getb().geta().geta()); - else z3.pmul(y.c.getb()); - - z3.times_i(); - - t0.copy(z0); - t0.neg(); - z1.add(t0); - this.b.copy(z1); - z2.copy(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - t0.copy(this.c); - - if (y.stype == ctx.FP.SPARSEST) t0.tmul(y.c.getb().geta().geta()); - else t0.pmul(y.c.getb()); - - t0.times_i(); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - } - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* this=1/this */ - inverse: function () { - var f0 = new ctx.FP8(this.a), - f1 = new ctx.FP8(this.b), - f2 = new ctx.FP8(this.a), - f3 = new ctx.FP8(0); - - f0.sqr(); - f1.mul(this.c); - f1.times_i(); - f0.sub(f1); - f0.norm(); - - f1.copy(this.c); - f1.sqr(); - f1.times_i(); - f2.mul(this.b); - f1.sub(f2); - f1.norm(); - - f2.copy(this.b); - f2.sqr(); - f3.copy(this.a); - f3.mul(this.c); - f2.sub(f3); - f2.norm(); - - f3.copy(this.b); - f3.mul(f2); - f3.times_i(); - this.a.mul(f0); - f3.add(this.a); - this.c.mul(f1); - this.c.times_i(); - - f3.add(this.c); - f3.norm(); - f3.inverse(null); - this.a.copy(f0); - this.a.mul(f3); - this.b.copy(f1); - this.b.mul(f3); - this.c.copy(f2); - this.c.mul(f3); - this.stype = ctx.FP.DENSE; - }, - - /* this=this^p, where p=Modulus, using Frobenius */ - frob: function (f, n) { - var f2 = new ctx.FP2(f), - f3 = new ctx.FP2(f), - i; - - f2.sqr(); - f3.mul(f2); - - f3.mul_ip(); - f3.norm(); - - for (i = 0; i < n; i++) { - this.a.frob(f3); - this.b.frob(f3); - this.c.frob(f3); - - this.b.qmul(f); - this.b.times_i2(); - this.c.qmul(f2); - this.c.times_i2(); - this.c.times_i2(); - } - this.stype = ctx.FP.DENSE; - }, - - /* trace function */ - trace: function () { - var t = new ctx.FP8(0); - - t.copy(this.a); - t.imul(3); - t.reduce(); - - return t; - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ',' + this.c.toString() + ']'; - }, - - /* convert this to byte array */ - toBytes: function (w) { - var t = []; - this.c.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i] = t[i]; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 8 * ctx.BIG.MODBYTES] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 16 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* set this=this^e */ - pow: function (e) { - var e1, e3, w, nb, i, bt, sf; - - sf = new FP24(this); - sf.norm(); - e1 = new ctx.BIG(e); - e1.norm(); - - e3 = new ctx.BIG(e1); - e3.pmul(3); - e3.norm(); - - w = new FP24(sf); - if (e3.iszilch()) { - w.one(); - return w; - } - nb = e3.nbits(); - - for (i = nb - 2; i >= 1; i--) { - w.usqr(); - bt = e3.bit(i) - e1.bit(i); - - if (bt == 1) { - w.mul(sf); - } - if (bt == -1) { - sf.conj(); - w.mul(sf); - sf.conj(); - } - } - w.reduce(); - - return w; - }, - - /* constant time powering by small integer of max length bts */ - pinpow: function (e, bts) { - var R = [], - i, - b; - - R[0] = new FP24(1); - R[1] = new FP24(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - R[1 - b].mul(R[b]); - R[b].usqr(); - } - - this.copy(R[0]); - }, - - /* Faster compressed powering for unitary elements */ - /* - compow: function(e, r) { - var fa, fb, f, q, m, a, b, g1, g2, c, cp, cpm1, cpm2; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - - m = new ctx.BIG(q); - m.mod(r); - - a = new ctx.BIG(e); - a.mod(m); - - b = new ctx.BIG(e); - b.div(m); - - g1 = new FP24(0); - g2 = new FP24(0); - g1.copy(this); - - c = g1.trace(); - - if (b.iszilch()) { - c=c.xtr_pow(e); - return c; - } - - g2.copy(g1); - g2.frob(f,1); - cp = g2.trace(); - g1.conj(); - g2.mul(g1); - cpm1 = g2.trace(); - g2.mul(g1); - cpm2 = g2.trace(); - - c = c.xtr_pow2(cp, cpm1, cpm2, a, b); - return c; - } -*/ - }; - - /* convert from byte array to FP12 */ - FP24.fromBytes = function (w) { - var a, b, c; - var t = []; - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = w[i]; - c = ctx.FP8.fromBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 8 * ctx.BIG.MODBYTES]; - b = ctx.FP8.fromBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 16 * ctx.BIG.MODBYTES]; - a = ctx.FP8.fromBytes(t); - return new FP24(a, b, c); - }; - - /* return 1 if b==c, no branching */ - FP24.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* p=q0^u0.q1^u1.q2^u2.q3^u3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - FP24.pow8 = function (q, u) { - var g1 = [], - g2 = [], - r = new FP24(0), - p = new FP24(0), - t = [], - mt = new ctx.BIG(0), - w1 = [], - s1 = [], - w2 = [], - s2 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2; - - for (i = 0; i < 8; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - } - - g1[0] = new FP24(q[0]); // q[0] - g1[1] = new FP24(g1[0]); - g1[1].mul(q[1]); // q[0].q[1] - g1[2] = new FP24(g1[0]); - g1[2].mul(q[2]); // q[0].q[2] - g1[3] = new FP24(g1[1]); - g1[3].mul(q[2]); // q[0].q[1].q[2] - g1[4] = new FP24(q[0]); - g1[4].mul(q[3]); // q[0].q[3] - g1[5] = new FP24(g1[1]); - g1[5].mul(q[3]); // q[0].q[1].q[3] - g1[6] = new FP24(g1[2]); - g1[6].mul(q[3]); // q[0].q[2].q[3] - g1[7] = new FP24(g1[3]); - g1[7].mul(q[3]); // q[0].q[1].q[2].q[3] - - g2[0] = new FP24(q[4]); // q[0] - g2[1] = new FP24(g2[0]); - g2[1].mul(q[5]); // q[0].q[1] - g2[2] = new FP24(g2[0]); - g2[2].mul(q[6]); // q[0].q[2] - g2[3] = new FP24(g2[1]); - g2[3].mul(q[6]); // q[0].q[1].q[2] - g2[4] = new FP24(q[4]); - g2[4].mul(q[7]); // q[0].q[3] - g2[5] = new FP24(g2[1]); - g2[5].mul(q[7]); // q[0].q[1].q[3] - g2[6] = new FP24(g2[2]); - g2[6].mul(q[7]); // q[0].q[2].q[3] - g2[7] = new FP24(g2[3]); - g2[7].mul(q[7]); // q[0].q[1].q[2].q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 8; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - } - - // Main loop - p.select(g1, 2 * w1[nb - 1] + 1); - r.select(g2, 2 * w2[nb - 1] + 1); - p.mul(r); - for (i = nb - 2; i >= 0; i--) { - p.usqr(); - r.select(g1, 2 * w1[i] + s1[i]); - p.mul(r); - r.select(g2, 2 * w2[i] + s2[i]); - p.mul(r); - } - - // apply correction - r.copy(q[0]); - r.conj(); - r.mul(p); - p.cmove(r, pb1); - - r.copy(q[4]); - r.conj(); - r.mul(p); - p.cmove(r, pb2); - - p.reduce(); - return p; - }; - - return FP24; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP24: FP24, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp4.js b/packages/bls-verify/src/vendor/amcl-js/src/fp4.js deleted file mode 100644 index 7ad95fa59..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp4.js +++ /dev/null @@ -1,722 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^4 functions */ - -/* FP4 elements are of the form a+ib, where i is sqrt(-1+sqrt(-1)) */ - -var FP4 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP4 = function (c, d) { - if (c instanceof FP4) { - this.a = new ctx.FP2(c.a); - this.b = new ctx.FP2(c.b); - } else { - this.a = new ctx.FP2(c); - this.b = new ctx.FP2(d); - } - }; - - FP4.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return 0; - var cmp = this.b.larger(); - if (cmp != 0) return cmp; - return this.a.larger(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) bf[i + 2 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this==1 ? */ - isunity: function () { - var one = new ctx.FP2(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test is w real? That is in a+ib test b is zero */ - isreal: function () { - return this.b.iszilch(); - }, - - /* extract real part a */ - real: function () { - return this.a; - }, - - geta: function () { - return this.a; - }, - - /* extract imaginary part b */ - getb: function () { - return this.b; - }, - - /* test this=x? */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - /* set from two FP2s */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - sign: function () { - var p1 = this.a.sign(); - var p2 = this.b.sign(); - if (ctx.FP.BIG_ENDIAN_SIGN) { - var u = this.b.iszilch() ? 1 : 0; - p2 ^= (p1 ^ p2) & u; - return p2; - } else { - var u = this.a.iszilch() ? 1 : 0; - p1 ^= (p1 ^ p2) & u; - return p1; - } - }, - - /* this=-this */ - neg: function () { - this.norm(); - var m = new ctx.FP2(this.a), - t = new ctx.FP2(0); - - m.add(this.b); - m.neg(); - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - this.norm(); - }, - - /* this=conjugate(this) */ - conj: function () { - this.b.neg(); - this.norm(); - }, - - /* this=-conjugate(this) */ - nconj: function () { - this.a.neg(); - this.norm(); - }, - - /* this+=x */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP4(x); - m.neg(); - this.add(m); - }, - - rsub: function (x) { - this.neg(); - this.add(x); - }, - - /* this*=s where s is FP2 */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=c where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - // this.norm(); - - var t1 = new ctx.FP2(this.a), - t2 = new ctx.FP2(this.b), - t3 = new ctx.FP2(this.a); - - t3.mul(this.b); - t1.add(this.b); - t1.norm(); - t2.mul_ip(); - - t2.add(this.a); - t2.norm(); - this.a.copy(t1); - - this.a.mul(t2); - - t2.copy(t3); - t2.mul_ip(); - t2.add(t3); - t2.norm(); // ?? - - t2.neg(); - - this.a.add(t2); - - this.b.copy(t3); - this.b.add(t3); - - this.norm(); - }, - - /* this*=y */ - mul: function (y) { - // this.norm(); - - var t1 = new ctx.FP2(this.a), - t2 = new ctx.FP2(this.b), - t3 = new ctx.FP2(0), - t4 = new ctx.FP2(this.b); - - t1.mul(y.a); - t2.mul(y.b); - t3.copy(y.b); - t3.add(y.a); - t4.add(this.a); - - t3.norm(); - t4.norm(); - - t4.mul(t3); - - t3.copy(t1); - t3.neg(); - t4.add(t3); - - t3.copy(t2); - t3.neg(); - this.b.copy(t4); - this.b.add(t3); - - t2.mul_ip(); - this.a.copy(t2); - this.a.add(t1); - - this.norm(); - }, - - /* convert to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function (h) { - this.norm(); - - var t1 = new ctx.FP2(this.a), - t2 = new ctx.FP2(this.b); - - t1.sqr(); - t2.sqr(); - t2.mul_ip(); - t2.norm(); // ?? - t1.sub(t2); - t1.inverse(h); - this.a.mul(t1); - t1.neg(); - t1.norm(); - this.b.mul(t1); - }, - - /* this*=i where i = sqrt(-1+sqrt(-1)) */ - times_i: function () { - var t = new ctx.FP2(this.b); - this.b.copy(this.a); - t.mul_ip(); - this.a.copy(t); - this.norm(); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - /* this=this^q using Frobenius, where q is Modulus */ - frob: function (f) { - this.a.conj(); - this.b.conj(); - this.b.mul(f); - }, - - /* this=this^e */ - /* - pow: function(e) { - var w = new FP4(this), - z = new ctx.BIG(e), - r = new FP4(1), - bt; - w.norm(); - z.norm(); - for (;;) { - bt = z.parity(); - z.fshr(1); - - if (bt === 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - - w.sqr(); - } - r.reduce(); - - return r; - }, */ - - /* XTR xtr_a function */ - xtr_A: function (w, y, z) { - var r = new FP4(w), - t = new FP4(w); - - //y.norm(); // ?? - r.sub(y); - r.norm(); - r.pmul(this.a); - t.add(y); - t.norm(); - t.pmul(this.b); - t.times_i(); - - this.copy(r); - this.add(t); - this.add(z); - - this.reduce(); - }, - - /* XTR xtr_d function */ - xtr_D: function () { - var w = new FP4(this); - this.sqr(); - w.conj(); - w.add(w); - this.sub(w); - this.reduce(); - }, - - /* r=x^n using XTR method on traces of FP12s */ - xtr_pow: function (n) { - var sf = new FP4(this); - sf.norm(); - var a = new FP4(3), - b = new FP4(sf), - c = new FP4(b), - t = new FP4(0), - r = new FP4(0), - par, - v, - nb, - i; - - c.xtr_D(); - - //n.norm(); - par = n.parity(); - v = new ctx.BIG(n); - v.norm(); - v.fshr(1); - - if (par === 0) { - v.dec(1); - v.norm(); - } - - nb = v.nbits(); - for (i = nb - 1; i >= 0; i--) { - if (v.bit(i) != 1) { - t.copy(b); - sf.conj(); - c.conj(); - b.xtr_A(a, sf, c); - sf.conj(); - c.copy(t); - c.xtr_D(); - a.xtr_D(); - } else { - t.copy(a); - t.conj(); - a.copy(b); - a.xtr_D(); - b.xtr_A(c, sf, t); - c.xtr_D(); - } - } - - if (par === 0) { - r.copy(c); - } else { - r.copy(b); - } - r.reduce(); - - return r; - }, - - /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP12s. See Stam thesis. */ - xtr_pow2: function (ck, ckml, ckm2l, a, b) { - var e = new ctx.BIG(a), - d = new ctx.BIG(b), - w = new ctx.BIG(0), - cu = new FP4(ck), - cv = new FP4(this), - cumv = new FP4(ckml), - cum2v = new FP4(ckm2l), - r = new FP4(0), - t = new FP4(0), - f2 = 0, - i; - - e.norm(); - d.norm(); - - while (d.parity() === 0 && e.parity() === 0) { - d.fshr(1); - e.fshr(1); - f2++; - } - - while (ctx.BIG.comp(d, e) !== 0) { - if (ctx.BIG.comp(d, e) > 0) { - w.copy(e); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(d, w) <= 0) { - w.copy(d); - d.copy(e); - e.rsub(w); - e.norm(); - - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cum2v.conj(); - cumv.copy(cv); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() === 0) { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } else if (e.parity() == 1) { - d.sub(e); - d.norm(); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cu.xtr_D(); - cum2v.copy(cv); - cum2v.xtr_D(); - cum2v.conj(); - cv.copy(t); - } else { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } - } - if (ctx.BIG.comp(d, e) < 0) { - w.copy(d); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(e, w) <= 0) { - e.sub(d); - e.norm(); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cumv.copy(cu); - cu.copy(t); - } else if (e.parity() === 0) { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() == 1) { - w.copy(e); - e.copy(d); - w.sub(d); - w.norm(); - d.copy(w); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cumv.conj(); - cum2v.copy(cu); - cum2v.xtr_D(); - cum2v.conj(); - cu.copy(cv); - cu.xtr_D(); - cv.copy(t); - } else { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } - } - } - r.copy(cv); - r.xtr_A(cu, cumv, cum2v); - for (i = 0; i < f2; i++) { - r.xtr_D(); - } - r = r.xtr_pow(d); - return r; - }, - - /* New stuff for ecp4.js */ - - div2: function () { - this.a.div2(); - this.b.div2(); - }, - - div_i: function () { - var u = new ctx.FP2(this.a), - v = new ctx.FP2(this.b); - u.div_ip(); - this.a.copy(v); - this.b.copy(u); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - qmul: function (s) { - this.a.pmul(s); - this.b.pmul(s); - }, - - /* this^e */ - /* - pow: function(e) { - var r = new FP4(1), - w = new FP4(this), - z = new ctx.BIG(e), - bt; - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - w.sqr(); - } - - r.reduce(); - this.copy(r); - },*/ - - qr: function (h) { - var c = new FP4(this); - c.conj(); - c.mul(this); - return c.geta().qr(h); - }, - - sqrt: function (h) { - if (this.iszilch()) { - return; - } - var wa = new ctx.FP2(this.a), - wb = new ctx.FP2(this.a), - ws = new ctx.FP2(this.b), - wt = new ctx.FP2(this.a); - var hint = new ctx.FP(0); - - ws.sqr(); - wa.sqr(); - ws.mul_ip(); - ws.norm(); - wa.sub(ws); - - ws.copy(wa); - ws.norm(); - ws.sqrt(h); - - wa.copy(wt); - wa.add(ws); - wa.norm(); - wa.div2(); - - wb.copy(this.b); - wb.div2(); - var qr = wa.qr(hint); - - // tweak hint - multiply old hint by Norm(1/Beta)^e where Beta is irreducible polynomial - ws.copy(wa); - var twk = new ctx.FP(0); - twk.rcopy(ctx.ROM_FIELD.TWK); - twk.mul(hint); - ws.div_ip(); - ws.norm(); - - wa.cmove(ws, 1 - qr); - hint.cmove(twk, 1 - qr); - - this.a.copy(wa); - this.a.sqrt(hint); - ws.copy(wa); - ws.inverse(hint); - ws.mul(this.a); - this.b.copy(ws); - this.b.mul(wb); - wt.copy(this.a); - - this.a.cmove(this.b, 1 - qr); - this.b.cmove(wt, 1 - qr); - - var sgn = this.sign(); - var nr = new FP4(this); - nr.neg(); - nr.norm(); - this.cmove(nr, sgn); - }, - }; - - FP4.rand = function (rng) { - return new FP4(ctx.FP2.rand(rng), ctx.FP2.rand(rng)); - }; - - FP4.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP2.fromBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = bf[i + 2 * ctx.BIG.MODBYTES]; - var ta = ctx.FP2.fromBytes(t); - return new FP4(ta, tb); - }; - - return FP4; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP4: FP4, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp48.js b/packages/bls-verify/src/vendor/amcl-js/src/fp48.js deleted file mode 100644 index 3e4ebb85f..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp48.js +++ /dev/null @@ -1,1225 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Fp^48 functions */ - -/* FP48 elements are of the form a+i.b+i^2.c */ - -var FP48 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP48 = function (d, e, f) { - /* - if (!isNaN(d)) - { - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(0); - this.c = new ctx.FP16(0); - if (d==1) this.stype=ctx.FP.ONE; - else this.stype=ctx.FP.SPARSEST; - } - else - { - if (d instanceof FP48) { - this.a = new ctx.FP16(d.a); - this.b = new ctx.FP16(d.b); - this.c = new ctx.FP16(d.c); - } else { - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(e); - this.c = new ctx.FP16(f); - } - this.stype=ctx.FP.DENSE; - } -*/ - - if (d instanceof FP48) { - // ignore e, d, which are assumed be undefined in this case - this.a = new ctx.FP16(d.a); - this.b = new ctx.FP16(d.b); - this.c = new ctx.FP16(d.c); - this.stype = ctx.FP.DENSE; - } else if (typeof d !== 'undefined' && typeof e !== 'undefined' && typeof f !== 'undefined') { - // all 3 components set to (can be anything that the FP16 constructor supports) - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(e); - this.c = new ctx.FP16(f); - this.stype = ctx.FP.DENSE; - } else if (typeof d === 'number') { - // first component is number - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(0); - this.c = new ctx.FP16(0); - if (d == 1) this.stype = ctx.FP.ONE; - else this.stype = ctx.FP.SPARSER; - } else { - // other cases, including `new ctx.FP48()` fall back to zero - this.a = new ctx.FP16(0); - this.b = new ctx.FP16(0); - this.c = new ctx.FP16(0); - this.stype = ctx.FP.ZERO; - } - }; - - FP48.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - this.c.reduce(); - }, - - /* normalize all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - this.c.norm(); - }, - - /* test x==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch() && this.c.iszilch(); - }, - - /* test x==1 ? */ - isunity: function () { - var one = new ctx.FP16(1); - return this.a.equals(one) && this.b.iszilch() && this.c.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - this.c.cmove(g.c, d); - d = ~(d - 1); - this.stype ^= (this.stype ^ g.stype) & d; - }, - - /* Constant time select from pre-computed table */ - select: function (g, b) { - var invf = new FP48(0), - m, - babs; - - m = b >> 31; - babs = (b ^ m) - m; - babs = (babs - 1) / 2; - - this.cmove(g[0], FP48.teq(babs, 0)); // conditional move - this.cmove(g[1], FP48.teq(babs, 1)); - this.cmove(g[2], FP48.teq(babs, 2)); - this.cmove(g[3], FP48.teq(babs, 3)); - this.cmove(g[4], FP48.teq(babs, 4)); - this.cmove(g[5], FP48.teq(babs, 5)); - this.cmove(g[6], FP48.teq(babs, 6)); - this.cmove(g[7], FP48.teq(babs, 7)); - - invf.copy(this); - invf.conj(); - this.cmove(invf, m & 1); - }, - - settype: function (w) { - this.stype = w; - }, - - gettype: function () { - return this.stype; - }, - - /* extract a from this */ - geta: function () { - return this.a; - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - /* extract c */ - getc: function () { - return this.c; - }, - - /* return 1 if x==y, else 0 */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b) && this.c.equals(x.c); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - this.c.copy(x.c); - this.stype = x.stype; - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ONE; - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ZERO; - }, - - /* this=conj(this) */ - conj: function () { - this.a.conj(); - this.b.nconj(); - this.c.conj(); - }, - - /* set this from 3 FP16s */ - set: function (d, e, f) { - this.a.copy(d); - this.b.copy(e); - this.c.copy(f); - this.stype = ctx.FP.DENSE; - }, - - /* set this from one ctx.FP16 */ - seta: function (d) { - this.a.copy(d); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.SPARSEST; - }, - - /* Granger-Scott Unitary Squaring */ - usqr: function () { - var A = new ctx.FP16(this.a), - B = new ctx.FP16(this.c), - C = new ctx.FP16(this.b), - D = new ctx.FP16(0); - - this.a.sqr(); - D.copy(this.a); - D.add(this.a); - this.a.add(D); - - A.nconj(); - - A.add(A); - this.a.add(A); - B.sqr(); - B.times_i(); - - D.copy(B); - D.add(B); - B.add(D); - - C.sqr(); - D.copy(C); - D.add(C); - C.add(D); - - this.b.conj(); - this.b.add(this.b); - this.c.nconj(); - - this.c.add(this.c); - this.b.add(B); - this.c.add(C); - this.stype = ctx.FP.DENSE; - this.reduce(); - }, - - /* Chung-Hasan SQR2 method from http://cacr.uwaterloo.ca/techreports/2006/cacr2006-24.pdf */ - sqr: function () { - if (this.stype == ctx.FP.ONE) return; - - var A = new ctx.FP16(this.a), - B = new ctx.FP16(this.b), - C = new ctx.FP16(this.c), - D = new ctx.FP16(this.a); - - A.sqr(); - B.mul(this.c); - B.add(B); - C.sqr(); - D.mul(this.b); - D.add(D); - - this.c.add(this.a); - this.c.add(this.b); - this.c.norm(); - this.c.sqr(); - - this.a.copy(A); - - A.add(B); - A.add(C); - A.add(D); - A.neg(); - B.times_i(); - C.times_i(); - - this.a.add(B); - this.b.copy(C); - this.b.add(D); - this.c.add(A); - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) this.stype = ctx.FP.SPARSE; - else this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP48 full multiplication this=this*y */ - mul: function (y) { - var z0 = new ctx.FP16(this.a), - z1 = new ctx.FP16(0), - z2 = new ctx.FP16(this.b), - z3 = new ctx.FP16(0), - t0 = new ctx.FP16(this.a), - t1 = new ctx.FP16(y.a); - - z0.mul(y.a); - z2.mul(y.b); - - t0.add(this.b); - t1.add(y.b); - - t0.norm(); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - - t1.copy(y.b); - t1.add(y.c); - - t0.norm(); - t1.norm(); - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t1.copy(y.a); - t1.add(y.c); - - t0.norm(); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - t0.copy(this.c); - t0.mul(y.c); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP48 multiplication w=w*y */ - /* catering for special case that arises from special form of ATE pairing line function */ - /* w and y are both sparser line functions - cost = 6m */ - smul: function (y) { - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - var w1 = new ctx.FP8(this.a.geta()); - var w2 = new ctx.FP8(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.b.geta().geta().geta().geta()); - t.mul(y.b.geta().geta().geta().geta()); - w3 = new ctx.FP8(t); - } else { - if (y.stype != ctx.FP.SPARSEST) { - w3 = new ctx.FP8(y.b.geta()); - w3.tmul(this.b.geta().geta().geta().geta()); - } else { - w3 = new ctx.FP8(this.b.geta()); - w3.tmul(y.b.geta().geta().geta().geta()); - } - } - } else { - w3 = new ctx.FP8(this.b.geta()); - w3.mul(y.b.geta()); - } - - var ta = new ctx.FP8(this.a.geta()); - var tb = new ctx.FP8(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP8(ta); - tc.mul(tb); - var t = new ctx.FP8(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.b.geta()); - tb.norm(); - var td = new ctx.FP8(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.b.geta()); - tb.norm(); - var te = new ctx.FP8(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - - this.a.geta().copy(w1); - this.a.getb().copy(tc); - this.b.geta().copy(td); - this.b.getb().copy(te); - this.c.geta().copy(w3); - this.c.getb().zero(); - - this.a.norm(); - this.b.norm(); - } else { - var w1 = new ctx.FP8(this.a.geta()); - var w2 = new ctx.FP8(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.c.getb().geta().geta().geta()); - t.mul(y.c.getb().geta().geta().geta()); - w3 = new ctx.FP8(t); - } else { - if (y.type != ctx.FP.SPARSEST) { - w3 = new ctx.FP8(y.c.getb()); - w3.tmul(this.c.getb().geta().geta().geta()); - } else { - w3 = new ctx.FP8(this.c.getb()); - w3.tmul(y.c.getb().geta().geta().geta()); - } - } - } else { - w3 = new ctx.FP8(this.c.getb()); - w3.mul(y.c.getb()); - } - var ta = new ctx.FP8(this.a.geta()); - var tb = new ctx.FP8(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP8(ta); - tc.mul(tb); - var t = new ctx.FP8(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.c.getb()); - tb.norm(); - var td = new ctx.FP8(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.c.getb()); - tb.norm(); - var te = new ctx.FP8(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - this.a.geta().copy(w1); - this.a.getb().copy(tc); - - w3.times_i(); - w3.norm(); - this.b.geta().zero(); - this.b.getb().copy(w3); - - te.norm(); - te.times_i(); - this.c.geta().copy(te); - this.c.getb().copy(td); - - this.a.norm(); - this.c.norm(); - } - this.stype = ctx.FP.SPARSE; - }, - - /* FP48 full multiplication w=w*y */ - /* Supports sparse multiplicands */ - /* Usually w is denser than y */ - ssmul: function (y) { - if (this.stype == ctx.FP.ONE) { - this.copy(y); - return; - } - if (y.stype == ctx.FP.ONE) return; - - if (y.stype >= ctx.FP.SPARSE) { - var z0 = new ctx.FP16(this.a); - var z1 = new ctx.FP16(0); - var z2 = new ctx.FP16(0); - var z3 = new ctx.FP16(0); - z0.mul(y.a); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - z2.getb().copy(this.b.getb()); - z2.getb().mul(y.b.getb()); - z2.geta().zero(); - if (y.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.getb()); - z2.geta().mul(y.b.geta()); - } - if (this.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.geta()); - z2.geta().mul(y.b.getb()); - } - z2.times_i(); - } else { - z2.copy(this.b); - z2.mul(y.b); - } - } else { - z2.copy(this.b); - z2.mul(y.b); - } - var t0 = new ctx.FP16(this.a); - var t1 = new ctx.FP16(y.a); - t0.add(this.b); - t0.norm(); - t1.add(y.b); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - t1.copy(y.b); - t1.add(y.c); - t1.norm(); - - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - t0.geta().copy(this.c.geta()); - t0.geta().mul(y.c.geta()); - t0.getb().zero(); - if (y.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.geta()); - t0.getb().mul(y.c.getb()); - } - if (this.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.getb()); - t0.getb().mul(y.c.geta()); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } else { - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) { - this.smul(y); - return; - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - // dense by sparser - 13m - var z0 = new ctx.FP16(this.a); - var z2 = new ctx.FP16(this.b); - var z3 = new ctx.FP16(this.b); - var t0 = new ctx.FP16(0); - var t1 = new ctx.FP16(y.a); - z0.mul(y.a); - - if (y.stype == ctx.FP.SPARSEST) z2.tmul(y.b.geta().geta().geta().geta()); - else z2.pmul(y.b.geta()); - - this.b.add(this.a); - t1.geta().add(y.b.geta()); - - t1.norm(); - this.b.norm(); - this.b.mul(t1); - z3.add(this.c); - z3.norm(); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.b.geta().geta().geta().geta()); - else z3.pmul(y.b.real()); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - this.b.add(t0); - - this.b.add(t1); - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - z3.norm(); - t0.mul(y.a); - this.c.copy(z2); - this.c.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - var z0 = new ctx.FP16(this.a); - var z1 = new ctx.FP16(0); - var z2 = new ctx.FP16(0); - var z3 = new ctx.FP16(0); - var t0 = new ctx.FP16(this.a); - var t1 = new ctx.FP16(0); - - z0.mul(y.a); - t0.add(this.b); - t0.norm(); - - z1.copy(t0); - z1.mul(y.a); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - - z3.copy(t0); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.c.getb().geta().geta().geta()); - else z3.pmul(y.c.getb()); - z3.times_i(); - - t0.copy(z0); - t0.neg(); - z1.add(t0); - this.b.copy(z1); - z2.copy(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - t0.copy(this.c); - - if (y.stype == ctx.FP.SPARSEST) t0.tmul(y.c.getb().geta().geta().geta()); - else t0.pmul(y.c.getb()); - t0.times_i(); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - } - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* this=1/this */ - inverse: function () { - var f0 = new ctx.FP16(this.a), - f1 = new ctx.FP16(this.b), - f2 = new ctx.FP16(this.a), - f3 = new ctx.FP16(0); - - f0.sqr(); - f1.mul(this.c); - f1.times_i(); - f0.sub(f1); - f0.norm(); - - f1.copy(this.c); - f1.sqr(); - f1.times_i(); - f2.mul(this.b); - f1.sub(f2); - f1.norm(); - - f2.copy(this.b); - f2.sqr(); - f3.copy(this.a); - f3.mul(this.c); - f2.sub(f3); - f2.norm(); - - f3.copy(this.b); - f3.mul(f2); - f3.times_i(); - this.a.mul(f0); - f3.add(this.a); - this.c.mul(f1); - this.c.times_i(); - - f3.add(this.c); - f3.norm(); - f3.inverse(); - this.a.copy(f0); - this.a.mul(f3); - this.b.copy(f1); - this.b.mul(f3); - this.c.copy(f2); - this.c.mul(f3); - this.stype = ctx.FP.DENSE; - }, - - /* this=this^p, where p=Modulus, using Frobenius */ - frob: function (f, n) { - var f2 = new ctx.FP2(f), - f3 = new ctx.FP2(f), - i; - - f2.sqr(); - f3.mul(f2); - - f3.mul_ip(); - f3.norm(); - f3.mul_ip(); - f3.norm(); - - for (i = 0; i < n; i++) { - this.a.frob(f3); - this.b.frob(f3); - this.c.frob(f3); - - this.b.qmul(f); - this.b.times_i4(); - this.b.times_i2(); - this.c.qmul(f2); - this.c.times_i4(); - this.c.times_i4(); - this.c.times_i4(); - } - this.stype = ctx.FP.DENSE; - }, - - /* trace function */ - trace: function () { - var t = new ctx.FP16(0); - - t.copy(this.a); - t.imul(3); - t.reduce(); - - return t; - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ',' + this.c.toString() + ']'; - }, - - /* convert this to byte array */ - toBytes: function (w) { - var t = []; - this.c.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i] = t[i]; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 16 * ctx.BIG.MODBYTES] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 32 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* set this=this^e */ - pow: function (e) { - var e1, e3, w, nb, i, bt, sf; - - sf = new FP48(this); - sf.norm(); - e1 = new ctx.BIG(e); - e1.norm(); - - e3 = new ctx.BIG(e1); - e3.pmul(3); - e3.norm(); - - w = new FP48(sf); //w.copy(this); - - if (e3.iszilch()) { - w.one(); - return w; - } - nb = e3.nbits(); - - for (i = nb - 2; i >= 1; i--) { - w.usqr(); - bt = e3.bit(i) - e1.bit(i); - - if (bt == 1) { - w.mul(sf); - } - if (bt == -1) { - sf.conj(); - w.mul(sf); - sf.conj(); - } - } - w.reduce(); - - return w; - }, - - /* constant time powering by small integer of max length bts */ - pinpow: function (e, bts) { - var R = [], - i, - b; - - R[0] = new FP48(1); - R[1] = new FP48(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - R[1 - b].mul(R[b]); - R[b].usqr(); - } - - this.copy(R[0]); - }, - - /* Faster compressed powering for unitary elements */ - /* - compow: function(e, r) { - var fa, fb, f, q, m, a, b, g1, g2, c, cp, cpm1, cpm2; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - - m = new ctx.BIG(q); - m.mod(r); - - a = new ctx.BIG(e); - a.mod(m); - - b = new ctx.BIG(e); - b.div(m); - - g1 = new FP48(0); - g2 = new FP48(0); - g1.copy(this); - - c = g1.trace(); - - if (b.iszilch()) { - c=c.xtr_pow(e); - return c; - } - - g2.copy(g1); - g2.frob(f,1); - cp = g2.trace(); - g1.conj(); - g2.mul(g1); - cpm1 = g2.trace(); - g2.mul(g1); - cpm2 = g2.trace(); - - c = c.xtr_pow2(cp, cpm1, cpm2, a, b); - return c; - } -*/ - }; - - /* convert from byte array to FP12 */ - FP48.fromBytes = function (w) { - var a, b, c; - var t = []; - for (var i = 0; i < 16 * ctx.BIG.MODBYTES; i++) t[i] = w[i]; - c = ctx.FP16.fromBytes(t); - for (var i = 0; i < 16 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 16 * ctx.BIG.MODBYTES]; - b = ctx.FP16.fromBytes(t); - for (var i = 0; i < 16 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 32 * ctx.BIG.MODBYTES]; - a = ctx.FP16.fromBytes(t); - return new FP48(a, b, c); - }; - - /* return 1 if b==c, no branching */ - FP48.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* p=q0^u0.q1^u1.q2^u2.q3^u3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - FP48.pow16 = function (q, u) { - var g1 = [], - g2 = [], - g3 = [], - g4 = [], - r = new FP48(0), - p = new FP48(0), - t = [], - mt = new ctx.BIG(0), - w1 = [], - s1 = [], - w2 = [], - s2 = [], - w3 = [], - s3 = [], - w4 = [], - s4 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2, - pb3, - pb4; - - for (i = 0; i < 16; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - } - - g1[0] = new FP48(q[0]); // q[0] - g1[1] = new FP48(g1[0]); - g1[1].mul(q[1]); // q[0].q[1] - g1[2] = new FP48(g1[0]); - g1[2].mul(q[2]); // q[0].q[2] - g1[3] = new FP48(g1[1]); - g1[3].mul(q[2]); // q[0].q[1].q[2] - g1[4] = new FP48(q[0]); - g1[4].mul(q[3]); // q[0].q[3] - g1[5] = new FP48(g1[1]); - g1[5].mul(q[3]); // q[0].q[1].q[3] - g1[6] = new FP48(g1[2]); - g1[6].mul(q[3]); // q[0].q[2].q[3] - g1[7] = new FP48(g1[3]); - g1[7].mul(q[3]); // q[0].q[1].q[2].q[3] - - g2[0] = new FP48(q[4]); // q[0] - g2[1] = new FP48(g2[0]); - g2[1].mul(q[5]); // q[0].q[1] - g2[2] = new FP48(g2[0]); - g2[2].mul(q[6]); // q[0].q[2] - g2[3] = new FP48(g2[1]); - g2[3].mul(q[6]); // q[0].q[1].q[2] - g2[4] = new FP48(q[4]); - g2[4].mul(q[7]); // q[0].q[3] - g2[5] = new FP48(g2[1]); - g2[5].mul(q[7]); // q[0].q[1].q[3] - g2[6] = new FP48(g2[2]); - g2[6].mul(q[7]); // q[0].q[2].q[3] - g2[7] = new FP48(g2[3]); - g2[7].mul(q[7]); // q[0].q[1].q[2].q[3] - - g3[0] = new FP48(q[8]); // q[0] - g3[1] = new FP48(g3[0]); - g3[1].mul(q[9]); // q[0].q[1] - g3[2] = new FP48(g3[0]); - g3[2].mul(q[10]); // q[0].q[2] - g3[3] = new FP48(g3[1]); - g3[3].mul(q[10]); // q[0].q[1].q[2] - g3[4] = new FP48(q[8]); - g3[4].mul(q[11]); // q[0].q[3] - g3[5] = new FP48(g3[1]); - g3[5].mul(q[11]); // q[0].q[1].q[3] - g3[6] = new FP48(g3[2]); - g3[6].mul(q[11]); // q[0].q[2].q[3] - g3[7] = new FP48(g3[3]); - g3[7].mul(q[11]); // q[0].q[1].q[2].q[3] - - g4[0] = new FP48(q[12]); // q[0] - g4[1] = new FP48(g4[0]); - g4[1].mul(q[13]); // q[0].q[1] - g4[2] = new FP48(g4[0]); - g4[2].mul(q[14]); // q[0].q[2] - g4[3] = new FP48(g4[1]); - g4[3].mul(q[14]); // q[0].q[1].q[2] - g4[4] = new FP48(q[12]); - g4[4].mul(q[15]); // q[0].q[3] - g4[5] = new FP48(g4[1]); - g4[5].mul(q[15]); // q[0].q[1].q[3] - g4[6] = new FP48(g4[2]); - g4[6].mul(q[15]); // q[0].q[2].q[3] - g4[7] = new FP48(g4[3]); - g4[7].mul(q[15]); // q[0].q[1].q[2].q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - pb3 = 1 - t[8].parity(); - t[8].inc(pb3); - t[8].norm(); - - pb4 = 1 - t[12].parity(); - t[12].inc(pb4); - t[12].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 16; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - s3[nb - 1] = 1; - s4[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - t[8].fshr(1); - s3[i] = 2 * t[8].parity() - 1; - t[12].fshr(1); - s4[i] = 2 * t[12].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - w3[i] = 0; - k = 1; - for (j = 9; j < 12; j++) { - bt = s3[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w3[i] += bt * k; - k *= 2; - } - w4[i] = 0; - k = 1; - for (j = 13; j < 16; j++) { - bt = s4[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w4[i] += bt * k; - k *= 2; - } - } - - // Main loop - p.select(g1, 2 * w1[nb - 1] + 1); - r.select(g2, 2 * w2[nb - 1] + 1); - p.mul(r); - r.select(g3, 2 * w3[nb - 1] + 1); - p.mul(r); - r.select(g4, 2 * w4[nb - 1] + 1); - p.mul(r); - for (i = nb - 2; i >= 0; i--) { - p.usqr(); - r.select(g1, 2 * w1[i] + s1[i]); - p.mul(r); - r.select(g2, 2 * w2[i] + s2[i]); - p.mul(r); - r.select(g3, 2 * w3[i] + s3[i]); - p.mul(r); - r.select(g4, 2 * w4[i] + s4[i]); - p.mul(r); - } - - // apply correction - r.copy(q[0]); - r.conj(); - r.mul(p); - p.cmove(r, pb1); - - r.copy(q[4]); - r.conj(); - r.mul(p); - p.cmove(r, pb2); - - r.copy(q[8]); - r.conj(); - r.mul(p); - p.cmove(r, pb3); - - r.copy(q[12]); - r.conj(); - r.mul(p); - p.cmove(r, pb4); - - p.reduce(); - return p; - }; - - return FP48; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP48: FP48, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp8.js b/packages/bls-verify/src/vendor/amcl-js/src/fp8.js deleted file mode 100644 index 0be8b39d0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp8.js +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^8 functions */ - -/* FP8 elements are of the form a+ib, where i is sqrt(sqrt(-1+sqrt(-1))) */ - -var FP8 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP8 = function (c, d) { - if (c instanceof FP8) { - this.a = new ctx.FP4(c.a); - this.b = new ctx.FP4(c.b); - } else { - this.a = new ctx.FP4(c); - this.b = new ctx.FP4(d); - } - }; - - FP8.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return 0; - var cmp = this.b.larger(); - if (cmp != 0) return cmp; - return this.a.larger(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) bf[i + 4 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this==1 ? */ - isunity: function () { - var one = new ctx.FP4(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test is w real? That is in a+ib test b is zero */ - isreal: function () { - return this.b.iszilch(); - }, - - /* extract real part a */ - real: function () { - return this.a; - }, - - geta: function () { - return this.a; - }, - - /* extract imaginary part b */ - getb: function () { - return this.b; - }, - - /* test this=x? */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - /* set from two FP4s */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - sign: function () { - var p1 = this.a.sign(); - var p2 = this.b.sign(); - if (ctx.FP.BIG_ENDIAN_SIGN) { - var u = this.b.iszilch() ? 1 : 0; - p2 ^= (p1 ^ p2) & u; - return p2; - } else { - var u = this.a.iszilch() ? 1 : 0; - p1 ^= (p1 ^ p2) & u; - return p1; - } - }, - - /* this=-this */ - neg: function () { - this.norm(); - var m = new ctx.FP4(this.a), - t = new ctx.FP4(0); - - m.add(this.b); - m.neg(); - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - this.norm(); - }, - - /* this=conjugate(this) */ - conj: function () { - this.b.neg(); - this.norm(); - }, - - /* this=-conjugate(this) */ - nconj: function () { - this.a.neg(); - this.norm(); - }, - - /* this+=x */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP8(x); - m.neg(); - this.add(m); - }, - - rsub: function (x) { - this.neg(); - this.add(x); - }, - - /* this*=s where s is FP4 */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=c where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - var t1 = new ctx.FP4(this.a), - t2 = new ctx.FP4(this.b), - t3 = new ctx.FP4(this.a); - - t3.mul(this.b); - t1.add(this.b); - t1.norm(); - t2.times_i(); - - t2.add(this.a); - t2.norm(); - this.a.copy(t1); - - this.a.mul(t2); - - t2.copy(t3); - t2.times_i(); - t2.add(t3); - - t2.neg(); - - this.a.add(t2); - - this.b.copy(t3); - this.b.add(t3); - - this.norm(); - }, - - /* this*=y */ - mul: function (y) { - var t1 = new ctx.FP4(this.a), - t2 = new ctx.FP4(this.b), - t3 = new ctx.FP4(0), - t4 = new ctx.FP4(this.b); - - t1.mul(y.a); - t2.mul(y.b); - t3.copy(y.b); - t3.add(y.a); - t4.add(this.a); - - t3.norm(); - t4.norm(); - - t4.mul(t3); - - t3.copy(t1); - t3.neg(); - t4.add(t3); - - t3.copy(t2); - t3.neg(); - this.b.copy(t4); - this.b.add(t3); - - t2.times_i(); - this.a.copy(t2); - this.a.add(t1); - - this.norm(); - }, - - /* convert to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function (h) { - this.norm(); - - var t1 = new ctx.FP4(this.a), - t2 = new ctx.FP4(this.b); - - t1.sqr(); - t2.sqr(); - t2.times_i(); - t2.norm(); // ?? - t1.sub(t2); - t1.inverse(h); - this.a.mul(t1); - t1.neg(); - t1.norm(); - this.b.mul(t1); - }, - - /* this*=i where i = sqrt(-1+sqrt(-1)) */ - times_i: function () { - var s = new ctx.FP4(this.b), - t = new ctx.FP4(this.a); - - s.times_i(); - this.b.copy(t); - - this.a.copy(s); - this.norm(); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - times_i2: function () { - this.a.times_i(); - this.b.times_i(); - }, - - /* this=this^q using Frobenius, where q is Modulus */ - frob: function (f) { - var ff = new ctx.FP2(f); - ff.sqr(); - ff.mul_ip(); - ff.norm(); - this.a.frob(ff); - this.b.frob(ff); - this.b.pmul(f); - this.b.times_i(); - }, - - /* this=this^e */ - /* - pow: function(e) { - var w = new FP8(this), - z = new ctx.BIG(e), - r = new FP8(1), - bt; - w.norm(); - z.norm(); - for (;;) { - bt = z.parity(); - z.fshr(1); - - if (bt === 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - - w.sqr(); - } - r.reduce(); - - return r; - }, */ - - /* XTR xtr_a function */ - /* - xtr_A: function(w, y, z) { - var r = new FP8(w), - t = new FP8(w); - - r.sub(y); - r.norm(); - r.pmul(this.a); - t.add(y); - t.norm(); - t.pmul(this.b); - t.times_i(); - - this.copy(r); - this.add(t); - this.add(z); - - this.reduce(); - }, -*/ - /* XTR xtr_d function */ - /* - xtr_D: function() { - var w = new FP8(this); //w.copy(this); - this.sqr(); - w.conj(); - w.add(w); - this.sub(w); - this.reduce(); - }, -*/ - /* r=x^n using XTR method on traces of FP24s */ - /* - xtr_pow: function(n) { - var sf = new FP8(this); - sf.norm(); - var a = new FP8(3), - b = new FP8(sf), - c = new FP8(b), - t = new FP8(0), - r = new FP8(0), - par, v, nb, i; - - c.xtr_D(); - - - par = n.parity(); - v = new ctx.BIG(n); - v.norm(); - v.fshr(1); - - if (par === 0) { - v.dec(1); - v.norm(); - } - - nb = v.nbits(); - for (i = nb - 1; i >= 0; i--) { - if (v.bit(i) != 1) { - t.copy(b); - sf.conj(); - c.conj(); - b.xtr_A(a, sf, c); - sf.conj(); - c.copy(t); - c.xtr_D(); - a.xtr_D(); - } else { - t.copy(a); - t.conj(); - a.copy(b); - a.xtr_D(); - b.xtr_A(c, sf, t); - c.xtr_D(); - } - } - - if (par === 0) { - r.copy(c); - } else { - r.copy(b); - } - r.reduce(); - - return r; - }, -*/ - /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP24s. See Stam thesis. */ - /* - xtr_pow2: function(ck, ckml, ckm2l, a, b) { - - var e = new ctx.BIG(a), - d = new ctx.BIG(b), - w = new ctx.BIG(0), - cu = new FP8(ck), - cv = new FP8(this), - cumv = new FP8(ckml), - cum2v = new FP8(ckm2l), - r = new FP8(0), - t = new FP8(0), - f2 = 0, - i; - - e.norm(); - d.norm(); - - while (d.parity() === 0 && e.parity() === 0) { - d.fshr(1); - e.fshr(1); - f2++; - } - - while (ctx.BIG.comp(d, e) !== 0) { - if (ctx.BIG.comp(d, e) > 0) { - w.copy(e); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(d, w) <= 0) { - w.copy(d); - d.copy(e); - e.rsub(w); - e.norm(); - - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cum2v.conj(); - cumv.copy(cv); - cv.copy(cu); - cu.copy(t); - - } else if (d.parity() === 0) { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } else if (e.parity() == 1) { - d.sub(e); - d.norm(); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cu.xtr_D(); - cum2v.copy(cv); - cum2v.xtr_D(); - cum2v.conj(); - cv.copy(t); - } else { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } - } - if (ctx.BIG.comp(d, e) < 0) { - w.copy(d); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(e, w) <= 0) { - e.sub(d); - e.norm(); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cumv.copy(cu); - cu.copy(t); - } else if (e.parity() === 0) { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() == 1) { - w.copy(e); - e.copy(d); - w.sub(d); - w.norm(); - d.copy(w); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cumv.conj(); - cum2v.copy(cu); - cum2v.xtr_D(); - cum2v.conj(); - cu.copy(cv); - cu.xtr_D(); - cv.copy(t); - } else { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } - } - } - r.copy(cv); - r.xtr_A(cu, cumv, cum2v); - for (i = 0; i < f2; i++) { - r.xtr_D(); - } - r = r.xtr_pow(d); - return r; - }, -*/ - /* New stuff for ecp4.js */ - - div2: function () { - this.a.div2(); - this.b.div2(); - }, - - div_i: function () { - var u = new ctx.FP4(this.a), - v = new ctx.FP4(this.b); - u.div_i(); - this.a.copy(v); - this.b.copy(u); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - qmul: function (s) { - this.a.pmul(s); - this.b.pmul(s); - }, - - tmul: function (s) { - this.a.qmul(s); - this.b.qmul(s); - }, - - /* this^e */ - /* - pow: function(e) { - var r = new FP8(1), - w = new FP8(this), - z = new ctx.BIG(e), - bt; - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - w.sqr(); - } - - r.reduce(); - this.copy(r); - },*/ - - qr: function (h) { - var c = new FP8(this); - c.conj(); - c.mul(this); - return c.geta().qr(h); - }, - - sqrt: function (h) { - if (this.iszilch()) { - return; - } - var wa = new ctx.FP4(this.a), - wb = new ctx.FP4(this.a), - ws = new ctx.FP4(this.b), - wt = new ctx.FP4(this.a); - var hint = new ctx.FP(0); - - ws.sqr(); - wa.sqr(); - ws.times_i(); - ws.norm(); - wa.sub(ws); - - ws.copy(wa); - ws.norm(); - ws.sqrt(h); - - wa.copy(wt); - wa.add(ws); - wa.norm(); - wa.div2(); - - wb.copy(this.b); - wb.div2(); - var qr = wa.qr(hint); - - // tweak hint - multiply old hint by Norm(1/Beta)^e where Beta is irreducible polynomial - ws.copy(wa); - var twk = new ctx.FP(0); - twk.rcopy(ctx.ROM_FIELD.TWK); - twk.mul(hint); - ws.div_i(); - ws.norm(); - - wa.cmove(ws, 1 - qr); - hint.cmove(twk, 1 - qr); - - this.a.copy(wa); - this.a.sqrt(hint); - ws.copy(wa); - ws.inverse(hint); - ws.mul(this.a); - this.b.copy(ws); - this.b.mul(wb); - wt.copy(this.a); - - this.a.cmove(this.b, 1 - qr); - this.b.cmove(wt, 1 - qr); - - var sgn = this.sign(); - var nr = new FP8(this); - nr.neg(); - nr.norm(); - this.cmove(nr, sgn); - }, - }; - - FP8.rand = function (rng) { - return new FP8(ctx.FP4.rand(rng), ctx.FP4.rand(rng)); - }; - - FP8.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP4.fromBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = bf[i + 4 * ctx.BIG.MODBYTES]; - var ta = ctx.FP4.fromBytes(t); - return new FP8(ta, tb); - }; - - return FP8; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP8: FP8, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/gcm.js b/packages/bls-verify/src/vendor/amcl-js/src/gcm.js deleted file mode 100644 index a66c0b39a..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/gcm.js +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Implementation of the ctx.AES-GCM Encryption/Authentication - * - * Some restrictions.. - * 1. Only for use with ctx.AES - * 2. Returned tag is always 128-bits. Truncate at your own risk. - * 3. The order of function calls must follow some rules - * - * Typical sequence of calls.. - * 1. call GCM_init - * 2. call GCM_add_header any number of times, as long as length of header is multiple of 16 bytes (block size) - * 3. call GCM_add_header one last time with any length of header - * 4. call GCM_add_cipher any number of times, as long as length of cipher/plaintext is multiple of 16 bytes - * 5. call GCM_add_cipher one last time with any length of cipher/plaintext - * 6. call GCM_finish to extract the tag. - * - * See http://www.mindspring.com/~dmcgrew/gcm-nist-6.pdf - */ - -var GCM = function (ctx) { - 'use strict'; - - var GCM = function () { - this.table = new Array(128); - for (var i = 0; i < 128; i++) { - this.table[i] = new Array(4); /* 2k bytes */ - } - this.stateX = []; - this.Y_0 = []; - this.counter = 0; - this.lenA = []; - this.lenC = []; - this.status = 0; - this.a = new ctx.AES(); - }; - - // GCM constants - - GCM.ACCEPTING_HEADER = 0; - GCM.ACCEPTING_CIPHER = 1; - GCM.NOT_ACCEPTING_MORE = 2; - GCM.FINISHED = 3; - GCM.ENCRYPTING = 0; - GCM.DECRYPTING = 1; - - GCM.prototype = { - precompute: function (H) { - var b = [], - i, - j, - c; - - for (i = j = 0; i < 4; i++, j += 4) { - b[0] = H[j]; - b[1] = H[j + 1]; - b[2] = H[j + 2]; - b[3] = H[j + 3]; - this.table[0][i] = GCM.pack(b); - } - for (i = 1; i < 128; i++) { - c = 0; - for (j = 0; j < 4; j++) { - this.table[i][j] = c | (this.table[i - 1][j] >>> 1); - c = this.table[i - 1][j] << 31; - } - - if (c !== 0) { - this.table[i][0] ^= 0xe1000000; /* irreducible polynomial */ - } - } - }, - - gf2mul: function () { - /* gf2m mul - Z=H*X mod 2^128 */ - var P = [], - b = [], - i, - j, - m, - k, - c; - - P[0] = P[1] = P[2] = P[3] = 0; - j = 8; - m = 0; - - for (i = 0; i < 128; i++) { - c = (this.stateX[m] >>> --j) & 1; - c = ~c + 1; - for (k = 0; k < 4; k++) { - P[k] ^= this.table[i][k] & c; - } - - if (j === 0) { - j = 8; - m++; - if (m == 16) { - break; - } - } - } - - for (i = j = 0; i < 4; i++, j += 4) { - b = GCM.unpack(P[i]); - this.stateX[j] = b[0]; - this.stateX[j + 1] = b[1]; - this.stateX[j + 2] = b[2]; - this.stateX[j + 3] = b[3]; - } - }, - - wrap: function () { - /* Finish off GHASH */ - var F = [], - L = [], - b = [], - i, - j; - - /* convert lengths from bytes to bits */ - F[0] = (this.lenA[0] << 3) | ((this.lenA[1] & 0xe0000000) >>> 29); - F[1] = this.lenA[1] << 3; - F[2] = (this.lenC[0] << 3) | ((this.lenC[1] & 0xe0000000) >>> 29); - F[3] = this.lenC[1] << 3; - - for (i = j = 0; i < 4; i++, j += 4) { - b = GCM.unpack(F[i]); - L[j] = b[0]; - L[j + 1] = b[1]; - L[j + 2] = b[2]; - L[j + 3] = b[3]; - } - - for (i = 0; i < 16; i++) { - this.stateX[i] ^= L[i]; - } - - this.gf2mul(); - }, - - /* Initialize GCM mode */ - init: function (nk, key, niv, iv) { - /* iv size niv is usually 12 bytes (96 bits). ctx.AES key size nk can be 16,24 or 32 bytes */ - var H = [], - b = [], - i; - - for (i = 0; i < 16; i++) { - H[i] = 0; - this.stateX[i] = 0; - } - - this.a.init(ctx.AES.ECB, nk, key, iv); - this.a.ecb_encrypt(H); /* E(K,0) */ - this.precompute(H); - - this.lenA[0] = this.lenC[0] = this.lenA[1] = this.lenC[1] = 0; - - if (niv == 12) { - for (i = 0; i < 12; i++) { - this.a.f[i] = iv[i]; - } - - b = GCM.unpack(1); - this.a.f[12] = b[0]; - this.a.f[13] = b[1]; - this.a.f[14] = b[2]; - this.a.f[15] = b[3]; /* initialise IV */ - - for (i = 0; i < 16; i++) { - this.Y_0[i] = this.a.f[i]; - } - } else { - this.status = GCM.ACCEPTING_CIPHER; - this.ghash(iv, niv); /* GHASH(H,0,IV) */ - this.wrap(); - - for (i = 0; i < 16; i++) { - this.a.f[i] = this.stateX[i]; - this.Y_0[i] = this.a.f[i]; - this.stateX[i] = 0; - } - - this.lenA[0] = this.lenC[0] = this.lenA[1] = this.lenC[1] = 0; - } - - this.status = GCM.ACCEPTING_HEADER; - }, - - /* Add Header data - included but not encrypted */ - add_header: function (header, len) { - /* Add some header. Won't be encrypted, but will be authenticated. len is length of header */ - var i, - j = 0; - - if (this.status != GCM.ACCEPTING_HEADER) { - return false; - } - - while (j < len) { - for (i = 0; i < 16 && j < len; i++) { - this.stateX[i] ^= header[j++]; - this.lenA[1]++; - this.lenA[1] |= 0; - - if (this.lenA[1] === 0) { - this.lenA[0]++; - } - } - - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.ACCEPTING_CIPHER; - } - - return true; - }, - - ghash: function (plain, len) { - var i, - j = 0; - - if (this.status == GCM.ACCEPTING_HEADER) { - this.status = GCM.ACCEPTING_CIPHER; - } - - if (this.status != GCM.ACCEPTING_CIPHER) { - return false; - } - - while (j < len) { - for (i = 0; i < 16 && j < len; i++) { - this.stateX[i] ^= plain[j++]; - this.lenC[1]++; - this.lenC[1] |= 0; - - if (this.lenC[1] === 0) { - this.lenC[0]++; - } - } - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.NOT_ACCEPTING_MORE; - } - - return true; - }, - - /* Add Plaintext - included and encrypted */ - add_plain: function (plain, len) { - var B = [], - b = [], - cipher = [], - i, - j = 0; - - if (this.status == GCM.ACCEPTING_HEADER) { - this.status = GCM.ACCEPTING_CIPHER; - } - - if (this.status != GCM.ACCEPTING_CIPHER) { - return cipher; - } - - while (j < len) { - b[0] = this.a.f[12]; - b[1] = this.a.f[13]; - b[2] = this.a.f[14]; - b[3] = this.a.f[15]; - this.counter = GCM.pack(b); - this.counter++; - b = GCM.unpack(this.counter); - this.a.f[12] = b[0]; - this.a.f[13] = b[1]; - this.a.f[14] = b[2]; - this.a.f[15] = b[3]; /* increment counter */ - - for (i = 0; i < 16; i++) { - B[i] = this.a.f[i]; - } - - this.a.ecb_encrypt(B); /* encrypt it */ - - for (i = 0; i < 16 && j < len; i++) { - cipher[j] = plain[j] ^ B[i]; - this.stateX[i] ^= cipher[j++]; - this.lenC[1]++; - this.lenC[1] |= 0; - - if (this.lenC[1] === 0) { - this.lenC[0]++; - } - } - - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.NOT_ACCEPTING_MORE; - } - - return cipher; - }, - - /* Add Ciphertext - decrypts to plaintext */ - add_cipher: function (cipher, len) { - var B = [], - b = [], - plain = [], - j = 0, - i, - oc; - - if (this.status == GCM.ACCEPTING_HEADER) { - this.status = GCM.ACCEPTING_CIPHER; - } - - if (this.status != GCM.ACCEPTING_CIPHER) { - return plain; - } - - while (j < len) { - b[0] = this.a.f[12]; - b[1] = this.a.f[13]; - b[2] = this.a.f[14]; - b[3] = this.a.f[15]; - this.counter = GCM.pack(b); - this.counter++; - b = GCM.unpack(this.counter); - this.a.f[12] = b[0]; - this.a.f[13] = b[1]; - this.a.f[14] = b[2]; - this.a.f[15] = b[3]; /* increment counter */ - - for (i = 0; i < 16; i++) { - B[i] = this.a.f[i]; - } - - this.a.ecb_encrypt(B); /* encrypt it */ - - for (i = 0; i < 16 && j < len; i++) { - oc = cipher[j]; - plain[j] = cipher[j] ^ B[i]; - this.stateX[i] ^= oc; - j++; - this.lenC[1]++; - this.lenC[1] |= 0; - - if (this.lenC[1] === 0) { - this.lenC[0]++; - } - } - - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.NOT_ACCEPTING_MORE; - } - - return plain; - }, - - /* Finish and extract Tag */ - finish: function (extract) { - /* Finish off GHASH and extract tag (MAC) */ - var tag = [], - i; - - this.wrap(); - /* extract tag */ - if (extract) { - this.a.ecb_encrypt(this.Y_0); /* E(K,Y0) */ - - for (i = 0; i < 16; i++) { - this.Y_0[i] ^= this.stateX[i]; - } - - for (i = 0; i < 16; i++) { - tag[i] = this.Y_0[i]; - this.Y_0[i] = this.stateX[i] = 0; - } - } - - this.status = GCM.FINISHED; - this.a.end(); - - return tag; - }, - }; - - GCM.pack = function (b) { - /* pack 4 bytes into a 32-bit Word */ - return ((b[0] & 0xff) << 24) | ((b[1] & 0xff) << 16) | ((b[2] & 0xff) << 8) | (b[3] & 0xff); - }; - - GCM.unpack = function (a) { - /* unpack bytes from a word */ - var b = []; - - b[3] = a & 0xff; - b[2] = (a >>> 8) & 0xff; - b[1] = (a >>> 16) & 0xff; - b[0] = (a >>> 24) & 0xff; - - return b; - }; - - GCM.hex2bytes = function (s) { - var len = s.length, - data = [], - i; - - for (i = 0; i < len; i += 2) { - data[i / 2] = parseInt(s.substr(i, 2), 16); - } - - return data; - }; - - GCM.encrypt = function (C, T, K, IV, H, P) { - var g = new GCM(); - g.init(K.length, K, IV.length, IV); - g.add_header(H, H.length); - var b = g.add_plain(P, P.length); - for (var i = 0; i < b.length; i++) C[i] = b[i]; - b = g.finish(true); - for (var i = 0; i < b.length; i++) T[i] = b[i]; - }; - - GCM.decrypt = function (P, T, K, IV, H, C) { - var g = new GCM(); - g.init(K.length, K, IV.length, IV); - g.add_header(H, H.length); - var b = g.add_cipher(C, C.length); - for (var i = 0; i < b.length; i++) P[i] = b[i]; - b = g.finish(true); - for (var i = 0; i < b.length; i++) T[i] = b[i]; - }; - - return GCM; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - GCM: GCM, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hash256.js b/packages/bls-verify/src/vendor/amcl-js/src/hash256.js deleted file mode 100644 index 7a629e5d1..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hash256.js +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HASH256 = function () { - 'use strict'; - - var HASH256 = function () { - this.length = []; - this.h = []; - this.w = []; - this.init(); - }; - - HASH256.prototype = { - transform: function () { - /* basic transformation step */ - var a, b, c, d, e, f, g, hh, t1, t2, j; - - for (j = 16; j < 64; j++) { - this.w[j] = - (HASH256.theta1(this.w[j - 2]) + - this.w[j - 7] + - HASH256.theta0(this.w[j - 15]) + - this.w[j - 16]) | - 0; - } - - a = this.h[0]; - b = this.h[1]; - c = this.h[2]; - d = this.h[3]; - e = this.h[4]; - f = this.h[5]; - g = this.h[6]; - hh = this.h[7]; - - for (j = 0; j < 64; j++) { - /* 64 times - mush it up */ - t1 = (hh + HASH256.Sig1(e) + HASH256.Ch(e, f, g) + HASH256.HK[j] + this.w[j]) | 0; - t2 = (HASH256.Sig0(a) + HASH256.Maj(a, b, c)) | 0; - hh = g; - g = f; - f = e; - e = (d + t1) | 0; // Need to knock these back down to prevent 52-bit overflow - d = c; - c = b; - b = a; - a = (t1 + t2) | 0; - } - this.h[0] += a; - this.h[1] += b; - this.h[2] += c; - this.h[3] += d; - this.h[4] += e; - this.h[5] += f; - this.h[6] += g; - this.h[7] += hh; - }, - - /* Initialise Hash function */ - init: function () { - /* initialise */ - var i; - - for (i = 0; i < 64; i++) { - this.w[i] = 0; - } - this.length[0] = this.length[1] = 0; - this.h[0] = HASH256.H[0]; - this.h[1] = HASH256.H[1]; - this.h[2] = HASH256.H[2]; - this.h[3] = HASH256.H[3]; - this.h[4] = HASH256.H[4]; - this.h[5] = HASH256.H[5]; - this.h[6] = HASH256.H[6]; - this.h[7] = HASH256.H[7]; - }, - - copy: function (b) { - for (var i = 0; i < 64; i++) { - this.w[i] = b.w[i]; - } - this.length[0] = b.length[0]; - this.length[1] = b.length[1]; - for (var i = 0; i < 8; i++) { - this.h[i] = b.h[i]; - } - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var cnt; - - cnt = (this.length[0] >>> 5) % 16; - this.w[cnt] <<= 8; - this.w[cnt] |= byt & 0xff; - this.length[0] += 8; - - if ((this.length[0] & 0xffffffff) === 0) { - this.length[1]++; - this.length[0] = 0; - } - - if (this.length[0] % 512 === 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - hash: function () { - /* pad message and finish - supply digest */ - var digest = [], - len0, - len1, - i; - - len0 = this.length[0]; - len1 = this.length[1]; - this.process(0x80); - - while (this.length[0] % 512 != 448) { - this.process(0); - } - - this.w[14] = len1; - this.w[15] = len0; - this.transform(); - - for (i = 0; i < HASH256.len; i++) { - /* convert to bytes */ - digest[i] = (this.h[i >>> 2] >> (8 * (3 - (i % 4)))) & 0xff; - } - this.init(); - - return digest; - }, - - continuing_hash() { - var sh = new HASH256(); - sh.copy(this); - return sh.hash(); - }, - }; - - /* static functions */ - - HASH256.S = function (n, x) { - return (x >>> n) | (x << (32 - n)); - }; - - HASH256.R = function (n, x) { - return x >>> n; - }; - - HASH256.Ch = function (x, y, z) { - return (x & y) ^ (~x & z); - }; - - HASH256.Maj = function (x, y, z) { - return (x & y) ^ (x & z) ^ (y & z); - }; - - HASH256.Sig0 = function (x) { - return HASH256.S(2, x) ^ HASH256.S(13, x) ^ HASH256.S(22, x); - }; - - HASH256.Sig1 = function (x) { - return HASH256.S(6, x) ^ HASH256.S(11, x) ^ HASH256.S(25, x); - }; - - HASH256.theta0 = function (x) { - return HASH256.S(7, x) ^ HASH256.S(18, x) ^ HASH256.R(3, x); - }; - - HASH256.theta1 = function (x) { - return HASH256.S(17, x) ^ HASH256.S(19, x) ^ HASH256.R(10, x); - }; - - /* constants */ - HASH256.len = 32; - - HASH256.H = [ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, - ]; - - HASH256.HK = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, - ]; - - return HASH256; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HASH256: HASH256, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hash384.js b/packages/bls-verify/src/vendor/amcl-js/src/hash384.js deleted file mode 100644 index d27028ae3..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hash384.js +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HASH384 = function (ctx) { - 'use strict'; - - var HASH384 = function () { - this.length = []; - this.h = []; - this.w = []; - this.init(); - }; - - HASH384.prototype = { - transform: function () { - /* basic transformation step */ - var a, b, c, d, e, f, g, hh, t1, t2, j; - - for (j = 16; j < 80; j++) { - this.w[j] = HASH384.theta1(this.w[j - 2]) - .add(this.w[j - 7]) - .add(HASH384.theta0(this.w[j - 15])) - .add(this.w[j - 16]); - } - - a = this.h[0].copy(); - b = this.h[1].copy(); - c = this.h[2].copy(); - d = this.h[3].copy(); - e = this.h[4].copy(); - f = this.h[5].copy(); - g = this.h[6].copy(); - hh = this.h[7].copy(); - - for (j = 0; j < 80; j++) { - /* 80 times - mush it up */ - t1 = hh.copy(); - t1.add(HASH384.Sig1(e)).add(HASH384.Ch(e, f, g)).add(HASH384.HK[j]).add(this.w[j]); - - t2 = HASH384.Sig0(a); - t2.add(HASH384.Maj(a, b, c)); - hh = g; - g = f; - f = e; - e = d.copy(); - e.add(t1); - - d = c; - c = b; - b = a; - a = t1.copy(); - a.add(t2); - } - - this.h[0].add(a); - this.h[1].add(b); - this.h[2].add(c); - this.h[3].add(d); - this.h[4].add(e); - this.h[5].add(f); - this.h[6].add(g); - this.h[7].add(hh); - }, - - copy: function (b) { - for (var i = 0; i < 80; i++) { - this.w[i] = b.w[i].copy(); - } - this.length[0] = b.length[0].copy(); - this.length[1] = b.length[1].copy(); - for (var i = 0; i < 8; i++) { - this.h[i] = b.h[i].copy(); - } - }, - - /* Initialise Hash function */ - init: function () { - /* initialise */ - var i; - - for (i = 0; i < 80; i++) { - this.w[i] = new ctx.UInt64(0, 0); - } - this.length[0] = new ctx.UInt64(0, 0); - this.length[1] = new ctx.UInt64(0, 0); - this.h[0] = HASH384.H[0].copy(); - this.h[1] = HASH384.H[1].copy(); - this.h[2] = HASH384.H[2].copy(); - this.h[3] = HASH384.H[3].copy(); - this.h[4] = HASH384.H[4].copy(); - this.h[5] = HASH384.H[5].copy(); - this.h[6] = HASH384.H[6].copy(); - this.h[7] = HASH384.H[7].copy(); - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var cnt, e; - - cnt = (this.length[0].bot >>> 6) % 16; - this.w[cnt].shlb(); - this.w[cnt].bot |= byt & 0xff; - - e = new ctx.UInt64(0, 8); - this.length[0].add(e); - - if (this.length[0].top === 0 && this.length[0].bot == 0) { - e = new ctx.UInt64(0, 1); - this.length[1].add(e); - } - - if (this.length[0].bot % 1024 === 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - hash: function () { - /* pad message and finish - supply digest */ - var digest = [], - len0, - len1, - i; - - len0 = this.length[0].copy(); - len1 = this.length[1].copy(); - this.process(0x80); - while (this.length[0].bot % 1024 != 896) { - this.process(0); - } - - this.w[14] = len1; - this.w[15] = len0; - this.transform(); - - for (i = 0; i < HASH384.len; i++) { - /* convert to bytes */ - digest[i] = HASH384.R(8 * (7 - (i % 8)), this.h[i >>> 3]).bot & 0xff; - } - - this.init(); - - return digest; - }, - - continuing_hash() { - var sh = new HASH384(); - sh.copy(this); - return sh.hash(); - }, - }; - - /* static functions */ - HASH384.S = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64( - (x.top >>> n) | (x.bot << (32 - n)), - (x.bot >>> n) | (x.top << (32 - n)), - ); - } else { - return new ctx.UInt64( - (x.bot >>> (n - 32)) | (x.top << (64 - n)), - (x.top >>> (n - 32)) | (x.bot << (64 - n)), - ); - } - }; - - HASH384.R = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64(x.top >>> n, (x.bot >>> n) | (x.top << (32 - n))); - } else { - return new ctx.UInt64(0, x.top >>> (n - 32)); - } - }; - - HASH384.Ch = function (x, y, z) { - return new ctx.UInt64((x.top & y.top) ^ (~x.top & z.top), (x.bot & y.bot) ^ (~x.bot & z.bot)); - }; - - HASH384.Maj = function (x, y, z) { - return new ctx.UInt64( - (x.top & y.top) ^ (x.top & z.top) ^ (y.top & z.top), - (x.bot & y.bot) ^ (x.bot & z.bot) ^ (y.bot & z.bot), - ); - }; - - HASH384.Sig0 = function (x) { - var r1 = HASH384.S(28, x), - r2 = HASH384.S(34, x), - r3 = HASH384.S(39, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.Sig1 = function (x) { - var r1 = HASH384.S(14, x), - r2 = HASH384.S(18, x), - r3 = HASH384.S(41, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.theta0 = function (x) { - var r1 = HASH384.S(1, x), - r2 = HASH384.S(8, x), - r3 = HASH384.R(7, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.theta1 = function (x) { - var r1 = HASH384.S(19, x), - r2 = HASH384.S(61, x), - r3 = HASH384.R(6, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.len = 48; - - HASH384.H = [ - new ctx.UInt64(0xcbbb9d5d, 0xc1059ed8), - new ctx.UInt64(0x629a292a, 0x367cd507), - new ctx.UInt64(0x9159015a, 0x3070dd17), - new ctx.UInt64(0x152fecd8, 0xf70e5939), - new ctx.UInt64(0x67332667, 0xffc00b31), - new ctx.UInt64(0x8eb44a87, 0x68581511), - new ctx.UInt64(0xdb0c2e0d, 0x64f98fa7), - new ctx.UInt64(0x47b5481d, 0xbefa4fa4), - ]; - - HASH384.HK = [ - new ctx.UInt64(0x428a2f98, 0xd728ae22), - new ctx.UInt64(0x71374491, 0x23ef65cd), - new ctx.UInt64(0xb5c0fbcf, 0xec4d3b2f), - new ctx.UInt64(0xe9b5dba5, 0x8189dbbc), - new ctx.UInt64(0x3956c25b, 0xf348b538), - new ctx.UInt64(0x59f111f1, 0xb605d019), - new ctx.UInt64(0x923f82a4, 0xaf194f9b), - new ctx.UInt64(0xab1c5ed5, 0xda6d8118), - new ctx.UInt64(0xd807aa98, 0xa3030242), - new ctx.UInt64(0x12835b01, 0x45706fbe), - new ctx.UInt64(0x243185be, 0x4ee4b28c), - new ctx.UInt64(0x550c7dc3, 0xd5ffb4e2), - new ctx.UInt64(0x72be5d74, 0xf27b896f), - new ctx.UInt64(0x80deb1fe, 0x3b1696b1), - new ctx.UInt64(0x9bdc06a7, 0x25c71235), - new ctx.UInt64(0xc19bf174, 0xcf692694), - new ctx.UInt64(0xe49b69c1, 0x9ef14ad2), - new ctx.UInt64(0xefbe4786, 0x384f25e3), - new ctx.UInt64(0x0fc19dc6, 0x8b8cd5b5), - new ctx.UInt64(0x240ca1cc, 0x77ac9c65), - new ctx.UInt64(0x2de92c6f, 0x592b0275), - new ctx.UInt64(0x4a7484aa, 0x6ea6e483), - new ctx.UInt64(0x5cb0a9dc, 0xbd41fbd4), - new ctx.UInt64(0x76f988da, 0x831153b5), - new ctx.UInt64(0x983e5152, 0xee66dfab), - new ctx.UInt64(0xa831c66d, 0x2db43210), - new ctx.UInt64(0xb00327c8, 0x98fb213f), - new ctx.UInt64(0xbf597fc7, 0xbeef0ee4), - new ctx.UInt64(0xc6e00bf3, 0x3da88fc2), - new ctx.UInt64(0xd5a79147, 0x930aa725), - new ctx.UInt64(0x06ca6351, 0xe003826f), - new ctx.UInt64(0x14292967, 0x0a0e6e70), - new ctx.UInt64(0x27b70a85, 0x46d22ffc), - new ctx.UInt64(0x2e1b2138, 0x5c26c926), - new ctx.UInt64(0x4d2c6dfc, 0x5ac42aed), - new ctx.UInt64(0x53380d13, 0x9d95b3df), - new ctx.UInt64(0x650a7354, 0x8baf63de), - new ctx.UInt64(0x766a0abb, 0x3c77b2a8), - new ctx.UInt64(0x81c2c92e, 0x47edaee6), - new ctx.UInt64(0x92722c85, 0x1482353b), - new ctx.UInt64(0xa2bfe8a1, 0x4cf10364), - new ctx.UInt64(0xa81a664b, 0xbc423001), - new ctx.UInt64(0xc24b8b70, 0xd0f89791), - new ctx.UInt64(0xc76c51a3, 0x0654be30), - new ctx.UInt64(0xd192e819, 0xd6ef5218), - new ctx.UInt64(0xd6990624, 0x5565a910), - new ctx.UInt64(0xf40e3585, 0x5771202a), - new ctx.UInt64(0x106aa070, 0x32bbd1b8), - new ctx.UInt64(0x19a4c116, 0xb8d2d0c8), - new ctx.UInt64(0x1e376c08, 0x5141ab53), - new ctx.UInt64(0x2748774c, 0xdf8eeb99), - new ctx.UInt64(0x34b0bcb5, 0xe19b48a8), - new ctx.UInt64(0x391c0cb3, 0xc5c95a63), - new ctx.UInt64(0x4ed8aa4a, 0xe3418acb), - new ctx.UInt64(0x5b9cca4f, 0x7763e373), - new ctx.UInt64(0x682e6ff3, 0xd6b2b8a3), - new ctx.UInt64(0x748f82ee, 0x5defb2fc), - new ctx.UInt64(0x78a5636f, 0x43172f60), - new ctx.UInt64(0x84c87814, 0xa1f0ab72), - new ctx.UInt64(0x8cc70208, 0x1a6439ec), - new ctx.UInt64(0x90befffa, 0x23631e28), - new ctx.UInt64(0xa4506ceb, 0xde82bde9), - new ctx.UInt64(0xbef9a3f7, 0xb2c67915), - new ctx.UInt64(0xc67178f2, 0xe372532b), - new ctx.UInt64(0xca273ece, 0xea26619c), - new ctx.UInt64(0xd186b8c7, 0x21c0c207), - new ctx.UInt64(0xeada7dd6, 0xcde0eb1e), - new ctx.UInt64(0xf57d4f7f, 0xee6ed178), - new ctx.UInt64(0x06f067aa, 0x72176fba), - new ctx.UInt64(0x0a637dc5, 0xa2c898a6), - new ctx.UInt64(0x113f9804, 0xbef90dae), - new ctx.UInt64(0x1b710b35, 0x131c471b), - new ctx.UInt64(0x28db77f5, 0x23047d84), - new ctx.UInt64(0x32caab7b, 0x40c72493), - new ctx.UInt64(0x3c9ebe0a, 0x15c9bebc), - new ctx.UInt64(0x431d67c4, 0x9c100d4c), - new ctx.UInt64(0x4cc5d4be, 0xcb3e42b6), - new ctx.UInt64(0x597f299c, 0xfc657e2a), - new ctx.UInt64(0x5fcb6fab, 0x3ad6faec), - new ctx.UInt64(0x6c44198c, 0x4a475817), - ]; - - return HASH384; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HASH384: HASH384, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hash512.js b/packages/bls-verify/src/vendor/amcl-js/src/hash512.js deleted file mode 100644 index 6a2797177..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hash512.js +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HASH512 = function (ctx) { - 'use strict'; - - var HASH512 = function () { - this.length = []; - this.h = []; - this.w = []; - this.init(); - }; - - HASH512.prototype = { - transform: function () { - /* basic transformation step */ - var a, b, c, d, e, f, g, hh, t1, t2, j; - - for (j = 16; j < 80; j++) { - this.w[j] = HASH512.theta1(this.w[j - 2]) - .add(this.w[j - 7]) - .add(HASH512.theta0(this.w[j - 15])) - .add(this.w[j - 16]); - } - - a = this.h[0].copy(); - b = this.h[1].copy(); - c = this.h[2].copy(); - d = this.h[3].copy(); - e = this.h[4].copy(); - f = this.h[5].copy(); - g = this.h[6].copy(); - hh = this.h[7].copy(); - - for (j = 0; j < 80; j++) { - /* 80 times - mush it up */ - t1 = hh.copy(); - t1.add(HASH512.Sig1(e)).add(HASH512.Ch(e, f, g)).add(HASH512.HK[j]).add(this.w[j]); - - t2 = HASH512.Sig0(a); - t2.add(HASH512.Maj(a, b, c)); - hh = g; - g = f; - f = e; - e = d.copy(); - e.add(t1); - - d = c; - c = b; - b = a; - a = t1.copy(); - a.add(t2); - } - - this.h[0].add(a); - this.h[1].add(b); - this.h[2].add(c); - this.h[3].add(d); - this.h[4].add(e); - this.h[5].add(f); - this.h[6].add(g); - this.h[7].add(hh); - }, - - copy: function (b) { - for (var i = 0; i < 80; i++) { - this.w[i] = b.w[i].copy(); - } - this.length[0] = b.length[0].copy(); - this.length[1] = b.length[1].copy(); - for (var i = 0; i < 8; i++) { - this.h[i] = b.h[i].copy(); - } - }, - - /* Initialise Hash function */ - init: function () { - /* initialise */ - var i; - - for (i = 0; i < 80; i++) { - this.w[i] = new ctx.UInt64(0, 0); - } - - this.length[0] = new ctx.UInt64(0, 0); - this.length[1] = new ctx.UInt64(0, 0); - this.h[0] = HASH512.H[0].copy(); - this.h[1] = HASH512.H[1].copy(); - this.h[2] = HASH512.H[2].copy(); - this.h[3] = HASH512.H[3].copy(); - this.h[4] = HASH512.H[4].copy(); - this.h[5] = HASH512.H[5].copy(); - this.h[6] = HASH512.H[6].copy(); - this.h[7] = HASH512.H[7].copy(); - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var cnt, e; - - cnt = (this.length[0].bot >>> 6) % 16; - this.w[cnt].shlb(); - this.w[cnt].bot |= byt & 0xff; - - e = new ctx.UInt64(0, 8); - this.length[0].add(e); - - if (this.length[0].top === 0 && this.length[0].bot == 0) { - e = new ctx.UInt64(0, 1); - this.length[1].add(e); - } - - if (this.length[0].bot % 1024 === 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - hash: function () { - /* pad message and finish - supply digest */ - var digest = [], - len0, - len1, - i; - - len0 = this.length[0].copy(); - len1 = this.length[1].copy(); - this.process(0x80); - - while (this.length[0].bot % 1024 != 896) { - this.process(0); - } - - this.w[14] = len1; - this.w[15] = len0; - this.transform(); - - for (i = 0; i < HASH512.len; i++) { - /* convert to bytes */ - digest[i] = HASH512.R(8 * (7 - (i % 8)), this.h[i >>> 3]).bot & 0xff; - } - - this.init(); - - return digest; - }, - - continuing_hash() { - var sh = new HASH256(); - sh.copy(this); - return sh.hash(); - }, - }; - - /* static functions */ - HASH512.S = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64( - (x.top >>> n) | (x.bot << (32 - n)), - (x.bot >>> n) | (x.top << (32 - n)), - ); - } else { - return new ctx.UInt64( - (x.bot >>> (n - 32)) | (x.top << (64 - n)), - (x.top >>> (n - 32)) | (x.bot << (64 - n)), - ); - } - }; - - HASH512.R = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64(x.top >>> n, (x.bot >>> n) | (x.top << (32 - n))); - } else { - return new ctx.UInt64(0, x.top >>> (n - 32)); - } - }; - - HASH512.Ch = function (x, y, z) { - return new ctx.UInt64((x.top & y.top) ^ (~x.top & z.top), (x.bot & y.bot) ^ (~x.bot & z.bot)); - }; - - HASH512.Maj = function (x, y, z) { - return new ctx.UInt64( - (x.top & y.top) ^ (x.top & z.top) ^ (y.top & z.top), - (x.bot & y.bot) ^ (x.bot & z.bot) ^ (y.bot & z.bot), - ); - }; - - HASH512.Sig0 = function (x) { - var r1 = HASH512.S(28, x), - r2 = HASH512.S(34, x), - r3 = HASH512.S(39, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH512.Sig1 = function (x) { - var r1 = HASH512.S(14, x), - r2 = HASH512.S(18, x), - r3 = HASH512.S(41, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH512.theta0 = function (x) { - var r1 = HASH512.S(1, x), - r2 = HASH512.S(8, x), - r3 = HASH512.R(7, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH512.theta1 = function (x) { - var r1 = HASH512.S(19, x), - r2 = HASH512.S(61, x), - r3 = HASH512.R(6, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - /* constants */ - HASH512.len = 64; - - HASH512.H = [ - new ctx.UInt64(0x6a09e667, 0xf3bcc908), - new ctx.UInt64(0xbb67ae85, 0x84caa73b), - new ctx.UInt64(0x3c6ef372, 0xfe94f82b), - new ctx.UInt64(0xa54ff53a, 0x5f1d36f1), - new ctx.UInt64(0x510e527f, 0xade682d1), - new ctx.UInt64(0x9b05688c, 0x2b3e6c1f), - new ctx.UInt64(0x1f83d9ab, 0xfb41bd6b), - new ctx.UInt64(0x5be0cd19, 0x137e2179), - ]; - - HASH512.HK = [ - new ctx.UInt64(0x428a2f98, 0xd728ae22), - new ctx.UInt64(0x71374491, 0x23ef65cd), - new ctx.UInt64(0xb5c0fbcf, 0xec4d3b2f), - new ctx.UInt64(0xe9b5dba5, 0x8189dbbc), - new ctx.UInt64(0x3956c25b, 0xf348b538), - new ctx.UInt64(0x59f111f1, 0xb605d019), - new ctx.UInt64(0x923f82a4, 0xaf194f9b), - new ctx.UInt64(0xab1c5ed5, 0xda6d8118), - new ctx.UInt64(0xd807aa98, 0xa3030242), - new ctx.UInt64(0x12835b01, 0x45706fbe), - new ctx.UInt64(0x243185be, 0x4ee4b28c), - new ctx.UInt64(0x550c7dc3, 0xd5ffb4e2), - new ctx.UInt64(0x72be5d74, 0xf27b896f), - new ctx.UInt64(0x80deb1fe, 0x3b1696b1), - new ctx.UInt64(0x9bdc06a7, 0x25c71235), - new ctx.UInt64(0xc19bf174, 0xcf692694), - new ctx.UInt64(0xe49b69c1, 0x9ef14ad2), - new ctx.UInt64(0xefbe4786, 0x384f25e3), - new ctx.UInt64(0x0fc19dc6, 0x8b8cd5b5), - new ctx.UInt64(0x240ca1cc, 0x77ac9c65), - new ctx.UInt64(0x2de92c6f, 0x592b0275), - new ctx.UInt64(0x4a7484aa, 0x6ea6e483), - new ctx.UInt64(0x5cb0a9dc, 0xbd41fbd4), - new ctx.UInt64(0x76f988da, 0x831153b5), - new ctx.UInt64(0x983e5152, 0xee66dfab), - new ctx.UInt64(0xa831c66d, 0x2db43210), - new ctx.UInt64(0xb00327c8, 0x98fb213f), - new ctx.UInt64(0xbf597fc7, 0xbeef0ee4), - new ctx.UInt64(0xc6e00bf3, 0x3da88fc2), - new ctx.UInt64(0xd5a79147, 0x930aa725), - new ctx.UInt64(0x06ca6351, 0xe003826f), - new ctx.UInt64(0x14292967, 0x0a0e6e70), - new ctx.UInt64(0x27b70a85, 0x46d22ffc), - new ctx.UInt64(0x2e1b2138, 0x5c26c926), - new ctx.UInt64(0x4d2c6dfc, 0x5ac42aed), - new ctx.UInt64(0x53380d13, 0x9d95b3df), - new ctx.UInt64(0x650a7354, 0x8baf63de), - new ctx.UInt64(0x766a0abb, 0x3c77b2a8), - new ctx.UInt64(0x81c2c92e, 0x47edaee6), - new ctx.UInt64(0x92722c85, 0x1482353b), - new ctx.UInt64(0xa2bfe8a1, 0x4cf10364), - new ctx.UInt64(0xa81a664b, 0xbc423001), - new ctx.UInt64(0xc24b8b70, 0xd0f89791), - new ctx.UInt64(0xc76c51a3, 0x0654be30), - new ctx.UInt64(0xd192e819, 0xd6ef5218), - new ctx.UInt64(0xd6990624, 0x5565a910), - new ctx.UInt64(0xf40e3585, 0x5771202a), - new ctx.UInt64(0x106aa070, 0x32bbd1b8), - new ctx.UInt64(0x19a4c116, 0xb8d2d0c8), - new ctx.UInt64(0x1e376c08, 0x5141ab53), - new ctx.UInt64(0x2748774c, 0xdf8eeb99), - new ctx.UInt64(0x34b0bcb5, 0xe19b48a8), - new ctx.UInt64(0x391c0cb3, 0xc5c95a63), - new ctx.UInt64(0x4ed8aa4a, 0xe3418acb), - new ctx.UInt64(0x5b9cca4f, 0x7763e373), - new ctx.UInt64(0x682e6ff3, 0xd6b2b8a3), - new ctx.UInt64(0x748f82ee, 0x5defb2fc), - new ctx.UInt64(0x78a5636f, 0x43172f60), - new ctx.UInt64(0x84c87814, 0xa1f0ab72), - new ctx.UInt64(0x8cc70208, 0x1a6439ec), - new ctx.UInt64(0x90befffa, 0x23631e28), - new ctx.UInt64(0xa4506ceb, 0xde82bde9), - new ctx.UInt64(0xbef9a3f7, 0xb2c67915), - new ctx.UInt64(0xc67178f2, 0xe372532b), - new ctx.UInt64(0xca273ece, 0xea26619c), - new ctx.UInt64(0xd186b8c7, 0x21c0c207), - new ctx.UInt64(0xeada7dd6, 0xcde0eb1e), - new ctx.UInt64(0xf57d4f7f, 0xee6ed178), - new ctx.UInt64(0x06f067aa, 0x72176fba), - new ctx.UInt64(0x0a637dc5, 0xa2c898a6), - new ctx.UInt64(0x113f9804, 0xbef90dae), - new ctx.UInt64(0x1b710b35, 0x131c471b), - new ctx.UInt64(0x28db77f5, 0x23047d84), - new ctx.UInt64(0x32caab7b, 0x40c72493), - new ctx.UInt64(0x3c9ebe0a, 0x15c9bebc), - new ctx.UInt64(0x431d67c4, 0x9c100d4c), - new ctx.UInt64(0x4cc5d4be, 0xcb3e42b6), - new ctx.UInt64(0x597f299c, 0xfc657e2a), - new ctx.UInt64(0x5fcb6fab, 0x3ad6faec), - new ctx.UInt64(0x6c44198c, 0x4a475817), - ]; - - return HASH512; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HASH512: HASH512, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hmac.js b/packages/bls-verify/src/vendor/amcl-js/src/hmac.js deleted file mode 100644 index b4b85ae3d..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hmac.js +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HMAC = function (ctx) { - 'use strict'; - - var HMAC = { - MC_SHA2: 2, - MC_SHA3: 3, - - /* Convert Integer to n-byte array */ - inttobytes: function (n, len) { - var b = [], - i; - - for (i = 0; i < len; i++) { - b[i] = 0; - } - - i = len; - while (n > 0 && i > 0) { - i--; - b[i] = n & 0xff; - n = Math.floor(n / 256); - } - - return b; - }, - - GPhashit: function (hash, sha, pad, zpad, A, n, B) { - var R = [], - H, - W, - i, - len; - - if (hash == this.MC_SHA2) { - if (sha == 32) { - H = new ctx.HASH256(); - } else if (sha == 48) { - H = new ctx.HASH384(); - } else if (sha == 64) { - H = new ctx.HASH512(); - } - } - if (hash == this.MC_SHA3) { - H = new ctx.SHA3(sha); - } - - for (i = 0; i < zpad; i++) H.process(0); - - if (A != null) { - H.process_array(A); - } - - if (n >= 0) { - H.process_num(n); - } - if (B != null) { - H.process_array(B); - } - R = H.hash(); - - if (R.length == 0) { - return null; - } - - if (pad == 0) { - return R; - } - - W = []; - - len = pad; - - if (sha >= len) { - for (i = 0; i < len; i++) { - W[i] = R[i]; - } - } else { - for (i = 0; i < sha; i++) { - W[i + len - sha] = R[i]; - } - - for (i = 0; i < len - sha; i++) { - W[i] = 0; - } - } - - return W; - }, - - SPhashit: function (hash, sha, A) { - return this.GPhashit(hash, sha, 0, 0, A, -1, null); - }, - - KDF2: function (hash, sha, Z, P, olen) { - /* NOTE: the parameter olen is the length of the output k in bytes */ - var hlen = sha, - K = [], - B = [], - k = 0, - counter, - cthreshold, - i; - - for (i = 0; i < K.length; i++) { - K[i] = 0; // redundant? - } - - cthreshold = Math.floor(olen / hlen); - if (olen % hlen !== 0) { - cthreshold++; - } - - for (counter = 1; counter <= cthreshold; counter++) { - B = this.GPhashit(hash, sha, 0, 0, Z, counter, P); - - if (k + hlen > olen) { - for (i = 0; i < olen % hlen; i++) { - K[k++] = B[i]; - } - } else { - for (i = 0; i < hlen; i++) { - K[k++] = B[i]; - } - } - } - - return K; - }, - - /* Password based Key Derivation Function */ - /* Input password p, salt s, and repeat count */ - /* Output key of length olen */ - - PBKDF2: function (hash, sha, Pass, Salt, rep, olen) { - var F = new Array(sha), - U = [], - S = [], - K = [], - opt = 0, - i, - j, - k, - d, - N, - key; - - d = Math.floor(olen / sha); - - if (olen % sha !== 0) { - d++; - } - - opt = 0; - - for (i = 1; i <= d; i++) { - for (j = 0; j < Salt.length; j++) { - S[j] = Salt[j]; - } - - N = this.inttobytes(i, 4); - - for (j = 0; j < 4; j++) { - S[Salt.length + j] = N[j]; - } - - this.HMAC1(hash, sha, F, sha, Pass, S); - - for (j = 0; j < sha; j++) { - U[j] = F[j]; - } - - for (j = 2; j <= rep; j++) { - this.HMAC1(hash, sha, U, sha, Pass, U); - for (k = 0; k < sha; k++) { - F[k] ^= U[k]; - } - } - - for (j = 0; j < sha; j++) { - K[opt++] = F[j]; - } - } - - key = []; - for (i = 0; i < olen; i++) { - key[i] = K[i]; - } - - return key; - }, - - blksize: function (hash, sha) { - var b = 0; - if (hash == this.MC_SHA2) { - b = 64; - if (sha > 32) b = 128; - } - if (hash == this.MC_SHA3) { - b = 200 - 2 * sha; - } - return b; - }, - - HMAC1: function (hash, sha, tag, olen, K, M) { - /* Input is from an octet m * - * olen is requested output length in bytes. k is the key * - * The output is the calculated tag */ - var B = [], - b = 0, - K0, - i; - - b = this.blksize(hash, sha); - if (b == 0) return 0; - - K0 = new Array(b); - - for (i = 0; i < b; i++) { - K0[i] = 0; - } - - if (K.length > b) { - B = this.SPhashit(hash, sha, K); - for (i = 0; i < sha; i++) { - K0[i] = B[i]; - } - } else { - for (i = 0; i < K.length; i++) { - K0[i] = K[i]; - } - } - - for (i = 0; i < b; i++) { - K0[i] ^= 0x36; - } - - B = this.GPhashit(hash, sha, 0, 0, K0, -1, M); - - for (i = 0; i < b; i++) { - K0[i] ^= 0x6a; - } - - B = this.GPhashit(hash, sha, olen, 0, K0, -1, B); - - for (i = 0; i < olen; i++) { - tag[i] = B[i]; - } - - return 1; - }, - - HKDF_Extract: function (hash, hlen, SALT, IKM) { - var PRK = []; - if (SALT == null) { - var H = []; - for (var i = 0; i < hlen; i++) H[i] = 0; - this.HMAC1(hash, hlen, PRK, hlen, H, IKM); - } else { - this.HMAC1(hash, hlen, PRK, hlen, SALT, IKM); - } - return PRK; - }, - - HKDF_Expand: function (hash, hlen, olen, PRK, INFO) { - var i, - j, - k, - m, - n = Math.floor(olen / hlen); - var flen = olen % hlen; - - var OKM = []; - var T = []; - var K = []; - - k = m = 0; - for (i = 1; i <= n; i++) { - for (j = 0; j < INFO.length; j++) T[k++] = INFO[j]; - T[k++] = i; - this.HMAC1(hash, hlen, K, hlen, PRK, T); - k = 0; - T = []; - for (j = 0; j < hlen; j++) { - OKM[m++] = K[j]; - T[k++] = K[j]; - } - } - if (flen > 0) { - for (j = 0; j < INFO.length; j++) T[k++] = INFO[j]; - T[k++] = n + 1; - this.HMAC1(hash, hlen, K, flen, PRK, T); - for (j = 0; j < flen; j++) OKM[m++] = K[j]; - } - return OKM; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - XOF_Expand: function (hlen, olen, DST, MSG) { - var OKM = []; - var H = new ctx.SHA3(hlen); - for (var i = 0; i < MSG.length; i++) H.process(MSG[i]); - H.process((olen >> 8) & 0xff); - H.process(olen & 0xff); - - for (var i = 0; i < DST.length; i++) H.process(DST[i]); - H.process(DST.length); - - H.shake(OKM, olen); - return OKM; - }, - - XMD_Expand(hash, hlen, olen, DST, MSG) { - var OKM = []; - var H1 = []; - var TMP = []; - var TMP2 = []; - - var ell = this.ceil(olen, hlen); - var blk = this.blksize(hash, hlen); - TMP[0] = (olen >> 8) & 0xff; - TMP[1] = olen & 0xff; - TMP[2] = 0; - for (var j = 0; j < DST.length; j++) TMP[3 + j] = DST[j]; - TMP[3 + DST.length] = DST.length; - - var H0 = this.GPhashit(hash, hlen, 0, blk, MSG, -1, TMP); - - var k = 0; - for (var j = 0; j < hlen; j++) H1[j] = 0; - - for (var i = 1; i <= ell; i++) { - for (var j = 0; j < hlen; j++) H1[j] ^= H0[j]; - TMP2[0] = i; - for (var j = 0; j < DST.length; j++) TMP2[1 + j] = DST[j]; - TMP2[1 + DST.length] = DST.length; - H1 = this.GPhashit(hash, hlen, 0, 0, H1, -1, TMP2); - for (var j = 0; j < hlen && k < olen; j++) OKM[k++] = H1[j]; - } - - return OKM; - }, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - /* SHAXXX identifier strings */ - SHA256ID: [ - 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, - 0x05, 0x00, 0x04, 0x20, - ], - SHA384ID: [ - 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, - 0x05, 0x00, 0x04, 0x30, - ], - SHA512ID: [ - 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, - 0x05, 0x00, 0x04, 0x40, - ], - - /* Mask Generation Function */ - MGF1: function (sha, Z, olen, K) { - var hlen = sha, - B = [], - k = 0, - counter, - cthreshold, - i; - - for (i = 0; i < K.length; i++) { - K[i] = 0; - } - - cthreshold = Math.floor(olen / hlen); - if (olen % hlen !== 0) { - cthreshold++; - } - - for (counter = 0; counter < cthreshold; counter++) { - B = this.GPhashit(this.MC_SHA2, sha, 0, 0, Z, counter, null); - //B = this.hashit(sha, Z, counter); - - if (k + hlen > olen) { - for (i = 0; i < olen % hlen; i++) { - K[k++] = B[i]; - } - } else { - for (i = 0; i < hlen; i++) { - K[k++] = B[i]; - } - } - } - }, - - MGF1XOR: function (sha, Z, K) { - var hlen = sha, - B = [], - k = 0, - counter, - cthreshold, - i; - var olen = K.length; - - cthreshold = Math.floor(olen / hlen); - if (olen % hlen !== 0) { - cthreshold++; - } - - for (counter = 0; counter < cthreshold; counter++) { - B = this.GPhashit(this.MC_SHA2, sha, 0, 0, Z, counter, null); - //B = this.hashit(sha, Z, counter); - - if (k + hlen > olen) { - for (i = 0; i < olen % hlen; i++) { - K[k++] ^= B[i]; - } - } else { - for (i = 0; i < hlen; i++) { - K[k++] ^= B[i]; - } - } - } - }, - - PKCS15: function (sha, m, w, RFS) { - var olen = RFS, - hlen = sha, - idlen = 19, - H, - i, - j; - - if (olen < idlen + hlen + 10) { - return false; - } - H = this.SPhashit(this.MC_SHA2, sha, m); - //H = this.hashit(sha, m, -1); - - for (i = 0; i < w.length; i++) { - w[i] = 0; - } - - i = 0; - w[i++] = 0; - w[i++] = 1; - for (j = 0; j < olen - idlen - hlen - 3; j++) { - w[i++] = 0xff; - } - w[i++] = 0; - - if (hlen == this.SHA256) { - for (j = 0; j < idlen; j++) { - w[i++] = this.SHA256ID[j]; - } - } else if (hlen == this.SHA384) { - for (j = 0; j < idlen; j++) { - w[i++] = this.SHA384ID[j]; - } - } else if (hlen == this.SHA512) { - for (j = 0; j < idlen; j++) { - w[i++] = this.SHA512ID[j]; - } - } - - for (j = 0; j < hlen; j++) { - w[i++] = H[j]; - } - - return true; - }, - - PSS_ENCODE: function (sha, m, rng, RFS) { - var emlen = RFS; - var embits = 8 * emlen - 1; - var hlen = sha; - var SALT = []; - for (i = 0; i < hlen; i++) { - SALT[i] = rng.getByte(); - } - var mask = 0xff >> (8 * emlen - embits); - - var H = this.SPhashit(this.MC_SHA2, sha, m); - - if (emlen < hlen + hlen + 2) return null; - - var MD = []; - - for (var i = 0; i < 8; i++) MD[i] = 0; - for (var i = 0; i < hlen; i++) MD[8 + i] = H[i]; - for (var i = 0; i < hlen; i++) MD[8 + hlen + i] = SALT[i]; - - H = this.SPhashit(this.MC_SHA2, sha, MD); - - var f = []; - for (var i = 0; i < emlen - hlen - hlen - 2; i++) f[i] = 0; - f[emlen - hlen - hlen - 2] = 0x1; - for (var i = 0; i < hlen; i++) f[emlen + i - hlen - hlen - 1] = SALT[i]; - this.MGF1XOR(sha, H, f); - f[0] &= mask; - for (var i = 0; i < hlen; i++) f[emlen + i - hlen - 1] = H[i]; - f[emlen - 1] = 0xbc; - return f; - }, - - PSS_VERIFY: function (sha, m, f) { - var emlen = f.length; - var embits = 8 * emlen - 1; - var hlen = sha; - var SALT = []; - var mask = 0xff >> (8 * emlen - embits); - - var HMASK = this.SPhashit(this.MC_SHA2, sha, m); - if (emlen < hlen + hlen + 2) return false; - if (f[emlen - 1] != 0xbc) return false; - if ((f[0] & ~mask) != 0) return false; - - var DB = []; - for (var i = 0; i < emlen - hlen - 1; i++) DB[i] = f[i]; - var H = []; - for (var i = 0; i < hlen; i++) H[i] = f[emlen + i - hlen - 1]; - this.MGF1XOR(sha, H, DB); - DB[0] &= mask; - var k = 0; - for (var i = 0; i < emlen - hlen - hlen - 2; i++) k |= DB[i]; - if (k != 0) return false; - if (DB[emlen - hlen - hlen - 2] != 0x01) return false; - - for (var i = 0; i < hlen; i++) SALT[i] = DB[emlen + i - hlen - hlen - 1]; - - var MD = []; - for (var i = 0; i < 8; i++) MD[i] = 0; - for (var i = 0; i < hlen; i++) MD[8 + i] = HMASK[i]; - for (var i = 0; i < hlen; i++) MD[8 + hlen + i] = SALT[i]; - - HMASK = this.SPhashit(this.MC_SHA2, sha, MD); - - k = 0; - for (var i = 0; i < hlen; i++) k |= H[i] - HMASK[i]; - if (k != 0) return false; - return true; - }, - /* OAEP Message Encoding for Encryption */ - OAEP_ENCODE: function (sha, m, rng, p, RFS) { - var olen = RFS - 1, - mlen = m.length, - SEED = [], - DBMASK = [], - f = [], - hlen, - seedlen, - slen, - i, - d, - h; - - seedlen = hlen = sha; - - if (mlen > olen - hlen - seedlen - 1) { - return null; - } - - h = this.SPhashit(this.MC_SHA2, sha, p); - //h = this.hashit(sha, p, -1); - for (i = 0; i < hlen; i++) { - f[i] = h[i]; - } - - slen = olen - mlen - hlen - seedlen - 1; - - for (i = 0; i < slen; i++) { - f[hlen + i] = 0; - } - f[hlen + slen] = 1; - for (i = 0; i < mlen; i++) { - f[hlen + slen + 1 + i] = m[i]; - } - - for (i = 0; i < seedlen; i++) { - SEED[i] = rng.getByte(); - } - this.MGF1(sha, SEED, olen - seedlen, DBMASK); - - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] ^= f[i]; - } - this.MGF1(sha, DBMASK, seedlen, f); - - for (i = 0; i < seedlen; i++) { - f[i] ^= SEED[i]; - } - - for (i = 0; i < olen - seedlen; i++) { - f[i + seedlen] = DBMASK[i]; - } - - /* pad to length RFS */ - d = 1; - for (i = RFS - 1; i >= d; i--) { - f[i] = f[i - d]; - } - for (i = d - 1; i >= 0; i--) { - f[i] = 0; - } - - return f; - }, - - /* OAEP Message Decoding for Decryption */ - OAEP_DECODE: function (sha, p, f, RFS) { - var olen = RFS - 1, - SEED = [], - CHASH = [], - DBMASK = [], - comp, - hlen, - seedlen, - x, - t, - d, - i, - k, - h, - r; - - seedlen = hlen = sha; - if (olen < seedlen + hlen + 1) { - return null; - } - - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] = 0; - } - - if (f.length < RFS) { - d = RFS - f.length; - for (i = RFS - 1; i >= d; i--) { - f[i] = f[i - d]; - } - for (i = d - 1; i >= 0; i--) { - f[i] = 0; - } - } - h = this.SPhashit(this.MC_SHA2, sha, p); - //h = this.hashit(sha, p, -1); - for (i = 0; i < hlen; i++) { - CHASH[i] = h[i]; - } - - x = f[0]; - - for (i = seedlen; i < olen; i++) { - DBMASK[i - seedlen] = f[i + 1]; - } - - this.MGF1(sha, DBMASK, seedlen, SEED); - for (i = 0; i < seedlen; i++) { - SEED[i] ^= f[i + 1]; - } - this.MGF1(sha, SEED, olen - seedlen, f); - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] ^= f[i]; - } - - comp = true; - for (i = 0; i < hlen; i++) { - if (CHASH[i] != DBMASK[i]) { - comp = false; - } - } - - for (i = 0; i < olen - seedlen - hlen; i++) { - DBMASK[i] = DBMASK[i + hlen]; - } - - for (i = 0; i < hlen; i++) { - SEED[i] = CHASH[i] = 0; - } - - for (k = 0; ; k++) { - if (k >= olen - seedlen - hlen) { - return null; - } - - if (DBMASK[k] !== 0) { - break; - } - } - - t = DBMASK[k]; - if (!comp || x !== 0 || t != 0x01) { - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] = 0; - } - return null; - } - r = []; - - for (i = 0; i < olen - seedlen - hlen - k - 1; i++) { - r[i] = DBMASK[i + k + 1]; - } - - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] = 0; - } - - return r; - }, - }; - - return HMAC; -}; - -/* - var MSG=ctx.ECDH.asciitobytes("abc"); - var DST=ctx.ECDH.asciitobytes("P256_XMD:SHA-256_SSWU_RO_TESTGEN"); - - var OKM=ctx.HMAC.XOF_Expand(ctx.SHA3.SHAKE128,48,DST,MSG); - mywindow.document.write("OKM : 0x"+ctx.ECDH.bytestostring(OKM) + "
"); - - OKM=ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2,32,48,DST,MSG); - mywindow.document.write("OKM : 0x"+ctx.ECDH.bytestostring(OKM) + "
"); - - ikm=[]; - salt=[]; - info=[]; - - for (i=0;i<22;i++) ikm[i]=0x0b; - for (i=0;i<13;i++) salt[i]=i; - for (i=0;i<10;i++) info[i]=(0xf0+i); - - var prk=ctx.HMAC.HKDF_Extract(ctx.HMAC.MC_SHA2,32,salt,ikm); - window.document.write("PRK= "+ctx.NHS.bytestostring(prk)+ "
"); - - var okm=ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2,32,42,prk,info); - window.document.write("PRK= "+ctx.NHS.bytestostring(okm)+ "
"); -*/ - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HMAC: HMAC, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hpke.js b/packages/bls-verify/src/vendor/amcl-js/src/hpke.js deleted file mode 100644 index 9a5927f50..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hpke.js +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Hybrid Public Key Encryption */ - -/* Following https://datatracker.ietf.org/doc/draft-irtf-cfrg-hpke/?include_text=1 */ - -var HPKE = function (ctx) { - 'use strict'; - - var HPKE = { - reverse: function (X) { - var i, - ch, - lx = X.length; - for (i = 0; i < lx / 2; i++) { - ch = X[i]; - X[i] = X[lx - i - 1]; - X[lx - i - 1] = ch; - } - }, - - LabeledExtract: function (SALT, SUITE_ID, label, IKM) { - var rfc = 'HPKE-07'; - var RFC = ctx.ECDH.asciitobytes(rfc); - var LABEL = ctx.ECDH.asciitobytes(label); - var LIKM = []; - var k = 0; - for (var i = 0; i < RFC.length; i++) LIKM[k++] = RFC[i]; - for (var i = 0; i < SUITE_ID.length; i++) LIKM[k++] = SUITE_ID[i]; - for (var i = 0; i < LABEL.length; i++) LIKM[k++] = LABEL[i]; - if (IKM != null) { - for (var i = 0; i < IKM.length; i++) LIKM[k++] = IKM[i]; - } - return ctx.HMAC.HKDF_Extract(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, SALT, LIKM); - }, - - LabeledExpand: function (PRK, SUITE_ID, label, INFO, L) { - var AR = ctx.HMAC.inttobytes(L, 2); - var rfc = 'HPKE-07'; - var RFC = ctx.ECDH.asciitobytes(rfc); - var LABEL = ctx.ECDH.asciitobytes(label); - var LINFO = []; - LINFO[0] = AR[0]; - LINFO[1] = AR[1]; - var k = 2; - for (var i = 0; i < RFC.length; i++) LINFO[k++] = RFC[i]; - for (var i = 0; i < SUITE_ID.length; i++) LINFO[k++] = SUITE_ID[i]; - for (var i = 0; i < LABEL.length; i++) LINFO[k++] = LABEL[i]; - if (INFO != null) { - for (var i = 0; i < INFO.length; i++) LINFO[k++] = INFO[i]; - } - return ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LINFO); - }, - - ExtractAndExpand: function (config_id, DH, CONTEXT) { - var kem = config_id & 255; - var txt = 'KEM'; - var KEM_ID = ctx.HMAC.inttobytes(kem, 2); - var KEM = ctx.ECDH.asciitobytes(txt); - var SUITE_ID = []; - var k = KEM.length; - for (var i = 0; i < k; i++) SUITE_ID[i] = KEM[i]; - SUITE_ID[k] = KEM_ID[0]; - SUITE_ID[k + 1] = KEM_ID[1]; - var PRK = this.LabeledExtract(null, SUITE_ID, 'eae_prk', DH); - return this.LabeledExpand(PRK, SUITE_ID, 'shared_secret', CONTEXT, ctx.ECP.HASH_TYPE); - }, - - DeriveKeyPair: function (config_id, SK, PK, SEED) { - var counter = 0; - var INFO = []; - var kem = config_id & 255; - var txt = 'KEM'; - var KEM_ID = ctx.HMAC.inttobytes(kem, 2); - var KEM = ctx.ECDH.asciitobytes(txt); - var SUITE_ID = []; - var k = KEM.length; - for (var i = 0; i < k; i++) SUITE_ID[i] = KEM[i]; - SUITE_ID[k] = KEM_ID[0]; - SUITE_ID[k + 1] = KEM_ID[1]; - - var PRK = this.LabeledExtract(null, SUITE_ID, 'dkp_prk', SEED); - var S; - if (kem == 32 || kem == 33) { - S = this.LabeledExpand(PRK, SUITE_ID, 'sk', null, ctx.ECDH.EGS); - this.reverse(S); - if (kem == 32) { - S[ctx.ECDH.EGS - 1] &= 248; - S[0] &= 127; - S[0] |= 64; - } else { - S[ctx.ECDH.EGS - 1] &= 252; - S[0] |= 128; - } - } else { - var bit_mask; - if (kem == 18) bit_mask = 1; - else bit_mask = 0xff; - S = []; - for (var i = 0; i < ctx.ECDH.EGS; i++) S[i] = 0; - while (!ctx.ECDH.IN_RANGE(S) && counter < 256) { - INFO[0] = counter; - S = this.LabeledExpand(PRK, SUITE_ID, 'candidate', INFO, ctx.ECDH.EGS); - S[0] &= bit_mask; - counter++; - } - } - for (var i = 0; i < ctx.ECDH.EGS; i++) SK[i] = S[i]; - ctx.ECDH.KEY_PAIR_GENERATE(null, SK, PK); - if (kem == 32 || kem == 33) this.reverse(PK); - if (counter < 256) return true; - return false; - }, - - encap: function (config_id, skE, pkE, pkR) { - var DH = []; - var KEMCONTEXT = []; - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkR); - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - this.reverse(pkR); - this.reverse(DH); - } else { - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - } - var k = 0; - for (var i = 0; i < pkE.length; i++) KEMCONTEXT[k++] = pkE[i]; - for (var i = 0; i < pkR.length; i++) KEMCONTEXT[k++] = pkR[i]; - - return this.ExtractAndExpand(config_id, DH, KEMCONTEXT); - }, - - decap: function (config_id, skR, pkE, pkR) { - var DH = []; - var KEMCONTEXT = []; - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkE); - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - this.reverse(pkE); - this.reverse(DH); - } else { - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - } - - var k = 0; - for (var i = 0; i < pkE.length; i++) KEMCONTEXT[k++] = pkE[i]; - for (var i = 0; i < pkR.length; i++) KEMCONTEXT[k++] = pkR[i]; - - return this.ExtractAndExpand(config_id, DH, KEMCONTEXT); - }, - - authEncap: function (config_id, skE, skS, pkE, pkR, pkS) { - var pklen = pkE.length; - var DH = []; - var DH1 = []; - var KEMCONTEXT = []; - - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkR); - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - ctx.ECDH.ECPSVDP_DH(skS, pkR, DH1, 0); - this.reverse(pkR); - this.reverse(DH); - this.reverse(DH1); - } else { - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - ctx.ECDH.ECPSVDP_DH(skS, pkR, DH1, 0); - } - var ZZ = []; - for (var i = 0; i < ctx.ECDH.EFS; i++) { - ZZ[i] = DH[i]; - ZZ[ctx.ECDH.EFS + i] = DH1[i]; - } - - for (var i = 0; i < pklen; i++) { - KEMCONTEXT[i] = pkE[i]; - KEMCONTEXT[pklen + i] = pkR[i]; - KEMCONTEXT[2 * pklen + i] = pkS[i]; - } - - return this.ExtractAndExpand(config_id, ZZ, KEMCONTEXT); - }, - - authDecap: function (config_id, skR, pkE, pkR, pkS) { - var pklen = pkE.length; - var DH = []; - var DH1 = []; - var KEMCONTEXT = []; - - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkE); - this.reverse(pkS); - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - ctx.ECDH.ECPSVDP_DH(skR, pkS, DH1, 0); - this.reverse(pkE); - this.reverse(pkS); - this.reverse(DH); - this.reverse(DH1); - } else { - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - ctx.ECDH.ECPSVDP_DH(skR, pkS, DH1, 0); - } - - var ZZ = []; - for (var i = 0; i < ctx.ECDH.EFS; i++) { - ZZ[i] = DH[i]; - ZZ[ctx.ECDH.EFS + i] = DH1[i]; - } - - for (var i = 0; i < pklen; i++) { - KEMCONTEXT[i] = pkE[i]; - KEMCONTEXT[pklen + i] = pkR[i]; - KEMCONTEXT[2 * pklen + i] = pkS[i]; - } - - return this.ExtractAndExpand(config_id, ZZ, KEMCONTEXT); - }, - - keySchedule: function (config_id, key, nonce, exp_secret, mode, Z, info, psk, pskID) { - var context = []; - var kem = config_id & 255; - var kdf = (config_id >> 8) & 3; - var aead = (config_id >> 10) & 3; - var num, k; - var txt = 'HPKE'; - var KEM = ctx.ECDH.asciitobytes(txt); - var SUITE_ID = []; - k = KEM.length; - for (var i = 0; i < k; i++) SUITE_ID[i] = KEM[i]; - num = ctx.HMAC.inttobytes(kem, 2); - SUITE_ID[k++] = num[0]; - SUITE_ID[k++] = num[1]; - num = ctx.HMAC.inttobytes(kdf, 2); - SUITE_ID[k++] = num[0]; - SUITE_ID[k++] = num[1]; - num = ctx.HMAC.inttobytes(aead, 2); - SUITE_ID[k++] = num[0]; - SUITE_ID[k++] = num[1]; - k = 0; - var ar = ctx.HMAC.inttobytes(mode, 1); - for (var i = 0; i < ar.length; i++) context[k++] = ar[i]; - - var H = this.LabeledExtract(null, SUITE_ID, 'psk_id_hash', pskID); - for (var i = 0; i < ctx.ECP.HASH_TYPE; i++) context[k++] = H[i]; - H = this.LabeledExtract(null, SUITE_ID, 'info_hash', info); - for (var i = 0; i < ctx.ECP.HASH_TYPE; i++) context[k++] = H[i]; - - //H=this.LabeledExtract(null,SUITE_ID,"psk_hash",psk); - //var secret=this.LabeledExtract(H,SUITE_ID,"secret",Z); - - var secret = this.LabeledExtract(Z, SUITE_ID, 'secret', psk); - - var ex = this.LabeledExpand(secret, SUITE_ID, 'key', context, ctx.ECP.AESKEY); - for (var i = 0; i < ex.length; i++) key[i] = ex[i]; - - ex = this.LabeledExpand(secret, SUITE_ID, 'base_nonce', context, 12); - for (var i = 0; i < ex.length; i++) nonce[i] = ex[i]; - - if (exp_secret != null) { - ex = this.LabeledExpand(secret, SUITE_ID, 'exp', context, ctx.ECP.HASH_TYPE); - for (var i = 0; i < ex.length; i++) exp_secret[i] = ex[i]; - } - }, - }; - return HPKE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HPKE: HPKE, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/mpin.js b/packages/bls-verify/src/vendor/amcl-js/src/mpin.js deleted file mode 100644 index 399e3a8cd..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/mpin.js +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* MPIN 128-bit API Functions */ - -var MPIN = function (ctx) { - 'use strict'; - - var MPIN = { - BAD_PARAMS: -11, - INVALID_POINT: -14, - WRONG_ORDER: -18, - BAD_PIN: -19, - /* configure PIN here */ - MAXPIN: 10000, - /* max PIN */ - PBLEN: 14, - /* MAXPIN length in bits */ - TS: 12, - /* 10 for 4 digit PIN, 14 for 6-digit PIN - 2^TS/TS approx = sqrt(MAXPIN) */ - - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - comparebytes: function (a, b) { - if (a.length != b.length) { - return false; - } - - for (var i = 0; i < a.length; i++) { - if (a[i] != b[i]) { - return false; - } - } - - return true; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - ENCODE_TO_CURVE: function (DST, ID, HCID) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var k = q.nbits(); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var m = r.nbits(); - var L = this.ceil(k + this.ceil(m, 2), 8); - var OKM = ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, DST, ID); - var fd = []; - - for (var j = 0; j < L; j++) fd[j] = OKM[j]; - var dx = ctx.DBIG.fromBytes(fd); - var u = new ctx.FP(dx.mod(q)); - var P = ctx.ECP.map2point(u); - P.cfp(); - P.affine(); - P.toBytes(HCID, false); - }, - - /* create random secret S */ - RANDOM_GENERATE: function (rng, S) { - var r = new ctx.BIG(0), - s; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - s.toBytes(S); - return 0; - }, - - /* Extract PIN from TOKEN for identity CID */ - EXTRACT_PIN: function (CID, pin, TOKEN) { - var P, R; - P = ctx.ECP.fromBytes(TOKEN); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - R = ctx.ECP.fromBytes(CID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - pin %= this.MAXPIN; - R = R.pinmul(pin, this.PBLEN); - P.sub(R); - P.toBytes(TOKEN, false); - return 0; - }, - - /* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */ - GET_SERVER_SECRET: function (S, SST) { - var s, Q; - Q = ctx.ECP2.generator(); - s = ctx.BIG.fromBytes(S); - Q = ctx.PAIR.G2mul(Q, s); - Q.toBytes(SST, false); - return 0; - }, - - /* Client secret CST=S*H(CID) where CID is client ID and S is master secret */ - GET_CLIENT_SECRET: function (S, IDHTC, CST) { - var s = ctx.BIG.fromBytes(S); - var P = ctx.ECP.fromBytes(IDHTC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - ctx.PAIR.G1mul(P, s).toBytes(CST, false); - return 0; - }, - - /* Implement step 1 on client side of MPin protocol */ - CLIENT_1: function (CID, rng, X, pin, TOKEN, SEC, xID) { - var r = new ctx.BIG(0), - x, - P, - T, - W; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (rng !== null) { - x = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - x.toBytes(X); - } else { - x = ctx.BIG.fromBytes(X); - } - P = ctx.ECP.fromBytes(CID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - T = ctx.ECP.fromBytes(TOKEN); - if (T.is_infinity()) { - return this.INVALID_POINT; - } - - pin %= this.MAXPIN; - W = P.pinmul(pin, this.PBLEN); - T.add(W); - - P = ctx.PAIR.G1mul(P, x); - P.toBytes(xID, false); - - T.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 on client side of MPin protocol */ - CLIENT_2: function (X, Y, SEC) { - var r = new ctx.BIG(0), - P, - px, - py; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - P = ctx.ECP.fromBytes(SEC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - px = ctx.BIG.fromBytes(X); - py = ctx.BIG.fromBytes(Y); - px.add(py); - px.mod(r); - - P = ctx.PAIR.G1mul(P, px); - P.neg(); - P.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 of MPin protocol on server side. */ - SERVER: function (HID, Y, SST, xID, mSEC) { - var Q, sQ, R, y, P, g; - Q = ctx.ECP2.generator(); - sQ = ctx.ECP2.fromBytes(SST); - if (sQ.is_infinity()) { - return this.INVALID_POINT; - } - if (xID == null) { - return this.BAD_PARAMS; - } - R = ctx.ECP.fromBytes(xID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - y = ctx.BIG.fromBytes(Y); - if (HID == null) { - return this.BAD_PARAMS; - } - P = ctx.ECP.fromBytes(HID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - - P = ctx.PAIR.G1mul(P, y); - P.add(R); - R = ctx.ECP.fromBytes(mSEC); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - - g = ctx.PAIR.ate2(Q, R, sQ, P); - g = ctx.PAIR.fexp(g); - - if (!g.isunity()) { - return this.BAD_PIN; - } - return 0; - }, - }; - - return MPIN; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - MPIN: MPIN, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/mpin192.js b/packages/bls-verify/src/vendor/amcl-js/src/mpin192.js deleted file mode 100644 index 478bc05c8..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/mpin192.js +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* MPIN 192-bit API Functions */ - -var MPIN192 = function (ctx) { - 'use strict'; - - var MPIN192 = { - BAD_PARAMS: -11, - INVALID_POINT: -14, - WRONG_ORDER: -18, - BAD_PIN: -19, - /* configure PIN here */ - MAXPIN: 10000, - /* max PIN */ - PBLEN: 14, - /* MAXPIN length in bits */ - TS: 12, - /* 10 for 4 digit PIN, 14 for 6-digit PIN - 2^TS/TS approx = sqrt(MAXPIN) */ - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - comparebytes: function (a, b) { - if (a.length != b.length) { - return false; - } - - for (var i = 0; i < a.length; i++) { - if (a[i] != b[i]) { - return false; - } - } - - return true; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - ENCODE_TO_CURVE: function (DST, ID, HCID) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var k = q.nbits(); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var m = r.nbits(); - var L = this.ceil(k + this.ceil(m, 2), 8); - var OKM = ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, DST, ID); - var fd = []; - - for (var j = 0; j < L; j++) fd[j] = OKM[j]; - var dx = ctx.DBIG.fromBytes(fd); - var u = new ctx.FP(dx.mod(q)); - var P = ctx.ECP.map2point(u); - P.cfp(); - P.affine(); - P.toBytes(HCID, false); - }, - - /* create random secret S */ - RANDOM_GENERATE: function (rng, S) { - var r = new ctx.BIG(0), - s; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - s.toBytes(S); - return 0; - }, - - /* Extract PIN from TOKEN for identity CID */ - EXTRACT_PIN: function (CID, pin, TOKEN) { - var P, R; - P = ctx.ECP.fromBytes(TOKEN); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - R = ctx.ECP.fromBytes(CID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - pin %= this.MAXPIN; - R = R.pinmul(pin, this.PBLEN); - P.sub(R); - P.toBytes(TOKEN, false); - return 0; - }, - - /* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */ - GET_SERVER_SECRET: function (S, SST) { - var s, Q; - Q = ctx.ECP4.generator(); - s = ctx.BIG.fromBytes(S); - Q = ctx.PAIR4.G2mul(Q, s); - Q.toBytes(SST, false); - return 0; - }, - - /* Client secret CST=S*H(CID) where CID is client ID and S is master secret */ - GET_CLIENT_SECRET: function (S, IDHTC, CST) { - var s = ctx.BIG.fromBytes(S); - var P = ctx.ECP.fromBytes(IDHTC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - ctx.PAIR4.G1mul(P, s).toBytes(CST, false); - return 0; - }, - - /* Implement step 1 on client side of MPin protocol */ - CLIENT_1: function (CID, rng, X, pin, TOKEN, SEC, xID) { - var r = new ctx.BIG(0), - x, - P, - T, - W; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (rng !== null) { - x = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - x.toBytes(X); - } else { - x = ctx.BIG.fromBytes(X); - } - P = ctx.ECP.fromBytes(CID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - T = ctx.ECP.fromBytes(TOKEN); - if (T.is_infinity()) { - return this.INVALID_POINT; - } - - pin %= this.MAXPIN; - W = P.pinmul(pin, this.PBLEN); - T.add(W); - - P = ctx.PAIR4.G1mul(P, x); - P.toBytes(xID, false); - - T.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 on client side of MPin protocol */ - CLIENT_2: function (X, Y, SEC) { - var r = new ctx.BIG(0), - P, - px, - py; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - P = ctx.ECP.fromBytes(SEC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - px = ctx.BIG.fromBytes(X); - py = ctx.BIG.fromBytes(Y); - px.add(py); - px.mod(r); - - P = ctx.PAIR4.G1mul(P, px); - P.neg(); - P.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 of MPin protocol on server side. */ - SERVER: function (HID, Y, SST, xID, mSEC) { - var Q, sQ, R, y, P, g; - Q = ctx.ECP4.generator(); - sQ = ctx.ECP4.fromBytes(SST); - if (sQ.is_infinity()) { - return this.INVALID_POINT; - } - if (xID == null) { - return this.BAD_PARAMS; - } - R = ctx.ECP.fromBytes(xID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - y = ctx.BIG.fromBytes(Y); - if (HID == null) { - return this.BAD_PARAMS; - } - P = ctx.ECP.fromBytes(HID); - - if (P.is_infinity()) { - return this.INVALID_POINT; - } - - P = ctx.PAIR4.G1mul(P, y); - P.add(R); - R = ctx.ECP.fromBytes(mSEC); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - - g = ctx.PAIR4.ate2(Q, R, sQ, P); - g = ctx.PAIR4.fexp(g); - - if (!g.isunity()) { - return this.BAD_PIN; - } - return 0; - }, - }; - - return MPIN192; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - MPIN192: MPIN192, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/mpin256.js b/packages/bls-verify/src/vendor/amcl-js/src/mpin256.js deleted file mode 100644 index 09f3a0d81..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/mpin256.js +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* MPIN 256-bit API Functions */ - -var MPIN256 = function (ctx) { - 'use strict'; - - var MPIN256 = { - BAD_PARAMS: -11, - INVALID_POINT: -14, - WRONG_ORDER: -18, - BAD_PIN: -19, - /* configure PIN here */ - MAXPIN: 10000, - /* max PIN */ - PBLEN: 14, - /* MAXPIN length in bits */ - TS: 12, - /* 10 for 4 digit PIN, 14 for 6-digit PIN - 2^TS/TS approx = sqrt(MAXPIN) */ - - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - comparebytes: function (a, b) { - if (a.length != b.length) { - return false; - } - - for (var i = 0; i < a.length; i++) { - if (a[i] != b[i]) { - return false; - } - } - - return true; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - ENCODE_TO_CURVE: function (DST, ID, HCID) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var k = q.nbits(); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var m = r.nbits(); - var L = this.ceil(k + this.ceil(m, 2), 8); - var OKM = ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, DST, ID); - var fd = []; - - for (var j = 0; j < L; j++) fd[j] = OKM[j]; - var dx = ctx.DBIG.fromBytes(fd); - var u = new ctx.FP(dx.mod(q)); - var P = ctx.ECP.map2point(u); - P.cfp(); - P.affine(); - P.toBytes(HCID, false); - }, - - /* create random secret S */ - RANDOM_GENERATE: function (rng, S) { - var r = new ctx.BIG(0), - s; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - s.toBytes(S); - return 0; - }, - - /* Extract PIN from TOKEN for identity CID */ - EXTRACT_PIN: function (CID, pin, TOKEN) { - var P, R; - P = ctx.ECP.fromBytes(TOKEN); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - R = ctx.ECP.fromBytes(CID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - pin %= this.MAXPIN; - R = R.pinmul(pin, this.PBLEN); - P.sub(R); - P.toBytes(TOKEN, false); - return 0; - }, - - /* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */ - GET_SERVER_SECRET: function (S, SST) { - var s, Q; - Q = ctx.ECP8.generator(); - s = ctx.BIG.fromBytes(S); - Q = ctx.PAIR8.G2mul(Q, s); - Q.toBytes(SST, false); - return 0; - }, - - /* Client secret CST=S*H(CID) where CID is client ID and S is master secret */ - GET_CLIENT_SECRET: function (S, IDHTC, CST) { - var s = ctx.BIG.fromBytes(S); - var P = ctx.ECP.fromBytes(IDHTC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - ctx.PAIR8.G1mul(P, s).toBytes(CST, false); - return 0; - }, - - /* Implement step 1 on client side of MPin protocol */ - CLIENT_1: function (CID, rng, X, pin, TOKEN, SEC, xID) { - var r = new ctx.BIG(0), - x, - P, - T, - W; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (rng !== null) { - x = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - x.toBytes(X); - } else { - x = ctx.BIG.fromBytes(X); - } - P = ctx.ECP.fromBytes(CID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - T = ctx.ECP.fromBytes(TOKEN); - if (T.is_infinity()) { - return this.INVALID_POINT; - } - - pin %= this.MAXPIN; - W = P.pinmul(pin, this.PBLEN); - T.add(W); - - P = ctx.PAIR8.G1mul(P, x); - P.toBytes(xID, false); - - T.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 on client side of MPin protocol */ - CLIENT_2: function (X, Y, SEC) { - var r = new ctx.BIG(0), - P, - px, - py; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - P = ctx.ECP.fromBytes(SEC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - px = ctx.BIG.fromBytes(X); - py = ctx.BIG.fromBytes(Y); - px.add(py); - px.mod(r); - - P = ctx.PAIR8.G1mul(P, px); - P.neg(); - P.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 of MPin protocol on server side. */ - SERVER: function (HID, Y, SST, xID, mSEC) { - var Q, sQ, R, y, P, g; - Q = ctx.ECP8.generator(); - sQ = ctx.ECP8.fromBytes(SST); - if (sQ.is_infinity()) { - return this.INVALID_POINT; - } - if (xID == null) { - return this.BAD_PARAMS; - } - R = ctx.ECP.fromBytes(xID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - y = ctx.BIG.fromBytes(Y); - if (HID == null) { - return this.BAD_PARAMS; - } - P = ctx.ECP.fromBytes(HID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - - P = ctx.PAIR8.G1mul(P, y); - P.add(R); - R = ctx.ECP.fromBytes(mSEC); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - - g = ctx.PAIR8.ate2(Q, R, sQ, P); - g = ctx.PAIR8.fexp(g); - - if (!g.isunity()) { - return this.BAD_PIN; - } - return 0; - }, - }; - - return MPIN256; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - MPIN256: MPIN256, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/nhs.js b/packages/bls-verify/src/vendor/amcl-js/src/nhs.js deleted file mode 100644 index bf86f040c..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/nhs.js +++ /dev/null @@ -1,766 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* NewHope API high-level functions */ - -var NHS = function (ctx) { - 'use strict'; - - var NHS = { - round: function (a, b) { - return Math.floor((a + (b >> 1)) / b); - }, - - /* constant time absolute value */ - nabs: function (x) { - var mask = x >> 31; - return (x + mask) ^ mask; - }, - - /* Montgomery stuff */ - - redc: function (T) { - var m = ((T & 0x3ffffff) * NHS.ND) & 0x3ffffff; - return (m * NHS.PRIME + T) * NHS.MODINV; - }, - - nres: function (x) { - return NHS.redc(x * NHS.R2MODP); - }, - - modmul: function (a, b) { - return NHS.redc(a * b); - }, - - /* NTT code */ - /* Cooley-Tukey NTT */ - - ntt: function (x) { - var t = NHS.DEGREE / 2, - q = NHS.PRIME, - m, - i, - j, - k, - S, - U, - V; - - /* Convert to Montgomery form */ - for (j = 0; j < NHS.DEGREE; j++) { - x[j] = NHS.nres(x[j]); - } - - m = 1; - while (m < NHS.DEGREE) { - k = 0; - - for (i = 0; i < m; i++) { - S = NHS.roots[m + i]; - - for (j = k; j < k + t; j++) { - U = x[j]; - V = NHS.modmul(x[j + t], S); - x[j] = U + V; - x[j + t] = U + 2 * q - V; - } - - k += 2 * t; - } - - t /= 2; - m *= 2; - } - }, - - /* Gentleman-Sande INTT */ - intt: function (x) { - var q = NHS.PRIME, - t = 1, - m, - i, - j, - k, - S, - U, - V, - W; - - m = NHS.DEGREE / 2; - while (m > 1) { - k = 0; - - for (i = 0; i < m; i++) { - S = NHS.iroots[m + i]; - - for (j = k; j < k + t; j++) { - U = x[j]; - V = x[j + t]; - x[j] = U + V; - W = U + NHS.DEGREE * q - V; - x[j + t] = NHS.modmul(W, S); - } - - k += 2 * t; - } - - t *= 2; - m /= 2; - } - /* Last iteration merged with n^-1 */ - - t = NHS.DEGREE / 2; - for (j = 0; j < t; j++) { - U = x[j]; - V = x[j + t]; - W = U + NHS.DEGREE * q - V; - x[j + t] = NHS.modmul(W, NHS.invpr); - x[j] = NHS.modmul(U + V, NHS.inv); - } - - /* convert back from Montgomery to "normal" form */ - for (j = 0; j < NHS.DEGREE; j++) { - x[j] = NHS.redc(x[j]); - x[j] -= q; - x[j] += (x[j] >> (NHS.WL - 1)) & q; - } - }, - - /* See https://eprint.iacr.org/2016/1157.pdf */ - - Encode: function (key, poly) { - var i, j, b, k, kj, q2; - - q2 = NHS.PRIME / 2; - for (i = j = 0; i < 256; ) { - kj = key[j++]; - - for (k = 0; k < 8; k++) { - b = kj & 1; - poly[i] = b * q2; - poly[i + 256] = b * q2; - poly[i + 512] = b * q2; - poly[i + 768] = b * q2; - kj >>= 1; - i++; - } - } - }, - - Decode: function (poly, key) { - var q2 = NHS.PRIME / 2, - i, - j, - k, - b, - t; - - for (i = 0; i < 32; i++) { - key[i] = 0; - } - - for (i = j = 0; i < 256; ) { - for (k = 0; k < 8; k++) { - t = - NHS.nabs(poly[i] - q2) + - NHS.nabs(poly[i + 256] - q2) + - NHS.nabs(poly[i + 512] - q2) + - NHS.nabs(poly[i + 768] - q2); - - b = t - NHS.PRIME; - b = (b >> 31) & 1; - key[j] = ((key[j] & 0xff) >> 1) + (b << 7); - i++; - } - - j++; - } - }, - - /* convert 32-byte seed to random polynomial */ - - Parse: function (seed, poly) { - var sh = new ctx.SHA3(ctx.SHA3.SHAKE128), - hash = [], - i, - j, - n; - - for (i = 0; i < 32; i++) { - sh.process(seed[i]); - } - sh.shake(hash, 4 * NHS.DEGREE); - - for (i = j = 0; i < NHS.DEGREE; i++) { - n = hash[j] & 0x7f; - n <<= 8; - n += hash[j + 1] & 0xff; - n <<= 8; - n += hash[j + 2] & 0xff; - n <<= 8; - n += hash[j + 3] & 0xff; - j += 4; - poly[i] = NHS.nres(n); - //poly[i] = NHS.modmul(n, NHS.ONE); // reduce 31-bit random number mod q - } - }, - - /* Compress 14 bits polynomial coefficients into byte array */ - /* 7 bytes is 3x14 */ - pack: function (poly, array) { - var i, j, a, b, c, d; - - for (i = j = 0; i < NHS.DEGREE; ) { - a = poly[i++]; - b = poly[i++]; - c = poly[i++]; - d = poly[i++]; - array[j++] = a & 0xff; - array[j++] = ((a >> 8) | (b << 6)) & 0xff; - array[j++] = (b >> 2) & 0xff; - array[j++] = ((b >> 10) | (c << 4)) & 0xff; - array[j++] = (c >> 4) & 0xff; - array[j++] = ((c >> 12) | (d << 2)) & 0xff; - array[j++] = d >> 6; - } - }, - - unpack: function (array, poly) { - var i, j, a, b, c, d, e, f, g; - - for (i = j = 0; i < NHS.DEGREE; ) { - a = array[j++] & 0xff; - b = array[j++] & 0xff; - c = array[j++] & 0xff; - d = array[j++] & 0xff; - e = array[j++] & 0xff; - f = array[j++] & 0xff; - g = array[j++] & 0xff; - poly[i++] = a | ((b & 0x3f) << 8); - poly[i++] = (b >> 6) | (c << 2) | ((d & 0xf) << 10); - poly[i++] = (d >> 4) | (e << 4) | ((f & 3) << 12); - poly[i++] = (f >> 2) | (g << 6); - } - }, - - /* See https://eprint.iacr.org/2016/1157.pdf */ - - Compress: function (poly, array) { - var col = 0, - i, - j, - k, - b; - - for (i = j = 0; i < NHS.DEGREE; ) { - for (k = 0; k < 8; k++) { - b = NHS.round(poly[i] * 8, NHS.PRIME) & 7; - col = (col << 3) + b; - i++; - } - - array[j] = col & 0xff; - array[j + 1] = (col >>> 8) & 0xff; - array[j + 2] = (col >>> 16) & 0xff; - j += 3; - col = 0; - } - }, - - Decompress: function (array, poly) { - var col = 0, - i, - j, - k, - b; - - for (i = j = 0; i < NHS.DEGREE; ) { - col = array[j + 2] & 0xff; - col = (col << 8) + (array[j + 1] & 0xff); - col = (col << 8) + (array[j] & 0xff); - j += 3; - - for (k = 0; k < 8; k++) { - b = (col & 0xe00000) >>> 21; - col <<= 3; - poly[i] = NHS.round(b * NHS.PRIME, 8); - i++; - } - } - }, - - /* generate centered binomial distribution */ - - Error: function (RNG, poly) { - var n1, n2, r, i, j; - - for (i = 0; i < NHS.DEGREE; i++) { - n1 = RNG.getByte() + (RNG.getByte() << 8); - n2 = RNG.getByte() + (RNG.getByte() << 8); - r = 0; - - for (j = 0; j < 16; j++) { - r += (n1 & 1) - (n2 & 1); - n1 >>= 1; - n2 >>= 1; - } - - poly[i] = r + NHS.PRIME; - } - }, - - redc_it: function (p) { - var i; - for (i = 0; i < NHS.DEGREE; i++) { - p[i] = NHS.redc(p[i]); - } - }, - - nres_it: function (p) { - var i; - for (i = 0; i < NHS.DEGREE; i++) { - p[i] = NHS.nres(p[i]); - } - }, - - poly_mul: function (p1, p2, p3) { - var i; - - for (i = 0; i < NHS.DEGREE; i++) { - p1[i] = NHS.modmul(p2[i], p3[i]); - } - }, - - poly_add: function (p1, p2, p3) { - var i; - - for (i = 0; i < NHS.DEGREE; i++) { - p1[i] = p2[i] + p3[i]; - } - }, - - poly_sub: function (p1, p2, p3) { - var i; - - for (i = 0; i < NHS.DEGREE; i++) { - p1[i] = p2[i] + NHS.PRIME - p3[i]; - } - }, - - /* reduces inputs < 2q */ - poly_soft_reduce: function (poly) { - var i, e; - - for (i = 0; i < NHS.DEGREE; i++) { - e = poly[i] - NHS.PRIME; - poly[i] = e + ((e >> (NHS.WL - 1)) & NHS.PRIME); - } - }, - - /* fully reduces modulo q */ - poly_hard_reduce: function (poly) { - var i, e; - - for (i = 0; i < NHS.DEGREE; i++) { - e = NHS.modmul(poly[i], NHS.ONE); - e = e - NHS.PRIME; - poly[i] = e + ((e >> (NHS.WL - 1)) & NHS.PRIME); - } - }, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - /* API files */ - - SERVER_1: function (RNG, SB, S) { - var seed = new Uint8Array(32), - array = new Uint8Array(1792), - s = new Int32Array(NHS.DEGREE), - e = new Int32Array(NHS.DEGREE), - b = new Int32Array(NHS.DEGREE), - i; - - for (i = 0; i < 32; i++) { - seed[i] = RNG.getByte(); - } - - NHS.Parse(seed, b); - - NHS.Error(RNG, e); - NHS.Error(RNG, s); - - NHS.ntt(s); - NHS.ntt(e); - NHS.poly_mul(b, b, s); - NHS.poly_add(b, b, e); - NHS.poly_hard_reduce(b); - - NHS.redc_it(b); - NHS.pack(b, array); - - for (i = 0; i < 32; i++) { - SB[i] = seed[i]; - } - - for (i = 0; i < 1792; i++) { - SB[i + 32] = array[i]; - } - - NHS.poly_hard_reduce(s); - - NHS.pack(s, array); - - for (i = 0; i < 1792; i++) { - S[i] = array[i]; - } - }, - - CLIENT: function (RNG, SB, UC, KEY) { - var sh = new ctx.SHA3(ctx.SHA3.HASH256), - seed = new Uint8Array(32), - array = new Uint8Array(1792), - key = new Uint8Array(32), - cc = new Uint8Array(384), - sd = new Int32Array(NHS.DEGREE), - ed = new Int32Array(NHS.DEGREE), - u = new Int32Array(NHS.DEGREE), - k = new Int32Array(NHS.DEGREE), - c = new Int32Array(NHS.DEGREE), - i; - - NHS.Error(RNG, sd); - NHS.Error(RNG, ed); - - NHS.ntt(sd); - NHS.ntt(ed); - - for (i = 0; i < 32; i++) { - seed[i] = SB[i]; - } - - for (i = 0; i < 1792; i++) { - array[i] = SB[i + 32]; - } - - NHS.Parse(seed, u); - - NHS.poly_mul(u, u, sd); - NHS.poly_add(u, u, ed); - NHS.poly_hard_reduce(u); - - for (i = 0; i < 32; i++) { - key[i] = RNG.getByte(); - } - - for (i = 0; i < 32; i++) { - sh.process(key[i]); - } - - key = sh.hash(); - - NHS.Encode(key, k); - - NHS.unpack(array, c); - NHS.nres_it(c); - - NHS.poly_mul(c, c, sd); - NHS.intt(c); - NHS.Error(RNG, ed); - NHS.poly_add(c, c, ed); - NHS.poly_add(c, c, k); - - NHS.Compress(c, cc); - - sh.init(ctx.SHA3.HASH256); - for (i = 0; i < 32; i++) { - sh.process(key[i]); - } - key = sh.hash(); - - for (i = 0; i < 32; i++) { - KEY[i] = key[i]; - } - - NHS.redc_it(u); - NHS.pack(u, array); - - for (i = 0; i < 1792; i++) { - UC[i] = array[i]; - } - - for (i = 0; i < 384; i++) { - UC[i + 1792] = cc[i]; - } - }, - - SERVER_2: function (S, UC, KEY) { - var sh = new ctx.SHA3(ctx.SHA3.HASH256), - c = new Int32Array(NHS.DEGREE), - s = new Int32Array(NHS.DEGREE), - k = new Int32Array(NHS.DEGREE), - array = new Uint8Array(1792), - key = new Uint8Array(32), - cc = new Uint8Array(384), - i; - - for (i = 0; i < 1792; i++) { - array[i] = UC[i]; - } - - NHS.unpack(array, k); - NHS.nres_it(k); - - for (i = 0; i < 384; i++) { - cc[i] = UC[i + 1792]; - } - - NHS.Decompress(cc, c); - - for (i = 0; i < 1792; i++) { - array[i] = S[i]; - } - - NHS.unpack(array, s); - - NHS.poly_mul(k, k, s); - NHS.intt(k); - NHS.poly_sub(k, c, k); - NHS.poly_soft_reduce(k); - - NHS.Decode(k, key); - - for (i = 0; i < 32; i++) { - sh.process(key[i]); - } - key = sh.hash(); - - for (i = 0; i < 32; i++) { - KEY[i] = key[i]; - } - }, - }; - - //q=12289 - NHS.PRIME = 0x3001; // q in Hex - NHS.LGN = 10; // Degree n=2^LGN - NHS.ND = 0x3002fff; // 1/(R-q) mod R - NHS.ONE = 0x2aac; // R mod q - NHS.R2MODP = 0x1da2; // R^2 mod q - - NHS.MODINV = Math.pow(2, -26); - - NHS.DEGREE = 1024; // 1<< LGN - NHS.WL = 26; - - NHS.inv = 0xffb; - NHS.invpr = 0x1131; - - NHS.roots = [ - 0x2aac, 0xd6f, 0x1c67, 0x2c5b, 0x2dbd, 0x2697, 0x29f6, 0x8d3, 0x1b7c, 0x9eb, 0x20eb, 0x264a, - 0x27d0, 0x121b, 0x58c, 0x4d7, 0x17a2, 0x29eb, 0x1b72, 0x13b0, 0x19b1, 0x1581, 0x2ac9, 0x25e8, - 0x249d, 0x2d5e, 0x363, 0x1f74, 0x1f8f, 0x20a4, 0x2cb2, 0x2d04, 0x1407, 0x2df9, 0x3ad, 0x23f7, - 0x1a72, 0xa91, 0x37f, 0xdb3, 0x2315, 0x5e6, 0xa8f, 0x211d, 0xdad, 0x1f2b, 0x2e29, 0x26b0, - 0x2009, 0x2fdd, 0x2881, 0x399, 0x586, 0x2781, 0x2ab5, 0x971, 0x234b, 0x1df3, 0x1d2a, 0x15dd, - 0x1a6d, 0x2774, 0x7ff, 0x1ebe, 0x230, 0x1cf4, 0x180b, 0xb58, 0x198c, 0x2b40, 0x127b, 0x1d9d, - 0x137f, 0xfa0, 0x144, 0x4b, 0x2fac, 0xb09, 0x1c7f, 0x1b5, 0xeec, 0xc58, 0x1248, 0x243c, 0x108a, - 0x14b8, 0xe9, 0x2dfe, 0xfb, 0x2602, 0x2aec, 0x1bb7, 0x1098, 0x23d8, 0x783, 0x1b13, 0x2067, - 0x20d6, 0x171c, 0x4, 0x662, 0x1097, 0x24b9, 0x1b9d, 0x27c4, 0x276e, 0x6bf, 0x757, 0x2e16, 0x472, - 0x1d11, 0x1649, 0x2904, 0xed4, 0x6c5, 0x14ae, 0x2ef8, 0x2ae0, 0x2e7c, 0x2735, 0x1186, 0x4f2, - 0x17bb, 0x297f, 0x1dc7, 0x1ae5, 0x2a43, 0x2c02, 0xed6, 0x2b70, 0x1c7b, 0x18d1, 0x20ae, 0x6ad, - 0x2404, 0x113a, 0x209e, 0x31b, 0x159d, 0x48f, 0xe09, 0x1bb2, 0x14f7, 0x385, 0x1c4, 0x1cdb, - 0x22d6, 0x21d8, 0xc, 0x1aae, 0x2ece, 0x2d81, 0xd56, 0x5c1, 0x12da, 0x8cf, 0x1605, 0x1bc4, - 0x18b7, 0x19b9, 0x21be, 0x135e, 0x28d6, 0x2891, 0x2208, 0x17e1, 0x2971, 0x926, 0x211b, 0xff, - 0x51f, 0xa85, 0xe1, 0x2c35, 0x2585, 0x121, 0xe27, 0x2e64, 0x29f8, 0x2d46, 0xcb2, 0x292a, 0x33d, - 0xaf9, 0xb86, 0x2e3a, 0x2138, 0x1978, 0x2324, 0xf3f, 0x2d10, 0x1dfd, 0x13c3, 0x6cc, 0x1a79, - 0x1221, 0x250f, 0xacd, 0xfff, 0x7b4, 0x650, 0x1893, 0xe85, 0x1f5d, 0x12dc, 0x2d42, 0xd8e, - 0x1240, 0x1082, 0x12ef, 0x11b6, 0xfa8, 0xb0f, 0xdac, 0x191c, 0x1242, 0x1ea, 0x155, 0x270a, - 0x9ed, 0x2e5b, 0x25d8, 0x222c, 0x7e9, 0x1fb3, 0x10ac, 0x2919, 0x2584, 0xbe3, 0x24fa, 0x23ed, - 0x618, 0x2d80, 0x6fa, 0x140e, 0x588, 0x355, 0x1054, 0x26c4, 0x1e4f, 0x1681, 0x1f6f, 0x1c53, - 0xfe4, 0xacb, 0x1680, 0x2fe8, 0x6c, 0x165a, 0x10bb, 0x2c39, 0x1804, 0x1196, 0x884, 0x2622, - 0x629, 0x1ac1, 0x2232, 0x2f9b, 0xd3e, 0x20ff, 0x12c0, 0x27ec, 0x5a, 0x2a0, 0x5f1, 0x1cda, 0x403, - 0x1ea8, 0x1719, 0x1fc7, 0x2d23, 0x5ea, 0x25d1, 0xb6, 0x49c, 0xac7, 0x2d9c, 0x204e, 0x2142, - 0x11e8, 0xed0, 0x15f0, 0x514, 0xa3f, 0xf43, 0x1de5, 0x2d97, 0x1543, 0x2c7b, 0x241a, 0x2223, - 0x2fb8, 0x25b7, 0x1b4c, 0x2f36, 0x26e2, 0x100, 0x2555, 0x266c, 0x2e10, 0x271c, 0x5aa, 0x1789, - 0x2199, 0x291d, 0x1088, 0x2046, 0x1ea1, 0xf89, 0x1c7a, 0x1e98, 0x137, 0x1b65, 0x24ed, 0xf37, - 0x2ec3, 0xd0c, 0x7c7, 0x123f, 0xb2e, 0x1a97, 0x1a03, 0x1bcd, 0x3b2, 0x714, 0x2979, 0xaef, - 0x2b3c, 0x2d91, 0xe03, 0xe5b, 0x1fbc, 0xcae, 0x432, 0x23a4, 0xb1d, 0x1ccc, 0x1fb6, 0x2f58, - 0x2a5a, 0x723, 0x2c99, 0x2d70, 0xa, 0x263c, 0x2701, 0xdeb, 0x2d08, 0x1c34, 0x200c, 0x1e88, - 0x396, 0x18d5, 0x1c45, 0xc4, 0x18bc, 0x2cd7, 0x1744, 0x8f1, 0x1c5c, 0xbe6, 0x2a89, 0x17a0, - 0x207, 0x19ce, 0x2024, 0x23e3, 0x299b, 0x685, 0x2baf, 0x539, 0x2d49, 0x24b5, 0x158d, 0xfd, - 0x2a95, 0x24d, 0xab3, 0x1125, 0x12f9, 0x15ba, 0x6a8, 0x2c36, 0x6e7, 0x1044, 0x36e, 0xfe8, - 0x112d, 0x2717, 0x24a0, 0x1c09, 0xe1d, 0x828, 0x2f7, 0x1f5b, 0xfab, 0xcf6, 0x1332, 0x1c72, - 0x2683, 0x15ce, 0x1ad3, 0x1a36, 0x24c, 0xb33, 0x253f, 0x1583, 0x1d69, 0x29ec, 0xba7, 0x2f97, - 0x16df, 0x1068, 0xaee, 0xc4f, 0x153c, 0x24eb, 0x20cd, 0x1398, 0x2366, 0x11f9, 0xe77, 0x103d, - 0x260a, 0xce, 0xaea, 0x236b, 0x2b11, 0x5f8, 0xe4f, 0x750, 0x1569, 0x10f5, 0x284e, 0xa38, 0x2e06, - 0xe0, 0xeaa, 0x99e, 0x249b, 0x8eb, 0x2b97, 0x2fdf, 0x29c1, 0x1b00, 0x2fe3, 0x1d4f, 0x83f, - 0x2d06, 0x10e, 0x183f, 0x27ba, 0x132, 0xfbf, 0x296d, 0x154a, 0x40a, 0x2767, 0xad, 0xc09, 0x974, - 0x2821, 0x1e2e, 0x28d2, 0xfac, 0x3c4, 0x2f19, 0xdd4, 0x2ddf, 0x1e43, 0x1e90, 0x2dc9, 0x1144, - 0x28c3, 0x653, 0xf3c, 0x1e32, 0x2a4a, 0x391, 0x1123, 0xdb, 0x2da0, 0xe1e, 0x667, 0x23b5, 0x2039, - 0xa92, 0x1552, 0x5d3, 0x169a, 0x1f03, 0x1342, 0x2004, 0x1b5d, 0x2d01, 0x2e9b, 0x41f, 0x2bc7, - 0xa94, 0xd0, 0x2e6a, 0x2b38, 0x14ac, 0x2724, 0x3ba, 0x6bc, 0x18ac, 0x2da5, 0x213c, 0x2c5c, - 0xdd3, 0xaae, 0x2e08, 0x6cd, 0x1677, 0x2025, 0x1e1c, 0x5b4, 0xdc4, 0x60, 0x156c, 0x2669, 0x1c01, - 0x26ab, 0x1ebb, 0x26d4, 0x21e1, 0x156b, 0x567, 0x1a, 0x29ce, 0x23d4, 0x684, 0xb79, 0x1953, - 0x1046, 0x1d8c, 0x17b5, 0x1c28, 0x1ce5, 0x2478, 0x18d8, 0x1b16, 0x2c2f, 0x21c9, 0x19bb, 0xbbc, - 0x291b, 0x19f6, 0x1879, 0x2fe4, 0x58e, 0x294a, 0x19e8, 0x27c7, 0x2fba, 0x1a29, 0x2319, 0x1ecb, - 0x203b, 0x2f05, 0x2b82, 0x192f, 0x26aa, 0x2482, 0xaed, 0x1216, 0x708, 0x11a1, 0xc22, 0x908, - 0x28f8, 0x2427, 0x7f8, 0x172e, 0xf50, 0xaa8, 0x184a, 0x1f67, 0x22d1, 0xeba, 0x215b, 0xf47, - 0x2877, 0xd5e, 0x8dc, 0x20d, 0x2dae, 0x1d3e, 0x775, 0xbf3, 0x872, 0x2667, 0x1ff6, 0xd9f, 0x13c4, - 0x105, 0x65f, 0x21ec, 0x6dd, 0x1a09, 0xc6e, 0x1fd, 0x1426, 0xae3, 0x494, 0x2d82, 0x22cd, 0x25d6, - 0x11c1, 0x1c, 0x2cae, 0x141f, 0x110a, 0x147, 0x2657, 0x23fd, 0x2f39, 0x360, 0x2294, 0x1f1e, - 0xb73, 0xbfc, 0x2f17, 0x7ca, 0x2f63, 0xbf, 0x28c2, 0xc1a, 0x255e, 0x226e, 0x1aa8, 0x229e, - 0x161a, 0x273, 0x106d, 0x2c40, 0x7cf, 0x1408, 0x7d8, 0x100a, 0x759, 0x1db4, 0x24be, 0x2ebb, - 0xc17, 0x1894, 0x244e, 0x15bd, 0x748, 0x1fe9, 0x23d, 0x1da, 0x2be, 0x18a3, 0xc5c, 0x9f9, 0x3d5, - 0x2ce4, 0x54, 0x2abf, 0x279c, 0x1e81, 0x2d59, 0x2847, 0x23f4, 0xda8, 0xa20, 0x258, 0x1cfe, - 0x240c, 0x2c2e, 0x2790, 0x2dd5, 0x2bf2, 0x2e34, 0x1724, 0x211, 0x1009, 0x27b9, 0x6f9, 0x23d9, - 0x19a2, 0x627, 0x156d, 0x169e, 0x7e7, 0x30f, 0x24b6, 0x5c2, 0x1ce4, 0x28dd, 0x20, 0x16ab, - 0x1cce, 0x20a9, 0x2390, 0x2884, 0x2245, 0x5f7, 0xab7, 0x1b6a, 0x11e7, 0x2a53, 0x2f94, 0x294c, - 0x1ee5, 0x1364, 0x1b9a, 0xff7, 0x5eb, 0x2c30, 0x1c02, 0x5a1, 0x1b87, 0x2402, 0x1cc8, 0x2ee1, - 0x1fbe, 0x138c, 0x2487, 0x1bf8, 0xd96, 0x1d68, 0x2fb3, 0x1fc1, 0x1fcc, 0xd66, 0x953, 0x2141, - 0x157a, 0x2477, 0x18e3, 0x2f30, 0x75e, 0x1de1, 0x14b2, 0x2faa, 0x1697, 0x2334, 0x12d1, 0xb76, - 0x2aa8, 0x1e7a, 0xd5, 0x2c60, 0x26b8, 0x1753, 0x124a, 0x1f57, 0x1425, 0xd84, 0x1c05, 0x641, - 0xf3a, 0x1b8c, 0xd7d, 0x2f52, 0x2f4, 0xc73, 0x151b, 0x1589, 0x1819, 0x1b18, 0xb9b, 0x1ae9, - 0x2b1f, 0x2b44, 0x2f5a, 0x2d37, 0x2cb1, 0x26f5, 0x233e, 0x276f, 0x276, 0x1260, 0x2997, 0x9f2, - 0x1c15, 0x1694, 0x11ac, 0x1e6d, 0x1bef, 0x2966, 0x18b2, 0x4fa, 0x2044, 0x1b70, 0x1f3e, 0x221e, - 0x28ca, 0x1d56, 0x7ae, 0x98d, 0x238c, 0x17b8, 0xad3, 0x113f, 0x1f1b, 0x4d2, 0x1757, 0xcb1, - 0x2ef1, 0x2e02, 0x17fc, 0x2f11, 0x2a74, 0x2029, 0x700, 0x154e, 0x1cef, 0x226a, 0x21bf, 0x27a6, - 0x14bc, 0x2b2b, 0x2fc6, 0x13b6, 0x21e6, 0x1663, 0xcbd, 0x752, 0x1624, 0x881, 0x2fc0, 0x1276, - 0xa7f, 0x274f, 0x2b53, 0x670, 0x1fb7, 0x1e41, 0x2a1e, 0x2612, 0x297, 0x19de, 0x18b, 0x249, - 0x1c88, 0xe9e, 0x1ef1, 0x213, 0x47b, 0x1e20, 0x28c1, 0x1d5e, 0x977, 0x1dca, 0x990, 0x1df6, - 0x2b62, 0x870, 0x1f4, 0x1829, 0x1e0a, 0x46, 0x1b9f, 0x2102, 0x16b, 0x1b32, 0x568, 0x2050, - 0x15b4, 0x191a, 0x1dd0, 0x5df, 0x55c, 0x1d21, 0x19db, 0x12d9, 0xe96, 0x680, 0x2349, 0x9b9, - 0x155d, 0xe31, 0x249f, 0x20f8, 0xb30, 0x337, 0x2da3, 0x11c3, 0x248f, 0x1cf9, 0x10ee, 0x6d8, - 0x6eb, 0xa0d, 0x101b, 0x1ae4, 0x1801, 0x24cd, 0x813, 0x2e98, 0x1574, 0x50, 0x11da, 0x1802, - 0xf56, 0x1839, 0x219c, 0x105b, 0x43b, 0x2c9, 0x917, 0x14c1, 0x1b79, 0xdab, 0x2ab9, 0x265c, - 0x71a, 0x1d90, 0x89f, 0x2bc2, 0x2777, 0x1014, 0x1e64, 0x14b4, 0x692, 0xddb, 0x56e, 0x2190, - 0x2d1b, 0x1016, 0x12d6, 0x1c81, 0x2628, 0x4a1, 0x1268, 0x2597, 0x2926, 0x7c5, 0x1dcd, 0x53f, - 0x11a9, 0x1a41, 0x5a2, 0x1c65, 0x7e8, 0xd71, 0x29c8, 0x427, 0x32f, 0x5dc, 0x16b1, 0x2a1d, - 0x1787, 0x2224, 0x620, 0x6a4, 0x1351, 0x1038, 0xe6c, 0x111b, 0x2f13, 0x441, 0x2cfd, 0x2f2f, - 0xd25, 0x9b8, 0x1b24, 0x762, 0x19b6, 0x2611, 0x85e, 0xe37, 0x1f5, 0x503, 0x1c46, 0x23cc, 0x4bb, - 0x243e, 0x122b, 0x28e2, 0x133e, 0x2db9, 0xdb2, 0x1a5c, 0x29a9, 0xca, 0x2113, 0x13d1, 0x15ec, - 0x2079, 0x18da, 0x2d50, 0x2c45, 0xaa2, 0x135a, 0x800, 0x18f7, 0x17f3, 0x5fd, 0x1f5a, 0x2d0, - 0x2cd1, 0x9ee, 0x218b, 0x19fd, 0x53b, 0x28c5, 0xe33, 0x1911, 0x26cc, 0x2018, 0x2f88, 0x1b01, - 0x2637, 0x1cd9, 0x126b, 0x1a0b, 0x5b0, 0x24e0, 0xe82, 0xb1, 0x21f7, 0x1a16, 0x2f24, 0x1cb1, - 0x1f7d, 0x28a0, 0x167e, 0xc3, - ]; - NHS.iroots = [ - 0x2aac, 0x2292, 0x3a6, 0x139a, 0x272e, 0x60b, 0x96a, 0x244, 0x2b2a, 0x2a75, 0x1de6, 0x831, - 0x9b7, 0xf16, 0x2616, 0x1485, 0x2fd, 0x34f, 0xf5d, 0x1072, 0x108d, 0x2c9e, 0x2a3, 0xb64, 0xa19, - 0x538, 0x1a80, 0x1650, 0x1c51, 0x148f, 0x616, 0x185f, 0x1143, 0x2802, 0x88d, 0x1594, 0x1a24, - 0x12d7, 0x120e, 0xcb6, 0x2690, 0x54c, 0x880, 0x2a7b, 0x2c68, 0x780, 0x24, 0xff8, 0x951, 0x1d8, - 0x10d6, 0x2254, 0xee4, 0x2572, 0x2a1b, 0xcec, 0x224e, 0x2c82, 0x2570, 0x158f, 0xc0a, 0x2c54, - 0x208, 0x1bfa, 0x3ff, 0x5be, 0x151c, 0x123a, 0x682, 0x1846, 0x2b0f, 0x1e7b, 0x8cc, 0x185, 0x521, - 0x109, 0x1b53, 0x293c, 0x212d, 0x6fd, 0x19b8, 0x12f0, 0x2b8f, 0x1eb, 0x28aa, 0x2942, 0x893, - 0x83d, 0x1464, 0xb48, 0x1f6a, 0x299f, 0x2ffd, 0x18e5, 0xf2b, 0xf9a, 0x14ee, 0x287e, 0xc29, - 0x1f69, 0x144a, 0x515, 0x9ff, 0x2f06, 0x203, 0x2f18, 0x1b49, 0x1f77, 0xbc5, 0x1db9, 0x23a9, - 0x2115, 0x2e4c, 0x1382, 0x24f8, 0x55, 0x2fb6, 0x2ebd, 0x2061, 0x1c82, 0x1264, 0x1d86, 0x4c1, - 0x1675, 0x24a9, 0x17f6, 0x130d, 0x2dd1, 0x29d8, 0x9df, 0x277d, 0x1e6b, 0x17fd, 0x3c8, 0x1f46, - 0x19a7, 0x2f95, 0x19, 0x1981, 0x2536, 0x201d, 0x13ae, 0x1092, 0x1980, 0x11b2, 0x93d, 0x1fad, - 0x2cac, 0x2a79, 0x1bf3, 0x2907, 0x281, 0x29e9, 0xc14, 0xb07, 0x241e, 0xa7d, 0x6e8, 0x1f55, - 0x104e, 0x2818, 0xdd5, 0xa29, 0x1a6, 0x2614, 0x8f7, 0x2eac, 0x2e17, 0x1dbf, 0x16e5, 0x2255, - 0x24f2, 0x2059, 0x1e4b, 0x1d12, 0x1f7f, 0x1dc1, 0x2273, 0x2bf, 0x1d25, 0x10a4, 0x217c, 0x176e, - 0x29b1, 0x284d, 0x2002, 0x2534, 0xaf2, 0x1de0, 0x1588, 0x2935, 0x1c3e, 0x1204, 0x2f1, 0x20c2, - 0xcdd, 0x1689, 0xec9, 0x1c7, 0x247b, 0x2508, 0x2cc4, 0x6d7, 0x234f, 0x2bb, 0x609, 0x19d, 0x21da, - 0x2ee0, 0xa7c, 0x3cc, 0x2f20, 0x257c, 0x2ae2, 0x2f02, 0xee6, 0x26db, 0x690, 0x1820, 0xdf9, - 0x770, 0x72b, 0x1ca3, 0xe43, 0x1648, 0x174a, 0x143d, 0x19fc, 0x2732, 0x1d27, 0x2a40, 0x22ab, - 0x280, 0x133, 0x1553, 0x2ff5, 0xe29, 0xd2b, 0x1326, 0x2e3d, 0x2c7c, 0x1b0a, 0x144f, 0x21f8, - 0x2b72, 0x1a64, 0x2ce6, 0xf63, 0x1ec7, 0xbfd, 0x2954, 0xf53, 0x1730, 0x1386, 0x491, 0x212b, - 0x222e, 0x3a5, 0xec5, 0x25c, 0x1755, 0x2945, 0x2c47, 0x8dd, 0x1b55, 0x4c9, 0x197, 0x2f31, - 0x256d, 0x43a, 0x2be2, 0x166, 0x300, 0x14a4, 0xffd, 0x1cbf, 0x10fe, 0x1967, 0x2a2e, 0x1aaf, - 0x256f, 0xfc8, 0xc4c, 0x299a, 0x21e3, 0x261, 0x2f26, 0x1ede, 0x2c70, 0x5b7, 0x11cf, 0x20c5, - 0x29ae, 0x73e, 0x1ebd, 0x238, 0x1171, 0x11be, 0x222, 0x222d, 0xe8, 0x2c3d, 0x2055, 0x72f, - 0x11d3, 0x7e0, 0x268d, 0x23f8, 0x2f54, 0x89a, 0x2bf7, 0x1ab7, 0x694, 0x2042, 0x2ecf, 0x847, - 0x17c2, 0x2ef3, 0x2fb, 0x27c2, 0x12b2, 0x1e, 0x1501, 0x640, 0x22, 0x46a, 0x2716, 0xb66, 0x2663, - 0x2157, 0x2f21, 0x1fb, 0x25c9, 0x7b3, 0x1f0c, 0x1a98, 0x28b1, 0x21b2, 0x2a09, 0x4f0, 0xc96, - 0x2517, 0x2f33, 0x9f7, 0x1fc4, 0x218a, 0x1e08, 0xc9b, 0x1c69, 0xf34, 0xb16, 0x1ac5, 0x23b2, - 0x2513, 0x1f99, 0x1922, 0x6a, 0x245a, 0x615, 0x1298, 0x1a7e, 0xac2, 0x24ce, 0x2db5, 0x15cb, - 0x152e, 0x1a33, 0x97e, 0x138f, 0x1ccf, 0x230b, 0x2056, 0x10a6, 0x2d0a, 0x27d9, 0x21e4, 0x13f8, - 0xb61, 0x8ea, 0x1ed4, 0x2019, 0x2c93, 0x1fbd, 0x291a, 0x3cb, 0x2959, 0x1a47, 0x1d08, 0x1edc, - 0x254e, 0x2db4, 0x56c, 0x2f04, 0x1a74, 0xb4c, 0x2b8, 0x2ac8, 0x452, 0x297c, 0x666, 0xc1e, 0xfdd, - 0x1633, 0x2dfa, 0x1861, 0x578, 0x241b, 0x13a5, 0x2710, 0x18bd, 0x32a, 0x1745, 0x2f3d, 0x13bc, - 0x172c, 0x2c6b, 0x1179, 0xff5, 0x13cd, 0x2f9, 0x2216, 0x900, 0x9c5, 0x2ff7, 0x291, 0x368, - 0x28de, 0x5a7, 0xa9, 0x104b, 0x1335, 0x24e4, 0xc5d, 0x2bcf, 0x2353, 0x1045, 0x21a6, 0x21fe, - 0x270, 0x4c5, 0x2512, 0x688, 0x28ed, 0x2c4f, 0x1434, 0x15fe, 0x156a, 0x24d3, 0x1dc2, 0x283a, - 0x22f5, 0x13e, 0x20ca, 0xb14, 0x149c, 0x2eca, 0x1169, 0x1387, 0x2078, 0x1160, 0xfbb, 0x1f79, - 0x6e4, 0xe68, 0x1878, 0x2a57, 0x8e5, 0x1f1, 0x995, 0xaac, 0x2f01, 0x91f, 0xcb, 0x14b5, 0xa4a, - 0x49, 0xdde, 0xbe7, 0x386, 0x1abe, 0x26a, 0x121c, 0x20be, 0x25c2, 0x2aed, 0x1a11, 0x2131, - 0x1e19, 0xebf, 0xfb3, 0x265, 0x253a, 0x2b65, 0x2f4b, 0xa30, 0x2a17, 0x2de, 0x103a, 0x18e8, - 0x1159, 0x2bfe, 0x1327, 0x2a10, 0x2d61, 0x2fa7, 0x815, 0x1d41, 0xf02, 0x22c3, 0x66, 0xdcf, - 0x1540, 0x2f3e, 0x1983, 0x761, 0x1084, 0x1350, 0xdd, 0x15eb, 0xe0a, 0x2f50, 0x217f, 0xb21, - 0x2a51, 0x15f6, 0x1d96, 0x1328, 0x9ca, 0x1500, 0x79, 0xfe9, 0x935, 0x16f0, 0x21ce, 0x73c, - 0x2ac6, 0x1604, 0xe76, 0x2613, 0x330, 0x2d31, 0x10a7, 0x2a04, 0x180e, 0x170a, 0x2801, 0x1ca7, - 0x255f, 0x3bc, 0x2b1, 0x1727, 0xf88, 0x1a15, 0x1c30, 0xeee, 0x2f37, 0x658, 0x15a5, 0x224f, - 0x248, 0x1cc3, 0x71f, 0x1dd6, 0xbc3, 0x2b46, 0xc35, 0x13bb, 0x2afe, 0x2e0c, 0x21ca, 0x27a3, - 0x9f0, 0x164b, 0x289f, 0x14dd, 0x2649, 0x22dc, 0xd2, 0x304, 0x2bc0, 0xee, 0x1ee6, 0x2195, - 0x1fc9, 0x1cb0, 0x295d, 0x29e1, 0xddd, 0x187a, 0x5e4, 0x1950, 0x2a25, 0x2cd2, 0x2bda, 0x639, - 0x2290, 0x2819, 0x139c, 0x2a5f, 0x15c0, 0x1e58, 0x2ac2, 0x1234, 0x283c, 0x6db, 0xa6a, 0x1d99, - 0x2b60, 0x9d9, 0x1380, 0x1d2b, 0x1feb, 0x2e6, 0xe71, 0x2a93, 0x2226, 0x296f, 0x1b4d, 0x119d, - 0x1fed, 0x88a, 0x43f, 0x2762, 0x1271, 0x28e7, 0x9a5, 0x548, 0x2256, 0x1488, 0x1b40, 0x26ea, - 0x2d38, 0x2bc6, 0x1fa6, 0xe65, 0x17c8, 0x20ab, 0x17ff, 0x1e27, 0x2fb1, 0x1a8d, 0x169, 0x27ee, - 0xb34, 0x1800, 0x151d, 0x1fe6, 0x25f4, 0x2916, 0x2929, 0x1f13, 0x1308, 0xb72, 0x1e3e, 0x25e, - 0x2cca, 0x24d1, 0xf09, 0xb62, 0x21d0, 0x1aa4, 0x2648, 0xcb8, 0x2981, 0x216b, 0x1d28, 0x1626, - 0x12e0, 0x2aa5, 0x2a22, 0x1231, 0x16e7, 0x1a4d, 0xfb1, 0x2a99, 0x14cf, 0x2e96, 0xeff, 0x1462, - 0x2fbb, 0x11f7, 0x17d8, 0x2e0d, 0x2791, 0x49f, 0x120b, 0x2671, 0x1237, 0x268a, 0x12a3, 0x740, - 0x11e1, 0x2b86, 0x2dee, 0x1110, 0x2163, 0x1379, 0x2db8, 0x2e76, 0x1623, 0x2d6a, 0x9ef, 0x5e3, - 0x11c0, 0x104a, 0x2991, 0x4ae, 0x8b2, 0x2582, 0x1d8b, 0x41, 0x2780, 0x19dd, 0x28af, 0x2344, - 0x199e, 0xe1b, 0x1c4b, 0x3b, 0x4d6, 0x1b45, 0x85b, 0xe42, 0xd97, 0x1312, 0x1ab3, 0x2901, 0xfd8, - 0x58d, 0xf0, 0x1805, 0x1ff, 0x110, 0x2350, 0x18aa, 0x2b2f, 0x10e6, 0x1ec2, 0x252e, 0x1849, - 0xc75, 0x2674, 0x2853, 0x12ab, 0x737, 0xde3, 0x10c3, 0x1491, 0xfbd, 0x2b07, 0x174f, 0x69b, - 0x1412, 0x1194, 0x1e55, 0x196d, 0x13ec, 0x260f, 0x66a, 0x1da1, 0x2d8b, 0x892, 0xcc3, 0x90c, - 0x350, 0x2ca, 0xa7, 0x4bd, 0x4e2, 0x1518, 0x2466, 0x14e9, 0x17e8, 0x1a78, 0x1ae6, 0x238e, - 0x2d0d, 0xaf, 0x2284, 0x1475, 0x20c7, 0x29c0, 0x13fc, 0x227d, 0x1bdc, 0x10aa, 0x1db7, 0x18ae, - 0x949, 0x3a1, 0x2f2c, 0x1187, 0x559, 0x248b, 0x1d30, 0xccd, 0x196a, 0x57, 0x1b4f, 0x1220, - 0x28a3, 0xd1, 0x171e, 0xb8a, 0x1a87, 0xec0, 0x26ae, 0x229b, 0x1035, 0x1040, 0x4e, 0x1299, - 0x226b, 0x1409, 0xb7a, 0x1c75, 0x1043, 0x120, 0x1339, 0xbff, 0x147a, 0x2a60, 0x13ff, 0x3d1, - 0x2a16, 0x200a, 0x1467, 0x1c9d, 0x111c, 0x6b5, 0x6d, 0x5ae, 0x1e1a, 0x1497, 0x254a, 0x2a0a, - 0xdbc, 0x77d, 0xc71, 0xf58, 0x1333, 0x1956, 0x2fe1, 0x724, 0x131d, 0x2a3f, 0xb4b, 0x2cf2, - 0x281a, 0x1963, 0x1a94, 0x29da, 0x165f, 0xc28, 0x2908, 0x848, 0x1ff8, 0x2df0, 0x18dd, 0x1cd, - 0x40f, 0x22c, 0x871, 0x3d3, 0xbf5, 0x1303, 0x2da9, 0x25e1, 0x2259, 0xc0d, 0x7ba, 0x2a8, 0x1180, - 0x865, 0x542, 0x2fad, 0x31d, 0x2c2c, 0x2608, 0x23a5, 0x175e, 0x2d43, 0x2e27, 0x2dc4, 0x1018, - 0x28b9, 0x1a44, 0xbb3, 0x176d, 0x23ea, 0x146, 0xb43, 0x124d, 0x28a8, 0x1ff7, 0x2829, 0x1bf9, - 0x2832, 0x3c1, 0x1f94, 0x2d8e, 0x19e7, 0xd63, 0x1559, 0xd93, 0xaa3, 0x23e7, 0x73f, 0x2f42, 0x9e, - 0x2837, 0xea, 0x2405, 0x248e, 0x10e3, 0xd6d, 0x2ca1, 0xc8, 0xc04, 0x9aa, 0x2eba, 0x1ef7, 0x1be2, - 0x353, 0x2fe5, 0x1e40, 0xa2b, 0xd34, 0x27f, 0x2b6d, 0x251e, 0x1bdb, 0x2e04, 0x2393, 0x15f8, - 0x2924, 0xe15, 0x29a2, 0x2efc, 0x1c3d, 0x2262, 0x100b, 0x99a, 0x278f, 0x240e, 0x288c, 0x12c3, - 0x253, 0x2df4, 0x2725, 0x22a3, 0x78a, 0x20ba, 0xea6, 0x2147, 0xd30, 0x109a, 0x17b7, 0x2559, - 0x20b1, 0x18d3, 0x2809, 0xbda, 0x709, 0x26f9, 0x23df, 0x1e60, 0x28f9, 0x1deb, 0x2514, 0xb7f, - 0x957, 0x16d2, 0x47f, 0xfc, 0xfc6, 0x1136, 0xce8, 0x15d8, 0x47, 0x83a, 0x1619, 0x6b7, 0x2a73, - 0x1d, 0x1788, 0x160b, 0x6e6, 0x2445, 0x1646, 0xe38, 0x3d2, 0x14eb, 0x1729, 0xb89, 0x131c, - 0x13d9, 0x184c, 0x1275, 0x1fbb, 0x16ae, 0x2488, 0x297d, 0xc2d, 0x633, 0x2fe7, 0x2a9a, 0x1a96, - 0xe20, 0x92d, 0x1146, 0x956, 0x1400, 0x998, 0x1a95, 0x2fa1, 0x223d, 0x2a4d, 0x11e5, 0xfdc, - 0x198a, 0x2934, 0x1f9, 0x2553, - ]; - - return NHS; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.NHS = NHS; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/pair.js b/packages/bls-verify/src/vendor/amcl-js/src/pair.js deleted file mode 100644 index 057dbe517..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/pair.js +++ /dev/null @@ -1,1076 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var PAIR = function (ctx) { - 'use strict'; - - var PAIR = { - dbl: function (A, AA, BB, CC) { - CC.copy(A.getx()); - var YY = new ctx.FP2(A.gety()); - BB.copy(A.getz()); - AA.copy(YY); - - AA.mul(BB); //YZ - CC.sqr(); //X^2 - YY.sqr(); //Y^2 - BB.sqr(); //Z^2 - - AA.add(AA); - AA.neg(); - AA.norm(); //-2AA - AA.mul_ip(); - AA.norm(); - - var sb = 3 * ctx.ROM_CURVE.CURVE_B_I; - BB.imul(sb); - CC.imul(3); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - YY.mul_ip(); - YY.norm(); - CC.mul_ip(); - CC.norm(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - BB.mul_ip(); - BB.norm(); - } - BB.sub(YY); - BB.norm(); - - A.dbl(); - }, - - add: function (A, B, AA, BB, CC) { - AA.copy(A.getx()); // X1 - CC.copy(A.gety()); // Y1 - var T1 = new ctx.FP2(A.getz()); // Z1 - BB.copy(A.getz()); // Z1 - - T1.mul(B.gety()); // T1=Z1.Y2 - BB.mul(B.getx()); // T2=Z1.X2 - - AA.sub(BB); - AA.norm(); // X1=X1-Z1.X2 - CC.sub(T1); - CC.norm(); // Y1=Y1-Z1.Y2 - - T1.copy(AA); // T1=X1-Z1.X2 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - AA.mul_ip(); - AA.norm(); - } - - T1.mul(B.gety()); // T1=(X1-Z1.X2).Y2 - - BB.copy(CC); // T2=Y1-Z1.Y2 - BB.mul(B.getx()); // T2=(Y1-Z1.Y2).X2 - BB.sub(T1); - BB.norm(); // T2=(Y1-Z1.Y2).X2 - (X1-Z1.X2).Y2 - CC.neg(); - CC.norm(); // Y1=-(Y1-Z1.Y2).Xs - - A.add(B); - }, - - /* Line function */ - line: function (A, B, Qx, Qy) { - var r = new ctx.FP12(1); - - var a, b, c; - var AA = new ctx.FP2(0); - var BB = new ctx.FP2(0); - var CC = new ctx.FP2(0); - if (A == B) PAIR.dbl(A, AA, BB, CC); - else PAIR.add(A, B, AA, BB, CC); - - CC.pmul(Qx); - AA.pmul(Qy); - - a = new ctx.FP4(AA, BB); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP4(CC); // L(0,1) | L(0,0) | L(1,0) - c = new ctx.FP4(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP4(0); - c = new ctx.FP4(CC); - c.times_i(); - } - - r.set(a, b, c); - r.settype(ctx.FP.SPARSER); - - return r; - }, - - /* prepare for multi-pairing */ - initmp: function () { - var r = []; - for (var i = 0; i < ctx.ECP.ATE_BITS; i++) r[i] = new ctx.FP12(1); - return r; - }, - - /* basic Miller loop */ - miller: function (r) { - var res = new ctx.FP12(1); - for (var i = ctx.ECP.ATE_BITS - 1; i >= 1; i--) { - res.sqr(); - res.ssmul(r[i]); - r[i].zero(); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) res.conj(); - res.ssmul(r[0]); - r[0].zero(); - - return res; - }, - - // Store precomputed line details in an FP4 - pack: function (AA, BB, CC) { - var i = new ctx.FP2(CC); - i.inverse(null); - var a = new ctx.FP2(AA); - a.mul(i); - var b = new ctx.FP2(BB); - b.mul(i); - return new ctx.FP4(a, b); - }, - - unpack: function (T, Qx, Qy) { - var a, b, c; - a = new ctx.FP4(T); - a.geta().pmul(Qy); - var t = new ctx.FP2(Qx); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP4(t); - c = new ctx.FP4(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP4(0); - c = new ctx.FP4(t); - c.times_i(); - } - var v = new ctx.FP12(a, b, c); - v.settype(ctx.FP.SPARSEST); - return v; - }, - - precomp: function (GV) { - var f; - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR.lbits(n3, n); - var P = new ctx.ECP2(); - P.copy(GV); - var AA = new ctx.FP2(0); - var BB = new ctx.FP2(0); - var CC = new ctx.FP2(0); - var j, bt; - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - var A = new ctx.ECP2(); - A.copy(P); - var MP = new ctx.ECP2(); - MP.copy(P); - MP.neg(); - j = 0; - - var T = []; - for (var i = nb - 2; i >= 1; i--) { - PAIR.dbl(A, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - PAIR.add(A, P, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - } - if (bt == -1) { - PAIR.add(A, MP, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - } - } - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - } - var K = new ctx.ECP2(); - K.copy(P); - K.frob(f); - PAIR.add(A, K, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - K.frob(f); - K.neg(); - PAIR.add(A, K, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - } - return T; - }, - - /* Accumulate another set of line functions for n-pairing, assuming precomputation on G2 */ - another_pc(r, T, QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR.lbits(n3, n); - var lv, lv2; - var j, bt; - - if (QV.is_infinity()) return; - - var Q = new ctx.ECP(); - Q.copy(QV); - Q.affine(); - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - j = 0; - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR.unpack(T[j++], Qx, Qy); - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - lv = PAIR.unpack(T[j++], Qx, Qy); - lv2 = PAIR.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - r[0].ssmul(lv); - } - }, - - /* Accumulate another set of line functions for n-pairing */ - another: function (r, P1, Q1) { - var f; - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var K = new ctx.ECP2(); - var lv, lv2; - var bt; - - if (Q1.is_infinity()) return; - // P is needed in affine form for line function, Q for (Qx,Qy) extraction - var P = new ctx.ECP2(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - P.affine(); - Q.affine(); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - var A = new ctx.ECP2(); - A.copy(P); - - var MP = new ctx.ECP2(); - MP.copy(P); - MP.neg(); - - var nb = PAIR.lbits(n3, n); - - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR.line(A, A, Qx, Qy); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR.line(A, MP, Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - - /* R-ate fixup required for BN curves */ - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - } - K.copy(P); - K.frob(f); - lv = PAIR.line(A, K, Qx, Qy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(A, K, Qx, Qy); - lv.smul(lv2); - r[0].ssmul(lv); - } - }, - - /* Optimal R-ate pairing */ - ate: function (P1, Q1) { - var fa, fb, f, n, n3, K, lv, lv2, Qx, Qy, A, NP, r, nb, bt, i; - - if (Q1.is_infinity()) return new ctx.FP12(1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - K = new ctx.ECP2(); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - - var P = new ctx.ECP2(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - A = new ctx.ECP2(); - r = new ctx.FP12(1); - A.copy(P); - - NP = new ctx.ECP2(); - NP.copy(P); - NP.neg(); - - nb = PAIR.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR.line(A, A, Qx, Qy); - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv2 = PAIR.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR.line(A, NP, Qx, Qy); - lv.smul(lv2); - } - r.ssmul(lv); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - /* R-ate fixup */ - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - } - - K.copy(P); - K.frob(f); - - lv = PAIR.line(A, K, Qx, Qy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(A, K, Qx, Qy); - lv.smul(lv2); - r.ssmul(lv); - } - - return r; - }, - - /* Optimal R-ate double pairing e(P,Q).e(R,S) */ - - ate2: function (P1, Q1, R1, S1) { - var fa, fb, f, n, n3, K, lv, lv2, Qx, Qy, Sx, Sy, A, B, NP, NR, r, nb, bt, i; - - if (Q1.is_infinity()) return PAIR.ate(R1, S1); - if (S1.is_infinity()) return PAIR.ate(P1, Q1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - K = new ctx.ECP2(); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - - var P = new ctx.ECP2(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - var R = new ctx.ECP2(); - R.copy(R1); - R.affine(); - var S = new ctx.ECP(); - S.copy(S1); - S.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - Sx = new ctx.FP(S.getx()); - Sy = new ctx.FP(S.gety()); - - A = new ctx.ECP2(); - B = new ctx.ECP2(); - r = new ctx.FP12(1); - - A.copy(P); - B.copy(R); - - NP = new ctx.ECP2(); - NP.copy(P); - NP.neg(); - NR = new ctx.ECP2(); - NR.copy(R); - NR.neg(); - - nb = PAIR.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR.line(A, A, Qx, Qy); - lv2 = PAIR.line(B, B, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv = PAIR.line(A, P, Qx, Qy); - lv2 = PAIR.line(B, R, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - if (bt == -1) { - lv = PAIR.line(A, NP, Qx, Qy); - lv2 = PAIR.line(B, NR, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - // R-ate fixup required for BN curves - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - B.neg(); - } - K.copy(P); - K.frob(f); - - lv = PAIR.line(A, K, Qx, Qy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(A, K, Qx, Qy); - lv.smul(lv2); - r.ssmul(lv); - - K.copy(R); - K.frob(f); - - lv = PAIR.line(B, K, Sx, Sy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(B, K, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - - return r; - }, - - /* final exponentiation - keep separate for multi-pairings */ - fexp: function (m) { - var fa, fb, f, x, r, lv; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - r = new ctx.FP12(m); - - /* Easy part of final exp */ - lv = new ctx.FP12(r); - lv.inverse(); - r.conj(); - r.mul(lv); - lv.copy(r); - r.frob(f); - r.frob(f); - r.mul(lv); - - /* Hard part of final exp */ - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - var x0, x1, x2, x3, x4, x5; - - lv.copy(r); - lv.frob(f); - x0 = new ctx.FP12(lv); //x0.copy(lv); - x0.frob(f); - lv.mul(r); - x0.mul(lv); - x0.frob(f); - x1 = new ctx.FP12(r); //x1.copy(r); - x1.conj(); - - x4 = r.pow(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - x4.conj(); - } - - x3 = new ctx.FP12(x4); //x3.copy(x4); - x3.frob(f); - x2 = x4.pow(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - x2.conj(); - } - x5 = new ctx.FP12(x2); /*x5.copy(x2);*/ - x5.conj(); - lv = x2.pow(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - lv.conj(); - } - x2.frob(f); - r.copy(x2); - r.conj(); - - x4.mul(r); - x2.frob(f); - - r.copy(lv); - r.frob(f); - lv.mul(r); - - lv.usqr(); - lv.mul(x4); - lv.mul(x5); - r.copy(x3); - r.mul(x5); - r.mul(lv); - lv.mul(x2); - r.usqr(); - r.mul(lv); - r.usqr(); - lv.copy(r); - lv.mul(x1); - r.mul(x0); - lv.usqr(); - r.mul(lv); - r.reduce(); - } else { - // See https://eprint.iacr.org/2020/875.pdf - var t0, y0, y1; - y1 = new ctx.FP12(r); - y1.usqr(); - y1.mul(r); // y1=r^3 - - y0 = new ctx.FP12(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0 = new ctx.FP12(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - // ^(x+p) - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.frob(f); - r.copy(y0); - r.mul(t0); - - // ^(x^2+p^2-1) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f); - t0.frob(f); - y0.mul(t0); - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - r.mul(y1); - r.reduce(); - - /* - var y0, y1, y2, y3; - // Ghamman & Fouotsa Method - y0 = new ctx.FP12(r); - y0.usqr(); - y1 = y0.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y1.conj(); - } - x.fshr(1); - y2 = y1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y2.conj(); - } - x.fshl(1); - y3 = new ctx.FP12(r); - y3.conj(); - y1.mul(y3); - - y1.conj(); - y1.mul(y2); - - y2 = y1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y2.conj(); - } - - y3 = y2.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y3.conj(); - } - y1.conj(); - y3.mul(y1); - - y1.conj(); - y1.frob(f); - y1.frob(f); - y1.frob(f); - y2.frob(f); - y2.frob(f); - y1.mul(y2); - - y2 = y3.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y2.conj(); - } - y2.mul(y0); - y2.mul(r); - - y1.mul(y2); - y2.copy(y3); - y2.frob(f); - y1.mul(y2); - r.copy(y1); - r.reduce(); -*/ - } - - return r; - }, - }; - - /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */ - PAIR.lbits = function (n3, n) { - n.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - n.pmul(6); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - n.inc(2); - } else { - n.dec(2); - } - } - - n.norm(); - n3.copy(n); - n3.pmul(3); - n3.norm(); - return n3.nbits(); - }; - - /* GLV method */ - PAIR.glv = function (e) { - var u = [], - t, - q, - v, - d, - x, - x2, - i, - j; - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - t = new ctx.BIG(0); - q = new ctx.BIG(0); - v = []; - - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - for (i = 0; i < 2; i++) { - t.rcopy(ctx.ROM_CURVE.CURVE_W[i]); - d = ctx.BIG.mul(t, e); - v[i] = new ctx.BIG(d.div(q)); - u[i] = new ctx.BIG(0); - } - - u[0].copy(e); - - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - t.rcopy(ctx.ROM_CURVE.CURVE_SB[j][i]); - t.copy(ctx.BIG.modmul(v[j], t, q)); - u[i].add(q); - u[i].sub(t); - u[i].mod(q); - } - } - } else { - // -(x^2).P = (Beta.x,y) - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - x2 = ctx.BIG.smul(x, x); - u[0] = new ctx.BIG(e); - u[0].mod(x2); - u[1] = new ctx.BIG(e); - u[1].div(x2); - u[1].rsub(q); - } - - return u; - }; - - /* Galbraith & Scott Method */ - PAIR.gs = function (e) { - var u = [], - i, - j, - t, - q, - v, - d, - x, - w; - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - t = new ctx.BIG(0); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - v = []; - - for (i = 0; i < 4; i++) { - t.rcopy(ctx.ROM_CURVE.CURVE_WB[i]); - d = ctx.BIG.mul(t, e); - v[i] = new ctx.BIG(d.div(q)); - u[i] = new ctx.BIG(0); - } - - u[0].copy(e); - - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - t.rcopy(ctx.ROM_CURVE.CURVE_BB[j][i]); - t.copy(ctx.BIG.modmul(v[j], t, q)); - u[i].add(q); - u[i].sub(t); - u[i].mod(q); - } - } - } else { - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - w = new ctx.BIG(e); - - for (i = 0; i < 3; i++) { - u[i] = new ctx.BIG(w); - u[i].mod(x); - w.div(x); - } - - u[3] = new ctx.BIG(w); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - u[1].copy(ctx.BIG.modneg(u[1], q)); - u[3].copy(ctx.BIG.modneg(u[3], q)); - } - } - - return u; - }; - - /* Multiply P by e in group G1 */ - PAIR.G1mul = function (P, e) { - var R, Q, q, bcru, cru, t, u, np, nn; - - if (ctx.ROM_CURVE.USE_GLV) { - R = new ctx.ECP(); - R.copy(P); - Q = new ctx.ECP(); - Q.copy(P); - Q.affine(); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - bcru = new ctx.BIG(0); - bcru.rcopy(ctx.ROM_FIELD.CRu); - cru = new ctx.FP(bcru); - t = new ctx.BIG(0); - u = PAIR.glv(e); - - Q.getx().mul(cru); - - np = u[0].nbits(); - t.copy(ctx.BIG.modneg(u[0], q)); - nn = t.nbits(); - if (nn < np) { - u[0].copy(t); - R.neg(); - } - - np = u[1].nbits(); - t.copy(ctx.BIG.modneg(u[1], q)); - nn = t.nbits(); - if (nn < np) { - u[1].copy(t); - Q.neg(); - } - u[0].norm(); - u[1].norm(); - R = R.mul2(u[0], Q, u[1]); - } else { - R = P.mul(e); - } - - return R; - }; - - /* Multiply P by e in group G2 */ - PAIR.G2mul = function (P, e) { - var R, Q, fa, fb, f, q, u, t, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_G2) { - Q = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - u = PAIR.gs(e); - t = new ctx.BIG(0); - Q[0] = new ctx.ECP2(); - Q[0].copy(P); - - for (i = 1; i < 4; i++) { - Q[i] = new ctx.ECP2(); - Q[i].copy(Q[i - 1]); - Q[i].frob(f); - } - - for (i = 0; i < 4; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - Q[i].neg(); - } - u[i].norm(); - } - - R = ctx.ECP2.mul4(Q, u); - } else { - R = P.mul(e); - } - return R; - }; - - /* Note that this method requires a lot of RAM! Better to use compressed XTR method, see ctx.FP4.js */ - PAIR.GTpow = function (d, e) { - var r, g, fa, fb, f, q, t, u, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_GT) { - g = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - t = new ctx.BIG(0); - u = PAIR.gs(e); - - g[0] = new ctx.FP12(d); - - for (i = 1; i < 4; i++) { - g[i] = new ctx.FP12(0); - g[i].copy(g[i - 1]); - g[i].frob(f); - } - - for (i = 0; i < 4; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - g[i].conj(); - } - u[i].norm(); - } - - r = ctx.FP12.pow4(g, u); - } else { - r = d.pow(e); - } - - return r; - }; - - /* test G1 group membership */ - PAIR.G1member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR.G1mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test G2 group membership */ - PAIR.G2member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR.G2mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test group membership - no longer needed */ - /* Check that m!=1, conj(m)*m==1, and m.m^{p^4}=m^{p^2} */ - - PAIR.GTmember = function (m) { - if (m.isunity()) return false; - var r = new ctx.FP12(m); - r.conj(); - r.mul(m); - if (!r.isunity()) return false; - - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - var f = new ctx.FP2(fa, fb); - - r.copy(m); - r.frob(f); - r.frob(f); - var w = new ctx.FP12(r); - w.frob(f); - w.frob(f); - w.mul(m); - if (!w.equals(r)) return false; - - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - w.copy(m); - r.copy(PAIR.GTpow(w, q)); - if (!r.isunity()) return false; - return true; - }; - - return PAIR; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.PAIR = PAIR; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/pair4.js b/packages/bls-verify/src/vendor/amcl-js/src/pair4.js deleted file mode 100644 index 3eac108d0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/pair4.js +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var PAIR4 = function (ctx) { - 'use strict'; - var PAIR4 = { - dbl: function (A, AA, BB, CC) { - CC.copy(A.getx()); - var YY = new ctx.FP4(A.gety()); - BB.copy(A.getz()); - AA.copy(YY); - - AA.mul(BB); //YZ - CC.sqr(); //X^2 - YY.sqr(); //Y^2 - BB.sqr(); //Z^2 - - AA.add(AA); - AA.neg(); - AA.norm(); //-2AA - AA.times_i(); - - var sb = 3 * ctx.ROM_CURVE.CURVE_B_I; - BB.imul(sb); - CC.imul(3); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - YY.times_i(); - CC.times_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - BB.times_i(); - } - BB.sub(YY); - BB.norm(); - - A.dbl(); - }, - - add: function (A, B, AA, BB, CC) { - AA.copy(A.getx()); // X1 - CC.copy(A.gety()); // Y1 - var T1 = new ctx.FP4(A.getz()); // Z1 - BB.copy(A.getz()); // Z1 - - T1.mul(B.gety()); // T1=Z1.Y2 - BB.mul(B.getx()); // T2=Z1.X2 - - AA.sub(BB); - AA.norm(); // X1=X1-Z1.X2 - CC.sub(T1); - CC.norm(); // Y1=Y1-Z1.Y2 - - T1.copy(AA); // T1=X1-Z1.X2 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - AA.times_i(); - AA.norm(); - } - - T1.mul(B.gety()); // T1=(X1-Z1.X2).Y2 - - BB.copy(CC); // T2=Y1-Z1.Y2 - BB.mul(B.getx()); // T2=(Y1-Z1.Y2).X2 - BB.sub(T1); - BB.norm(); // T2=(Y1-Z1.Y2).X2 - (X1-Z1.X2).Y2 - CC.neg(); - CC.norm(); // Y1=-(Y1-Z1.Y2).Xs - - A.add(B); - }, - - /* Line function */ - line: function (A, B, Qx, Qy) { - var r = new ctx.FP24(1); - - var a, b, c; - var AA = new ctx.FP4(0); - var BB = new ctx.FP4(0); - var CC = new ctx.FP4(0); - if (A == B) PAIR4.dbl(A, AA, BB, CC); - else PAIR4.add(A, B, AA, BB, CC); - - CC.qmul(Qx); - AA.qmul(Qy); - - a = new ctx.FP8(AA, BB); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP8(CC); // L(0,1) | L(0,0) | L(1,0) - c = new ctx.FP8(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP8(0); - c = new ctx.FP8(CC); - c.times_i(); - } - - r.set(a, b, c); - r.settype(ctx.FP.SPARSER); - - return r; - }, - - /* prepare for multi-pairing */ - initmp: function () { - var r = []; - for (var i = 0; i < ctx.ECP.ATE_BITS; i++) r[i] = new ctx.FP24(1); - return r; - }, - - /* basic Miller loop */ - miller: function (r) { - var res = new ctx.FP24(1); - for (var i = ctx.ECP.ATE_BITS - 1; i >= 1; i--) { - res.sqr(); - res.ssmul(r[i]); - r[i].zero(); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) res.conj(); - res.ssmul(r[0]); - r[0].zero(); - - return res; - }, - - // Store precomputed line details in an FP8 - pack: function (AA, BB, CC) { - var i = new ctx.FP4(CC); - i.inverse(null); - var a = new ctx.FP4(AA); - a.mul(i); - var b = new ctx.FP4(BB); - b.mul(i); - return new ctx.FP8(a, b); - }, - - unpack: function (T, Qx, Qy) { - var a, b, c; - a = new ctx.FP8(T); - a.geta().qmul(Qy); - var t = new ctx.FP4(Qx); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP8(t); - c = new ctx.FP8(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP8(0); - c = new ctx.FP8(t); - c.times_i(); - } - var v = new ctx.FP24(a, b, c); - v.settype(ctx.FP.SPARSEST); - return v; - }, - - precomp: function (QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR4.lbits(n3, n); - var P = new ctx.ECP4(); - P.copy(QV); - var AA = new ctx.FP4(0); - var BB = new ctx.FP4(0); - var CC = new ctx.FP4(0); - var j, bt; - - var A = new ctx.ECP4(); - A.copy(P); - var MP = new ctx.ECP4(); - MP.copy(P); - MP.neg(); - j = 0; - - var T = []; - for (var i = nb - 2; i >= 1; i--) { - PAIR4.dbl(A, AA, BB, CC); - T[j++] = PAIR4.pack(AA, BB, CC); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - PAIR4.add(A, P, AA, BB, CC); - T[j++] = PAIR4.pack(AA, BB, CC); - } - if (bt == -1) { - PAIR4.add(A, MP, AA, BB, CC); - T[j++] = PAIR4.pack(AA, BB, CC); - } - } - return T; - }, - - /* Accumulate another set of line functions for n-pairing, assuming precomputation on G2 */ - another_pc(r, T, QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR4.lbits(n3, n); - var lv, lv2; - var j, bt; - - if (QV.is_infinity()) return; - - var Q = new ctx.ECP(); - Q.copy(QV); - Q.affine(); - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - j = 0; - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR4.unpack(T[j++], Qx, Qy); - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR4.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR4.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Accumulate another set of line functions for n-pairing */ - another: function (r, P1, Q1) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var lv, lv2; - var bt; - - if (Q1.is_infinity()) return; - // P is needed in affine form for line function, Q for (Qx,Qy) extraction - var P = new ctx.ECP4(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - P.affine(); - Q.affine(); - - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - var A = new ctx.ECP4(); - A.copy(P); - - var MP = new ctx.ECP4(); - MP.copy(P); - MP.neg(); - - var nb = PAIR4.lbits(n3, n); - - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR4.line(A, A, Qx, Qy); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR4.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR4.line(A, MP, Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Optimal R-ate pairing */ - ate: function (P1, Q1) { - var n, n3, lv, lv2, Qx, Qy, A, NP, r, nb, bt, i; - - if (Q1.is_infinity()) return new ctx.FP24(1); - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP4(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - A = new ctx.ECP4(); - r = new ctx.FP24(1); - - A.copy(P); - NP = new ctx.ECP4(); - NP.copy(P); - NP.neg(); - - nb = PAIR4.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR4.line(A, A, Qx, Qy); - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv2 = PAIR4.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR4.line(A, NP, Qx, Qy); - lv.smul(lv2); - } - r.ssmul(lv); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* Optimal R-ate double pairing e(P,Q).e(R,S) */ - ate2: function (P1, Q1, R1, S1) { - var n, n3, lv, lv2, Qx, Qy, Sx, Sy, A, B, NP, NR, r, nb, bt, i; - - if (Q1.is_infinity()) return PAIR4.ate(R1, S1); - if (S1.is_infinity()) return PAIR4.ate(P1, Q1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP4(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - var R = new ctx.ECP4(); - R.copy(R1); - R.affine(); - var S = new ctx.ECP(); - S.copy(S1); - S.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - Sx = new ctx.FP(S.getx()); - Sy = new ctx.FP(S.gety()); - - A = new ctx.ECP4(); - B = new ctx.ECP4(); - r = new ctx.FP24(1); - - A.copy(P); - B.copy(R); - NP = new ctx.ECP4(); - NP.copy(P); - NP.neg(); - NR = new ctx.ECP4(); - NR.copy(R); - NR.neg(); - - nb = PAIR4.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR4.line(A, A, Qx, Qy); - lv2 = PAIR4.line(B, B, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv = PAIR4.line(A, P, Qx, Qy); - lv2 = PAIR4.line(B, R, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - if (bt == -1) { - lv = PAIR4.line(A, NP, Qx, Qy); - lv2 = PAIR4.line(B, NR, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */ - fexp: function (m) { - var fa, fb, f, x, r, lv; - // t0,t1,t2,t3,t4,t5,t6,t7; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - r = new ctx.FP24(m); //r.copy(m); - - /* Easy part of final exp */ - lv = new ctx.FP24(r); //lv.copy(r); - lv.inverse(); - r.conj(); - r.mul(lv); - lv.copy(r); - r.frob(f, 4); - r.mul(lv); - - /* Hard part of final exp */ - // See https://eprint.iacr.org/2020/875.pdf - var t0, y0, y1; - y1 = new ctx.FP24(r); - y1.usqr(); - y1.mul(r); // y1=r^3 - - y0 = new ctx.FP24(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0 = new ctx.FP24(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - // ^(x+p) - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.frob(f, 1); - r.copy(y0); - r.mul(t0); - - // ^(x^2+p^2) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 2); - r.copy(y0); - r.mul(t0); - - // ^(x^4+p^4-1) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 4); - y0.mul(t0); - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - r.mul(y1); - r.reduce(); - - /* - // Ghamman & Fouotsa Method - t7=new ctx.FP24(r); t7.usqr(); - t1=t7.pow(x); - - x.fshr(1); - t2=t1.pow(x); - x.fshl(1); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - t3=new ctx.FP24(t1); t3.conj(); - t2.mul(t3); - t2.mul(r); - - t3=t2.pow(x); - t4=t3.pow(x); - t5=t4.pow(x); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t3.conj(); t5.conj(); - } - - t3.frob(f,6); t4.frob(f,5); - t3.mul(t4); - - t6=t5.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t6.conj(); - } - - t5.frob(f,4); - t3.mul(t5); - - t0=new ctx.FP24(t2); t0.conj(); - t6.mul(t0); - - t5.copy(t6); - t5.frob(f,3); - - t3.mul(t5); - t5=t6.pow(x); - t6=t5.pow(x); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t5.conj(); - } - - t0.copy(t5); - t0.frob(f,2); - t3.mul(t0); - t0.copy(t6); - t0.frob(f,1); - - t3.mul(t0); - t5=t6.pow(x); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t5.conj(); - } - t2.frob(f,7); - - t5.mul(t7); - t3.mul(t2); - t3.mul(t5); - - r.mul(t3); - - r.reduce(); -*/ - return r; - }, - }; - - /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */ - PAIR4.lbits = function (n3, n) { - n.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - n3.copy(n); - n3.pmul(3); - n3.norm(); - return n3.nbits(); - }; - - /* GLV method */ - PAIR4.glv = function (e) { - var u = [], - q, - x, - x2; - - // -(x^2).P = (Beta.x,y) - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - x2 = ctx.BIG.smul(x, x); - x = ctx.BIG.smul(x2, x2); - u[0] = new ctx.BIG(e); - u[0].mod(x); - u[1] = new ctx.BIG(e); - u[1].div(x); - u[1].rsub(q); - - return u; - }; - - /* Galbraith & Scott Method */ - PAIR4.gs = function (e) { - var u = [], - i, - q, - x, - w; - - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - w = new ctx.BIG(e); - - for (i = 0; i < 7; i++) { - u[i] = new ctx.BIG(w); - u[i].mod(x); - w.div(x); - } - - u[7] = new ctx.BIG(w); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - u[1].copy(ctx.BIG.modneg(u[1], q)); - u[3].copy(ctx.BIG.modneg(u[3], q)); - u[5].copy(ctx.BIG.modneg(u[5], q)); - u[7].copy(ctx.BIG.modneg(u[7], q)); - } - - return u; - }; - - /* Multiply P by e in group G1 */ - PAIR4.G1mul = function (P, e) { - var R, Q, q, bcru, cru, t, u, np, nn; - - if (ctx.ROM_CURVE.USE_GLV) { - R = new ctx.ECP(); - R.copy(P); - Q = new ctx.ECP(); - Q.copy(P); - Q.affine(); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - bcru = new ctx.BIG(0); - bcru.rcopy(ctx.ROM_FIELD.CRu); - cru = new ctx.FP(bcru); - t = new ctx.BIG(0); - u = PAIR4.glv(e); - - Q.getx().mul(cru); - - np = u[0].nbits(); - t.copy(ctx.BIG.modneg(u[0], q)); - nn = t.nbits(); - if (nn < np) { - u[0].copy(t); - R.neg(); - } - - np = u[1].nbits(); - t.copy(ctx.BIG.modneg(u[1], q)); - nn = t.nbits(); - if (nn < np) { - u[1].copy(t); - Q.neg(); - } - u[0].norm(); - u[1].norm(); - R = R.mul2(u[0], Q, u[1]); - } else { - R = P.mul(e); - } - - return R; - }; - - /* Multiply P by e in group G2 */ - PAIR4.G2mul = function (P, e) { - var R, Q, F, q, u, t, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_G2) { - Q = []; - F = ctx.ECP4.frob_constants(); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - u = PAIR4.gs(e); - t = new ctx.BIG(0); - - Q[0] = new ctx.ECP4(); - Q[0].copy(P); - - for (i = 1; i < 8; i++) { - Q[i] = new ctx.ECP4(); - Q[i].copy(Q[i - 1]); - Q[i].frob(F, 1); - } - - for (i = 0; i < 8; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - Q[i].neg(); - } - u[i].norm(); - } - - R = ctx.ECP4.mul8(Q, u); - } else { - R = P.mul(e); - } - return R; - }; - - /* Note that this method requires a lot of RAM */ - PAIR4.GTpow = function (d, e) { - var r, g, fa, fb, f, q, t, u, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_GT) { - g = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - t = new ctx.BIG(0); - u = PAIR4.gs(e); - - g[0] = new ctx.FP24(d); - - for (i = 1; i < 8; i++) { - g[i] = new ctx.FP24(0); - g[i].copy(g[i - 1]); - g[i].frob(f, 1); - } - - for (i = 0; i < 8; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - g[i].conj(); - } - u[i].norm(); - } - - r = ctx.FP24.pow8(g, u); - } else { - r = d.pow(e); - } - - return r; - }; - - /* test G1 group membership */ - PAIR4.G1member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR4.G1mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test G2 group membership */ - PAIR4.G2member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR4.G2mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test group membership - no longer needed */ - /* Check that m!=1, conj(m)*m==1, and m.m^{p^8}=m^{p^4} */ - - PAIR4.GTmember = function (m) { - if (m.isunity()) return false; - var r = new ctx.FP24(m); - r.conj(); - r.mul(m); - if (!r.isunity()) return false; - - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - var f = new ctx.FP2(fa, fb); - - r.copy(m); - r.frob(f, 4); - var w = new ctx.FP24(r); - w.frob(f, 4); - w.mul(m); - if (!w.equals(r)) return false; - - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - w.copy(m); - r.copy(PAIR4.GTpow(w, q)); - if (!r.isunity()) return false; - return true; - }; - - return PAIR4; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.PAIR4 = PAIR4; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/pair8.js b/packages/bls-verify/src/vendor/amcl-js/src/pair8.js deleted file mode 100644 index d23f941e3..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/pair8.js +++ /dev/null @@ -1,918 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var PAIR8 = function (ctx) { - 'use strict'; - - var PAIR8 = { - dbl: function (A, AA, BB, CC) { - CC.copy(A.getx()); - var YY = new ctx.FP8(A.gety()); - BB.copy(A.getz()); - AA.copy(YY); - - AA.mul(BB); //YZ - CC.sqr(); //X^2 - YY.sqr(); //Y^2 - BB.sqr(); //Z^2 - - AA.add(AA); - AA.neg(); - AA.norm(); //-2AA - AA.times_i(); - - var sb = 3 * ctx.ROM_CURVE.CURVE_B_I; - BB.imul(sb); - CC.imul(3); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - YY.times_i(); - CC.times_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - BB.times_i(); - } - BB.sub(YY); - BB.norm(); - - A.dbl(); - }, - - add: function (A, B, AA, BB, CC) { - AA.copy(A.getx()); // X1 - CC.copy(A.gety()); // Y1 - var T1 = new ctx.FP8(A.getz()); // Z1 - BB.copy(A.getz()); // Z1 - - T1.mul(B.gety()); // T1=Z1.Y2 - BB.mul(B.getx()); // T2=Z1.X2 - - AA.sub(BB); - AA.norm(); // X1=X1-Z1.X2 - CC.sub(T1); - CC.norm(); // Y1=Y1-Z1.Y2 - - T1.copy(AA); // T1=X1-Z1.X2 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - AA.times_i(); - AA.norm(); - } - - T1.mul(B.gety()); // T1=(X1-Z1.X2).Y2 - - BB.copy(CC); // T2=Y1-Z1.Y2 - BB.mul(B.getx()); // T2=(Y1-Z1.Y2).X2 - BB.sub(T1); - BB.norm(); // T2=(Y1-Z1.Y2).X2 - (X1-Z1.X2).Y2 - CC.neg(); - CC.norm(); // Y1=-(Y1-Z1.Y2).Xs - - A.add(B); - }, - - /* Line function */ - line: function (A, B, Qx, Qy) { - var r = new ctx.FP48(1); - - var a, b, c; - var AA = new ctx.FP8(0); - var BB = new ctx.FP8(0); - var CC = new ctx.FP8(0); - if (A == B) PAIR8.dbl(A, AA, BB, CC); - else PAIR8.add(A, B, AA, BB, CC); - - CC.tmul(Qx); - AA.tmul(Qy); - - a = new ctx.FP16(AA, BB); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP16(CC); // L(0,1) | L(0,0) | L(1,0) - c = new ctx.FP16(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP16(0); - c = new ctx.FP16(CC); - c.times_i(); - } - - r.set(a, b, c); - r.settype(ctx.FP.SPARSER); - - return r; - }, - - /* prepare for multi-pairing */ - initmp: function () { - var r = []; - for (var i = 0; i < ctx.ECP.ATE_BITS; i++) r[i] = new ctx.FP48(1); - return r; - }, - - /* basic Miller loop */ - miller: function (r) { - var res = new ctx.FP48(1); - for (var i = ctx.ECP.ATE_BITS - 1; i >= 1; i--) { - res.sqr(); - res.ssmul(r[i]); - r[i].zero(); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) res.conj(); - res.ssmul(r[0]); - r[0].zero(); - - return res; - }, - - // Store precomputed line details in an FP8 - pack: function (AA, BB, CC) { - var i = new ctx.FP8(CC); - i.inverse(null); - var a = new ctx.FP8(AA); - a.mul(i); - var b = new ctx.FP8(BB); - b.mul(i); - return new ctx.FP16(a, b); - }, - - unpack: function (T, Qx, Qy) { - var a, b, c; - a = new ctx.FP16(T); - a.geta().tmul(Qy); - var t = new ctx.FP8(Qx); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP16(t); - c = new ctx.FP16(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP16(0); - c = new ctx.FP16(t); - c.times_i(); - } - var v = new ctx.FP48(a, b, c); - v.settype(ctx.FP.SPARSEST); - return v; - }, - - precomp: function (QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR8.lbits(n3, n); - var P = new ctx.ECP8(); - P.copy(QV); - var AA = new ctx.FP8(0); - var BB = new ctx.FP8(0); - var CC = new ctx.FP8(0); - var j, bt; - - var A = new ctx.ECP8(); - A.copy(P); - var MP = new ctx.ECP8(); - MP.copy(P); - MP.neg(); - j = 0; - - var T = []; - for (var i = nb - 2; i >= 1; i--) { - PAIR8.dbl(A, AA, BB, CC); - T[j++] = PAIR8.pack(AA, BB, CC); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - PAIR8.add(A, P, AA, BB, CC); - T[j++] = PAIR8.pack(AA, BB, CC); - } - if (bt == -1) { - PAIR8.add(A, MP, AA, BB, CC); - T[j++] = PAIR8.pack(AA, BB, CC); - } - } - return T; - }, - - /* Accumulate another set of line functions for n-pairing, assuming precomputation on G2 */ - another_pc(r, T, QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR8.lbits(n3, n); - var lv, lv2; - var j, bt; - - if (QV.is_infinity()) return; - - var Q = new ctx.ECP(); - Q.copy(QV); - Q.affine(); - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - j = 0; - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR8.unpack(T[j++], Qx, Qy); - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR8.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR8.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Accumulate another set of line functions for n-pairing */ - another: function (r, P1, Q1) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var lv, lv2; - var bt; - - if (Q1.is_infinity()) return; - // P is needed in affine form for line function, Q for (Qx,Qy) extraction - var P = new ctx.ECP8(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - P.affine(); - Q.affine(); - - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - var A = new ctx.ECP8(); - A.copy(P); - - var MP = new ctx.ECP8(); - MP.copy(P); - MP.neg(); - - var nb = PAIR8.lbits(n3, n); - - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR8.line(A, A, Qx, Qy); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR8.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR8.line(A, MP, Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Optimal R-ate pairing */ - ate: function (P1, Q1) { - var n, n3, lv, lv2, Qx, Qy, A, NP, r, nb, bt, i; - - if (Q1.is_infinity()) return new ctx.FP48(1); - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP8(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - A = new ctx.ECP8(); - r = new ctx.FP48(1); - - A.copy(P); - NP = new ctx.ECP8(); - NP.copy(P); - NP.neg(); - - nb = PAIR8.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR8.line(A, A, Qx, Qy); - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv2 = PAIR8.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR8.line(A, NP, Qx, Qy); - lv.smul(lv2); - } - r.ssmul(lv); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* Optimal R-ate double pairing e(P,Q).e(R,S) */ - ate2: function (P1, Q1, R1, S1) { - var n, n3, lv, lv2, Qx, Qy, Sx, Sy, A, B, NP, NR, r, nb, bt, i; - - if (Q1.is_infinity()) return PAIR8.ate(R1, S1); - if (S1.is_infinity()) return PAIR8.ate(P1, Q1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP8(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - var R = new ctx.ECP8(); - R.copy(R1); - R.affine(); - var S = new ctx.ECP(); - S.copy(S1); - S.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - Sx = new ctx.FP(S.getx()); - Sy = new ctx.FP(S.gety()); - - A = new ctx.ECP8(); - B = new ctx.ECP8(); - r = new ctx.FP48(1); - - A.copy(P); - B.copy(R); - NP = new ctx.ECP8(); - NP.copy(P); - NP.neg(); - NR = new ctx.ECP8(); - NR.copy(R); - NR.neg(); - - nb = PAIR8.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR8.line(A, A, Qx, Qy); - lv2 = PAIR8.line(B, B, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv = PAIR8.line(A, P, Qx, Qy); - lv2 = PAIR8.line(B, R, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - if (bt == -1) { - lv = PAIR8.line(A, NP, Qx, Qy); - lv2 = PAIR8.line(B, NR, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */ - fexp: function (m) { - var fa, fb, f, x, r, lv; - // t1,t2,t3,t7; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - r = new ctx.FP48(m); //r.copy(m); - - /* Easy part of final exp */ - lv = new ctx.FP48(r); //lv.copy(r); - lv.inverse(); - r.conj(); - r.mul(lv); - lv.copy(r); - r.frob(f, 8); - r.mul(lv); - - /* Hard part of final exp */ - - // See https://eprint.iacr.org/2020/875.pdf - var t0, y0, y1; - y1 = new ctx.FP48(r); - y1.usqr(); - y1.mul(r); // y1=r^3 - - y0 = new ctx.FP48(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0 = new ctx.FP48(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - // ^(x+p) - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.frob(f, 1); - r.copy(y0); - r.mul(t0); - - // ^(x^2+p^2) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 2); - r.copy(y0); - r.mul(t0); - - // ^(x^4+p^4) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 4); - r.copy(y0); - r.mul(t0); - - // ^(x^8+p^8-1) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 8); - y0.mul(t0); - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - r.mul(y1); - r.reduce(); - - /* - // Ghamman & Fouotsa Method - t7=new ctx.FP48(r); t7.usqr(); - - if (x.parity()==1) - { - t2=r.pow(x); - t1=new ctx.FP48(t2); t1.usqr(); - t2=t2.pow(x); - } else { - t1=t7.pow(x); - x.fshr(1); - t2=t1.pow(x); - x.fshl(1); - } - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3=new ctx.FP48(t1); t3.conj(); - t2.mul(t3); - t2.mul(r); - - r.mul(t7); - - t1=t2.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - t3.copy(t1); - t3.frob(f,14); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,13); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,12); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,11); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,10); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,9); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,8); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t2); t3.conj(); - t1.mul(t3); - t3.copy(t1); - t3.frob(f,7); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,6); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,5); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,4); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,3); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,2); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,1); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - r.mul(t1); - t2.frob(f,15); - r.mul(t2); - - r.reduce(); -*/ - return r; - }, - }; - - /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */ - PAIR8.lbits = function (n3, n) { - n.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - n3.copy(n); - n3.pmul(3); - n3.norm(); - return n3.nbits(); - }; - - /* GLV method */ - PAIR8.glv = function (e) { - var u = [], - q, - x, - x2; - - // -(x^2).P = (Beta.x,y) - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - x2 = ctx.BIG.smul(x, x); - x = ctx.BIG.smul(x2, x2); - x2 = ctx.BIG.smul(x, x); - u[0] = new ctx.BIG(e); - u[0].mod(x2); - u[1] = new ctx.BIG(e); - u[1].div(x2); - u[1].rsub(q); - - return u; - }; - - /* Galbraith & Scott Method */ - PAIR8.gs = function (e) { - var u = [], - i, - q, - x, - w; - - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - w = new ctx.BIG(e); - - for (i = 0; i < 15; i++) { - u[i] = new ctx.BIG(w); - u[i].mod(x); - w.div(x); - } - - u[15] = new ctx.BIG(w); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - u[1].copy(ctx.BIG.modneg(u[1], q)); - u[3].copy(ctx.BIG.modneg(u[3], q)); - u[5].copy(ctx.BIG.modneg(u[5], q)); - u[7].copy(ctx.BIG.modneg(u[7], q)); - u[9].copy(ctx.BIG.modneg(u[9], q)); - u[11].copy(ctx.BIG.modneg(u[11], q)); - u[13].copy(ctx.BIG.modneg(u[13], q)); - u[15].copy(ctx.BIG.modneg(u[15], q)); - } - - return u; - }; - - /* Multiply P by e in group G1 */ - PAIR8.G1mul = function (P, e) { - var R, Q, q, bcru, cru, t, u, np, nn; - - if (ctx.ROM_CURVE.USE_GLV) { - R = new ctx.ECP(); - R.copy(P); - Q = new ctx.ECP(); - Q.copy(P); - Q.affine(); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - bcru = new ctx.BIG(0); - bcru.rcopy(ctx.ROM_FIELD.CRu); - cru = new ctx.FP(bcru); - t = new ctx.BIG(0); - u = PAIR8.glv(e); - - Q.getx().mul(cru); - - np = u[0].nbits(); - t.copy(ctx.BIG.modneg(u[0], q)); - nn = t.nbits(); - if (nn < np) { - u[0].copy(t); - R.neg(); - } - - np = u[1].nbits(); - t.copy(ctx.BIG.modneg(u[1], q)); - nn = t.nbits(); - if (nn < np) { - u[1].copy(t); - Q.neg(); - } - u[0].norm(); - u[1].norm(); - R = R.mul2(u[0], Q, u[1]); - } else { - R = P.mul(e); - } - - return R; - }; - - /* Multiply P by e in group G2 */ - PAIR8.G2mul = function (P, e) { - var R, Q, F, q, u, t, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_G2) { - Q = []; - F = ctx.ECP8.frob_constants(); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - u = PAIR8.gs(e); - t = new ctx.BIG(0); - - Q[0] = new ctx.ECP8(); - Q[0].copy(P); - - for (i = 1; i < 16; i++) { - Q[i] = new ctx.ECP8(); - Q[i].copy(Q[i - 1]); - Q[i].frob(F, 1); - } - - for (i = 0; i < 16; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - Q[i].neg(); - } - u[i].norm(); - } - - R = ctx.ECP8.mul16(Q, u); - } else { - R = P.mul(e); - } - return R; - }; - - /* Note that this method requires a lot of RAM! */ - PAIR8.GTpow = function (d, e) { - var r, g, fa, fb, f, q, t, u, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_GT) { - g = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - t = new ctx.BIG(0); - u = PAIR8.gs(e); - - g[0] = new ctx.FP48(d); - - for (i = 1; i < 16; i++) { - g[i] = new ctx.FP48(0); - g[i].copy(g[i - 1]); - g[i].frob(f, 1); - } - - for (i = 0; i < 16; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - g[i].conj(); - } - u[i].norm(); - } - - r = ctx.FP48.pow16(g, u); - } else { - r = d.pow(e); - } - - return r; - }; - - /* test G1 group membership */ - PAIR8.G1member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR8.G1mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test G2 group membership */ - PAIR8.G2member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR8.G2mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test group membership - no longer needed */ - /* Check that m!=1, conj(m)*m==1, and m.m^{p^16}=m^{p^8} */ - - PAIR8.GTmember = function (m) { - if (m.isunity()) return false; - var r = new ctx.FP48(m); - r.conj(); - r.mul(m); - if (!r.isunity()) return false; - - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - var f = new ctx.FP2(fa, fb); - - r.copy(m); - r.frob(f, 8); - var w = new ctx.FP48(r); - w.frob(f, 8); - w.mul(m); - if (!w.equals(r)) return false; - - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - w.copy(m); - r.copy(PAIR8.GTpow(w, q)); - if (!r.isunity()) return false; - return true; - }; - - return PAIR8; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.PAIR8 = PAIR8; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rand.js b/packages/bls-verify/src/vendor/amcl-js/src/rand.js deleted file mode 100644 index 5f2932fc7..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rand.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Cryptographic strong random number generator - * - * Unguessable seed -> SHA -> PRNG internal state -> SHA -> random numbers - * Slow - but secure - * - * See ftp://ftp.rsasecurity.com/pub/pdfs/bull-1.pdf for a justification - */ - -/* Marsaglia & Zaman Random number generator constants */ - -var RAND = function (ctx) { - 'use strict'; - - var RAND = function () { - /* Cryptographically strong pseudo-random number generator */ - this.ira = []; /* random number... */ - this.rndptr = 0; /* ...array & pointer */ - this.borrow = 0; - this.pool_ptr = 0; - this.pool = []; /* random pool */ - this.clean(); - }; - - RAND.prototype = { - NK: 21, - NJ: 6, - NV: 8, - - /* Terminate and clean up */ - clean: function () { - var i; - - for (i = 0; i < 32; i++) { - this.pool[i] = 0; - } - - for (i = 0; i < this.NK; i++) { - this.ira[i] = 0; - } - - this.rndptr = 0; - this.borrow = 0; - this.pool_ptr = 0; - }, - - sbrand: function () { - /* Marsaglia & Zaman random number generator */ - var i, k, pdiff, t; - - this.rndptr++; - if (this.rndptr < this.NK) { - return this.ira[this.rndptr]; - } - - this.rndptr = 0; - - for (i = 0, k = this.NK - this.NJ; i < this.NK; i++, k++) { - /* calculate next NK values */ - if (k == this.NK) { - k = 0; - } - - t = this.ira[k] >>> 0; - pdiff = (t - this.ira[i] - this.borrow) | 0; - pdiff >>>= 0; /* This is seriously weird shit. I got to do this to get a proper unsigned comparison... */ - - if (pdiff < t) { - this.borrow = 0; - } - - if (pdiff > t) { - this.borrow = 1; - } - - this.ira[i] = pdiff | 0; - } - - return this.ira[0]; - }, - - sirand: function (seed) { - var m = 1, - i, - inn, - t; - - this.borrow = 0; - this.rndptr = 0; - seed >>>= 0; - this.ira[0] ^= seed; - - for (i = 1; i < this.NK; i++) { - /* fill initialisation vector */ - inn = (this.NV * i) % this.NK; - this.ira[inn] ^= m; /* note XOR */ - t = m; - m = (seed - m) | 0; - seed = t; - } - - /* "warm-up" & stir the generator */ - for (i = 0; i < 10000; i++) { - this.sbrand(); - } - }, - - fill_pool: function () { - var sh = new ctx.HASH256(), - i; - - for (i = 0; i < 128; i++) { - sh.process(this.sbrand()); - } - - this.pool = sh.hash(); - this.pool_ptr = 0; - }, - - /* Initialize RNG with some real entropy from some external source */ - seed: function (rawlen, raw) { - /* initialise from at least 128 byte string of raw random entropy */ - var sh = new ctx.HASH256(), - digest = [], - b = [], - i; - - this.pool_ptr = 0; - - for (i = 0; i < this.NK; i++) { - this.ira[i] = 0; - } - - if (rawlen > 0) { - for (i = 0; i < rawlen; i++) { - sh.process(raw[i]); - } - - digest = sh.hash(); - - /* initialise PRNG from distilled randomness */ - for (i = 0; i < 8; i++) { - b[0] = digest[4 * i]; - b[1] = digest[4 * i + 1]; - b[2] = digest[4 * i + 2]; - b[3] = digest[4 * i + 3]; - this.sirand(RAND.pack(b)); - } - } - - this.fill_pool(); - }, - - /* get random byte */ - getByte: function () { - var r = this.pool[this.pool_ptr++]; - - if (this.pool_ptr >= 32) { - this.fill_pool(); - } - - return r & 0xff; - }, - }; - - RAND.pack = function (b) { - /* pack 4 bytes into a 32-bit Word */ - return ((b[3] & 0xff) << 24) | ((b[2] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[0] & 0xff); - }; - - return RAND; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - RAND: RAND, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js b/packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js deleted file mode 100644 index dd62b296c..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js +++ /dev/null @@ -1,2705 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Fixed Data in ROM - Field and Curve parameters */ - -var ROM_CURVE_ANSSI, - ROM_CURVE_BLS12383, - ROM_CURVE_BLS24479, - ROM_CURVE_BLS48556, - ROM_CURVE_BLS48286, - ROM_CURVE_BLS48581, - ROM_CURVE_BLS12381, - ROM_CURVE_BLS12461, - ROM_CURVE_BN462, - ROM_CURVE_FP256BN, - ROM_CURVE_FP512BN, - ROM_CURVE_BN254, - ROM_CURVE_BN254CX, - ROM_CURVE_BRAINPOOL, - ROM_CURVE_C25519, - ROM_CURVE_C41417, - ROM_CURVE_C1174, - ROM_CURVE_C1665, - ROM_CURVE_MDC, - ROM_CURVE_ED25519, - ROM_CURVE_GOLDILOCKS, - ROM_CURVE_X448, - ROM_CURVE_HIFIVE, - ROM_CURVE_NIST256, - ROM_CURVE_NIST384, - ROM_CURVE_NIST521, - ROM_CURVE_NUMS256E, - ROM_CURVE_NUMS256W, - ROM_CURVE_NUMS384E, - ROM_CURVE_NUMS384W, - ROM_CURVE_NUMS512E, - ROM_CURVE_NUMS512W, - ROM_CURVE_SECP256K1, - ROM_CURVE_SECP160R1, - ROM_CURVE_SM2, - ROM_CURVE_C13318, - ROM_CURVE_JUBJUB, - ROM_CURVE_TWEEDLEDUM, - ROM_CURVE_TWEEDLEDEE; - -ROM_CURVE_ANSSI = function () { - var ROM_CURVE_ANSSI = { - // ANSSI curve - - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0x7bb73f, 0xed967b, 0x803075, 0xe4b1a1, 0xec0c9a, 0xc00fdf, 0x754a44, 0xd4aba, 0x28a930, - 0x3fca54, 0xee35, - ], - CURVE_Order: [ - 0xd655e1, 0xd459c6, 0x941ffd, 0x40d2bf, 0xdc67e1, 0x435b53, 0xe8ce42, 0x10126d, 0x3ad58f, - 0x178c0b, 0xf1fd, - ], - CURVE_Gx: [ - 0x8f5cff, 0x7a2dd9, 0x164c9, 0xaf98b7, 0x27d2dc, 0x23958c, 0x4749d4, 0x31183d, 0xc139eb, - 0xd4c356, 0xb6b3, - ], - CURVE_Gy: [ - 0x62cfb, 0x5a1554, 0xe18311, 0xe8e4c9, 0x1c307, 0xef8c27, 0xf0f3ec, 0x1f9271, 0xb20491, - 0xe0f7c8, 0x6142, - ], - CURVE_HTPC: [ - 0xa725d0, 0x983e21, 0x349ea8, 0xbb477b, 0x4c66d2, 0x5676b5, 0x119a09, 0xac6dc7, 0x18a3ac, - 0x6d4dfd, 0x7290, - ], - }; - return ROM_CURVE_ANSSI; -}; - -ROM_CURVE_BLS12383 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS12383 = { - // BLS12383 Curve - // Base Bits= 23 - - CURVE_Cof_I: 0, - CURVE_B_I: 15, - CURVE_B: [0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x3c0001, 0x33d7fd, 0x5cec82, 0x9069c, 0x5f095a, 0x703bc0, 0x5a62c, 0x2200e4, 0x3809c0, - 0x1801, 0x8006, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x734573, 0x6e7210, 0x11e311, 0x1fa3b8, 0x5dbf08, 0x688b8a, 0x12bc78, 0x43dd6c, 0x742c2f, - 0x6d6103, 0x4c767d, 0x6d8287, 0x74052d, 0x1c706b, 0x5e7b39, 0x5d2adc, 0x41fc, - ], - CURVE_Gy: [ - 0x3f224, 0x2cbd00, 0x7484b4, 0x43fcc7, 0x7d49ec, 0x25bbca, 0x2b7ad3, 0x29854a, 0x449107, - 0xcd76c, 0x7436b7, 0x6236cc, 0x1cdc31, 0x495d, 0x33ecc0, 0xb393a, 0x68f, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x1200, 0x2, 0x40020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x11ff, 0x2, 0x40020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x169EAB, 0x2AC2AA, 0x7ED541, 0x555DF, 0x2AAC00, 0xAAB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0x7f2d86, 0x676c5a, 0x7850f2, 0x4ae8e9, 0x7dab67, 0x65dd03, 0x3d5895, 0x3f8e48, 0x725bd4, - 0x10a5aa, 0xc9407, 0xf3a32, 0x967cb, 0x180f32, 0x7b00fa, 0x691203, 0x634, - ], - CURVE_Pxb: [ - 0x52de15, 0x483d88, 0x37bf67, 0x2bff30, 0x4ab28d, 0x3aeb6a, 0x23a4b5, 0x6cc5d4, 0x4c89df, - 0x5b3a0b, 0x13d263, 0x1b0ee9, 0x717288, 0x5e6f4e, 0x592e, 0x3c0030, 0x300d, - ], - CURVE_Pya: [ - 0x8cb41, 0x617728, 0x5971a3, 0x106b0c, 0x1ede4f, 0x5ceb69, 0x2a44e8, 0x4bc1d6, 0x1b3e68, - 0x2ce793, 0x3a643b, 0x31a3db, 0x573fe, 0x79293b, 0x4894d1, 0x167c9e, 0x3379, - ], - CURVE_Pyb: [ - 0x479093, 0xc86fe, 0x18eb61, 0x731124, 0x43cb0d, 0x131602, 0x127def, 0x78597a, 0x7a8f7a, - 0x8d67d, 0x73835, 0x53d700, 0x3a7d15, 0x649dcf, 0x33631a, 0x123ee9, 0x20e5, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: true, - - //debug: false, - }; - - return ROM_CURVE_BLS12383; -}; - -ROM_CURVE_BLS24479 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS24479 = { - // BLS24479 Curve - // Base Bits= 23 - CURVE_Cof_I: 0, - CURVE_B_I: 19, - CURVE_B: [ - 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x1, 0x11ffe0, 0x464068, 0x1ffaa8, 0x71e703, 0x645bb5, 0x379fb8, 0x689d35, 0x49d0ce, 0x49091f, - 0x4a7308, 0x286c0b, 0x3b44a0, 0x60b731, 0x6807c3, 0x8002, 0x10010, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x63ccd4, 0x41ebd7, 0x15919d, 0x576cfa, 0x1efe2d, 0x743f98, 0xfc23a, 0x409a3c, 0x595af8, - 0x6f8df1, 0x38b611, 0x65468d, 0x7e4bfd, 0x6b0d9d, 0x7641d, 0x2eccde, 0xb7fea, 0x5bd3c3, - 0x2be521, 0x71a0be, 0x1ab2b, - ], - CURVE_Gy: [ - 0x1e5245, 0x4b95a4, 0x5b132e, 0x462aef, 0x36d660, 0x672e8d, 0x7b4a53, 0x79e459, 0x24920f, - 0x4828b0, 0x58f969, 0x1d527e, 0x4e00f6, 0x457ef3, 0x66924a, 0x294ffb, 0x66a7a4, 0x70c394, - 0x4f91de, 0x386362, 0x47fcb, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x11ff80, 0x400, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x11ff7f, 0x400, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x7415AB, 0x7F7FF3, 0x5FFF07, 0x2AB555, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxaa: [ - 0x624678, 0x26a6e9, 0x22f8a, 0x212c12, 0x60c343, 0x3df8d3, 0x5d9733, 0x6bfc87, 0x2d2888, - 0x758675, 0x259d1c, 0x7e922c, 0x4bab37, 0x11daab, 0x6214a4, 0x758a55, 0x786671, 0x72b190, - 0x32581d, 0x729d1f, 0x959d, - ], - CURVE_Pxab: [ - 0x3099b8, 0x3d75ff, 0x40e1fe, 0x9523, 0x63775a, 0x78470a, 0x5746c7, 0x7cf1b5, 0x26a730, - 0x14fe14, 0x76ca97, 0x61c7c2, 0x669261, 0x6a7c2f, 0x3e5da9, 0x5f2d68, 0x2d39d1, 0x4a3c98, - 0x4cf7f1, 0x68418b, 0x3b0de, - ], - CURVE_Pxba: [ - 0x2d15d3, 0x1bce23, 0x5bb687, 0x46fb70, 0x185317, 0x47c134, 0x2fd0fa, 0x3597b2, 0x56de56, - 0x165b19, 0x1d3f6e, 0x10e136, 0x76b1ef, 0x1913c7, 0x4011ef, 0x1f994f, 0x3fe210, 0x545186, - 0x41ebca, 0x7d6a72, 0x3ec27, - ], - CURVE_Pxbb: [ - 0x60f480, 0x650ebd, 0x2e31ea, 0x21eb62, 0x14556e, 0x1c3973, 0x48b7e0, 0xffefd, 0x50122f, - 0x55ee1f, 0x263bd7, 0x2ed92b, 0x1ba3ad, 0x39c35e, 0x2dd201, 0x17232e, 0x1da7ce, 0x4cb0aa, - 0x1e67df, 0x46de50, 0xa5b3, - ], - CURVE_Pyaa: [ - 0x781aa0, 0x132628, 0x2ac619, 0x181db8, 0x3609da, 0x3f8897, 0x4a9851, 0x189252, 0x4c42a, - 0x768c5c, 0x66b9a2, 0x1c1d70, 0x4fcadc, 0x69ed7c, 0x7d286c, 0xd685, 0x198f9, 0x459da0, - 0x30250d, 0x1aeb9b, 0x5057f, - ], - CURVE_Pyab: [ - 0x2e08fa, 0x58afdd, 0x5ab6ef, 0x5d52fc, 0x78774, 0x348594, 0x32bc26, 0x23c32, 0x3bccf7, - 0xb913f, 0x3e1549, 0x5b907f, 0x77b3e6, 0x22c6ed, 0x7865fe, 0x3daefb, 0x60f558, 0x702d7a, - 0x3a258d, 0x24b30f, 0x2ce2b, - ], - CURVE_Pyba: [ - 0x70cc41, 0x4ed4b, 0x7d5cc, 0x2a9855, 0x7f8932, 0x5f1428, 0x7361e6, 0x14406c, 0x68a9fe, - 0x21dca7, 0x4dc54e, 0x10783e, 0x71f3a4, 0x3aa336, 0x6c5305, 0x1e5adc, 0x1a39dd, 0x7c73f0, - 0x18c69a, 0x2331f7, 0x18070, - ], - CURVE_Pybb: [ - 0x5c1cae, 0x65cca2, 0x2373c6, 0x2ad84c, 0x2d40d3, 0x714eee, 0x10ff70, 0x3ae561, 0x136b6, - 0x3eba67, 0x75cbf3, 0x327450, 0x161ac1, 0x5cb9a1, 0x2c42ee, 0x48bb8f, 0x56d046, 0x725081, - 0x77b22d, 0x2756cd, 0x499d1, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: true, - - //debug: false, - }; - - return ROM_CURVE_BLS24479; -}; - -ROM_CURVE_BLS48581 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS48581 = { - // Base Bits= 23 - // Ate Bits= 33 - // G2 Table size= 36 - - CURVE_Cof_I: 0, - CURVE_Cof: [ - 0x382, 0x280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_B_I: 1, - CURVE_B: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x671c01, 0x7cdf9a, 0x46297, 0x3e126d, 0x659946, 0x789997, 0x1588c0, 0x2e3e68, 0x2016a8, - 0x698992, 0x65a74, 0x17373a, 0x3c972c, 0x7f5ad, 0x4f2f80, 0x3d1f85, 0x463538, 0x2b81ad, - 0x733058, 0x7119d4, 0x5e2885, 0x5f1524, 0x8e1, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x5af640, 0xe6462, 0x30ef3a, 0x50f36c, 0x4da5d3, 0x70d96e, 0x5a2c45, 0x62bed9, 0x36ebdb, - 0x3b0b24, 0x611d99, 0x37cb22, 0x46a9df, 0x8aa0a, 0x6e7dd5, 0x5d76ff, 0x761abd, 0xd0d19, - 0x15f83a, 0x6f1f9, 0x693f86, 0x6e7be3, 0x4aebca, 0x561a07, 0x2f59b7, 0x5, - ], - CURVE_Gy: [ - 0x587a70, 0x3bc7c4, 0x5db6ed, 0x5c935a, 0x37aef7, 0x65c6be, 0x21db46, 0x3fbbe1, 0x722f48, - 0x30987d, 0x3d9e1, 0x7729f4, 0x7fb98a, 0x776f7d, 0x5c83bd, 0x4eea0d, 0x699127, 0x5714a5, - 0x4f27bf, 0x24452a, 0x7b398a, 0x6745a3, 0x647e1a, 0x7b298f, 0x6fda44, 0x19, - ], - CURVE_HTPC: [ - 0x1193ec, 0x617c06, 0x10ce4f, 0x203ac1, 0x288964, 0x28c418, 0x2a39c3, 0x76df25, 0x6fd560, - 0x4f7aab, 0x41c1ac, 0x25f766, 0x24a962, 0x2766c2, 0x1ab5f1, 0x2af131, 0x30c7, 0x308b53, - 0xb0b77, 0x5a7353, 0x429389, 0x3153fa, 0x653c17, 0x2ee2d7, 0x2348cd, 0x12, - ], - - CURVE_Bnx: [ - 0x381, 0x280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Pxaaa: [ - 0x68bfab, 0x216959, 0x7b0d3f, 0x110aa6, 0x797663, 0x2062f6, 0x1247d4, 0x26c0, 0x400503, - 0x40c25e, 0x698f2, 0x462114, 0x3aad1a, 0xdfef3, 0x3c55b1, 0x6d9d17, 0x37de64, 0x9b799, - 0x3f1c0d, 0x75d5df, 0x22775d, 0x6ff48b, 0x128e08, 0x53c38f, 0x5615d9, 0xb, - ], - CURVE_Pxaab: [ - 0x347c57, 0x66cced, 0x7c59a6, 0x57d0a1, 0x556a01, 0x1ffaea, 0x65e58c, 0x63b186, 0x4f0c3, - 0x7f4c4a, 0x529dab, 0x6f8b10, 0xabfe, 0x72874, 0x1fd387, 0x6d0918, 0x1526f6, 0x42c47d, - 0x5b6603, 0x45915d, 0x2bc07e, 0x361d0d, 0x14481a, 0x67112c, 0x44973e, 0xf, - ], - CURVE_Pxaba: [ - 0x5a3e6a, 0x2ad94a, 0x519220, 0x359f85, 0x74cded, 0x3fd51d, 0x6e1e75, 0x465efd, 0x555f02, - 0x61a54d, 0x6b9d9b, 0x49217f, 0x41dbd1, 0xc02c3, 0x2d6ada, 0x2be65d, 0x7a6d69, 0x446f94, - 0x1b2a6b, 0x639d45, 0x3ad83b, 0x5d430a, 0x4d386c, 0xcc789, 0x7ccc70, 0x3, - ], - CURVE_Pxabb: [ - 0x7feafe, 0x67976, 0x7c269c, 0x7405e1, 0xb8cb4, 0x14a462, 0x5f0803, 0x18e292, 0x39468c, - 0x6364f3, 0x3b050e, 0x63bb73, 0x5f63e1, 0x43152, 0x62f833, 0x151c9f, 0x21b7b9, 0x5e7cb0, - 0x616b18, 0x7f47ac, 0x154d4b, 0x1b0025, 0x6171e, 0x12e75b, 0x62218c, 0x17, - ], - CURVE_Pxbaa: [ - 0x78cce5, 0x7438a7, 0x6dce70, 0x64ea65, 0x35f746, 0x5018cb, 0x6226a, 0x56aafe, 0x9274f, - 0x1255cb, 0x42cbbd, 0x4ead60, 0x1e4819, 0x33303f, 0x14e19a, 0x73e2c0, 0x675ff0, 0x2c856a, - 0x1d742c, 0x1803e3, 0x2a9dd6, 0x331c99, 0x44e8f1, 0x59ac, 0xb91c6, 0x7, - ], - CURVE_Pxbab: [ - 0x3c093a, 0x1b2294, 0x43c801, 0x7e719b, 0x160910, 0x12ff8f, 0x5d84bc, 0x2d4f8b, 0x5dd759, - 0x738162, 0x55ed02, 0x44cbf5, 0x3835d2, 0x303bec, 0xdd060, 0x33bdd8, 0x3d1a58, 0x612ef4, - 0x4d773b, 0x47bdc7, 0x6cda08, 0x2623c9, 0x6180fc, 0x3f5839, 0x16c779, 0x19, - ], - CURVE_Pxbba: [ - 0x50e057, 0xfcc0e, 0x539058, 0x2e19a, 0x35b0e2, 0x2c6669, 0x49308b, 0xe5f21, 0x432aad, - 0x3df9e6, 0x7432a9, 0x1e7687, 0x7293b1, 0x39de23, 0x2de912, 0x45d160, 0x36db90, 0x2270a5, - 0x106ce7, 0x3306f5, 0x108aee, 0x2f4931, 0x38fc06, 0x63030f, 0x1b7951, 0x17, - ], - CURVE_Pxbbb: [ - 0x46ae34, 0x3401f7, 0x613867, 0x74be1f, 0x2f2fc9, 0x89cad, 0x3afe7f, 0x3cdeb5, 0x545854, - 0x6fc561, 0x29c642, 0x67f9b2, 0x293f29, 0x3f19f9, 0x4a29fe, 0x20b8cb, 0x211cf7, 0x5e8f6a, - 0x6a77be, 0x58f2eb, 0x74aaa2, 0x4c4989, 0x7b14a0, 0x17d95e, 0x27d5c2, 0x10, - ], - CURVE_Pyaaa: [ - 0x2d7971, 0x27fc9a, 0x4c8fb7, 0x9607f, 0x5012ab, 0x2cb208, 0x5fba9b, 0x4cd5fb, 0x163c15, - 0x5b15ca, 0x43dccd, 0x3ba46c, 0x35afa2, 0x6120c4, 0xd7eaa, 0x4f5fe2, 0x66f3b3, 0x334aef, - 0x508e01, 0x25c8c5, 0x52f302, 0x2e42c8, 0x577e92, 0x361bad, 0x6b5335, 0x1, - ], - CURVE_Pyaab: [ - 0x4d5665, 0x3b726d, 0x44451c, 0x2ffe3d, 0x342352, 0x45cb11, 0x5f5d83, 0x97d04, 0x4e1dd2, - 0x125564, 0x170f46, 0xf8c96, 0x6b243b, 0x75f612, 0x4bf2fc, 0x14b239, 0x3a01d7, 0x64bcdf, - 0x108ae8, 0x615bad, 0x15fcad, 0x4ca630, 0x7c5136, 0x4bcf07, 0x4dc75, 0x5, - ], - CURVE_Pyaba: [ - 0x2a8474, 0x54a4d4, 0x79a0cc, 0x61dc7e, 0x47c46f, 0x44d397, 0x546994, 0x60e9ae, 0x65e2f0, - 0x14652b, 0x4554db, 0x48208a, 0x499d0e, 0x6befab, 0x414511, 0x24069b, 0x119d3a, 0x42dab6, - 0x7140c0, 0x779617, 0x367669, 0x3df6e0, 0x48f908, 0x6e8042, 0x36a201, 0x16, - ], - CURVE_Pyabb: [ - 0x41589d, 0x7b5250, 0x4c5884, 0xf299b, 0x3d8b8a, 0x4af1f6, 0x40fb97, 0x33ded2, 0xba10d, - 0x6e84ee, 0x3b4a05, 0x7d206e, 0x224333, 0x59136, 0x48b49d, 0x738870, 0x3dd8b0, 0x1b9dc4, - 0x7b4cd8, 0x58e166, 0x478762, 0x47f77a, 0x1a208, 0x310f6e, 0x6c25a4, 0x15, - ], - CURVE_Pybaa: [ - 0x650137, 0x63f305, 0xfd1e0, 0x7e7bd2, 0x57fddd, 0x6f6110, 0x651744, 0x21809a, 0x64f59f, - 0x1ca256, 0x78b29, 0x66e745, 0x7fa238, 0x5b0b8e, 0x4a615f, 0x402f88, 0x35a959, 0x7bb27, - 0x71506d, 0x512aa6, 0x288325, 0x207f4b, 0x11a459, 0x111d4e, 0x209d5a, 0x1a, - ], - CURVE_Pybab: [ - 0x10bee4, 0x38b19f, 0x1653bb, 0x13679d, 0x59ed82, 0x6cf3b4, 0x32a9ca, 0x57e0cc, 0x139e3a, - 0x78301a, 0x2093d1, 0x420fb, 0xe8c27, 0x750684, 0x2dd413, 0x7102ad, 0x589d82, 0x2ce456, - 0x359bac, 0x48210d, 0x2d537b, 0x2673ab, 0x5e944f, 0x22b9b5, 0x50d037, 0xf, - ], - CURVE_Pybba: [ - 0x323986, 0x75d5fd, 0x2cf507, 0x6cd531, 0x84017, 0x39993d, 0xe7d4f, 0x5a07d3, 0x618b5b, - 0x18e964, 0x307eae, 0x432791, 0x5ae3a2, 0x731e84, 0x669b7, 0xa7264, 0x64155f, 0x108360, - 0x4d93f0, 0x450037, 0x5d17af, 0x5a0bbf, 0x7a8970, 0x8df32, 0x167678, 0x11, - ], - CURVE_Pybbb: [ - 0x2718b6, 0x7f96e6, 0x57599f, 0x2034e2, 0x2c66e8, 0x6e91cb, 0x12accf, 0x1806c6, 0x205417, - 0x7d8e32, 0x6b40cc, 0xf4bf0, 0xe69c3, 0x26747f, 0x32a6a5, 0x5b77c7, 0x487549, 0x7d1ca1, - 0x3c501a, 0x5af034, 0x4f981, 0x4b80fd, 0x274e4e, 0x7fc481, 0x5e2524, 0x6, - ], - // CURVE_W: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]], - // CURVE_SB: [[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]], - // CURVE_WB: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]], - // CURVE_BB: [[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - }; - - return ROM_CURVE_BLS48581; -}; - -ROM_CURVE_BN462 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BN462 = { - // Base Bits= 23 - // Ate Bits= 118 - // G2 Table size= 125 - - CURVE_Cof_I: 1, - CURVE_Cof: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - CURVE_B_I: 5, - CURVE_B: [ - 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - CURVE_Order: [ - 0x10800d, 0x600fc0, 0x9006, 0x0, 0x7f7c00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, 0x438403, - 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - CURVE_Gx: [ - 0x36980d, 0x323e6d, 0x44f263, 0x2e6b80, 0x40372e, 0x4f2473, 0x5a82c7, 0x734d20, 0x31bbb4, - 0x5cd13b, 0xf3d2c, 0x1f6df6, 0x15f63b, 0x4c96df, 0x2e6b24, 0x5180b0, 0x3a34a0, 0x323f5b, - 0x7bc940, 0xd36b3, 0x2, - ], - CURVE_Gy: [ - 0x7b03de, 0x669a6d, 0x2aa295, 0x31176, 0x2c6660, 0x68ea86, 0x3ae03, 0xdc572, 0x777df1, - 0x4dcd5, 0x165941, 0x6bc463, 0x4ccfa7, 0x5b5085, 0x29243b, 0x353a19, 0x2b3367, 0x6f5770, - 0x1183df, 0x8c750, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x7fbfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Pxa: [ - 0x61e4df, 0x7b2695, 0x551a38, 0x4403b4, 0x26a8b4, 0x5c3e15, 0x3800ca, 0x4dd6c9, 0x1ad269, - 0x10411f, 0x4e0810, 0x6b0e48, 0x1cd96e, 0x66fcf8, 0x520b80, 0x465ee2, 0x338e3a, 0x3b41bf, - 0x216d63, 0x12be66, 0x0, - ], - CURVE_Pxb: [ - 0xcd283, 0x174d55, 0x6dcc42, 0x742874, 0x359bf7, 0x6a15f1, 0x60dc63, 0x72aadb, 0x5d86ba, - 0x630269, 0x210162, 0x6c8bb4, 0x730cbe, 0x4546a8, 0x68f263, 0x24ab35, 0xedca8, 0x22055f, - 0xfa166, 0x69721a, 0x1, - ], - CURVE_Pya: [ - 0x37154e, 0x51be1b, 0x5db96d, 0xebe19, 0x40e7b1, 0x6d2b42, 0x38cb80, 0xe4eed, 0x19a1f4, - 0x21e27, 0x6d0bfa, 0x7d3d35, 0x6e23c3, 0x2c68e0, 0x7b280d, 0x510404, 0x517427, 0x5832f2, - 0xe7688, 0x503282, 0x0, - ], - CURVE_Pyb: [ - 0x22a93a, 0x18aa59, 0x7ae853, 0x1a49dc, 0xd5374, 0x70f54d, 0x13be1c, 0x122250, 0x464769, - 0x7ae4b9, 0x6acdc3, 0x59c9f8, 0x69ac57, 0x3cd618, 0x135135, 0x398319, 0x2c8ae3, 0x17c02e, - 0x2f50e3, 0x39f786, 0x0, - ], - CURVE_W: [ - [ - 0x20003, 0xc0, 0x0, 0x0, 0x7ff000, 0x7e7fef, 0x7fffff, 0x7fffff, 0x17ffff, 0x400c00, 0x1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_SB: [ - [ - [ - 0x28004, 0xc0, 0x0, 0x0, 0x7fec00, 0x7e7fee, 0x7fffff, 0x7fffff, 0x17ffff, 0x400c00, 0x1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x11000e, 0x600fc0, 0x9006, 0x0, 0x7f7800, 0xf7ee1, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - [ - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x20003, 0xc0, 0x0, 0x0, 0x7ff000, 0x7e7fef, 0x7fffff, 0x7fffff, 0x17ffff, 0x400c00, 0x1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - ], - CURVE_WB: [ - [ - 0x4000, 0x40, 0x0, 0x0, 0x3ffe00, 0x7f7ffb, 0x7fffff, 0x7fffff, 0x7ffff, 0x400400, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7abffb, 0x1ffc7f, 0x7fffff, 0x7fffff, 0x4029ff, 0x100042, 0x240, 0x0, 0x100000, 0x7f7fff, - 0x7dbfd4, 0x7fffff, 0x7fffff, 0x4800bf, 0x401200, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7d3ffd, 0x4ffe3f, 0x7fffff, 0x7fffff, 0x4015ff, 0x80021, 0x120, 0x0, 0x480000, 0x3fbfff, - 0x7edfea, 0x7fffff, 0x7fffff, 0x24005f, 0x600900, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0xc001, 0x40, 0x0, 0x0, 0x3ffa00, 0x7f7ffa, 0x7fffff, 0x7fffff, 0x7ffff, 0x400400, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_BB: [ - [ - [ - 0x7fc000, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7fbfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7fbfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x11000f, 0x600fc0, 0x9006, 0x0, 0x7f7800, 0xf7ee1, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - [ - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x10c00e, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x10c00d, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x10c00e, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - [ - [ - 0x7f7ffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - [ - [ - 0x10c00f, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x11800f, 0x600fc0, 0x9006, 0x0, 0x7f7400, 0xf7ee0, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x7f7ffd, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x10c00f, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - }; - - return ROM_CURVE_BN462; -}; - -ROM_CURVE_BLS48556 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS48556 = { - // BLS48556 Curve - // Base Bits= 23 - CURVE_Cof_I: 0, - CURVE_B_I: 17, - CURVE_B: [ - 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x1, 0x7e0000, 0x421bff, 0x714ed3, 0x455409, 0x53842, 0x7ac588, 0x7e8a68, 0xad8c1, 0x184da5, - 0x7fb5e2, 0x5e936, 0x5ef479, 0x12b881, 0x46fe3f, 0x32fd85, 0x2973c4, 0x3d260d, 0x318df1, - 0x88d57, 0x3f73ea, 0x1887, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x571d33, 0x5a5ecb, 0x3fca1, 0x7f196f, 0x580554, 0x23dc17, 0x591dc, 0x1987f8, 0x7ca7f6, - 0x345e03, 0x203d9a, 0x1734d, 0x444e07, 0x5602b2, 0x5003e, 0x5961d5, 0x30d242, 0x336bc2, - 0x79241, 0xe0499, 0x7edd74, 0x3b712a, 0x215d65, 0x544f49, 0x9, - ], - CURVE_Gy: [ - 0x6ed83a, 0x367fd4, 0x33da69, 0x254538, 0x5c4b95, 0x2b0cef, 0x7aa39a, 0x47d9c8, 0x677b5f, - 0x4f9e3d, 0x6dc8a6, 0x71c0c7, 0x4b44e2, 0x4aa8f1, 0x4c3099, 0x3071e3, 0x240862, 0x1b9ccf, - 0x579c4, 0x4d1997, 0x3349da, 0x3f5c56, 0x5318b1, 0x56c684, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x640020, 0xfb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x64001f, 0xfb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x12ABEB, 0x221EFE, 0x528B, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxaaa: [ - 0x23ce4a, 0x5d1d12, 0x74aa34, 0x695c09, 0x3d7102, 0x274419, 0x76284c, 0x69f0b2, 0x4637c1, - 0x5fe3fe, 0x242e62, 0x3f853e, 0x4dd2b3, 0x672bde, 0x6ed92, 0x2b9bad, 0x6c4abf, 0x393882, - 0x32ee21, 0x2ef3a1, 0x59487e, 0x92f4b, 0x26870, 0x32bc6c, 0xe, - ], - CURVE_Pxaab: [ - 0xa1be1, 0x1b8b58, 0x7dc9c7, 0x3beb, 0x28fe3b, 0x72e58b, 0x51e10c, 0x31856a, 0x389247, - 0x15b9fd, 0x2847ea, 0x2e35a0, 0x9b0e7, 0x7f92ce, 0x6960c8, 0xc5821, 0x48632d, 0xc919c, - 0x3c27f4, 0x2a934d, 0x348b6e, 0x2f6b1b, 0x179d2a, 0x4a1009, 0x2, - ], - CURVE_Pxaba: [ - 0xc5dc4, 0x6498ee, 0x4b68e9, 0x6ed677, 0x2964ad, 0x7d8e6d, 0x4d0966, 0x550884, 0x1926ac, - 0x47162d, 0x633555, 0x265962, 0x6402b8, 0x48f745, 0x68195f, 0x198b3a, 0x117ce2, 0x5e9efb, - 0x729335, 0x471f6e, 0x3689ba, 0x3bb4f1, 0x3ddb5c, 0x297f7c, 0xb, - ], - CURVE_Pxabb: [ - 0x64b740, 0x52cd34, 0x578358, 0x464902, 0x11fd49, 0x475ba2, 0x5c150c, 0x436206, 0x335e27, - 0x7cfa66, 0x53ba9f, 0x39e20f, 0x41e3c, 0x30cb43, 0x5e7d7a, 0x4869da, 0x6b405, 0x57b683, - 0x77306a, 0x3e774a, 0x63b1a6, 0x4be47e, 0x764b7f, 0x1c2054, 0x9, - ], - CURVE_Pxbaa: [ - 0x71e01f, 0x18c2e5, 0x26ec, 0x1a5853, 0x4311cd, 0x430f11, 0x43e8e4, 0x20204c, 0x35ab89, - 0x775c07, 0x43202c, 0x442943, 0x1e3472, 0xb1bea, 0x14841d, 0x56a6a1, 0x4e27c3, 0x6ac397, - 0x111e6a, 0x453f3c, 0x449d32, 0x6288f9, 0x7d0633, 0x6f0f7b, 0xd, - ], - CURVE_Pxbab: [ - 0x37383d, 0x70470c, 0x66c28, 0x7ccc3f, 0x220253, 0x27a425, 0x147b57, 0x64a9ae, 0x7a0147, - 0x61ce2b, 0x7620bf, 0x1ceb9b, 0x3f1646, 0x5546dc, 0x12aec8, 0x2a6d46, 0x38885e, 0xa7fd0, - 0x3a2974, 0x7872f1, 0x4f91fb, 0x2ade02, 0x632141, 0x16d9d3, 0x8, - ], - CURVE_Pxbba: [ - 0x11939c, 0x7b67ae, 0x6ba5a0, 0x34d20c, 0x1be51d, 0x65ed81, 0x6d5cb3, 0x6465e6, 0x40b384, - 0x146e44, 0x54f471, 0x119f79, 0x11a9b3, 0x5235b8, 0x342402, 0x6b0380, 0x51a403, 0x22e30f, - 0x1f23ba, 0x468cdf, 0x5a9ccf, 0x77c486, 0x613650, 0x411539, 0xa, - ], - CURVE_Pxbbb: [ - 0x6f4899, 0x2150a, 0x750cb5, 0x4952b2, 0x1c51eb, 0x179378, 0x295e64, 0x5b5457, 0x47a789, - 0x1403f8, 0x62578c, 0x2f5d38, 0x7fe82c, 0x6cff62, 0x32162, 0x3acbe5, 0x1e3000, 0x668f, - 0x426a4b, 0x4f46ed, 0x57a328, 0x62acf0, 0xf705b, 0x7baa3c, 0xd, - ], - CURVE_Pyaaa: [ - 0x137844, 0x2f9f68, 0x4ddb82, 0x4ffa79, 0x44ec64, 0x6d10a3, 0x1beaf1, 0x4b2f5c, 0xb8a71, - 0x20ab1c, 0x225b80, 0x663e7c, 0x673c10, 0x7e8ea9, 0x2fc388, 0x66e9cc, 0x202f56, 0x39587c, - 0x343e8c, 0x52c8bf, 0x6190b, 0x11fb0e, 0x6124d5, 0x337685, 0x7, - ], - CURVE_Pyaab: [ - 0x483190, 0x6491db, 0x424978, 0x23544c, 0x2eaaf4, 0x31a65, 0x48eeb1, 0x7eeb0e, 0x91f2f, - 0x2d992c, 0xf07c, 0x4ae56f, 0x688ed2, 0x62e3a0, 0x284758, 0x15cf7, 0x7e205e, 0x9fa40, - 0x24ea65, 0xce87c, 0x7a1c42, 0x1c4d1d, 0x4f76aa, 0x3ce59c, 0x2, - ], - CURVE_Pyaba: [ - 0x185c0d, 0x3fa083, 0xfa771, 0x50c8ee, 0xd404d, 0x759d3, 0x697d52, 0x6598bc, 0x685c7c, - 0x612d58, 0x160d06, 0x2201f3, 0x5c797c, 0x10c374, 0xe7e1c, 0x52fa00, 0x1f60b0, 0x42b24, - 0x7635e0, 0xdd262, 0x140d61, 0x26a7e6, 0x595fbc, 0x22cde4, 0xd, - ], - CURVE_Pyabb: [ - 0x1d42f8, 0x41502b, 0x5d7dbf, 0x88b12, 0x243afd, 0x3cfe57, 0x4ec3fa, 0x2fb013, 0x7c3cff, - 0x1d3717, 0x79401a, 0x33c434, 0x635f37, 0x29e4f6, 0x2ca2db, 0x7a8ef0, 0x3fd902, 0x3309c9, - 0x1f125b, 0x3ff0c9, 0x7310, 0x3137db, 0x280e0b, 0x70755, 0xa, - ], - CURVE_Pybaa: [ - 0x38039f, 0x25673e, 0x184354, 0x3e78d1, 0xee895, 0x1279f, 0x285016, 0x445c85, 0x4bfe85, - 0x7f8597, 0x2aedd5, 0x2e62f9, 0x32710c, 0x4f5b51, 0x59016c, 0x6178c7, 0x6e268e, 0x2d39ef, - 0x2c36b6, 0x717762, 0x1d1abc, 0x323714, 0x7c7bb9, 0x582324, 0x2, - ], - CURVE_Pybab: [ - 0x5f7865, 0x40de52, 0x20e9a7, 0x7439d3, 0x3f0756, 0x595baf, 0x7cfc76, 0x287b18, 0x56074e, - 0x186679, 0x416ec0, 0x1dc812, 0x127fbe, 0x18d9b5, 0x3c4a9d, 0x1c2bb4, 0x135ca4, 0x7a40ac, - 0x739984, 0x6f008c, 0x7180ea, 0x58af6d, 0x5b4b02, 0x9194c, 0x3, - ], - CURVE_Pybba: [ - 0x4c1979, 0x753ecf, 0x6f0760, 0x3bb13c, 0x4aaf9c, 0x6bfb52, 0x470858, 0x41323d, 0x5401d8, - 0x494404, 0x5ccf5c, 0xbcf06, 0x7e6ecf, 0x5a9c20, 0xd2dff, 0x64ff44, 0x31645b, 0x4ee883, - 0x4e22ec, 0x112445, 0x486c5c, 0x5c8211, 0x67da66, 0x400692, 0xc, - ], - CURVE_Pybbb: [ - 0x49f25b, 0x12ac5f, 0x5d33f2, 0x35d356, 0x2c4f80, 0x3a4c9e, 0x3c5a72, 0x426c74, 0x5dac92, - 0x52c146, 0x61366b, 0x6cde77, 0x5a9e8f, 0x6dff70, 0x6d20e3, 0x5a60e6, 0x33df1a, 0x2afa7, - 0x390f0, 0x6320a2, 0x3f5493, 0x1cc373, 0x174990, 0x7b09b, 0xa, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: true, - - //debug: false, - }; - - return ROM_CURVE_BLS48556; -}; - -ROM_CURVE_BLS48286 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS48286 = { - // BLS48286 Curve - // Base Bits= 23 - CURVE_Cof_I: 62958, - CURVE_Cof: [0xf5ee, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 10, - CURVE_B: [0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x612c81, 0x2365fa, 0x7ff10, 0x1794b8, 0xf2882, 0x1fc453, 0x253ef9, 0x359315, 0x7c9ede, - 0x602a6b, 0x1af27a, 0x4, 0x0, - ], - CURVE_Gx: [ - 0x5d59e0, 0x7d4612, 0x577225, 0x677dd0, 0x597475, 0x9a33b, 0x50693a, 0x602a23, 0x6c0f04, - 0x11f68e, 0x44836e, 0x39219e, 0x69, - ], - CURVE_Gy: [ - 0x2beb43, 0x53f2e1, 0xbbbbd, 0x2c071f, 0x37ce6b, 0x1583e4, 0x7b94ec, 0x519846, 0x7f979a, - 0x5af112, 0x7995b8, 0x472050, 0x203, - ], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0xf5ef, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxaaa: [ - 0x6106b5, 0x46930a, 0x3fa105, 0x662660, 0x43b1ce, 0x3ea359, 0x6b2bf6, 0x3d4a96, 0x4caeb, - 0x2544f6, 0x4c71c7, 0x67ea02, 0x22a, - ], - CURVE_Pxaab: [ - 0x6d1a55, 0x237b12, 0x6a77b3, 0x29c48e, 0x277185, 0x6ad728, 0x164bfb, 0x264519, 0xc873e, - 0x4b1a4a, 0x2d7216, 0x5dcccb, 0x18d, - ], - CURVE_Pxaba: [ - 0x57a35e, 0x3474cf, 0xe204, 0x662c53, 0x7af4e8, 0x5e8393, 0x41ad4a, 0x6e0cd2, 0x3de1d4, - 0x62f5c5, 0x7829f0, 0x1496ae, 0xa8, - ], - CURVE_Pxabb: [ - 0x7023e8, 0xa4185, 0x428a3a, 0x799e96, 0x191b5c, 0x45b13e, 0x3d77ed, 0xf392e, 0x1f92e8, - 0x1b1776, 0x7eb253, 0x5f06aa, 0x202, - ], - CURVE_Pxbaa: [ - 0x14cb9b, 0x1ab71e, 0x3622e6, 0x7f12aa, 0x217d62, 0x72d443, 0x5b5546, 0x3e38f7, 0x225964, - 0x45096a, 0x78fdd, 0x139b4d, 0x175, - ], - CURVE_Pxbab: [ - 0x60dd54, 0x650d96, 0x10efda, 0x1b8d12, 0x532b9, 0x7d3817, 0x535f9a, 0x6b1c6a, 0x2d3760, - 0x668d88, 0x7a7567, 0xf5242, 0x110, - ], - CURVE_Pxbba: [ - 0x5776da, 0x361573, 0x7e8829, 0x9089a, 0x657276, 0x5b5754, 0x162f92, 0x26f20a, 0xe4aad, - 0x3f9dec, 0x187f90, 0x37e71, 0xf6, - ], - CURVE_Pxbbb: [ - 0x350a8e, 0x447051, 0x2d7cff, 0x1304e7, 0x7554ef, 0x5934ae, 0x648e87, 0x139670, 0x68c000, - 0x2cd8a2, 0x483465, 0x598734, 0x1f0, - ], - CURVE_Pyaaa: [ - 0x6988be, 0x2bfacf, 0x3b89b3, 0x74bc5e, 0x7e5ef8, 0x1d1663, 0x1513c5, 0x781cd9, 0x38694f, - 0x2af8fe, 0x258b35, 0x7c66d, 0x21f, - ], - CURVE_Pyaab: [ - 0x711b92, 0x2cda1b, 0x21de1, 0xf5e2f, 0x333180, 0x681970, 0x4a7c36, 0xdc200, 0x5e1586, - 0x528744, 0x1bfb5e, 0xe0ff6, 0xe0, - ], - CURVE_Pyaba: [ - 0x7dd06a, 0x74cf57, 0x4951f3, 0x467f2c, 0x3cdab0, 0x571cc9, 0x2a634b, 0x12ad70, 0x335eff, - 0x45b3d7, 0xf5afa, 0x7fdc6, 0x12c, - ], - CURVE_Pyabb: [ - 0xa47f4, 0x3fa6f1, 0x4a2cf7, 0x308359, 0x15f9a3, 0x62afa3, 0x4e1447, 0x1a5942, 0x5d352b, - 0x743bb7, 0x6f7ffc, 0x418f2a, 0x156, - ], - CURVE_Pybaa: [ - 0x639e77, 0x36e68b, 0x132dbb, 0x7ca9c6, 0x48190f, 0x232649, 0x37bc94, 0x6fb23e, 0x74193e, - 0x569ebd, 0x6213, 0x472055, 0x73, - ], - CURVE_Pybab: [ - 0x4975c6, 0x50286c, 0x2c0ca0, 0x654460, 0x624ad9, 0x26e477, 0x436b98, 0x50cb4d, 0x369be1, - 0x7238a0, 0x25b890, 0x2c3b34, 0x136, - ], - CURVE_Pybba: [ - 0x3f2d7c, 0x735783, 0x102f4c, 0x59d512, 0x713ef1, 0x6fe36, 0x2674e, 0x5b0a2d, 0x288f81, - 0xbdc69, 0x450f27, 0x541ba, 0x1fb, - ], - - CURVE_Pybbb: [ - 0x1130a6, 0x41a3ca, 0x76aaa6, 0x1b12a9, 0x39e708, 0xd0fdd, 0x59da9f, 0x76d23, 0x32d633, - 0x342eef, 0x1ab27a, 0x79bc6e, 0x193, - ], - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BLS48286; -}; - -ROM_CURVE_BLS12381 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS12381 = { - // BLS12381 Curve - // Base Bits= 23 - - CURVE_Cof_I: 0, - CURVE_B_I: 4, - CURVE_B: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x1, 0x7ffe00, 0x7bffff, 0x7ff2df, 0x5a402f, 0xaa77, 0x26876, 0x1cec04, 0x7d4833, 0x26533a, - 0x4fb69d, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x22c6bb, 0x6015b6, 0x3feceb, 0x4bd0d7, 0x5e83ff, 0xb0d8a, 0x45c6eb, 0x271d1f, 0x3905a1, - 0x1f2ee9, 0xda231, 0x4d607e, 0x38c4fa, 0x4d2ac, 0x65f5e5, 0x69d398, 0x17f1, - ], - CURVE_Gy: [ - 0x45e7e1, 0x46528d, 0x1032a8, 0x144457, 0x4c744a, 0x7dba07, 0x4b012c, 0x6d8c65, 0xaf600, - 0x2baba0, 0x73d782, 0x6c5727, 0xed741, 0x3413c6, 0x6aa83c, 0x7a40f1, 0x8b3, - ], - CURVE_HTPC: [ - 0x6821b8, 0x20c57b, 0x6df314, 0x72e2bf, 0x69520e, 0x621116, 0x500ff0, 0x376dee, 0x9ff04, - 0x69291a, 0x4bc077, 0x38ded0, 0x4a9a3d, 0x1b671e, 0x5b2fdd, 0x231645, 0x1f7, - ], - - CURVE_Bnx: [ - 0x10000, 0x0, 0x34804, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x10001, 0x0, 0x34804, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0xAAAB, 0x555600, 0x5A3002, 0x2AAF0A, 0x48C005, 0x72D, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0x21bdb8, 0x2d9182, 0x3f5201, 0x402ddf, 0x40326a, 0x2ee175, 0x1eb8f4, 0x2885b2, 0x3b02b4, - 0x29f480, 0x1b91eb, 0x28828e, 0x5272dc, 0x24c100, 0x23c2a4, 0x515978, 0x24a, - ], - CURVE_Pxb: [ - 0x42b7e, 0x7a0aba, 0x5f96b1, 0x1ca2ea, 0x4f1121, 0x92669, 0x771fd4, 0x6d30dd, 0x361ab5, - 0x213241, 0x65af43, 0x3a7b2a, 0x3a0882, 0xfb59a, 0x1c67d8, 0x15b029, 0x13e0, - ], - CURVE_Pya: [ - 0x382801, 0x290c11, 0x27864d, 0x5d6514, 0x2c9cc3, 0x259247, 0x545834, 0x214d34, 0x53a76d, - 0x55197b, 0x37f66e, 0x71a8d5, 0x5c6da2, 0x319939, 0x1f5b84, 0x6a93b9, 0xce5, - ], - CURVE_Pyb: [ - 0x5f79be, 0xebfe0, 0x6aaa4, 0x6760ed, 0x70d275, 0x3567e6, 0x55cba6, 0x3a4955, 0x63af26, - 0x7d0b4e, 0x2cf8a1, 0x145cce, 0x2b02bc, 0x6559a, 0x29cd33, 0x625017, 0x606, - ], - - CURVE_HTPC2: [ - 0x78492b, 0x627501, 0x51f09d, 0x7754d1, 0x45087, 0x32e477, 0x7532db, 0x4f9b0e, 0x5735f4, - 0x5c4ea3, 0x7eb54d, 0x6735a4, 0x48c21e, 0x7203ac, 0x1e011, 0x4c45ce, 0x52, - ], - CURVE_Ad: [ - 0x584c1d, 0x50105a, 0x7d73d0, 0x707cb, 0x36f8da, 0x359312, 0x3bf620, 0x744c0d, 0x66a8d8, - 0x2707dc, 0x43aa61, 0x6a4c15, 0x202c96, 0x67ad27, 0x6e3a50, 0x234c51, 0x14, - ], - CURVE_Bd: [ - 0x172be0, 0x11d31c, 0x174731, 0xb6755, 0x3215a3, 0x5eab44, 0x73bcd7, 0x5ce0a7, 0x4070a0, - 0x61e49e, 0x5b07, 0x7771d9, 0x2e8753, 0x3162, 0x5a200c, 0x484688, 0x12e2, - ], - PC: [ - [ - 0x22d229, 0x745d17, 0x7ea722, 0x3269c8, 0x31b80b, 0x6d1849, 0x70931a, 0x605f8d, 0x37bc23, - 0x7c4590, 0x475e75, 0x6f71e9, 0x62381e, 0x17a3d2, 0x9839c, 0x461247, 0x6e0, - ], - [ - 0x5fb7b, 0x3e7e2c, 0x33299f, 0x6142ef, 0x3771f8, 0xcded3, 0xec52, 0x579b0, 0x7f96d5, - 0x3bccf0, 0x69f733, 0x32d86f, 0x409d25, 0x4e5b1d, 0x7381f8, 0xed03c, 0x1032, - ], - [ - 0x390c9e, 0x20cf7c, 0x65fc90, 0x60193b, 0x10b2ed, 0x6ff463, 0x3d2ec6, 0x318a5d, 0x5c9967, - 0x7418, 0x74bb2e, 0x1c7916, 0x7515d1, 0x5c186, 0x73e9f1, 0xfc70d, 0x169b, - ], - [ - 0x17e317, 0x30d509, 0x55b5c6, 0x35ba74, 0x295f29, 0x3bc9f4, 0x4a3174, 0x62cb64, 0x5574a2, - 0x59cf3e, 0x10edd5, 0x74c86e, 0x33563b, 0xf7216, 0x69e3f1, 0x1e78fc, 0x80d, - ], - [ - 0x70c88e, 0x2c31c7, 0x3e732d, 0x47a3ad, 0x7c8f8c, 0x266736, 0x3c3c9d, 0x416317, 0x4db1a6, - 0x564eb6, 0x55b796, 0xbf299, 0x84d11, 0x5d0e87, 0x6af6f8, 0xf3b80, 0x17b8, - ], - [ - 0x39ed84, 0x644b42, 0x2b775f, 0x82976, 0x25128c, 0x6551b4, 0x3e721a, 0x4710c, 0xce190, - 0x4c9e1f, 0x445618, 0x3295fd, 0x6c38ae, 0x2d46e4, 0x79134a, 0x6b2a9f, 0xd6e, - ], - [ - 0x652983, 0x38cde, 0x67344f, 0x5739e8, 0x70d2dc, 0x721410, 0x25f9a3, 0x69d5c8, 0x799b9e, - 0x7bb2a4, 0x6cf2c5, 0x3a55ae, 0x1bf7a, 0x603a24, 0x5cc4ff, 0x619286, 0x1630, - ], - [ - 0x895d9, 0x19d359, 0x114455, 0xf3be, 0x2286f3, 0x3130b, 0x660beb, 0x3775b2, 0x7b3f08, - 0x3424af, 0x676e65, 0xc72a4, 0x4b3e41, 0x6cc856, 0x667d10, 0x393518, 0xe99, - ], - [ - 0x1b6861, 0x10c83b, 0x4f16ce, 0x18838c, 0x6e25ce, 0x106a66, 0x7c6ccc, 0x599944, 0x3f25f1, - 0x4ad51b, 0x5fd791, 0x2aa096, 0x1d307e, 0x69c0c1, 0x731b6d, 0x738b37, 0x1778, - ], - [ - 0x1edcb0, 0x3f3b59, 0x7f805e, 0x504b94, 0x43e3d2, 0x4b92b1, 0x7b1a38, 0x3c7280, 0x3e568, - 0x6652b3, 0x380c91, 0x54d0de, 0xc5d10, 0x3a209, 0x5d9e3b, 0x2edc, 0xd54, - ], - [ - 0x4b83bb, 0x5de367, 0x5ba0d3, 0x18c61a, 0xf2a6f, 0xd6907, 0x1c347a, 0x32f19e, 0x417f5, - 0x365ed5, 0x705f9d, 0x3d40e3, 0x2b2214, 0x60b117, 0x50eacb, 0x2769f4, 0x1729, - ], - [ - 0x4649b7, 0x2cc4e6, 0x3abab0, 0x17316b, 0xc2d5f, 0x590ac2, 0x336d38, 0x313dab, 0x5ff2, - 0x1145ae, 0x2cc0fa, 0x40ac2b, 0x1dd99, 0x170122, 0x20ccd0, 0x2f958f, 0x11a0, - ], - [ - 0x6cdd0a, 0x9a2d1, 0xb58e, 0x5bc328, 0x74e4b4, 0x2b262, 0x5e3cc7, 0x6fa99c, 0x503776, - 0x5d2def, 0x5a0ad3, 0x2b3407, 0x63eb3a, 0x8edad, 0x7a4ab5, 0x609d5c, 0x95f, - ], - [ - 0x21d641, 0x5874f3, 0x411ddb, 0x5dd21b, 0x26692a, 0x6a070, 0x1fce62, 0x806d3, 0x366b74, - 0x3ae2c2, 0x1fe34, 0x3d1e67, 0x33dafc, 0x4bd241, 0x6953e0, 0x767b56, 0xa10, - ], - [ - 0x4c5a5e, 0x33377b, 0x4c47df, 0x688f16, 0x5b9489, 0xb01f4, 0x7e608b, 0x4b70e6, 0x68a819, - 0x43794, 0x39fd8f, 0x780ccb, 0x5b074c, 0x46167e, 0x592a2c, 0x56154e, 0x14a7, - ], - [ - 0x684a3a, 0x6892dd, 0x33b095, 0x786f03, 0x3b3538, 0x539d4e, 0x18abb7, 0x170398, 0x21894e, - 0x335ea7, 0x5c3d5e, 0x4b390a, 0x463e05, 0x21e7c1, 0x5a4d86, 0x655678, 0x772, - ], - [ - 0x6304a5, 0x73453e, 0x4700b7, 0x211478, 0xd24bc, 0x5ee80, 0x492e26, 0x21de77, 0x2d4d0a, - 0x539d39, 0x655cd7, 0x363749, 0x77f050, 0x2aa721, 0x3999ee, 0x2afc72, 0xe73, - ], - [ - 0x32a21e, 0x72b66a, 0x754e74, 0x79abc0, 0x29ba81, 0x5b537a, 0xcecc1, 0x35a274, 0x62bb8d, - 0x334240, 0x7f7f1d, 0x3d03ef, 0x55f43e, 0x14de3, 0xa452a, 0x70b101, 0x13a8, - ], - [ - 0x462cd8, 0x51271b, 0x104c37, 0x7767ae, 0x6d5243, 0x7a092e, 0x70a35b, 0x665455, 0x655154, - 0x7e2d62, 0x6c2090, 0x75aa2, 0x7ef7c4, 0x590755, 0x62b8bf, 0x2ac0d2, 0x342, - ], - [ - 0x383e19, 0x7374b9, 0x73f308, 0x64a7f6, 0x3d0967, 0x559ad4, 0x2c46b3, 0x532700, 0xcd1fc, - 0x5eb4e3, 0x3e2505, 0x14c8fb, 0x629bff, 0x5026fc, 0x68c897, 0x317f2b, 0xb29, - ], - [ - 0x2b3bff, 0x4edd90, 0x279720, 0x658137, 0x2a8846, 0x6ae27b, 0x23122f, 0x13612c, 0xc01, - 0x1419e1, 0x4107a3, 0x29b1b3, 0x11298e, 0x69168e, 0x556710, 0xd2ef5, 0x1256, - ], - [ - 0x521b1c, 0x73f481, 0x6264f3, 0x71a1ef, 0xd681b, 0xc56ab, 0x5ff22b, 0x4ac430, 0x48ba9c, - 0x1746b6, 0x757bd, 0x1fd378, 0x62f4bd, 0x43165c, 0x3fc66b, 0x46aa46, 0x8ca, - ], - [ - 0x48b604, 0x2d7cd3, 0x5c12d1, 0x7600e3, 0x5027ef, 0x3656cc, 0x256bc0, 0x56ea7d, 0x5a3957, - 0x1f092c, 0x2c6076, 0x7975ae, 0x33b42d, 0x49d4a1, 0x43c0f3, 0x5f274c, 0x15e6, - ], - [ - 0x75224b, 0x3ce2a8, 0x5e19ac, 0x2bcd7d, 0x1049b6, 0x1c8d74, 0x4e5a9f, 0x5587ae, 0x6568d9, - 0x3afd0, 0x799cf6, 0x251fe2, 0x1f748c, 0x20542b, 0x1133c4, 0x14b22f, 0x5c1, - ], - [ - 0x180133, 0x27ebb7, 0x110b67, 0x611953, 0x790ad1, 0x3398d9, 0x4f1019, 0x733196, 0x158013, - 0x101a98, 0x55ecec, 0x18aee3, 0xae7be, 0x6e5f80, 0x47b2a6, 0x51ca56, 0x245, - ], - [ - 0x171ef8, 0x9e017, 0x483530, 0xc908f, 0x51c19, 0x67e0d9, 0x1ed18, 0x138874, 0x308ec0, - 0x54684d, 0x6a9ec4, 0x29fa23, 0x16004f, 0x3a2aa1, 0x6e4e6, 0x165608, 0xb18, - ], - [ - 0x74d8e, 0x1149a0, 0x1b381f, 0x5a26b0, 0x1cdf41, 0x6493b, 0x6447d9, 0x35ff3f, 0x42462e, - 0x7155e1, 0x48d566, 0x176e62, 0x143fed, 0x572318, 0x4dbdb7, 0x354847, 0x18b4, - ], - [ - 0x11c132, 0x6235a0, 0x73a04d, 0x71fdd7, 0x73a5cc, 0x420637, 0x58e279, 0xc1f20, 0x493fd1, - 0x16d95e, 0x34bf2f, 0x1fdc9e, 0x38f1d4, 0x41bfa1, 0x5f346f, 0x1f23c9, 0x1971, - ], - [ - 0x731c30, 0x55d794, 0x3caebe, 0x6a75d3, 0x77055d, 0x77367, 0x347935, 0x4c2f3f, 0x76fe06, - 0x4f22b5, 0x10a832, 0xa511e, 0x5e7ada, 0x244757, 0x61af6d, 0x5d3d08, 0xe1b, - ], - [ - 0x5ba587, 0x1caef7, 0xd80dc, 0x3c303d, 0x65201c, 0x57cd3a, 0x7c832, 0x45b735, 0x426c1e, - 0x2ccf3b, 0x3ceaf4, 0x6d0ddc, 0x6221e4, 0x7d1193, 0x659a12, 0x200c5e, 0x9fc, - ], - [ - 0x70fb29, 0x194630, 0x568579, 0x76ff49, 0x64550f, 0x4c85e, 0x309b21, 0x1c6d3, 0x581ffd, - 0x7fc77b, 0x5c2816, 0x3633a0, 0x6bd2ca, 0x7bd324, 0x4eae1b, 0x646a99, 0x987, - ], - [ - 0x69d6f2, 0x710abf, 0x7b2587, 0x307a0a, 0x7ac24, 0x66e8f5, 0x1358d3, 0x18a09e, 0x4cb52, - 0x1457c3, 0x1d6ee3, 0x4b59e7, 0x7d0277, 0x16592e, 0x6b06ef, 0x5cde7, 0x4ab, - ], - [ - 0x33a5f0, 0x75626c, 0x4a66c8, 0x4ad403, 0x76326c, 0x9c407, 0x4eb555, 0x282e1e, 0x37bd76, - 0x295f5b, 0x529f43, 0x53503, 0x11db8f, 0x44423c, 0x18d2da, 0x1fe520, 0x1660, - ], - [ - 0x68fedb, 0x35d9e5, 0x2106db, 0x4c8205, 0x7f8dc0, 0x5b85dc, 0x84d46, 0x419fe9, 0x50b879, - 0x77c79c, 0x6554db, 0x294e20, 0x7e2a21, 0x6b95e9, 0x783fc4, 0x1fef7, 0x8cc, - ], - [ - 0x65f4cb, 0x38ef61, 0x3298d5, 0x7630ef, 0x5aba9, 0x1f3bc8, 0xc947, 0x7251f6, 0x791c09, - 0x721dd6, 0x50aa9e, 0x233abe, 0x51ad87, 0x2f130e, 0x260708, 0x31bb74, 0x1f8, - ], - [ - 0x2de1f6, 0x44818e, 0xee37f, 0x458029, 0x552162, 0x34fa4d, 0x645003, 0x225f25, 0x1ce2c3, - 0x2cb146, 0x154b8b, 0x5a4ca1, 0x4c86a3, 0x5e9470, 0x259b99, 0x3c35d5, 0xcc, - ], - [ - 0x41c696, 0x4eb45c, 0x7f825f, 0x317d45, 0x567119, 0x269ad8, 0x7ad9eb, 0x4831a1, 0x383d0f, - 0x584a9e, 0x488fa5, 0x5a3418, 0x6d776f, 0x3aa206, 0x3b9604, 0x4b5082, 0x1349, - ], - [ - 0x7bb33, 0xae32e, 0xafa61, 0x59dd1e, 0x47aee9, 0x7a79a1, 0x255950, 0x2957b6, 0x69522b, - 0x1c9150, 0x46b44e, 0x6e7d0, 0x709498, 0x4b3a3, 0x6893b8, 0x4be40d, 0x90d, - ], - [ - 0x634b8f, 0xe743a, 0x11055, 0x9a4bc, 0x2f570f, 0x440b94, 0xd5b2a, 0x277e6b, 0x385332, - 0x4bc4e7, 0x47103d, 0x40ce0b, 0x55e0d7, 0x4d6484, 0x37700f, 0x50ec0b, 0xe0f, - ], - [ - 0x6d06f7, 0x38264d, 0x347eb, 0x38a664, 0x517bd8, 0x1c840, 0x1e5092, 0x3a46f9, 0x27c1cb, - 0x29ce52, 0x7d596e, 0x6bb795, 0x50d53c, 0x6c517b, 0x4b93ce, 0x20075, 0x266, - ], - [ - 0x3345cc, 0x6270ae, 0x47a66, 0x1dc856, 0x763e, 0x70d260, 0x680366, 0x2e777c, 0x2267d, - 0x3315be, 0x50cd1b, 0x78a4b2, 0x144b45, 0x786c26, 0x1d9ff8, 0x5ca8a6, 0xad6, - ], - [ - 0x561092, 0x6a53c4, 0x2a5a12, 0x7bf5df, 0x168986, 0x26a2df, 0x33a9e4, 0x7cd44, 0x42d28c, - 0x15df9c, 0x7e53fe, 0x28623b, 0x41e48c, 0x7eb0a5, 0x740cf, 0x5db3a4, 0xacc, - ], - [ - 0xf6aa8, 0x693975, 0x1003e2, 0x7c1830, 0x5c29f4, 0x390e34, 0x398da9, 0x2c8d9b, 0x26290e, - 0x7376c3, 0x71b740, 0x1488ec, 0xa01ad, 0x291e02, 0x29016f, 0x792cf7, 0x4d2, - ], - [ - 0x113f55, 0x691771, 0x78d1bb, 0x294d9a, 0x5ea3d, 0x1f78e7, 0x1fa9f5, 0x42c97, 0x7bb53, - 0x47c27b, 0x485bdd, 0x542481, 0x597d94, 0x1d5040, 0x429b87, 0x2ae6d3, 0x167a, - ], - [ - 0x535d4a, 0x7b3aaa, 0xdac8c, 0x5c9244, 0x7e2f7b, 0x690a59, 0x12fce6, 0x62ba86, 0x5920ab, - 0x498d5e, 0x67ec33, 0x3a6627, 0x54fd1d, 0x63437c, 0x5b1848, 0x647699, 0x1866, - ], - [ - 0x12ed9, 0x2b42b, 0x1183b9, 0x400ef7, 0xf5b00, 0x265724, 0x18d5c, 0x59a7e9, 0x4fd7fe, - 0x3df43e, 0x1690dd, 0x37fb77, 0x5fabba, 0x40779b, 0xfa9fa, 0x77845f, 0x16a3, - ], - [ - 0x6a775c, 0x273224, 0x64f468, 0x2c58fd, 0x29c01a, 0xa3abf, 0x100280, 0x69b2de, 0x78ef5d, - 0x751a19, 0x7bb3f7, 0x4c125a, 0x734ace, 0x787750, 0x2676cb, 0x3e045, 0x1660, - ], - [ - 0x79b7ac, 0xeff55, 0x80b19, 0x7d4e67, 0x38db9d, 0x4c893e, 0x5bc3d6, 0x766c3d, 0x5881c5, - 0xcaaa1, 0x5c054b, 0x418c15, 0x6eaac7, 0x33f64c, 0x61b6cb, 0x7294b8, 0x8d9, - ], - [ - 0x25001d, 0x284623, 0x3768e4, 0x7e976f, 0x315dc0, 0x22d441, 0x7277b2, 0x176d07, 0x3bb054, - 0x3e1ed3, 0x1b4672, 0x146ee6, 0x112f82, 0x160199, 0x17d0f9, 0x703caa, 0xbe0, - ], - [ - 0x5f5416, 0x5b3088, 0x36a349, 0x1414bd, 0x364f2c, 0x682e4e, 0x79c9ab, 0x1ed244, 0x530e12, - 0x37bb79, 0x445717, 0x6da68e, 0x3bf89e, 0x3e41a4, 0x6394e5, 0x69443c, 0x16b7, - ], - [ - 0x3f67f2, 0x716a7b, 0x247894, 0x37cb7c, 0x57cd63, 0x5d94ce, 0x49e734, 0x1ad2ee, 0x7f310c, - 0x2aa35c, 0x631215, 0x758abb, 0x67d6e8, 0x6df555, 0x103689, 0x799833, 0x58d, - ], - [ - 0x49a03d, 0x20585c, 0x54cbd8, 0x1a94f1, 0x426076, 0x3ef14, 0x3d14f8, 0x5081ab, 0x559ca4, - 0x6e6389, 0x17213f, 0x1a45c4, 0x56c43c, 0x434197, 0x604807, 0x6bae11, 0x1962, - ], - [ - 0x3663c1, 0x24a760, 0x34051e, 0x306103, 0x3688ef, 0x4f40fe, 0x56f9cb, 0x619195, 0xbe6ee, - 0x4af130, 0x69b7, 0x7574b, 0x140fad, 0x4a4302, 0x27262c, 0x16261d, 0x1611, - ], - ], - CURVE_Adr: [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Adi: [ - 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Bdr: [ - 0x3f4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Bdi: [ - 0x3f4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - PCR: [ - [ - 0x2a5ed1, 0x555555, 0x46238a, 0x7b38e3, 0xe38d0, 0x2eae13, 0x450ae1, 0x6b0847, 0x10aa22, - 0x4fe9d0, 0x2c52d3, 0x7db0a6, 0x2691f5, 0x5dadbd, 0xe333e, 0x32a0fd, 0x171d, - ], - [ - 0x7fc71e, 0x7fffff, 0x549aa7, 0x5c6aaa, 0x2aaa9c, 0x3028e, 0x53c829, 0x104635, 0xc7f9a, - 0x5bef5c, 0x613e1e, 0x3e447c, 0x7ced78, 0x6424d, 0x6aa66f, 0x5f8bd, 0x1156, - ], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x2a97d6, 0x555555, 0x7188e2, 0x1ece38, 0x638e34, 0x2bab84, 0x7142b8, 0x5ac211, 0x42a88, - 0x73fa74, 0x4b14b4, 0x3f6c29, 0x29a47d, 0x576b6f, 0x238ccf, 0x2ca83f, 0x5c7, - ], - [0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x718b10, 0x638e38, 0x6786cd, 0x36e25e, 0x1097a5, 0xa49cf, 0x26a89d, 0x74bbe3, 0x6286b0, - 0x6f43c4, 0x586c3c, 0x8d683, 0x43de38, 0x7f7ee0, 0x5b3de6, 0x4d6a1d, 0x124c, - ], - [ - 0x7fc71c, 0x7fffff, 0x549aa7, 0x5c6aaa, 0x2aaa9c, 0x3028e, 0x53c829, 0x104635, 0xc7f9a, - 0x5bef5c, 0x613e1e, 0x3e447c, 0x7ced78, 0x6424d, 0x6aa66f, 0x5f8bd, 0x1156, - ], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x46d706, 0xe38e3, 0x204b3f, 0x46497b, 0x425ebf, 0x201f91, 0x1f49f9, 0x221cec, 0x649bf5, - 0x2940fe, 0x3df697, 0x688c98, 0x18b076, 0x6b3498, 0x2d044e, 0x23be3d, 0x1530, - ], - [0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7fa8fb, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - ], - PCI: [ - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7fe38d, 0x7fffff, 0x2a4d53, 0x2e3555, 0x15554e, 0x418147, 0x69e414, 0x8231a, 0x63fcd, - 0x2df7ae, 0x309f0f, 0x1f223e, 0x7e76bc, 0x432126, 0x755337, 0x2fc5e, 0x8ab, - ], - [ - 0x7fc71a, 0x7fffff, 0x549aa7, 0x5c6aaa, 0x2aaa9c, 0x3028e, 0x53c829, 0x104635, 0xc7f9a, - 0x5bef5c, 0x613e1e, 0x3e447c, 0x7ced78, 0x6424d, 0x6aa66f, 0x5f8bd, 0x1156, - ], - [ - 0x2a97d6, 0x555555, 0x7188e2, 0x1ece38, 0x638e34, 0x2bab84, 0x7142b8, 0x5ac211, 0x42a88, - 0x73fa74, 0x4b14b4, 0x3f6c29, 0x29a47d, 0x576b6f, 0x238ccf, 0x2ca83f, 0x5c7, - ], - [ - 0x7faa9f, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [ - 0x7faa63, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7fe38f, 0x7fffff, 0x2a4d53, 0x2e3555, 0x15554e, 0x418147, 0x69e414, 0x8231a, 0x63fcd, - 0x2df7ae, 0x309f0f, 0x1f223e, 0x7e76bc, 0x432126, 0x755337, 0x2fc5e, 0x8ab, - ], - [ - 0x2a97be, 0x555555, 0x7188e2, 0x1ece38, 0x638e34, 0x2bab84, 0x7142b8, 0x5ac211, 0x42a88, - 0x73fa74, 0x4b14b4, 0x3f6c29, 0x29a47d, 0x576b6f, 0x238ccf, 0x2ca83f, 0x5c7, - ], - [ - 0x46d706, 0xe38e3, 0x204b3f, 0x46497b, 0x425ebf, 0x201f91, 0x1f49f9, 0x221cec, 0x649bf5, - 0x2940fe, 0x3df697, 0x688c98, 0x18b076, 0x6b3498, 0x2d044e, 0x23be3d, 0x1530, - ], - [ - 0x7faa99, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [ - 0x7fa9d3, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [ - 0x7fa8fb, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BLS12381; -}; - -ROM_CURVE_BLS12461 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS12461 = { - // BLS12461 Curve - // Base Bits= 23 - - CURVE_Cof_I: 0, - CURVE_B_I: 9, - CURVE_B: [ - 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - CURVE_Order: [ - 0x1, 0x0, 0x700000, 0x7f7fff, 0x7feff, 0x22000, 0x7f2000, 0x7e00bf, 0xe801, 0x40bfa0, 0x5ff, - 0x7fe00c, 0x7fff7f, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x5ee93d, 0x4d515, 0x504534, 0x773a5b, 0x2d9c00, 0x6358fe, 0x6606d4, 0x4114e1, 0x4dc921, - 0x21a6ac, 0x282599, 0x7be149, 0x436166, 0x45632e, 0x1a2fa4, 0x38967b, 0xc8132, 0x476e74, - 0x3a66d1, 0x56873a, 0x0, - ], - CURVE_Gy: [ - 0x51d465, 0x462af5, 0x51c3dd, 0x64627f, 0x517884, 0x71a42b, 0x6799a, 0x2ce854, 0x245f49, - 0x15cb86, 0x2e1244, 0x45fd20, 0x16eecb, 0x3f197d, 0x3322fe, 0x1793bd, 0x5f1c3f, 0x3ed192, - 0x452cc1, 0x3bde6d, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x0, 0x7ffc00, 0x7fffef, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x1, 0x7ffc00, 0x7fffef, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x2AAAAB, 0x7FFD55, 0x5AAA9F, 0x5580AA, 0x7D55AA, 0x2A9FFF, 0x5555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxa: [ - 0x50a37c, 0x20630d, 0x31196d, 0x173aee, 0x1c2e49, 0x2d0f15, 0x7e467, 0x7ab270, 0x74ff92, - 0x610db6, 0x19a00f, 0x36ac0d, 0x6d78d4, 0x78520f, 0x224be5, 0x1e1386, 0x767945, 0x4a1535, - 0x4e281a, 0x662a0, 0x1, - ], - CURVE_Pxb: [ - 0x41c0ad, 0x395185, 0x37a7e1, 0x6212e5, 0x16cd66, 0x4512c1, 0x4a546, 0x200d63, 0x3ebee2, - 0x7aa535, 0x7d96c5, 0x504e99, 0x45af5b, 0x6e3da9, 0x4b9350, 0x123533, 0x2279d2, 0x1d46f9, - 0x53f96b, 0x4ae0fd, 0x0, - ], - CURVE_Pya: [ - 0x2fb006, 0x218360, 0xcdf33, 0x525095, 0x53d194, 0x125912, 0x5833f3, 0x6345a4, 0xf39f, - 0x1e7536, 0x7b46e8, 0x3edde2, 0x4dfd8a, 0x5ef53, 0x3489f3, 0x7a739f, 0x6070f4, 0x74fcce, - 0x1239fa, 0x113564, 0x0, - ], - CURVE_Pyb: [ - 0x71457c, 0xd5bfb, 0x2a294, 0x6e0261, 0x4d6a31, 0x6dc7f6, 0x26a3c4, 0x2b3475, 0x64492f, - 0x2e7877, 0x19e84a, 0x25f55d, 0x220be7, 0x5c70ad, 0x7c1310, 0x228ab, 0x2ab1d0, 0x6805d4, - 0x6d3eae, 0x71c080, 0x0, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BLS12461; -}; - -ROM_CURVE_FP256BN = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_FP256BN = { - // FP256BN Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 3, - CURVE_B: [0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xb500d, 0x536cd1, 0x1af62d, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - CURVE_Gx: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0xb0a801, 0xf5c030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxa: [ - 0xc09efb, 0x16b689, 0x3cd226, 0x12bf84, 0x1c539a, 0x913ace, 0x577c28, 0x28560f, 0xc96c20, - 0x3350b4, 0xfe0c, - ], - CURVE_Pxb: [ - 0x7e6a2b, 0xed34a3, 0x89d269, 0x87d035, 0xdd78e2, 0x13b924, 0xc637d8, 0xdb5ae1, 0x8ac054, - 0x605773, 0x4ea6, - ], - CURVE_Pya: [ - 0xdc27ff, 0xb481be, 0x48e909, 0x8d6158, 0xcb2475, 0x3e51ef, 0x75124e, 0x76770d, 0x42a3b3, - 0x46e7c5, 0x7020, - ], - CURVE_Pyb: [ - 0xad049b, 0x81114a, 0xb3e012, 0x821a98, 0x4cbe80, 0xb29f8b, 0x49297e, 0x42eea6, 0x88c290, - 0xe3bcd3, 0x554, - ], - - CURVE_W: [ - [0x54003, 0x36e1b, 0x663af0, 0xfffe78, 0xffffff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_SB: [ - [ - [0x669004, 0xeeee7c, 0x670bf5, 0xfffe78, 0xffffff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x6100a, 0x4ffeb6, 0xb4bb3d, 0x129b19, 0xdc65fb, 0xa49d0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - ], - ], - CURVE_WB: [ - [0x30a800, 0x678f0d, 0xcc1020, 0x5554d2, 0x555555, 0x55, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7dc805, 0x764c0d, 0xad1ad6, 0xa10bc3, 0xde8fbe, 0x104467, 0x806160, 0xd105eb, 0x0, 0x0, - 0x0, - ], - [ - 0x173803, 0xb6061f, 0xd6c1ac, 0x5085e1, 0xef47df, 0x82233, 0xc030b0, 0x6882f5, 0x0, 0x0, - 0x0, - ], - [0x91f801, 0x530f6e, 0xcce126, 0x5554d2, 0x555555, 0x55, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_BB: [ - [ - [ - 0x5aa80d, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [0x615002, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80d, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - ], - [ - [0x615002, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0xb0a802, 0xf5c030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xc2a002, 0xd700c2, 0x1a20b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0xaa000a, 0x67ec6f, 0x1a2527, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [0xb0a802, 0xf5c030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_FP256BN; -}; - -ROM_CURVE_FP512BN = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_FP512BN = { - // FP512BN Curve - - // Base Bits= 23 - - CURVE_Cof_I: 1, - CURVE_B_I: 3, - CURVE_B: [ - 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x1a09ed, 0x14bea3, 0x501a99, 0x27cd15, 0x313e0, 0x346942, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CURVE_Gx: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gy: [ - 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x1bd80f, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Pxa: [ - 0x3646b5, 0x52dc1b, 0x7a3c1e, 0x48397f, 0xf8731, 0x71e443, 0x6f2ef1, 0x2bdf10, 0x4dc6dc, - 0x70c6a2, 0x40914d, 0x3c6685, 0x5a57cc, 0x3736af, 0x4d63c3, 0x5de94d, 0x6a1e4b, 0x25e79, - 0x6e9d, 0x244ac4, 0x1e1386, 0x62ca67, 0xe, - ], - CURVE_Pxb: [ - 0xae0e9, 0x17dfb5, 0x6cf6d7, 0x6c4488, 0x4a411c, 0x5b9c81, 0x4e0f56, 0x286b70, 0x6e0d5e, - 0x650aa4, 0x607889, 0x5ca6cb, 0x302566, 0x48ed51, 0x1b1bbc, 0x532b6e, 0x34825e, 0x157d1, - 0x6d311a, 0x3f3644, 0x3f8506, 0x38279, 0x12, - ], - CURVE_Pya: [ - 0x5e67a1, 0x6255b, 0x178920, 0xaf7dc, 0x217ad6, 0x778b9b, 0xa022d, 0x11892a, 0x3e8edd, - 0x7bd82a, 0x5b3462, 0x34cea5, 0x65c158, 0x1ba07d, 0x5982bf, 0x42d8ef, 0x4f2770, 0x19746e, - 0x3bd6ac, 0x3dc149, 0x4c827c, 0x603d90, 0x1b, - ], - CURVE_Pyb: [ - 0x4f8e8b, 0x630d90, 0x5a162d, 0x25fbb0, 0x5c222, 0x11bfe, 0x7b89e7, 0x18856b, 0x714a4, - 0x7c5ca, 0xa25ff, 0xca0ed, 0x3d0496, 0x61936c, 0x46219e, 0xa1c60, 0x591f02, 0x62beeb, 0xd9030, - 0x3c18d6, 0x48b04e, 0x34779d, 0x14, - ], - CURVE_W: [ - [ - 0x34583, 0x712e93, 0x4fc443, 0x68b50b, 0x5fb911, 0x47fd2c, 0x7fff3d, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_SB: [ - [ - [ - 0x4b9564, 0x56411a, 0x4f3eab, 0x5da58c, 0x1010b, 0x47e30c, 0x7fff3d, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x6259ce, 0x79d12a, 0x4f9500, 0x1cbd96, 0x245bda, 0x344f21, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - [ - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x34583, 0x712e93, 0x4fc443, 0x68b50b, 0x5fb911, 0x47fd2c, 0x7fff3d, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - ], - CURVE_WB: [ - [ - 0x5a29f0, 0x66d56a, 0x305b6a, 0x2c1e98, 0x442c60, 0x42bf7f, 0x555514, 0x2aaaaa, 0x555555, - 0x2aaaaa, 0x555555, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x355d4b, 0x25744, 0x45fbac, 0x6bfc27, 0x20fc1f, 0x6bcb9e, 0x2778ae, 0x2c497d, 0x5ad40f, - 0x72c0c9, 0x4549d2, 0x29a8b1, 0x576bc3, 0x42cc1, 0x587bf8, 0x75c030, 0xd105, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, - ], - [ - 0x289aad, 0x7e700, 0x431f3c, 0x38c1f3, 0x282c11, 0x35ec57, 0x53bc57, 0x5624be, 0x6d6a07, - 0x396064, 0x62a4e9, 0x54d458, 0x6bb5e1, 0x21660, 0x2c3dfc, 0x7ae018, 0x6882, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, - ], - [ - 0x2279d1, 0x4be7f2, 0x2fd5d2, 0x210f19, 0x65745a, 0x42a55e, 0x555514, 0x2aaaaa, 0x555555, - 0x2aaaaa, 0x555555, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_BB: [ - [ - [ - 0x1bd810, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x1bd80f, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x1bd80f, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x6259cf, 0x79d12a, 0x4f9500, 0x1cbd96, 0x245bda, 0x344f21, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - [ - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7e31de, 0x747e6, 0xfd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x7e31dd, 0x747e6, 0xfd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x7e31de, 0x747e6, 0xfd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - [ - [ - 0x37b01e, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - [ - [ - 0x7e31df, 0x0747e6, 0x0fd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x2aa9af, 0x5ee3b2, 0x4f0f68, 0x11ae17, 0x45a3d4, 0x343500, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x37b01d, 0x1aed78, 0x008598, 0x0b0f7f, 0x5eb806, 0x001a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7e31df, 0x0747e6, 0x0fd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_FP512BN; -}; - -ROM_CURVE_BN254 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BN254 = { - // BN254 Curve - - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 2, - CURVE_B: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xd, 0x0, 0x10a100, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523, - ], - CURVE_Gx: [ - 0x12, 0x0, 0x13a700, 0x0, 0x210000, 0x861, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523, - ], - CURVE_Gy: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0x1, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0x3fb2b, 0x4224c8, 0xd91ee, 0x4898bf, 0x648bbb, 0xedb6a4, 0x7e8c61, 0xeb8d8c, 0x9eb62f, - 0x10bb51, 0x61a, - ], - CURVE_Pxb: [ - 0xd54cf3, 0x34c1e7, 0xb70d8c, 0xae3784, 0x4d746b, 0xaa5b1f, 0x8c5982, 0x310aa7, 0x737833, - 0xaaf9ba, 0x516, - ], - CURVE_Pya: [ - 0xcd2b9a, 0xe07891, 0xbd19f0, 0xbdbe09, 0xbd0ae6, 0x822329, 0x96698c, 0x9a90e0, 0xaf9343, - 0x97a06b, 0x218, - ], - CURVE_Pyb: [ - 0x3ace9b, 0x1aec6b, 0x578a2d, 0xd739c9, 0x9006ff, 0x8d37b0, 0x56f5f3, 0x8f6d44, 0x8b1526, - 0x2b0e7c, 0xebb, - ], - CURVE_W: [ - [0x3, 0x0, 0x20400, 0x0, 0x818000, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_SB: [ - [ - [0x4, 0x0, 0x28500, 0x0, 0x818000, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xa, 0x0, 0xe9d00, 0x0, 0x1e0000, 0x79e, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - ], - ], - CURVE_WB: [ - [0x0, 0x0, 0x4080, 0x0, 0x808000, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x5, 0x0, 0x54a80, 0x0, 0x70000, 0x1c7, 0x800000, 0x312241, 0x0, 0x0, 0x0], - [0x3, 0x0, 0x2c580, 0x0, 0x838000, 0xe3, 0xc00000, 0x189120, 0x0, 0x0, 0x0], - [0x1, 0x0, 0xc180, 0x0, 0x808000, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_BB: [ - [ - [0xd, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0x2, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xd, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - ], - [ - [0x2, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x2, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x2, 0x0, 0x10200, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xa, 0x0, 0x102000, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0x2, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BN254; -}; - -ROM_CURVE_BN254CX = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BN254CX = { - // BN254CX Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 2, - CURVE_B: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xeb1f6d, 0xc0a636, 0xcebe11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - CURVE_Gx: [ - 0x1b55b2, 0x23ef5c, 0xe1be66, 0x18093e, 0x3fd6ee, 0x66d324, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - CURVE_Gy: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0xc012b1, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0xd2ec74, 0x1ceee4, 0x26c085, 0xa03e27, 0x7c85bf, 0x4bbb90, 0xf5c3, 0x358b25, 0x53b256, - 0x2d2c70, 0x1968, - ], - CURVE_Pxb: [ - 0x29cfe1, 0x8e8b2e, 0xf47a5, 0xc209c3, 0x1b97b0, 0x9743f8, 0x37a8e9, 0xa011c9, 0x19f64a, - 0xb9ec3e, 0x1466, - ], - CURVE_Pya: [ - 0xbe09f, 0xfcebcf, 0xb30cfb, 0x847ec1, 0x61b33d, 0xe20963, 0x157dae, 0xd81e22, 0x332b8d, - 0xedd972, 0xa79, - ], - CURVE_Pyb: [ - 0x98ee9d, 0x4b2288, 0xebed90, 0x69d2ed, 0x864ea5, 0x3461c2, 0x512d8d, 0x35c6e4, 0xc4c090, - 0xc39ec, 0x616, - ], - - CURVE_W: [ - [0x2feb83, 0x634916, 0x120054, 0xb4038, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_SB: [ - [ - [0xb010e4, 0x63491d, 0x128054, 0xb4038, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0xbb33ea, 0x5d5d20, 0xbcbdbd, 0x188ce, 0x3fd6ee, 0x66d264, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - ], - ], - CURVE_WB: [ - [0x7a84b0, 0x211856, 0xb0401c, 0x3c012, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x220475, 0xf995be, 0x9a36cd, 0xa8ca7f, 0x7e94ed, 0x2a0dc0, 0x870, 0x300000, 0x0, 0x0, 0x0], - [0xf10b93, 0xfccae0, 0xcd3b66, 0xd4653f, 0x3f4a76, 0x1506e0, 0x438, 0x180000, 0x0, 0x0, 0x0], - [0xfaaa11, 0x21185d, 0xb0c01c, 0x3c012, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_BB: [ - [ - [ - 0x2b0cbd, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [0x802562, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbd, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - ], - [ - [0x802562, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0xc012b2, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x4ac2, 0xf, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x6afa0a, 0xc0a62f, 0xce3e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [0xc012b2, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BN254CX; -}; - -ROM_CURVE_BRAINPOOL = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - /* Note that the original curve has been transformed to an isomorphic curve with A=-3 */ - - var ROM_CURVE_BRAINPOOL = { - // Brainpool curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0xe92b04, 0x8101fe, 0x256ae5, 0xaf2f49, 0x93ebc4, 0x76b7bf, 0x733d0b, 0xfe66a7, 0xd84ea4, - 0x61c430, 0x662c, - ], - CURVE_Order: [ - 0x4856a7, 0xe8297, 0xf7901e, 0xb561a6, 0x397aa3, 0x8d718c, 0x909d83, 0x3e660a, 0xeea9bc, - 0x57dba1, 0xa9fb, - ], - CURVE_Gx: [ - 0x1305f4, 0x91562e, 0x2b79a1, 0x7aafbc, 0xa142c4, 0x6149af, 0xb23a65, 0x732213, 0xcfe7b7, - 0xeb3cc1, 0xa3e8, - ], - CURVE_Gy: [ - 0x25c9be, 0xe8f35b, 0x1dab, 0x39d027, 0xbcb6de, 0x417e69, 0xe14644, 0x7f7b22, 0x39c56d, - 0x6c8234, 0x2d99, - ], - CURVE_HTPC: [ - 0xbc7b16, 0x14bb03, 0x88ebbc, 0x2deae8, 0x4730d2, 0xfd9592, 0xdf0183, 0x737593, 0xc052e1, - 0xc79cf0, 0x6665, - ], - }; - return ROM_CURVE_BRAINPOOL; -}; - -ROM_CURVE_C25519 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C25519 = { - // C25519 Curve - - CURVE_Cof_I: 8, - CURVE_B_I: 0, - CURVE_B: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xf5d3ed, 0x631a5c, 0xd65812, 0xa2f79c, 0xdef9de, 0x14, 0x0, 0x0, 0x0, 0x0, 0x1000, - ], - CURVE_Gx: [0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [ - 0x7504f, 0xd93a5, 0x3c6277, 0x5697f2, 0xa18c03, 0xebd397, 0x4c9efd, 0x95a680, 0xe0ef85, - 0x924027, 0x55c1, - ], - }; - return ROM_CURVE_C25519; -}; - -ROM_CURVE_C41417 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C41417 = { - // C41417 curve - CURVE_Cof_I: 8, - CURVE_B_I: 3617, - CURVE_B: [ - 0xe21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_Order: [ - 0x6af79, 0x69784, 0x1b0e7, 0x18f3c6, 0x338ad, 0xdbc70, 0x6022b, 0x533dc, 0x3cc924, 0x3fffac, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x7fff, - ], - CURVE_Gx: [ - 0xbc595, 0x204bcf, 0xc4fd3, 0x14df19, 0x33faa8, 0x4c069, 0x16ba11, 0x2ad35b, 0x1498a4, - 0x15ffcd, 0x3ec7f, 0x27d130, 0xd4636, 0x9b97f, 0x631c3, 0x8630, 0x144330, 0x241450, 0x1a334, - ], - CURVE_Gy: [ - 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_HTPC: [ - 0x3fffee, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3ffff, - ], - }; - - return ROM_CURVE_C41417; -}; - -ROM_CURVE_C1174 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C1174 = { - // C1174 curve - CURVE_Cof_I: 4, - CURVE_Cof: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: -1174, - CURVE_B: [ - 0xfffb61, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - CURVE_Order: [ - 0x66c971, 0xd45fd1, 0x348944, 0xdfd307, 0x7965c4, 0xfffff7, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x1ff, - ], - CURVE_Gx: [ - 0xe29eda, 0x3f27bc, 0x651612, 0x492ecd, 0x21d96a, 0xa190c0, 0xe7c029, 0x9343ae, 0x308c47, - 0xbb0cea, 0x37f, - ], - CURVE_Gy: [ - 0x46360e, 0xb1bf9b, 0x6ba4cc, 0xaf3f97, 0xe2dee2, 0xe0c4f, 0x116984, 0x665684, 0x7fb7cc, - 0x2f82d4, 0x6b7, - ], - CURVE_HTPC: [ - 0xfffff6, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - }; - - return ROM_CURVE_C1174; -}; - -ROM_CURVE_C1665 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C1665 = { - // C1665 curve - CURVE_Cof_I: 4, - CURVE_Cof: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 5766, - CURVE_B: [0x1686, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [0x3a8b27, 0x61533b, 0x40603f, 0x7feaf7, 0x7fffff, 0x7fffff, 0x7fffff, 0x7], - CURVE_Gx: [0x552398, 0x73b7f3, 0x1b19c6, 0x7707b3, 0x1a0618, 0x20b701, 0x325369, 0xa], - CURVE_Gy: [0x120345, 0xf6489, 0x70b1c2, 0x1ceb16, 0x3bfc77, 0x378142, 0x505152, 0x14], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - }; - - return ROM_CURVE_C1665; -}; - -ROM_CURVE_MDC = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_MDC = { - // Million Dollar curve - CURVE_Cof_I: 4, - CURVE_Cof: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [ - 0xcf89, 0x92503, 0x41ee93, 0x3f21f0, 0x1270f6, 0xb9625f, 0xccfb0c, 0x7cdfbf, 0x65b68a, - 0x45219, 0x5713, - ], - CURVE_Order: [ - 0xb0f7fb, 0x52f421, 0xbb5885, 0xfaf974, 0xb38975, 0x7f534f, 0xbf75e9, 0x14cbe4, 0x15abed, - 0xda2e75, 0x3c4e, - ], - CURVE_Gx: [ - 0x68363b, 0x25bfee, 0xe2232c, 0x8d2713, 0xd72abb, 0xcf6350, 0x1e03cb, 0xd85b42, 0x903b83, - 0x886a7f, 0xb681, - ], - CURVE_Gy: [ - 0x2864b5, 0xc355bd, 0x3a7e73, 0x81a93a, 0xa8bc3d, 0xda421d, 0xcf6563, 0x59814d, 0x9c0b03, - 0x34e1b5, 0xca67, - ], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - }; - - return ROM_CURVE_MDC; -}; - -ROM_CURVE_ED25519 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_ED25519 = { - // ED25519 Curve - - CURVE_Cof_I: 8, - CURVE_B_I: 0, - CURVE_B: [ - 0x5978a3, 0x4dca13, 0xab75eb, 0x4141d8, 0x700a4d, 0xe89800, 0x797779, 0x8cc740, 0x6ffe73, - 0x6cee2b, 0x5203, - ], - CURVE_Order: [ - 0xf5d3ed, 0x631a5c, 0xd65812, 0xa2f79c, 0xdef9de, 0x14, 0x0, 0x0, 0x0, 0x0, 0x1000, - ], - CURVE_Gx: [ - 0x25d51a, 0x2d608f, 0xb2c956, 0x9525a7, 0x2cc760, 0xdc5c69, 0x31fdd6, 0xc0a4e2, 0x6e53fe, - 0x36d3cd, 0x2169, - ], - CURVE_Gy: [ - 0x666658, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, - 0x666666, 0x6666, - ], - CURVE_HTPC: [ - 0x7504f, 0xd93a5, 0x3c6277, 0x5697f2, 0xa18c03, 0xebd397, 0x4c9efd, 0x95a680, 0xe0ef85, - 0x924027, 0x55c1, - ], - }; - return ROM_CURVE_ED25519; -}; - -ROM_CURVE_GOLDILOCKS = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_GOLDILOCKS = { - // GOLDILOCKS curve - CURVE_Cof_I: 4, - CURVE_B_I: -39081, - CURVE_B: [ - 0x7f6756, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - CURVE_Order: [ - 0x5844f3, 0x52556, 0x548de3, 0x6e2c7a, 0x4c2728, 0x52042d, 0x6bb58d, 0x276da4, 0x23e9c4, - 0x7ef994, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x1ff, - ], - CURVE_Gx: [ - 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, - 0x52aaaa, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, - 0x2aaaaa, 0x555, - ], - CURVE_Gy: [ - 0x1386ed, 0x779bd5, 0x2f6bab, 0xe6d03, 0x4b2bed, 0x131777, 0x4e8a8c, 0x32b2c1, 0x44b80d, - 0x6515b1, 0x5f8db5, 0x426ebd, 0x7a0358, 0x6dda, 0x21b0ac, 0x6b1028, 0xdb359, 0x15ae09, - 0x17a58d, 0x570, - ], - CURVE_HTPC: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - }; - return ROM_CURVE_GOLDILOCKS; -}; - -ROM_CURVE_X448 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_X448 = { - // X448 curve - CURVE_Cof_I: 4, - CURVE_Cof: [ - 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_B_I: 0, - CURVE_B: [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_Order: [ - 0x5844f3, 0x52556, 0x548de3, 0x6e2c7a, 0x4c2728, 0x52042d, 0x6bb58d, 0x276da4, 0x23e9c4, - 0x7ef994, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x1ff, - ], - CURVE_Gx: [ - 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_Gy: [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_HTPC: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - }; - return ROM_CURVE_X448; -}; - -ROM_CURVE_HIFIVE = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_HIFIVE = { - // HIFIVE curve - - CURVE_Cof_I: 8, - CURVE_B_I: 11111, - CURVE_B: [0x2b67, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x1fa805, 0x2b2e7d, 0x29ecbe, 0x3fc9dd, 0xbd6b8, 0x530a18, 0x45057e, 0x3, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x800, - ], - CURVE_Gx: [0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [ - 0x7e8632, 0xd0a0b, 0x6c4afb, 0x501b2e, 0x55650c, 0x36db6b, 0x1fbd0d, 0x61c08e, 0x314b46, - 0x70a7a3, 0x587401, 0xc70e0, 0x56502e, 0x38c2d6, 0x303, - ], - CURVE_HTPC: [ - 0x531622, 0x37d80a, 0x3928ff, 0x1b054e, 0x35d63a, 0x6a25b3, 0x406ae8, 0x278495, 0x339df0, - 0x2ac208, 0xe9a97, 0x1fb80f, 0x70856c, 0x3c1fc, 0xd8, - ], - }; - return ROM_CURVE_HIFIVE; -}; - -ROM_CURVE_NIST256 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NIST256 = { - // NIST256 Curve - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0xd2604b, 0x3c3e27, 0xf63bce, 0xcc53b0, 0x1d06b0, 0x86bc65, 0x557698, 0xb3ebbd, 0x3a93e7, - 0x35d8aa, 0x5ac6, - ], - CURVE_Order: [ - 0x632551, 0xcac2fc, 0x84f3b9, 0xa7179e, 0xe6faad, 0xffffbc, 0xffffff, 0xffffff, 0x0, 0xffff00, - 0xffff, - ], - CURVE_Gx: [ - 0x98c296, 0x3945d8, 0xa0f4a1, 0x2deb33, 0x37d81, 0x40f277, 0xe563a4, 0xf8bce6, 0x2c4247, - 0xd1f2e1, 0x6b17, - ], - CURVE_Gy: [ - 0xbf51f5, 0x406837, 0xcecbb6, 0x6b315e, 0xce3357, 0x9e162b, 0x4a7c0f, 0x8ee7eb, 0x1a7f9b, - 0x42e2fe, 0x4fe3, - ], - CURVE_HTPC: [ - 0x613926, 0x47959c, 0xd42eb8, 0x452a9d, 0x3eb001, 0x55548d, 0x8f44a6, 0x5240b3, 0x3723a4, - 0xd82cb6, 0x6a2a, - ], - }; - return ROM_CURVE_NIST256; -}; - -ROM_CURVE_SM2 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_SM2 = { - // SM2 Curve - - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [ - 0x940e93, 0xbd414d, 0x92ddbc, 0x15ab8f, 0x9789f5, 0x9a7f3, 0x4bcf65, 0x4d5a9e, 0x9f5e34, - 0xfa9e9d, 0x28e9, - ], - CURVE_Order: [ - 0xd54123, 0xf40939, 0x2b53bb, 0x21c605, 0x3df6b, 0xffff72, 0xffffff, 0xffffff, 0xffffff, - 0xfffeff, 0xffff, - ], - CURVE_Gx: [ - 0x4c74c7, 0x458933, 0xe1715a, 0xf2660b, 0xe30bbf, 0xc9948f, 0x466a39, 0x5f9904, 0x198119, - 0xae2c1f, 0x32c4, - ], - CURVE_Gy: [ - 0x39f0a0, 0x32e521, 0x4002df, 0xc62a47, 0xa9877c, 0x2153d0, 0xe36b69, 0x59bdce, 0xf6779c, - 0x36a2f4, 0xbc37, - ], - CURVE_HTPC: [ - 0xffffff, 0xffffff, 0x55ffff, 0x555555, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xaaa9ff, 0xaaaa, - ], - }; - return ROM_CURVE_SM2; -}; - -ROM_CURVE_NIST384 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NIST384 = { - // NIST384 curve - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0x6c2aef, 0x11dba7, 0x74aa17, 0x51768c, 0x6398d8, 0x6b58ca, 0x5404e1, 0xa0447, 0x411203, - 0x5dfd02, 0x607671, 0x4168c8, 0x56be3f, 0x1311c0, 0xfb9f9, 0x17d3f1, 0xb331, - ], - CURVE_Order: [ - 0x452973, 0x32d599, 0x6bb3b0, 0x45853b, 0x20db24, 0x3beb03, 0x7d0dcb, 0x31a6c0, 0x7fffc7, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Gx: [ - 0x760ab7, 0x3c70e4, 0x30e951, 0x7aa94b, 0x2f25db, 0x470aa0, 0x20950a, 0x7ba0f0, 0x1b9859, - 0x45174f, 0x3874ed, 0x56ba3, 0x71ef32, 0x71d638, 0x22c14d, 0x65115f, 0xaa87, - ], - CURVE_Gy: [ - 0x6a0e5f, 0x3af921, 0x75e90c, 0x6bf40c, 0xb1ce1, 0x18014c, 0x6d7c2e, 0x6d1889, 0x147ce9, - 0x7a5134, 0x63d076, 0x16e14f, 0xbf929, 0x6bb3d3, 0x98b1b, 0x6f254b, 0x3617, - ], - CURVE_HTPC: [ - 0x5cd21b, 0x589a81, 0x4cf909, 0x3aa056, 0x42d2a8, 0x7dda0a, 0x421117, 0x2fb357, 0x63b4bd, - 0x6a06e8, 0x225e, 0x43e017, 0x3feca5, 0x97ad4, 0x5c5492, 0x787911, 0xbc6e, - ], - }; - return ROM_CURVE_NIST384; -}; - -ROM_CURVE_NIST521 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NIST521 = { - // NIST521 curve - - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0x503f00, 0x3fa8d6, 0x47bd14, 0x6961a7, 0x3df883, 0x60e6ae, 0x4eec6f, 0x29605e, 0x137b16, - 0x23d8fd, 0x5864e5, 0x84f0a, 0x1918ef, 0x771691, 0x6cc57c, 0x392dcc, 0x6ea2da, 0x6d0a81, - 0x688682, 0x50fc94, 0x18e1c9, 0x27d72c, 0x1465, - ], - CURVE_Order: [ - 0x386409, 0x6e3d22, 0x3aedbe, 0x4ce23d, 0x5c9b88, 0x3a0776, 0x3dc269, 0x6600a4, 0x166b7f, - 0x77e5f, 0x461a1e, 0x7fffd2, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - CURVE_Gx: [ - 0x65bd66, 0x7c6385, 0x6fe5f9, 0x2b5214, 0xb3c18, 0x1bc669, 0x68bfea, 0xee093, 0x5928fe, - 0x6fdfce, 0x52d79, 0x69edd5, 0x7606b4, 0x3f0515, 0x4fed48, 0x409c82, 0x429c64, 0x472b68, - 0x7b2d98, 0x4e6cf1, 0x70404e, 0x31c0d6, 0x31a1, - ], - CURVE_Gy: [ - 0x516650, 0x28ed3f, 0x222fa, 0x139612, 0x47086a, 0x6c26a7, 0x4feb41, 0x285c80, 0x2640c5, - 0x32bde8, 0x5fb9ca, 0x733164, 0x517273, 0x2f5f7, 0x66d11a, 0x2224ab, 0x5998f5, 0x58fa37, - 0x297ed0, 0x22e4, 0x9a3bc, 0x252d4f, 0x460e, - ], - CURVE_HTPC: [ - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3fff, - ], - }; - return ROM_CURVE_NIST521; -}; - -ROM_CURVE_NUMS256E = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS256E = { - // NUMS256E Curve - CURVE_Cof_I: 4, - CURVE_B_I: -15342, - CURVE_B: [ - 0xffc355, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - CURVE_Order: [ - 0xdd4af5, 0xb190ee, 0x9b1a47, 0x2f5943, 0x955aa5, 0x41, 0x0, 0x0, 0x0, 0x0, 0x4000, - ], - CURVE_Gx: [ - 0xed13da, 0xc0902e, 0x86a0de, 0xe30835, 0x398a0e, 0x9bd60c, 0x5f6920, 0xcd1e3d, 0xea237d, - 0x14fb6a, 0x8a75, - ], - CURVE_Gy: [ - 0x8a89e6, 0x16e779, 0xd32fa6, 0x10856e, 0x5f61d8, 0x801071, 0xd9a64b, 0xce9665, 0xd925c7, - 0x3e9fd9, 0x44d5, - ], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - }; - return ROM_CURVE_NUMS256E; -}; - -ROM_CURVE_NUMS256W = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS256W = { - // NUMS256W Curve - CURVE_Cof_I: 1, - CURVE_B_I: 152961, - CURVE_B: [0x25581, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x51a825, 0x202947, 0x6020ab, 0xea265c, 0x3c8275, 0xffffe4, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - CURVE_Gx: [ - 0x1aacb1, 0xee1eb2, 0x3abc52, 0x3d4c7, 0x579b09, 0xcb0983, 0xa04f42, 0x297a95, 0xaadb61, - 0xd6b65a, 0xbc9e, - ], - CURVE_Gy: [ - 0x84de9f, 0xb9cb21, 0xbb80b5, 0x15310f, 0x55c3d1, 0xe035c9, 0xf77e04, 0x73448b, 0x99b6a6, - 0xc0f133, 0xd08f, - ], - CURVE_HTPC: [ - 0x2b84d6, 0x6f7595, 0x9e05fc, 0x2040e8, 0x4092c6, 0xc6ae46, 0x70cadd, 0xb22ed0, 0x11e3b5, - 0x44e454, 0xcf7f, - ], - }; - return ROM_CURVE_NUMS256W; -}; - -ROM_CURVE_NUMS384E = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS384E = { - // NUMS384E Curve - CURVE_Cof_I: 4, - CURVE_B_I: -11556, - CURVE_B: [ - 0x7fd19f, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Order: [ - 0x23897d, 0x3989cd, 0x6482e7, 0x59ae43, 0x4555aa, 0x39ec3c, 0x2d1af8, 0x238d0e, 0x7fffe2, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3fff, - ], - CURVE_Gx: [ - 0x206bde, 0x1c8d8, 0x4d4355, 0x2a2ca0, 0x292b16, 0x680dfe, 0x3ccc58, 0x31ffd4, 0x4c0057, - 0xdcb7c, 0x4c2fd1, 0x2aedad, 0x2129ae, 0x1816d4, 0x6a499b, 0x8fda2, 0x61b1, - ], - CURVE_Gy: [ - 0x729392, 0x7c3e0, 0x727634, 0x376246, 0x2b0f94, 0x49600e, 0x7d9165, 0x7cc7b, 0x5f5683, - 0x69e284, 0x5ab609, 0x86eb8, 0x1a423b, 0x10e716, 0x69bbac, 0x1f33dc, 0x8298, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - }; - return ROM_CURVE_NUMS384E; -}; - -ROM_CURVE_NUMS384W = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS384W = { - // NUMS384W Curve - CURVE_Cof_I: 1, - CURVE_B_I: -34568, - CURVE_B: [ - 0x7f77bb, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Order: [ - 0xe61b9, 0x3ecf6, 0x698136, 0x61bf13, 0x29d3d4, 0x1037db, 0x3ad75a, 0xf578f, 0x7fffd6, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Gx: [ - 0x18152a, 0x740841, 0x6fae72, 0x7b0e23, 0x6ed100, 0x684a45, 0x4a9b31, 0x5e948d, 0x79f4f3, - 0x1bf703, 0x89707, 0x2f8d30, 0x222410, 0x91019, 0x5bc607, 0x2b7858, 0x7579, - ], - CURVE_Gy: [ - 0x180716, 0x71d8cc, 0x1971d2, 0x7fa569, 0x6b4dbb, 0x6fd79a, 0x4486a0, 0x1041be, 0x739cb9, - 0x6ff0fe, 0x4011a5, 0x267bf5, 0x530058, 0x1afc67, 0x66e38e, 0x71b470, 0xacde, - ], - CURVE_HTPC: [ - 0x7fff61, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - }; - return ROM_CURVE_NUMS384W; -}; - -ROM_CURVE_NUMS512E = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS512E = { - // NUMS512E Curve - CURVE_Cof_I: 4, - CURVE_B_I: -78296, - CURVE_B: [ - 0x7ecbef, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CURVE_Order: [ - 0x6ed46d, 0x19ea37, 0x7d9d1a, 0x6f7f67, 0x605786, 0x5ea548, 0x5c2da1, 0x1fec64, 0x11ba9e, - 0x5a5f9f, 0x53c18d, 0x7ffffd, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xf, - ], - CURVE_Gx: [ - 0x6c57fe, 0x565333, 0x5716e6, 0x662780, 0x525427, 0x15a1fc, 0x15a241, 0x5ee4c9, 0x730f78, - 0x1ddc8c, 0x188705, 0x5c0a3a, 0x6be273, 0x44f42f, 0x7128e0, 0x73cfa6, 0x332fd1, 0x11a78a, - 0x632de2, 0x34e3d0, 0x5128db, 0x71c62d, 0x37, - ], - CURVE_Gy: [ - 0x62f5e1, 0x3d8183, 0x7cc9b7, 0x5f8e80, 0x6d38a9, 0x3fa04c, 0xabb30, 0xd0343, 0x356260, - 0x65d32c, 0x3294f, 0x741a09, 0x395909, 0x55256d, 0x96748, 0x7b936c, 0x6ee476, 0x50544a, - 0x43d5de, 0x538cc5, 0x39d49c, 0x2137fe, 0x1b, - ], - CURVE_HTPC: [ - 0x7ffdc6, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - }; - return ROM_CURVE_NUMS512E; -}; - -ROM_CURVE_NUMS512W = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS512W = { - // NUMS512W Curve - CURVE_Cof_I: 1, - CURVE_B_I: 121243, - CURVE_B: [ - 0x1d99b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x33555d, 0x7e7208, 0xf3854, 0x3e692, 0x68b366, 0x38c76a, 0x65f42f, 0x612c76, 0x31b4f, - 0x7729cf, 0x6cf293, 0x7ffffa, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CURVE_Gx: [ - 0x2bae57, 0xf2b19, 0xb720a, 0x6b7aef, 0x560137, 0x3063ab, 0x95585, 0x3ca143, 0x359e93, - 0x220ed6, 0x408685, 0x36cfca, 0xc2530, 0x28a0dc, 0x407da1, 0x6c1dda, 0x5298ca, 0x407a76, - 0x2dc00a, 0x549ed1, 0x7141d0, 0x580688, 0xe, - ], - CURVE_Gy: [ - 0x3527a6, 0xec070, 0x248e82, 0x67e87f, 0x35c1e4, 0x4059e5, 0x2c9695, 0x10d420, 0x6de9c1, - 0x35161d, 0xa1057, 0xa78a5, 0x60c7bd, 0x11e964, 0x6f2ee3, 0x6def55, 0x4b97, 0x47d762, - 0x3bbb71, 0x359e70, 0x229ad5, 0x74a99, 0x25, - ], - CURVE_HTPC: [ - 0x7ffee3, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x1f, - ], - }; - return ROM_CURVE_NUMS512W; -}; - -ROM_CURVE_SECP256K1 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_SECP256K1 = { - // SECP256K1 Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 7, - CURVE_B: [0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x364141, 0x5e8cd0, 0x3bbfd2, 0xaf48a0, 0xaedce6, 0xfffeba, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - CURVE_Gx: [ - 0xf81798, 0x815b16, 0xd959f2, 0x2dce28, 0x9bfcdb, 0xb0702, 0x95ce87, 0x55a062, 0xdcbbac, - 0x667ef9, 0x79be, - ], - CURVE_Gy: [ - 0x10d4b8, 0xd08ffb, 0x199c47, 0xa68554, 0x17b448, 0x8a8fd, 0xfc0e11, 0x5da4fb, 0xa3c465, - 0xda7726, 0x483a, - ], - CURVE_HTPC: [ - 0x8624aa, 0x13789e, 0x8ecdc8, 0xc23f50, 0xfdca45, 0xcd8bbb, 0x640a39, 0xf4d5b4, 0x3ffe30, - 0xe9e881, 0xcce8, - ], - - CURVE_Ad: [ - 0x444533, 0x47c01a, 0x5d4054, 0xcb6f0e, 0x53d363, 0xd272e9, 0x58f0f5, 0xa08a55, 0x661adc, - 0x31abdd, 0x3f87, - ], - CURVE_Bd: [0x6eb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - PC: [ - [ - 0xaaa88c, 0xe38daa, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, - 0xe38e38, 0x8e38, - ], - [ - 0x9dd262, 0xd0b53d, 0x314ecb, 0x37c40, 0x506144, 0xcaece4, 0xdeca25, 0xe2a413, 0xf234e6, - 0x328d23, 0x534c, - ], - [ - 0x7c6581, 0x1044f1, 0x92dfff, 0xbf63b, 0x95d2fc, 0x44c5d5, 0xcea7fd, 0xb9f315, 0xc321d5, - 0xd4c80b, 0x7d3, - ], - [ - 0xaaa8c7, 0xe38daa, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, - 0xe38e38, 0x8e38, - ], - [ - 0x8c6d14, 0x56612a, 0xbbc52a, 0x1f5e41, 0xd36b64, 0x225406, 0xd51b54, 0xf7c4b2, 0x83dc1d, - 0xc6f643, 0xedad, - ], - [ - 0x1eb49b, 0xb74578, 0x7d9fe6, 0x42f848, 0xcd4095, 0x40dd86, 0xcbb7b6, 0x9ca34c, 0x94918a, - 0x71193d, 0xd357, - ], - [ - 0xe38d84, 0xa12f38, 0xf684bd, 0x4bda12, 0xa12f68, 0xf684bd, 0x4bda12, 0xa12f68, 0xf684bd, - 0x4bda12, 0x2f68, - ], - [ - 0xcee931, 0xe85a9e, 0x18a765, 0x1be20, 0x2830a2, 0xe57672, 0xef6512, 0x715209, 0xf91a73, - 0x194691, 0x29a6, - ], - [ - 0x1d71a3, 0x90fc20, 0x6fdffc, 0xd686da, 0x7ab046, 0xa6d564, 0x4b12a0, 0xa9d0a5, 0xcb7c0f, - 0xc32d5, 0xc75e, - ], - [ - 0x38e23c, 0x684b8e, 0xbda12f, 0x12f684, 0x684bda, 0xbda12f, 0x12f684, 0x684bda, 0xbda12f, - 0x12f684, 0x4bda, - ], - [ - 0xd2a76f, 0x8192bf, 0x99a7bf, 0x2f0d62, 0x3d2116, 0x337e0a, 0x3fa8fe, 0xf3a70c, 0x45ca2c, - 0xaa7165, 0x6484, - ], - [ - 0x5c2573, 0x25d268, 0x78dfb4, 0xc8e8d9, 0x67c1bf, 0xc29894, 0x632722, 0xd5e9e6, 0xbdb49f, - 0x534bb8, 0x7a06, - ], - [ - 0xfff93b, 0xfffeff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - ], - }; - return ROM_CURVE_SECP256K1; -}; - -ROM_CURVE_SECP160R1 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_SECP160R1 = { - // SECP160R1 Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [0x65fa45, 0xd4adc5, 0x9f81d4, 0x65acf8, 0xbd7a8b, 0xbefc54, 0x1c97], - CURVE_Order: [0x752257, 0xaed3ca, 0xc8f927, 0x1f4, 0x0, 0x0, 0x10000], - CURVE_Gx: [0xcbfc82, 0x8bb913, 0x8968c3, 0x466469, 0xf57328, 0xb5688e, 0x4a96], - CURVE_Gy: [0xc5fb32, 0x51377a, 0x120423, 0x59dcc9, 0x68947d, 0x285531, 0x23a6], - CURVE_HTPC: [0x5bc0da, 0xfaf3a2, 0x7305da, 0xface6a, 0x5a6106, 0xbd02cd, 0x1e50], - }; - return ROM_CURVE_SECP160R1; -}; - -ROM_CURVE_JUBJUB = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_JUBJUB = { - // JUBJUB Curve - // Base Bits= 24 - - CURVE_Cof_I: 8, - CURVE_Cof: [0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [ - 0x343eb1, 0x5fd6d6, 0x260106, 0x37579d, 0x2d7f6d, 0x7fd429, 0x7e6bd, 0xf5fd92, 0xfa2b48, - 0x18e74b, 0x2a93, - ], - CURVE_Order: [ - 0xf72cb7, 0xe5ed6, 0x82d097, 0xccc810, 0x682093, 0x3b00a6, 0x10134, 0x6673b, 0x33afa9, - 0xb4ea65, 0xe7d, - ], - CURVE_Gx: [ - 0xf976c4, 0xcf1a74, 0xde7f4e, 0xf2f39e, 0xc546b, 0x488200, 0xdf0038, 0xa624b4, 0xeff38c, - 0x972af8, 0x5183, - ], - CURVE_Gy: [ - 0x49702e, 0xad7093, 0x3b146b, 0xffa683, 0x6c8707, 0xc30809, 0x5abd9d, 0x9e8fcc, 0xa2fc2c, - 0xf8472c, 0x3b43, - ], - CURVE_HTPC: [ - 0x7bbbb6, 0xaef9e4, 0xa9907, 0x517532, 0x5dff51, 0xd546e2, 0xcb473c, 0x3e3ee, 0x37b1d4, - 0x68b42b, 0x62fd, - ], - }; - return ROM_CURVE_JUBJUB; -}; - -ROM_CURVE_C13318 = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_C13318 = { - // C13318 Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 13318, - CURVE_B: [0x3406, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xc2cbe3, 0x12dc4d, 0x16eb7d, 0x3deb8d, 0xf654f8, 0xf4, 0x0, 0x0, 0x0, 0x0, 0x8000, - ], - CURVE_Gx: [0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [ - 0x6ead0b, 0xd3546b, 0xb5b8c8, 0xcf016d, 0x4ccb04, 0x66369d, 0xe51669, 0x381630, 0xbca6f1, - 0xaad926, 0x6675, - ], - CURVE_HTPC: [ - 0x7504f, 0xd93a5, 0x3c6277, 0x5697f2, 0xa18c03, 0xebd397, 0x4c9efd, 0x95a680, 0xe0ef85, - 0x924027, 0x55c1, - ], - }; - return ROM_CURVE_C13318; -}; - -ROM_CURVE_TWEEDLEDUM = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_TWEEDLEDUM = { - //*** rom curve parameters ***** - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 5, - CURVE_B: [0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [0x1, 0xafd400, 0xc9842c, 0x696286, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gx: [0x0, 0x64e200, 0xb9a140, 0x6c3f59, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [ - 0x381795, 0x755341, 0xc366d6, 0xd03cfb, 0x10aeeb, 0xbaa53e, 0x8b6caa, 0xef14d8, 0x20bf4, - 0x6cf337, 0x3ab4, - ], - }; - return ROM_CURVE_TWEEDLEDUM; -}; - -ROM_CURVE_TWEEDLEDEE = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_TWEEDLEDEE = { - //*** rom curve parameters ***** - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 5, - CURVE_B: [0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [0x1, 0x64e200, 0xb9a140, 0x6c3f59, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gx: [0x0, 0xafd400, 0xc9842c, 0x696286, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [ - 0x69c848, 0x1cbdad, 0x873386, 0x672ef6, 0xac0754, 0xe9704, 0xe5bc1a, 0x82c6a2, 0x649720, - 0x88de2a, 0x3ac1, - ], - }; - return ROM_CURVE_TWEEDLEDEE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - ROM_CURVE_ANSSI: ROM_CURVE_ANSSI, - ROM_CURVE_BLS12383: ROM_CURVE_BLS12383, - ROM_CURVE_BLS24479: ROM_CURVE_BLS24479, - ROM_CURVE_BLS48556: ROM_CURVE_BLS48556, - ROM_CURVE_BLS48286: ROM_CURVE_BLS48286, - ROM_CURVE_BLS48581: ROM_CURVE_BLS48581, - ROM_CURVE_BLS12381: ROM_CURVE_BLS12381, - ROM_CURVE_BLS12461: ROM_CURVE_BLS12461, - ROM_CURVE_BN462: ROM_CURVE_BN462, - ROM_CURVE_FP256BN: ROM_CURVE_FP256BN, - ROM_CURVE_FP512BN: ROM_CURVE_FP512BN, - ROM_CURVE_BN254: ROM_CURVE_BN254, - ROM_CURVE_BN254CX: ROM_CURVE_BN254CX, - ROM_CURVE_BRAINPOOL: ROM_CURVE_BRAINPOOL, - ROM_CURVE_C25519: ROM_CURVE_C25519, - ROM_CURVE_C41417: ROM_CURVE_C41417, - ROM_CURVE_C1174: ROM_CURVE_C1174, - ROM_CURVE_C1665: ROM_CURVE_C1665, - ROM_CURVE_MDC: ROM_CURVE_MDC, - ROM_CURVE_ED25519: ROM_CURVE_ED25519, - ROM_CURVE_GOLDILOCKS: ROM_CURVE_GOLDILOCKS, - ROM_CURVE_X448: ROM_CURVE_X448, - ROM_CURVE_HIFIVE: ROM_CURVE_HIFIVE, - ROM_CURVE_NIST256: ROM_CURVE_NIST256, - ROM_CURVE_NIST384: ROM_CURVE_NIST384, - ROM_CURVE_NIST521: ROM_CURVE_NIST521, - ROM_CURVE_NUMS256E: ROM_CURVE_NUMS256E, - ROM_CURVE_NUMS256W: ROM_CURVE_NUMS256W, - ROM_CURVE_NUMS384E: ROM_CURVE_NUMS384E, - ROM_CURVE_NUMS384W: ROM_CURVE_NUMS384W, - ROM_CURVE_NUMS512E: ROM_CURVE_NUMS512E, - ROM_CURVE_NUMS512W: ROM_CURVE_NUMS512W, - ROM_CURVE_SECP256K1: ROM_CURVE_SECP256K1, - ROM_CURVE_SECP160R1: ROM_CURVE_SECP160R1, - ROM_CURVE_SM2: ROM_CURVE_SM2, - ROM_CURVE_C13318: ROM_CURVE_C13318, - ROM_CURVE_JUBJUB: ROM_CURVE_JUBJUB, - ROM_CURVE_TWEEDLEDEE: ROM_CURVE_TWEEDLEDEE, - ROM_CURVE_TWEEDLEDUM: ROM_CURVE_TWEEDLEDUM, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rom_field.js b/packages/bls-verify/src/vendor/amcl-js/src/rom_field.js deleted file mode 100644 index 2a221a701..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rom_field.js +++ /dev/null @@ -1,1101 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Fixed Data in ROM - Field and Curve parameters */ - -var ROM_FIELD_25519, - ROM_FIELD_256PM, - ROM_FIELD_384PM, - ROM_FIELD_512PM, - ROM_FIELD_ANSSI, - ROM_FIELD_BLS12383, - ROM_FIELD_BLS24479, - ROM_FIELD_BLS48556, - ROM_FIELD_BLS48286, - ROM_FIELD_BLS48581, - ROM_FIELD_BLS12381, - ROM_FIELD_BLS12461, - ROM_FIELD_BN462, - ROM_FIELD_FP256BN, - ROM_FIELD_FP512BN, - ROM_FIELD_BN254, - ROM_FIELD_BN254CX, - ROM_FIELD_BRAINPOOL, - ROM_FIELD_C41417, - ROM_FIELD_C1174, - ROM_FIELD_C1665, - ROM_FIELD_MDC, - ROM_FIELD_GOLDILOCKS, - ROM_FIELD_HIFIVE, - ROM_FIELD_NIST256, - ROM_FIELD_NIST384, - ROM_FIELD_NIST521, - ROM_FIELD_SECP256K1, - ROM_FIELD_SECP160R1, - ROM_FIELD_SM2, - ROM_FIELD_JUBJUB, - ROM_FIELD_TWEEDLEDUM, - ROM_FIELD_TWEEDLEDEE; - -ROM_FIELD_25519 = function () { - 'use strict'; - - var ROM_FIELD_25519 = { - // 25519 Curve Modulus - Modulus: [ - 0xffffed, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7fff, - ], - ROI: [ - 0xea0b0, 0x1b274a, 0x78c4ee, 0xad2fe4, 0x431806, 0xd7a72f, 0x993dfb, 0x2b4d00, 0xc1df0b, - 0x24804f, 0x2b83, - ], - R2modp: [0xa40000, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0x13, - }; - return ROM_FIELD_25519; -}; - -ROM_FIELD_256PM = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_256PM = { - // NUMS256 Curve Modulus - // Base Bits= 24 - Modulus: [ - 0xffff43, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - ROI: [ - 0xffff42, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - R2modp: [0x890000, 0x8b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0xbd, - }; - return ROM_FIELD_256PM; -}; - -ROM_FIELD_384PM = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_384PM = { - // NUMS384 Curve Modulus - // Base Bits= 23 - Modulus: [ - 0x7ffec3, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - ROI: [ - 0x7ffec2, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - R2modp: [ - 0x224000, 0xc4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x13d, - }; - return ROM_FIELD_384PM; -}; - -ROM_FIELD_512PM = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_512PM = { - // NUMS512 Curve Modulus - // Base Bits= 23 - Modulus: [ - 0x7ffdc7, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ROI: [ - 0x7ffdc6, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - R2modp: [ - 0x0, 0x58800, 0x4f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x239, - }; - return ROM_FIELD_512PM; -}; - -ROM_FIELD_ANSSI = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_ANSSI = { - // ANSSI modulus - // Base Bits= 24 - Modulus: [ - 0x6e9c03, 0xf353d8, 0x6de8fc, 0xabc8ca, 0x61adbc, 0x435b39, 0xe8ce42, 0x10126d, 0x3ad58f, - 0x178c0b, 0xf1fd, - ], - ROI: [ - 0x6e9c02, 0xf353d8, 0x6de8fc, 0xabc8ca, 0x61adbc, 0x435b39, 0xe8ce42, 0x10126d, 0x3ad58f, - 0x178c0b, 0xf1fd, - ], - R2modp: [ - 0xacece3, 0x924166, 0xb10fce, 0x6cfbb6, 0x87ec2, 0x3de43d, 0xd2cf67, 0xa67dde, 0xad30f2, - 0xbcaae, 0xdf98, - ], - MConst: 0x4e1155, - }; - return ROM_FIELD_ANSSI; -}; - -ROM_FIELD_BLS12383 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS12383 = { - // BLS12383 Modulus - // Base Bits= 23 - Modulus: [ - 0x2ab0ab, 0x3ac90b, 0x2f68dc, 0x532429, 0x43f298, 0x1e8f51, 0x5a5849, 0x18dc00, 0x2511ac, - 0x59e6cb, 0x2b518, 0x549425, 0x5c41fe, 0x340db5, 0x2adbad, 0x2b4ab2, 0x5565, - ], - ROI: [ - 0x2ab0aa, 0x3ac90b, 0x2f68dc, 0x532429, 0x43f298, 0x1e8f51, 0x5a5849, 0x18dc00, 0x2511ac, - 0x59e6cb, 0x2b518, 0x549425, 0x5c41fe, 0x340db5, 0x2adbad, 0x2b4ab2, 0x5565, - ], - R2modp: [ - 0x250a44, 0x68f66f, 0xe3c74, 0x791772, 0x3525e3, 0xe1e15, 0x356616, 0x54f624, 0x508069, - 0x272663, 0x4a4cb0, 0x359293, 0x5b6573, 0x9f27f, 0x5ea3b4, 0x60fd2d, 0x5167, - ], - MConst: 0x3435fd, - SQRTm3: [ - 0x2ad4a8, 0x6277af, 0x677d3e, 0x5ad233, 0x7add9b, 0x31dfb7, 0x401708, 0x395349, 0x3da818, - 0x7988aa, 0x7fed10, 0x3ff320, 0xc3ede, 0x7403b5, 0x2adbac, 0x2b4ab2, 0x5565, - ], - CRu: [ - 0x2ac2a9, 0x4ea05d, 0x4b730d, 0x16fb2e, 0x5f681a, 0x683784, 0xd37a8, 0x2917a5, 0x715ce2, - 0x69b7ba, 0x15114, 0x4a43a3, 0x34406e, 0x1408b5, 0x2adbad, 0x2b4ab2, 0x5565, - ], - Fra: [ - 0x11dac1, 0x2e5a66, 0x614b, 0x733b9f, 0x13480f, 0x19146d, 0x395436, 0x2b3a25, 0x1a8682, - 0x247f74, 0x3931b3, 0x5a9788, 0x7c2c11, 0x67173, 0x1fda2f, 0x6adf81, 0x22ac, - ], - Frb: [ - 0x18d5ea, 0xc6ea5, 0x2f0791, 0x5fe88a, 0x30aa88, 0x57ae4, 0x210413, 0x6da1db, 0xa8b29, - 0x356757, 0x498365, 0x79fc9c, 0x6015ec, 0x2d9c41, 0xb017e, 0x406b31, 0x32b8, - ], - }; - - return ROM_FIELD_BLS12383; -}; - -ROM_FIELD_BLS24479 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS24479 = { - // BLS24479 Modulus - // Base Bits= 23 - - Modulus: [ - 0x6152b, 0x2ce94, 0x6be113, 0x416986, 0x2ffe2e, 0x36d4c8, 0x47172f, 0x1945b7, 0x5f068a, - 0xe6441, 0x110186, 0x4f0f9, 0x33568e, 0x4a0f2e, 0x306ea0, 0x173bf2, 0x6e803f, 0x735d8, - 0x3316ea, 0x3c01e, 0x555c0, - ], - ROI: [ - 0x6152a, 0x2ce94, 0x6be113, 0x416986, 0x2ffe2e, 0x36d4c8, 0x47172f, 0x1945b7, 0x5f068a, - 0xe6441, 0x110186, 0x4f0f9, 0x33568e, 0x4a0f2e, 0x306ea0, 0x173bf2, 0x6e803f, 0x735d8, - 0x3316ea, 0x3c01e, 0x555c0, - ], - R2modp: [ - 0x22d6fa, 0x7aa299, 0x4c307e, 0x68e711, 0x7da4ae, 0x383cc3, 0x12048c, 0x11b7d, 0x3ca412, - 0x2ce421, 0x4932ac, 0x27a306, 0x340b6a, 0x666e, 0x3f6575, 0x2f823c, 0xa0de6, 0x137ec5, - 0x37d4bc, 0x48a54e, 0x4c28b, - ], - MConst: 0x15fe7d, - SQRTm3: [ - 0x291428, 0x198323, 0x663cce, 0x7745ac, 0x1747e3, 0x5222a9, 0x41f479, 0x54b5f9, 0x1861bc, - 0xde532, 0x2be5aa, 0x1e67ea, 0x5cb732, 0x67ab99, 0xb7c9f, 0x71250d, 0x741800, 0x26db7, - 0x2b165a, 0x3c01e, 0x555c0, - ], - CRu: [ - 0x5794a9, 0x4e28db, 0x690ef0, 0x1c5799, 0x63a309, 0x447bb8, 0x4485d4, 0x36fdd8, 0x7bb423, - 0xe24b9, 0x5e7398, 0x11ac71, 0x806e0, 0x18dd64, 0x5df5a0, 0x4307f, 0x314c20, 0x4d1c8, - 0x2f16a2, 0x3c01e, 0x555c0, - ], - Fra: [ - 0x796f1d, 0x4e9577, 0x6eb572, 0x68637f, 0x41ff8b, 0x46e8d3, 0x7a7898, 0x7c72a4, 0x248407, - 0x6e79d9, 0x56499e, 0x4eb47f, 0x27cbd6, 0x33c662, 0x4e9746, 0xc2798, 0x397549, 0x4a5b1b, - 0x5c90b6, 0x3dca73, 0x4bbc8, - ], - Frb: [ - 0xca60e, 0x34391c, 0x7d2ba0, 0x590606, 0x6dfea2, 0x6febf4, 0x4c9e96, 0x1cd312, 0x3a8282, - 0x1fea68, 0x3ab7e7, 0x363c79, 0xb8ab7, 0x1648cc, 0x61d75a, 0xb1459, 0x350af6, 0x3cdabd, - 0x568633, 0x45f5aa, 0x99f7, - ], - TWK: [ - 0x6a62f3, 0x12416d, 0x735296, 0x62f9eb, 0x1cb389, 0x794c37, 0x37ddda, 0x7acf76, 0x6a6d51, - 0x1625bc, 0x7c5536, 0x518cd7, 0x3e1bc9, 0x47ce1f, 0x8c33b, 0xc7722, 0x62935e, 0x40f556, - 0x4ed046, 0x133767, 0x337a3, - ], - }; - - return ROM_FIELD_BLS24479; -}; - -ROM_FIELD_BLS48581 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS48581 = { - // Base Bits= 23 - Modulus: [ - 0x65912b, 0x2a9cca, 0x30fb70, 0x525245, 0x7df721, 0x414af1, 0x4c5c3b, 0x33d2a8, 0x5af683, - 0x1e8e6d, 0x34c0e5, 0x1566ce, 0x2f6e08, 0x115c87, 0x551129, 0x78f9cb, 0x3be6c0, 0x426376, - 0x3e3448, 0x2b742, 0x7012a0, 0x1c63a8, 0x4c4e09, 0x79a3b7, 0xf73f, 0x25, - ], - ROI: [ - 0x65912a, 0x2a9cca, 0x30fb70, 0x525245, 0x7df721, 0x414af1, 0x4c5c3b, 0x33d2a8, 0x5af683, - 0x1e8e6d, 0x34c0e5, 0x1566ce, 0x2f6e08, 0x115c87, 0x551129, 0x78f9cb, 0x3be6c0, 0x426376, - 0x3e3448, 0x2b742, 0x7012a0, 0x1c63a8, 0x4c4e09, 0x79a3b7, 0xf73f, 0x25, - ], - R2modp: [ - 0x4e2506, 0x1fad8c, 0x618be7, 0x23e9bf, 0x6a8ad9, 0x3529c9, 0xb64d9, 0x1c7a8e, 0x759816, - 0x2ae889, 0x3b1f74, 0x53d536, 0x7cff54, 0x389ee8, 0x4f41f1, 0x2c5d2d, 0x48d19d, 0x6c88a7, - 0x7b224e, 0x3b0db8, 0x3bdcf8, 0x83abf, 0x5b548e, 0x50a9d7, 0x362f43, 0x10, - ], - MConst: 0x1d5a7d, - SQRTm3: [ - 0x565a0a, 0x3f8543, 0x6fd47b, 0x496c66, 0x62daa2, 0x3ac2da, 0x11e09a, 0x92089, 0x3f8ad7, - 0x4ba795, 0x1335b0, 0x35ae9f, 0x48e9b1, 0x12c1dd, 0xedce, 0x21fa85, 0x6fed43, 0x4cc86e, - 0x6b8186, 0x7dc492, 0x2bffd8, 0x451bd5, 0x24231a, 0x4d3b00, 0xf73f, 0x25, - ], - CRu: [ - 0x479b90, 0x358bc3, 0x20937a, 0x4472ef, 0x4d8e3f, 0x43440b, 0x5d3dd0, 0x15590f, 0xdb5d6, - 0x29736c, 0x50c59a, 0x2fdc17, 0x73422b, 0x3f4d54, 0x2a11ad, 0x6b7fa3, 0x65fcbe, 0x7acd83, - 0x695960, 0x427957, 0x620963, 0x2ba3e9, 0x541577, 0x16345b, 0x0, 0x0, - ], - Fra: [ - 0x2aeb25, 0x6d9fc8, 0x7e58ba, 0x3b0569, 0x341942, 0x3d9c9b, 0x15c1c5, 0x7d3ef9, 0x208ac0, - 0x6ef6a2, 0x106240, 0x1f0e46, 0x684849, 0x3030fc, 0xc1f8a, 0x317a4b, 0x4afd6b, 0xe81c7, - 0xf9e16, 0x6823cc, 0x5f6067, 0x7ce7ca, 0x69d735, 0x280a4f, 0x7d30db, 0x1, - ], - Frb: [ - 0x2aeb25, 0x6d9fc8, 0x7e58ba, 0x3b0569, 0x341942, 0x3d9c9b, 0x15c1c5, 0x7d3ef9, 0x208ac0, - 0x6ef6a2, 0x106240, 0x1f0e46, 0x684849, 0x3030fc, 0xc1f8a, 0x317a4b, 0x4afd6b, 0xe81c7, - 0xf9e16, 0x6823cc, 0x5f6067, 0x7ce7ca, 0x69d735, 0x280a4f, 0x7d30db, 0x1, - ], - TWK: [ - 0x426953, 0x67a4be, 0xf5ed0, 0x11dcc3, 0x2ce459, 0x6fc2c1, 0x77e8b4, 0x46145d, 0x7b4bc1, - 0x7f9915, 0x313d8b, 0x497801, 0x661b43, 0x428f02, 0x1fa546, 0x231769, 0x3b8532, 0x614cd0, - 0x281d59, 0x4dd09c, 0x6aeb8c, 0x39bbb3, 0x1d5da, 0x1bde08, 0x3a65a5, 0x0, - ], - }; - - return ROM_FIELD_BLS48581; -}; - -ROM_FIELD_BLS48556 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS48556 = { - // BLS48556 Modulus - // Base Bits= 23 - - Modulus: [ - 0x76ac0b, 0x4c1ff9, 0x67bbdb, 0x5330ef, 0x167009, 0x450805, 0x61c350, 0x609bd4, 0x76b2e, - 0x40410d, 0x169054, 0x353e01, 0x141301, 0x66f371, 0x3b355a, 0x6d4a85, 0x36f405, 0x28840a, - 0x454ab3, 0x2b6433, 0x29047a, 0xb646e, 0xbff3f, 0x68bec2, 0xf, - ], - ROI: [ - 0x76ac0a, 0x4c1ff9, 0x67bbdb, 0x5330ef, 0x167009, 0x450805, 0x61c350, 0x609bd4, 0x76b2e, - 0x40410d, 0x169054, 0x353e01, 0x141301, 0x66f371, 0x3b355a, 0x6d4a85, 0x36f405, 0x28840a, - 0x454ab3, 0x2b6433, 0x29047a, 0xb646e, 0xbff3f, 0x68bec2, 0xf, - ], - R2modp: [ - 0x5f42c2, 0x596e88, 0x2ed8fa, 0x15c970, 0x2518b4, 0x2a75e7, 0x62ce53, 0x431c50, 0x3cf507, - 0x620e44, 0xd6fcd, 0x21a7d, 0x1fda3f, 0x6a099, 0x53487, 0x53eebf, 0x54e2d0, 0x48437d, - 0x2233d8, 0x63296f, 0x21ee21, 0x611417, 0x619d35, 0x13a61a, 0xb, - ], - MConst: 0x5a805d, - SQRTm3: [ - 0x9c48, 0x6dd9b9, 0x4445d6, 0x401e84, 0x5f13b, 0x5b1ce6, 0x3c70c7, 0x798d07, 0x7e0544, - 0x62ca1b, 0x75113, 0x557bb6, 0x3a11f4, 0x1426f2, 0x27ef0c, 0x1763b3, 0x7ee9f8, 0x3cf4db, - 0x4cdb7e, 0x6bf8c, 0x263a76, 0x3d63a0, 0x5bbf38, 0x68bec1, 0xf, - ], - CRu: [ - 0x3ba429, 0x1cfcd9, 0x1600d9, 0x49a7ba, 0x4e30a2, 0x101275, 0xf1a0c, 0x6d146e, 0x42b839, - 0x118594, 0x4ef0b4, 0x55cdb, 0x67127b, 0x3d8d31, 0x319233, 0x2571c, 0x1aeeff, 0x72bc73, - 0x91318, 0x1911e0, 0x279f78, 0x646407, 0x73df3b, 0x68bec1, 0xf, - ], - Fra: [ - 0x25bf89, 0x79fb26, 0x56f988, 0x399a14, 0x507ea3, 0x77995, 0x3ee83a, 0x52eca9, 0x3e3474, - 0x5f1e13, 0x2e7cb0, 0x255f3d, 0x3ae7f8, 0x2e4ef6, 0x3bde94, 0x7b05a, 0x13c83c, 0x7bf664, - 0x1ff27f, 0x6fe082, 0x3b36ce, 0x138113, 0x6e2002, 0x4c5c03, 0x2, - ], - Frb: [ - 0x25bf89, 0x79fb26, 0x56f988, 0x399a14, 0x507ea3, 0x77995, 0x3ee83a, 0x52eca9, 0x3e3474, - 0x5f1e13, 0x2e7cb0, 0x255f3d, 0x3ae7f8, 0x2e4ef6, 0x3bde94, 0x7b05a, 0x13c83c, 0x7bf664, - 0x1ff27f, 0x6fe082, 0x3b36ce, 0x138113, 0x6e2002, 0x4c5c03, 0x2, - ], - TWK: [ - 0x6f9937, 0x4f5442, 0x12b489, 0x31b13f, 0xbd341, 0x4006d0, 0x7a84d9, 0x4dd830, 0x6d4c49, - 0x59d972, 0x1a71ca, 0x687e1, 0x40c8dc, 0x206554, 0x5de9a7, 0x2817c7, 0x6556ed, 0x27c11a, - 0x3ec6ef, 0x764e01, 0x6dd577, 0x7cffdd, 0x246857, 0x1907ce, 0x4, - ], - }; - - return ROM_FIELD_BLS48556; -}; - -ROM_FIELD_BLS48286 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS48286 = { - // BLS48286 Modulus - // Base Bits= 23 - - Modulus: [ - 0x1c345b, 0x57241, 0x3679d4, 0x1471a9, 0x641c45, 0x1355e, 0x6b012, 0x36463f, 0x145a8, - 0x604039, 0x31ef5e, 0x16298f, 0x297, - ], - R2modp: [ - 0x116bcb, 0x4a9ce9, 0xd861f, 0x5ca282, 0x66469, 0x30c42d, 0x299fc6, 0x442c07, 0x1735e0, - 0x516724, 0x325ec8, 0x294de1, 0x35, - ], - ROI: [ - 0x1c345a, 0x57241, 0x3679d4, 0x1471a9, 0x641c45, 0x1355e, 0x6b012, 0x36463f, 0x145a8, - 0x604039, 0x31ef5e, 0x16298f, 0x297, - ], - SQRTm3: [ - 0x524a9c, 0x48e5cc, 0x66335e, 0xe9944, 0x35b814, 0x1d666a, 0x269c21, 0x4bac4c, 0x2987b9, - 0x614644, 0x63d761, 0xe12a3, 0x297, - ], - CRu: [ - 0x773f7b, 0x272c06, 0xe5699, 0x518577, 0x4cea2c, 0x4f4de4, 0x56a619, 0xf945, 0x5566b1, - 0x20c33e, 0x4ae360, 0x121e19, 0x297, - ], - MConst: 0x6a242d, - Fra: [ - 0x490183, 0x52be7f, 0x4dbaa1, 0xde9f4, 0x556bed, 0x6134f8, 0x3c09a3, 0x1ec81f, 0x2fe004, - 0x1d15d8, 0x48b045, 0x20bf62, 0xd9, - ], - Frb: [ - 0x5332d8, 0x32b3c1, 0x68bf32, 0x687b4, 0xeb058, 0x200066, 0x4aa66e, 0x177e1f, 0x5165a4, - 0x432a60, 0x693f19, 0x756a2c, 0x1bd, - ], - TWK: [ - 0x505dcc, 0x2e6b87, 0x2e69f6, 0x2a1538, 0x197054, 0x458d43, 0x4532ea, 0x7de65e, 0x367221, - 0x233e6e, 0x1228cd, 0x76f7a, 0x1d2, - ], - }; - - return ROM_FIELD_BLS48286; -}; - -ROM_FIELD_BN462 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BN462 = { - // Base Bits= 23 - Modulus: [ - 0x138013, 0x601080, 0x9006, 0x0, 0x7f6400, 0xdfed0, 0x3fd9bf, 0x7ffffb, 0xfffff, 0x39004, - 0x4a423d, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - ROI: [ - 0x138012, 0x601080, 0x9006, 0x0, 0x7f6400, 0xdfed0, 0x3fd9bf, 0x7ffffb, 0xfffff, 0x39004, - 0x4a423d, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - R2modp: [ - 0x8b8d, 0x7265c, 0x56003a, 0xe1112, 0x275149, 0x50bff0, 0x1e3e2e, 0x2dedf3, 0x43d666, - 0x644751, 0x2a7239, 0x1dca94, 0x5f2ff8, 0x41cff0, 0x41494f, 0x34b04a, 0x47932f, 0x5e4bbc, - 0x50bc6, 0x30f0fb, 0x1, - ], - MConst: 0x1bb5e5, - SQRTm3: [ - 0x210022, 0x1980, 0x9009, 0x0, 0x7ef800, 0x60fe25, 0x3fd2fe, 0x7ffffb, 0x2fffff, 0x4f806, - 0x5102bb, 0x6c0, 0x0, 0x5ff700, 0x7d77f4, 0x7b7f81, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - CRu: [ - 0x1a401a, 0x701500, 0x9007, 0x0, 0x3f2e00, 0x777e7b, 0x3fd65e, 0x7ffffb, 0x1fffff, 0x44405, - 0x4da27c, 0x6c0, 0x0, 0x4bf820, 0x1d92f5, 0x7b7f84, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - Fra: [ - 0x575d1a, 0x7c7fe4, 0x6f7b92, 0x44b2ce, 0xfc7d, 0x27f423, 0x517476, 0x3c6c86, 0x3310cc, - 0xac42e, 0x3551f0, 0x3c9282, 0x7e11c, 0x207535, 0x2164bb, 0x8b938, 0x35a8cc, 0x179fb, - 0x5232ed, 0xb7fa1, 0x0, - ], - Frb: [ - 0x5ff85b, 0x15c12a, 0x2d8881, 0x432bdf, 0x90238, 0x2c6144, 0x653d2f, 0x786807, 0x27a84f, - 0x362943, 0x2c76eb, 0x6c72, 0x685f7b, 0x794003, 0x6c9d24, 0x5b4192, 0x2008e6, 0x21d510, - 0x2503a, 0x1e1bfc, 0x2, - ], - }; - - return ROM_FIELD_BN462; -}; - -ROM_FIELD_BLS12381 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS12381 = { - // BLS12381 Modulus - // Base Bits= 23 - - Modulus: [ - 0x7faaab, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - ROI: [ - 0x7faaaa, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - R2modp: [ - 0x40c6e6, 0xe1a28, 0x3d1c6c, 0x6d2448, 0x1bb111, 0x4eafa8, 0x229c8c, 0x4cee55, 0x46d2ad, - 0x7ba87c, 0x708835, 0x2413d1, 0x6702e3, 0x390116, 0xd9e3f, 0x4bd65c, 0x9a3, - ], - MConst: 0x7cfffd, - SQRTm3: [ - 0x1aaae, 0x0, 0x6d77ec, 0x69ffff, 0x44fd7e, 0x224c4f, 0x4a2ff2, 0x64c014, 0x22e9ab, 0x6c3ecc, - 0x3e8efd, 0x70819f, 0x156845, 0x319d1b, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - CRu: [ - 0x7efffe, 0x7fffff, 0x8b807, 0x105000, 0x7d8136, 0x511bc2, 0x79be25, 0x59d49d, 0x77eadd, - 0xed41e, 0x69a718, 0x36728d, 0x72fdf7, 0xbe32c, 0x0, 0x0, 0x0, - ], - Fra: [ - 0x235fb8, 0x6bdb24, 0x76341d, 0x1f3c09, 0x6a53d6, 0x389ecf, 0x612eae, 0x1221eb, 0x5f4f7b, - 0x7a797a, 0x3f580f, 0x6068f8, 0x6b4202, 0x784637, 0x2ec199, 0x69df81, 0x1904, - ], - Frb: [ - 0x5c4af3, 0x1424db, 0x8b3de, 0x6b63f6, 0x55ac14, 0xbe505, 0x5c7d8f, 0x64764, 0x336fec, - 0xf6d8f, 0x52851e, 0x7cfdc2, 0x102231, 0x511d3d, 0x31380c, 0x1f159b, 0xfc, - ], - }; - - return ROM_FIELD_BLS12381; -}; - -ROM_FIELD_BLS12461 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS12461 = { - // BLS12461 Modulus - // Base Bits= 23 - Modulus: [ - 0x2aaaab, 0x155, 0x2aaab0, 0x2aaa55, 0x55, 0x80004, 0x555fc0, 0x135548, 0x1cc00f, 0x3ff4b8, - 0x2d0aa3, 0x58a424, 0x2cca47, 0x465b17, 0x6f5bc7, 0xa49af, 0x55d694, 0x34aab4, 0x155535, - 0x2aaaaa, 0x1, - ], - ROI: [ - 0x2aaaaa, 0x155, 0x2aaab0, 0x2aaa55, 0x55, 0x80004, 0x555fc0, 0x135548, 0x1cc00f, 0x3ff4b8, - 0x2d0aa3, 0x58a424, 0x2cca47, 0x465b17, 0x6f5bc7, 0xa49af, 0x55d694, 0x34aab4, 0x155535, - 0x2aaaaa, 0x1, - ], - R2modp: [ - 0x621498, 0x3b585f, 0x41688, 0x6f780d, 0x17c239, 0x158d8a, 0x491a92, 0x737df1, 0x22a06, - 0x460263, 0x275ff2, 0x5496c3, 0x6d4ad2, 0x3a7b46, 0x3a6323, 0x1723b1, 0x76204b, 0x66fd26, - 0x4e743e, 0x1be66e, 0x0, - ], - MConst: 0x7ffffd, - SQRTm3: [ - 0x2aaaae, 0x7ff955, 0x2aaa8f, 0x2aac55, 0x355, 0x440028, 0x54fd80, 0x4d50d6, 0x415095, - 0x7b9ed2, 0x4566e7, 0x514ff0, 0x2ead34, 0x325192, 0x3f33c7, 0xb89b0, 0x51d694, 0x34aab4, - 0x155535, 0x2aaaaa, 0x1, - ], - CRu: [ - 0x7ffffe, 0x3ff, 0x10, 0x7fff00, 0x7ffe7f, 0x61ffed, 0x311f, 0x630239, 0x6db7bc, 0x622af2, - 0x73d1dd, 0x43aa19, 0x3f0e89, 0xa04c2, 0x581400, 0x7f5fff, 0x1ffff, 0x0, 0x0, 0x0, 0x0, - ], - Fra: [ - 0x12a3a, 0x2f7f37, 0x3dc4, 0x52cce2, 0x1c6308, 0xb7f14, 0x4381d4, 0x52d328, 0x58d45f, - 0x359c90, 0x1dc2cc, 0x616582, 0x7c61eb, 0x6b11c5, 0x64341c, 0x421b30, 0x4dfefa, 0x3cabc4, - 0x12dfda, 0x172028, 0x1, - ], - Frb: [ - 0x298071, 0x50821e, 0x2a6ceb, 0x57dd73, 0x639d4c, 0x7c80ef, 0x11ddeb, 0x408220, 0x43ebaf, - 0xa5827, 0xf47d7, 0x773ea2, 0x30685b, 0x5b4951, 0xb27aa, 0x482e7f, 0x7d799, 0x77fef0, 0x2755a, - 0x138a82, 0x0, - ], - }; - - return ROM_FIELD_BLS12461; -}; - -ROM_FIELD_FP256BN = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_FP256BN = { - // FP256BN Modulus - // Base Bits= 24 - Modulus: [ - 0xd33013, 0x2ddbae, 0x82d329, 0x12980a, 0xdc65fb, 0xa49f0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - ROI: [ - 0xd33012, 0x2ddbae, 0x82d329, 0x12980a, 0xdc65fb, 0xa49f0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - R2modp: [ - 0x2f4801, 0xf779d1, 0x3e7f6e, 0xb42a3a, 0xc919c9, 0xc26c08, 0x1bb715, 0xca2ed6, 0x54293e, - 0xe578e, 0x78ea, - ], - MConst: 0x37e5e5, - SQRTm3: [ - 0x8fc004, 0x199267, 0x451cf1, 0x2f71b0, 0x40b6bf, 0x73d3d5, 0xddca51, 0xd3d42f, 0xfcf0ca, - 0xffffff, 0xffff, - ], - CRu: [ - 0xa1b807, 0xa24a3, 0x1edb1c, 0xf1932d, 0xcdd79d, 0x18659b, 0x409210, 0x3988e1, 0x1, 0x0, 0x0, - ], - Fra: [ - 0x943106, 0x328af, 0x8f7476, 0x1e3ab2, 0xa17151, 0x67cf39, 0x8ddb08, 0x2d1a6e, 0x786f35, - 0x7662ca, 0x3d61, - ], - Frb: [ - 0x3eff0d, 0x2ab2ff, 0xf35eb3, 0xf45d57, 0x3af4a9, 0x3ccfd3, 0xd11369, 0x19cb83, 0x848198, - 0x899d35, 0xc29e, - ], - }; - - return ROM_FIELD_FP256BN; -}; - -ROM_FIELD_FP512BN = function () { - 'use strict'; - - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_FP512BN = { - // FP512BN Modulus - // Base Bits= 23 - Modulus: [ - 0x2def33, 0x501245, 0x1ed3ac, 0x7a6323, 0x255ce5, 0x7c322d, 0x2ac8db, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a2a, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ROI: [ - 0x2def32, 0x501245, 0x1ed3ac, 0x7a6323, 0x255ce5, 0x7c322d, 0x2ac8db, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a2a, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - R2modp: [ - 0x23e65d, 0x575a37, 0x411cd0, 0x295fb3, 0x640669, 0x375c69, 0x92395, 0x738492, 0x780d6d, - 0x1bcd9d, 0x417caa, 0x2dc6fb, 0x7eacfb, 0x327043, 0x7f2fc7, 0xf268c, 0x73d733, 0x2147c9, - 0x2accd3, 0x32eaf8, 0x3b2c1e, 0xd46a2, 0x30, - ], - MConst: 0x4c5c05, - // SQRTm3: [0x332330,0x505BC6,0x1C3175,0x1D56FC,0x52DE91,0x5E48D,0x345737,0x415677,0x83CB6,0x651720,0x753DC3,0xA8065,0x35CDD1,0x6B9137,0x2960D9,0x24905A,0x7C8EB4,0x7FF3D8,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3F], - SQRTm3: [ - 0x4463e2, 0x8702c, 0x6b848c, 0x3e4e58, 0x37724d, 0x287986, 0x346054, 0x415677, 0x83cb6, - 0x651720, 0x753dc3, 0xa8005, 0x35cdd1, 0x6b9137, 0x2960d9, 0x24905a, 0x7c8eb4, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CRu: [ - 0x79298a, 0x2c4138, 0x52c1c, 0x5c58be, 0x6e6799, 0x1255d9, 0x2f9498, 0x43c4b3, 0x507acd, - 0x11384e, 0x1d2c80, 0x8fd18, 0x78ef76, 0x71d459, 0x2e1acd, 0x1530a3, 0x7dc83d, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - Fra: [ - 0x373ab2, 0x2f63e9, 0x47d258, 0x101576, 0x1514f6, 0x503c2e, 0x34ef61, 0x4fb040, 0x2cbbb5, - 0x553d0a, 0x63a7e2, 0x10341c, 0x48cf2e, 0x3564d7, 0x25bde4, 0x50c529, 0x468b4e, 0x2d518f, - 0x6de46, 0x7c84ad, 0x1cf5bb, 0x5ee355, 0x7, - ], - Frb: [ - 0x76b481, 0x20ae5b, 0x570154, 0x6a4dac, 0x1047ef, 0x2bf5ff, 0x75d97a, 0x7682ae, 0x6bfd2e, - 0x681c72, 0x617359, 0x77460d, 0x7341ec, 0x42b2a4, 0xd16dd, 0x350bc3, 0x387677, 0x52a249, - 0x7921b9, 0x37b52, 0x630a44, 0x211caa, 0x38, - ], - }; - - return ROM_FIELD_FP512BN; -}; - -ROM_FIELD_BN254 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BN254 = { - // BN254 Modulus - // Base Bits= 24 - Modulus: [0x13, 0x0, 0x13a700, 0x0, 0x210000, 0x861, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - ROI: [0x12, 0x0, 0x13a700, 0x0, 0x210000, 0x861, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - R2modp: [ - 0x2f2aa7, 0x537047, 0xf8f174, 0xc3e364, 0xab8c1c, 0x3c2035, 0x69549, 0x379287, 0x3be629, - 0x75617a, 0x1f47, - ], - MConst: 0x9435e5, - SQRTm3: [0x4, 0x0, 0x60c00, 0x0, 0xf0000, 0x3cf, 0x0, 0x26cd89, 0x1, 0x648240, 0x2523], - CRu: [0x7, 0x0, 0x6cd80, 0x0, 0x90000, 0x249, 0x400000, 0x49b362, 0x0, 0x0, 0x0], - Fra: [ - 0x2a6de9, 0xe6c06f, 0xc2e17d, 0x4d3f77, 0x97492, 0x953f85, 0x50a846, 0xb6499b, 0x2e7c8c, - 0x761921, 0x1b37, - ], - Frb: [ - 0xd5922a, 0x193f90, 0x50c582, 0xb2c088, 0x178b6d, 0x6ac8dc, 0x2f57b9, 0x3eab2, 0xd18375, - 0xee691e, 0x9eb, - ], - }; - - return ROM_FIELD_BN254; -}; - -ROM_FIELD_BN254CX = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BN254CX = { - // BN254CX Modulus - // Base Bits= 24 - Modulus: [ - 0x1b55b3, 0x23ef5c, 0xe1be66, 0x18093e, 0x3fd6ee, 0x66d324, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - ROI: [ - 0x1b55b2, 0x23ef5c, 0xe1be66, 0x18093e, 0x3fd6ee, 0x66d324, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - R2modp: [ - 0x8ee63d, 0x721fde, 0xcc0891, 0x10c28b, 0xd4f5a, 0x4c18fb, 0x9036fa, 0x3f845f, 0xa507e4, - 0x78eb29, 0x1587, - ], - MConst: 0x789e85, - SQRTm3: [ - 0xd49c84, 0xfdc033, 0x355aa4, 0x342a30, 0xc41825, 0xe8aaa2, 0x646112, 0x20bddf, 0x702a0d, 0x8, - 0x2400, - ], - CRu: [ - 0x235c97, 0x931794, 0x5631e0, 0x71ef87, 0xbddf64, 0x3f1440, 0xca8, 0x480000, 0x0, 0x0, 0x0, - ], - Fra: [ - 0xc80ea3, 0x83355, 0x215bd9, 0xf173f8, 0x677326, 0x189868, 0x8aaca7, 0xafe18b, 0x3a0164, - 0x82fa6, 0x1359, - ], - Frb: [ - 0x534710, 0x1bbc06, 0xc0628d, 0x269546, 0xd863c7, 0x4e3abb, 0xd9cdbc, 0xdc53, 0x3628a9, - 0xf7d062, 0x10a6, - ], - }; - - return ROM_FIELD_BN254CX; -}; - -ROM_FIELD_BRAINPOOL = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BRAINPOOL = { - // Brainpool modulus - // Base Bits= 24 - Modulus: [ - 0x6e5377, 0x481d1f, 0x282013, 0xd52620, 0x3bf623, 0x8d726e, 0x909d83, 0x3e660a, 0xeea9bc, - 0x57dba1, 0xa9fb, - ], - ROI: [ - 0x6e5376, 0x481d1f, 0x282013, 0xd52620, 0x3bf623, 0x8d726e, 0x909d83, 0x3e660a, 0xeea9bc, - 0x57dba1, 0xa9fb, - ], - R2modp: [ - 0x35b819, 0xb03428, 0xecaf0f, 0x3854a4, 0x4a0ed5, 0x2421ea, 0xaa562c, 0xf9c45, 0xddae58, - 0x4350fd, 0x52b8, - ], - MConst: 0xfd89b9, - }; - return ROM_FIELD_BRAINPOOL; -}; - -ROM_FIELD_C41417 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_C41417 = { - // C41417 modulus - // Base Bits= 22 - Modulus: [ - 0x3fffef, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3ffff, - ], - ROI: [ - 0x3fffee, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3ffff, - ], - R2modp: [ - 0x12100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - MConst: 0x11, - }; - return ROM_FIELD_C41417; -}; - -ROM_FIELD_C1174 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_C1174 = { - // C1174 modulus - // Base Bits= 24 - Modulus: [ - 0xfffff7, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - R2modp: [0x0, 0x144, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ROI: [ - 0xfffff6, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - MConst: 0x9, - }; - return ROM_FIELD_C1174; -}; - -ROM_FIELD_C1665 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - var ROM_FIELD_C1665 = { - // C1665 modulus - // Base Bits= 23 - Modulus: [0x7ffffb, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x1f], - R2modp: [0x0, 0x32000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ROI: [0x7ffffa, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x1f], - MConst: 0x5, - }; - return ROM_FIELD_C1665; -}; - -ROM_FIELD_MDC = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - var ROM_FIELD_MDC = { - // Million Dollar Curve modulus - // Base Bits= 24 - Modulus: [ - 0x79ec13, 0x104057, 0x9ec137, 0xef07af, 0x6a9037, 0xfd4f08, 0xfdd7a5, 0x532f92, 0x56afb4, - 0x68b9d4, 0xf13b, - ], - R2modp: [ - 0xfff702, 0x31619a, 0xba623e, 0xc672c1, 0xf5883f, 0x39e4ab, 0x4589, 0x972c4a, 0xd61255, - 0x6e22d, 0x7c41, - ], - ROI: [ - 0x79ec12, 0x104057, 0x9ec137, 0xef07af, 0x6a9037, 0xfd4f08, 0xfdd7a5, 0x532f92, 0x56afb4, - 0x68b9d4, 0xf13b, - ], - MConst: 0xe541e5, - }; - return ROM_FIELD_MDC; -}; - -ROM_FIELD_GOLDILOCKS = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_GOLDILOCKS = { - // GOLDILOCKS modulus - // Base Bits= 23 - Modulus: [ - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - ROI: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - R2modp: [ - 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - MConst: 0x1, - }; - return ROM_FIELD_GOLDILOCKS; -}; - -ROM_FIELD_HIFIVE = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_HIFIVE = { - // HIFIVE modulus - // Base Bits= 23 - Modulus: [ - 0x7ffffd, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3fff, - ], - ROI: [ - 0x59d3b8, 0x104fea, 0xdae01, 0x49f563, 0x14538b, 0x2bb499, 0x7f2a2e, 0x30f6d4, 0x18c41f, - 0x2a7bef, 0x62cad1, 0x408fe1, 0x1ef527, 0x787c06, 0x3e4f, - ], - R2modp: [0x240000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0x3, - }; - return ROM_FIELD_HIFIVE; -}; - -ROM_FIELD_NIST256 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_NIST256 = { - // NIST256 Modulus - // Base Bits= 24 - Modulus: [0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x0, 0x0, 0x0, 0x0, 0x1, 0xffff00, 0xffff], - ROI: [0xfffffe, 0xffffff, 0xffffff, 0xffffff, 0x0, 0x0, 0x0, 0x0, 0x1, 0xffff00, 0xffff], - R2modp: [ - 0x30000, 0x0, 0x0, 0xffff00, 0xfbffff, 0xffffff, 0xfffffe, 0xffffff, 0xfdffff, 0xffffff, 0x4, - ], - MConst: 0x1, - }; - return ROM_FIELD_NIST256; -}; - -ROM_FIELD_SM2 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_SM2 = { - // SM2 Modulus - // Base Bits= 24 - Modulus: [ - 0xffffff, 0xffffff, 0xffff, 0x0, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffeff, - 0xffff, - ], - ROI: [ - 0xfffffe, 0xffffff, 0xffff, 0x0, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffeff, - 0xffff, - ], - R2modp: [0x30000, 0x0, 0x2, 0xffff00, 0x2ffff, 0x0, 0x1, 0x100, 0x20000, 0x0, 0x4], - MConst: 0x1, - }; - return ROM_FIELD_SM2; -}; - -ROM_FIELD_NIST384 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_NIST384 = { - // NIST384 modulus - // Base Bits= 23 - Modulus: [ - 0x7fffff, 0x1ff, 0x0, 0x0, 0x7ffff0, 0x7fdfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - ROI: [ - 0x7ffffe, 0x1ff, 0x0, 0x0, 0x7ffff0, 0x7fdfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - R2modp: [ - 0x4000, 0x0, 0x7ffffe, 0x1ff, 0x80000, 0x0, 0x0, 0x7fc000, 0x3fffff, 0x0, 0x200, 0x20000, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x1, - }; - return ROM_FIELD_NIST384; -}; - -ROM_FIELD_NIST521 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_NIST521 = { - // NIST521 modulus - // Base Bits= 23 - Modulus: [ - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - ROI: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - R2modp: [ - 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x1, - }; - return ROM_FIELD_NIST521; -}; - -ROM_FIELD_SECP256K1 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_SECP256K1 = { - // SECP256K1 modulus - // Base Bits= 24 - Modulus: [ - 0xfffc2f, 0xfffeff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - ROI: [ - 0xfffc2e, 0xfffeff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - R2modp: [0xa10000, 0xe90, 0x7a2, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0x253531, - SQRTm3: [ - 0xd5f852, 0x27ae1c, 0xd47d8d, 0xda14ec, 0x1f6d15, 0x962cc6, 0xc2a797, 0x233770, 0x7f1df, - 0x2ba935, 0xa2d, - ], - }; - return ROM_FIELD_SECP256K1; -}; - -ROM_FIELD_SECP160R1 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_SECP160R1 = { - // SECP160R1 modulus - // Base Bits= 24 - Modulus: [0xffffff, 0xffff7f, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffff], - R2modp: [0x10000, 0x0, 0x1, 0x40, 0x0, 0x0, 0x0], - ROI: [0xfffffe, 0xffff7f, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffff], - MConst: 0x1, - }; - return ROM_FIELD_SECP160R1; -}; - -ROM_FIELD_JUBJUB = function () { - 'use strict'; - // Fixed Data in ROM - Field and Curve parameters - - var ROM_FIELD_JUBJUB = { - // Base Bits= 24 - Modulus: [ - 0x1, 0xffff00, 0xfeffff, 0xfffe5b, 0xbda402, 0xd80553, 0x809a1, 0x3339d8, 0x9d7d48, 0xa75329, - 0x73ed, - ], - R2modp: [ - 0x6cefea, 0x4089c, 0xafe991, 0x7687f1, 0x3f3f50, 0x45bbe1, 0x94826, 0x101d61, 0xb3be6b, - 0xb9a93, 0x8f8, - ], - ROI: [ - 0x912f1f, 0x8f500b, 0x941b78, 0x70b3e0, 0x24ff2, 0xd6c0c4, 0xc8d168, 0xfd56d, 0x416b6f, - 0xd79e5b, 0x212, - ], - MConst: 0xffffff, - }; - return ROM_FIELD_JUBJUB; -}; - -ROM_FIELD_TWEEDLEDUM = function () { - 'use strict'; - // Fixed Data in ROM - Field and Curve parameters - - var ROM_FIELD_TWEEDLEDUM = { - // Base bits= 24 - Modulus: [0x1, 0x64e200, 0xb9a140, 0x6c3f59, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - R2modp: [ - 0xffcde, 0xf3fc00, 0x817083, 0x90fd10, 0x4e767f, 0x919928, 0x94c659, 0x28e190, 0xedd7b, - 0x7ccca, 0x2d91, - ], - ROI: [ - 0x8837ce, 0x9f31b8, 0xd653de, 0xf3ea99, 0x46e8f3, 0x2d57ff, 0xeaaf8c, 0xf624f2, 0xee2fc, - 0x511789, 0x2ae4, - ], - SQRTm3: [ - 0xde6c70, 0xd7ab7, 0x6c960f, 0x34f725, 0x86aae0, 0x84cb12, 0xd7220f, 0xc8286d, 0x2d06d6, - 0x7d4a94, 0x15ef, - ], - MConst: 0xffffff, - }; - return ROM_FIELD_TWEEDLEDUM; -}; - -ROM_FIELD_TWEEDLEDEE = function () { - 'use strict'; - // Fixed Data in ROM - Field and Curve parameters - - var ROM_FIELD_TWEEDLEDEE = { - // Base bits= 24 - Modulus: [0x1, 0xafd400, 0xc9842c, 0x696286, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - R2modp: [ - 0xffcde, 0x29d800, 0x45e681, 0x2b8642, 0x18e911, 0x7e0b8d, 0x3aa0a2, 0xe6fcb0, 0x13f4c0, - 0x68860, 0x2d91, - ], - ROI: [ - 0x9d57ec, 0x323486, 0xbf1cbd, 0xb8084f, 0x287dd1, 0x72930a, 0x645a98, 0xf1dbcb, 0xc03c0b, - 0xfc510d, 0x113e, - ], - SQRTm3: [ - 0x1f49fa, 0xd5a629, 0xb902fc, 0xd867d6, 0x147aa6, 0x3ffcd0, 0xbff2e6, 0xf5b16, 0x934b1, - 0xda743c, 0x2d8c, - ], - MConst: 0xffffff, - }; - return ROM_FIELD_TWEEDLEDEE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - ROM_FIELD_25519: ROM_FIELD_25519, - ROM_FIELD_256PM: ROM_FIELD_256PM, - ROM_FIELD_384PM: ROM_FIELD_384PM, - ROM_FIELD_512PM: ROM_FIELD_512PM, - ROM_FIELD_ANSSI: ROM_FIELD_ANSSI, - ROM_FIELD_FP256BN: ROM_FIELD_FP256BN, - ROM_FIELD_FP512BN: ROM_FIELD_FP512BN, - ROM_FIELD_BN254: ROM_FIELD_BN254, - ROM_FIELD_BN254CX: ROM_FIELD_BN254CX, - ROM_FIELD_BRAINPOOL: ROM_FIELD_BRAINPOOL, - ROM_FIELD_C41417: ROM_FIELD_C41417, - ROM_FIELD_GOLDILOCKS: ROM_FIELD_GOLDILOCKS, - ROM_FIELD_HIFIVE: ROM_FIELD_HIFIVE, - ROM_FIELD_NIST256: ROM_FIELD_NIST256, - ROM_FIELD_NIST384: ROM_FIELD_NIST384, - ROM_FIELD_NIST521: ROM_FIELD_NIST521, - ROM_FIELD_SECP256K1: ROM_FIELD_SECP256K1, - ROM_FIELD_BLS12383: ROM_FIELD_BLS12383, - ROM_FIELD_BLS24479: ROM_FIELD_BLS24479, - ROM_FIELD_BLS48556: ROM_FIELD_BLS48556, - ROM_FIELD_BLS48286: ROM_FIELD_BLS48286, - ROM_FIELD_BLS48581: ROM_FIELD_BLS48581, - ROM_FIELD_BLS12381: ROM_FIELD_BLS12381, - ROM_FIELD_BLS12461: ROM_FIELD_BLS12461, - ROM_FIELD_BN462: ROM_FIELD_BN462, - ROM_FIELD_C1174: ROM_FIELD_C1174, - ROM_FIELD_C1665: ROM_FIELD_C1665, - ROM_FIELD_MDC: ROM_FIELD_MDC, - ROM_FIELD_SECP160R1: ROM_FIELD_SECP160R1, - ROM_FIELD_SM2: ROM_FIELD_SM2, - ROM_FIELD_JUBJUB: ROM_FIELD_JUBJUB, - ROM_FIELD_TWEEDLEDUM: ROM_FIELD_TWEEDLEDUM, - ROM_FIELD_TWEEDLEDEE: ROM_FIELD_TWEEDLEDEE, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rsa.js b/packages/bls-verify/src/vendor/amcl-js/src/rsa.js deleted file mode 100644 index 9134e6b75..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rsa.js +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* RSA API Functions */ -var RSA, rsa_private_key, rsa_public_key; - -RSA = function (ctx) { - 'use strict'; - - var RSA = { - RFS: ctx.BIG.MODBYTES * ctx.FF.FFLEN, - HASH_TYPE: 32, - - bytestohex: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - return s; - }, - - bytestostring: function (b) { - var s = '', - i; - - for (i = 0; i < b.length; i++) { - s += String.fromCharCode(b[i]); - } - - return s; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - KEY_PAIR: function (rng, e, PRIV, PUB) { - /* IEEE1363 A16.11/A16.12 more or less */ - var n = PUB.n.length >> 1, - t = new ctx.FF(n), - p1 = new ctx.FF(n), - q1 = new ctx.FF(n); - - for (;;) { - PRIV.p.random(rng); - - while (PRIV.p.lastbits(2) != 3) { - PRIV.p.inc(1); - } - - while (!ctx.FF.prime(PRIV.p, rng)) { - PRIV.p.inc(4); - } - - p1.copy(PRIV.p); - p1.dec(1); - - if (p1.cfactor(e)) { - continue; - } - - break; - } - - for (;;) { - PRIV.q.random(rng); - - while (PRIV.q.lastbits(2) != 3) { - PRIV.q.inc(1); - } - - while (!ctx.FF.prime(PRIV.q, rng)) { - PRIV.q.inc(4); - } - - q1.copy(PRIV.q); - q1.dec(1); - - if (q1.cfactor(e)) { - continue; - } - - break; - } - - PUB.n = ctx.FF.mul(PRIV.p, PRIV.q); - PUB.e = e; - - t.copy(p1); - t.shr(); - PRIV.dp.set(e); - PRIV.dp.invmodp(t); - if (PRIV.dp.parity() === 0) { - PRIV.dp.add(t); - } - PRIV.dp.norm(); - - t.copy(q1); - t.shr(); - PRIV.dq.set(e); - PRIV.dq.invmodp(t); - if (PRIV.dq.parity() === 0) { - PRIV.dq.add(t); - } - PRIV.dq.norm(); - - PRIV.c.copy(PRIV.p); - PRIV.c.invmodp(PRIV.q); - - return; - }, - - /* destroy the Private Key structure */ - PRIVATE_KEY_KILL: function (PRIV) { - PRIV.p.zero(); - PRIV.q.zero(); - PRIV.dp.zero(); - PRIV.dq.zero(); - PRIV.c.zero(); - }, - - /* RSA encryption with the public key */ - ENCRYPT: function (PUB, F, G) { - var n = PUB.n.getlen(), - f = new ctx.FF(n); - - ctx.FF.fromBytes(f, F); - - f.power(PUB.e, PUB.n); - - f.toBytes(G); - }, - - /* RSA decryption with the private key */ - DECRYPT: function (PRIV, G, F) { - var n = PRIV.p.getlen(), - g = new ctx.FF(2 * n), - jp, - jq, - t; - - ctx.FF.fromBytes(g, G); - - jp = g.dmod(PRIV.p); - jq = g.dmod(PRIV.q); - - jp.skpow(PRIV.dp, PRIV.p); - jq.skpow(PRIV.dq, PRIV.q); - - g.zero(); - g.dscopy(jp); - jp.mod(PRIV.q); - if (ctx.FF.comp(jp, jq) > 0) { - jq.add(PRIV.q); - } - jq.sub(jp); - jq.norm(); - - t = ctx.FF.mul(PRIV.c, jq); - jq = t.dmod(PRIV.q); - - t = ctx.FF.mul(jq, PRIV.p); - g.add(t); - g.norm(); - - g.toBytes(F); - }, - }; - - return RSA; -}; - -rsa_private_key = function (ctx) { - 'use strict'; - - var rsa_private_key = function (n) { - this.p = new ctx.FF(n); - this.q = new ctx.FF(n); - this.dp = new ctx.FF(n); - this.dq = new ctx.FF(n); - this.c = new ctx.FF(n); - }; - - rsa_private_key.prototype = { - set: function (p, q, dp, dq, c) { - this.p = p; - this.q = q; - this.dp = dp; - this.dq = dq; - this.c = c; - }, - - set_p: function (p) { - this.p = p; - }, - - set_q: function (q) { - this.q = q; - }, - - set_dp: function (dp) { - this.dp = dp; - }, - - set_dq: function (dq) { - this.dq = dq; - }, - - set_c: function (c) { - this.c = c; - }, - }; - - rsa_private_key.get_instance = function (p, q, dp, dq, c) { - let priv = new rsa_private_key(ctx.FF.HFLEN); - priv.set(p, q, dp, dq, c); - return priv; - }; - - return rsa_private_key; -}; - -rsa_public_key = function (ctx) { - 'use strict'; - - var rsa_public_key = function (m) { - this.e = 0; - this.n = new ctx.FF(m); - }; - - rsa_public_key.prototype = { - set: function (n, e) { - this.e = e; - ctx.FF.fromBytes(this.n, n); - }, - - set_e: function (e) { - this.e = e; - }, - - set_n: function (n) { - ctx.FF.fromBytes(this.n, n); - }, - }; - - rsa_public_key.get_instance = function (n, e) { - var pub = new rsa_public_key(ctx.FF.FFLEN); - pub.set(n, e); - return pub; - }; - - return rsa_public_key; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - RSA: RSA, - rsa_private_key: rsa_private_key, - rsa_public_key: rsa_public_key, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/sha3.js b/packages/bls-verify/src/vendor/amcl-js/src/sha3.js deleted file mode 100644 index 8d3fc1bfd..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/sha3.js +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Implementation of the Secure Hashing Algorithm SHA-3 - - * Generates a message digest. It should be impossible to come - * come up with two messages that hash to the same value ("collision free"). - * - * For use with byte-oriented messages only. - */ - -var SHA3 = function (ctx) { - 'use strict'; - - var SHA3 = function (olen) { - this.length = 0; - this.rate = 0; - this.len = 0; - this.S = []; - this.init(olen); - }; - - SHA3.prototype = { - transform: function () { - var C = [], - D = [], - B = [], - i, - j, - k; - - for (k = 0; k < SHA3.ROUNDS; k++) { - C[0] = new ctx.UInt64( - this.S[0][0].top ^ - this.S[0][1].top ^ - this.S[0][2].top ^ - this.S[0][3].top ^ - this.S[0][4].top, - this.S[0][0].bot ^ - this.S[0][1].bot ^ - this.S[0][2].bot ^ - this.S[0][3].bot ^ - this.S[0][4].bot, - ); - C[1] = new ctx.UInt64( - this.S[1][0].top ^ - this.S[1][1].top ^ - this.S[1][2].top ^ - this.S[1][3].top ^ - this.S[1][4].top, - this.S[1][0].bot ^ - this.S[1][1].bot ^ - this.S[1][2].bot ^ - this.S[1][3].bot ^ - this.S[1][4].bot, - ); - C[2] = new ctx.UInt64( - this.S[2][0].top ^ - this.S[2][1].top ^ - this.S[2][2].top ^ - this.S[2][3].top ^ - this.S[2][4].top, - this.S[2][0].bot ^ - this.S[2][1].bot ^ - this.S[2][2].bot ^ - this.S[2][3].bot ^ - this.S[2][4].bot, - ); - C[3] = new ctx.UInt64( - this.S[3][0].top ^ - this.S[3][1].top ^ - this.S[3][2].top ^ - this.S[3][3].top ^ - this.S[3][4].top, - this.S[3][0].bot ^ - this.S[3][1].bot ^ - this.S[3][2].bot ^ - this.S[3][3].bot ^ - this.S[3][4].bot, - ); - C[4] = new ctx.UInt64( - this.S[4][0].top ^ - this.S[4][1].top ^ - this.S[4][2].top ^ - this.S[4][3].top ^ - this.S[4][4].top, - this.S[4][0].bot ^ - this.S[4][1].bot ^ - this.S[4][2].bot ^ - this.S[4][3].bot ^ - this.S[4][4].bot, - ); - - D[0] = SHA3.xor(C[4], SHA3.rotl(C[1], 1)); - D[1] = SHA3.xor(C[0], SHA3.rotl(C[2], 1)); - D[2] = SHA3.xor(C[1], SHA3.rotl(C[3], 1)); - D[3] = SHA3.xor(C[2], SHA3.rotl(C[4], 1)); - D[4] = SHA3.xor(C[3], SHA3.rotl(C[0], 1)); - - for (i = 0; i < 5; i++) { - B[i] = []; - for (j = 0; j < 5; j++) { - B[i][j] = new ctx.UInt64(0, 0); - this.S[i][j] = SHA3.xor(this.S[i][j], D[i]); - } - } - - B[0][0] = this.S[0][0].copy(); - B[1][3] = SHA3.rotl(this.S[0][1], 36); - B[2][1] = SHA3.rotl(this.S[0][2], 3); - B[3][4] = SHA3.rotl(this.S[0][3], 41); - B[4][2] = SHA3.rotl(this.S[0][4], 18); - - B[0][2] = SHA3.rotl(this.S[1][0], 1); - B[1][0] = SHA3.rotl(this.S[1][1], 44); - B[2][3] = SHA3.rotl(this.S[1][2], 10); - B[3][1] = SHA3.rotl(this.S[1][3], 45); - B[4][4] = SHA3.rotl(this.S[1][4], 2); - - B[0][4] = SHA3.rotl(this.S[2][0], 62); - B[1][2] = SHA3.rotl(this.S[2][1], 6); - B[2][0] = SHA3.rotl(this.S[2][2], 43); - B[3][3] = SHA3.rotl(this.S[2][3], 15); - B[4][1] = SHA3.rotl(this.S[2][4], 61); - - B[0][1] = SHA3.rotl(this.S[3][0], 28); - B[1][4] = SHA3.rotl(this.S[3][1], 55); - B[2][2] = SHA3.rotl(this.S[3][2], 25); - B[3][0] = SHA3.rotl(this.S[3][3], 21); - B[4][3] = SHA3.rotl(this.S[3][4], 56); - - B[0][3] = SHA3.rotl(this.S[4][0], 27); - B[1][1] = SHA3.rotl(this.S[4][1], 20); - B[2][4] = SHA3.rotl(this.S[4][2], 39); - B[3][2] = SHA3.rotl(this.S[4][3], 8); - B[4][0] = SHA3.rotl(this.S[4][4], 14); - - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - this.S[i][j] = SHA3.xor( - B[i][j], - SHA3.and(SHA3.not(B[(i + 1) % 5][j]), B[(i + 2) % 5][j]), - ); - } - } - - this.S[0][0] = SHA3.xor(this.S[0][0], SHA3.RC[k]); - } - }, - - copy: function (b) { - var i, j; - this.length = b.length; - this.len = b.len; - this.rate = b.rate; - for (i = 0; i < 5; i++) for (j = 0; j < 5; j++) this.S[i][j] = b.S[i][j].copy(); - }, - - /* Initialise Hash function */ - init: function (olen) { - /* initialise */ - var i, j; - for (i = 0; i < 5; i++) { - this.S[i] = []; - for (j = 0; j < 5; j++) { - this.S[i][j] = new ctx.UInt64(0, 0); - } - } - this.length = 0; - this.len = olen; - this.rate = 200 - 2 * olen; - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var i, j, k, b, cnt, el; - - cnt = this.length % this.rate; - b = cnt % 8; - cnt >>= 3; - i = cnt % 5; - j = Math.floor(cnt / 5); /* process by columns! */ - - el = new ctx.UInt64(0, byt); - for (k = 0; k < b; k++) { - el.shlb(); - } - this.S[i][j] = SHA3.xor(this.S[i][j], el); - - this.length++; - if (this.length % this.rate == 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - /* squeeze the sponge */ - squeeze: function (buff, olen) { - var done, - m = 0, - i, - j, - k, - el; - - /* extract by columns */ - done = false; - - for (;;) { - for (j = 0; j < 5; j++) { - for (i = 0; i < 5; i++) { - el = this.S[i][j].copy(); - for (k = 0; k < 8; k++) { - buff[m++] = el.bot & 0xff; - if (m >= olen || m % this.rate == 0) { - done = true; - break; - } - el = SHA3.rotl(el, 56); - } - - if (done) { - break; - } - } - - if (done) { - break; - } - } - - if (m >= olen) { - break; - } - - done = false; - this.transform(); - } - }, - - hash: function () { - /* pad message and finish - supply digest */ - var buff = []; - var q = this.rate - (this.length % this.rate); - if (q == 1) { - this.process(0x86); - } else { - this.process(0x06); /* 0x06 for SHA-3 */ - while (this.length % this.rate != this.rate - 1) { - this.process(0x00); - } - this.process(0x80); /* this will force a final transform */ - } - this.squeeze(buff, this.len); - return buff; - }, - - continuing_hash() { - var sh = new SHA3(); - sh.copy(this); - return sh.hash(); - }, - - shake: function (buff, olen) { - /* pad message and finish - supply digest */ - var q = this.rate - (this.length % this.rate); - if (q == 1) { - this.process(0x9f); - } else { - this.process(0x1f); /* 0x06 for SHA-3 */ - while (this.length % this.rate != this.rate - 1) { - this.process(0x00); - } - this.process(0x80); /* this will force a final transform */ - } - this.squeeze(buff, olen); - }, - - continuing_shake(buff, olen) { - var sh = new SHA3(); - sh.copy(this); - sh.shake(buff, olen); - }, - }; - - /* static functions */ - SHA3.rotl = function (x, n) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64( - (x.top << n) | (x.bot >>> (32 - n)), - (x.bot << n) | (x.top >>> (32 - n)), - ); - } else { - return new ctx.UInt64( - (x.bot << (n - 32)) | (x.top >>> (64 - n)), - (x.top << (n - 32)) | (x.bot >>> (64 - n)), - ); - } - }; - - SHA3.xor = function (a, b) { - return new ctx.UInt64(a.top ^ b.top, a.bot ^ b.bot); - }; - - SHA3.and = function (a, b) { - return new ctx.UInt64(a.top & b.top, a.bot & b.bot); - }; - - SHA3.not = function (a) { - return new ctx.UInt64(~a.top, ~a.bot); - }; - - /* constants */ - SHA3.ROUNDS = 24; - SHA3.HASH224 = 28; - SHA3.HASH256 = 32; - SHA3.HASH384 = 48; - SHA3.HASH512 = 64; - SHA3.SHAKE128 = 16; - SHA3.SHAKE256 = 32; - - SHA3.RC = [ - new ctx.UInt64(0x00000000, 0x00000001), - new ctx.UInt64(0x00000000, 0x00008082), - new ctx.UInt64(0x80000000, 0x0000808a), - new ctx.UInt64(0x80000000, 0x80008000), - new ctx.UInt64(0x00000000, 0x0000808b), - new ctx.UInt64(0x00000000, 0x80000001), - new ctx.UInt64(0x80000000, 0x80008081), - new ctx.UInt64(0x80000000, 0x00008009), - new ctx.UInt64(0x00000000, 0x0000008a), - new ctx.UInt64(0x00000000, 0x00000088), - new ctx.UInt64(0x00000000, 0x80008009), - new ctx.UInt64(0x00000000, 0x8000000a), - new ctx.UInt64(0x00000000, 0x8000808b), - new ctx.UInt64(0x80000000, 0x0000008b), - new ctx.UInt64(0x80000000, 0x00008089), - new ctx.UInt64(0x80000000, 0x00008003), - new ctx.UInt64(0x80000000, 0x00008002), - new ctx.UInt64(0x80000000, 0x00000080), - new ctx.UInt64(0x00000000, 0x0000800a), - new ctx.UInt64(0x80000000, 0x8000000a), - new ctx.UInt64(0x80000000, 0x80008081), - new ctx.UInt64(0x80000000, 0x00008080), - new ctx.UInt64(0x00000000, 0x80000001), - new ctx.UInt64(0x80000000, 0x80008008), - ]; - - return SHA3; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - SHA3: SHA3, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/share.js b/packages/bls-verify/src/vendor/amcl-js/src/share.js deleted file mode 100644 index 5075f1b41..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/share.js +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Shamir threshold secret sharing module */ -/* Split any byte array into number of shares < 256 */ -/* Specify number of shares required for recovery - nsr */ - -/* See TestMPIN.html for an example of use */ - -var SHARE = function (ctx) { - 'use strict'; - - /* Return a share of M */ - /* input id - Unique share ID */ - /* input nsr - Number of shares required for recovery */ - /* input Message M to be shared */ - /* input Random seed R */ - /* return share structure */ - var SHARE = function (id, nsr, M, R) { - this.ID = 0; - this.NSR = 0; - this.B = []; - if (id < 1 || id >= 256 || nsr < 2 || nsr >= 256) return; - this.ID = id; - this.NSR = nsr; - var m = M.length; - var rng = new ctx.RAND(); - rng.clean(); - rng.seed(R.length, R); - for (var j = 0; j < m; j++) { - var x = this.ID; - this.B[j] = M[j]; - for (var n = 1; n < nsr; n++) { - this.B[j] = SHARE.add(this.B[j], SHARE.mul(rng.getByte(), x)); - x = SHARE.mul(x, this.ID); - } - } - }; - - /* recover M from shares */ - SHARE.recover = function (S) { - var m = S[0].B.length; - var nsr = S[0].NSR; - if (nsr != S.length) return null; - for (var i = 1; i < nsr; i++) { - if (S[i].NSR != nsr || S[i].B.length != m) return null; - } - var M = []; - var x = []; - var y = []; - for (var j = 0; j < m; j++) { - for (var i = 0; i < nsr; i++) { - x[i] = S[i].ID; - y[i] = S[i].B[j]; - } - M[j] = SHARE.interpolate(nsr, x, y); - } - return M; - }; - - /* Internal functions */ - - SHARE.add = function (x, y) { - return x ^ y; - }; - - SHARE.mul = function (x, y) { - var ix = x & 0xff, - iy = y & 0xff, - lx = SHARE.ltab[ix] & 0xff, - ly = SHARE.ltab[iy] & 0xff; - - if (x !== 0 && y !== 0) { - return SHARE.ptab[(lx + ly) % 255]; - } else { - return 0; - } - }; - - SHARE.inv = function (x) { - var ix = x & 0xff; - var lx = SHARE.ltab[ix] & 0xff; - return SHARE.ptab[255 - lx]; - }; - - SHARE.interpolate = function (n, x, y) { - var i, j; - var p, - yp = 0; - for (i = 0; i < n; i++) { - p = 1; - for (j = 0; j < n; j++) - if (i != j) p = SHARE.mul(p, SHARE.mul(x[j], SHARE.inv(SHARE.add(x[i], x[j])))); - yp = SHARE.add(yp, SHARE.mul(p, y[i])); - } - return yp; - }; - - SHARE.ptab = [ - 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53, 95, 225, 56, 72, 216, 115, - 149, 164, 247, 2, 6, 10, 30, 34, 102, 170, 229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, - 112, 144, 171, 230, 49, 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205, - 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136, 131, 158, 185, 208, 107, - 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154, 181, 196, 87, 249, 16, 48, 80, 240, 11, - 29, 39, 105, 187, 214, 97, 163, 254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, - 32, 96, 160, 251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65, 195, 94, - 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117, 159, 186, 213, 100, 172, 239, - 42, 126, 130, 157, 188, 223, 122, 142, 137, 128, 155, 182, 193, 88, 232, 35, 101, 175, 234, 37, - 111, 177, 200, 67, 197, 84, 252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, - 202, 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14, 18, 54, 90, 238, - 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23, 57, 75, 221, 124, 132, 151, 162, 253, - 28, 36, 108, 180, 199, 82, 246, 1, - ]; - SHARE.ltab = [ - 0, 255, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3, 100, 4, 224, 14, 52, 141, 129, - 239, 76, 113, 8, 200, 248, 105, 28, 193, 125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, - 114, 154, 201, 9, 120, 101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142, - 150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56, 102, 221, 253, 48, - 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16, 126, 110, 72, 195, 163, 182, 30, 66, 58, - 107, 40, 84, 250, 133, 61, 186, 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, - 167, 87, 175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232, 44, 215, - 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160, 127, 12, 246, 111, 23, 196, 73, - 236, 216, 67, 31, 45, 164, 118, 123, 183, 204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, - 170, 85, 41, 157, 151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209, - 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171, 68, 17, 146, 217, 35, 32, - 46, 137, 180, 124, 184, 38, 119, 153, 227, 165, 103, 74, 237, 222, 197, 49, 254, 24, 13, 99, - 140, 128, 192, 247, 112, 7, - ]; - return SHARE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - SHARE: SHARE, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/uint64.js b/packages/bls-verify/src/vendor/amcl-js/src/uint64.js deleted file mode 100644 index 75cbd7137..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/uint64.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* rudimentary unsigned 64-bit type for SHA384 and SHA512 */ - -var UInt64 = function () { - 'use strict'; - - var UInt64 = function (top, bot) { - this.top = top; - this.bot = bot; - }; - - UInt64.prototype = { - add: function (y) { - var t = (this.bot >>> 0) + (y.bot >>> 0), - low = t >>> 0, - high = (this.top >>> 0) + (y.top >>> 0); - - this.bot = low; - - if (low != t) { - this.top = (high + 1) >>> 0; - } else { - this.top = high; - } - - return this; - }, - - copy: function () { - var r = new UInt64(this.top, this.bot); - return r; - }, - - shlb: function () { - var t = this.bot >>> 24; - this.top = t + (this.top << 8); - this.bot <<= 8; - return this; - }, - }; - - return UInt64; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - UInt64: UInt64, - }; -} From f11b33c775e45a0996a1408a6da4e1c9972b7b47 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 12:43:50 -0800 Subject: [PATCH 02/11] bls verification working --- README.md | 2 ++ package-lock.json | 9 +++------ packages/bls-verify/package.json | 4 ++-- packages/bls-verify/src/index.test.ts | 8 +++----- packages/bls-verify/src/index.ts | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5b4bb747d..d6e554c66 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Use an Agent to interact with the Internet Computer from your JavaScript program This source code repository contains multiple npm packages, each under `./packages/`. +Note: the `@noble/curves` `verifyShortSignature` function has been audited and merged, but has not yet been released. Once the release is available, we will update the `@dfinity/agent` dependency to use it instead of this manually compiled version + ## Development ### Getting Started diff --git a/package-lock.json b/package-lock.json index c7b8ee476..bba6567e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1983,6 +1983,8 @@ }, "node_modules/@noble/curves": { "version": "1.2.0", + "resolved": "file:noble-curves-1.2.0.tgz", + "integrity": "sha512-Ow/xR1GC0+Qwlos9GA4ueaG7fT48u04ifqmobWr9wtmA+uwWsYcoRToJosUTf2OBqdjVCdc8ZAHjjsNAzYvCCw==", "license": "MIT", "dependencies": { "@noble/hashes": "1.3.2" @@ -5612,10 +5614,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/amcl-js": { - "resolved": "packages/bls-verify/src/vendor/amcl-js", - "link": true - }, "node_modules/amp": { "version": "0.3.1", "dev": true, @@ -20755,7 +20753,7 @@ "version": "0.20.2", "license": "Apache-2.0", "dependencies": { - "amcl-js": "file:src/vendor/amcl-js" + "@noble/curves": "file:../../noble-curves-1.2.0.tgz" }, "devDependencies": { "@types/jest": "^29.5.5", @@ -20783,7 +20781,6 @@ "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "packages/bls-verify/src/vendor/amcl-js": {}, "packages/candid": { "name": "@dfinity/candid", "version": "0.20.2", diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index c0a05c054..df0d45f85 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -39,16 +39,16 @@ "build": "tsc -b && tsc -p tsconfig-cjs.json", "bundle": "esbuild --bundle src/index.ts --outfile=dist/index.js --platform=node", "size-limit": "size-limit", + "test": "vitest", "ci": "npm run prettier && npm run lint && npm run test", "lint": "eslint 'src' --ext '.js,.jsx,.ts,.tsx'", "lint:fix": "npm run lint -- --fix", "make:docs/reference": "typedoc src/index.ts --out ../../docs/generated/bls-verify --excludeInternal", - "test": "jest", "prettier": "prettier --check \"src/**/*.ts\"", "prettier:write": "npm run prettier -- --write" }, "dependencies": { - "amcl-js": "file:src/vendor/amcl-js" + "@noble/curves": "file:../../noble-curves-1.2.0.tgz" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/bls-verify/src/index.test.ts b/packages/bls-verify/src/index.test.ts index fa835156f..a37d87446 100644 --- a/packages/bls-verify/src/index.test.ts +++ b/packages/bls-verify/src/index.test.ts @@ -3,6 +3,7 @@ import * as Cert from '../../agent/src/certificate'; import * as cbor from '../../agent/src/cbor'; import { fromHex } from '../../agent/src/utils/buffer'; import { Principal } from '@dfinity/principal'; +import { test, expect, vi } from 'vitest'; // Root public key for the IC main net, encoded as hex const IC_ROOT_KEY = @@ -16,9 +17,6 @@ const IC_ROOT_KEY = const SAMPLE_CERT = 'd9d9f7a364747265658301830182045820250f5e26868d9c1ea7ab29cbe9c15bf1c47c0d7605e803e39e375a7fe09c6ebb830183024e726571756573745f7374617475738301820458204b268227774ec77ff2b37ecb12157329d54cf376694bdd59ded7803efd82386f83025820edad510eaaa08ed2acd4781324e6446269da6753ec17760f206bbe81c465ff528301830183024b72656a6563745f636f64658203410383024e72656a6563745f6d6573736167658203584443616e69737465722069766733372d71696161612d61616161622d61616167612d63616920686173206e6f20757064617465206d6574686f64202772656769737465722783024673746174757382034872656a65637465648204582097232f31f6ab7ca4fe53eb6568fc3e02bc22fe94ab31d010e5fb3c642301f1608301820458203a48d1fc213d49307103104f7d72c2b5930edba8787b90631f343b3aa68a5f0a83024474696d65820349e2dc939091c696eb16697369676e6174757265583089a2be21b5fa8ac9fab1527e041327ce899d7da971436a1f2165393947b4d942365bfe5488710e61a619ba48388a21b16a64656c65676174696f6ea2697375626e65745f6964581dd77b2a2f7199b9a8aec93fe6fb588661358cf12223e9a3af7b4ebac4026b6365727469666963617465590231d9d9f7a26474726565830182045820ae023f28c3b9d966c8fb09f9ed755c828aadb5152e00aaf700b18c9c067294b483018302467375626e6574830182045820e83bb025f6574c8f31233dc0fe289ff546dfa1e49bd6116dd6e8896d90a4946e830182045820e782619092d69d5bebf0924138bd4116b0156b5a95e25c358ea8cf7e7161a661830183018204582062513fa926c9a9ef803ac284d620f303189588e1d3904349ab63b6470856fc4883018204582060e9a344ced2c9c4a96a0197fd585f2d259dbd193e4eada56239cac26087f9c58302581dd77b2a2f7199b9a8aec93fe6fb588661358cf12223e9a3af7b4ebac402830183024f63616e69737465725f72616e6765738203581bd9d9f781824a000000000020000001014a00000000002fffff010183024a7075626c69635f6b657982035885308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c050302010361009933e1f89e8a3c4d7fdcccdbd518089e2bd4d8180a261f18d9c247a52768ebce98dc7328a39814a8f911086a1dd50cbe015e2a53b7bf78b55288893daa15c346640e8831d72a12bdedd979d28470c34823b8d1c3f4795d9c3984a247132e94fe82045820996f17bb926be3315745dea7282005a793b58e76afeb5d43d1a28ce29d2d158583024474696d6582034995b8aac0e4eda2ea16697369676e61747572655830ace9fcdd9bc977e05d6328f889dc4e7c99114c737a494653cb27a1f55c06f4555e0f160980af5ead098acc195010b2f7'; -beforeEach(() => { - jest.setTimeout(10_000); -}); test('delegation works for canisters within the subnet range', async () => { // The certificate specifies the range from // 0x00000000002000000101 @@ -27,9 +25,9 @@ test('delegation works for canisters within the subnet range', async () => { const rangeStart = Principal.fromHex('00000000002000000101'); const rangeInterior = Principal.fromHex('000000000020000C0101'); const rangeEnd = Principal.fromHex('00000000002FFFFF0101'); - jest.useFakeTimers(); + vi.useFakeTimers(); async function verifies(canisterId) { - jest.setSystemTime(new Date(Date.parse('2022-02-23T07:38:00.652Z'))); + vi.setSystemTime(new Date(Date.parse('2022-02-23T07:38:00.652Z'))); await expect( Cert.Certificate.create({ certificate: fromHex(SAMPLE_CERT), diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index 189f8fcb6..c69a22777 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -9,5 +9,5 @@ export const blsVerify = async ( const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - return bls.verify(sig, msg, pk); + return bls.verifyShortSignature(sig, msg, pk); }; From 75ac5aae2ec654bd1cd9558ff86c89ff42012f8c Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 15:00:30 -0800 Subject: [PATCH 03/11] vitest --- packages/bls-verify/vitest.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/bls-verify/vitest.config.ts diff --git a/packages/bls-verify/vitest.config.ts b/packages/bls-verify/vitest.config.ts new file mode 100644 index 000000000..285af81da --- /dev/null +++ b/packages/bls-verify/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + setupFiles: ['./test-setup.ts'], + testTimeout: 100_000, + }, +}); From e095923a5fb8977a4a3dc49a216802a9a0ab53b3 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 16:54:18 -0800 Subject: [PATCH 04/11] working build --- packages/agent/src/actor.ts | 17 +- packages/agent/src/canisterStatus/index.ts | 1 - packages/agent/src/certificate.ts | 12 +- packages/agent/src/index.ts | 1 - packages/agent/src/polling/index.ts | 2 - packages/agent/src/utils/bls.test.ts | 21 - packages/agent/src/utils/bls.ts | 28 - packages/bls-verify/README.md | 7 - packages/bls-verify/package.json | 1 - packages/bls-verify/src/index.test.ts | 1 - packages/bls-verify/src/index.ts | 6 +- .../bls-verify/src/verifyShortSignature.js | 3066 +++++++++++++++++ packages/bls-verify/tsconfig.json | 2 +- 13 files changed, 3075 insertions(+), 90 deletions(-) delete mode 100644 packages/agent/src/utils/bls.test.ts delete mode 100644 packages/agent/src/utils/bls.ts create mode 100644 packages/bls-verify/src/verifyShortSignature.js diff --git a/packages/agent/src/actor.ts b/packages/agent/src/actor.ts index 6d1947314..73df8d355 100644 --- a/packages/agent/src/actor.ts +++ b/packages/agent/src/actor.ts @@ -14,7 +14,6 @@ import { pollForResponse, PollStrategyFactory, strategy } from './polling'; import { Principal } from '@dfinity/principal'; import { RequestId } from './request_id'; import { toHex } from './utils/buffer'; -import { CreateCertificateOptions } from './certificate'; import managementCanisterIdl from './canisters/management_idl'; import _SERVICE from './canisters/management_service'; @@ -130,11 +129,6 @@ export interface ActorConfig extends CallConfig { args: unknown[], callConfig: CallConfig, ): Partial | void; - - /** - * Polyfill for BLS Certificate verification in case wasm is not supported - */ - blsVerify?: CreateCertificateOptions['blsVerify']; } // TODO: move this to proper typing when Candid support TypeScript. @@ -308,7 +302,7 @@ export class Actor { func.annotations.push(ACTOR_METHOD_WITH_HTTP_DETAILS); } - this[methodName] = _createActorMethod(this, methodName, func, config.blsVerify); + this[methodName] = _createActorMethod(this, methodName, func); } } } @@ -369,12 +363,7 @@ export type ActorConstructor = new (config: ActorConfig) => ActorSubclass; export const ACTOR_METHOD_WITH_HTTP_DETAILS = 'http-details'; -function _createActorMethod( - actor: Actor, - methodName: string, - func: IDL.FuncClass, - blsVerify?: CreateCertificateOptions['blsVerify'], -): ActorMethod { +function _createActorMethod(actor: Actor, methodName: string, func: IDL.FuncClass): ActorMethod { let caller: (options: CallConfig, ...args: unknown[]) => Promise; if (func.annotations.includes('query') || func.annotations.includes('composite_query')) { caller = async (options, ...args) => { @@ -437,7 +426,7 @@ function _createActorMethod( } const pollStrategy = pollingStrategyFactory(); - const responseBytes = await pollForResponse(agent, ecid, requestId, pollStrategy, blsVerify); + const responseBytes = await pollForResponse(agent, ecid, requestId, pollStrategy); const shouldIncludeHttpDetails = func.annotations.includes(ACTOR_METHOD_WITH_HTTP_DETAILS); if (responseBytes !== undefined) { diff --git a/packages/agent/src/canisterStatus/index.ts b/packages/agent/src/canisterStatus/index.ts index a680cd7d0..e7ab822b8 100644 --- a/packages/agent/src/canisterStatus/index.ts +++ b/packages/agent/src/canisterStatus/index.ts @@ -90,7 +90,6 @@ export type CanisterStatusOptions = { canisterId: Principal; agent: HttpAgent; paths?: Path[] | Set; - blsVerify?: CreateCertificateOptions['blsVerify']; }; /** diff --git a/packages/agent/src/certificate.ts b/packages/agent/src/certificate.ts index 376483c6e..cdc9b54f6 100644 --- a/packages/agent/src/certificate.ts +++ b/packages/agent/src/certificate.ts @@ -3,7 +3,7 @@ import { AgentError } from './errors'; import { hash } from './request_id'; import { concat, fromHex, toHex } from './utils/buffer'; import { Principal } from '@dfinity/principal'; -import * as bls from './utils/bls'; +import { blsVerify } from '@dfinity/bls-verify'; import { decodeTime } from './utils/leb'; /** @@ -170,15 +170,10 @@ export class Certificate { * @throws {CertificateVerificationError} */ public static async create(options: CreateCertificateOptions): Promise { - let blsVerify = options.blsVerify; - if (!blsVerify) { - blsVerify = bls.blsVerify; - } const cert = new Certificate( options.certificate, options.rootKey, options.canisterId, - blsVerify, options.maxAgeInMinutes, ); @@ -190,8 +185,6 @@ export class Certificate { certificate: ArrayBuffer, private _rootKey: ArrayBuffer, private _canisterId: Principal, - private _blsVerify: VerifyFunc, - // Default to 5 minutes private _maxAgeInMinutes: number = 5, ) { this.cert = cbor.decode(new Uint8Array(certificate)); @@ -245,7 +238,7 @@ export class Certificate { } try { - sigVer = await this._blsVerify(new Uint8Array(key), new Uint8Array(sig), new Uint8Array(msg)); + sigVer = await blsVerify(new Uint8Array(key), new Uint8Array(sig), new Uint8Array(msg)); } catch (err) { sigVer = false; } @@ -263,7 +256,6 @@ export class Certificate { certificate: d.certificate, rootKey: this._rootKey, canisterId: this._canisterId, - blsVerify: this._blsVerify, // Do not check max age for delegation certificates maxAgeInMinutes: Infinity, }); diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index 5d195a5e1..500b2c4cc 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -11,7 +11,6 @@ export * from './der'; export * from './fetch_candid'; export * from './public_key'; export * from './request_id'; -export * from './utils/bls'; export * from './utils/buffer'; export * from './utils/random'; export * as polling from './polling'; diff --git a/packages/agent/src/polling/index.ts b/packages/agent/src/polling/index.ts index 09c1e445d..d8f18e452 100644 --- a/packages/agent/src/polling/index.ts +++ b/packages/agent/src/polling/index.ts @@ -29,7 +29,6 @@ export async function pollForResponse( strategy: PollStrategy, // eslint-disable-next-line request?: any, - blsVerify?: CreateCertificateOptions['blsVerify'], ): Promise { const path = [new TextEncoder().encode('request_status'), requestId]; const currentRequest = request ?? (await agent.createReadStateRequest?.({ paths: [path] })); @@ -39,7 +38,6 @@ export async function pollForResponse( certificate: state.certificate, rootKey: agent.rootKey, canisterId: canisterId, - blsVerify, }); const maybeBuf = cert.lookup([...path, new TextEncoder().encode('status')]); let status; diff --git a/packages/agent/src/utils/bls.test.ts b/packages/agent/src/utils/bls.test.ts deleted file mode 100644 index 65d6f6303..000000000 --- a/packages/agent/src/utils/bls.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { blsVerify } from './bls'; -import { fromHex } from './buffer'; - -test('verify', async () => { - const pk = new Uint8Array( - fromHex( - 'a7623a93cdb56c4d23d99c14216afaab3dfd6d4f9eb3db23d038280b6d5cb2caaee2a19dd92c9df7001d' + - 'ede23bf036bc0f33982dfb41e8fa9b8e96b5dc3e83d55ca4dd146c7eb2e8b6859cb5a5db815db86810b8' + - 'd12cee1588b5dbf34a4dc9a5', - ), - ); - const sig = new Uint8Array( - fromHex( - 'b89e13a212c830586eaa9ad53946cd968718ebecc27eda849d9232673dcd4f440e8b5df39bf14a88048c15e16cbcaabe', - ), - ); - - const msg = new Uint8Array(new TextEncoder().encode('hello')); - expect(await blsVerify(pk, sig, msg)).toBe(true); - expect(await blsVerify(pk, sig, new Uint8Array(new TextEncoder().encode('hallo')))).toBe(false); -}, 10000); // Default timer is flaky with WASM. diff --git a/packages/agent/src/utils/bls.ts b/packages/agent/src/utils/bls.ts deleted file mode 100644 index 1688e93ea..000000000 --- a/packages/agent/src/utils/bls.ts +++ /dev/null @@ -1,28 +0,0 @@ -import init, { bls_init, bls_verify } from '../vendor/bls/bls'; - -export let verify: (pk: Uint8Array, sig: Uint8Array, msg: Uint8Array) => boolean; - -/** - * - * @param pk primary key: Uint8Array - * @param sig signature: Uint8Array - * @param msg message: Uint8Array - * @returns Promise resolving a boolean - */ -export async function blsVerify( - pk: Uint8Array, - sig: Uint8Array, - msg: Uint8Array, -): Promise { - if (!verify) { - await init(); - if (bls_init() !== 0) { - throw new Error('Cannot initialize BLS'); - } - verify = (pk1, sig1, msg1) => { - // Reorder things from what the WASM expects (sig, m, w). - return bls_verify(sig1, msg1, pk1) === 0; - }; - } - return verify(pk, sig, msg); -} diff --git a/packages/bls-verify/README.md b/packages/bls-verify/README.md index 9d601693f..83c218816 100644 --- a/packages/bls-verify/README.md +++ b/packages/bls-verify/README.md @@ -20,11 +20,4 @@ npm i --save @dfinity/bls-verify ```ts import { blsVerify } from '@dfinity/bls-verify'; -import { createActor, canisterId } from '../declarations/example'; - -const exampleActor = createActor(canisterId, { - actorOptions: { - blsVerify, - }, -}); ``` diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index df0d45f85..c776eeb1a 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -13,7 +13,6 @@ "bugs": { "url": "https://github.com/dfinity/agent-js/issues" }, - "type": "module", "keywords": [ "internet computer", "ic", diff --git a/packages/bls-verify/src/index.test.ts b/packages/bls-verify/src/index.test.ts index a37d87446..fc658fd19 100644 --- a/packages/bls-verify/src/index.test.ts +++ b/packages/bls-verify/src/index.test.ts @@ -33,7 +33,6 @@ test('delegation works for canisters within the subnet range', async () => { certificate: fromHex(SAMPLE_CERT), rootKey: fromHex(IC_ROOT_KEY), canisterId: canisterId, - blsVerify, }), ).resolves.not.toThrow(); } diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index c69a22777..86c2ca04d 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -1,13 +1,13 @@ import { toHex } from './utils'; -import { bls12_381 as bls } from '@noble/curves/bls12-381'; - export const blsVerify = async ( primaryKey: Uint8Array | string, signature: Uint8Array | string, message: Uint8Array | string, ): Promise => { + const { verifyShortSignature } = (await import('./verifyShortSignature')).default() as any; + const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - return bls.verifyShortSignature(sig, msg, pk); + return verifyShortSignature(sig, msg, pk); }; diff --git a/packages/bls-verify/src/verifyShortSignature.js b/packages/bls-verify/src/verifyShortSignature.js new file mode 100644 index 000000000..575a3fc5d --- /dev/null +++ b/packages/bls-verify/src/verifyShortSignature.js @@ -0,0 +1,3066 @@ +/* eslint-disable */ +// Extracted from @noble/curves commit fb02e93ff66ecd7bc7257d8f76e6cdf88b54bfa9 +export default () => { + var __defProp = Object.defineProperty; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __esm = (fn, res) => + function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res; + }; + var __commonJS = (cb, mod2) => + function __require() { + return ( + mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), + mod2.exports + ); + }; + var __export = (target, all) => { + for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); + }; + + // node_modules/@noble/hashes/esm/_assert.js + function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); + } + function exists(instance, checkFinished = true) { + if (instance.destroyed) throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); + } + function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } + } + var init_assert = __esm({ + 'node_modules/@noble/hashes/esm/_assert.js'() {}, + }); + + // node_modules/@noble/hashes/esm/crypto.js + var crypto; + var init_crypto = __esm({ + 'node_modules/@noble/hashes/esm/crypto.js'() { + crypto = + typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : void 0; + }, + }); + + // node_modules/@noble/hashes/esm/utils.js + function utf8ToBytes(str) { + if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); + } + function toBytes(data) { + if (typeof data === 'string') data = utf8ToBytes(data); + if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; + } + function wrapConstructor(hashCons) { + const hashC = msg => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; + } + function randomBytes(bytesLength = 32) { + if (crypto && typeof crypto.getRandomValues === 'function') { + return crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); + } + var u8a, createView, rotr, isLE, Hash, toStr; + var init_utils = __esm({ + 'node_modules/@noble/hashes/esm/utils.js'() { + init_crypto(); + u8a = a => a instanceof Uint8Array; + createView = arr => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); + rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); + isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; + if (!isLE) throw new Error('Non little-endian hardware is not supported'); + Hash = class { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } + }; + toStr = {}.toString; + }, + }); + + // node_modules/@noble/hashes/esm/_sha2.js + function setBigUint64(view, byteOffset, value, isLE2) { + if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE2); + const _32n = BigInt(32); + const _u32_max = BigInt(4294967295); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE2 ? 4 : 0; + const l = isLE2 ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE2); + view.setUint32(byteOffset + l, wl, isLE2); + } + var SHA2; + var init_sha2 = __esm({ + 'node_modules/@noble/hashes/esm/_sha2.js'() { + init_assert(); + init_utils(); + SHA2 = class extends Hash { + constructor(blockLen, outputLen, padOffset, isLE2) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE2; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data) { + exists(this); + const { view, buffer, blockLen } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len; ) { + const take = Math.min(blockLen - this.pos, len - pos); + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + exists(this); + output(out, this); + this.finished = true; + const { buffer, view, blockLen, isLE: isLE2 } = this; + let { pos } = this; + buffer[pos++] = 128; + this.buffer.subarray(pos).fill(0); + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + for (let i = pos; i < blockLen; i++) buffer[i] = 0; + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); + this.process(view, 0); + const oview = createView(out); + const len = this.outputLen; + if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE2); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) to.buffer.set(buffer); + return to; + } + }; + }, + }); + + // node_modules/@noble/hashes/esm/sha256.js + var Chi, Maj, SHA256_K, IV, SHA256_W, SHA256, sha256; + var init_sha256 = __esm({ + 'node_modules/@noble/hashes/esm/sha256.js'() { + init_sha2(); + init_utils(); + Chi = (a, b, c) => (a & b) ^ (~a & c); + Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); + SHA256_K = /* @__PURE__ */ new Uint32Array([ + 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, + 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, + 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, + 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, + 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, + 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, + 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, + 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, + 2361852424, 2428436474, 2756734187, 3204031479, 3329325298, + ]); + IV = /* @__PURE__ */ new Uint32Array([ + 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, + 1541459225, + ]); + SHA256_W = /* @__PURE__ */ new Uint32Array(64); + SHA256 = class extends SHA2 { + constructor() { + super(64, 32, 8, false); + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } + }; + sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); + }, + }); + + // node_modules/@noble/curves/esm/abstract/utils.js + var utils_exports = {}; + __export(utils_exports, { + bitGet: () => bitGet, + bitLen: () => bitLen, + bitMask: () => bitMask, + bitSet: () => bitSet, + bytesToHex: () => bytesToHex, + bytesToNumberBE: () => bytesToNumberBE, + bytesToNumberLE: () => bytesToNumberLE, + concatBytes: () => concatBytes, + createHmacDrbg: () => createHmacDrbg, + ensureBytes: () => ensureBytes, + equalBytes: () => equalBytes, + hexToBytes: () => hexToBytes, + hexToNumber: () => hexToNumber, + numberToBytesBE: () => numberToBytesBE, + numberToBytesLE: () => numberToBytesLE, + numberToHexUnpadded: () => numberToHexUnpadded, + numberToVarBytesBE: () => numberToVarBytesBE, + utf8ToBytes: () => utf8ToBytes2, + validateObject: () => validateObject, + }); + function bytesToHex(bytes2) { + if (!u8a2(bytes2)) throw new Error('Uint8Array expected'); + let hex = ''; + for (let i = 0; i < bytes2.length; i++) { + hex += hexes[bytes2[i]]; + } + return hex; + } + function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + } + function hexToNumber(hex) { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + return BigInt(hex === '' ? '0' : `0x${hex}`); + } + function asciiToBase16(char) { + if (char >= asciis._0 && char <= asciis._9) return char - asciis._0; + if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10); + if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10); + return; + } + function hexToBytes(hex) { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + const hl = hex.length; + const al = hl / 2; + if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl); + const array = new Uint8Array(al); + for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { + const n1 = asciiToBase16(hex.charCodeAt(hi)); + const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); + if (n1 === void 0 || n2 === void 0) { + const char = hex[hi] + hex[hi + 1]; + throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); + } + array[ai] = n1 * 16 + n2; + } + return array; + } + function bytesToNumberBE(bytes2) { + return hexToNumber(bytesToHex(bytes2)); + } + function bytesToNumberLE(bytes2) { + if (!u8a2(bytes2)) throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse())); + } + function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); + } + function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); + } + function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); + } + function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } else if (u8a2(hex)) { + res = Uint8Array.from(hex); + } else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; + } + function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; + arrays.forEach(a => { + if (!u8a2(a)) throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; + } + function equalBytes(b1, b2) { + if (b1.length !== b2.length) return false; + for (let i = 0; i < b1.length; i++) if (b1[i] !== b2[i]) return false; + return true; + } + function utf8ToBytes2(str) { + if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); + } + function bitLen(n) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1); + return len; + } + function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n; + } + function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') throw new Error('hmacFn must be a function'); + let v = u8n(hashLen); + let k = u8n(hashLen); + let i = 0; + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); + const reseed = (seed = u8n()) => { + k = h(u8fr([0]), seed); + v = h(); + if (seed.length === 0) return; + k = h(u8fr([1]), seed); + v = h(); + }; + const gen = () => { + if (i++ >= 1e3) throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); + let res = void 0; + while (!(res = pred(gen()))) reseed(); + reset(); + return res; + }; + return genUntil; + } + function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === void 0) return; + if (!checkVal(val, object)) { + throw new Error( + `Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`, + ); + } + }; + for (const [fieldName, type] of Object.entries(validators)) checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; + } + var _0n, _1n, _2n, u8a2, hexes, asciis, bitSet, bitMask, u8n, u8fr, validatorFns; + var init_utils2 = __esm({ + 'node_modules/@noble/curves/esm/abstract/utils.js'() { + _0n = BigInt(0); + _1n = BigInt(1); + _2n = BigInt(2); + u8a2 = a => a instanceof Uint8Array; + hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => + i.toString(16).padStart(2, '0'), + ); + asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; + bitSet = (n, pos, value) => { + return n | ((value ? _1n : _0n) << BigInt(pos)); + }; + bitMask = n => (_2n << BigInt(n - 1)) - _1n; + u8n = data => new Uint8Array(data); + u8fr = arr => Uint8Array.from(arr); + validatorFns = { + bigint: val => typeof val === 'bigint', + function: val => typeof val === 'function', + boolean: val => typeof val === 'boolean', + string: val => typeof val === 'string', + stringOrUint8Array: val => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: val => Number.isSafeInteger(val), + array: val => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: val => typeof val === 'function' && Number.isSafeInteger(val.outputLen), + }; + }, + }); + + // node_modules/@noble/curves/esm/abstract/modular.js + function mod(a, b) { + const result = a % b; + return result >= _0n2 ? result : b + result; + } + function pow(num, power, modulo) { + if (modulo <= _0n2 || power < _0n2) throw new Error('Expected power/modulo > 0'); + if (modulo === _1n2) return _0n2; + let res = _1n2; + while (power > _0n2) { + if (power & _1n2) res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n2; + } + return res; + } + function invert(number, modulo) { + if (number === _0n2 || modulo <= _0n2) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + let a = mod(number, modulo); + let b = modulo; + let x = _0n2, + y = _1n2, + u = _1n2, + v = _0n2; + while (a !== _0n2) { + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + (b = a), (a = r), (x = u), (y = v), (u = m), (v = n); + } + const gcd = b; + if (gcd !== _1n2) throw new Error('invert: does not exist'); + return mod(x, modulo); + } + function tonelliShanks(P) { + const legendreC = (P - _1n2) / _2n2; + let Q, S, Z; + for (Q = P - _1n2, S = 0; Q % _2n2 === _0n2; Q /= _2n2, S++); + for (Z = _2n2; Z < P && pow(Z, legendreC, P) !== P - _1n2; Z++); + if (S === 1) { + const p1div4 = (P + _1n2) / _4n; + return function tonelliFast(Fp3, n) { + const root = Fp3.pow(n, p1div4); + if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + const Q1div2 = (Q + _1n2) / _2n2; + return function tonelliSlow(Fp3, n) { + if (Fp3.pow(n, legendreC) === Fp3.neg(Fp3.ONE)) throw new Error('Cannot find square root'); + let r = S; + let g = Fp3.pow(Fp3.mul(Fp3.ONE, Z), Q); + let x = Fp3.pow(n, Q1div2); + let b = Fp3.pow(n, Q); + while (!Fp3.eql(b, Fp3.ONE)) { + if (Fp3.eql(b, Fp3.ZERO)) return Fp3.ZERO; + let m = 1; + for (let t2 = Fp3.sqr(b); m < r; m++) { + if (Fp3.eql(t2, Fp3.ONE)) break; + t2 = Fp3.sqr(t2); + } + const ge = Fp3.pow(g, _1n2 << BigInt(r - m - 1)); + g = Fp3.sqr(ge); + x = Fp3.mul(x, ge); + b = Fp3.mul(b, g); + r = m; + } + return x; + }; + } + function FpSqrt(P) { + if (P % _4n === _3n) { + const p1div4 = (P + _1n2) / _4n; + return function sqrt3mod4(Fp3, n) { + const root = Fp3.pow(n, p1div4); + if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp3, n) { + const n2 = Fp3.mul(n, _2n2); + const v = Fp3.pow(n2, c1); + const nv = Fp3.mul(n, v); + const i = Fp3.mul(Fp3.mul(nv, _2n2), v); + const root = Fp3.mul(nv, Fp3.sub(i, Fp3.ONE)); + if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + if (P % _16n === _9n) { + } + return tonelliShanks(P); + } + function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return validateObject(field, opts); + } + function FpPow(f, num, power) { + if (power < _0n2) throw new Error('Expected power > 0'); + if (power === _0n2) return f.ONE; + if (power === _1n2) return num; + let p = f.ONE; + let d = num; + while (power > _0n2) { + if (power & _1n2) p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n2; + } + return p; + } + function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + const inverted = f.inv(lastMultiplied); + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; + } + function nLength(n, nBitLength) { + const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; + } + function Field(ORDER, bitLen2, isLE2 = false, redef = {}) { + if (ORDER <= _0n2) throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2); + if (BYTES > 2048) throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: bitMask(BITS), + ZERO: _0n2, + ONE: _1n2, + create: num => mod(num, ORDER), + isValid: num => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n2 <= num && num < ORDER; + }, + is0: num => num === _0n2, + isOdd: num => (num & _1n2) === _1n2, + neg: num => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: num => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: num => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: num => invert(num, ORDER), + sqrt: redef.sqrt || (n => sqrtP(f, n)), + invertBatch: lst => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: num => (isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), + fromBytes: bytes2 => { + if (bytes2.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`); + return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2); + }, + }); + return Object.freeze(f); + } + function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); + } + function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); + } + function mapHashToField(key, fieldOrder, isLE2 = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key); + const reduced = mod(num, fieldOrder - _1n2) + _1n2; + return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); + } + var _0n2, _1n2, _2n2, _3n, _4n, _5n, _8n, _9n, _16n, FIELD_FIELDS; + var init_modular = __esm({ + 'node_modules/@noble/curves/esm/abstract/modular.js'() { + init_utils2(); + _0n2 = BigInt(0); + _1n2 = BigInt(1); + _2n2 = BigInt(2); + _3n = BigInt(3); + _4n = BigInt(4); + _5n = BigInt(5); + _8n = BigInt(8); + _9n = BigInt(9); + _16n = BigInt(16); + FIELD_FIELDS = [ + 'create', + 'isValid', + 'is0', + 'neg', + 'inv', + 'sqrt', + 'sqr', + 'eql', + 'add', + 'sub', + 'mul', + 'pow', + 'div', + 'addN', + 'subN', + 'mulN', + 'sqrN', + ]; + }, + }); + + // node_modules/@noble/curves/esm/abstract/hash-to-curve.js + function validateDST(dst) { + if (dst instanceof Uint8Array) return dst; + if (typeof dst === 'string') return utf8ToBytes2(dst); + throw new Error('DST must be Uint8Array or string'); + } + function i2osp(value, length) { + if (value < 0 || value >= 1 << (8 * length)) { + throw new Error(`bad I2OSP call: value=${value} length=${length}`); + } + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 255; + value >>>= 8; + } + return new Uint8Array(res); + } + function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; + } + function isBytes(item) { + if (!(item instanceof Uint8Array)) throw new Error('Uint8Array expected'); + } + function isNum(item) { + if (!Number.isSafeInteger(item)) throw new Error('number expected'); + } + function expand_message_xmd(msg, DST, lenInBytes, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + if (DST.length > 255) DST = H(concatBytes(utf8ToBytes2('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (ell > 255) throw new Error('Invalid xmd length'); + const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); + const b = new Array(ell); + const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H(concatBytes(...args)); + } + const pseudo_random_bytes = concatBytes(...b); + return pseudo_random_bytes.slice(0, lenInBytes); + } + function expand_message_xof(msg, DST, lenInBytes, k, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update(utf8ToBytes2('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest(); + } + function hash_to_field(msg, count, options) { + validateObject(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + isBytes(msg); + isNum(count); + const DST = validateDST(_DST); + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); + const len_in_bytes = count * m * L; + let prb; + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } else if (expand === '_internal_pass') { + prb = msg; + } else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = mod(os2ip(tv), p); + } + u[i] = e; + } + return u; + } + function isogenyMap(field, map) { + const COEFF = map.map(i => Array.from(i).reverse()); + return (x, y) => { + const [xNum, xDen, yNum, yDen] = COEFF.map(val => + val.reduce((acc, i) => field.add(field.mul(acc, x), i)), + ); + x = field.div(xNum, xDen); + y = field.mul(y, field.div(yNum, yDen)); + return { x, y }; + }; + } + function createHasher(Point, mapToCurve, def) { + if (typeof mapToCurve !== 'function') throw new Error('mapToCurve() must be defined'); + return { + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); + const u0 = Point.fromAffine(mapToCurve(u[0])); + const u1 = Point.fromAffine(mapToCurve(u[1])); + const P = u0.add(u1).clearCofactor(); + P.assertValidity(); + return P; + }, + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); + const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); + P.assertValidity(); + return P; + }, + }; + } + var os2ip; + var init_hash_to_curve = __esm({ + 'node_modules/@noble/curves/esm/abstract/hash-to-curve.js'() { + init_modular(); + init_utils2(); + os2ip = bytesToNumberBE; + }, + }); + + // node_modules/@noble/curves/esm/abstract/curve.js + function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = W => { + const windows = Math.ceil(bits / W) + 1; + const windowSize = 2 ** (W - 1); + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n3) { + if (n & _1n3) p = p.add(d); + d = d.double(); + n >>= _1n3; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + let wbits = Number(n & mask); + n >>= shiftBy; + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n3; + } + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + const W = P._WINDOW_SIZE || 1; + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; + } + function validateBasic(curve) { + validateField(curve.Fp); + validateObject( + curve, + { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, + { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }, + ); + return Object.freeze({ + ...nLength(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); + } + var _0n3, _1n3; + var init_curve = __esm({ + 'node_modules/@noble/curves/esm/abstract/curve.js'() { + init_modular(); + init_utils2(); + _0n3 = BigInt(0); + _1n3 = BigInt(1); + }, + }); + + // node_modules/@noble/curves/esm/abstract/weierstrass.js + function validatePointOpts(curve) { + const opts = validateBasic(curve); + validateObject( + opts, + { + a: 'field', + b: 'field', + }, + { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }, + ); + const { endo, Fp: Fp3, a } = opts; + if (endo) { + if (!Fp3.eql(a, Fp3.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if ( + typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function' + ) { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); + } + function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp: Fp3 } = CURVE; + const toBytes2 = + CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return concatBytes(Uint8Array.from([4]), Fp3.toBytes(a.x), Fp3.toBytes(a.y)); + }); + const fromBytes = + CURVE.fromBytes || + (bytes2 => { + const tail = bytes2.subarray(1); + const x = Fp3.fromBytes(tail.subarray(0, Fp3.BYTES)); + const y = Fp3.fromBytes(tail.subarray(Fp3.BYTES, 2 * Fp3.BYTES)); + return { x, y }; + }); + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp3.sqr(x); + const x3 = Fp3.mul(x2, x); + return Fp3.add(Fp3.add(x3, Fp3.mul(x, a)), b); + } + if (!Fp3.eql(Fp3.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n4 < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) key = bytesToHex(key); + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : bytesToNumberBE(ensureBytes('private key', key, nByteLength)); + } catch (error) { + throw new Error( + `private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`, + ); + } + if (wrapPrivateKey) num = mod(num, n); + assertGE(num); + return num; + } + const pointPrecomputes = /* @__PURE__ */ new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) throw new Error('ProjectivePoint expected'); + } + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp3.isValid(px)) throw new Error('x required'); + if (py == null || !Fp3.isValid(py)) throw new Error('y required'); + if (pz == null || !Fp3.isValid(pz)) throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp3.isValid(x) || !Fp3.isValid(y)) throw new Error('invalid affine point'); + if (p instanceof Point) throw new Error('projective point not allowed'); + const is0 = i => Fp3.eql(i, Fp3.ZERO); + if (is0(x) && is0(y)) return Point.ZERO; + return new Point(x, y, Fp3.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp3.invertBatch(points.map(p => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + if (this.is0()) { + if (CURVE.allowInfinityPoint && !Fp3.is0(this.py)) return; + throw new Error('bad point: ZERO'); + } + const { x, y } = this.toAffine(); + if (!Fp3.isValid(x) || !Fp3.isValid(y)) throw new Error('bad point: x or y not FE'); + const left = Fp3.sqr(y); + const right = weierstrassEquation(x); + if (!Fp3.eql(left, right)) throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp3.isOdd) return !Fp3.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp3.eql(Fp3.mul(X1, Z2), Fp3.mul(X2, Z1)); + const U2 = Fp3.eql(Fp3.mul(Y1, Z2), Fp3.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp3.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp3.mul(b, _3n2); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp3.ZERO, + Y3 = Fp3.ZERO, + Z3 = Fp3.ZERO; + let t0 = Fp3.mul(X1, X1); + let t1 = Fp3.mul(Y1, Y1); + let t2 = Fp3.mul(Z1, Z1); + let t3 = Fp3.mul(X1, Y1); + t3 = Fp3.add(t3, t3); + Z3 = Fp3.mul(X1, Z1); + Z3 = Fp3.add(Z3, Z3); + X3 = Fp3.mul(a, Z3); + Y3 = Fp3.mul(b3, t2); + Y3 = Fp3.add(X3, Y3); + X3 = Fp3.sub(t1, Y3); + Y3 = Fp3.add(t1, Y3); + Y3 = Fp3.mul(X3, Y3); + X3 = Fp3.mul(t3, X3); + Z3 = Fp3.mul(b3, Z3); + t2 = Fp3.mul(a, t2); + t3 = Fp3.sub(t0, t2); + t3 = Fp3.mul(a, t3); + t3 = Fp3.add(t3, Z3); + Z3 = Fp3.add(t0, t0); + t0 = Fp3.add(Z3, t0); + t0 = Fp3.add(t0, t2); + t0 = Fp3.mul(t0, t3); + Y3 = Fp3.add(Y3, t0); + t2 = Fp3.mul(Y1, Z1); + t2 = Fp3.add(t2, t2); + t0 = Fp3.mul(t2, t3); + X3 = Fp3.sub(X3, t0); + Z3 = Fp3.mul(t2, t1); + Z3 = Fp3.add(Z3, Z3); + Z3 = Fp3.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp3.ZERO, + Y3 = Fp3.ZERO, + Z3 = Fp3.ZERO; + const a = CURVE.a; + const b3 = Fp3.mul(CURVE.b, _3n2); + let t0 = Fp3.mul(X1, X2); + let t1 = Fp3.mul(Y1, Y2); + let t2 = Fp3.mul(Z1, Z2); + let t3 = Fp3.add(X1, Y1); + let t4 = Fp3.add(X2, Y2); + t3 = Fp3.mul(t3, t4); + t4 = Fp3.add(t0, t1); + t3 = Fp3.sub(t3, t4); + t4 = Fp3.add(X1, Z1); + let t5 = Fp3.add(X2, Z2); + t4 = Fp3.mul(t4, t5); + t5 = Fp3.add(t0, t2); + t4 = Fp3.sub(t4, t5); + t5 = Fp3.add(Y1, Z1); + X3 = Fp3.add(Y2, Z2); + t5 = Fp3.mul(t5, X3); + X3 = Fp3.add(t1, t2); + t5 = Fp3.sub(t5, X3); + Z3 = Fp3.mul(a, t4); + X3 = Fp3.mul(b3, t2); + Z3 = Fp3.add(X3, Z3); + X3 = Fp3.sub(t1, Z3); + Z3 = Fp3.add(t1, Z3); + Y3 = Fp3.mul(X3, Z3); + t1 = Fp3.add(t0, t0); + t1 = Fp3.add(t1, t0); + t2 = Fp3.mul(a, t2); + t4 = Fp3.mul(b3, t4); + t1 = Fp3.add(t1, t2); + t2 = Fp3.sub(t0, t2); + t2 = Fp3.mul(a, t2); + t4 = Fp3.add(t4, t2); + t0 = Fp3.mul(t1, t4); + Y3 = Fp3.add(Y3, t0); + t0 = Fp3.mul(t5, t4); + X3 = Fp3.mul(t3, X3); + X3 = Fp3.sub(X3, t0); + t0 = Fp3.mul(t3, t1); + Z3 = Fp3.mul(t5, Z3); + Z3 = Fp3.add(Z3, t0); + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, comp => { + const toInv = Fp3.invertBatch(comp.map(p => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n4) return I; + assertGE(n); + if (n === _1n4) return this; + const { endo } = CURVE; + if (!endo) return wnaf.unsafeLadder(this, n); + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n4 || k2 > _0n4) { + if (k1 & _1n4) k1p = k1p.add(d); + if (k2 & _1n4) k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n4; + k2 >>= _1n4; + } + if (k1neg) k1p = k1p.negate(); + if (k2neg) k2p = k2p.negate(); + k2p = new Point(Fp3.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp3.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; + const mul = (P, a2) => + a2 === _0n4 || a2 === _1n4 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? void 0 : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + if (iz == null) iz = is0 ? Fp3.ONE : Fp3.inv(z); + const ax = Fp3.mul(x, iz); + const ay = Fp3.mul(y, iz); + const zz = Fp3.mul(z, iz); + if (is0) return { x: Fp3.ZERO, y: Fp3.ZERO }; + if (!Fp3.eql(zz, Fp3.ONE)) throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n4) return true; + if (isTorsionFree) return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n4) return this; + if (clearCofactor) return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes2(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp3.ONE); + Point.ZERO = new Point(Fp3.ZERO, Fp3.ONE, Fp3.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; + } + function SWUFpSqrtRatio(Fp3, Z) { + const q = Fp3.ORDER; + let l = _0n4; + for (let o = q - _1n4; o % _2n3 === _0n4; o /= _2n3) l += _1n4; + const c1 = l; + const _2n_pow_c1_1 = _2n3 << (c1 - _1n4 - _1n4); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n3; + const c2 = (q - _1n4) / _2n_pow_c1; + const c3 = (c2 - _1n4) / _2n3; + const c4 = _2n_pow_c1 - _1n4; + const c5 = _2n_pow_c1_1; + const c6 = Fp3.pow(Z, c2); + const c7 = Fp3.pow(Z, (c2 + _1n4) / _2n3); + let sqrtRatio = (u, v) => { + let tv1 = c6; + let tv2 = Fp3.pow(v, c4); + let tv3 = Fp3.sqr(tv2); + tv3 = Fp3.mul(tv3, v); + let tv5 = Fp3.mul(u, tv3); + tv5 = Fp3.pow(tv5, c3); + tv5 = Fp3.mul(tv5, tv2); + tv2 = Fp3.mul(tv5, v); + tv3 = Fp3.mul(tv5, u); + let tv4 = Fp3.mul(tv3, tv2); + tv5 = Fp3.pow(tv4, c5); + let isQR = Fp3.eql(tv5, Fp3.ONE); + tv2 = Fp3.mul(tv3, c7); + tv5 = Fp3.mul(tv4, tv1); + tv3 = Fp3.cmov(tv2, tv3, isQR); + tv4 = Fp3.cmov(tv5, tv4, isQR); + for (let i = c1; i > _1n4; i--) { + let tv52 = i - _2n3; + tv52 = _2n3 << (tv52 - _1n4); + let tvv5 = Fp3.pow(tv4, tv52); + const e1 = Fp3.eql(tvv5, Fp3.ONE); + tv2 = Fp3.mul(tv3, tv1); + tv1 = Fp3.mul(tv1, tv1); + tvv5 = Fp3.mul(tv4, tv1); + tv3 = Fp3.cmov(tv2, tv3, e1); + tv4 = Fp3.cmov(tvv5, tv4, e1); + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp3.ORDER % _4n2 === _3n2) { + const c12 = (Fp3.ORDER - _3n2) / _4n2; + const c22 = Fp3.sqrt(Fp3.neg(Z)); + sqrtRatio = (u, v) => { + let tv1 = Fp3.sqr(v); + const tv2 = Fp3.mul(u, v); + tv1 = Fp3.mul(tv1, tv2); + let y1 = Fp3.pow(tv1, c12); + y1 = Fp3.mul(y1, tv2); + const y2 = Fp3.mul(y1, c22); + const tv3 = Fp3.mul(Fp3.sqr(y1), v); + const isQR = Fp3.eql(tv3, u); + let y = Fp3.cmov(y2, y1, isQR); + return { isValid: isQR, value: y }; + }; + } + return sqrtRatio; + } + function mapToCurveSimpleSWU(Fp3, opts) { + validateField(Fp3); + if (!Fp3.isValid(opts.A) || !Fp3.isValid(opts.B) || !Fp3.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp3, opts.Z); + if (!Fp3.isOdd) throw new Error('Fp.isOdd is not implemented!'); + return u => { + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp3.sqr(u); + tv1 = Fp3.mul(tv1, opts.Z); + tv2 = Fp3.sqr(tv1); + tv2 = Fp3.add(tv2, tv1); + tv3 = Fp3.add(tv2, Fp3.ONE); + tv3 = Fp3.mul(tv3, opts.B); + tv4 = Fp3.cmov(opts.Z, Fp3.neg(tv2), !Fp3.eql(tv2, Fp3.ZERO)); + tv4 = Fp3.mul(tv4, opts.A); + tv2 = Fp3.sqr(tv3); + tv6 = Fp3.sqr(tv4); + tv5 = Fp3.mul(tv6, opts.A); + tv2 = Fp3.add(tv2, tv5); + tv2 = Fp3.mul(tv2, tv3); + tv6 = Fp3.mul(tv6, tv4); + tv5 = Fp3.mul(tv6, opts.B); + tv2 = Fp3.add(tv2, tv5); + x = Fp3.mul(tv1, tv3); + const { isValid, value } = sqrtRatio(tv2, tv6); + y = Fp3.mul(tv1, u); + y = Fp3.mul(y, value); + x = Fp3.cmov(x, tv3, isValid); + y = Fp3.cmov(y, value, isValid); + const e1 = Fp3.isOdd(u) === Fp3.isOdd(y); + y = Fp3.cmov(Fp3.neg(y), y, e1); + x = Fp3.div(x, tv4); + return { x, y }; + }; + } + var b2n, h2b, _0n4, _1n4, _2n3, _3n2, _4n2; + var init_weierstrass = __esm({ + 'node_modules/@noble/curves/esm/abstract/weierstrass.js'() { + init_modular(); + init_utils2(); + init_utils2(); + init_curve(); + ({ bytesToNumberBE: b2n, hexToBytes: h2b } = utils_exports); + _0n4 = BigInt(0); + _1n4 = BigInt(1); + _2n3 = BigInt(2); + _3n2 = BigInt(3); + _4n2 = BigInt(4); + }, + }); + + // node_modules/@noble/curves/esm/abstract/bls.js + function bls(CURVE) { + const { Fp: Fp3, Fr: Fr2, Fp2: Fp22, Fp6: Fp62, Fp12: Fp122 } = CURVE.fields; + const BLS_X_LEN2 = bitLen(CURVE.params.x); + function calcPairingPrecomputes(p) { + const { x, y } = p; + const Qx = x, + Qy = y, + Qz = Fp22.ONE; + let Rx = Qx, + Ry = Qy, + Rz = Qz; + let ell_coeff = []; + for (let i = BLS_X_LEN2 - 2; i >= 0; i--) { + let t0 = Fp22.sqr(Ry); + let t1 = Fp22.sqr(Rz); + let t2 = Fp22.multiplyByB(Fp22.mul(t1, _3n3)); + let t3 = Fp22.mul(t2, _3n3); + let t4 = Fp22.sub(Fp22.sub(Fp22.sqr(Fp22.add(Ry, Rz)), t1), t0); + ell_coeff.push([ + Fp22.sub(t2, t0), + Fp22.mul(Fp22.sqr(Rx), _3n3), + Fp22.neg(t4), + // -T4 + ]); + Rx = Fp22.div(Fp22.mul(Fp22.mul(Fp22.sub(t0, t3), Rx), Ry), _2n4); + Ry = Fp22.sub(Fp22.sqr(Fp22.div(Fp22.add(t0, t3), _2n4)), Fp22.mul(Fp22.sqr(t2), _3n3)); + Rz = Fp22.mul(t0, t4); + if (bitGet(CURVE.params.x, i)) { + let t02 = Fp22.sub(Ry, Fp22.mul(Qy, Rz)); + let t12 = Fp22.sub(Rx, Fp22.mul(Qx, Rz)); + ell_coeff.push([ + Fp22.sub(Fp22.mul(t02, Qx), Fp22.mul(t12, Qy)), + Fp22.neg(t02), + t12, + // T1 + ]); + let t22 = Fp22.sqr(t12); + let t32 = Fp22.mul(t22, t12); + let t42 = Fp22.mul(t22, Rx); + let t5 = Fp22.add(Fp22.sub(t32, Fp22.mul(t42, _2n4)), Fp22.mul(Fp22.sqr(t02), Rz)); + Rx = Fp22.mul(t12, t5); + Ry = Fp22.sub(Fp22.mul(Fp22.sub(t42, t5), t02), Fp22.mul(t32, Ry)); + Rz = Fp22.mul(Rz, t32); + } + } + return ell_coeff; + } + function millerLoop(ell, g1) { + const { x } = CURVE.params; + const Px = g1[0]; + const Py = g1[1]; + let f12 = Fp122.ONE; + for (let j = 0, i = BLS_X_LEN2 - 2; i >= 0; i--, j++) { + const E = ell[j]; + f12 = Fp122.multiplyBy014(f12, E[0], Fp22.mul(E[1], Px), Fp22.mul(E[2], Py)); + if (bitGet(x, i)) { + j += 1; + const F = ell[j]; + f12 = Fp122.multiplyBy014(f12, F[0], Fp22.mul(F[1], Px), Fp22.mul(F[2], Py)); + } + if (i !== 0) f12 = Fp122.sqr(f12); + } + return Fp122.conjugate(f12); + } + const utils = { + randomPrivateKey: () => { + const length = getMinHashLength(Fr2.ORDER); + return mapHashToField(CURVE.randomBytes(length), Fr2.ORDER); + }, + calcPairingPrecomputes, + }; + const G1_ = weierstrassPoints({ n: Fr2.ORDER, ...CURVE.G1 }); + const G1 = Object.assign( + G1_, + createHasher(G1_.ProjectivePoint, CURVE.G1.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G1.htfDefaults, + }), + ); + function pairingPrecomputes(point) { + const p = point; + if (p._PPRECOMPUTES) return p._PPRECOMPUTES; + p._PPRECOMPUTES = calcPairingPrecomputes(point.toAffine()); + return p._PPRECOMPUTES; + } + const G2_ = weierstrassPoints({ n: Fr2.ORDER, ...CURVE.G2 }); + const G2 = Object.assign( + G2_, + createHasher(G2_.ProjectivePoint, CURVE.G2.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G2.htfDefaults, + }), + ); + const { ShortSignature } = CURVE.G1; + const { Signature } = CURVE.G2; + function pairing(Q, P, withFinalExponent = true) { + if (Q.equals(G1.ProjectivePoint.ZERO) || P.equals(G2.ProjectivePoint.ZERO)) + throw new Error('pairing is not available for ZERO point'); + Q.assertValidity(); + P.assertValidity(); + const Qa = Q.toAffine(); + const looped = millerLoop(pairingPrecomputes(P), [Qa.x, Qa.y]); + return withFinalExponent ? Fp122.finalExponentiate(looped) : looped; + } + function normP1(point) { + return point instanceof G1.ProjectivePoint ? point : G1.ProjectivePoint.fromHex(point); + } + function normP1Hash(point, htfOpts) { + return point instanceof G1.ProjectivePoint + ? point + : G1.hashToCurve(ensureBytes('point', point), htfOpts); + } + function normP2(point) { + return point instanceof G2.ProjectivePoint ? point : Signature.fromHex(point); + } + function normP2Hash(point, htfOpts) { + return point instanceof G2.ProjectivePoint + ? point + : G2.hashToCurve(ensureBytes('point', point), htfOpts); + } + function getPublicKey(privateKey) { + return G1.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + function getPublicKeyForShortSignatures(privateKey) { + return G2.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + function sign(message, privateKey, htfOpts) { + const msgPoint = normP2Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G2.ProjectivePoint) return sigPoint; + return Signature.toRawBytes(sigPoint); + } + function signShortSignature(message, privateKey, htfOpts) { + const msgPoint = normP1Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G1.ProjectivePoint) return sigPoint; + return ShortSignature.toRawBytes(sigPoint); + } + function verify(signature, message, publicKey, htfOpts) { + const P = normP1(publicKey); + const Hm = normP2Hash(message, htfOpts); + const G = G1.ProjectivePoint.BASE; + const S = normP2(signature); + const ePHm = pairing(P.negate(), Hm, false); + const eGS = pairing(G, S, false); + const exp = Fp122.finalExponentiate(Fp122.mul(eGS, ePHm)); + return Fp122.eql(exp, Fp122.ONE); + } + function verifyShortSignature(signature, message, publicKey, htfOpts) { + const P = normP2(publicKey); + const Hm = normP1Hash(message, htfOpts); + const G = G2.ProjectivePoint.BASE; + const S = normP1(signature); + const eHmP = pairing(Hm, P, false); + const eSG = pairing(S, G.negate(), false); + const exp = Fp122.finalExponentiate(Fp122.mul(eSG, eHmP)); + return Fp122.eql(exp, Fp122.ONE); + } + function aggregatePublicKeys(publicKeys) { + if (!publicKeys.length) throw new Error('Expected non-empty array'); + const agg = publicKeys.map(normP1).reduce((sum, p) => sum.add(p), G1.ProjectivePoint.ZERO); + const aggAffine = agg; + if (publicKeys[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return aggAffine.toRawBytes(true); + } + function aggregateSignatures(signatures) { + if (!signatures.length) throw new Error('Expected non-empty array'); + const agg = signatures.map(normP2).reduce((sum, s) => sum.add(s), G2.ProjectivePoint.ZERO); + const aggAffine = agg; + if (signatures[0] instanceof G2.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return Signature.toRawBytes(aggAffine); + } + function aggregateShortSignatures(signatures) { + if (!signatures.length) throw new Error('Expected non-empty array'); + const agg = signatures.map(normP1).reduce((sum, s) => sum.add(s), G1.ProjectivePoint.ZERO); + const aggAffine = agg; + if (signatures[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return ShortSignature.toRawBytes(aggAffine); + } + function verifyBatch(signature, messages, publicKeys, htfOpts) { + if (!messages.length) throw new Error('Expected non-empty messages array'); + if (publicKeys.length !== messages.length) + throw new Error('Pubkey count should equal msg count'); + const sig = normP2(signature); + const nMessages = messages.map(i => normP2Hash(i, htfOpts)); + const nPublicKeys = publicKeys.map(normP1); + try { + const paired = []; + for (const message of new Set(nMessages)) { + const groupPublicKey = nMessages.reduce( + (groupPublicKey2, subMessage, i) => + subMessage === message ? groupPublicKey2.add(nPublicKeys[i]) : groupPublicKey2, + G1.ProjectivePoint.ZERO, + ); + paired.push(pairing(groupPublicKey, message, false)); + } + paired.push(pairing(G1.ProjectivePoint.BASE.negate(), sig, false)); + const product = paired.reduce((a, b) => Fp122.mul(a, b), Fp122.ONE); + const exp = Fp122.finalExponentiate(product); + return Fp122.eql(exp, Fp122.ONE); + } catch { + return false; + } + } + G1.ProjectivePoint.BASE._setWindowSize(4); + return { + getPublicKey, + getPublicKeyForShortSignatures, + sign, + signShortSignature, + verify, + verifyBatch, + verifyShortSignature, + aggregatePublicKeys, + aggregateSignatures, + aggregateShortSignatures, + millerLoop, + pairing, + G1, + G2, + Signature, + ShortSignature, + fields: { + Fr: Fr2, + Fp: Fp3, + Fp2: Fp22, + Fp6: Fp62, + Fp12: Fp122, + }, + params: { + x: CURVE.params.x, + r: CURVE.params.r, + G1b: CURVE.G1.b, + G2b: CURVE.G2.b, + }, + utils, + }; + } + var _2n4, _3n3; + var init_bls = __esm({ + 'node_modules/@noble/curves/esm/abstract/bls.js'() { + init_modular(); + init_utils2(); + init_hash_to_curve(); + init_weierstrass(); + _2n4 = BigInt(2); + _3n3 = BigInt(3); + }, + }); + + // node_modules/@noble/curves/esm/bls12-381.js + function Fp4Square(a, b) { + const a2 = Fp2.sqr(a); + const b2 = Fp2.sqr(b); + return { + first: Fp2.add(Fp2.mulByNonresidue(b2), a2), + second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), + // (a + b)² - a² - b² + }; + } + function psi(x, y) { + const x2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wsq_inv, x), 1), wsq).c0.c0; + const y2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wcu_inv, y), 1), wcu).c0.c0; + return [x2, y2]; + } + function G2psi(c, P) { + const affine = P.toAffine(); + const p = psi(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); + } + function psi2(x, y) { + return [Fp2.mul(x, PSI2_C1), Fp2.neg(y)]; + } + function G2psi2(c, P) { + const affine = P.toAffine(); + const p = psi2(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); + } + function signatureG1ToRawBytes(point) { + point.assertValidity(); + const isZero = point.equals(bls12_381.G1.ProjectivePoint.ZERO); + const { x, y } = point.toAffine(); + if (isZero) return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = bitSet(x, C_BIT_POS, Boolean((y * _2n5) / P)); + num = bitSet(num, S_BIT_POS, true); + return numberToBytesBE(num, Fp.BYTES); + } + function signatureG2ToRawBytes(point) { + point.assertValidity(); + const len = Fp.BYTES; + if (point.equals(bls12_381.G2.ProjectivePoint.ZERO)) + return concatBytes(COMPRESSED_ZERO, numberToBytesBE(_0n5, len)); + const { x, y } = point.toAffine(); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + const tmp = y1 > _0n5 ? y1 * _2n5 : y0 * _2n5; + const aflag1 = Boolean((tmp / Fp.ORDER) & _1n5); + const z1 = bitSet(bitSet(x1, 381, aflag1), S_BIT_POS, true); + const z2 = x0; + return concatBytes(numberToBytesBE(z1, len), numberToBytesBE(z2, len)); + } + var _0n5, + _1n5, + _2n5, + _3n4, + _4n3, + _8n2, + _16n2, + Fp_raw, + Fp, + Fr, + Fp2Add, + Fp2Subtract, + Fp2Multiply, + Fp2Square, + FP2_ORDER, + Fp2, + FP2_FROBENIUS_COEFFICIENTS, + rv1, + FP2_ROOTS_OF_UNITY, + Fp6Add, + Fp6Subtract, + Fp6Multiply, + Fp6Square, + Fp6, + FP6_FROBENIUS_COEFFICIENTS_1, + FP6_FROBENIUS_COEFFICIENTS_2, + BLS_X, + BLS_X_LEN, + Fp12Add, + Fp12Subtract, + Fp12Multiply, + Fp12Square, + Fp12, + FP12_FROBENIUS_COEFFICIENTS, + isogenyMapG2, + isogenyMapG1, + G2_SWU, + G1_SWU, + ut_root, + wsq, + wcu, + wsq_inv, + wcu_inv, + PSI2_C1, + htfDefaults, + C_BIT_POS, + I_BIT_POS, + S_BIT_POS, + COMPRESSED_ZERO, + bls12_381; + var init_bls12_381 = __esm({ + 'node_modules/@noble/curves/esm/bls12-381.js'() { + init_sha256(); + init_utils(); + init_bls(); + init_modular(); + init_utils2(); + init_weierstrass(); + init_hash_to_curve(); + _0n5 = BigInt(0); + _1n5 = BigInt(1); + _2n5 = BigInt(2); + _3n4 = BigInt(3); + _4n3 = BigInt(4); + _8n2 = BigInt(8); + _16n2 = BigInt(16); + Fp_raw = BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab', + ); + Fp = Field(Fp_raw); + Fr = Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')); + Fp2Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.add(c0, r0), + c1: Fp.add(c1, r1), + }); + Fp2Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.sub(c0, r0), + c1: Fp.sub(c1, r1), + }); + Fp2Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') return { c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }; + const { c0: r0, c1: r1 } = rhs; + let t1 = Fp.mul(c0, r0); + let t2 = Fp.mul(c1, r1); + const o0 = Fp.sub(t1, t2); + const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); + return { c0: o0, c1: o1 }; + }; + Fp2Square = ({ c0, c1 }) => { + const a = Fp.add(c0, c1); + const b = Fp.sub(c0, c1); + const c = Fp.add(c0, c0); + return { c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }; + }; + FP2_ORDER = Fp_raw * Fp_raw; + Fp2 = { + ORDER: FP2_ORDER, + BITS: bitLen(FP2_ORDER), + BYTES: Math.ceil(bitLen(FP2_ORDER) / 8), + MASK: bitMask(bitLen(FP2_ORDER)), + ZERO: { c0: Fp.ZERO, c1: Fp.ZERO }, + ONE: { c0: Fp.ONE, c1: Fp.ZERO }, + create: num => num, + isValid: ({ c0, c1 }) => typeof c0 === 'bigint' && typeof c1 === 'bigint', + is0: ({ c0, c1 }) => Fp.is0(c0) && Fp.is0(c1), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp.eql(c0, r0) && Fp.eql(c1, r1), + neg: ({ c0, c1 }) => ({ c0: Fp.neg(c0), c1: Fp.neg(c1) }), + pow: (num, power) => FpPow(Fp2, num, power), + invertBatch: nums => FpInvertBatch(Fp2, nums), + // Normalized + add: Fp2Add, + sub: Fp2Subtract, + mul: Fp2Multiply, + sqr: Fp2Square, + // NonNormalized stuff + addN: Fp2Add, + subN: Fp2Subtract, + mulN: Fp2Multiply, + sqrN: Fp2Square, + // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? + div: (lhs, rhs) => + Fp2.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp2.inv(rhs)), + inv: ({ c0: a, c1: b }) => { + const factor = Fp.inv(Fp.create(a * a + b * b)); + return { c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }; + }, + sqrt: num => { + if (Fp2.eql(num, Fp2.ZERO)) return Fp2.ZERO; + const candidateSqrt = Fp2.pow(num, (Fp2.ORDER + _8n2) / _16n2); + const check = Fp2.div(Fp2.sqr(candidateSqrt), num); + const R = FP2_ROOTS_OF_UNITY; + const divisor = [R[0], R[2], R[4], R[6]].find(r => Fp2.eql(r, check)); + if (!divisor) throw new Error('No root'); + const index = R.indexOf(divisor); + const root = R[index / 2]; + if (!root) throw new Error('Invalid root'); + const x1 = Fp2.div(candidateSqrt, root); + const x2 = Fp2.neg(x1); + const { re: re1, im: im1 } = Fp2.reim(x1); + const { re: re2, im: im2 } = Fp2.reim(x2); + if (im1 > im2 || (im1 === im2 && re1 > re2)) return x1; + return x2; + }, + // Same as sgn0_m_eq_2 in RFC 9380 + isOdd: x => { + const { re: x0, im: x1 } = Fp2.reim(x); + const sign_0 = x0 % _2n5; + const zero_0 = x0 === _0n5; + const sign_1 = x1 % _2n5; + return BigInt(sign_0 || (zero_0 && sign_1)) == _1n5; + }, + // Bytes util + fromBytes(b) { + if (b.length !== Fp2.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), + c1: Fp.fromBytes(b.subarray(Fp.BYTES)), + }; + }, + toBytes: ({ c0, c1 }) => concatBytes(Fp.toBytes(c0), Fp.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp.cmov(c0, r0, c), + c1: Fp.cmov(c1, r1, c), + }), + // Specific utils + // toString() { + // return `Fp2(${this.c0} + ${this.c1}×i)`; + // } + reim: ({ c0, c1 }) => ({ re: c0, im: c1 }), + // multiply by u + 1 + mulByNonresidue: ({ c0, c1 }) => ({ c0: Fp.sub(c0, c1), c1: Fp.add(c0, c1) }), + multiplyByB: ({ c0, c1 }) => { + let t0 = Fp.mul(c0, _4n3); + let t1 = Fp.mul(c1, _4n3); + return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; + }, + fromBigTuple: tuple => { + if (tuple.length !== 2) throw new Error('Invalid tuple'); + const fps = tuple.map(n => Fp.create(n)); + return { c0: fps[0], c1: fps[1] }; + }, + frobeniusMap: ({ c0, c1 }, power) => ({ + c0, + c1: Fp.mul(c1, FP2_FROBENIUS_COEFFICIENTS[power % 2]), + }), + }; + FP2_FROBENIUS_COEFFICIENTS = [ + BigInt('0x1'), + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', + ), + ].map(item => Fp.create(item)); + rv1 = BigInt( + '0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', + ); + FP2_ROOTS_OF_UNITY = [ + [_1n5, _0n5], + [rv1, -rv1], + [_0n5, _1n5], + [rv1, rv1], + [-_1n5, _0n5], + [-rv1, rv1], + [_0n5, -_1n5], + [-rv1, -rv1], + ].map(pair => Fp2.fromBigTuple(pair)); + Fp6Add = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.add(c0, r0), + c1: Fp2.add(c1, r1), + c2: Fp2.add(c2, r2), + }); + Fp6Subtract = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.sub(c0, r0), + c1: Fp2.sub(c1, r1), + c2: Fp2.sub(c2, r2), + }); + Fp6Multiply = ({ c0, c1, c2 }, rhs) => { + if (typeof rhs === 'bigint') { + return { + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }; + } + const { c0: r0, c1: r1, c2: r2 } = rhs; + const t0 = Fp2.mul(c0, r0); + const t1 = Fp2.mul(c1, r1); + const t2 = Fp2.mul(c2, r2); + return { + // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) + c0: Fp2.add( + t0, + Fp2.mulByNonresidue( + Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2)), + ), + ), + // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) + c1: Fp2.add( + Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), + Fp2.mulByNonresidue(t2), + ), + // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 + c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), + }; + }; + Fp6Square = ({ c0, c1, c2 }) => { + let t0 = Fp2.sqr(c0); + let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n5); + let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n5); + let t4 = Fp2.sqr(c2); + return { + c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), + c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), + // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 + c2: Fp2.sub( + Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), + t4, + ), + }; + }; + Fp6 = { + ORDER: Fp2.ORDER, + BITS: 3 * Fp2.BITS, + BYTES: 3 * Fp2.BYTES, + MASK: bitMask(3 * Fp2.BITS), + ZERO: { c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }, + ONE: { c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }, + create: num => num, + isValid: ({ c0, c1, c2 }) => Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2), + is0: ({ c0, c1, c2 }) => Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2), + neg: ({ c0, c1, c2 }) => ({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }), + eql: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => + Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2), + sqrt: () => { + throw new Error('Not implemented'); + }, + // Do we need division by bigint at all? Should be done via order: + div: (lhs, rhs) => + Fp6.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp6.inv(rhs)), + pow: (num, power) => FpPow(Fp6, num, power), + invertBatch: nums => FpInvertBatch(Fp6, nums), + // Normalized + add: Fp6Add, + sub: Fp6Subtract, + mul: Fp6Multiply, + sqr: Fp6Square, + // NonNormalized stuff + addN: Fp6Add, + subN: Fp6Subtract, + mulN: Fp6Multiply, + sqrN: Fp6Square, + inv: ({ c0, c1, c2 }) => { + let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); + let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); + let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); + let t4 = Fp2.inv( + Fp2.add( + Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), + Fp2.mul(c0, t0), + ), + ); + return { c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }; + }, + // Bytes utils + fromBytes: b => { + if (b.length !== Fp6.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp2.fromBytes(b.subarray(0, Fp2.BYTES)), + c1: Fp2.fromBytes(b.subarray(Fp2.BYTES, 2 * Fp2.BYTES)), + c2: Fp2.fromBytes(b.subarray(2 * Fp2.BYTES)), + }; + }, + toBytes: ({ c0, c1, c2 }) => concatBytes(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)), + cmov: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }, c) => ({ + c0: Fp2.cmov(c0, r0, c), + c1: Fp2.cmov(c1, r1, c), + c2: Fp2.cmov(c2, r2, c), + }), + // Utils + // fromTriple(triple: [Fp2, Fp2, Fp2]) { + // return new Fp6(...triple); + // } + // toString() { + // return `Fp6(${this.c0} + ${this.c1} * v, ${this.c2} * v^2)`; + // } + fromBigSix: t => { + if (!Array.isArray(t) || t.length !== 6) throw new Error('Invalid Fp6 usage'); + return { + c0: Fp2.fromBigTuple(t.slice(0, 2)), + c1: Fp2.fromBigTuple(t.slice(2, 4)), + c2: Fp2.fromBigTuple(t.slice(4, 6)), + }; + }, + frobeniusMap: ({ c0, c1, c2 }, power) => ({ + c0: Fp2.frobeniusMap(c0, power), + c1: Fp2.mul(Fp2.frobeniusMap(c1, power), FP6_FROBENIUS_COEFFICIENTS_1[power % 6]), + c2: Fp2.mul(Fp2.frobeniusMap(c2, power), FP6_FROBENIUS_COEFFICIENTS_2[power % 6]), + }), + mulByNonresidue: ({ c0, c1, c2 }) => ({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }), + // Sparse multiplication + multiplyBy1: ({ c0, c1, c2 }, b1) => ({ + c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), + c1: Fp2.mul(c0, b1), + c2: Fp2.mul(c1, b1), + }), + // Sparse multiplication + multiplyBy01({ c0, c1, c2 }, b0, b1) { + let t0 = Fp2.mul(c0, b0); + let t1 = Fp2.mul(c1, b1); + return { + // ((c1 + c2) * b1 - T1) * (u + 1) + T0 + c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), + // (b0 + b1) * (c0 + c1) - T0 - T1 + c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), + // (c0 + c2) * b0 - T0 + T1 + c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1, c2 }, rhs) => ({ + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }), + }; + FP6_FROBENIUS_COEFFICIENTS_1 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x0'), + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + BigInt('0x0'), + ], + [BigInt('0x0'), BigInt('0x1')], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + BigInt('0x0'), + ], + [ + BigInt('0x0'), + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + ], + ].map(pair => Fp2.fromBigTuple(pair)); + FP6_FROBENIUS_COEFFICIENTS_2 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff', + ), + BigInt('0x0'), + ], + ].map(pair => Fp2.fromBigTuple(pair)); + BLS_X = BigInt('0xd201000000010000'); + BLS_X_LEN = bitLen(BLS_X); + Fp12Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.add(c0, r0), + c1: Fp6.add(c1, r1), + }); + Fp12Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.sub(c0, r0), + c1: Fp6.sub(c1, r1), + }); + Fp12Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') return { c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }; + let { c0: r0, c1: r1 } = rhs; + let t1 = Fp6.mul(c0, r0); + let t2 = Fp6.mul(c1, r1); + return { + c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), + // (c0 + c1) * (r0 + r1) - (T1 + T2) + c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), + }; + }; + Fp12Square = ({ c0, c1 }) => { + let ab = Fp6.mul(c0, c1); + return { + // (c1 * v + c0) * (c0 + c1) - AB - AB * v + c0: Fp6.sub( + Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), + Fp6.mulByNonresidue(ab), + ), + c1: Fp6.add(ab, ab), + }; + }; + Fp12 = { + ORDER: Fp2.ORDER, + BITS: 2 * Fp2.BITS, + BYTES: 2 * Fp2.BYTES, + MASK: bitMask(2 * Fp2.BITS), + ZERO: { c0: Fp6.ZERO, c1: Fp6.ZERO }, + ONE: { c0: Fp6.ONE, c1: Fp6.ZERO }, + create: num => num, + isValid: ({ c0, c1 }) => Fp6.isValid(c0) && Fp6.isValid(c1), + is0: ({ c0, c1 }) => Fp6.is0(c0) && Fp6.is0(c1), + neg: ({ c0, c1 }) => ({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp6.eql(c0, r0) && Fp6.eql(c1, r1), + sqrt: () => { + throw new Error('Not implemented'); + }, + inv: ({ c0, c1 }) => { + let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); + return { c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }; + }, + div: (lhs, rhs) => + Fp12.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp12.inv(rhs)), + pow: (num, power) => FpPow(Fp12, num, power), + invertBatch: nums => FpInvertBatch(Fp12, nums), + // Normalized + add: Fp12Add, + sub: Fp12Subtract, + mul: Fp12Multiply, + sqr: Fp12Square, + // NonNormalized stuff + addN: Fp12Add, + subN: Fp12Subtract, + mulN: Fp12Multiply, + sqrN: Fp12Square, + // Bytes utils + fromBytes: b => { + if (b.length !== Fp12.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), + c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), + }; + }, + toBytes: ({ c0, c1 }) => concatBytes(Fp6.toBytes(c0), Fp6.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp6.cmov(c0, r0, c), + c1: Fp6.cmov(c1, r1, c), + }), + // Utils + // toString() { + // return `Fp12(${this.c0} + ${this.c1} * w)`; + // }, + // fromTuple(c: [Fp6, Fp6]) { + // return new Fp12(...c); + // } + fromBigTwelve: t => ({ + c0: Fp6.fromBigSix(t.slice(0, 6)), + c1: Fp6.fromBigSix(t.slice(6, 12)), + }), + // Raises to q**i -th power + frobeniusMap(lhs, power) { + const r0 = Fp6.frobeniusMap(lhs.c0, power); + const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); + const coeff = FP12_FROBENIUS_COEFFICIENTS[power % 12]; + return { + c0: r0, + c1: Fp6.create({ + c0: Fp2.mul(c0, coeff), + c1: Fp2.mul(c1, coeff), + c2: Fp2.mul(c2, coeff), + }), + }; + }, + // Sparse multiplication + multiplyBy014: ({ c0, c1 }, o0, o1, o4) => { + let t0 = Fp6.multiplyBy01(c0, o0, o1); + let t1 = Fp6.multiplyBy1(c1, o4); + return { + c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), + // (c1 + c0) * [o0, o1+o4] - T0 - T1 + c1: Fp6.sub(Fp6.sub(Fp6.multiplyBy01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1 }, rhs) => ({ + c0: Fp6.multiplyByFp2(c0, rhs), + c1: Fp6.multiplyByFp2(c1, rhs), + }), + conjugate: ({ c0, c1 }) => ({ c0, c1: Fp6.neg(c1) }), + // A cyclotomic group is a subgroup of Fp^n defined by + // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} + // The result of any pairing is in a cyclotomic subgroup + // https://eprint.iacr.org/2009/565.pdf + _cyclotomicSquare: ({ c0, c1 }) => { + const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; + const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; + const { first: t3, second: t4 } = Fp4Square(c0c0, c1c1); + const { first: t5, second: t6 } = Fp4Square(c1c0, c0c2); + const { first: t7, second: t8 } = Fp4Square(c0c1, c1c2); + let t9 = Fp2.mulByNonresidue(t8); + return { + c0: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n5), t3), + c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n5), t5), + c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n5), t7), + }), + c1: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n5), t9), + c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n5), t4), + c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n5), t6), + }), + }; + }, + _cyclotomicExp(num, n) { + let z = Fp12.ONE; + for (let i = BLS_X_LEN - 1; i >= 0; i--) { + z = Fp12._cyclotomicSquare(z); + if (bitGet(n, i)) z = Fp12.mul(z, num); + } + return z; + }, + // https://eprint.iacr.org/2010/354.pdf + // https://eprint.iacr.org/2009/565.pdf + finalExponentiate: num => { + const x = BLS_X; + const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); + const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); + const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); + const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); + const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); + const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); + const t6 = Fp12.mul( + Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), + Fp12._cyclotomicSquare(t2), + ); + const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); + const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); + const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); + const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); + const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); + return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); + }, + }; + FP12_FROBENIUS_COEFFICIENTS = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt( + '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8', + ), + BigInt( + '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3', + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2', + ), + BigInt( + '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995', + ), + BigInt( + '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116', + ), + ], + [ + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3', + ), + BigInt( + '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8', + ), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', + ), + BigInt( + '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2', + ), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116', + ), + BigInt( + '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995', + ), + ], + ].map(n => Fp2.fromBigTuple(n)); + isogenyMapG2 = isogenyMap( + Fp2, + [ + // xNum + [ + [ + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + ], + [ + '0x0', + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', + ], + [ + '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', + '0x0', + ], + ], + // xDen + [ + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', + ], + [ + '0xc', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', + ], + ['0x1', '0x0'], + // LAST 1 + ], + // yNum + [ + [ + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + ], + [ + '0x0', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', + ], + [ + '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', + '0x0', + ], + ], + // yDen + [ + [ + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + ], + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', + ], + [ + '0x12', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', + ], + ['0x1', '0x0'], + // LAST 1 + ], + ].map(i => i.map(pair => Fp2.fromBigTuple(pair.map(BigInt)))), + ); + isogenyMapG1 = isogenyMap( + Fp, + [ + // xNum + [ + '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', + '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', + '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', + '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', + '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', + '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', + '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', + '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', + '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', + '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', + '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', + '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', + ], + // xDen + [ + '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', + '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', + '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', + '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', + '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', + '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', + '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', + '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', + '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', + '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', + // LAST 1 + ], + // yNum + [ + '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', + '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', + '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', + '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', + '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', + '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', + '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', + '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', + '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', + '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', + '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', + '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', + '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', + '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', + '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', + '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', + ], + // yDen + [ + '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', + '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', + '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', + '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', + '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', + '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', + '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', + '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', + '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', + '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', + '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', + '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', + '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', + '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', + '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', + // LAST 1 + ], + ].map(i => i.map(j => BigInt(j))), + ); + G2_SWU = mapToCurveSimpleSWU(Fp2, { + A: Fp2.create({ c0: Fp.create(_0n5), c1: Fp.create(BigInt(240)) }), + B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), + Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), + // Z: -(2 + I) + }); + G1_SWU = mapToCurveSimpleSWU(Fp, { + A: Fp.create( + BigInt( + '0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d', + ), + ), + B: Fp.create( + BigInt( + '0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0', + ), + ), + Z: Fp.create(BigInt(11)), + }); + ut_root = Fp6.create({ c0: Fp2.ZERO, c1: Fp2.ONE, c2: Fp2.ZERO }); + wsq = Fp12.create({ c0: ut_root, c1: Fp6.ZERO }); + wcu = Fp12.create({ c0: Fp6.ZERO, c1: ut_root }); + [wsq_inv, wcu_inv] = Fp12.invertBatch([wsq, wcu]); + PSI2_C1 = BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ); + htfDefaults = Object.freeze({ + // DST: a domain separation tag + // defined in section 2.2.5 + // Use utils.getDSTLabel(), utils.setDSTLabel(value) + DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + // p: the characteristic of F + // where F is a finite field of characteristic p and order q = p^m + p: Fp.ORDER, + // m: the extension degree of F, m >= 1 + // where F is a finite field of characteristic p and order q = p^m + m: 2, + // k: the target security level for the suite in bits + // defined in section 5.1 + k: 128, + // option to use a message that has already been processed by + // expand_message_xmd + expand: 'xmd', + // Hash functions for: expand_message_xmd is appropriate for use with a + // wide range of hash functions, including SHA-2, SHA-3, BLAKE2, and others. + // BBS+ uses blake2: https://github.com/hyperledger/aries-framework-go/issues/2247 + hash: sha256, + }); + C_BIT_POS = Fp.BITS; + I_BIT_POS = Fp.BITS + 1; + S_BIT_POS = Fp.BITS + 2; + COMPRESSED_ZERO = Fp.toBytes(bitSet(bitSet(_0n5, I_BIT_POS, true), S_BIT_POS, true)); + bls12_381 = bls({ + // Fields + fields: { + Fp, + Fp2, + Fp6, + Fp12, + Fr, + }, + // G1 is the order-q subgroup of E1(Fp) : y² = x³ + 4, #E1(Fp) = h1q, where + // characteristic; z + (z⁴ - z² + 1)(z - 1)²/3 + G1: { + Fp, + // cofactor; (z - 1)²/3 + h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), + // generator's coordinates + // x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 + // y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 + Gx: BigInt( + '0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb', + ), + Gy: BigInt( + '0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1', + ), + a: Fp.ZERO, + b: _4n3, + htfDefaults: { ...htfDefaults, m: 1, DST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_' }, + wrapPrivateKey: true, + allowInfinityPoint: true, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, point) => { + const cubicRootOfUnityModP = BigInt( + '0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ); + const phi = new c(Fp.mul(point.px, cubicRootOfUnityModP), point.py, point.pz); + const xP = point.multiplyUnsafe(bls12_381.params.x).negate(); + const u2P = xP.multiplyUnsafe(bls12_381.params.x); + return u2P.equals(phi); + }, + // Clear cofactor of G1 + // https://eprint.iacr.org/2019/403 + clearCofactor: (_c, point) => { + return point.multiplyUnsafe(bls12_381.params.x).add(point); + }, + mapToCurve: scalars => { + const { x, y } = G1_SWU(Fp.create(scalars[0])); + return isogenyMapG1(x, y); + }, + fromBytes: bytes2 => { + bytes2 = bytes2.slice(); + if (bytes2.length === 48) { + const P = Fp.ORDER; + const compressedValue = bytesToNumberBE(bytes2); + const bflag = bitGet(compressedValue, I_BIT_POS); + if (bflag === _1n5) return { x: _0n5, y: _0n5 }; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n4), Fp.create(bls12_381.params.G1b)); + let y = Fp.sqrt(right); + if (!y) throw new Error('Invalid compressed G1 point'); + const aflag = bitGet(compressedValue, C_BIT_POS); + if ((y * _2n5) / P !== aflag) y = Fp.neg(y); + return { x: Fp.create(x), y: Fp.create(y) }; + } else if (bytes2.length === 96) { + if ((bytes2[0] & (1 << 6)) !== 0) return bls12_381.G1.ProjectivePoint.ZERO.toAffine(); + const x = bytesToNumberBE(bytes2.subarray(0, Fp.BYTES)); + const y = bytesToNumberBE(bytes2.subarray(Fp.BYTES)); + return { x: Fp.create(x), y: Fp.create(y) }; + } else { + throw new Error('Invalid point G1, expected 48/96 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = bitSet(x, C_BIT_POS, Boolean((y * _2n5) / P)); + num = bitSet(num, S_BIT_POS, true); + return numberToBytesBE(num, Fp.BYTES); + } else { + if (isZero) { + const x2 = concatBytes(new Uint8Array([64]), new Uint8Array(2 * Fp.BYTES - 1)); + return x2; + } else { + return concatBytes(numberToBytesBE(x, Fp.BYTES), numberToBytesBE(y, Fp.BYTES)); + } + } + }, + ShortSignature: { + fromHex(hex) { + const bytes2 = ensureBytes('signatureHex', hex, 48); + const P = Fp.ORDER; + const compressedValue = bytesToNumberBE(bytes2); + const bflag = bitGet(compressedValue, I_BIT_POS); + if (bflag === _1n5) return bls12_381.G1.ProjectivePoint.ZERO; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n4), Fp.create(bls12_381.params.G1b)); + let y = Fp.sqrt(right); + if (!y) throw new Error('Invalid compressed G1 point'); + const aflag = bitGet(compressedValue, C_BIT_POS); + if ((y * _2n5) / P !== aflag) y = Fp.neg(y); + const point = bls12_381.G1.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point) { + return signatureG1ToRawBytes(point); + }, + toHex(point) { + return bytesToHex(signatureG1ToRawBytes(point)); + }, + }, + }, + // G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), + // where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where + // G² - 1 + // h2q + G2: { + Fp: Fp2, + // cofactor + h: BigInt( + '0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5', + ), + Gx: Fp2.fromBigTuple([ + BigInt( + '0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8', + ), + BigInt( + '0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e', + ), + ]), + // y = + // 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582, + // 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 + Gy: Fp2.fromBigTuple([ + BigInt( + '0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801', + ), + BigInt( + '0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be', + ), + ]), + a: Fp2.ZERO, + b: Fp2.fromBigTuple([_4n3, _4n3]), + hEff: BigInt( + '0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551', + ), + htfDefaults: { ...htfDefaults }, + wrapPrivateKey: true, + allowInfinityPoint: true, + mapToCurve: scalars => { + const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars)); + return isogenyMapG2(x, y); + }, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, P) => { + return P.multiplyUnsafe(bls12_381.params.x).negate().equals(G2psi(c, P)); + }, + // Maps the point into the prime-order subgroup G2. + // clear_cofactor_bls12381_g2 from cfrg-hash-to-curve-11 + // https://eprint.iacr.org/2017/419.pdf + // prettier-ignore + clearCofactor: (c, P) => { + const x = bls12_381.params.x; + let t1 = P.multiplyUnsafe(x).negate(); + let t2 = G2psi(c, P); + let t3 = P.double(); + t3 = G2psi2(c, t3); + t3 = t3.subtract(t2); + t2 = t1.add(t2); + t2 = t2.multiplyUnsafe(x).negate(); + t3 = t3.add(t2); + t3 = t3.subtract(t1); + const Q = t3.subtract(P); + return Q; + }, + fromBytes: bytes2 => { + bytes2 = bytes2.slice(); + const m_byte = bytes2[0] & 224; + if (m_byte === 32 || m_byte === 96 || m_byte === 224) { + throw new Error('Invalid encoding flag: ' + m_byte); + } + const bitC = m_byte & 128; + const bitI = m_byte & 64; + const bitS = m_byte & 32; + const L = Fp.BYTES; + const slc = (b, from, to) => bytesToNumberBE(b.slice(from, to)); + if (bytes2.length === 96 && bitC) { + const b = bls12_381.params.G2b; + const P = Fp.ORDER; + bytes2[0] = bytes2[0] & 31; + if (bitI) { + if (bytes2.reduce((p, c) => (p !== 0 ? c + 1 : c), 0) > 0) { + throw new Error('Invalid compressed G2 point'); + } + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x_1 = slc(bytes2, 0, L); + const x_0 = slc(bytes2, L, 2 * L); + const x = Fp2.create({ c0: Fp.create(x_0), c1: Fp.create(x_1) }); + const right = Fp2.add(Fp2.pow(x, _3n4), b); + let y = Fp2.sqrt(right); + const Y_bit = y.c1 === _0n5 ? (y.c0 * _2n5) / P : (y.c1 * _2n5) / P ? _1n5 : _0n5; + y = bitS > 0 && Y_bit > 0 ? y : Fp2.neg(y); + return { x, y }; + } else if (bytes2.length === 192 && !bitC) { + if ((bytes2[0] & (1 << 6)) !== 0) { + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x1 = slc(bytes2, 0, L); + const x0 = slc(bytes2, L, 2 * L); + const y1 = slc(bytes2, 2 * L, 3 * L); + const y0 = slc(bytes2, 3 * L, 4 * L); + return { x: Fp2.fromBigTuple([x0, x1]), y: Fp2.fromBigTuple([y0, y1]) }; + } else { + throw new Error('Invalid point G2, expected 96/192 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const { BYTES: len, ORDER: P } = Fp; + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) return concatBytes(COMPRESSED_ZERO, numberToBytesBE(_0n5, len)); + const flag = Boolean(y.c1 === _0n5 ? (y.c0 * _2n5) / P : (y.c1 * _2n5) / P); + let x_1 = bitSet(x.c1, C_BIT_POS, flag); + x_1 = bitSet(x_1, S_BIT_POS, true); + return concatBytes(numberToBytesBE(x_1, len), numberToBytesBE(x.c0, len)); + } else { + if (isZero) return concatBytes(new Uint8Array([64]), new Uint8Array(4 * len - 1)); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + return concatBytes( + numberToBytesBE(x1, len), + numberToBytesBE(x0, len), + numberToBytesBE(y1, len), + numberToBytesBE(y0, len), + ); + } + }, + Signature: { + // TODO: Optimize, it's very slow because of sqrt. + fromHex(hex) { + hex = ensureBytes('signatureHex', hex); + const P = Fp.ORDER; + const half = hex.length / 2; + if (half !== 48 && half !== 96) + throw new Error('Invalid compressed signature length, must be 96 or 192'); + const z1 = bytesToNumberBE(hex.slice(0, half)); + const z2 = bytesToNumberBE(hex.slice(half)); + const bflag1 = bitGet(z1, I_BIT_POS); + if (bflag1 === _1n5) return bls12_381.G2.ProjectivePoint.ZERO; + const x1 = Fp.create(z1 & Fp.MASK); + const x2 = Fp.create(z2); + const x = Fp2.create({ c0: x2, c1: x1 }); + const y2 = Fp2.add(Fp2.pow(x, _3n4), bls12_381.params.G2b); + let y = Fp2.sqrt(y2); + if (!y) throw new Error('Failed to find a square root'); + const { re: y0, im: y1 } = Fp2.reim(y); + const aflag1 = bitGet(z1, 381); + const isGreater = y1 > _0n5 && (y1 * _2n5) / P !== aflag1; + const isZero = y1 === _0n5 && (y0 * _2n5) / P !== aflag1; + if (isGreater || isZero) y = Fp2.neg(y); + const point = bls12_381.G2.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point) { + return signatureG2ToRawBytes(point); + }, + toHex(point) { + return bytesToHex(signatureG2ToRawBytes(point)); + }, + }, + }, + params: { + x: BLS_X, + r: Fr.ORDER, + // order; z⁴ − z² + 1; CURVE.n from other curves + }, + htfDefaults, + hash: sha256, + randomBytes, + }); + }, + }); + + // index.js + var require_bls = __commonJS({ + 'index.js'(exports, module) { + init_bls12_381(); + module.exports = { + verifyShortSignature: bls12_381.verifyShortSignature, + }; + }, + }); + return require_bls(); +}; +/*! Bundled license information: + +@noble/hashes/esm/utils.js: + (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/utils.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/modular.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/curve.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/weierstrass.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/bls12-381.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) +*/ diff --git a/packages/bls-verify/tsconfig.json b/packages/bls-verify/tsconfig.json index d6fb55d23..bc24095c8 100644 --- a/packages/bls-verify/tsconfig.json +++ b/packages/bls-verify/tsconfig.json @@ -4,7 +4,7 @@ "allowJs": true, "baseUrl": "./", "composite": false, - "declaration": false, + "declaration": true, "esModuleInterop": false, "forceConsistentCasingInFileNames": true, "incremental": true, From 184bd86ff03c8ef053507238ce9b8b2cdda56ff9 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 12:21:50 -0800 Subject: [PATCH 05/11] wip --- package-lock.json | 6439 +++++------------ package.json | 3 + packages/bls-verify/package.json | 4 +- packages/bls-verify/src/index.ts | 16 +- .../bls-verify/src/vendor/amcl-js/index.js | 1 - .../src/vendor/amcl-js/package.json | 15 - .../bls-verify/src/vendor/amcl-js/readme.md | 62 - .../bls-verify/src/vendor/amcl-js/src/aes.js | 882 --- .../bls-verify/src/vendor/amcl-js/src/big.js | 1505 ---- .../bls-verify/src/vendor/amcl-js/src/bls.js | 184 - .../src/vendor/amcl-js/src/bls192.js | 183 - .../src/vendor/amcl-js/src/bls256.js | 188 - .../bls-verify/src/vendor/amcl-js/src/ctx.js | 1203 --- .../bls-verify/src/vendor/amcl-js/src/ecdh.js | 447 -- .../bls-verify/src/vendor/amcl-js/src/ecp.js | 1966 ----- .../bls-verify/src/vendor/amcl-js/src/ecp2.js | 1094 --- .../bls-verify/src/vendor/amcl-js/src/ecp4.js | 970 --- .../bls-verify/src/vendor/amcl-js/src/ecp8.js | 1172 --- .../bls-verify/src/vendor/amcl-js/src/ff.js | 1024 --- .../bls-verify/src/vendor/amcl-js/src/fp.js | 833 --- .../bls-verify/src/vendor/amcl-js/src/fp12.js | 1069 --- .../bls-verify/src/vendor/amcl-js/src/fp16.js | 594 -- .../bls-verify/src/vendor/amcl-js/src/fp2.js | 483 -- .../bls-verify/src/vendor/amcl-js/src/fp24.js | 1131 --- .../bls-verify/src/vendor/amcl-js/src/fp4.js | 722 -- .../bls-verify/src/vendor/amcl-js/src/fp48.js | 1225 ---- .../bls-verify/src/vendor/amcl-js/src/fp8.js | 737 -- .../bls-verify/src/vendor/amcl-js/src/gcm.js | 471 -- .../src/vendor/amcl-js/src/hash256.js | 235 - .../src/vendor/amcl-js/src/hash384.js | 361 - .../src/vendor/amcl-js/src/hash512.js | 364 - .../bls-verify/src/vendor/amcl-js/src/hmac.js | 764 -- .../bls-verify/src/vendor/amcl-js/src/hpke.js | 297 - .../bls-verify/src/vendor/amcl-js/src/mpin.js | 274 - .../src/vendor/amcl-js/src/mpin192.js | 275 - .../src/vendor/amcl-js/src/mpin256.js | 276 - .../bls-verify/src/vendor/amcl-js/src/nhs.js | 766 -- .../bls-verify/src/vendor/amcl-js/src/pair.js | 1076 --- .../src/vendor/amcl-js/src/pair4.js | 819 --- .../src/vendor/amcl-js/src/pair8.js | 918 --- .../bls-verify/src/vendor/amcl-js/src/rand.js | 197 - .../src/vendor/amcl-js/src/rom_curve.js | 2705 ------- .../src/vendor/amcl-js/src/rom_field.js | 1101 --- .../bls-verify/src/vendor/amcl-js/src/rsa.js | 290 - .../bls-verify/src/vendor/amcl-js/src/sha3.js | 392 - .../src/vendor/amcl-js/src/share.js | 152 - .../src/vendor/amcl-js/src/uint64.js | 67 - 47 files changed, 1929 insertions(+), 34023 deletions(-) delete mode 100644 packages/bls-verify/src/vendor/amcl-js/index.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/package.json delete mode 100644 packages/bls-verify/src/vendor/amcl-js/readme.md delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/aes.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/big.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/bls.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/bls192.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/bls256.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ctx.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecdh.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp2.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp4.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ecp8.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/ff.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp12.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp16.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp2.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp24.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp4.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp48.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/fp8.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/gcm.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hash256.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hash384.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hash512.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hmac.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/hpke.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/mpin.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/mpin192.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/mpin256.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/nhs.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/pair.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/pair4.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/pair8.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rand.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rom_field.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/rsa.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/sha3.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/share.js delete mode 100644 packages/bls-verify/src/vendor/amcl-js/src/uint64.js diff --git a/package-lock.json b/package-lock.json index de4820d5d..c7b8ee476 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "@dfinity/agent-monorepo", "version": "0.20.2", "license": "Apache-2.0", + "dependencies": { + "@noble/curves": "^1.2.0" + }, "devDependencies": { "@jest/types": "^29.6.3", "@size-limit/preset-small-lib": "^9.0.0", @@ -80,18 +83,16 @@ }, "e2e/browser/node_modules/@types/node": { "version": "18.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } }, "e2e/browser/node_modules/size-limit": { "version": "8.2.6", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-8.2.6.tgz", - "integrity": "sha512-zpznim/tX/NegjoQuRKgWTF4XiB0cn2qt90uJzxYNTFAqexk4b94DOAkBD3TwhC6c3kw2r0KcnA5upziVMZqDg==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -143,9 +144,8 @@ }, "e2e/node/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", - "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.4.0", "@typescript-eslint/scope-manager": "5.62.0", @@ -177,9 +177,8 @@ }, "e2e/node/node_modules/@typescript-eslint/parser": { "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", - "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", @@ -204,9 +203,8 @@ }, "e2e/node/node_modules/escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -216,9 +214,8 @@ }, "e2e/node/node_modules/eslint-plugin-jsdoc": { "version": "39.9.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.9.1.tgz", - "integrity": "sha512-Rq2QY6BZP2meNIs48aZ3GlIlJgBqFCmR55+UBvaDkA3ZNQ0SvQXOs2QKkubakEijV8UbIVbVZKsOVN8G3MuqZw==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "@es-joy/jsdoccomment": "~0.36.1", "comment-parser": "1.3.1", @@ -237,9 +234,8 @@ }, "e2e/node/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -252,9 +248,8 @@ }, "e2e/node/node_modules/size-limit": { "version": "8.2.6", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-8.2.6.tgz", - "integrity": "sha512-zpznim/tX/NegjoQuRKgWTF4XiB0cn2qt90uJzxYNTFAqexk4b94DOAkBD3TwhC6c3kw2r0KcnA5upziVMZqDg==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -699,9 +694,8 @@ }, "node_modules/@babel/runtime": { "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", - "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", "dev": true, + "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -762,6 +756,7 @@ }, "node_modules/@colors/colors": { "version": "1.5.0", + "dev": true, "license": "MIT", "engines": { "node": ">=0.1.90" @@ -789,9 +784,8 @@ }, "node_modules/@cypress/request": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", - "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -818,9 +812,8 @@ }, "node_modules/@cypress/request/node_modules/form-data": { "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -832,9 +825,8 @@ }, "node_modules/@cypress/xvfb": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", - "integrity": "sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^3.1.0", "lodash.once": "^4.1.1" @@ -842,9 +834,8 @@ }, "node_modules/@cypress/xvfb/node_modules/debug": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.1" } @@ -901,9 +892,8 @@ }, "node_modules/@es-joy/jsdoccomment": { "version": "0.36.1", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.36.1.tgz", - "integrity": "sha512-922xqFsTpHs6D0BUiG4toiyPOMc8/jafnWKxz1KWgS4XzKPy2qXf1Pe6UFuNSCQqt6tOuhAWXBNuuyUhJmw9Vg==", "dev": true, + "license": "MIT", "dependencies": { "comment-parser": "1.3.1", "esquery": "^1.4.0", @@ -913,530 +903,193 @@ "node": "^14 || ^16 || ^17 || ^18 || ^19" } }, - "node_modules/@esbuild/android-arm": { + "node_modules/@esbuild/darwin-arm64": { "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", - "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", "cpu": [ - "arm" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "darwin" ], "engines": { "node": ">=12" } }, - "node_modules/@esbuild/android-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", - "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", - "cpu": [ - "arm64" - ], + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, - "node_modules/@esbuild/android-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", - "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", - "cpu": [ - "x64" - ], + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", - "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", - "cpu": [ - "arm64" - ], + "node_modules/@eslint/eslintrc": { + "version": "2.1.3", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", - "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", - "cpu": [ - "x64" - ], + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.23.0", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", - "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", - "cpu": [ - "arm64" - ], + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", - "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", - "cpu": [ - "x64" - ], + "node_modules/@eslint/js": { + "version": "8.53.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@esbuild/linux-arm": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", - "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", - "cpu": [ - "arm" - ], + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.13", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, "engines": { - "node": ">=12" + "node": ">=10.10.0" } }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", - "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", - "cpu": [ - "arm64" - ], + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", - "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", - "cpu": [ - "ia32" - ], + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "BSD-3-Clause" }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", - "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", - "cpu": [ - "loong64" - ], + "node_modules/@iarna/toml": { + "version": "2.2.5", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "ISC" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", - "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", - "cpu": [ - "mips64el" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" } }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", - "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", - "cpu": [ - "ppc64" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", - "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", - "cpu": [ - "riscv64" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", - "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", - "cpu": [ - "s390x" - ], + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/@esbuild/linux-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", - "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", - "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", - "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", - "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", - "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", - "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", - "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.23.0", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "8.53.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@iarna/toml": { - "version": "2.2.5", - "dev": true, - "license": "ISC" - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { - "version": "1.0.10", - "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.1", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { - "version": "2.3.0", + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", "dev": true, "license": "MIT", "dependencies": { @@ -2007,9 +1660,8 @@ }, "node_modules/@jest/test-sequencer": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", - "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", "dev": true, + "license": "MIT", "dependencies": { "@jest/test-result": "^29.7.0", "graceful-fs": "^4.2.9", @@ -2270,15 +1922,13 @@ }, "node_modules/@lezer/common": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.1.1.tgz", - "integrity": "sha512-aAPB9YbvZHqAW+bIwiuuTDGB4DG0sYNRObGLxud8cW7osw1ZQxfDuTZ8KQiqfZ0QJGcR34CvpTMDXEyo/+Htgg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@lezer/lr": { "version": "1.3.14", - "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.3.14.tgz", - "integrity": "sha512-z5mY4LStlA3yL7aHT/rqgG614cfcvklS+8oFRFBYrs4YaWLJyKKM4+nN6KopToX0o9Hj6zmH6M5kinOYuy06ug==", "dev": true, + "license": "MIT", "dependencies": { "@lezer/common": "^1.0.0" } @@ -2296,87 +1946,20 @@ }, "node_modules/@lmdb/lmdb-darwin-arm64": { "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-2.8.5.tgz", - "integrity": "sha512-KPDeVScZgA1oq0CiPBcOa3kHIqU+pTOwRFDIhxvmf8CTNvqdZQYp5cCKW0bUk69VygB2PuTiINFWbY78aR2pQw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, - "node_modules/@lmdb/lmdb-darwin-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-2.8.5.tgz", - "integrity": "sha512-w/sLhN4T7MW1nB3R/U8WK5BgQLz904wh+/SmA2jD8NnF7BLLoUgflCNxOeSPOWp8geP6nP/+VjWzZVip7rZ1ug==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-2.8.5.tgz", - "integrity": "sha512-c0TGMbm2M55pwTDIfkDLB6BpIsgxV4PjYck2HiOX+cy/JWiBXz32lYbarPqejKs9Flm7YVAKSILUducU9g2RVg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-2.8.5.tgz", - "integrity": "sha512-vtbZRHH5UDlL01TT5jB576Zox3+hdyogvpcbvVJlmU5PdL3c5V7cj1EODdh1CHPksRl+cws/58ugEHi8bcj4Ww==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-2.8.5.tgz", - "integrity": "sha512-Xkc8IUx9aEhP0zvgeKy7IQ3ReX2N8N1L0WPcQwnZweWmOuKfwpS3GRIYqLtK5za/w3E60zhFfNdS+3pBZPytqQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-win32-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.8.5.tgz", - "integrity": "sha512-4wvrf5BgnR8RpogHhtpCPJMKBmvyZPhhUtEwMJbXh0ni2BucpfF07jlmyM11zRqQ2XIq6PbC2j7W7UCCcm1rRQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@mischnic/json-sourcemap": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@mischnic/json-sourcemap/-/json-sourcemap-0.1.1.tgz", - "integrity": "sha512-iA7+tyVqfrATAIsIRWQG+a7ZLLD0VaOCKV2Wd/v4mqIU3J9c4jx9p7S0nw1XH3gJCKNBOOwACOPYYSUu9pgT+w==", "dev": true, + "license": "MIT", "dependencies": { "@lezer/common": "^1.0.0", "@lezer/lr": "^1.0.0", @@ -2388,86 +1971,19 @@ }, "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.2.tgz", - "integrity": "sha512-9bfjwDxIDWmmOKusUcqdS4Rw+SETlp9Dy39Xui9BEGEk19dDwH0jhipwFzEff/pFg95NKymc6TOTbRKcWeRqyQ==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.2.tgz", - "integrity": "sha512-lwriRAHm1Yg4iDf23Oxm9n/t5Zpw1lVnxYU3HnJPTi2lJRkKTrps1KVgvL6m7WvmhYVt/FIsssWay+k45QHeuw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.2.tgz", - "integrity": "sha512-MOI9Dlfrpi2Cuc7i5dXdxPbFIgbDBGgKR5F2yWEa6FVEtSWncfVNKW5AKjImAQ6CZlBK9tympdsZJ2xThBiWWA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.2.tgz", - "integrity": "sha512-FU20Bo66/f7He9Fp9sP2zaJ1Q8L9uLPZQDub/WlUip78JlPeMbVL8546HbZfcW9LNciEXc8d+tThSJjSC+tmsg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.2.tgz", - "integrity": "sha512-gsWNDCklNy7Ajk0vBBf9jEx04RUxuDQfBse918Ww+Qb9HCPoGzS+XJTLe96iN3BVK7grnLiYghP/M4L8VsaHeA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.2.tgz", - "integrity": "sha512-O+6Gs8UeDbyFpbSh2CPEz/UOrrdWPTBYNblZK5CxxLisYt4kGX3Sc+czffFonyjiGSq3jWLwJS/CCJc7tBr4sQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@noble/curves": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", - "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "license": "MIT", "dependencies": { "@noble/hashes": "1.3.2" }, @@ -2692,9 +2208,8 @@ }, "node_modules/@opencensus/core": { "version": "0.0.9", - "resolved": "https://registry.npmjs.org/@opencensus/core/-/core-0.0.9.tgz", - "integrity": "sha512-31Q4VWtbzXpVUd2m9JS6HEaPjlKvNMOiF7lWKNmXF84yUcgfAFL5re7/hjDmdyQbOp32oGc+RFV78jXIldVz6Q==", "dev": true, + "license": "Apache-2.0", "dependencies": { "continuation-local-storage": "^3.2.1", "log-driver": "^1.2.7", @@ -2708,28 +2223,24 @@ }, "node_modules/@opencensus/core/node_modules/semver": { "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } }, "node_modules/@opencensus/core/node_modules/uuid": { "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, + "license": "MIT", "bin": { "uuid": "bin/uuid" } }, "node_modules/@opencensus/propagation-b3": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@opencensus/propagation-b3/-/propagation-b3-0.0.8.tgz", - "integrity": "sha512-PffXX2AL8Sh0VHQ52jJC4u3T0H6wDK6N/4bg7xh4ngMYOIi13aR1kzVvX1sVDBgfGwDOkMbl4c54Xm3tlPx/+A==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@opencensus/core": "^0.0.8", "uuid": "^3.2.1" @@ -2740,9 +2251,8 @@ }, "node_modules/@opencensus/propagation-b3/node_modules/@opencensus/core": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@opencensus/core/-/core-0.0.8.tgz", - "integrity": "sha512-yUFT59SFhGMYQgX0PhoTR0LBff2BEhPrD9io1jWfF/VDbakRfs6Pq60rjv0Z7iaTav5gQlttJCX2+VPxFWCuoQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "continuation-local-storage": "^3.2.1", "log-driver": "^1.2.7", @@ -2756,28 +2266,24 @@ }, "node_modules/@opencensus/propagation-b3/node_modules/semver": { "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } }, "node_modules/@opencensus/propagation-b3/node_modules/uuid": { "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, + "license": "MIT", "bin": { "uuid": "bin/uuid" } }, "node_modules/@parcel/bundler-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/bundler-default/-/bundler-default-2.10.2.tgz", - "integrity": "sha512-XlVGsScK5PgIFXNJ0Yx/+nHu1RFCuslCbrb8MIs0yqS790yzvyJF2QHX5WAr7Qc5powij/+2tfBHiViauWwVpA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/graph": "3.0.2", @@ -2797,9 +2303,8 @@ }, "node_modules/@parcel/cache": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/cache/-/cache-2.10.2.tgz", - "integrity": "sha512-B69e5n+bBzYoaJdUOviYeUT7N1iXI3IC5G8dAxKNZ9Zgn+pjZ5BwltbfmP47+NTfQ7LqM8Ea4UJxysQsLdwb+Q==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/fs": "2.10.2", "@parcel/logger": "2.10.2", @@ -2819,9 +2324,8 @@ }, "node_modules/@parcel/codeframe": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/codeframe/-/codeframe-2.10.2.tgz", - "integrity": "sha512-EZrYSIlVg4qiBLHRRqC/BGN2MLG0SKnw4u7kpviwz63I+v36ghqmHGOomwfn4x13nDL+EgOFz4/+Q7QpbMTKug==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0" }, @@ -2835,9 +2339,8 @@ }, "node_modules/@parcel/codeframe/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -2850,9 +2353,8 @@ }, "node_modules/@parcel/codeframe/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -2866,9 +2368,8 @@ }, "node_modules/@parcel/codeframe/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -2878,24 +2379,21 @@ }, "node_modules/@parcel/codeframe/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/codeframe/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/codeframe/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -2905,9 +2403,8 @@ }, "node_modules/@parcel/compressor-raw": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/compressor-raw/-/compressor-raw-2.10.2.tgz", - "integrity": "sha512-zIbtmL7vGfWkvBwD29zVdDosFR1eKHa29SpPOQXYLmDO0EVdwzYcTQq2OrlZM07o759QUqwXJfuAYxwcBNRTYg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -2922,9 +2419,8 @@ }, "node_modules/@parcel/config-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/config-default/-/config-default-2.10.2.tgz", - "integrity": "sha512-BGn7G5MT6VXpnI5Rj8fzHT1ij0YElge3l2KVGSOJ5crho2Fmz7UKmm8kJ9kdcLrzHWOIH07T100YoQuAwKVQaA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/bundler-default": "2.10.2", "@parcel/compressor-raw": "2.10.2", @@ -2968,9 +2464,8 @@ }, "node_modules/@parcel/core": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/core/-/core-2.10.2.tgz", - "integrity": "sha512-c6hh13oYk9w5creiQ9yCz9GLQ17ZRMonULhJ46J0yoFArynVhNTJ9B5xVst7rS/chOTY8jU0jSdJuxQCR4fjkg==", "dev": true, + "license": "MIT", "dependencies": { "@mischnic/json-sourcemap": "^0.1.0", "@parcel/cache": "2.10.2", @@ -3008,18 +2503,16 @@ }, "node_modules/@parcel/core/node_modules/base-x": { "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.0.1" } }, "node_modules/@parcel/core/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3032,9 +2525,8 @@ }, "node_modules/@parcel/diagnostic": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/diagnostic/-/diagnostic-2.10.2.tgz", - "integrity": "sha512-FwtphyiV/TJEiYIRYXBOloXp7XhTW37ifRSLr7RdLbDVyn/P9q/7l0+ORlnOL+WuKwbDQtY+dXYLh/ijTsq7qQ==", "dev": true, + "license": "MIT", "dependencies": { "@mischnic/json-sourcemap": "^0.1.0", "nullthrows": "^1.1.1" @@ -3049,9 +2541,8 @@ }, "node_modules/@parcel/events": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/events/-/events-2.10.2.tgz", - "integrity": "sha512-Dp8Oqh5UvSuIASfiHP8jrEtdtzzmTKiOG/RkSL3mtp2tK3mu6dZLJZbcdJXrvBTg7smtRiznkrIOJCawALC7AQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12.0.0" }, @@ -3062,9 +2553,8 @@ }, "node_modules/@parcel/fs": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/fs/-/fs-2.10.2.tgz", - "integrity": "sha512-80SXdFGDJtil9tTbWrYiZRfQ5ehMAT/dq6eY4EYcFg+MvSiwBL/4GfYMfqXn6AamuSVeQlsFCPpunFLNl9YDDA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/rust": "2.10.2", "@parcel/types": "2.10.2", @@ -3085,9 +2575,8 @@ }, "node_modules/@parcel/graph": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@parcel/graph/-/graph-3.0.2.tgz", - "integrity": "sha512-cPxCN3+QF+5l4BJ0wnLeb3DPJarWQoD3W984CfuEYy/8Zgo2oayd31soZzkevyTYtp7H4tJKo+I79i2TJdNq5Q==", "dev": true, + "license": "MIT", "dependencies": { "nullthrows": "^1.1.1" }, @@ -3101,9 +2590,8 @@ }, "node_modules/@parcel/logger": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/logger/-/logger-2.10.2.tgz", - "integrity": "sha512-5lufBuBnXDs3hjAaptmeEAxpH0eHe0+2hJvlVv5lE/RwHR7vDjh+FDwzPfCLWNM3TQhPQdZPdHcDsuA539GHcw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/events": "2.10.2" @@ -3118,9 +2606,8 @@ }, "node_modules/@parcel/markdown-ansi": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/markdown-ansi/-/markdown-ansi-2.10.2.tgz", - "integrity": "sha512-uZrysHjJ+0vbQNK2bhKy8yoVso8KnoW6O/SW8MiGQ4lpDJdqHShkW08wZUKr4sjl7h/WVFdNsDdgvi2/ANwoRQ==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0" }, @@ -3134,9 +2621,8 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -3149,9 +2635,8 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3165,9 +2650,8 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -3177,24 +2661,21 @@ }, "node_modules/@parcel/markdown-ansi/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/markdown-ansi/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/markdown-ansi/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3204,9 +2685,8 @@ }, "node_modules/@parcel/namer-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/namer-default/-/namer-default-2.10.2.tgz", - "integrity": "sha512-wjn3MCus0w9IOjCtQsp5fgb8hgITyxMr0OPF9cBVAhVJI1X9vvd4RurHuLJ3MjvlCqrP1en09yg3ME7VO1kPuA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3223,9 +2703,8 @@ }, "node_modules/@parcel/node-resolver-core": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@parcel/node-resolver-core/-/node-resolver-core-3.1.2.tgz", - "integrity": "sha512-xvIBgYBRQGmCkfwK/yxVSDtPEvWDVH9poQcGpKHT1jqstYju5crXro0acni5nYF0hWZu7Kttrp9G9fXJQWBksw==", "dev": true, + "license": "MIT", "dependencies": { "@mischnic/json-sourcemap": "^0.1.0", "@parcel/diagnostic": "2.10.2", @@ -3245,9 +2724,8 @@ }, "node_modules/@parcel/node-resolver-core/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3260,9 +2738,8 @@ }, "node_modules/@parcel/optimizer-css": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-css/-/optimizer-css-2.10.2.tgz", - "integrity": "sha512-05H/Ng90TErSFZkNaUwi7gNCf2gLWi3/w07oIzHu1wjRjjKjZidqaQqZtHTEYoO9ffmhK14Xwh9q4IpOTa0sbQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3283,9 +2760,8 @@ }, "node_modules/@parcel/optimizer-htmlnano": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-htmlnano/-/optimizer-htmlnano-2.10.2.tgz", - "integrity": "sha512-9Sg2xLsfX7CPLd1AO3uVa/Kh9EROKVNHMnmNxlzmO2+LEOU/M1OHalvt4bhC7I+cNFPLN5BePdBv3QMYpO0yyA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "htmlnano": "^2.0.0", @@ -3304,18 +2780,16 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/commander": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, "node_modules/@parcel/optimizer-htmlnano/node_modules/css-select": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.0.1", @@ -3329,9 +2803,8 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/css-tree": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", "dev": true, + "license": "MIT", "dependencies": { "mdn-data": "2.0.14", "source-map": "^0.6.1" @@ -3342,9 +2815,8 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/csso": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", "dev": true, + "license": "MIT", "dependencies": { "css-tree": "^1.1.2" }, @@ -3354,15 +2826,13 @@ }, "node_modules/@parcel/optimizer-htmlnano/node_modules/mdn-data": { "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true + "dev": true, + "license": "CC0-1.0" }, "node_modules/@parcel/optimizer-htmlnano/node_modules/svgo": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", "dev": true, + "license": "MIT", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", @@ -3381,9 +2851,8 @@ }, "node_modules/@parcel/optimizer-image": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-image/-/optimizer-image-2.10.2.tgz", - "integrity": "sha512-X8q7mvWJEIXsEMYHYKbwIRUJvI0W41YWCEW7Ohmn0SSi+KuiO8BW5JEPKs7HboO9bX+i6Yxa/T1h9HgRXhdUug==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3405,9 +2874,8 @@ }, "node_modules/@parcel/optimizer-svgo": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-svgo/-/optimizer-svgo-2.10.2.tgz", - "integrity": "sha512-Ws+xd6nbetMCZHmRj54tIF8wYuu/JwkEvn5BotLE69l3naf2ELtsQ+PHg9G5jUa+PnSNMHhykIhBOqjxhTeq/w==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3425,18 +2893,16 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/commander": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, "node_modules/@parcel/optimizer-svgo/node_modules/css-select": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.0.1", @@ -3450,9 +2916,8 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/css-tree": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", - "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", "dev": true, + "license": "MIT", "dependencies": { "mdn-data": "2.0.14", "source-map": "^0.6.1" @@ -3463,9 +2928,8 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/csso": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", "dev": true, + "license": "MIT", "dependencies": { "css-tree": "^1.1.2" }, @@ -3475,15 +2939,13 @@ }, "node_modules/@parcel/optimizer-svgo/node_modules/mdn-data": { "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true + "dev": true, + "license": "CC0-1.0" }, "node_modules/@parcel/optimizer-svgo/node_modules/svgo": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", - "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", "dev": true, + "license": "MIT", "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", @@ -3502,9 +2964,8 @@ }, "node_modules/@parcel/optimizer-swc": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-swc/-/optimizer-swc-2.10.2.tgz", - "integrity": "sha512-/4yMgMgLvF4yCHh0QnZlTUTpKobuFK/lNhB1i5yrtiipRaYcS+OgtakB83grfK+x1KwTbYjzXZBILwqu6GKJDQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3524,9 +2985,8 @@ }, "node_modules/@parcel/package-manager": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/package-manager/-/package-manager-2.10.2.tgz", - "integrity": "sha512-c91YYsIxjX3YhMvtPT7v2MpDOn/Qyw13bi1+0Ftd2JNjUZPlm8+xKizlmgvdi75dgs7dGIUVpvrGLU9LoKthCA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/fs": "2.10.2", @@ -3550,9 +3010,8 @@ }, "node_modules/@parcel/package-manager/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3565,9 +3024,8 @@ }, "node_modules/@parcel/packager-css": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-css/-/packager-css-2.10.2.tgz", - "integrity": "sha512-+X4dV7mBdOhXSHeg5gAkk0Qju6A1oezYIancqDC17zoFzbHUfD13nHNDOXrEfMNFVWy93lB8vLJwchH54MDMwQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3586,9 +3044,8 @@ }, "node_modules/@parcel/packager-html": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-html/-/packager-html-2.10.2.tgz", - "integrity": "sha512-GonfLzuzEkelJde89sq9P9LowLJrFNkuEt33nRokc1Q5TPNOWfTYb6difjuVIMr/j0c4nWlOzUrkGJsyo++F7w==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/types": "2.10.2", @@ -3607,9 +3064,8 @@ }, "node_modules/@parcel/packager-js": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-js/-/packager-js-2.10.2.tgz", - "integrity": "sha512-SgKJqIvMt+UJM0x3F21yBVsgdHbTnOnBrNJ7VoY3nujQX5fa+pxTf0emWuX1vSUDbBaJOmO/pC9rKwWP5enqfQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3631,9 +3087,8 @@ }, "node_modules/@parcel/packager-js/node_modules/globals": { "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -3646,9 +3101,8 @@ }, "node_modules/@parcel/packager-js/node_modules/type-fest": { "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -3658,9 +3112,8 @@ }, "node_modules/@parcel/packager-raw": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-raw/-/packager-raw-2.10.2.tgz", - "integrity": "sha512-+/O2DeMIB9d+1+zCPOkaf2aTl2rN5TFod/UcMzG/HGFlDVqhkV9xgfwV4rV+Vso5TlyHA4p53BFgvGWQBQJAQw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -3675,9 +3128,8 @@ }, "node_modules/@parcel/packager-svg": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-svg/-/packager-svg-2.10.2.tgz", - "integrity": "sha512-eQx3VJpuuDcen+DcLxlPn95txlnbpEH8TES+Ezym/LFyD8oQQfok/VFHy/iGoG4r1CtH0/c7lFUJE8+LZdwYmQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/types": "2.10.2", @@ -3695,9 +3147,8 @@ }, "node_modules/@parcel/packager-wasm": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-wasm/-/packager-wasm-2.10.2.tgz", - "integrity": "sha512-Y/UyyOePb3WmWy2WtmXn4QLLrb7wjWL/ZhVgvhFiQft4lCbdGBGz1BiKEzhFkkN2IGdX06XZolmKCQieAM6zlQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -3712,9 +3163,8 @@ }, "node_modules/@parcel/plugin": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/plugin/-/plugin-2.10.2.tgz", - "integrity": "sha512-1u+GJhuqqlYjMAQLBbMExfFCbsbtuSAm6wXmMmTse5cBpFqxgsMumMeztAhcTy0oMnMhbZg2AKZV0XVSMrIgng==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/types": "2.10.2" }, @@ -3728,9 +3178,8 @@ }, "node_modules/@parcel/profiler": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/profiler/-/profiler-2.10.2.tgz", - "integrity": "sha512-YQugGhf12u83O0RJLWbhkPV772nePPxNZjvFJmV++7buPUpgJW2m1lVOrut/s/8ZZIPqcxJe8dyxSSOtvdG7OQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/events": "2.10.2", @@ -3746,9 +3195,8 @@ }, "node_modules/@parcel/reporter-cli": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-cli/-/reporter-cli-2.10.2.tgz", - "integrity": "sha512-6/cLuiGfMh1ny8ULNOXJkugIvJRVo4tV4XA3vJXH96SYqFSfiWxtHqb6MAVndBy8MezEAv0EsLqc7yR7ygdZJw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/types": "2.10.2", @@ -3767,9 +3215,8 @@ }, "node_modules/@parcel/reporter-cli/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -3782,9 +3229,8 @@ }, "node_modules/@parcel/reporter-cli/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3798,9 +3244,8 @@ }, "node_modules/@parcel/reporter-cli/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -3810,24 +3255,21 @@ }, "node_modules/@parcel/reporter-cli/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/reporter-cli/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/reporter-cli/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3837,9 +3279,8 @@ }, "node_modules/@parcel/reporter-dev-server": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-dev-server/-/reporter-dev-server-2.10.2.tgz", - "integrity": "sha512-mLEcZFPpw0ixlvbT846NwmPEVv1ej7H5dwCQ3r1Ca1nQjyXkmQMM06rdb5M+/gk12WVEDOuienWqBL44Xsz3NA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2" @@ -3855,9 +3296,8 @@ }, "node_modules/@parcel/reporter-tracer": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-tracer/-/reporter-tracer-2.10.2.tgz", - "integrity": "sha512-oreu3vIdN5u9ONSNhqypcK3nR91NoreR4B4vwD/1Rqod1ud2Vb9awJZv7QIrkdnEMmGcr5DQ/R872s7XYWeZnA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -3875,9 +3315,8 @@ }, "node_modules/@parcel/resolver-default": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/resolver-default/-/resolver-default-2.10.2.tgz", - "integrity": "sha512-ENEq8f4wRQlU7p3tCelXWK6xIsL+57q9hQ+b4eRJOEctjfN1/BguxZDh+P+fIlJ1lkqiX4UB/PUkK97uSI5XTQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/node-resolver-core": "3.1.2", "@parcel/plugin": "2.10.2" @@ -3893,9 +3332,8 @@ }, "node_modules/@parcel/runtime-browser-hmr": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-browser-hmr/-/runtime-browser-hmr-2.10.2.tgz", - "integrity": "sha512-ABlCzDYI16lAZLTTL2g3JZasU/dWuSzRGK5paC6JhIJJwQwPeTwu4PaUoEPKeyk0iE9PzVuXjkBbGuSLXQFmmA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2" @@ -3911,9 +3349,8 @@ }, "node_modules/@parcel/runtime-js": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-js/-/runtime-js-2.10.2.tgz", - "integrity": "sha512-a6TaMVg1Xgy+WJJ0a3sC/Taw5hkN4hmLnz00jg7G6LwoGbBpvjJn8pm4eovkMFJz13RCjmS9q0K+qZnvXh1WYA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -3931,9 +3368,8 @@ }, "node_modules/@parcel/runtime-react-refresh": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-react-refresh/-/runtime-react-refresh-2.10.2.tgz", - "integrity": "sha512-9xW3g4FH9iizHWscHD2yEWJOCfYkIYMbWsZoj0EOMILqrRd1OZxHH8FbLYBQKT6swRbZI2mM19veVVBBfxco/Q==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -3951,9 +3387,8 @@ }, "node_modules/@parcel/runtime-service-worker": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-service-worker/-/runtime-service-worker-2.10.2.tgz", - "integrity": "sha512-XY1GrY4r+zu0b/pZiTflZHdk9+I3XoxpExgPcZzep5hnq2UdyXbS4yDhmen7pTcqay5U9NmRw/62YrKL+yPang==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -3970,9 +3405,8 @@ }, "node_modules/@parcel/rust": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/rust/-/rust-2.10.2.tgz", - "integrity": "sha512-v/Cyf3iXlzSc6vgvPiEZzqdKAZ1jJ/aZX7y1YSupDh3RoqJI2bZ93kAOyEi+S7P3kshJkQM0px3YveJFOAMUOA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12.0.0" }, @@ -3983,9 +3417,8 @@ }, "node_modules/@parcel/source-map": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@parcel/source-map/-/source-map-2.1.1.tgz", - "integrity": "sha512-Ejx1P/mj+kMjQb8/y5XxDUn4reGdr+WyKYloBljpppUy8gs42T+BNoEOuRYqDVdgPc6NxduzIDoJS9pOFfV5Ew==", "dev": true, + "license": "MIT", "dependencies": { "detect-libc": "^1.0.3" }, @@ -3995,9 +3428,8 @@ }, "node_modules/@parcel/transformer-babel": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-babel/-/transformer-babel-2.10.2.tgz", - "integrity": "sha512-lmuksSzEBdPL1nVTznsQi5hQ+4mJ7GP+jvOv/Tvx3MjnzIu1G6Fs5MvNpAwBRXmG/F1+0aw/Wa8J38HYfN05dA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4019,9 +3451,8 @@ }, "node_modules/@parcel/transformer-babel/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4034,9 +3465,8 @@ }, "node_modules/@parcel/transformer-css": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-css/-/transformer-css-2.10.2.tgz", - "integrity": "sha512-WxKe1YherQrX0vEfxAsBALEIsztGStmfXF0GAMeynE4q/w1iHQdTzu29tqLrJY7x532Ric8TxnwO8zR0r89DJg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4057,9 +3487,8 @@ }, "node_modules/@parcel/transformer-html": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-html/-/transformer-html-2.10.2.tgz", - "integrity": "sha512-Zkg1HHdYp14ecdtNF+s4d/e1lr8/PAQgBTYhyEVLVC1N7uivjjZ9XClxZlHuZImbQvX3q3PgZS+PocIizhY4rQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4082,9 +3511,8 @@ }, "node_modules/@parcel/transformer-html/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4097,9 +3525,8 @@ }, "node_modules/@parcel/transformer-image": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-image/-/transformer-image-2.10.2.tgz", - "integrity": "sha512-sR2kTsPykYRujKR7ISn0d6Fhem1pMQoqm0cFTrtC9Te5pfIjZ72NfM9clP7jPK660Gd2DYudhUa48y+qKBfCAw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -4116,9 +3543,8 @@ }, "node_modules/@parcel/transformer-js": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-js/-/transformer-js-2.10.2.tgz", - "integrity": "sha512-qcVLyikhSVf3oHhzReECkKdPU5uHVH4L0TC5O9ahlsq2IUTqR8Swq+9wUgUN0S2aYFTWreH05bQwBCNrLzF/eQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4146,15 +3572,13 @@ }, "node_modules/@parcel/transformer-js/node_modules/regenerator-runtime": { "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/transformer-js/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4167,9 +3591,8 @@ }, "node_modules/@parcel/transformer-json": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-json/-/transformer-json-2.10.2.tgz", - "integrity": "sha512-iVgwuaLNqH3jgoBzMds63zd9FULvYb/s/5Hq9JZJ6pCZrOQoPruurgAW8A/t2IE4CSFkDDNoFvRpjsq1WBsSvA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "json5": "^2.2.0" @@ -4185,9 +3608,8 @@ }, "node_modules/@parcel/transformer-postcss": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-postcss/-/transformer-postcss-2.10.2.tgz", - "integrity": "sha512-2/ehCZgj5TOmsAIeGiLwrm6gO/M+X4fZ/O71MhpmXd8zr08j25T0VdSdw5UyopsBvtPYM7DI/FJCviZc7AigCg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4209,9 +3631,8 @@ }, "node_modules/@parcel/transformer-postcss/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4224,9 +3645,8 @@ }, "node_modules/@parcel/transformer-posthtml": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-posthtml/-/transformer-posthtml-2.10.2.tgz", - "integrity": "sha512-0jvqqXfrLqPYBD62aWIMldDnZ9hO/esX6TGKNhAO+85ljeaS2+QZ5XLLb8uPJq8UXB4olhsoEGyGtJSByigndg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -4247,9 +3667,8 @@ }, "node_modules/@parcel/transformer-posthtml/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4262,9 +3681,8 @@ }, "node_modules/@parcel/transformer-raw": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-raw/-/transformer-raw-2.10.2.tgz", - "integrity": "sha512-h6SoIZ3u+Lq8z8SEEAVsHg4IQbUtkBWCln5SG4qfjGiclUDDA2hcG7grsP06Wb6/U7oEc8n0ksTtaG4dekYIxw==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2" }, @@ -4279,9 +3697,8 @@ }, "node_modules/@parcel/transformer-react-refresh-wrap": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-react-refresh-wrap/-/transformer-react-refresh-wrap-2.10.2.tgz", - "integrity": "sha512-1jpzaEbKwJnDUmF8Kgf3/XvT9BnUWIQ7FWkg5EL5kEx6tq2KLKdzD17nFigNj8fr2V+faX0Qa63h+e3OOpnMAA==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.10.2", "@parcel/utils": "2.10.2", @@ -4298,9 +3715,8 @@ }, "node_modules/@parcel/transformer-svg": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-svg/-/transformer-svg-2.10.2.tgz", - "integrity": "sha512-SsCjiM9LZwGne3LUn+GuwhyqklAnr7CER6D0ozdpw+tPOeODsXZXNSktvtpE1Qbia61c/zdlU0yOEuhkeXz29w==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.10.2", "@parcel/plugin": "2.10.2", @@ -4322,9 +3738,8 @@ }, "node_modules/@parcel/transformer-svg/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4337,9 +3752,8 @@ }, "node_modules/@parcel/types": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/types/-/types-2.10.2.tgz", - "integrity": "sha512-fwHJu03ROcc4/Kr/00VfOQUD6aV+6FBLN5bDW1+Xblgrpkb1MSUGTWRuz0YH5X6xhkVigC1llCIR2uHSwA+YBg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/cache": "2.10.2", "@parcel/diagnostic": "2.10.2", @@ -4352,9 +3766,8 @@ }, "node_modules/@parcel/utils": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/utils/-/utils-2.10.2.tgz", - "integrity": "sha512-XLUhTh0UkPB5n8r7agX9iIz9f+3JsBIVsmqltsJYX7n/GAa6EQtqrIYyZu8cEFeZlZw3zaf7wTmf9xJppdlj7Q==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/codeframe": "2.10.2", "@parcel/diagnostic": "2.10.2", @@ -4375,9 +3788,8 @@ }, "node_modules/@parcel/utils/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -4390,9 +3802,8 @@ }, "node_modules/@parcel/utils/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -4406,9 +3817,8 @@ }, "node_modules/@parcel/utils/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -4418,24 +3828,21 @@ }, "node_modules/@parcel/utils/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@parcel/utils/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@parcel/utils/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -4445,10 +3852,8 @@ }, "node_modules/@parcel/watcher": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.3.0.tgz", - "integrity": "sha512-pW7QaFiL11O0BphO+bq3MgqeX/INAk9jgBldVDYjlQPO4VddoZnF22TcF9onMhnLVHuNqBJeRf+Fj7eezi/+rQ==", "dev": true, - "hasInstallScript": true, + "license": "MIT", "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", @@ -4477,34 +3882,13 @@ "@parcel/watcher-win32-x64": "2.3.0" } }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.3.0.tgz", - "integrity": "sha512-f4o9eA3dgk0XRT3XhB0UWpWpLnKgrh1IwNJKJ7UJek7eTYccQ8LR7XUWFKqw6aEq5KUNlCcGvSzKqSX/vtWVVA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/@parcel/watcher-darwin-arm64": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.3.0.tgz", - "integrity": "sha512-mKY+oijI4ahBMc/GygVGvEdOq0L4DxhYgwQqYAz/7yPzuGi79oXrZG52WdpGA1wLBPrYb0T8uBaGFo7I6rvSKw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -4517,241 +3901,38 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.3.0.tgz", - "integrity": "sha512-20oBj8LcEOnLE3mgpy6zuOq8AplPu9NcSSSfyVKgfOhNAc4eF4ob3ldj0xWjGGbOF7Dcy1Tvm6ytvgdjlfUeow==", - "cpu": [ - "x64" - ], + "node_modules/@parcel/watcher/node_modules/node-addon-api": { + "version": "7.0.0", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT" + }, + "node_modules/@parcel/workers": { + "version": "2.10.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@parcel/diagnostic": "2.10.2", + "@parcel/logger": "2.10.2", + "@parcel/profiler": "2.10.2", + "@parcel/types": "2.10.2", + "@parcel/utils": "2.10.2", + "nullthrows": "^1.1.1" + }, "engines": { - "node": ">= 10.0.0" + "node": ">= 12.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.3.0.tgz", - "integrity": "sha512-7LftKlaHunueAEiojhCn+Ef2CTXWsLgTl4hq0pkhkTBFI3ssj2bJXmH2L67mKpiAD5dz66JYk4zS66qzdnIOgw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.3.0.tgz", - "integrity": "sha512-1apPw5cD2xBv1XIHPUlq0cO6iAaEUQ3BcY0ysSyD9Kuyw4MoWm1DV+W9mneWI+1g6OeP6dhikiFE6BlU+AToTQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.3.0.tgz", - "integrity": "sha512-mQ0gBSQEiq1k/MMkgcSB0Ic47UORZBmWoAWlMrTW6nbAGoLZP+h7AtUM7H3oDu34TBFFvjy4JCGP43JlylkTQA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.3.0.tgz", - "integrity": "sha512-LXZAExpepJew0Gp8ZkJ+xDZaTQjLHv48h0p0Vw2VMFQ8A+RKrAvpFuPVCVwKJCr5SE+zvaG+Etg56qXvTDIedw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.3.0.tgz", - "integrity": "sha512-P7Wo91lKSeSgMTtG7CnBS6WrA5otr1K7shhSjKHNePVmfBHDoAOHYRXgUmhiNfbcGk0uMCHVcdbfxtuiZCHVow==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.3.0.tgz", - "integrity": "sha512-+kiRE1JIq8QdxzwoYY+wzBs9YbJ34guBweTK8nlzLKimn5EQ2b2FSC+tAOpq302BuIMjyuUGvBiUhEcLIGMQ5g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.3.0.tgz", - "integrity": "sha512-35gXCnaz1AqIXpG42evcoP2+sNL62gZTMZne3IackM+6QlfMcJLy3DrjuL6Iks7Czpd3j4xRBzez3ADCj1l7Aw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.3.0.tgz", - "integrity": "sha512-FJS/IBQHhRpZ6PiCjFt1UAcPr0YmCLHRbTc00IBTrelEjlmmgIVLeOx4MSXzx2HFEy5Jo5YdhGpxCuqCyDJ5ow==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-x64": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.3.0.tgz", - "integrity": "sha512-dLx+0XRdMnVI62kU3wbXvbIRhLck4aE28bIGKbRGS7BJNt54IIj9+c/Dkqb+7DJEbHUZAX1bwaoM8PqVlHJmCA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher/node_modules/node-addon-api": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.0.0.tgz", - "integrity": "sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==", - "dev": true - }, - "node_modules/@parcel/workers": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@parcel/workers/-/workers-2.10.2.tgz", - "integrity": "sha512-LvifdeORXKGGyhwOwnYxn1AsJ5u6Ihk2RJUxsVA4WYEjz2PSsmLAUDdp48ovssSMnTb9P2g4RrbEG1mJjYtBGA==", - "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.10.2", - "@parcel/logger": "2.10.2", - "@parcel/profiler": "2.10.2", - "@parcel/types": "2.10.2", - "@parcel/utils": "2.10.2", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.10.2" + }, + "peerDependencies": { + "@parcel/core": "^2.10.2" } }, "node_modules/@peculiar/asn1-cms": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.3.8.tgz", - "integrity": "sha512-Wtk9R7yQxGaIaawHorWKP2OOOm/RZzamOmSWwaqGphIuU6TcKYih0slL6asZlSSZtVoYTrBfrddSOD/jTu9vuQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4762,15 +3943,13 @@ }, "node_modules/@peculiar/asn1-cms/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-csr": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.3.8.tgz", - "integrity": "sha512-ZmAaP2hfzgIGdMLcot8gHTykzoI+X/S53x1xoGbTmratETIaAbSWMiPGvZmXRA0SNEIydpMkzYtq4fQBxN1u1w==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4780,15 +3959,13 @@ }, "node_modules/@peculiar/asn1-csr/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-ecc": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.3.8.tgz", - "integrity": "sha512-Ah/Q15y3A/CtxbPibiLM/LKcMbnLTdUdLHUgdpB5f60sSvGkXzxJCu5ezGTFHogZXWNX3KSmYqilCrfdmBc6pQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4798,15 +3975,13 @@ }, "node_modules/@peculiar/asn1-ecc/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-pfx": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.3.8.tgz", - "integrity": "sha512-XhdnCVznMmSmgy68B9pVxiZ1XkKoE1BjO4Hv+eUGiY1pM14msLsFZ3N7K46SoITIVZLq92kKkXpGiTfRjlNLyg==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-cms": "^2.3.8", "@peculiar/asn1-pkcs8": "^2.3.8", @@ -4818,15 +3993,13 @@ }, "node_modules/@peculiar/asn1-pfx/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-pkcs8": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.3.8.tgz", - "integrity": "sha512-rL8k2x59v8lZiwLRqdMMmOJ30GHt6yuHISFIuuWivWjAJjnxzZBVzMTQ72sknX5MeTSSvGwPmEFk2/N8+UztFQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4836,15 +4009,13 @@ }, "node_modules/@peculiar/asn1-pkcs8/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-pkcs9": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.3.8.tgz", - "integrity": "sha512-+nONq5tcK7vm3qdY7ZKoSQGQjhJYMJbwJGbXLFOhmqsFIxEWyQPHyV99+wshOjpOjg0wUSSkEEzX2hx5P6EKeQ==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-cms": "^2.3.8", "@peculiar/asn1-pfx": "^2.3.8", @@ -4858,15 +4029,13 @@ }, "node_modules/@peculiar/asn1-pkcs9/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-rsa": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.3.8.tgz", - "integrity": "sha512-ES/RVEHu8VMYXgrg3gjb1m/XG0KJWnV4qyZZ7mAg7rrF3VTmRbLxO8mk+uy0Hme7geSMebp+Wvi2U6RLLEs12Q==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4876,14 +4045,12 @@ }, "node_modules/@peculiar/asn1-rsa/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-schema": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.3.8.tgz", - "integrity": "sha512-ULB1XqHKx1WBU/tTFIA+uARuRoBVZ4pNdOA878RDrRbBfBGcSzi5HBkdScC6ZbHn8z7L8gmKCgPC1LHRrP46tA==", + "license": "MIT", "dependencies": { "asn1js": "^3.0.5", "pvtsutils": "^1.3.5", @@ -4892,14 +4059,12 @@ }, "node_modules/@peculiar/asn1-schema/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "license": "0BSD" }, "node_modules/@peculiar/asn1-x509": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.3.8.tgz", - "integrity": "sha512-voKxGfDU1c6r9mKiN5ZUsZWh3Dy1BABvTM3cimf0tztNwyMJPhiXY94eRTgsMQe6ViLfT6EoXxkWVzcm3mFAFw==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "asn1js": "^3.0.5", @@ -4910,9 +4075,8 @@ }, "node_modules/@peculiar/asn1-x509-attr": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.3.8.tgz", - "integrity": "sha512-4Z8mSN95MOuX04Aku9BUyMdsMKtVQUqWnr627IheiWnwFoheUhX3R4Y2zh23M7m80r4/WG8MOAckRKc77IRv6g==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", @@ -4922,15 +4086,13 @@ }, "node_modules/@peculiar/asn1-x509-attr/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/asn1-x509/node_modules/tslib": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@peculiar/json-schema": { "version": "1.1.12", @@ -4958,9 +4120,8 @@ }, "node_modules/@peculiar/x509": { "version": "1.9.5", - "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.9.5.tgz", - "integrity": "sha512-6HBrlgoyH8sod0PTjQ8hzOL4/f5L94s5lwiL9Gr0P5HiSO8eeNgKoiB+s7VhDczE2aaloAgDXFjoQHVEcTg4mg==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-cms": "^2.3.6", "@peculiar/asn1-csr": "^2.3.6", @@ -4977,9 +4138,8 @@ }, "node_modules/@pm2/agent": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-2.0.3.tgz", - "integrity": "sha512-xkqqCoTf5VsciMqN0vb9jthW7olVAi4KRFNddCc7ZkeJZ3i8QwZANr4NSH2H5DvseRFHq7MiPspRY/EWAFWWTg==", "dev": true, + "license": "AGPL-3.0", "dependencies": { "async": "~3.2.0", "chalk": "~3.0.0", @@ -4998,9 +4158,8 @@ }, "node_modules/@pm2/agent/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -5013,9 +4172,8 @@ }, "node_modules/@pm2/agent/node_modules/chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5026,9 +4184,8 @@ }, "node_modules/@pm2/agent/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -5038,36 +4195,31 @@ }, "node_modules/@pm2/agent/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@pm2/agent/node_modules/dayjs": { "version": "1.8.36", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.36.tgz", - "integrity": "sha512-3VmRXEtw7RZKAf+4Tv1Ym9AGeo8r8+CjDi26x+7SYQil1UqtqdaokhzoEJohqlzt0m5kacJSDhJQkG/LWhpRBw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@pm2/agent/node_modules/eventemitter2": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz", - "integrity": "sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@pm2/agent/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@pm2/agent/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5080,9 +4232,8 @@ }, "node_modules/@pm2/agent/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -5092,9 +4243,8 @@ }, "node_modules/@pm2/agent/node_modules/ws": { "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -5113,9 +4263,8 @@ }, "node_modules/@pm2/io": { "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@pm2/io/-/io-5.0.2.tgz", - "integrity": "sha512-XAvrNoQPKOyO/jJyCu8jPhLzlyp35MEf7w/carHXmWKddPzeNOFSEpSEqMzPDawsvpxbE+i918cNN+MwgVsStA==", "dev": true, + "license": "Apache-2", "dependencies": { "@opencensus/core": "0.0.9", "@opencensus/propagation-b3": "0.0.8", @@ -5134,18 +4283,16 @@ }, "node_modules/@pm2/io/node_modules/async": { "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, + "license": "MIT", "dependencies": { "lodash": "^4.17.14" } }, "node_modules/@pm2/io/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5158,15 +4305,13 @@ }, "node_modules/@pm2/io/node_modules/tslib": { "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/@pm2/js-api": { "version": "0.6.7", - "resolved": "https://registry.npmjs.org/@pm2/js-api/-/js-api-0.6.7.tgz", - "integrity": "sha512-jiJUhbdsK+5C4zhPZNnyA3wRI01dEc6a2GhcQ9qI38DyIk+S+C8iC3fGjcjUbt/viLYKPjlAaE+hcT2/JMQPXw==", "dev": true, + "license": "Apache-2", "dependencies": { "async": "^2.6.3", "axios": "^0.21.0", @@ -5180,18 +4325,16 @@ }, "node_modules/@pm2/js-api/node_modules/async": { "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, + "license": "MIT", "dependencies": { "lodash": "^4.17.14" } }, "node_modules/@pm2/js-api/node_modules/ws": { "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -5210,9 +4353,8 @@ }, "node_modules/@pm2/pm2-version-check": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@pm2/pm2-version-check/-/pm2-version-check-1.0.4.tgz", - "integrity": "sha512-SXsM27SGH3yTWKc2fKR4SYNxsmnvuBQ9dd6QHtEWmiZ/VqaOYPAIlS8+vMcn27YLtAEBGvNRSh3TPNvtjZgfqA==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.3.1" } @@ -5296,9 +4438,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/esbuild": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-9.0.0.tgz", - "integrity": "sha512-y3NY0inaFeLqV6SRXNVILhawQdQcODxF30qft6OalsrqtQtBjt++6ZeahYhUbrVexUEWRh6c7yPCe8RvHn8hlA==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.19.2", "nanoid": "^3.3.6" @@ -5312,9 +4453,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/file": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-9.0.0.tgz", - "integrity": "sha512-oM2UaH2FRq4q22k+R+P6xCpzET10T94LFdSjb9svVu/vOD7NaB9LGcG6se8TW1BExXiyXO4GEhLsBt3uMKM3qA==", "dev": true, + "license": "MIT", "dependencies": { "semver": "7.5.4" }, @@ -5327,10 +4467,9 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/esbuild": { "version": "0.19.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", - "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -5364,9 +4503,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5379,9 +4517,8 @@ }, "node_modules/@size-limit/preset-small-lib/node_modules/size-limit": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-9.0.0.tgz", - "integrity": "sha512-DrA7o2DeRN3s+vwCA9nn7Ck9Y4pn9t0GNUwQRpKqBtBmNkl6LA2s/NlNCdtKHrEkRTeYA1ZQ65mnYveo9rUqgA==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -5399,10 +4536,9 @@ }, "node_modules/@swc/core": { "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.96.tgz", - "integrity": "sha512-zwE3TLgoZwJfQygdv2SdCK9mRLYluwDOM53I+dT6Z5ZvrgVENmY3txvWDvduzkV+/8IuvrRbVezMpxcojadRdQ==", "dev": true, "hasInstallScript": true, + "license": "Apache-2.0", "dependencies": { "@swc/counter": "^0.1.1", "@swc/types": "^0.1.5" @@ -5437,12 +4573,11 @@ }, "node_modules/@swc/core-darwin-arm64": { "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.96.tgz", - "integrity": "sha512-8hzgXYVd85hfPh6mJ9yrG26rhgzCmcLO0h1TIl8U31hwmTbfZLzRitFQ/kqMJNbIBCwmNH1RU2QcJnL3d7f69A==", "cpu": [ "arm64" ], "dev": true, + "license": "Apache-2.0 AND MIT", "optional": true, "os": [ "darwin" @@ -5452,179 +4587,23 @@ "node": ">=10" } }, - "node_modules/@swc/core-darwin-x64": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.96.tgz", - "integrity": "sha512-mFp9GFfuPg+43vlAdQZl0WZpZSE8sEzqL7sr/7Reul5McUHP0BaLsEzwjvD035ESfkY8GBZdLpMinblIbFNljQ==", - "cpu": [ - "x64" - ], + "node_modules/@swc/counter": { + "version": "0.1.2", "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">=10" + "license": "Apache-2.0" + }, + "node_modules/@swc/helpers": { + "version": "0.5.3", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.4.0" } }, - "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.96.tgz", - "integrity": "sha512-8UEKkYJP4c8YzYIY/LlbSo8z5Obj4hqcv/fUTHiEePiGsOddgGf7AWjh56u7IoN/0uEmEro59nc1ChFXqXSGyg==", - "cpu": [ - "arm" - ], + "node_modules/@swc/types": { + "version": "0.1.5", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.96.tgz", - "integrity": "sha512-c/IiJ0s1y3Ymm2BTpyC/xr6gOvoqAVETrivVXHq68xgNms95luSpbYQ28rqaZC8bQC8M5zdXpSc0T8DJu8RJGw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.96.tgz", - "integrity": "sha512-i5/UTUwmJLri7zhtF6SAo/4QDQJDH2fhYJaBIUhrICmIkRO/ltURmpejqxsM/ye9Jqv5zG7VszMC0v/GYn/7BQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.96.tgz", - "integrity": "sha512-USdaZu8lTIkm4Yf9cogct/j5eqtdZqTgcTib4I+NloUW0E/hySou3eSyp3V2UAA1qyuC72ld1otXuyKBna0YKQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-musl": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.96.tgz", - "integrity": "sha512-QYErutd+G2SNaCinUVobfL7jWWjGTI0QEoQ6hqTp7PxCJS/dmKmj3C5ZkvxRYcq7XcZt7ovrYCTwPTHzt6lZBg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.96.tgz", - "integrity": "sha512-hjGvvAduA3Un2cZ9iNP4xvTXOO4jL3G9iakhFsgVhpkU73SGmK7+LN8ZVBEu4oq2SUcHO6caWvnZ881cxGuSpg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.96.tgz", - "integrity": "sha512-Far2hVFiwr+7VPCM2GxSmbh3ikTpM3pDombE+d69hkedvYHYZxtTF+2LTKl/sXtpbUnsoq7yV/32c9R/xaaWfw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.3.96", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.96.tgz", - "integrity": "sha512-4VbSAniIu0ikLf5mBX81FsljnfqjoVGleEkCQv4+zRlyZtO3FHoDPkeLVoy6WRlj7tyrRcfUJ4mDdPkbfTO14g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/counter": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", - "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==", - "dev": true - }, - "node_modules/@swc/helpers": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.3.tgz", - "integrity": "sha512-FaruWX6KdudYloq1AHD/4nU+UsMTdNE8CKyrseXWEcgjDAbvkwJg2QGPAnfIJLIWsjZOSPLOAykK6fuYp4vp4A==", - "dev": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@swc/types": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.5.tgz", - "integrity": "sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==", - "dev": true + "license": "Apache-2.0" }, "node_modules/@szmarczak/http-timer": { "version": "5.0.1", @@ -5679,9 +4658,8 @@ }, "node_modules/@trysound/sax": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", - "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10.13.0" } @@ -5708,9 +4686,8 @@ }, "node_modules/@tsconfig/node17": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node17/-/node17-1.0.3.tgz", - "integrity": "sha512-hgCBRFxS8grt7H1zfUeRdNvGzL3ZETTszOHJ5o5Hr/XBpqrWcMb0Ufec9kJK3zCL2DJ4bflH3VxHF/cESEYF+w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/babel__core": { "version": "7.20.3", @@ -5751,9 +4728,8 @@ }, "node_modules/@types/base64-js": { "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/base64-js/-/base64-js-1.3.2.tgz", - "integrity": "sha512-Q2Xn2/vQHRGLRXhQ5+BSLwhHkR3JVflxVKywH0Q6fVoAiUE8fFYL2pE5/l2ZiOiBDfA8qUqRnSxln4G/NFz1Sg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/bs58check": { "version": "2.1.0", @@ -5765,15 +4741,13 @@ }, "node_modules/@types/chai": { "version": "4.3.10", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-of+ICnbqjmFCiixUnqRulbylyXQrPqIGf/B3Jax1wIF3DvSheysQxAWvqHhZiW3IQrycvokcLcFQlveGp+vyNg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/chai-subset": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.5.tgz", - "integrity": "sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==", "dev": true, + "license": "MIT", "dependencies": { "@types/chai": "*" } @@ -5788,9 +4762,8 @@ }, "node_modules/@types/hdkey": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/hdkey/-/hdkey-2.0.3.tgz", - "integrity": "sha512-U5W3b+f3KqCC7tge4WjV5MDzzYTcwbnufyL7RwEmxH2EyxtbfaQVlS8z6PZDp8XET304EEVhLWG76rF5ygUKHQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -5802,9 +4775,8 @@ }, "node_modules/@types/isomorphic-fetch": { "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.36.tgz", - "integrity": "sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", @@ -5893,9 +4865,8 @@ }, "node_modules/@types/secp256k1": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.6.tgz", - "integrity": "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -5907,15 +4878,13 @@ }, "node_modules/@types/sinonjs__fake-timers": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz", - "integrity": "sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/sizzle": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.6.tgz", - "integrity": "sha512-m04Om5Gz6kbjUwAQ7XJJQ30OdEFsSmAVsvn4NYwcTRyMVpKKa1aPuESw1n2CxS5fYkOQv3nHgDKeNa8e76fUkw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/stack-utils": { "version": "2.0.1", @@ -5924,9 +4893,8 @@ }, "node_modules/@types/text-encoding": { "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@types/text-encoding/-/text-encoding-0.0.36.tgz", - "integrity": "sha512-LfATA7bH+MtAPlOshYgQ1M3n2r0TSB6Ns5ESvKYlVugkKErQg5oFbR2qO7XrKtNsrtzedDvTeqQfyTjdPJH7jw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/tough-cookie": { "version": "4.0.4", @@ -5948,9 +4916,8 @@ }, "node_modules/@types/yauzl": { "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", - "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "@types/node": "*" @@ -6110,9 +5077,8 @@ }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ts-api-utils": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, + "license": "MIT", "engines": { "node": ">=16.13.0" }, @@ -6217,9 +5183,8 @@ }, "node_modules/@typescript-eslint/parser/node_modules/ts-api-utils": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, + "license": "MIT", "engines": { "node": ">=16.13.0" }, @@ -6427,9 +5392,8 @@ }, "node_modules/@vitest/expect": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", - "integrity": "sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==", "dev": true, + "license": "MIT", "dependencies": { "@vitest/spy": "0.34.6", "@vitest/utils": "0.34.6", @@ -6441,9 +5405,8 @@ }, "node_modules/@vitest/runner": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.6.tgz", - "integrity": "sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==", "dev": true, + "license": "MIT", "dependencies": { "@vitest/utils": "0.34.6", "p-limit": "^4.0.0", @@ -6455,9 +5418,8 @@ }, "node_modules/@vitest/runner/node_modules/p-limit": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^1.0.0" }, @@ -6470,9 +5432,8 @@ }, "node_modules/@vitest/runner/node_modules/yocto-queue": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.20" }, @@ -6482,9 +5443,8 @@ }, "node_modules/@vitest/snapshot": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.6.tgz", - "integrity": "sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==", "dev": true, + "license": "MIT", "dependencies": { "magic-string": "^0.30.1", "pathe": "^1.1.1", @@ -6496,9 +5456,8 @@ }, "node_modules/@vitest/spy": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.6.tgz", - "integrity": "sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==", "dev": true, + "license": "MIT", "dependencies": { "tinyspy": "^2.1.1" }, @@ -6508,9 +5467,8 @@ }, "node_modules/@vitest/utils": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.6.tgz", - "integrity": "sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==", "dev": true, + "license": "MIT", "dependencies": { "diff-sequences": "^29.4.3", "loupe": "^2.3.6", @@ -6522,9 +5480,8 @@ }, "node_modules/@vitest/utils/node_modules/diff-sequences": { "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true, + "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } @@ -6567,9 +5524,8 @@ }, "node_modules/abortcontroller-polyfill": { "version": "1.7.5", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", - "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/acorn": { "version": "8.10.0", @@ -6631,9 +5587,8 @@ }, "node_modules/aggregate-error": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", "dev": true, + "license": "MIT", "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" @@ -6663,15 +5618,13 @@ }, "node_modules/amp": { "version": "0.3.1", - "resolved": "https://registry.npmjs.org/amp/-/amp-0.3.1.tgz", - "integrity": "sha512-OwIuC4yZaRogHKiuU5WlMR5Xk/jAcpPtawWL05Gj8Lvm2F6mwoJt4O/bHI+DHwG79vWd+8OFYM4/BzYqyRd3qw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/amp-message": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/amp-message/-/amp-message-0.1.2.tgz", - "integrity": "sha512-JqutcFwoU1+jhv7ArgW38bqrE+LQdcRv4NxNw0mp0JHQyB6tXesWRjtYKlDgHRY2o3JE5UTaBGUK8kSWUdxWUg==", "dev": true, + "license": "MIT", "dependencies": { "amp": "0.3.1" } @@ -6686,9 +5639,8 @@ }, "node_modules/ansi-colors": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -6733,9 +5685,8 @@ }, "node_modules/ansicolors": { "version": "0.3.2", - "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", - "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/anymatch": { "version": "3.1.2", @@ -6751,8 +5702,6 @@ }, "node_modules/arch": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", - "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", "dev": true, "funding": [ { @@ -6767,7 +5716,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/are-docs-informative": { "version": "0.0.2", @@ -6891,18 +5841,16 @@ }, "node_modules/assert-plus": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8" } }, "node_modules/assertion-error": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -6920,22 +5868,21 @@ }, "node_modules/astral-regex": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/async": { "version": "3.2.4", + "dev": true, "license": "MIT" }, "node_modules/async-listener": { "version": "0.6.10", - "resolved": "https://registry.npmjs.org/async-listener/-/async-listener-0.6.10.tgz", - "integrity": "sha512-gpuo6xOyF4D5DE5WvyqZdPA3NGhiT6Qf07l7DCB0wwDEsLvDIbCr6j9S5aj5Ch96dLace5tXVzWBZkxU/c5ohw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "semver": "^5.3.0", "shimmer": "^1.1.0" @@ -6946,9 +5893,8 @@ }, "node_modules/async-listener/node_modules/semver": { "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } @@ -6968,9 +5914,8 @@ }, "node_modules/at-least-node": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "dev": true, + "license": "ISC", "engines": { "node": ">= 4.0.0" } @@ -6988,24 +5933,21 @@ }, "node_modules/aws-sign2": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "*" } }, "node_modules/aws4": { "version": "1.12.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", - "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/axios": { "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "dev": true, + "license": "MIT", "dependencies": { "follow-redirects": "^1.14.0" } @@ -7182,8 +6124,7 @@ }, "node_modules/base-x": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + "license": "MIT" }, "node_modules/base64-arraybuffer": { "version": "0.2.0", @@ -7235,9 +6176,8 @@ }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "tweetnacl": "^0.14.3" } @@ -7272,17 +6212,15 @@ }, "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==", "dev": true, + "license": "MIT", "dependencies": { "file-uri-to-path": "1.0.0" } }, "node_modules/bip39": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", - "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", + "license": "ISC", "dependencies": { "@noble/hashes": "^1.2.0" } @@ -7299,9 +6237,8 @@ }, "node_modules/blessed": { "version": "0.1.81", - "resolved": "https://registry.npmjs.org/blessed/-/blessed-0.1.81.tgz", - "integrity": "sha512-LoF5gae+hlmfORcG1M5+5XZi4LBmvlXTzwJWzUlPryN/SJdSflZvROM2TwkT0GMpq7oqT48NRd4GS7BiVBc5OQ==", "dev": true, + "license": "MIT", "bin": { "blessed": "bin/tput.js" }, @@ -7311,15 +6248,13 @@ }, "node_modules/blob-util": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz", - "integrity": "sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/bluebird": { "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/bn.js": { "version": "4.12.0", @@ -7327,15 +6262,13 @@ }, "node_modules/bodec": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bodec/-/bodec-0.1.0.tgz", - "integrity": "sha512-Ylo+MAo5BDUq1KA3f3R/MFhh+g8cnHmo8bz3YPGhI1znrMaf77ol1sfvYJzsw3nTE+Y2GryfDxBaR+AqpAkEHQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/boolbase": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/borc": { "version": "2.1.2", @@ -7571,9 +6504,8 @@ }, "node_modules/bs-logger": { "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", "dev": true, + "license": "MIT", "dependencies": { "fast-json-stable-stringify": "2.x" }, @@ -7583,16 +6515,14 @@ }, "node_modules/bs58": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "license": "MIT", "dependencies": { "base-x": "^4.0.0" } }, "node_modules/bs58check": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz", - "integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==", + "license": "MIT", "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^5.0.0" @@ -7630,9 +6560,8 @@ }, "node_modules/buffer-crc32": { "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -7666,9 +6595,8 @@ }, "node_modules/cac": { "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -7700,9 +6628,8 @@ }, "node_modules/cachedir": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", - "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -7753,9 +6680,8 @@ }, "node_modules/cardinal": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", - "integrity": "sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==", "dev": true, + "license": "MIT", "dependencies": { "ansicolors": "~0.3.2", "redeyed": "~2.1.0" @@ -7766,15 +6692,13 @@ }, "node_modules/caseless": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/chai": { "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", "dev": true, + "license": "MIT", "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.3", @@ -7816,24 +6740,21 @@ }, "node_modules/charenc": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": "*" } }, "node_modules/charm": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/charm/-/charm-0.1.2.tgz", - "integrity": "sha512-syedaZ9cPe7r3hoQA9twWYKu5AIyCswN5+szkmPBe9ccdLrj4bYaCnLVPTLd2kgVRc7+zoX4tyPgRnFKCj5YjQ==", - "dev": true + "dev": true, + "license": "MIT/X11" }, "node_modules/check-error": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, + "license": "MIT", "dependencies": { "get-func-name": "^2.0.2" }, @@ -7843,9 +6764,8 @@ }, "node_modules/check-more-types": { "version": "2.24.0", - "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", - "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } @@ -7889,9 +6809,8 @@ }, "node_modules/chrome-trace-event": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", - "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0" } @@ -7903,8 +6822,7 @@ }, "node_modules/cipher-base": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "license": "MIT", "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -7917,9 +6835,8 @@ }, "node_modules/clean-stack": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -7937,9 +6854,8 @@ }, "node_modules/cli-color": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz", - "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.61", @@ -7975,9 +6891,8 @@ }, "node_modules/cli-table3": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", "dev": true, + "license": "MIT", "dependencies": { "string-width": "^4.2.0" }, @@ -7990,8 +6905,6 @@ }, "node_modules/cli-tableau": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/cli-tableau/-/cli-tableau-2.0.1.tgz", - "integrity": "sha512-he+WTicka9cl0Fg/y+YyxcN6/bfQ/1O3QmgxRXDhABKqLzvoOSM4fMzp39uMyLBulAFuywD2N7UaoQE7WaADxQ==", "dev": true, "dependencies": { "chalk": "3.0.0" @@ -8002,9 +6915,8 @@ }, "node_modules/cli-tableau/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -8017,9 +6929,8 @@ }, "node_modules/cli-tableau/node_modules/chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8030,9 +6941,8 @@ }, "node_modules/cli-tableau/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -8042,24 +6952,21 @@ }, "node_modules/cli-tableau/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cli-tableau/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/cli-tableau/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8069,9 +6976,8 @@ }, "node_modules/cli-truncate": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", "dev": true, + "license": "MIT", "dependencies": { "slice-ansi": "^3.0.0", "string-width": "^4.2.0" @@ -8106,18 +7012,16 @@ }, "node_modules/clone": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8" } }, "node_modules/co": { "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", "dev": true, + "license": "MIT", "engines": { "iojs": ">= 1.0.0", "node": ">= 0.12.0" @@ -8143,12 +7047,12 @@ }, "node_modules/colorette": { "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/colors": { "version": "1.0.3", + "dev": true, "license": "MIT", "engines": { "node": ">=0.1.90" @@ -8171,18 +7075,16 @@ }, "node_modules/comment-parser": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", - "integrity": "sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12.0.0" } }, "node_modules/common-tags": { "version": "1.8.2", - "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", - "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", "dev": true, + "license": "MIT", "engines": { "node": ">=4.0.0" } @@ -8194,9 +7096,8 @@ }, "node_modules/concurrently": { "version": "7.6.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.6.0.tgz", - "integrity": "sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "date-fns": "^2.29.1", @@ -8221,9 +7122,8 @@ }, "node_modules/concurrently/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -8236,9 +7136,8 @@ }, "node_modules/concurrently/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8252,9 +7151,8 @@ }, "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8264,9 +7162,8 @@ }, "node_modules/concurrently/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -8276,24 +7173,21 @@ }, "node_modules/concurrently/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/concurrently/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/concurrently/node_modules/supports-color": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8344,9 +7238,8 @@ }, "node_modules/continuation-local-storage": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz", - "integrity": "sha512-jx44cconVqkCEEyLSKWwkvUXwO561jXMa3LPjTPsm5QR22PA0/mhe33FT4Xb5y74JDvt/Cq+5lm8S8rskLv9ZA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "async-listener": "^0.6.0", "emitter-listener": "^1.1.1" @@ -8362,15 +7255,13 @@ }, "node_modules/core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cosmiconfig": { "version": "8.3.6", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", - "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", "dev": true, + "license": "MIT", "dependencies": { "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", @@ -8394,8 +7285,7 @@ }, "node_modules/create-hash": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "license": "MIT", "dependencies": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", @@ -8511,9 +7401,8 @@ }, "node_modules/croner": { "version": "4.1.97", - "resolved": "https://registry.npmjs.org/croner/-/croner-4.1.97.tgz", - "integrity": "sha512-/f6gpQuxDaqXu+1kwQYSckUglPaOrHdbIlBAu0YuW8/Cdb45XwXYNUBXg3r/9Mo6n540Kn/smKcZWko5x99KrQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { "version": "7.0.3", @@ -8530,9 +7419,8 @@ }, "node_modules/crypt": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": "*" } @@ -8564,9 +7452,8 @@ }, "node_modules/css-select": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "dependencies": { @@ -8582,9 +7469,8 @@ }, "node_modules/css-select/node_modules/dom-serializer": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8598,9 +7484,8 @@ }, "node_modules/css-select/node_modules/domhandler": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "dependencies": { @@ -8615,9 +7500,8 @@ }, "node_modules/css-select/node_modules/domutils": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", - "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "dependencies": { @@ -8631,9 +7515,8 @@ }, "node_modules/css-select/node_modules/entities": { "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "peer": true, "engines": { @@ -8645,9 +7528,8 @@ }, "node_modules/css-tree": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", - "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8660,9 +7542,8 @@ }, "node_modules/css-what": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", - "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">= 6" }, @@ -8672,9 +7553,8 @@ }, "node_modules/csso": { "version": "5.0.5", - "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", - "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8687,9 +7567,8 @@ }, "node_modules/csso/node_modules/css-tree": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", - "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { @@ -8703,9 +7582,8 @@ }, "node_modules/csso/node_modules/mdn-data": { "version": "2.0.28", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", - "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", "dev": true, + "license": "CC0-1.0", "optional": true, "peer": true }, @@ -8732,22 +7610,21 @@ }, "node_modules/culvert": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/culvert/-/culvert-0.1.2.tgz", - "integrity": "sha512-yi1x3EAWKjQTreYWeSd98431AV+IEE0qoDyOoaHJ7KJ21gv6HtBXHVLX74opVSGqcR8/AbjJBHAHpcOy2bj5Gg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cycle": { "version": "1.0.3", + "dev": true, "engines": { "node": ">=0.4.0" } }, "node_modules/cypress": { "version": "13.5.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.5.0.tgz", - "integrity": "sha512-oh6U7h9w8wwHfzNDJQ6wVcAeXu31DlIYlNOBvfd6U4CcB8oe4akawQmH+QJVOMZlM42eBoCne015+svVqdwdRQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", @@ -8802,18 +7679,16 @@ }, "node_modules/cypress/node_modules/@types/node": { "version": "18.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/cypress/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -8826,8 +7701,6 @@ }, "node_modules/cypress/node_modules/buffer": { "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "dev": true, "funding": [ { @@ -8843,6 +7716,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -8850,9 +7724,8 @@ }, "node_modules/cypress/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8866,9 +7739,8 @@ }, "node_modules/cypress/node_modules/chalk/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -8878,9 +7750,8 @@ }, "node_modules/cypress/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -8890,24 +7761,21 @@ }, "node_modules/cypress/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cypress/node_modules/commander": { "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 6" } }, "node_modules/cypress/node_modules/execa": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", "dev": true, + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", @@ -8928,9 +7796,8 @@ }, "node_modules/cypress/node_modules/fs-extra": { "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, + "license": "MIT", "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", @@ -8943,9 +7810,8 @@ }, "node_modules/cypress/node_modules/get-stream": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, + "license": "MIT", "dependencies": { "pump": "^3.0.0" }, @@ -8958,27 +7824,24 @@ }, "node_modules/cypress/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/cypress/node_modules/human-signals": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=8.12.0" } }, "node_modules/cypress/node_modules/jsonfile": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, + "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -8988,15 +7851,13 @@ }, "node_modules/cypress/node_modules/proxy-from-env": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", - "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cypress/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -9009,9 +7870,8 @@ }, "node_modules/cypress/node_modules/supports-color": { "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -9024,18 +7884,16 @@ }, "node_modules/cypress/node_modules/universalify": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10.0.0" } }, "node_modules/d": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", "dev": true, + "license": "ISC", "dependencies": { "es5-ext": "^0.10.50", "type": "^1.0.1" @@ -9043,9 +7901,8 @@ }, "node_modules/dashdash": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, + "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" }, @@ -9088,9 +7945,8 @@ }, "node_modules/date-fns": { "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.21.0" }, @@ -9104,16 +7960,14 @@ }, "node_modules/dayjs": { "version": "1.11.10", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", - "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/deasync": { "version": "0.1.29", - "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.29.tgz", - "integrity": "sha512-EBtfUhVX23CE9GR6m+F8WPeImEE4hR/FW9RkK0PMl9V1t283s0elqsTD8EZjaKX28SY1BW2rYfCgNsAYdpamUw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "bindings": "^1.5.0", "node-addon-api": "^1.7.1" @@ -9124,9 +7978,8 @@ }, "node_modules/deasync/node_modules/node-addon-api": { "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/debug": { "version": "4.3.4", @@ -9176,9 +8029,8 @@ }, "node_modules/dedent": { "version": "1.5.1", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", - "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", "dev": true, + "license": "MIT", "peerDependencies": { "babel-plugin-macros": "^3.1.0" }, @@ -9190,9 +8042,8 @@ }, "node_modules/deep-eql": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, + "license": "MIT", "dependencies": { "type-detect": "^4.0.0" }, @@ -9215,9 +8066,8 @@ }, "node_modules/deepmerge": { "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -9398,9 +8248,8 @@ }, "node_modules/define-lazy-prop": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -9456,9 +8305,8 @@ }, "node_modules/detect-libc": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", "dev": true, + "license": "Apache-2.0", "bin": { "detect-libc": "bin/detect-libc.js" }, @@ -9514,9 +8362,8 @@ }, "node_modules/dom-serializer": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", - "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", "dev": true, + "license": "MIT", "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.2.0", @@ -9528,24 +8375,22 @@ }, "node_modules/dom-serializer/node_modules/entities": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", "dev": true, + "license": "BSD-2-Clause", "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } }, "node_modules/domelementtype": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/fb55" } - ] + ], + "license": "BSD-2-Clause" }, "node_modules/domexception": { "version": "4.0.0", @@ -9560,9 +8405,8 @@ }, "node_modules/domhandler": { "version": "4.3.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", - "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "domelementtype": "^2.2.0" }, @@ -9575,9 +8419,8 @@ }, "node_modules/domutils": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "dom-serializer": "^1.0.1", "domelementtype": "^2.2.0", @@ -9603,18 +8446,16 @@ }, "node_modules/dotenv": { "version": "7.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-7.0.0.tgz", - "integrity": "sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=6" } }, "node_modules/dotenv-expand": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", - "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/eastasianwidth": { "version": "0.2.0", @@ -9623,9 +8464,8 @@ }, "node_modules/ecc-jsbn": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, + "license": "MIT", "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -9655,9 +8495,8 @@ }, "node_modules/emitter-listener": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/emitter-listener/-/emitter-listener-1.1.2.tgz", - "integrity": "sha512-Bt1sBAGFHY9DKY+4/2cV6izcKJUf5T7/gkdmkxzX/qv9CcGH8xSwVRW5mtX03SWJtRTWSOpzCuWN9rBFYZepZQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "shimmer": "^1.2.0" } @@ -9688,9 +8527,8 @@ }, "node_modules/enquirer": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", - "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" @@ -9701,9 +8539,8 @@ }, "node_modules/entities": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.12" }, @@ -9831,10 +8668,9 @@ }, "node_modules/es5-ext": { "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", "dev": true, "hasInstallScript": true, + "license": "ISC", "dependencies": { "es6-iterator": "^2.0.3", "es6-symbol": "^3.1.3", @@ -9846,9 +8682,8 @@ }, "node_modules/es6-iterator": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "^0.10.35", @@ -9857,9 +8692,8 @@ }, "node_modules/es6-map": { "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha512-mz3UqCh0uPCIqsw1SSAkB/p0rOzF/M0V++vyN7JqlPtSW/VsYgQBvVvqMLmfBuyMzTpLnNqi6JmcSizs4jy19A==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "~0.10.14", @@ -9871,9 +8705,8 @@ }, "node_modules/es6-set": { "version": "0.1.6", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.6.tgz", - "integrity": "sha512-TE3LgGLDIBX332jq3ypv6bcOpkLO0AslAQo7p2VqX/1N46YNsvIWgvjojjSEnWEGWMhr1qUbYeTSir5J6mFHOw==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.62", @@ -9888,15 +8721,13 @@ }, "node_modules/es6-set/node_modules/type": { "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/es6-symbol": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "ext": "^1.1.2" @@ -9904,9 +8735,8 @@ }, "node_modules/es6-weak-map": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", "dev": true, + "license": "ISC", "dependencies": { "d": "1", "es5-ext": "^0.10.46", @@ -9950,405 +8780,371 @@ "esbuild-windows-arm64": "0.15.16" } }, - "node_modules/esbuild-android-64": { + "node_modules/esbuild-darwin-arm64": { "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.16.tgz", - "integrity": "sha512-Vwkv/sT0zMSgPSVO3Jlt1pUbnZuOgtOQJkJkyyJFAlLe7BiT8e9ESzo0zQSx4c3wW4T6kGChmKDPMbWTgtliQA==", "cpu": [ - "x64" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "darwin" ], "engines": { "node": ">=12" } }, - "node_modules/esbuild-android-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.16.tgz", - "integrity": "sha512-lqfKuofMExL5niNV3gnhMUYacSXfsvzTa/58sDlBET/hCOG99Zmeh+lz6kvdgvGOsImeo6J9SW21rFCogNPLxg==", - "cpu": [ - "arm64" - ], + "node_modules/escalade": { + "version": "3.1.1", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6" } }, - "node_modules/esbuild-darwin-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.16.tgz", - "integrity": "sha512-wo2VWk/n/9V2TmqUZ/KpzRjCEcr00n7yahEdmtzlrfQ3lfMCf3Wa+0sqHAbjk3C6CKkR3WKK/whkMq5Gj4Da9g==", - "cpu": [ - "x64" - ], + "node_modules/escape-goat": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-darwin-arm64": { - "version": "0.15.16", - "cpu": [ - "arm64" - ], + "node_modules/escape-string-regexp": { + "version": "1.0.5", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], "engines": { - "node": ">=12" + "node": ">=0.8.0" } }, - "node_modules/esbuild-freebsd-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.16.tgz", - "integrity": "sha512-UzIc0xlRx5x9kRuMr+E3+hlSOxa/aRqfuMfiYBXu2jJ8Mzej4lGL7+o6F5hzhLqWfWm1GWHNakIdlqg1ayaTNQ==", - "cpu": [ - "x64" - ], + "node_modules/escodegen": { + "version": "2.1.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, "engines": { - "node": ">=12" + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" } }, - "node_modules/esbuild-freebsd-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.16.tgz", - "integrity": "sha512-8xyiYuGc0DLZphFQIiYaLHlfoP+hAN9RHbE+Ibh8EUcDNHAqbQgUrQg7pE7Bo00rXmQ5Ap6KFgcR0b4ALZls1g==", - "cpu": [ - "arm64" - ], + "node_modules/escodegen/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "BSD-2-Clause", "engines": { - "node": ">=12" + "node": ">=4.0" } }, - "node_modules/esbuild-linux-32": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.16.tgz", - "integrity": "sha512-iGijUTV+0kIMyUVoynK0v+32Oi8yyp0xwMzX69GX+5+AniNy/C/AL1MjFTsozRp/3xQPl7jVux/PLe2ds10/2w==", - "cpu": [ - "ia32" - ], + "node_modules/escope": { + "version": "3.6.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-2-Clause", + "dependencies": { + "es6-map": "^0.1.3", + "es6-weak-map": "^2.0.1", + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, "engines": { - "node": ">=12" + "node": ">=0.4.0" } }, - "node_modules/esbuild-linux-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.16.tgz", - "integrity": "sha512-tuSOjXdLw7VzaUj89fIdAaQT7zFGbKBcz4YxbWrOiXkwscYgE7HtTxUavreBbnRkGxKwr9iT/gmeJWNm4djy/g==", - "cpu": [ - "x64" - ], + "node_modules/eslint": { + "version": "8.53.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.53.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/esbuild-linux-arm": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.16.tgz", - "integrity": "sha512-XKcrxCEXDTOuoRj5l12tJnkvuxXBMKwEC5j0JISw3ziLf0j4zIwXbKbTmUrKFWbo6ZgvNpa7Y5dnbsjVvH39bQ==", - "cpu": [ - "arm" - ], + "node_modules/eslint-plugin-cypress": { + "version": "2.15.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "globals": "^13.20.0" + }, + "peerDependencies": { + "eslint": ">= 3.2.1" } }, - "node_modules/esbuild-linux-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.16.tgz", - "integrity": "sha512-mPYksnfHnemNrvjrDhZyixL/AfbJN0Xn9S34ZOHYdh6/jJcNd8iTsv3JwJoEvTJqjMggjMhGUPJAdjnFBHoH8A==", - "cpu": [ - "arm64" - ], + "node_modules/eslint-plugin-cypress/node_modules/globals": { + "version": "13.23.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-linux-mips64le": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.16.tgz", - "integrity": "sha512-kSJO2PXaxfm0pWY39+YX+QtpFqyyrcp0ZeI8QPTrcFVQoWEPiPVtOfTZeS3ZKedfH+Ga38c4DSzmKMQJocQv6A==", - "cpu": [ - "mips64el" - ], + "node_modules/eslint-plugin-cypress/node_modules/type-fest": { + "version": "0.20.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-linux-ppc64le": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.16.tgz", - "integrity": "sha512-NimPikwkBY0yGABw6SlhKrtT35sU4O23xkhlrTT/O6lSxv3Pm5iSc6OYaqVAHWkLdVf31bF4UDVFO+D990WpAA==", - "cpu": [ - "ppc64" - ], + "node_modules/eslint-plugin-jsdoc": { + "version": "46.8.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-3-Clause", + "dependencies": { + "@es-joy/jsdoccomment": "~0.40.1", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.0", + "debug": "^4.3.4", + "escape-string-regexp": "^4.0.0", + "esquery": "^1.5.0", + "is-builtin-module": "^3.2.1", + "semver": "^7.5.4", + "spdx-expression-parse": "^3.0.1" + }, "engines": { - "node": ">=12" + "node": ">=16" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" } }, - "node_modules/esbuild-linux-riscv64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.16.tgz", - "integrity": "sha512-ty2YUHZlwFOwp7pR+J87M4CVrXJIf5ZZtU/umpxgVJBXvWjhziSLEQxvl30SYfUPq0nzeWKBGw5i/DieiHeKfw==", - "cpu": [ - "riscv64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/@es-joy/jsdoccomment": { + "version": "0.40.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "comment-parser": "1.4.0", + "esquery": "^1.5.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, "engines": { - "node": ">=12" + "node": ">=16" } }, - "node_modules/esbuild-linux-s390x": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.16.tgz", - "integrity": "sha512-VkZaGssvPDQtx4fvVdZ9czezmyWyzpQhEbSNsHZZN0BHvxRLOYAQ7sjay8nMQwYswP6O2KlZluRMNPYefFRs+w==", - "cpu": [ - "s390x" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/comment-parser": { + "version": "1.4.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 12.0.0" } }, - "node_modules/esbuild-netbsd-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.16.tgz", - "integrity": "sha512-ElQ9rhdY51et6MJTWrCPbqOd/YuPowD7Cxx3ee8wlmXQQVW7UvQI6nSprJ9uVFQISqSF5e5EWpwWqXZsECLvXg==", - "cpu": [ - "x64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esbuild-openbsd-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.16.tgz", - "integrity": "sha512-KgxMHyxMCT+NdLQE1zVJEsLSt2QQBAvJfmUGDmgEq8Fvjrf6vSKB00dVHUEDKcJwMID6CdgCpvYNt999tIYhqA==", - "cpu": [ - "x64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=12.0.0" } }, - "node_modules/esbuild-sunos-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.16.tgz", - "integrity": "sha512-exSAx8Phj7QylXHlMfIyEfNrmqnLxFqLxdQF6MBHPdHAjT7fsKaX6XIJn+aQEFiOcE4X8e7VvdMCJ+WDZxjSRQ==", - "cpu": [ - "x64" - ], + "node_modules/eslint-plugin-jsdoc/node_modules/semver": { + "version": "7.5.4", "dev": true, - "optional": true, - "os": [ - "sunos" - ], + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, "engines": { - "node": ">=12" + "node": ">=10" } }, - "node_modules/esbuild-windows-32": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.16.tgz", - "integrity": "sha512-zQgWpY5pUCSTOwqKQ6/vOCJfRssTvxFuEkpB4f2VUGPBpdddZfdj8hbZuFRdZRPIVHvN7juGcpgCA/XCF37mAQ==", - "cpu": [ - "ia32" - ], + "node_modules/eslint-plugin-prettier": { + "version": "4.2.1", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">=12.0.0" + }, + "peerDependencies": { + "eslint": ">=7.28.0", + "prettier": ">=2.0.0" + }, + "peerDependenciesMeta": { + "eslint-config-prettier": { + "optional": true + } } }, - "node_modules/esbuild-windows-64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.16.tgz", - "integrity": "sha512-HjW1hHRLSncnM3MBCP7iquatHVJq9l0S2xxsHHj4yzf4nm9TU4Z7k4NkeMlD/dHQ4jPlQQhwcMvwbJiOefSuZw==", - "cpu": [ - "x64" - ], + "node_modules/eslint-scope": { + "version": "5.1.1", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, "engines": { - "node": ">=12" + "node": ">=8.0.0" } }, - "node_modules/esbuild-windows-arm64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.16.tgz", - "integrity": "sha512-oCcUKrJaMn04Vxy9Ekd8x23O8LoU01+4NOkQ2iBToKgnGj5eo1vU9i27NQZ9qC8NFZgnQQZg5oZWAejmbsppNA==", - "cpu": [ - "arm64" - ], + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/esbuild/node_modules/@esbuild/android-arm": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.16.tgz", - "integrity": "sha512-nyB6CH++2mSgx3GbnrJsZSxzne5K0HMyNIWafDHqYy7IwxFc4fd/CgHVZXr8Eh+Q3KbIAcAe3vGyqIPhGblvMQ==", - "cpu": [ - "arm" - ], + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/esbuild/node_modules/@esbuild/linux-loong64": { - "version": "0.15.16", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.16.tgz", - "integrity": "sha512-SDLfP1uoB0HZ14CdVYgagllgrG7Mdxhkt4jDJOKl/MldKrkQ6vDJMZKl2+5XsEY/Lzz37fjgLQoJBGuAw/x8kQ==", - "cpu": [ - "loong64" - ], + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/escalade": { - "version": "3.1.1", + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">=6" + "node": ">=7.0.0" } }, - "node_modules/escape-goat": { + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=12" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "2.1.0", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">=6.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, - "optionalDependencies": { - "source-map": "~0.6.1" + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/escodegen/node_modules/estraverse": { + "node_modules/eslint/node_modules/estraverse": { "version": "5.3.0", "dev": true, "license": "BSD-2-Clause", @@ -10356,232 +9152,202 @@ "node": ">=4.0" } }, - "node_modules/escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha512-75IUQsusDdalQEW/G/2esa87J7raqdJF+Ca0/Xm5C3Q58Nr4yVYjZGp/P1+2xiEVgXRrA39dpRb8LcshajbqDQ==", + "node_modules/eslint/node_modules/globals": { + "version": "13.23.0", "dev": true, + "license": "MIT", "dependencies": { - "es6-map": "^0.1.3", - "es6-weak-map": "^2.0.1", - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" + "type-fest": "^0.20.2" }, "engines": { - "node": ">=0.4.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint": { - "version": "8.53.0", + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", "dev": true, "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.3", - "@eslint/js": "8.53.0", - "@humanwhocodes/config-array": "^0.11.13", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=8" } }, - "node_modules/eslint-plugin-cypress": { - "version": "2.15.1", + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", "dependencies": { - "globals": "^13.20.0" + "has-flag": "^4.0.0" }, - "peerDependencies": { - "eslint": ">= 3.2.1" + "engines": { + "node": ">=8" } }, - "node_modules/eslint-plugin-cypress/node_modules/globals": { - "version": "13.23.0", + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-cypress/node_modules/type-fest": { - "version": "0.20.2", + "node_modules/espree": { + "version": "9.6.1", "dev": true, - "license": "(MIT OR CC0-1.0)", + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-plugin-jsdoc": { - "version": "46.8.2", + "node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@es-joy/jsdoccomment": "~0.40.1", - "are-docs-informative": "^0.0.2", - "comment-parser": "1.4.0", - "debug": "^4.3.4", - "escape-string-regexp": "^4.0.0", - "esquery": "^1.5.0", - "is-builtin-module": "^3.2.1", - "semver": "^7.5.4", - "spdx-expression-parse": "^3.0.1" + "estraverse": "^5.1.0" }, "engines": { - "node": ">=16" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "node": ">=0.10" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/@es-joy/jsdoccomment": { - "version": "0.40.1", + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "comment-parser": "1.4.0", - "esquery": "^1.5.0", - "jsdoc-type-pratt-parser": "~4.0.0" + "estraverse": "^5.2.0" }, "engines": { - "node": ">=16" + "node": ">=4.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/comment-parser": { - "version": "1.4.0", + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "engines": { - "node": ">= 12.0.0" + "node": ">=4.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { - "version": "4.0.0", + "node_modules/estraverse": { + "version": "4.3.0", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=4.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/jsdoc-type-pratt-parser": { - "version": "4.0.0", + "node_modules/esutils": { + "version": "2.0.3", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "engines": { - "node": ">=12.0.0" + "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/semver": { - "version": "7.5.4", + "node_modules/event-emitter": { + "version": "0.3.5", "dev": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" + "d": "1", + "es5-ext": "~0.10.14" } }, - "node_modules/eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "node_modules/eventemitter2": { + "version": "6.4.7", + "dev": true, + "license": "MIT" + }, + "node_modules/execa": { + "version": "5.1.1", "dev": true, + "license": "MIT", "dependencies": { - "prettier-linter-helpers": "^1.0.0" + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" }, "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "eslint": ">=7.28.0", - "prettier": ">=2.0.0" + "node": ">=10" }, - "peerDependenciesMeta": { - "eslint-config-prettier": { - "optional": true - } + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", + "node_modules/executable": { + "version": "4.1.1", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "pify": "^2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=4" } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", + "node_modules/exit": { + "version": "0.1.2", "dev": true, - "license": "Apache-2.0", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" }, - "funding": { - "url": "https://opencollective.com/eslint" + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/eslint/node_modules/ansi-styles": { + "node_modules/expect/node_modules/ansi-styles": { "version": "4.3.0", "dev": true, "license": "MIT", @@ -10595,7 +9361,7 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/eslint/node_modules/chalk": { + "node_modules/expect/node_modules/chalk": { "version": "4.1.2", "dev": true, "license": "MIT", @@ -10610,7 +9376,7 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/eslint/node_modules/color-convert": { + "node_modules/expect/node_modules/color-convert": { "version": "2.0.1", "dev": true, "license": "MIT", @@ -10621,496 +9387,212 @@ "node": ">=7.0.0" } }, - "node_modules/eslint/node_modules/color-name": { + "node_modules/expect/node_modules/color-name": { "version": "1.1.4", "dev": true, "license": "MIT" }, - "node_modules/eslint/node_modules/escape-string-regexp": { + "node_modules/expect/node_modules/has-flag": { "version": "4.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", + "node_modules/expect/node_modules/jest-util": { + "version": "29.7.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", "engines": { - "node": ">=4.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/eslint/node_modules/globals": { - "version": "13.23.0", + "node_modules/expect/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", "dependencies": { - "type-fest": "^0.20.2" + "has-flag": "^4.0.0" }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", + "node_modules/ext": { + "version": "1.7.0", "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" + "license": "ISC", + "dependencies": { + "type": "^2.7.2" } }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", + "node_modules/ext/node_modules/type": { + "version": "2.7.2", "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } + "license": "ISC" }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", + "node_modules/extend": { + "version": "3.0.2", "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, - "node_modules/espree": { - "version": "9.6.1", + "node_modules/external-editor": { + "version": "3.1.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=4" } }, - "node_modules/esprima": { - "version": "4.0.1", + "node_modules/external-editor/node_modules/iconv-lite": { + "version": "0.4.24", "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { - "node": ">=4" + "node": ">=0.10.0" } }, - "node_modules/esquery": { - "version": "1.5.0", + "node_modules/external-editor/node_modules/tmp": { + "version": "0.0.33", "dev": true, - "license": "BSD-3-Clause", + "license": "MIT", "dependencies": { - "estraverse": "^5.1.0" + "os-tmpdir": "~1.0.2" }, "engines": { - "node": ">=0.10" + "node": ">=0.6.0" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", + "node_modules/extract-zip": { + "version": "2.0.1", "dev": true, "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, "engines": { - "node": ">=4.0" + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" } }, - "node_modules/esrecurse": { - "version": "4.3.0", + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "estraverse": "^5.2.0" + "pump": "^3.0.0" }, "engines": { - "node": ">=4.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", + "node_modules/extsprintf": { + "version": "1.3.0", "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" }, - "node_modules/estraverse": { - "version": "4.3.0", + "node_modules/eyes": { + "version": "0.1.8", "dev": true, - "license": "BSD-2-Clause", "engines": { - "node": ">=4.0" + "node": "> 0.1.90" } }, - "node_modules/esutils": { - "version": "2.0.3", + "node_modules/fake-indexeddb": { + "version": "4.0.0", "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" + "license": "Apache-2.0", + "dependencies": { + "realistic-structured-clone": "^3.0.0" } }, - "node_modules/event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", + "node_modules/fast-deep-equal": { + "version": "3.1.3", "dev": true, - "dependencies": { - "d": "1", - "es5-ext": "~0.10.14" - } + "license": "MIT" }, - "node_modules/eventemitter2": { - "version": "6.4.7", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", - "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==", - "dev": true + "node_modules/fast-diff": { + "version": "1.3.0", + "dev": true, + "license": "Apache-2.0" }, - "node_modules/execa": { - "version": "5.1.1", + "node_modules/fast-glob": { + "version": "3.3.1", "dev": true, "license": "MIT", "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" + "node": ">=8.6.0" } }, - "node_modules/executable": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", - "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", "dev": true, + "license": "ISC", "dependencies": { - "pify": "^2.2.0" + "is-glob": "^4.0.1" }, "engines": { - "node": ">=4" + "node": ">= 6" } }, - "node_modules/exit": { - "version": "0.1.2", + "node_modules/fast-json-patch": { + "version": "3.1.1", "dev": true, - "engines": { - "node": ">= 0.8.0" - } + "license": "MIT" }, - "node_modules/expect": { - "version": "29.7.0", + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", "dev": true, - "license": "MIT", + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.13.0", + "dev": true, + "license": "ISC", "dependencies": { - "@jest/expect-utils": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/expect/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/expect/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/expect/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/expect/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/expect/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/expect/node_modules/jest-util": { - "version": "29.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/expect/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dev": true, - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", - "dev": true - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "node_modules/external-editor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/external-editor/node_modules/iconv-lite": { - "version": "0.4.24", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/external-editor/node_modules/tmp": { - "version": "0.0.33", - "dev": true, - "license": "MIT", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/extract-zip/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "dev": true, - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/eyes": { - "version": "0.1.8", - "engines": { - "node": "> 0.1.90" - } - }, - "node_modules/fake-indexeddb": { - "version": "4.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "realistic-structured-clone": "^3.0.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fast-json-patch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", - "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/fastq": { - "version": "1.13.0", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" + "reusify": "^1.0.4" } }, "node_modules/fb-watchman": { @@ -11123,15 +9605,13 @@ }, "node_modules/fclone": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz", - "integrity": "sha512-GDqVQezKzRABdeqflsgMr7ktzgF9CyS+p2oe0jJqUY6izSSbhPIQJDpoU4PtGcD7VPM9xh/dVrTu6z1nwgmEGw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fd-slicer": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, + "license": "MIT", "dependencies": { "pend": "~1.2.0" } @@ -11160,9 +9640,8 @@ }, "node_modules/figures": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, + "license": "MIT", "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -11186,9 +9665,8 @@ }, "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==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fill-range": { "version": "7.0.1", @@ -11235,8 +9713,6 @@ }, "node_modules/follow-redirects": { "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true, "funding": [ { @@ -11244,6 +9720,7 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], + "license": "MIT", "engines": { "node": ">=4.0" }, @@ -11263,9 +9740,8 @@ }, "node_modules/forever-agent": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "*" } @@ -11396,9 +9872,8 @@ }, "node_modules/get-func-name": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -11427,9 +9902,8 @@ }, "node_modules/get-port": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-4.2.0.tgz", - "integrity": "sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -11476,33 +9950,29 @@ }, "node_modules/getos": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", - "integrity": "sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==", "dev": true, + "license": "MIT", "dependencies": { "async": "^3.2.0" } }, "node_modules/getpass": { "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, + "license": "MIT", "dependencies": { "assert-plus": "^1.0.0" } }, "node_modules/git-node-fs": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/git-node-fs/-/git-node-fs-1.0.0.tgz", - "integrity": "sha512-bLQypt14llVXBg0S0u8q8HmU7g9p3ysH+NvVlae5vILuUvs759665HvmR5+wb04KjHyjFcDRxdYb4kyNnluMUQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/git-sha1": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/git-sha1/-/git-sha1-0.1.2.tgz", - "integrity": "sha512-2e/nZezdVlyCopOCYHeW0onkbZg7xP1Ad6pndPy1rCygeRykefUS6r7oA5cJRGEFvseiaz5a/qUHFVX1dd6Isg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/git-up": { "version": "7.0.0", @@ -11661,9 +10131,8 @@ }, "node_modules/graphene-pk11": { "version": "2.3.2", - "resolved": "https://registry.npmjs.org/graphene-pk11/-/graphene-pk11-2.3.2.tgz", - "integrity": "sha512-fhRM7BF3MYAL6A6xgCLki/CHKfZpO8gRFpddQc/hqdPow6dymVBmgdKK23OE0HbG3LhB2yz8O+GkL2EejqXW7g==", "dev": true, + "license": "MIT", "dependencies": { "pkcs11js": "^1.3.0", "tslib": "^2.4.0" @@ -11763,8 +10232,7 @@ }, "node_modules/hash-base": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "license": "MIT", "dependencies": { "inherits": "^2.0.4", "readable-stream": "^3.6.0", @@ -11776,8 +10244,6 @@ }, "node_modules/hash-base/node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "funding": [ { "type": "github", @@ -11791,7 +10257,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/hash.js": { "version": "1.1.7", @@ -11814,8 +10281,7 @@ }, "node_modules/hdkey": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hdkey/-/hdkey-2.1.0.tgz", - "integrity": "sha512-i9Wzi0Dy49bNS4tXXeGeu0vIcn86xXdPQUpEYg+SO1YiO8HtomjmmRMaRyqL0r59QfcD4PfVbSF3qmsWFwAemA==", + "license": "MIT", "dependencies": { "bs58check": "^2.1.2", "ripemd160": "^2.0.2", @@ -11825,24 +10291,21 @@ }, "node_modules/hdkey/node_modules/base-x": { "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "license": "MIT", "dependencies": { "safe-buffer": "^5.0.1" } }, "node_modules/hdkey/node_modules/bs58": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", "dependencies": { "base-x": "^3.0.2" } }, "node_modules/hdkey/node_modules/bs58check": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "license": "MIT", "dependencies": { "bs58": "^4.0.0", "create-hash": "^1.1.0", @@ -11851,14 +10314,12 @@ }, "node_modules/hdkey/node_modules/node-addon-api": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + "license": "MIT" }, "node_modules/hdkey/node_modules/secp256k1": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "elliptic": "^6.5.4", "node-addon-api": "^2.0.0", @@ -11895,9 +10356,8 @@ }, "node_modules/htmlnano": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/htmlnano/-/htmlnano-2.1.0.tgz", - "integrity": "sha512-jVGRE0Ep9byMBKEu0Vxgl8dhXYOUk0iNQ2pjsG+BcRB0u0oDF5A9p/iBGMg/PGKYUyMD0OAGu8dVT5Lzj8S58g==", "dev": true, + "license": "MIT", "dependencies": { "cosmiconfig": "^8.0.0", "posthtml": "^0.16.5", @@ -11942,8 +10402,6 @@ }, "node_modules/htmlparser2": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", - "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", "dev": true, "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", @@ -11952,6 +10410,7 @@ "url": "https://github.com/sponsors/fb55" } ], + "license": "MIT", "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.2.2", @@ -11979,9 +10438,8 @@ }, "node_modules/http-signature": { "version": "1.3.6", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", - "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, + "license": "MIT", "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^2.0.2", @@ -12136,9 +10594,8 @@ }, "node_modules/indent-string": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -12402,9 +10859,8 @@ }, "node_modules/ipaddr.js": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz", - "integrity": "sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } @@ -12481,9 +10937,8 @@ }, "node_modules/is-buffer": { "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/is-builtin-module": { "version": "3.2.1", @@ -12589,9 +11044,8 @@ }, "node_modules/is-generator-fn": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -12680,9 +11134,8 @@ }, "node_modules/is-json": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-json/-/is-json-2.0.1.tgz", - "integrity": "sha512-6BEnpVn1rcf3ngfmViLM6vjUjGErbdrL4rwlv+u1NO1XO8kqT4YGL8+19Q+Z/bas8tY90BTWMk2+fW1g6hQjbA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/is-map": { "version": "2.0.2", @@ -12759,9 +11212,8 @@ }, "node_modules/is-promise": { "version": "2.2.2", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/is-regex": { "version": "1.1.4", @@ -12927,6 +11379,7 @@ }, "node_modules/isstream": { "version": "0.1.2", + "dev": true, "license": "MIT" }, "node_modules/issue-parser": { @@ -13178,9 +11631,8 @@ }, "node_modules/jest-circus": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", - "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", "dev": true, + "license": "MIT", "dependencies": { "@jest/environment": "^29.7.0", "@jest/expect": "^29.7.0", @@ -13209,9 +11661,8 @@ }, "node_modules/jest-circus/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -13224,9 +11675,8 @@ }, "node_modules/jest-circus/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -13240,9 +11690,8 @@ }, "node_modules/jest-circus/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -13252,24 +11701,21 @@ }, "node_modules/jest-circus/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jest-circus/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/jest-circus/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -13284,9 +11730,8 @@ }, "node_modules/jest-circus/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -13408,9 +11853,8 @@ }, "node_modules/jest-config": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", - "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", "@jest/test-sequencer": "^29.7.0", @@ -13453,9 +11897,8 @@ }, "node_modules/jest-config/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -13468,9 +11911,8 @@ }, "node_modules/jest-config/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -13484,9 +11926,8 @@ }, "node_modules/jest-config/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -13496,24 +11937,21 @@ }, "node_modules/jest-config/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/jest-config/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -13528,9 +11966,8 @@ }, "node_modules/jest-config/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -13666,9 +12103,8 @@ }, "node_modules/jest-each": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", - "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "chalk": "^4.0.0", @@ -13682,9 +12118,8 @@ }, "node_modules/jest-each/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -13697,9 +12132,8 @@ }, "node_modules/jest-each/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -13713,9 +12147,8 @@ }, "node_modules/jest-each/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -13725,24 +12158,21 @@ }, "node_modules/jest-each/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jest-each/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/jest-each/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -13757,9 +12187,8 @@ }, "node_modules/jest-each/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -15385,9 +13814,8 @@ }, "node_modules/js-git": { "version": "0.7.8", - "resolved": "https://registry.npmjs.org/js-git/-/js-git-0.7.8.tgz", - "integrity": "sha512-+E5ZH/HeRnoc/LW0AmAyhU+mNcWBzAKE+30+IDMLSLbbK+Tdt02AdkOKq9u15rlJsDEGFqtgckc8ZM59LhhiUA==", "dev": true, + "license": "MIT", "dependencies": { "bodec": "^0.1.0", "culvert": "^0.1.2", @@ -15413,15 +13841,13 @@ }, "node_modules/jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jsdoc-type-pratt-parser": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-3.1.0.tgz", - "integrity": "sha512-MgtD0ZiCDk9B+eI73BextfRrVQl0oyzRG8B2BjORts6jbunj4ScKPcyXGTbB6eXL4y9TzxCm6hyeLq/2ASzNdw==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.0.0" } @@ -15494,9 +13920,8 @@ }, "node_modules/json-schema": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true + "dev": true, + "license": "(AFL-2.1 OR BSD-3-Clause)" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -15510,9 +13935,8 @@ }, "node_modules/json-stringify-safe": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/json-text-sequence": { "version": "0.1.1", @@ -15547,12 +13971,11 @@ }, "node_modules/jsprim": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", - "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "engines": [ "node >=0.6.0" ], + "license": "MIT", "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -15592,18 +14015,16 @@ }, "node_modules/lazy": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/lazy/-/lazy-1.0.11.tgz", - "integrity": "sha512-Y+CjUfLmIpoUCCRl0ub4smrYtGGr5AOa2AKOaWelGHOGz33X/Y/KizefGqbkwfz44+cnq/+9habclf8vOmu2LA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.2.0" } }, "node_modules/lazy-ass": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", - "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==", "dev": true, + "license": "MIT", "engines": { "node": "> 0.8" } @@ -15630,9 +14051,8 @@ }, "node_modules/lightningcss": { "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.22.1.tgz", - "integrity": "sha512-Fy45PhibiNXkm0cK5FJCbfO8Y6jUpD/YcHf/BtuI+jvYYqSXKF4muk61jjE8YxCR9y+hDYIWSzHTc+bwhDE6rQ==", "dev": true, + "license": "MPL-2.0", "dependencies": { "detect-libc": "^1.0.3" }, @@ -15657,12 +14077,11 @@ }, "node_modules/lightningcss-darwin-arm64": { "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.22.1.tgz", - "integrity": "sha512-ldvElu+R0QimNTjsKpaZkUv3zf+uefzLy/R1R19jtgOfSRM+zjUCUgDhfEDRmVqJtMwYsdhMI2aJtJChPC6Osg==", "cpu": [ "arm64" ], "dev": true, + "license": "MPL-2.0", "optional": true, "os": [ "darwin" @@ -15676,174 +14095,6 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.22.1.tgz", - "integrity": "sha512-5p2rnlVTv6Gpw4PlTLq925nTVh+HFh4MpegX8dPDYJae+NFVjQ67gY7O6iHIzQjLipDiYejFF0yHrhjU3XgLBQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.22.1.tgz", - "integrity": "sha512-1FaBtcFrZqB2hkFbAxY//Pnp8koThvyB6AhjbdVqKD4/pu13Rl91fKt2N9qyeQPUt3xy7ORUvSO+dPk3J6EjXg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.22.1.tgz", - "integrity": "sha512-6rub98tYGfE5I5j0BP8t/2d4BZyu1S7Iz9vUkm0H26snAFHYxLfj3RbQn0xHHIePSetjLnhcg3QlfwUAkD/FYg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.22.1.tgz", - "integrity": "sha512-nYO5qGtb/1kkTZu3FeTiM+2B2TAb7m2DkLCTgQIs2bk2o9aEs7I96fwySKcoHWQAiQDGR9sMux9vkV4KQXqPaQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.22.1.tgz", - "integrity": "sha512-MCV6RuRpzXbunvzwY644iz8cw4oQxvW7oer9xPkdadYqlEyiJJ6wl7FyJOH7Q6ZYH4yjGAUCvxDBxPbnDu9ZVg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.22.1.tgz", - "integrity": "sha512-RjNgpdM20VUXgV7us/VmlO3Vn2ZRiDnc3/bUxCVvySZWPiVPprpqW/QDWuzkGa+NCUf6saAM5CLsZLSxncXJwg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.22.1.tgz", - "integrity": "sha512-ZgO4C7Rd6Hv/5MnyY2KxOYmIlzk4rplVolDt3NbkNR8DndnyX0Q5IR4acJWNTBICQ21j3zySzKbcJaiJpk/4YA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.22.1.tgz", - "integrity": "sha512-4pozV4eyD0MDET41ZLHAeBo+H04Nm2UEYIk5w/ts40231dRFV7E0cjwbnZvSoc1DXFgecAhiC0L16ruv/ZDCpg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/lilconfig": { "version": "2.1.0", "dev": true, @@ -15859,9 +14110,8 @@ }, "node_modules/listr2": { "version": "3.14.0", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", - "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", "dev": true, + "license": "MIT", "dependencies": { "cli-truncate": "^2.1.0", "colorette": "^2.0.16", @@ -15886,10 +14136,9 @@ }, "node_modules/lmdb": { "version": "2.8.5", - "resolved": "https://registry.npmjs.org/lmdb/-/lmdb-2.8.5.tgz", - "integrity": "sha512-9bMdFfc80S+vSldBmG3HOuLVHnxRdNTlpzR6QDnzqCQtCzGUEAGTzBKYMeIM+I/sU4oZfgbcbS7X7F65/z/oxQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "msgpackr": "^1.9.5", "node-addon-api": "^6.1.0", @@ -15911,15 +14160,13 @@ }, "node_modules/lmdb/node_modules/node-addon-api": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", - "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/local-pkg": { "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" }, @@ -15943,10 +14190,9 @@ }, "node_modules/locus": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/locus/-/locus-2.0.4.tgz", - "integrity": "sha512-IZkIsFkcfvO51LWyAXUEeyj5ftH8Bq2akCkiz72CA8UHmuvCIWBmgOl0+ChuNazIQZbPXoC5my6xE/n/DBR2nw==", "dev": true, "hasInstallScript": true, + "license": "LGPL-3.0", "dependencies": { "bindings": "^1.5.0", "cardinal": "^2.1.1", @@ -15989,9 +14235,8 @@ }, "node_modules/lodash.memoize": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -16000,9 +14245,8 @@ }, "node_modules/lodash.once": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.uniqby": { "version": "4.7.0", @@ -16011,9 +14255,8 @@ }, "node_modules/log-driver": { "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", "dev": true, + "license": "ISC", "engines": { "node": ">=0.8.6" } @@ -16099,9 +14342,8 @@ }, "node_modules/log-update": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", - "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-escapes": "^4.3.0", "cli-cursor": "^3.1.0", @@ -16117,9 +14359,8 @@ }, "node_modules/log-update/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -16132,9 +14373,8 @@ }, "node_modules/log-update/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -16144,15 +14384,13 @@ }, "node_modules/log-update/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-update/node_modules/slice-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -16167,9 +14405,8 @@ }, "node_modules/log-update/node_modules/wrap-ansi": { "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -16181,9 +14418,8 @@ }, "node_modules/loupe": { "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", "dev": true, + "license": "MIT", "dependencies": { "get-func-name": "^2.0.1" } @@ -16212,9 +14448,8 @@ }, "node_modules/lru-queue": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", - "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==", "dev": true, + "license": "MIT", "dependencies": { "es5-ext": "~0.10.2" } @@ -16237,9 +14472,8 @@ }, "node_modules/magic-string": { "version": "0.30.5", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", - "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, @@ -16301,9 +14535,8 @@ }, "node_modules/md5": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "charenc": "0.0.2", "crypt": "0.0.2", @@ -16312,8 +14545,7 @@ }, "node_modules/md5.js": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "license": "MIT", "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", @@ -16322,17 +14554,15 @@ }, "node_modules/mdn-data": { "version": "2.0.30", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", - "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "dev": true, + "license": "CC0-1.0", "optional": true, "peer": true }, "node_modules/memoizee": { "version": "0.4.15", - "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", - "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.53", @@ -16436,9 +14666,8 @@ }, "node_modules/mkdirp": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true, + "license": "MIT", "bin": { "mkdirp": "bin/cmd.js" }, @@ -16448,9 +14677,8 @@ }, "node_modules/mlly": { "version": "1.4.2", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", - "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^8.10.0", "pathe": "^1.1.1", @@ -16460,9 +14688,8 @@ }, "node_modules/module-details-from-path": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", - "integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/mri": { "version": "1.2.0", @@ -16479,19 +14706,17 @@ }, "node_modules/msgpackr": { "version": "1.9.9", - "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.9.9.tgz", - "integrity": "sha512-sbn6mioS2w0lq1O6PpGtsv6Gy8roWM+o3o4Sqjd6DudrL/nOugY+KyJUimoWzHnf9OkO0T6broHFnYE/R05t9A==", "dev": true, + "license": "MIT", "optionalDependencies": { "msgpackr-extract": "^3.0.2" } }, "node_modules/msgpackr-extract": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.2.tgz", - "integrity": "sha512-SdzXp4kD/Qf8agZ9+iTu6eql0m3kWm1A2y1hkpTeVNENutaB0BwHlSvAIaMxwntmRUAUjon2V4L8Z/njd0Ct8A==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "dependencies": { "node-gyp-build-optional-packages": "5.0.7" @@ -16510,9 +14735,8 @@ }, "node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages": { "version": "5.0.7", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz", - "integrity": "sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w==", "dev": true, + "license": "MIT", "optional": true, "bin": { "node-gyp-build-optional-packages": "bin.js", @@ -16537,13 +14761,13 @@ }, "node_modules/mute-stream": { "version": "0.0.8", + "dev": true, "license": "ISC" }, "node_modules/nan": { "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.6", @@ -16582,9 +14806,8 @@ }, "node_modules/needle": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", - "integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^3.2.6", "iconv-lite": "^0.4.4", @@ -16599,18 +14822,16 @@ }, "node_modules/needle/node_modules/debug": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.1" } }, "node_modules/needle/node_modules/iconv-lite": { "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, + "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -16653,14 +14874,12 @@ }, "node_modules/next-tick": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/node-addon-api": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", - "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" + "license": "MIT" }, "node_modules/node-domexception": { "version": "1.0.0", @@ -16729,9 +14948,8 @@ }, "node_modules/node-gyp-build-optional-packages": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.1.1.tgz", - "integrity": "sha512-+P72GAjVAbTxjjwUmwjVrqrdZROD4nf8KgpBoDxqXXTiYZZt/ud60dE5yvCSr9lRO8e8yv6kgJIC0K0PfZFVQw==", "dev": true, + "license": "MIT", "dependencies": { "detect-libc": "^2.0.1" }, @@ -16743,9 +14961,8 @@ }, "node_modules/node-gyp-build-optional-packages/node_modules/detect-libc": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=8" } @@ -16770,9 +14987,8 @@ }, "node_modules/node-webcrypto-p11": { "version": "2.6.3", - "resolved": "https://registry.npmjs.org/node-webcrypto-p11/-/node-webcrypto-p11-2.6.3.tgz", - "integrity": "sha512-re1Q6i+nAYtFtvUQ2Dkeu/q/3GEezWpIvDZ79ftMj6Mt0iw9Id9JSNdzhEhuMs7JuEjcLg7J2029h1RrF48v/g==", "dev": true, + "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.6", "@peculiar/asn1-x509": "^2.3.6", @@ -16821,9 +15037,8 @@ }, "node_modules/nssocket": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/nssocket/-/nssocket-0.6.0.tgz", - "integrity": "sha512-a9GSOIql5IqgWJR3F/JXG4KpJTA3Z53Cj0MeMvGpglytB1nxE4PdFNC0jINe27CS7cGivoynwc054EzCcT3M3w==", "dev": true, + "license": "MIT", "dependencies": { "eventemitter2": "~0.4.14", "lazy": "~1.0.11" @@ -16834,15 +15049,13 @@ }, "node_modules/nssocket/node_modules/eventemitter2": { "version": "0.4.14", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", - "integrity": "sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==", - "dev": true - }, + "dev": true, + "license": "MIT" + }, "node_modules/nth-check": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "boolbase": "^1.0.0" }, @@ -16852,9 +15065,8 @@ }, "node_modules/nullthrows": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz", - "integrity": "sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/nwsapi": { "version": "2.2.2", @@ -16918,9 +15130,8 @@ }, "node_modules/open": { "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", "dev": true, + "license": "MIT", "dependencies": { "default-browser": "^4.0.0", "define-lazy-prop": "^3.0.0", @@ -17086,9 +15297,8 @@ }, "node_modules/ordered-binary": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/ordered-binary/-/ordered-binary-1.4.1.tgz", - "integrity": "sha512-9LtiGlPy982CsgxZvJGNNp2/NnrgEr6EAyN3iIEP3/8vd3YLgAZQHbQ75ZrkfBRGrNg37Dk3U6tuVb+B4Xfslg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/os": { "version": "0.1.2", @@ -17120,9 +15330,8 @@ }, "node_modules/ospath": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz", - "integrity": "sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/p-cancelable": { "version": "3.0.0", @@ -17162,9 +15371,8 @@ }, "node_modules/p-map": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "dev": true, + "license": "MIT", "dependencies": { "aggregate-error": "^3.0.0" }, @@ -17306,15 +15514,13 @@ }, "node_modules/pako": { "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/parcel": { "version": "2.10.2", - "resolved": "https://registry.npmjs.org/parcel/-/parcel-2.10.2.tgz", - "integrity": "sha512-wRvsK9v12Nt2/EIjLp/uvxd3UeRSN9DRoSofDn21Ot+rEw4e98ODvbdSHi6dYr82s4oo6mF823ACmOp1hXd4wg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/config-default": "2.10.2", "@parcel/core": "2.10.2", @@ -17344,9 +15550,8 @@ }, "node_modules/parcel/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -17359,9 +15564,8 @@ }, "node_modules/parcel/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -17375,9 +15579,8 @@ }, "node_modules/parcel/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -17387,33 +15590,29 @@ }, "node_modules/parcel/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/parcel/node_modules/commander": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } }, "node_modules/parcel/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/parcel/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -17459,10 +15658,8 @@ }, "node_modules/parse-stack": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/parse-stack/-/parse-stack-0.1.4.tgz", - "integrity": "sha512-LavgUUPQOilfSoBTt9MEyOznloproJQnrHYLtr2DHJBH2D8cXCRh7DYPNDgnFCBjfCEjOcN92WG+eBfiWM1OoA==", - "deprecated": "Use error-stack-parser instead.", - "dev": true + "dev": true, + "license": "LGPLv3" }, "node_modules/parse-url": { "version": "8.1.0", @@ -17538,30 +15735,26 @@ }, "node_modules/pathe": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", - "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pathval": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, "node_modules/pend": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/performance-now": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/picocolors": { "version": "1.0.0", @@ -17581,9 +15774,8 @@ }, "node_modules/pidusage": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-3.0.2.tgz", - "integrity": "sha512-g0VU+y08pKw5M8EZ2rIGiEBaB8wrQMjYGFfW2QVIfyT8V+fq8YFLkvlz4bz5ljvFDJYNFCWT3PWqcRr2FKO81w==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.2.1" }, @@ -17593,8 +15785,6 @@ }, "node_modules/pidusage/node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -17609,13 +15799,13 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -17630,10 +15820,8 @@ }, "node_modules/pkcs11js": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/pkcs11js/-/pkcs11js-1.3.1.tgz", - "integrity": "sha512-eo7fTeQwYGzX1pFmRaf4ji/WcDW2XKpwqylOwzutsjNWECv6G9PzDHj3Yj5dX9EW/fydMnJG8xvWj/btnQT9TA==", "dev": true, - "hasInstallScript": true, + "license": "MIT", "dependencies": { "nan": "^2.15.0" }, @@ -17703,9 +15891,8 @@ }, "node_modules/pkg-types": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", "dev": true, + "license": "MIT", "dependencies": { "jsonc-parser": "^3.2.0", "mlly": "^1.2.0", @@ -17714,9 +15901,8 @@ }, "node_modules/pm2": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/pm2/-/pm2-5.3.0.tgz", - "integrity": "sha512-xscmQiAAf6ArVmKhjKTeeN8+Td7ZKnuZFFPw1DGkdFPR/0Iyx+m+1+OpCdf9+HQopX3VPc9/wqPQHqVOfHum9w==", "dev": true, + "license": "AGPL-3.0", "dependencies": { "@pm2/agent": "~2.0.0", "@pm2/io": "~5.0.0", @@ -17763,9 +15949,8 @@ }, "node_modules/pm2-axon": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pm2-axon/-/pm2-axon-4.0.1.tgz", - "integrity": "sha512-kES/PeSLS8orT8dR5jMlNl+Yu4Ty3nbvZRmaAtROuVm9nYYGiaoXqqKQqQYzWQzMYWUKHMQTvBlirjE5GIIxqg==", "dev": true, + "license": "MIT", "dependencies": { "amp": "~0.3.1", "amp-message": "~0.1.1", @@ -17778,9 +15963,8 @@ }, "node_modules/pm2-axon-rpc": { "version": "0.7.1", - "resolved": "https://registry.npmjs.org/pm2-axon-rpc/-/pm2-axon-rpc-0.7.1.tgz", - "integrity": "sha512-FbLvW60w+vEyvMjP/xom2UPhUN/2bVpdtLfKJeYM3gwzYhoTEEChCOICfFzxkxuoEleOlnpjie+n1nue91bDQw==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.3.1" }, @@ -17790,9 +15974,8 @@ }, "node_modules/pm2-axon/node_modules/escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -17802,9 +15985,8 @@ }, "node_modules/pm2-deploy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pm2-deploy/-/pm2-deploy-1.0.2.tgz", - "integrity": "sha512-YJx6RXKrVrWaphEYf++EdOOx9EH18vM8RSZN/P1Y+NokTKqYAca/ejXwVLyiEpNju4HPZEk3Y2uZouwMqUlcgg==", "dev": true, + "license": "MIT", "dependencies": { "run-series": "^1.1.8", "tv4": "^1.3.0" @@ -17815,18 +15997,16 @@ }, "node_modules/pm2-multimeter": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/pm2-multimeter/-/pm2-multimeter-0.1.2.tgz", - "integrity": "sha512-S+wT6XfyKfd7SJIBqRgOctGxaBzUOmVQzTAS+cg04TsEUObJVreha7lvCfX8zzGVr871XwCSnHUU7DQQ5xEsfA==", "dev": true, + "license": "MIT/X11", "dependencies": { "charm": "~0.1.1" } }, "node_modules/pm2-sysmonit": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/pm2-sysmonit/-/pm2-sysmonit-1.2.8.tgz", - "integrity": "sha512-ACOhlONEXdCTVwKieBIQLSi2tQZ8eKinhcr9JpZSUAL8Qy0ajIgRtsLxG/lwPOW3JEKqPyw/UaHmTWhUzpP4kA==", "dev": true, + "license": "Apache", "optional": true, "dependencies": { "async": "^3.2.0", @@ -17838,9 +16018,8 @@ }, "node_modules/pm2-sysmonit/node_modules/pidusage": { "version": "2.0.21", - "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-2.0.21.tgz", - "integrity": "sha512-cv3xAQos+pugVX+BfXpHsbyz/dLzX+lr44zNMsYiGxUw+kV5sgQCIcLd1z+0vq+KyC7dJ+/ts2PsfgWfSC3WXA==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "safe-buffer": "^5.2.1" @@ -17851,8 +16030,6 @@ }, "node_modules/pm2-sysmonit/node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -17868,13 +16045,13 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "optional": true }, "node_modules/pm2/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -17887,9 +16064,8 @@ }, "node_modules/pm2/node_modules/chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -17900,9 +16076,8 @@ }, "node_modules/pm2/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -17912,21 +16087,18 @@ }, "node_modules/pm2/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pm2/node_modules/commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pm2/node_modules/enquirer": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-colors": "^4.1.1" }, @@ -17936,24 +16108,21 @@ }, "node_modules/pm2/node_modules/eventemitter2": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz", - "integrity": "sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pm2/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/pm2/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -17966,9 +16135,8 @@ }, "node_modules/pm2/node_modules/source-map-support": { "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -17976,15 +16144,13 @@ }, "node_modules/pm2/node_modules/sprintf-js": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", - "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/pm2/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -17994,8 +16160,6 @@ }, "node_modules/postcss": { "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "dev": true, "funding": [ { @@ -18011,6 +16175,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", @@ -18022,15 +16187,13 @@ }, "node_modules/postcss-value-parser": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/posthtml": { "version": "0.16.6", - "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.16.6.tgz", - "integrity": "sha512-JcEmHlyLK/o0uGAlj65vgg+7LIms0xKXe60lcDOTU7oVX/3LuEuLwrQpW3VJ7de5TaFKiW4kWkaIpJL42FEgxQ==", "dev": true, + "license": "MIT", "dependencies": { "posthtml-parser": "^0.11.0", "posthtml-render": "^3.0.0" @@ -18041,9 +16204,8 @@ }, "node_modules/posthtml-parser": { "version": "0.10.2", - "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.10.2.tgz", - "integrity": "sha512-PId6zZ/2lyJi9LiKfe+i2xv57oEjJgWbsHGGANwos5AvdQp98i6AtamAl8gzSVFGfQ43Glb5D614cvZf012VKg==", "dev": true, + "license": "MIT", "dependencies": { "htmlparser2": "^7.1.1" }, @@ -18053,9 +16215,8 @@ }, "node_modules/posthtml-render": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/posthtml-render/-/posthtml-render-3.0.0.tgz", - "integrity": "sha512-z+16RoxK3fUPgwaIgH9NGnK1HKY9XIDpydky5eQGgAFVXTCSezalv9U2jQuNV+Z9qV1fDWNzldcw4eK0SSbqKA==", "dev": true, + "license": "MIT", "dependencies": { "is-json": "^2.0.1" }, @@ -18065,9 +16226,8 @@ }, "node_modules/posthtml/node_modules/posthtml-parser": { "version": "0.11.0", - "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.11.0.tgz", - "integrity": "sha512-QecJtfLekJbWVo/dMAA+OSwY79wpRmbqS5TeXvXSX+f0c6pW4/SE6inzZ2qkU7oAMCPqIDkZDvd/bQsSFUnKyw==", "dev": true, + "license": "MIT", "dependencies": { "htmlparser2": "^7.1.1" }, @@ -18085,9 +16245,8 @@ }, "node_modules/prettier": { "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin-prettier.js" }, @@ -18100,9 +16259,8 @@ }, "node_modules/prettier-linter-helpers": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, + "license": "MIT", "dependencies": { "fast-diff": "^1.1.2" }, @@ -18112,9 +16270,8 @@ }, "node_modules/pretty-bytes": { "version": "5.6.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", - "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" }, @@ -18164,9 +16321,8 @@ }, "node_modules/pretty-quick": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.3.tgz", - "integrity": "sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^3.0.0", "execa": "^4.0.0", @@ -18367,6 +16523,7 @@ }, "node_modules/prompt": { "version": "1.3.0", + "dev": true, "license": "MIT", "dependencies": { "@colors/colors": "1.5.0", @@ -18381,13 +16538,13 @@ }, "node_modules/prompt/node_modules/async": { "version": "3.2.3", + "dev": true, "license": "MIT" }, "node_modules/promptly": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/promptly/-/promptly-2.2.0.tgz", - "integrity": "sha512-aC9j+BZsRSSzEsXBNBwDnAxujdx19HycZoKgRgzWnS8eOHg1asuf9heuLprfbe739zY3IdUQx+Egv6Jn135WHA==", "dev": true, + "license": "MIT", "dependencies": { "read": "^1.0.4" } @@ -18518,8 +16675,6 @@ }, "node_modules/pure-rand": { "version": "6.0.4", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.4.tgz", - "integrity": "sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==", "dev": true, "funding": [ { @@ -18530,12 +16685,12 @@ "type": "opencollective", "url": "https://opencollective.com/fast-check" } - ] + ], + "license": "MIT" }, "node_modules/pvtsutils": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.5.tgz", - "integrity": "sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA==", + "license": "MIT", "dependencies": { "tslib": "^2.6.1" } @@ -18549,9 +16704,8 @@ }, "node_modules/qs": { "version": "6.10.4", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", - "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.4" }, @@ -18621,9 +16775,8 @@ }, "node_modules/react-error-overlay": { "version": "6.0.9", - "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", - "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/react-is": { "version": "18.2.0", @@ -18632,15 +16785,15 @@ }, "node_modules/react-refresh": { "version": "0.9.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", - "integrity": "sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/read": { "version": "1.0.7", + "dev": true, "license": "ISC", "dependencies": { "mute-stream": "~0.0.4" @@ -18674,9 +16827,8 @@ }, "node_modules/readline-history": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/readline-history/-/readline-history-1.2.0.tgz", - "integrity": "sha512-8R0Vr9jhdtqYSdWGpAvkEopvuPKjAlYELIKoa7+7FO2CBN/b88rYB9r9gFSNtdCUHdAOJslj0KDG75MsiozXIQ==", - "dev": true + "dev": true, + "license": "WTFPL" }, "node_modules/realistic-structured-clone": { "version": "3.0.0", @@ -18703,24 +16855,21 @@ }, "node_modules/redeyed": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", - "integrity": "sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==", "dev": true, + "license": "MIT", "dependencies": { "esprima": "~4.0.0" } }, "node_modules/reflect-metadata": { "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/regenerator-runtime": { "version": "0.14.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", - "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/regexp.prototype.flags": { "version": "1.5.1", @@ -18986,9 +17135,8 @@ }, "node_modules/request-progress": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", - "integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==", "dev": true, + "license": "MIT", "dependencies": { "throttleit": "^1.0.0" } @@ -19003,9 +17151,8 @@ }, "node_modules/require-in-the-middle": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-5.2.0.tgz", - "integrity": "sha512-efCx3b+0Z69/LGJmm9Yvi4cqEdxnoGnxYxGxBghkkTTFeXRtTCmmhO0AnAfHz59k957uTSuy8WaHqOs8wbYUWg==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.1.1", "module-details-from-path": "^1.0.3", @@ -19121,6 +17268,7 @@ }, "node_modules/revalidator": { "version": "0.1.8", + "dev": true, "license": "Apache 2.0", "engines": { "node": ">= 0.4.0" @@ -19128,9 +17276,8 @@ }, "node_modules/rfdc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/rimraf": { "version": "3.0.2", @@ -19148,8 +17295,7 @@ }, "node_modules/ripemd160": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "license": "MIT", "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1" @@ -19157,9 +17303,8 @@ }, "node_modules/rollup": { "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, + "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, @@ -19217,8 +17362,6 @@ }, "node_modules/run-series": { "version": "1.1.9", - "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", - "integrity": "sha512-Arc4hUN896vjkqCYrUXquBFtRZdv1PfLbTYP71efP6butxyQ0kWpiNJyAgsxscmQg1cqvHY32/UCBzXedTpU2g==", "dev": true, "funding": [ { @@ -19233,7 +17376,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/rxjs": { "version": "7.8.1", @@ -19293,9 +17437,8 @@ }, "node_modules/sax": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", - "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/saxes": { "version": "5.0.1", @@ -19310,9 +17453,8 @@ }, "node_modules/secp256k1": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-5.0.0.tgz", - "integrity": "sha512-TKWX8xvoGHrxVdqbYeZM9w+izTF4b9z3NhSaDkdn81btvuh+ivbIMGT/zQvDtTFWhRlThpoz6LEYTr7n8A5GcA==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "elliptic": "^6.5.4", "node-addon-api": "^5.0.0", @@ -19387,8 +17529,7 @@ }, "node_modules/sha.js": { "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "license": "(MIT AND BSD-3-Clause)", "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -19418,9 +17559,8 @@ }, "node_modules/shell-quote": { "version": "1.8.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", - "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -19472,9 +17612,8 @@ }, "node_modules/shimmer": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", - "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/side-channel": { "version": "1.0.4", @@ -19491,9 +17630,8 @@ }, "node_modules/siginfo": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/signal-exit": { "version": "3.0.7", @@ -19511,9 +17649,8 @@ }, "node_modules/size-limit": { "version": "10.0.2", - "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-10.0.2.tgz", - "integrity": "sha512-ULFHMr+OQjuyqdGSqkDGY3XfnGO0l3cIfJaNe6F6ZqO+QzWUYunZh9DYHovNctsN7R9fR9gzzzW4Ze8TiJ060g==", "dev": true, + "license": "MIT", "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.5.3", @@ -19531,9 +17668,8 @@ }, "node_modules/size-limit-node-esbuild": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/size-limit-node-esbuild/-/size-limit-node-esbuild-0.2.0.tgz", - "integrity": "sha512-iiIfHBH/+ZxgsE7YVQDEejAUGZYEu4QIai/QNZloEGxA+cmow79O8uGdu4sK64V8kafryqR1grK7nl7xIGv6rw==", "dev": true, + "license": "MIT", "dependencies": { "@size-limit/esbuild": "^8.1.0", "nanoid": "^3.2.0", @@ -19546,439 +17682,360 @@ "url": "https://opencollective.com/unts" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-arm": { + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-arm64": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", "cpu": [ - "arm" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "darwin" ], "engines": { "node": ">=12" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], + "node_modules/size-limit-node-esbuild/node_modules/@size-limit/esbuild": { + "version": "8.2.6", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "esbuild": "^0.18.6", + "nanoid": "^3.3.6" + }, "engines": { - "node": ">=12" + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "size-limit": "8.2.6" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-x64": { + "node_modules/size-limit-node-esbuild/node_modules/esbuild": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], "dev": true, - "optional": true, - "os": [ - "android" - ], + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, "engines": { "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", - "cpu": [ - "arm64" - ], + "node_modules/size-limit-node-esbuild/node_modules/size-limit": { + "version": "8.2.6", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], + "peer": true, + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, "engines": { - "node": ">=12" + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], + "node_modules/size-limit/node_modules/globby": { + "version": "13.2.2", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, "engines": { - "node": ">=12" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], + "node_modules/size-limit/node_modules/slash": { + "version": "4.0.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "cpu": [ - "x64" - ], + "node_modules/slash": { + "version": "3.0.0", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], + "node_modules/slice-ansi": { + "version": "3.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=12" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">=12" + "node": ">=7.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], + "node_modules/smart-buffer": { + "version": "4.2.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 6.0.0", + "npm": ">= 3.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], + "node_modules/socks": { + "version": "2.7.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, "engines": { - "node": ">=12" + "node": ">= 10.13.0", + "npm": ">= 3.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], + "node_modules/socks-proxy-agent": { + "version": "8.0.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, "engines": { - "node": ">=12" + "node": ">= 14" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, "engines": { - "node": ">=12" + "node": ">= 14" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], + "node_modules/socks/node_modules/ip": { + "version": "2.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], + "node_modules/source-map": { + "version": "0.6.1", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "BSD-3-Clause", "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "cpu": [ - "x64" - ], + "node_modules/source-map-js": { + "version": "1.0.2", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "BSD-3-Clause", "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "cpu": [ - "x64" - ], + "node_modules/source-map-support": { + "version": "0.5.13", "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], + "node_modules/spawn-command": { + "version": "0.0.2-1", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], + "node_modules/spdx-exceptions": { + "version": "2.3.0", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "cpu": [ - "x64" - ], + "node_modules/spdx-license-ids": { + "version": "3.0.12", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "CC0-1.0" + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/srcset": { + "version": "4.0.0", + "dev": true, + "license": "MIT", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit-node-esbuild/node_modules/@size-limit/esbuild": { - "version": "8.2.6", + "node_modules/sshpk": { + "version": "1.18.0", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.18.6", - "nanoid": "^3.3.6" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" }, - "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" }, - "peerDependencies": { - "size-limit": "8.2.6" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/size-limit-node-esbuild/node_modules/esbuild": { - "version": "0.18.20", - "dev": true, - "hasInstallScript": true, + "node_modules/stable": { + "version": "0.1.8", + "dev": true, + "license": "MIT" + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "dev": true, "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.18.20", - "@esbuild/android-arm64": "0.18.20", - "@esbuild/android-x64": "0.18.20", - "@esbuild/darwin-arm64": "0.18.20", - "@esbuild/darwin-x64": "0.18.20", - "@esbuild/freebsd-arm64": "0.18.20", - "@esbuild/freebsd-x64": "0.18.20", - "@esbuild/linux-arm": "0.18.20", - "@esbuild/linux-arm64": "0.18.20", - "@esbuild/linux-ia32": "0.18.20", - "@esbuild/linux-loong64": "0.18.20", - "@esbuild/linux-mips64el": "0.18.20", - "@esbuild/linux-ppc64": "0.18.20", - "@esbuild/linux-riscv64": "0.18.20", - "@esbuild/linux-s390x": "0.18.20", - "@esbuild/linux-x64": "0.18.20", - "@esbuild/netbsd-x64": "0.18.20", - "@esbuild/openbsd-x64": "0.18.20", - "@esbuild/sunos-x64": "0.18.20", - "@esbuild/win32-arm64": "0.18.20", - "@esbuild/win32-ia32": "0.18.20", - "@esbuild/win32-x64": "0.18.20" + "node": "*" } }, - "node_modules/size-limit-node-esbuild/node_modules/size-limit": { - "version": "8.2.6", + "node_modules/stack-utils": { + "version": "2.0.5", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "bytes-iec": "^3.1.1", - "chokidar": "^3.5.3", - "globby": "^11.1.0", - "lilconfig": "^2.1.0", - "nanospinner": "^1.1.0", - "picocolors": "^1.0.0" - }, - "bin": { - "size-limit": "bin.js" + "escape-string-regexp": "^2.0.0" }, "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/size-limit/node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.4.3", "dev": true, + "license": "MIT" + }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "dev": true, + "license": "MIT", "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" + "bl": "^5.0.0" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" @@ -19987,645 +18044,362 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/size-limit/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", "dev": true, - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "internal-slot": "^1.0.4" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">= 0.4" } }, - "node_modules/slash": { - "version": "3.0.0", + "node_modules/stream": { + "version": "0.0.2", "dev": true, "license": "MIT", - "engines": { - "node": ">=8" + "dependencies": { + "emitter-component": "^1.1.1" } }, - "node_modules/slice-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "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/string-length": { + "version": "4.0.2", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/string-width": { + "version": "4.2.3", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/string.prototype.trim": { + "version": "1.2.8", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/smart-buffer": { - "version": "4.2.0", + "node_modules/string.prototype.trimend": { + "version": "1.0.7", "dev": true, "license": "MIT", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/socks": { - "version": "2.7.1", + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", "dev": true, "license": "MIT", "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/socks-proxy-agent": { - "version": "8.0.2", + "node_modules/strip-ansi": { + "version": "6.0.1", "dev": true, "license": "MIT", "dependencies": { - "agent-base": "^7.0.2", - "debug": "^4.3.4", - "socks": "^2.7.1" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">= 14" + "node": ">=8" } }, - "node_modules/socks-proxy-agent/node_modules/agent-base": { - "version": "7.1.0", + "node_modules/strip-bom": { + "version": "4.0.0", "dev": true, "license": "MIT", - "dependencies": { - "debug": "^4.3.4" - }, "engines": { - "node": ">= 14" + "node": ">=8" } }, - "node_modules/socks/node_modules/ip": { + "node_modules/strip-final-newline": { "version": "2.0.0", "dev": true, - "license": "MIT" - }, - "node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "node_modules/strip-json-comments": { + "version": "3.1.1", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/source-map-support": { - "version": "0.5.13", + "node_modules/strip-literal": { + "version": "1.3.0", "dev": true, "license": "MIT", "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "acorn": "^8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" } }, - "node_modules/spawn-command": { - "version": "0.0.2-1", - "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", - "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", - "dev": true - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "dev": true, - "license": "CC-BY-3.0" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", + "node_modules/supports-color": { + "version": "5.5.0", "dev": true, "license": "MIT", "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "node_modules/spdx-license-ids": { - "version": "3.0.12", - "dev": true, - "license": "CC0-1.0" - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/srcset": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/srcset/-/srcset-4.0.0.tgz", - "integrity": "sha512-wvLeHgcVHKO8Sc/H/5lkGreJQVeYMm9rlmt8PuR1xE31rIuXhuzznUUqAt8MqLhB3MqJdFzlNAfpcWnxiFUcPw==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", + "node_modules/svgo": { + "version": "3.0.3", "dev": true, + "license": "MIT", + "optional": true, + "peer": true, "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^5.1.0", + "css-tree": "^2.2.1", + "csso": "5.0.5", + "picocolors": "^1.0.0" }, "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" + "svgo": "bin/svgo" }, "engines": { - "node": ">=0.10.0" + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/svgo" } }, - "node_modules/stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility", - "dev": true - }, - "node_modules/stack-trace": { - "version": "0.0.10", + "node_modules/svgo/node_modules/commander": { + "version": "7.2.0", + "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { - "node": "*" + "node": ">= 10" } }, - "node_modules/stack-utils": { - "version": "2.0.5", + "node_modules/symbol-tree": { + "version": "3.2.4", "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } + "license": "MIT" }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", + "node_modules/systeminformation": { + "version": "5.21.17", "dev": true, "license": "MIT", + "optional": true, + "os": [ + "darwin", + "linux", + "win32", + "freebsd", + "openbsd", + "netbsd", + "sunos", + "android" + ], + "bin": { + "systeminformation": "lib/cli.js" + }, "engines": { - "node": ">=8" + "node": ">=8.0.0" + }, + "funding": { + "type": "Buy me a coffee", + "url": "https://www.buymeacoffee.com/systeminfo" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "node_modules/std-env": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.4.3.tgz", - "integrity": "sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==", - "dev": true - }, - "node_modules/stdin-discarder": { - "version": "0.1.0", + "node_modules/term-size": { + "version": "2.2.1", "dev": true, "license": "MIT", - "dependencies": { - "bl": "^5.0.0" - }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/stop-iteration-iterator": { - "version": "1.0.0", + "node_modules/test-exclude": { + "version": "6.0.0", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "internal-slot": "^1.0.4" + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" }, "engines": { - "node": ">= 0.4" + "node": ">=8" } }, - "node_modules/stream": { - "version": "0.0.2", + "node_modules/text-encoding": { + "version": "0.7.0", "dev": true, - "license": "MIT", - "dependencies": { - "emitter-component": "^1.1.1" - } + "license": "(Unlicense OR Apache-2.0)" }, - "node_modules/string_decoder": { - "version": "1.3.0", - "license": "MIT", + "node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/throttleit": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "dev": true, + "license": "MIT" + }, + "node_modules/timers-ext": { + "version": "0.1.7", + "dev": true, + "license": "ISC", "dependencies": { - "safe-buffer": "~5.2.0" + "es5-ext": "~0.10.46", + "next-tick": "1" } }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/timsort": { + "version": "0.3.0", + "dev": true, "license": "MIT" }, - "node_modules/string-length": { - "version": "4.0.2", + "node_modules/tinybench": { + "version": "2.5.1", + "dev": true, + "license": "MIT" + }, + "node_modules/tinypool": { + "version": "0.7.0", "dev": true, "license": "MIT", - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, "engines": { - "node": ">=10" + "node": ">=14.0.0" } }, - "node_modules/string-width": { - "version": "4.2.3", + "node_modules/tinyspy": { + "version": "2.2.0", "dev": true, "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, "engines": { - "node": ">=8" + "node": ">=14.0.0" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.8", + "node_modules/titleize": { + "version": "3.0.0", "dev": true, "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, "engines": { - "node": ">= 0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.7", + "node_modules/tmp": { + "version": "0.2.1", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "rimraf": "^3.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8.17.0" } }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strip-literal": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", - "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", - "dev": true, - "dependencies": { - "acorn": "^8.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/svgo": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.3.tgz", - "integrity": "sha512-X4UZvLhOglD5Xrp834HzGHf8RKUW0Ahigg/08yRO1no9t2NxffOkMiQ0WmaMIbaGlVTlSst2zWANsdhz5ybXgA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@trysound/sax": "0.2.0", - "commander": "^7.2.0", - "css-select": "^5.1.0", - "css-tree": "^2.2.1", - "csso": "5.0.5", - "picocolors": "^1.0.0" - }, - "bin": { - "svgo": "bin/svgo" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/svgo" - } - }, - "node_modules/svgo/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/systeminformation": { - "version": "5.21.17", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.21.17.tgz", - "integrity": "sha512-JZYRCbIjk3WuBV59A9/rTla2rROX+aAJ9uo2Z1dI+bjieORcukClN8rlM1zE9NYKpULSbaGc+KKct/870lO0DA==", - "dev": true, - "optional": true, - "os": [ - "darwin", - "linux", - "win32", - "freebsd", - "openbsd", - "netbsd", - "sunos", - "android" - ], - "bin": { - "systeminformation": "lib/cli.js" - }, - "engines": { - "node": ">=8.0.0" - }, - "funding": { - "type": "Buy me a coffee", - "url": "https://www.buymeacoffee.com/systeminfo" - } - }, - "node_modules/term-size": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", - "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-encoding": { - "version": "0.7.0", - "dev": true, - "license": "(Unlicense OR Apache-2.0)" - }, - "node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==", - "dev": true - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, - "node_modules/timers-ext": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", - "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", - "dev": true, - "dependencies": { - "es5-ext": "~0.10.46", - "next-tick": "1" - } - }, - "node_modules/timsort": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", - "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==", - "dev": true - }, - "node_modules/tinybench": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", - "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", - "dev": true - }, - "node_modules/tinypool": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz", - "integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.0.tgz", - "integrity": "sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/titleize": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, - "dependencies": { - "rimraf": "^3.0.0" - }, - "engines": { - "node": ">=8.17.0" - } - }, - "node_modules/tmpl": { - "version": "1.0.5", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", + "node_modules/tmpl": { + "version": "1.0.5", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", "dev": true, "license": "MIT", "engines": { @@ -20670,18 +18444,16 @@ }, "node_modules/tree-kill": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dev": true, + "license": "MIT", "bin": { "tree-kill": "cli.js" } }, "node_modules/ts-jest": { "version": "29.1.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", "dev": true, + "license": "MIT", "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", @@ -20722,9 +18494,8 @@ }, "node_modules/ts-jest/node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -20737,9 +18508,8 @@ }, "node_modules/ts-jest/node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -20753,9 +18523,8 @@ }, "node_modules/ts-jest/node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -20765,24 +18534,21 @@ }, "node_modules/ts-jest/node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ts-jest/node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/ts-jest/node_modules/jest-util": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -20797,9 +18563,8 @@ }, "node_modules/ts-jest/node_modules/semver": { "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -20812,9 +18577,8 @@ }, "node_modules/ts-jest/node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -20878,9 +18642,8 @@ }, "node_modules/tsutils": { "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.8.1" }, @@ -20893,15 +18656,13 @@ }, "node_modules/tsutils/node_modules/tslib": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/tsyringe": { "version": "4.8.0", - "resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.8.0.tgz", - "integrity": "sha512-YB1FG+axdxADa3ncEtRnQCFq/M0lALGLxSZeVNbTU8NqhOVc51nnv2CISTcvc1kyv6EGPtXVr0v6lWeDxiijOA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.9.3" }, @@ -20911,15 +18672,13 @@ }, "node_modules/tsyringe/node_modules/tslib": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "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==", "dev": true, + "license": "Apache-2.0", "dependencies": { "safe-buffer": "^5.0.1" }, @@ -20929,24 +18688,30 @@ }, "node_modules/tv4": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/tv4/-/tv4-1.3.0.tgz", - "integrity": "sha512-afizzfpJgvPr+eDkREK4MxJ/+r8nEEHcmitwgnPUqpaP+FpwQyadnxNoSACbgc/b1LsZYtODGoPiFxQrgJgjvw==", "dev": true, + "license": [ + { + "type": "Public Domain", + "url": "http://geraintluff.github.io/tv4/LICENSE.txt" + }, + { + "type": "MIT", + "url": "http://jsonary.com/LICENSE.txt" + } + ], "engines": { "node": ">= 0.8.0" } }, "node_modules/tweetnacl": { "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true + "dev": true, + "license": "Unlicense" }, "node_modules/tx2": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tx2/-/tx2-1.0.5.tgz", - "integrity": "sha512-sJ24w0y03Md/bxzK4FU8J8JveYYUbSs2FViLJ2D/8bytSiyPRbuE3DyL/9UKYXTZlV3yXq0L8GLlhobTnekCVg==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "json-stringify-safe": "^5.0.1" @@ -20954,9 +18719,8 @@ }, "node_modules/type": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/type-check": { "version": "0.4.0", @@ -21101,9 +18865,8 @@ }, "node_modules/typescript": { "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -21167,9 +18930,8 @@ }, "node_modules/ufo": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz", - "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/unbox-primitive": { "version": "1.0.2", @@ -21316,542 +19078,200 @@ "license": "MIT", "dependencies": { "punycode": "^1.4.1", - "qs": "^6.11.2" - } - }, - "node_modules/url-join": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/url-parse": { - "version": "1.5.10", - "dev": true, - "license": "MIT", - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/url/node_modules/punycode": { - "version": "1.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/url/node_modules/qs": { - "version": "6.11.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/util": { - "version": "0.12.4", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/utility-types": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", - "integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-to-istanbul": { - "version": "9.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/v8-to-istanbul/node_modules/convert-source-map": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/vite": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", - "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", - "dev": true, - "dependencies": { - "esbuild": "^0.18.10", - "postcss": "^8.4.27", - "rollup": "^3.27.1" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@types/node": ">= 14", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } - } - }, - "node_modules/vite-node": { - "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.6.tgz", - "integrity": "sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==", - "dev": true, - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.3.4", - "mlly": "^1.4.0", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": ">=v14.18.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", - "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "qs": "^6.11.2" } }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], + "node_modules/url-join": { + "version": "5.0.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], + "node_modules/url-parse": { + "version": "1.5.10", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" } }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], + "node_modules/url/node_modules/punycode": { + "version": "1.4.1", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], + "node_modules/url/node_modules/qs": { + "version": "6.11.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.4" + }, "engines": { - "node": ">=12" + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], + "node_modules/util": { + "version": "0.12.4", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" } }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], + "node_modules/util-deprecate": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/utility-types": { + "version": "3.10.0", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 4" } }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], + "node_modules/uuid": { + "version": "8.3.2", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" } }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "cpu": [ - "x64" - ], + "node_modules/v8-to-istanbul": { + "version": "9.1.3", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, "engines": { - "node": ">=12" + "node": ">=10.12.0" } }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "cpu": [ - "x64" - ], + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "2.0.0", "dev": true, - "optional": true, - "os": [ - "sunos" + "license": "MIT" + }, + "node_modules/verror": { + "version": "1.10.0", + "dev": true, + "engines": [ + "node >=0.6.0" ], - "engines": { - "node": ">=12" + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" } }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], + "node_modules/vite": { + "version": "4.5.0", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + }, + "bin": { + "vite": "bin/vite.js" + }, "engines": { - "node": ">=12" + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], + "node_modules/vite-node": { + "version": "0.34.6", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.4.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, "engines": { - "node": ">=12" + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "cpu": [ - "x64" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "win32" + "darwin" ], "engines": { "node": ">=12" @@ -21859,10 +19279,9 @@ }, "node_modules/vite/node_modules/esbuild": { "version": "0.18.20", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", - "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -21896,9 +19315,8 @@ }, "node_modules/vitest": { "version": "0.34.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.6.tgz", - "integrity": "sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/chai": "^4.3.5", "@types/chai-subset": "^1.3.3", @@ -21973,18 +19391,16 @@ }, "node_modules/vitest/node_modules/acorn-walk": { "version": "8.3.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", - "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } }, "node_modules/vizion": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/vizion/-/vizion-2.2.1.tgz", - "integrity": "sha512-sfAcO2yeSU0CSPFI/DmZp3FsFE9T+8913nv1xWBOyzODv13fwkn6Vl7HqxGpkr9F608M+8SuFId3s+BlZqfXww==", "dev": true, + "license": "Apache-2.0", "dependencies": { "async": "^2.6.3", "git-node-fs": "^1.0.0", @@ -21997,9 +19413,8 @@ }, "node_modules/vizion/node_modules/async": { "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, + "license": "MIT", "dependencies": { "lodash": "^4.17.14" } @@ -22051,9 +19466,8 @@ }, "node_modules/weak-lru-cache": { "version": "1.2.2", - "resolved": "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.2.tgz", - "integrity": "sha512-DEAoo25RfSYMuTGc9vPJzZcZullwIqRDSI9LOy+fkCJPi6hykCnfKaXTuPBDuXAUcqHXyOgFtHNp/kB2FjYHbw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/web-encoding": { "version": "1.1.5", @@ -22177,9 +19591,8 @@ }, "node_modules/why-is-node-running": { "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", "dev": true, + "license": "MIT", "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" @@ -22272,6 +19685,7 @@ }, "node_modules/winston": { "version": "2.4.6", + "dev": true, "license": "MIT", "dependencies": { "async": "^3.2.3", @@ -22407,9 +19821,8 @@ }, "node_modules/yamljs": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", - "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^1.0.7", "glob": "^7.0.5" @@ -22421,9 +19834,8 @@ }, "node_modules/yamljs/node_modules/argparse": { "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, + "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" } @@ -22455,9 +19867,8 @@ }, "node_modules/yauzl": { "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, + "license": "MIT", "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -23349,8 +20760,8 @@ "devDependencies": { "@types/jest": "^29.5.5", "esbuild": "^0.15.16", - "jest": "^29.7.0", - "size-limit": "^8.1.0" + "size-limit": "^8.1.0", + "vitest": "^0.34.6" } }, "packages/bls-verify/node_modules/size-limit": { @@ -23372,13 +20783,7 @@ "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "packages/bls-verify/src/vendor/amcl-js": { - "version": "3.0.0", - "license": "Apache License 2.0", - "dependencies": { - "prompt": "^1.0.0" - } - }, + "packages/bls-verify/src/vendor/amcl-js": {}, "packages/candid": { "name": "@dfinity/candid", "version": "0.20.2", diff --git a/package.json b/package.json index fb2f9830c..95ef0afaf 100644 --- a/package.json +++ b/package.json @@ -146,5 +146,8 @@ "draft": true, "autoGenerate": true } + }, + "dependencies": { + "@noble/curves": "^1.2.0" } } diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index 5d5b1e467..c0a05c054 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -53,8 +53,8 @@ "devDependencies": { "@types/jest": "^29.5.5", "esbuild": "^0.15.16", - "jest": "^29.7.0", - "size-limit": "^8.1.0" + "size-limit": "^8.1.0", + "vitest": "^0.34.6" }, "size-limit": [ { diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index 7b566c846..189f8fcb6 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -1,6 +1,5 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { CTX } from 'amcl-js'; import { toHex } from './utils'; +import { bls12_381 as bls } from '@noble/curves/bls12-381'; export const blsVerify = async ( primaryKey: Uint8Array | string, @@ -10,16 +9,5 @@ export const blsVerify = async ( const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - const ctx = new CTX('BLS12381'); - if (((ctx as any).BLS as any).init() !== 0) { - throw new Error('Cannot initialize BLS'); - } - - return ( - ((ctx as any).BLS as any).core_verify( - ((ctx as any).BLS as any).stringtobytes(sig), - ((ctx as any).BLS as any).stringtobytes(msg), - ((ctx as any).BLS as any).stringtobytes(pk), - ) == 0 - ); + return bls.verify(sig, msg, pk); }; diff --git a/packages/bls-verify/src/vendor/amcl-js/index.js b/packages/bls-verify/src/vendor/amcl-js/index.js deleted file mode 100644 index b8e38afff..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports.CTX = require('./src/ctx'); diff --git a/packages/bls-verify/src/vendor/amcl-js/package.json b/packages/bls-verify/src/vendor/amcl-js/package.json deleted file mode 100644 index 43addfb1e..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "amcl-js", - "version": "3.0.0", - "description": "AMCL Library", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Michael Scott, Alessandro Budroni, Kealan McCusker, Samuele Andreoli", - "license": "Apache License 2.0", - "dependencies": { - "prompt": "^1.0.0" - } -} diff --git a/packages/bls-verify/src/vendor/amcl-js/readme.md b/packages/bls-verify/src/vendor/amcl-js/readme.md deleted file mode 100644 index ce1ac3802..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/readme.md +++ /dev/null @@ -1,62 +0,0 @@ -# Installation and Testing - -Suppose you want to implement ECDH with NIST256 elliptic curve. First you need to initialize the context: - - var ctx = new CTX("NIST256"); - -then you can call the functions as follows: - - ctx.ECDH.KEY_PAIR_GENERATE(...); - ctx.ECDH.ECPSVDP_DH(...); - -If you need to use more than one elliptic curve in the same program you only need to initialize two different contexts, for example - - var ctx1 = new CTX("NIST256"); - var ctx2 = new CTX("C25519"); - -The following is the list of all elliptic curves supported by MIRACL Core JS - - ['ED25519', 'C25519', 'C41417', 'GOLDILOCKS', 'X448', 'NIST256', 'SECP160R1', 'C1174', 'C1665', 'MDC', 'NIST384','NIST521', 'BRAINPOOL', 'ANSSI', 'HIFIVE', 'JUBJUB', 'NUMS256W', 'SECP256K1','NUMS256E', 'NUMS384W', 'NUMS384E', 'NUMS512W', 'NUMS512E', 'TWEEDLEDUM', 'TWEEDLEDEE', 'BN254', 'BN254CX', 'BLS12383', 'BLS12381', 'FP256BN', 'FP512BN', 'BLS12461', 'BN462', 'BLS24479', 'BLS48556', 'BLS48581', 'BLS48286']; - -This library supports also RSA encryption/decryption and RSA signature. The following is a quick example on how to use RSA. First initialize the context - - var ctx = new CTX("RSA2048"); - -then you can call the RSA functions as follows: - - ctx.RSA.ENCRYPT(...); - ctx.RSA.DECRYPT(...); - -The following is the list of all the RSA security level supported by _MIRACL Core JS_ - - ['RSA2048','RSA3072','RSA4096']; - -MIRACL Core JS supports also SHA256, SHA384, SHA512, SHA3, AES-GCM encryption and a secure random number generator. Those functions are contained in every context initialized with RSA or with an elliptic curve. -If you want to create a context supporting only those general functions then initialize it with no parameter as follows: - - var ctx = new CTX(); - -To use this library in Node.js import it as follows: - -```javascript -var CTX = require('./index.js'); -``` - -It is also possible to use it as a npm package. Install it locally into your project with: - - npm install --save - -As an example in React it is possible to install the library with npm and import it with - -```javascript -const ctx = require('amcl-js').CTX; -``` - -After the import the library is used as described above. - ---- - -To see some running examples, load TestECC.html or TestMPIN.html or TestHPKE.html or TestHTP.html or TestBLS.html or TestNHS.html or BenchtestALL.html into your favourite browser. -You might have to wait a few seconds for the benchmarking scripts to complete. - -For TestMPIN.html the correct PIN number is 1234. diff --git a/packages/bls-verify/src/vendor/amcl-js/src/aes.js b/packages/bls-verify/src/vendor/amcl-js/src/aes.js deleted file mode 100644 index 0ce8d189a..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/aes.js +++ /dev/null @@ -1,882 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var AES = function () { - 'use strict'; - - var AES = function () { - this.Nk = 0; - this.Nr = 0; - this.mode = 0; - this.fkey = []; - this.rkey = []; - this.f = []; - }; - - // AES constants - AES.ECB = 0; - AES.CBC = 1; - AES.CFB1 = 2; - AES.CFB2 = 3; - AES.CFB4 = 5; - AES.OFB1 = 14; - AES.OFB2 = 15; - AES.OFB4 = 17; - AES.OFB8 = 21; - AES.OFB16 = 29; - AES.CTR1 = 30; - AES.CTR2 = 31; - AES.CTR4 = 33; - AES.CTR8 = 37; - AES.CTR16 = 45; - - AES.prototype = { - /* reset cipher */ - reset: function (m, iv) { - /* reset mode, or reset iv */ - var i; - - this.mode = m; - - for (i = 0; i < 16; i++) { - this.f[i] = 0; - } - - if (this.mode != AES.ECB && iv !== null) { - for (i = 0; i < 16; i++) { - this.f[i] = iv[i]; - } - } - }, - - getreg: function () { - var ir = [], - i; - - for (i = 0; i < 16; i++) { - ir[i] = this.f[i]; - } - - return ir; - }, - - increment: function () { - var i; - - for (i = 0; i < 16; i++) { - this.f[i]++; - - if ((this.f[i] & 0xff) != 0) { - break; - } - } - }, - - /* Initialise cipher */ - init: function (m, nk, key, iv) { - /* Key=16 bytes */ - /* Key Scheduler. Create expanded encryption key */ - var CipherKey = [], - b = [], - i, - j, - k, - N, - nr; - - nk /= 4; - - if (nk != 4 && nk != 6 && nk != 8) { - return false; - } - - nr = 6 + nk; - - this.Nk = nk; - this.Nr = nr; - - this.reset(m, iv); - N = 4 * (nr + 1); - - for (i = j = 0; i < nk; i++, j += 4) { - for (k = 0; k < 4; k++) { - b[k] = key[j + k]; - } - CipherKey[i] = AES.pack(b); - } - - for (i = 0; i < nk; i++) { - this.fkey[i] = CipherKey[i]; - } - - for (j = nk, k = 0; j < N; j += nk, k++) { - this.fkey[j] = - this.fkey[j - nk] ^ AES.SubByte(AES.ROTL24(this.fkey[j - 1])) ^ (AES.rco[k] & 0xff); - - if (nk <= 6) { - for (i = 1; i < nk && i + j < N; i++) { - this.fkey[i + j] = this.fkey[i + j - nk] ^ this.fkey[i + j - 1]; - } - } else { - for (i = 1; i < 4 && i + j < N; i++) { - this.fkey[i + j] = this.fkey[i + j - nk] ^ this.fkey[i + j - 1]; - } - if (j + 4 < N) { - this.fkey[j + 4] = this.fkey[j + 4 - nk] ^ AES.SubByte(this.fkey[j + 3]); - } - for (i = 5; i < nk && i + j < N; i++) { - this.fkey[i + j] = this.fkey[i + j - nk] ^ this.fkey[i + j - 1]; - } - } - } - - /* now for the expanded decrypt key in reverse order */ - - for (j = 0; j < 4; j++) { - this.rkey[j + N - 4] = this.fkey[j]; - } - - for (i = 4; i < N - 4; i += 4) { - k = N - 4 - i; - for (j = 0; j < 4; j++) { - this.rkey[k + j] = AES.InvMixCol(this.fkey[i + j]); - } - } - - for (j = N - 4; j < N; j++) { - this.rkey[j - N + 4] = this.fkey[j]; - } - }, - - /* Encrypt a single block */ - ecb_encrypt: function (buff) { - var b = [], - p = [], - q = [], - t, - i, - j, - k; - - for (i = j = 0; i < 4; i++, j += 4) { - for (k = 0; k < 4; k++) { - b[k] = buff[j + k]; - } - p[i] = AES.pack(b); - p[i] ^= this.fkey[i]; - } - - k = 4; - - /* State alternates between p and q */ - for (i = 1; i < this.Nr; i++) { - q[0] = - this.fkey[k] ^ - AES.ftable[p[0] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[1] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[2] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[3] >>> 24) & 0xff]); - q[1] = - this.fkey[k + 1] ^ - AES.ftable[p[1] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[2] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[3] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[0] >>> 24) & 0xff]); - q[2] = - this.fkey[k + 2] ^ - AES.ftable[p[2] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[3] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[0] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[1] >>> 24) & 0xff]); - q[3] = - this.fkey[k + 3] ^ - AES.ftable[p[3] & 0xff] ^ - AES.ROTL8(AES.ftable[(p[0] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.ftable[(p[1] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.ftable[(p[2] >>> 24) & 0xff]); - - k += 4; - for (j = 0; j < 4; j++) { - t = p[j]; - p[j] = q[j]; - q[j] = t; - } - } - - /* Last Round */ - - q[0] = - this.fkey[k] ^ - (AES.fbsub[p[0] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[1] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[2] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[3] >>> 24) & 0xff] & 0xff); - - q[1] = - this.fkey[k + 1] ^ - (AES.fbsub[p[1] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[2] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[3] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[0] >>> 24) & 0xff] & 0xff); - - q[2] = - this.fkey[k + 2] ^ - (AES.fbsub[p[2] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[3] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[0] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[1] >>> 24) & 0xff] & 0xff); - - q[3] = - this.fkey[k + 3] ^ - (AES.fbsub[p[3] & 0xff] & 0xff) ^ - AES.ROTL8(AES.fbsub[(p[0] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.fbsub[(p[1] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.fbsub[(p[2] >>> 24) & 0xff] & 0xff); - - for (i = j = 0; i < 4; i++, j += 4) { - b = AES.unpack(q[i]); - for (k = 0; k < 4; k++) { - buff[j + k] = b[k]; - } - } - }, - - /* Decrypt a single block */ - ecb_decrypt: function (buff) { - var b = [], - p = [], - q = [], - t, - i, - j, - k; - - for (i = j = 0; i < 4; i++, j += 4) { - for (k = 0; k < 4; k++) { - b[k] = buff[j + k]; - } - p[i] = AES.pack(b); - p[i] ^= this.rkey[i]; - } - - k = 4; - - /* State alternates between p and q */ - for (i = 1; i < this.Nr; i++) { - q[0] = - this.rkey[k] ^ - AES.rtable[p[0] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[3] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[2] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[1] >>> 24) & 0xff]); - q[1] = - this.rkey[k + 1] ^ - AES.rtable[p[1] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[0] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[3] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[2] >>> 24) & 0xff]); - q[2] = - this.rkey[k + 2] ^ - AES.rtable[p[2] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[1] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[0] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[3] >>> 24) & 0xff]); - q[3] = - this.rkey[k + 3] ^ - AES.rtable[p[3] & 0xff] ^ - AES.ROTL8(AES.rtable[(p[2] >>> 8) & 0xff]) ^ - AES.ROTL16(AES.rtable[(p[1] >>> 16) & 0xff]) ^ - AES.ROTL24(AES.rtable[(p[0] >>> 24) & 0xff]); - - k += 4; - - for (j = 0; j < 4; j++) { - t = p[j]; - p[j] = q[j]; - q[j] = t; - } - } - - /* Last Round */ - - q[0] = - this.rkey[k] ^ - (AES.rbsub[p[0] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[3] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[2] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[1] >>> 24) & 0xff] & 0xff); - q[1] = - this.rkey[k + 1] ^ - (AES.rbsub[p[1] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[0] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[3] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[2] >>> 24) & 0xff] & 0xff); - q[2] = - this.rkey[k + 2] ^ - (AES.rbsub[p[2] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[1] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[0] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[3] >>> 24) & 0xff] & 0xff); - q[3] = - this.rkey[k + 3] ^ - (AES.rbsub[p[3] & 0xff] & 0xff) ^ - AES.ROTL8(AES.rbsub[(p[2] >>> 8) & 0xff] & 0xff) ^ - AES.ROTL16(AES.rbsub[(p[1] >>> 16) & 0xff] & 0xff) ^ - AES.ROTL24(AES.rbsub[(p[0] >>> 24) & 0xff] & 0xff); - - for (i = j = 0; i < 4; i++, j += 4) { - b = AES.unpack(q[i]); - for (k = 0; k < 4; k++) { - buff[j + k] = b[k]; - } - } - }, - - /* Encrypt using selected mode of operation */ - encrypt: function (buff) { - var st = [], - bytes, - fell_off, - j; - - // Supported Modes of Operation - - fell_off = 0; - - switch (this.mode) { - case AES.ECB: - this.ecb_encrypt(buff); - return 0; - - case AES.CBC: - for (j = 0; j < 16; j++) { - buff[j] ^= this.f[j]; - } - this.ecb_encrypt(buff); - for (j = 0; j < 16; j++) { - this.f[j] = buff[j]; - } - return 0; - - case AES.CFB1: - case AES.CFB2: - case AES.CFB4: - bytes = this.mode - AES.CFB1 + 1; - for (j = 0; j < bytes; j++) { - fell_off = (fell_off << 8) | this.f[j]; - } - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - for (j = bytes; j < 16; j++) { - this.f[j - bytes] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - buff[j] ^= st[j]; - this.f[16 - bytes + j] = buff[j]; - } - return fell_off; - - case AES.OFB1: - case AES.OFB2: - case AES.OFB4: - case AES.OFB8: - case AES.OFB16: - bytes = this.mode - AES.OFB1 + 1; - this.ecb_encrypt(this.f); - for (j = 0; j < bytes; j++) { - buff[j] ^= this.f[j]; - } - return 0; - - case AES.CTR1: - case AES.CTR2: - case AES.CTR4: - case AES.CTR8: - case AES.CTR16: - bytes = this.mode - AES.CTR1 + 1; - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - buff[j] ^= st[j]; - } - this.increment(); - return 0; - - default: - return 0; - } - }, - - /* Decrypt using selected mode of operation */ - decrypt: function (buff) { - var st = [], - bytes, - fell_off, - j; - - // Supported modes of operation - fell_off = 0; - switch (this.mode) { - case AES.ECB: - this.ecb_decrypt(buff); - return 0; - - case AES.CBC: - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - this.f[j] = buff[j]; - } - this.ecb_decrypt(buff); - for (j = 0; j < 16; j++) { - buff[j] ^= st[j]; - st[j] = 0; - } - return 0; - - case AES.CFB1: - case AES.CFB2: - case AES.CFB4: - bytes = this.mode - AES.CFB1 + 1; - for (j = 0; j < bytes; j++) { - fell_off = (fell_off << 8) | this.f[j]; - } - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - for (j = bytes; j < 16; j++) { - this.f[j - bytes] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - this.f[16 - bytes + j] = buff[j]; - buff[j] ^= st[j]; - } - return fell_off; - - case AES.OFB1: - case AES.OFB2: - case AES.OFB4: - case AES.OFB8: - case AES.OFB16: - bytes = this.mode - AES.OFB1 + 1; - this.ecb_encrypt(this.f); - for (j = 0; j < bytes; j++) { - buff[j] ^= this.f[j]; - } - return 0; - - case AES.CTR1: - case AES.CTR2: - case AES.CTR4: - case AES.CTR8: - case AES.CTR16: - bytes = this.mode - AES.CTR1 + 1; - for (j = 0; j < 16; j++) { - st[j] = this.f[j]; - } - this.ecb_encrypt(st); - for (j = 0; j < bytes; j++) { - buff[j] ^= st[j]; - } - this.increment(); - return 0; - - default: - return 0; - } - }, - - /* Clean up and delete left-overs */ - end: function () { - // clean up - var i; - - for (i = 0; i < 4 * (this.Nr + 1); i++) { - this.fkey[i] = this.rkey[i] = 0; - } - - for (i = 0; i < 16; i++) { - this.f[i] = 0; - } - }, - }; - - /* static functions */ - - AES.ROTL8 = function (x) { - return (x << 8) | (x >>> 24); - }; - - AES.ROTL16 = function (x) { - return (x << 16) | (x >>> 16); - }; - - AES.ROTL24 = function (x) { - return (x << 24) | (x >>> 8); - }; - - AES.pack = function (b) { - /* pack 4 bytes into a 32-bit Word */ - return ((b[3] & 0xff) << 24) | ((b[2] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[0] & 0xff); - }; - - AES.unpack = function (a) { - /* unpack bytes from a word */ - var b = []; - b[0] = a & 0xff; - b[1] = (a >>> 8) & 0xff; - b[2] = (a >>> 16) & 0xff; - b[3] = (a >>> 24) & 0xff; - return b; - }; - - AES.bmul = function (x, y) { - /* x.y= AntiLog(Log(x) + Log(y)) */ - var ix = x & 0xff, - iy = y & 0xff, - lx = AES.ltab[ix] & 0xff, - ly = AES.ltab[iy] & 0xff; - - if (x !== 0 && y !== 0) { - return AES.ptab[(lx + ly) % 255]; - } else { - return 0; - } - }; - - // if (x && y) - - AES.SubByte = function (a) { - var b = AES.unpack(a); - b[0] = AES.fbsub[b[0] & 0xff]; - b[1] = AES.fbsub[b[1] & 0xff]; - b[2] = AES.fbsub[b[2] & 0xff]; - b[3] = AES.fbsub[b[3] & 0xff]; - return AES.pack(b); - }; - - AES.product = function (x, y) { - /* dot product of two 4-byte arrays */ - var xb = AES.unpack(x), - yb = AES.unpack(y); - - return ( - (AES.bmul(xb[0], yb[0]) ^ - AES.bmul(xb[1], yb[1]) ^ - AES.bmul(xb[2], yb[2]) ^ - AES.bmul(xb[3], yb[3])) & - 0xff - ); - }; - - AES.InvMixCol = function (x) { - /* matrix Multiplication */ - var b = [], - y, - m; - - m = AES.pack(AES.InCo); - b[3] = AES.product(m, x); - m = AES.ROTL24(m); - b[2] = AES.product(m, x); - m = AES.ROTL24(m); - b[1] = AES.product(m, x); - m = AES.ROTL24(m); - b[0] = AES.product(m, x); - y = AES.pack(b); - - return y; - }; - - AES.CBC_IV0_ENCRYPT = function (K, M) { - /* ctx.AES CBC encryption, with Null IV and key K */ - /* Input is from an octet string M, output is to an octet string C */ - /* Input is padded as necessary to make up a full final block */ - var a = new AES(), - buff = [], - C = [], - fin, - padlen, - i, - j, - ipt, - opt; - - a.init(AES.CBC, K.length, K, null); - - ipt = opt = 0; - fin = false; - - for (;;) { - for (i = 0; i < 16; i++) { - if (ipt < M.length) { - buff[i] = M[ipt++]; - } else { - fin = true; - break; - } - } - - if (fin) { - break; - } - - a.encrypt(buff); - - for (i = 0; i < 16; i++) { - C[opt++] = buff[i]; - } - } - - /* last block, filled up to i-th index */ - - padlen = 16 - i; - for (j = i; j < 16; j++) { - buff[j] = padlen; - } - a.encrypt(buff); - for (i = 0; i < 16; i++) { - C[opt++] = buff[i]; - } - a.end(); - - return C; - }; - - AES.CBC_IV0_DECRYPT = function (K, C) { - /* padding is removed */ - var a = new AES(), - buff = [], - MM = [], - ipt = 0, - opt = 0, - M, - ch, - fin, - bad, - padlen, - i; - - a.init(AES.CBC, K.length, K, null); - - if (C.length === 0) { - return []; - } - ch = C[ipt++]; - - fin = false; - - for (;;) { - for (i = 0; i < 16; i++) { - buff[i] = ch; - if (ipt >= C.length) { - fin = true; - break; - } else { - ch = C[ipt++]; - } - } - a.decrypt(buff); - if (fin) { - break; - } - - for (i = 0; i < 16; i++) { - MM[opt++] = buff[i]; - } - } - - a.end(); - bad = false; - padlen = buff[15]; - - if (i != 15 || padlen < 1 || padlen > 16) { - bad = true; - } - - if (padlen >= 2 && padlen <= 16) { - for (i = 16 - padlen; i < 16; i++) { - if (buff[i] != padlen) { - bad = true; - } - } - } - - if (!bad) { - for (i = 0; i < 16 - padlen; i++) { - MM[opt++] = buff[i]; - } - } - - M = []; - if (bad) { - return M; - } - - for (i = 0; i < opt; i++) { - M[i] = MM[i]; - } - - return M; - }; - - AES.InCo = [0xb, 0xd, 0x9, 0xe]; /* Inverse Coefficients */ - AES.rco = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47]; - - AES.ptab = [ - 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53, 95, 225, 56, 72, 216, 115, - 149, 164, 247, 2, 6, 10, 30, 34, 102, 170, 229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, - 112, 144, 171, 230, 49, 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205, - 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136, 131, 158, 185, 208, 107, - 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154, 181, 196, 87, 249, 16, 48, 80, 240, 11, - 29, 39, 105, 187, 214, 97, 163, 254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, - 32, 96, 160, 251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65, 195, 94, - 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117, 159, 186, 213, 100, 172, 239, - 42, 126, 130, 157, 188, 223, 122, 142, 137, 128, 155, 182, 193, 88, 232, 35, 101, 175, 234, 37, - 111, 177, 200, 67, 197, 84, 252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, - 202, 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14, 18, 54, 90, 238, - 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23, 57, 75, 221, 124, 132, 151, 162, 253, - 28, 36, 108, 180, 199, 82, 246, 1, - ]; - AES.ltab = [ - 0, 255, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3, 100, 4, 224, 14, 52, 141, 129, - 239, 76, 113, 8, 200, 248, 105, 28, 193, 125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, - 114, 154, 201, 9, 120, 101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142, - 150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56, 102, 221, 253, 48, - 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16, 126, 110, 72, 195, 163, 182, 30, 66, 58, - 107, 40, 84, 250, 133, 61, 186, 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, - 167, 87, 175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232, 44, 215, - 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160, 127, 12, 246, 111, 23, 196, 73, - 236, 216, 67, 31, 45, 164, 118, 123, 183, 204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, - 170, 85, 41, 157, 151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209, - 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171, 68, 17, 146, 217, 35, 32, - 46, 137, 180, 124, 184, 38, 119, 153, 227, 165, 103, 74, 237, 222, 197, 49, 254, 24, 13, 99, - 140, 128, 192, 247, 112, 7, - ]; - AES.fbsub = [ - 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, - 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, - 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, - 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, - 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, - 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, - 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, - 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, - 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, - 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, - 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, - 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, - 176, 84, 187, 22, - ]; - AES.rbsub = [ - 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, - 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, - 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, - 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, - 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, - 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, - 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, - 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, - 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, - 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, - 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, - 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, - 99, 85, 33, 12, 125, - ]; - AES.ftable = [ - 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6, 0xdf2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591, - 0x50303060, 0x3010102, 0xa96767ce, 0x7d2b2b56, 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec, - 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa, 0x15fafaef, 0xeb5959b2, 0xc947478e, 0xbf0f0fb, - 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45, 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b, - 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c, 0x5a36366c, 0x413f3f7e, 0x2f7f7f5, 0x4fcccc83, - 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x8f1f1f9, 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a, - 0xc040408, 0x52c7c795, 0x65232346, 0x5ec3c39d, 0x28181830, 0xa1969637, 0xf05050a, 0xb59a9a2f, - 0x907070e, 0x36121224, 0x9b80801b, 0x3de2e2df, 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea, - 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34, 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b, - 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d, 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413, - 0xf55353a6, 0x68d1d1b9, 0x0, 0x2cededc1, 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6, - 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972, 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85, - 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed, 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511, - 0xcf45458a, 0x10f9f9e9, 0x6020204, 0x817f7ffe, 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b, - 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05, 0xad92923f, 0xbc9d9d21, 0x48383870, 0x4f5f5f1, - 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142, 0x30101020, 0x1affffe5, 0xef3f3fd, 0x6dd2d2bf, - 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3, 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e, - 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a, 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6, - 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3, 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b, - 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428, 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad, - 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14, 0xdb494992, 0xa06060c, 0x6c242448, 0xe45c5cb8, - 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4, 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2, - 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda, 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949, - 0xb46c6cd8, 0xfa5656ac, 0x7f4f4f3, 0x25eaeacf, 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810, - 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c, 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697, - 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e, 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f, - 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc, 0xd8484890, 0x5030306, 0x1f6f6f7, 0x120e0e1c, - 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969, 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27, - 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122, 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433, - 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9, 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5, - 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a, 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0, - 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e, 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c, - ]; - AES.rtable = [ - 0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a, 0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b, - 0x55fa3020, 0xf66d76ad, 0x9176cc88, 0x254c02f5, 0xfcd7e54f, 0xd7cb2ac5, 0x80443526, 0x8fa362b5, - 0x495ab1de, 0x671bba25, 0x980eea45, 0xe1c0fe5d, 0x2752fc3, 0x12f04c81, 0xa397468d, 0xc6f9d36b, - 0xe75f8f03, 0x959c9215, 0xeb7a6dbf, 0xda595295, 0x2d83bed4, 0xd3217458, 0x2969e049, 0x44c8c98e, - 0x6a89c275, 0x78798ef4, 0x6b3e5899, 0xdd71b927, 0xb64fe1be, 0x17ad88f0, 0x66ac20c9, 0xb43ace7d, - 0x184adf63, 0x82311ae5, 0x60335197, 0x457f5362, 0xe07764b1, 0x84ae6bbb, 0x1ca081fe, 0x942b08f9, - 0x58684870, 0x19fd458f, 0x876cde94, 0xb7f87b52, 0x23d373ab, 0xe2024b72, 0x578f1fe3, 0x2aab5566, - 0x728ebb2, 0x3c2b52f, 0x9a7bc586, 0xa50837d3, 0xf2872830, 0xb2a5bf23, 0xba6a0302, 0x5c8216ed, - 0x2b1ccf8a, 0x92b479a7, 0xf0f207f3, 0xa1e2694e, 0xcdf4da65, 0xd5be0506, 0x1f6234d1, 0x8afea6c4, - 0x9d532e34, 0xa055f3a2, 0x32e18a05, 0x75ebf6a4, 0x39ec830b, 0xaaef6040, 0x69f715e, 0x51106ebd, - 0xf98a213e, 0x3d06dd96, 0xae053edd, 0x46bde64d, 0xb58d5491, 0x55dc471, 0x6fd40604, 0xff155060, - 0x24fb9819, 0x97e9bdd6, 0xcc434089, 0x779ed967, 0xbd42e8b0, 0x888b8907, 0x385b19e7, 0xdbeec879, - 0x470a7ca1, 0xe90f427c, 0xc91e84f8, 0x0, 0x83868009, 0x48ed2b32, 0xac70111e, 0x4e725a6c, - 0xfbff0efd, 0x5638850f, 0x1ed5ae3d, 0x27392d36, 0x64d90f0a, 0x21a65c68, 0xd1545b9b, 0x3a2e3624, - 0xb1670a0c, 0xfe75793, 0xd296eeb4, 0x9e919b1b, 0x4fc5c080, 0xa220dc61, 0x694b775a, 0x161a121c, - 0xaba93e2, 0xe52aa0c0, 0x43e0223c, 0x1d171b12, 0xb0d090e, 0xadc78bf2, 0xb9a8b62d, 0xc8a91e14, - 0x8519f157, 0x4c0775af, 0xbbdd99ee, 0xfd607fa3, 0x9f2601f7, 0xbcf5725c, 0xc53b6644, 0x347efb5b, - 0x7629438b, 0xdcc623cb, 0x68fcedb6, 0x63f1e4b8, 0xcadc31d7, 0x10856342, 0x40229713, 0x2011c684, - 0x7d244a85, 0xf83dbbd2, 0x1132f9ae, 0x6da129c7, 0x4b2f9e1d, 0xf330b2dc, 0xec52860d, 0xd0e3c177, - 0x6c16b32b, 0x99b970a9, 0xfa489411, 0x2264e947, 0xc48cfca8, 0x1a3ff0a0, 0xd82c7d56, 0xef903322, - 0xc74e4987, 0xc1d138d9, 0xfea2ca8c, 0x360bd498, 0xcf81f5a6, 0x28de7aa5, 0x268eb7da, 0xa4bfad3f, - 0xe49d3a2c, 0xd927850, 0x9bcc5f6a, 0x62467e54, 0xc2138df6, 0xe8b8d890, 0x5ef7392e, 0xf5afc382, - 0xbe805d9f, 0x7c93d069, 0xa92dd56f, 0xb31225cf, 0x3b99acc8, 0xa77d1810, 0x6e639ce8, 0x7bbb3bdb, - 0x97826cd, 0xf418596e, 0x1b79aec, 0xa89a4f83, 0x656e95e6, 0x7ee6ffaa, 0x8cfbc21, 0xe6e815ef, - 0xd99be7ba, 0xce366f4a, 0xd4099fea, 0xd67cb029, 0xafb2a431, 0x31233f2a, 0x3094a5c6, 0xc066a235, - 0x37bc4e74, 0xa6ca82fc, 0xb0d090e0, 0x15d8a733, 0x4a9804f1, 0xf7daec41, 0xe50cd7f, 0x2ff69117, - 0x8dd64d76, 0x4db0ef43, 0x544daacc, 0xdf0496e4, 0xe3b5d19e, 0x1b886a4c, 0xb81f2cc1, 0x7f516546, - 0x4ea5e9d, 0x5d358c01, 0x737487fa, 0x2e410bfb, 0x5a1d67b3, 0x52d2db92, 0x335610e9, 0x1347d66d, - 0x8c61d79a, 0x7a0ca137, 0x8e14f859, 0x893c13eb, 0xee27a9ce, 0x35c961b7, 0xede51ce1, 0x3cb1477a, - 0x59dfd29c, 0x3f73f255, 0x79ce1418, 0xbf37c773, 0xeacdf753, 0x5baafd5f, 0x146f3ddf, 0x86db4478, - 0x81f3afca, 0x3ec468b9, 0x2c342438, 0x5f40a3c2, 0x72c31d16, 0xc25e2bc, 0x8b493c28, 0x41950dff, - 0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664, 0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0, - ]; - - return AES; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - AES: AES, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/big.js b/packages/bls-verify/src/vendor/amcl-js/src/big.js deleted file mode 100644 index bd318cf77..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/big.js +++ /dev/null @@ -1,1505 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE BIG number class */ -var BIG, DBIG; - -BIG = function (ctx) { - 'use strict'; - - /* General purpose Constructor */ - var BIG = function (x) { - this.w = new Array(BIG.NLEN); - - switch (typeof x) { - case 'object': - this.copy(x); - break; - - case 'number': - this.zero(); - this.w[0] = x; - break; - - default: - this.zero(); - } - }; - - BIG.CHUNK = 32; - BIG.MODBYTES = ctx.config['@NB']; - BIG.BASEBITS = ctx.config['@BASE']; - BIG.NLEN = 1 + Math.floor((8 * BIG.MODBYTES - 1) / BIG.BASEBITS); - BIG.DNLEN = 2 * BIG.NLEN; - BIG.BMASK = (1 << BIG.BASEBITS) - 1; - BIG.BIGBITS = 8 * BIG.MODBYTES; - BIG.NEXCESS = 1 << (BIG.CHUNK - BIG.BASEBITS - 1); - BIG.MODINV = Math.pow(2, -BIG.BASEBITS); - - BIG.prototype = { - /* set to zero */ - zero: function () { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* set to one */ - one: function () { - var i; - - this.w[0] = 1; - for (i = 1; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - get: function (i) { - return this.w[i]; - }, - - set: function (i, x) { - this.w[i] = x; - }, - - /* test for zero */ - iszilch: function () { - var i; - var d = 0; - for (i = 0; i < BIG.NLEN; i++) { - d |= this.w[i]; - } - return (1 & ((d - 1) >> BIG.BASEBITS)) != 0; - }, - - /* test for unity */ - isunity: function () { - var i; - var d = 0; - - for (i = 1; i < BIG.NLEN; i++) { - d |= this.w[i]; - } - - return (1 & ((d - 1) >> BIG.BASEBITS) & (((this.w[0] ^ 1) - 1) >> BIG.BASEBITS)) != 0; - }, - - /* Conditional swap of two BIGs depending on d using XOR - no branches */ - cswap: function (b, d) { - var c = d, - t, - i; - - c = ~(c - 1); - - for (i = 0; i < BIG.NLEN; i++) { - t = c & (this.w[i] ^ b.w[i]); - this.w[i] ^= t; - b.w[i] ^= t; - } - }, - - /* Conditional move of BIG depending on d using XOR - no branches */ - cmove: function (b, d) { - var c = d, - i; - - c = ~(c - 1); - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] ^= (this.w[i] ^ b.w[i]) & c; - } - }, - - /* copy from another BIG */ - copy: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = y.w[i]; - } - - return this; - }, - - /* copy from bottom half of ctx.DBIG */ - hcopy: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = y.w[i]; - } - - return this; - }, - - /* copy from ROM */ - rcopy: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = y[i]; - } - - return this; - }, - - xortop: function (x) { - this.w[BIG.NLEN - 1] ^= x; - }, - - ortop: function (x) { - this.w[BIG.NLEN - 1] |= x; - }, - - /* normalise BIG - force all digits < 2^BASEBITS */ - norm: function () { - var carry = 0, - d, - i; - - for (i = 0; i < BIG.NLEN - 1; i++) { - d = this.w[i] + carry; - this.w[i] = d & BIG.BMASK; - carry = d >> BIG.BASEBITS; - } - - this.w[BIG.NLEN - 1] = this.w[BIG.NLEN - 1] + carry; - - return this.w[BIG.NLEN - 1] >> (8 * BIG.MODBYTES) % BIG.BASEBITS; - }, - - /* quick shift right by less than a word */ - fshr: function (k) { - var r, i; - - r = this.w[0] & ((1 << k) - 1); /* shifted out part */ - - for (i = 0; i < BIG.NLEN - 1; i++) { - this.w[i] = (this.w[i] >> k) | ((this.w[i + 1] << (BIG.BASEBITS - k)) & BIG.BMASK); - } - - this.w[BIG.NLEN - 1] = this.w[BIG.NLEN - 1] >> k; - - return r; - }, - - /* General shift right by k bits */ - shr: function (k) { - var n = k % BIG.BASEBITS, - m = Math.floor(k / BIG.BASEBITS), - i; - - for (i = 0; i < BIG.NLEN - m - 1; i++) { - this.w[i] = (this.w[m + i] >> n) | ((this.w[m + i + 1] << (BIG.BASEBITS - n)) & BIG.BMASK); - } - - this.w[BIG.NLEN - m - 1] = this.w[BIG.NLEN - 1] >> n; - - for (i = BIG.NLEN - m; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* quick shift left by less than a word */ - fshl: function (k) { - var i; - - this.w[BIG.NLEN - 1] = - (this.w[BIG.NLEN - 1] << k) | (this.w[BIG.NLEN - 2] >> (BIG.BASEBITS - k)); - - for (i = BIG.NLEN - 2; i > 0; i--) { - this.w[i] = ((this.w[i] << k) & BIG.BMASK) | (this.w[i - 1] >> (BIG.BASEBITS - k)); - } - - this.w[0] = (this.w[0] << k) & BIG.BMASK; - - return ( - this.w[BIG.NLEN - 1] >> (8 * BIG.MODBYTES) % BIG.BASEBITS - ); /* return excess - only used in FF.java */ - }, - - /* General shift left by k bits */ - shl: function (k) { - var n = k % BIG.BASEBITS, - m = Math.floor(k / BIG.BASEBITS), - i; - - this.w[BIG.NLEN - 1] = this.w[BIG.NLEN - 1 - m] << n; - - if (BIG.NLEN > m + 2) { - this.w[BIG.NLEN - 1] |= this.w[BIG.NLEN - m - 2] >> (BIG.BASEBITS - n); - } - - for (i = BIG.NLEN - 2; i > m; i--) { - this.w[i] = ((this.w[i - m] << n) & BIG.BMASK) | (this.w[i - m - 1] >> (BIG.BASEBITS - n)); - } - - this.w[m] = (this.w[0] << n) & BIG.BMASK; - - for (i = 0; i < m; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* return length in bits */ - nbits: function () { - var k = BIG.NLEN - 1, - bts, - c; - - var t = new BIG(0); - t.copy(this); - t.norm(); - - while (k >= 0 && t.w[k] === 0) { - k--; - } - - if (k < 0) { - return 0; - } - - bts = BIG.BASEBITS * k; - c = t.w[k]; - - while (c !== 0) { - c = Math.floor(c / 2); - bts++; - } - - return bts; - }, - - /* convert this to string */ - toString: function () { - var s = '', - len = this.nbits(), - b, - i; - - if (len % 4 === 0) { - len = Math.floor(len / 4); - } else { - len = Math.floor(len / 4); - len++; - } - - if (len < BIG.MODBYTES * 2) { - len = BIG.MODBYTES * 2; - } - - for (i = len - 1; i >= 0; i--) { - b = new BIG(0); - b.copy(this); - b.shr(i * 4); - s += (b.w[0] & 15).toString(16); - } - - return s; - }, - - /* this+=y */ - add: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] += y.w[i]; - } - - return this; - }, - - /* this|=y */ - or: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] |= y.w[i]; - } - - return this; - }, - - /* return this+x */ - plus: function (x) { - var s = new BIG(0), - i; - - for (i = 0; i < BIG.NLEN; i++) { - s.w[i] = this.w[i] + x.w[i]; - } - - return s; - }, - - /* this+=i, where i is int */ - inc: function (i) { - this.norm(); - this.w[0] += i; - return this; - }, - - /* this-=y */ - sub: function (y) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] -= y.w[i]; - } - - return this; - }, - - /* reverse subtract this=x-this */ - rsub: function (x) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] = x.w[i] - this.w[i]; - } - - return this; - }, - - /* this-=i, where i is int */ - dec: function (i) { - this.norm(); - this.w[0] -= i; - return this; - }, - - /* return this-x */ - minus: function (x) { - var d = new BIG(0), - i; - - for (i = 0; i < BIG.NLEN; i++) { - d.w[i] = this.w[i] - x.w[i]; - } - - return d; - }, - - /* multiply by small integer */ - imul: function (c) { - var i; - - for (i = 0; i < BIG.NLEN; i++) { - this.w[i] *= c; - } - - return this; - }, - - /* convert this BIG to byte array */ - tobytearray: function (b, n) { - var c = new BIG(0), - i; - - c.copy(this); - c.norm(); - - for (i = BIG.MODBYTES - 1; i >= 0; i--) { - b[i + n] = c.w[0] & 0xff; - c.fshr(8); - } - - return this; - }, - - /* convert this to byte array */ - toBytes: function (b) { - this.tobytearray(b, 0); - }, - - /* set this[i]+=x*y+c, and return high part */ - muladd: function (x, y, c, i) { - var prod = x * y + c + this.w[i]; - this.w[i] = prod & BIG.BMASK; - return (prod - this.w[i]) * BIG.MODINV; - }, - - /* multiply by larger int */ - pmul: function (c) { - var carry = 0, - ak, - i; - - for (i = 0; i < BIG.NLEN; i++) { - ak = this.w[i]; - this.w[i] = 0; - carry = this.muladd(ak, c, carry, i); - } - - return carry; - }, - - /* multiply by still larger int - results requires a ctx.DBIG */ - pxmul: function (c) { - var m = new ctx.DBIG(0), - carry = 0, - j; - - for (j = 0; j < BIG.NLEN; j++) { - carry = m.muladd(this.w[j], c, carry, j); - } - - m.w[BIG.NLEN] = carry; - - return m; - }, - - /* divide by 3 */ - div3: function () { - var carry = 0, - ak, - base, - i; - - this.norm(); - base = 1 << BIG.BASEBITS; - - for (i = BIG.NLEN - 1; i >= 0; i--) { - ak = carry * base + this.w[i]; - this.w[i] = Math.floor(ak / 3); - carry = ak % 3; - } - return carry; - }, - - /* set x = x mod 2^m */ - mod2m: function (m) { - var i, wd, bt, msk; - - wd = Math.floor(m / BIG.BASEBITS); - bt = m % BIG.BASEBITS; - msk = (1 << bt) - 1; - this.w[wd] &= msk; - - for (i = wd + 1; i < BIG.NLEN; i++) { - this.w[i] = 0; - } - }, - - /* a=1/a mod 2^256. This is very fast! */ - invmod2m: function () { - var U = new BIG(0), - b = new BIG(0), - c = new BIG(0), - i, - t1, - t2; - - U.inc(BIG.invmod256(this.lastbits(8))); - - for (i = 8; i < BIG.BIGBITS; i <<= 1) { - U.norm(); - b.copy(this); - b.mod2m(i); - t1 = BIG.smul(U, b); - t1.shr(i); - c.copy(this); - c.shr(i); - c.mod2m(i); - - t2 = BIG.smul(U, c); - t2.mod2m(i); - t1.add(t2); - t1.norm(); - b = BIG.smul(t1, U); - t1.copy(b); - t1.mod2m(i); - - t2.one(); - t2.shl(i); - t1.rsub(t2); - t1.norm(); - t1.shl(i); - U.add(t1); - } - - U.mod2m(BIG.BIGBITS); - this.copy(U); - this.norm(); - }, - - /* reduce this mod m */ - mod: function (m1) { - var k = 0, - r = new BIG(0); - var m = new BIG(0); - m.copy(m1); - - this.norm(); - - if (BIG.comp(this, m) < 0) { - return; - } - - do { - m.fshl(1); - k++; - } while (BIG.comp(this, m) >= 0); - - while (k > 0) { - m.fshr(1); - - r.copy(this); - r.sub(m); - r.norm(); - this.cmove(r, 1 - ((r.w[BIG.NLEN - 1] >> (BIG.CHUNK - 1)) & 1)); - - k--; - } - }, - /* this/=m */ - div: function (m1) { - var k = 0, - d = 0, - e = new BIG(1), - b = new BIG(0), - r = new BIG(0); - var m = new BIG(0); - m.copy(m1); - - this.norm(); - b.copy(this); - this.zero(); - - while (BIG.comp(b, m) >= 0) { - e.fshl(1); - m.fshl(1); - k++; - } - - while (k > 0) { - m.fshr(1); - e.fshr(1); - - r.copy(b); - r.sub(m); - r.norm(); - d = 1 - ((r.w[BIG.NLEN - 1] >> (BIG.CHUNK - 1)) & 1); - b.cmove(r, d); - r.copy(this); - r.add(e); - r.norm(); - this.cmove(r, d); - - k--; - } - }, - /* return parity of this */ - parity: function () { - return this.w[0] % 2; - }, - - /* return n-th bit of this */ - bit: function (n) { - if ((this.w[Math.floor(n / BIG.BASEBITS)] & (1 << n % BIG.BASEBITS)) > 0) { - return 1; - } else { - return 0; - } - }, - - /* return last n bits of this */ - lastbits: function (n) { - var msk = (1 << n) - 1; - this.norm(); - return this.w[0] & msk; - }, - - isok: function () { - var ok = true, - i; - - for (i = 0; i < BIG.NLEN; i++) { - if (this.w[i] >> BIG.BASEBITS != 0) { - ok = false; - } - } - - return ok; - }, - - /* Jacobi Symbol (this/p). Returns 0, 1 or -1 */ - jacobi: function (p) { - var m = 0, - t = new BIG(0), - x = new BIG(0), - n = new BIG(0), - zilch = new BIG(0), - one = new BIG(1), - n8, - k; - - if (p.parity() === 0 || BIG.comp(this, zilch) === 0 || BIG.comp(p, one) <= 0) { - return 0; - } - - this.norm(); - x.copy(this); - n.copy(p); - x.mod(p); - - while (BIG.comp(n, one) > 0) { - if (BIG.comp(x, zilch) === 0) { - return 0; - } - - n8 = n.lastbits(3); - k = 0; - - while (x.parity() === 0) { - k++; - x.shr(1); - } - - if (k % 2 == 1) { - m += (n8 * n8 - 1) / 8; - } - - m += ((n8 - 1) * (x.lastbits(2) - 1)) / 4; - t.copy(n); - t.mod(x); - n.copy(x); - x.copy(t); - m %= 2; - } - - if (m === 0) { - return 1; - } else { - return -1; - } - }, - - /* this=1/this mod p. Binary method */ - invmodp: function (p) { - if (this.iszilch()) { - return; - } - var u = new BIG(0), - v = new BIG(0), - x1 = new BIG(1), - x2 = new BIG(0), - t = new BIG(0), - one = new BIG(1); - - this.mod(p); - u.copy(this); - v.copy(p); - - while (BIG.comp(u, one) !== 0 && BIG.comp(v, one) !== 0) { - while (u.parity() === 0) { - u.fshr(1); - t.copy(x1); - t.add(p); - x1.cmove(t, x1.parity()); - x1.norm(); - x1.fshr(1); - } - while (v.parity() === 0) { - v.fshr(1); - t.copy(x2); - t.add(p); - x2.cmove(t, x2.parity()); - x2.norm(); - x2.fshr(1); - } - if (BIG.comp(u, v) >= 0) { - u.sub(v); - u.norm(); - t.copy(x1); - t.add(p); - x1.cmove(t, (BIG.comp(x1, x2) >> 1) & 1); - x1.sub(x2); - x1.norm(); - } else { - v.sub(u); - v.norm(); - t.copy(x2); - t.add(p); - x2.cmove(t, (BIG.comp(x2, x1) >> 1) & 1); - x2.sub(x1); - x2.norm(); - } - } - - this.copy(x1); - this.cmove(x2, BIG.comp(u, one) & 1); - }, - - /* return this^e mod m */ - powmod: function (e1, m) { - var a = new BIG(1), - z = new BIG(0), - s = new BIG(0), - bt; - - var e = new BIG(0); - e.copy(e1); - this.norm(); - e.norm(); - z.copy(e); - s.copy(this); - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - a = BIG.modmul(a, s, m); - } - - if (z.iszilch()) { - break; - } - - s = BIG.modsqr(s, m); - } - - return a; - }, - }; - - BIG.ssn = function (r, a, m) { - var n = BIG.NLEN - 1; - m.w[0] = (m.w[0] >> 1) | ((m.w[1] << (BIG.BASEBITS - 1)) & BIG.BMASK); - r.w[0] = a.w[0] - m.w[0]; - var carry = r.w[0] >> BIG.BASEBITS; - r.w[0] &= BIG.BMASK; - for (var i = 1; i < n; i++) { - m.w[i] = (m.w[i] >> 1) | ((m.w[i + 1] << (BIG.BASEBITS - 1)) & BIG.BMASK); - r.w[i] = a.w[i] - m.w[i] + carry; - carry = r.w[i] >> BIG.BASEBITS; - r.w[i] &= BIG.BMASK; - } - m.w[n] >>= 1; - r.w[n] = a.w[n] - m.w[n] + carry; - return (r.w[n] >> (BIG.CHUNK - 1)) & 1; - }; - - /* convert from byte array to BIG */ - BIG.frombytearray = function (b, n) { - var m = new BIG(0), - i; - - for (i = 0; i < BIG.MODBYTES; i++) { - m.fshl(8); - m.w[0] += b[i + n] & 0xff; - } - - return m; - }; - - BIG.fromBytes = function (b) { - return BIG.frombytearray(b, 0); - }; - - /* return a*b where product fits a BIG */ - BIG.smul = function (a, b) { - var c = new BIG(0), - carry, - i, - j; - - for (i = 0; i < BIG.NLEN; i++) { - carry = 0; - - for (j = 0; j < BIG.NLEN; j++) { - if (i + j < BIG.NLEN) { - carry = c.muladd(a.w[i], b.w[j], carry, i + j); - } - } - } - - return c; - }; - - /* Compare a and b, return 0 if a==b, -1 if ab. Inputs must be normalised */ - BIG.comp = function (a, b) { - var i; - var gt = 0; - var eq = 1; - - for (i = BIG.NLEN - 1; i >= 0; i--) { - gt |= ((b.w[i] - a.w[i]) >> BIG.BASEBITS) & eq; - eq &= ((b.w[i] ^ a.w[i]) - 1) >> BIG.BASEBITS; - } - - return gt + gt + eq - 1; - }; - - /* get 8*MODBYTES size random number */ - BIG.random = function (rng) { - var m = new BIG(0), - j = 0, - r = 0, - i, - b; - - /* generate random BIG */ - for (i = 0; i < 8 * BIG.MODBYTES; i++) { - if (j === 0) { - r = rng.getByte(); - } else { - r >>= 1; - } - - b = r & 1; - m.shl(1); - m.w[0] += b; // m.inc(b); - j++; - j &= 7; - } - return m; - }; - - /* Create random BIG in portable way, one bit at a time */ - BIG.randomnum = function (q, rng) { - var d = new ctx.DBIG(0), - j = 0, - r = 0, - i, - b, - m; - - for (i = 0; i < 2 * q.nbits(); i++) { - if (j === 0) { - r = rng.getByte(); - } else { - r >>= 1; - } - - b = r & 1; - d.shl(1); - d.w[0] += b; - j++; - j &= 7; - } - - m = d.mod(q); - - return m; - }; - - BIG.randtrunc = function (q, trunc, rng) { - var m = BIG.randomnum(q, rng); - if (q.nbits() > trunc) m.mod2m(trunc); - return m; - }; - - /* return a*b as ctx.DBIG */ - BIG.mul = function (a, b) { - var c = new ctx.DBIG(0), - d = new Array(BIG.NLEN), //[], - n, - s, - t, - i, - k, - co; - - for (i = 0; i < BIG.NLEN; i++) { - d[i] = a.w[i] * b.w[i]; - } - - s = d[0]; - t = s; - c.w[0] = t; - - for (k = 1; k < BIG.NLEN; k++) { - s += d[k]; - t = s; - for (i = k; i >= 1 + Math.floor(k / 2); i--) { - t += (a.w[i] - a.w[k - i]) * (b.w[k - i] - b.w[i]); - } - c.w[k] = t; - } - for (k = BIG.NLEN; k < 2 * BIG.NLEN - 1; k++) { - s -= d[k - BIG.NLEN]; - t = s; - for (i = BIG.NLEN - 1; i >= 1 + Math.floor(k / 2); i--) { - t += (a.w[i] - a.w[k - i]) * (b.w[k - i] - b.w[i]); - } - c.w[k] = t; - } - - co = 0; - for (i = 0; i < BIG.DNLEN - 1; i++) { - n = c.w[i] + co; - c.w[i] = n & BIG.BMASK; - co = (n - c.w[i]) * BIG.MODINV; - } - c.w[BIG.DNLEN - 1] = co; - - return c; - }; - - /* return a^2 as ctx.DBIG */ - BIG.sqr = function (a) { - var c = new ctx.DBIG(0), - n, - t, - j, - i, - co; - - c.w[0] = a.w[0] * a.w[0]; - - for (j = 1; j < BIG.NLEN - 1; ) { - t = a.w[j] * a.w[0]; - for (i = 1; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - c.w[j] = t; - j++; - t = a.w[j] * a.w[0]; - for (i = 1; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - t += a.w[j >> 1] * a.w[j >> 1]; - c.w[j] = t; - j++; - } - - for (j = BIG.NLEN - 1 + (BIG.NLEN % 2); j < BIG.DNLEN - 3; ) { - t = a.w[BIG.NLEN - 1] * a.w[j - BIG.NLEN + 1]; - for (i = j - BIG.NLEN + 2; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - c.w[j] = t; - j++; - t = a.w[BIG.NLEN - 1] * a.w[j - BIG.NLEN + 1]; - for (i = j - BIG.NLEN + 2; i < (j + 1) >> 1; i++) { - t += a.w[j - i] * a.w[i]; - } - t += t; - t += a.w[j >> 1] * a.w[j >> 1]; - c.w[j] = t; - j++; - } - - t = a.w[BIG.NLEN - 2] * a.w[BIG.NLEN - 1]; - t += t; - c.w[BIG.DNLEN - 3] = t; - - t = a.w[BIG.NLEN - 1] * a.w[BIG.NLEN - 1]; - c.w[BIG.DNLEN - 2] = t; - - co = 0; - for (i = 0; i < BIG.DNLEN - 1; i++) { - n = c.w[i] + co; - c.w[i] = n & BIG.BMASK; - co = (n - c.w[i]) * BIG.MODINV; - } - c.w[BIG.DNLEN - 1] = co; - - return c; - }; - - BIG.monty = function (m, nd, d) { - var b = new BIG(0), - v = new Array(BIG.NLEN), - dd = new Array(BIG.NLEN), - s, - c, - t, - i, - k; - - t = d.w[0]; - v[0] = ((t & BIG.BMASK) * nd) & BIG.BMASK; - t += v[0] * m.w[0]; - c = d.w[1] + t * BIG.MODINV; - s = 0; - - for (k = 1; k < BIG.NLEN; k++) { - t = c + s + v[0] * m.w[k]; - for (i = k - 1; i > Math.floor(k / 2); i--) { - t += (v[k - i] - v[i]) * (m.w[i] - m.w[k - i]); - } - v[k] = ((t & BIG.BMASK) * nd) & BIG.BMASK; - t += v[k] * m.w[0]; - c = t * BIG.MODINV + d.w[k + 1]; - - dd[k] = v[k] * m.w[k]; - s += dd[k]; - } - - for (k = BIG.NLEN; k < 2 * BIG.NLEN - 1; k++) { - t = c + s; - for (i = BIG.NLEN - 1; i >= 1 + Math.floor(k / 2); i--) { - t += (v[k - i] - v[i]) * (m.w[i] - m.w[k - i]); - } - b.w[k - BIG.NLEN] = t & BIG.BMASK; - c = (t - b.w[k - BIG.NLEN]) * BIG.MODINV + d.w[k + 1]; - - s -= dd[k - BIG.NLEN + 1]; - } - - b.w[BIG.NLEN - 1] = c & BIG.BMASK; - - return b; - }; - - /* return a*b mod m */ - BIG.modmul = function (a1, b1, m) { - var d; - var a = new BIG(0); - a.copy(a1); - var b = new BIG(0); - b.copy(b1); - a.mod(m); - b.mod(m); - d = BIG.mul(a, b); - - return d.mod(m); - }; - - /* return a^2 mod m */ - BIG.modsqr = function (a1, m) { - var d; - var a = new BIG(0); - a.copy(a1); - a.mod(m); - d = BIG.sqr(a); - - return d.mod(m); - }; - - /* return -a mod m */ - BIG.modneg = function (a1, m) { - var a = new BIG(0); - a.copy(a1); - a.mod(m); - a.rsub(m); - a.mod(m); - return a; - }; - - /* return a+b mod m */ - BIG.modadd = function (a1, b1, m) { - var a = new BIG(0); - a.copy(a1); - var b = new BIG(0); - b.copy(b1); - a.mod(m); - b.mod(m); - a.add(b); - a.norm(); - a.mod(m); - return a; - }; - - /* Arazi and Qi inversion mod 256 */ - BIG.invmod256 = function (a) { - var U, t1, t2, b, c; - - t1 = 0; - c = (a >> 1) & 1; - t1 += c; - t1 &= 1; - t1 = 2 - t1; - t1 <<= 1; - U = t1 + 1; - - // i=2 - b = a & 3; - t1 = U * b; - t1 >>= 2; - c = (a >> 2) & 3; - t2 = (U * c) & 3; - t1 += t2; - t1 *= U; - t1 &= 3; - t1 = 4 - t1; - t1 <<= 2; - U += t1; - - // i=4 - b = a & 15; - t1 = U * b; - t1 >>= 4; - c = (a >> 4) & 15; - t2 = (U * c) & 15; - t1 += t2; - t1 *= U; - t1 &= 15; - t1 = 16 - t1; - t1 <<= 4; - U += t1; - - return U; - }; - return BIG; -}; - -/* CORE double length DBIG number class */ -DBIG = function (ctx) { - 'use strict'; - - /* constructor */ - var DBIG = function (x) { - this.w = new Array(BIG.DNLEN); - this.zero(); - this.w[0] = x; - }; - - DBIG.prototype = { - /* set this=0 */ - zero: function () { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] = 0; - } - return this; - }, - - /* set this=b */ - copy: function (b) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] = b.w[i]; - } - return this; - }, - - /* copy from ctx.BIG */ - hcopy: function (b) { - var i; - - for (i = 0; i < ctx.BIG.NLEN; i++) { - this.w[i] = b.w[i]; - } - - for (i = ctx.BIG.NLEN; i < ctx.BIG.DNLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - ucopy: function (b) { - var i; - - for (i = 0; i < ctx.BIG.NLEN; i++) { - this.w[i] = 0; - } - - for (i = ctx.BIG.NLEN; i < ctx.BIG.DNLEN; i++) { - this.w[i] = b.w[i - ctx.BIG.NLEN]; - } - - return this; - }, - - /* normalise this */ - norm: function () { - var carry = 0, - d, - i; - - for (i = 0; i < ctx.BIG.DNLEN - 1; i++) { - d = this.w[i] + carry; - this.w[i] = d & ctx.BIG.BMASK; - carry = d >> ctx.BIG.BASEBITS; - } - this.w[ctx.BIG.DNLEN - 1] = this.w[ctx.BIG.DNLEN - 1] + carry; - - return this; - }, - - /* set this[i]+=x*y+c, and return high part */ - muladd: function (x, y, c, i) { - var prod = x * y + c + this.w[i]; - this.w[i] = prod & ctx.BIG.BMASK; - return (prod - this.w[i]) * ctx.BIG.MODINV; - }, - - /* shift this right by k bits */ - shr: function (k) { - var n = k % ctx.BIG.BASEBITS, - m = Math.floor(k / ctx.BIG.BASEBITS), - i; - - for (i = 0; i < ctx.BIG.DNLEN - m - 1; i++) { - this.w[i] = - (this.w[m + i] >> n) | ((this.w[m + i + 1] << (ctx.BIG.BASEBITS - n)) & ctx.BIG.BMASK); - } - - this.w[ctx.BIG.DNLEN - m - 1] = this.w[ctx.BIG.DNLEN - 1] >> n; - - for (i = ctx.BIG.DNLEN - m; i < ctx.BIG.DNLEN; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* shift this left by k bits */ - shl: function (k) { - var n = k % ctx.BIG.BASEBITS, - m = Math.floor(k / ctx.BIG.BASEBITS), - i; - - this.w[ctx.BIG.DNLEN - 1] = - (this.w[ctx.BIG.DNLEN - 1 - m] << n) | - (this.w[ctx.BIG.DNLEN - m - 2] >> (ctx.BIG.BASEBITS - n)); - - for (i = ctx.BIG.DNLEN - 2; i > m; i--) { - this.w[i] = - ((this.w[i - m] << n) & ctx.BIG.BMASK) | (this.w[i - m - 1] >> (ctx.BIG.BASEBITS - n)); - } - - this.w[m] = (this.w[0] << n) & ctx.BIG.BMASK; - - for (i = 0; i < m; i++) { - this.w[i] = 0; - } - - return this; - }, - - /* Conditional move of ctx.BIG depending on d using XOR - no branches */ - cmove: function (b, d) { - var c = d, - i; - - c = ~(c - 1); - - for (i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] ^= (this.w[i] ^ b.w[i]) & c; - } - }, - - /* this+=x */ - add: function (x) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] += x.w[i]; - } - }, - - /* this-=x */ - sub: function (x) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] -= x.w[i]; - } - }, - - rsub: function (x) { - for (var i = 0; i < ctx.BIG.DNLEN; i++) { - this.w[i] = x.w[i] - this.w[i]; - } - }, - - /* return number of bits in this */ - nbits: function () { - var k = ctx.BIG.DNLEN - 1, - bts, - c; - - var t = new DBIG(0); - t.copy(this); - t.norm(); - - while (k >= 0 && t.w[k] === 0) { - k--; - } - - if (k < 0) { - return 0; - } - - bts = ctx.BIG.BASEBITS * k; - c = t.w[k]; - - while (c !== 0) { - c = Math.floor(c / 2); - bts++; - } - - return bts; - }, - - /* convert this to string */ - toString: function () { - var s = '', - len = this.nbits(), - b, - i; - - if (len % 4 === 0) { - len = Math.floor(len / 4); - } else { - len = Math.floor(len / 4); - len++; - } - - for (i = len - 1; i >= 0; i--) { - b = new DBIG(0); - b.copy(this); - b.shr(i * 4); - s += (b.w[0] & 15).toString(16); - } - - return s; - }, - - /* reduces this DBIG mod a ctx.BIG, and returns the ctx.BIG */ - mod: function (c) { - var k = 0, - m = new DBIG(0), - dr = new DBIG(0), - r = new ctx.BIG(0); - - this.norm(); - m.hcopy(c); - r.hcopy(this); - - if (DBIG.comp(this, m) < 0) { - return r; - } - - do { - m.shl(1); - k++; - } while (DBIG.comp(this, m) >= 0); - - while (k > 0) { - m.shr(1); - - dr.copy(this); - dr.sub(m); - dr.norm(); - this.cmove(dr, 1 - ((dr.w[ctx.BIG.DNLEN - 1] >> (ctx.BIG.CHUNK - 1)) & 1)); - k--; - } - - r.hcopy(this); - - return r; - }, - - /* this/=c */ - div: function (c) { - var d = 0, - k = 0, - m = new DBIG(0), - dr = new DBIG(0), - r = new ctx.BIG(0), - a = new ctx.BIG(0), - e = new ctx.BIG(1); - - m.hcopy(c); - this.norm(); - - while (DBIG.comp(this, m) >= 0) { - e.fshl(1); - m.shl(1); - k++; - } - - while (k > 0) { - m.shr(1); - e.shr(1); - - dr.copy(this); - dr.sub(m); - dr.norm(); - d = 1 - ((dr.w[ctx.BIG.DNLEN - 1] >> (ctx.BIG.CHUNK - 1)) & 1); - this.cmove(dr, d); - r.copy(a); - r.add(e); - r.norm(); - a.cmove(r, d); - - k--; - } - return a; - }, - - /* split this DBIG at position n, return higher half, keep lower half */ - split: function (n) { - var t = new ctx.BIG(0), - m = n % ctx.BIG.BASEBITS, - carry = this.w[ctx.BIG.DNLEN - 1] << (ctx.BIG.BASEBITS - m), - nw, - i; - - for (i = ctx.BIG.DNLEN - 2; i >= ctx.BIG.NLEN - 1; i--) { - nw = (this.w[i] >> m) | carry; - carry = (this.w[i] << (ctx.BIG.BASEBITS - m)) & ctx.BIG.BMASK; - t.w[i - ctx.BIG.NLEN + 1] = nw; - } - - this.w[ctx.BIG.NLEN - 1] &= (1 << m) - 1; - - return t; - }, - }; - - /* Compare a and b, return 0 if a==b, -1 if ab. Inputs must be normalised */ - DBIG.comp = function (a, b) { - var i; - var gt = 0; - var eq = 1; - for (i = ctx.BIG.DNLEN - 1; i >= 0; i--) { - gt |= ((b.w[i] - a.w[i]) >> ctx.BIG.BASEBITS) & eq; - eq &= ((b.w[i] ^ a.w[i]) - 1) >> ctx.BIG.BASEBITS; - } - - return gt + gt + eq - 1; - }; - - /* convert from byte array to DBIG */ - DBIG.fromBytes = function (b) { - var m = new DBIG(0), - i; - - for (i = 0; i < b.length; i++) { - m.shl(8); - m.w[0] += b[i] & 0xff; - } - - return m; - }; - - return DBIG; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BIG: BIG, - DBIG: DBIG, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/bls.js b/packages/bls-verify/src/vendor/amcl-js/src/bls.js deleted file mode 100644 index 1af3affb8..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/bls.js +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Boneh-Lynn-Shacham signature 128-bit API Functions */ - -var BLS = function (ctx) { - 'use strict'; - - var BLS = { - BLS_OK: 0, - BLS_FAIL: -1, - - BFS: ctx.BIG.MODBYTES, - BGS: ctx.BIG.MODBYTES, - G2_TAB: [], - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - return b; - }, - - init: function () { - var G = ctx.ECP2.generator(); - if (G.is_infinity()) return this.BLS_FAIL; - this.G2_TAB = ctx.PAIR.precomp(G); - return this.BLS_OK; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - /* output u \in F_p */ - hash_to_field: function (hash, hlen, DST, M, ctr) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var L = this.ceil(q.nbits() + ctx.ECP.AESKEY * 8, 8); - var u = []; - var fd = []; - var OKM = ctx.HMAC.XMD_Expand(hash, hlen, L * ctr, DST, M); - - for (var i = 0; i < ctr; i++) { - for (var j = 0; j < L; j++) fd[j] = OKM[i * L + j]; - u[i] = new ctx.FP(ctx.DBIG.fromBytes(fd).mod(q)); - } - return u; - }, - - /* hash a message to an ECP point, using SHA2 */ - bls_hash_to_point: function (M) { - var dst = 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_'; - var u = this.hash_to_field(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, this.asciitobytes(dst), M, 2); - - var P = ctx.ECP.map2point(u[0]); - var P1 = ctx.ECP.map2point(u[1]); - P.add(P1); - P.cfp(); - P.affine(); - return P; - }, - - /* generate key pair, private key S, public key W */ - KeyPairGenerate: function (IKM, S, W) { - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var L = this.ceil(3 * this.ceil(r.nbits(), 8), 2); - var G = ctx.ECP2.generator(); - var LEN = ctx.HMAC.inttobytes(L, 2); - var AIKM = []; - for (var i = 0; i < IKM.length; i++) AIKM[i] = IKM[i]; - AIKM[IKM.length] = 0; - - var salt = 'BLS-SIG-KEYGEN-SALT-'; - var PRK = ctx.HMAC.HKDF_Extract( - ctx.HMAC.MC_SHA2, - ctx.ECP.HASH_TYPE, - this.asciitobytes(salt), - AIKM, - ); - var OKM = ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LEN); - - var dx = ctx.DBIG.fromBytes(OKM); - var s = dx.mod(r); - s.toBytes(S); - // SkToPk - G = ctx.PAIR.G2mul(G, s); - G.toBytes(W, true); - return this.BLS_OK; - }, - - /* Sign message m using private key S to produce signature SIG */ - - core_sign: function (SIG, M, S) { - var D = this.bls_hash_to_point(M); - var s = ctx.BIG.fromBytes(S); - D = ctx.PAIR.G1mul(D, s); - D.toBytes(SIG, true); - return this.BLS_OK; - }, - - /* Verify signature given message m, the signature SIG, and the public key W */ - - core_verify: function (SIG, M, W) { - var HM = this.bls_hash_to_point(M); - - var D = ctx.ECP.fromBytes(SIG); - if (!ctx.PAIR.G1member(D)) return this.BLS_FAIL; - D.neg(); - - var PK = ctx.ECP2.fromBytes(W); - if (!ctx.PAIR.G2member(PK)) return this.BLS_FAIL; - - // Use new multi-pairing mechanism - //var r = ctx.PAIR.initmp(); - //ctx.PAIR.another_pc(r, this.G2_TAB, D); - // ctx.PAIR.another(r,G,D); - //ctx.PAIR.another(r, PK, HM); - //var v = ctx.PAIR.miller(r); - - //.. or alternatively - var G = ctx.ECP2.generator(); - var v = ctx.PAIR.ate2(G, D, PK, HM); - - v = ctx.PAIR.fexp(v); - if (v.isunity()) return this.BLS_OK; - return this.BLS_FAIL; - }, - }; - - return BLS; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BLS: BLS, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/bls192.js b/packages/bls-verify/src/vendor/amcl-js/src/bls192.js deleted file mode 100644 index 61b26ca57..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/bls192.js +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Boneh-Lynn-Shacham signature 192-bit API Functions */ - -var BLS192 = function (ctx) { - 'use strict'; - - var BLS192 = { - BLS_OK: 0, - BLS_FAIL: -1, - - BFS: ctx.BIG.MODBYTES, - BGS: ctx.BIG.MODBYTES, - G2_TAB: [], - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - init: function () { - var G = ctx.ECP4.generator(); - if (G.is_infinity()) return this.BLS_FAIL; - this.G2_TAB = ctx.PAIR4.precomp(G); - return this.BLS_OK; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - /* output u \in F_p */ - hash_to_field: function (hash, hlen, DST, M, ctr) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var L = this.ceil(q.nbits() + ctx.ECP.AESKEY * 8, 8); - var u = []; - var fd = []; - var OKM = ctx.HMAC.XMD_Expand(hash, hlen, L * ctr, DST, M); - - for (var i = 0; i < ctr; i++) { - for (var j = 0; j < L; j++) fd[j] = OKM[i * L + j]; - u[i] = new ctx.FP(ctx.DBIG.fromBytes(fd).mod(q)); - } - return u; - }, - - /* hash a message to an ECP point, using SHA2 */ - bls_hash_to_point: function (M) { - var dst = 'BLS_SIG_ZZZG1_XMD:SHA-384_SVDW_RO_NUL_'; - var u = this.hash_to_field(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, this.asciitobytes(dst), M, 2); - - var P = ctx.ECP.map2point(u[0]); - var P1 = ctx.ECP.map2point(u[1]); - P.add(P1); - P.cfp(); - P.affine(); - return P; - }, - - /* generate key pair, private key S, public key W */ - KeyPairGenerate: function (IKM, S, W) { - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var L = this.ceil(3 * this.ceil(r.nbits(), 8), 2); - var G = ctx.ECP4.generator(); - var LEN = ctx.HMAC.inttobytes(L, 2); - var AIKM = []; - for (var i = 0; i < IKM.length; i++) AIKM[i] = IKM[i]; - AIKM[IKM.length] = 0; - - var salt = 'BLS-SIG-KEYGEN-SALT-'; - var PRK = ctx.HMAC.HKDF_Extract( - ctx.HMAC.MC_SHA2, - ctx.ECP.HASH_TYPE, - this.asciitobytes(salt), - AIKM, - ); - var OKM = ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LEN); - - var dx = ctx.DBIG.fromBytes(OKM); - var s = dx.mod(r); - s.toBytes(S); - // SkToPk - G = ctx.PAIR4.G2mul(G, s); - G.toBytes(W, true); - return this.BLS_OK; - }, - - /* Sign message m using private key S to produce signature SIG */ - - core_sign: function (SIG, M, S) { - var D = this.bls_hash_to_point(M); - var s = ctx.BIG.fromBytes(S); - D = ctx.PAIR4.G1mul(D, s); - D.toBytes(SIG, true); - return this.BLS_OK; - }, - - /* Verify signature given message m, the signature SIG, and the public key W */ - - core_verify: function (SIG, M, W) { - var HM = this.bls_hash_to_point(M); - - var D = ctx.ECP.fromBytes(SIG); - if (!ctx.PAIR4.G1member(D)) return this.BLS_FAIL; - D.neg(); - - var PK = ctx.ECP4.fromBytes(W); - if (!ctx.PAIR4.G2member(PK)) return this.BLS_FAIL; - - // Use new multi-pairing mechanism - var r = ctx.PAIR4.initmp(); - // ctx.PAIR4.another(r,G,D); - ctx.PAIR4.another_pc(r, this.G2_TAB, D); - ctx.PAIR4.another(r, PK, HM); - var v = ctx.PAIR4.miller(r); - - //.. or alternatively - // var v=ctx.PAIR4.ate2(G,D,PK,HM); - v = ctx.PAIR4.fexp(v); - if (v.isunity()) return this.BLS_OK; - return this.BLS_FAIL; - }, - }; - - return BLS192; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BLS192: BLS192, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/bls256.js b/packages/bls-verify/src/vendor/amcl-js/src/bls256.js deleted file mode 100644 index dd4077eba..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/bls256.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Boneh-Lynn-Shacham signature 256-bit API Functions */ - -var BLS256 = function (ctx) { - 'use strict'; - - var BLS256 = { - BLS_OK: 0, - BLS_FAIL: -1, - - BFS: ctx.BIG.MODBYTES, - BGS: ctx.BIG.MODBYTES, - G2_TAB: [], - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - init: function () { - var G = ctx.ECP8.generator(); - if (G.is_infinity()) return this.BLS_FAIL; - this.G2_TAB = ctx.PAIR8.precomp(G); - return this.BLS_OK; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - /* output u \in F_p */ - hash_to_field: function (hash, hlen, DST, M, ctr) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var L = this.ceil(q.nbits() + ctx.ECP.AESKEY * 8, 8); - var u = []; - var fd = []; - var OKM = ctx.HMAC.XMD_Expand(hash, hlen, L * ctr, DST, M); - - for (var i = 0; i < ctr; i++) { - for (var j = 0; j < L; j++) fd[j] = OKM[i * L + j]; - u[i] = new ctx.FP(ctx.DBIG.fromBytes(fd).mod(q)); - } - return u; - }, - - /* hash a message to an ECP point, using SHA2 */ - bls_hash_to_point: function (M) { - var dst = 'BLS_SIG_ZZZG1_XMD:SHA-512_SVDW_RO_NUL_'; - var u = this.hash_to_field(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, this.asciitobytes(dst), M, 2); - - var P = ctx.ECP.map2point(u[0]); - var P1 = ctx.ECP.map2point(u[1]); - P.add(P1); - P.cfp(); - P.affine(); - return P; - }, - - /* generate key pair, private key S, public key W */ - KeyPairGenerate: function (IKM, S, W) { - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var L = this.ceil(3 * this.ceil(r.nbits(), 8), 2); - var G = ctx.ECP8.generator(); - var LEN = ctx.HMAC.inttobytes(L, 2); - var AIKM = []; - for (var i = 0; i < IKM.length; i++) AIKM[i] = IKM[i]; - AIKM[IKM.length] = 0; - - var salt = 'BLS-SIG-KEYGEN-SALT-'; - var PRK = ctx.HMAC.HKDF_Extract( - ctx.HMAC.MC_SHA2, - ctx.ECP.HASH_TYPE, - this.asciitobytes(salt), - AIKM, - ); - var OKM = ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LEN); - - var dx = ctx.DBIG.fromBytes(OKM); - var s = dx.mod(r); - s.toBytes(S); - // SkToPk - G = ctx.PAIR8.G2mul(G, s); - G.toBytes(W, true); - return this.BLS_OK; - }, - - /* Sign message m using private key S to produce signature SIG */ - - core_sign: function (SIG, M, S) { - var D = this.bls_hash_to_point(M); - var s = ctx.BIG.fromBytes(S); - D = ctx.PAIR8.G1mul(D, s); - D.toBytes(SIG, true); - return this.BLS_OK; - }, - - /* Verify signature given message m, the signature SIG, and the public key W */ - - core_verify: function (SIG, M, W) { - var HM = this.bls_hash_to_point(M); - - var D = ctx.ECP.fromBytes(SIG); - if (!ctx.PAIR8.G1member(D)) return this.BLS_FAIL; - D.neg(); - - var PK = ctx.ECP8.fromBytes(W); - if (!ctx.PAIR8.G2member(PK)) return this.BLS_FAIL; - - //if (!ctx.PAIR8.G2member(PK)) alert("Not a member"); - //alert("PK= "+PK.toString()); - - // Use new multi-pairing mechanism - var r = ctx.PAIR8.initmp(); - // ctx.PAIR8.another(r,G,D); - ctx.PAIR8.another_pc(r, this.G2_TAB, D); - ctx.PAIR8.another(r, PK, HM); - var v = ctx.PAIR8.miller(r); - - //.. or alternatively - //var G = ctx.ECP8.generator(); - //var v=ctx.PAIR8.ate2(G,D,PK,HM); - - v = ctx.PAIR8.fexp(v); - if (v.isunity()) return this.BLS_OK; - return this.BLS_FAIL; - }, - }; - - return BLS256; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - BLS256: BLS256, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ctx.js b/packages/bls-verify/src/vendor/amcl-js/src/ctx.js deleted file mode 100644 index 5a2a51636..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ctx.js +++ /dev/null @@ -1,1203 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var CTX = function (input_parameter) { - 'use strict'; - - var ctx = this, - CTXLIST, - prepareModule; - - CTXLIST = { - ED25519: { - 'BITS': '256', - 'FIELD': '25519', - 'CURVE': 'ED25519', - '@NB': 32 /* Number of bytes in Modulus */, - '@BASE': 24 /* Number base as power of 2 */, - '@NBT': 255 /* Number of bits in modulus */, - '@M8': 2 /* Modulus mod 8 */, - '@RZ': 1 /* Hash-to-point Z value */, - '@RZ2A': 0 /* Hash-to-point G2 Z value */, - '@RZ2B': 0 /* Hash-to-point G2 Z value */, - '@HC': 0 /* Isogeny degree G1 */, - '@HC2': 0 /* Isogeny degree G2 */, - '@MT': 1 /* Modulus Type (pseudo-mersenne,...) */, - '@QI': 0 /* Fp2 QNR */, - '@TW': 0 /* Tower type */, - '@CT': 1 /* Curve Type (Weierstrass,...) */, - '@CA': -1 /* Curve A parameter */, - '@PF': 0 /* Pairing Friendly */, - '@ST': 0 /* Sextic Twist Type */, - '@SX': 0 /* Sign of x parameter */, - '@AB': 0 /* ATE parameter size */, - '@HT': 32 /* Hash output size */, - '@SH': 9 /* Maximum field excess */, - '@AK': 16 /* AES key size */, - }, - - MDC: { - 'BITS': '256', - 'FIELD': 'MDC', - 'CURVE': 'MDC', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - X448: { - 'BITS': '448', - 'FIELD': 'GOLDILOCKS', - 'CURVE': 'X448', - '@NB': 56, - '@BASE': 23, - '@NBT': 448, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 2, - '@QI': 0, - '@TW': 0, - '@CT': 2, - '@CA': 156326, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - SECP160R1: { - 'BITS': '160', - 'FIELD': 'SECP160R1', - 'CURVE': 'SECP160R1', - '@NB': 20, - '@BASE': 24, - '@NBT': 160, - '@M8': 1, - '@RZ': 3, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - C25519: { - 'BITS': '256', - 'FIELD': '25519', - 'CURVE': 'C25519', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 2, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 2, - '@CA': 486662, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - C13318: { - 'BITS': '256', - 'FIELD': '25519', - 'CURVE': 'C13318', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 2, - '@RZ': 2, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - JUBJUB: { - 'BITS': '256', - 'FIELD': 'JUBJUB', - 'CURVE': 'JUBJUB', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 32, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 5, - '@TW': 0, - '@CT': 1, - '@CA': -1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - SECP256K1: { - 'BITS': '256', - 'FIELD': 'SECP256K1', - 'CURVE': 'SECP256K1', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -11, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 3, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NIST256: { - 'BITS': '256', - 'FIELD': 'NIST256', - 'CURVE': 'NIST256', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -10, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - SM2: { - 'BITS': '256', - 'FIELD': 'SM2', - 'CURVE': 'SM2', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -9, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NIST384: { - 'BITS': '384', - 'FIELD': 'NIST384', - 'CURVE': 'NIST384', - '@NB': 48, - '@BASE': 23, - '@NBT': 384, - '@M8': 1, - '@RZ': -12, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 7, - '@AK': 24, - }, - - BRAINPOOL: { - 'BITS': '256', - 'FIELD': 'BRAINPOOL', - 'CURVE': 'BRAINPOOL', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -3, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - ANSSI: { - 'BITS': '256', - 'FIELD': 'ANSSI', - 'CURVE': 'ANSSI', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': -5, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - HIFIVE: { - 'BITS': '336', - 'FIELD': 'HIFIVE', - 'CURVE': 'HIFIVE', - '@NB': 42, - '@BASE': 23, - '@NBT': 336, - '@M8': 2, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 9, - '@AK': 24, - }, - - GOLDILOCKS: { - 'BITS': '448', - 'FIELD': 'GOLDILOCKS', - 'CURVE': 'GOLDILOCKS', - '@NB': 56, - '@BASE': 23, - '@NBT': 448, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 2, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - C41417: { - 'BITS': '416', - 'FIELD': 'C41417', - 'CURVE': 'C41417', - '@NB': 52, - '@BASE': 22, - '@NBT': 414, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 4, - '@AK': 32, - }, - - C1174: { - 'BITS': '256', - 'FIELD': 'C1174', - 'CURVE': 'C1174', - '@NB': 32, - '@BASE': 24, - '@NBT': 251, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - C1665: { - 'BITS': '168', - 'FIELD': 'C1665', - 'CURVE': 'C1665', - '@NB': 21, - '@BASE': 23, - '@NBT': 166, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - NIST521: { - 'BITS': '528', - 'FIELD': 'NIST521', - 'CURVE': 'NIST521', - '@NB': 66, - '@BASE': 23, - '@NBT': 521, - '@M8': 1, - '@RZ': -4, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 8, - '@AK': 32, - }, - - NUMS256W: { - 'BITS': '256', - 'FIELD': '256PM', - 'CURVE': 'NUMS256W', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 7, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NUMS256E: { - 'BITS': '256', - 'FIELD': '256PM', - 'CURVE': 'NUMS256E', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - NUMS384W: { - 'BITS': '384', - 'FIELD': '384PM', - 'CURVE': 'NUMS384W', - '@NB': 48, - '@BASE': 23, - '@NBT': 384, - '@M8': 1, - '@RZ': -4, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 7, - '@AK': 24, - }, - - NUMS384E: { - 'BITS': '384', - 'FIELD': '384PM', - 'CURVE': 'NUMS384E', - '@NB': 48, - '@BASE': 23, - '@NBT': 384, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 48, - '@SH': 7, - '@AK': 24, - }, - - NUMS512W: { - 'BITS': '512', - 'FIELD': '512PM', - 'CURVE': 'NUMS512W', - '@NB': 64, - '@BASE': 23, - '@NBT': 512, - '@M8': 1, - '@RZ': -4, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': -3, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - NUMS512E: { - 'BITS': '512', - 'FIELD': '512PM', - 'CURVE': 'NUMS512E', - '@NB': 64, - '@BASE': 23, - '@NBT': 512, - '@M8': 1, - '@RZ': 0, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 1, - '@QI': 0, - '@TW': 0, - '@CT': 1, - '@CA': 1, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - TWEEDLEDUM: { - 'BITS': '255', - 'FIELD': 'TWEEDLEDUM', - 'CURVE': 'TWEEDLEDUM', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 33, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 5, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - TWEEDLEDEE: { - 'BITS': '255', - 'FIELD': 'TWEEDLEDEE', - 'CURVE': 'TWEEDLEDEE', - '@NB': 32, - '@BASE': 24, - '@NBT': 255, - '@M8': 34, - '@RZ': 1, - '@RZ2A': 0, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 5, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 0, - '@ST': 0, - '@SX': 0, - '@AB': 0, - '@HT': 32, - '@SH': 9, - '@AK': 16, - }, - - FP256BN: { - 'BITS': '256', - 'FIELD': 'FP256BN', - 'CURVE': 'FP256BN', - '@NB': 32, - '@BASE': 24, - '@NBT': 256, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 1, - '@SX': 1, - '@AB': 66, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - FP512BN: { - 'BITS': '512', - 'FIELD': 'FP512BN', - 'CURVE': 'FP512BN', - '@NB': 64, - '@BASE': 23, - '@NBT': 512, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 1, - '@SX': 0, - '@AB': 130, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - BN254: { - 'BITS': '256', - 'FIELD': 'BN254', - 'CURVE': 'BN254', - '@NB': 32, - '@BASE': 24, - '@NBT': 254, - '@M8': 1, - '@RZ': -1, - '@RZ2A': -1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 0, - '@SX': 1, - '@AB': 66, - '@HT': 32, - '@SH': 10, - '@AK': 16, - }, - - BN254CX: { - 'BITS': '256', - 'FIELD': 'BN254CX', - 'CURVE': 'BN254CX', - '@NB': 32, - '@BASE': 24, - '@NBT': 254, - '@M8': 1, - '@RZ': -1, - '@RZ2A': -1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 0, - '@SX': 1, - '@AB': 66, - '@HT': 32, - '@SH': 10, - '@AK': 16, - }, - - BN462: { - 'BITS': '464', - 'FIELD': 'BN462', - 'CURVE': 'BN462', - '@NB': 58, - '@BASE': 23, - '@NBT': 462, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 1, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 1, - '@ST': 0, - '@SX': 0, - '@AB': 118, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - BLS12383: { - 'BITS': '384', - 'FIELD': 'BLS12383', - 'CURVE': 'BLS12383', - '@NB': 48, - '@BASE': 23, - '@NBT': 383, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 2, - '@ST': 1, - '@SX': 0, - '@AB': 65, - '@HT': 32, - '@SH': 8, - '@AK': 16, - }, - - BLS24479: { - 'BITS': '480', - 'FIELD': 'BLS24479', - 'CURVE': 'BLS24479', - '@NB': 60, - '@BASE': 23, - '@NBT': 479, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 4, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 3, - '@ST': 1, - '@SX': 0, - '@AB': 49, - '@HT': 48, - '@SH': 4, - '@AK': 24, - }, - - BLS48556: { - 'BITS': '560', - 'FIELD': 'BLS48556', - 'CURVE': 'BLS48556', - '@NB': 70, - '@BASE': 23, - '@NBT': 556, - '@M8': 1, - '@RZ': -1, - '@RZ2A': 2, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 4, - '@ST': 1, - '@SX': 0, - '@AB': 32, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - BLS48286: { - 'BITS': '288', - 'FIELD': 'BLS48286', - 'CURVE': 'BLS48286', - '@NB': 36, - '@BASE': 23, - '@NBT': 286, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 1, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 4, - '@ST': 1, - '@SX': 0, - '@AB': 17, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - BLS48581: { - 'BITS': '584', - 'FIELD': 'BLS48581', - 'CURVE': 'BLS48581', - '@NB': 73, - '@BASE': 23, - '@NBT': 581, - '@M8': 1, - '@RZ': 2, - '@RZ2A': 2, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 1, - '@CT': 0, - '@CA': 0, - '@PF': 4, - '@ST': 0, - '@SX': 1, - '@AB': 33, - '@HT': 64, - '@SH': 11, - '@AK': 32, - }, - - BLS12381: { - 'BITS': '381', - 'FIELD': 'BLS12381', - 'CURVE': 'BLS12381', - '@NB': 48, - '@BASE': 23, - '@NBT': 381, - '@M8': 1, - '@RZ': 11, - '@RZ2A': -2, - '@RZ2B': -1, - '@HC': 11, - '@HC2': 3, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 2, - '@ST': 1, - '@SX': 1, - '@AB': 65, - '@HT': 32, - '@SH': 10, - '@AK': 16, - }, - - BLS12461: { - 'BITS': '464', - 'FIELD': 'BLS12461', - 'CURVE': 'BLS12461', - '@NB': 58, - '@BASE': 23, - '@NBT': 461, - '@M8': 1, - '@RZ': 1, - '@RZ2A': 4, - '@RZ2B': 0, - '@HC': 0, - '@HC2': 0, - '@MT': 0, - '@QI': 0, - '@TW': 0, - '@CT': 0, - '@CA': 0, - '@PF': 2, - '@ST': 1, - '@SX': 1, - '@AB': 78, - '@HT': 32, - '@SH': 11, - '@AK': 16, - }, - - RSA2048: { - 'BITS': '1024', - 'TFF': '2048', - '@NB': 128, - '@BASE': 22, - '@ML': 2, - }, - - RSA3072: { - 'BITS': '384', - 'TFF': '3072', - '@NB': 48, - '@BASE': 23, - '@ML': 8, - }, - - RSA4096: { - 'BITS': '512', - 'TFF': '4096', - '@NB': 64, - '@BASE': 23, - '@ML': 8, - }, - }; - - prepareModule = function (moduleName, fileName, propertyName) { - if (!propertyName) { - propertyName = moduleName; - } - - if (typeof require !== 'undefined') { - if (!fileName) { - fileName = moduleName.toLowerCase(); - } - - ctx[propertyName] = require('./' + fileName)[moduleName](ctx); - } else { - ctx[propertyName] = window[moduleName](ctx); - } - }; - - prepareModule('AES'); - prepareModule('GCM'); - prepareModule('UInt64'); - prepareModule('HMAC'); - prepareModule('HASH256'); - prepareModule('HASH384'); - prepareModule('HASH512'); - prepareModule('SHA3'); - prepareModule('RAND'); - prepareModule('SHARE'); - prepareModule('NHS'); - - if (typeof input_parameter === 'undefined') { - return; - } - - ctx.config = CTXLIST[input_parameter]; - - // Set BIG parameters - prepareModule('BIG'); - prepareModule('DBIG', 'big'); - - // Set RSA parameters - if (typeof ctx.config['TFF'] !== 'undefined') { - prepareModule('FF'); - prepareModule('RSA'); - prepareModule('rsa_public_key', 'rsa'); - prepareModule('rsa_private_key', 'rsa'); - return; - } - - // Set Elliptic Curve parameters - if (typeof ctx.config['CURVE'] !== 'undefined') { - prepareModule('ROM_CURVE_' + ctx.config['CURVE'], 'rom_curve', 'ROM_CURVE'); - - prepareModule('ROM_FIELD_' + ctx.config['FIELD'], 'rom_field', 'ROM_FIELD'); - - prepareModule('FP'); - prepareModule('ECP'); - prepareModule('ECDH'); - prepareModule('HPKE'); - - if (ctx.config['@PF'] == 1 || ctx.config['@PF'] == 2) { - prepareModule('FP2'); - prepareModule('FP4'); - prepareModule('FP12'); - prepareModule('ECP2'); - prepareModule('PAIR'); - prepareModule('MPIN'); - prepareModule('BLS'); - } - - if (ctx.config['@PF'] == 3) { - prepareModule('FP2'); - prepareModule('FP4'); - prepareModule('FP8'); - prepareModule('FP24'); - prepareModule('ECP4'); - prepareModule('PAIR4'); - prepareModule('MPIN192'); - prepareModule('BLS192'); - } - - if (ctx.config['@PF'] == 4) { - prepareModule('FP2'); - prepareModule('FP4'); - prepareModule('FP8'); - prepareModule('FP16'); - prepareModule('FP48'); - prepareModule('ECP8'); - prepareModule('PAIR8'); - prepareModule('MPIN256'); - prepareModule('BLS256'); - } - - return; - } -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = CTX; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecdh.js b/packages/bls-verify/src/vendor/amcl-js/src/ecdh.js deleted file mode 100644 index f00493340..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecdh.js +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* ECDH/ECIES/ECDSA API Functions */ - -var ECDH = function (ctx) { - 'use strict'; - - var ECDH = { - INVALID_PUBLIC_KEY: -2, - ERROR: -3, - //INVALID: -4, - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - /* ctx.AES encryption/decryption */ - - IN_RANGE: function (S) { - var r, s; - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.fromBytes(S); - if (s.iszilch()) return false; - if (ctx.BIG.comp(s, r) >= 0) return false; - return true; - }, - - KEY_PAIR_GENERATE: function (RNG, S, W) { - var res = 0, - r, - s, - G, - WP; - // var T=[]; - - G = ctx.ECP.generator(); - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - if (RNG === null) { - s = ctx.BIG.fromBytes(S); - s.mod(r); - } else { - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, RNG); - } - - s.toBytes(S); - - WP = G.mul(s); - WP.toBytes(W, false); // To use point compression on public keys, change to true - - return res; - }, - - PUBLIC_KEY_VALIDATE: function (W) { - var WP = ctx.ECP.fromBytes(W), - res = 0, - r, - q, - nb, - k; - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - if (WP.is_infinity()) { - res = this.INVALID_PUBLIC_KEY; - } - - if (res === 0) { - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - nb = q.nbits(); - k = new ctx.BIG(1); - k.shl(Math.floor((nb + 4) / 2)); - k.add(q); - k.div(r); - - while (k.parity() == 0) { - k.shr(1); - WP.dbl(); - } - - if (!k.isunity()) { - WP = WP.mul(k); - } - - if (WP.is_infinity()) { - res = this.INVALID_PUBLIC_KEY; - } - } - - return res; - }, - - ECPSVDP_DH: function (S, WD, Z, type) { - var res = 0, - r, - s, - i, - W; - - s = ctx.BIG.fromBytes(S); - - W = ctx.ECP.fromBytes(WD); - if (W.is_infinity()) { - res = this.ERROR; - } - - if (res === 0) { - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s.mod(r); - W = W.mul(s); - - if (W.is_infinity()) { - res = this.ERROR; - } else { - if (ctx.ECP.CURVETYPE != ctx.ECP.MONTGOMERY) { - if (type > 0) { - if (type == 1) W.toBytes(Z, true); - else W.toBytes(Z, false); - } else { - W.getX().toBytes(Z); - } - return res; - } else { - W.getX().toBytes(Z); - } - } - } - return res; - }, - - ECPSP_DSA: function (sha, RNG, S, F, C, D) { - var T = [], - i, - r, - s, - f, - c, - d, - u, - vx, - w, - G, - V, - B; - - B = ctx.HMAC.GPhashit(ctx.HMAC.MC_SHA2, sha, ctx.BIG.MODBYTES, 0, F, -1, null); - - G = ctx.ECP.generator(); - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - s = ctx.BIG.fromBytes(S); - f = ctx.BIG.fromBytes(B); - - c = new ctx.BIG(0); - d = new ctx.BIG(0); - V = new ctx.ECP(); - - do { - u = ctx.BIG.randomnum(r, RNG); - w = ctx.BIG.randomnum(r, RNG); /* side channel masking */ - V.copy(G); - V = V.mul(u); - vx = V.getX(); - c.copy(vx); - c.mod(r); - if (c.iszilch()) { - continue; - } - u = ctx.BIG.modmul(u, w, r); - u.invmodp(r); - d = ctx.BIG.modmul(s, c, r); - d.add(f); - d = ctx.BIG.modmul(d, w, r); - d = ctx.BIG.modmul(u, d, r); - } while (d.iszilch()); - - c.toBytes(T); - for (i = 0; i < this.EFS; i++) { - C[i] = T[i]; - } - d.toBytes(T); - for (i = 0; i < this.EFS; i++) { - D[i] = T[i]; - } - - return 0; - }, - - ECPVP_DSA: function (sha, W, F, C, D) { - var B = [], - res = 0, - r, - f, - c, - d, - h2, - G, - WP, - P; - - B = ctx.HMAC.GPhashit(ctx.HMAC.MC_SHA2, sha, ctx.BIG.MODBYTES, 0, F, -1, null); - - G = ctx.ECP.generator(); - - r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - c = ctx.BIG.fromBytes(C); - d = ctx.BIG.fromBytes(D); - f = ctx.BIG.fromBytes(B); - - if (c.iszilch() || ctx.BIG.comp(c, r) >= 0 || d.iszilch() || ctx.BIG.comp(d, r) >= 0) { - res = this.ERROR; - } - - if (res === 0) { - d.invmodp(r); - f = ctx.BIG.modmul(f, d, r); - h2 = ctx.BIG.modmul(c, d, r); - - WP = ctx.ECP.fromBytes(W); - if (WP.is_infinity()) { - res = this.ERROR; - } else { - P = new ctx.ECP(); - /* - var X=[]; X[0]=new ctx.ECP(); X[1]=new ctx.ECP(); - var e=[]; e[0]=new ctx.BIG(); e[1]=new ctx.BIG(); - X[0].copy(WP); X[1].copy(G); - e[0].copy(h2); e[1].copy(f); - P=ctx.ECP.muln(2,X,e); -*/ - - P.copy(WP); - P = P.mul2(h2, G, f); - - if (P.is_infinity()) { - res = this.ERROR; - } else { - d = P.getX(); - d.mod(r); - if (ctx.BIG.comp(d, c) !== 0) { - res = this.ERROR; - } - } - } - } - - return res; - }, - - ECIES_ENCRYPT: function (sha, P1, P2, RNG, W, M, V, T) { - var Z = [], - VZ = [], - K1 = [], - K2 = [], - U = [], - C = [], - K, - L2, - AC, - i; - - if (this.KEY_PAIR_GENERATE(RNG, U, V) !== 0) { - return C; - } - - if (this.ECPSVDP_DH(U, W, Z, 0) !== 0) { - return C; - } - - for (i = 0; i < 2 * this.EFS + 1; i++) { - VZ[i] = V[i]; - } - - for (i = 0; i < this.EFS; i++) { - VZ[2 * this.EFS + 1 + i] = Z[i]; - } - - K = ctx.HMAC.KDF2(ctx.HMAC.MC_SHA2, sha, VZ, P1, 2 * ctx.ECP.AESKEY); - - for (i = 0; i < ctx.ECP.AESKEY; i++) { - K1[i] = K[i]; - K2[i] = K[ctx.ECP.AESKEY + i]; - } - - C = ctx.AES.CBC_IV0_ENCRYPT(K1, M); - - L2 = ctx.HMAC.inttobytes(P2.length, 8); - - AC = []; - for (i = 0; i < C.length; i++) { - AC[i] = C[i]; - } - for (i = 0; i < P2.length; i++) { - AC[C.length + i] = P2[i]; - } - for (i = 0; i < 8; i++) { - AC[C.length + P2.length + i] = L2[i]; - } - - ctx.HMAC.HMAC1(ctx.HMAC.MC_SHA2, sha, T, T.length, K2, AC); - - return C; - }, - - ncomp: function (T1, T2, n) { - var res = 0; - for (var i = 0; i < n; i++) { - res |= T1[i] ^ T2[i]; - } - if (res == 0) return true; - return false; - }, - - ECIES_DECRYPT: function (sha, P1, P2, V, C, T, U) { - var Z = [], - VZ = [], - K1 = [], - K2 = [], - TAG = new Array(T.length), - M = [], - K, - L2, - AC, - i; - - if (this.ECPSVDP_DH(U, V, Z, 0) !== 0) { - return M; - } - - for (i = 0; i < 2 * this.EFS + 1; i++) { - VZ[i] = V[i]; - } - - for (i = 0; i < this.EFS; i++) { - VZ[2 * this.EFS + 1 + i] = Z[i]; - } - - K = ctx.HMAC.KDF2(ctx.HMAC.MC_SHA2, sha, VZ, P1, 2 * ctx.ECP.AESKEY); - - for (i = 0; i < ctx.ECP.AESKEY; i++) { - K1[i] = K[i]; - K2[i] = K[ctx.ECP.AESKEY + i]; - } - - M = ctx.AES.CBC_IV0_DECRYPT(K1, C); - - if (M.length === 0) { - return M; - } - - L2 = ctx.HMAC.inttobytes(P2.length, 8); - - AC = []; - - for (i = 0; i < C.length; i++) { - AC[i] = C[i]; - } - for (i = 0; i < P2.length; i++) { - AC[C.length + i] = P2[i]; - } - for (i = 0; i < 8; i++) { - AC[C.length + P2.length + i] = L2[i]; - } - - ctx.HMAC.HMAC1(ctx.HMAC.MC_SHA2, sha, TAG, TAG.length, K2, AC); - - if (!this.ncomp(T, TAG, T.length)) { - return []; - } - - return M; - }, - }; - - return ECDH; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - ECDH: ECDH, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp.js deleted file mode 100644 index 28dbb0aae..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp.js +++ /dev/null @@ -1,1966 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Elliptic Curve Point class */ - -var ECP = function (ctx) { - 'use strict'; - - /* Constructor */ - var ECP = function () { - this.x = new ctx.FP(0); - this.y = new ctx.FP(1); - if (ECP.CURVETYPE != ECP.EDWARDS) { - this.z = new ctx.FP(0); - } else { - this.z = new ctx.FP(1); - } - }; - - ECP.WEIERSTRASS = 0; - ECP.EDWARDS = 1; - ECP.MONTGOMERY = 2; - ECP.NOT = 0; - ECP.BN = 1; - ECP.BLS12 = 2; - ECP.BLS24 = 3; - ECP.BLS48 = 4; - ECP.D_TYPE = 0; - ECP.M_TYPE = 1; - ECP.POSITIVEX = 0; - ECP.NEGATIVEX = 1; - - ECP.CURVETYPE = ctx.config['@CT']; - ECP.CURVE_A = ctx.config['@CA']; - ECP.CURVE_PAIRING_TYPE = ctx.config['@PF']; - ECP.SEXTIC_TWIST = ctx.config['@ST']; - ECP.SIGN_OF_X = ctx.config['@SX']; - ECP.ATE_BITS = ctx.config['@AB']; - ECP.HTC_ISO = ctx.config['@HC']; - ECP.HTC_ISO_G2 = ctx.config['@HC2']; - - ECP.HASH_TYPE = ctx.config['@HT']; - ECP.AESKEY = ctx.config['@AK']; - ECP.ALLOW_ALT_COMPRESS = true; - - ECP.prototype = { - /* test this=O point-at-infinity */ - is_infinity: function () { - if (ECP.CURVETYPE == ECP.EDWARDS) { - return this.x.iszilch() && this.y.equals(this.z); - } else if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - return this.x.iszilch() && this.z.iszilch(); - } else if (ECP.CURVETYPE == ECP.MONTGOMERY) { - return this.z.iszilch(); - } - - return true; - }, - - /* conditional swap of this and Q dependant on d */ - cswap: function (Q, d) { - this.x.cswap(Q.x, d); - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.cswap(Q.y, d); - } - this.z.cswap(Q.z, d); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.cmove(Q.y, d); - } - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP(), - m = b >> 31, - babs = (b ^ m) - m; - - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP.teq(babs, 1)); - this.cmove(W[2], ECP.teq(babs, 2)); - this.cmove(W[3], ECP.teq(babs, 3)); - this.cmove(W[4], ECP.teq(babs, 4)); - this.cmove(W[5], ECP.teq(babs, 5)); - this.cmove(W[6], ECP.teq(babs, 6)); - this.cmove(W[7], ECP.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - - equals: function (Q) { - var a, b; - - a = new ctx.FP(0); - b = new ctx.FP(0); - a.copy(this.x); - a.mul(Q.z); - a.reduce(); - b.copy(Q.x); - b.mul(this.z); - b.reduce(); - - if (!a.equals(b)) { - return false; - } - - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - a.copy(this.y); - a.mul(Q.z); - a.reduce(); - b.copy(Q.y); - b.mul(this.z); - b.reduce(); - if (!a.equals(b)) { - return false; - } - } - - return true; - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.copy(P.y); - } - this.z.copy(P.z); - }, - - /* this=-this */ - neg: function () { - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - this.y.neg(); - this.y.norm(); - } else if (ECP.CURVETYPE == ECP.EDWARDS) { - this.x.neg(); - this.x.norm(); - } - - return; - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y.one(); - } - - if (ECP.CURVETYPE != ECP.EDWARDS) { - this.z.zero(); - } else { - this.z.one(); - } - }, - - /* set this=(x,y) where x and y are BIGs */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x = new ctx.FP(0); - this.x.bcopy(ix); - - this.y = new ctx.FP(0); - this.y.bcopy(iy); - this.z = new ctx.FP(1); - this.x.norm(); - rhs = ECP.RHS(this.x); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - if (rhs.qr(null) != 1) { - this.inf(); - } - } else { - y2 = new ctx.FP(0); - y2.copy(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - } - }, - - /* set this=x, where x is ctx.BIG, y is derived from sign s */ - setxi: function (ix, s) { - var rhs, ny; - - this.x = new ctx.FP(0); - this.x.bcopy(ix); - this.x.norm(); - rhs = ECP.RHS(this.x); - this.z = new ctx.FP(1); - var hint = new ctx.FP(0); - if (rhs.qr(hint) == 1) { - ny = rhs.sqrt(hint); - if (ny.sign() != s) { - ny.neg(); - ny.norm(); - } - this.y = ny; - } else { - this.inf(); - } - }, - - /* set this=x, y calculated from curve equation */ - setx: function (ix) { - var rhs; - - this.x = new ctx.FP(0); - this.x.bcopy(ix); - this.x.norm(); - rhs = ECP.RHS(this.x); - this.z = new ctx.FP(1); - var hint = new ctx.FP(0); - - if (rhs.qr(hint) == 1) { - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - this.y = rhs.sqrt(hint); - } - } else { - this.inf(); - } - }, - - /* set this to affine - from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP(1); - - if (this.z.equals(one)) { - return; - } - - this.z.inverse(null); - - if (ECP.CURVETYPE == ECP.EDWARDS || ECP.CURVETYPE == ECP.WEIERSTRASS) { - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z = one; - } - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - this.x.mul(this.z); - this.x.reduce(); - this.z = one; - } - }, - - /* extract x as ctx.BIG */ - getX: function () { - var W = new ECP(); - W.copy(this); - W.affine(); - return W.x.redc(); - }, - - /* extract y as ctx.BIG */ - getY: function () { - var W = new ECP(); - W.copy(this); - W.affine(); - return W.y.redc(); - }, - - /* get sign of Y */ - getS: function () { - var W = new ECP(); - W.copy(this); - W.affine(); - return W.y.sign(); - }, - - /* extract x as ctx.FP */ - getx: function () { - return this.x; - }, - - /* extract y as ctx.FP */ - gety: function () { - return this.y; - }, - - /* extract z as ctx.FP */ - getz: function () { - return this.z; - }, - - /* convert to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP(); - W.copy(this); - W.affine(); - W.x.redc().toBytes(t); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - b[i] = t[i]; - } - return; - } - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (compress) { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } else { - W.y.redc().toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i + ctx.BIG.MODBYTES] = t[i]; - } - } else { - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (compress) { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - return; - } - b[0] = 0x04; - W.y.redc().toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) b[i + ctx.BIG.MODBYTES + 1] = t[i]; - } - }, - /* convert to hex string */ - toString: function () { - var W = new ECP(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - - W.affine(); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - return '(' + W.x.redc().toString() + ')'; - } else { - return '(' + W.x.redc().toString() + ',' + W.y.redc().toString() + ')'; - } - }, - - /* this+=this */ - dbl: function () { - var t0, t1, t2, t3, x3, y3, z3, b, C, D, H, J, A, B, AA, BB; - - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - if (ECP.CURVE_A == 0) { - t0 = new ctx.FP(0); - t0.copy(this.y); - t0.sqr(); - t1 = new ctx.FP(0); - t1.copy(this.y); - t1.mul(this.z); - t2 = new ctx.FP(0); - t2.copy(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - - x3 = new ctx.FP(0); - x3.copy(t2); - x3.mul(this.z); - y3 = new ctx.FP(0); - y3.copy(t0); - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t0.sub(t2); - t0.norm(); - y3.mul(t0); - y3.add(x3); - t1.copy(this.x); - t1.mul(this.y); - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - } else { - t0 = new ctx.FP(0); - t0.copy(this.x); - t1 = new ctx.FP(0); - t1.copy(this.y); - t2 = new ctx.FP(0); - t2.copy(this.z); - t3 = new ctx.FP(0); - t3.copy(this.x); - z3 = new ctx.FP(0); - z3.copy(this.z); - y3 = new ctx.FP(0); - x3 = new ctx.FP(0); - b = new ctx.FP(0); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - b.rcopy(ctx.ROM_CURVE.CURVE_B); - } - - t0.sqr(); //1 x^2 - t1.sqr(); //2 y^2 - t2.sqr(); //3 - - t3.mul(this.y); //4 - t3.add(t3); - t3.norm(); //5 - z3.mul(this.x); //6 - z3.add(z3); - z3.norm(); //7 - y3.copy(t2); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - y3.mul(b); //8 - } else { - y3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - y3.sub(z3); //9 *** - x3.copy(y3); - x3.add(y3); - x3.norm(); //10 - - y3.add(x3); //11 - x3.copy(t1); - x3.sub(y3); - x3.norm(); //12 - y3.add(t1); - y3.norm(); //13 - y3.mul(x3); //14 - x3.mul(t3); //15 - t3.copy(t2); - t3.add(t2); //16 - t2.add(t3); //17 - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - z3.mul(b); //18 - } else { - z3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - z3.sub(t2); //19 - z3.sub(t0); - z3.norm(); //20 *** - t3.copy(z3); - t3.add(z3); //21 - - z3.add(t3); - z3.norm(); //22 - t3.copy(t0); - t3.add(t0); //23 - t0.add(t3); //24 - t0.sub(t2); - t0.norm(); //25 - - t0.mul(z3); //26 - y3.add(t0); //27 - t0.copy(this.y); - t0.mul(this.z); //28 - t0.add(t0); - t0.norm(); //29 - z3.mul(t0); //30 - x3.sub(z3); //31 - t0.add(t0); - t0.norm(); //32 - t1.add(t1); - t1.norm(); //33 - z3.copy(t0); - z3.mul(t1); //34 - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - } - } - - if (ECP.CURVETYPE == ECP.EDWARDS) { - C = new ctx.FP(0); - C.copy(this.x); - D = new ctx.FP(0); - D.copy(this.y); - H = new ctx.FP(0); - H.copy(this.z); - J = new ctx.FP(0); - - this.x.mul(this.y); - this.x.add(this.x); - this.x.norm(); - C.sqr(); - D.sqr(); - if (ECP.CURVE_A == -1) { - C.neg(); - } - - this.y.copy(C); - this.y.add(D); - this.y.norm(); - H.sqr(); - H.add(H); - - this.z.copy(this.y); - J.copy(this.y); - - J.sub(H); - J.norm(); - - this.x.mul(J); - C.sub(D); - C.norm(); - this.y.mul(C); - this.z.mul(J); - } - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - A = new ctx.FP(0); - A.copy(this.x); - B = new ctx.FP(0); - B.copy(this.x); - AA = new ctx.FP(0); - BB = new ctx.FP(0); - C = new ctx.FP(0); - - A.add(this.z); - A.norm(); - AA.copy(A); - AA.sqr(); - B.sub(this.z); - B.norm(); - BB.copy(B); - BB.sqr(); - C.copy(AA); - C.sub(BB); - C.norm(); - this.x.copy(AA); - this.x.mul(BB); - - A.copy(C); - A.imul((ECP.CURVE_A + 2) >> 2); - - BB.add(A); - BB.norm(); - this.z.copy(BB); - this.z.mul(C); - } - - return; - }, - - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3, A, B, C, D, E, F, G; - - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - if (ECP.CURVE_A == 0) { - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP(0); - t0.copy(this.x); - t0.mul(Q.x); - t1 = new ctx.FP(0); - t1.copy(this.y); - t1.mul(Q.y); - t2 = new ctx.FP(0); - t2.copy(this.z); - t2.mul(Q.z); - t3 = new ctx.FP(0); - t3.copy(this.x); - t3.add(this.y); - t3.norm(); - t4 = new ctx.FP(0); - t4.copy(Q.x); - t4.add(Q.y); - t4.norm(); - t3.mul(t4); - t4.copy(t0); - t4.add(t1); - - t3.sub(t4); - t3.norm(); - t4.copy(this.y); - t4.add(this.z); - t4.norm(); - x3 = new ctx.FP(0); - x3.copy(Q.y); - x3.add(Q.z); - x3.norm(); - - t4.mul(x3); - x3.copy(t1); - x3.add(t2); - - t4.sub(x3); - t4.norm(); - x3.copy(this.x); - x3.add(this.z); - x3.norm(); - y3 = new ctx.FP(0); - y3.copy(Q.x); - y3.add(Q.z); - y3.norm(); - x3.mul(y3); - y3.copy(t0); - y3.add(t2); - y3.rsub(x3); - y3.norm(); - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - - z3 = new ctx.FP(0); - z3.copy(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - } else { - t0 = new ctx.FP(0); - t0.copy(this.x); - t1 = new ctx.FP(0); - t1.copy(this.y); - t2 = new ctx.FP(0); - t2.copy(this.z); - t3 = new ctx.FP(0); - t3.copy(this.x); - t4 = new ctx.FP(0); - t4.copy(Q.x); - z3 = new ctx.FP(0); - y3 = new ctx.FP(0); - y3.copy(Q.x); - x3 = new ctx.FP(0); - x3.copy(Q.y); - b = new ctx.FP(0); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - b.rcopy(ctx.ROM_CURVE.CURVE_B); - } - t0.mul(Q.x); //1 - t1.mul(Q.y); //2 - t2.mul(Q.z); //3 - - t3.add(this.y); - t3.norm(); //4 - t4.add(Q.y); - t4.norm(); //5 - t3.mul(t4); //6 - t4.copy(t0); - t4.add(t1); //7 - t3.sub(t4); - t3.norm(); //8 - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //9 - x3.add(Q.z); - x3.norm(); //10 - t4.mul(x3); //11 - x3.copy(t1); - x3.add(t2); //12 - - t4.sub(x3); - t4.norm(); //13 - x3.copy(this.x); - x3.add(this.z); - x3.norm(); //14 - y3.add(Q.z); - y3.norm(); //15 - - x3.mul(y3); //16 - y3.copy(t0); - y3.add(t2); //17 - - y3.rsub(x3); - y3.norm(); //18 - z3.copy(t2); - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - z3.mul(b); //18 - } else { - z3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - x3.copy(y3); - x3.sub(z3); - x3.norm(); //20 - z3.copy(x3); - z3.add(x3); //21 - - x3.add(z3); //22 - z3.copy(t1); - z3.sub(x3); - z3.norm(); //23 - x3.add(t1); - x3.norm(); //24 - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - y3.mul(b); //18 - } else { - y3.imul(ctx.ROM_CURVE.CURVE_B_I); - } - - t1.copy(t2); - t1.add(t2); //26 - t2.add(t1); //27 - - y3.sub(t2); //28 - - y3.sub(t0); - y3.norm(); //29 - t1.copy(y3); - t1.add(y3); //30 - y3.add(t1); - y3.norm(); //31 - - t1.copy(t0); - t1.add(t0); //32 - t0.add(t1); //33 - t0.sub(t2); - t0.norm(); //34 - t1.copy(t4); - t1.mul(y3); //35 - t2.copy(t0); - t2.mul(y3); //36 - y3.copy(x3); - y3.mul(z3); //37 - y3.add(t2); //38 - x3.mul(t3); //39 - x3.sub(t1); //40 - z3.mul(t4); //41 - t1.copy(t3); - t1.mul(t0); //42 - z3.add(t1); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - } - } - - if (ECP.CURVETYPE == ECP.EDWARDS) { - A = new ctx.FP(0); - A.copy(this.z); - B = new ctx.FP(0); - C = new ctx.FP(0); - C.copy(this.x); - D = new ctx.FP(0); - D.copy(this.y); - E = new ctx.FP(0); - F = new ctx.FP(0); - G = new ctx.FP(0); - - A.mul(Q.z); //A=2 - B.copy(A); - B.sqr(); //B=2 - C.mul(Q.x); //C=2 - D.mul(Q.y); //D=2 - - E.copy(C); - E.mul(D); //E=2 - - if (ctx.ROM_CURVE.CURVE_B_I == 0) { - b = new ctx.FP(0); - b.rcopy(ctx.ROM_CURVE.CURVE_B); - E.mul(b); - } else { - E.imul(ctx.ROM_CURVE.CURVE_B_I); //E=22222 - } - - F.copy(B); - F.sub(E); //F=22224 - G.copy(B); - G.add(E); //G=22224 - - if (ECP.CURVE_A == 1) { - E.copy(D); - E.sub(C); //E=4 - } - C.add(D); //C=4 - - B.copy(this.x); - B.add(this.y); //B=4 - D.copy(Q.x); - D.add(Q.y); - B.norm(); - D.norm(); //D=4 - B.mul(D); //B=2 - B.sub(C); - B.norm(); - F.norm(); // B=6 - B.mul(F); //B=2 - this.x.copy(A); - this.x.mul(B); - G.norm(); // x=2 - - if (ECP.CURVE_A == 1) { - E.norm(); - C.copy(E); - C.mul(G); //C=2 - } - - if (ECP.CURVE_A == -1) { - C.norm(); - C.mul(G); - } - - this.y.copy(A); - this.y.mul(C); //y=2 - this.z.copy(F); - this.z.mul(G); - } - - return; - }, - - /* Differential Add for Montgomery curves. this+=Q where W is this-Q and is affine. */ - dadd: function (Q, W) { - var A, B, C, D, DA, CB; - - A = new ctx.FP(0); - A.copy(this.x); - B = new ctx.FP(0); - B.copy(this.x); - C = new ctx.FP(0); - C.copy(Q.x); - D = new ctx.FP(0); - D.copy(Q.x); - DA = new ctx.FP(0); - CB = new ctx.FP(0); - - A.add(this.z); - B.sub(this.z); - - C.add(Q.z); - D.sub(Q.z); - - D.norm(); - A.norm(); - DA.copy(D); - DA.mul(A); - C.norm(); - B.norm(); - CB.copy(C); - CB.mul(B); - - A.copy(DA); - A.add(CB); - A.norm(); - A.sqr(); - B.copy(DA); - B.sub(CB); - B.norm(); - B.sqr(); - - this.x.copy(A); - this.z.copy(W.x); - this.z.mul(B); - - // this.x.norm(); - }, - - /* this-=Q */ - sub: function (Q) { - var NQ = new ECP(); - NQ.copy(Q); - NQ.neg(); - this.add(NQ); - }, - - /* constant time multiply by small integer of length bts - use ladder */ - pinmul: function (e, bts) { - var i, b, P, R0, R1; - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - return this.mul(new ctx.BIG(e)); - } else { - P = new ECP(); - R0 = new ECP(); - R1 = new ECP(); - R1.copy(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - P.copy(R1); - P.add(R0); - R0.cswap(R1, b); - R1.copy(P); - R0.dbl(); - R0.cswap(R1, b); - } - - P.copy(R0); - - return P; - } - }, - - // multiply this by the curves cofactor - cfp: function () { - var cf = ctx.ROM_CURVE.CURVE_Cof_I, - c = new ctx.BIG(0); - - if (cf == 1) { - return; - } - if (cf == 4) { - this.dbl(); - this.dbl(); - return; - } - if (cf == 8) { - this.dbl(); - this.dbl(); - this.dbl(); - return; - } - c.rcopy(ctx.ROM_CURVE.CURVE_Cof); - this.copy(this.mul(c)); - }, - - /* return e.this - SPA immune, using Ladder */ - mul: function (e) { - var P, D, R0, R1, mt, t, Q, C, W, w, i, b, nb, s, ns; - - if (e.iszilch() || this.is_infinity()) { - return new ECP(); - } - - P = new ECP(); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - /* use ladder */ - D = new ECP(); - R0 = new ECP(); - R0.copy(this); - R1 = new ECP(); - R1.copy(this); - R1.dbl(); - D.copy(this); - D.affine(); - nb = e.nbits(); - for (i = nb - 2; i >= 0; i--) { - b = e.bit(i); - P.copy(R1); - P.dadd(R0, D); - - R0.cswap(R1, b); - R1.copy(P); - R0.dbl(); - R0.cswap(R1, b); - } - P.copy(R0); - } else { - // fixed size windows - mt = new ctx.BIG(); - t = new ctx.BIG(); - Q = new ECP(); - C = new ECP(); - W = []; - w = []; - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - } - - return P; - }, - - /* Return e.this+f.Q */ - - mul2: function (e, Q, f) { - var te = new ctx.BIG(), - tf = new ctx.BIG(), - mt = new ctx.BIG(), - S = new ECP(), - T = new ECP(), - C = new ECP(), - W = [], - w = [], - i, - s, - ns, - nb, - a, - b; - - te.copy(e); - tf.copy(f); - - // precompute table - W[1] = new ECP(); - W[1].copy(this); - W[1].sub(Q); - W[2] = new ECP(); - W[2].copy(this); - W[2].add(Q); - S.copy(Q); - S.dbl(); - W[0] = new ECP(); - W[0].copy(W[1]); - W[0].sub(S); - W[3] = new ECP(); - W[3].copy(W[2]); - W[3].add(S); - T.copy(this); - T.dbl(); - W[5] = new ECP(); - W[5].copy(W[1]); - W[5].add(T); - W[6] = new ECP(); - W[6].copy(W[2]); - W[6].add(T); - W[4] = new ECP(); - W[4].copy(W[5]); - W[4].sub(S); - W[7] = new ECP(); - W[7].copy(W[6]); - W[7].add(S); - - // if multiplier is odd, add 2, else add 1 to multiplier, and add 2P or P to correction - - s = te.parity(); - te.inc(1); - te.norm(); - ns = te.parity(); - mt.copy(te); - mt.inc(1); - mt.norm(); - te.cmove(mt, s); - T.cmove(this, ns); - C.copy(T); - - s = tf.parity(); - tf.inc(1); - tf.norm(); - ns = tf.parity(); - mt.copy(tf); - mt.inc(1); - mt.norm(); - tf.cmove(mt, s); - S.cmove(Q, ns); - C.add(S); - - mt.copy(te); - mt.add(tf); - mt.norm(); - nb = 1 + Math.floor((mt.nbits() + 1) / 2); - - // convert exponent to signed 2-bit window - for (i = 0; i < nb; i++) { - a = te.lastbits(3) - 4; - te.dec(a); - te.norm(); - te.fshr(2); - b = tf.lastbits(3) - 4; - tf.dec(b); - tf.norm(); - tf.fshr(2); - w[i] = 4 * a + b; - } - w[nb] = 4 * te.lastbits(3) + tf.lastbits(3); - S.copy(W[Math.floor((w[nb] - 1) / 2)]); - - for (i = nb - 1; i >= 0; i--) { - T.select(W, w[i]); - S.dbl(); - S.dbl(); - S.add(T); - } - S.sub(C); /* apply correction */ - - return S; - }, - }; - - // set to group generator - ECP.generator = function () { - var G = new ECP(), - gx = new ctx.BIG(0), - gy = new ctx.BIG(0); - - gx.rcopy(ctx.ROM_CURVE.CURVE_Gx); - - if (ctx.ECP.CURVETYPE != ctx.ECP.MONTGOMERY) { - gy.rcopy(ctx.ROM_CURVE.CURVE_Gy); - G.setxy(gx, gy); - } else { - G.setx(gx); - } - return G; - }; - - /* return 1 if b==c, no branching */ - ECP.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* convert from byte array to ECP */ - ECP.fromBytes = function (b) { - var t = [], - P = new ECP(), - p = new ctx.BIG(0), - px, - py, - i; - var alt = false; - - p.rcopy(ctx.ROM_FIELD.Modulus); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - t[i] = b[i]; - } - px = ctx.BIG.fromBytes(t); - if (ctx.BIG.comp(px, p) >= 0) { - return P; - } - P.setx(px); - return P; - } - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - px = ctx.BIG.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = b[i + ctx.BIG.MODBYTES]; - py = ctx.BIG.fromBytes(t); - P.setxy(px, py); - return P; - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setxi(px, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - return P; - } - } else { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - t[i] = b[i + 1]; - } - px = ctx.BIG.fromBytes(t); - if (ctx.BIG.comp(px, p) >= 0) { - return P; - } - - if (b[0] == 0x04) { - for (i = 0; i < ctx.BIG.MODBYTES; i++) { - t[i] = b[i + ctx.BIG.MODBYTES + 1]; - } - - py = ctx.BIG.fromBytes(t); - - if (ctx.BIG.comp(py, p) >= 0) { - return P; - } - - P.setxy(px, py); - - return P; - } - - if (b[0] == 0x02 || b[0] == 0x03) { - P.setxi(px, b[0] & 1); - return P; - } - } - - return P; - }; - - /* Calculate RHS of curve equation */ - ECP.RHS = function (x) { - var r = new ctx.FP(0), - b, - cx, - one, - x3; - - //x.norm(); - r.copy(x); - r.sqr(); - - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - // x^3+Ax+B - b = new ctx.FP(0); - b.rcopy(ctx.ROM_CURVE.CURVE_B); - r.mul(x); - if (ECP.CURVE_A == -3) { - cx = new ctx.FP(0); - cx.copy(x); - cx.imul(3); - cx.neg(); - cx.norm(); - r.add(cx); - } - r.add(b); - } else if (ECP.CURVETYPE == ECP.EDWARDS) { - // (Ax^2-1)/(Bx^2-1) - b = new ctx.FP(0); - b.rcopy(ctx.ROM_CURVE.CURVE_B); - - one = new ctx.FP(1); - b.mul(r); - b.sub(one); - b.norm(); - if (ECP.CURVE_A == -1) { - r.neg(); - } - r.sub(one); - r.norm(); - b.inverse(null); - - r.mul(b); - } else if (ECP.CURVETYPE == ECP.MONTGOMERY) { - // x^3+Ax^2+x - x3 = new ctx.FP(0); - x3.copy(r); - x3.mul(x); - r.imul(ECP.CURVE_A); - r.add(x3); - r.add(x); - } - - r.reduce(); - - return r; - }; - - // Generic multi-multiplication, fixed 4-bit window, P=Sigma e_i*X_i - ECP.muln = function (n, X, e) { - var B = []; - var P = new ECP(); - var R = new ECP(); - var S = new ECP(); - var t = new ctx.BIG(); - var mr = new ctx.BIG(); - - for (var i = 0; i < 16; i++) { - B[i] = new ECP(); - } - var mt = new ctx.BIG(); - mt.copy(e[0]); - mt.norm(); - for (var i = 1; i < n; i++) { - // find biggest - t.copy(e[i]); - t.norm(); - var k = ctx.BIG.comp(t, mt); - mt.cmove(t, (k + 1) >> 1); - } - var nb = (mt.nbits() + 3) >> 2; - for (var i = nb - 1; i >= 0; i--) { - for (var j = 0; j < 16; j++) { - B[j].inf(); - } - for (var j = 0; j < n; j++) { - mt.copy(e[j]); - mt.norm(); - mt.shr(4 * i); - var k = mt.lastbits(4); - B[k].add(X[j]); - } - R.inf(); - S.inf(); - for (var j = 15; j >= 1; j--) { - R.add(B[j]); - S.add(R); - } - for (var j = 0; j < 4; j++) { - P.dbl(); - } - P.add(S); - } - return P; - }; - - /* Hunt and Peck a BIG to a curve point - ECP.hap2point = function(h) { - var P = new ECP(); - var x=new ctx.BIG(h); - for (;;) { - if (ECP.CURVETYPE != ECP.MONTGOMERY) { - P.setxi(x, 0); - } else { - P.setx(x); - } - x.inc(1); - x.norm(); - if (!P.is_infinity()) break; - } - return P; - }; */ - - /* Constant time Map to Point */ - ECP.map2point = function (h) { - var P = new ECP(); - - if (ECP.CURVETYPE == ECP.MONTGOMERY) { - var X1 = new ctx.FP(0); - var X2 = new ctx.FP(0); - var t = new ctx.FP(h); - var w = new ctx.FP(0); - var one = new ctx.FP(1); - var N = new ctx.FP(0); - var D = new ctx.FP(0); - var hint = new ctx.FP(0); - var A = new ctx.FP(ECP.CURVE_A); - t.sqr(); - - if (ctx.FP.PM1D2 == 2) { - t.add(t); - } - if (ctx.FP.PM1D2 == 1) { - t.neg(); - } - if (ctx.FP.PM1D2 > 2) { - t.imul(ctx.FP.PM1D2); - } - t.norm(); - D.copy(t); - D.add(one); - D.norm(); - - X1.copy(A); - X1.neg(); - X1.norm(); - X2.copy(X1); - X2.mul(t); - - w.copy(X1); - w.sqr(); - N.copy(w); - N.mul(X1); - w.mul(A); - w.mul(D); - N.add(w); - t.copy(D); - t.sqr(); - t.mul(X1); - N.add(t); - N.norm(); - - t.copy(N); - t.mul(D); - var qres = t.qr(hint); - w.copy(t); - w.inverse(hint); - D.copy(w); - D.mul(N); - X1.mul(D); - X2.mul(D); - X1.cmove(X2, 1 - qres); - - var a = X1.redc(); - P.setx(a); - } - if (ECP.CURVETYPE == ECP.EDWARDS) { - // Elligator 2 - map to Montgomery, place point, map back - var X1 = new ctx.FP(0); - var X2 = new ctx.FP(0); - var t = new ctx.FP(h); - var w = new ctx.FP(0); - var one = new ctx.FP(1); - var A = new ctx.FP(0); - var w1 = new ctx.FP(0); - var w2 = new ctx.FP(0); - var B = new ctx.FP(0); - B.rcopy(ctx.ROM_CURVE.CURVE_B); - var Y = new ctx.FP(0); - var K = new ctx.FP(0); - var D = new ctx.FP(0); - var hint = new ctx.FP(0); - //var Y3 = new ctx.FP(0); - - var qres, - qnr, - rfc = 0; - - if (ctx.FP.MODTYPE != ctx.FP.GENERALISED_MERSENNE) { - A.copy(B); - if (ECP.CURVE_A == 1) { - A.add(one); - B.sub(one); - } else { - A.sub(one); - B.add(one); - } - A.norm(); - B.norm(); - - A.div2(); - B.div2(); - B.div2(); - - K.copy(B); - K.neg(); - K.norm(); - //K.inverse(null); - K.invsqrt(K, w1); - - rfc = ctx.FP.RIADZ; - if (rfc == 1) { - // RFC7748 - A.mul(K); - K.mul(w1); - //K=K.sqrt(null); - } else { - B.sqr(); - } - } else { - A.copy(new ctx.FP(156326)); - rfc = 1; - } - - t.sqr(); - if (ctx.FP.PM1D2 == 2) { - t.add(t); - qnr = 2; - } - if (ctx.FP.PM1D2 == 1) { - t.neg(); - qnr = -1; - } - if (ctx.FP.PM1D2 > 2) { - t.imul(ctx.FP.PM1D2); - qnr = ctx.FP.PM1D2; - } - t.norm(); - D.copy(t); - D.add(one); - D.norm(); - X1.copy(A); - X1.neg(); - X1.norm(); - X2.copy(X1); - X2.mul(t); - - // Figure out RHS of Montgomery curve in rational form gx1/d^3 - - w.copy(X1); - w.sqr(); - w1.copy(w); - w1.mul(X1); - w.mul(A); - w.mul(D); - w1.add(w); - w2.copy(D); - w2.sqr(); - - if (rfc == 0) { - w.copy(X1); - w.mul(B); - w2.mul(w); - w1.add(w2); - } else { - w2.mul(X1); - w1.add(w2); - } - w1.norm(); - - B.copy(w1); - B.mul(D); - qres = B.qr(hint); - w.copy(B); - w.inverse(hint); - D.copy(w); - D.mul(w1); - X1.mul(D); - X2.mul(D); - D.sqr(); - - w1.copy(B); - w1.imul(qnr); - w.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - w.mul(hint); - w2.copy(D); - w2.mul(h); - - X1.cmove(X2, 1 - qres); - B.cmove(w1, 1 - qres); - hint.cmove(w, 1 - qres); - D.cmove(w2, 1 - qres); - - Y.copy(B.sqrt(hint)); - Y.mul(D); - - /* - Y.copy(B.sqrt(hint)); - Y.mul(D); - - B.imul(qnr); - w.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - hint.mul(w); - - Y3.copy(B.sqrt(hint)); - D.mul(h); - Y3.mul(D); - - X1.cmove(X2,1-qres); - Y.cmove(Y3,1-qres); -*/ - w.copy(Y); - w.neg(); - w.norm(); - Y.cmove(w, qres ^ Y.sign()); - - if (rfc == 0) { - X1.mul(K); - Y.mul(K); - } - - if (ctx.FP.MODTYPE == ctx.FP.GENERALISED_MERSENNE) { - // GOLDILOCKS isogeny - t.copy(X1); - t.sqr(); - w.copy(t); - w.add(one); - w.norm(); - t.sub(one); - t.norm(); - w1.copy(t); - w1.mul(Y); - w1.add(w1); - X2.copy(w1); - X2.add(w1); - X2.norm(); - t.sqr(); - Y.sqr(); - Y.add(Y); - Y.add(Y); - Y.norm(); - B.copy(t); - B.add(Y); - B.norm(); - - w2.copy(Y); - w2.sub(t); - w2.norm(); - w2.mul(X1); - t.mul(X1); - Y.div2(); - w1.copy(Y); - w1.mul(w); - w1.rsub(t); - w1.norm(); - - t.copy(X2); - t.mul(w1); - P = new ECP(); - P.x.copy(t); - t.copy(w2); - t.mul(B); - P.y.copy(t); - t.copy(w1); - t.mul(B); - P.z.copy(t); - - return P; - } else { - w1.copy(X1); - w1.add(one); - w1.norm(); - w2.copy(X1); - w2.sub(one); - w2.norm(); - t.copy(w1); - t.mul(Y); - X1.mul(w1); - - if (rfc == 1) X1.mul(K); - - Y.mul(w2); - P = new ECP(); - P.x.copy(X1); - P.y.copy(Y); - P.z.copy(t); - - return P; - } - } - if (ECP.CURVETYPE == ECP.WEIERSTRASS) { - // swu method - var A = new ctx.FP(0); - var B = new ctx.FP(0); - var X1 = new ctx.FP(0); - var X2 = new ctx.FP(0); - var X3 = new ctx.FP(0); - var one = new ctx.FP(1); - var Y = new ctx.FP(0); - var D = new ctx.FP(0); - var t = new ctx.FP(h); - var w = new ctx.FP(0); - var D2 = new ctx.FP(0); - var hint = new ctx.FP(0); - var GX1 = new ctx.FP(0); - //var Y3=new ctx.FP(0); - var sgn = t.sign(); - - if (ECP.CURVE_A != 0 || ECP.HTC_ISO != 0) { - if (ECP.HTC_ISO != 0) { - A.rcopy(ctx.ROM_CURVE.CURVE_Ad); - B.rcopy(ctx.ROM_CURVE.CURVE_Bd); - } else { - A.copy(new ctx.FP(ECP.CURVE_A)); - B.rcopy(ctx.ROM_CURVE.CURVE_B); - } - // SSWU Method - t.sqr(); - t.imul(ctx.FP.RIADZ); - w.copy(t); - w.add(one); - w.norm(); - - w.mul(t); - D.copy(A); - D.mul(w); - - w.add(one); - w.norm(); - w.mul(B); - w.neg(); - w.norm(); - - X2.copy(w); - X3.copy(t); - X3.mul(X2); - - // x^3+Ad^2x+Bd^3 - GX1.copy(X2); - GX1.sqr(); - D2.copy(D); - D2.sqr(); - w.copy(A); - w.mul(D2); - GX1.add(w); - GX1.norm(); - GX1.mul(X2); - D2.mul(D); - w.copy(B); - w.mul(D2); - GX1.add(w); - GX1.norm(); - - w.copy(GX1); - w.mul(D); - var qr = w.qr(hint); - D.copy(w); - D.inverse(hint); - D.mul(GX1); - X2.mul(D); - X3.mul(D); - t.mul(h); - D2.copy(D); - D2.sqr(); - - D.copy(D2); - D.mul(t); - t.copy(w); - t.imul(ctx.FP.RIADZ); - X1.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - X1.mul(hint); - - X2.cmove(X3, 1 - qr); - D2.cmove(D, 1 - qr); - w.cmove(t, 1 - qr); - hint.cmove(X1, 1 - qr); - - Y.copy(w.sqrt(hint)); - Y.mul(D2); - - /* - Y.copy(w.sqrt(hint)); - Y.mul(D2); - - D2.mul(t); - w.imul(ctx.FP.RIADZ); - - X1.rcopy(ctx.ROM_CURVE.CURVE_HTPC); - hint.mul(X1); - - Y3.copy(w.sqrt(hint)); - Y3.mul(D2); - - X2.cmove(X3,1-qr); - Y.cmove(Y3,1-qr); -*/ - var ne = Y.sign() ^ sgn; - w.copy(Y); - w.neg(); - w.norm(); - Y.cmove(w, ne); - - if (ECP.HTC_ISO != 0) { - var k = 0; - var isox = ECP.HTC_ISO; - var isoy = (3 * (isox - 1)) / 2; - // xnum - var xnum = new ctx.FP(0); - xnum.rcopy(ctx.ROM_CURVE.PC[k++]); - for (var i = 0; i < isox; i++) { - xnum.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - xnum.add(w); - xnum.norm(); - } - // xden - var xden = new ctx.FP(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - xden.add(w); - xden.norm(); - for (var i = 0; i < isox - 2; i++) { - xden.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - xden.add(w); - xden.norm(); - } - // ynum - var ynum = new ctx.FP(0); - ynum.rcopy(ctx.ROM_CURVE.PC[k++]); - for (var i = 0; i < isoy; i++) { - ynum.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - ynum.add(w); - ynum.norm(); - } - // yden - var yden = new ctx.FP(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - yden.add(w); - yden.norm(); - for (var i = 0; i < isoy - 1; i++) { - yden.mul(X2); - w.rcopy(ctx.ROM_CURVE.PC[k++]); - yden.add(w); - yden.norm(); - } - ynum.mul(Y); - w.copy(xnum); - w.mul(yden); - P.x.copy(w); - w.copy(ynum); - w.mul(xden); - P.y.copy(w); - w.copy(xden); - w.mul(yden); - P.z.copy(w); - return P; - } else { - var x = X2.redc(); - var y = Y.redc(); - P.setxy(x, y); - return P; - } - } else { - // Shallue and van de Woestijne - var Z = ctx.FP.RIADZ; - X1.copy(new ctx.FP(Z)); - X3.copy(X1); - var A = ECP.RHS(X1); - B.rcopy(ctx.ROM_FIELD.SQRTm3); - B.imul(Z); - - t.sqr(); - Y.copy(A); - Y.mul(t); - t.copy(one); - t.add(Y); - t.norm(); - Y.rsub(one); - Y.norm(); - D.copy(t); - D.mul(Y); - D.mul(B); - - var w = new ctx.FP(A); - ctx.FP.tpo(D, w); - - w.mul(B); - if (w.sign() == 1) { - w.neg(); - w.norm(); - } - w.mul(B); - w.mul(h); - w.mul(Y); - w.mul(D); - - X1.neg(); - X1.norm(); - X1.div2(); - X2.copy(X1); - X1.sub(w); - X1.norm(); - X2.add(w); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - t.sqr(); - t.mul(D); - t.sqr(); - A.mul(t); - X3.add(A); - X3.norm(); - - var rhs = ECP.RHS(X2); - X3.cmove(X2, rhs.qr(null)); - rhs.copy(ECP.RHS(X1)); - X3.cmove(X1, rhs.qr(null)); - rhs.copy(ECP.RHS(X3)); - Y.copy(rhs.sqrt(null)); - - var ne = Y.sign() ^ sgn; - w.copy(Y); - w.neg(); - w.norm(); - Y.cmove(w, ne); - - var x = X3.redc(); - var y = Y.redc(); - P.setxy(x, y); - return P; - } - } - return P; - }; - - /* - ECP.mapit = function(h) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx = ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - var P=ctx.ECP.hap2point(x); - P.cfp(); - return P; - }; -*/ - return ECP; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP = ECP; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp2.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp2.js deleted file mode 100644 index 544ca7601..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp2.js +++ /dev/null @@ -1,1094 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Weierstrass elliptic curve functions over ctx.FP2 */ - -var ECP2 = function (ctx) { - 'use strict'; - - /* Constructor, set this=O */ - var ECP2 = function () { - this.x = new ctx.FP2(0); - this.y = new ctx.FP2(1); - this.z = new ctx.FP2(0); - }; - - ECP2.prototype = { - /* Test this=O? */ - is_infinity: function () { - return this.x.iszilch() && this.z.iszilch(); - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - this.y.copy(P.y); - this.z.copy(P.z); - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - this.y.one(); - this.z.zero(); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - this.y.cmove(Q.y, d); - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP2(), - m, - babs; - - (m = b >> 31), (babs = (b ^ m) - m); - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP2.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP2.teq(babs, 1)); - this.cmove(W[2], ECP2.teq(babs, 2)); - this.cmove(W[3], ECP2.teq(babs, 3)); - this.cmove(W[4], ECP2.teq(babs, 4)); - this.cmove(W[5], ECP2.teq(babs, 5)); - this.cmove(W[6], ECP2.teq(babs, 6)); - this.cmove(W[7], ECP2.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - equals: function (Q) { - var a, b; - - a = new ctx.FP2(0); - a.copy(this.x); - b = new ctx.FP2(0); - b.copy(Q.x); - - a.copy(this.x); - a.mul(Q.z); - a.reduce(); - b.copy(Q.x); - b.mul(this.z); - b.reduce(); - if (!a.equals(b)) { - return false; - } - - a.copy(this.y); - a.mul(Q.z); - a.reduce(); - b.copy(Q.y); - b.mul(this.z); - b.reduce(); - if (!a.equals(b)) { - return false; - } - - return true; - }, - - /* set this=-this */ - neg: function () { - this.y.norm(); - this.y.neg(); - this.y.norm(); - return; - }, - - /* convert this to affine, from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP2(1); - - if (this.z.equals(one)) { - this.x.reduce(); - this.y.reduce(); - return; - } - - this.z.inverse(null); - - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z.copy(one); - }, - - /* extract affine x as ctx.FP2 */ - getX: function () { - var W = new ECP2(); - W.copy(this); - W.affine(); - return W.x; - }, - - /* extract affine y as ctx.FP2 */ - getY: function () { - var W = new ECP2(); - W.copy(this); - W.affine(); - return W.y; - }, - - /* extract projective x */ - getx: function () { - return this.x; - }, - - /* extract projective y */ - gety: function () { - return this.y; - }, - - /* extract projective z */ - getz: function () { - return this.z; - }, - - /* convert this to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP2(); - W.copy(this); - W.affine(); - W.x.toBytes(t); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ctx.ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (!compress) { - W.y.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i + 2 * ctx.BIG.MODBYTES] = t[i]; - } else { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } - } else { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (!compress) { - b[0] = 0x04; - W.y.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) b[i + 2 * ctx.BIG.MODBYTES + 1] = t[i]; - } else { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - } - } - }, - - /* convert this to hex string */ - toString: function () { - var W = new ECP2(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - W.affine(); - return '(' + W.x.toString() + ',' + W.y.toString() + ')'; - }, - - /* set this=(x,y) */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x.copy(ix); - this.y.copy(iy); - this.z.one(); - this.x.norm(); - - rhs = ECP2.RHS(this.x); - - y2 = new ctx.FP2(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - }, - - /* set this=(x,.) */ - setx: function (ix, s) { - var rhs, h; - - this.x.copy(ix); - this.z.one(); - this.x.norm(); - - rhs = ECP2.RHS(this.x); - //alert("Into setx= rhs= "+rhs.toString()); - if (rhs.qr(h) == 1) { - rhs.sqrt(h); - if (rhs.sign() != s) rhs.neg(); - rhs.reduce(); - this.y.copy(rhs); - } else { - this.inf(); - } - }, - - /* set this*=q, where q is Modulus, using Frobenius */ - frob: function (X) { - var X2; - - X2 = new ctx.FP2(X); //X2.copy(X); - X2.sqr(); - this.x.conj(); - this.y.conj(); - this.z.conj(); - this.z.reduce(); - this.x.mul(X2); - this.y.mul(X2); - this.y.mul(X); - }, - - /* this+=this */ - dbl: function () { - var iy, t0, t1, t2, x3, y3; - - iy = new ctx.FP2(0); - iy.copy(this.y); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - iy.mul_ip(); - iy.norm(); - } - - t0 = new ctx.FP2(0); - t0.copy(this.y); - t0.sqr(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.mul_ip(); - } - t1 = new ctx.FP2(0); - t1.copy(iy); - t1.mul(this.z); - t2 = new ctx.FP2(0); - t2.copy(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.mul_ip(); - t2.norm(); - } - - x3 = new ctx.FP2(0); - x3.copy(t2); - x3.mul(this.z); - - y3 = new ctx.FP2(0); - y3.copy(t0); - - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t2.norm(); - t0.sub(t2); - t0.norm(); //y^2-9bz^2 - y3.mul(t0); - y3.add(x3); //(y^2+3z*2)(y^2-9z^2)+3b.z^2.8y^2 - t1.copy(this.x); - t1.mul(iy); // - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); //(y^2-9bz^2)xy2 - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - - return 1; - }, - - /* this+=Q - return 0 for add, 1 for double, -1 for O */ - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3; - - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP2(0); - t0.copy(this.x); - t0.mul(Q.x); // x.Q.x - t1 = new ctx.FP2(0); - t1.copy(this.y); - t1.mul(Q.y); // y.Q.y - - t2 = new ctx.FP2(0); - t2.copy(this.z); - t2.mul(Q.z); - t3 = new ctx.FP2(0); - t3.copy(this.x); - t3.add(this.y); - t3.norm(); //t3=X1+Y1 - t4 = new ctx.FP2(0); - t4.copy(Q.x); - t4.add(Q.y); - t4.norm(); //t4=X2+Y2 - t3.mul(t4); //t3=(X1+Y1)(X2+Y2) - t4.copy(t0); - t4.add(t1); //t4=X1.X2+Y1.Y2 - - t3.sub(t4); - t3.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t3.mul_ip(); - t3.norm(); //t3=(X1+Y1)(X2+Y2)-(X1.X2+Y1.Y2) = X1.Y2+X2.Y1 - } - - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //t4=Y1+Z1 - x3 = new ctx.FP2(0); - x3.copy(Q.y); - x3.add(Q.z); - x3.norm(); //x3=Y2+Z2 - - t4.mul(x3); //t4=(Y1+Z1)(Y2+Z2) - x3.copy(t1); // - x3.add(t2); //X3=Y1.Y2+Z1.Z2 - - t4.sub(x3); - t4.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t4.mul_ip(); - t4.norm(); //t4=(Y1+Z1)(Y2+Z2) - (Y1.Y2+Z1.Z2) = Y1.Z2+Y2.Z1 - } - - x3.copy(this.x); - x3.add(this.z); - x3.norm(); // x3=X1+Z1 - y3 = new ctx.FP2(0); - y3.copy(Q.x); - y3.add(Q.z); - y3.norm(); // y3=X2+Z2 - x3.mul(y3); // x3=(X1+Z1)(X2+Z2) - y3.copy(t0); - y3.add(t2); // y3=X1.X2+Z1+Z2 - y3.rsub(x3); - y3.norm(); // y3=(X1+Z1)(X2+Z2) - (X1.X2+Z1.Z2) = X1.Z2+X2.Z1 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.mul_ip(); - t0.norm(); // x.Q.x - t1.mul_ip(); - t1.norm(); // y.Q.y - } - - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.mul_ip(); - t2.norm(); - } - - z3 = new ctx.FP2(0); - z3.copy(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - y3.mul_ip(); - y3.norm(); - } - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - - return 0; - }, - - /* this-=Q */ - sub: function (Q) { - var D; - var NQ = new ECP2(); - NQ.copy(Q); - NQ.neg(); - D = this.add(NQ); - return D; - }, - - /* P*=e */ - mul: function (e) { - /* fixed size windows */ - var mt = new ctx.BIG(), - t = new ctx.BIG(), - C = new ECP2(), - P = new ECP2(), - Q = new ECP2(), - W = [], - w = [], - i, - nb, - s, - ns; - - if (this.is_infinity()) { - return new ECP2(); - } - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP2(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP2(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - - return P; - }, - - // clear cofactor - cfp: function () { - var fa = new ctx.BIG(0), - fb = new ctx.BIG(0), - x, - T, - K, - X, - xQ, - x2Q; - - // Fast Hashing to G2 - Fuentes-Castaneda, Knapp and Rodriguez-Henriquez - fa.rcopy(ctx.ROM_FIELD.Fra); - fb.rcopy(ctx.ROM_FIELD.Frb); - X = new ctx.FP2(fa, fb); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - X.inverse(null); - X.norm(); - } - - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - T = new ECP2(); - T.copy(this); - T = T.mul(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - T.neg(); - } - K = new ECP2(); - K.copy(T); - K.dbl(); - K.add(T); //K.affine(); - - K.frob(X); - this.frob(X); - this.frob(X); - this.frob(X); - this.add(T); - this.add(K); - T.frob(X); - T.frob(X); - this.add(T); - } - - if (ctx.ECP.CURVE_PAIRING_TYPE > ctx.ECP.BN) { - xQ = this.mul(x); - x2Q = xQ.mul(x); - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - xQ.neg(); - } - - x2Q.sub(xQ); - x2Q.sub(this); - - xQ.sub(this); - xQ.frob(X); - - this.dbl(); - this.frob(X); - this.frob(X); - - this.add(x2Q); - this.add(xQ); - } - }, - }; - - // set to group generator - ECP2.generator = function () { - var G = new ECP2(), - A = new ctx.BIG(0), - B = new ctx.BIG(0), - QX, - QY; - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxb); - QX = new ctx.FP2(0); - QX.bset(A, B); - A.rcopy(ctx.ROM_CURVE.CURVE_Pya); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyb); - QY = new ctx.FP2(0); - QY.bset(A, B); - G.setxy(QX, QY); - return G; - }; - - /* convert from byte array to point */ - ECP2.fromBytes = function (b) { - var t = []; - var alt = false; - var typ = b[0]; - var P = new ECP2(); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ctx.ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - var rx = ctx.FP2.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 2 * ctx.BIG.MODBYTES]; - var ry = ctx.FP2.fromBytes(t); - P.setxy(rx, ry); - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setx(rx, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - } - } else { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 1]; - var rx = ctx.FP2.fromBytes(t); - if (typ == 0x04) { - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 2 * ctx.BIG.MODBYTES + 1]; - var ry = ctx.FP2.fromBytes(t); - P.setxy(rx, ry); - } else { - P.setx(rx, typ & 1); - } - } - return P; - }; - - /* Calculate RHS of curve equation x^3+B */ - ECP2.RHS = function (x) { - var r, c, b; - - //x.norm(); - r = new ctx.FP2(x); //r.copy(x); - r.sqr(); - - c = new ctx.BIG(0); - c.rcopy(ctx.ROM_CURVE.CURVE_B); - b = new ctx.FP2(c); //b.bseta(c); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b.div_ip(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b.norm(); - b.mul_ip(); - b.norm(); - } - - r.mul(x); - r.add(b); - - r.reduce(); - - return r; - }; - - /* P=u0.Q0+u1*Q1+u2*Q2+u3*Q3 */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - ECP2.mul4 = function (Q, u) { - var W = new ECP2(), - P = new ECP2(), - T = [], - mt = new ctx.BIG(), - t = [], - w = [], - s = [], - i, - j, - k, - nb, - bt, - pb; - - for (i = 0; i < 4; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - //Q[i].affine(); - } - - T[0] = new ECP2(); - T[0].copy(Q[0]); // Q[0] - T[1] = new ECP2(); - T[1].copy(T[0]); - T[1].add(Q[1]); // Q[0]+Q[1] - T[2] = new ECP2(); - T[2].copy(T[0]); - T[2].add(Q[2]); // Q[0]+Q[2] - T[3] = new ECP2(); - T[3].copy(T[1]); - T[3].add(Q[2]); // Q[0]+Q[1]+Q[2] - T[4] = new ECP2(); - T[4].copy(T[0]); - T[4].add(Q[3]); // Q[0]+Q[3] - T[5] = new ECP2(); - T[5].copy(T[1]); - T[5].add(Q[3]); // Q[0]+Q[1]+Q[3] - T[6] = new ECP2(); - T[6].copy(T[2]); - T[6].add(Q[3]); // Q[0]+Q[2]+Q[3] - T[7] = new ECP2(); - T[7].copy(T[3]); - T[7].add(Q[3]); // Q[0]+Q[1]+Q[2]+Q[3] - - // Make it odd - pb = 1 - t[0].parity(); - t[0].inc(pb); - t[0].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 4; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s[i] = 2 * t[0].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w[i] += bt * k; - k *= 2; - } - } - - // Main loop - P.select(T, 2 * w[nb - 1] + 1); - for (i = nb - 2; i >= 0; i--) { - P.dbl(); - W.select(T, 2 * w[i] + s[i]); - P.add(W); - } - - // apply correction - W.copy(P); - W.sub(Q[0]); - P.cmove(W, pb); - return P; - }; - - /* return 1 if b==c, no branching */ - ECP2.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* Hunt and Peck a BIG to a curve point - ECP2.hap2point = function(h) - { - var one=new ctx.BIG(1); - var x=new ctx.BIG(h); - var Q,X2; - for (;;) { - X2 = new ctx.FP2(one, x); - Q = new ECP2(); - Q.setx(X2,0); - if (!Q.is_infinity()) break; - x.inc(1); - x.norm(); - } - return Q; - }; */ - - /* Constant time Map to Point */ - ECP2.map2point = function (H) { - // Shallue and van de Woestijne method. - var sgn, ne; - var NY = new ctx.FP2(1); - var T = new ctx.FP2(H); - sgn = T.sign(); - if (ctx.ECP.HTC_ISO_G2 == 0) { - var Z = new ctx.FP(ctx.FP.RIADZG2A); - var X1 = new ctx.FP2(Z); - var A = ECP2.RHS(X1); - var W = new ctx.FP2(A); - if ( - ctx.FP.RIADZG2A == -1 && - ctx.FP.RIADZG2B == 0 && - ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE && - ctx.ROM_CURVE.CURVE_B_I == 4 - ) { - // special case for BLS12381 - W.copy(new ctx.FP2(2, 1)); - } else { - W.sqrt(null); - } - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_FIELD.SQRTm3); - Z.mul(s); - - T.sqr(); - var Y = new ctx.FP2(A); - Y.mul(T); - T.copy(NY); - T.add(Y); - T.norm(); - Y.rsub(NY); - Y.norm(); - NY.copy(T); - NY.mul(Y); - - NY.pmul(Z); - NY.inverse(null); - - W.pmul(Z); - if (W.sign() == 1) { - W.neg(); - W.norm(); - } - W.pmul(Z); - W.mul(H); - W.mul(Y); - W.mul(NY); - - var X3 = new ctx.FP2(X1); - X1.neg(); - X1.norm(); - X1.div2(); - var X2 = new ctx.FP2(X1); - X1.sub(W); - X1.norm(); - X2.add(W); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - T.sqr(); - T.mul(NY); - T.sqr(); - A.mul(T); - X3.add(A); - X3.norm(); - - Y.copy(ECP2.RHS(X2)); - X3.cmove(X2, Y.qr(null)); - Y.copy(ECP2.RHS(X1)); - X3.cmove(X1, Y.qr(null)); - Y.copy(ECP2.RHS(X3)); - Y.sqrt(null); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var P = new ECP2(); - P.setxy(X3, Y); - return P; - } else { - var Q = new ctx.ECP2(); - var ra = new ctx.FP(0); - var rb = new ctx.FP(0); - ra.rcopy(ctx.ROM_CURVE.CURVE_Adr); - rb.rcopy(ctx.ROM_CURVE.CURVE_Adi); - var Ad = new ctx.FP2(ra, rb); - ra.rcopy(ctx.ROM_CURVE.CURVE_Bdr); - rb.rcopy(ctx.ROM_CURVE.CURVE_Bdi); - var Bd = new ctx.FP2(ra, rb); - var ZZ = new ctx.FP2(ctx.FP.RIADZG2A, ctx.FP.RIADZG2B); - var hint = new ctx.FP(0); - - T.sqr(); - T.mul(ZZ); - var W = new ctx.FP2(T); - W.add(NY); - W.norm(); - - W.mul(T); - var D = new ctx.FP2(Ad); - D.mul(W); - - W.add(NY); - W.norm(); - W.mul(Bd); - W.neg(); - W.norm(); - - var X2 = new ctx.FP2(W); - var X3 = new ctx.FP2(T); - X3.mul(X2); - - var GX1 = new ctx.FP2(X2); - GX1.sqr(); - var D2 = new ctx.FP2(D); - D2.sqr(); - W.copy(Ad); - W.mul(D2); - GX1.add(W); - GX1.norm(); - GX1.mul(X2); - D2.mul(D); - W.copy(Bd); - W.mul(D2); - GX1.add(W); - GX1.norm(); // x^3+Ax+b - - W.copy(GX1); - W.mul(D); - var qr = W.qr(hint); - D.copy(W); - D.inverse(hint); - D.mul(GX1); - X2.mul(D); - X3.mul(D); - T.mul(H); - D2.copy(D); - D2.sqr(); - - D.copy(D2); - D.mul(T); - T.copy(W); - T.mul(ZZ); - - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_CURVE.CURVE_HTPC2); - s.mul(hint); - - X2.cmove(X3, 1 - qr); - W.cmove(T, 1 - qr); - D2.cmove(D, 1 - qr); - hint.cmove(s, 1 - qr); - - var Y = new ctx.FP2(W); - Y.sqrt(hint); - Y.mul(D2); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var k = 0; - var isox = ctx.ECP.HTC_ISO_G2; - var isoy = (3 * (isox - 1)) / 2; - - // xnum - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - var xnum = new ctx.FP2(ra, rb); - k++; - for (var i = 0; i < isox; i++) { - xnum.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - xnum.add(W); - xnum.norm(); - } - - //xden - var xden = new ctx.FP2(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - xden.add(W); - xden.norm(); - for (var i = 0; i < isox - 2; i++) { - xden.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - xden.add(W); - xden.norm(); - } - - //ynum - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - var ynum = new ctx.FP2(ra, rb); - k++; - for (var i = 0; i < isoy; i++) { - ynum.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - ynum.add(W); - ynum.norm(); - } - - //yden - var yden = new ctx.FP2(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - yden.add(W); - yden.norm(); - for (var i = 0; i < isoy - 1; i++) { - yden.mul(X2); - ra.rcopy(ctx.ROM_CURVE.PCR[k]); - rb.rcopy(ctx.ROM_CURVE.PCI[k]); - W.copy(new ctx.FP2(ra, rb)); - k++; - yden.add(W); - yden.norm(); - } - - ynum.mul(Y); - - T.copy(xnum); - T.mul(yden); - Q.x.copy(T); - T.copy(ynum); - T.mul(xden); - Q.y.copy(T); - T.copy(xden); - T.mul(yden); - Q.z.copy(T); - - return Q; - } - }; - - /* Map octet string to curve point - ECP2.mapit = function(h) - { - var q=new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx=ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - - var Q=ECP2.hap2point(x); - Q.cfp(); - return Q; - };*/ - - return ECP2; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP2 = ECP2; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp4.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp4.js deleted file mode 100644 index a1cb9407b..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp4.js +++ /dev/null @@ -1,970 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Weierstrass elliptic curve functions over ctx.FP4 */ - -var ECP4 = function (ctx) { - 'use strict'; - - /* Constructor, set this=O */ - var ECP4 = function () { - this.x = new ctx.FP4(0); - this.y = new ctx.FP4(1); - this.z = new ctx.FP4(0); - }; - - ECP4.prototype = { - /* Test this=O? */ - is_infinity: function () { - return this.x.iszilch() && this.z.iszilch(); - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - this.y.copy(P.y); - this.z.copy(P.z); - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - this.y.one(); - this.z.zero(); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - this.y.cmove(Q.y, d); - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP4(), - m = b >> 31, - babs = (b ^ m) - m; - - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP4.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP4.teq(babs, 1)); - this.cmove(W[2], ECP4.teq(babs, 2)); - this.cmove(W[3], ECP4.teq(babs, 3)); - this.cmove(W[4], ECP4.teq(babs, 4)); - this.cmove(W[5], ECP4.teq(babs, 5)); - this.cmove(W[6], ECP4.teq(babs, 6)); - this.cmove(W[7], ECP4.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - equals: function (Q) { - var a, b; - - a = new ctx.FP4(this.x); - b = new ctx.FP4(Q.x); - - a.mul(Q.z); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - a.copy(this.y); - a.mul(Q.z); - b.copy(Q.y); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - return true; - }, - - /* set this=-this */ - neg: function () { - this.y.norm(); - this.y.neg(); - this.y.norm(); - return; - }, - - /* convert this to affine, from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP4(1); - - if (this.z.equals(one)) { - this.x.reduce(); - this.y.reduce(); - return; - } - - this.z.inverse(null); - - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z.copy(one); - }, - - /* extract affine x as ctx.FP4 */ - getX: function () { - var W = new ECP4(); - W.copy(this); - W.affine(); - return W.x; - }, - - /* extract affine y as ctx.FP4 */ - getY: function () { - var W = new ECP4(); - W.copy(this); - W.affine(); - return W.y; - }, - - /* extract projective x */ - getx: function () { - return this.x; - }, - - /* extract projective y */ - gety: function () { - return this.y; - }, - - /* extract projective z */ - getz: function () { - return this.z; - }, - - /* convert this to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP4(); - W.copy(this); - W.affine(); - W.x.toBytes(t); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (!compress) { - W.y.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i + 4 * ctx.BIG.MODBYTES] = t[i]; - } else { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } - } else { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (!compress) { - b[0] = 0x04; - W.y.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) b[i + 4 * ctx.BIG.MODBYTES + 1] = t[i]; - } else { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - } - } - }, - - /* convert this to hex string */ - toString: function () { - var W = new ECP4(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - W.affine(); - return '(' + W.x.toString() + ',' + W.y.toString() + ')'; - }, - - /* set this=(x,y) */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x.copy(ix); - this.y.copy(iy); - this.z.one(); - this.x.norm(); - - rhs = ECP4.RHS(this.x); - - y2 = new ctx.FP4(this.y); //y2.copy(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - }, - - /* set this=(x,.) */ - setx: function (ix, s) { - var rhs, h; - - this.x.copy(ix); - this.z.one(); - this.x.norm(); - rhs = ECP4.RHS(this.x); - - if (rhs.qr(h) == 1) { - rhs.sqrt(h); - if (rhs.sign() != s) rhs.neg(); - rhs.reduce(); - this.y.copy(rhs); - } else { - this.inf(); - } - }, - - /* set this*=q, where q is Modulus, using Frobenius */ - frob: function (F, n) { - for (var i = 0; i < n; i++) { - this.x.frob(F[2]); - this.x.pmul(F[0]); - - this.y.frob(F[2]); - this.y.pmul(F[1]); - this.y.times_i(); - - this.z.frob(F[2]); - } - }, - - /* this+=this */ - dbl: function () { - var iy, t0, t1, t2, x3, y3; - - iy = new ctx.FP4(this.y); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - iy.times_i(); - iy.norm(); - } - - t0 = new ctx.FP4(this.y); - t0.sqr(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - } - t1 = new ctx.FP4(iy); - t1.mul(this.z); - t2 = new ctx.FP4(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - x3 = new ctx.FP4(t2); - x3.mul(this.z); - - y3 = new ctx.FP4(t0); - - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t2.norm(); - t0.sub(t2); - t0.norm(); //y^2-9bz^2 - y3.mul(t0); - y3.add(x3); //(y^2+3z*2)(y^2-9z^2)+3b.z^2.8y^2 - t1.copy(this.x); - t1.mul(iy); // - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); //(y^2-9bz^2)xy2 - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - - return 1; - }, - - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3; - - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP4(this.x); - t0.mul(Q.x); // x.Q.x - t1 = new ctx.FP4(this.y); - t1.mul(Q.y); // y.Q.y - - t2 = new ctx.FP4(this.z); - t2.mul(Q.z); - t3 = new ctx.FP4(this.x); - t3.add(this.y); - t3.norm(); //t3=X1+Y1 - t4 = new ctx.FP4(Q.x); - t4.add(Q.y); - t4.norm(); //t4=X2+Y2 - t3.mul(t4); //t3=(X1+Y1)(X2+Y2) - t4.copy(t0); - t4.add(t1); //t4=X1.X2+Y1.Y2 - - t3.sub(t4); - t3.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t3.times_i(); //t3=(X1+Y1)(X2+Y2)-(X1.X2+Y1.Y2) = X1.Y2+X2.Y1 - } - - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //t4=Y1+Z1 - x3 = new ctx.FP4(Q.y); - x3.add(Q.z); - x3.norm(); //x3=Y2+Z2 - - t4.mul(x3); //t4=(Y1+Z1)(Y2+Z2) - x3.copy(t1); // - x3.add(t2); //X3=Y1.Y2+Z1.Z2 - - t4.sub(x3); - t4.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t4.times_i(); //t4=(Y1+Z1)(Y2+Z2) - (Y1.Y2+Z1.Z2) = Y1.Z2+Y2.Z1 - } - - x3.copy(this.x); - x3.add(this.z); - x3.norm(); // x3=X1+Z1 - y3 = new ctx.FP4(Q.x); - y3.add(Q.z); - y3.norm(); // y3=X2+Z2 - x3.mul(y3); // x3=(X1+Z1)(X2+Z2) - y3.copy(t0); - y3.add(t2); // y3=X1.X2+Z1+Z2 - y3.rsub(x3); - y3.norm(); // y3=(X1+Z1)(X2+Z2) - (X1.X2+Z1.Z2) = X1.Z2+X2.Z1 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - t1.times_i(); - } - - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - z3 = new ctx.FP4(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - y3.times_i(); - } - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - - return 0; - }, - - /* this-=Q */ - sub: function (Q) { - var D; - var NQ = new ECP4(); - NQ.copy(Q); - NQ.neg(); - D = this.add(NQ); - return D; - }, - - /* P*=e */ - mul: function (e) { - /* fixed size windows */ - var mt = new ctx.BIG(), - t = new ctx.BIG(), - C = new ECP4(), - P = new ECP4(), - Q = new ECP4(), - W = [], - w = [], - i, - nb, - s, - ns; - - if (this.is_infinity()) { - return new ECP4(); - } - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP4(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP4(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - P.affine(); - - return P; - }, - - cfp: function () { - var F = ECP4.frob_constants(), - x, - xQ, - x2Q, - x3Q, - x4Q; - - /* Fast Hashing to G2 - Fuentes-Castaneda, Knapp and Rodriguez-Henriquez */ - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - xQ = this.mul(x); - x2Q = xQ.mul(x); - x3Q = x2Q.mul(x); - x4Q = x3Q.mul(x); - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - xQ.neg(); - x3Q.neg(); - } - - x4Q.sub(x3Q); - x4Q.sub(this); - - x3Q.sub(x2Q); - x3Q.frob(F, 1); - - x2Q.sub(xQ); - x2Q.frob(F, 2); - - xQ.sub(this); - xQ.frob(F, 3); - - this.dbl(); - this.frob(F, 4); - - this.add(x4Q); - this.add(x3Q); - this.add(x2Q); - this.add(xQ); - - this.affine(); - }, - }; - - // set to group generator - ECP4.generator = function () { - var G = new ECP4(), - A = new ctx.BIG(0), - B = new ctx.BIG(0), - XA, - XB, - X, - YA, - YB, - Y; - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxab); - XA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxbb); - - XB = new ctx.FP2(A, B); - X = new ctx.FP4(XA, XB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyab); - YA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pybb); - - YB = new ctx.FP2(A, B); - Y = new ctx.FP4(YA, YB); - - G.setxy(X, Y); - - return G; - }; - - /* convert from byte array to point */ - ECP4.fromBytes = function (b) { - var t = []; - var alt = false; - var typ = b[0]; - var P = new ECP4(); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - var rx = ctx.FP4.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 4 * ctx.BIG.MODBYTES]; - var ry = ctx.FP4.fromBytes(t); - P.setxy(rx, ry); - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setx(rx, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - } - } else { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 1]; - var rx = ctx.FP4.fromBytes(t); - if (typ == 0x04) { - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 4 * ctx.BIG.MODBYTES + 1]; - var ry = ctx.FP4.fromBytes(t); - P.setxy(rx, ry); - } else { - P.setx(rx, typ & 1); - } - } - return P; - }; - - /* Calculate RHS of curve equation x^3+B */ - ECP4.RHS = function (x) { - var r, c, b; - - //x.norm(); - r = new ctx.FP4(x); //r.copy(x); - r.sqr(); - - c = new ctx.BIG(0); - c.rcopy(ctx.ROM_CURVE.CURVE_B); - b = new ctx.FP4(c); //b.bseta(c); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b.div_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b.times_i(); - } - - r.mul(x); - r.add(b); - - r.reduce(); - return r; - }; - - /* P=u0.Q0+u1*Q1+u2*Q2+u3*Q3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - ECP4.mul8 = function (Q, u) { - var W = new ECP4(), - P = new ECP4(), - T1 = [], - T2 = [], - mt = new ctx.BIG(), - t = [], - w1 = [], - s1 = [], - w2 = [], - s2 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2; - - for (i = 0; i < 8; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - //Q[i].affine(); - } - - T1[0] = new ECP4(); - T1[0].copy(Q[0]); // Q[0] - T1[1] = new ECP4(); - T1[1].copy(T1[0]); - T1[1].add(Q[1]); // Q[0]+Q[1] - T1[2] = new ECP4(); - T1[2].copy(T1[0]); - T1[2].add(Q[2]); // Q[0]+Q[2] - T1[3] = new ECP4(); - T1[3].copy(T1[1]); - T1[3].add(Q[2]); // Q[0]+Q[1]+Q[2] - T1[4] = new ECP4(); - T1[4].copy(T1[0]); - T1[4].add(Q[3]); // Q[0]+Q[3] - T1[5] = new ECP4(); - T1[5].copy(T1[1]); - T1[5].add(Q[3]); // Q[0]+Q[1]+Q[3] - T1[6] = new ECP4(); - T1[6].copy(T1[2]); - T1[6].add(Q[3]); // Q[0]+Q[2]+Q[3] - T1[7] = new ECP4(); - T1[7].copy(T1[3]); - T1[7].add(Q[3]); // Q[0]+Q[1]+Q[2]+Q[3] - - T2[0] = new ECP4(); - T2[0].copy(Q[4]); // Q[0] - T2[1] = new ECP4(); - T2[1].copy(T2[0]); - T2[1].add(Q[5]); // Q[0]+Q[1] - T2[2] = new ECP4(); - T2[2].copy(T2[0]); - T2[2].add(Q[6]); // Q[0]+Q[2] - T2[3] = new ECP4(); - T2[3].copy(T2[1]); - T2[3].add(Q[6]); // Q[0]+Q[1]+Q[2] - T2[4] = new ECP4(); - T2[4].copy(T2[0]); - T2[4].add(Q[7]); // Q[0]+Q[3] - T2[5] = new ECP4(); - T2[5].copy(T2[1]); - T2[5].add(Q[7]); // Q[0]+Q[1]+Q[3] - T2[6] = new ECP4(); - T2[6].copy(T2[2]); - T2[6].add(Q[7]); // Q[0]+Q[2]+Q[3] - T2[7] = new ECP4(); - T2[7].copy(T2[3]); - T2[7].add(Q[7]); // Q[0]+Q[1]+Q[2]+Q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 8; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - } - - // Main loop - P.select(T1, 2 * w1[nb - 1] + 1); - W.select(T2, 2 * w2[nb - 1] + 1); - P.add(W); - for (i = nb - 2; i >= 0; i--) { - P.dbl(); - W.select(T1, 2 * w1[i] + s1[i]); - P.add(W); - W.select(T2, 2 * w2[i] + s2[i]); - P.add(W); - } - - // apply correction - W.copy(P); - W.sub(Q[0]); - P.cmove(W, pb1); - - W.copy(P); - W.sub(Q[4]); - P.cmove(W, pb2); - - P.affine(); - return P; - }; - - /* return 1 if b==c, no branching */ - ECP4.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* Hunt and Peck a BIG to a curve point - ECP4.hap2point = function(h) - { - var one=new ctx.BIG(1); - var x=new ctx.BIG(h); - var Q,X2,X4; - for (;;) { - X2 = new ctx.FP2(one, x); - X4 = new ctx.FP4(X2); - Q = new ECP4(); - Q.setx(X4,0); - if (!Q.is_infinity()) break; - x.inc(1); - x.norm(); - } - return Q; - }; */ - - /* Constant time Map to Point */ - ECP4.map2point = function (H) { - // Shallue and van de Woestijne method. - var sgn, ne; - var NY = new ctx.FP4(1); - var T = new ctx.FP4(H); - sgn = T.sign(); - - var Z = new ctx.FP(ctx.FP.RIADZG2A); - var X1 = new ctx.FP4(Z); - var A = ECP4.RHS(X1); - var W = new ctx.FP4(A); - - W.sqrt(null); - - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_FIELD.SQRTm3); - Z.mul(s); - - T.sqr(); - var Y = new ctx.FP4(A); - Y.mul(T); - T.copy(NY); - T.add(Y); - T.norm(); - Y.rsub(NY); - Y.norm(); - NY.copy(T); - NY.mul(Y); - - NY.qmul(Z); - NY.inverse(null); - - W.qmul(Z); - if (W.sign() == 1) { - W.neg(); - W.norm(); - } - W.qmul(Z); - W.mul(H); - W.mul(Y); - W.mul(NY); - - var X3 = new ctx.FP4(X1); - X1.neg(); - X1.norm(); - X1.div2(); - var X2 = new ctx.FP4(X1); - X1.sub(W); - X1.norm(); - X2.add(W); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - T.sqr(); - T.mul(NY); - T.sqr(); - A.mul(T); - X3.add(A); - X3.norm(); - - Y.copy(ECP4.RHS(X2)); - X3.cmove(X2, Y.qr(null)); - Y.copy(ECP4.RHS(X1)); - X3.cmove(X1, Y.qr(null)); - Y.copy(ECP4.RHS(X3)); - Y.sqrt(null); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var P = new ECP4(); - P.setxy(X3, Y); - return P; - }; - - /* Map octet string to curve point - ECP4.mapit = function(h) - { - var q=new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx=ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - - var Q=ECP4.hap2point(x); - Q.cfp(); - return Q; - }; */ - - ECP4.frob_constants = function () { - var fa = new ctx.BIG(0), - fb = new ctx.BIG(0), - F = [], - X, - F0, - F1, - F2; - - fa.rcopy(ctx.ROM_FIELD.Fra); - fb.rcopy(ctx.ROM_FIELD.Frb); - X = new ctx.FP2(fa, fb); - - F0 = new ctx.FP2(X); - F0.sqr(); - F2 = new ctx.FP2(F0); - F2.mul_ip(); - F2.norm(); - F1 = new ctx.FP2(F2); - F1.sqr(); - F2.mul(F1); - F1.copy(X); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - F1.mul_ip(); - F1.inverse(null); - F0.copy(F1); - F0.sqr(); - } - F0.mul_ip(); - F0.norm(); - F1.mul(F0); - - F[0] = new ctx.FP2(F0); - F[1] = new ctx.FP2(F1); - F[2] = new ctx.FP2(F2); - return F; - }; - - return ECP4; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP4 = ECP4; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ecp8.js b/packages/bls-verify/src/vendor/amcl-js/src/ecp8.js deleted file mode 100644 index 7edfaba54..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ecp8.js +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Weierstrass elliptic curve functions over ctx.FP8 */ - -var ECP8 = function (ctx) { - 'use strict'; - - /* Constructor, set this=O */ - var ECP8 = function () { - this.x = new ctx.FP8(0); - this.y = new ctx.FP8(1); - this.z = new ctx.FP8(0); - }; - - ECP8.prototype = { - /* Test this=O? */ - is_infinity: function () { - return this.x.iszilch() && this.z.iszilch(); - }, - - /* copy this=P */ - copy: function (P) { - this.x.copy(P.x); - this.y.copy(P.y); - this.z.copy(P.z); - }, - - /* set this=O */ - inf: function () { - this.x.zero(); - this.y.one(); - this.z.zero(); - }, - - /* conditional move of Q to P dependant on d */ - cmove: function (Q, d) { - this.x.cmove(Q.x, d); - this.y.cmove(Q.y, d); - this.z.cmove(Q.z, d); - }, - - /* Constant time select from pre-computed table */ - select: function (W, b) { - var MP = new ECP8(), - m = b >> 31, - babs = (b ^ m) - m; - - babs = (babs - 1) / 2; - - this.cmove(W[0], ECP8.teq(babs, 0)); // conditional move - this.cmove(W[1], ECP8.teq(babs, 1)); - this.cmove(W[2], ECP8.teq(babs, 2)); - this.cmove(W[3], ECP8.teq(babs, 3)); - this.cmove(W[4], ECP8.teq(babs, 4)); - this.cmove(W[5], ECP8.teq(babs, 5)); - this.cmove(W[6], ECP8.teq(babs, 6)); - this.cmove(W[7], ECP8.teq(babs, 7)); - - MP.copy(this); - MP.neg(); - this.cmove(MP, m & 1); - }, - - /* Test P == Q */ - equals: function (Q) { - var a, b; - - a = new ctx.FP8(this.x); - b = new ctx.FP8(Q.x); - - a.mul(Q.z); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - a.copy(this.y); - a.mul(Q.z); - b.copy(Q.y); - b.mul(this.z); - if (!a.equals(b)) { - return false; - } - - return true; - }, - - /* set this=-this */ - neg: function () { - this.y.norm(); - this.y.neg(); - this.y.norm(); - return; - }, - - /* convert this to affine, from (x,y,z) to (x,y) */ - affine: function () { - var one; - - if (this.is_infinity()) { - return; - } - - one = new ctx.FP8(1); - - if (this.z.equals(one)) { - this.x.reduce(); - this.y.reduce(); - return; - } - - this.z.inverse(null); - this.x.mul(this.z); - this.x.reduce(); - this.y.mul(this.z); - this.y.reduce(); - this.z.copy(one); - }, - - /* extract affine x as ctx.FP8 */ - getX: function () { - var W = new ECP8(); - W.copy(this); - W.affine(); - return W.x; - }, - - /* extract affine y as ctx.FP8 */ - getY: function () { - var W = new ECP8(); - W.copy(this); - W.affine(); - return W.y; - }, - - /* extract projective x */ - getx: function () { - return this.x; - }, - - /* extract projective y */ - gety: function () { - return this.y; - }, - - /* extract projective z */ - getz: function () { - return this.z; - }, - - /* convert this to byte array */ - toBytes: function (b, compress) { - var t = []; - var alt = false; - var W = new ECP8(); - W.copy(this); - W.affine(); - W.x.toBytes(t); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i] = t[i]; - if (!compress) { - W.y.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i + 8 * ctx.BIG.MODBYTES] = t[i]; - } else { - b[0] |= 0x80; - if (W.y.islarger() == 1) b[0] |= 0x20; - } - } else { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i + 1] = t[i]; - if (!compress) { - b[0] = 0x04; - W.y.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) b[i + 8 * ctx.BIG.MODBYTES + 1] = t[i]; - } else { - b[0] = 0x02; - if (W.y.sign() == 1) b[0] = 0x03; - } - } - }, - - /* convert this to hex string */ - toString: function () { - var W = new ECP8(); - W.copy(this); - if (W.is_infinity()) { - return 'infinity'; - } - W.affine(); - return '(' + W.x.toString() + ',' + W.y.toString() + ')'; - }, - - /* set this=(x,y) */ - setxy: function (ix, iy) { - var rhs, y2; - - this.x.copy(ix); - this.y.copy(iy); - this.z.one(); - this.x.norm(); - - rhs = ECP8.RHS(this.x); - - y2 = new ctx.FP8(this.y); //y2.copy(this.y); - y2.sqr(); - - if (!y2.equals(rhs)) { - this.inf(); - } - }, - - /* set this=(x,.) */ - setx: function (ix, s) { - var rhs, h; - - this.x.copy(ix); - this.z.one(); - this.x.norm(); - rhs = ECP8.RHS(this.x); - - //alert("0. rhs= "+rhs.toString()); - if (rhs.qr(h) == 1) { - rhs.sqrt(h); - //alert("1. rhs= "+rhs.toString()); - if (rhs.sign() != s) rhs.neg(); - rhs.reduce(); - this.y.copy(rhs); - } else { - this.inf(); - } - }, - - /* set this*=q, where q is Modulus, using Frobenius */ - frob: function (F, n) { - for (var i = 0; i < n; i++) { - this.x.frob(F[2]); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - this.x.qmul(F[0]); - this.x.times_i2(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - this.x.qmul(F[0]); - this.x.times_i2(); - } - - this.y.frob(F[2]); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - this.y.qmul(F[1]); - this.y.times_i2(); - this.y.times_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - this.y.qmul(F[1]); - this.y.times_i(); - } - - this.z.frob(F[2]); - } - }, - - /* this+=this */ - dbl: function () { - var iy, t0, t1, t2, x3, y3; - - iy = new ctx.FP8(this.y); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - iy.times_i(); - iy.norm(); - } - - t0 = new ctx.FP8(this.y); - t0.sqr(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - } - t1 = new ctx.FP8(iy); - t1.mul(this.z); - t2 = new ctx.FP8(this.z); - t2.sqr(); - - this.z.copy(t0); - this.z.add(t0); - this.z.norm(); - this.z.add(this.z); - this.z.add(this.z); - this.z.norm(); - - t2.imul(3 * ctx.ROM_CURVE.CURVE_B_I); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - x3 = new ctx.FP8(t2); - x3.mul(this.z); - - y3 = new ctx.FP8(t0); - - y3.add(t2); - y3.norm(); - this.z.mul(t1); - t1.copy(t2); - t1.add(t2); - t2.add(t1); - t2.norm(); - t0.sub(t2); - t0.norm(); //y^2-9bz^2 - y3.mul(t0); - y3.add(x3); //(y^2+3z*2)(y^2-9z^2)+3b.z^2.8y^2 - t1.copy(this.x); - t1.mul(iy); // - this.x.copy(t0); - this.x.norm(); - this.x.mul(t1); - this.x.add(this.x); //(y^2-9bz^2)xy2 - - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - - return 1; - }, - - /* this+=Q */ - add: function (Q) { - var b, t0, t1, t2, t3, t4, x3, y3, z3; - - b = 3 * ctx.ROM_CURVE.CURVE_B_I; - t0 = new ctx.FP8(this.x); - t0.mul(Q.x); // x.Q.x - t1 = new ctx.FP8(this.y); - t1.mul(Q.y); // y.Q.y - - t2 = new ctx.FP8(this.z); - t2.mul(Q.z); - t3 = new ctx.FP8(this.x); - t3.add(this.y); - t3.norm(); //t3=X1+Y1 - t4 = new ctx.FP8(Q.x); - t4.add(Q.y); - t4.norm(); //t4=X2+Y2 - t3.mul(t4); //t3=(X1+Y1)(X2+Y2) - t4.copy(t0); - t4.add(t1); //t4=X1.X2+Y1.Y2 - - t3.sub(t4); - t3.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t3.times_i(); //t3=(X1+Y1)(X2+Y2)-(X1.X2+Y1.Y2) = X1.Y2+X2.Y1 - } - - t4.copy(this.y); - t4.add(this.z); - t4.norm(); //t4=Y1+Z1 - x3 = new ctx.FP8(Q.y); - x3.add(Q.z); - x3.norm(); //x3=Y2+Z2 - - t4.mul(x3); //t4=(Y1+Z1)(Y2+Z2) - x3.copy(t1); // - x3.add(t2); //X3=Y1.Y2+Z1.Z2 - - t4.sub(x3); - t4.norm(); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t4.times_i(); //t4=(Y1+Z1)(Y2+Z2) - (Y1.Y2+Z1.Z2) = Y1.Z2+Y2.Z1 - } - - x3.copy(this.x); - x3.add(this.z); - x3.norm(); // x3=X1+Z1 - y3 = new ctx.FP8(Q.x); - y3.add(Q.z); - y3.norm(); // y3=X2+Z2 - x3.mul(y3); // x3=(X1+Z1)(X2+Z2) - y3.copy(t0); - y3.add(t2); // y3=X1.X2+Z1+Z2 - y3.rsub(x3); - y3.norm(); // y3=(X1+Z1)(X2+Z2) - (X1.X2+Z1.Z2) = X1.Z2+X2.Z1 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - t0.times_i(); - t1.times_i(); - } - - x3.copy(t0); - x3.add(t0); - t0.add(x3); - t0.norm(); - t2.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - t2.times_i(); - } - - z3 = new ctx.FP8(t1); - z3.add(t2); - z3.norm(); - t1.sub(t2); - t1.norm(); - y3.imul(b); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - y3.times_i(); - } - - x3.copy(y3); - x3.mul(t4); - t2.copy(t3); - t2.mul(t1); - x3.rsub(t2); - y3.mul(t0); - t1.mul(z3); - y3.add(t1); - t0.mul(t3); - z3.mul(t4); - z3.add(t0); - - this.x.copy(x3); - this.x.norm(); - this.y.copy(y3); - this.y.norm(); - this.z.copy(z3); - this.z.norm(); - - return 0; - }, - - /* this-=Q */ - sub: function (Q) { - var D; - var NQ = new ECP8(); - NQ.copy(Q); - NQ.neg(); - D = this.add(NQ); - return D; - }, - - /* P*=e */ - mul: function (e) { - /* fixed size windows */ - var mt = new ctx.BIG(), - t = new ctx.BIG(), - C = new ECP8(), - P = new ECP8(), - Q = new ECP8(), - W = [], - w = [], - i, - nb, - s, - ns; - - if (this.is_infinity()) { - return new ECP8(); - } - - // precompute table - Q.copy(this); - Q.dbl(); - W[0] = new ECP8(); - W[0].copy(this); - - for (i = 1; i < 8; i++) { - W[i] = new ECP8(); - W[i].copy(W[i - 1]); - W[i].add(Q); - } - - // make exponent odd - add 2P if even, P if odd - t.copy(e); - s = t.parity(); - t.inc(1); - t.norm(); - ns = t.parity(); - mt.copy(t); - mt.inc(1); - mt.norm(); - t.cmove(mt, s); - Q.cmove(this, ns); - C.copy(Q); - - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - // convert exponent to signed 4-bit window - for (i = 0; i < nb; i++) { - w[i] = t.lastbits(5) - 16; - t.dec(w[i]); - t.norm(); - t.fshr(4); - } - w[nb] = t.lastbits(5); - - P.copy(W[Math.floor((w[nb] - 1) / 2)]); - for (i = nb - 1; i >= 0; i--) { - Q.select(W, w[i]); - P.dbl(); - P.dbl(); - P.dbl(); - P.dbl(); - P.add(Q); - } - P.sub(C); - P.affine(); - - return P; - }, - /* clear cofactor */ - cfp: function (h) { - var F = ECP8.frob_constants(), - x, - xQ, - x2Q, - x3Q, - x4Q, - x5Q, - x6Q, - x7Q, - x8Q; - - /* Fast Hashing to G2 - Fuentes-Castaneda, Knapp and Rodriguez-Henriquez */ - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - xQ = this.mul(x); - x2Q = xQ.mul(x); - x3Q = x2Q.mul(x); - x4Q = x3Q.mul(x); - x5Q = x4Q.mul(x); - x6Q = x5Q.mul(x); - x7Q = x6Q.mul(x); - x8Q = x7Q.mul(x); - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - xQ.neg(); - x3Q.neg(); - x5Q.neg(); - x7Q.neg(); - } - - x8Q.sub(x7Q); - x8Q.sub(this); - - x7Q.sub(x6Q); - x7Q.frob(F, 1); - - x6Q.sub(x5Q); - x6Q.frob(F, 2); - - x5Q.sub(x4Q); - x5Q.frob(F, 3); - - x4Q.sub(x3Q); - x4Q.frob(F, 4); - - x3Q.sub(x2Q); - x3Q.frob(F, 5); - - x2Q.sub(xQ); - x2Q.frob(F, 6); - - xQ.sub(this); - xQ.frob(F, 7); - - this.dbl(); - this.frob(F, 8); - - this.add(x8Q); - this.add(x7Q); - this.add(x6Q); - this.add(x5Q); - - this.add(x4Q); - this.add(x3Q); - this.add(x2Q); - this.add(xQ); - - this.affine(); - }, - }; - - // set to group generator - ECP8.generator = function () { - var G = new ECP8(), - A = new ctx.BIG(0), - B = new ctx.BIG(0), - XAA, - XAB, - XA, - XBA, - XBB, - XB, - X, - YAA, - YAB, - YA, - YBA, - YBB, - YB, - Y; - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxaaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxaab); - XAA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxaba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxabb); - - XAB = new ctx.FP2(A, B); - XA = new ctx.FP4(XAA, XAB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxbaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxbab); - XBA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pxbba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pxbbb); - - XBB = new ctx.FP2(A, B); - XB = new ctx.FP4(XBA, XBB); - - X = new ctx.FP8(XA, XB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyaaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyaab); - YAA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pyaba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pyabb); - - YAB = new ctx.FP2(A, B); - YA = new ctx.FP4(YAA, YAB); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pybaa); - B.rcopy(ctx.ROM_CURVE.CURVE_Pybab); - YBA = new ctx.FP2(A, B); - - A.rcopy(ctx.ROM_CURVE.CURVE_Pybba); - B.rcopy(ctx.ROM_CURVE.CURVE_Pybbb); - - YBB = new ctx.FP2(A, B); - YB = new ctx.FP4(YBA, YBB); - - Y = new ctx.FP8(YA, YB); - - G.setxy(X, Y); - - return G; - }; - - /* convert from byte array to point */ - ECP8.fromBytes = function (b) { - var t = []; - var alt = false; - var typ = b[0]; - var P = new ECP8(); - - if ((ctx.FP.MODBITS - 1) % 8 <= 4 && ECP.ALLOW_ALT_COMPRESS) alt = true; - - if (alt) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i]; - t[0] &= 0x1f; - var rx = ctx.FP8.fromBytes(t); - if ((b[0] & 0x80) == 0) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 8 * ctx.BIG.MODBYTES]; - var ry = ctx.FP8.fromBytes(t); - P.setxy(rx, ry); - } else { - var sgn = (b[0] & 0x20) >> 5; - P.setx(rx, 0); - var cmp = P.y.islarger(); - if ((sgn == 1 && cmp != 1) || (sgn == 0 && cmp == 1)) P.neg(); - } - } else { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 1]; - var rx = ctx.FP8.fromBytes(t); - if (typ == 0x04) { - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = b[i + 8 * ctx.BIG.MODBYTES + 1]; - var ry = ctx.FP8.fromBytes(t); - P.setxy(rx, ry); - } else { - P.setx(rx, typ & 1); - } - } - return P; - }; - - /* Calculate RHS of curve equation x^3+B */ - ECP8.RHS = function (x) { - var r, c, b; - - //x.norm(); - r = new ctx.FP8(x); //r.copy(x); - r.sqr(); - - c = new ctx.BIG(0); - c.rcopy(ctx.ROM_CURVE.CURVE_B); - b = new ctx.FP8(c); //b.bseta(c); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b.div_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b.times_i(); - } - - r.mul(x); - r.add(b); - - r.reduce(); - return r; - }; - - /* P=u0.Q0+u1*Q1+u2*Q2+u3*Q3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - ECP8.mul16 = function (Q, u) { - var W = new ECP8(), - P = new ECP8(), - T1 = [], - T2 = [], - T3 = [], - T4 = [], - mt = new ctx.BIG(), - t = [], - w1 = [], - s1 = [], - w2 = [], - s2 = [], - w3 = [], - s3 = [], - w4 = [], - s4 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2, - pb3, - pb4; - - for (i = 0; i < 16; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - //Q[i].affine(); - } - - T1[0] = new ECP8(); - T1[0].copy(Q[0]); // Q[0] - T1[1] = new ECP8(); - T1[1].copy(T1[0]); - T1[1].add(Q[1]); // Q[0]+Q[1] - T1[2] = new ECP8(); - T1[2].copy(T1[0]); - T1[2].add(Q[2]); // Q[0]+Q[2] - T1[3] = new ECP8(); - T1[3].copy(T1[1]); - T1[3].add(Q[2]); // Q[0]+Q[1]+Q[2] - T1[4] = new ECP8(); - T1[4].copy(T1[0]); - T1[4].add(Q[3]); // Q[0]+Q[3] - T1[5] = new ECP8(); - T1[5].copy(T1[1]); - T1[5].add(Q[3]); // Q[0]+Q[1]+Q[3] - T1[6] = new ECP8(); - T1[6].copy(T1[2]); - T1[6].add(Q[3]); // Q[0]+Q[2]+Q[3] - T1[7] = new ECP8(); - T1[7].copy(T1[3]); - T1[7].add(Q[3]); // Q[0]+Q[1]+Q[2]+Q[3] - - T2[0] = new ECP8(); - T2[0].copy(Q[4]); // Q[0] - T2[1] = new ECP8(); - T2[1].copy(T2[0]); - T2[1].add(Q[5]); // Q[0]+Q[1] - T2[2] = new ECP8(); - T2[2].copy(T2[0]); - T2[2].add(Q[6]); // Q[0]+Q[2] - T2[3] = new ECP8(); - T2[3].copy(T2[1]); - T2[3].add(Q[6]); // Q[0]+Q[1]+Q[2] - T2[4] = new ECP8(); - T2[4].copy(T2[0]); - T2[4].add(Q[7]); // Q[0]+Q[3] - T2[5] = new ECP8(); - T2[5].copy(T2[1]); - T2[5].add(Q[7]); // Q[0]+Q[1]+Q[3] - T2[6] = new ECP8(); - T2[6].copy(T2[2]); - T2[6].add(Q[7]); // Q[0]+Q[2]+Q[3] - T2[7] = new ECP8(); - T2[7].copy(T2[3]); - T2[7].add(Q[7]); // Q[0]+Q[1]+Q[2]+Q[3] - - T3[0] = new ECP8(); - T3[0].copy(Q[8]); // Q[0] - T3[1] = new ECP8(); - T3[1].copy(T3[0]); - T3[1].add(Q[9]); // Q[0]+Q[1] - T3[2] = new ECP8(); - T3[2].copy(T3[0]); - T3[2].add(Q[10]); // Q[0]+Q[2] - T3[3] = new ECP8(); - T3[3].copy(T3[1]); - T3[3].add(Q[10]); // Q[0]+Q[1]+Q[2] - T3[4] = new ECP8(); - T3[4].copy(T3[0]); - T3[4].add(Q[11]); // Q[0]+Q[3] - T3[5] = new ECP8(); - T3[5].copy(T3[1]); - T3[5].add(Q[11]); // Q[0]+Q[1]+Q[3] - T3[6] = new ECP8(); - T3[6].copy(T3[2]); - T3[6].add(Q[11]); // Q[0]+Q[2]+Q[3] - T3[7] = new ECP8(); - T3[7].copy(T3[3]); - T3[7].add(Q[11]); // Q[0]+Q[1]+Q[2]+Q[3] - - T4[0] = new ECP8(); - T4[0].copy(Q[12]); // Q[0] - T4[1] = new ECP8(); - T4[1].copy(T4[0]); - T4[1].add(Q[13]); // Q[0]+Q[1] - T4[2] = new ECP8(); - T4[2].copy(T4[0]); - T4[2].add(Q[14]); // Q[0]+Q[2] - T4[3] = new ECP8(); - T4[3].copy(T4[1]); - T4[3].add(Q[14]); // Q[0]+Q[1]+Q[2] - T4[4] = new ECP8(); - T4[4].copy(T4[0]); - T4[4].add(Q[15]); // Q[0]+Q[3] - T4[5] = new ECP8(); - T4[5].copy(T4[1]); - T4[5].add(Q[15]); // Q[0]+Q[1]+Q[3] - T4[6] = new ECP8(); - T4[6].copy(T4[2]); - T4[6].add(Q[15]); // Q[0]+Q[2]+Q[3] - T4[7] = new ECP8(); - T4[7].copy(T4[3]); - T4[7].add(Q[15]); // Q[0]+Q[1]+Q[2]+Q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - pb3 = 1 - t[8].parity(); - t[8].inc(pb3); - t[8].norm(); - - pb4 = 1 - t[12].parity(); - t[12].inc(pb4); - t[12].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 16; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - s3[nb - 1] = 1; - s4[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - - t[8].fshr(1); - s3[i] = 2 * t[8].parity() - 1; - t[12].fshr(1); - s4[i] = 2 * t[12].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - - w3[i] = 0; - k = 1; - for (j = 9; j < 12; j++) { - bt = s3[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w3[i] += bt * k; - k *= 2; - } - w4[i] = 0; - k = 1; - for (j = 13; j < 16; j++) { - bt = s4[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w4[i] += bt * k; - k *= 2; - } - } - - // Main loop - P.select(T1, 2 * w1[nb - 1] + 1); - W.select(T2, 2 * w2[nb - 1] + 1); - P.add(W); - W.select(T3, 2 * w3[nb - 1] + 1); - P.add(W); - W.select(T4, 2 * w4[nb - 1] + 1); - P.add(W); - for (i = nb - 2; i >= 0; i--) { - P.dbl(); - W.select(T1, 2 * w1[i] + s1[i]); - P.add(W); - W.select(T2, 2 * w2[i] + s2[i]); - P.add(W); - W.select(T3, 2 * w3[i] + s3[i]); - P.add(W); - W.select(T4, 2 * w4[i] + s4[i]); - P.add(W); - } - - // apply correction - W.copy(P); - W.sub(Q[0]); - P.cmove(W, pb1); - - W.copy(P); - W.sub(Q[4]); - P.cmove(W, pb2); - - W.copy(P); - W.sub(Q[8]); - P.cmove(W, pb3); - - W.copy(P); - W.sub(Q[12]); - P.cmove(W, pb4); - - P.affine(); - return P; - }; - - /* return 1 if b==c, no branching */ - ECP8.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* Hunt and Peck a BIG to a curve point - ECP8.hap2point = function(h) - { - var one=new ctx.BIG(1); - var x=new ctx.BIG(h); - var Q,X2,X4,X4; - for (;;) { - X2 = new ctx.FP2(one, x); - X4 = new ctx.FP4(X2); - X8 = new ctx.FP8(X4); - Q = new ECP8(); - Q.setx(X8,0); - if (!Q.is_infinity()) break; - x.inc(1); - x.norm(); - } - return Q; - }; */ - - /* Constant time Map to Point */ - ECP8.map2point = function (H) { - // Shallue and van de Woestijne method. - var sgn, ne; - var NY = new ctx.FP8(1); - var T = new ctx.FP8(H); - sgn = T.sign(); - - var Z = new ctx.FP(ctx.FP.RIADZG2A); - var X1 = new ctx.FP8(Z); - var A = ECP8.RHS(X1); - var W = new ctx.FP8(A); - - W.sqrt(null); - - var s = new ctx.FP(0); - s.rcopy(ctx.ROM_FIELD.SQRTm3); - Z.mul(s); - - T.sqr(); - var Y = new ctx.FP8(A); - Y.mul(T); - T.copy(NY); - T.add(Y); - T.norm(); - Y.rsub(NY); - Y.norm(); - NY.copy(T); - NY.mul(Y); - - NY.tmul(Z); - NY.inverse(null); - - W.tmul(Z); - if (W.sign() == 1) { - W.neg(); - W.norm(); - } - W.tmul(Z); - W.mul(H); - W.mul(Y); - W.mul(NY); - - var X3 = new ctx.FP8(X1); - X1.neg(); - X1.norm(); - X1.div2(); - var X2 = new ctx.FP8(X1); - X1.sub(W); - X1.norm(); - X2.add(W); - X2.norm(); - A.add(A); - A.add(A); - A.norm(); - T.sqr(); - T.mul(NY); - T.sqr(); - A.mul(T); - X3.add(A); - X3.norm(); - - Y.copy(ECP8.RHS(X2)); - X3.cmove(X2, Y.qr(null)); - Y.copy(ECP8.RHS(X1)); - X3.cmove(X1, Y.qr(null)); - Y.copy(ECP8.RHS(X3)); - Y.sqrt(null); - - ne = Y.sign() ^ sgn; - W.copy(Y); - W.neg(); - W.norm(); - Y.cmove(W, ne); - - var P = new ECP8(); - P.setxy(X3, Y); - return P; - }; - - /* Map octet string to curve point - ECP8.mapit = function(h) - { - var q=new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var dx=ctx.DBIG.fromBytes(h); - var x=dx.mod(q); - - var Q=ECP8.hap2point(x); - Q.cfp(); - return Q; - }; */ - - ECP8.frob_constants = function () { - var fa = new ctx.BIG(0), - fb = new ctx.BIG(0), - F = [], - X, - F0, - F1, - F2; - - fa.rcopy(ctx.ROM_FIELD.Fra); - fb.rcopy(ctx.ROM_FIELD.Frb); - X = new ctx.FP2(fa, fb); - - F0 = new ctx.FP2(X); - F0.sqr(); - F2 = new ctx.FP2(F0); - F2.mul_ip(); - F2.norm(); - F1 = new ctx.FP2(F2); - F1.sqr(); - F2.mul(F1); - - F2.mul_ip(); - F2.norm(); - - F1.copy(X); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - F1.mul_ip(); - F1.norm(); - F1.inverse(null); - F0.copy(F1); - F0.sqr(); - - F1.mul(F0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - F0.copy(F1); - F0.sqr(); - F1.mul(F0); - F0.mul_ip(); - F0.norm(); - F1.mul_ip(); - F1.norm(); - F1.mul_ip(); - F1.norm(); - } - /* - } - F0.mul_ip(); F0.norm(); - F1.mul(F0); */ - - F[0] = new ctx.FP2(F0); - F[1] = new ctx.FP2(F1); - F[2] = new ctx.FP2(F2); - return F; - }; - - return ECP8; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.ECP8 = ECP8; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/ff.js b/packages/bls-verify/src/vendor/amcl-js/src/ff.js deleted file mode 100644 index 772c36c7e..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/ff.js +++ /dev/null @@ -1,1024 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE FF number class */ - -var FF = function (ctx) { - 'use strict'; - - /* General purpose Constructor */ - var FF = function (n) { - this.v = new Array(n); - this.length = n; - for (var i = 0; i < n; i++) { - this.v[i] = new ctx.BIG(0); - } - }; - - FF.FFLEN = ctx.config['@ML']; - FF.P_MBITS = ctx.BIG.MODBYTES * 8; - FF.P_OMASK = -1 << FF.P_MBITS % ctx.BIG.BASEBITS; - FF.P_FEXCESS = 1 << (ctx.BIG.BASEBITS * ctx.BIG.NLEN - FF.P_MBITS - 1); - FF.P_TBITS = FF.P_MBITS % ctx.BIG.BASEBITS; - FF.FF_BITS = ctx.BIG.BIGBITS * FF.FFLEN; - FF.HFLEN = FF.FFLEN / 2; /* Useful for half-size RSA private key operations */ - - FF.prototype = { - /* set to zero */ - - P_EXCESS: function () { - return ((this.v[this.length - 1].get(ctx.BIG.NLEN - 1) & FF.P_OMASK) >> FF.P_TBITS) + 1; - }, - - zero: function () { - for (var i = 0; i < this.length; i++) { - this.v[i].zero(); - } - - return this; - }, - - getlen: function () { - return this.length; - }, - - /* set to integer */ - set: function (m) { - this.zero(); - this.v[0].set(0, m & ctx.BIG.BMASK); - this.v[0].set(1, m >> ctx.BIG.BASEBITS); - }, - /* copy from FF b */ - copy: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].copy(b.v[i]); - } - }, - /* copy from FF b */ - rcopy: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].rcopy(b[i]); - } - }, - /* x=y<>n */ - sducopy: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].copy(b.v[this.length + i]); - } - }, - one: function () { - this.v[0].one(); - for (var i = 1; i < this.length; i++) { - this.v[i].zero(); - } - }, - /* test equals 0 */ - iszilch: function () { - for (var i = 0; i < this.length; i++) { - if (!this.v[i].iszilch()) { - return false; - } - } - - return true; - }, - /* shift right by BIGBITS-bit words */ - shrw: function (n) { - for (var i = 0; i < n; i++) { - this.v[i].copy(this.v[i + n]); - this.v[i + n].zero(); - } - }, - - /* shift left by BIGBITS-bit words */ - shlw: function (n) { - for (var i = 0; i < n; i++) { - this.v[n + i].copy(this.v[i]); - this.v[i].zero(); - } - }, - /* extract last bit */ - parity: function () { - return this.v[0].parity(); - }, - - lastbits: function (m) { - return this.v[0].lastbits(m); - }, - - /* recursive add */ - radd: function (vp, x, xp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].copy(x.v[xp + i]); - this.v[vp + i].add(y.v[yp + i]); - } - }, - - /* recursive inc */ - rinc: function (vp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].add(y.v[yp + i]); - } - }, - - /* recursive sub */ - rsub: function (vp, x, xp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].copy(x.v[xp + i]); - this.v[vp + i].sub(y.v[yp + i]); - } - }, - - /* recursive dec */ - rdec: function (vp, y, yp, n) { - for (var i = 0; i < n; i++) { - this.v[vp + i].sub(y.v[yp + i]); - } - }, - - /* simple add */ - add: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].add(b.v[i]); - } - }, - - /* simple sub */ - sub: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].sub(b.v[i]); - } - }, - - /* reverse sub */ - revsub: function (b) { - for (var i = 0; i < this.length; i++) { - this.v[i].rsub(b.v[i]); - } - }, - - /* increment/decrement by a small integer */ - inc: function (m) { - this.v[0].inc(m); - this.norm(); - }, - - dec: function (m) { - this.v[0].dec(m); - this.norm(); - }, - - /* normalise - but hold any overflow in top part unless n<0 */ - rnorm: function (vp, n) { - var trunc = false, - i, - carry; - - if (n < 0) { - /* -v n signals to do truncation */ - n = -n; - trunc = true; - } - - for (i = 0; i < n - 1; i++) { - carry = this.v[vp + i].norm(); - this.v[vp + i].xortop(carry << FF.P_TBITS); - this.v[vp + i + 1].inc(carry); - } - carry = this.v[vp + n - 1].norm(); - - if (trunc) { - this.v[vp + n - 1].xortop(carry << FF.P_TBITS); - } - - return this; - }, - - norm: function () { - this.rnorm(0, this.length); - }, - - /* shift left by one bit */ - shl: function () { - var delay_carry = 0, - i, - carry; - - for (i = 0; i < this.length - 1; i++) { - carry = this.v[i].fshl(1); - this.v[i].inc(delay_carry); - this.v[i].xortop(carry << FF.P_TBITS); - delay_carry = carry; - } - - this.v[this.length - 1].fshl(1); - this.v[this.length - 1].inc(delay_carry); - }, - - /* shift right by one bit */ - shr: function () { - var i, carry; - - for (i = this.length - 1; i > 0; i--) { - carry = this.v[i].fshr(1); - this.v[i - 1].ortop(carry << FF.P_TBITS); - } - - this.v[0].fshr(1); - }, - - /* Convert to Hex String */ - toString: function () { - var s = '', - i; - - this.norm(); - - for (i = this.length - 1; i >= 0; i--) { - s += this.v[i].toString(); - } - - return s; - }, - /* Convert FFs to/from byte arrays */ - toBytes: function (b) { - var i; - - for (i = 0; i < this.length; i++) { - this.v[i].tobytearray(b, (this.length - i - 1) * ctx.BIG.MODBYTES); - } - }, - - /* z=x*y, t is workspace */ - karmul: function (vp, x, xp, y, yp, t, tp, n) { - var nd2, d; - - if (n === 1) { - x.v[xp].norm(); - y.v[yp].norm(); - d = ctx.BIG.mul(x.v[xp], y.v[yp]); - this.v[vp + 1] = d.split(8 * ctx.BIG.MODBYTES); - this.v[vp].copy(d); - - return; - } - - nd2 = n / 2; - this.radd(vp, x, xp, x, xp + nd2, nd2); - this.rnorm(vp, nd2); /* Important - required for 32-bit build */ - this.radd(vp + nd2, y, yp, y, yp + nd2, nd2); - this.rnorm(vp + nd2, nd2); /* Important - required for 32-bit build */ - t.karmul(tp, this, vp, this, vp + nd2, t, tp + n, nd2); - this.karmul(vp, x, xp, y, yp, t, tp + n, nd2); - this.karmul(vp + n, x, xp + nd2, y, yp + nd2, t, tp + n, nd2); - t.rdec(tp, this, vp, n); - t.rdec(tp, this, vp + n, n); - this.rinc(vp + nd2, t, tp, n); - this.rnorm(vp, 2 * n); - }, - - karsqr: function (vp, x, xp, t, tp, n) { - var nd2, d; - - if (n === 1) { - x.v[xp].norm(); - d = ctx.BIG.sqr(x.v[xp]); - this.v[vp + 1].copy(d.split(8 * ctx.BIG.MODBYTES)); - this.v[vp].copy(d); - - return; - } - - nd2 = n / 2; - this.karsqr(vp, x, xp, t, tp + n, nd2); - this.karsqr(vp + n, x, xp + nd2, t, tp + n, nd2); - t.karmul(tp, x, xp, x, xp + nd2, t, tp + n, nd2); - this.rinc(vp + nd2, t, tp, n); - this.rinc(vp + nd2, t, tp, n); - this.rnorm(vp + nd2, n); - }, - - karmul_lower: function (vp, x, xp, y, yp, t, tp, n) { - /* Calculates Least Significant bottom half of x*y */ - var nd2; - - if (n === 1) { - /* only calculate bottom half of product */ - this.v[vp].copy(ctx.BIG.smul(x.v[xp], y.v[yp])); - - return; - } - - nd2 = n / 2; - - this.karmul(vp, x, xp, y, yp, t, tp + n, nd2); - t.karmul_lower(tp, x, xp + nd2, y, yp, t, tp + n, nd2); - this.rinc(vp + nd2, t, tp, nd2); - t.karmul_lower(tp, x, xp, y, yp + nd2, t, tp + n, nd2); - - this.rinc(vp + nd2, t, tp, nd2); - this.rnorm(vp + nd2, -nd2); /* truncate it */ - }, - - karmul_upper: function (x, y, t, n) { - /* Calculates Most Significant upper half of x*y, given lower part */ - var nd2; - - nd2 = n / 2; - this.radd(n, x, 0, x, nd2, nd2); - this.radd(n + nd2, y, 0, y, nd2, nd2); - this.rnorm(n, nd2); - this.rnorm(n + nd2, nd2); - - t.karmul(0, this, n + nd2, this, n, t, n, nd2); /* t = (a0+a1)(b0+b1) */ - this.karmul(n, x, nd2, y, nd2, t, n, nd2); /* z[n]= a1*b1 */ - /* z[0-nd2]=l(a0b0) z[nd2-n]= h(a0b0)+l(t)-l(a0b0)-l(a1b1) */ - t.rdec(0, this, n, n); /* t=t-a1b1 */ - this.rinc(nd2, this, 0, nd2); /* z[nd2-n]+=l(a0b0) = h(a0b0)+l(t)-l(a1b1) */ - this.rdec(nd2, t, 0, nd2); /* z[nd2-n]=h(a0b0)+l(t)-l(a1b1)-l(t-a1b1)=h(a0b0) */ - this.rnorm(0, -n); /* a0b0 now in z - truncate it */ - t.rdec(0, this, 0, n); /* (a0+a1)(b0+b1) - a0b0 */ - this.rinc(nd2, t, 0, n); - - this.rnorm(nd2, n); - }, - - /* return low part of product this*y */ - lmul: function (y) { - var n = this.length, - t = new FF(2 * n), - x = new FF(n); - - x.copy(this); - this.karmul_lower(0, x, 0, y, 0, t, 0, n); - }, - - /* Set b=b mod c */ - mod: function (c) { - var k = 0; - - this.norm(); - if (FF.comp(this, c) < 0) { - return; - } - - do { - c.shl(); - k++; - } while (FF.comp(this, c) >= 0); - - while (k > 0) { - c.shr(); - - if (FF.comp(this, c) >= 0) { - this.sub(c); - this.norm(); - } - - k--; - } - }, - - /* return This mod modulus, N is modulus, ND is Montgomery Constant */ - reduce: function (N, ND) { - /* fast karatsuba Montgomery reduction */ - var n = N.length, - t = new FF(2 * n), - r = new FF(n), - m = new FF(n); - - r.sducopy(this); - m.karmul_lower(0, this, 0, ND, 0, t, 0, n); - this.karmul_upper(N, m, t, n); - m.sducopy(this); - - r.add(N); - r.sub(m); - r.norm(); - - return r; - }, - - /* Set r=this mod b */ - /* this is of length - 2*n */ - /* r,b is of length - n */ - dmod: function (b) { - var n = b.length, - m = new FF(2 * n), - x = new FF(2 * n), - r = new FF(n), - k; - - x.copy(this); - x.norm(); - m.dsucopy(b); - k = ctx.BIG.BIGBITS * n; - - while (FF.comp(x, m) >= 0) { - x.sub(m); - x.norm(); - } - - while (k > 0) { - m.shr(); - - if (FF.comp(x, m) >= 0) { - x.sub(m); - x.norm(); - } - - k--; - } - - r.copy(x); - r.mod(b); - - return r; - }, - - /* Set return=1/this mod p. Binary method - a

= 0) { - u.sub(v); - u.norm(); - - if (FF.comp(x1, x2) >= 0) { - x1.sub(x2); - } else { - t.copy(p); - t.sub(x2); - x1.add(t); - } - - x1.norm(); - } else { - v.sub(u); - v.norm(); - - if (FF.comp(x2, x1) >= 0) { - x2.sub(x1); - } else { - t.copy(p); - t.sub(x1); - x2.add(t); - } - - x2.norm(); - } - } - - if (FF.comp(u, one) === 0) { - this.copy(x1); - } else { - this.copy(x2); - } - }, - - /* nresidue mod m */ - nres: function (m) { - var n = m.length, - d; - - if (n === 1) { - d = new ctx.DBIG(0); - d.hcopy(this.v[0]); - d.shl(ctx.BIG.NLEN * ctx.BIG.BASEBITS); - this.v[0].copy(d.mod(m.v[0])); - } else { - d = new FF(2 * n); - d.dsucopy(this); - this.copy(d.dmod(m)); - } - }, - - redc: function (m, ND) { - var n = m.length, - d; - - if (n === 1) { - d = new ctx.DBIG(0); - d.hcopy(this.v[0]); - this.v[0].copy(ctx.BIG.monty(m.v[0], (1 << ctx.BIG.BASEBITS) - ND.v[0].w[0], d)); - } else { - d = new FF(2 * n); - this.mod(m); - d.dscopy(this); - this.copy(d.reduce(m, ND)); - this.mod(m); - } - }, - - mod2m: function (m) { - for (var i = m; i < this.length; i++) { - this.v[i].zero(); - } - }, - - /* U=1/a mod 2^m - Arazi & Qi */ - invmod2m: function () { - var n = this.length, - b = new FF(n), - c = new FF(n), - U = new FF(n), - t, - i; - - U.zero(); - U.v[0].copy(this.v[0]); - U.v[0].invmod2m(); - - for (i = 1; i < n; i <<= 1) { - b.copy(this); - b.mod2m(i); - t = FF.mul(U, b); - t.shrw(i); - b.copy(t); - c.copy(this); - c.shrw(i); - c.mod2m(i); - c.lmul(U); - c.mod2m(i); - - b.add(c); - b.norm(); - b.lmul(U); - b.mod2m(i); - - c.one(); - c.shlw(i); - b.revsub(c); - b.norm(); - b.shlw(i); - U.add(b); - } - U.norm(); - - return U; - }, - - random: function (rng) { - var n = this.length, - i; - - for (i = 0; i < n; i++) { - this.v[i].copy(ctx.BIG.random(rng)); - } - - /* make sure top bit is 1 */ - while (this.v[n - 1].nbits() < ctx.BIG.MODBYTES * 8) { - this.v[n - 1].copy(ctx.BIG.random(rng)); - } - }, - - /* generate random x */ - randomnum: function (p, rng) { - var n = this.length, - d = new FF(2 * n), - i; - - for (i = 0; i < 2 * n; i++) { - d.v[i].copy(ctx.BIG.random(rng)); - } - - this.copy(d.dmod(p)); - }, - - /* this*=y mod p */ - modmul: function (y, p, nd) { - var ex = this.P_EXCESS(), - ey = y.P_EXCESS(), - n = p.length, - d; - - if (ex + 1 >= Math.floor((FF.P_FEXCESS - 1) / (ey + 1))) { - this.mod(p); - } - - if (n === 1) { - d = ctx.BIG.mul(this.v[0], y.v[0]); - this.v[0].copy(ctx.BIG.monty(p.v[0], (1 << ctx.BIG.BASEBITS) - nd.v[0].w[0], d)); - } else { - d = FF.mul(this, y); - this.copy(d.reduce(p, nd)); - } - }, - - /* this*=y mod p */ - modsqr: function (p, nd) { - var ex = this.P_EXCESS(), - n, - d; - - if (ex + 1 >= Math.floor((FF.P_FEXCESS - 1) / (ex + 1))) { - this.mod(p); - } - n = p.length; - - if (n === 1) { - d = ctx.BIG.sqr(this.v[0]); - this.v[0].copy(ctx.BIG.monty(p.v[0], (1 << ctx.BIG.BASEBITS) - nd.v[0].w[0], d)); - } else { - d = FF.sqr(this); - this.copy(d.reduce(p, nd)); - } - }, - - /* this=this^e mod p using side-channel resistant Montgomery Ladder, for large e */ - skpow: function (e, p) { - var n = p.length, - R0 = new FF(n), - R1 = new FF(n), - ND = p.invmod2m(), - i, - b; - - this.mod(p); - R0.one(); - R1.copy(this); - R0.nres(p); - R1.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES * n - 1; i >= 0; i--) { - b = e.v[Math.floor(i / ctx.BIG.BIGBITS)].bit(i % ctx.BIG.BIGBITS); - - this.copy(R0); - this.modmul(R1, p, ND); - - FF.cswap(R0, R1, b); - R0.modsqr(p, ND); - - R1.copy(this); - FF.cswap(R0, R1, b); - } - - this.copy(R0); - this.redc(p, ND); - }, - - /* this =this^e mod p using side-channel resistant Montgomery Ladder, for short e */ - skspow: function (e, p) { - var n = p.length, - R0 = new FF(n), - R1 = new FF(n), - ND = p.invmod2m(), - i, - b; - - this.mod(p); - R0.one(); - R1.copy(this); - R0.nres(p); - R1.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES - 1; i >= 0; i--) { - b = e.bit(i); - this.copy(R0); - this.modmul(R1, p, ND); - - FF.cswap(R0, R1, b); - R0.modsqr(p, ND); - - R1.copy(this); - FF.cswap(R0, R1, b); - } - this.copy(R0); - this.redc(p, ND); - }, - - /* raise to an integer power - right-to-left method */ - power: function (e, p) { - var n = p.length, - f = true, - w = new FF(n), - ND = p.invmod2m(); - - w.copy(this); - w.nres(p); - - if (e == 2) { - this.copy(w); - this.modsqr(p, ND); - } else { - for (;;) { - if (e % 2 == 1) { - if (f) { - this.copy(w); - } else { - this.modmul(w, p, ND); - } - f = false; - } - e >>= 1; - if (e === 0) { - break; - } - w.modsqr(p, ND); - } - } - - this.redc(p, ND); - }, - - /* this=this^e mod p, faster but not side channel resistant */ - pow: function (e, p) { - var n = p.length, - w = new FF(n), - ND = p.invmod2m(), - i, - b; - - w.copy(this); - this.one(); - this.nres(p); - w.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES * n - 1; i >= 0; i--) { - this.modsqr(p, ND); - b = e.v[Math.floor(i / ctx.BIG.BIGBITS)].bit(i % ctx.BIG.BIGBITS); - if (b === 1) { - this.modmul(w, p, ND); - } - } - - this.redc(p, ND); - }, - - /* double exponentiation r=x^e.y^f mod p */ - pow2: function (e, y, f, p) { - var n = p.length, - xn = new FF(n), - yn = new FF(n), - xy = new FF(n), - ND = p.invmod2m(), - i, - eb, - fb; - - xn.copy(this); - yn.copy(y); - xn.nres(p); - yn.nres(p); - xy.copy(xn); - xy.modmul(yn, p, ND); - this.one(); - this.nres(p); - - for (i = 8 * ctx.BIG.MODBYTES - 1; i >= 0; i--) { - eb = e.bit(i); - fb = f.bit(i); - this.modsqr(p, ND); - - if (eb == 1) { - if (fb == 1) { - this.modmul(xy, p, ND); - } else { - this.modmul(xn, p, ND); - } - } else { - if (fb == 1) { - this.modmul(yn, p, ND); - } - } - } - this.redc(p, ND); - }, - - /* quick and dirty check for common factor with n */ - cfactor: function (s) { - var n = this.length, - x = new FF(n), - y = new FF(n), - r, - g; - - y.set(s); - - x.copy(this); - x.norm(); - - do { - x.sub(y); - x.norm(); - while (!x.iszilch() && x.parity() === 0) { - x.shr(); - } - } while (FF.comp(x, y) > 0); - - g = x.v[0].get(0); - r = FF.igcd(s, g); - if (r > 1) { - return true; - } - - return false; - }, - }; - - /* compare x and y - must be normalised, and of same length */ - FF.comp = function (a, b) { - var i, j; - - for (i = a.length - 1; i >= 0; i--) { - j = ctx.BIG.comp(a.v[i], b.v[i]); - if (j !== 0) { - return j; - } - } - - return 0; - }; - - FF.fromBytes = function (x, b) { - var i; - - for (i = 0; i < x.length; i++) { - x.v[i] = ctx.BIG.frombytearray(b, (x.length - i - 1) * ctx.BIG.MODBYTES); - } - }; - - /* in-place swapping using xor - side channel resistant - lengths must be the same */ - FF.cswap = function (a, b, d) { - var i; - - for (i = 0; i < a.length; i++) { - a.v[i].cswap(b.v[i], d); - } - }; - - /* z=x*y. Assumes x and y are of same length. */ - FF.mul = function (x, y) { - var n = x.length, - z = new FF(2 * n), - t = new FF(2 * n); - - z.karmul(0, x, 0, y, 0, t, 0, n); - - return z; - }; - - /* z=x^2 */ - FF.sqr = function (x) { - var n = x.length, - z = new FF(2 * n), - t = new FF(2 * n); - - z.karsqr(0, x, 0, t, 0, n); - - return z; - }; - - FF.igcd = function (x, y) { - /* integer GCD, returns GCD of x and y */ - var r; - - if (y === 0) { - return x; - } - - while ((r = x % y) !== 0) { - x = y; - y = r; - } - - return y; - }; - - /* Miller-Rabin test for primality. Slow. */ - FF.prime = function (p, rng) { - var n = p.length, - s = 0, - loop, - d = new FF(n), - x = new FF(n), - unity = new FF(n), - nm1 = new FF(n), - sf = 4849845 /* 3*5*.. *19 */, - i, - j; - - p.norm(); - - if (p.cfactor(sf)) { - return false; - } - - unity.one(); - nm1.copy(p); - nm1.sub(unity); - nm1.norm(); - d.copy(nm1); - - while (d.parity() === 0) { - d.shr(); - s++; - } - - if (s === 0) { - return false; - } - - for (i = 0; i < 10; i++) { - x.randomnum(p, rng); - x.pow(d, p); - - if (FF.comp(x, unity) === 0 || FF.comp(x, nm1) === 0) { - continue; - } - - loop = false; - - for (j = 1; j < s; j++) { - x.power(2, p); - - if (FF.comp(x, unity) === 0) { - return false; - } - - if (FF.comp(x, nm1) === 0) { - loop = true; - break; - } - } - if (loop) { - continue; - } - - return false; - } - - return true; - }; - - return FF; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FF: FF, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp.js b/packages/bls-verify/src/vendor/amcl-js/src/fp.js deleted file mode 100644 index 2dee274e0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp.js +++ /dev/null @@ -1,833 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic */ -/* CORE mod p functions */ - -var FP = function (ctx) { - 'use strict'; - - /* General purpose Constructor */ - var FP = function (x) { - if (x instanceof FP) { - this.f = new ctx.BIG(x.f); - this.XES = x.XES; - } else { - if (x instanceof ctx.BIG) { - this.f = new ctx.BIG(x); - } else { - if (x < 0) { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - m.inc(x); - m.norm(); - this.f = new ctx.BIG(m); - } else { - this.f = new ctx.BIG(x); - } - } - this.XES = 1; - //if (x!=0) - if (!this.f.iszilch()) this.nres(); - } - }; - - FP.NOT_SPECIAL = 0; - FP.PSEUDO_MERSENNE = 1; - FP.GENERALISED_MERSENNE = 2; - FP.MONTGOMERY_FRIENDLY = 3; - - FP.ZERO = 0; - FP.ONE = 1; - FP.SPARSEST = 2; - FP.SPARSER = 3; - FP.SPARSE = 4; - FP.DENSE = 5; - - FP.NEGATOWER = 0; - FP.POSITOWER = 1; - - FP.MODBITS = ctx.config['@NBT']; - FP.PM1D2 = ctx.config['@M8']; - FP.RIADZ = ctx.config['@RZ']; - FP.RIADZG2A = ctx.config['@RZ2A']; - FP.RIADZG2B = ctx.config['@RZ2B']; - FP.MODTYPE = ctx.config['@MT']; - FP.QNRI = ctx.config['@QI']; - FP.TOWER = ctx.config['@TW']; - - FP.FEXCESS = (1 << ctx.config['@SH']) - 1; // 2^(BASEBITS*NLEN-MODBITS)-1 - FP.OMASK = -1 << FP.TBITS; - FP.TBITS = FP.MODBITS % ctx.BIG.BASEBITS; - FP.TMASK = (1 << FP.TBITS) - 1; - - FP.BIG_ENDIAN_SIGN = false; - - FP.prototype = { - /* set this=0 */ - zero: function () { - this.XES = 1; - this.f.zero(); - }, - - /* copy from a ctx.BIG in ROM */ - rcopy: function (y) { - this.f.rcopy(y); - this.nres(); - }, - - /* copy from another ctx.BIG */ - bcopy: function (y) { - this.f.copy(y); - this.nres(); - }, - - /* copy from another FP */ - copy: function (y) { - this.XES = y.XES; - this.f.copy(y.f); - }, - - /* conditional swap of a and b depending on d */ - cswap: function (b, d) { - this.f.cswap(b.f, d); - var t, - c = d; - c = ~(c - 1); - t = c & (this.XES ^ b.XES); - this.XES ^= t; - b.XES ^= t; - }, - - /* conditional copy of b to a depending on d */ - cmove: function (b, d) { - var c = d; - - c = ~(c - 1); - - this.f.cmove(b.f, d); - this.XES ^= (this.XES ^ b.XES) & c; - }, - - /* convert to Montgomery n-residue form */ - nres: function () { - var r, d; - - if (FP.MODTYPE != FP.PSEUDO_MERSENNE && FP.MODTYPE != FP.GENERALISED_MERSENNE) { - r = new ctx.BIG(); - r.rcopy(ctx.ROM_FIELD.R2modp); - - d = ctx.BIG.mul(this.f, r); - this.f.copy(FP.mod(d)); - this.XES = 2; - } else { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - this.f.mod(m); - this.XES = 1; - } - - return this; - }, - - /* convert back to regular form */ - redc: function () { - var r = new ctx.BIG(0), - d, - w; - - r.copy(this.f); - - if (FP.MODTYPE != FP.PSEUDO_MERSENNE && FP.MODTYPE != FP.GENERALISED_MERSENNE) { - d = new ctx.DBIG(0); - d.hcopy(this.f); - w = FP.mod(d); - r.copy(w); - } - - return r; - }, - - /* convert this to string */ - toString: function () { - var s = this.redc().toString(); - return s; - }, - - /* test this=0 */ - iszilch: function () { - var c = new FP(0); - c.copy(this); - c.reduce(); - return c.f.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return; - var sx = new ctx.BIG(0); - sx.rcopy(ctx.ROM_FIELD.Modulus); - var fx = this.redc(); - sx.sub(fx); - sx.norm(); - return ctx.BIG.comp(fx, sx); - }, - - toBytes: function (b) { - this.redc().toBytes(b); - }, - - /* test this=1 */ - isunity: function () { - var c = new FP(0); - c.copy(this); - c.reduce(); - return c.redc().isunity(); - }, - - sign: function () { - if (FP.BIG_ENDIAN_SIGN) { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - m.dec(1); - m.fshr(1); - var n = new FP(0); - n.copy(this); - n.reduce(); - var w = n.redc(); - var cp = ctx.BIG.comp(w, m); - return ((cp + 1) & 2) >> 1; - } else { - var c = new FP(0); - c.copy(this); - c.reduce(); - return c.redc().parity(); - } - }, - - /* reduce this mod Modulus */ - reduce: function () { - var q, - carry, - sr, - sb, - m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_FIELD.Modulus); - this.f.norm(); - - if (this.XES > 16) { - q = FP.quo(this.f, m); - carry = r.pmul(q); - r.w[ctx.BIG.NLEN - 1] += carry << ctx.BIG.BASEBITS; // correction - put any carry out back in again - this.f.sub(r); - this.f.norm(); - sb = 2; - } else { - sb = FP.logb2(this.XES - 1); - } - m.fshl(sb); - - while (sb > 0) { - // constant time... - sr = ctx.BIG.ssn(r, this.f, m); // optimized combined shift, subtract and norm - this.f.cmove(r, 1 - sr); - sb--; - } - - this.XES = 1; - }, - - /* set this=1 */ - one: function () { - this.f.one(); - this.nres(); - }, - - /* normalise this */ - norm: function () { - return this.f.norm(); - }, - - /* this*=b mod Modulus */ - mul: function (b) { - var d; - - if (this.XES * b.XES > FP.FEXCESS) { - this.reduce(); - } - - d = ctx.BIG.mul(this.f, b.f); - this.f.copy(FP.mod(d)); - this.XES = 2; - - return this; - }, - - /* this*=c mod Modulus where c is an int */ - imul: function (c) { - var s = false, - d, - n; - - if (c < 0) { - c = -c; - s = true; - } - - if (FP.MODTYPE == FP.PSEUDO_MERSENNE || FP.MODTYPE == FP.GENERALISED_MERSENNE) { - d = this.f.pxmul(c); - this.f.copy(FP.mod(d)); - this.XES = 2; - } else { - if (this.XES * c <= FP.FEXCESS) { - this.f.pmul(c); - this.XES *= c; - } else { - n = new FP(c); - this.mul(n); - } - } - - if (s) { - this.neg(); - this.norm(); - } - return this; - }, - - /* this*=this mod Modulus */ - sqr: function () { - var d, t; - - if (this.XES * this.XES > FP.FEXCESS) { - this.reduce(); - } - - d = ctx.BIG.sqr(this.f); - t = FP.mod(d); - this.f.copy(t); - this.XES = 2; - - return this; - }, - - /* this+=b */ - add: function (b) { - this.f.add(b.f); - this.XES += b.XES; - - if (this.XES > FP.FEXCESS) { - this.reduce(); - } - - return this; - }, - /* this=-this mod Modulus */ - neg: function () { - var m = new ctx.BIG(0), - sb; - - m.rcopy(ctx.ROM_FIELD.Modulus); - - sb = FP.logb2(this.XES - 1); - - m.fshl(sb); - this.XES = (1 << sb) + 1; - this.f.rsub(m); - - if (this.XES > FP.FEXCESS) { - this.reduce(); - } - - return this; - }, - - /* this-=b */ - sub: function (b) { - var n = new FP(0); - - n.copy(b); - n.neg(); - this.add(n); - - return this; - }, - - rsub: function (b) { - var n = new FP(0); - - n.copy(this); - n.neg(); - this.copy(b); - this.add(n); - }, - - /* this/=2 mod Modulus */ - div2: function () { - var p; - p = new ctx.BIG(0); - p.rcopy(ctx.ROM_FIELD.Modulus); - var pr = this.f.parity(); - var w = new ctx.BIG(0); - w.copy(this.f); - this.f.fshr(1); - w.add(p); - w.norm(); - w.fshr(1); - this.f.cmove(w, pr); - return this; - }, - - /* return jacobi symbol (this/Modulus) */ - jacobi: function () { - var p = new ctx.BIG(0), - w = this.redc(); - - p.rcopy(ctx.ROM_FIELD.Modulus); - - return w.jacobi(p); - }, - - /* return TRUE if this==a */ - equals: function (a) { - var ft = new FP(0); - ft.copy(this); - var sd = new FP(0); - sd.copy(a); - ft.reduce(); - sd.reduce(); - - if (ctx.BIG.comp(ft.f, sd.f) === 0) { - return true; - } - - return false; - }, - - /* return this^e mod Modulus */ - pow: function (e) { - var i, - w = [], - tb = [], - t = new ctx.BIG(e), - nb, - lsbs, - r; - this.norm(); - t.norm(); - nb = 1 + Math.floor((t.nbits() + 3) / 4); - - for (i = 0; i < nb; i++) { - lsbs = t.lastbits(4); - t.dec(lsbs); - t.norm(); - w[i] = lsbs; - t.fshr(4); - } - tb[0] = new FP(1); - tb[1] = new FP(this); - for (i = 2; i < 16; i++) { - tb[i] = new FP(tb[i - 1]); - tb[i].mul(this); - } - r = new FP(tb[w[nb - 1]]); - for (i = nb - 2; i >= 0; i--) { - r.sqr(); - r.sqr(); - r.sqr(); - r.sqr(); - r.mul(tb[w[i]]); - } - r.reduce(); - return r; - }, - - // return this^(p-3)/4 or this^(p-5)/8 - // See https://eprint.iacr.org/2018/1038 - fpow: function () { - var i, j, k, bw, w, c, nw, lo, m, n, nd, e; - var xp = []; - var ac = [1, 2, 3, 6, 12, 15, 30, 60, 120, 240, 255]; - // phase 1 - - xp[0] = new FP(this); // 1 - xp[1] = new FP(this); - xp[1].sqr(); // 2 - xp[2] = new FP(xp[1]); - xp[2].mul(this); //3 - xp[3] = new FP(xp[2]); - xp[3].sqr(); // 6 - xp[4] = new FP(xp[3]); - xp[4].sqr(); // 12 - xp[5] = new FP(xp[4]); - xp[5].mul(xp[2]); // 15 - xp[6] = new FP(xp[5]); - xp[6].sqr(); // 30 - xp[7] = new FP(xp[6]); - xp[7].sqr(); // 60 - xp[8] = new FP(xp[7]); - xp[8].sqr(); // 120 - xp[9] = new FP(xp[8]); - xp[9].sqr(); // 240 - xp[10] = new FP(xp[9]); - xp[10].mul(xp[5]); // 255 - - n = FP.MODBITS; - if (FP.MODTYPE == FP.GENERALISED_MERSENNE) - // Goldilocks ONLY - n /= 2; - - e = FP.PM1D2; - - n -= e + 1; - c = (ctx.ROM_FIELD.MConst + (1 << e) + 1) / (1 << (e + 1)); - - nd = 0; - while (c % 2 == 0) { - c /= 2; - n -= 1; - nd++; - } - - bw = 0; - w = 1; - while (w < c) { - w *= 2; - bw += 1; - } - k = w - c; - - i = 10; - var key = new FP(0); - if (k != 0) { - while (ac[i] > k) i--; - key.copy(xp[i]); - k -= ac[i]; - } - while (k != 0) { - i--; - if (ac[i] > k) continue; - key.mul(xp[i]); - k -= ac[i]; - } - - // phase 2 - xp[1].copy(xp[2]); - xp[2].copy(xp[5]); - xp[3].copy(xp[10]); - - j = 3; - m = 8; - nw = n - bw; - var t = new FP(0); - while (2 * m < nw) { - t.copy(xp[j++]); - for (i = 0; i < m; i++) t.sqr(); - xp[j].copy(xp[j - 1]); - xp[j].mul(t); - m *= 2; - } - lo = nw - m; - var r = new FP(xp[j]); - - while (lo != 0) { - m /= 2; - j--; - if (lo < m) continue; - lo -= m; - t.copy(r); - for (i = 0; i < m; i++) t.sqr(); - r.copy(t); - r.mul(xp[j]); - } - - // phase 3 - if (bw != 0) { - for (i = 0; i < bw; i++) r.sqr(); - r.mul(key); - } - - if (FP.MODTYPE == FP.GENERALISED_MERSENNE) { - // Goldilocks ONLY - key.copy(r); - r.sqr(); - r.mul(this); - for (i = 0; i < n + 1; i++) r.sqr(); - r.mul(key); - } - - for (i = 0; i < nd; i++) r.sqr(); - - return r; - }, - - // calculates r=x^(p-1-2^e)/2^{e+1) where 2^e|p-1 - progen: function () { - if (FP.MODTYPE == FP.PSEUDO_MERSENNE || FP.MODTYPE == FP.GENERALISED_MERSENNE) { - this.copy(this.fpow()); - return; - } - var e = FP.PM1D2; - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - m.dec(1); - m.shr(e); - m.dec(1); - m.fshr(1); - - this.copy(this.pow(m)); - }, - - /* this=1/this mod Modulus */ - inverse: function (h) { - var e = FP.PM1D2; - this.norm(); - var s = new FP(this); - for (var i = 0; i < e - 1; i++) { - s.sqr(); - s.mul(this); - } - if (h == null) this.progen(); - else this.copy(h); - - for (var i = 0; i <= e; i++) this.sqr(); - this.mul(s); - this.reduce(); - return this; - }, - - // Calculate both inverse and square root of x, return QR - invsqrt: function (i, s) { - var h = new FP(0); - var qr = this.qr(h); - s.copy(this.sqrt(h)); - i.copy(this); - i.inverse(h); - return qr; - }, - - /* test for Quadratic residue */ - qr: function (h) { - var r = new FP(this); - var e = FP.PM1D2; - r.progen(); - if (h != null) h.copy(r); - - r.sqr(); - r.mul(this); - for (var i = 0; i < e - 1; i++) r.sqr(); - - return r.isunity() ? 1 : 0; - }, - - /* return sqrt(this) mod Modulus */ - sqrt: function (h) { - var e = FP.PM1D2; - var g = new FP(this); - if (h == null) g.progen(); - else g.copy(h); - - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.ROI); - - var v = new FP(m); - - var t = new FP(g); - t.sqr(); - t.mul(this); - - var r = new FP(this); - r.mul(g); - var b = new FP(t); - - for (var k = e; k > 1; k--) { - for (var j = 1; j < k - 1; j++) b.sqr(); - var u = b.isunity() ? 0 : 1; - g.copy(r); - g.mul(v); - r.cmove(g, u); - v.sqr(); - g.copy(t); - g.mul(v); - t.cmove(g, u); - b.copy(t); - } - var sgn = r.sign(); - var nr = new FP(r); - nr.neg(); - nr.norm(); - r.cmove(nr, sgn); - return r; - }, - }; - - // Two for the price of One - See Hamburg https://eprint.iacr.org/2012/309.pdf - // Calculate inverse of i and square root of s, return QR - FP.tpo = function (i, s) { - var w = new FP(s); - var t = new FP(i); - w.mul(i); - t.mul(w); - var qr = t.invsqrt(i, s); - i.mul(w); - s.mul(i); - return qr; - }; - - FP.fromBytes = function (b) { - var t = ctx.BIG.fromBytes(b); - return new FP(t); - }; - - FP.rand = function (rng) { - var m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - var w = ctx.BIG.randomnum(m, rng); - return new FP(w); - }; - - FP.logb2 = function (v) { - var r; - - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - - v = v - ((v >>> 1) & 0x55555555); - v = (v & 0x33333333) + ((v >>> 2) & 0x33333333); - r = (((v + (v >>> 4)) & 0xf0f0f0f) * 0x1010101) >>> 24; - - return r; - }; - - FP.quo = function (n, m) { - var num, - den, - hb = ctx.BIG.CHUNK >> 1; - if (FP.TBITS < hb) { - var sh = hb - FP.TBITS; - num = (n.w[ctx.BIG.NLEN - 1] << sh) | (n.w[ctx.BIG.NLEN - 2] >> (ctx.BIG.BASEBITS - sh)); - den = (m.w[ctx.BIG.NLEN - 1] << sh) | (m.w[ctx.BIG.NLEN - 2] >> (ctx.BIG.BASEBITS - sh)); - } else { - num = n.w[ctx.BIG.NLEN - 1]; - den = m.w[ctx.BIG.NLEN - 1]; - } - return Math.floor(num / (den + 1)); - }; - - /* reduce a ctx.DBIG to a ctx.BIG using a "special" modulus */ - FP.mod = function (d) { - var b = new ctx.BIG(0), - i, - t, - v, - tw, - tt, - lo, - carry, - m, - dd; - - if (FP.MODTYPE == FP.PSEUDO_MERSENNE) { - t = d.split(FP.MODBITS); - b.hcopy(d); - - if (ctx.ROM_FIELD.MConst != 1) { - v = t.pmul(ctx.ROM_FIELD.MConst); - } else { - v = 0; - } - - t.add(b); - t.norm(); - - tw = t.w[ctx.BIG.NLEN - 1]; - t.w[ctx.BIG.NLEN - 1] &= FP.TMASK; - t.inc(ctx.ROM_FIELD.MConst * ((tw >> FP.TBITS) + (v << (ctx.BIG.BASEBITS - FP.TBITS)))); - // b.add(t); - t.norm(); - - return t; - } - - if (FP.MODTYPE == FP.MONTGOMERY_FRIENDLY) { - for (i = 0; i < ctx.BIG.NLEN; i++) { - d.w[ctx.BIG.NLEN + i] += d.muladd( - d.w[i], - ctx.ROM_FIELD.MConst - 1, - d.w[i], - ctx.BIG.NLEN + i - 1, - ); - } - - for (i = 0; i < ctx.BIG.NLEN; i++) { - b.w[i] = d.w[ctx.BIG.NLEN + i]; - } - - b.norm(); - } - - if (FP.MODTYPE == FP.GENERALISED_MERSENNE) { - // GoldiLocks Only - t = d.split(FP.MODBITS); - b.hcopy(d); - b.add(t); - dd = new ctx.DBIG(0); - dd.hcopy(t); - dd.shl(FP.MODBITS / 2); - - tt = dd.split(FP.MODBITS); - lo = new ctx.BIG(); - lo.hcopy(dd); - - b.add(tt); - b.add(lo); - //b.norm(); - tt.shl(FP.MODBITS / 2); - b.add(tt); - - carry = b.w[ctx.BIG.NLEN - 1] >> FP.TBITS; - b.w[ctx.BIG.NLEN - 1] &= FP.TMASK; - b.w[0] += carry; - - b.w[Math.floor(224 / ctx.BIG.BASEBITS)] += carry << 224 % ctx.BIG.BASEBITS; - b.norm(); - } - - if (FP.MODTYPE == FP.NOT_SPECIAL) { - m = new ctx.BIG(0); - m.rcopy(ctx.ROM_FIELD.Modulus); - - b.copy(ctx.BIG.monty(m, ctx.ROM_FIELD.MConst, d)); - } - - return b; - }; - - return FP; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP: FP, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp12.js b/packages/bls-verify/src/vendor/amcl-js/src/fp12.js deleted file mode 100644 index 3c1c3f016..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp12.js +++ /dev/null @@ -1,1069 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Fp^12 functions */ - -/* FP12 elements are of the form a+i.b+i^2.c */ - -var FP12 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP12 = function (d, e, f) { - /* - if (!isNaN(d)) - { - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(0); - this.c = new ctx.FP4(0); - if (d==1) this.stype=ctx.FP.ONE; - else this.stype=ctx.FP.SPARSEST; - } - else - { - if (d instanceof FP12) { - this.a = new ctx.FP4(d.a); - this.b = new ctx.FP4(d.b); - this.c = new ctx.FP4(d.c); - } else { - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(e); - this.c = new ctx.FP4(f); - } - this.stype=ctx.FP.DENSE; - } -*/ - if (d instanceof FP12) { - // ignore e, d, which are assumed be undefined in this case - this.a = new ctx.FP4(d.a); - this.b = new ctx.FP4(d.b); - this.c = new ctx.FP4(d.c); - this.stype = ctx.FP.DENSE; - } else if (typeof d !== 'undefined' && typeof e !== 'undefined' && typeof f !== 'undefined') { - // all 3 components set to (can be anything that the FP4 constructor supports) - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(e); - this.c = new ctx.FP4(f); - this.stype = ctx.FP.DENSE; - } else if (typeof d === 'number') { - // first component is number - this.a = new ctx.FP4(d); - this.b = new ctx.FP4(0); - this.c = new ctx.FP4(0); - if (d == 1) this.stype = ctx.FP.ONE; - else this.stype = ctx.FP.SPARSER; - } else { - // other cases, including `new ctx.FP12()` fall back to zero - this.a = new ctx.FP4(0); - this.b = new ctx.FP4(0); - this.c = new ctx.FP4(0); - this.stype = ctx.FP.ZERO; - } - }; - - FP12.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - this.c.reduce(); - }, - - /* normalize all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - this.c.norm(); - }, - - /* test x==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch() && this.c.iszilch(); - }, - - /* test x==1 ? */ - isunity: function () { - var one = new ctx.FP4(1); - return this.a.equals(one) && this.b.iszilch() && this.c.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - this.c.cmove(g.c, d); - d = ~(d - 1); - this.stype ^= (this.stype ^ g.stype) & d; - }, - - /* Constant time select from pre-computed table */ - select: function (g, b) { - var invf = new FP12(0), - m, - babs; - - m = b >> 31; - babs = (b ^ m) - m; - babs = (babs - 1) / 2; - - this.cmove(g[0], FP12.teq(babs, 0)); // conditional move - this.cmove(g[1], FP12.teq(babs, 1)); - this.cmove(g[2], FP12.teq(babs, 2)); - this.cmove(g[3], FP12.teq(babs, 3)); - this.cmove(g[4], FP12.teq(babs, 4)); - this.cmove(g[5], FP12.teq(babs, 5)); - this.cmove(g[6], FP12.teq(babs, 6)); - this.cmove(g[7], FP12.teq(babs, 7)); - - invf.copy(this); - invf.conj(); - this.cmove(invf, m & 1); - }, - - settype: function (w) { - this.stype = w; - }, - - gettype: function () { - return this.stype; - }, - - /* extract a from this */ - geta: function () { - return this.a; - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - /* extract c */ - getc: function () { - return this.c; - }, - - /* return 1 if x==y, else 0 */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b) && this.c.equals(x.c); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - this.c.copy(x.c); - this.stype = x.stype; - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ONE; - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ZERO; - }, - - /* this=conj(this) */ - conj: function () { - this.a.conj(); - this.b.nconj(); - this.c.conj(); - }, - - /* set this from 3 FP4s */ - set: function (d, e, f) { - this.a.copy(d); - this.b.copy(e); - this.c.copy(f); - this.stype = ctx.FP.DENSE; - }, - - /* set this from one ctx.FP4 */ - seta: function (d) { - this.a.copy(d); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.SPARSEST; - }, - - /* Granger-Scott Unitary Squaring */ - usqr: function () { - var A = new ctx.FP4(this.a), - B = new ctx.FP4(this.c), - C = new ctx.FP4(this.b), - D = new ctx.FP4(0); - - this.a.sqr(); - D.copy(this.a); - D.add(this.a); - this.a.add(D); - - A.nconj(); - - A.add(A); - this.a.add(A); - B.sqr(); - B.times_i(); - - D.copy(B); - D.add(B); - B.add(D); - - C.sqr(); - D.copy(C); - D.add(C); - C.add(D); - - this.b.conj(); - this.b.add(this.b); - this.c.nconj(); - - this.c.add(this.c); - this.b.add(B); - this.c.add(C); - this.stype = ctx.FP.DENSE; - this.reduce(); - }, - - /* Chung-Hasan SQR2 method from http://cacr.uwaterloo.ca/techreports/2006/cacr2006-24.pdf */ - sqr: function () { - if (this.stype == ctx.FP.ONE) return; - - var A = new ctx.FP4(this.a), - B = new ctx.FP4(this.b), - C = new ctx.FP4(this.c), - D = new ctx.FP4(this.a); - - A.sqr(); - B.mul(this.c); - B.add(B); - C.sqr(); - D.mul(this.b); - D.add(D); - - this.c.add(this.a); - this.c.add(this.b); - this.c.norm(); - this.c.sqr(); - - this.a.copy(A); - - A.add(B); - A.add(C); - A.add(D); - A.neg(); - B.times_i(); - C.times_i(); - - this.a.add(B); - this.b.copy(C); - this.b.add(D); - this.c.add(A); - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) this.stype = ctx.FP.SPARSE; - else this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP12 full multiplication this=this*y */ - mul: function (y) { - var z0 = new ctx.FP4(this.a), - z1 = new ctx.FP4(0), - z2 = new ctx.FP4(this.b), - z3 = new ctx.FP4(0), - t0 = new ctx.FP4(this.a), - t1 = new ctx.FP4(y.a); - - z0.mul(y.a); - z2.mul(y.b); - - t0.add(this.b); - t1.add(y.b); - - t0.norm(); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - - t1.copy(y.b); - t1.add(y.c); - - t0.norm(); - t1.norm(); - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t1.copy(y.a); - t1.add(y.c); - - t0.norm(); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - t0.copy(this.c); - t0.mul(y.c); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP12 multiplication w=w*y */ - /* catering for special case that arises from special form of ATE pairing line function */ - /* w and y are both sparser line functions - cost = 6m */ - smul: function (y) { - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - var w1 = new ctx.FP2(this.a.geta()); - var w2 = new ctx.FP2(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.b.geta().geta()); - t.mul(y.b.geta().geta()); - w3 = new ctx.FP2(t); - } else { - if (y.stype != ctx.FP.SPARSEST) { - w3 = new ctx.FP2(y.b.geta()); - w3.pmul(this.b.geta().geta()); - } else { - w3 = new ctx.FP2(this.b.geta()); - w3.pmul(y.b.geta().geta()); - } - } - } else { - w3 = new ctx.FP2(this.b.geta()); - w3.mul(y.b.geta()); - } - - var ta = new ctx.FP2(this.a.geta()); - var tb = new ctx.FP2(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP2(ta); - tc.mul(tb); - var t = new ctx.FP2(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.b.geta()); - tb.norm(); - var td = new ctx.FP2(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.b.geta()); - tb.norm(); - var te = new ctx.FP2(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.mul_ip(); - w1.add(w2); - - this.a.geta().copy(w1); - this.a.getb().copy(tc); - this.b.geta().copy(td); - this.b.getb().copy(te); - this.c.geta().copy(w3); - this.c.getb().zero(); - - this.a.norm(); - this.b.norm(); - } else { - var w1 = new ctx.FP2(this.a.geta()); - var w2 = new ctx.FP2(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.c.getb().geta()); - t.mul(y.c.getb().geta()); - w3 = new ctx.FP2(t); - } else { - if (y.type != ctx.FP.SPARSEST) { - w3 = new ctx.FP2(y.c.getb()); - w3.pmul(this.c.getb().geta()); - } else { - w3 = new ctx.FP2(this.c.getb()); - w3.pmul(y.c.getb().geta()); - } - } - } else { - w3 = new ctx.FP2(this.c.getb()); - w3.mul(y.c.getb()); - } - - var ta = new ctx.FP2(this.a.geta()); - var tb = new ctx.FP2(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP2(ta); - tc.mul(tb); - var t = new ctx.FP2(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.c.getb()); - tb.norm(); - var td = new ctx.FP2(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.c.getb()); - tb.norm(); - var te = new ctx.FP2(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.mul_ip(); - w1.add(w2); - this.a.geta().copy(w1); - this.a.getb().copy(tc); - - w3.mul_ip(); - w3.norm(); - this.b.geta().zero(); - this.b.getb().copy(w3); - - te.norm(); - te.mul_ip(); - this.c.geta().copy(te); - this.c.getb().copy(td); - - this.a.norm(); - this.c.norm(); - } - this.stype = ctx.FP.SPARSE; - }, - - /* FP12 full multiplication w=w*y */ - /* Supports sparse multiplicands */ - /* Usually w is denser than y */ - ssmul: function (y) { - if (this.stype == ctx.FP.ONE) { - this.copy(y); - return; - } - if (y.stype == ctx.FP.ONE) return; - - if (y.stype >= ctx.FP.SPARSE) { - var z0 = new ctx.FP4(this.a); - var z1 = new ctx.FP4(0); - var z2 = new ctx.FP4(0); - var z3 = new ctx.FP4(0); - z0.mul(y.a); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - z2.getb().copy(this.b.getb()); - z2.getb().mul(y.b.getb()); - z2.geta().zero(); - if (y.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.getb()); - z2.geta().mul(y.b.geta()); - } - if (this.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.geta()); - z2.geta().mul(y.b.getb()); - } - z2.times_i(); - } else { - z2.copy(this.b); - z2.mul(y.b); - } - } else { - z2.copy(this.b); - z2.mul(y.b); - } - var t0 = new ctx.FP4(this.a); - var t1 = new ctx.FP4(y.a); - t0.add(this.b); - t0.norm(); - t1.add(y.b); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - t1.copy(y.b); - t1.add(y.c); - t1.norm(); - - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - t0.geta().copy(this.c.geta()); - t0.geta().mul(y.c.geta()); - t0.getb().zero(); - if (y.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.geta()); - t0.getb().mul(y.c.getb()); - } - if (this.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.getb()); - t0.getb().mul(y.c.geta()); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } else { - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) { - this.smul(y); - return; - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - // dense by sparser - 13m - var z0 = new ctx.FP4(this.a); - var z2 = new ctx.FP4(this.b); - var z3 = new ctx.FP4(this.b); - var t0 = new ctx.FP4(0); - var t1 = new ctx.FP4(y.a); - z0.mul(y.a); - - if (y.stype == ctx.FP.SPARSEST) z2.qmul(y.b.geta().geta()); - else z2.pmul(y.b.geta()); - - this.b.add(this.a); - t1.real().add(y.b.geta()); - - t1.norm(); - this.b.norm(); - this.b.mul(t1); - z3.add(this.c); - z3.norm(); - if (y.stype == ctx.FP.SPARSEST) z3.qmul(y.b.geta().geta()); - else z3.pmul(y.b.geta()); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - this.b.add(t0); - - this.b.add(t1); - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - z3.norm(); - t0.mul(y.a); - this.c.copy(z2); - this.c.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - var z0 = new ctx.FP4(this.a); - var z1 = new ctx.FP4(0); - var z2 = new ctx.FP4(0); - var z3 = new ctx.FP4(0); - var t0 = new ctx.FP4(this.a); - var t1 = new ctx.FP4(0); - - z0.mul(y.a); - t0.add(this.b); - t0.norm(); - - z1.copy(t0); - z1.mul(y.a); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - - z3.copy(t0); - - if (y.stype == ctx.FP.SPARSEST) z3.qmul(y.c.getb().geta()); - else z3.pmul(y.c.getb()); - z3.times_i(); - - t0.copy(z0); - t0.neg(); - z1.add(t0); - this.b.copy(z1); - z2.copy(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - t0.copy(this.c); - - if (y.stype == ctx.FP.SPARSEST) t0.qmul(y.c.getb().geta()); - else t0.pmul(y.c.getb()); - t0.times_i(); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - } - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* this=1/this */ - inverse: function () { - var f0 = new ctx.FP4(this.a), - f1 = new ctx.FP4(this.b), - f2 = new ctx.FP4(this.a), - f3 = new ctx.FP4(0); - - f0.sqr(); - f1.mul(this.c); - f1.times_i(); - f0.sub(f1); - f0.norm(); - - f1.copy(this.c); - f1.sqr(); - f1.times_i(); - f2.mul(this.b); - f1.sub(f2); - f1.norm(); - - f2.copy(this.b); - f2.sqr(); - f3.copy(this.a); - f3.mul(this.c); - f2.sub(f3); - f2.norm(); - - f3.copy(this.b); - f3.mul(f2); - f3.times_i(); - this.a.mul(f0); - f3.add(this.a); - this.c.mul(f1); - this.c.times_i(); - - f3.add(this.c); - f3.norm(); - f3.inverse(null); - this.a.copy(f0); - this.a.mul(f3); - this.b.copy(f1); - this.b.mul(f3); - this.c.copy(f2); - this.c.mul(f3); - this.stype = ctx.FP.DENSE; - }, - - /* this=this^p, where p=Modulus, using Frobenius */ - frob: function (f) { - var f2 = new ctx.FP2(f), - f3 = new ctx.FP2(f); - - f2.sqr(); - f3.mul(f2); - - this.a.frob(f3); - this.b.frob(f3); - this.c.frob(f3); - - this.b.pmul(f); - this.c.pmul(f2); - this.stype = ctx.FP.DENSE; - }, - - /* trace function */ - trace: function () { - var t = new ctx.FP4(0); - - t.copy(this.a); - t.imul(3); - t.reduce(); - - return t; - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ',' + this.c.toString() + ']'; - }, - - /* convert this to byte array */ - toBytes: function (w) { - var t = []; - this.c.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i] = t[i]; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 4 * ctx.BIG.MODBYTES] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 8 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* set this=this^e */ - pow: function (e) { - var e1, e3, w, nb, i, bt, sf; - e1 = new ctx.BIG(e); - e1.norm(); - e3 = new ctx.BIG(e1); - e3.pmul(3); - e3.norm(); - - sf = new FP12(this); - sf.norm(); - w = new FP12(sf); - if (e3.iszilch()) { - w.one(); - return w; - } - nb = e3.nbits(); - - for (i = nb - 2; i >= 1; i--) { - w.usqr(); - bt = e3.bit(i) - e1.bit(i); - - if (bt == 1) { - w.mul(sf); - } - if (bt == -1) { - sf.conj(); - w.mul(sf); - sf.conj(); - } - } - w.reduce(); - - return w; - }, - - /* constant time powering by small integer of max length bts */ - pinpow: function (e, bts) { - var R = [], - i, - b; - - R[0] = new FP12(1); - R[1] = new FP12(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - R[1 - b].mul(R[b]); - R[b].usqr(); - } - - this.copy(R[0]); - }, - - /* Faster compressed powering for unitary elements */ - compow: function (e, r) { - var fa, fb, f, q, m, a, b, g1, g2, c, cp, cpm1, cpm2; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - - m = new ctx.BIG(q); - m.mod(r); - - a = new ctx.BIG(e); - a.mod(m); - - b = new ctx.BIG(e); - b.div(m); - - g1 = new FP12(0); - g2 = new FP12(0); - g1.copy(this); - - c = g1.trace(); - - if (b.iszilch()) { - c = c.xtr_pow(e); - return c; - } - - g2.copy(g1); - g2.frob(f); - cp = g2.trace(); - g1.conj(); - g2.mul(g1); - cpm1 = g2.trace(); - g2.mul(g1); - cpm2 = g2.trace(); - - c = c.xtr_pow2(cp, cpm1, cpm2, a, b); - return c; - }, - }; - - /* convert from byte array to FP12 */ - FP12.fromBytes = function (w) { - var a, b, c; - var t = []; - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = w[i]; - c = ctx.FP4.fromBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 4 * ctx.BIG.MODBYTES]; - b = ctx.FP4.fromBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 8 * ctx.BIG.MODBYTES]; - a = ctx.FP4.fromBytes(t); - return new FP12(a, b, c); - }; - - /* return 1 if b==c, no branching */ - FP12.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* p=q0^u0.q1^u1.q2^u2.q3^u3 */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - FP12.pow4 = function (q, u) { - var g = [], - r = new FP12(0), - p = new FP12(0), - t = [], - mt = new ctx.BIG(0), - w = [], - s = [], - i, - j, - k, - nb, - bt, - pb; - - for (i = 0; i < 4; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - } - - g[0] = new FP12(q[0]); // q[0] - g[1] = new FP12(g[0]); - g[1].mul(q[1]); // q[0].q[1] - g[2] = new FP12(g[0]); - g[2].mul(q[2]); // q[0].q[2] - g[3] = new FP12(g[1]); - g[3].mul(q[2]); // q[0].q[1].q[2] - g[4] = new FP12(q[0]); - g[4].mul(q[3]); // q[0].q[3] - g[5] = new FP12(g[1]); - g[5].mul(q[3]); // q[0].q[1].q[3] - g[6] = new FP12(g[2]); - g[6].mul(q[3]); // q[0].q[2].q[3] - g[7] = new FP12(g[3]); - g[7].mul(q[3]); // q[0].q[1].q[2].q[3] - - // Make it odd - pb = 1 - t[0].parity(); - t[0].inc(pb); - t[0].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 4; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s[i] = 2 * t[0].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w[i] += bt * k; - k *= 2; - } - } - - // Main loop - p.select(g, 2 * w[nb - 1] + 1); - for (i = nb - 2; i >= 0; i--) { - p.usqr(); - r.select(g, 2 * w[i] + s[i]); - p.mul(r); - } - - // apply correction - r.copy(q[0]); - r.conj(); - r.mul(p); - p.cmove(r, pb); - - p.reduce(); - return p; - }; - - return FP12; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP12: FP12, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp16.js b/packages/bls-verify/src/vendor/amcl-js/src/fp16.js deleted file mode 100644 index 8ce7919e0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp16.js +++ /dev/null @@ -1,594 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^16 functions */ - -/* FP16 elements are of the form a+ib, where i is sqrt(sqrt(-1+sqrt(-1))) */ - -var FP16 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP16 = function (c, d) { - if (c instanceof FP16) { - this.a = new ctx.FP8(c.a); - this.b = new ctx.FP8(c.b); - } else { - this.a = new ctx.FP8(c); - this.b = new ctx.FP8(d); - } - }; - - FP16.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) bf[i + 2 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this==1 ? */ - isunity: function () { - var one = new ctx.FP8(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test is w real? That is in a+ib test b is zero */ - isreal: function () { - return this.b.iszilch(); - }, - - /* extract real part a */ - real: function () { - return this.a; - }, - - geta: function () { - return this.a; - }, - - /* extract imaginary part b */ - getb: function () { - return this.b; - }, - - /* test this=x? */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - /* set from two FP8s */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - /* this=-this */ - neg: function () { - var m = new ctx.FP8(this.a), - t = new ctx.FP8(0); - - this.norm(); - m.add(this.b); - m.neg(); - - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - this.norm(); - }, - - /* this=conjugate(this) */ - conj: function () { - this.b.neg(); - this.norm(); - }, - - /* this=-conjugate(this) */ - nconj: function () { - this.a.neg(); - this.norm(); - }, - - /* this+=x */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP16(x); - m.neg(); - this.add(m); - }, - - /* this*=s where s is FP8 */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=s where s is FP2 */ - qmul: function (s) { - this.a.qmul(s); - this.b.qmul(s); - }, - - /* this*=c where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - var t1 = new ctx.FP8(this.a), - t2 = new ctx.FP8(this.b), - t3 = new ctx.FP8(this.a); - - t3.mul(this.b); - t1.add(this.b); - t1.norm(); - t2.times_i(); - - t2.add(this.a); - t2.norm(); - this.a.copy(t1); - - this.a.mul(t2); - - t2.copy(t3); - t2.times_i(); - t2.add(t3); - - t2.neg(); - - this.a.add(t2); - - this.b.copy(t3); - this.b.add(t3); - - this.norm(); - }, - - /* this*=y */ - mul: function (y) { - var t1 = new ctx.FP8(this.a), - t2 = new ctx.FP8(this.b), - t3 = new ctx.FP8(0), - t4 = new ctx.FP8(this.b); - - t1.mul(y.a); - t2.mul(y.b); - t3.copy(y.b); - t3.add(y.a); - t4.add(this.a); - - t3.norm(); - t4.norm(); - - t4.mul(t3); - - t3.copy(t1); - t3.neg(); - t4.add(t3); - - t3.copy(t2); - t3.neg(); - this.b.copy(t4); - this.b.add(t3); - - t2.times_i(); - this.a.copy(t2); - this.a.add(t1); - - this.norm(); - }, - - /* convert to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function () { - //this.norm(); - - var t1 = new ctx.FP8(this.a), - t2 = new ctx.FP8(this.b); - - t1.sqr(); - t2.sqr(); - t2.times_i(); - t2.norm(); // ?? - t1.sub(t2); - t1.inverse(null); - this.a.mul(t1); - t1.neg(); - t1.norm(); - this.b.mul(t1); - }, - - /* this*=i where i = sqrt(-1+sqrt(-1)) */ - times_i: function () { - var s = new ctx.FP8(this.b), - t = new ctx.FP8(this.a); - - s.times_i(); - this.b.copy(t); - - this.a.copy(s); - this.norm(); - }, - - times_i2: function () { - this.a.times_i(); - this.b.times_i(); - }, - - times_i4: function () { - this.a.times_i2(); - this.b.times_i2(); - }, - - /* this=this^q using Frobenius, where q is Modulus */ - frob: function (f) { - var ff = new ctx.FP2(f); - ff.sqr(); - ff.norm(); - this.a.frob(ff); - this.b.frob(ff); - this.b.qmul(f); - this.b.times_i(); - }, - - /* this=this^e */ - pow: function (e) { - var w = new FP16(this), - z = new ctx.BIG(e), - r = new FP16(1), - bt; - w.norm(); - z.norm(); - for (;;) { - bt = z.parity(); - z.fshr(1); - - if (bt === 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - - w.sqr(); - } - r.reduce(); - - return r; - }, - - /* XTR xtr_a function */ - /* - xtr_A: function(w, y, z) { - var r = new FP16(w), - t = new FP16(w); - - r.sub(y); - r.norm(); - r.pmul(this.a); - t.add(y); - t.norm(); - t.pmul(this.b); - t.times_i(); - - this.copy(r); - this.add(t); - this.add(z); - - this.reduce(); - }, -*/ - /* XTR xtr_d function */ - /* - xtr_D: function() { - var w = new FP16(this); - this.sqr(); - w.conj(); - w.add(w); - this.sub(w); - this.reduce(); - }, -*/ - /* r=x^n using XTR method on traces of FP48s */ - /* - xtr_pow: function(n) { - var sf = new FP16(this); - sf.norm(); - var a = new FP16(3), - b = new FP16(sf), - c = new FP16(b), - t = new FP16(0), - r = new FP16(0), - par, v, nb, i; - - c.xtr_D(); - - - par = n.parity(); - v = new ctx.BIG(n); - v.norm(); - v.fshr(1); - - if (par === 0) { - v.dec(1); - v.norm(); - } - - nb = v.nbits(); - for (i = nb - 1; i >= 0; i--) { - if (v.bit(i) != 1) { - t.copy(b); - sf.conj(); - c.conj(); - b.xtr_A(a, sf, c); - sf.conj(); - c.copy(t); - c.xtr_D(); - a.xtr_D(); - } else { - t.copy(a); - t.conj(); - a.copy(b); - a.xtr_D(); - b.xtr_A(c, sf, t); - c.xtr_D(); - } - } - - if (par === 0) { - r.copy(c); - } else { - r.copy(b); - } - r.reduce(); - - return r; - }, -*/ - /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP48s. See Stam thesis. */ - /* - xtr_pow2: function(ck, ckml, ckm2l, a, b) { - - var e = new ctx.BIG(a), - d = new ctx.BIG(b), - w = new ctx.BIG(0), - cu = new FP16(ck), - cv = new FP16(this), - cumv = new FP16(ckml), - cum2v = new FP16(ckm2l), - r = new FP16(0), - t = new FP16(0), - f2 = 0, - i; - - d.norm(); - e.norm(); - - while (d.parity() === 0 && e.parity() === 0) { - d.fshr(1); - e.fshr(1); - f2++; - } - - while (ctx.BIG.comp(d, e) !== 0) { - if (ctx.BIG.comp(d, e) > 0) { - w.copy(e); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(d, w) <= 0) { - w.copy(d); - d.copy(e); - e.rsub(w); - e.norm(); - - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cum2v.conj(); - cumv.copy(cv); - cv.copy(cu); - cu.copy(t); - - } else if (d.parity() === 0) { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } else if (e.parity() == 1) { - d.sub(e); - d.norm(); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cu.xtr_D(); - cum2v.copy(cv); - cum2v.xtr_D(); - cum2v.conj(); - cv.copy(t); - } else { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } - } - if (ctx.BIG.comp(d, e) < 0) { - w.copy(d); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(e, w) <= 0) { - e.sub(d); - e.norm(); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cumv.copy(cu); - cu.copy(t); - } else if (e.parity() === 0) { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() == 1) { - w.copy(e); - e.copy(d); - w.sub(d); - w.norm(); - d.copy(w); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cumv.conj(); - cum2v.copy(cu); - cum2v.xtr_D(); - cum2v.conj(); - cu.copy(cv); - cu.xtr_D(); - cv.copy(t); - } else { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } - } - } - r.copy(cv); - r.xtr_A(cu, cumv, cum2v); - for (i = 0; i < f2; i++) { - r.xtr_D(); - } - r = r.xtr_pow(d); - return r; - } -*/ - }; - - FP16.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP8.fromBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = bf[i + 8 * ctx.BIG.MODBYTES]; - var ta = ctx.FP8.fromBytes(t); - return new FP16(ta, tb); - }; - - return FP16; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP16: FP16, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp2.js b/packages/bls-verify/src/vendor/amcl-js/src/fp2.js deleted file mode 100644 index baf3edf14..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp2.js +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^2 functions */ - -/* FP2 elements are of the form a+ib, where i is sqrt(-1) */ - -var FP2 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP2 = function (c, d) { - if (c instanceof FP2) { - this.a = new ctx.FP(c.a); - this.b = new ctx.FP(c.b); - } else { - this.a = new ctx.FP(c); - this.b = new ctx.FP(d); - } - }; - - FP2.prototype = { - /* reduce components mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise components of w */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this=0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return 0; - var cmp = this.b.islarger(); - if (cmp != 0) return cmp; - return this.a.islarger(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) bf[i + ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this=1 ? */ - isunity: function () { - var one = new ctx.FP(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test this=x */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* extract a */ - - geta: function () { - return this.a; - }, - - getA: function () { - return this.a.redc(); - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - getB: function () { - return this.b.redc(); - }, - - /* set from pair of FPs */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - /* set from two BIGs */ - bset: function (c, d) { - this.a.bcopy(c); - this.b.bcopy(d); - }, - - /* set from one ctx.BIG */ - bseta: function (c) { - this.a.bcopy(c); - this.b.zero(); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - sign: function () { - var p1 = this.a.sign(); - var p2 = this.b.sign(); - if (ctx.FP.BIG_ENDIAN_SIGN) { - var u = this.b.iszilch() ? 1 : 0; - p2 ^= (p1 ^ p2) & u; - return p2; - } else { - var u = this.a.iszilch() ? 1 : 0; - p1 ^= (p1 ^ p2) & u; - return p1; - } - }, - - /* negate this */ - neg: function () { - var m = new ctx.FP(this.a), - t = new ctx.FP(0); - - m.add(this.b); - m.neg(); - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - }, - - /* conjugate this */ - conj: function () { - this.b.neg(); - this.b.norm(); - }, - - /* this+=a */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP2(x); - m.neg(); - this.add(m); - }, - - rsub: function (x) { - this.neg(); - this.add(x); - }, - - /* this*=s, where s is FP */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=c, where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - var w1 = new ctx.FP(this.a), - w3 = new ctx.FP(this.a), - mb = new ctx.FP(this.b); - - w1.add(this.b); - w3.add(this.a); - w3.norm(); - this.b.mul(w3); - - mb.neg(); - this.a.add(mb); - - this.a.norm(); - w1.norm(); - - this.a.mul(w1); - }, - - /* this*=y */ - /* Now using Lazy reduction - inputs must be normed */ - mul: function (y) { - var p = new ctx.BIG(0), - pR = new ctx.DBIG(0), - A, - B, - C, - D, - E, - F; - - p.rcopy(ctx.ROM_FIELD.Modulus); - pR.ucopy(p); - - if ((this.a.XES + this.b.XES) * (y.a.XES + y.b.XES) > ctx.FP.FEXCESS) { - if (this.a.XES > 1) { - this.a.reduce(); - } - - if (this.b.XES > 1) { - this.b.reduce(); - } - } - - A = ctx.BIG.mul(this.a.f, y.a.f); - B = ctx.BIG.mul(this.b.f, y.b.f); - - C = new ctx.BIG(this.a.f); - D = new ctx.BIG(y.a.f); - - C.add(this.b.f); - C.norm(); - D.add(y.b.f); - D.norm(); - - E = ctx.BIG.mul(C, D); - F = new ctx.DBIG(0); - F.copy(A); - F.add(B); - B.rsub(pR); - - A.add(B); - A.norm(); - E.sub(F); - E.norm(); - - this.a.f.copy(ctx.FP.mod(A)); - this.a.XES = 3; - this.b.f.copy(ctx.FP.mod(E)); - this.b.XES = 2; - }, - - /* this^e */ - /* - pow: function(e) { - var r = new FP2(1), - w = new FP2(this), - z = new ctx.BIG(e), - bt; - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - w.sqr(); - } - - r.reduce(); - this.copy(r); - }, */ - - qr: function (h) { - var c = new FP2(this); - c.conj(); - c.mul(this); - - return c.geta().qr(h); - }, - - /* sqrt(a+ib) = sqrt(a+sqrt(a*a-n*b*b)/2)+ib/(2*sqrt(a+sqrt(a*a-n*b*b)/2)) */ - sqrt: function (h) { - var w1, w2, w3, w4, hint; - - if (this.iszilch()) { - return; - } - - w1 = new ctx.FP(this.b); - w2 = new ctx.FP(this.a); - w3 = new ctx.FP(this.a); - w4 = new ctx.FP(this.a); - hint = new ctx.FP(this.a); - - w1.sqr(); - w2.sqr(); - w1.add(w2); - w1.norm(); - - w1 = w1.sqrt(h); - - w2.copy(this.a); - w2.add(w1); - w2.norm(); - w2.div2(); - - w1.copy(this.b); - w1.div2(); - var qr = w2.qr(hint); - - // tweak hint - w3.copy(hint); - w3.neg(); - w3.norm(); - w4.copy(w2); - w4.neg(); - w4.norm(); - - w2.cmove(w4, 1 - qr); - hint.cmove(w3, 1 - qr); - - this.a.copy(w2.sqrt(hint)); - w3.copy(w2); - w3.inverse(hint); - w3.mul(this.a); - this.b.copy(w3); - this.b.mul(w1); - w4.copy(this.a); - - this.a.cmove(this.b, 1 - qr); - this.b.cmove(w4, 1 - qr); - - /* - this.a.copy(w2.sqrt(hint)); - w3.copy(w2); w3.inverse(hint); - w3.mul(this.a); - this.b.copy(w3); this.b.mul(w1); - - hint.neg(); hint.norm(); - w2.neg(); w2.norm(); - - w4.copy(w2.sqrt(hint)); - w3.copy(w2); w3.inverse(hint); - w3.mul(w4); - w3.mul(w1); - - this.a.cmove(w3,1-qr); - this.b.cmove(w4,1-qr); -*/ - var sgn = this.sign(); - var nr = new FP2(this); - nr.neg(); - nr.norm(); - this.cmove(nr, sgn); - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function (h) { - var w1, w2; - - this.norm(); - - w1 = new ctx.FP(this.a); - w2 = new ctx.FP(this.b); - - w1.sqr(); - w2.sqr(); - w1.add(w2); - w1.inverse(h); - this.a.mul(w1); - w1.neg(); - w1.norm(); - this.b.mul(w1); - }, - - /* this/=2 */ - div2: function () { - this.a.div2(); - this.b.div2(); - }, - - /* this*=sqrt(-1) */ - times_i: function () { - var z = new ctx.FP(this.a); //z.copy(this.a); - this.a.copy(this.b); - this.a.neg(); - this.b.copy(z); - }, - - /* w*=(1+sqrt(-1)) */ - /* where X*2-(1+sqrt(-1)) is irreducible for FP4, assumes p=3 mod 8 */ - mul_ip: function () { - var t = new FP2(this); - var i = ctx.FP.QNRI; - this.times_i(); - while (i > 0) { - t.add(t); - t.norm(); - i--; - } - this.add(t); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.norm(); - this.neg(); - } - }, - - /* w/=(1+sqrt(-1)) */ - div_ip: function () { - var z = new FP2(1 << ctx.FP.QNRI, 1); - z.inverse(null); - this.mul(z); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - }; - - FP2.rand = function (rng) { - return new FP2(ctx.FP.rand(rng), ctx.FP.rand(rng)); - }; - - FP2.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP.fromBytes(t); - for (var i = 0; i < ctx.BIG.MODBYTES; i++) t[i] = bf[i + ctx.BIG.MODBYTES]; - var ta = ctx.FP.fromBytes(t); - return new FP2(ta, tb); - }; - - return FP2; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP2: FP2, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp24.js b/packages/bls-verify/src/vendor/amcl-js/src/fp24.js deleted file mode 100644 index 768bf1cd4..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp24.js +++ /dev/null @@ -1,1131 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Fp^24 functions */ - -/* FP24 elements are of the form a+i.b+i^2.c */ - -var FP24 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP24 = function (d, e, f) { - /* - if (!isNaN(d)) - { - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(0); - this.c = new ctx.FP8(0); - if (d==1) this.stype=ctx.FP.ONE; - else this.stype=ctx.FP.SPARSEST; - } - else - { - if (d instanceof FP24) { - this.a = new ctx.FP8(d.a); - this.b = new ctx.FP8(d.b); - this.c = new ctx.FP8(d.c); - } else { - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(e); - this.c = new ctx.FP8(f); - } - this.stype=ctx.FP.DENSE; - } -*/ - - if (d instanceof FP24) { - // ignore e, d, which are assumed be undefined in this case - this.a = new ctx.FP8(d.a); - this.b = new ctx.FP8(d.b); - this.c = new ctx.FP8(d.c); - this.stype = ctx.FP.DENSE; - } else if (typeof d !== 'undefined' && typeof e !== 'undefined' && typeof f !== 'undefined') { - // all 3 components set to (can be anything that the FP8 constructor supports) - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(e); - this.c = new ctx.FP8(f); - this.stype = ctx.FP.DENSE; - } else if (typeof d === 'number') { - // first component is number - this.a = new ctx.FP8(d); - this.b = new ctx.FP8(0); - this.c = new ctx.FP8(0); - if (d == 1) this.stype = ctx.FP.ONE; - else this.stype = ctx.FP.SPARSER; - } else { - // other cases, including `new ctx.FP24()` fall back to zero - this.a = new ctx.FP8(0); - this.b = new ctx.FP8(0); - this.c = new ctx.FP8(0); - this.stype = ctx.FP.ZERO; - } - }; - - FP24.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - this.c.reduce(); - }, - - /* normalize all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - this.c.norm(); - }, - - /* test x==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch() && this.c.iszilch(); - }, - - /* test x==1 ? */ - isunity: function () { - var one = new ctx.FP8(1); - return this.a.equals(one) && this.b.iszilch() && this.c.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - this.c.cmove(g.c, d); - d = ~(d - 1); - this.stype ^= (this.stype ^ g.stype) & d; - }, - - /* Constant time select from pre-computed table */ - select: function (g, b) { - var invf = new FP24(0), - m, - babs; - - m = b >> 31; - babs = (b ^ m) - m; - babs = (babs - 1) / 2; - - this.cmove(g[0], FP24.teq(babs, 0)); // conditional move - this.cmove(g[1], FP24.teq(babs, 1)); - this.cmove(g[2], FP24.teq(babs, 2)); - this.cmove(g[3], FP24.teq(babs, 3)); - this.cmove(g[4], FP24.teq(babs, 4)); - this.cmove(g[5], FP24.teq(babs, 5)); - this.cmove(g[6], FP24.teq(babs, 6)); - this.cmove(g[7], FP24.teq(babs, 7)); - - invf.copy(this); - invf.conj(); - this.cmove(invf, m & 1); - }, - - settype: function (w) { - this.stype = w; - }, - - gettype: function () { - return this.stype; - }, - /* extract a from this */ - geta: function () { - return this.a; - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - /* extract c */ - getc: function () { - return this.c; - }, - - /* return 1 if x==y, else 0 */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b) && this.c.equals(x.c); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - this.c.copy(x.c); - this.stype = x.stype; - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ONE; - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ZERO; - }, - - /* this=conj(this) */ - conj: function () { - this.a.conj(); - this.b.nconj(); - this.c.conj(); - }, - - /* set this from 3 FP8s */ - set: function (d, e, f) { - this.a.copy(d); - this.b.copy(e); - this.c.copy(f); - this.stype = ctx.FP.DENSE; - }, - - /* set this from one ctx.FP8 */ - seta: function (d) { - this.a.copy(d); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.SPARSEST; - }, - - /* Granger-Scott Unitary Squaring */ - usqr: function () { - var A = new ctx.FP8(this.a), - B = new ctx.FP8(this.c), - C = new ctx.FP8(this.b), - D = new ctx.FP8(0); - - this.a.sqr(); - D.copy(this.a); - D.add(this.a); - this.a.add(D); - - A.nconj(); - - A.add(A); - this.a.add(A); - B.sqr(); - B.times_i(); - - D.copy(B); - D.add(B); - B.add(D); - - C.sqr(); - D.copy(C); - D.add(C); - C.add(D); - - this.b.conj(); - this.b.add(this.b); - this.c.nconj(); - - this.c.add(this.c); - this.b.add(B); - this.c.add(C); - this.stype = ctx.FP.DENSE; - this.reduce(); - }, - - /* Chung-Hasan SQR2 method from http://cacr.uwaterloo.ca/techreports/2006/cacr2006-24.pdf */ - sqr: function () { - if (this.stype == ctx.FP.ONE) return; - - var A = new ctx.FP8(this.a), - B = new ctx.FP8(this.b), - C = new ctx.FP8(this.c), - D = new ctx.FP8(this.a); - - A.sqr(); - B.mul(this.c); - B.add(B); - C.sqr(); - D.mul(this.b); - D.add(D); - - this.c.add(this.a); - this.c.add(this.b); - this.c.norm(); - this.c.sqr(); - - this.a.copy(A); - - A.add(B); - A.add(C); - A.add(D); - A.neg(); - B.times_i(); - C.times_i(); - - this.a.add(B); - this.b.copy(C); - this.b.add(D); - this.c.add(A); - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) this.stype = ctx.FP.SPARSE; - else this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP24 full multiplication this=this*y */ - mul: function (y) { - var z0 = new ctx.FP8(this.a), - z1 = new ctx.FP8(0), - z2 = new ctx.FP8(this.b), - z3 = new ctx.FP8(0), - t0 = new ctx.FP8(this.a), - t1 = new ctx.FP8(y.a); - - z0.mul(y.a); - z2.mul(y.b); - - t0.add(this.b); - t1.add(y.b); - - t0.norm(); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - - t1.copy(y.b); - t1.add(y.c); - - t0.norm(); - t1.norm(); - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t1.copy(y.a); - t1.add(y.c); - - t0.norm(); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - t0.copy(this.c); - t0.mul(y.c); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - // z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP24 multiplication w=w*y */ - /* catering for special case that arises from special form of ATE pairing line function */ - /* w and y are both sparser line functions - cost = 6m */ - smul: function (y) { - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - var w1 = new ctx.FP4(this.a.geta()); - var w2 = new ctx.FP4(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.b.geta().geta().geta()); - t.mul(y.b.geta().geta().geta()); - w3 = new ctx.FP4(t); - } else { - if (y.stype != ctx.FP.SPARSEST) { - w3 = new ctx.FP4(y.b.geta()); - w3.qmul(this.b.geta().geta().geta()); - } else { - w3 = new ctx.FP4(this.b.geta()); - w3.qmul(y.b.geta().geta().geta()); - } - } - } else { - w3 = new ctx.FP4(this.b.geta()); - w3.mul(y.b.geta()); - } - - var ta = new ctx.FP4(this.a.geta()); - var tb = new ctx.FP4(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP4(ta); - tc.mul(tb); - var t = new ctx.FP4(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.b.geta()); - tb.norm(); - var td = new ctx.FP4(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.b.geta()); - tb.norm(); - var te = new ctx.FP4(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - - this.a.geta().copy(w1); - this.a.getb().copy(tc); - this.b.geta().copy(td); - this.b.getb().copy(te); - this.c.geta().copy(w3); - this.c.getb().zero(); - - this.a.norm(); - this.b.norm(); - } else { - var w1 = new ctx.FP4(this.a.geta()); - var w2 = new ctx.FP4(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.c.getb().geta().geta()); - t.mul(y.c.getb().geta().geta()); - w3 = new ctx.FP4(t); - } else { - if (y.type != ctx.FP.SPARSEST) { - w3 = new ctx.FP4(y.c.getb()); - w3.qmul(this.c.getb().geta().geta()); - } else { - w3 = new ctx.FP4(this.c.getb()); - w3.qmul(y.c.getb().geta().geta()); - } - } - } else { - w3 = new ctx.FP4(this.c.getb()); - w3.mul(y.c.getb()); - } - - var ta = new ctx.FP4(this.a.geta()); - var tb = new ctx.FP4(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP4(ta); - tc.mul(tb); - var t = new ctx.FP4(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.c.getb()); - tb.norm(); - var td = new ctx.FP4(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.c.getb()); - tb.norm(); - var te = new ctx.FP4(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - this.a.geta().copy(w1); - this.a.getb().copy(tc); - - w3.times_i(); - w3.norm(); - this.b.geta().zero(); - this.b.getb().copy(w3); - - te.norm(); - te.times_i(); - this.c.geta().copy(te); - this.c.getb().copy(td); - - this.a.norm(); - this.c.norm(); - } - this.stype = ctx.FP.SPARSE; - }, - - /* FP24 full multiplication w=w*y */ - /* Supports sparse multiplicands */ - /* Usually w is denser than y */ - ssmul: function (y) { - if (this.stype == ctx.FP.ONE) { - this.copy(y); - return; - } - if (y.stype == ctx.FP.ONE) return; - - if (y.stype >= ctx.FP.SPARSE) { - var z0 = new ctx.FP8(this.a); - var z1 = new ctx.FP8(0); - var z2 = new ctx.FP8(0); - var z3 = new ctx.FP8(0); - z0.mul(y.a); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - z2.getb().copy(this.b.getb()); - z2.getb().mul(y.b.getb()); - z2.geta().zero(); - if (y.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.getb()); - z2.geta().mul(y.b.geta()); - } - if (this.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.geta()); - z2.geta().mul(y.b.getb()); - } - z2.times_i(); - } else { - z2.copy(this.b); - z2.mul(y.b); - } - } else { - z2.copy(this.b); - z2.mul(y.b); - } - var t0 = new ctx.FP8(this.a); - var t1 = new ctx.FP8(y.a); - t0.add(this.b); - t0.norm(); - t1.add(y.b); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - t1.copy(y.b); - t1.add(y.c); - t1.norm(); - - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - t0.geta().copy(this.c.geta()); - t0.geta().mul(y.c.geta()); - t0.getb().zero(); - if (y.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.geta()); - t0.getb().mul(y.c.getb()); - } - if (this.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.getb()); - t0.getb().mul(y.c.geta()); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } else { - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) { - this.smul(y); - return; - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - // dense by sparser - 13m - var z0 = new ctx.FP8(this.a); - var z2 = new ctx.FP8(this.b); - var z3 = new ctx.FP8(this.b); - var t0 = new ctx.FP8(0); - var t1 = new ctx.FP8(y.a); - z0.mul(y.a); - - if (y.stype == ctx.FP.SPARSEST) z2.tmul(y.b.geta().geta().geta()); - else z2.pmul(y.b.geta()); - - this.b.add(this.a); - t1.geta().add(y.b.geta()); - - t1.norm(); - this.b.norm(); - this.b.mul(t1); - z3.add(this.c); - z3.norm(); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.b.geta().geta().geta()); - else z3.pmul(y.b.geta()); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - this.b.add(t0); - - this.b.add(t1); - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - z3.norm(); - t0.mul(y.a); - this.c.copy(z2); - this.c.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - var z0 = new ctx.FP8(this.a); - var z1 = new ctx.FP8(0); - var z2 = new ctx.FP8(0); - var z3 = new ctx.FP8(0); - var t0 = new ctx.FP8(this.a); - var t1 = new ctx.FP8(0); - - z0.mul(y.a); - t0.add(this.b); - t0.norm(); - - z1.copy(t0); - z1.mul(y.a); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - - z3.copy(t0); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.c.getb().geta().geta()); - else z3.pmul(y.c.getb()); - - z3.times_i(); - - t0.copy(z0); - t0.neg(); - z1.add(t0); - this.b.copy(z1); - z2.copy(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - t0.copy(this.c); - - if (y.stype == ctx.FP.SPARSEST) t0.tmul(y.c.getb().geta().geta()); - else t0.pmul(y.c.getb()); - - t0.times_i(); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - } - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* this=1/this */ - inverse: function () { - var f0 = new ctx.FP8(this.a), - f1 = new ctx.FP8(this.b), - f2 = new ctx.FP8(this.a), - f3 = new ctx.FP8(0); - - f0.sqr(); - f1.mul(this.c); - f1.times_i(); - f0.sub(f1); - f0.norm(); - - f1.copy(this.c); - f1.sqr(); - f1.times_i(); - f2.mul(this.b); - f1.sub(f2); - f1.norm(); - - f2.copy(this.b); - f2.sqr(); - f3.copy(this.a); - f3.mul(this.c); - f2.sub(f3); - f2.norm(); - - f3.copy(this.b); - f3.mul(f2); - f3.times_i(); - this.a.mul(f0); - f3.add(this.a); - this.c.mul(f1); - this.c.times_i(); - - f3.add(this.c); - f3.norm(); - f3.inverse(null); - this.a.copy(f0); - this.a.mul(f3); - this.b.copy(f1); - this.b.mul(f3); - this.c.copy(f2); - this.c.mul(f3); - this.stype = ctx.FP.DENSE; - }, - - /* this=this^p, where p=Modulus, using Frobenius */ - frob: function (f, n) { - var f2 = new ctx.FP2(f), - f3 = new ctx.FP2(f), - i; - - f2.sqr(); - f3.mul(f2); - - f3.mul_ip(); - f3.norm(); - - for (i = 0; i < n; i++) { - this.a.frob(f3); - this.b.frob(f3); - this.c.frob(f3); - - this.b.qmul(f); - this.b.times_i2(); - this.c.qmul(f2); - this.c.times_i2(); - this.c.times_i2(); - } - this.stype = ctx.FP.DENSE; - }, - - /* trace function */ - trace: function () { - var t = new ctx.FP8(0); - - t.copy(this.a); - t.imul(3); - t.reduce(); - - return t; - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ',' + this.c.toString() + ']'; - }, - - /* convert this to byte array */ - toBytes: function (w) { - var t = []; - this.c.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i] = t[i]; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 8 * ctx.BIG.MODBYTES] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 16 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* set this=this^e */ - pow: function (e) { - var e1, e3, w, nb, i, bt, sf; - - sf = new FP24(this); - sf.norm(); - e1 = new ctx.BIG(e); - e1.norm(); - - e3 = new ctx.BIG(e1); - e3.pmul(3); - e3.norm(); - - w = new FP24(sf); - if (e3.iszilch()) { - w.one(); - return w; - } - nb = e3.nbits(); - - for (i = nb - 2; i >= 1; i--) { - w.usqr(); - bt = e3.bit(i) - e1.bit(i); - - if (bt == 1) { - w.mul(sf); - } - if (bt == -1) { - sf.conj(); - w.mul(sf); - sf.conj(); - } - } - w.reduce(); - - return w; - }, - - /* constant time powering by small integer of max length bts */ - pinpow: function (e, bts) { - var R = [], - i, - b; - - R[0] = new FP24(1); - R[1] = new FP24(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - R[1 - b].mul(R[b]); - R[b].usqr(); - } - - this.copy(R[0]); - }, - - /* Faster compressed powering for unitary elements */ - /* - compow: function(e, r) { - var fa, fb, f, q, m, a, b, g1, g2, c, cp, cpm1, cpm2; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - - m = new ctx.BIG(q); - m.mod(r); - - a = new ctx.BIG(e); - a.mod(m); - - b = new ctx.BIG(e); - b.div(m); - - g1 = new FP24(0); - g2 = new FP24(0); - g1.copy(this); - - c = g1.trace(); - - if (b.iszilch()) { - c=c.xtr_pow(e); - return c; - } - - g2.copy(g1); - g2.frob(f,1); - cp = g2.trace(); - g1.conj(); - g2.mul(g1); - cpm1 = g2.trace(); - g2.mul(g1); - cpm2 = g2.trace(); - - c = c.xtr_pow2(cp, cpm1, cpm2, a, b); - return c; - } -*/ - }; - - /* convert from byte array to FP12 */ - FP24.fromBytes = function (w) { - var a, b, c; - var t = []; - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = w[i]; - c = ctx.FP8.fromBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 8 * ctx.BIG.MODBYTES]; - b = ctx.FP8.fromBytes(t); - for (var i = 0; i < 8 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 16 * ctx.BIG.MODBYTES]; - a = ctx.FP8.fromBytes(t); - return new FP24(a, b, c); - }; - - /* return 1 if b==c, no branching */ - FP24.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* p=q0^u0.q1^u1.q2^u2.q3^u3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - FP24.pow8 = function (q, u) { - var g1 = [], - g2 = [], - r = new FP24(0), - p = new FP24(0), - t = [], - mt = new ctx.BIG(0), - w1 = [], - s1 = [], - w2 = [], - s2 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2; - - for (i = 0; i < 8; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - } - - g1[0] = new FP24(q[0]); // q[0] - g1[1] = new FP24(g1[0]); - g1[1].mul(q[1]); // q[0].q[1] - g1[2] = new FP24(g1[0]); - g1[2].mul(q[2]); // q[0].q[2] - g1[3] = new FP24(g1[1]); - g1[3].mul(q[2]); // q[0].q[1].q[2] - g1[4] = new FP24(q[0]); - g1[4].mul(q[3]); // q[0].q[3] - g1[5] = new FP24(g1[1]); - g1[5].mul(q[3]); // q[0].q[1].q[3] - g1[6] = new FP24(g1[2]); - g1[6].mul(q[3]); // q[0].q[2].q[3] - g1[7] = new FP24(g1[3]); - g1[7].mul(q[3]); // q[0].q[1].q[2].q[3] - - g2[0] = new FP24(q[4]); // q[0] - g2[1] = new FP24(g2[0]); - g2[1].mul(q[5]); // q[0].q[1] - g2[2] = new FP24(g2[0]); - g2[2].mul(q[6]); // q[0].q[2] - g2[3] = new FP24(g2[1]); - g2[3].mul(q[6]); // q[0].q[1].q[2] - g2[4] = new FP24(q[4]); - g2[4].mul(q[7]); // q[0].q[3] - g2[5] = new FP24(g2[1]); - g2[5].mul(q[7]); // q[0].q[1].q[3] - g2[6] = new FP24(g2[2]); - g2[6].mul(q[7]); // q[0].q[2].q[3] - g2[7] = new FP24(g2[3]); - g2[7].mul(q[7]); // q[0].q[1].q[2].q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 8; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - } - - // Main loop - p.select(g1, 2 * w1[nb - 1] + 1); - r.select(g2, 2 * w2[nb - 1] + 1); - p.mul(r); - for (i = nb - 2; i >= 0; i--) { - p.usqr(); - r.select(g1, 2 * w1[i] + s1[i]); - p.mul(r); - r.select(g2, 2 * w2[i] + s2[i]); - p.mul(r); - } - - // apply correction - r.copy(q[0]); - r.conj(); - r.mul(p); - p.cmove(r, pb1); - - r.copy(q[4]); - r.conj(); - r.mul(p); - p.cmove(r, pb2); - - p.reduce(); - return p; - }; - - return FP24; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP24: FP24, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp4.js b/packages/bls-verify/src/vendor/amcl-js/src/fp4.js deleted file mode 100644 index 7ad95fa59..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp4.js +++ /dev/null @@ -1,722 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^4 functions */ - -/* FP4 elements are of the form a+ib, where i is sqrt(-1+sqrt(-1)) */ - -var FP4 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP4 = function (c, d) { - if (c instanceof FP4) { - this.a = new ctx.FP2(c.a); - this.b = new ctx.FP2(c.b); - } else { - this.a = new ctx.FP2(c); - this.b = new ctx.FP2(d); - } - }; - - FP4.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return 0; - var cmp = this.b.larger(); - if (cmp != 0) return cmp; - return this.a.larger(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) bf[i + 2 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this==1 ? */ - isunity: function () { - var one = new ctx.FP2(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test is w real? That is in a+ib test b is zero */ - isreal: function () { - return this.b.iszilch(); - }, - - /* extract real part a */ - real: function () { - return this.a; - }, - - geta: function () { - return this.a; - }, - - /* extract imaginary part b */ - getb: function () { - return this.b; - }, - - /* test this=x? */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - /* set from two FP2s */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - sign: function () { - var p1 = this.a.sign(); - var p2 = this.b.sign(); - if (ctx.FP.BIG_ENDIAN_SIGN) { - var u = this.b.iszilch() ? 1 : 0; - p2 ^= (p1 ^ p2) & u; - return p2; - } else { - var u = this.a.iszilch() ? 1 : 0; - p1 ^= (p1 ^ p2) & u; - return p1; - } - }, - - /* this=-this */ - neg: function () { - this.norm(); - var m = new ctx.FP2(this.a), - t = new ctx.FP2(0); - - m.add(this.b); - m.neg(); - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - this.norm(); - }, - - /* this=conjugate(this) */ - conj: function () { - this.b.neg(); - this.norm(); - }, - - /* this=-conjugate(this) */ - nconj: function () { - this.a.neg(); - this.norm(); - }, - - /* this+=x */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP4(x); - m.neg(); - this.add(m); - }, - - rsub: function (x) { - this.neg(); - this.add(x); - }, - - /* this*=s where s is FP2 */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=c where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - // this.norm(); - - var t1 = new ctx.FP2(this.a), - t2 = new ctx.FP2(this.b), - t3 = new ctx.FP2(this.a); - - t3.mul(this.b); - t1.add(this.b); - t1.norm(); - t2.mul_ip(); - - t2.add(this.a); - t2.norm(); - this.a.copy(t1); - - this.a.mul(t2); - - t2.copy(t3); - t2.mul_ip(); - t2.add(t3); - t2.norm(); // ?? - - t2.neg(); - - this.a.add(t2); - - this.b.copy(t3); - this.b.add(t3); - - this.norm(); - }, - - /* this*=y */ - mul: function (y) { - // this.norm(); - - var t1 = new ctx.FP2(this.a), - t2 = new ctx.FP2(this.b), - t3 = new ctx.FP2(0), - t4 = new ctx.FP2(this.b); - - t1.mul(y.a); - t2.mul(y.b); - t3.copy(y.b); - t3.add(y.a); - t4.add(this.a); - - t3.norm(); - t4.norm(); - - t4.mul(t3); - - t3.copy(t1); - t3.neg(); - t4.add(t3); - - t3.copy(t2); - t3.neg(); - this.b.copy(t4); - this.b.add(t3); - - t2.mul_ip(); - this.a.copy(t2); - this.a.add(t1); - - this.norm(); - }, - - /* convert to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function (h) { - this.norm(); - - var t1 = new ctx.FP2(this.a), - t2 = new ctx.FP2(this.b); - - t1.sqr(); - t2.sqr(); - t2.mul_ip(); - t2.norm(); // ?? - t1.sub(t2); - t1.inverse(h); - this.a.mul(t1); - t1.neg(); - t1.norm(); - this.b.mul(t1); - }, - - /* this*=i where i = sqrt(-1+sqrt(-1)) */ - times_i: function () { - var t = new ctx.FP2(this.b); - this.b.copy(this.a); - t.mul_ip(); - this.a.copy(t); - this.norm(); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - /* this=this^q using Frobenius, where q is Modulus */ - frob: function (f) { - this.a.conj(); - this.b.conj(); - this.b.mul(f); - }, - - /* this=this^e */ - /* - pow: function(e) { - var w = new FP4(this), - z = new ctx.BIG(e), - r = new FP4(1), - bt; - w.norm(); - z.norm(); - for (;;) { - bt = z.parity(); - z.fshr(1); - - if (bt === 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - - w.sqr(); - } - r.reduce(); - - return r; - }, */ - - /* XTR xtr_a function */ - xtr_A: function (w, y, z) { - var r = new FP4(w), - t = new FP4(w); - - //y.norm(); // ?? - r.sub(y); - r.norm(); - r.pmul(this.a); - t.add(y); - t.norm(); - t.pmul(this.b); - t.times_i(); - - this.copy(r); - this.add(t); - this.add(z); - - this.reduce(); - }, - - /* XTR xtr_d function */ - xtr_D: function () { - var w = new FP4(this); - this.sqr(); - w.conj(); - w.add(w); - this.sub(w); - this.reduce(); - }, - - /* r=x^n using XTR method on traces of FP12s */ - xtr_pow: function (n) { - var sf = new FP4(this); - sf.norm(); - var a = new FP4(3), - b = new FP4(sf), - c = new FP4(b), - t = new FP4(0), - r = new FP4(0), - par, - v, - nb, - i; - - c.xtr_D(); - - //n.norm(); - par = n.parity(); - v = new ctx.BIG(n); - v.norm(); - v.fshr(1); - - if (par === 0) { - v.dec(1); - v.norm(); - } - - nb = v.nbits(); - for (i = nb - 1; i >= 0; i--) { - if (v.bit(i) != 1) { - t.copy(b); - sf.conj(); - c.conj(); - b.xtr_A(a, sf, c); - sf.conj(); - c.copy(t); - c.xtr_D(); - a.xtr_D(); - } else { - t.copy(a); - t.conj(); - a.copy(b); - a.xtr_D(); - b.xtr_A(c, sf, t); - c.xtr_D(); - } - } - - if (par === 0) { - r.copy(c); - } else { - r.copy(b); - } - r.reduce(); - - return r; - }, - - /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP12s. See Stam thesis. */ - xtr_pow2: function (ck, ckml, ckm2l, a, b) { - var e = new ctx.BIG(a), - d = new ctx.BIG(b), - w = new ctx.BIG(0), - cu = new FP4(ck), - cv = new FP4(this), - cumv = new FP4(ckml), - cum2v = new FP4(ckm2l), - r = new FP4(0), - t = new FP4(0), - f2 = 0, - i; - - e.norm(); - d.norm(); - - while (d.parity() === 0 && e.parity() === 0) { - d.fshr(1); - e.fshr(1); - f2++; - } - - while (ctx.BIG.comp(d, e) !== 0) { - if (ctx.BIG.comp(d, e) > 0) { - w.copy(e); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(d, w) <= 0) { - w.copy(d); - d.copy(e); - e.rsub(w); - e.norm(); - - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cum2v.conj(); - cumv.copy(cv); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() === 0) { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } else if (e.parity() == 1) { - d.sub(e); - d.norm(); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cu.xtr_D(); - cum2v.copy(cv); - cum2v.xtr_D(); - cum2v.conj(); - cv.copy(t); - } else { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } - } - if (ctx.BIG.comp(d, e) < 0) { - w.copy(d); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(e, w) <= 0) { - e.sub(d); - e.norm(); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cumv.copy(cu); - cu.copy(t); - } else if (e.parity() === 0) { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() == 1) { - w.copy(e); - e.copy(d); - w.sub(d); - w.norm(); - d.copy(w); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cumv.conj(); - cum2v.copy(cu); - cum2v.xtr_D(); - cum2v.conj(); - cu.copy(cv); - cu.xtr_D(); - cv.copy(t); - } else { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } - } - } - r.copy(cv); - r.xtr_A(cu, cumv, cum2v); - for (i = 0; i < f2; i++) { - r.xtr_D(); - } - r = r.xtr_pow(d); - return r; - }, - - /* New stuff for ecp4.js */ - - div2: function () { - this.a.div2(); - this.b.div2(); - }, - - div_i: function () { - var u = new ctx.FP2(this.a), - v = new ctx.FP2(this.b); - u.div_ip(); - this.a.copy(v); - this.b.copy(u); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - qmul: function (s) { - this.a.pmul(s); - this.b.pmul(s); - }, - - /* this^e */ - /* - pow: function(e) { - var r = new FP4(1), - w = new FP4(this), - z = new ctx.BIG(e), - bt; - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - w.sqr(); - } - - r.reduce(); - this.copy(r); - },*/ - - qr: function (h) { - var c = new FP4(this); - c.conj(); - c.mul(this); - return c.geta().qr(h); - }, - - sqrt: function (h) { - if (this.iszilch()) { - return; - } - var wa = new ctx.FP2(this.a), - wb = new ctx.FP2(this.a), - ws = new ctx.FP2(this.b), - wt = new ctx.FP2(this.a); - var hint = new ctx.FP(0); - - ws.sqr(); - wa.sqr(); - ws.mul_ip(); - ws.norm(); - wa.sub(ws); - - ws.copy(wa); - ws.norm(); - ws.sqrt(h); - - wa.copy(wt); - wa.add(ws); - wa.norm(); - wa.div2(); - - wb.copy(this.b); - wb.div2(); - var qr = wa.qr(hint); - - // tweak hint - multiply old hint by Norm(1/Beta)^e where Beta is irreducible polynomial - ws.copy(wa); - var twk = new ctx.FP(0); - twk.rcopy(ctx.ROM_FIELD.TWK); - twk.mul(hint); - ws.div_ip(); - ws.norm(); - - wa.cmove(ws, 1 - qr); - hint.cmove(twk, 1 - qr); - - this.a.copy(wa); - this.a.sqrt(hint); - ws.copy(wa); - ws.inverse(hint); - ws.mul(this.a); - this.b.copy(ws); - this.b.mul(wb); - wt.copy(this.a); - - this.a.cmove(this.b, 1 - qr); - this.b.cmove(wt, 1 - qr); - - var sgn = this.sign(); - var nr = new FP4(this); - nr.neg(); - nr.norm(); - this.cmove(nr, sgn); - }, - }; - - FP4.rand = function (rng) { - return new FP4(ctx.FP2.rand(rng), ctx.FP2.rand(rng)); - }; - - FP4.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP2.fromBytes(t); - for (var i = 0; i < 2 * ctx.BIG.MODBYTES; i++) t[i] = bf[i + 2 * ctx.BIG.MODBYTES]; - var ta = ctx.FP2.fromBytes(t); - return new FP4(ta, tb); - }; - - return FP4; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP4: FP4, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp48.js b/packages/bls-verify/src/vendor/amcl-js/src/fp48.js deleted file mode 100644 index 3e4ebb85f..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp48.js +++ /dev/null @@ -1,1225 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* CORE Fp^48 functions */ - -/* FP48 elements are of the form a+i.b+i^2.c */ - -var FP48 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP48 = function (d, e, f) { - /* - if (!isNaN(d)) - { - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(0); - this.c = new ctx.FP16(0); - if (d==1) this.stype=ctx.FP.ONE; - else this.stype=ctx.FP.SPARSEST; - } - else - { - if (d instanceof FP48) { - this.a = new ctx.FP16(d.a); - this.b = new ctx.FP16(d.b); - this.c = new ctx.FP16(d.c); - } else { - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(e); - this.c = new ctx.FP16(f); - } - this.stype=ctx.FP.DENSE; - } -*/ - - if (d instanceof FP48) { - // ignore e, d, which are assumed be undefined in this case - this.a = new ctx.FP16(d.a); - this.b = new ctx.FP16(d.b); - this.c = new ctx.FP16(d.c); - this.stype = ctx.FP.DENSE; - } else if (typeof d !== 'undefined' && typeof e !== 'undefined' && typeof f !== 'undefined') { - // all 3 components set to (can be anything that the FP16 constructor supports) - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(e); - this.c = new ctx.FP16(f); - this.stype = ctx.FP.DENSE; - } else if (typeof d === 'number') { - // first component is number - this.a = new ctx.FP16(d); - this.b = new ctx.FP16(0); - this.c = new ctx.FP16(0); - if (d == 1) this.stype = ctx.FP.ONE; - else this.stype = ctx.FP.SPARSER; - } else { - // other cases, including `new ctx.FP48()` fall back to zero - this.a = new ctx.FP16(0); - this.b = new ctx.FP16(0); - this.c = new ctx.FP16(0); - this.stype = ctx.FP.ZERO; - } - }; - - FP48.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - this.c.reduce(); - }, - - /* normalize all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - this.c.norm(); - }, - - /* test x==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch() && this.c.iszilch(); - }, - - /* test x==1 ? */ - isunity: function () { - var one = new ctx.FP16(1); - return this.a.equals(one) && this.b.iszilch() && this.c.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - this.c.cmove(g.c, d); - d = ~(d - 1); - this.stype ^= (this.stype ^ g.stype) & d; - }, - - /* Constant time select from pre-computed table */ - select: function (g, b) { - var invf = new FP48(0), - m, - babs; - - m = b >> 31; - babs = (b ^ m) - m; - babs = (babs - 1) / 2; - - this.cmove(g[0], FP48.teq(babs, 0)); // conditional move - this.cmove(g[1], FP48.teq(babs, 1)); - this.cmove(g[2], FP48.teq(babs, 2)); - this.cmove(g[3], FP48.teq(babs, 3)); - this.cmove(g[4], FP48.teq(babs, 4)); - this.cmove(g[5], FP48.teq(babs, 5)); - this.cmove(g[6], FP48.teq(babs, 6)); - this.cmove(g[7], FP48.teq(babs, 7)); - - invf.copy(this); - invf.conj(); - this.cmove(invf, m & 1); - }, - - settype: function (w) { - this.stype = w; - }, - - gettype: function () { - return this.stype; - }, - - /* extract a from this */ - geta: function () { - return this.a; - }, - - /* extract b */ - getb: function () { - return this.b; - }, - - /* extract c */ - getc: function () { - return this.c; - }, - - /* return 1 if x==y, else 0 */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b) && this.c.equals(x.c); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - this.c.copy(x.c); - this.stype = x.stype; - }, - - /* set this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ONE; - }, - - /* set this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.ZERO; - }, - - /* this=conj(this) */ - conj: function () { - this.a.conj(); - this.b.nconj(); - this.c.conj(); - }, - - /* set this from 3 FP16s */ - set: function (d, e, f) { - this.a.copy(d); - this.b.copy(e); - this.c.copy(f); - this.stype = ctx.FP.DENSE; - }, - - /* set this from one ctx.FP16 */ - seta: function (d) { - this.a.copy(d); - this.b.zero(); - this.c.zero(); - this.stype = ctx.FP.SPARSEST; - }, - - /* Granger-Scott Unitary Squaring */ - usqr: function () { - var A = new ctx.FP16(this.a), - B = new ctx.FP16(this.c), - C = new ctx.FP16(this.b), - D = new ctx.FP16(0); - - this.a.sqr(); - D.copy(this.a); - D.add(this.a); - this.a.add(D); - - A.nconj(); - - A.add(A); - this.a.add(A); - B.sqr(); - B.times_i(); - - D.copy(B); - D.add(B); - B.add(D); - - C.sqr(); - D.copy(C); - D.add(C); - C.add(D); - - this.b.conj(); - this.b.add(this.b); - this.c.nconj(); - - this.c.add(this.c); - this.b.add(B); - this.c.add(C); - this.stype = ctx.FP.DENSE; - this.reduce(); - }, - - /* Chung-Hasan SQR2 method from http://cacr.uwaterloo.ca/techreports/2006/cacr2006-24.pdf */ - sqr: function () { - if (this.stype == ctx.FP.ONE) return; - - var A = new ctx.FP16(this.a), - B = new ctx.FP16(this.b), - C = new ctx.FP16(this.c), - D = new ctx.FP16(this.a); - - A.sqr(); - B.mul(this.c); - B.add(B); - C.sqr(); - D.mul(this.b); - D.add(D); - - this.c.add(this.a); - this.c.add(this.b); - this.c.norm(); - this.c.sqr(); - - this.a.copy(A); - - A.add(B); - A.add(C); - A.add(D); - A.neg(); - B.times_i(); - C.times_i(); - - this.a.add(B); - this.b.copy(C); - this.b.add(D); - this.c.add(A); - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) this.stype = ctx.FP.SPARSE; - else this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP48 full multiplication this=this*y */ - mul: function (y) { - var z0 = new ctx.FP16(this.a), - z1 = new ctx.FP16(0), - z2 = new ctx.FP16(this.b), - z3 = new ctx.FP16(0), - t0 = new ctx.FP16(this.a), - t1 = new ctx.FP16(y.a); - - z0.mul(y.a); - z2.mul(y.b); - - t0.add(this.b); - t1.add(y.b); - - t0.norm(); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - - t1.copy(y.b); - t1.add(y.c); - - t0.norm(); - t1.norm(); - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t1.copy(y.a); - t1.add(y.c); - - t0.norm(); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - t0.copy(this.c); - t0.mul(y.c); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* FP48 multiplication w=w*y */ - /* catering for special case that arises from special form of ATE pairing line function */ - /* w and y are both sparser line functions - cost = 6m */ - smul: function (y) { - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - var w1 = new ctx.FP8(this.a.geta()); - var w2 = new ctx.FP8(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.b.geta().geta().geta().geta()); - t.mul(y.b.geta().geta().geta().geta()); - w3 = new ctx.FP8(t); - } else { - if (y.stype != ctx.FP.SPARSEST) { - w3 = new ctx.FP8(y.b.geta()); - w3.tmul(this.b.geta().geta().geta().geta()); - } else { - w3 = new ctx.FP8(this.b.geta()); - w3.tmul(y.b.geta().geta().geta().geta()); - } - } - } else { - w3 = new ctx.FP8(this.b.geta()); - w3.mul(y.b.geta()); - } - - var ta = new ctx.FP8(this.a.geta()); - var tb = new ctx.FP8(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP8(ta); - tc.mul(tb); - var t = new ctx.FP8(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.b.geta()); - tb.norm(); - var td = new ctx.FP8(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.b.geta()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.b.geta()); - tb.norm(); - var te = new ctx.FP8(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - - this.a.geta().copy(w1); - this.a.getb().copy(tc); - this.b.geta().copy(td); - this.b.getb().copy(te); - this.c.geta().copy(w3); - this.c.getb().zero(); - - this.a.norm(); - this.b.norm(); - } else { - var w1 = new ctx.FP8(this.a.geta()); - var w2 = new ctx.FP8(this.a.getb()); - var w3; - - w1.mul(y.a.geta()); - w2.mul(y.a.getb()); - if (y.stype == ctx.FP.SPARSEST || this.stype == ctx.FP.SPARSEST) { - if (y.stype == ctx.FP.SPARSEST && this.stype == ctx.FP.SPARSEST) { - var t = new ctx.FP(this.c.getb().geta().geta().geta()); - t.mul(y.c.getb().geta().geta().geta()); - w3 = new ctx.FP8(t); - } else { - if (y.type != ctx.FP.SPARSEST) { - w3 = new ctx.FP8(y.c.getb()); - w3.tmul(this.c.getb().geta().geta().geta()); - } else { - w3 = new ctx.FP8(this.c.getb()); - w3.tmul(y.c.getb().geta().geta().geta()); - } - } - } else { - w3 = new ctx.FP8(this.c.getb()); - w3.mul(y.c.getb()); - } - var ta = new ctx.FP8(this.a.geta()); - var tb = new ctx.FP8(y.a.geta()); - ta.add(this.a.getb()); - ta.norm(); - tb.add(y.a.getb()); - tb.norm(); - var tc = new ctx.FP8(ta); - tc.mul(tb); - var t = new ctx.FP8(w1); - t.add(w2); - t.neg(); - tc.add(t); - - ta.copy(this.a.geta()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.geta()); - tb.add(y.c.getb()); - tb.norm(); - var td = new ctx.FP8(ta); - td.mul(tb); - t.copy(w1); - t.add(w3); - t.neg(); - td.add(t); - - ta.copy(this.a.getb()); - ta.add(this.c.getb()); - ta.norm(); - tb.copy(y.a.getb()); - tb.add(y.c.getb()); - tb.norm(); - var te = new ctx.FP8(ta); - te.mul(tb); - t.copy(w2); - t.add(w3); - t.neg(); - te.add(t); - - w2.times_i(); - w1.add(w2); - this.a.geta().copy(w1); - this.a.getb().copy(tc); - - w3.times_i(); - w3.norm(); - this.b.geta().zero(); - this.b.getb().copy(w3); - - te.norm(); - te.times_i(); - this.c.geta().copy(te); - this.c.getb().copy(td); - - this.a.norm(); - this.c.norm(); - } - this.stype = ctx.FP.SPARSE; - }, - - /* FP48 full multiplication w=w*y */ - /* Supports sparse multiplicands */ - /* Usually w is denser than y */ - ssmul: function (y) { - if (this.stype == ctx.FP.ONE) { - this.copy(y); - return; - } - if (y.stype == ctx.FP.ONE) return; - - if (y.stype >= ctx.FP.SPARSE) { - var z0 = new ctx.FP16(this.a); - var z1 = new ctx.FP16(0); - var z2 = new ctx.FP16(0); - var z3 = new ctx.FP16(0); - z0.mul(y.a); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - z2.getb().copy(this.b.getb()); - z2.getb().mul(y.b.getb()); - z2.geta().zero(); - if (y.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.getb()); - z2.geta().mul(y.b.geta()); - } - if (this.stype != ctx.FP.SPARSE) { - z2.geta().copy(this.b.geta()); - z2.geta().mul(y.b.getb()); - } - z2.times_i(); - } else { - z2.copy(this.b); - z2.mul(y.b); - } - } else { - z2.copy(this.b); - z2.mul(y.b); - } - var t0 = new ctx.FP16(this.a); - var t1 = new ctx.FP16(y.a); - t0.add(this.b); - t0.norm(); - t1.add(y.b); - t1.norm(); - - z1.copy(t0); - z1.mul(t1); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - t1.copy(y.b); - t1.add(y.c); - t1.norm(); - - z3.copy(t0); - z3.mul(t1); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - z1.add(t0); - this.b.copy(z1); - this.b.add(t1); - - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - if (y.stype == ctx.FP.SPARSE || this.stype == ctx.FP.SPARSE) { - t0.geta().copy(this.c.geta()); - t0.geta().mul(y.c.geta()); - t0.getb().zero(); - if (y.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.geta()); - t0.getb().mul(y.c.getb()); - } - if (this.stype != ctx.FP.SPARSE) { - t0.getb().copy(this.c.getb()); - t0.getb().mul(y.c.geta()); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - } else { - t0.copy(this.c); - t0.mul(y.c); - } - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } else { - if (this.stype == ctx.FP.SPARSER || this.stype == ctx.FP.SPARSEST) { - this.smul(y); - return; - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - // dense by sparser - 13m - var z0 = new ctx.FP16(this.a); - var z2 = new ctx.FP16(this.b); - var z3 = new ctx.FP16(this.b); - var t0 = new ctx.FP16(0); - var t1 = new ctx.FP16(y.a); - z0.mul(y.a); - - if (y.stype == ctx.FP.SPARSEST) z2.tmul(y.b.geta().geta().geta().geta()); - else z2.pmul(y.b.geta()); - - this.b.add(this.a); - t1.geta().add(y.b.geta()); - - t1.norm(); - this.b.norm(); - this.b.mul(t1); - z3.add(this.c); - z3.norm(); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.b.geta().geta().geta().geta()); - else z3.pmul(y.b.real()); - - t0.copy(z0); - t0.neg(); - t1.copy(z2); - t1.neg(); - - this.b.add(t0); - - this.b.add(t1); - z3.add(t1); - z2.add(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - z3.norm(); - t0.mul(y.a); - this.c.copy(z2); - this.c.add(t0); - - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - var z0 = new ctx.FP16(this.a); - var z1 = new ctx.FP16(0); - var z2 = new ctx.FP16(0); - var z3 = new ctx.FP16(0); - var t0 = new ctx.FP16(this.a); - var t1 = new ctx.FP16(0); - - z0.mul(y.a); - t0.add(this.b); - t0.norm(); - - z1.copy(t0); - z1.mul(y.a); - t0.copy(this.b); - t0.add(this.c); - t0.norm(); - - z3.copy(t0); - - if (y.stype == ctx.FP.SPARSEST) z3.tmul(y.c.getb().geta().geta().geta()); - else z3.pmul(y.c.getb()); - z3.times_i(); - - t0.copy(z0); - t0.neg(); - z1.add(t0); - this.b.copy(z1); - z2.copy(t0); - - t0.copy(this.a); - t0.add(this.c); - t0.norm(); - t1.copy(y.a); - t1.add(y.c); - t1.norm(); - - t0.mul(t1); - z2.add(t0); - t0.copy(this.c); - - if (y.stype == ctx.FP.SPARSEST) t0.tmul(y.c.getb().geta().geta().geta()); - else t0.pmul(y.c.getb()); - t0.times_i(); - t1.copy(t0); - t1.neg(); - - this.c.copy(z2); - this.c.add(t1); - z3.add(t1); - t0.times_i(); - this.b.add(t0); - z3.norm(); - z3.times_i(); - this.a.copy(z0); - this.a.add(z3); - } - } - this.stype = ctx.FP.DENSE; - this.norm(); - }, - - /* this=1/this */ - inverse: function () { - var f0 = new ctx.FP16(this.a), - f1 = new ctx.FP16(this.b), - f2 = new ctx.FP16(this.a), - f3 = new ctx.FP16(0); - - f0.sqr(); - f1.mul(this.c); - f1.times_i(); - f0.sub(f1); - f0.norm(); - - f1.copy(this.c); - f1.sqr(); - f1.times_i(); - f2.mul(this.b); - f1.sub(f2); - f1.norm(); - - f2.copy(this.b); - f2.sqr(); - f3.copy(this.a); - f3.mul(this.c); - f2.sub(f3); - f2.norm(); - - f3.copy(this.b); - f3.mul(f2); - f3.times_i(); - this.a.mul(f0); - f3.add(this.a); - this.c.mul(f1); - this.c.times_i(); - - f3.add(this.c); - f3.norm(); - f3.inverse(); - this.a.copy(f0); - this.a.mul(f3); - this.b.copy(f1); - this.b.mul(f3); - this.c.copy(f2); - this.c.mul(f3); - this.stype = ctx.FP.DENSE; - }, - - /* this=this^p, where p=Modulus, using Frobenius */ - frob: function (f, n) { - var f2 = new ctx.FP2(f), - f3 = new ctx.FP2(f), - i; - - f2.sqr(); - f3.mul(f2); - - f3.mul_ip(); - f3.norm(); - f3.mul_ip(); - f3.norm(); - - for (i = 0; i < n; i++) { - this.a.frob(f3); - this.b.frob(f3); - this.c.frob(f3); - - this.b.qmul(f); - this.b.times_i4(); - this.b.times_i2(); - this.c.qmul(f2); - this.c.times_i4(); - this.c.times_i4(); - this.c.times_i4(); - } - this.stype = ctx.FP.DENSE; - }, - - /* trace function */ - trace: function () { - var t = new ctx.FP16(0); - - t.copy(this.a); - t.imul(3); - t.reduce(); - - return t; - }, - - /* convert this to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ',' + this.c.toString() + ']'; - }, - - /* convert this to byte array */ - toBytes: function (w) { - var t = []; - this.c.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i] = t[i]; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 16 * ctx.BIG.MODBYTES] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) w[i + 32 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* set this=this^e */ - pow: function (e) { - var e1, e3, w, nb, i, bt, sf; - - sf = new FP48(this); - sf.norm(); - e1 = new ctx.BIG(e); - e1.norm(); - - e3 = new ctx.BIG(e1); - e3.pmul(3); - e3.norm(); - - w = new FP48(sf); //w.copy(this); - - if (e3.iszilch()) { - w.one(); - return w; - } - nb = e3.nbits(); - - for (i = nb - 2; i >= 1; i--) { - w.usqr(); - bt = e3.bit(i) - e1.bit(i); - - if (bt == 1) { - w.mul(sf); - } - if (bt == -1) { - sf.conj(); - w.mul(sf); - sf.conj(); - } - } - w.reduce(); - - return w; - }, - - /* constant time powering by small integer of max length bts */ - pinpow: function (e, bts) { - var R = [], - i, - b; - - R[0] = new FP48(1); - R[1] = new FP48(this); - - for (i = bts - 1; i >= 0; i--) { - b = (e >> i) & 1; - R[1 - b].mul(R[b]); - R[b].usqr(); - } - - this.copy(R[0]); - }, - - /* Faster compressed powering for unitary elements */ - /* - compow: function(e, r) { - var fa, fb, f, q, m, a, b, g1, g2, c, cp, cpm1, cpm2; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - - m = new ctx.BIG(q); - m.mod(r); - - a = new ctx.BIG(e); - a.mod(m); - - b = new ctx.BIG(e); - b.div(m); - - g1 = new FP48(0); - g2 = new FP48(0); - g1.copy(this); - - c = g1.trace(); - - if (b.iszilch()) { - c=c.xtr_pow(e); - return c; - } - - g2.copy(g1); - g2.frob(f,1); - cp = g2.trace(); - g1.conj(); - g2.mul(g1); - cpm1 = g2.trace(); - g2.mul(g1); - cpm2 = g2.trace(); - - c = c.xtr_pow2(cp, cpm1, cpm2, a, b); - return c; - } -*/ - }; - - /* convert from byte array to FP12 */ - FP48.fromBytes = function (w) { - var a, b, c; - var t = []; - for (var i = 0; i < 16 * ctx.BIG.MODBYTES; i++) t[i] = w[i]; - c = ctx.FP16.fromBytes(t); - for (var i = 0; i < 16 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 16 * ctx.BIG.MODBYTES]; - b = ctx.FP16.fromBytes(t); - for (var i = 0; i < 16 * ctx.BIG.MODBYTES; i++) t[i] = w[i + 32 * ctx.BIG.MODBYTES]; - a = ctx.FP16.fromBytes(t); - return new FP48(a, b, c); - }; - - /* return 1 if b==c, no branching */ - FP48.teq = function (b, c) { - var x = b ^ c; - x -= 1; // if x=0, x now -1 - return (x >> 31) & 1; - }; - - /* p=q0^u0.q1^u1.q2^u2.q3^u3... */ - // Bos & Costello https://eprint.iacr.org/2013/458.pdf - // Faz-Hernandez & Longa & Sanchez https://eprint.iacr.org/2013/158.pdf - // Side channel attack secure - FP48.pow16 = function (q, u) { - var g1 = [], - g2 = [], - g3 = [], - g4 = [], - r = new FP48(0), - p = new FP48(0), - t = [], - mt = new ctx.BIG(0), - w1 = [], - s1 = [], - w2 = [], - s2 = [], - w3 = [], - s3 = [], - w4 = [], - s4 = [], - i, - j, - k, - nb, - bt, - pb1, - pb2, - pb3, - pb4; - - for (i = 0; i < 16; i++) { - t[i] = new ctx.BIG(u[i]); - t[i].norm(); - } - - g1[0] = new FP48(q[0]); // q[0] - g1[1] = new FP48(g1[0]); - g1[1].mul(q[1]); // q[0].q[1] - g1[2] = new FP48(g1[0]); - g1[2].mul(q[2]); // q[0].q[2] - g1[3] = new FP48(g1[1]); - g1[3].mul(q[2]); // q[0].q[1].q[2] - g1[4] = new FP48(q[0]); - g1[4].mul(q[3]); // q[0].q[3] - g1[5] = new FP48(g1[1]); - g1[5].mul(q[3]); // q[0].q[1].q[3] - g1[6] = new FP48(g1[2]); - g1[6].mul(q[3]); // q[0].q[2].q[3] - g1[7] = new FP48(g1[3]); - g1[7].mul(q[3]); // q[0].q[1].q[2].q[3] - - g2[0] = new FP48(q[4]); // q[0] - g2[1] = new FP48(g2[0]); - g2[1].mul(q[5]); // q[0].q[1] - g2[2] = new FP48(g2[0]); - g2[2].mul(q[6]); // q[0].q[2] - g2[3] = new FP48(g2[1]); - g2[3].mul(q[6]); // q[0].q[1].q[2] - g2[4] = new FP48(q[4]); - g2[4].mul(q[7]); // q[0].q[3] - g2[5] = new FP48(g2[1]); - g2[5].mul(q[7]); // q[0].q[1].q[3] - g2[6] = new FP48(g2[2]); - g2[6].mul(q[7]); // q[0].q[2].q[3] - g2[7] = new FP48(g2[3]); - g2[7].mul(q[7]); // q[0].q[1].q[2].q[3] - - g3[0] = new FP48(q[8]); // q[0] - g3[1] = new FP48(g3[0]); - g3[1].mul(q[9]); // q[0].q[1] - g3[2] = new FP48(g3[0]); - g3[2].mul(q[10]); // q[0].q[2] - g3[3] = new FP48(g3[1]); - g3[3].mul(q[10]); // q[0].q[1].q[2] - g3[4] = new FP48(q[8]); - g3[4].mul(q[11]); // q[0].q[3] - g3[5] = new FP48(g3[1]); - g3[5].mul(q[11]); // q[0].q[1].q[3] - g3[6] = new FP48(g3[2]); - g3[6].mul(q[11]); // q[0].q[2].q[3] - g3[7] = new FP48(g3[3]); - g3[7].mul(q[11]); // q[0].q[1].q[2].q[3] - - g4[0] = new FP48(q[12]); // q[0] - g4[1] = new FP48(g4[0]); - g4[1].mul(q[13]); // q[0].q[1] - g4[2] = new FP48(g4[0]); - g4[2].mul(q[14]); // q[0].q[2] - g4[3] = new FP48(g4[1]); - g4[3].mul(q[14]); // q[0].q[1].q[2] - g4[4] = new FP48(q[12]); - g4[4].mul(q[15]); // q[0].q[3] - g4[5] = new FP48(g4[1]); - g4[5].mul(q[15]); // q[0].q[1].q[3] - g4[6] = new FP48(g4[2]); - g4[6].mul(q[15]); // q[0].q[2].q[3] - g4[7] = new FP48(g4[3]); - g4[7].mul(q[15]); // q[0].q[1].q[2].q[3] - - // Make it odd - pb1 = 1 - t[0].parity(); - t[0].inc(pb1); - t[0].norm(); - - pb2 = 1 - t[4].parity(); - t[4].inc(pb2); - t[4].norm(); - - pb3 = 1 - t[8].parity(); - t[8].inc(pb3); - t[8].norm(); - - pb4 = 1 - t[12].parity(); - t[12].inc(pb4); - t[12].norm(); - - // Number of bits - mt.zero(); - for (i = 0; i < 16; i++) { - mt.or(t[i]); - } - - nb = 1 + mt.nbits(); - - // Sign pivot - s1[nb - 1] = 1; - s2[nb - 1] = 1; - s3[nb - 1] = 1; - s4[nb - 1] = 1; - for (i = 0; i < nb - 1; i++) { - t[0].fshr(1); - s1[i] = 2 * t[0].parity() - 1; - t[4].fshr(1); - s2[i] = 2 * t[4].parity() - 1; - t[8].fshr(1); - s3[i] = 2 * t[8].parity() - 1; - t[12].fshr(1); - s4[i] = 2 * t[12].parity() - 1; - } - - // Recoded exponent - for (i = 0; i < nb; i++) { - w1[i] = 0; - k = 1; - for (j = 1; j < 4; j++) { - bt = s1[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w1[i] += bt * k; - k *= 2; - } - w2[i] = 0; - k = 1; - for (j = 5; j < 8; j++) { - bt = s2[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w2[i] += bt * k; - k *= 2; - } - w3[i] = 0; - k = 1; - for (j = 9; j < 12; j++) { - bt = s3[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w3[i] += bt * k; - k *= 2; - } - w4[i] = 0; - k = 1; - for (j = 13; j < 16; j++) { - bt = s4[i] * t[j].parity(); - t[j].fshr(1); - t[j].dec(bt >> 1); - t[j].norm(); - w4[i] += bt * k; - k *= 2; - } - } - - // Main loop - p.select(g1, 2 * w1[nb - 1] + 1); - r.select(g2, 2 * w2[nb - 1] + 1); - p.mul(r); - r.select(g3, 2 * w3[nb - 1] + 1); - p.mul(r); - r.select(g4, 2 * w4[nb - 1] + 1); - p.mul(r); - for (i = nb - 2; i >= 0; i--) { - p.usqr(); - r.select(g1, 2 * w1[i] + s1[i]); - p.mul(r); - r.select(g2, 2 * w2[i] + s2[i]); - p.mul(r); - r.select(g3, 2 * w3[i] + s3[i]); - p.mul(r); - r.select(g4, 2 * w4[i] + s4[i]); - p.mul(r); - } - - // apply correction - r.copy(q[0]); - r.conj(); - r.mul(p); - p.cmove(r, pb1); - - r.copy(q[4]); - r.conj(); - r.mul(p); - p.cmove(r, pb2); - - r.copy(q[8]); - r.conj(); - r.mul(p); - p.cmove(r, pb3); - - r.copy(q[12]); - r.conj(); - r.mul(p); - p.cmove(r, pb4); - - p.reduce(); - return p; - }; - - return FP48; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP48: FP48, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/fp8.js b/packages/bls-verify/src/vendor/amcl-js/src/fp8.js deleted file mode 100644 index 0be8b39d0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/fp8.js +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Finite Field arithmetic Fp^8 functions */ - -/* FP8 elements are of the form a+ib, where i is sqrt(sqrt(-1+sqrt(-1))) */ - -var FP8 = function (ctx) { - 'use strict'; - - /* general purpose constructor */ - var FP8 = function (c, d) { - if (c instanceof FP8) { - this.a = new ctx.FP4(c.a); - this.b = new ctx.FP4(c.b); - } else { - this.a = new ctx.FP4(c); - this.b = new ctx.FP4(d); - } - }; - - FP8.prototype = { - /* reduce all components of this mod Modulus */ - reduce: function () { - this.a.reduce(); - this.b.reduce(); - }, - - /* normalise all components of this mod Modulus */ - norm: function () { - this.a.norm(); - this.b.norm(); - }, - - /* test this==0 ? */ - iszilch: function () { - return this.a.iszilch() && this.b.iszilch(); - }, - - islarger: function () { - if (this.iszilch()) return 0; - var cmp = this.b.larger(); - if (cmp != 0) return cmp; - return this.a.larger(); - }, - - toBytes: function (bf) { - var t = []; - this.b.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) bf[i] = t[i]; - this.a.toBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) bf[i + 4 * ctx.BIG.MODBYTES] = t[i]; - }, - - /* test this==1 ? */ - isunity: function () { - var one = new ctx.FP4(1); - return this.a.equals(one) && this.b.iszilch(); - }, - - /* conditional copy of g to this depending on d */ - cmove: function (g, d) { - this.a.cmove(g.a, d); - this.b.cmove(g.b, d); - }, - - /* test is w real? That is in a+ib test b is zero */ - isreal: function () { - return this.b.iszilch(); - }, - - /* extract real part a */ - real: function () { - return this.a; - }, - - geta: function () { - return this.a; - }, - - /* extract imaginary part b */ - getb: function () { - return this.b; - }, - - /* test this=x? */ - equals: function (x) { - return this.a.equals(x.a) && this.b.equals(x.b); - }, - - /* copy this=x */ - copy: function (x) { - this.a.copy(x.a); - this.b.copy(x.b); - }, - - /* this=0 */ - zero: function () { - this.a.zero(); - this.b.zero(); - }, - - /* this=1 */ - one: function () { - this.a.one(); - this.b.zero(); - }, - - /* set from two FP4s */ - set: function (c, d) { - this.a.copy(c); - this.b.copy(d); - }, - - /* set a */ - seta: function (c) { - this.a.copy(c); - this.b.zero(); - }, - - sign: function () { - var p1 = this.a.sign(); - var p2 = this.b.sign(); - if (ctx.FP.BIG_ENDIAN_SIGN) { - var u = this.b.iszilch() ? 1 : 0; - p2 ^= (p1 ^ p2) & u; - return p2; - } else { - var u = this.a.iszilch() ? 1 : 0; - p1 ^= (p1 ^ p2) & u; - return p1; - } - }, - - /* this=-this */ - neg: function () { - this.norm(); - var m = new ctx.FP4(this.a), - t = new ctx.FP4(0); - - m.add(this.b); - m.neg(); - t.copy(m); - t.add(this.b); - this.b.copy(m); - this.b.add(this.a); - this.a.copy(t); - this.norm(); - }, - - /* this=conjugate(this) */ - conj: function () { - this.b.neg(); - this.norm(); - }, - - /* this=-conjugate(this) */ - nconj: function () { - this.a.neg(); - this.norm(); - }, - - /* this+=x */ - add: function (x) { - this.a.add(x.a); - this.b.add(x.b); - }, - - /* this-=x */ - sub: function (x) { - var m = new FP8(x); - m.neg(); - this.add(m); - }, - - rsub: function (x) { - this.neg(); - this.add(x); - }, - - /* this*=s where s is FP4 */ - pmul: function (s) { - this.a.mul(s); - this.b.mul(s); - }, - - /* this*=c where s is int */ - imul: function (c) { - this.a.imul(c); - this.b.imul(c); - }, - - /* this*=this */ - sqr: function () { - var t1 = new ctx.FP4(this.a), - t2 = new ctx.FP4(this.b), - t3 = new ctx.FP4(this.a); - - t3.mul(this.b); - t1.add(this.b); - t1.norm(); - t2.times_i(); - - t2.add(this.a); - t2.norm(); - this.a.copy(t1); - - this.a.mul(t2); - - t2.copy(t3); - t2.times_i(); - t2.add(t3); - - t2.neg(); - - this.a.add(t2); - - this.b.copy(t3); - this.b.add(t3); - - this.norm(); - }, - - /* this*=y */ - mul: function (y) { - var t1 = new ctx.FP4(this.a), - t2 = new ctx.FP4(this.b), - t3 = new ctx.FP4(0), - t4 = new ctx.FP4(this.b); - - t1.mul(y.a); - t2.mul(y.b); - t3.copy(y.b); - t3.add(y.a); - t4.add(this.a); - - t3.norm(); - t4.norm(); - - t4.mul(t3); - - t3.copy(t1); - t3.neg(); - t4.add(t3); - - t3.copy(t2); - t3.neg(); - this.b.copy(t4); - this.b.add(t3); - - t2.times_i(); - this.a.copy(t2); - this.a.add(t1); - - this.norm(); - }, - - /* convert to hex string */ - toString: function () { - return '[' + this.a.toString() + ',' + this.b.toString() + ']'; - }, - - /* this=1/this */ - inverse: function (h) { - this.norm(); - - var t1 = new ctx.FP4(this.a), - t2 = new ctx.FP4(this.b); - - t1.sqr(); - t2.sqr(); - t2.times_i(); - t2.norm(); // ?? - t1.sub(t2); - t1.inverse(h); - this.a.mul(t1); - t1.neg(); - t1.norm(); - this.b.mul(t1); - }, - - /* this*=i where i = sqrt(-1+sqrt(-1)) */ - times_i: function () { - var s = new ctx.FP4(this.b), - t = new ctx.FP4(this.a); - - s.times_i(); - this.b.copy(t); - - this.a.copy(s); - this.norm(); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - times_i2: function () { - this.a.times_i(); - this.b.times_i(); - }, - - /* this=this^q using Frobenius, where q is Modulus */ - frob: function (f) { - var ff = new ctx.FP2(f); - ff.sqr(); - ff.mul_ip(); - ff.norm(); - this.a.frob(ff); - this.b.frob(ff); - this.b.pmul(f); - this.b.times_i(); - }, - - /* this=this^e */ - /* - pow: function(e) { - var w = new FP8(this), - z = new ctx.BIG(e), - r = new FP8(1), - bt; - w.norm(); - z.norm(); - for (;;) { - bt = z.parity(); - z.fshr(1); - - if (bt === 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - - w.sqr(); - } - r.reduce(); - - return r; - }, */ - - /* XTR xtr_a function */ - /* - xtr_A: function(w, y, z) { - var r = new FP8(w), - t = new FP8(w); - - r.sub(y); - r.norm(); - r.pmul(this.a); - t.add(y); - t.norm(); - t.pmul(this.b); - t.times_i(); - - this.copy(r); - this.add(t); - this.add(z); - - this.reduce(); - }, -*/ - /* XTR xtr_d function */ - /* - xtr_D: function() { - var w = new FP8(this); //w.copy(this); - this.sqr(); - w.conj(); - w.add(w); - this.sub(w); - this.reduce(); - }, -*/ - /* r=x^n using XTR method on traces of FP24s */ - /* - xtr_pow: function(n) { - var sf = new FP8(this); - sf.norm(); - var a = new FP8(3), - b = new FP8(sf), - c = new FP8(b), - t = new FP8(0), - r = new FP8(0), - par, v, nb, i; - - c.xtr_D(); - - - par = n.parity(); - v = new ctx.BIG(n); - v.norm(); - v.fshr(1); - - if (par === 0) { - v.dec(1); - v.norm(); - } - - nb = v.nbits(); - for (i = nb - 1; i >= 0; i--) { - if (v.bit(i) != 1) { - t.copy(b); - sf.conj(); - c.conj(); - b.xtr_A(a, sf, c); - sf.conj(); - c.copy(t); - c.xtr_D(); - a.xtr_D(); - } else { - t.copy(a); - t.conj(); - a.copy(b); - a.xtr_D(); - b.xtr_A(c, sf, t); - c.xtr_D(); - } - } - - if (par === 0) { - r.copy(c); - } else { - r.copy(b); - } - r.reduce(); - - return r; - }, -*/ - /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP24s. See Stam thesis. */ - /* - xtr_pow2: function(ck, ckml, ckm2l, a, b) { - - var e = new ctx.BIG(a), - d = new ctx.BIG(b), - w = new ctx.BIG(0), - cu = new FP8(ck), - cv = new FP8(this), - cumv = new FP8(ckml), - cum2v = new FP8(ckm2l), - r = new FP8(0), - t = new FP8(0), - f2 = 0, - i; - - e.norm(); - d.norm(); - - while (d.parity() === 0 && e.parity() === 0) { - d.fshr(1); - e.fshr(1); - f2++; - } - - while (ctx.BIG.comp(d, e) !== 0) { - if (ctx.BIG.comp(d, e) > 0) { - w.copy(e); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(d, w) <= 0) { - w.copy(d); - d.copy(e); - e.rsub(w); - e.norm(); - - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cum2v.conj(); - cumv.copy(cv); - cv.copy(cu); - cu.copy(t); - - } else if (d.parity() === 0) { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } else if (e.parity() == 1) { - d.sub(e); - d.norm(); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cu.xtr_D(); - cum2v.copy(cv); - cum2v.xtr_D(); - cum2v.conj(); - cv.copy(t); - } else { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } - } - if (ctx.BIG.comp(d, e) < 0) { - w.copy(d); - w.imul(4); - w.norm(); - - if (ctx.BIG.comp(e, w) <= 0) { - e.sub(d); - e.norm(); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cum2v.copy(cumv); - cumv.copy(cu); - cu.copy(t); - } else if (e.parity() === 0) { - w.copy(d); - d.copy(e); - d.fshr(1); - e.copy(w); - t.copy(cumv); - t.xtr_D(); - cumv.copy(cum2v); - cumv.conj(); - cum2v.copy(t); - cum2v.conj(); - t.copy(cv); - t.xtr_D(); - cv.copy(cu); - cu.copy(t); - } else if (d.parity() == 1) { - w.copy(e); - e.copy(d); - w.sub(d); - w.norm(); - d.copy(w); - d.fshr(1); - t.copy(cv); - t.xtr_A(cu, cumv, cum2v); - cumv.conj(); - cum2v.copy(cu); - cum2v.xtr_D(); - cum2v.conj(); - cu.copy(cv); - cu.xtr_D(); - cv.copy(t); - } else { - d.fshr(1); - r.copy(cum2v); - r.conj(); - t.copy(cumv); - t.xtr_A(cu, cv, r); - cum2v.copy(cumv); - cum2v.xtr_D(); - cumv.copy(t); - cu.xtr_D(); - } - } - } - r.copy(cv); - r.xtr_A(cu, cumv, cum2v); - for (i = 0; i < f2; i++) { - r.xtr_D(); - } - r = r.xtr_pow(d); - return r; - }, -*/ - /* New stuff for ecp4.js */ - - div2: function () { - this.a.div2(); - this.b.div2(); - }, - - div_i: function () { - var u = new ctx.FP4(this.a), - v = new ctx.FP4(this.b); - u.div_i(); - this.a.copy(v); - this.b.copy(u); - if (ctx.FP.TOWER == ctx.FP.POSITOWER) { - this.neg(); - this.norm(); - } - }, - - qmul: function (s) { - this.a.pmul(s); - this.b.pmul(s); - }, - - tmul: function (s) { - this.a.qmul(s); - this.b.qmul(s); - }, - - /* this^e */ - /* - pow: function(e) { - var r = new FP8(1), - w = new FP8(this), - z = new ctx.BIG(e), - bt; - - for (;;) { - bt = z.parity(); - z.fshr(1); - if (bt == 1) { - r.mul(w); - } - - if (z.iszilch()) { - break; - } - w.sqr(); - } - - r.reduce(); - this.copy(r); - },*/ - - qr: function (h) { - var c = new FP8(this); - c.conj(); - c.mul(this); - return c.geta().qr(h); - }, - - sqrt: function (h) { - if (this.iszilch()) { - return; - } - var wa = new ctx.FP4(this.a), - wb = new ctx.FP4(this.a), - ws = new ctx.FP4(this.b), - wt = new ctx.FP4(this.a); - var hint = new ctx.FP(0); - - ws.sqr(); - wa.sqr(); - ws.times_i(); - ws.norm(); - wa.sub(ws); - - ws.copy(wa); - ws.norm(); - ws.sqrt(h); - - wa.copy(wt); - wa.add(ws); - wa.norm(); - wa.div2(); - - wb.copy(this.b); - wb.div2(); - var qr = wa.qr(hint); - - // tweak hint - multiply old hint by Norm(1/Beta)^e where Beta is irreducible polynomial - ws.copy(wa); - var twk = new ctx.FP(0); - twk.rcopy(ctx.ROM_FIELD.TWK); - twk.mul(hint); - ws.div_i(); - ws.norm(); - - wa.cmove(ws, 1 - qr); - hint.cmove(twk, 1 - qr); - - this.a.copy(wa); - this.a.sqrt(hint); - ws.copy(wa); - ws.inverse(hint); - ws.mul(this.a); - this.b.copy(ws); - this.b.mul(wb); - wt.copy(this.a); - - this.a.cmove(this.b, 1 - qr); - this.b.cmove(wt, 1 - qr); - - var sgn = this.sign(); - var nr = new FP8(this); - nr.neg(); - nr.norm(); - this.cmove(nr, sgn); - }, - }; - - FP8.rand = function (rng) { - return new FP8(ctx.FP4.rand(rng), ctx.FP4.rand(rng)); - }; - - FP8.fromBytes = function (bf) { - var t = []; - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = bf[i]; - var tb = ctx.FP4.fromBytes(t); - for (var i = 0; i < 4 * ctx.BIG.MODBYTES; i++) t[i] = bf[i + 4 * ctx.BIG.MODBYTES]; - var ta = ctx.FP4.fromBytes(t); - return new FP8(ta, tb); - }; - - return FP8; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - FP8: FP8, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/gcm.js b/packages/bls-verify/src/vendor/amcl-js/src/gcm.js deleted file mode 100644 index a66c0b39a..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/gcm.js +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Implementation of the ctx.AES-GCM Encryption/Authentication - * - * Some restrictions.. - * 1. Only for use with ctx.AES - * 2. Returned tag is always 128-bits. Truncate at your own risk. - * 3. The order of function calls must follow some rules - * - * Typical sequence of calls.. - * 1. call GCM_init - * 2. call GCM_add_header any number of times, as long as length of header is multiple of 16 bytes (block size) - * 3. call GCM_add_header one last time with any length of header - * 4. call GCM_add_cipher any number of times, as long as length of cipher/plaintext is multiple of 16 bytes - * 5. call GCM_add_cipher one last time with any length of cipher/plaintext - * 6. call GCM_finish to extract the tag. - * - * See http://www.mindspring.com/~dmcgrew/gcm-nist-6.pdf - */ - -var GCM = function (ctx) { - 'use strict'; - - var GCM = function () { - this.table = new Array(128); - for (var i = 0; i < 128; i++) { - this.table[i] = new Array(4); /* 2k bytes */ - } - this.stateX = []; - this.Y_0 = []; - this.counter = 0; - this.lenA = []; - this.lenC = []; - this.status = 0; - this.a = new ctx.AES(); - }; - - // GCM constants - - GCM.ACCEPTING_HEADER = 0; - GCM.ACCEPTING_CIPHER = 1; - GCM.NOT_ACCEPTING_MORE = 2; - GCM.FINISHED = 3; - GCM.ENCRYPTING = 0; - GCM.DECRYPTING = 1; - - GCM.prototype = { - precompute: function (H) { - var b = [], - i, - j, - c; - - for (i = j = 0; i < 4; i++, j += 4) { - b[0] = H[j]; - b[1] = H[j + 1]; - b[2] = H[j + 2]; - b[3] = H[j + 3]; - this.table[0][i] = GCM.pack(b); - } - for (i = 1; i < 128; i++) { - c = 0; - for (j = 0; j < 4; j++) { - this.table[i][j] = c | (this.table[i - 1][j] >>> 1); - c = this.table[i - 1][j] << 31; - } - - if (c !== 0) { - this.table[i][0] ^= 0xe1000000; /* irreducible polynomial */ - } - } - }, - - gf2mul: function () { - /* gf2m mul - Z=H*X mod 2^128 */ - var P = [], - b = [], - i, - j, - m, - k, - c; - - P[0] = P[1] = P[2] = P[3] = 0; - j = 8; - m = 0; - - for (i = 0; i < 128; i++) { - c = (this.stateX[m] >>> --j) & 1; - c = ~c + 1; - for (k = 0; k < 4; k++) { - P[k] ^= this.table[i][k] & c; - } - - if (j === 0) { - j = 8; - m++; - if (m == 16) { - break; - } - } - } - - for (i = j = 0; i < 4; i++, j += 4) { - b = GCM.unpack(P[i]); - this.stateX[j] = b[0]; - this.stateX[j + 1] = b[1]; - this.stateX[j + 2] = b[2]; - this.stateX[j + 3] = b[3]; - } - }, - - wrap: function () { - /* Finish off GHASH */ - var F = [], - L = [], - b = [], - i, - j; - - /* convert lengths from bytes to bits */ - F[0] = (this.lenA[0] << 3) | ((this.lenA[1] & 0xe0000000) >>> 29); - F[1] = this.lenA[1] << 3; - F[2] = (this.lenC[0] << 3) | ((this.lenC[1] & 0xe0000000) >>> 29); - F[3] = this.lenC[1] << 3; - - for (i = j = 0; i < 4; i++, j += 4) { - b = GCM.unpack(F[i]); - L[j] = b[0]; - L[j + 1] = b[1]; - L[j + 2] = b[2]; - L[j + 3] = b[3]; - } - - for (i = 0; i < 16; i++) { - this.stateX[i] ^= L[i]; - } - - this.gf2mul(); - }, - - /* Initialize GCM mode */ - init: function (nk, key, niv, iv) { - /* iv size niv is usually 12 bytes (96 bits). ctx.AES key size nk can be 16,24 or 32 bytes */ - var H = [], - b = [], - i; - - for (i = 0; i < 16; i++) { - H[i] = 0; - this.stateX[i] = 0; - } - - this.a.init(ctx.AES.ECB, nk, key, iv); - this.a.ecb_encrypt(H); /* E(K,0) */ - this.precompute(H); - - this.lenA[0] = this.lenC[0] = this.lenA[1] = this.lenC[1] = 0; - - if (niv == 12) { - for (i = 0; i < 12; i++) { - this.a.f[i] = iv[i]; - } - - b = GCM.unpack(1); - this.a.f[12] = b[0]; - this.a.f[13] = b[1]; - this.a.f[14] = b[2]; - this.a.f[15] = b[3]; /* initialise IV */ - - for (i = 0; i < 16; i++) { - this.Y_0[i] = this.a.f[i]; - } - } else { - this.status = GCM.ACCEPTING_CIPHER; - this.ghash(iv, niv); /* GHASH(H,0,IV) */ - this.wrap(); - - for (i = 0; i < 16; i++) { - this.a.f[i] = this.stateX[i]; - this.Y_0[i] = this.a.f[i]; - this.stateX[i] = 0; - } - - this.lenA[0] = this.lenC[0] = this.lenA[1] = this.lenC[1] = 0; - } - - this.status = GCM.ACCEPTING_HEADER; - }, - - /* Add Header data - included but not encrypted */ - add_header: function (header, len) { - /* Add some header. Won't be encrypted, but will be authenticated. len is length of header */ - var i, - j = 0; - - if (this.status != GCM.ACCEPTING_HEADER) { - return false; - } - - while (j < len) { - for (i = 0; i < 16 && j < len; i++) { - this.stateX[i] ^= header[j++]; - this.lenA[1]++; - this.lenA[1] |= 0; - - if (this.lenA[1] === 0) { - this.lenA[0]++; - } - } - - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.ACCEPTING_CIPHER; - } - - return true; - }, - - ghash: function (plain, len) { - var i, - j = 0; - - if (this.status == GCM.ACCEPTING_HEADER) { - this.status = GCM.ACCEPTING_CIPHER; - } - - if (this.status != GCM.ACCEPTING_CIPHER) { - return false; - } - - while (j < len) { - for (i = 0; i < 16 && j < len; i++) { - this.stateX[i] ^= plain[j++]; - this.lenC[1]++; - this.lenC[1] |= 0; - - if (this.lenC[1] === 0) { - this.lenC[0]++; - } - } - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.NOT_ACCEPTING_MORE; - } - - return true; - }, - - /* Add Plaintext - included and encrypted */ - add_plain: function (plain, len) { - var B = [], - b = [], - cipher = [], - i, - j = 0; - - if (this.status == GCM.ACCEPTING_HEADER) { - this.status = GCM.ACCEPTING_CIPHER; - } - - if (this.status != GCM.ACCEPTING_CIPHER) { - return cipher; - } - - while (j < len) { - b[0] = this.a.f[12]; - b[1] = this.a.f[13]; - b[2] = this.a.f[14]; - b[3] = this.a.f[15]; - this.counter = GCM.pack(b); - this.counter++; - b = GCM.unpack(this.counter); - this.a.f[12] = b[0]; - this.a.f[13] = b[1]; - this.a.f[14] = b[2]; - this.a.f[15] = b[3]; /* increment counter */ - - for (i = 0; i < 16; i++) { - B[i] = this.a.f[i]; - } - - this.a.ecb_encrypt(B); /* encrypt it */ - - for (i = 0; i < 16 && j < len; i++) { - cipher[j] = plain[j] ^ B[i]; - this.stateX[i] ^= cipher[j++]; - this.lenC[1]++; - this.lenC[1] |= 0; - - if (this.lenC[1] === 0) { - this.lenC[0]++; - } - } - - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.NOT_ACCEPTING_MORE; - } - - return cipher; - }, - - /* Add Ciphertext - decrypts to plaintext */ - add_cipher: function (cipher, len) { - var B = [], - b = [], - plain = [], - j = 0, - i, - oc; - - if (this.status == GCM.ACCEPTING_HEADER) { - this.status = GCM.ACCEPTING_CIPHER; - } - - if (this.status != GCM.ACCEPTING_CIPHER) { - return plain; - } - - while (j < len) { - b[0] = this.a.f[12]; - b[1] = this.a.f[13]; - b[2] = this.a.f[14]; - b[3] = this.a.f[15]; - this.counter = GCM.pack(b); - this.counter++; - b = GCM.unpack(this.counter); - this.a.f[12] = b[0]; - this.a.f[13] = b[1]; - this.a.f[14] = b[2]; - this.a.f[15] = b[3]; /* increment counter */ - - for (i = 0; i < 16; i++) { - B[i] = this.a.f[i]; - } - - this.a.ecb_encrypt(B); /* encrypt it */ - - for (i = 0; i < 16 && j < len; i++) { - oc = cipher[j]; - plain[j] = cipher[j] ^ B[i]; - this.stateX[i] ^= oc; - j++; - this.lenC[1]++; - this.lenC[1] |= 0; - - if (this.lenC[1] === 0) { - this.lenC[0]++; - } - } - - this.gf2mul(); - } - - if (len % 16 !== 0) { - this.status = GCM.NOT_ACCEPTING_MORE; - } - - return plain; - }, - - /* Finish and extract Tag */ - finish: function (extract) { - /* Finish off GHASH and extract tag (MAC) */ - var tag = [], - i; - - this.wrap(); - /* extract tag */ - if (extract) { - this.a.ecb_encrypt(this.Y_0); /* E(K,Y0) */ - - for (i = 0; i < 16; i++) { - this.Y_0[i] ^= this.stateX[i]; - } - - for (i = 0; i < 16; i++) { - tag[i] = this.Y_0[i]; - this.Y_0[i] = this.stateX[i] = 0; - } - } - - this.status = GCM.FINISHED; - this.a.end(); - - return tag; - }, - }; - - GCM.pack = function (b) { - /* pack 4 bytes into a 32-bit Word */ - return ((b[0] & 0xff) << 24) | ((b[1] & 0xff) << 16) | ((b[2] & 0xff) << 8) | (b[3] & 0xff); - }; - - GCM.unpack = function (a) { - /* unpack bytes from a word */ - var b = []; - - b[3] = a & 0xff; - b[2] = (a >>> 8) & 0xff; - b[1] = (a >>> 16) & 0xff; - b[0] = (a >>> 24) & 0xff; - - return b; - }; - - GCM.hex2bytes = function (s) { - var len = s.length, - data = [], - i; - - for (i = 0; i < len; i += 2) { - data[i / 2] = parseInt(s.substr(i, 2), 16); - } - - return data; - }; - - GCM.encrypt = function (C, T, K, IV, H, P) { - var g = new GCM(); - g.init(K.length, K, IV.length, IV); - g.add_header(H, H.length); - var b = g.add_plain(P, P.length); - for (var i = 0; i < b.length; i++) C[i] = b[i]; - b = g.finish(true); - for (var i = 0; i < b.length; i++) T[i] = b[i]; - }; - - GCM.decrypt = function (P, T, K, IV, H, C) { - var g = new GCM(); - g.init(K.length, K, IV.length, IV); - g.add_header(H, H.length); - var b = g.add_cipher(C, C.length); - for (var i = 0; i < b.length; i++) P[i] = b[i]; - b = g.finish(true); - for (var i = 0; i < b.length; i++) T[i] = b[i]; - }; - - return GCM; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - GCM: GCM, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hash256.js b/packages/bls-verify/src/vendor/amcl-js/src/hash256.js deleted file mode 100644 index 7a629e5d1..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hash256.js +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HASH256 = function () { - 'use strict'; - - var HASH256 = function () { - this.length = []; - this.h = []; - this.w = []; - this.init(); - }; - - HASH256.prototype = { - transform: function () { - /* basic transformation step */ - var a, b, c, d, e, f, g, hh, t1, t2, j; - - for (j = 16; j < 64; j++) { - this.w[j] = - (HASH256.theta1(this.w[j - 2]) + - this.w[j - 7] + - HASH256.theta0(this.w[j - 15]) + - this.w[j - 16]) | - 0; - } - - a = this.h[0]; - b = this.h[1]; - c = this.h[2]; - d = this.h[3]; - e = this.h[4]; - f = this.h[5]; - g = this.h[6]; - hh = this.h[7]; - - for (j = 0; j < 64; j++) { - /* 64 times - mush it up */ - t1 = (hh + HASH256.Sig1(e) + HASH256.Ch(e, f, g) + HASH256.HK[j] + this.w[j]) | 0; - t2 = (HASH256.Sig0(a) + HASH256.Maj(a, b, c)) | 0; - hh = g; - g = f; - f = e; - e = (d + t1) | 0; // Need to knock these back down to prevent 52-bit overflow - d = c; - c = b; - b = a; - a = (t1 + t2) | 0; - } - this.h[0] += a; - this.h[1] += b; - this.h[2] += c; - this.h[3] += d; - this.h[4] += e; - this.h[5] += f; - this.h[6] += g; - this.h[7] += hh; - }, - - /* Initialise Hash function */ - init: function () { - /* initialise */ - var i; - - for (i = 0; i < 64; i++) { - this.w[i] = 0; - } - this.length[0] = this.length[1] = 0; - this.h[0] = HASH256.H[0]; - this.h[1] = HASH256.H[1]; - this.h[2] = HASH256.H[2]; - this.h[3] = HASH256.H[3]; - this.h[4] = HASH256.H[4]; - this.h[5] = HASH256.H[5]; - this.h[6] = HASH256.H[6]; - this.h[7] = HASH256.H[7]; - }, - - copy: function (b) { - for (var i = 0; i < 64; i++) { - this.w[i] = b.w[i]; - } - this.length[0] = b.length[0]; - this.length[1] = b.length[1]; - for (var i = 0; i < 8; i++) { - this.h[i] = b.h[i]; - } - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var cnt; - - cnt = (this.length[0] >>> 5) % 16; - this.w[cnt] <<= 8; - this.w[cnt] |= byt & 0xff; - this.length[0] += 8; - - if ((this.length[0] & 0xffffffff) === 0) { - this.length[1]++; - this.length[0] = 0; - } - - if (this.length[0] % 512 === 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - hash: function () { - /* pad message and finish - supply digest */ - var digest = [], - len0, - len1, - i; - - len0 = this.length[0]; - len1 = this.length[1]; - this.process(0x80); - - while (this.length[0] % 512 != 448) { - this.process(0); - } - - this.w[14] = len1; - this.w[15] = len0; - this.transform(); - - for (i = 0; i < HASH256.len; i++) { - /* convert to bytes */ - digest[i] = (this.h[i >>> 2] >> (8 * (3 - (i % 4)))) & 0xff; - } - this.init(); - - return digest; - }, - - continuing_hash() { - var sh = new HASH256(); - sh.copy(this); - return sh.hash(); - }, - }; - - /* static functions */ - - HASH256.S = function (n, x) { - return (x >>> n) | (x << (32 - n)); - }; - - HASH256.R = function (n, x) { - return x >>> n; - }; - - HASH256.Ch = function (x, y, z) { - return (x & y) ^ (~x & z); - }; - - HASH256.Maj = function (x, y, z) { - return (x & y) ^ (x & z) ^ (y & z); - }; - - HASH256.Sig0 = function (x) { - return HASH256.S(2, x) ^ HASH256.S(13, x) ^ HASH256.S(22, x); - }; - - HASH256.Sig1 = function (x) { - return HASH256.S(6, x) ^ HASH256.S(11, x) ^ HASH256.S(25, x); - }; - - HASH256.theta0 = function (x) { - return HASH256.S(7, x) ^ HASH256.S(18, x) ^ HASH256.R(3, x); - }; - - HASH256.theta1 = function (x) { - return HASH256.S(17, x) ^ HASH256.S(19, x) ^ HASH256.R(10, x); - }; - - /* constants */ - HASH256.len = 32; - - HASH256.H = [ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, - ]; - - HASH256.HK = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, - ]; - - return HASH256; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HASH256: HASH256, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hash384.js b/packages/bls-verify/src/vendor/amcl-js/src/hash384.js deleted file mode 100644 index d27028ae3..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hash384.js +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HASH384 = function (ctx) { - 'use strict'; - - var HASH384 = function () { - this.length = []; - this.h = []; - this.w = []; - this.init(); - }; - - HASH384.prototype = { - transform: function () { - /* basic transformation step */ - var a, b, c, d, e, f, g, hh, t1, t2, j; - - for (j = 16; j < 80; j++) { - this.w[j] = HASH384.theta1(this.w[j - 2]) - .add(this.w[j - 7]) - .add(HASH384.theta0(this.w[j - 15])) - .add(this.w[j - 16]); - } - - a = this.h[0].copy(); - b = this.h[1].copy(); - c = this.h[2].copy(); - d = this.h[3].copy(); - e = this.h[4].copy(); - f = this.h[5].copy(); - g = this.h[6].copy(); - hh = this.h[7].copy(); - - for (j = 0; j < 80; j++) { - /* 80 times - mush it up */ - t1 = hh.copy(); - t1.add(HASH384.Sig1(e)).add(HASH384.Ch(e, f, g)).add(HASH384.HK[j]).add(this.w[j]); - - t2 = HASH384.Sig0(a); - t2.add(HASH384.Maj(a, b, c)); - hh = g; - g = f; - f = e; - e = d.copy(); - e.add(t1); - - d = c; - c = b; - b = a; - a = t1.copy(); - a.add(t2); - } - - this.h[0].add(a); - this.h[1].add(b); - this.h[2].add(c); - this.h[3].add(d); - this.h[4].add(e); - this.h[5].add(f); - this.h[6].add(g); - this.h[7].add(hh); - }, - - copy: function (b) { - for (var i = 0; i < 80; i++) { - this.w[i] = b.w[i].copy(); - } - this.length[0] = b.length[0].copy(); - this.length[1] = b.length[1].copy(); - for (var i = 0; i < 8; i++) { - this.h[i] = b.h[i].copy(); - } - }, - - /* Initialise Hash function */ - init: function () { - /* initialise */ - var i; - - for (i = 0; i < 80; i++) { - this.w[i] = new ctx.UInt64(0, 0); - } - this.length[0] = new ctx.UInt64(0, 0); - this.length[1] = new ctx.UInt64(0, 0); - this.h[0] = HASH384.H[0].copy(); - this.h[1] = HASH384.H[1].copy(); - this.h[2] = HASH384.H[2].copy(); - this.h[3] = HASH384.H[3].copy(); - this.h[4] = HASH384.H[4].copy(); - this.h[5] = HASH384.H[5].copy(); - this.h[6] = HASH384.H[6].copy(); - this.h[7] = HASH384.H[7].copy(); - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var cnt, e; - - cnt = (this.length[0].bot >>> 6) % 16; - this.w[cnt].shlb(); - this.w[cnt].bot |= byt & 0xff; - - e = new ctx.UInt64(0, 8); - this.length[0].add(e); - - if (this.length[0].top === 0 && this.length[0].bot == 0) { - e = new ctx.UInt64(0, 1); - this.length[1].add(e); - } - - if (this.length[0].bot % 1024 === 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - hash: function () { - /* pad message and finish - supply digest */ - var digest = [], - len0, - len1, - i; - - len0 = this.length[0].copy(); - len1 = this.length[1].copy(); - this.process(0x80); - while (this.length[0].bot % 1024 != 896) { - this.process(0); - } - - this.w[14] = len1; - this.w[15] = len0; - this.transform(); - - for (i = 0; i < HASH384.len; i++) { - /* convert to bytes */ - digest[i] = HASH384.R(8 * (7 - (i % 8)), this.h[i >>> 3]).bot & 0xff; - } - - this.init(); - - return digest; - }, - - continuing_hash() { - var sh = new HASH384(); - sh.copy(this); - return sh.hash(); - }, - }; - - /* static functions */ - HASH384.S = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64( - (x.top >>> n) | (x.bot << (32 - n)), - (x.bot >>> n) | (x.top << (32 - n)), - ); - } else { - return new ctx.UInt64( - (x.bot >>> (n - 32)) | (x.top << (64 - n)), - (x.top >>> (n - 32)) | (x.bot << (64 - n)), - ); - } - }; - - HASH384.R = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64(x.top >>> n, (x.bot >>> n) | (x.top << (32 - n))); - } else { - return new ctx.UInt64(0, x.top >>> (n - 32)); - } - }; - - HASH384.Ch = function (x, y, z) { - return new ctx.UInt64((x.top & y.top) ^ (~x.top & z.top), (x.bot & y.bot) ^ (~x.bot & z.bot)); - }; - - HASH384.Maj = function (x, y, z) { - return new ctx.UInt64( - (x.top & y.top) ^ (x.top & z.top) ^ (y.top & z.top), - (x.bot & y.bot) ^ (x.bot & z.bot) ^ (y.bot & z.bot), - ); - }; - - HASH384.Sig0 = function (x) { - var r1 = HASH384.S(28, x), - r2 = HASH384.S(34, x), - r3 = HASH384.S(39, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.Sig1 = function (x) { - var r1 = HASH384.S(14, x), - r2 = HASH384.S(18, x), - r3 = HASH384.S(41, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.theta0 = function (x) { - var r1 = HASH384.S(1, x), - r2 = HASH384.S(8, x), - r3 = HASH384.R(7, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.theta1 = function (x) { - var r1 = HASH384.S(19, x), - r2 = HASH384.S(61, x), - r3 = HASH384.R(6, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH384.len = 48; - - HASH384.H = [ - new ctx.UInt64(0xcbbb9d5d, 0xc1059ed8), - new ctx.UInt64(0x629a292a, 0x367cd507), - new ctx.UInt64(0x9159015a, 0x3070dd17), - new ctx.UInt64(0x152fecd8, 0xf70e5939), - new ctx.UInt64(0x67332667, 0xffc00b31), - new ctx.UInt64(0x8eb44a87, 0x68581511), - new ctx.UInt64(0xdb0c2e0d, 0x64f98fa7), - new ctx.UInt64(0x47b5481d, 0xbefa4fa4), - ]; - - HASH384.HK = [ - new ctx.UInt64(0x428a2f98, 0xd728ae22), - new ctx.UInt64(0x71374491, 0x23ef65cd), - new ctx.UInt64(0xb5c0fbcf, 0xec4d3b2f), - new ctx.UInt64(0xe9b5dba5, 0x8189dbbc), - new ctx.UInt64(0x3956c25b, 0xf348b538), - new ctx.UInt64(0x59f111f1, 0xb605d019), - new ctx.UInt64(0x923f82a4, 0xaf194f9b), - new ctx.UInt64(0xab1c5ed5, 0xda6d8118), - new ctx.UInt64(0xd807aa98, 0xa3030242), - new ctx.UInt64(0x12835b01, 0x45706fbe), - new ctx.UInt64(0x243185be, 0x4ee4b28c), - new ctx.UInt64(0x550c7dc3, 0xd5ffb4e2), - new ctx.UInt64(0x72be5d74, 0xf27b896f), - new ctx.UInt64(0x80deb1fe, 0x3b1696b1), - new ctx.UInt64(0x9bdc06a7, 0x25c71235), - new ctx.UInt64(0xc19bf174, 0xcf692694), - new ctx.UInt64(0xe49b69c1, 0x9ef14ad2), - new ctx.UInt64(0xefbe4786, 0x384f25e3), - new ctx.UInt64(0x0fc19dc6, 0x8b8cd5b5), - new ctx.UInt64(0x240ca1cc, 0x77ac9c65), - new ctx.UInt64(0x2de92c6f, 0x592b0275), - new ctx.UInt64(0x4a7484aa, 0x6ea6e483), - new ctx.UInt64(0x5cb0a9dc, 0xbd41fbd4), - new ctx.UInt64(0x76f988da, 0x831153b5), - new ctx.UInt64(0x983e5152, 0xee66dfab), - new ctx.UInt64(0xa831c66d, 0x2db43210), - new ctx.UInt64(0xb00327c8, 0x98fb213f), - new ctx.UInt64(0xbf597fc7, 0xbeef0ee4), - new ctx.UInt64(0xc6e00bf3, 0x3da88fc2), - new ctx.UInt64(0xd5a79147, 0x930aa725), - new ctx.UInt64(0x06ca6351, 0xe003826f), - new ctx.UInt64(0x14292967, 0x0a0e6e70), - new ctx.UInt64(0x27b70a85, 0x46d22ffc), - new ctx.UInt64(0x2e1b2138, 0x5c26c926), - new ctx.UInt64(0x4d2c6dfc, 0x5ac42aed), - new ctx.UInt64(0x53380d13, 0x9d95b3df), - new ctx.UInt64(0x650a7354, 0x8baf63de), - new ctx.UInt64(0x766a0abb, 0x3c77b2a8), - new ctx.UInt64(0x81c2c92e, 0x47edaee6), - new ctx.UInt64(0x92722c85, 0x1482353b), - new ctx.UInt64(0xa2bfe8a1, 0x4cf10364), - new ctx.UInt64(0xa81a664b, 0xbc423001), - new ctx.UInt64(0xc24b8b70, 0xd0f89791), - new ctx.UInt64(0xc76c51a3, 0x0654be30), - new ctx.UInt64(0xd192e819, 0xd6ef5218), - new ctx.UInt64(0xd6990624, 0x5565a910), - new ctx.UInt64(0xf40e3585, 0x5771202a), - new ctx.UInt64(0x106aa070, 0x32bbd1b8), - new ctx.UInt64(0x19a4c116, 0xb8d2d0c8), - new ctx.UInt64(0x1e376c08, 0x5141ab53), - new ctx.UInt64(0x2748774c, 0xdf8eeb99), - new ctx.UInt64(0x34b0bcb5, 0xe19b48a8), - new ctx.UInt64(0x391c0cb3, 0xc5c95a63), - new ctx.UInt64(0x4ed8aa4a, 0xe3418acb), - new ctx.UInt64(0x5b9cca4f, 0x7763e373), - new ctx.UInt64(0x682e6ff3, 0xd6b2b8a3), - new ctx.UInt64(0x748f82ee, 0x5defb2fc), - new ctx.UInt64(0x78a5636f, 0x43172f60), - new ctx.UInt64(0x84c87814, 0xa1f0ab72), - new ctx.UInt64(0x8cc70208, 0x1a6439ec), - new ctx.UInt64(0x90befffa, 0x23631e28), - new ctx.UInt64(0xa4506ceb, 0xde82bde9), - new ctx.UInt64(0xbef9a3f7, 0xb2c67915), - new ctx.UInt64(0xc67178f2, 0xe372532b), - new ctx.UInt64(0xca273ece, 0xea26619c), - new ctx.UInt64(0xd186b8c7, 0x21c0c207), - new ctx.UInt64(0xeada7dd6, 0xcde0eb1e), - new ctx.UInt64(0xf57d4f7f, 0xee6ed178), - new ctx.UInt64(0x06f067aa, 0x72176fba), - new ctx.UInt64(0x0a637dc5, 0xa2c898a6), - new ctx.UInt64(0x113f9804, 0xbef90dae), - new ctx.UInt64(0x1b710b35, 0x131c471b), - new ctx.UInt64(0x28db77f5, 0x23047d84), - new ctx.UInt64(0x32caab7b, 0x40c72493), - new ctx.UInt64(0x3c9ebe0a, 0x15c9bebc), - new ctx.UInt64(0x431d67c4, 0x9c100d4c), - new ctx.UInt64(0x4cc5d4be, 0xcb3e42b6), - new ctx.UInt64(0x597f299c, 0xfc657e2a), - new ctx.UInt64(0x5fcb6fab, 0x3ad6faec), - new ctx.UInt64(0x6c44198c, 0x4a475817), - ]; - - return HASH384; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HASH384: HASH384, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hash512.js b/packages/bls-verify/src/vendor/amcl-js/src/hash512.js deleted file mode 100644 index 6a2797177..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hash512.js +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HASH512 = function (ctx) { - 'use strict'; - - var HASH512 = function () { - this.length = []; - this.h = []; - this.w = []; - this.init(); - }; - - HASH512.prototype = { - transform: function () { - /* basic transformation step */ - var a, b, c, d, e, f, g, hh, t1, t2, j; - - for (j = 16; j < 80; j++) { - this.w[j] = HASH512.theta1(this.w[j - 2]) - .add(this.w[j - 7]) - .add(HASH512.theta0(this.w[j - 15])) - .add(this.w[j - 16]); - } - - a = this.h[0].copy(); - b = this.h[1].copy(); - c = this.h[2].copy(); - d = this.h[3].copy(); - e = this.h[4].copy(); - f = this.h[5].copy(); - g = this.h[6].copy(); - hh = this.h[7].copy(); - - for (j = 0; j < 80; j++) { - /* 80 times - mush it up */ - t1 = hh.copy(); - t1.add(HASH512.Sig1(e)).add(HASH512.Ch(e, f, g)).add(HASH512.HK[j]).add(this.w[j]); - - t2 = HASH512.Sig0(a); - t2.add(HASH512.Maj(a, b, c)); - hh = g; - g = f; - f = e; - e = d.copy(); - e.add(t1); - - d = c; - c = b; - b = a; - a = t1.copy(); - a.add(t2); - } - - this.h[0].add(a); - this.h[1].add(b); - this.h[2].add(c); - this.h[3].add(d); - this.h[4].add(e); - this.h[5].add(f); - this.h[6].add(g); - this.h[7].add(hh); - }, - - copy: function (b) { - for (var i = 0; i < 80; i++) { - this.w[i] = b.w[i].copy(); - } - this.length[0] = b.length[0].copy(); - this.length[1] = b.length[1].copy(); - for (var i = 0; i < 8; i++) { - this.h[i] = b.h[i].copy(); - } - }, - - /* Initialise Hash function */ - init: function () { - /* initialise */ - var i; - - for (i = 0; i < 80; i++) { - this.w[i] = new ctx.UInt64(0, 0); - } - - this.length[0] = new ctx.UInt64(0, 0); - this.length[1] = new ctx.UInt64(0, 0); - this.h[0] = HASH512.H[0].copy(); - this.h[1] = HASH512.H[1].copy(); - this.h[2] = HASH512.H[2].copy(); - this.h[3] = HASH512.H[3].copy(); - this.h[4] = HASH512.H[4].copy(); - this.h[5] = HASH512.H[5].copy(); - this.h[6] = HASH512.H[6].copy(); - this.h[7] = HASH512.H[7].copy(); - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var cnt, e; - - cnt = (this.length[0].bot >>> 6) % 16; - this.w[cnt].shlb(); - this.w[cnt].bot |= byt & 0xff; - - e = new ctx.UInt64(0, 8); - this.length[0].add(e); - - if (this.length[0].top === 0 && this.length[0].bot == 0) { - e = new ctx.UInt64(0, 1); - this.length[1].add(e); - } - - if (this.length[0].bot % 1024 === 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - hash: function () { - /* pad message and finish - supply digest */ - var digest = [], - len0, - len1, - i; - - len0 = this.length[0].copy(); - len1 = this.length[1].copy(); - this.process(0x80); - - while (this.length[0].bot % 1024 != 896) { - this.process(0); - } - - this.w[14] = len1; - this.w[15] = len0; - this.transform(); - - for (i = 0; i < HASH512.len; i++) { - /* convert to bytes */ - digest[i] = HASH512.R(8 * (7 - (i % 8)), this.h[i >>> 3]).bot & 0xff; - } - - this.init(); - - return digest; - }, - - continuing_hash() { - var sh = new HASH256(); - sh.copy(this); - return sh.hash(); - }, - }; - - /* static functions */ - HASH512.S = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64( - (x.top >>> n) | (x.bot << (32 - n)), - (x.bot >>> n) | (x.top << (32 - n)), - ); - } else { - return new ctx.UInt64( - (x.bot >>> (n - 32)) | (x.top << (64 - n)), - (x.top >>> (n - 32)) | (x.bot << (64 - n)), - ); - } - }; - - HASH512.R = function (n, x) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64(x.top >>> n, (x.bot >>> n) | (x.top << (32 - n))); - } else { - return new ctx.UInt64(0, x.top >>> (n - 32)); - } - }; - - HASH512.Ch = function (x, y, z) { - return new ctx.UInt64((x.top & y.top) ^ (~x.top & z.top), (x.bot & y.bot) ^ (~x.bot & z.bot)); - }; - - HASH512.Maj = function (x, y, z) { - return new ctx.UInt64( - (x.top & y.top) ^ (x.top & z.top) ^ (y.top & z.top), - (x.bot & y.bot) ^ (x.bot & z.bot) ^ (y.bot & z.bot), - ); - }; - - HASH512.Sig0 = function (x) { - var r1 = HASH512.S(28, x), - r2 = HASH512.S(34, x), - r3 = HASH512.S(39, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH512.Sig1 = function (x) { - var r1 = HASH512.S(14, x), - r2 = HASH512.S(18, x), - r3 = HASH512.S(41, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH512.theta0 = function (x) { - var r1 = HASH512.S(1, x), - r2 = HASH512.S(8, x), - r3 = HASH512.R(7, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - HASH512.theta1 = function (x) { - var r1 = HASH512.S(19, x), - r2 = HASH512.S(61, x), - r3 = HASH512.R(6, x); - - return new ctx.UInt64(r1.top ^ r2.top ^ r3.top, r1.bot ^ r2.bot ^ r3.bot); - }; - - /* constants */ - HASH512.len = 64; - - HASH512.H = [ - new ctx.UInt64(0x6a09e667, 0xf3bcc908), - new ctx.UInt64(0xbb67ae85, 0x84caa73b), - new ctx.UInt64(0x3c6ef372, 0xfe94f82b), - new ctx.UInt64(0xa54ff53a, 0x5f1d36f1), - new ctx.UInt64(0x510e527f, 0xade682d1), - new ctx.UInt64(0x9b05688c, 0x2b3e6c1f), - new ctx.UInt64(0x1f83d9ab, 0xfb41bd6b), - new ctx.UInt64(0x5be0cd19, 0x137e2179), - ]; - - HASH512.HK = [ - new ctx.UInt64(0x428a2f98, 0xd728ae22), - new ctx.UInt64(0x71374491, 0x23ef65cd), - new ctx.UInt64(0xb5c0fbcf, 0xec4d3b2f), - new ctx.UInt64(0xe9b5dba5, 0x8189dbbc), - new ctx.UInt64(0x3956c25b, 0xf348b538), - new ctx.UInt64(0x59f111f1, 0xb605d019), - new ctx.UInt64(0x923f82a4, 0xaf194f9b), - new ctx.UInt64(0xab1c5ed5, 0xda6d8118), - new ctx.UInt64(0xd807aa98, 0xa3030242), - new ctx.UInt64(0x12835b01, 0x45706fbe), - new ctx.UInt64(0x243185be, 0x4ee4b28c), - new ctx.UInt64(0x550c7dc3, 0xd5ffb4e2), - new ctx.UInt64(0x72be5d74, 0xf27b896f), - new ctx.UInt64(0x80deb1fe, 0x3b1696b1), - new ctx.UInt64(0x9bdc06a7, 0x25c71235), - new ctx.UInt64(0xc19bf174, 0xcf692694), - new ctx.UInt64(0xe49b69c1, 0x9ef14ad2), - new ctx.UInt64(0xefbe4786, 0x384f25e3), - new ctx.UInt64(0x0fc19dc6, 0x8b8cd5b5), - new ctx.UInt64(0x240ca1cc, 0x77ac9c65), - new ctx.UInt64(0x2de92c6f, 0x592b0275), - new ctx.UInt64(0x4a7484aa, 0x6ea6e483), - new ctx.UInt64(0x5cb0a9dc, 0xbd41fbd4), - new ctx.UInt64(0x76f988da, 0x831153b5), - new ctx.UInt64(0x983e5152, 0xee66dfab), - new ctx.UInt64(0xa831c66d, 0x2db43210), - new ctx.UInt64(0xb00327c8, 0x98fb213f), - new ctx.UInt64(0xbf597fc7, 0xbeef0ee4), - new ctx.UInt64(0xc6e00bf3, 0x3da88fc2), - new ctx.UInt64(0xd5a79147, 0x930aa725), - new ctx.UInt64(0x06ca6351, 0xe003826f), - new ctx.UInt64(0x14292967, 0x0a0e6e70), - new ctx.UInt64(0x27b70a85, 0x46d22ffc), - new ctx.UInt64(0x2e1b2138, 0x5c26c926), - new ctx.UInt64(0x4d2c6dfc, 0x5ac42aed), - new ctx.UInt64(0x53380d13, 0x9d95b3df), - new ctx.UInt64(0x650a7354, 0x8baf63de), - new ctx.UInt64(0x766a0abb, 0x3c77b2a8), - new ctx.UInt64(0x81c2c92e, 0x47edaee6), - new ctx.UInt64(0x92722c85, 0x1482353b), - new ctx.UInt64(0xa2bfe8a1, 0x4cf10364), - new ctx.UInt64(0xa81a664b, 0xbc423001), - new ctx.UInt64(0xc24b8b70, 0xd0f89791), - new ctx.UInt64(0xc76c51a3, 0x0654be30), - new ctx.UInt64(0xd192e819, 0xd6ef5218), - new ctx.UInt64(0xd6990624, 0x5565a910), - new ctx.UInt64(0xf40e3585, 0x5771202a), - new ctx.UInt64(0x106aa070, 0x32bbd1b8), - new ctx.UInt64(0x19a4c116, 0xb8d2d0c8), - new ctx.UInt64(0x1e376c08, 0x5141ab53), - new ctx.UInt64(0x2748774c, 0xdf8eeb99), - new ctx.UInt64(0x34b0bcb5, 0xe19b48a8), - new ctx.UInt64(0x391c0cb3, 0xc5c95a63), - new ctx.UInt64(0x4ed8aa4a, 0xe3418acb), - new ctx.UInt64(0x5b9cca4f, 0x7763e373), - new ctx.UInt64(0x682e6ff3, 0xd6b2b8a3), - new ctx.UInt64(0x748f82ee, 0x5defb2fc), - new ctx.UInt64(0x78a5636f, 0x43172f60), - new ctx.UInt64(0x84c87814, 0xa1f0ab72), - new ctx.UInt64(0x8cc70208, 0x1a6439ec), - new ctx.UInt64(0x90befffa, 0x23631e28), - new ctx.UInt64(0xa4506ceb, 0xde82bde9), - new ctx.UInt64(0xbef9a3f7, 0xb2c67915), - new ctx.UInt64(0xc67178f2, 0xe372532b), - new ctx.UInt64(0xca273ece, 0xea26619c), - new ctx.UInt64(0xd186b8c7, 0x21c0c207), - new ctx.UInt64(0xeada7dd6, 0xcde0eb1e), - new ctx.UInt64(0xf57d4f7f, 0xee6ed178), - new ctx.UInt64(0x06f067aa, 0x72176fba), - new ctx.UInt64(0x0a637dc5, 0xa2c898a6), - new ctx.UInt64(0x113f9804, 0xbef90dae), - new ctx.UInt64(0x1b710b35, 0x131c471b), - new ctx.UInt64(0x28db77f5, 0x23047d84), - new ctx.UInt64(0x32caab7b, 0x40c72493), - new ctx.UInt64(0x3c9ebe0a, 0x15c9bebc), - new ctx.UInt64(0x431d67c4, 0x9c100d4c), - new ctx.UInt64(0x4cc5d4be, 0xcb3e42b6), - new ctx.UInt64(0x597f299c, 0xfc657e2a), - new ctx.UInt64(0x5fcb6fab, 0x3ad6faec), - new ctx.UInt64(0x6c44198c, 0x4a475817), - ]; - - return HASH512; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HASH512: HASH512, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hmac.js b/packages/bls-verify/src/vendor/amcl-js/src/hmac.js deleted file mode 100644 index b4b85ae3d..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hmac.js +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var HMAC = function (ctx) { - 'use strict'; - - var HMAC = { - MC_SHA2: 2, - MC_SHA3: 3, - - /* Convert Integer to n-byte array */ - inttobytes: function (n, len) { - var b = [], - i; - - for (i = 0; i < len; i++) { - b[i] = 0; - } - - i = len; - while (n > 0 && i > 0) { - i--; - b[i] = n & 0xff; - n = Math.floor(n / 256); - } - - return b; - }, - - GPhashit: function (hash, sha, pad, zpad, A, n, B) { - var R = [], - H, - W, - i, - len; - - if (hash == this.MC_SHA2) { - if (sha == 32) { - H = new ctx.HASH256(); - } else if (sha == 48) { - H = new ctx.HASH384(); - } else if (sha == 64) { - H = new ctx.HASH512(); - } - } - if (hash == this.MC_SHA3) { - H = new ctx.SHA3(sha); - } - - for (i = 0; i < zpad; i++) H.process(0); - - if (A != null) { - H.process_array(A); - } - - if (n >= 0) { - H.process_num(n); - } - if (B != null) { - H.process_array(B); - } - R = H.hash(); - - if (R.length == 0) { - return null; - } - - if (pad == 0) { - return R; - } - - W = []; - - len = pad; - - if (sha >= len) { - for (i = 0; i < len; i++) { - W[i] = R[i]; - } - } else { - for (i = 0; i < sha; i++) { - W[i + len - sha] = R[i]; - } - - for (i = 0; i < len - sha; i++) { - W[i] = 0; - } - } - - return W; - }, - - SPhashit: function (hash, sha, A) { - return this.GPhashit(hash, sha, 0, 0, A, -1, null); - }, - - KDF2: function (hash, sha, Z, P, olen) { - /* NOTE: the parameter olen is the length of the output k in bytes */ - var hlen = sha, - K = [], - B = [], - k = 0, - counter, - cthreshold, - i; - - for (i = 0; i < K.length; i++) { - K[i] = 0; // redundant? - } - - cthreshold = Math.floor(olen / hlen); - if (olen % hlen !== 0) { - cthreshold++; - } - - for (counter = 1; counter <= cthreshold; counter++) { - B = this.GPhashit(hash, sha, 0, 0, Z, counter, P); - - if (k + hlen > olen) { - for (i = 0; i < olen % hlen; i++) { - K[k++] = B[i]; - } - } else { - for (i = 0; i < hlen; i++) { - K[k++] = B[i]; - } - } - } - - return K; - }, - - /* Password based Key Derivation Function */ - /* Input password p, salt s, and repeat count */ - /* Output key of length olen */ - - PBKDF2: function (hash, sha, Pass, Salt, rep, olen) { - var F = new Array(sha), - U = [], - S = [], - K = [], - opt = 0, - i, - j, - k, - d, - N, - key; - - d = Math.floor(olen / sha); - - if (olen % sha !== 0) { - d++; - } - - opt = 0; - - for (i = 1; i <= d; i++) { - for (j = 0; j < Salt.length; j++) { - S[j] = Salt[j]; - } - - N = this.inttobytes(i, 4); - - for (j = 0; j < 4; j++) { - S[Salt.length + j] = N[j]; - } - - this.HMAC1(hash, sha, F, sha, Pass, S); - - for (j = 0; j < sha; j++) { - U[j] = F[j]; - } - - for (j = 2; j <= rep; j++) { - this.HMAC1(hash, sha, U, sha, Pass, U); - for (k = 0; k < sha; k++) { - F[k] ^= U[k]; - } - } - - for (j = 0; j < sha; j++) { - K[opt++] = F[j]; - } - } - - key = []; - for (i = 0; i < olen; i++) { - key[i] = K[i]; - } - - return key; - }, - - blksize: function (hash, sha) { - var b = 0; - if (hash == this.MC_SHA2) { - b = 64; - if (sha > 32) b = 128; - } - if (hash == this.MC_SHA3) { - b = 200 - 2 * sha; - } - return b; - }, - - HMAC1: function (hash, sha, tag, olen, K, M) { - /* Input is from an octet m * - * olen is requested output length in bytes. k is the key * - * The output is the calculated tag */ - var B = [], - b = 0, - K0, - i; - - b = this.blksize(hash, sha); - if (b == 0) return 0; - - K0 = new Array(b); - - for (i = 0; i < b; i++) { - K0[i] = 0; - } - - if (K.length > b) { - B = this.SPhashit(hash, sha, K); - for (i = 0; i < sha; i++) { - K0[i] = B[i]; - } - } else { - for (i = 0; i < K.length; i++) { - K0[i] = K[i]; - } - } - - for (i = 0; i < b; i++) { - K0[i] ^= 0x36; - } - - B = this.GPhashit(hash, sha, 0, 0, K0, -1, M); - - for (i = 0; i < b; i++) { - K0[i] ^= 0x6a; - } - - B = this.GPhashit(hash, sha, olen, 0, K0, -1, B); - - for (i = 0; i < olen; i++) { - tag[i] = B[i]; - } - - return 1; - }, - - HKDF_Extract: function (hash, hlen, SALT, IKM) { - var PRK = []; - if (SALT == null) { - var H = []; - for (var i = 0; i < hlen; i++) H[i] = 0; - this.HMAC1(hash, hlen, PRK, hlen, H, IKM); - } else { - this.HMAC1(hash, hlen, PRK, hlen, SALT, IKM); - } - return PRK; - }, - - HKDF_Expand: function (hash, hlen, olen, PRK, INFO) { - var i, - j, - k, - m, - n = Math.floor(olen / hlen); - var flen = olen % hlen; - - var OKM = []; - var T = []; - var K = []; - - k = m = 0; - for (i = 1; i <= n; i++) { - for (j = 0; j < INFO.length; j++) T[k++] = INFO[j]; - T[k++] = i; - this.HMAC1(hash, hlen, K, hlen, PRK, T); - k = 0; - T = []; - for (j = 0; j < hlen; j++) { - OKM[m++] = K[j]; - T[k++] = K[j]; - } - } - if (flen > 0) { - for (j = 0; j < INFO.length; j++) T[k++] = INFO[j]; - T[k++] = n + 1; - this.HMAC1(hash, hlen, K, flen, PRK, T); - for (j = 0; j < flen; j++) OKM[m++] = K[j]; - } - return OKM; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - XOF_Expand: function (hlen, olen, DST, MSG) { - var OKM = []; - var H = new ctx.SHA3(hlen); - for (var i = 0; i < MSG.length; i++) H.process(MSG[i]); - H.process((olen >> 8) & 0xff); - H.process(olen & 0xff); - - for (var i = 0; i < DST.length; i++) H.process(DST[i]); - H.process(DST.length); - - H.shake(OKM, olen); - return OKM; - }, - - XMD_Expand(hash, hlen, olen, DST, MSG) { - var OKM = []; - var H1 = []; - var TMP = []; - var TMP2 = []; - - var ell = this.ceil(olen, hlen); - var blk = this.blksize(hash, hlen); - TMP[0] = (olen >> 8) & 0xff; - TMP[1] = olen & 0xff; - TMP[2] = 0; - for (var j = 0; j < DST.length; j++) TMP[3 + j] = DST[j]; - TMP[3 + DST.length] = DST.length; - - var H0 = this.GPhashit(hash, hlen, 0, blk, MSG, -1, TMP); - - var k = 0; - for (var j = 0; j < hlen; j++) H1[j] = 0; - - for (var i = 1; i <= ell; i++) { - for (var j = 0; j < hlen; j++) H1[j] ^= H0[j]; - TMP2[0] = i; - for (var j = 0; j < DST.length; j++) TMP2[1 + j] = DST[j]; - TMP2[1 + DST.length] = DST.length; - H1 = this.GPhashit(hash, hlen, 0, 0, H1, -1, TMP2); - for (var j = 0; j < hlen && k < olen; j++) OKM[k++] = H1[j]; - } - - return OKM; - }, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - /* SHAXXX identifier strings */ - SHA256ID: [ - 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, - 0x05, 0x00, 0x04, 0x20, - ], - SHA384ID: [ - 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, - 0x05, 0x00, 0x04, 0x30, - ], - SHA512ID: [ - 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, - 0x05, 0x00, 0x04, 0x40, - ], - - /* Mask Generation Function */ - MGF1: function (sha, Z, olen, K) { - var hlen = sha, - B = [], - k = 0, - counter, - cthreshold, - i; - - for (i = 0; i < K.length; i++) { - K[i] = 0; - } - - cthreshold = Math.floor(olen / hlen); - if (olen % hlen !== 0) { - cthreshold++; - } - - for (counter = 0; counter < cthreshold; counter++) { - B = this.GPhashit(this.MC_SHA2, sha, 0, 0, Z, counter, null); - //B = this.hashit(sha, Z, counter); - - if (k + hlen > olen) { - for (i = 0; i < olen % hlen; i++) { - K[k++] = B[i]; - } - } else { - for (i = 0; i < hlen; i++) { - K[k++] = B[i]; - } - } - } - }, - - MGF1XOR: function (sha, Z, K) { - var hlen = sha, - B = [], - k = 0, - counter, - cthreshold, - i; - var olen = K.length; - - cthreshold = Math.floor(olen / hlen); - if (olen % hlen !== 0) { - cthreshold++; - } - - for (counter = 0; counter < cthreshold; counter++) { - B = this.GPhashit(this.MC_SHA2, sha, 0, 0, Z, counter, null); - //B = this.hashit(sha, Z, counter); - - if (k + hlen > olen) { - for (i = 0; i < olen % hlen; i++) { - K[k++] ^= B[i]; - } - } else { - for (i = 0; i < hlen; i++) { - K[k++] ^= B[i]; - } - } - } - }, - - PKCS15: function (sha, m, w, RFS) { - var olen = RFS, - hlen = sha, - idlen = 19, - H, - i, - j; - - if (olen < idlen + hlen + 10) { - return false; - } - H = this.SPhashit(this.MC_SHA2, sha, m); - //H = this.hashit(sha, m, -1); - - for (i = 0; i < w.length; i++) { - w[i] = 0; - } - - i = 0; - w[i++] = 0; - w[i++] = 1; - for (j = 0; j < olen - idlen - hlen - 3; j++) { - w[i++] = 0xff; - } - w[i++] = 0; - - if (hlen == this.SHA256) { - for (j = 0; j < idlen; j++) { - w[i++] = this.SHA256ID[j]; - } - } else if (hlen == this.SHA384) { - for (j = 0; j < idlen; j++) { - w[i++] = this.SHA384ID[j]; - } - } else if (hlen == this.SHA512) { - for (j = 0; j < idlen; j++) { - w[i++] = this.SHA512ID[j]; - } - } - - for (j = 0; j < hlen; j++) { - w[i++] = H[j]; - } - - return true; - }, - - PSS_ENCODE: function (sha, m, rng, RFS) { - var emlen = RFS; - var embits = 8 * emlen - 1; - var hlen = sha; - var SALT = []; - for (i = 0; i < hlen; i++) { - SALT[i] = rng.getByte(); - } - var mask = 0xff >> (8 * emlen - embits); - - var H = this.SPhashit(this.MC_SHA2, sha, m); - - if (emlen < hlen + hlen + 2) return null; - - var MD = []; - - for (var i = 0; i < 8; i++) MD[i] = 0; - for (var i = 0; i < hlen; i++) MD[8 + i] = H[i]; - for (var i = 0; i < hlen; i++) MD[8 + hlen + i] = SALT[i]; - - H = this.SPhashit(this.MC_SHA2, sha, MD); - - var f = []; - for (var i = 0; i < emlen - hlen - hlen - 2; i++) f[i] = 0; - f[emlen - hlen - hlen - 2] = 0x1; - for (var i = 0; i < hlen; i++) f[emlen + i - hlen - hlen - 1] = SALT[i]; - this.MGF1XOR(sha, H, f); - f[0] &= mask; - for (var i = 0; i < hlen; i++) f[emlen + i - hlen - 1] = H[i]; - f[emlen - 1] = 0xbc; - return f; - }, - - PSS_VERIFY: function (sha, m, f) { - var emlen = f.length; - var embits = 8 * emlen - 1; - var hlen = sha; - var SALT = []; - var mask = 0xff >> (8 * emlen - embits); - - var HMASK = this.SPhashit(this.MC_SHA2, sha, m); - if (emlen < hlen + hlen + 2) return false; - if (f[emlen - 1] != 0xbc) return false; - if ((f[0] & ~mask) != 0) return false; - - var DB = []; - for (var i = 0; i < emlen - hlen - 1; i++) DB[i] = f[i]; - var H = []; - for (var i = 0; i < hlen; i++) H[i] = f[emlen + i - hlen - 1]; - this.MGF1XOR(sha, H, DB); - DB[0] &= mask; - var k = 0; - for (var i = 0; i < emlen - hlen - hlen - 2; i++) k |= DB[i]; - if (k != 0) return false; - if (DB[emlen - hlen - hlen - 2] != 0x01) return false; - - for (var i = 0; i < hlen; i++) SALT[i] = DB[emlen + i - hlen - hlen - 1]; - - var MD = []; - for (var i = 0; i < 8; i++) MD[i] = 0; - for (var i = 0; i < hlen; i++) MD[8 + i] = HMASK[i]; - for (var i = 0; i < hlen; i++) MD[8 + hlen + i] = SALT[i]; - - HMASK = this.SPhashit(this.MC_SHA2, sha, MD); - - k = 0; - for (var i = 0; i < hlen; i++) k |= H[i] - HMASK[i]; - if (k != 0) return false; - return true; - }, - /* OAEP Message Encoding for Encryption */ - OAEP_ENCODE: function (sha, m, rng, p, RFS) { - var olen = RFS - 1, - mlen = m.length, - SEED = [], - DBMASK = [], - f = [], - hlen, - seedlen, - slen, - i, - d, - h; - - seedlen = hlen = sha; - - if (mlen > olen - hlen - seedlen - 1) { - return null; - } - - h = this.SPhashit(this.MC_SHA2, sha, p); - //h = this.hashit(sha, p, -1); - for (i = 0; i < hlen; i++) { - f[i] = h[i]; - } - - slen = olen - mlen - hlen - seedlen - 1; - - for (i = 0; i < slen; i++) { - f[hlen + i] = 0; - } - f[hlen + slen] = 1; - for (i = 0; i < mlen; i++) { - f[hlen + slen + 1 + i] = m[i]; - } - - for (i = 0; i < seedlen; i++) { - SEED[i] = rng.getByte(); - } - this.MGF1(sha, SEED, olen - seedlen, DBMASK); - - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] ^= f[i]; - } - this.MGF1(sha, DBMASK, seedlen, f); - - for (i = 0; i < seedlen; i++) { - f[i] ^= SEED[i]; - } - - for (i = 0; i < olen - seedlen; i++) { - f[i + seedlen] = DBMASK[i]; - } - - /* pad to length RFS */ - d = 1; - for (i = RFS - 1; i >= d; i--) { - f[i] = f[i - d]; - } - for (i = d - 1; i >= 0; i--) { - f[i] = 0; - } - - return f; - }, - - /* OAEP Message Decoding for Decryption */ - OAEP_DECODE: function (sha, p, f, RFS) { - var olen = RFS - 1, - SEED = [], - CHASH = [], - DBMASK = [], - comp, - hlen, - seedlen, - x, - t, - d, - i, - k, - h, - r; - - seedlen = hlen = sha; - if (olen < seedlen + hlen + 1) { - return null; - } - - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] = 0; - } - - if (f.length < RFS) { - d = RFS - f.length; - for (i = RFS - 1; i >= d; i--) { - f[i] = f[i - d]; - } - for (i = d - 1; i >= 0; i--) { - f[i] = 0; - } - } - h = this.SPhashit(this.MC_SHA2, sha, p); - //h = this.hashit(sha, p, -1); - for (i = 0; i < hlen; i++) { - CHASH[i] = h[i]; - } - - x = f[0]; - - for (i = seedlen; i < olen; i++) { - DBMASK[i - seedlen] = f[i + 1]; - } - - this.MGF1(sha, DBMASK, seedlen, SEED); - for (i = 0; i < seedlen; i++) { - SEED[i] ^= f[i + 1]; - } - this.MGF1(sha, SEED, olen - seedlen, f); - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] ^= f[i]; - } - - comp = true; - for (i = 0; i < hlen; i++) { - if (CHASH[i] != DBMASK[i]) { - comp = false; - } - } - - for (i = 0; i < olen - seedlen - hlen; i++) { - DBMASK[i] = DBMASK[i + hlen]; - } - - for (i = 0; i < hlen; i++) { - SEED[i] = CHASH[i] = 0; - } - - for (k = 0; ; k++) { - if (k >= olen - seedlen - hlen) { - return null; - } - - if (DBMASK[k] !== 0) { - break; - } - } - - t = DBMASK[k]; - if (!comp || x !== 0 || t != 0x01) { - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] = 0; - } - return null; - } - r = []; - - for (i = 0; i < olen - seedlen - hlen - k - 1; i++) { - r[i] = DBMASK[i + k + 1]; - } - - for (i = 0; i < olen - seedlen; i++) { - DBMASK[i] = 0; - } - - return r; - }, - }; - - return HMAC; -}; - -/* - var MSG=ctx.ECDH.asciitobytes("abc"); - var DST=ctx.ECDH.asciitobytes("P256_XMD:SHA-256_SSWU_RO_TESTGEN"); - - var OKM=ctx.HMAC.XOF_Expand(ctx.SHA3.SHAKE128,48,DST,MSG); - mywindow.document.write("OKM : 0x"+ctx.ECDH.bytestostring(OKM) + "
"); - - OKM=ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2,32,48,DST,MSG); - mywindow.document.write("OKM : 0x"+ctx.ECDH.bytestostring(OKM) + "
"); - - ikm=[]; - salt=[]; - info=[]; - - for (i=0;i<22;i++) ikm[i]=0x0b; - for (i=0;i<13;i++) salt[i]=i; - for (i=0;i<10;i++) info[i]=(0xf0+i); - - var prk=ctx.HMAC.HKDF_Extract(ctx.HMAC.MC_SHA2,32,salt,ikm); - window.document.write("PRK= "+ctx.NHS.bytestostring(prk)+ "
"); - - var okm=ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2,32,42,prk,info); - window.document.write("PRK= "+ctx.NHS.bytestostring(okm)+ "
"); -*/ - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HMAC: HMAC, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/hpke.js b/packages/bls-verify/src/vendor/amcl-js/src/hpke.js deleted file mode 100644 index 9a5927f50..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/hpke.js +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Hybrid Public Key Encryption */ - -/* Following https://datatracker.ietf.org/doc/draft-irtf-cfrg-hpke/?include_text=1 */ - -var HPKE = function (ctx) { - 'use strict'; - - var HPKE = { - reverse: function (X) { - var i, - ch, - lx = X.length; - for (i = 0; i < lx / 2; i++) { - ch = X[i]; - X[i] = X[lx - i - 1]; - X[lx - i - 1] = ch; - } - }, - - LabeledExtract: function (SALT, SUITE_ID, label, IKM) { - var rfc = 'HPKE-07'; - var RFC = ctx.ECDH.asciitobytes(rfc); - var LABEL = ctx.ECDH.asciitobytes(label); - var LIKM = []; - var k = 0; - for (var i = 0; i < RFC.length; i++) LIKM[k++] = RFC[i]; - for (var i = 0; i < SUITE_ID.length; i++) LIKM[k++] = SUITE_ID[i]; - for (var i = 0; i < LABEL.length; i++) LIKM[k++] = LABEL[i]; - if (IKM != null) { - for (var i = 0; i < IKM.length; i++) LIKM[k++] = IKM[i]; - } - return ctx.HMAC.HKDF_Extract(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, SALT, LIKM); - }, - - LabeledExpand: function (PRK, SUITE_ID, label, INFO, L) { - var AR = ctx.HMAC.inttobytes(L, 2); - var rfc = 'HPKE-07'; - var RFC = ctx.ECDH.asciitobytes(rfc); - var LABEL = ctx.ECDH.asciitobytes(label); - var LINFO = []; - LINFO[0] = AR[0]; - LINFO[1] = AR[1]; - var k = 2; - for (var i = 0; i < RFC.length; i++) LINFO[k++] = RFC[i]; - for (var i = 0; i < SUITE_ID.length; i++) LINFO[k++] = SUITE_ID[i]; - for (var i = 0; i < LABEL.length; i++) LINFO[k++] = LABEL[i]; - if (INFO != null) { - for (var i = 0; i < INFO.length; i++) LINFO[k++] = INFO[i]; - } - return ctx.HMAC.HKDF_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, PRK, LINFO); - }, - - ExtractAndExpand: function (config_id, DH, CONTEXT) { - var kem = config_id & 255; - var txt = 'KEM'; - var KEM_ID = ctx.HMAC.inttobytes(kem, 2); - var KEM = ctx.ECDH.asciitobytes(txt); - var SUITE_ID = []; - var k = KEM.length; - for (var i = 0; i < k; i++) SUITE_ID[i] = KEM[i]; - SUITE_ID[k] = KEM_ID[0]; - SUITE_ID[k + 1] = KEM_ID[1]; - var PRK = this.LabeledExtract(null, SUITE_ID, 'eae_prk', DH); - return this.LabeledExpand(PRK, SUITE_ID, 'shared_secret', CONTEXT, ctx.ECP.HASH_TYPE); - }, - - DeriveKeyPair: function (config_id, SK, PK, SEED) { - var counter = 0; - var INFO = []; - var kem = config_id & 255; - var txt = 'KEM'; - var KEM_ID = ctx.HMAC.inttobytes(kem, 2); - var KEM = ctx.ECDH.asciitobytes(txt); - var SUITE_ID = []; - var k = KEM.length; - for (var i = 0; i < k; i++) SUITE_ID[i] = KEM[i]; - SUITE_ID[k] = KEM_ID[0]; - SUITE_ID[k + 1] = KEM_ID[1]; - - var PRK = this.LabeledExtract(null, SUITE_ID, 'dkp_prk', SEED); - var S; - if (kem == 32 || kem == 33) { - S = this.LabeledExpand(PRK, SUITE_ID, 'sk', null, ctx.ECDH.EGS); - this.reverse(S); - if (kem == 32) { - S[ctx.ECDH.EGS - 1] &= 248; - S[0] &= 127; - S[0] |= 64; - } else { - S[ctx.ECDH.EGS - 1] &= 252; - S[0] |= 128; - } - } else { - var bit_mask; - if (kem == 18) bit_mask = 1; - else bit_mask = 0xff; - S = []; - for (var i = 0; i < ctx.ECDH.EGS; i++) S[i] = 0; - while (!ctx.ECDH.IN_RANGE(S) && counter < 256) { - INFO[0] = counter; - S = this.LabeledExpand(PRK, SUITE_ID, 'candidate', INFO, ctx.ECDH.EGS); - S[0] &= bit_mask; - counter++; - } - } - for (var i = 0; i < ctx.ECDH.EGS; i++) SK[i] = S[i]; - ctx.ECDH.KEY_PAIR_GENERATE(null, SK, PK); - if (kem == 32 || kem == 33) this.reverse(PK); - if (counter < 256) return true; - return false; - }, - - encap: function (config_id, skE, pkE, pkR) { - var DH = []; - var KEMCONTEXT = []; - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkR); - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - this.reverse(pkR); - this.reverse(DH); - } else { - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - } - var k = 0; - for (var i = 0; i < pkE.length; i++) KEMCONTEXT[k++] = pkE[i]; - for (var i = 0; i < pkR.length; i++) KEMCONTEXT[k++] = pkR[i]; - - return this.ExtractAndExpand(config_id, DH, KEMCONTEXT); - }, - - decap: function (config_id, skR, pkE, pkR) { - var DH = []; - var KEMCONTEXT = []; - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkE); - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - this.reverse(pkE); - this.reverse(DH); - } else { - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - } - - var k = 0; - for (var i = 0; i < pkE.length; i++) KEMCONTEXT[k++] = pkE[i]; - for (var i = 0; i < pkR.length; i++) KEMCONTEXT[k++] = pkR[i]; - - return this.ExtractAndExpand(config_id, DH, KEMCONTEXT); - }, - - authEncap: function (config_id, skE, skS, pkE, pkR, pkS) { - var pklen = pkE.length; - var DH = []; - var DH1 = []; - var KEMCONTEXT = []; - - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkR); - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - ctx.ECDH.ECPSVDP_DH(skS, pkR, DH1, 0); - this.reverse(pkR); - this.reverse(DH); - this.reverse(DH1); - } else { - ctx.ECDH.ECPSVDP_DH(skE, pkR, DH, 0); - ctx.ECDH.ECPSVDP_DH(skS, pkR, DH1, 0); - } - var ZZ = []; - for (var i = 0; i < ctx.ECDH.EFS; i++) { - ZZ[i] = DH[i]; - ZZ[ctx.ECDH.EFS + i] = DH1[i]; - } - - for (var i = 0; i < pklen; i++) { - KEMCONTEXT[i] = pkE[i]; - KEMCONTEXT[pklen + i] = pkR[i]; - KEMCONTEXT[2 * pklen + i] = pkS[i]; - } - - return this.ExtractAndExpand(config_id, ZZ, KEMCONTEXT); - }, - - authDecap: function (config_id, skR, pkE, pkR, pkS) { - var pklen = pkE.length; - var DH = []; - var DH1 = []; - var KEMCONTEXT = []; - - var kem = config_id & 255; - - if (kem == 32 || kem == 33) { - this.reverse(pkE); - this.reverse(pkS); - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - ctx.ECDH.ECPSVDP_DH(skR, pkS, DH1, 0); - this.reverse(pkE); - this.reverse(pkS); - this.reverse(DH); - this.reverse(DH1); - } else { - ctx.ECDH.ECPSVDP_DH(skR, pkE, DH, 0); - ctx.ECDH.ECPSVDP_DH(skR, pkS, DH1, 0); - } - - var ZZ = []; - for (var i = 0; i < ctx.ECDH.EFS; i++) { - ZZ[i] = DH[i]; - ZZ[ctx.ECDH.EFS + i] = DH1[i]; - } - - for (var i = 0; i < pklen; i++) { - KEMCONTEXT[i] = pkE[i]; - KEMCONTEXT[pklen + i] = pkR[i]; - KEMCONTEXT[2 * pklen + i] = pkS[i]; - } - - return this.ExtractAndExpand(config_id, ZZ, KEMCONTEXT); - }, - - keySchedule: function (config_id, key, nonce, exp_secret, mode, Z, info, psk, pskID) { - var context = []; - var kem = config_id & 255; - var kdf = (config_id >> 8) & 3; - var aead = (config_id >> 10) & 3; - var num, k; - var txt = 'HPKE'; - var KEM = ctx.ECDH.asciitobytes(txt); - var SUITE_ID = []; - k = KEM.length; - for (var i = 0; i < k; i++) SUITE_ID[i] = KEM[i]; - num = ctx.HMAC.inttobytes(kem, 2); - SUITE_ID[k++] = num[0]; - SUITE_ID[k++] = num[1]; - num = ctx.HMAC.inttobytes(kdf, 2); - SUITE_ID[k++] = num[0]; - SUITE_ID[k++] = num[1]; - num = ctx.HMAC.inttobytes(aead, 2); - SUITE_ID[k++] = num[0]; - SUITE_ID[k++] = num[1]; - k = 0; - var ar = ctx.HMAC.inttobytes(mode, 1); - for (var i = 0; i < ar.length; i++) context[k++] = ar[i]; - - var H = this.LabeledExtract(null, SUITE_ID, 'psk_id_hash', pskID); - for (var i = 0; i < ctx.ECP.HASH_TYPE; i++) context[k++] = H[i]; - H = this.LabeledExtract(null, SUITE_ID, 'info_hash', info); - for (var i = 0; i < ctx.ECP.HASH_TYPE; i++) context[k++] = H[i]; - - //H=this.LabeledExtract(null,SUITE_ID,"psk_hash",psk); - //var secret=this.LabeledExtract(H,SUITE_ID,"secret",Z); - - var secret = this.LabeledExtract(Z, SUITE_ID, 'secret', psk); - - var ex = this.LabeledExpand(secret, SUITE_ID, 'key', context, ctx.ECP.AESKEY); - for (var i = 0; i < ex.length; i++) key[i] = ex[i]; - - ex = this.LabeledExpand(secret, SUITE_ID, 'base_nonce', context, 12); - for (var i = 0; i < ex.length; i++) nonce[i] = ex[i]; - - if (exp_secret != null) { - ex = this.LabeledExpand(secret, SUITE_ID, 'exp', context, ctx.ECP.HASH_TYPE); - for (var i = 0; i < ex.length; i++) exp_secret[i] = ex[i]; - } - }, - }; - return HPKE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - HPKE: HPKE, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/mpin.js b/packages/bls-verify/src/vendor/amcl-js/src/mpin.js deleted file mode 100644 index 399e3a8cd..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/mpin.js +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* MPIN 128-bit API Functions */ - -var MPIN = function (ctx) { - 'use strict'; - - var MPIN = { - BAD_PARAMS: -11, - INVALID_POINT: -14, - WRONG_ORDER: -18, - BAD_PIN: -19, - /* configure PIN here */ - MAXPIN: 10000, - /* max PIN */ - PBLEN: 14, - /* MAXPIN length in bits */ - TS: 12, - /* 10 for 4 digit PIN, 14 for 6-digit PIN - 2^TS/TS approx = sqrt(MAXPIN) */ - - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - comparebytes: function (a, b) { - if (a.length != b.length) { - return false; - } - - for (var i = 0; i < a.length; i++) { - if (a[i] != b[i]) { - return false; - } - } - - return true; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - ENCODE_TO_CURVE: function (DST, ID, HCID) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var k = q.nbits(); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var m = r.nbits(); - var L = this.ceil(k + this.ceil(m, 2), 8); - var OKM = ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, DST, ID); - var fd = []; - - for (var j = 0; j < L; j++) fd[j] = OKM[j]; - var dx = ctx.DBIG.fromBytes(fd); - var u = new ctx.FP(dx.mod(q)); - var P = ctx.ECP.map2point(u); - P.cfp(); - P.affine(); - P.toBytes(HCID, false); - }, - - /* create random secret S */ - RANDOM_GENERATE: function (rng, S) { - var r = new ctx.BIG(0), - s; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - s.toBytes(S); - return 0; - }, - - /* Extract PIN from TOKEN for identity CID */ - EXTRACT_PIN: function (CID, pin, TOKEN) { - var P, R; - P = ctx.ECP.fromBytes(TOKEN); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - R = ctx.ECP.fromBytes(CID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - pin %= this.MAXPIN; - R = R.pinmul(pin, this.PBLEN); - P.sub(R); - P.toBytes(TOKEN, false); - return 0; - }, - - /* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */ - GET_SERVER_SECRET: function (S, SST) { - var s, Q; - Q = ctx.ECP2.generator(); - s = ctx.BIG.fromBytes(S); - Q = ctx.PAIR.G2mul(Q, s); - Q.toBytes(SST, false); - return 0; - }, - - /* Client secret CST=S*H(CID) where CID is client ID and S is master secret */ - GET_CLIENT_SECRET: function (S, IDHTC, CST) { - var s = ctx.BIG.fromBytes(S); - var P = ctx.ECP.fromBytes(IDHTC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - ctx.PAIR.G1mul(P, s).toBytes(CST, false); - return 0; - }, - - /* Implement step 1 on client side of MPin protocol */ - CLIENT_1: function (CID, rng, X, pin, TOKEN, SEC, xID) { - var r = new ctx.BIG(0), - x, - P, - T, - W; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (rng !== null) { - x = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - x.toBytes(X); - } else { - x = ctx.BIG.fromBytes(X); - } - P = ctx.ECP.fromBytes(CID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - T = ctx.ECP.fromBytes(TOKEN); - if (T.is_infinity()) { - return this.INVALID_POINT; - } - - pin %= this.MAXPIN; - W = P.pinmul(pin, this.PBLEN); - T.add(W); - - P = ctx.PAIR.G1mul(P, x); - P.toBytes(xID, false); - - T.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 on client side of MPin protocol */ - CLIENT_2: function (X, Y, SEC) { - var r = new ctx.BIG(0), - P, - px, - py; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - P = ctx.ECP.fromBytes(SEC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - px = ctx.BIG.fromBytes(X); - py = ctx.BIG.fromBytes(Y); - px.add(py); - px.mod(r); - - P = ctx.PAIR.G1mul(P, px); - P.neg(); - P.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 of MPin protocol on server side. */ - SERVER: function (HID, Y, SST, xID, mSEC) { - var Q, sQ, R, y, P, g; - Q = ctx.ECP2.generator(); - sQ = ctx.ECP2.fromBytes(SST); - if (sQ.is_infinity()) { - return this.INVALID_POINT; - } - if (xID == null) { - return this.BAD_PARAMS; - } - R = ctx.ECP.fromBytes(xID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - y = ctx.BIG.fromBytes(Y); - if (HID == null) { - return this.BAD_PARAMS; - } - P = ctx.ECP.fromBytes(HID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - - P = ctx.PAIR.G1mul(P, y); - P.add(R); - R = ctx.ECP.fromBytes(mSEC); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - - g = ctx.PAIR.ate2(Q, R, sQ, P); - g = ctx.PAIR.fexp(g); - - if (!g.isunity()) { - return this.BAD_PIN; - } - return 0; - }, - }; - - return MPIN; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - MPIN: MPIN, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/mpin192.js b/packages/bls-verify/src/vendor/amcl-js/src/mpin192.js deleted file mode 100644 index 478bc05c8..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/mpin192.js +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* MPIN 192-bit API Functions */ - -var MPIN192 = function (ctx) { - 'use strict'; - - var MPIN192 = { - BAD_PARAMS: -11, - INVALID_POINT: -14, - WRONG_ORDER: -18, - BAD_PIN: -19, - /* configure PIN here */ - MAXPIN: 10000, - /* max PIN */ - PBLEN: 14, - /* MAXPIN length in bits */ - TS: 12, - /* 10 for 4 digit PIN, 14 for 6-digit PIN - 2^TS/TS approx = sqrt(MAXPIN) */ - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - comparebytes: function (a, b) { - if (a.length != b.length) { - return false; - } - - for (var i = 0; i < a.length; i++) { - if (a[i] != b[i]) { - return false; - } - } - - return true; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - ENCODE_TO_CURVE: function (DST, ID, HCID) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var k = q.nbits(); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var m = r.nbits(); - var L = this.ceil(k + this.ceil(m, 2), 8); - var OKM = ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, DST, ID); - var fd = []; - - for (var j = 0; j < L; j++) fd[j] = OKM[j]; - var dx = ctx.DBIG.fromBytes(fd); - var u = new ctx.FP(dx.mod(q)); - var P = ctx.ECP.map2point(u); - P.cfp(); - P.affine(); - P.toBytes(HCID, false); - }, - - /* create random secret S */ - RANDOM_GENERATE: function (rng, S) { - var r = new ctx.BIG(0), - s; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - s.toBytes(S); - return 0; - }, - - /* Extract PIN from TOKEN for identity CID */ - EXTRACT_PIN: function (CID, pin, TOKEN) { - var P, R; - P = ctx.ECP.fromBytes(TOKEN); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - R = ctx.ECP.fromBytes(CID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - pin %= this.MAXPIN; - R = R.pinmul(pin, this.PBLEN); - P.sub(R); - P.toBytes(TOKEN, false); - return 0; - }, - - /* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */ - GET_SERVER_SECRET: function (S, SST) { - var s, Q; - Q = ctx.ECP4.generator(); - s = ctx.BIG.fromBytes(S); - Q = ctx.PAIR4.G2mul(Q, s); - Q.toBytes(SST, false); - return 0; - }, - - /* Client secret CST=S*H(CID) where CID is client ID and S is master secret */ - GET_CLIENT_SECRET: function (S, IDHTC, CST) { - var s = ctx.BIG.fromBytes(S); - var P = ctx.ECP.fromBytes(IDHTC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - ctx.PAIR4.G1mul(P, s).toBytes(CST, false); - return 0; - }, - - /* Implement step 1 on client side of MPin protocol */ - CLIENT_1: function (CID, rng, X, pin, TOKEN, SEC, xID) { - var r = new ctx.BIG(0), - x, - P, - T, - W; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (rng !== null) { - x = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - x.toBytes(X); - } else { - x = ctx.BIG.fromBytes(X); - } - P = ctx.ECP.fromBytes(CID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - T = ctx.ECP.fromBytes(TOKEN); - if (T.is_infinity()) { - return this.INVALID_POINT; - } - - pin %= this.MAXPIN; - W = P.pinmul(pin, this.PBLEN); - T.add(W); - - P = ctx.PAIR4.G1mul(P, x); - P.toBytes(xID, false); - - T.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 on client side of MPin protocol */ - CLIENT_2: function (X, Y, SEC) { - var r = new ctx.BIG(0), - P, - px, - py; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - P = ctx.ECP.fromBytes(SEC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - px = ctx.BIG.fromBytes(X); - py = ctx.BIG.fromBytes(Y); - px.add(py); - px.mod(r); - - P = ctx.PAIR4.G1mul(P, px); - P.neg(); - P.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 of MPin protocol on server side. */ - SERVER: function (HID, Y, SST, xID, mSEC) { - var Q, sQ, R, y, P, g; - Q = ctx.ECP4.generator(); - sQ = ctx.ECP4.fromBytes(SST); - if (sQ.is_infinity()) { - return this.INVALID_POINT; - } - if (xID == null) { - return this.BAD_PARAMS; - } - R = ctx.ECP.fromBytes(xID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - y = ctx.BIG.fromBytes(Y); - if (HID == null) { - return this.BAD_PARAMS; - } - P = ctx.ECP.fromBytes(HID); - - if (P.is_infinity()) { - return this.INVALID_POINT; - } - - P = ctx.PAIR4.G1mul(P, y); - P.add(R); - R = ctx.ECP.fromBytes(mSEC); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - - g = ctx.PAIR4.ate2(Q, R, sQ, P); - g = ctx.PAIR4.fexp(g); - - if (!g.isunity()) { - return this.BAD_PIN; - } - return 0; - }, - }; - - return MPIN192; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - MPIN192: MPIN192, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/mpin256.js b/packages/bls-verify/src/vendor/amcl-js/src/mpin256.js deleted file mode 100644 index 09f3a0d81..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/mpin256.js +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* MPIN 256-bit API Functions */ - -var MPIN256 = function (ctx) { - 'use strict'; - - var MPIN256 = { - BAD_PARAMS: -11, - INVALID_POINT: -14, - WRONG_ORDER: -18, - BAD_PIN: -19, - /* configure PIN here */ - MAXPIN: 10000, - /* max PIN */ - PBLEN: 14, - /* MAXPIN length in bits */ - TS: 12, - /* 10 for 4 digit PIN, 14 for 6-digit PIN - 2^TS/TS approx = sqrt(MAXPIN) */ - - EFS: ctx.BIG.MODBYTES, - EGS: ctx.BIG.MODBYTES, - - SHA256: 32, - SHA384: 48, - SHA512: 64, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - - asciitobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i += 2) { - b.push(parseInt(s.substr(i, 2), 16)); - } - - return b; - }, - - comparebytes: function (a, b) { - if (a.length != b.length) { - return false; - } - - for (var i = 0; i < a.length; i++) { - if (a[i] != b[i]) { - return false; - } - } - - return true; - }, - - ceil: function (a, b) { - return Math.floor((a - 1) / b + 1); - }, - - ENCODE_TO_CURVE: function (DST, ID, HCID) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_FIELD.Modulus); - var k = q.nbits(); - var r = new ctx.BIG(0); - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - var m = r.nbits(); - var L = this.ceil(k + this.ceil(m, 2), 8); - var OKM = ctx.HMAC.XMD_Expand(ctx.HMAC.MC_SHA2, ctx.ECP.HASH_TYPE, L, DST, ID); - var fd = []; - - for (var j = 0; j < L; j++) fd[j] = OKM[j]; - var dx = ctx.DBIG.fromBytes(fd); - var u = new ctx.FP(dx.mod(q)); - var P = ctx.ECP.map2point(u); - P.cfp(); - P.affine(); - P.toBytes(HCID, false); - }, - - /* create random secret S */ - RANDOM_GENERATE: function (rng, S) { - var r = new ctx.BIG(0), - s; - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - s = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - s.toBytes(S); - return 0; - }, - - /* Extract PIN from TOKEN for identity CID */ - EXTRACT_PIN: function (CID, pin, TOKEN) { - var P, R; - P = ctx.ECP.fromBytes(TOKEN); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - R = ctx.ECP.fromBytes(CID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - pin %= this.MAXPIN; - R = R.pinmul(pin, this.PBLEN); - P.sub(R); - P.toBytes(TOKEN, false); - return 0; - }, - - /* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */ - GET_SERVER_SECRET: function (S, SST) { - var s, Q; - Q = ctx.ECP8.generator(); - s = ctx.BIG.fromBytes(S); - Q = ctx.PAIR8.G2mul(Q, s); - Q.toBytes(SST, false); - return 0; - }, - - /* Client secret CST=S*H(CID) where CID is client ID and S is master secret */ - GET_CLIENT_SECRET: function (S, IDHTC, CST) { - var s = ctx.BIG.fromBytes(S); - var P = ctx.ECP.fromBytes(IDHTC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - ctx.PAIR8.G1mul(P, s).toBytes(CST, false); - return 0; - }, - - /* Implement step 1 on client side of MPin protocol */ - CLIENT_1: function (CID, rng, X, pin, TOKEN, SEC, xID) { - var r = new ctx.BIG(0), - x, - P, - T, - W; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (rng !== null) { - x = ctx.BIG.randtrunc(r, 16 * ctx.ECP.AESKEY, rng); - x.toBytes(X); - } else { - x = ctx.BIG.fromBytes(X); - } - P = ctx.ECP.fromBytes(CID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - T = ctx.ECP.fromBytes(TOKEN); - if (T.is_infinity()) { - return this.INVALID_POINT; - } - - pin %= this.MAXPIN; - W = P.pinmul(pin, this.PBLEN); - T.add(W); - - P = ctx.PAIR8.G1mul(P, x); - P.toBytes(xID, false); - - T.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 on client side of MPin protocol */ - CLIENT_2: function (X, Y, SEC) { - var r = new ctx.BIG(0), - P, - px, - py; - - r.rcopy(ctx.ROM_CURVE.CURVE_Order); - - P = ctx.ECP.fromBytes(SEC); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - px = ctx.BIG.fromBytes(X); - py = ctx.BIG.fromBytes(Y); - px.add(py); - px.mod(r); - - P = ctx.PAIR8.G1mul(P, px); - P.neg(); - P.toBytes(SEC, false); - return 0; - }, - - /* Implement step 2 of MPin protocol on server side. */ - SERVER: function (HID, Y, SST, xID, mSEC) { - var Q, sQ, R, y, P, g; - Q = ctx.ECP8.generator(); - sQ = ctx.ECP8.fromBytes(SST); - if (sQ.is_infinity()) { - return this.INVALID_POINT; - } - if (xID == null) { - return this.BAD_PARAMS; - } - R = ctx.ECP.fromBytes(xID); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - y = ctx.BIG.fromBytes(Y); - if (HID == null) { - return this.BAD_PARAMS; - } - P = ctx.ECP.fromBytes(HID); - if (P.is_infinity()) { - return this.INVALID_POINT; - } - - P = ctx.PAIR8.G1mul(P, y); - P.add(R); - R = ctx.ECP.fromBytes(mSEC); - if (R.is_infinity()) { - return this.INVALID_POINT; - } - - g = ctx.PAIR8.ate2(Q, R, sQ, P); - g = ctx.PAIR8.fexp(g); - - if (!g.isunity()) { - return this.BAD_PIN; - } - return 0; - }, - }; - - return MPIN256; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - MPIN256: MPIN256, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/nhs.js b/packages/bls-verify/src/vendor/amcl-js/src/nhs.js deleted file mode 100644 index bf86f040c..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/nhs.js +++ /dev/null @@ -1,766 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* NewHope API high-level functions */ - -var NHS = function (ctx) { - 'use strict'; - - var NHS = { - round: function (a, b) { - return Math.floor((a + (b >> 1)) / b); - }, - - /* constant time absolute value */ - nabs: function (x) { - var mask = x >> 31; - return (x + mask) ^ mask; - }, - - /* Montgomery stuff */ - - redc: function (T) { - var m = ((T & 0x3ffffff) * NHS.ND) & 0x3ffffff; - return (m * NHS.PRIME + T) * NHS.MODINV; - }, - - nres: function (x) { - return NHS.redc(x * NHS.R2MODP); - }, - - modmul: function (a, b) { - return NHS.redc(a * b); - }, - - /* NTT code */ - /* Cooley-Tukey NTT */ - - ntt: function (x) { - var t = NHS.DEGREE / 2, - q = NHS.PRIME, - m, - i, - j, - k, - S, - U, - V; - - /* Convert to Montgomery form */ - for (j = 0; j < NHS.DEGREE; j++) { - x[j] = NHS.nres(x[j]); - } - - m = 1; - while (m < NHS.DEGREE) { - k = 0; - - for (i = 0; i < m; i++) { - S = NHS.roots[m + i]; - - for (j = k; j < k + t; j++) { - U = x[j]; - V = NHS.modmul(x[j + t], S); - x[j] = U + V; - x[j + t] = U + 2 * q - V; - } - - k += 2 * t; - } - - t /= 2; - m *= 2; - } - }, - - /* Gentleman-Sande INTT */ - intt: function (x) { - var q = NHS.PRIME, - t = 1, - m, - i, - j, - k, - S, - U, - V, - W; - - m = NHS.DEGREE / 2; - while (m > 1) { - k = 0; - - for (i = 0; i < m; i++) { - S = NHS.iroots[m + i]; - - for (j = k; j < k + t; j++) { - U = x[j]; - V = x[j + t]; - x[j] = U + V; - W = U + NHS.DEGREE * q - V; - x[j + t] = NHS.modmul(W, S); - } - - k += 2 * t; - } - - t *= 2; - m /= 2; - } - /* Last iteration merged with n^-1 */ - - t = NHS.DEGREE / 2; - for (j = 0; j < t; j++) { - U = x[j]; - V = x[j + t]; - W = U + NHS.DEGREE * q - V; - x[j + t] = NHS.modmul(W, NHS.invpr); - x[j] = NHS.modmul(U + V, NHS.inv); - } - - /* convert back from Montgomery to "normal" form */ - for (j = 0; j < NHS.DEGREE; j++) { - x[j] = NHS.redc(x[j]); - x[j] -= q; - x[j] += (x[j] >> (NHS.WL - 1)) & q; - } - }, - - /* See https://eprint.iacr.org/2016/1157.pdf */ - - Encode: function (key, poly) { - var i, j, b, k, kj, q2; - - q2 = NHS.PRIME / 2; - for (i = j = 0; i < 256; ) { - kj = key[j++]; - - for (k = 0; k < 8; k++) { - b = kj & 1; - poly[i] = b * q2; - poly[i + 256] = b * q2; - poly[i + 512] = b * q2; - poly[i + 768] = b * q2; - kj >>= 1; - i++; - } - } - }, - - Decode: function (poly, key) { - var q2 = NHS.PRIME / 2, - i, - j, - k, - b, - t; - - for (i = 0; i < 32; i++) { - key[i] = 0; - } - - for (i = j = 0; i < 256; ) { - for (k = 0; k < 8; k++) { - t = - NHS.nabs(poly[i] - q2) + - NHS.nabs(poly[i + 256] - q2) + - NHS.nabs(poly[i + 512] - q2) + - NHS.nabs(poly[i + 768] - q2); - - b = t - NHS.PRIME; - b = (b >> 31) & 1; - key[j] = ((key[j] & 0xff) >> 1) + (b << 7); - i++; - } - - j++; - } - }, - - /* convert 32-byte seed to random polynomial */ - - Parse: function (seed, poly) { - var sh = new ctx.SHA3(ctx.SHA3.SHAKE128), - hash = [], - i, - j, - n; - - for (i = 0; i < 32; i++) { - sh.process(seed[i]); - } - sh.shake(hash, 4 * NHS.DEGREE); - - for (i = j = 0; i < NHS.DEGREE; i++) { - n = hash[j] & 0x7f; - n <<= 8; - n += hash[j + 1] & 0xff; - n <<= 8; - n += hash[j + 2] & 0xff; - n <<= 8; - n += hash[j + 3] & 0xff; - j += 4; - poly[i] = NHS.nres(n); - //poly[i] = NHS.modmul(n, NHS.ONE); // reduce 31-bit random number mod q - } - }, - - /* Compress 14 bits polynomial coefficients into byte array */ - /* 7 bytes is 3x14 */ - pack: function (poly, array) { - var i, j, a, b, c, d; - - for (i = j = 0; i < NHS.DEGREE; ) { - a = poly[i++]; - b = poly[i++]; - c = poly[i++]; - d = poly[i++]; - array[j++] = a & 0xff; - array[j++] = ((a >> 8) | (b << 6)) & 0xff; - array[j++] = (b >> 2) & 0xff; - array[j++] = ((b >> 10) | (c << 4)) & 0xff; - array[j++] = (c >> 4) & 0xff; - array[j++] = ((c >> 12) | (d << 2)) & 0xff; - array[j++] = d >> 6; - } - }, - - unpack: function (array, poly) { - var i, j, a, b, c, d, e, f, g; - - for (i = j = 0; i < NHS.DEGREE; ) { - a = array[j++] & 0xff; - b = array[j++] & 0xff; - c = array[j++] & 0xff; - d = array[j++] & 0xff; - e = array[j++] & 0xff; - f = array[j++] & 0xff; - g = array[j++] & 0xff; - poly[i++] = a | ((b & 0x3f) << 8); - poly[i++] = (b >> 6) | (c << 2) | ((d & 0xf) << 10); - poly[i++] = (d >> 4) | (e << 4) | ((f & 3) << 12); - poly[i++] = (f >> 2) | (g << 6); - } - }, - - /* See https://eprint.iacr.org/2016/1157.pdf */ - - Compress: function (poly, array) { - var col = 0, - i, - j, - k, - b; - - for (i = j = 0; i < NHS.DEGREE; ) { - for (k = 0; k < 8; k++) { - b = NHS.round(poly[i] * 8, NHS.PRIME) & 7; - col = (col << 3) + b; - i++; - } - - array[j] = col & 0xff; - array[j + 1] = (col >>> 8) & 0xff; - array[j + 2] = (col >>> 16) & 0xff; - j += 3; - col = 0; - } - }, - - Decompress: function (array, poly) { - var col = 0, - i, - j, - k, - b; - - for (i = j = 0; i < NHS.DEGREE; ) { - col = array[j + 2] & 0xff; - col = (col << 8) + (array[j + 1] & 0xff); - col = (col << 8) + (array[j] & 0xff); - j += 3; - - for (k = 0; k < 8; k++) { - b = (col & 0xe00000) >>> 21; - col <<= 3; - poly[i] = NHS.round(b * NHS.PRIME, 8); - i++; - } - } - }, - - /* generate centered binomial distribution */ - - Error: function (RNG, poly) { - var n1, n2, r, i, j; - - for (i = 0; i < NHS.DEGREE; i++) { - n1 = RNG.getByte() + (RNG.getByte() << 8); - n2 = RNG.getByte() + (RNG.getByte() << 8); - r = 0; - - for (j = 0; j < 16; j++) { - r += (n1 & 1) - (n2 & 1); - n1 >>= 1; - n2 >>= 1; - } - - poly[i] = r + NHS.PRIME; - } - }, - - redc_it: function (p) { - var i; - for (i = 0; i < NHS.DEGREE; i++) { - p[i] = NHS.redc(p[i]); - } - }, - - nres_it: function (p) { - var i; - for (i = 0; i < NHS.DEGREE; i++) { - p[i] = NHS.nres(p[i]); - } - }, - - poly_mul: function (p1, p2, p3) { - var i; - - for (i = 0; i < NHS.DEGREE; i++) { - p1[i] = NHS.modmul(p2[i], p3[i]); - } - }, - - poly_add: function (p1, p2, p3) { - var i; - - for (i = 0; i < NHS.DEGREE; i++) { - p1[i] = p2[i] + p3[i]; - } - }, - - poly_sub: function (p1, p2, p3) { - var i; - - for (i = 0; i < NHS.DEGREE; i++) { - p1[i] = p2[i] + NHS.PRIME - p3[i]; - } - }, - - /* reduces inputs < 2q */ - poly_soft_reduce: function (poly) { - var i, e; - - for (i = 0; i < NHS.DEGREE; i++) { - e = poly[i] - NHS.PRIME; - poly[i] = e + ((e >> (NHS.WL - 1)) & NHS.PRIME); - } - }, - - /* fully reduces modulo q */ - poly_hard_reduce: function (poly) { - var i, e; - - for (i = 0; i < NHS.DEGREE; i++) { - e = NHS.modmul(poly[i], NHS.ONE); - e = e - NHS.PRIME; - poly[i] = e + ((e >> (NHS.WL - 1)) & NHS.PRIME); - } - }, - - bytestostring: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - - return s; - }, - /* API files */ - - SERVER_1: function (RNG, SB, S) { - var seed = new Uint8Array(32), - array = new Uint8Array(1792), - s = new Int32Array(NHS.DEGREE), - e = new Int32Array(NHS.DEGREE), - b = new Int32Array(NHS.DEGREE), - i; - - for (i = 0; i < 32; i++) { - seed[i] = RNG.getByte(); - } - - NHS.Parse(seed, b); - - NHS.Error(RNG, e); - NHS.Error(RNG, s); - - NHS.ntt(s); - NHS.ntt(e); - NHS.poly_mul(b, b, s); - NHS.poly_add(b, b, e); - NHS.poly_hard_reduce(b); - - NHS.redc_it(b); - NHS.pack(b, array); - - for (i = 0; i < 32; i++) { - SB[i] = seed[i]; - } - - for (i = 0; i < 1792; i++) { - SB[i + 32] = array[i]; - } - - NHS.poly_hard_reduce(s); - - NHS.pack(s, array); - - for (i = 0; i < 1792; i++) { - S[i] = array[i]; - } - }, - - CLIENT: function (RNG, SB, UC, KEY) { - var sh = new ctx.SHA3(ctx.SHA3.HASH256), - seed = new Uint8Array(32), - array = new Uint8Array(1792), - key = new Uint8Array(32), - cc = new Uint8Array(384), - sd = new Int32Array(NHS.DEGREE), - ed = new Int32Array(NHS.DEGREE), - u = new Int32Array(NHS.DEGREE), - k = new Int32Array(NHS.DEGREE), - c = new Int32Array(NHS.DEGREE), - i; - - NHS.Error(RNG, sd); - NHS.Error(RNG, ed); - - NHS.ntt(sd); - NHS.ntt(ed); - - for (i = 0; i < 32; i++) { - seed[i] = SB[i]; - } - - for (i = 0; i < 1792; i++) { - array[i] = SB[i + 32]; - } - - NHS.Parse(seed, u); - - NHS.poly_mul(u, u, sd); - NHS.poly_add(u, u, ed); - NHS.poly_hard_reduce(u); - - for (i = 0; i < 32; i++) { - key[i] = RNG.getByte(); - } - - for (i = 0; i < 32; i++) { - sh.process(key[i]); - } - - key = sh.hash(); - - NHS.Encode(key, k); - - NHS.unpack(array, c); - NHS.nres_it(c); - - NHS.poly_mul(c, c, sd); - NHS.intt(c); - NHS.Error(RNG, ed); - NHS.poly_add(c, c, ed); - NHS.poly_add(c, c, k); - - NHS.Compress(c, cc); - - sh.init(ctx.SHA3.HASH256); - for (i = 0; i < 32; i++) { - sh.process(key[i]); - } - key = sh.hash(); - - for (i = 0; i < 32; i++) { - KEY[i] = key[i]; - } - - NHS.redc_it(u); - NHS.pack(u, array); - - for (i = 0; i < 1792; i++) { - UC[i] = array[i]; - } - - for (i = 0; i < 384; i++) { - UC[i + 1792] = cc[i]; - } - }, - - SERVER_2: function (S, UC, KEY) { - var sh = new ctx.SHA3(ctx.SHA3.HASH256), - c = new Int32Array(NHS.DEGREE), - s = new Int32Array(NHS.DEGREE), - k = new Int32Array(NHS.DEGREE), - array = new Uint8Array(1792), - key = new Uint8Array(32), - cc = new Uint8Array(384), - i; - - for (i = 0; i < 1792; i++) { - array[i] = UC[i]; - } - - NHS.unpack(array, k); - NHS.nres_it(k); - - for (i = 0; i < 384; i++) { - cc[i] = UC[i + 1792]; - } - - NHS.Decompress(cc, c); - - for (i = 0; i < 1792; i++) { - array[i] = S[i]; - } - - NHS.unpack(array, s); - - NHS.poly_mul(k, k, s); - NHS.intt(k); - NHS.poly_sub(k, c, k); - NHS.poly_soft_reduce(k); - - NHS.Decode(k, key); - - for (i = 0; i < 32; i++) { - sh.process(key[i]); - } - key = sh.hash(); - - for (i = 0; i < 32; i++) { - KEY[i] = key[i]; - } - }, - }; - - //q=12289 - NHS.PRIME = 0x3001; // q in Hex - NHS.LGN = 10; // Degree n=2^LGN - NHS.ND = 0x3002fff; // 1/(R-q) mod R - NHS.ONE = 0x2aac; // R mod q - NHS.R2MODP = 0x1da2; // R^2 mod q - - NHS.MODINV = Math.pow(2, -26); - - NHS.DEGREE = 1024; // 1<< LGN - NHS.WL = 26; - - NHS.inv = 0xffb; - NHS.invpr = 0x1131; - - NHS.roots = [ - 0x2aac, 0xd6f, 0x1c67, 0x2c5b, 0x2dbd, 0x2697, 0x29f6, 0x8d3, 0x1b7c, 0x9eb, 0x20eb, 0x264a, - 0x27d0, 0x121b, 0x58c, 0x4d7, 0x17a2, 0x29eb, 0x1b72, 0x13b0, 0x19b1, 0x1581, 0x2ac9, 0x25e8, - 0x249d, 0x2d5e, 0x363, 0x1f74, 0x1f8f, 0x20a4, 0x2cb2, 0x2d04, 0x1407, 0x2df9, 0x3ad, 0x23f7, - 0x1a72, 0xa91, 0x37f, 0xdb3, 0x2315, 0x5e6, 0xa8f, 0x211d, 0xdad, 0x1f2b, 0x2e29, 0x26b0, - 0x2009, 0x2fdd, 0x2881, 0x399, 0x586, 0x2781, 0x2ab5, 0x971, 0x234b, 0x1df3, 0x1d2a, 0x15dd, - 0x1a6d, 0x2774, 0x7ff, 0x1ebe, 0x230, 0x1cf4, 0x180b, 0xb58, 0x198c, 0x2b40, 0x127b, 0x1d9d, - 0x137f, 0xfa0, 0x144, 0x4b, 0x2fac, 0xb09, 0x1c7f, 0x1b5, 0xeec, 0xc58, 0x1248, 0x243c, 0x108a, - 0x14b8, 0xe9, 0x2dfe, 0xfb, 0x2602, 0x2aec, 0x1bb7, 0x1098, 0x23d8, 0x783, 0x1b13, 0x2067, - 0x20d6, 0x171c, 0x4, 0x662, 0x1097, 0x24b9, 0x1b9d, 0x27c4, 0x276e, 0x6bf, 0x757, 0x2e16, 0x472, - 0x1d11, 0x1649, 0x2904, 0xed4, 0x6c5, 0x14ae, 0x2ef8, 0x2ae0, 0x2e7c, 0x2735, 0x1186, 0x4f2, - 0x17bb, 0x297f, 0x1dc7, 0x1ae5, 0x2a43, 0x2c02, 0xed6, 0x2b70, 0x1c7b, 0x18d1, 0x20ae, 0x6ad, - 0x2404, 0x113a, 0x209e, 0x31b, 0x159d, 0x48f, 0xe09, 0x1bb2, 0x14f7, 0x385, 0x1c4, 0x1cdb, - 0x22d6, 0x21d8, 0xc, 0x1aae, 0x2ece, 0x2d81, 0xd56, 0x5c1, 0x12da, 0x8cf, 0x1605, 0x1bc4, - 0x18b7, 0x19b9, 0x21be, 0x135e, 0x28d6, 0x2891, 0x2208, 0x17e1, 0x2971, 0x926, 0x211b, 0xff, - 0x51f, 0xa85, 0xe1, 0x2c35, 0x2585, 0x121, 0xe27, 0x2e64, 0x29f8, 0x2d46, 0xcb2, 0x292a, 0x33d, - 0xaf9, 0xb86, 0x2e3a, 0x2138, 0x1978, 0x2324, 0xf3f, 0x2d10, 0x1dfd, 0x13c3, 0x6cc, 0x1a79, - 0x1221, 0x250f, 0xacd, 0xfff, 0x7b4, 0x650, 0x1893, 0xe85, 0x1f5d, 0x12dc, 0x2d42, 0xd8e, - 0x1240, 0x1082, 0x12ef, 0x11b6, 0xfa8, 0xb0f, 0xdac, 0x191c, 0x1242, 0x1ea, 0x155, 0x270a, - 0x9ed, 0x2e5b, 0x25d8, 0x222c, 0x7e9, 0x1fb3, 0x10ac, 0x2919, 0x2584, 0xbe3, 0x24fa, 0x23ed, - 0x618, 0x2d80, 0x6fa, 0x140e, 0x588, 0x355, 0x1054, 0x26c4, 0x1e4f, 0x1681, 0x1f6f, 0x1c53, - 0xfe4, 0xacb, 0x1680, 0x2fe8, 0x6c, 0x165a, 0x10bb, 0x2c39, 0x1804, 0x1196, 0x884, 0x2622, - 0x629, 0x1ac1, 0x2232, 0x2f9b, 0xd3e, 0x20ff, 0x12c0, 0x27ec, 0x5a, 0x2a0, 0x5f1, 0x1cda, 0x403, - 0x1ea8, 0x1719, 0x1fc7, 0x2d23, 0x5ea, 0x25d1, 0xb6, 0x49c, 0xac7, 0x2d9c, 0x204e, 0x2142, - 0x11e8, 0xed0, 0x15f0, 0x514, 0xa3f, 0xf43, 0x1de5, 0x2d97, 0x1543, 0x2c7b, 0x241a, 0x2223, - 0x2fb8, 0x25b7, 0x1b4c, 0x2f36, 0x26e2, 0x100, 0x2555, 0x266c, 0x2e10, 0x271c, 0x5aa, 0x1789, - 0x2199, 0x291d, 0x1088, 0x2046, 0x1ea1, 0xf89, 0x1c7a, 0x1e98, 0x137, 0x1b65, 0x24ed, 0xf37, - 0x2ec3, 0xd0c, 0x7c7, 0x123f, 0xb2e, 0x1a97, 0x1a03, 0x1bcd, 0x3b2, 0x714, 0x2979, 0xaef, - 0x2b3c, 0x2d91, 0xe03, 0xe5b, 0x1fbc, 0xcae, 0x432, 0x23a4, 0xb1d, 0x1ccc, 0x1fb6, 0x2f58, - 0x2a5a, 0x723, 0x2c99, 0x2d70, 0xa, 0x263c, 0x2701, 0xdeb, 0x2d08, 0x1c34, 0x200c, 0x1e88, - 0x396, 0x18d5, 0x1c45, 0xc4, 0x18bc, 0x2cd7, 0x1744, 0x8f1, 0x1c5c, 0xbe6, 0x2a89, 0x17a0, - 0x207, 0x19ce, 0x2024, 0x23e3, 0x299b, 0x685, 0x2baf, 0x539, 0x2d49, 0x24b5, 0x158d, 0xfd, - 0x2a95, 0x24d, 0xab3, 0x1125, 0x12f9, 0x15ba, 0x6a8, 0x2c36, 0x6e7, 0x1044, 0x36e, 0xfe8, - 0x112d, 0x2717, 0x24a0, 0x1c09, 0xe1d, 0x828, 0x2f7, 0x1f5b, 0xfab, 0xcf6, 0x1332, 0x1c72, - 0x2683, 0x15ce, 0x1ad3, 0x1a36, 0x24c, 0xb33, 0x253f, 0x1583, 0x1d69, 0x29ec, 0xba7, 0x2f97, - 0x16df, 0x1068, 0xaee, 0xc4f, 0x153c, 0x24eb, 0x20cd, 0x1398, 0x2366, 0x11f9, 0xe77, 0x103d, - 0x260a, 0xce, 0xaea, 0x236b, 0x2b11, 0x5f8, 0xe4f, 0x750, 0x1569, 0x10f5, 0x284e, 0xa38, 0x2e06, - 0xe0, 0xeaa, 0x99e, 0x249b, 0x8eb, 0x2b97, 0x2fdf, 0x29c1, 0x1b00, 0x2fe3, 0x1d4f, 0x83f, - 0x2d06, 0x10e, 0x183f, 0x27ba, 0x132, 0xfbf, 0x296d, 0x154a, 0x40a, 0x2767, 0xad, 0xc09, 0x974, - 0x2821, 0x1e2e, 0x28d2, 0xfac, 0x3c4, 0x2f19, 0xdd4, 0x2ddf, 0x1e43, 0x1e90, 0x2dc9, 0x1144, - 0x28c3, 0x653, 0xf3c, 0x1e32, 0x2a4a, 0x391, 0x1123, 0xdb, 0x2da0, 0xe1e, 0x667, 0x23b5, 0x2039, - 0xa92, 0x1552, 0x5d3, 0x169a, 0x1f03, 0x1342, 0x2004, 0x1b5d, 0x2d01, 0x2e9b, 0x41f, 0x2bc7, - 0xa94, 0xd0, 0x2e6a, 0x2b38, 0x14ac, 0x2724, 0x3ba, 0x6bc, 0x18ac, 0x2da5, 0x213c, 0x2c5c, - 0xdd3, 0xaae, 0x2e08, 0x6cd, 0x1677, 0x2025, 0x1e1c, 0x5b4, 0xdc4, 0x60, 0x156c, 0x2669, 0x1c01, - 0x26ab, 0x1ebb, 0x26d4, 0x21e1, 0x156b, 0x567, 0x1a, 0x29ce, 0x23d4, 0x684, 0xb79, 0x1953, - 0x1046, 0x1d8c, 0x17b5, 0x1c28, 0x1ce5, 0x2478, 0x18d8, 0x1b16, 0x2c2f, 0x21c9, 0x19bb, 0xbbc, - 0x291b, 0x19f6, 0x1879, 0x2fe4, 0x58e, 0x294a, 0x19e8, 0x27c7, 0x2fba, 0x1a29, 0x2319, 0x1ecb, - 0x203b, 0x2f05, 0x2b82, 0x192f, 0x26aa, 0x2482, 0xaed, 0x1216, 0x708, 0x11a1, 0xc22, 0x908, - 0x28f8, 0x2427, 0x7f8, 0x172e, 0xf50, 0xaa8, 0x184a, 0x1f67, 0x22d1, 0xeba, 0x215b, 0xf47, - 0x2877, 0xd5e, 0x8dc, 0x20d, 0x2dae, 0x1d3e, 0x775, 0xbf3, 0x872, 0x2667, 0x1ff6, 0xd9f, 0x13c4, - 0x105, 0x65f, 0x21ec, 0x6dd, 0x1a09, 0xc6e, 0x1fd, 0x1426, 0xae3, 0x494, 0x2d82, 0x22cd, 0x25d6, - 0x11c1, 0x1c, 0x2cae, 0x141f, 0x110a, 0x147, 0x2657, 0x23fd, 0x2f39, 0x360, 0x2294, 0x1f1e, - 0xb73, 0xbfc, 0x2f17, 0x7ca, 0x2f63, 0xbf, 0x28c2, 0xc1a, 0x255e, 0x226e, 0x1aa8, 0x229e, - 0x161a, 0x273, 0x106d, 0x2c40, 0x7cf, 0x1408, 0x7d8, 0x100a, 0x759, 0x1db4, 0x24be, 0x2ebb, - 0xc17, 0x1894, 0x244e, 0x15bd, 0x748, 0x1fe9, 0x23d, 0x1da, 0x2be, 0x18a3, 0xc5c, 0x9f9, 0x3d5, - 0x2ce4, 0x54, 0x2abf, 0x279c, 0x1e81, 0x2d59, 0x2847, 0x23f4, 0xda8, 0xa20, 0x258, 0x1cfe, - 0x240c, 0x2c2e, 0x2790, 0x2dd5, 0x2bf2, 0x2e34, 0x1724, 0x211, 0x1009, 0x27b9, 0x6f9, 0x23d9, - 0x19a2, 0x627, 0x156d, 0x169e, 0x7e7, 0x30f, 0x24b6, 0x5c2, 0x1ce4, 0x28dd, 0x20, 0x16ab, - 0x1cce, 0x20a9, 0x2390, 0x2884, 0x2245, 0x5f7, 0xab7, 0x1b6a, 0x11e7, 0x2a53, 0x2f94, 0x294c, - 0x1ee5, 0x1364, 0x1b9a, 0xff7, 0x5eb, 0x2c30, 0x1c02, 0x5a1, 0x1b87, 0x2402, 0x1cc8, 0x2ee1, - 0x1fbe, 0x138c, 0x2487, 0x1bf8, 0xd96, 0x1d68, 0x2fb3, 0x1fc1, 0x1fcc, 0xd66, 0x953, 0x2141, - 0x157a, 0x2477, 0x18e3, 0x2f30, 0x75e, 0x1de1, 0x14b2, 0x2faa, 0x1697, 0x2334, 0x12d1, 0xb76, - 0x2aa8, 0x1e7a, 0xd5, 0x2c60, 0x26b8, 0x1753, 0x124a, 0x1f57, 0x1425, 0xd84, 0x1c05, 0x641, - 0xf3a, 0x1b8c, 0xd7d, 0x2f52, 0x2f4, 0xc73, 0x151b, 0x1589, 0x1819, 0x1b18, 0xb9b, 0x1ae9, - 0x2b1f, 0x2b44, 0x2f5a, 0x2d37, 0x2cb1, 0x26f5, 0x233e, 0x276f, 0x276, 0x1260, 0x2997, 0x9f2, - 0x1c15, 0x1694, 0x11ac, 0x1e6d, 0x1bef, 0x2966, 0x18b2, 0x4fa, 0x2044, 0x1b70, 0x1f3e, 0x221e, - 0x28ca, 0x1d56, 0x7ae, 0x98d, 0x238c, 0x17b8, 0xad3, 0x113f, 0x1f1b, 0x4d2, 0x1757, 0xcb1, - 0x2ef1, 0x2e02, 0x17fc, 0x2f11, 0x2a74, 0x2029, 0x700, 0x154e, 0x1cef, 0x226a, 0x21bf, 0x27a6, - 0x14bc, 0x2b2b, 0x2fc6, 0x13b6, 0x21e6, 0x1663, 0xcbd, 0x752, 0x1624, 0x881, 0x2fc0, 0x1276, - 0xa7f, 0x274f, 0x2b53, 0x670, 0x1fb7, 0x1e41, 0x2a1e, 0x2612, 0x297, 0x19de, 0x18b, 0x249, - 0x1c88, 0xe9e, 0x1ef1, 0x213, 0x47b, 0x1e20, 0x28c1, 0x1d5e, 0x977, 0x1dca, 0x990, 0x1df6, - 0x2b62, 0x870, 0x1f4, 0x1829, 0x1e0a, 0x46, 0x1b9f, 0x2102, 0x16b, 0x1b32, 0x568, 0x2050, - 0x15b4, 0x191a, 0x1dd0, 0x5df, 0x55c, 0x1d21, 0x19db, 0x12d9, 0xe96, 0x680, 0x2349, 0x9b9, - 0x155d, 0xe31, 0x249f, 0x20f8, 0xb30, 0x337, 0x2da3, 0x11c3, 0x248f, 0x1cf9, 0x10ee, 0x6d8, - 0x6eb, 0xa0d, 0x101b, 0x1ae4, 0x1801, 0x24cd, 0x813, 0x2e98, 0x1574, 0x50, 0x11da, 0x1802, - 0xf56, 0x1839, 0x219c, 0x105b, 0x43b, 0x2c9, 0x917, 0x14c1, 0x1b79, 0xdab, 0x2ab9, 0x265c, - 0x71a, 0x1d90, 0x89f, 0x2bc2, 0x2777, 0x1014, 0x1e64, 0x14b4, 0x692, 0xddb, 0x56e, 0x2190, - 0x2d1b, 0x1016, 0x12d6, 0x1c81, 0x2628, 0x4a1, 0x1268, 0x2597, 0x2926, 0x7c5, 0x1dcd, 0x53f, - 0x11a9, 0x1a41, 0x5a2, 0x1c65, 0x7e8, 0xd71, 0x29c8, 0x427, 0x32f, 0x5dc, 0x16b1, 0x2a1d, - 0x1787, 0x2224, 0x620, 0x6a4, 0x1351, 0x1038, 0xe6c, 0x111b, 0x2f13, 0x441, 0x2cfd, 0x2f2f, - 0xd25, 0x9b8, 0x1b24, 0x762, 0x19b6, 0x2611, 0x85e, 0xe37, 0x1f5, 0x503, 0x1c46, 0x23cc, 0x4bb, - 0x243e, 0x122b, 0x28e2, 0x133e, 0x2db9, 0xdb2, 0x1a5c, 0x29a9, 0xca, 0x2113, 0x13d1, 0x15ec, - 0x2079, 0x18da, 0x2d50, 0x2c45, 0xaa2, 0x135a, 0x800, 0x18f7, 0x17f3, 0x5fd, 0x1f5a, 0x2d0, - 0x2cd1, 0x9ee, 0x218b, 0x19fd, 0x53b, 0x28c5, 0xe33, 0x1911, 0x26cc, 0x2018, 0x2f88, 0x1b01, - 0x2637, 0x1cd9, 0x126b, 0x1a0b, 0x5b0, 0x24e0, 0xe82, 0xb1, 0x21f7, 0x1a16, 0x2f24, 0x1cb1, - 0x1f7d, 0x28a0, 0x167e, 0xc3, - ]; - NHS.iroots = [ - 0x2aac, 0x2292, 0x3a6, 0x139a, 0x272e, 0x60b, 0x96a, 0x244, 0x2b2a, 0x2a75, 0x1de6, 0x831, - 0x9b7, 0xf16, 0x2616, 0x1485, 0x2fd, 0x34f, 0xf5d, 0x1072, 0x108d, 0x2c9e, 0x2a3, 0xb64, 0xa19, - 0x538, 0x1a80, 0x1650, 0x1c51, 0x148f, 0x616, 0x185f, 0x1143, 0x2802, 0x88d, 0x1594, 0x1a24, - 0x12d7, 0x120e, 0xcb6, 0x2690, 0x54c, 0x880, 0x2a7b, 0x2c68, 0x780, 0x24, 0xff8, 0x951, 0x1d8, - 0x10d6, 0x2254, 0xee4, 0x2572, 0x2a1b, 0xcec, 0x224e, 0x2c82, 0x2570, 0x158f, 0xc0a, 0x2c54, - 0x208, 0x1bfa, 0x3ff, 0x5be, 0x151c, 0x123a, 0x682, 0x1846, 0x2b0f, 0x1e7b, 0x8cc, 0x185, 0x521, - 0x109, 0x1b53, 0x293c, 0x212d, 0x6fd, 0x19b8, 0x12f0, 0x2b8f, 0x1eb, 0x28aa, 0x2942, 0x893, - 0x83d, 0x1464, 0xb48, 0x1f6a, 0x299f, 0x2ffd, 0x18e5, 0xf2b, 0xf9a, 0x14ee, 0x287e, 0xc29, - 0x1f69, 0x144a, 0x515, 0x9ff, 0x2f06, 0x203, 0x2f18, 0x1b49, 0x1f77, 0xbc5, 0x1db9, 0x23a9, - 0x2115, 0x2e4c, 0x1382, 0x24f8, 0x55, 0x2fb6, 0x2ebd, 0x2061, 0x1c82, 0x1264, 0x1d86, 0x4c1, - 0x1675, 0x24a9, 0x17f6, 0x130d, 0x2dd1, 0x29d8, 0x9df, 0x277d, 0x1e6b, 0x17fd, 0x3c8, 0x1f46, - 0x19a7, 0x2f95, 0x19, 0x1981, 0x2536, 0x201d, 0x13ae, 0x1092, 0x1980, 0x11b2, 0x93d, 0x1fad, - 0x2cac, 0x2a79, 0x1bf3, 0x2907, 0x281, 0x29e9, 0xc14, 0xb07, 0x241e, 0xa7d, 0x6e8, 0x1f55, - 0x104e, 0x2818, 0xdd5, 0xa29, 0x1a6, 0x2614, 0x8f7, 0x2eac, 0x2e17, 0x1dbf, 0x16e5, 0x2255, - 0x24f2, 0x2059, 0x1e4b, 0x1d12, 0x1f7f, 0x1dc1, 0x2273, 0x2bf, 0x1d25, 0x10a4, 0x217c, 0x176e, - 0x29b1, 0x284d, 0x2002, 0x2534, 0xaf2, 0x1de0, 0x1588, 0x2935, 0x1c3e, 0x1204, 0x2f1, 0x20c2, - 0xcdd, 0x1689, 0xec9, 0x1c7, 0x247b, 0x2508, 0x2cc4, 0x6d7, 0x234f, 0x2bb, 0x609, 0x19d, 0x21da, - 0x2ee0, 0xa7c, 0x3cc, 0x2f20, 0x257c, 0x2ae2, 0x2f02, 0xee6, 0x26db, 0x690, 0x1820, 0xdf9, - 0x770, 0x72b, 0x1ca3, 0xe43, 0x1648, 0x174a, 0x143d, 0x19fc, 0x2732, 0x1d27, 0x2a40, 0x22ab, - 0x280, 0x133, 0x1553, 0x2ff5, 0xe29, 0xd2b, 0x1326, 0x2e3d, 0x2c7c, 0x1b0a, 0x144f, 0x21f8, - 0x2b72, 0x1a64, 0x2ce6, 0xf63, 0x1ec7, 0xbfd, 0x2954, 0xf53, 0x1730, 0x1386, 0x491, 0x212b, - 0x222e, 0x3a5, 0xec5, 0x25c, 0x1755, 0x2945, 0x2c47, 0x8dd, 0x1b55, 0x4c9, 0x197, 0x2f31, - 0x256d, 0x43a, 0x2be2, 0x166, 0x300, 0x14a4, 0xffd, 0x1cbf, 0x10fe, 0x1967, 0x2a2e, 0x1aaf, - 0x256f, 0xfc8, 0xc4c, 0x299a, 0x21e3, 0x261, 0x2f26, 0x1ede, 0x2c70, 0x5b7, 0x11cf, 0x20c5, - 0x29ae, 0x73e, 0x1ebd, 0x238, 0x1171, 0x11be, 0x222, 0x222d, 0xe8, 0x2c3d, 0x2055, 0x72f, - 0x11d3, 0x7e0, 0x268d, 0x23f8, 0x2f54, 0x89a, 0x2bf7, 0x1ab7, 0x694, 0x2042, 0x2ecf, 0x847, - 0x17c2, 0x2ef3, 0x2fb, 0x27c2, 0x12b2, 0x1e, 0x1501, 0x640, 0x22, 0x46a, 0x2716, 0xb66, 0x2663, - 0x2157, 0x2f21, 0x1fb, 0x25c9, 0x7b3, 0x1f0c, 0x1a98, 0x28b1, 0x21b2, 0x2a09, 0x4f0, 0xc96, - 0x2517, 0x2f33, 0x9f7, 0x1fc4, 0x218a, 0x1e08, 0xc9b, 0x1c69, 0xf34, 0xb16, 0x1ac5, 0x23b2, - 0x2513, 0x1f99, 0x1922, 0x6a, 0x245a, 0x615, 0x1298, 0x1a7e, 0xac2, 0x24ce, 0x2db5, 0x15cb, - 0x152e, 0x1a33, 0x97e, 0x138f, 0x1ccf, 0x230b, 0x2056, 0x10a6, 0x2d0a, 0x27d9, 0x21e4, 0x13f8, - 0xb61, 0x8ea, 0x1ed4, 0x2019, 0x2c93, 0x1fbd, 0x291a, 0x3cb, 0x2959, 0x1a47, 0x1d08, 0x1edc, - 0x254e, 0x2db4, 0x56c, 0x2f04, 0x1a74, 0xb4c, 0x2b8, 0x2ac8, 0x452, 0x297c, 0x666, 0xc1e, 0xfdd, - 0x1633, 0x2dfa, 0x1861, 0x578, 0x241b, 0x13a5, 0x2710, 0x18bd, 0x32a, 0x1745, 0x2f3d, 0x13bc, - 0x172c, 0x2c6b, 0x1179, 0xff5, 0x13cd, 0x2f9, 0x2216, 0x900, 0x9c5, 0x2ff7, 0x291, 0x368, - 0x28de, 0x5a7, 0xa9, 0x104b, 0x1335, 0x24e4, 0xc5d, 0x2bcf, 0x2353, 0x1045, 0x21a6, 0x21fe, - 0x270, 0x4c5, 0x2512, 0x688, 0x28ed, 0x2c4f, 0x1434, 0x15fe, 0x156a, 0x24d3, 0x1dc2, 0x283a, - 0x22f5, 0x13e, 0x20ca, 0xb14, 0x149c, 0x2eca, 0x1169, 0x1387, 0x2078, 0x1160, 0xfbb, 0x1f79, - 0x6e4, 0xe68, 0x1878, 0x2a57, 0x8e5, 0x1f1, 0x995, 0xaac, 0x2f01, 0x91f, 0xcb, 0x14b5, 0xa4a, - 0x49, 0xdde, 0xbe7, 0x386, 0x1abe, 0x26a, 0x121c, 0x20be, 0x25c2, 0x2aed, 0x1a11, 0x2131, - 0x1e19, 0xebf, 0xfb3, 0x265, 0x253a, 0x2b65, 0x2f4b, 0xa30, 0x2a17, 0x2de, 0x103a, 0x18e8, - 0x1159, 0x2bfe, 0x1327, 0x2a10, 0x2d61, 0x2fa7, 0x815, 0x1d41, 0xf02, 0x22c3, 0x66, 0xdcf, - 0x1540, 0x2f3e, 0x1983, 0x761, 0x1084, 0x1350, 0xdd, 0x15eb, 0xe0a, 0x2f50, 0x217f, 0xb21, - 0x2a51, 0x15f6, 0x1d96, 0x1328, 0x9ca, 0x1500, 0x79, 0xfe9, 0x935, 0x16f0, 0x21ce, 0x73c, - 0x2ac6, 0x1604, 0xe76, 0x2613, 0x330, 0x2d31, 0x10a7, 0x2a04, 0x180e, 0x170a, 0x2801, 0x1ca7, - 0x255f, 0x3bc, 0x2b1, 0x1727, 0xf88, 0x1a15, 0x1c30, 0xeee, 0x2f37, 0x658, 0x15a5, 0x224f, - 0x248, 0x1cc3, 0x71f, 0x1dd6, 0xbc3, 0x2b46, 0xc35, 0x13bb, 0x2afe, 0x2e0c, 0x21ca, 0x27a3, - 0x9f0, 0x164b, 0x289f, 0x14dd, 0x2649, 0x22dc, 0xd2, 0x304, 0x2bc0, 0xee, 0x1ee6, 0x2195, - 0x1fc9, 0x1cb0, 0x295d, 0x29e1, 0xddd, 0x187a, 0x5e4, 0x1950, 0x2a25, 0x2cd2, 0x2bda, 0x639, - 0x2290, 0x2819, 0x139c, 0x2a5f, 0x15c0, 0x1e58, 0x2ac2, 0x1234, 0x283c, 0x6db, 0xa6a, 0x1d99, - 0x2b60, 0x9d9, 0x1380, 0x1d2b, 0x1feb, 0x2e6, 0xe71, 0x2a93, 0x2226, 0x296f, 0x1b4d, 0x119d, - 0x1fed, 0x88a, 0x43f, 0x2762, 0x1271, 0x28e7, 0x9a5, 0x548, 0x2256, 0x1488, 0x1b40, 0x26ea, - 0x2d38, 0x2bc6, 0x1fa6, 0xe65, 0x17c8, 0x20ab, 0x17ff, 0x1e27, 0x2fb1, 0x1a8d, 0x169, 0x27ee, - 0xb34, 0x1800, 0x151d, 0x1fe6, 0x25f4, 0x2916, 0x2929, 0x1f13, 0x1308, 0xb72, 0x1e3e, 0x25e, - 0x2cca, 0x24d1, 0xf09, 0xb62, 0x21d0, 0x1aa4, 0x2648, 0xcb8, 0x2981, 0x216b, 0x1d28, 0x1626, - 0x12e0, 0x2aa5, 0x2a22, 0x1231, 0x16e7, 0x1a4d, 0xfb1, 0x2a99, 0x14cf, 0x2e96, 0xeff, 0x1462, - 0x2fbb, 0x11f7, 0x17d8, 0x2e0d, 0x2791, 0x49f, 0x120b, 0x2671, 0x1237, 0x268a, 0x12a3, 0x740, - 0x11e1, 0x2b86, 0x2dee, 0x1110, 0x2163, 0x1379, 0x2db8, 0x2e76, 0x1623, 0x2d6a, 0x9ef, 0x5e3, - 0x11c0, 0x104a, 0x2991, 0x4ae, 0x8b2, 0x2582, 0x1d8b, 0x41, 0x2780, 0x19dd, 0x28af, 0x2344, - 0x199e, 0xe1b, 0x1c4b, 0x3b, 0x4d6, 0x1b45, 0x85b, 0xe42, 0xd97, 0x1312, 0x1ab3, 0x2901, 0xfd8, - 0x58d, 0xf0, 0x1805, 0x1ff, 0x110, 0x2350, 0x18aa, 0x2b2f, 0x10e6, 0x1ec2, 0x252e, 0x1849, - 0xc75, 0x2674, 0x2853, 0x12ab, 0x737, 0xde3, 0x10c3, 0x1491, 0xfbd, 0x2b07, 0x174f, 0x69b, - 0x1412, 0x1194, 0x1e55, 0x196d, 0x13ec, 0x260f, 0x66a, 0x1da1, 0x2d8b, 0x892, 0xcc3, 0x90c, - 0x350, 0x2ca, 0xa7, 0x4bd, 0x4e2, 0x1518, 0x2466, 0x14e9, 0x17e8, 0x1a78, 0x1ae6, 0x238e, - 0x2d0d, 0xaf, 0x2284, 0x1475, 0x20c7, 0x29c0, 0x13fc, 0x227d, 0x1bdc, 0x10aa, 0x1db7, 0x18ae, - 0x949, 0x3a1, 0x2f2c, 0x1187, 0x559, 0x248b, 0x1d30, 0xccd, 0x196a, 0x57, 0x1b4f, 0x1220, - 0x28a3, 0xd1, 0x171e, 0xb8a, 0x1a87, 0xec0, 0x26ae, 0x229b, 0x1035, 0x1040, 0x4e, 0x1299, - 0x226b, 0x1409, 0xb7a, 0x1c75, 0x1043, 0x120, 0x1339, 0xbff, 0x147a, 0x2a60, 0x13ff, 0x3d1, - 0x2a16, 0x200a, 0x1467, 0x1c9d, 0x111c, 0x6b5, 0x6d, 0x5ae, 0x1e1a, 0x1497, 0x254a, 0x2a0a, - 0xdbc, 0x77d, 0xc71, 0xf58, 0x1333, 0x1956, 0x2fe1, 0x724, 0x131d, 0x2a3f, 0xb4b, 0x2cf2, - 0x281a, 0x1963, 0x1a94, 0x29da, 0x165f, 0xc28, 0x2908, 0x848, 0x1ff8, 0x2df0, 0x18dd, 0x1cd, - 0x40f, 0x22c, 0x871, 0x3d3, 0xbf5, 0x1303, 0x2da9, 0x25e1, 0x2259, 0xc0d, 0x7ba, 0x2a8, 0x1180, - 0x865, 0x542, 0x2fad, 0x31d, 0x2c2c, 0x2608, 0x23a5, 0x175e, 0x2d43, 0x2e27, 0x2dc4, 0x1018, - 0x28b9, 0x1a44, 0xbb3, 0x176d, 0x23ea, 0x146, 0xb43, 0x124d, 0x28a8, 0x1ff7, 0x2829, 0x1bf9, - 0x2832, 0x3c1, 0x1f94, 0x2d8e, 0x19e7, 0xd63, 0x1559, 0xd93, 0xaa3, 0x23e7, 0x73f, 0x2f42, 0x9e, - 0x2837, 0xea, 0x2405, 0x248e, 0x10e3, 0xd6d, 0x2ca1, 0xc8, 0xc04, 0x9aa, 0x2eba, 0x1ef7, 0x1be2, - 0x353, 0x2fe5, 0x1e40, 0xa2b, 0xd34, 0x27f, 0x2b6d, 0x251e, 0x1bdb, 0x2e04, 0x2393, 0x15f8, - 0x2924, 0xe15, 0x29a2, 0x2efc, 0x1c3d, 0x2262, 0x100b, 0x99a, 0x278f, 0x240e, 0x288c, 0x12c3, - 0x253, 0x2df4, 0x2725, 0x22a3, 0x78a, 0x20ba, 0xea6, 0x2147, 0xd30, 0x109a, 0x17b7, 0x2559, - 0x20b1, 0x18d3, 0x2809, 0xbda, 0x709, 0x26f9, 0x23df, 0x1e60, 0x28f9, 0x1deb, 0x2514, 0xb7f, - 0x957, 0x16d2, 0x47f, 0xfc, 0xfc6, 0x1136, 0xce8, 0x15d8, 0x47, 0x83a, 0x1619, 0x6b7, 0x2a73, - 0x1d, 0x1788, 0x160b, 0x6e6, 0x2445, 0x1646, 0xe38, 0x3d2, 0x14eb, 0x1729, 0xb89, 0x131c, - 0x13d9, 0x184c, 0x1275, 0x1fbb, 0x16ae, 0x2488, 0x297d, 0xc2d, 0x633, 0x2fe7, 0x2a9a, 0x1a96, - 0xe20, 0x92d, 0x1146, 0x956, 0x1400, 0x998, 0x1a95, 0x2fa1, 0x223d, 0x2a4d, 0x11e5, 0xfdc, - 0x198a, 0x2934, 0x1f9, 0x2553, - ]; - - return NHS; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.NHS = NHS; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/pair.js b/packages/bls-verify/src/vendor/amcl-js/src/pair.js deleted file mode 100644 index 057dbe517..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/pair.js +++ /dev/null @@ -1,1076 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var PAIR = function (ctx) { - 'use strict'; - - var PAIR = { - dbl: function (A, AA, BB, CC) { - CC.copy(A.getx()); - var YY = new ctx.FP2(A.gety()); - BB.copy(A.getz()); - AA.copy(YY); - - AA.mul(BB); //YZ - CC.sqr(); //X^2 - YY.sqr(); //Y^2 - BB.sqr(); //Z^2 - - AA.add(AA); - AA.neg(); - AA.norm(); //-2AA - AA.mul_ip(); - AA.norm(); - - var sb = 3 * ctx.ROM_CURVE.CURVE_B_I; - BB.imul(sb); - CC.imul(3); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - YY.mul_ip(); - YY.norm(); - CC.mul_ip(); - CC.norm(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - BB.mul_ip(); - BB.norm(); - } - BB.sub(YY); - BB.norm(); - - A.dbl(); - }, - - add: function (A, B, AA, BB, CC) { - AA.copy(A.getx()); // X1 - CC.copy(A.gety()); // Y1 - var T1 = new ctx.FP2(A.getz()); // Z1 - BB.copy(A.getz()); // Z1 - - T1.mul(B.gety()); // T1=Z1.Y2 - BB.mul(B.getx()); // T2=Z1.X2 - - AA.sub(BB); - AA.norm(); // X1=X1-Z1.X2 - CC.sub(T1); - CC.norm(); // Y1=Y1-Z1.Y2 - - T1.copy(AA); // T1=X1-Z1.X2 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - AA.mul_ip(); - AA.norm(); - } - - T1.mul(B.gety()); // T1=(X1-Z1.X2).Y2 - - BB.copy(CC); // T2=Y1-Z1.Y2 - BB.mul(B.getx()); // T2=(Y1-Z1.Y2).X2 - BB.sub(T1); - BB.norm(); // T2=(Y1-Z1.Y2).X2 - (X1-Z1.X2).Y2 - CC.neg(); - CC.norm(); // Y1=-(Y1-Z1.Y2).Xs - - A.add(B); - }, - - /* Line function */ - line: function (A, B, Qx, Qy) { - var r = new ctx.FP12(1); - - var a, b, c; - var AA = new ctx.FP2(0); - var BB = new ctx.FP2(0); - var CC = new ctx.FP2(0); - if (A == B) PAIR.dbl(A, AA, BB, CC); - else PAIR.add(A, B, AA, BB, CC); - - CC.pmul(Qx); - AA.pmul(Qy); - - a = new ctx.FP4(AA, BB); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP4(CC); // L(0,1) | L(0,0) | L(1,0) - c = new ctx.FP4(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP4(0); - c = new ctx.FP4(CC); - c.times_i(); - } - - r.set(a, b, c); - r.settype(ctx.FP.SPARSER); - - return r; - }, - - /* prepare for multi-pairing */ - initmp: function () { - var r = []; - for (var i = 0; i < ctx.ECP.ATE_BITS; i++) r[i] = new ctx.FP12(1); - return r; - }, - - /* basic Miller loop */ - miller: function (r) { - var res = new ctx.FP12(1); - for (var i = ctx.ECP.ATE_BITS - 1; i >= 1; i--) { - res.sqr(); - res.ssmul(r[i]); - r[i].zero(); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) res.conj(); - res.ssmul(r[0]); - r[0].zero(); - - return res; - }, - - // Store precomputed line details in an FP4 - pack: function (AA, BB, CC) { - var i = new ctx.FP2(CC); - i.inverse(null); - var a = new ctx.FP2(AA); - a.mul(i); - var b = new ctx.FP2(BB); - b.mul(i); - return new ctx.FP4(a, b); - }, - - unpack: function (T, Qx, Qy) { - var a, b, c; - a = new ctx.FP4(T); - a.geta().pmul(Qy); - var t = new ctx.FP2(Qx); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP4(t); - c = new ctx.FP4(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP4(0); - c = new ctx.FP4(t); - c.times_i(); - } - var v = new ctx.FP12(a, b, c); - v.settype(ctx.FP.SPARSEST); - return v; - }, - - precomp: function (GV) { - var f; - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR.lbits(n3, n); - var P = new ctx.ECP2(); - P.copy(GV); - var AA = new ctx.FP2(0); - var BB = new ctx.FP2(0); - var CC = new ctx.FP2(0); - var j, bt; - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - var A = new ctx.ECP2(); - A.copy(P); - var MP = new ctx.ECP2(); - MP.copy(P); - MP.neg(); - j = 0; - - var T = []; - for (var i = nb - 2; i >= 1; i--) { - PAIR.dbl(A, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - PAIR.add(A, P, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - } - if (bt == -1) { - PAIR.add(A, MP, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - } - } - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - } - var K = new ctx.ECP2(); - K.copy(P); - K.frob(f); - PAIR.add(A, K, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - K.frob(f); - K.neg(); - PAIR.add(A, K, AA, BB, CC); - T[j++] = PAIR.pack(AA, BB, CC); - } - return T; - }, - - /* Accumulate another set of line functions for n-pairing, assuming precomputation on G2 */ - another_pc(r, T, QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR.lbits(n3, n); - var lv, lv2; - var j, bt; - - if (QV.is_infinity()) return; - - var Q = new ctx.ECP(); - Q.copy(QV); - Q.affine(); - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - j = 0; - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR.unpack(T[j++], Qx, Qy); - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - lv = PAIR.unpack(T[j++], Qx, Qy); - lv2 = PAIR.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - r[0].ssmul(lv); - } - }, - - /* Accumulate another set of line functions for n-pairing */ - another: function (r, P1, Q1) { - var f; - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var K = new ctx.ECP2(); - var lv, lv2; - var bt; - - if (Q1.is_infinity()) return; - // P is needed in affine form for line function, Q for (Qx,Qy) extraction - var P = new ctx.ECP2(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - P.affine(); - Q.affine(); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - var A = new ctx.ECP2(); - A.copy(P); - - var MP = new ctx.ECP2(); - MP.copy(P); - MP.neg(); - - var nb = PAIR.lbits(n3, n); - - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR.line(A, A, Qx, Qy); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR.line(A, MP, Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - - /* R-ate fixup required for BN curves */ - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - } - K.copy(P); - K.frob(f); - lv = PAIR.line(A, K, Qx, Qy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(A, K, Qx, Qy); - lv.smul(lv2); - r[0].ssmul(lv); - } - }, - - /* Optimal R-ate pairing */ - ate: function (P1, Q1) { - var fa, fb, f, n, n3, K, lv, lv2, Qx, Qy, A, NP, r, nb, bt, i; - - if (Q1.is_infinity()) return new ctx.FP12(1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - K = new ctx.ECP2(); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - - var P = new ctx.ECP2(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - A = new ctx.ECP2(); - r = new ctx.FP12(1); - A.copy(P); - - NP = new ctx.ECP2(); - NP.copy(P); - NP.neg(); - - nb = PAIR.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR.line(A, A, Qx, Qy); - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv2 = PAIR.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR.line(A, NP, Qx, Qy); - lv.smul(lv2); - } - r.ssmul(lv); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - /* R-ate fixup */ - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - } - - K.copy(P); - K.frob(f); - - lv = PAIR.line(A, K, Qx, Qy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(A, K, Qx, Qy); - lv.smul(lv2); - r.ssmul(lv); - } - - return r; - }, - - /* Optimal R-ate double pairing e(P,Q).e(R,S) */ - - ate2: function (P1, Q1, R1, S1) { - var fa, fb, f, n, n3, K, lv, lv2, Qx, Qy, Sx, Sy, A, B, NP, NR, r, nb, bt, i; - - if (Q1.is_infinity()) return PAIR.ate(R1, S1); - if (S1.is_infinity()) return PAIR.ate(P1, Q1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - K = new ctx.ECP2(); - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - } - - var P = new ctx.ECP2(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - var R = new ctx.ECP2(); - R.copy(R1); - R.affine(); - var S = new ctx.ECP(); - S.copy(S1); - S.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - Sx = new ctx.FP(S.getx()); - Sy = new ctx.FP(S.gety()); - - A = new ctx.ECP2(); - B = new ctx.ECP2(); - r = new ctx.FP12(1); - - A.copy(P); - B.copy(R); - - NP = new ctx.ECP2(); - NP.copy(P); - NP.neg(); - NR = new ctx.ECP2(); - NR.copy(R); - NR.neg(); - - nb = PAIR.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR.line(A, A, Qx, Qy); - lv2 = PAIR.line(B, B, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv = PAIR.line(A, P, Qx, Qy); - lv2 = PAIR.line(B, R, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - if (bt == -1) { - lv = PAIR.line(A, NP, Qx, Qy); - lv2 = PAIR.line(B, NR, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - // R-ate fixup required for BN curves - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - A.neg(); - B.neg(); - } - K.copy(P); - K.frob(f); - - lv = PAIR.line(A, K, Qx, Qy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(A, K, Qx, Qy); - lv.smul(lv2); - r.ssmul(lv); - - K.copy(R); - K.frob(f); - - lv = PAIR.line(B, K, Sx, Sy); - K.frob(f); - K.neg(); - lv2 = PAIR.line(B, K, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - - return r; - }, - - /* final exponentiation - keep separate for multi-pairings */ - fexp: function (m) { - var fa, fb, f, x, r, lv; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - r = new ctx.FP12(m); - - /* Easy part of final exp */ - lv = new ctx.FP12(r); - lv.inverse(); - r.conj(); - r.mul(lv); - lv.copy(r); - r.frob(f); - r.frob(f); - r.mul(lv); - - /* Hard part of final exp */ - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - var x0, x1, x2, x3, x4, x5; - - lv.copy(r); - lv.frob(f); - x0 = new ctx.FP12(lv); //x0.copy(lv); - x0.frob(f); - lv.mul(r); - x0.mul(lv); - x0.frob(f); - x1 = new ctx.FP12(r); //x1.copy(r); - x1.conj(); - - x4 = r.pow(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - x4.conj(); - } - - x3 = new ctx.FP12(x4); //x3.copy(x4); - x3.frob(f); - x2 = x4.pow(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - x2.conj(); - } - x5 = new ctx.FP12(x2); /*x5.copy(x2);*/ - x5.conj(); - lv = x2.pow(x); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - lv.conj(); - } - x2.frob(f); - r.copy(x2); - r.conj(); - - x4.mul(r); - x2.frob(f); - - r.copy(lv); - r.frob(f); - lv.mul(r); - - lv.usqr(); - lv.mul(x4); - lv.mul(x5); - r.copy(x3); - r.mul(x5); - r.mul(lv); - lv.mul(x2); - r.usqr(); - r.mul(lv); - r.usqr(); - lv.copy(r); - lv.mul(x1); - r.mul(x0); - lv.usqr(); - r.mul(lv); - r.reduce(); - } else { - // See https://eprint.iacr.org/2020/875.pdf - var t0, y0, y1; - y1 = new ctx.FP12(r); - y1.usqr(); - y1.mul(r); // y1=r^3 - - y0 = new ctx.FP12(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0 = new ctx.FP12(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - // ^(x+p) - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.frob(f); - r.copy(y0); - r.mul(t0); - - // ^(x^2+p^2-1) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f); - t0.frob(f); - y0.mul(t0); - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - r.mul(y1); - r.reduce(); - - /* - var y0, y1, y2, y3; - // Ghamman & Fouotsa Method - y0 = new ctx.FP12(r); - y0.usqr(); - y1 = y0.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y1.conj(); - } - x.fshr(1); - y2 = y1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y2.conj(); - } - x.fshl(1); - y3 = new ctx.FP12(r); - y3.conj(); - y1.mul(y3); - - y1.conj(); - y1.mul(y2); - - y2 = y1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y2.conj(); - } - - y3 = y2.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y3.conj(); - } - y1.conj(); - y3.mul(y1); - - y1.conj(); - y1.frob(f); - y1.frob(f); - y1.frob(f); - y2.frob(f); - y2.frob(f); - y1.mul(y2); - - y2 = y3.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - y2.conj(); - } - y2.mul(y0); - y2.mul(r); - - y1.mul(y2); - y2.copy(y3); - y2.frob(f); - y1.mul(y2); - r.copy(y1); - r.reduce(); -*/ - } - - return r; - }, - }; - - /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */ - PAIR.lbits = function (n3, n) { - n.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - n.pmul(6); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.POSITIVEX) { - n.inc(2); - } else { - n.dec(2); - } - } - - n.norm(); - n3.copy(n); - n3.pmul(3); - n3.norm(); - return n3.nbits(); - }; - - /* GLV method */ - PAIR.glv = function (e) { - var u = [], - t, - q, - v, - d, - x, - x2, - i, - j; - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - t = new ctx.BIG(0); - q = new ctx.BIG(0); - v = []; - - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - for (i = 0; i < 2; i++) { - t.rcopy(ctx.ROM_CURVE.CURVE_W[i]); - d = ctx.BIG.mul(t, e); - v[i] = new ctx.BIG(d.div(q)); - u[i] = new ctx.BIG(0); - } - - u[0].copy(e); - - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - t.rcopy(ctx.ROM_CURVE.CURVE_SB[j][i]); - t.copy(ctx.BIG.modmul(v[j], t, q)); - u[i].add(q); - u[i].sub(t); - u[i].mod(q); - } - } - } else { - // -(x^2).P = (Beta.x,y) - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - x2 = ctx.BIG.smul(x, x); - u[0] = new ctx.BIG(e); - u[0].mod(x2); - u[1] = new ctx.BIG(e); - u[1].div(x2); - u[1].rsub(q); - } - - return u; - }; - - /* Galbraith & Scott Method */ - PAIR.gs = function (e) { - var u = [], - i, - j, - t, - q, - v, - d, - x, - w; - - if (ctx.ECP.CURVE_PAIRING_TYPE == ctx.ECP.BN) { - t = new ctx.BIG(0); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - v = []; - - for (i = 0; i < 4; i++) { - t.rcopy(ctx.ROM_CURVE.CURVE_WB[i]); - d = ctx.BIG.mul(t, e); - v[i] = new ctx.BIG(d.div(q)); - u[i] = new ctx.BIG(0); - } - - u[0].copy(e); - - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - t.rcopy(ctx.ROM_CURVE.CURVE_BB[j][i]); - t.copy(ctx.BIG.modmul(v[j], t, q)); - u[i].add(q); - u[i].sub(t); - u[i].mod(q); - } - } - } else { - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - w = new ctx.BIG(e); - - for (i = 0; i < 3; i++) { - u[i] = new ctx.BIG(w); - u[i].mod(x); - w.div(x); - } - - u[3] = new ctx.BIG(w); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - u[1].copy(ctx.BIG.modneg(u[1], q)); - u[3].copy(ctx.BIG.modneg(u[3], q)); - } - } - - return u; - }; - - /* Multiply P by e in group G1 */ - PAIR.G1mul = function (P, e) { - var R, Q, q, bcru, cru, t, u, np, nn; - - if (ctx.ROM_CURVE.USE_GLV) { - R = new ctx.ECP(); - R.copy(P); - Q = new ctx.ECP(); - Q.copy(P); - Q.affine(); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - bcru = new ctx.BIG(0); - bcru.rcopy(ctx.ROM_FIELD.CRu); - cru = new ctx.FP(bcru); - t = new ctx.BIG(0); - u = PAIR.glv(e); - - Q.getx().mul(cru); - - np = u[0].nbits(); - t.copy(ctx.BIG.modneg(u[0], q)); - nn = t.nbits(); - if (nn < np) { - u[0].copy(t); - R.neg(); - } - - np = u[1].nbits(); - t.copy(ctx.BIG.modneg(u[1], q)); - nn = t.nbits(); - if (nn < np) { - u[1].copy(t); - Q.neg(); - } - u[0].norm(); - u[1].norm(); - R = R.mul2(u[0], Q, u[1]); - } else { - R = P.mul(e); - } - - return R; - }; - - /* Multiply P by e in group G2 */ - PAIR.G2mul = function (P, e) { - var R, Q, fa, fb, f, q, u, t, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_G2) { - Q = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - f.inverse(null); - f.norm(); - } - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - u = PAIR.gs(e); - t = new ctx.BIG(0); - Q[0] = new ctx.ECP2(); - Q[0].copy(P); - - for (i = 1; i < 4; i++) { - Q[i] = new ctx.ECP2(); - Q[i].copy(Q[i - 1]); - Q[i].frob(f); - } - - for (i = 0; i < 4; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - Q[i].neg(); - } - u[i].norm(); - } - - R = ctx.ECP2.mul4(Q, u); - } else { - R = P.mul(e); - } - return R; - }; - - /* Note that this method requires a lot of RAM! Better to use compressed XTR method, see ctx.FP4.js */ - PAIR.GTpow = function (d, e) { - var r, g, fa, fb, f, q, t, u, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_GT) { - g = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - t = new ctx.BIG(0); - u = PAIR.gs(e); - - g[0] = new ctx.FP12(d); - - for (i = 1; i < 4; i++) { - g[i] = new ctx.FP12(0); - g[i].copy(g[i - 1]); - g[i].frob(f); - } - - for (i = 0; i < 4; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - g[i].conj(); - } - u[i].norm(); - } - - r = ctx.FP12.pow4(g, u); - } else { - r = d.pow(e); - } - - return r; - }; - - /* test G1 group membership */ - PAIR.G1member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR.G1mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test G2 group membership */ - PAIR.G2member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR.G2mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test group membership - no longer needed */ - /* Check that m!=1, conj(m)*m==1, and m.m^{p^4}=m^{p^2} */ - - PAIR.GTmember = function (m) { - if (m.isunity()) return false; - var r = new ctx.FP12(m); - r.conj(); - r.mul(m); - if (!r.isunity()) return false; - - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - var f = new ctx.FP2(fa, fb); - - r.copy(m); - r.frob(f); - r.frob(f); - var w = new ctx.FP12(r); - w.frob(f); - w.frob(f); - w.mul(m); - if (!w.equals(r)) return false; - - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - w.copy(m); - r.copy(PAIR.GTpow(w, q)); - if (!r.isunity()) return false; - return true; - }; - - return PAIR; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.PAIR = PAIR; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/pair4.js b/packages/bls-verify/src/vendor/amcl-js/src/pair4.js deleted file mode 100644 index 3eac108d0..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/pair4.js +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var PAIR4 = function (ctx) { - 'use strict'; - var PAIR4 = { - dbl: function (A, AA, BB, CC) { - CC.copy(A.getx()); - var YY = new ctx.FP4(A.gety()); - BB.copy(A.getz()); - AA.copy(YY); - - AA.mul(BB); //YZ - CC.sqr(); //X^2 - YY.sqr(); //Y^2 - BB.sqr(); //Z^2 - - AA.add(AA); - AA.neg(); - AA.norm(); //-2AA - AA.times_i(); - - var sb = 3 * ctx.ROM_CURVE.CURVE_B_I; - BB.imul(sb); - CC.imul(3); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - YY.times_i(); - CC.times_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - BB.times_i(); - } - BB.sub(YY); - BB.norm(); - - A.dbl(); - }, - - add: function (A, B, AA, BB, CC) { - AA.copy(A.getx()); // X1 - CC.copy(A.gety()); // Y1 - var T1 = new ctx.FP4(A.getz()); // Z1 - BB.copy(A.getz()); // Z1 - - T1.mul(B.gety()); // T1=Z1.Y2 - BB.mul(B.getx()); // T2=Z1.X2 - - AA.sub(BB); - AA.norm(); // X1=X1-Z1.X2 - CC.sub(T1); - CC.norm(); // Y1=Y1-Z1.Y2 - - T1.copy(AA); // T1=X1-Z1.X2 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - AA.times_i(); - AA.norm(); - } - - T1.mul(B.gety()); // T1=(X1-Z1.X2).Y2 - - BB.copy(CC); // T2=Y1-Z1.Y2 - BB.mul(B.getx()); // T2=(Y1-Z1.Y2).X2 - BB.sub(T1); - BB.norm(); // T2=(Y1-Z1.Y2).X2 - (X1-Z1.X2).Y2 - CC.neg(); - CC.norm(); // Y1=-(Y1-Z1.Y2).Xs - - A.add(B); - }, - - /* Line function */ - line: function (A, B, Qx, Qy) { - var r = new ctx.FP24(1); - - var a, b, c; - var AA = new ctx.FP4(0); - var BB = new ctx.FP4(0); - var CC = new ctx.FP4(0); - if (A == B) PAIR4.dbl(A, AA, BB, CC); - else PAIR4.add(A, B, AA, BB, CC); - - CC.qmul(Qx); - AA.qmul(Qy); - - a = new ctx.FP8(AA, BB); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP8(CC); // L(0,1) | L(0,0) | L(1,0) - c = new ctx.FP8(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP8(0); - c = new ctx.FP8(CC); - c.times_i(); - } - - r.set(a, b, c); - r.settype(ctx.FP.SPARSER); - - return r; - }, - - /* prepare for multi-pairing */ - initmp: function () { - var r = []; - for (var i = 0; i < ctx.ECP.ATE_BITS; i++) r[i] = new ctx.FP24(1); - return r; - }, - - /* basic Miller loop */ - miller: function (r) { - var res = new ctx.FP24(1); - for (var i = ctx.ECP.ATE_BITS - 1; i >= 1; i--) { - res.sqr(); - res.ssmul(r[i]); - r[i].zero(); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) res.conj(); - res.ssmul(r[0]); - r[0].zero(); - - return res; - }, - - // Store precomputed line details in an FP8 - pack: function (AA, BB, CC) { - var i = new ctx.FP4(CC); - i.inverse(null); - var a = new ctx.FP4(AA); - a.mul(i); - var b = new ctx.FP4(BB); - b.mul(i); - return new ctx.FP8(a, b); - }, - - unpack: function (T, Qx, Qy) { - var a, b, c; - a = new ctx.FP8(T); - a.geta().qmul(Qy); - var t = new ctx.FP4(Qx); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP8(t); - c = new ctx.FP8(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP8(0); - c = new ctx.FP8(t); - c.times_i(); - } - var v = new ctx.FP24(a, b, c); - v.settype(ctx.FP.SPARSEST); - return v; - }, - - precomp: function (QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR4.lbits(n3, n); - var P = new ctx.ECP4(); - P.copy(QV); - var AA = new ctx.FP4(0); - var BB = new ctx.FP4(0); - var CC = new ctx.FP4(0); - var j, bt; - - var A = new ctx.ECP4(); - A.copy(P); - var MP = new ctx.ECP4(); - MP.copy(P); - MP.neg(); - j = 0; - - var T = []; - for (var i = nb - 2; i >= 1; i--) { - PAIR4.dbl(A, AA, BB, CC); - T[j++] = PAIR4.pack(AA, BB, CC); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - PAIR4.add(A, P, AA, BB, CC); - T[j++] = PAIR4.pack(AA, BB, CC); - } - if (bt == -1) { - PAIR4.add(A, MP, AA, BB, CC); - T[j++] = PAIR4.pack(AA, BB, CC); - } - } - return T; - }, - - /* Accumulate another set of line functions for n-pairing, assuming precomputation on G2 */ - another_pc(r, T, QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR4.lbits(n3, n); - var lv, lv2; - var j, bt; - - if (QV.is_infinity()) return; - - var Q = new ctx.ECP(); - Q.copy(QV); - Q.affine(); - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - j = 0; - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR4.unpack(T[j++], Qx, Qy); - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR4.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR4.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Accumulate another set of line functions for n-pairing */ - another: function (r, P1, Q1) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var lv, lv2; - var bt; - - if (Q1.is_infinity()) return; - // P is needed in affine form for line function, Q for (Qx,Qy) extraction - var P = new ctx.ECP4(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - P.affine(); - Q.affine(); - - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - var A = new ctx.ECP4(); - A.copy(P); - - var MP = new ctx.ECP4(); - MP.copy(P); - MP.neg(); - - var nb = PAIR4.lbits(n3, n); - - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR4.line(A, A, Qx, Qy); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR4.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR4.line(A, MP, Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Optimal R-ate pairing */ - ate: function (P1, Q1) { - var n, n3, lv, lv2, Qx, Qy, A, NP, r, nb, bt, i; - - if (Q1.is_infinity()) return new ctx.FP24(1); - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP4(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - A = new ctx.ECP4(); - r = new ctx.FP24(1); - - A.copy(P); - NP = new ctx.ECP4(); - NP.copy(P); - NP.neg(); - - nb = PAIR4.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR4.line(A, A, Qx, Qy); - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv2 = PAIR4.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR4.line(A, NP, Qx, Qy); - lv.smul(lv2); - } - r.ssmul(lv); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* Optimal R-ate double pairing e(P,Q).e(R,S) */ - ate2: function (P1, Q1, R1, S1) { - var n, n3, lv, lv2, Qx, Qy, Sx, Sy, A, B, NP, NR, r, nb, bt, i; - - if (Q1.is_infinity()) return PAIR4.ate(R1, S1); - if (S1.is_infinity()) return PAIR4.ate(P1, Q1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP4(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - var R = new ctx.ECP4(); - R.copy(R1); - R.affine(); - var S = new ctx.ECP(); - S.copy(S1); - S.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - Sx = new ctx.FP(S.getx()); - Sy = new ctx.FP(S.gety()); - - A = new ctx.ECP4(); - B = new ctx.ECP4(); - r = new ctx.FP24(1); - - A.copy(P); - B.copy(R); - NP = new ctx.ECP4(); - NP.copy(P); - NP.neg(); - NR = new ctx.ECP4(); - NR.copy(R); - NR.neg(); - - nb = PAIR4.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR4.line(A, A, Qx, Qy); - lv2 = PAIR4.line(B, B, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv = PAIR4.line(A, P, Qx, Qy); - lv2 = PAIR4.line(B, R, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - if (bt == -1) { - lv = PAIR4.line(A, NP, Qx, Qy); - lv2 = PAIR4.line(B, NR, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */ - fexp: function (m) { - var fa, fb, f, x, r, lv; - // t0,t1,t2,t3,t4,t5,t6,t7; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - r = new ctx.FP24(m); //r.copy(m); - - /* Easy part of final exp */ - lv = new ctx.FP24(r); //lv.copy(r); - lv.inverse(); - r.conj(); - r.mul(lv); - lv.copy(r); - r.frob(f, 4); - r.mul(lv); - - /* Hard part of final exp */ - // See https://eprint.iacr.org/2020/875.pdf - var t0, y0, y1; - y1 = new ctx.FP24(r); - y1.usqr(); - y1.mul(r); // y1=r^3 - - y0 = new ctx.FP24(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0 = new ctx.FP24(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - // ^(x+p) - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.frob(f, 1); - r.copy(y0); - r.mul(t0); - - // ^(x^2+p^2) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 2); - r.copy(y0); - r.mul(t0); - - // ^(x^4+p^4-1) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 4); - y0.mul(t0); - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - r.mul(y1); - r.reduce(); - - /* - // Ghamman & Fouotsa Method - t7=new ctx.FP24(r); t7.usqr(); - t1=t7.pow(x); - - x.fshr(1); - t2=t1.pow(x); - x.fshl(1); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - t3=new ctx.FP24(t1); t3.conj(); - t2.mul(t3); - t2.mul(r); - - t3=t2.pow(x); - t4=t3.pow(x); - t5=t4.pow(x); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t3.conj(); t5.conj(); - } - - t3.frob(f,6); t4.frob(f,5); - t3.mul(t4); - - t6=t5.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t6.conj(); - } - - t5.frob(f,4); - t3.mul(t5); - - t0=new ctx.FP24(t2); t0.conj(); - t6.mul(t0); - - t5.copy(t6); - t5.frob(f,3); - - t3.mul(t5); - t5=t6.pow(x); - t6=t5.pow(x); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t5.conj(); - } - - t0.copy(t5); - t0.frob(f,2); - t3.mul(t0); - t0.copy(t6); - t0.frob(f,1); - - t3.mul(t0); - t5=t6.pow(x); - - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t5.conj(); - } - t2.frob(f,7); - - t5.mul(t7); - t3.mul(t2); - t3.mul(t5); - - r.mul(t3); - - r.reduce(); -*/ - return r; - }, - }; - - /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */ - PAIR4.lbits = function (n3, n) { - n.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - n3.copy(n); - n3.pmul(3); - n3.norm(); - return n3.nbits(); - }; - - /* GLV method */ - PAIR4.glv = function (e) { - var u = [], - q, - x, - x2; - - // -(x^2).P = (Beta.x,y) - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - x2 = ctx.BIG.smul(x, x); - x = ctx.BIG.smul(x2, x2); - u[0] = new ctx.BIG(e); - u[0].mod(x); - u[1] = new ctx.BIG(e); - u[1].div(x); - u[1].rsub(q); - - return u; - }; - - /* Galbraith & Scott Method */ - PAIR4.gs = function (e) { - var u = [], - i, - q, - x, - w; - - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - w = new ctx.BIG(e); - - for (i = 0; i < 7; i++) { - u[i] = new ctx.BIG(w); - u[i].mod(x); - w.div(x); - } - - u[7] = new ctx.BIG(w); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - u[1].copy(ctx.BIG.modneg(u[1], q)); - u[3].copy(ctx.BIG.modneg(u[3], q)); - u[5].copy(ctx.BIG.modneg(u[5], q)); - u[7].copy(ctx.BIG.modneg(u[7], q)); - } - - return u; - }; - - /* Multiply P by e in group G1 */ - PAIR4.G1mul = function (P, e) { - var R, Q, q, bcru, cru, t, u, np, nn; - - if (ctx.ROM_CURVE.USE_GLV) { - R = new ctx.ECP(); - R.copy(P); - Q = new ctx.ECP(); - Q.copy(P); - Q.affine(); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - bcru = new ctx.BIG(0); - bcru.rcopy(ctx.ROM_FIELD.CRu); - cru = new ctx.FP(bcru); - t = new ctx.BIG(0); - u = PAIR4.glv(e); - - Q.getx().mul(cru); - - np = u[0].nbits(); - t.copy(ctx.BIG.modneg(u[0], q)); - nn = t.nbits(); - if (nn < np) { - u[0].copy(t); - R.neg(); - } - - np = u[1].nbits(); - t.copy(ctx.BIG.modneg(u[1], q)); - nn = t.nbits(); - if (nn < np) { - u[1].copy(t); - Q.neg(); - } - u[0].norm(); - u[1].norm(); - R = R.mul2(u[0], Q, u[1]); - } else { - R = P.mul(e); - } - - return R; - }; - - /* Multiply P by e in group G2 */ - PAIR4.G2mul = function (P, e) { - var R, Q, F, q, u, t, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_G2) { - Q = []; - F = ctx.ECP4.frob_constants(); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - u = PAIR4.gs(e); - t = new ctx.BIG(0); - - Q[0] = new ctx.ECP4(); - Q[0].copy(P); - - for (i = 1; i < 8; i++) { - Q[i] = new ctx.ECP4(); - Q[i].copy(Q[i - 1]); - Q[i].frob(F, 1); - } - - for (i = 0; i < 8; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - Q[i].neg(); - } - u[i].norm(); - } - - R = ctx.ECP4.mul8(Q, u); - } else { - R = P.mul(e); - } - return R; - }; - - /* Note that this method requires a lot of RAM */ - PAIR4.GTpow = function (d, e) { - var r, g, fa, fb, f, q, t, u, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_GT) { - g = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - t = new ctx.BIG(0); - u = PAIR4.gs(e); - - g[0] = new ctx.FP24(d); - - for (i = 1; i < 8; i++) { - g[i] = new ctx.FP24(0); - g[i].copy(g[i - 1]); - g[i].frob(f, 1); - } - - for (i = 0; i < 8; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - g[i].conj(); - } - u[i].norm(); - } - - r = ctx.FP24.pow8(g, u); - } else { - r = d.pow(e); - } - - return r; - }; - - /* test G1 group membership */ - PAIR4.G1member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR4.G1mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test G2 group membership */ - PAIR4.G2member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR4.G2mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test group membership - no longer needed */ - /* Check that m!=1, conj(m)*m==1, and m.m^{p^8}=m^{p^4} */ - - PAIR4.GTmember = function (m) { - if (m.isunity()) return false; - var r = new ctx.FP24(m); - r.conj(); - r.mul(m); - if (!r.isunity()) return false; - - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - var f = new ctx.FP2(fa, fb); - - r.copy(m); - r.frob(f, 4); - var w = new ctx.FP24(r); - w.frob(f, 4); - w.mul(m); - if (!w.equals(r)) return false; - - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - w.copy(m); - r.copy(PAIR4.GTpow(w, q)); - if (!r.isunity()) return false; - return true; - }; - - return PAIR4; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.PAIR4 = PAIR4; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/pair8.js b/packages/bls-verify/src/vendor/amcl-js/src/pair8.js deleted file mode 100644 index d23f941e3..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/pair8.js +++ /dev/null @@ -1,918 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var PAIR8 = function (ctx) { - 'use strict'; - - var PAIR8 = { - dbl: function (A, AA, BB, CC) { - CC.copy(A.getx()); - var YY = new ctx.FP8(A.gety()); - BB.copy(A.getz()); - AA.copy(YY); - - AA.mul(BB); //YZ - CC.sqr(); //X^2 - YY.sqr(); //Y^2 - BB.sqr(); //Z^2 - - AA.add(AA); - AA.neg(); - AA.norm(); //-2AA - AA.times_i(); - - var sb = 3 * ctx.ROM_CURVE.CURVE_B_I; - BB.imul(sb); - CC.imul(3); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - YY.times_i(); - CC.times_i(); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - BB.times_i(); - } - BB.sub(YY); - BB.norm(); - - A.dbl(); - }, - - add: function (A, B, AA, BB, CC) { - AA.copy(A.getx()); // X1 - CC.copy(A.gety()); // Y1 - var T1 = new ctx.FP8(A.getz()); // Z1 - BB.copy(A.getz()); // Z1 - - T1.mul(B.gety()); // T1=Z1.Y2 - BB.mul(B.getx()); // T2=Z1.X2 - - AA.sub(BB); - AA.norm(); // X1=X1-Z1.X2 - CC.sub(T1); - CC.norm(); // Y1=Y1-Z1.Y2 - - T1.copy(AA); // T1=X1-Z1.X2 - - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - AA.times_i(); - AA.norm(); - } - - T1.mul(B.gety()); // T1=(X1-Z1.X2).Y2 - - BB.copy(CC); // T2=Y1-Z1.Y2 - BB.mul(B.getx()); // T2=(Y1-Z1.Y2).X2 - BB.sub(T1); - BB.norm(); // T2=(Y1-Z1.Y2).X2 - (X1-Z1.X2).Y2 - CC.neg(); - CC.norm(); // Y1=-(Y1-Z1.Y2).Xs - - A.add(B); - }, - - /* Line function */ - line: function (A, B, Qx, Qy) { - var r = new ctx.FP48(1); - - var a, b, c; - var AA = new ctx.FP8(0); - var BB = new ctx.FP8(0); - var CC = new ctx.FP8(0); - if (A == B) PAIR8.dbl(A, AA, BB, CC); - else PAIR8.add(A, B, AA, BB, CC); - - CC.tmul(Qx); - AA.tmul(Qy); - - a = new ctx.FP16(AA, BB); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP16(CC); // L(0,1) | L(0,0) | L(1,0) - c = new ctx.FP16(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP16(0); - c = new ctx.FP16(CC); - c.times_i(); - } - - r.set(a, b, c); - r.settype(ctx.FP.SPARSER); - - return r; - }, - - /* prepare for multi-pairing */ - initmp: function () { - var r = []; - for (var i = 0; i < ctx.ECP.ATE_BITS; i++) r[i] = new ctx.FP48(1); - return r; - }, - - /* basic Miller loop */ - miller: function (r) { - var res = new ctx.FP48(1); - for (var i = ctx.ECP.ATE_BITS - 1; i >= 1; i--) { - res.sqr(); - res.ssmul(r[i]); - r[i].zero(); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) res.conj(); - res.ssmul(r[0]); - r[0].zero(); - - return res; - }, - - // Store precomputed line details in an FP8 - pack: function (AA, BB, CC) { - var i = new ctx.FP8(CC); - i.inverse(null); - var a = new ctx.FP8(AA); - a.mul(i); - var b = new ctx.FP8(BB); - b.mul(i); - return new ctx.FP16(a, b); - }, - - unpack: function (T, Qx, Qy) { - var a, b, c; - a = new ctx.FP16(T); - a.geta().tmul(Qy); - var t = new ctx.FP8(Qx); - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.D_TYPE) { - b = new ctx.FP16(t); - c = new ctx.FP16(0); - } - if (ctx.ECP.SEXTIC_TWIST == ctx.ECP.M_TYPE) { - b = new ctx.FP16(0); - c = new ctx.FP16(t); - c.times_i(); - } - var v = new ctx.FP48(a, b, c); - v.settype(ctx.FP.SPARSEST); - return v; - }, - - precomp: function (QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR8.lbits(n3, n); - var P = new ctx.ECP8(); - P.copy(QV); - var AA = new ctx.FP8(0); - var BB = new ctx.FP8(0); - var CC = new ctx.FP8(0); - var j, bt; - - var A = new ctx.ECP8(); - A.copy(P); - var MP = new ctx.ECP8(); - MP.copy(P); - MP.neg(); - j = 0; - - var T = []; - for (var i = nb - 2; i >= 1; i--) { - PAIR8.dbl(A, AA, BB, CC); - T[j++] = PAIR8.pack(AA, BB, CC); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - PAIR8.add(A, P, AA, BB, CC); - T[j++] = PAIR8.pack(AA, BB, CC); - } - if (bt == -1) { - PAIR8.add(A, MP, AA, BB, CC); - T[j++] = PAIR8.pack(AA, BB, CC); - } - } - return T; - }, - - /* Accumulate another set of line functions for n-pairing, assuming precomputation on G2 */ - another_pc(r, T, QV) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var nb = PAIR8.lbits(n3, n); - var lv, lv2; - var j, bt; - - if (QV.is_infinity()) return; - - var Q = new ctx.ECP(); - Q.copy(QV); - Q.affine(); - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - j = 0; - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR8.unpack(T[j++], Qx, Qy); - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR8.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR8.unpack(T[j++], Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Accumulate another set of line functions for n-pairing */ - another: function (r, P1, Q1) { - var n = new ctx.BIG(0); - var n3 = new ctx.BIG(0); - var lv, lv2; - var bt; - - if (Q1.is_infinity()) return; - // P is needed in affine form for line function, Q for (Qx,Qy) extraction - var P = new ctx.ECP8(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - P.affine(); - Q.affine(); - - var Qx = new ctx.FP(Q.getx()); - var Qy = new ctx.FP(Q.gety()); - - var A = new ctx.ECP8(); - A.copy(P); - - var MP = new ctx.ECP8(); - MP.copy(P); - MP.neg(); - - var nb = PAIR8.lbits(n3, n); - - for (var i = nb - 2; i >= 1; i--) { - lv = PAIR8.line(A, A, Qx, Qy); - - bt = n3.bit(i) - n.bit(i); - if (bt == 1) { - lv2 = PAIR8.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR8.line(A, MP, Qx, Qy); - lv.smul(lv2); - } - r[i].ssmul(lv); - } - }, - - /* Optimal R-ate pairing */ - ate: function (P1, Q1) { - var n, n3, lv, lv2, Qx, Qy, A, NP, r, nb, bt, i; - - if (Q1.is_infinity()) return new ctx.FP48(1); - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP8(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - A = new ctx.ECP8(); - r = new ctx.FP48(1); - - A.copy(P); - NP = new ctx.ECP8(); - NP.copy(P); - NP.neg(); - - nb = PAIR8.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR8.line(A, A, Qx, Qy); - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv2 = PAIR8.line(A, P, Qx, Qy); - lv.smul(lv2); - } - if (bt == -1) { - lv2 = PAIR8.line(A, NP, Qx, Qy); - lv.smul(lv2); - } - r.ssmul(lv); - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* Optimal R-ate double pairing e(P,Q).e(R,S) */ - ate2: function (P1, Q1, R1, S1) { - var n, n3, lv, lv2, Qx, Qy, Sx, Sy, A, B, NP, NR, r, nb, bt, i; - - if (Q1.is_infinity()) return PAIR8.ate(R1, S1); - if (S1.is_infinity()) return PAIR8.ate(P1, Q1); - - n = new ctx.BIG(0); - n3 = new ctx.BIG(0); - - var P = new ctx.ECP8(); - P.copy(P1); - P.affine(); - var Q = new ctx.ECP(); - Q.copy(Q1); - Q.affine(); - var R = new ctx.ECP8(); - R.copy(R1); - R.affine(); - var S = new ctx.ECP(); - S.copy(S1); - S.affine(); - - Qx = new ctx.FP(Q.getx()); - Qy = new ctx.FP(Q.gety()); - - Sx = new ctx.FP(S.getx()); - Sy = new ctx.FP(S.gety()); - - A = new ctx.ECP8(); - B = new ctx.ECP8(); - r = new ctx.FP48(1); - - A.copy(P); - B.copy(R); - NP = new ctx.ECP8(); - NP.copy(P); - NP.neg(); - NR = new ctx.ECP8(); - NR.copy(R); - NR.neg(); - - nb = PAIR8.lbits(n3, n); - - for (i = nb - 2; i >= 1; i--) { - r.sqr(); - lv = PAIR8.line(A, A, Qx, Qy); - lv2 = PAIR8.line(B, B, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - - bt = n3.bit(i) - n.bit(i); - - if (bt == 1) { - lv = PAIR8.line(A, P, Qx, Qy); - lv2 = PAIR8.line(B, R, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - if (bt == -1) { - lv = PAIR8.line(A, NP, Qx, Qy); - lv2 = PAIR8.line(B, NR, Sx, Sy); - lv.smul(lv2); - r.ssmul(lv); - } - } - - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - r.conj(); - } - - return r; - }, - - /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */ - fexp: function (m) { - var fa, fb, f, x, r, lv; - // t1,t2,t3,t7; - - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - - r = new ctx.FP48(m); //r.copy(m); - - /* Easy part of final exp */ - lv = new ctx.FP48(r); //lv.copy(r); - lv.inverse(); - r.conj(); - r.mul(lv); - lv.copy(r); - r.frob(f, 8); - r.mul(lv); - - /* Hard part of final exp */ - - // See https://eprint.iacr.org/2020/875.pdf - var t0, y0, y1; - y1 = new ctx.FP48(r); - y1.usqr(); - y1.mul(r); // y1=r^3 - - y0 = new ctx.FP48(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0 = new ctx.FP48(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - // ^(x+p) - y0.copy(r.pow(x)); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - y0.conj(); - } - t0.copy(r); - t0.frob(f, 1); - r.copy(y0); - r.mul(t0); - - // ^(x^2+p^2) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 2); - r.copy(y0); - r.mul(t0); - - // ^(x^4+p^4) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 4); - r.copy(y0); - r.mul(t0); - - // ^(x^8+p^8-1) - y0.copy(r.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - y0.copy(y0.pow(x)); - t0.copy(r); - t0.frob(f, 8); - y0.mul(t0); - t0.copy(r); - t0.conj(); - r.copy(y0); - r.mul(t0); - - r.mul(y1); - r.reduce(); - - /* - // Ghamman & Fouotsa Method - t7=new ctx.FP48(r); t7.usqr(); - - if (x.parity()==1) - { - t2=r.pow(x); - t1=new ctx.FP48(t2); t1.usqr(); - t2=t2.pow(x); - } else { - t1=t7.pow(x); - x.fshr(1); - t2=t1.pow(x); - x.fshl(1); - } - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3=new ctx.FP48(t1); t3.conj(); - t2.mul(t3); - t2.mul(r); - - r.mul(t7); - - t1=t2.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - t3.copy(t1); - t3.frob(f,14); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,13); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,12); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,11); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,10); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,9); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,8); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t2); t3.conj(); - t1.mul(t3); - t3.copy(t1); - t3.frob(f,7); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,6); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,5); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,4); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,3); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,2); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - t3.copy(t1); - t3.frob(f,1); - r.mul(t3); - t1=t1.pow(x); - if (ctx.ECP.SIGN_OF_X==ctx.ECP.NEGATIVEX) { - t1.conj(); - } - - r.mul(t1); - t2.frob(f,15); - r.mul(t2); - - r.reduce(); -*/ - return r; - }, - }; - - /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */ - PAIR8.lbits = function (n3, n) { - n.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - n3.copy(n); - n3.pmul(3); - n3.norm(); - return n3.nbits(); - }; - - /* GLV method */ - PAIR8.glv = function (e) { - var u = [], - q, - x, - x2; - - // -(x^2).P = (Beta.x,y) - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - x2 = ctx.BIG.smul(x, x); - x = ctx.BIG.smul(x2, x2); - x2 = ctx.BIG.smul(x, x); - u[0] = new ctx.BIG(e); - u[0].mod(x2); - u[1] = new ctx.BIG(e); - u[1].div(x2); - u[1].rsub(q); - - return u; - }; - - /* Galbraith & Scott Method */ - PAIR8.gs = function (e) { - var u = [], - i, - q, - x, - w; - - x = new ctx.BIG(0); - x.rcopy(ctx.ROM_CURVE.CURVE_Bnx); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - w = new ctx.BIG(e); - - for (i = 0; i < 15; i++) { - u[i] = new ctx.BIG(w); - u[i].mod(x); - w.div(x); - } - - u[15] = new ctx.BIG(w); - if (ctx.ECP.SIGN_OF_X == ctx.ECP.NEGATIVEX) { - u[1].copy(ctx.BIG.modneg(u[1], q)); - u[3].copy(ctx.BIG.modneg(u[3], q)); - u[5].copy(ctx.BIG.modneg(u[5], q)); - u[7].copy(ctx.BIG.modneg(u[7], q)); - u[9].copy(ctx.BIG.modneg(u[9], q)); - u[11].copy(ctx.BIG.modneg(u[11], q)); - u[13].copy(ctx.BIG.modneg(u[13], q)); - u[15].copy(ctx.BIG.modneg(u[15], q)); - } - - return u; - }; - - /* Multiply P by e in group G1 */ - PAIR8.G1mul = function (P, e) { - var R, Q, q, bcru, cru, t, u, np, nn; - - if (ctx.ROM_CURVE.USE_GLV) { - R = new ctx.ECP(); - R.copy(P); - Q = new ctx.ECP(); - Q.copy(P); - Q.affine(); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - bcru = new ctx.BIG(0); - bcru.rcopy(ctx.ROM_FIELD.CRu); - cru = new ctx.FP(bcru); - t = new ctx.BIG(0); - u = PAIR8.glv(e); - - Q.getx().mul(cru); - - np = u[0].nbits(); - t.copy(ctx.BIG.modneg(u[0], q)); - nn = t.nbits(); - if (nn < np) { - u[0].copy(t); - R.neg(); - } - - np = u[1].nbits(); - t.copy(ctx.BIG.modneg(u[1], q)); - nn = t.nbits(); - if (nn < np) { - u[1].copy(t); - Q.neg(); - } - u[0].norm(); - u[1].norm(); - R = R.mul2(u[0], Q, u[1]); - } else { - R = P.mul(e); - } - - return R; - }; - - /* Multiply P by e in group G2 */ - PAIR8.G2mul = function (P, e) { - var R, Q, F, q, u, t, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_G2) { - Q = []; - F = ctx.ECP8.frob_constants(); - - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - u = PAIR8.gs(e); - t = new ctx.BIG(0); - - Q[0] = new ctx.ECP8(); - Q[0].copy(P); - - for (i = 1; i < 16; i++) { - Q[i] = new ctx.ECP8(); - Q[i].copy(Q[i - 1]); - Q[i].frob(F, 1); - } - - for (i = 0; i < 16; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - Q[i].neg(); - } - u[i].norm(); - } - - R = ctx.ECP8.mul16(Q, u); - } else { - R = P.mul(e); - } - return R; - }; - - /* Note that this method requires a lot of RAM! */ - PAIR8.GTpow = function (d, e) { - var r, g, fa, fb, f, q, t, u, i, np, nn; - - if (ctx.ROM_CURVE.USE_GS_GT) { - g = []; - fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - f = new ctx.FP2(fa, fb); - q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - t = new ctx.BIG(0); - u = PAIR8.gs(e); - - g[0] = new ctx.FP48(d); - - for (i = 1; i < 16; i++) { - g[i] = new ctx.FP48(0); - g[i].copy(g[i - 1]); - g[i].frob(f, 1); - } - - for (i = 0; i < 16; i++) { - np = u[i].nbits(); - t.copy(ctx.BIG.modneg(u[i], q)); - nn = t.nbits(); - - if (nn < np) { - u[i].copy(t); - g[i].conj(); - } - u[i].norm(); - } - - r = ctx.FP48.pow16(g, u); - } else { - r = d.pow(e); - } - - return r; - }; - - /* test G1 group membership */ - PAIR8.G1member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR8.G1mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test G2 group membership */ - PAIR8.G2member = function (P) { - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - if (P.is_infinity()) return false; - var W = PAIR8.G2mul(P, q); - if (!W.is_infinity()) return false; - return true; - }; - /* test group membership - no longer needed */ - /* Check that m!=1, conj(m)*m==1, and m.m^{p^16}=m^{p^8} */ - - PAIR8.GTmember = function (m) { - if (m.isunity()) return false; - var r = new ctx.FP48(m); - r.conj(); - r.mul(m); - if (!r.isunity()) return false; - - var fa = new ctx.BIG(0); - fa.rcopy(ctx.ROM_FIELD.Fra); - var fb = new ctx.BIG(0); - fb.rcopy(ctx.ROM_FIELD.Frb); - var f = new ctx.FP2(fa, fb); - - r.copy(m); - r.frob(f, 8); - var w = new ctx.FP48(r); - w.frob(f, 8); - w.mul(m); - if (!w.equals(r)) return false; - - var q = new ctx.BIG(0); - q.rcopy(ctx.ROM_CURVE.CURVE_Order); - - w.copy(m); - r.copy(PAIR8.GTpow(w, q)); - if (!r.isunity()) return false; - return true; - }; - - return PAIR8; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports.PAIR8 = PAIR8; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rand.js b/packages/bls-verify/src/vendor/amcl-js/src/rand.js deleted file mode 100644 index 5f2932fc7..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rand.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Cryptographic strong random number generator - * - * Unguessable seed -> SHA -> PRNG internal state -> SHA -> random numbers - * Slow - but secure - * - * See ftp://ftp.rsasecurity.com/pub/pdfs/bull-1.pdf for a justification - */ - -/* Marsaglia & Zaman Random number generator constants */ - -var RAND = function (ctx) { - 'use strict'; - - var RAND = function () { - /* Cryptographically strong pseudo-random number generator */ - this.ira = []; /* random number... */ - this.rndptr = 0; /* ...array & pointer */ - this.borrow = 0; - this.pool_ptr = 0; - this.pool = []; /* random pool */ - this.clean(); - }; - - RAND.prototype = { - NK: 21, - NJ: 6, - NV: 8, - - /* Terminate and clean up */ - clean: function () { - var i; - - for (i = 0; i < 32; i++) { - this.pool[i] = 0; - } - - for (i = 0; i < this.NK; i++) { - this.ira[i] = 0; - } - - this.rndptr = 0; - this.borrow = 0; - this.pool_ptr = 0; - }, - - sbrand: function () { - /* Marsaglia & Zaman random number generator */ - var i, k, pdiff, t; - - this.rndptr++; - if (this.rndptr < this.NK) { - return this.ira[this.rndptr]; - } - - this.rndptr = 0; - - for (i = 0, k = this.NK - this.NJ; i < this.NK; i++, k++) { - /* calculate next NK values */ - if (k == this.NK) { - k = 0; - } - - t = this.ira[k] >>> 0; - pdiff = (t - this.ira[i] - this.borrow) | 0; - pdiff >>>= 0; /* This is seriously weird shit. I got to do this to get a proper unsigned comparison... */ - - if (pdiff < t) { - this.borrow = 0; - } - - if (pdiff > t) { - this.borrow = 1; - } - - this.ira[i] = pdiff | 0; - } - - return this.ira[0]; - }, - - sirand: function (seed) { - var m = 1, - i, - inn, - t; - - this.borrow = 0; - this.rndptr = 0; - seed >>>= 0; - this.ira[0] ^= seed; - - for (i = 1; i < this.NK; i++) { - /* fill initialisation vector */ - inn = (this.NV * i) % this.NK; - this.ira[inn] ^= m; /* note XOR */ - t = m; - m = (seed - m) | 0; - seed = t; - } - - /* "warm-up" & stir the generator */ - for (i = 0; i < 10000; i++) { - this.sbrand(); - } - }, - - fill_pool: function () { - var sh = new ctx.HASH256(), - i; - - for (i = 0; i < 128; i++) { - sh.process(this.sbrand()); - } - - this.pool = sh.hash(); - this.pool_ptr = 0; - }, - - /* Initialize RNG with some real entropy from some external source */ - seed: function (rawlen, raw) { - /* initialise from at least 128 byte string of raw random entropy */ - var sh = new ctx.HASH256(), - digest = [], - b = [], - i; - - this.pool_ptr = 0; - - for (i = 0; i < this.NK; i++) { - this.ira[i] = 0; - } - - if (rawlen > 0) { - for (i = 0; i < rawlen; i++) { - sh.process(raw[i]); - } - - digest = sh.hash(); - - /* initialise PRNG from distilled randomness */ - for (i = 0; i < 8; i++) { - b[0] = digest[4 * i]; - b[1] = digest[4 * i + 1]; - b[2] = digest[4 * i + 2]; - b[3] = digest[4 * i + 3]; - this.sirand(RAND.pack(b)); - } - } - - this.fill_pool(); - }, - - /* get random byte */ - getByte: function () { - var r = this.pool[this.pool_ptr++]; - - if (this.pool_ptr >= 32) { - this.fill_pool(); - } - - return r & 0xff; - }, - }; - - RAND.pack = function (b) { - /* pack 4 bytes into a 32-bit Word */ - return ((b[3] & 0xff) << 24) | ((b[2] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[0] & 0xff); - }; - - return RAND; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - RAND: RAND, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js b/packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js deleted file mode 100644 index dd62b296c..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rom_curve.js +++ /dev/null @@ -1,2705 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Fixed Data in ROM - Field and Curve parameters */ - -var ROM_CURVE_ANSSI, - ROM_CURVE_BLS12383, - ROM_CURVE_BLS24479, - ROM_CURVE_BLS48556, - ROM_CURVE_BLS48286, - ROM_CURVE_BLS48581, - ROM_CURVE_BLS12381, - ROM_CURVE_BLS12461, - ROM_CURVE_BN462, - ROM_CURVE_FP256BN, - ROM_CURVE_FP512BN, - ROM_CURVE_BN254, - ROM_CURVE_BN254CX, - ROM_CURVE_BRAINPOOL, - ROM_CURVE_C25519, - ROM_CURVE_C41417, - ROM_CURVE_C1174, - ROM_CURVE_C1665, - ROM_CURVE_MDC, - ROM_CURVE_ED25519, - ROM_CURVE_GOLDILOCKS, - ROM_CURVE_X448, - ROM_CURVE_HIFIVE, - ROM_CURVE_NIST256, - ROM_CURVE_NIST384, - ROM_CURVE_NIST521, - ROM_CURVE_NUMS256E, - ROM_CURVE_NUMS256W, - ROM_CURVE_NUMS384E, - ROM_CURVE_NUMS384W, - ROM_CURVE_NUMS512E, - ROM_CURVE_NUMS512W, - ROM_CURVE_SECP256K1, - ROM_CURVE_SECP160R1, - ROM_CURVE_SM2, - ROM_CURVE_C13318, - ROM_CURVE_JUBJUB, - ROM_CURVE_TWEEDLEDUM, - ROM_CURVE_TWEEDLEDEE; - -ROM_CURVE_ANSSI = function () { - var ROM_CURVE_ANSSI = { - // ANSSI curve - - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0x7bb73f, 0xed967b, 0x803075, 0xe4b1a1, 0xec0c9a, 0xc00fdf, 0x754a44, 0xd4aba, 0x28a930, - 0x3fca54, 0xee35, - ], - CURVE_Order: [ - 0xd655e1, 0xd459c6, 0x941ffd, 0x40d2bf, 0xdc67e1, 0x435b53, 0xe8ce42, 0x10126d, 0x3ad58f, - 0x178c0b, 0xf1fd, - ], - CURVE_Gx: [ - 0x8f5cff, 0x7a2dd9, 0x164c9, 0xaf98b7, 0x27d2dc, 0x23958c, 0x4749d4, 0x31183d, 0xc139eb, - 0xd4c356, 0xb6b3, - ], - CURVE_Gy: [ - 0x62cfb, 0x5a1554, 0xe18311, 0xe8e4c9, 0x1c307, 0xef8c27, 0xf0f3ec, 0x1f9271, 0xb20491, - 0xe0f7c8, 0x6142, - ], - CURVE_HTPC: [ - 0xa725d0, 0x983e21, 0x349ea8, 0xbb477b, 0x4c66d2, 0x5676b5, 0x119a09, 0xac6dc7, 0x18a3ac, - 0x6d4dfd, 0x7290, - ], - }; - return ROM_CURVE_ANSSI; -}; - -ROM_CURVE_BLS12383 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS12383 = { - // BLS12383 Curve - // Base Bits= 23 - - CURVE_Cof_I: 0, - CURVE_B_I: 15, - CURVE_B: [0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x3c0001, 0x33d7fd, 0x5cec82, 0x9069c, 0x5f095a, 0x703bc0, 0x5a62c, 0x2200e4, 0x3809c0, - 0x1801, 0x8006, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x734573, 0x6e7210, 0x11e311, 0x1fa3b8, 0x5dbf08, 0x688b8a, 0x12bc78, 0x43dd6c, 0x742c2f, - 0x6d6103, 0x4c767d, 0x6d8287, 0x74052d, 0x1c706b, 0x5e7b39, 0x5d2adc, 0x41fc, - ], - CURVE_Gy: [ - 0x3f224, 0x2cbd00, 0x7484b4, 0x43fcc7, 0x7d49ec, 0x25bbca, 0x2b7ad3, 0x29854a, 0x449107, - 0xcd76c, 0x7436b7, 0x6236cc, 0x1cdc31, 0x495d, 0x33ecc0, 0xb393a, 0x68f, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x1200, 0x2, 0x40020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x11ff, 0x2, 0x40020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x169EAB, 0x2AC2AA, 0x7ED541, 0x555DF, 0x2AAC00, 0xAAB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0x7f2d86, 0x676c5a, 0x7850f2, 0x4ae8e9, 0x7dab67, 0x65dd03, 0x3d5895, 0x3f8e48, 0x725bd4, - 0x10a5aa, 0xc9407, 0xf3a32, 0x967cb, 0x180f32, 0x7b00fa, 0x691203, 0x634, - ], - CURVE_Pxb: [ - 0x52de15, 0x483d88, 0x37bf67, 0x2bff30, 0x4ab28d, 0x3aeb6a, 0x23a4b5, 0x6cc5d4, 0x4c89df, - 0x5b3a0b, 0x13d263, 0x1b0ee9, 0x717288, 0x5e6f4e, 0x592e, 0x3c0030, 0x300d, - ], - CURVE_Pya: [ - 0x8cb41, 0x617728, 0x5971a3, 0x106b0c, 0x1ede4f, 0x5ceb69, 0x2a44e8, 0x4bc1d6, 0x1b3e68, - 0x2ce793, 0x3a643b, 0x31a3db, 0x573fe, 0x79293b, 0x4894d1, 0x167c9e, 0x3379, - ], - CURVE_Pyb: [ - 0x479093, 0xc86fe, 0x18eb61, 0x731124, 0x43cb0d, 0x131602, 0x127def, 0x78597a, 0x7a8f7a, - 0x8d67d, 0x73835, 0x53d700, 0x3a7d15, 0x649dcf, 0x33631a, 0x123ee9, 0x20e5, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: true, - - //debug: false, - }; - - return ROM_CURVE_BLS12383; -}; - -ROM_CURVE_BLS24479 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS24479 = { - // BLS24479 Curve - // Base Bits= 23 - CURVE_Cof_I: 0, - CURVE_B_I: 19, - CURVE_B: [ - 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x1, 0x11ffe0, 0x464068, 0x1ffaa8, 0x71e703, 0x645bb5, 0x379fb8, 0x689d35, 0x49d0ce, 0x49091f, - 0x4a7308, 0x286c0b, 0x3b44a0, 0x60b731, 0x6807c3, 0x8002, 0x10010, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x63ccd4, 0x41ebd7, 0x15919d, 0x576cfa, 0x1efe2d, 0x743f98, 0xfc23a, 0x409a3c, 0x595af8, - 0x6f8df1, 0x38b611, 0x65468d, 0x7e4bfd, 0x6b0d9d, 0x7641d, 0x2eccde, 0xb7fea, 0x5bd3c3, - 0x2be521, 0x71a0be, 0x1ab2b, - ], - CURVE_Gy: [ - 0x1e5245, 0x4b95a4, 0x5b132e, 0x462aef, 0x36d660, 0x672e8d, 0x7b4a53, 0x79e459, 0x24920f, - 0x4828b0, 0x58f969, 0x1d527e, 0x4e00f6, 0x457ef3, 0x66924a, 0x294ffb, 0x66a7a4, 0x70c394, - 0x4f91de, 0x386362, 0x47fcb, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x11ff80, 0x400, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x11ff7f, 0x400, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x7415AB, 0x7F7FF3, 0x5FFF07, 0x2AB555, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxaa: [ - 0x624678, 0x26a6e9, 0x22f8a, 0x212c12, 0x60c343, 0x3df8d3, 0x5d9733, 0x6bfc87, 0x2d2888, - 0x758675, 0x259d1c, 0x7e922c, 0x4bab37, 0x11daab, 0x6214a4, 0x758a55, 0x786671, 0x72b190, - 0x32581d, 0x729d1f, 0x959d, - ], - CURVE_Pxab: [ - 0x3099b8, 0x3d75ff, 0x40e1fe, 0x9523, 0x63775a, 0x78470a, 0x5746c7, 0x7cf1b5, 0x26a730, - 0x14fe14, 0x76ca97, 0x61c7c2, 0x669261, 0x6a7c2f, 0x3e5da9, 0x5f2d68, 0x2d39d1, 0x4a3c98, - 0x4cf7f1, 0x68418b, 0x3b0de, - ], - CURVE_Pxba: [ - 0x2d15d3, 0x1bce23, 0x5bb687, 0x46fb70, 0x185317, 0x47c134, 0x2fd0fa, 0x3597b2, 0x56de56, - 0x165b19, 0x1d3f6e, 0x10e136, 0x76b1ef, 0x1913c7, 0x4011ef, 0x1f994f, 0x3fe210, 0x545186, - 0x41ebca, 0x7d6a72, 0x3ec27, - ], - CURVE_Pxbb: [ - 0x60f480, 0x650ebd, 0x2e31ea, 0x21eb62, 0x14556e, 0x1c3973, 0x48b7e0, 0xffefd, 0x50122f, - 0x55ee1f, 0x263bd7, 0x2ed92b, 0x1ba3ad, 0x39c35e, 0x2dd201, 0x17232e, 0x1da7ce, 0x4cb0aa, - 0x1e67df, 0x46de50, 0xa5b3, - ], - CURVE_Pyaa: [ - 0x781aa0, 0x132628, 0x2ac619, 0x181db8, 0x3609da, 0x3f8897, 0x4a9851, 0x189252, 0x4c42a, - 0x768c5c, 0x66b9a2, 0x1c1d70, 0x4fcadc, 0x69ed7c, 0x7d286c, 0xd685, 0x198f9, 0x459da0, - 0x30250d, 0x1aeb9b, 0x5057f, - ], - CURVE_Pyab: [ - 0x2e08fa, 0x58afdd, 0x5ab6ef, 0x5d52fc, 0x78774, 0x348594, 0x32bc26, 0x23c32, 0x3bccf7, - 0xb913f, 0x3e1549, 0x5b907f, 0x77b3e6, 0x22c6ed, 0x7865fe, 0x3daefb, 0x60f558, 0x702d7a, - 0x3a258d, 0x24b30f, 0x2ce2b, - ], - CURVE_Pyba: [ - 0x70cc41, 0x4ed4b, 0x7d5cc, 0x2a9855, 0x7f8932, 0x5f1428, 0x7361e6, 0x14406c, 0x68a9fe, - 0x21dca7, 0x4dc54e, 0x10783e, 0x71f3a4, 0x3aa336, 0x6c5305, 0x1e5adc, 0x1a39dd, 0x7c73f0, - 0x18c69a, 0x2331f7, 0x18070, - ], - CURVE_Pybb: [ - 0x5c1cae, 0x65cca2, 0x2373c6, 0x2ad84c, 0x2d40d3, 0x714eee, 0x10ff70, 0x3ae561, 0x136b6, - 0x3eba67, 0x75cbf3, 0x327450, 0x161ac1, 0x5cb9a1, 0x2c42ee, 0x48bb8f, 0x56d046, 0x725081, - 0x77b22d, 0x2756cd, 0x499d1, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: true, - - //debug: false, - }; - - return ROM_CURVE_BLS24479; -}; - -ROM_CURVE_BLS48581 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS48581 = { - // Base Bits= 23 - // Ate Bits= 33 - // G2 Table size= 36 - - CURVE_Cof_I: 0, - CURVE_Cof: [ - 0x382, 0x280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_B_I: 1, - CURVE_B: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x671c01, 0x7cdf9a, 0x46297, 0x3e126d, 0x659946, 0x789997, 0x1588c0, 0x2e3e68, 0x2016a8, - 0x698992, 0x65a74, 0x17373a, 0x3c972c, 0x7f5ad, 0x4f2f80, 0x3d1f85, 0x463538, 0x2b81ad, - 0x733058, 0x7119d4, 0x5e2885, 0x5f1524, 0x8e1, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x5af640, 0xe6462, 0x30ef3a, 0x50f36c, 0x4da5d3, 0x70d96e, 0x5a2c45, 0x62bed9, 0x36ebdb, - 0x3b0b24, 0x611d99, 0x37cb22, 0x46a9df, 0x8aa0a, 0x6e7dd5, 0x5d76ff, 0x761abd, 0xd0d19, - 0x15f83a, 0x6f1f9, 0x693f86, 0x6e7be3, 0x4aebca, 0x561a07, 0x2f59b7, 0x5, - ], - CURVE_Gy: [ - 0x587a70, 0x3bc7c4, 0x5db6ed, 0x5c935a, 0x37aef7, 0x65c6be, 0x21db46, 0x3fbbe1, 0x722f48, - 0x30987d, 0x3d9e1, 0x7729f4, 0x7fb98a, 0x776f7d, 0x5c83bd, 0x4eea0d, 0x699127, 0x5714a5, - 0x4f27bf, 0x24452a, 0x7b398a, 0x6745a3, 0x647e1a, 0x7b298f, 0x6fda44, 0x19, - ], - CURVE_HTPC: [ - 0x1193ec, 0x617c06, 0x10ce4f, 0x203ac1, 0x288964, 0x28c418, 0x2a39c3, 0x76df25, 0x6fd560, - 0x4f7aab, 0x41c1ac, 0x25f766, 0x24a962, 0x2766c2, 0x1ab5f1, 0x2af131, 0x30c7, 0x308b53, - 0xb0b77, 0x5a7353, 0x429389, 0x3153fa, 0x653c17, 0x2ee2d7, 0x2348cd, 0x12, - ], - - CURVE_Bnx: [ - 0x381, 0x280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Pxaaa: [ - 0x68bfab, 0x216959, 0x7b0d3f, 0x110aa6, 0x797663, 0x2062f6, 0x1247d4, 0x26c0, 0x400503, - 0x40c25e, 0x698f2, 0x462114, 0x3aad1a, 0xdfef3, 0x3c55b1, 0x6d9d17, 0x37de64, 0x9b799, - 0x3f1c0d, 0x75d5df, 0x22775d, 0x6ff48b, 0x128e08, 0x53c38f, 0x5615d9, 0xb, - ], - CURVE_Pxaab: [ - 0x347c57, 0x66cced, 0x7c59a6, 0x57d0a1, 0x556a01, 0x1ffaea, 0x65e58c, 0x63b186, 0x4f0c3, - 0x7f4c4a, 0x529dab, 0x6f8b10, 0xabfe, 0x72874, 0x1fd387, 0x6d0918, 0x1526f6, 0x42c47d, - 0x5b6603, 0x45915d, 0x2bc07e, 0x361d0d, 0x14481a, 0x67112c, 0x44973e, 0xf, - ], - CURVE_Pxaba: [ - 0x5a3e6a, 0x2ad94a, 0x519220, 0x359f85, 0x74cded, 0x3fd51d, 0x6e1e75, 0x465efd, 0x555f02, - 0x61a54d, 0x6b9d9b, 0x49217f, 0x41dbd1, 0xc02c3, 0x2d6ada, 0x2be65d, 0x7a6d69, 0x446f94, - 0x1b2a6b, 0x639d45, 0x3ad83b, 0x5d430a, 0x4d386c, 0xcc789, 0x7ccc70, 0x3, - ], - CURVE_Pxabb: [ - 0x7feafe, 0x67976, 0x7c269c, 0x7405e1, 0xb8cb4, 0x14a462, 0x5f0803, 0x18e292, 0x39468c, - 0x6364f3, 0x3b050e, 0x63bb73, 0x5f63e1, 0x43152, 0x62f833, 0x151c9f, 0x21b7b9, 0x5e7cb0, - 0x616b18, 0x7f47ac, 0x154d4b, 0x1b0025, 0x6171e, 0x12e75b, 0x62218c, 0x17, - ], - CURVE_Pxbaa: [ - 0x78cce5, 0x7438a7, 0x6dce70, 0x64ea65, 0x35f746, 0x5018cb, 0x6226a, 0x56aafe, 0x9274f, - 0x1255cb, 0x42cbbd, 0x4ead60, 0x1e4819, 0x33303f, 0x14e19a, 0x73e2c0, 0x675ff0, 0x2c856a, - 0x1d742c, 0x1803e3, 0x2a9dd6, 0x331c99, 0x44e8f1, 0x59ac, 0xb91c6, 0x7, - ], - CURVE_Pxbab: [ - 0x3c093a, 0x1b2294, 0x43c801, 0x7e719b, 0x160910, 0x12ff8f, 0x5d84bc, 0x2d4f8b, 0x5dd759, - 0x738162, 0x55ed02, 0x44cbf5, 0x3835d2, 0x303bec, 0xdd060, 0x33bdd8, 0x3d1a58, 0x612ef4, - 0x4d773b, 0x47bdc7, 0x6cda08, 0x2623c9, 0x6180fc, 0x3f5839, 0x16c779, 0x19, - ], - CURVE_Pxbba: [ - 0x50e057, 0xfcc0e, 0x539058, 0x2e19a, 0x35b0e2, 0x2c6669, 0x49308b, 0xe5f21, 0x432aad, - 0x3df9e6, 0x7432a9, 0x1e7687, 0x7293b1, 0x39de23, 0x2de912, 0x45d160, 0x36db90, 0x2270a5, - 0x106ce7, 0x3306f5, 0x108aee, 0x2f4931, 0x38fc06, 0x63030f, 0x1b7951, 0x17, - ], - CURVE_Pxbbb: [ - 0x46ae34, 0x3401f7, 0x613867, 0x74be1f, 0x2f2fc9, 0x89cad, 0x3afe7f, 0x3cdeb5, 0x545854, - 0x6fc561, 0x29c642, 0x67f9b2, 0x293f29, 0x3f19f9, 0x4a29fe, 0x20b8cb, 0x211cf7, 0x5e8f6a, - 0x6a77be, 0x58f2eb, 0x74aaa2, 0x4c4989, 0x7b14a0, 0x17d95e, 0x27d5c2, 0x10, - ], - CURVE_Pyaaa: [ - 0x2d7971, 0x27fc9a, 0x4c8fb7, 0x9607f, 0x5012ab, 0x2cb208, 0x5fba9b, 0x4cd5fb, 0x163c15, - 0x5b15ca, 0x43dccd, 0x3ba46c, 0x35afa2, 0x6120c4, 0xd7eaa, 0x4f5fe2, 0x66f3b3, 0x334aef, - 0x508e01, 0x25c8c5, 0x52f302, 0x2e42c8, 0x577e92, 0x361bad, 0x6b5335, 0x1, - ], - CURVE_Pyaab: [ - 0x4d5665, 0x3b726d, 0x44451c, 0x2ffe3d, 0x342352, 0x45cb11, 0x5f5d83, 0x97d04, 0x4e1dd2, - 0x125564, 0x170f46, 0xf8c96, 0x6b243b, 0x75f612, 0x4bf2fc, 0x14b239, 0x3a01d7, 0x64bcdf, - 0x108ae8, 0x615bad, 0x15fcad, 0x4ca630, 0x7c5136, 0x4bcf07, 0x4dc75, 0x5, - ], - CURVE_Pyaba: [ - 0x2a8474, 0x54a4d4, 0x79a0cc, 0x61dc7e, 0x47c46f, 0x44d397, 0x546994, 0x60e9ae, 0x65e2f0, - 0x14652b, 0x4554db, 0x48208a, 0x499d0e, 0x6befab, 0x414511, 0x24069b, 0x119d3a, 0x42dab6, - 0x7140c0, 0x779617, 0x367669, 0x3df6e0, 0x48f908, 0x6e8042, 0x36a201, 0x16, - ], - CURVE_Pyabb: [ - 0x41589d, 0x7b5250, 0x4c5884, 0xf299b, 0x3d8b8a, 0x4af1f6, 0x40fb97, 0x33ded2, 0xba10d, - 0x6e84ee, 0x3b4a05, 0x7d206e, 0x224333, 0x59136, 0x48b49d, 0x738870, 0x3dd8b0, 0x1b9dc4, - 0x7b4cd8, 0x58e166, 0x478762, 0x47f77a, 0x1a208, 0x310f6e, 0x6c25a4, 0x15, - ], - CURVE_Pybaa: [ - 0x650137, 0x63f305, 0xfd1e0, 0x7e7bd2, 0x57fddd, 0x6f6110, 0x651744, 0x21809a, 0x64f59f, - 0x1ca256, 0x78b29, 0x66e745, 0x7fa238, 0x5b0b8e, 0x4a615f, 0x402f88, 0x35a959, 0x7bb27, - 0x71506d, 0x512aa6, 0x288325, 0x207f4b, 0x11a459, 0x111d4e, 0x209d5a, 0x1a, - ], - CURVE_Pybab: [ - 0x10bee4, 0x38b19f, 0x1653bb, 0x13679d, 0x59ed82, 0x6cf3b4, 0x32a9ca, 0x57e0cc, 0x139e3a, - 0x78301a, 0x2093d1, 0x420fb, 0xe8c27, 0x750684, 0x2dd413, 0x7102ad, 0x589d82, 0x2ce456, - 0x359bac, 0x48210d, 0x2d537b, 0x2673ab, 0x5e944f, 0x22b9b5, 0x50d037, 0xf, - ], - CURVE_Pybba: [ - 0x323986, 0x75d5fd, 0x2cf507, 0x6cd531, 0x84017, 0x39993d, 0xe7d4f, 0x5a07d3, 0x618b5b, - 0x18e964, 0x307eae, 0x432791, 0x5ae3a2, 0x731e84, 0x669b7, 0xa7264, 0x64155f, 0x108360, - 0x4d93f0, 0x450037, 0x5d17af, 0x5a0bbf, 0x7a8970, 0x8df32, 0x167678, 0x11, - ], - CURVE_Pybbb: [ - 0x2718b6, 0x7f96e6, 0x57599f, 0x2034e2, 0x2c66e8, 0x6e91cb, 0x12accf, 0x1806c6, 0x205417, - 0x7d8e32, 0x6b40cc, 0xf4bf0, 0xe69c3, 0x26747f, 0x32a6a5, 0x5b77c7, 0x487549, 0x7d1ca1, - 0x3c501a, 0x5af034, 0x4f981, 0x4b80fd, 0x274e4e, 0x7fc481, 0x5e2524, 0x6, - ], - // CURVE_W: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]], - // CURVE_SB: [[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]], - // CURVE_WB: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]], - // CURVE_BB: [[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - }; - - return ROM_CURVE_BLS48581; -}; - -ROM_CURVE_BN462 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BN462 = { - // Base Bits= 23 - // Ate Bits= 118 - // G2 Table size= 125 - - CURVE_Cof_I: 1, - CURVE_Cof: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - CURVE_B_I: 5, - CURVE_B: [ - 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - CURVE_Order: [ - 0x10800d, 0x600fc0, 0x9006, 0x0, 0x7f7c00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, 0x438403, - 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - CURVE_Gx: [ - 0x36980d, 0x323e6d, 0x44f263, 0x2e6b80, 0x40372e, 0x4f2473, 0x5a82c7, 0x734d20, 0x31bbb4, - 0x5cd13b, 0xf3d2c, 0x1f6df6, 0x15f63b, 0x4c96df, 0x2e6b24, 0x5180b0, 0x3a34a0, 0x323f5b, - 0x7bc940, 0xd36b3, 0x2, - ], - CURVE_Gy: [ - 0x7b03de, 0x669a6d, 0x2aa295, 0x31176, 0x2c6660, 0x68ea86, 0x3ae03, 0xdc572, 0x777df1, - 0x4dcd5, 0x165941, 0x6bc463, 0x4ccfa7, 0x5b5085, 0x29243b, 0x353a19, 0x2b3367, 0x6f5770, - 0x1183df, 0x8c750, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x7fbfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Pxa: [ - 0x61e4df, 0x7b2695, 0x551a38, 0x4403b4, 0x26a8b4, 0x5c3e15, 0x3800ca, 0x4dd6c9, 0x1ad269, - 0x10411f, 0x4e0810, 0x6b0e48, 0x1cd96e, 0x66fcf8, 0x520b80, 0x465ee2, 0x338e3a, 0x3b41bf, - 0x216d63, 0x12be66, 0x0, - ], - CURVE_Pxb: [ - 0xcd283, 0x174d55, 0x6dcc42, 0x742874, 0x359bf7, 0x6a15f1, 0x60dc63, 0x72aadb, 0x5d86ba, - 0x630269, 0x210162, 0x6c8bb4, 0x730cbe, 0x4546a8, 0x68f263, 0x24ab35, 0xedca8, 0x22055f, - 0xfa166, 0x69721a, 0x1, - ], - CURVE_Pya: [ - 0x37154e, 0x51be1b, 0x5db96d, 0xebe19, 0x40e7b1, 0x6d2b42, 0x38cb80, 0xe4eed, 0x19a1f4, - 0x21e27, 0x6d0bfa, 0x7d3d35, 0x6e23c3, 0x2c68e0, 0x7b280d, 0x510404, 0x517427, 0x5832f2, - 0xe7688, 0x503282, 0x0, - ], - CURVE_Pyb: [ - 0x22a93a, 0x18aa59, 0x7ae853, 0x1a49dc, 0xd5374, 0x70f54d, 0x13be1c, 0x122250, 0x464769, - 0x7ae4b9, 0x6acdc3, 0x59c9f8, 0x69ac57, 0x3cd618, 0x135135, 0x398319, 0x2c8ae3, 0x17c02e, - 0x2f50e3, 0x39f786, 0x0, - ], - CURVE_W: [ - [ - 0x20003, 0xc0, 0x0, 0x0, 0x7ff000, 0x7e7fef, 0x7fffff, 0x7fffff, 0x17ffff, 0x400c00, 0x1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_SB: [ - [ - [ - 0x28004, 0xc0, 0x0, 0x0, 0x7fec00, 0x7e7fee, 0x7fffff, 0x7fffff, 0x17ffff, 0x400c00, 0x1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x11000e, 0x600fc0, 0x9006, 0x0, 0x7f7800, 0xf7ee1, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - [ - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x20003, 0xc0, 0x0, 0x0, 0x7ff000, 0x7e7fef, 0x7fffff, 0x7fffff, 0x17ffff, 0x400c00, 0x1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - ], - CURVE_WB: [ - [ - 0x4000, 0x40, 0x0, 0x0, 0x3ffe00, 0x7f7ffb, 0x7fffff, 0x7fffff, 0x7ffff, 0x400400, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7abffb, 0x1ffc7f, 0x7fffff, 0x7fffff, 0x4029ff, 0x100042, 0x240, 0x0, 0x100000, 0x7f7fff, - 0x7dbfd4, 0x7fffff, 0x7fffff, 0x4800bf, 0x401200, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7d3ffd, 0x4ffe3f, 0x7fffff, 0x7fffff, 0x4015ff, 0x80021, 0x120, 0x0, 0x480000, 0x3fbfff, - 0x7edfea, 0x7fffff, 0x7fffff, 0x24005f, 0x600900, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0xc001, 0x40, 0x0, 0x0, 0x3ffa00, 0x7f7ffa, 0x7fffff, 0x7fffff, 0x7ffff, 0x400400, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_BB: [ - [ - [ - 0x7fc000, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7fbfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7fbfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x4001ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x11000f, 0x600fc0, 0x9006, 0x0, 0x7f7800, 0xf7ee1, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - [ - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x10c00e, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x10c00d, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x10c00e, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - [ - [ - 0x7f7ffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7f7fff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - [ - [ - 0x10c00f, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x11800f, 0x600fc0, 0x9006, 0x0, 0x7f7400, 0xf7ee0, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - [ - 0x7f7ffd, 0x7fffff, 0x7fffff, 0x7fffff, 0x3ff, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x10c00f, 0x600fc0, 0x9006, 0x0, 0x3f7a00, 0xf7ee2, 0x3fd9bf, 0x7ffffb, 0x77ffff, - 0x438403, 0x4a423b, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, - 0x202401, 0x2, - ], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - }; - - return ROM_CURVE_BN462; -}; - -ROM_CURVE_BLS48556 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS48556 = { - // BLS48556 Curve - // Base Bits= 23 - CURVE_Cof_I: 0, - CURVE_B_I: 17, - CURVE_B: [ - 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x1, 0x7e0000, 0x421bff, 0x714ed3, 0x455409, 0x53842, 0x7ac588, 0x7e8a68, 0xad8c1, 0x184da5, - 0x7fb5e2, 0x5e936, 0x5ef479, 0x12b881, 0x46fe3f, 0x32fd85, 0x2973c4, 0x3d260d, 0x318df1, - 0x88d57, 0x3f73ea, 0x1887, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x571d33, 0x5a5ecb, 0x3fca1, 0x7f196f, 0x580554, 0x23dc17, 0x591dc, 0x1987f8, 0x7ca7f6, - 0x345e03, 0x203d9a, 0x1734d, 0x444e07, 0x5602b2, 0x5003e, 0x5961d5, 0x30d242, 0x336bc2, - 0x79241, 0xe0499, 0x7edd74, 0x3b712a, 0x215d65, 0x544f49, 0x9, - ], - CURVE_Gy: [ - 0x6ed83a, 0x367fd4, 0x33da69, 0x254538, 0x5c4b95, 0x2b0cef, 0x7aa39a, 0x47d9c8, 0x677b5f, - 0x4f9e3d, 0x6dc8a6, 0x71c0c7, 0x4b44e2, 0x4aa8f1, 0x4c3099, 0x3071e3, 0x240862, 0x1b9ccf, - 0x579c4, 0x4d1997, 0x3349da, 0x3f5c56, 0x5318b1, 0x56c684, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x640020, 0xfb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x64001f, 0xfb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x12ABEB, 0x221EFE, 0x528B, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxaaa: [ - 0x23ce4a, 0x5d1d12, 0x74aa34, 0x695c09, 0x3d7102, 0x274419, 0x76284c, 0x69f0b2, 0x4637c1, - 0x5fe3fe, 0x242e62, 0x3f853e, 0x4dd2b3, 0x672bde, 0x6ed92, 0x2b9bad, 0x6c4abf, 0x393882, - 0x32ee21, 0x2ef3a1, 0x59487e, 0x92f4b, 0x26870, 0x32bc6c, 0xe, - ], - CURVE_Pxaab: [ - 0xa1be1, 0x1b8b58, 0x7dc9c7, 0x3beb, 0x28fe3b, 0x72e58b, 0x51e10c, 0x31856a, 0x389247, - 0x15b9fd, 0x2847ea, 0x2e35a0, 0x9b0e7, 0x7f92ce, 0x6960c8, 0xc5821, 0x48632d, 0xc919c, - 0x3c27f4, 0x2a934d, 0x348b6e, 0x2f6b1b, 0x179d2a, 0x4a1009, 0x2, - ], - CURVE_Pxaba: [ - 0xc5dc4, 0x6498ee, 0x4b68e9, 0x6ed677, 0x2964ad, 0x7d8e6d, 0x4d0966, 0x550884, 0x1926ac, - 0x47162d, 0x633555, 0x265962, 0x6402b8, 0x48f745, 0x68195f, 0x198b3a, 0x117ce2, 0x5e9efb, - 0x729335, 0x471f6e, 0x3689ba, 0x3bb4f1, 0x3ddb5c, 0x297f7c, 0xb, - ], - CURVE_Pxabb: [ - 0x64b740, 0x52cd34, 0x578358, 0x464902, 0x11fd49, 0x475ba2, 0x5c150c, 0x436206, 0x335e27, - 0x7cfa66, 0x53ba9f, 0x39e20f, 0x41e3c, 0x30cb43, 0x5e7d7a, 0x4869da, 0x6b405, 0x57b683, - 0x77306a, 0x3e774a, 0x63b1a6, 0x4be47e, 0x764b7f, 0x1c2054, 0x9, - ], - CURVE_Pxbaa: [ - 0x71e01f, 0x18c2e5, 0x26ec, 0x1a5853, 0x4311cd, 0x430f11, 0x43e8e4, 0x20204c, 0x35ab89, - 0x775c07, 0x43202c, 0x442943, 0x1e3472, 0xb1bea, 0x14841d, 0x56a6a1, 0x4e27c3, 0x6ac397, - 0x111e6a, 0x453f3c, 0x449d32, 0x6288f9, 0x7d0633, 0x6f0f7b, 0xd, - ], - CURVE_Pxbab: [ - 0x37383d, 0x70470c, 0x66c28, 0x7ccc3f, 0x220253, 0x27a425, 0x147b57, 0x64a9ae, 0x7a0147, - 0x61ce2b, 0x7620bf, 0x1ceb9b, 0x3f1646, 0x5546dc, 0x12aec8, 0x2a6d46, 0x38885e, 0xa7fd0, - 0x3a2974, 0x7872f1, 0x4f91fb, 0x2ade02, 0x632141, 0x16d9d3, 0x8, - ], - CURVE_Pxbba: [ - 0x11939c, 0x7b67ae, 0x6ba5a0, 0x34d20c, 0x1be51d, 0x65ed81, 0x6d5cb3, 0x6465e6, 0x40b384, - 0x146e44, 0x54f471, 0x119f79, 0x11a9b3, 0x5235b8, 0x342402, 0x6b0380, 0x51a403, 0x22e30f, - 0x1f23ba, 0x468cdf, 0x5a9ccf, 0x77c486, 0x613650, 0x411539, 0xa, - ], - CURVE_Pxbbb: [ - 0x6f4899, 0x2150a, 0x750cb5, 0x4952b2, 0x1c51eb, 0x179378, 0x295e64, 0x5b5457, 0x47a789, - 0x1403f8, 0x62578c, 0x2f5d38, 0x7fe82c, 0x6cff62, 0x32162, 0x3acbe5, 0x1e3000, 0x668f, - 0x426a4b, 0x4f46ed, 0x57a328, 0x62acf0, 0xf705b, 0x7baa3c, 0xd, - ], - CURVE_Pyaaa: [ - 0x137844, 0x2f9f68, 0x4ddb82, 0x4ffa79, 0x44ec64, 0x6d10a3, 0x1beaf1, 0x4b2f5c, 0xb8a71, - 0x20ab1c, 0x225b80, 0x663e7c, 0x673c10, 0x7e8ea9, 0x2fc388, 0x66e9cc, 0x202f56, 0x39587c, - 0x343e8c, 0x52c8bf, 0x6190b, 0x11fb0e, 0x6124d5, 0x337685, 0x7, - ], - CURVE_Pyaab: [ - 0x483190, 0x6491db, 0x424978, 0x23544c, 0x2eaaf4, 0x31a65, 0x48eeb1, 0x7eeb0e, 0x91f2f, - 0x2d992c, 0xf07c, 0x4ae56f, 0x688ed2, 0x62e3a0, 0x284758, 0x15cf7, 0x7e205e, 0x9fa40, - 0x24ea65, 0xce87c, 0x7a1c42, 0x1c4d1d, 0x4f76aa, 0x3ce59c, 0x2, - ], - CURVE_Pyaba: [ - 0x185c0d, 0x3fa083, 0xfa771, 0x50c8ee, 0xd404d, 0x759d3, 0x697d52, 0x6598bc, 0x685c7c, - 0x612d58, 0x160d06, 0x2201f3, 0x5c797c, 0x10c374, 0xe7e1c, 0x52fa00, 0x1f60b0, 0x42b24, - 0x7635e0, 0xdd262, 0x140d61, 0x26a7e6, 0x595fbc, 0x22cde4, 0xd, - ], - CURVE_Pyabb: [ - 0x1d42f8, 0x41502b, 0x5d7dbf, 0x88b12, 0x243afd, 0x3cfe57, 0x4ec3fa, 0x2fb013, 0x7c3cff, - 0x1d3717, 0x79401a, 0x33c434, 0x635f37, 0x29e4f6, 0x2ca2db, 0x7a8ef0, 0x3fd902, 0x3309c9, - 0x1f125b, 0x3ff0c9, 0x7310, 0x3137db, 0x280e0b, 0x70755, 0xa, - ], - CURVE_Pybaa: [ - 0x38039f, 0x25673e, 0x184354, 0x3e78d1, 0xee895, 0x1279f, 0x285016, 0x445c85, 0x4bfe85, - 0x7f8597, 0x2aedd5, 0x2e62f9, 0x32710c, 0x4f5b51, 0x59016c, 0x6178c7, 0x6e268e, 0x2d39ef, - 0x2c36b6, 0x717762, 0x1d1abc, 0x323714, 0x7c7bb9, 0x582324, 0x2, - ], - CURVE_Pybab: [ - 0x5f7865, 0x40de52, 0x20e9a7, 0x7439d3, 0x3f0756, 0x595baf, 0x7cfc76, 0x287b18, 0x56074e, - 0x186679, 0x416ec0, 0x1dc812, 0x127fbe, 0x18d9b5, 0x3c4a9d, 0x1c2bb4, 0x135ca4, 0x7a40ac, - 0x739984, 0x6f008c, 0x7180ea, 0x58af6d, 0x5b4b02, 0x9194c, 0x3, - ], - CURVE_Pybba: [ - 0x4c1979, 0x753ecf, 0x6f0760, 0x3bb13c, 0x4aaf9c, 0x6bfb52, 0x470858, 0x41323d, 0x5401d8, - 0x494404, 0x5ccf5c, 0xbcf06, 0x7e6ecf, 0x5a9c20, 0xd2dff, 0x64ff44, 0x31645b, 0x4ee883, - 0x4e22ec, 0x112445, 0x486c5c, 0x5c8211, 0x67da66, 0x400692, 0xc, - ], - CURVE_Pybbb: [ - 0x49f25b, 0x12ac5f, 0x5d33f2, 0x35d356, 0x2c4f80, 0x3a4c9e, 0x3c5a72, 0x426c74, 0x5dac92, - 0x52c146, 0x61366b, 0x6cde77, 0x5a9e8f, 0x6dff70, 0x6d20e3, 0x5a60e6, 0x33df1a, 0x2afa7, - 0x390f0, 0x6320a2, 0x3f5493, 0x1cc373, 0x174990, 0x7b09b, 0xa, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: true, - - //debug: false, - }; - - return ROM_CURVE_BLS48556; -}; - -ROM_CURVE_BLS48286 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS48286 = { - // BLS48286 Curve - // Base Bits= 23 - CURVE_Cof_I: 62958, - CURVE_Cof: [0xf5ee, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 10, - CURVE_B: [0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x612c81, 0x2365fa, 0x7ff10, 0x1794b8, 0xf2882, 0x1fc453, 0x253ef9, 0x359315, 0x7c9ede, - 0x602a6b, 0x1af27a, 0x4, 0x0, - ], - CURVE_Gx: [ - 0x5d59e0, 0x7d4612, 0x577225, 0x677dd0, 0x597475, 0x9a33b, 0x50693a, 0x602a23, 0x6c0f04, - 0x11f68e, 0x44836e, 0x39219e, 0x69, - ], - CURVE_Gy: [ - 0x2beb43, 0x53f2e1, 0xbbbbd, 0x2c071f, 0x37ce6b, 0x1583e4, 0x7b94ec, 0x519846, 0x7f979a, - 0x5af112, 0x7995b8, 0x472050, 0x203, - ], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0xf5ef, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxaaa: [ - 0x6106b5, 0x46930a, 0x3fa105, 0x662660, 0x43b1ce, 0x3ea359, 0x6b2bf6, 0x3d4a96, 0x4caeb, - 0x2544f6, 0x4c71c7, 0x67ea02, 0x22a, - ], - CURVE_Pxaab: [ - 0x6d1a55, 0x237b12, 0x6a77b3, 0x29c48e, 0x277185, 0x6ad728, 0x164bfb, 0x264519, 0xc873e, - 0x4b1a4a, 0x2d7216, 0x5dcccb, 0x18d, - ], - CURVE_Pxaba: [ - 0x57a35e, 0x3474cf, 0xe204, 0x662c53, 0x7af4e8, 0x5e8393, 0x41ad4a, 0x6e0cd2, 0x3de1d4, - 0x62f5c5, 0x7829f0, 0x1496ae, 0xa8, - ], - CURVE_Pxabb: [ - 0x7023e8, 0xa4185, 0x428a3a, 0x799e96, 0x191b5c, 0x45b13e, 0x3d77ed, 0xf392e, 0x1f92e8, - 0x1b1776, 0x7eb253, 0x5f06aa, 0x202, - ], - CURVE_Pxbaa: [ - 0x14cb9b, 0x1ab71e, 0x3622e6, 0x7f12aa, 0x217d62, 0x72d443, 0x5b5546, 0x3e38f7, 0x225964, - 0x45096a, 0x78fdd, 0x139b4d, 0x175, - ], - CURVE_Pxbab: [ - 0x60dd54, 0x650d96, 0x10efda, 0x1b8d12, 0x532b9, 0x7d3817, 0x535f9a, 0x6b1c6a, 0x2d3760, - 0x668d88, 0x7a7567, 0xf5242, 0x110, - ], - CURVE_Pxbba: [ - 0x5776da, 0x361573, 0x7e8829, 0x9089a, 0x657276, 0x5b5754, 0x162f92, 0x26f20a, 0xe4aad, - 0x3f9dec, 0x187f90, 0x37e71, 0xf6, - ], - CURVE_Pxbbb: [ - 0x350a8e, 0x447051, 0x2d7cff, 0x1304e7, 0x7554ef, 0x5934ae, 0x648e87, 0x139670, 0x68c000, - 0x2cd8a2, 0x483465, 0x598734, 0x1f0, - ], - CURVE_Pyaaa: [ - 0x6988be, 0x2bfacf, 0x3b89b3, 0x74bc5e, 0x7e5ef8, 0x1d1663, 0x1513c5, 0x781cd9, 0x38694f, - 0x2af8fe, 0x258b35, 0x7c66d, 0x21f, - ], - CURVE_Pyaab: [ - 0x711b92, 0x2cda1b, 0x21de1, 0xf5e2f, 0x333180, 0x681970, 0x4a7c36, 0xdc200, 0x5e1586, - 0x528744, 0x1bfb5e, 0xe0ff6, 0xe0, - ], - CURVE_Pyaba: [ - 0x7dd06a, 0x74cf57, 0x4951f3, 0x467f2c, 0x3cdab0, 0x571cc9, 0x2a634b, 0x12ad70, 0x335eff, - 0x45b3d7, 0xf5afa, 0x7fdc6, 0x12c, - ], - CURVE_Pyabb: [ - 0xa47f4, 0x3fa6f1, 0x4a2cf7, 0x308359, 0x15f9a3, 0x62afa3, 0x4e1447, 0x1a5942, 0x5d352b, - 0x743bb7, 0x6f7ffc, 0x418f2a, 0x156, - ], - CURVE_Pybaa: [ - 0x639e77, 0x36e68b, 0x132dbb, 0x7ca9c6, 0x48190f, 0x232649, 0x37bc94, 0x6fb23e, 0x74193e, - 0x569ebd, 0x6213, 0x472055, 0x73, - ], - CURVE_Pybab: [ - 0x4975c6, 0x50286c, 0x2c0ca0, 0x654460, 0x624ad9, 0x26e477, 0x436b98, 0x50cb4d, 0x369be1, - 0x7238a0, 0x25b890, 0x2c3b34, 0x136, - ], - CURVE_Pybba: [ - 0x3f2d7c, 0x735783, 0x102f4c, 0x59d512, 0x713ef1, 0x6fe36, 0x2674e, 0x5b0a2d, 0x288f81, - 0xbdc69, 0x450f27, 0x541ba, 0x1fb, - ], - - CURVE_Pybbb: [ - 0x1130a6, 0x41a3ca, 0x76aaa6, 0x1b12a9, 0x39e708, 0xd0fdd, 0x59da9f, 0x76d23, 0x32d633, - 0x342eef, 0x1ab27a, 0x79bc6e, 0x193, - ], - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BLS48286; -}; - -ROM_CURVE_BLS12381 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS12381 = { - // BLS12381 Curve - // Base Bits= 23 - - CURVE_Cof_I: 0, - CURVE_B_I: 4, - CURVE_B: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x1, 0x7ffe00, 0x7bffff, 0x7ff2df, 0x5a402f, 0xaa77, 0x26876, 0x1cec04, 0x7d4833, 0x26533a, - 0x4fb69d, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x22c6bb, 0x6015b6, 0x3feceb, 0x4bd0d7, 0x5e83ff, 0xb0d8a, 0x45c6eb, 0x271d1f, 0x3905a1, - 0x1f2ee9, 0xda231, 0x4d607e, 0x38c4fa, 0x4d2ac, 0x65f5e5, 0x69d398, 0x17f1, - ], - CURVE_Gy: [ - 0x45e7e1, 0x46528d, 0x1032a8, 0x144457, 0x4c744a, 0x7dba07, 0x4b012c, 0x6d8c65, 0xaf600, - 0x2baba0, 0x73d782, 0x6c5727, 0xed741, 0x3413c6, 0x6aa83c, 0x7a40f1, 0x8b3, - ], - CURVE_HTPC: [ - 0x6821b8, 0x20c57b, 0x6df314, 0x72e2bf, 0x69520e, 0x621116, 0x500ff0, 0x376dee, 0x9ff04, - 0x69291a, 0x4bc077, 0x38ded0, 0x4a9a3d, 0x1b671e, 0x5b2fdd, 0x231645, 0x1f7, - ], - - CURVE_Bnx: [ - 0x10000, 0x0, 0x34804, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x10001, 0x0, 0x34804, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0xAAAB, 0x555600, 0x5A3002, 0x2AAF0A, 0x48C005, 0x72D, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0x21bdb8, 0x2d9182, 0x3f5201, 0x402ddf, 0x40326a, 0x2ee175, 0x1eb8f4, 0x2885b2, 0x3b02b4, - 0x29f480, 0x1b91eb, 0x28828e, 0x5272dc, 0x24c100, 0x23c2a4, 0x515978, 0x24a, - ], - CURVE_Pxb: [ - 0x42b7e, 0x7a0aba, 0x5f96b1, 0x1ca2ea, 0x4f1121, 0x92669, 0x771fd4, 0x6d30dd, 0x361ab5, - 0x213241, 0x65af43, 0x3a7b2a, 0x3a0882, 0xfb59a, 0x1c67d8, 0x15b029, 0x13e0, - ], - CURVE_Pya: [ - 0x382801, 0x290c11, 0x27864d, 0x5d6514, 0x2c9cc3, 0x259247, 0x545834, 0x214d34, 0x53a76d, - 0x55197b, 0x37f66e, 0x71a8d5, 0x5c6da2, 0x319939, 0x1f5b84, 0x6a93b9, 0xce5, - ], - CURVE_Pyb: [ - 0x5f79be, 0xebfe0, 0x6aaa4, 0x6760ed, 0x70d275, 0x3567e6, 0x55cba6, 0x3a4955, 0x63af26, - 0x7d0b4e, 0x2cf8a1, 0x145cce, 0x2b02bc, 0x6559a, 0x29cd33, 0x625017, 0x606, - ], - - CURVE_HTPC2: [ - 0x78492b, 0x627501, 0x51f09d, 0x7754d1, 0x45087, 0x32e477, 0x7532db, 0x4f9b0e, 0x5735f4, - 0x5c4ea3, 0x7eb54d, 0x6735a4, 0x48c21e, 0x7203ac, 0x1e011, 0x4c45ce, 0x52, - ], - CURVE_Ad: [ - 0x584c1d, 0x50105a, 0x7d73d0, 0x707cb, 0x36f8da, 0x359312, 0x3bf620, 0x744c0d, 0x66a8d8, - 0x2707dc, 0x43aa61, 0x6a4c15, 0x202c96, 0x67ad27, 0x6e3a50, 0x234c51, 0x14, - ], - CURVE_Bd: [ - 0x172be0, 0x11d31c, 0x174731, 0xb6755, 0x3215a3, 0x5eab44, 0x73bcd7, 0x5ce0a7, 0x4070a0, - 0x61e49e, 0x5b07, 0x7771d9, 0x2e8753, 0x3162, 0x5a200c, 0x484688, 0x12e2, - ], - PC: [ - [ - 0x22d229, 0x745d17, 0x7ea722, 0x3269c8, 0x31b80b, 0x6d1849, 0x70931a, 0x605f8d, 0x37bc23, - 0x7c4590, 0x475e75, 0x6f71e9, 0x62381e, 0x17a3d2, 0x9839c, 0x461247, 0x6e0, - ], - [ - 0x5fb7b, 0x3e7e2c, 0x33299f, 0x6142ef, 0x3771f8, 0xcded3, 0xec52, 0x579b0, 0x7f96d5, - 0x3bccf0, 0x69f733, 0x32d86f, 0x409d25, 0x4e5b1d, 0x7381f8, 0xed03c, 0x1032, - ], - [ - 0x390c9e, 0x20cf7c, 0x65fc90, 0x60193b, 0x10b2ed, 0x6ff463, 0x3d2ec6, 0x318a5d, 0x5c9967, - 0x7418, 0x74bb2e, 0x1c7916, 0x7515d1, 0x5c186, 0x73e9f1, 0xfc70d, 0x169b, - ], - [ - 0x17e317, 0x30d509, 0x55b5c6, 0x35ba74, 0x295f29, 0x3bc9f4, 0x4a3174, 0x62cb64, 0x5574a2, - 0x59cf3e, 0x10edd5, 0x74c86e, 0x33563b, 0xf7216, 0x69e3f1, 0x1e78fc, 0x80d, - ], - [ - 0x70c88e, 0x2c31c7, 0x3e732d, 0x47a3ad, 0x7c8f8c, 0x266736, 0x3c3c9d, 0x416317, 0x4db1a6, - 0x564eb6, 0x55b796, 0xbf299, 0x84d11, 0x5d0e87, 0x6af6f8, 0xf3b80, 0x17b8, - ], - [ - 0x39ed84, 0x644b42, 0x2b775f, 0x82976, 0x25128c, 0x6551b4, 0x3e721a, 0x4710c, 0xce190, - 0x4c9e1f, 0x445618, 0x3295fd, 0x6c38ae, 0x2d46e4, 0x79134a, 0x6b2a9f, 0xd6e, - ], - [ - 0x652983, 0x38cde, 0x67344f, 0x5739e8, 0x70d2dc, 0x721410, 0x25f9a3, 0x69d5c8, 0x799b9e, - 0x7bb2a4, 0x6cf2c5, 0x3a55ae, 0x1bf7a, 0x603a24, 0x5cc4ff, 0x619286, 0x1630, - ], - [ - 0x895d9, 0x19d359, 0x114455, 0xf3be, 0x2286f3, 0x3130b, 0x660beb, 0x3775b2, 0x7b3f08, - 0x3424af, 0x676e65, 0xc72a4, 0x4b3e41, 0x6cc856, 0x667d10, 0x393518, 0xe99, - ], - [ - 0x1b6861, 0x10c83b, 0x4f16ce, 0x18838c, 0x6e25ce, 0x106a66, 0x7c6ccc, 0x599944, 0x3f25f1, - 0x4ad51b, 0x5fd791, 0x2aa096, 0x1d307e, 0x69c0c1, 0x731b6d, 0x738b37, 0x1778, - ], - [ - 0x1edcb0, 0x3f3b59, 0x7f805e, 0x504b94, 0x43e3d2, 0x4b92b1, 0x7b1a38, 0x3c7280, 0x3e568, - 0x6652b3, 0x380c91, 0x54d0de, 0xc5d10, 0x3a209, 0x5d9e3b, 0x2edc, 0xd54, - ], - [ - 0x4b83bb, 0x5de367, 0x5ba0d3, 0x18c61a, 0xf2a6f, 0xd6907, 0x1c347a, 0x32f19e, 0x417f5, - 0x365ed5, 0x705f9d, 0x3d40e3, 0x2b2214, 0x60b117, 0x50eacb, 0x2769f4, 0x1729, - ], - [ - 0x4649b7, 0x2cc4e6, 0x3abab0, 0x17316b, 0xc2d5f, 0x590ac2, 0x336d38, 0x313dab, 0x5ff2, - 0x1145ae, 0x2cc0fa, 0x40ac2b, 0x1dd99, 0x170122, 0x20ccd0, 0x2f958f, 0x11a0, - ], - [ - 0x6cdd0a, 0x9a2d1, 0xb58e, 0x5bc328, 0x74e4b4, 0x2b262, 0x5e3cc7, 0x6fa99c, 0x503776, - 0x5d2def, 0x5a0ad3, 0x2b3407, 0x63eb3a, 0x8edad, 0x7a4ab5, 0x609d5c, 0x95f, - ], - [ - 0x21d641, 0x5874f3, 0x411ddb, 0x5dd21b, 0x26692a, 0x6a070, 0x1fce62, 0x806d3, 0x366b74, - 0x3ae2c2, 0x1fe34, 0x3d1e67, 0x33dafc, 0x4bd241, 0x6953e0, 0x767b56, 0xa10, - ], - [ - 0x4c5a5e, 0x33377b, 0x4c47df, 0x688f16, 0x5b9489, 0xb01f4, 0x7e608b, 0x4b70e6, 0x68a819, - 0x43794, 0x39fd8f, 0x780ccb, 0x5b074c, 0x46167e, 0x592a2c, 0x56154e, 0x14a7, - ], - [ - 0x684a3a, 0x6892dd, 0x33b095, 0x786f03, 0x3b3538, 0x539d4e, 0x18abb7, 0x170398, 0x21894e, - 0x335ea7, 0x5c3d5e, 0x4b390a, 0x463e05, 0x21e7c1, 0x5a4d86, 0x655678, 0x772, - ], - [ - 0x6304a5, 0x73453e, 0x4700b7, 0x211478, 0xd24bc, 0x5ee80, 0x492e26, 0x21de77, 0x2d4d0a, - 0x539d39, 0x655cd7, 0x363749, 0x77f050, 0x2aa721, 0x3999ee, 0x2afc72, 0xe73, - ], - [ - 0x32a21e, 0x72b66a, 0x754e74, 0x79abc0, 0x29ba81, 0x5b537a, 0xcecc1, 0x35a274, 0x62bb8d, - 0x334240, 0x7f7f1d, 0x3d03ef, 0x55f43e, 0x14de3, 0xa452a, 0x70b101, 0x13a8, - ], - [ - 0x462cd8, 0x51271b, 0x104c37, 0x7767ae, 0x6d5243, 0x7a092e, 0x70a35b, 0x665455, 0x655154, - 0x7e2d62, 0x6c2090, 0x75aa2, 0x7ef7c4, 0x590755, 0x62b8bf, 0x2ac0d2, 0x342, - ], - [ - 0x383e19, 0x7374b9, 0x73f308, 0x64a7f6, 0x3d0967, 0x559ad4, 0x2c46b3, 0x532700, 0xcd1fc, - 0x5eb4e3, 0x3e2505, 0x14c8fb, 0x629bff, 0x5026fc, 0x68c897, 0x317f2b, 0xb29, - ], - [ - 0x2b3bff, 0x4edd90, 0x279720, 0x658137, 0x2a8846, 0x6ae27b, 0x23122f, 0x13612c, 0xc01, - 0x1419e1, 0x4107a3, 0x29b1b3, 0x11298e, 0x69168e, 0x556710, 0xd2ef5, 0x1256, - ], - [ - 0x521b1c, 0x73f481, 0x6264f3, 0x71a1ef, 0xd681b, 0xc56ab, 0x5ff22b, 0x4ac430, 0x48ba9c, - 0x1746b6, 0x757bd, 0x1fd378, 0x62f4bd, 0x43165c, 0x3fc66b, 0x46aa46, 0x8ca, - ], - [ - 0x48b604, 0x2d7cd3, 0x5c12d1, 0x7600e3, 0x5027ef, 0x3656cc, 0x256bc0, 0x56ea7d, 0x5a3957, - 0x1f092c, 0x2c6076, 0x7975ae, 0x33b42d, 0x49d4a1, 0x43c0f3, 0x5f274c, 0x15e6, - ], - [ - 0x75224b, 0x3ce2a8, 0x5e19ac, 0x2bcd7d, 0x1049b6, 0x1c8d74, 0x4e5a9f, 0x5587ae, 0x6568d9, - 0x3afd0, 0x799cf6, 0x251fe2, 0x1f748c, 0x20542b, 0x1133c4, 0x14b22f, 0x5c1, - ], - [ - 0x180133, 0x27ebb7, 0x110b67, 0x611953, 0x790ad1, 0x3398d9, 0x4f1019, 0x733196, 0x158013, - 0x101a98, 0x55ecec, 0x18aee3, 0xae7be, 0x6e5f80, 0x47b2a6, 0x51ca56, 0x245, - ], - [ - 0x171ef8, 0x9e017, 0x483530, 0xc908f, 0x51c19, 0x67e0d9, 0x1ed18, 0x138874, 0x308ec0, - 0x54684d, 0x6a9ec4, 0x29fa23, 0x16004f, 0x3a2aa1, 0x6e4e6, 0x165608, 0xb18, - ], - [ - 0x74d8e, 0x1149a0, 0x1b381f, 0x5a26b0, 0x1cdf41, 0x6493b, 0x6447d9, 0x35ff3f, 0x42462e, - 0x7155e1, 0x48d566, 0x176e62, 0x143fed, 0x572318, 0x4dbdb7, 0x354847, 0x18b4, - ], - [ - 0x11c132, 0x6235a0, 0x73a04d, 0x71fdd7, 0x73a5cc, 0x420637, 0x58e279, 0xc1f20, 0x493fd1, - 0x16d95e, 0x34bf2f, 0x1fdc9e, 0x38f1d4, 0x41bfa1, 0x5f346f, 0x1f23c9, 0x1971, - ], - [ - 0x731c30, 0x55d794, 0x3caebe, 0x6a75d3, 0x77055d, 0x77367, 0x347935, 0x4c2f3f, 0x76fe06, - 0x4f22b5, 0x10a832, 0xa511e, 0x5e7ada, 0x244757, 0x61af6d, 0x5d3d08, 0xe1b, - ], - [ - 0x5ba587, 0x1caef7, 0xd80dc, 0x3c303d, 0x65201c, 0x57cd3a, 0x7c832, 0x45b735, 0x426c1e, - 0x2ccf3b, 0x3ceaf4, 0x6d0ddc, 0x6221e4, 0x7d1193, 0x659a12, 0x200c5e, 0x9fc, - ], - [ - 0x70fb29, 0x194630, 0x568579, 0x76ff49, 0x64550f, 0x4c85e, 0x309b21, 0x1c6d3, 0x581ffd, - 0x7fc77b, 0x5c2816, 0x3633a0, 0x6bd2ca, 0x7bd324, 0x4eae1b, 0x646a99, 0x987, - ], - [ - 0x69d6f2, 0x710abf, 0x7b2587, 0x307a0a, 0x7ac24, 0x66e8f5, 0x1358d3, 0x18a09e, 0x4cb52, - 0x1457c3, 0x1d6ee3, 0x4b59e7, 0x7d0277, 0x16592e, 0x6b06ef, 0x5cde7, 0x4ab, - ], - [ - 0x33a5f0, 0x75626c, 0x4a66c8, 0x4ad403, 0x76326c, 0x9c407, 0x4eb555, 0x282e1e, 0x37bd76, - 0x295f5b, 0x529f43, 0x53503, 0x11db8f, 0x44423c, 0x18d2da, 0x1fe520, 0x1660, - ], - [ - 0x68fedb, 0x35d9e5, 0x2106db, 0x4c8205, 0x7f8dc0, 0x5b85dc, 0x84d46, 0x419fe9, 0x50b879, - 0x77c79c, 0x6554db, 0x294e20, 0x7e2a21, 0x6b95e9, 0x783fc4, 0x1fef7, 0x8cc, - ], - [ - 0x65f4cb, 0x38ef61, 0x3298d5, 0x7630ef, 0x5aba9, 0x1f3bc8, 0xc947, 0x7251f6, 0x791c09, - 0x721dd6, 0x50aa9e, 0x233abe, 0x51ad87, 0x2f130e, 0x260708, 0x31bb74, 0x1f8, - ], - [ - 0x2de1f6, 0x44818e, 0xee37f, 0x458029, 0x552162, 0x34fa4d, 0x645003, 0x225f25, 0x1ce2c3, - 0x2cb146, 0x154b8b, 0x5a4ca1, 0x4c86a3, 0x5e9470, 0x259b99, 0x3c35d5, 0xcc, - ], - [ - 0x41c696, 0x4eb45c, 0x7f825f, 0x317d45, 0x567119, 0x269ad8, 0x7ad9eb, 0x4831a1, 0x383d0f, - 0x584a9e, 0x488fa5, 0x5a3418, 0x6d776f, 0x3aa206, 0x3b9604, 0x4b5082, 0x1349, - ], - [ - 0x7bb33, 0xae32e, 0xafa61, 0x59dd1e, 0x47aee9, 0x7a79a1, 0x255950, 0x2957b6, 0x69522b, - 0x1c9150, 0x46b44e, 0x6e7d0, 0x709498, 0x4b3a3, 0x6893b8, 0x4be40d, 0x90d, - ], - [ - 0x634b8f, 0xe743a, 0x11055, 0x9a4bc, 0x2f570f, 0x440b94, 0xd5b2a, 0x277e6b, 0x385332, - 0x4bc4e7, 0x47103d, 0x40ce0b, 0x55e0d7, 0x4d6484, 0x37700f, 0x50ec0b, 0xe0f, - ], - [ - 0x6d06f7, 0x38264d, 0x347eb, 0x38a664, 0x517bd8, 0x1c840, 0x1e5092, 0x3a46f9, 0x27c1cb, - 0x29ce52, 0x7d596e, 0x6bb795, 0x50d53c, 0x6c517b, 0x4b93ce, 0x20075, 0x266, - ], - [ - 0x3345cc, 0x6270ae, 0x47a66, 0x1dc856, 0x763e, 0x70d260, 0x680366, 0x2e777c, 0x2267d, - 0x3315be, 0x50cd1b, 0x78a4b2, 0x144b45, 0x786c26, 0x1d9ff8, 0x5ca8a6, 0xad6, - ], - [ - 0x561092, 0x6a53c4, 0x2a5a12, 0x7bf5df, 0x168986, 0x26a2df, 0x33a9e4, 0x7cd44, 0x42d28c, - 0x15df9c, 0x7e53fe, 0x28623b, 0x41e48c, 0x7eb0a5, 0x740cf, 0x5db3a4, 0xacc, - ], - [ - 0xf6aa8, 0x693975, 0x1003e2, 0x7c1830, 0x5c29f4, 0x390e34, 0x398da9, 0x2c8d9b, 0x26290e, - 0x7376c3, 0x71b740, 0x1488ec, 0xa01ad, 0x291e02, 0x29016f, 0x792cf7, 0x4d2, - ], - [ - 0x113f55, 0x691771, 0x78d1bb, 0x294d9a, 0x5ea3d, 0x1f78e7, 0x1fa9f5, 0x42c97, 0x7bb53, - 0x47c27b, 0x485bdd, 0x542481, 0x597d94, 0x1d5040, 0x429b87, 0x2ae6d3, 0x167a, - ], - [ - 0x535d4a, 0x7b3aaa, 0xdac8c, 0x5c9244, 0x7e2f7b, 0x690a59, 0x12fce6, 0x62ba86, 0x5920ab, - 0x498d5e, 0x67ec33, 0x3a6627, 0x54fd1d, 0x63437c, 0x5b1848, 0x647699, 0x1866, - ], - [ - 0x12ed9, 0x2b42b, 0x1183b9, 0x400ef7, 0xf5b00, 0x265724, 0x18d5c, 0x59a7e9, 0x4fd7fe, - 0x3df43e, 0x1690dd, 0x37fb77, 0x5fabba, 0x40779b, 0xfa9fa, 0x77845f, 0x16a3, - ], - [ - 0x6a775c, 0x273224, 0x64f468, 0x2c58fd, 0x29c01a, 0xa3abf, 0x100280, 0x69b2de, 0x78ef5d, - 0x751a19, 0x7bb3f7, 0x4c125a, 0x734ace, 0x787750, 0x2676cb, 0x3e045, 0x1660, - ], - [ - 0x79b7ac, 0xeff55, 0x80b19, 0x7d4e67, 0x38db9d, 0x4c893e, 0x5bc3d6, 0x766c3d, 0x5881c5, - 0xcaaa1, 0x5c054b, 0x418c15, 0x6eaac7, 0x33f64c, 0x61b6cb, 0x7294b8, 0x8d9, - ], - [ - 0x25001d, 0x284623, 0x3768e4, 0x7e976f, 0x315dc0, 0x22d441, 0x7277b2, 0x176d07, 0x3bb054, - 0x3e1ed3, 0x1b4672, 0x146ee6, 0x112f82, 0x160199, 0x17d0f9, 0x703caa, 0xbe0, - ], - [ - 0x5f5416, 0x5b3088, 0x36a349, 0x1414bd, 0x364f2c, 0x682e4e, 0x79c9ab, 0x1ed244, 0x530e12, - 0x37bb79, 0x445717, 0x6da68e, 0x3bf89e, 0x3e41a4, 0x6394e5, 0x69443c, 0x16b7, - ], - [ - 0x3f67f2, 0x716a7b, 0x247894, 0x37cb7c, 0x57cd63, 0x5d94ce, 0x49e734, 0x1ad2ee, 0x7f310c, - 0x2aa35c, 0x631215, 0x758abb, 0x67d6e8, 0x6df555, 0x103689, 0x799833, 0x58d, - ], - [ - 0x49a03d, 0x20585c, 0x54cbd8, 0x1a94f1, 0x426076, 0x3ef14, 0x3d14f8, 0x5081ab, 0x559ca4, - 0x6e6389, 0x17213f, 0x1a45c4, 0x56c43c, 0x434197, 0x604807, 0x6bae11, 0x1962, - ], - [ - 0x3663c1, 0x24a760, 0x34051e, 0x306103, 0x3688ef, 0x4f40fe, 0x56f9cb, 0x619195, 0xbe6ee, - 0x4af130, 0x69b7, 0x7574b, 0x140fad, 0x4a4302, 0x27262c, 0x16261d, 0x1611, - ], - ], - CURVE_Adr: [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Adi: [ - 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Bdr: [ - 0x3f4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Bdi: [ - 0x3f4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - PCR: [ - [ - 0x2a5ed1, 0x555555, 0x46238a, 0x7b38e3, 0xe38d0, 0x2eae13, 0x450ae1, 0x6b0847, 0x10aa22, - 0x4fe9d0, 0x2c52d3, 0x7db0a6, 0x2691f5, 0x5dadbd, 0xe333e, 0x32a0fd, 0x171d, - ], - [ - 0x7fc71e, 0x7fffff, 0x549aa7, 0x5c6aaa, 0x2aaa9c, 0x3028e, 0x53c829, 0x104635, 0xc7f9a, - 0x5bef5c, 0x613e1e, 0x3e447c, 0x7ced78, 0x6424d, 0x6aa66f, 0x5f8bd, 0x1156, - ], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x2a97d6, 0x555555, 0x7188e2, 0x1ece38, 0x638e34, 0x2bab84, 0x7142b8, 0x5ac211, 0x42a88, - 0x73fa74, 0x4b14b4, 0x3f6c29, 0x29a47d, 0x576b6f, 0x238ccf, 0x2ca83f, 0x5c7, - ], - [0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x718b10, 0x638e38, 0x6786cd, 0x36e25e, 0x1097a5, 0xa49cf, 0x26a89d, 0x74bbe3, 0x6286b0, - 0x6f43c4, 0x586c3c, 0x8d683, 0x43de38, 0x7f7ee0, 0x5b3de6, 0x4d6a1d, 0x124c, - ], - [ - 0x7fc71c, 0x7fffff, 0x549aa7, 0x5c6aaa, 0x2aaa9c, 0x3028e, 0x53c829, 0x104635, 0xc7f9a, - 0x5bef5c, 0x613e1e, 0x3e447c, 0x7ced78, 0x6424d, 0x6aa66f, 0x5f8bd, 0x1156, - ], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x46d706, 0xe38e3, 0x204b3f, 0x46497b, 0x425ebf, 0x201f91, 0x1f49f9, 0x221cec, 0x649bf5, - 0x2940fe, 0x3df697, 0x688c98, 0x18b076, 0x6b3498, 0x2d044e, 0x23be3d, 0x1530, - ], - [0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7fa8fb, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - ], - PCI: [ - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7fe38d, 0x7fffff, 0x2a4d53, 0x2e3555, 0x15554e, 0x418147, 0x69e414, 0x8231a, 0x63fcd, - 0x2df7ae, 0x309f0f, 0x1f223e, 0x7e76bc, 0x432126, 0x755337, 0x2fc5e, 0x8ab, - ], - [ - 0x7fc71a, 0x7fffff, 0x549aa7, 0x5c6aaa, 0x2aaa9c, 0x3028e, 0x53c829, 0x104635, 0xc7f9a, - 0x5bef5c, 0x613e1e, 0x3e447c, 0x7ced78, 0x6424d, 0x6aa66f, 0x5f8bd, 0x1156, - ], - [ - 0x2a97d6, 0x555555, 0x7188e2, 0x1ece38, 0x638e34, 0x2bab84, 0x7142b8, 0x5ac211, 0x42a88, - 0x73fa74, 0x4b14b4, 0x3f6c29, 0x29a47d, 0x576b6f, 0x238ccf, 0x2ca83f, 0x5c7, - ], - [ - 0x7faa9f, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [ - 0x7faa63, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7fe38f, 0x7fffff, 0x2a4d53, 0x2e3555, 0x15554e, 0x418147, 0x69e414, 0x8231a, 0x63fcd, - 0x2df7ae, 0x309f0f, 0x1f223e, 0x7e76bc, 0x432126, 0x755337, 0x2fc5e, 0x8ab, - ], - [ - 0x2a97be, 0x555555, 0x7188e2, 0x1ece38, 0x638e34, 0x2bab84, 0x7142b8, 0x5ac211, 0x42a88, - 0x73fa74, 0x4b14b4, 0x3f6c29, 0x29a47d, 0x576b6f, 0x238ccf, 0x2ca83f, 0x5c7, - ], - [ - 0x46d706, 0xe38e3, 0x204b3f, 0x46497b, 0x425ebf, 0x201f91, 0x1f49f9, 0x221cec, 0x649bf5, - 0x2940fe, 0x3df697, 0x688c98, 0x18b076, 0x6b3498, 0x2d044e, 0x23be3d, 0x1530, - ], - [ - 0x7faa99, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [ - 0x7fa9d3, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - [ - 0x7fa8fb, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BLS12381; -}; - -ROM_CURVE_BLS12461 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BLS12461 = { - // BLS12461 Curve - // Base Bits= 23 - - CURVE_Cof_I: 0, - CURVE_B_I: 9, - CURVE_B: [ - 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - CURVE_Order: [ - 0x1, 0x0, 0x700000, 0x7f7fff, 0x7feff, 0x22000, 0x7f2000, 0x7e00bf, 0xe801, 0x40bfa0, 0x5ff, - 0x7fe00c, 0x7fff7f, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gx: [ - 0x5ee93d, 0x4d515, 0x504534, 0x773a5b, 0x2d9c00, 0x6358fe, 0x6606d4, 0x4114e1, 0x4dc921, - 0x21a6ac, 0x282599, 0x7be149, 0x436166, 0x45632e, 0x1a2fa4, 0x38967b, 0xc8132, 0x476e74, - 0x3a66d1, 0x56873a, 0x0, - ], - CURVE_Gy: [ - 0x51d465, 0x462af5, 0x51c3dd, 0x64627f, 0x517884, 0x71a42b, 0x6799a, 0x2ce854, 0x245f49, - 0x15cb86, 0x2e1244, 0x45fd20, 0x16eecb, 0x3f197d, 0x3322fe, 0x1793bd, 0x5f1c3f, 0x3ed192, - 0x452cc1, 0x3bde6d, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x0, 0x7ffc00, 0x7fffef, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x1, 0x7ffc00, 0x7fffef, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - //CURVE_Cof: [0x2AAAAB, 0x7FFD55, 0x5AAA9F, 0x5580AA, 0x7D55AA, 0x2A9FFF, 0x5555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxa: [ - 0x50a37c, 0x20630d, 0x31196d, 0x173aee, 0x1c2e49, 0x2d0f15, 0x7e467, 0x7ab270, 0x74ff92, - 0x610db6, 0x19a00f, 0x36ac0d, 0x6d78d4, 0x78520f, 0x224be5, 0x1e1386, 0x767945, 0x4a1535, - 0x4e281a, 0x662a0, 0x1, - ], - CURVE_Pxb: [ - 0x41c0ad, 0x395185, 0x37a7e1, 0x6212e5, 0x16cd66, 0x4512c1, 0x4a546, 0x200d63, 0x3ebee2, - 0x7aa535, 0x7d96c5, 0x504e99, 0x45af5b, 0x6e3da9, 0x4b9350, 0x123533, 0x2279d2, 0x1d46f9, - 0x53f96b, 0x4ae0fd, 0x0, - ], - CURVE_Pya: [ - 0x2fb006, 0x218360, 0xcdf33, 0x525095, 0x53d194, 0x125912, 0x5833f3, 0x6345a4, 0xf39f, - 0x1e7536, 0x7b46e8, 0x3edde2, 0x4dfd8a, 0x5ef53, 0x3489f3, 0x7a739f, 0x6070f4, 0x74fcce, - 0x1239fa, 0x113564, 0x0, - ], - CURVE_Pyb: [ - 0x71457c, 0xd5bfb, 0x2a294, 0x6e0261, 0x4d6a31, 0x6dc7f6, 0x26a3c4, 0x2b3475, 0x64492f, - 0x2e7877, 0x19e84a, 0x25f55d, 0x220be7, 0x5c70ad, 0x7c1310, 0x228ab, 0x2ab1d0, 0x6805d4, - 0x6d3eae, 0x71c080, 0x0, - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BLS12461; -}; - -ROM_CURVE_FP256BN = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_FP256BN = { - // FP256BN Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 3, - CURVE_B: [0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xb500d, 0x536cd1, 0x1af62d, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - CURVE_Gx: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0xb0a801, 0xf5c030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Pxa: [ - 0xc09efb, 0x16b689, 0x3cd226, 0x12bf84, 0x1c539a, 0x913ace, 0x577c28, 0x28560f, 0xc96c20, - 0x3350b4, 0xfe0c, - ], - CURVE_Pxb: [ - 0x7e6a2b, 0xed34a3, 0x89d269, 0x87d035, 0xdd78e2, 0x13b924, 0xc637d8, 0xdb5ae1, 0x8ac054, - 0x605773, 0x4ea6, - ], - CURVE_Pya: [ - 0xdc27ff, 0xb481be, 0x48e909, 0x8d6158, 0xcb2475, 0x3e51ef, 0x75124e, 0x76770d, 0x42a3b3, - 0x46e7c5, 0x7020, - ], - CURVE_Pyb: [ - 0xad049b, 0x81114a, 0xb3e012, 0x821a98, 0x4cbe80, 0xb29f8b, 0x49297e, 0x42eea6, 0x88c290, - 0xe3bcd3, 0x554, - ], - - CURVE_W: [ - [0x54003, 0x36e1b, 0x663af0, 0xfffe78, 0xffffff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_SB: [ - [ - [0x669004, 0xeeee7c, 0x670bf5, 0xfffe78, 0xffffff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x6100a, 0x4ffeb6, 0xb4bb3d, 0x129b19, 0xdc65fb, 0xa49d0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - ], - ], - CURVE_WB: [ - [0x30a800, 0x678f0d, 0xcc1020, 0x5554d2, 0x555555, 0x55, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x7dc805, 0x764c0d, 0xad1ad6, 0xa10bc3, 0xde8fbe, 0x104467, 0x806160, 0xd105eb, 0x0, 0x0, - 0x0, - ], - [ - 0x173803, 0xb6061f, 0xd6c1ac, 0x5085e1, 0xef47df, 0x82233, 0xc030b0, 0x6882f5, 0x0, 0x0, - 0x0, - ], - [0x91f801, 0x530f6e, 0xcce126, 0x5554d2, 0x555555, 0x55, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_BB: [ - [ - [ - 0x5aa80d, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [0x615002, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80d, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [ - 0x5aa80c, 0x5daca0, 0x1a8daa, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - ], - [ - [0x615002, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x615001, 0xeb8061, 0xd105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0xb0a802, 0xf5c030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xc2a002, 0xd700c2, 0x1a20b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0xaa000a, 0x67ec6f, 0x1a2527, 0x129992, 0xdc65fb, 0xa49e0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - [0xb0a802, 0xf5c030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_FP256BN; -}; - -ROM_CURVE_FP512BN = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_FP512BN = { - // FP512BN Curve - - // Base Bits= 23 - - CURVE_Cof_I: 1, - CURVE_B_I: 3, - CURVE_B: [ - 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x1a09ed, 0x14bea3, 0x501a99, 0x27cd15, 0x313e0, 0x346942, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CURVE_Gx: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Gy: [ - 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Bnx: [ - 0x1bd80f, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Cof: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - - CURVE_Pxa: [ - 0x3646b5, 0x52dc1b, 0x7a3c1e, 0x48397f, 0xf8731, 0x71e443, 0x6f2ef1, 0x2bdf10, 0x4dc6dc, - 0x70c6a2, 0x40914d, 0x3c6685, 0x5a57cc, 0x3736af, 0x4d63c3, 0x5de94d, 0x6a1e4b, 0x25e79, - 0x6e9d, 0x244ac4, 0x1e1386, 0x62ca67, 0xe, - ], - CURVE_Pxb: [ - 0xae0e9, 0x17dfb5, 0x6cf6d7, 0x6c4488, 0x4a411c, 0x5b9c81, 0x4e0f56, 0x286b70, 0x6e0d5e, - 0x650aa4, 0x607889, 0x5ca6cb, 0x302566, 0x48ed51, 0x1b1bbc, 0x532b6e, 0x34825e, 0x157d1, - 0x6d311a, 0x3f3644, 0x3f8506, 0x38279, 0x12, - ], - CURVE_Pya: [ - 0x5e67a1, 0x6255b, 0x178920, 0xaf7dc, 0x217ad6, 0x778b9b, 0xa022d, 0x11892a, 0x3e8edd, - 0x7bd82a, 0x5b3462, 0x34cea5, 0x65c158, 0x1ba07d, 0x5982bf, 0x42d8ef, 0x4f2770, 0x19746e, - 0x3bd6ac, 0x3dc149, 0x4c827c, 0x603d90, 0x1b, - ], - CURVE_Pyb: [ - 0x4f8e8b, 0x630d90, 0x5a162d, 0x25fbb0, 0x5c222, 0x11bfe, 0x7b89e7, 0x18856b, 0x714a4, - 0x7c5ca, 0xa25ff, 0xca0ed, 0x3d0496, 0x61936c, 0x46219e, 0xa1c60, 0x591f02, 0x62beeb, 0xd9030, - 0x3c18d6, 0x48b04e, 0x34779d, 0x14, - ], - CURVE_W: [ - [ - 0x34583, 0x712e93, 0x4fc443, 0x68b50b, 0x5fb911, 0x47fd2c, 0x7fff3d, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_SB: [ - [ - [ - 0x4b9564, 0x56411a, 0x4f3eab, 0x5da58c, 0x1010b, 0x47e30c, 0x7fff3d, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x6259ce, 0x79d12a, 0x4f9500, 0x1cbd96, 0x245bda, 0x344f21, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - [ - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x34583, 0x712e93, 0x4fc443, 0x68b50b, 0x5fb911, 0x47fd2c, 0x7fff3d, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - ], - CURVE_WB: [ - [ - 0x5a29f0, 0x66d56a, 0x305b6a, 0x2c1e98, 0x442c60, 0x42bf7f, 0x555514, 0x2aaaaa, 0x555555, - 0x2aaaaa, 0x555555, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x355d4b, 0x25744, 0x45fbac, 0x6bfc27, 0x20fc1f, 0x6bcb9e, 0x2778ae, 0x2c497d, 0x5ad40f, - 0x72c0c9, 0x4549d2, 0x29a8b1, 0x576bc3, 0x42cc1, 0x587bf8, 0x75c030, 0xd105, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, - ], - [ - 0x289aad, 0x7e700, 0x431f3c, 0x38c1f3, 0x282c11, 0x35ec57, 0x53bc57, 0x5624be, 0x6d6a07, - 0x396064, 0x62a4e9, 0x54d458, 0x6bb5e1, 0x21660, 0x2c3dfc, 0x7ae018, 0x6882, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, - ], - [ - 0x2279d1, 0x4be7f2, 0x2fd5d2, 0x210f19, 0x65745a, 0x42a55e, 0x555514, 0x2aaaaa, 0x555555, - 0x2aaaaa, 0x555555, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - CURVE_BB: [ - [ - [ - 0x1bd810, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x1bd80f, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x1bd80f, 0xd76bc, 0x4042cc, 0x587bf, 0x2f5c03, 0xd10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x6259cf, 0x79d12a, 0x4f9500, 0x1cbd96, 0x245bda, 0x344f21, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - [ - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7e31de, 0x747e6, 0xfd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x7e31dd, 0x747e6, 0xfd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x7e31de, 0x747e6, 0xfd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - [ - [ - 0x37b01e, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x37b01f, 0x1aed78, 0x8598, 0xb0f7f, 0x5eb806, 0x1a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - ], - [ - [ - 0x7e31df, 0x0747e6, 0x0fd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x2aa9af, 0x5ee3b2, 0x4f0f68, 0x11ae17, 0x45a3d4, 0x343500, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - [ - 0x37b01d, 0x1aed78, 0x008598, 0x0b0f7f, 0x5eb806, 0x001a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - [ - 0x7e31df, 0x0747e6, 0x0fd7cd, 0x224556, 0x53b7dd, 0x345c31, 0x2ac99e, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a22, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_FP512BN; -}; - -ROM_CURVE_BN254 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BN254 = { - // BN254 Curve - - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 2, - CURVE_B: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xd, 0x0, 0x10a100, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523, - ], - CURVE_Gx: [ - 0x12, 0x0, 0x13a700, 0x0, 0x210000, 0x861, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523, - ], - CURVE_Gy: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0x1, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0x3fb2b, 0x4224c8, 0xd91ee, 0x4898bf, 0x648bbb, 0xedb6a4, 0x7e8c61, 0xeb8d8c, 0x9eb62f, - 0x10bb51, 0x61a, - ], - CURVE_Pxb: [ - 0xd54cf3, 0x34c1e7, 0xb70d8c, 0xae3784, 0x4d746b, 0xaa5b1f, 0x8c5982, 0x310aa7, 0x737833, - 0xaaf9ba, 0x516, - ], - CURVE_Pya: [ - 0xcd2b9a, 0xe07891, 0xbd19f0, 0xbdbe09, 0xbd0ae6, 0x822329, 0x96698c, 0x9a90e0, 0xaf9343, - 0x97a06b, 0x218, - ], - CURVE_Pyb: [ - 0x3ace9b, 0x1aec6b, 0x578a2d, 0xd739c9, 0x9006ff, 0x8d37b0, 0x56f5f3, 0x8f6d44, 0x8b1526, - 0x2b0e7c, 0xebb, - ], - CURVE_W: [ - [0x3, 0x0, 0x20400, 0x0, 0x818000, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_SB: [ - [ - [0x4, 0x0, 0x28500, 0x0, 0x818000, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xa, 0x0, 0xe9d00, 0x0, 0x1e0000, 0x79e, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - ], - ], - CURVE_WB: [ - [0x0, 0x0, 0x4080, 0x0, 0x808000, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x5, 0x0, 0x54a80, 0x0, 0x70000, 0x1c7, 0x800000, 0x312241, 0x0, 0x0, 0x0], - [0x3, 0x0, 0x2c580, 0x0, 0x838000, 0xe3, 0xc00000, 0x189120, 0x0, 0x0, 0x0], - [0x1, 0x0, 0xc180, 0x0, 0x808000, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_BB: [ - [ - [0xd, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0x2, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xd, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0xc, 0x0, 0x106080, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - ], - [ - [0x2, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x2, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x2, 0x0, 0x10200, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0xa, 0x0, 0x102000, 0x0, 0x9f8000, 0x7ff, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - [0x2, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BN254; -}; - -ROM_CURVE_BN254CX = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_BN254CX = { - // BN254CX Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 2, - CURVE_B: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xeb1f6d, 0xc0a636, 0xcebe11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - CURVE_Gx: [ - 0x1b55b2, 0x23ef5c, 0xe1be66, 0x18093e, 0x3fd6ee, 0x66d324, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - CURVE_Gy: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Bnx: [0xc012b1, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - - CURVE_Pxa: [ - 0xd2ec74, 0x1ceee4, 0x26c085, 0xa03e27, 0x7c85bf, 0x4bbb90, 0xf5c3, 0x358b25, 0x53b256, - 0x2d2c70, 0x1968, - ], - CURVE_Pxb: [ - 0x29cfe1, 0x8e8b2e, 0xf47a5, 0xc209c3, 0x1b97b0, 0x9743f8, 0x37a8e9, 0xa011c9, 0x19f64a, - 0xb9ec3e, 0x1466, - ], - CURVE_Pya: [ - 0xbe09f, 0xfcebcf, 0xb30cfb, 0x847ec1, 0x61b33d, 0xe20963, 0x157dae, 0xd81e22, 0x332b8d, - 0xedd972, 0xa79, - ], - CURVE_Pyb: [ - 0x98ee9d, 0x4b2288, 0xebed90, 0x69d2ed, 0x864ea5, 0x3461c2, 0x512d8d, 0x35c6e4, 0xc4c090, - 0xc39ec, 0x616, - ], - - CURVE_W: [ - [0x2feb83, 0x634916, 0x120054, 0xb4038, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_SB: [ - [ - [0xb010e4, 0x63491d, 0x128054, 0xb4038, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0xbb33ea, 0x5d5d20, 0xbcbdbd, 0x188ce, 0x3fd6ee, 0x66d264, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - ], - ], - CURVE_WB: [ - [0x7a84b0, 0x211856, 0xb0401c, 0x3c012, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x220475, 0xf995be, 0x9a36cd, 0xa8ca7f, 0x7e94ed, 0x2a0dc0, 0x870, 0x300000, 0x0, 0x0, 0x0], - [0xf10b93, 0xfccae0, 0xcd3b66, 0xd4653f, 0x3f4a76, 0x1506e0, 0x438, 0x180000, 0x0, 0x0, 0x0], - [0xfaaa11, 0x21185d, 0xb0c01c, 0x3c012, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - CURVE_BB: [ - [ - [ - 0x2b0cbd, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [0x802562, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbd, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [ - 0x2b0cbc, 0xc0a633, 0xce7e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - ], - [ - [0x802562, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - [ - [0xc012b2, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [0x4ac2, 0xf, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - [ - 0x6afa0a, 0xc0a62f, 0xce3e11, 0xcc906, 0x3fd6ee, 0x66d2c4, 0x647a63, 0xb0bddf, 0x702a0d, - 0x8, 0x2400, - ], - [0xc012b2, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ], - ], - - USE_GLV: true, - USE_GS_G2: true, - USE_GS_GT: true, - GT_STRONG: false, - - //debug: false, - }; - - return ROM_CURVE_BN254CX; -}; - -ROM_CURVE_BRAINPOOL = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - /* Note that the original curve has been transformed to an isomorphic curve with A=-3 */ - - var ROM_CURVE_BRAINPOOL = { - // Brainpool curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0xe92b04, 0x8101fe, 0x256ae5, 0xaf2f49, 0x93ebc4, 0x76b7bf, 0x733d0b, 0xfe66a7, 0xd84ea4, - 0x61c430, 0x662c, - ], - CURVE_Order: [ - 0x4856a7, 0xe8297, 0xf7901e, 0xb561a6, 0x397aa3, 0x8d718c, 0x909d83, 0x3e660a, 0xeea9bc, - 0x57dba1, 0xa9fb, - ], - CURVE_Gx: [ - 0x1305f4, 0x91562e, 0x2b79a1, 0x7aafbc, 0xa142c4, 0x6149af, 0xb23a65, 0x732213, 0xcfe7b7, - 0xeb3cc1, 0xa3e8, - ], - CURVE_Gy: [ - 0x25c9be, 0xe8f35b, 0x1dab, 0x39d027, 0xbcb6de, 0x417e69, 0xe14644, 0x7f7b22, 0x39c56d, - 0x6c8234, 0x2d99, - ], - CURVE_HTPC: [ - 0xbc7b16, 0x14bb03, 0x88ebbc, 0x2deae8, 0x4730d2, 0xfd9592, 0xdf0183, 0x737593, 0xc052e1, - 0xc79cf0, 0x6665, - ], - }; - return ROM_CURVE_BRAINPOOL; -}; - -ROM_CURVE_C25519 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C25519 = { - // C25519 Curve - - CURVE_Cof_I: 8, - CURVE_B_I: 0, - CURVE_B: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xf5d3ed, 0x631a5c, 0xd65812, 0xa2f79c, 0xdef9de, 0x14, 0x0, 0x0, 0x0, 0x0, 0x1000, - ], - CURVE_Gx: [0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [ - 0x7504f, 0xd93a5, 0x3c6277, 0x5697f2, 0xa18c03, 0xebd397, 0x4c9efd, 0x95a680, 0xe0ef85, - 0x924027, 0x55c1, - ], - }; - return ROM_CURVE_C25519; -}; - -ROM_CURVE_C41417 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C41417 = { - // C41417 curve - CURVE_Cof_I: 8, - CURVE_B_I: 3617, - CURVE_B: [ - 0xe21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_Order: [ - 0x6af79, 0x69784, 0x1b0e7, 0x18f3c6, 0x338ad, 0xdbc70, 0x6022b, 0x533dc, 0x3cc924, 0x3fffac, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x7fff, - ], - CURVE_Gx: [ - 0xbc595, 0x204bcf, 0xc4fd3, 0x14df19, 0x33faa8, 0x4c069, 0x16ba11, 0x2ad35b, 0x1498a4, - 0x15ffcd, 0x3ec7f, 0x27d130, 0xd4636, 0x9b97f, 0x631c3, 0x8630, 0x144330, 0x241450, 0x1a334, - ], - CURVE_Gy: [ - 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_HTPC: [ - 0x3fffee, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3ffff, - ], - }; - - return ROM_CURVE_C41417; -}; - -ROM_CURVE_C1174 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C1174 = { - // C1174 curve - CURVE_Cof_I: 4, - CURVE_Cof: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: -1174, - CURVE_B: [ - 0xfffb61, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - CURVE_Order: [ - 0x66c971, 0xd45fd1, 0x348944, 0xdfd307, 0x7965c4, 0xfffff7, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x1ff, - ], - CURVE_Gx: [ - 0xe29eda, 0x3f27bc, 0x651612, 0x492ecd, 0x21d96a, 0xa190c0, 0xe7c029, 0x9343ae, 0x308c47, - 0xbb0cea, 0x37f, - ], - CURVE_Gy: [ - 0x46360e, 0xb1bf9b, 0x6ba4cc, 0xaf3f97, 0xe2dee2, 0xe0c4f, 0x116984, 0x665684, 0x7fb7cc, - 0x2f82d4, 0x6b7, - ], - CURVE_HTPC: [ - 0xfffff6, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - }; - - return ROM_CURVE_C1174; -}; - -ROM_CURVE_C1665 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_C1665 = { - // C1665 curve - CURVE_Cof_I: 4, - CURVE_Cof: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 5766, - CURVE_B: [0x1686, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [0x3a8b27, 0x61533b, 0x40603f, 0x7feaf7, 0x7fffff, 0x7fffff, 0x7fffff, 0x7], - CURVE_Gx: [0x552398, 0x73b7f3, 0x1b19c6, 0x7707b3, 0x1a0618, 0x20b701, 0x325369, 0xa], - CURVE_Gy: [0x120345, 0xf6489, 0x70b1c2, 0x1ceb16, 0x3bfc77, 0x378142, 0x505152, 0x14], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - }; - - return ROM_CURVE_C1665; -}; - -ROM_CURVE_MDC = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_MDC = { - // Million Dollar curve - CURVE_Cof_I: 4, - CURVE_Cof: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [ - 0xcf89, 0x92503, 0x41ee93, 0x3f21f0, 0x1270f6, 0xb9625f, 0xccfb0c, 0x7cdfbf, 0x65b68a, - 0x45219, 0x5713, - ], - CURVE_Order: [ - 0xb0f7fb, 0x52f421, 0xbb5885, 0xfaf974, 0xb38975, 0x7f534f, 0xbf75e9, 0x14cbe4, 0x15abed, - 0xda2e75, 0x3c4e, - ], - CURVE_Gx: [ - 0x68363b, 0x25bfee, 0xe2232c, 0x8d2713, 0xd72abb, 0xcf6350, 0x1e03cb, 0xd85b42, 0x903b83, - 0x886a7f, 0xb681, - ], - CURVE_Gy: [ - 0x2864b5, 0xc355bd, 0x3a7e73, 0x81a93a, 0xa8bc3d, 0xda421d, 0xcf6563, 0x59814d, 0x9c0b03, - 0x34e1b5, 0xca67, - ], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - }; - - return ROM_CURVE_MDC; -}; - -ROM_CURVE_ED25519 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_ED25519 = { - // ED25519 Curve - - CURVE_Cof_I: 8, - CURVE_B_I: 0, - CURVE_B: [ - 0x5978a3, 0x4dca13, 0xab75eb, 0x4141d8, 0x700a4d, 0xe89800, 0x797779, 0x8cc740, 0x6ffe73, - 0x6cee2b, 0x5203, - ], - CURVE_Order: [ - 0xf5d3ed, 0x631a5c, 0xd65812, 0xa2f79c, 0xdef9de, 0x14, 0x0, 0x0, 0x0, 0x0, 0x1000, - ], - CURVE_Gx: [ - 0x25d51a, 0x2d608f, 0xb2c956, 0x9525a7, 0x2cc760, 0xdc5c69, 0x31fdd6, 0xc0a4e2, 0x6e53fe, - 0x36d3cd, 0x2169, - ], - CURVE_Gy: [ - 0x666658, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, - 0x666666, 0x6666, - ], - CURVE_HTPC: [ - 0x7504f, 0xd93a5, 0x3c6277, 0x5697f2, 0xa18c03, 0xebd397, 0x4c9efd, 0x95a680, 0xe0ef85, - 0x924027, 0x55c1, - ], - }; - return ROM_CURVE_ED25519; -}; - -ROM_CURVE_GOLDILOCKS = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_GOLDILOCKS = { - // GOLDILOCKS curve - CURVE_Cof_I: 4, - CURVE_B_I: -39081, - CURVE_B: [ - 0x7f6756, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - CURVE_Order: [ - 0x5844f3, 0x52556, 0x548de3, 0x6e2c7a, 0x4c2728, 0x52042d, 0x6bb58d, 0x276da4, 0x23e9c4, - 0x7ef994, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x1ff, - ], - CURVE_Gx: [ - 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, - 0x52aaaa, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, 0x2aaaaa, 0x555555, - 0x2aaaaa, 0x555, - ], - CURVE_Gy: [ - 0x1386ed, 0x779bd5, 0x2f6bab, 0xe6d03, 0x4b2bed, 0x131777, 0x4e8a8c, 0x32b2c1, 0x44b80d, - 0x6515b1, 0x5f8db5, 0x426ebd, 0x7a0358, 0x6dda, 0x21b0ac, 0x6b1028, 0xdb359, 0x15ae09, - 0x17a58d, 0x570, - ], - CURVE_HTPC: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - }; - return ROM_CURVE_GOLDILOCKS; -}; - -ROM_CURVE_X448 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_X448 = { - // X448 curve - CURVE_Cof_I: 4, - CURVE_Cof: [ - 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_B_I: 0, - CURVE_B: [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_Order: [ - 0x5844f3, 0x52556, 0x548de3, 0x6e2c7a, 0x4c2728, 0x52042d, 0x6bb58d, 0x276da4, 0x23e9c4, - 0x7ef994, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x1ff, - ], - CURVE_Gx: [ - 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_Gy: [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - CURVE_HTPC: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - }; - return ROM_CURVE_X448; -}; - -ROM_CURVE_HIFIVE = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_HIFIVE = { - // HIFIVE curve - - CURVE_Cof_I: 8, - CURVE_B_I: 11111, - CURVE_B: [0x2b67, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x1fa805, 0x2b2e7d, 0x29ecbe, 0x3fc9dd, 0xbd6b8, 0x530a18, 0x45057e, 0x3, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x800, - ], - CURVE_Gx: [0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [ - 0x7e8632, 0xd0a0b, 0x6c4afb, 0x501b2e, 0x55650c, 0x36db6b, 0x1fbd0d, 0x61c08e, 0x314b46, - 0x70a7a3, 0x587401, 0xc70e0, 0x56502e, 0x38c2d6, 0x303, - ], - CURVE_HTPC: [ - 0x531622, 0x37d80a, 0x3928ff, 0x1b054e, 0x35d63a, 0x6a25b3, 0x406ae8, 0x278495, 0x339df0, - 0x2ac208, 0xe9a97, 0x1fb80f, 0x70856c, 0x3c1fc, 0xd8, - ], - }; - return ROM_CURVE_HIFIVE; -}; - -ROM_CURVE_NIST256 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NIST256 = { - // NIST256 Curve - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0xd2604b, 0x3c3e27, 0xf63bce, 0xcc53b0, 0x1d06b0, 0x86bc65, 0x557698, 0xb3ebbd, 0x3a93e7, - 0x35d8aa, 0x5ac6, - ], - CURVE_Order: [ - 0x632551, 0xcac2fc, 0x84f3b9, 0xa7179e, 0xe6faad, 0xffffbc, 0xffffff, 0xffffff, 0x0, 0xffff00, - 0xffff, - ], - CURVE_Gx: [ - 0x98c296, 0x3945d8, 0xa0f4a1, 0x2deb33, 0x37d81, 0x40f277, 0xe563a4, 0xf8bce6, 0x2c4247, - 0xd1f2e1, 0x6b17, - ], - CURVE_Gy: [ - 0xbf51f5, 0x406837, 0xcecbb6, 0x6b315e, 0xce3357, 0x9e162b, 0x4a7c0f, 0x8ee7eb, 0x1a7f9b, - 0x42e2fe, 0x4fe3, - ], - CURVE_HTPC: [ - 0x613926, 0x47959c, 0xd42eb8, 0x452a9d, 0x3eb001, 0x55548d, 0x8f44a6, 0x5240b3, 0x3723a4, - 0xd82cb6, 0x6a2a, - ], - }; - return ROM_CURVE_NIST256; -}; - -ROM_CURVE_SM2 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_SM2 = { - // SM2 Curve - - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [ - 0x940e93, 0xbd414d, 0x92ddbc, 0x15ab8f, 0x9789f5, 0x9a7f3, 0x4bcf65, 0x4d5a9e, 0x9f5e34, - 0xfa9e9d, 0x28e9, - ], - CURVE_Order: [ - 0xd54123, 0xf40939, 0x2b53bb, 0x21c605, 0x3df6b, 0xffff72, 0xffffff, 0xffffff, 0xffffff, - 0xfffeff, 0xffff, - ], - CURVE_Gx: [ - 0x4c74c7, 0x458933, 0xe1715a, 0xf2660b, 0xe30bbf, 0xc9948f, 0x466a39, 0x5f9904, 0x198119, - 0xae2c1f, 0x32c4, - ], - CURVE_Gy: [ - 0x39f0a0, 0x32e521, 0x4002df, 0xc62a47, 0xa9877c, 0x2153d0, 0xe36b69, 0x59bdce, 0xf6779c, - 0x36a2f4, 0xbc37, - ], - CURVE_HTPC: [ - 0xffffff, 0xffffff, 0x55ffff, 0x555555, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xaaa9ff, 0xaaaa, - ], - }; - return ROM_CURVE_SM2; -}; - -ROM_CURVE_NIST384 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NIST384 = { - // NIST384 curve - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0x6c2aef, 0x11dba7, 0x74aa17, 0x51768c, 0x6398d8, 0x6b58ca, 0x5404e1, 0xa0447, 0x411203, - 0x5dfd02, 0x607671, 0x4168c8, 0x56be3f, 0x1311c0, 0xfb9f9, 0x17d3f1, 0xb331, - ], - CURVE_Order: [ - 0x452973, 0x32d599, 0x6bb3b0, 0x45853b, 0x20db24, 0x3beb03, 0x7d0dcb, 0x31a6c0, 0x7fffc7, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Gx: [ - 0x760ab7, 0x3c70e4, 0x30e951, 0x7aa94b, 0x2f25db, 0x470aa0, 0x20950a, 0x7ba0f0, 0x1b9859, - 0x45174f, 0x3874ed, 0x56ba3, 0x71ef32, 0x71d638, 0x22c14d, 0x65115f, 0xaa87, - ], - CURVE_Gy: [ - 0x6a0e5f, 0x3af921, 0x75e90c, 0x6bf40c, 0xb1ce1, 0x18014c, 0x6d7c2e, 0x6d1889, 0x147ce9, - 0x7a5134, 0x63d076, 0x16e14f, 0xbf929, 0x6bb3d3, 0x98b1b, 0x6f254b, 0x3617, - ], - CURVE_HTPC: [ - 0x5cd21b, 0x589a81, 0x4cf909, 0x3aa056, 0x42d2a8, 0x7dda0a, 0x421117, 0x2fb357, 0x63b4bd, - 0x6a06e8, 0x225e, 0x43e017, 0x3feca5, 0x97ad4, 0x5c5492, 0x787911, 0xbc6e, - ], - }; - return ROM_CURVE_NIST384; -}; - -ROM_CURVE_NIST521 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NIST521 = { - // NIST521 curve - - CURVE_Cof_I: 1, - CURVE_B_I: 0, - CURVE_B: [ - 0x503f00, 0x3fa8d6, 0x47bd14, 0x6961a7, 0x3df883, 0x60e6ae, 0x4eec6f, 0x29605e, 0x137b16, - 0x23d8fd, 0x5864e5, 0x84f0a, 0x1918ef, 0x771691, 0x6cc57c, 0x392dcc, 0x6ea2da, 0x6d0a81, - 0x688682, 0x50fc94, 0x18e1c9, 0x27d72c, 0x1465, - ], - CURVE_Order: [ - 0x386409, 0x6e3d22, 0x3aedbe, 0x4ce23d, 0x5c9b88, 0x3a0776, 0x3dc269, 0x6600a4, 0x166b7f, - 0x77e5f, 0x461a1e, 0x7fffd2, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - CURVE_Gx: [ - 0x65bd66, 0x7c6385, 0x6fe5f9, 0x2b5214, 0xb3c18, 0x1bc669, 0x68bfea, 0xee093, 0x5928fe, - 0x6fdfce, 0x52d79, 0x69edd5, 0x7606b4, 0x3f0515, 0x4fed48, 0x409c82, 0x429c64, 0x472b68, - 0x7b2d98, 0x4e6cf1, 0x70404e, 0x31c0d6, 0x31a1, - ], - CURVE_Gy: [ - 0x516650, 0x28ed3f, 0x222fa, 0x139612, 0x47086a, 0x6c26a7, 0x4feb41, 0x285c80, 0x2640c5, - 0x32bde8, 0x5fb9ca, 0x733164, 0x517273, 0x2f5f7, 0x66d11a, 0x2224ab, 0x5998f5, 0x58fa37, - 0x297ed0, 0x22e4, 0x9a3bc, 0x252d4f, 0x460e, - ], - CURVE_HTPC: [ - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3fff, - ], - }; - return ROM_CURVE_NIST521; -}; - -ROM_CURVE_NUMS256E = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS256E = { - // NUMS256E Curve - CURVE_Cof_I: 4, - CURVE_B_I: -15342, - CURVE_B: [ - 0xffc355, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - CURVE_Order: [ - 0xdd4af5, 0xb190ee, 0x9b1a47, 0x2f5943, 0x955aa5, 0x41, 0x0, 0x0, 0x0, 0x0, 0x4000, - ], - CURVE_Gx: [ - 0xed13da, 0xc0902e, 0x86a0de, 0xe30835, 0x398a0e, 0x9bd60c, 0x5f6920, 0xcd1e3d, 0xea237d, - 0x14fb6a, 0x8a75, - ], - CURVE_Gy: [ - 0x8a89e6, 0x16e779, 0xd32fa6, 0x10856e, 0x5f61d8, 0x801071, 0xd9a64b, 0xce9665, 0xd925c7, - 0x3e9fd9, 0x44d5, - ], - CURVE_HTPC: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - }; - return ROM_CURVE_NUMS256E; -}; - -ROM_CURVE_NUMS256W = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS256W = { - // NUMS256W Curve - CURVE_Cof_I: 1, - CURVE_B_I: 152961, - CURVE_B: [0x25581, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x51a825, 0x202947, 0x6020ab, 0xea265c, 0x3c8275, 0xffffe4, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - CURVE_Gx: [ - 0x1aacb1, 0xee1eb2, 0x3abc52, 0x3d4c7, 0x579b09, 0xcb0983, 0xa04f42, 0x297a95, 0xaadb61, - 0xd6b65a, 0xbc9e, - ], - CURVE_Gy: [ - 0x84de9f, 0xb9cb21, 0xbb80b5, 0x15310f, 0x55c3d1, 0xe035c9, 0xf77e04, 0x73448b, 0x99b6a6, - 0xc0f133, 0xd08f, - ], - CURVE_HTPC: [ - 0x2b84d6, 0x6f7595, 0x9e05fc, 0x2040e8, 0x4092c6, 0xc6ae46, 0x70cadd, 0xb22ed0, 0x11e3b5, - 0x44e454, 0xcf7f, - ], - }; - return ROM_CURVE_NUMS256W; -}; - -ROM_CURVE_NUMS384E = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS384E = { - // NUMS384E Curve - CURVE_Cof_I: 4, - CURVE_B_I: -11556, - CURVE_B: [ - 0x7fd19f, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Order: [ - 0x23897d, 0x3989cd, 0x6482e7, 0x59ae43, 0x4555aa, 0x39ec3c, 0x2d1af8, 0x238d0e, 0x7fffe2, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3fff, - ], - CURVE_Gx: [ - 0x206bde, 0x1c8d8, 0x4d4355, 0x2a2ca0, 0x292b16, 0x680dfe, 0x3ccc58, 0x31ffd4, 0x4c0057, - 0xdcb7c, 0x4c2fd1, 0x2aedad, 0x2129ae, 0x1816d4, 0x6a499b, 0x8fda2, 0x61b1, - ], - CURVE_Gy: [ - 0x729392, 0x7c3e0, 0x727634, 0x376246, 0x2b0f94, 0x49600e, 0x7d9165, 0x7cc7b, 0x5f5683, - 0x69e284, 0x5ab609, 0x86eb8, 0x1a423b, 0x10e716, 0x69bbac, 0x1f33dc, 0x8298, - ], - CURVE_HTPC: [ - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - }; - return ROM_CURVE_NUMS384E; -}; - -ROM_CURVE_NUMS384W = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS384W = { - // NUMS384W Curve - CURVE_Cof_I: 1, - CURVE_B_I: -34568, - CURVE_B: [ - 0x7f77bb, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Order: [ - 0xe61b9, 0x3ecf6, 0x698136, 0x61bf13, 0x29d3d4, 0x1037db, 0x3ad75a, 0xf578f, 0x7fffd6, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - CURVE_Gx: [ - 0x18152a, 0x740841, 0x6fae72, 0x7b0e23, 0x6ed100, 0x684a45, 0x4a9b31, 0x5e948d, 0x79f4f3, - 0x1bf703, 0x89707, 0x2f8d30, 0x222410, 0x91019, 0x5bc607, 0x2b7858, 0x7579, - ], - CURVE_Gy: [ - 0x180716, 0x71d8cc, 0x1971d2, 0x7fa569, 0x6b4dbb, 0x6fd79a, 0x4486a0, 0x1041be, 0x739cb9, - 0x6ff0fe, 0x4011a5, 0x267bf5, 0x530058, 0x1afc67, 0x66e38e, 0x71b470, 0xacde, - ], - CURVE_HTPC: [ - 0x7fff61, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - }; - return ROM_CURVE_NUMS384W; -}; - -ROM_CURVE_NUMS512E = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS512E = { - // NUMS512E Curve - CURVE_Cof_I: 4, - CURVE_B_I: -78296, - CURVE_B: [ - 0x7ecbef, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CURVE_Order: [ - 0x6ed46d, 0x19ea37, 0x7d9d1a, 0x6f7f67, 0x605786, 0x5ea548, 0x5c2da1, 0x1fec64, 0x11ba9e, - 0x5a5f9f, 0x53c18d, 0x7ffffd, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xf, - ], - CURVE_Gx: [ - 0x6c57fe, 0x565333, 0x5716e6, 0x662780, 0x525427, 0x15a1fc, 0x15a241, 0x5ee4c9, 0x730f78, - 0x1ddc8c, 0x188705, 0x5c0a3a, 0x6be273, 0x44f42f, 0x7128e0, 0x73cfa6, 0x332fd1, 0x11a78a, - 0x632de2, 0x34e3d0, 0x5128db, 0x71c62d, 0x37, - ], - CURVE_Gy: [ - 0x62f5e1, 0x3d8183, 0x7cc9b7, 0x5f8e80, 0x6d38a9, 0x3fa04c, 0xabb30, 0xd0343, 0x356260, - 0x65d32c, 0x3294f, 0x741a09, 0x395909, 0x55256d, 0x96748, 0x7b936c, 0x6ee476, 0x50544a, - 0x43d5de, 0x538cc5, 0x39d49c, 0x2137fe, 0x1b, - ], - CURVE_HTPC: [ - 0x7ffdc6, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - }; - return ROM_CURVE_NUMS512E; -}; - -ROM_CURVE_NUMS512W = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_NUMS512W = { - // NUMS512W Curve - CURVE_Cof_I: 1, - CURVE_B_I: 121243, - CURVE_B: [ - 0x1d99b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - CURVE_Order: [ - 0x33555d, 0x7e7208, 0xf3854, 0x3e692, 0x68b366, 0x38c76a, 0x65f42f, 0x612c76, 0x31b4f, - 0x7729cf, 0x6cf293, 0x7ffffa, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CURVE_Gx: [ - 0x2bae57, 0xf2b19, 0xb720a, 0x6b7aef, 0x560137, 0x3063ab, 0x95585, 0x3ca143, 0x359e93, - 0x220ed6, 0x408685, 0x36cfca, 0xc2530, 0x28a0dc, 0x407da1, 0x6c1dda, 0x5298ca, 0x407a76, - 0x2dc00a, 0x549ed1, 0x7141d0, 0x580688, 0xe, - ], - CURVE_Gy: [ - 0x3527a6, 0xec070, 0x248e82, 0x67e87f, 0x35c1e4, 0x4059e5, 0x2c9695, 0x10d420, 0x6de9c1, - 0x35161d, 0xa1057, 0xa78a5, 0x60c7bd, 0x11e964, 0x6f2ee3, 0x6def55, 0x4b97, 0x47d762, - 0x3bbb71, 0x359e70, 0x229ad5, 0x74a99, 0x25, - ], - CURVE_HTPC: [ - 0x7ffee3, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x1f, - ], - }; - return ROM_CURVE_NUMS512W; -}; - -ROM_CURVE_SECP256K1 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_SECP256K1 = { - // SECP256K1 Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_B_I: 7, - CURVE_B: [0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0x364141, 0x5e8cd0, 0x3bbfd2, 0xaf48a0, 0xaedce6, 0xfffeba, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - CURVE_Gx: [ - 0xf81798, 0x815b16, 0xd959f2, 0x2dce28, 0x9bfcdb, 0xb0702, 0x95ce87, 0x55a062, 0xdcbbac, - 0x667ef9, 0x79be, - ], - CURVE_Gy: [ - 0x10d4b8, 0xd08ffb, 0x199c47, 0xa68554, 0x17b448, 0x8a8fd, 0xfc0e11, 0x5da4fb, 0xa3c465, - 0xda7726, 0x483a, - ], - CURVE_HTPC: [ - 0x8624aa, 0x13789e, 0x8ecdc8, 0xc23f50, 0xfdca45, 0xcd8bbb, 0x640a39, 0xf4d5b4, 0x3ffe30, - 0xe9e881, 0xcce8, - ], - - CURVE_Ad: [ - 0x444533, 0x47c01a, 0x5d4054, 0xcb6f0e, 0x53d363, 0xd272e9, 0x58f0f5, 0xa08a55, 0x661adc, - 0x31abdd, 0x3f87, - ], - CURVE_Bd: [0x6eb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - PC: [ - [ - 0xaaa88c, 0xe38daa, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, - 0xe38e38, 0x8e38, - ], - [ - 0x9dd262, 0xd0b53d, 0x314ecb, 0x37c40, 0x506144, 0xcaece4, 0xdeca25, 0xe2a413, 0xf234e6, - 0x328d23, 0x534c, - ], - [ - 0x7c6581, 0x1044f1, 0x92dfff, 0xbf63b, 0x95d2fc, 0x44c5d5, 0xcea7fd, 0xb9f315, 0xc321d5, - 0xd4c80b, 0x7d3, - ], - [ - 0xaaa8c7, 0xe38daa, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, 0xe38e38, - 0xe38e38, 0x8e38, - ], - [ - 0x8c6d14, 0x56612a, 0xbbc52a, 0x1f5e41, 0xd36b64, 0x225406, 0xd51b54, 0xf7c4b2, 0x83dc1d, - 0xc6f643, 0xedad, - ], - [ - 0x1eb49b, 0xb74578, 0x7d9fe6, 0x42f848, 0xcd4095, 0x40dd86, 0xcbb7b6, 0x9ca34c, 0x94918a, - 0x71193d, 0xd357, - ], - [ - 0xe38d84, 0xa12f38, 0xf684bd, 0x4bda12, 0xa12f68, 0xf684bd, 0x4bda12, 0xa12f68, 0xf684bd, - 0x4bda12, 0x2f68, - ], - [ - 0xcee931, 0xe85a9e, 0x18a765, 0x1be20, 0x2830a2, 0xe57672, 0xef6512, 0x715209, 0xf91a73, - 0x194691, 0x29a6, - ], - [ - 0x1d71a3, 0x90fc20, 0x6fdffc, 0xd686da, 0x7ab046, 0xa6d564, 0x4b12a0, 0xa9d0a5, 0xcb7c0f, - 0xc32d5, 0xc75e, - ], - [ - 0x38e23c, 0x684b8e, 0xbda12f, 0x12f684, 0x684bda, 0xbda12f, 0x12f684, 0x684bda, 0xbda12f, - 0x12f684, 0x4bda, - ], - [ - 0xd2a76f, 0x8192bf, 0x99a7bf, 0x2f0d62, 0x3d2116, 0x337e0a, 0x3fa8fe, 0xf3a70c, 0x45ca2c, - 0xaa7165, 0x6484, - ], - [ - 0x5c2573, 0x25d268, 0x78dfb4, 0xc8e8d9, 0x67c1bf, 0xc29894, 0x632722, 0xd5e9e6, 0xbdb49f, - 0x534bb8, 0x7a06, - ], - [ - 0xfff93b, 0xfffeff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - ], - }; - return ROM_CURVE_SECP256K1; -}; - -ROM_CURVE_SECP160R1 = function () { - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_CURVE_SECP160R1 = { - // SECP160R1 Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [0x65fa45, 0xd4adc5, 0x9f81d4, 0x65acf8, 0xbd7a8b, 0xbefc54, 0x1c97], - CURVE_Order: [0x752257, 0xaed3ca, 0xc8f927, 0x1f4, 0x0, 0x0, 0x10000], - CURVE_Gx: [0xcbfc82, 0x8bb913, 0x8968c3, 0x466469, 0xf57328, 0xb5688e, 0x4a96], - CURVE_Gy: [0xc5fb32, 0x51377a, 0x120423, 0x59dcc9, 0x68947d, 0x285531, 0x23a6], - CURVE_HTPC: [0x5bc0da, 0xfaf3a2, 0x7305da, 0xface6a, 0x5a6106, 0xbd02cd, 0x1e50], - }; - return ROM_CURVE_SECP160R1; -}; - -ROM_CURVE_JUBJUB = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_JUBJUB = { - // JUBJUB Curve - // Base Bits= 24 - - CURVE_Cof_I: 8, - CURVE_Cof: [0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 0, - CURVE_B: [ - 0x343eb1, 0x5fd6d6, 0x260106, 0x37579d, 0x2d7f6d, 0x7fd429, 0x7e6bd, 0xf5fd92, 0xfa2b48, - 0x18e74b, 0x2a93, - ], - CURVE_Order: [ - 0xf72cb7, 0xe5ed6, 0x82d097, 0xccc810, 0x682093, 0x3b00a6, 0x10134, 0x6673b, 0x33afa9, - 0xb4ea65, 0xe7d, - ], - CURVE_Gx: [ - 0xf976c4, 0xcf1a74, 0xde7f4e, 0xf2f39e, 0xc546b, 0x488200, 0xdf0038, 0xa624b4, 0xeff38c, - 0x972af8, 0x5183, - ], - CURVE_Gy: [ - 0x49702e, 0xad7093, 0x3b146b, 0xffa683, 0x6c8707, 0xc30809, 0x5abd9d, 0x9e8fcc, 0xa2fc2c, - 0xf8472c, 0x3b43, - ], - CURVE_HTPC: [ - 0x7bbbb6, 0xaef9e4, 0xa9907, 0x517532, 0x5dff51, 0xd546e2, 0xcb473c, 0x3e3ee, 0x37b1d4, - 0x68b42b, 0x62fd, - ], - }; - return ROM_CURVE_JUBJUB; -}; - -ROM_CURVE_C13318 = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_C13318 = { - // C13318 Curve - // Base Bits= 24 - - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 13318, - CURVE_B: [0x3406, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [ - 0xc2cbe3, 0x12dc4d, 0x16eb7d, 0x3deb8d, 0xf654f8, 0xf4, 0x0, 0x0, 0x0, 0x0, 0x8000, - ], - CURVE_Gx: [0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Gy: [ - 0x6ead0b, 0xd3546b, 0xb5b8c8, 0xcf016d, 0x4ccb04, 0x66369d, 0xe51669, 0x381630, 0xbca6f1, - 0xaad926, 0x6675, - ], - CURVE_HTPC: [ - 0x7504f, 0xd93a5, 0x3c6277, 0x5697f2, 0xa18c03, 0xebd397, 0x4c9efd, 0x95a680, 0xe0ef85, - 0x924027, 0x55c1, - ], - }; - return ROM_CURVE_C13318; -}; - -ROM_CURVE_TWEEDLEDUM = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_TWEEDLEDUM = { - //*** rom curve parameters ***** - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 5, - CURVE_B: [0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [0x1, 0xafd400, 0xc9842c, 0x696286, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gx: [0x0, 0x64e200, 0xb9a140, 0x6c3f59, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [ - 0x381795, 0x755341, 0xc366d6, 0xd03cfb, 0x10aeeb, 0xbaa53e, 0x8b6caa, 0xef14d8, 0x20bf4, - 0x6cf337, 0x3ab4, - ], - }; - return ROM_CURVE_TWEEDLEDUM; -}; - -ROM_CURVE_TWEEDLEDEE = function () { - // Fixed Data in ROM - Field and Curve parameters - - var ROM_CURVE_TWEEDLEDEE = { - //*** rom curve parameters ***** - CURVE_Cof_I: 1, - CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_B_I: 5, - CURVE_B: [0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_Order: [0x1, 0x64e200, 0xb9a140, 0x6c3f59, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gx: [0x0, 0xafd400, 0xc9842c, 0x696286, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - CURVE_HTPC: [ - 0x69c848, 0x1cbdad, 0x873386, 0x672ef6, 0xac0754, 0xe9704, 0xe5bc1a, 0x82c6a2, 0x649720, - 0x88de2a, 0x3ac1, - ], - }; - return ROM_CURVE_TWEEDLEDEE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - ROM_CURVE_ANSSI: ROM_CURVE_ANSSI, - ROM_CURVE_BLS12383: ROM_CURVE_BLS12383, - ROM_CURVE_BLS24479: ROM_CURVE_BLS24479, - ROM_CURVE_BLS48556: ROM_CURVE_BLS48556, - ROM_CURVE_BLS48286: ROM_CURVE_BLS48286, - ROM_CURVE_BLS48581: ROM_CURVE_BLS48581, - ROM_CURVE_BLS12381: ROM_CURVE_BLS12381, - ROM_CURVE_BLS12461: ROM_CURVE_BLS12461, - ROM_CURVE_BN462: ROM_CURVE_BN462, - ROM_CURVE_FP256BN: ROM_CURVE_FP256BN, - ROM_CURVE_FP512BN: ROM_CURVE_FP512BN, - ROM_CURVE_BN254: ROM_CURVE_BN254, - ROM_CURVE_BN254CX: ROM_CURVE_BN254CX, - ROM_CURVE_BRAINPOOL: ROM_CURVE_BRAINPOOL, - ROM_CURVE_C25519: ROM_CURVE_C25519, - ROM_CURVE_C41417: ROM_CURVE_C41417, - ROM_CURVE_C1174: ROM_CURVE_C1174, - ROM_CURVE_C1665: ROM_CURVE_C1665, - ROM_CURVE_MDC: ROM_CURVE_MDC, - ROM_CURVE_ED25519: ROM_CURVE_ED25519, - ROM_CURVE_GOLDILOCKS: ROM_CURVE_GOLDILOCKS, - ROM_CURVE_X448: ROM_CURVE_X448, - ROM_CURVE_HIFIVE: ROM_CURVE_HIFIVE, - ROM_CURVE_NIST256: ROM_CURVE_NIST256, - ROM_CURVE_NIST384: ROM_CURVE_NIST384, - ROM_CURVE_NIST521: ROM_CURVE_NIST521, - ROM_CURVE_NUMS256E: ROM_CURVE_NUMS256E, - ROM_CURVE_NUMS256W: ROM_CURVE_NUMS256W, - ROM_CURVE_NUMS384E: ROM_CURVE_NUMS384E, - ROM_CURVE_NUMS384W: ROM_CURVE_NUMS384W, - ROM_CURVE_NUMS512E: ROM_CURVE_NUMS512E, - ROM_CURVE_NUMS512W: ROM_CURVE_NUMS512W, - ROM_CURVE_SECP256K1: ROM_CURVE_SECP256K1, - ROM_CURVE_SECP160R1: ROM_CURVE_SECP160R1, - ROM_CURVE_SM2: ROM_CURVE_SM2, - ROM_CURVE_C13318: ROM_CURVE_C13318, - ROM_CURVE_JUBJUB: ROM_CURVE_JUBJUB, - ROM_CURVE_TWEEDLEDEE: ROM_CURVE_TWEEDLEDEE, - ROM_CURVE_TWEEDLEDUM: ROM_CURVE_TWEEDLEDUM, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rom_field.js b/packages/bls-verify/src/vendor/amcl-js/src/rom_field.js deleted file mode 100644 index 2a221a701..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rom_field.js +++ /dev/null @@ -1,1101 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Fixed Data in ROM - Field and Curve parameters */ - -var ROM_FIELD_25519, - ROM_FIELD_256PM, - ROM_FIELD_384PM, - ROM_FIELD_512PM, - ROM_FIELD_ANSSI, - ROM_FIELD_BLS12383, - ROM_FIELD_BLS24479, - ROM_FIELD_BLS48556, - ROM_FIELD_BLS48286, - ROM_FIELD_BLS48581, - ROM_FIELD_BLS12381, - ROM_FIELD_BLS12461, - ROM_FIELD_BN462, - ROM_FIELD_FP256BN, - ROM_FIELD_FP512BN, - ROM_FIELD_BN254, - ROM_FIELD_BN254CX, - ROM_FIELD_BRAINPOOL, - ROM_FIELD_C41417, - ROM_FIELD_C1174, - ROM_FIELD_C1665, - ROM_FIELD_MDC, - ROM_FIELD_GOLDILOCKS, - ROM_FIELD_HIFIVE, - ROM_FIELD_NIST256, - ROM_FIELD_NIST384, - ROM_FIELD_NIST521, - ROM_FIELD_SECP256K1, - ROM_FIELD_SECP160R1, - ROM_FIELD_SM2, - ROM_FIELD_JUBJUB, - ROM_FIELD_TWEEDLEDUM, - ROM_FIELD_TWEEDLEDEE; - -ROM_FIELD_25519 = function () { - 'use strict'; - - var ROM_FIELD_25519 = { - // 25519 Curve Modulus - Modulus: [ - 0xffffed, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7fff, - ], - ROI: [ - 0xea0b0, 0x1b274a, 0x78c4ee, 0xad2fe4, 0x431806, 0xd7a72f, 0x993dfb, 0x2b4d00, 0xc1df0b, - 0x24804f, 0x2b83, - ], - R2modp: [0xa40000, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0x13, - }; - return ROM_FIELD_25519; -}; - -ROM_FIELD_256PM = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_256PM = { - // NUMS256 Curve Modulus - // Base Bits= 24 - Modulus: [ - 0xffff43, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - ROI: [ - 0xffff42, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - R2modp: [0x890000, 0x8b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0xbd, - }; - return ROM_FIELD_256PM; -}; - -ROM_FIELD_384PM = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_384PM = { - // NUMS384 Curve Modulus - // Base Bits= 23 - Modulus: [ - 0x7ffec3, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - ROI: [ - 0x7ffec2, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - R2modp: [ - 0x224000, 0xc4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x13d, - }; - return ROM_FIELD_384PM; -}; - -ROM_FIELD_512PM = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_512PM = { - // NUMS512 Curve Modulus - // Base Bits= 23 - Modulus: [ - 0x7ffdc7, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ROI: [ - 0x7ffdc6, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - R2modp: [ - 0x0, 0x58800, 0x4f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x239, - }; - return ROM_FIELD_512PM; -}; - -ROM_FIELD_ANSSI = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_ANSSI = { - // ANSSI modulus - // Base Bits= 24 - Modulus: [ - 0x6e9c03, 0xf353d8, 0x6de8fc, 0xabc8ca, 0x61adbc, 0x435b39, 0xe8ce42, 0x10126d, 0x3ad58f, - 0x178c0b, 0xf1fd, - ], - ROI: [ - 0x6e9c02, 0xf353d8, 0x6de8fc, 0xabc8ca, 0x61adbc, 0x435b39, 0xe8ce42, 0x10126d, 0x3ad58f, - 0x178c0b, 0xf1fd, - ], - R2modp: [ - 0xacece3, 0x924166, 0xb10fce, 0x6cfbb6, 0x87ec2, 0x3de43d, 0xd2cf67, 0xa67dde, 0xad30f2, - 0xbcaae, 0xdf98, - ], - MConst: 0x4e1155, - }; - return ROM_FIELD_ANSSI; -}; - -ROM_FIELD_BLS12383 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS12383 = { - // BLS12383 Modulus - // Base Bits= 23 - Modulus: [ - 0x2ab0ab, 0x3ac90b, 0x2f68dc, 0x532429, 0x43f298, 0x1e8f51, 0x5a5849, 0x18dc00, 0x2511ac, - 0x59e6cb, 0x2b518, 0x549425, 0x5c41fe, 0x340db5, 0x2adbad, 0x2b4ab2, 0x5565, - ], - ROI: [ - 0x2ab0aa, 0x3ac90b, 0x2f68dc, 0x532429, 0x43f298, 0x1e8f51, 0x5a5849, 0x18dc00, 0x2511ac, - 0x59e6cb, 0x2b518, 0x549425, 0x5c41fe, 0x340db5, 0x2adbad, 0x2b4ab2, 0x5565, - ], - R2modp: [ - 0x250a44, 0x68f66f, 0xe3c74, 0x791772, 0x3525e3, 0xe1e15, 0x356616, 0x54f624, 0x508069, - 0x272663, 0x4a4cb0, 0x359293, 0x5b6573, 0x9f27f, 0x5ea3b4, 0x60fd2d, 0x5167, - ], - MConst: 0x3435fd, - SQRTm3: [ - 0x2ad4a8, 0x6277af, 0x677d3e, 0x5ad233, 0x7add9b, 0x31dfb7, 0x401708, 0x395349, 0x3da818, - 0x7988aa, 0x7fed10, 0x3ff320, 0xc3ede, 0x7403b5, 0x2adbac, 0x2b4ab2, 0x5565, - ], - CRu: [ - 0x2ac2a9, 0x4ea05d, 0x4b730d, 0x16fb2e, 0x5f681a, 0x683784, 0xd37a8, 0x2917a5, 0x715ce2, - 0x69b7ba, 0x15114, 0x4a43a3, 0x34406e, 0x1408b5, 0x2adbad, 0x2b4ab2, 0x5565, - ], - Fra: [ - 0x11dac1, 0x2e5a66, 0x614b, 0x733b9f, 0x13480f, 0x19146d, 0x395436, 0x2b3a25, 0x1a8682, - 0x247f74, 0x3931b3, 0x5a9788, 0x7c2c11, 0x67173, 0x1fda2f, 0x6adf81, 0x22ac, - ], - Frb: [ - 0x18d5ea, 0xc6ea5, 0x2f0791, 0x5fe88a, 0x30aa88, 0x57ae4, 0x210413, 0x6da1db, 0xa8b29, - 0x356757, 0x498365, 0x79fc9c, 0x6015ec, 0x2d9c41, 0xb017e, 0x406b31, 0x32b8, - ], - }; - - return ROM_FIELD_BLS12383; -}; - -ROM_FIELD_BLS24479 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS24479 = { - // BLS24479 Modulus - // Base Bits= 23 - - Modulus: [ - 0x6152b, 0x2ce94, 0x6be113, 0x416986, 0x2ffe2e, 0x36d4c8, 0x47172f, 0x1945b7, 0x5f068a, - 0xe6441, 0x110186, 0x4f0f9, 0x33568e, 0x4a0f2e, 0x306ea0, 0x173bf2, 0x6e803f, 0x735d8, - 0x3316ea, 0x3c01e, 0x555c0, - ], - ROI: [ - 0x6152a, 0x2ce94, 0x6be113, 0x416986, 0x2ffe2e, 0x36d4c8, 0x47172f, 0x1945b7, 0x5f068a, - 0xe6441, 0x110186, 0x4f0f9, 0x33568e, 0x4a0f2e, 0x306ea0, 0x173bf2, 0x6e803f, 0x735d8, - 0x3316ea, 0x3c01e, 0x555c0, - ], - R2modp: [ - 0x22d6fa, 0x7aa299, 0x4c307e, 0x68e711, 0x7da4ae, 0x383cc3, 0x12048c, 0x11b7d, 0x3ca412, - 0x2ce421, 0x4932ac, 0x27a306, 0x340b6a, 0x666e, 0x3f6575, 0x2f823c, 0xa0de6, 0x137ec5, - 0x37d4bc, 0x48a54e, 0x4c28b, - ], - MConst: 0x15fe7d, - SQRTm3: [ - 0x291428, 0x198323, 0x663cce, 0x7745ac, 0x1747e3, 0x5222a9, 0x41f479, 0x54b5f9, 0x1861bc, - 0xde532, 0x2be5aa, 0x1e67ea, 0x5cb732, 0x67ab99, 0xb7c9f, 0x71250d, 0x741800, 0x26db7, - 0x2b165a, 0x3c01e, 0x555c0, - ], - CRu: [ - 0x5794a9, 0x4e28db, 0x690ef0, 0x1c5799, 0x63a309, 0x447bb8, 0x4485d4, 0x36fdd8, 0x7bb423, - 0xe24b9, 0x5e7398, 0x11ac71, 0x806e0, 0x18dd64, 0x5df5a0, 0x4307f, 0x314c20, 0x4d1c8, - 0x2f16a2, 0x3c01e, 0x555c0, - ], - Fra: [ - 0x796f1d, 0x4e9577, 0x6eb572, 0x68637f, 0x41ff8b, 0x46e8d3, 0x7a7898, 0x7c72a4, 0x248407, - 0x6e79d9, 0x56499e, 0x4eb47f, 0x27cbd6, 0x33c662, 0x4e9746, 0xc2798, 0x397549, 0x4a5b1b, - 0x5c90b6, 0x3dca73, 0x4bbc8, - ], - Frb: [ - 0xca60e, 0x34391c, 0x7d2ba0, 0x590606, 0x6dfea2, 0x6febf4, 0x4c9e96, 0x1cd312, 0x3a8282, - 0x1fea68, 0x3ab7e7, 0x363c79, 0xb8ab7, 0x1648cc, 0x61d75a, 0xb1459, 0x350af6, 0x3cdabd, - 0x568633, 0x45f5aa, 0x99f7, - ], - TWK: [ - 0x6a62f3, 0x12416d, 0x735296, 0x62f9eb, 0x1cb389, 0x794c37, 0x37ddda, 0x7acf76, 0x6a6d51, - 0x1625bc, 0x7c5536, 0x518cd7, 0x3e1bc9, 0x47ce1f, 0x8c33b, 0xc7722, 0x62935e, 0x40f556, - 0x4ed046, 0x133767, 0x337a3, - ], - }; - - return ROM_FIELD_BLS24479; -}; - -ROM_FIELD_BLS48581 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS48581 = { - // Base Bits= 23 - Modulus: [ - 0x65912b, 0x2a9cca, 0x30fb70, 0x525245, 0x7df721, 0x414af1, 0x4c5c3b, 0x33d2a8, 0x5af683, - 0x1e8e6d, 0x34c0e5, 0x1566ce, 0x2f6e08, 0x115c87, 0x551129, 0x78f9cb, 0x3be6c0, 0x426376, - 0x3e3448, 0x2b742, 0x7012a0, 0x1c63a8, 0x4c4e09, 0x79a3b7, 0xf73f, 0x25, - ], - ROI: [ - 0x65912a, 0x2a9cca, 0x30fb70, 0x525245, 0x7df721, 0x414af1, 0x4c5c3b, 0x33d2a8, 0x5af683, - 0x1e8e6d, 0x34c0e5, 0x1566ce, 0x2f6e08, 0x115c87, 0x551129, 0x78f9cb, 0x3be6c0, 0x426376, - 0x3e3448, 0x2b742, 0x7012a0, 0x1c63a8, 0x4c4e09, 0x79a3b7, 0xf73f, 0x25, - ], - R2modp: [ - 0x4e2506, 0x1fad8c, 0x618be7, 0x23e9bf, 0x6a8ad9, 0x3529c9, 0xb64d9, 0x1c7a8e, 0x759816, - 0x2ae889, 0x3b1f74, 0x53d536, 0x7cff54, 0x389ee8, 0x4f41f1, 0x2c5d2d, 0x48d19d, 0x6c88a7, - 0x7b224e, 0x3b0db8, 0x3bdcf8, 0x83abf, 0x5b548e, 0x50a9d7, 0x362f43, 0x10, - ], - MConst: 0x1d5a7d, - SQRTm3: [ - 0x565a0a, 0x3f8543, 0x6fd47b, 0x496c66, 0x62daa2, 0x3ac2da, 0x11e09a, 0x92089, 0x3f8ad7, - 0x4ba795, 0x1335b0, 0x35ae9f, 0x48e9b1, 0x12c1dd, 0xedce, 0x21fa85, 0x6fed43, 0x4cc86e, - 0x6b8186, 0x7dc492, 0x2bffd8, 0x451bd5, 0x24231a, 0x4d3b00, 0xf73f, 0x25, - ], - CRu: [ - 0x479b90, 0x358bc3, 0x20937a, 0x4472ef, 0x4d8e3f, 0x43440b, 0x5d3dd0, 0x15590f, 0xdb5d6, - 0x29736c, 0x50c59a, 0x2fdc17, 0x73422b, 0x3f4d54, 0x2a11ad, 0x6b7fa3, 0x65fcbe, 0x7acd83, - 0x695960, 0x427957, 0x620963, 0x2ba3e9, 0x541577, 0x16345b, 0x0, 0x0, - ], - Fra: [ - 0x2aeb25, 0x6d9fc8, 0x7e58ba, 0x3b0569, 0x341942, 0x3d9c9b, 0x15c1c5, 0x7d3ef9, 0x208ac0, - 0x6ef6a2, 0x106240, 0x1f0e46, 0x684849, 0x3030fc, 0xc1f8a, 0x317a4b, 0x4afd6b, 0xe81c7, - 0xf9e16, 0x6823cc, 0x5f6067, 0x7ce7ca, 0x69d735, 0x280a4f, 0x7d30db, 0x1, - ], - Frb: [ - 0x2aeb25, 0x6d9fc8, 0x7e58ba, 0x3b0569, 0x341942, 0x3d9c9b, 0x15c1c5, 0x7d3ef9, 0x208ac0, - 0x6ef6a2, 0x106240, 0x1f0e46, 0x684849, 0x3030fc, 0xc1f8a, 0x317a4b, 0x4afd6b, 0xe81c7, - 0xf9e16, 0x6823cc, 0x5f6067, 0x7ce7ca, 0x69d735, 0x280a4f, 0x7d30db, 0x1, - ], - TWK: [ - 0x426953, 0x67a4be, 0xf5ed0, 0x11dcc3, 0x2ce459, 0x6fc2c1, 0x77e8b4, 0x46145d, 0x7b4bc1, - 0x7f9915, 0x313d8b, 0x497801, 0x661b43, 0x428f02, 0x1fa546, 0x231769, 0x3b8532, 0x614cd0, - 0x281d59, 0x4dd09c, 0x6aeb8c, 0x39bbb3, 0x1d5da, 0x1bde08, 0x3a65a5, 0x0, - ], - }; - - return ROM_FIELD_BLS48581; -}; - -ROM_FIELD_BLS48556 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS48556 = { - // BLS48556 Modulus - // Base Bits= 23 - - Modulus: [ - 0x76ac0b, 0x4c1ff9, 0x67bbdb, 0x5330ef, 0x167009, 0x450805, 0x61c350, 0x609bd4, 0x76b2e, - 0x40410d, 0x169054, 0x353e01, 0x141301, 0x66f371, 0x3b355a, 0x6d4a85, 0x36f405, 0x28840a, - 0x454ab3, 0x2b6433, 0x29047a, 0xb646e, 0xbff3f, 0x68bec2, 0xf, - ], - ROI: [ - 0x76ac0a, 0x4c1ff9, 0x67bbdb, 0x5330ef, 0x167009, 0x450805, 0x61c350, 0x609bd4, 0x76b2e, - 0x40410d, 0x169054, 0x353e01, 0x141301, 0x66f371, 0x3b355a, 0x6d4a85, 0x36f405, 0x28840a, - 0x454ab3, 0x2b6433, 0x29047a, 0xb646e, 0xbff3f, 0x68bec2, 0xf, - ], - R2modp: [ - 0x5f42c2, 0x596e88, 0x2ed8fa, 0x15c970, 0x2518b4, 0x2a75e7, 0x62ce53, 0x431c50, 0x3cf507, - 0x620e44, 0xd6fcd, 0x21a7d, 0x1fda3f, 0x6a099, 0x53487, 0x53eebf, 0x54e2d0, 0x48437d, - 0x2233d8, 0x63296f, 0x21ee21, 0x611417, 0x619d35, 0x13a61a, 0xb, - ], - MConst: 0x5a805d, - SQRTm3: [ - 0x9c48, 0x6dd9b9, 0x4445d6, 0x401e84, 0x5f13b, 0x5b1ce6, 0x3c70c7, 0x798d07, 0x7e0544, - 0x62ca1b, 0x75113, 0x557bb6, 0x3a11f4, 0x1426f2, 0x27ef0c, 0x1763b3, 0x7ee9f8, 0x3cf4db, - 0x4cdb7e, 0x6bf8c, 0x263a76, 0x3d63a0, 0x5bbf38, 0x68bec1, 0xf, - ], - CRu: [ - 0x3ba429, 0x1cfcd9, 0x1600d9, 0x49a7ba, 0x4e30a2, 0x101275, 0xf1a0c, 0x6d146e, 0x42b839, - 0x118594, 0x4ef0b4, 0x55cdb, 0x67127b, 0x3d8d31, 0x319233, 0x2571c, 0x1aeeff, 0x72bc73, - 0x91318, 0x1911e0, 0x279f78, 0x646407, 0x73df3b, 0x68bec1, 0xf, - ], - Fra: [ - 0x25bf89, 0x79fb26, 0x56f988, 0x399a14, 0x507ea3, 0x77995, 0x3ee83a, 0x52eca9, 0x3e3474, - 0x5f1e13, 0x2e7cb0, 0x255f3d, 0x3ae7f8, 0x2e4ef6, 0x3bde94, 0x7b05a, 0x13c83c, 0x7bf664, - 0x1ff27f, 0x6fe082, 0x3b36ce, 0x138113, 0x6e2002, 0x4c5c03, 0x2, - ], - Frb: [ - 0x25bf89, 0x79fb26, 0x56f988, 0x399a14, 0x507ea3, 0x77995, 0x3ee83a, 0x52eca9, 0x3e3474, - 0x5f1e13, 0x2e7cb0, 0x255f3d, 0x3ae7f8, 0x2e4ef6, 0x3bde94, 0x7b05a, 0x13c83c, 0x7bf664, - 0x1ff27f, 0x6fe082, 0x3b36ce, 0x138113, 0x6e2002, 0x4c5c03, 0x2, - ], - TWK: [ - 0x6f9937, 0x4f5442, 0x12b489, 0x31b13f, 0xbd341, 0x4006d0, 0x7a84d9, 0x4dd830, 0x6d4c49, - 0x59d972, 0x1a71ca, 0x687e1, 0x40c8dc, 0x206554, 0x5de9a7, 0x2817c7, 0x6556ed, 0x27c11a, - 0x3ec6ef, 0x764e01, 0x6dd577, 0x7cffdd, 0x246857, 0x1907ce, 0x4, - ], - }; - - return ROM_FIELD_BLS48556; -}; - -ROM_FIELD_BLS48286 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS48286 = { - // BLS48286 Modulus - // Base Bits= 23 - - Modulus: [ - 0x1c345b, 0x57241, 0x3679d4, 0x1471a9, 0x641c45, 0x1355e, 0x6b012, 0x36463f, 0x145a8, - 0x604039, 0x31ef5e, 0x16298f, 0x297, - ], - R2modp: [ - 0x116bcb, 0x4a9ce9, 0xd861f, 0x5ca282, 0x66469, 0x30c42d, 0x299fc6, 0x442c07, 0x1735e0, - 0x516724, 0x325ec8, 0x294de1, 0x35, - ], - ROI: [ - 0x1c345a, 0x57241, 0x3679d4, 0x1471a9, 0x641c45, 0x1355e, 0x6b012, 0x36463f, 0x145a8, - 0x604039, 0x31ef5e, 0x16298f, 0x297, - ], - SQRTm3: [ - 0x524a9c, 0x48e5cc, 0x66335e, 0xe9944, 0x35b814, 0x1d666a, 0x269c21, 0x4bac4c, 0x2987b9, - 0x614644, 0x63d761, 0xe12a3, 0x297, - ], - CRu: [ - 0x773f7b, 0x272c06, 0xe5699, 0x518577, 0x4cea2c, 0x4f4de4, 0x56a619, 0xf945, 0x5566b1, - 0x20c33e, 0x4ae360, 0x121e19, 0x297, - ], - MConst: 0x6a242d, - Fra: [ - 0x490183, 0x52be7f, 0x4dbaa1, 0xde9f4, 0x556bed, 0x6134f8, 0x3c09a3, 0x1ec81f, 0x2fe004, - 0x1d15d8, 0x48b045, 0x20bf62, 0xd9, - ], - Frb: [ - 0x5332d8, 0x32b3c1, 0x68bf32, 0x687b4, 0xeb058, 0x200066, 0x4aa66e, 0x177e1f, 0x5165a4, - 0x432a60, 0x693f19, 0x756a2c, 0x1bd, - ], - TWK: [ - 0x505dcc, 0x2e6b87, 0x2e69f6, 0x2a1538, 0x197054, 0x458d43, 0x4532ea, 0x7de65e, 0x367221, - 0x233e6e, 0x1228cd, 0x76f7a, 0x1d2, - ], - }; - - return ROM_FIELD_BLS48286; -}; - -ROM_FIELD_BN462 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BN462 = { - // Base Bits= 23 - Modulus: [ - 0x138013, 0x601080, 0x9006, 0x0, 0x7f6400, 0xdfed0, 0x3fd9bf, 0x7ffffb, 0xfffff, 0x39004, - 0x4a423d, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - ROI: [ - 0x138012, 0x601080, 0x9006, 0x0, 0x7f6400, 0xdfed0, 0x3fd9bf, 0x7ffffb, 0xfffff, 0x39004, - 0x4a423d, 0x6c0, 0x0, 0x37f940, 0x3dadf6, 0x7b7f86, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - R2modp: [ - 0x8b8d, 0x7265c, 0x56003a, 0xe1112, 0x275149, 0x50bff0, 0x1e3e2e, 0x2dedf3, 0x43d666, - 0x644751, 0x2a7239, 0x1dca94, 0x5f2ff8, 0x41cff0, 0x41494f, 0x34b04a, 0x47932f, 0x5e4bbc, - 0x50bc6, 0x30f0fb, 0x1, - ], - MConst: 0x1bb5e5, - SQRTm3: [ - 0x210022, 0x1980, 0x9009, 0x0, 0x7ef800, 0x60fe25, 0x3fd2fe, 0x7ffffb, 0x2fffff, 0x4f806, - 0x5102bb, 0x6c0, 0x0, 0x5ff700, 0x7d77f4, 0x7b7f81, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - CRu: [ - 0x1a401a, 0x701500, 0x9007, 0x0, 0x3f2e00, 0x777e7b, 0x3fd65e, 0x7ffffb, 0x1fffff, 0x44405, - 0x4da27c, 0x6c0, 0x0, 0x4bf820, 0x1d92f5, 0x7b7f84, 0x7fffff, 0x47fff, 0x580480, 0x202401, - 0x2, - ], - Fra: [ - 0x575d1a, 0x7c7fe4, 0x6f7b92, 0x44b2ce, 0xfc7d, 0x27f423, 0x517476, 0x3c6c86, 0x3310cc, - 0xac42e, 0x3551f0, 0x3c9282, 0x7e11c, 0x207535, 0x2164bb, 0x8b938, 0x35a8cc, 0x179fb, - 0x5232ed, 0xb7fa1, 0x0, - ], - Frb: [ - 0x5ff85b, 0x15c12a, 0x2d8881, 0x432bdf, 0x90238, 0x2c6144, 0x653d2f, 0x786807, 0x27a84f, - 0x362943, 0x2c76eb, 0x6c72, 0x685f7b, 0x794003, 0x6c9d24, 0x5b4192, 0x2008e6, 0x21d510, - 0x2503a, 0x1e1bfc, 0x2, - ], - }; - - return ROM_FIELD_BN462; -}; - -ROM_FIELD_BLS12381 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS12381 = { - // BLS12381 Modulus - // Base Bits= 23 - - Modulus: [ - 0x7faaab, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - ROI: [ - 0x7faaaa, 0x7fffff, 0x7ee7fb, 0xa9fff, 0x3fffeb, 0x4483d5, 0x3dac3d, 0x186950, 0x12bf67, - 0x9e70a, 0x11dd2e, 0x5d66bb, 0x7b6434, 0x496374, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - R2modp: [ - 0x40c6e6, 0xe1a28, 0x3d1c6c, 0x6d2448, 0x1bb111, 0x4eafa8, 0x229c8c, 0x4cee55, 0x46d2ad, - 0x7ba87c, 0x708835, 0x2413d1, 0x6702e3, 0x390116, 0xd9e3f, 0x4bd65c, 0x9a3, - ], - MConst: 0x7cfffd, - SQRTm3: [ - 0x1aaae, 0x0, 0x6d77ec, 0x69ffff, 0x44fd7e, 0x224c4f, 0x4a2ff2, 0x64c014, 0x22e9ab, 0x6c3ecc, - 0x3e8efd, 0x70819f, 0x156845, 0x319d1b, 0x5ff9a6, 0x8f51c, 0x1a01, - ], - CRu: [ - 0x7efffe, 0x7fffff, 0x8b807, 0x105000, 0x7d8136, 0x511bc2, 0x79be25, 0x59d49d, 0x77eadd, - 0xed41e, 0x69a718, 0x36728d, 0x72fdf7, 0xbe32c, 0x0, 0x0, 0x0, - ], - Fra: [ - 0x235fb8, 0x6bdb24, 0x76341d, 0x1f3c09, 0x6a53d6, 0x389ecf, 0x612eae, 0x1221eb, 0x5f4f7b, - 0x7a797a, 0x3f580f, 0x6068f8, 0x6b4202, 0x784637, 0x2ec199, 0x69df81, 0x1904, - ], - Frb: [ - 0x5c4af3, 0x1424db, 0x8b3de, 0x6b63f6, 0x55ac14, 0xbe505, 0x5c7d8f, 0x64764, 0x336fec, - 0xf6d8f, 0x52851e, 0x7cfdc2, 0x102231, 0x511d3d, 0x31380c, 0x1f159b, 0xfc, - ], - }; - - return ROM_FIELD_BLS12381; -}; - -ROM_FIELD_BLS12461 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BLS12461 = { - // BLS12461 Modulus - // Base Bits= 23 - Modulus: [ - 0x2aaaab, 0x155, 0x2aaab0, 0x2aaa55, 0x55, 0x80004, 0x555fc0, 0x135548, 0x1cc00f, 0x3ff4b8, - 0x2d0aa3, 0x58a424, 0x2cca47, 0x465b17, 0x6f5bc7, 0xa49af, 0x55d694, 0x34aab4, 0x155535, - 0x2aaaaa, 0x1, - ], - ROI: [ - 0x2aaaaa, 0x155, 0x2aaab0, 0x2aaa55, 0x55, 0x80004, 0x555fc0, 0x135548, 0x1cc00f, 0x3ff4b8, - 0x2d0aa3, 0x58a424, 0x2cca47, 0x465b17, 0x6f5bc7, 0xa49af, 0x55d694, 0x34aab4, 0x155535, - 0x2aaaaa, 0x1, - ], - R2modp: [ - 0x621498, 0x3b585f, 0x41688, 0x6f780d, 0x17c239, 0x158d8a, 0x491a92, 0x737df1, 0x22a06, - 0x460263, 0x275ff2, 0x5496c3, 0x6d4ad2, 0x3a7b46, 0x3a6323, 0x1723b1, 0x76204b, 0x66fd26, - 0x4e743e, 0x1be66e, 0x0, - ], - MConst: 0x7ffffd, - SQRTm3: [ - 0x2aaaae, 0x7ff955, 0x2aaa8f, 0x2aac55, 0x355, 0x440028, 0x54fd80, 0x4d50d6, 0x415095, - 0x7b9ed2, 0x4566e7, 0x514ff0, 0x2ead34, 0x325192, 0x3f33c7, 0xb89b0, 0x51d694, 0x34aab4, - 0x155535, 0x2aaaaa, 0x1, - ], - CRu: [ - 0x7ffffe, 0x3ff, 0x10, 0x7fff00, 0x7ffe7f, 0x61ffed, 0x311f, 0x630239, 0x6db7bc, 0x622af2, - 0x73d1dd, 0x43aa19, 0x3f0e89, 0xa04c2, 0x581400, 0x7f5fff, 0x1ffff, 0x0, 0x0, 0x0, 0x0, - ], - Fra: [ - 0x12a3a, 0x2f7f37, 0x3dc4, 0x52cce2, 0x1c6308, 0xb7f14, 0x4381d4, 0x52d328, 0x58d45f, - 0x359c90, 0x1dc2cc, 0x616582, 0x7c61eb, 0x6b11c5, 0x64341c, 0x421b30, 0x4dfefa, 0x3cabc4, - 0x12dfda, 0x172028, 0x1, - ], - Frb: [ - 0x298071, 0x50821e, 0x2a6ceb, 0x57dd73, 0x639d4c, 0x7c80ef, 0x11ddeb, 0x408220, 0x43ebaf, - 0xa5827, 0xf47d7, 0x773ea2, 0x30685b, 0x5b4951, 0xb27aa, 0x482e7f, 0x7d799, 0x77fef0, 0x2755a, - 0x138a82, 0x0, - ], - }; - - return ROM_FIELD_BLS12461; -}; - -ROM_FIELD_FP256BN = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_FP256BN = { - // FP256BN Modulus - // Base Bits= 24 - Modulus: [ - 0xd33013, 0x2ddbae, 0x82d329, 0x12980a, 0xdc65fb, 0xa49f0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - ROI: [ - 0xd33012, 0x2ddbae, 0x82d329, 0x12980a, 0xdc65fb, 0xa49f0c, 0x5eee71, 0x46e5f2, 0xfcf0cd, - 0xffffff, 0xffff, - ], - R2modp: [ - 0x2f4801, 0xf779d1, 0x3e7f6e, 0xb42a3a, 0xc919c9, 0xc26c08, 0x1bb715, 0xca2ed6, 0x54293e, - 0xe578e, 0x78ea, - ], - MConst: 0x37e5e5, - SQRTm3: [ - 0x8fc004, 0x199267, 0x451cf1, 0x2f71b0, 0x40b6bf, 0x73d3d5, 0xddca51, 0xd3d42f, 0xfcf0ca, - 0xffffff, 0xffff, - ], - CRu: [ - 0xa1b807, 0xa24a3, 0x1edb1c, 0xf1932d, 0xcdd79d, 0x18659b, 0x409210, 0x3988e1, 0x1, 0x0, 0x0, - ], - Fra: [ - 0x943106, 0x328af, 0x8f7476, 0x1e3ab2, 0xa17151, 0x67cf39, 0x8ddb08, 0x2d1a6e, 0x786f35, - 0x7662ca, 0x3d61, - ], - Frb: [ - 0x3eff0d, 0x2ab2ff, 0xf35eb3, 0xf45d57, 0x3af4a9, 0x3ccfd3, 0xd11369, 0x19cb83, 0x848198, - 0x899d35, 0xc29e, - ], - }; - - return ROM_FIELD_FP256BN; -}; - -ROM_FIELD_FP512BN = function () { - 'use strict'; - - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_FP512BN = { - // FP512BN Modulus - // Base Bits= 23 - Modulus: [ - 0x2def33, 0x501245, 0x1ed3ac, 0x7a6323, 0x255ce5, 0x7c322d, 0x2ac8db, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a2a, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - ROI: [ - 0x2def32, 0x501245, 0x1ed3ac, 0x7a6323, 0x255ce5, 0x7c322d, 0x2ac8db, 0x4632ef, 0x18b8e4, - 0x3d597d, 0x451b3c, 0x77a2a, 0x3c111b, 0x78177c, 0x32d4c1, 0x5d0ec, 0x7f01c6, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - R2modp: [ - 0x23e65d, 0x575a37, 0x411cd0, 0x295fb3, 0x640669, 0x375c69, 0x92395, 0x738492, 0x780d6d, - 0x1bcd9d, 0x417caa, 0x2dc6fb, 0x7eacfb, 0x327043, 0x7f2fc7, 0xf268c, 0x73d733, 0x2147c9, - 0x2accd3, 0x32eaf8, 0x3b2c1e, 0xd46a2, 0x30, - ], - MConst: 0x4c5c05, - // SQRTm3: [0x332330,0x505BC6,0x1C3175,0x1D56FC,0x52DE91,0x5E48D,0x345737,0x415677,0x83CB6,0x651720,0x753DC3,0xA8065,0x35CDD1,0x6B9137,0x2960D9,0x24905A,0x7C8EB4,0x7FF3D8,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3F], - SQRTm3: [ - 0x4463e2, 0x8702c, 0x6b848c, 0x3e4e58, 0x37724d, 0x287986, 0x346054, 0x415677, 0x83cb6, - 0x651720, 0x753dc3, 0xa8005, 0x35cdd1, 0x6b9137, 0x2960d9, 0x24905a, 0x7c8eb4, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - CRu: [ - 0x79298a, 0x2c4138, 0x52c1c, 0x5c58be, 0x6e6799, 0x1255d9, 0x2f9498, 0x43c4b3, 0x507acd, - 0x11384e, 0x1d2c80, 0x8fd18, 0x78ef76, 0x71d459, 0x2e1acd, 0x1530a3, 0x7dc83d, 0x7ff3d8, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3f, - ], - Fra: [ - 0x373ab2, 0x2f63e9, 0x47d258, 0x101576, 0x1514f6, 0x503c2e, 0x34ef61, 0x4fb040, 0x2cbbb5, - 0x553d0a, 0x63a7e2, 0x10341c, 0x48cf2e, 0x3564d7, 0x25bde4, 0x50c529, 0x468b4e, 0x2d518f, - 0x6de46, 0x7c84ad, 0x1cf5bb, 0x5ee355, 0x7, - ], - Frb: [ - 0x76b481, 0x20ae5b, 0x570154, 0x6a4dac, 0x1047ef, 0x2bf5ff, 0x75d97a, 0x7682ae, 0x6bfd2e, - 0x681c72, 0x617359, 0x77460d, 0x7341ec, 0x42b2a4, 0xd16dd, 0x350bc3, 0x387677, 0x52a249, - 0x7921b9, 0x37b52, 0x630a44, 0x211caa, 0x38, - ], - }; - - return ROM_FIELD_FP512BN; -}; - -ROM_FIELD_BN254 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BN254 = { - // BN254 Modulus - // Base Bits= 24 - Modulus: [0x13, 0x0, 0x13a700, 0x0, 0x210000, 0x861, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - ROI: [0x12, 0x0, 0x13a700, 0x0, 0x210000, 0x861, 0x800000, 0xba344d, 0x1, 0x648240, 0x2523], - R2modp: [ - 0x2f2aa7, 0x537047, 0xf8f174, 0xc3e364, 0xab8c1c, 0x3c2035, 0x69549, 0x379287, 0x3be629, - 0x75617a, 0x1f47, - ], - MConst: 0x9435e5, - SQRTm3: [0x4, 0x0, 0x60c00, 0x0, 0xf0000, 0x3cf, 0x0, 0x26cd89, 0x1, 0x648240, 0x2523], - CRu: [0x7, 0x0, 0x6cd80, 0x0, 0x90000, 0x249, 0x400000, 0x49b362, 0x0, 0x0, 0x0], - Fra: [ - 0x2a6de9, 0xe6c06f, 0xc2e17d, 0x4d3f77, 0x97492, 0x953f85, 0x50a846, 0xb6499b, 0x2e7c8c, - 0x761921, 0x1b37, - ], - Frb: [ - 0xd5922a, 0x193f90, 0x50c582, 0xb2c088, 0x178b6d, 0x6ac8dc, 0x2f57b9, 0x3eab2, 0xd18375, - 0xee691e, 0x9eb, - ], - }; - - return ROM_FIELD_BN254; -}; - -ROM_FIELD_BN254CX = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BN254CX = { - // BN254CX Modulus - // Base Bits= 24 - Modulus: [ - 0x1b55b3, 0x23ef5c, 0xe1be66, 0x18093e, 0x3fd6ee, 0x66d324, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - ROI: [ - 0x1b55b2, 0x23ef5c, 0xe1be66, 0x18093e, 0x3fd6ee, 0x66d324, 0x647a63, 0xb0bddf, 0x702a0d, 0x8, - 0x2400, - ], - R2modp: [ - 0x8ee63d, 0x721fde, 0xcc0891, 0x10c28b, 0xd4f5a, 0x4c18fb, 0x9036fa, 0x3f845f, 0xa507e4, - 0x78eb29, 0x1587, - ], - MConst: 0x789e85, - SQRTm3: [ - 0xd49c84, 0xfdc033, 0x355aa4, 0x342a30, 0xc41825, 0xe8aaa2, 0x646112, 0x20bddf, 0x702a0d, 0x8, - 0x2400, - ], - CRu: [ - 0x235c97, 0x931794, 0x5631e0, 0x71ef87, 0xbddf64, 0x3f1440, 0xca8, 0x480000, 0x0, 0x0, 0x0, - ], - Fra: [ - 0xc80ea3, 0x83355, 0x215bd9, 0xf173f8, 0x677326, 0x189868, 0x8aaca7, 0xafe18b, 0x3a0164, - 0x82fa6, 0x1359, - ], - Frb: [ - 0x534710, 0x1bbc06, 0xc0628d, 0x269546, 0xd863c7, 0x4e3abb, 0xd9cdbc, 0xdc53, 0x3628a9, - 0xf7d062, 0x10a6, - ], - }; - - return ROM_FIELD_BN254CX; -}; - -ROM_FIELD_BRAINPOOL = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_BRAINPOOL = { - // Brainpool modulus - // Base Bits= 24 - Modulus: [ - 0x6e5377, 0x481d1f, 0x282013, 0xd52620, 0x3bf623, 0x8d726e, 0x909d83, 0x3e660a, 0xeea9bc, - 0x57dba1, 0xa9fb, - ], - ROI: [ - 0x6e5376, 0x481d1f, 0x282013, 0xd52620, 0x3bf623, 0x8d726e, 0x909d83, 0x3e660a, 0xeea9bc, - 0x57dba1, 0xa9fb, - ], - R2modp: [ - 0x35b819, 0xb03428, 0xecaf0f, 0x3854a4, 0x4a0ed5, 0x2421ea, 0xaa562c, 0xf9c45, 0xddae58, - 0x4350fd, 0x52b8, - ], - MConst: 0xfd89b9, - }; - return ROM_FIELD_BRAINPOOL; -}; - -ROM_FIELD_C41417 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_C41417 = { - // C41417 modulus - // Base Bits= 22 - Modulus: [ - 0x3fffef, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3ffff, - ], - ROI: [ - 0x3fffee, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, 0x3fffff, - 0x3ffff, - ], - R2modp: [ - 0x12100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, - ], - MConst: 0x11, - }; - return ROM_FIELD_C41417; -}; - -ROM_FIELD_C1174 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_C1174 = { - // C1174 modulus - // Base Bits= 24 - Modulus: [ - 0xfffff7, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - R2modp: [0x0, 0x144, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ROI: [ - 0xfffff6, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0x7ff, - ], - MConst: 0x9, - }; - return ROM_FIELD_C1174; -}; - -ROM_FIELD_C1665 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - var ROM_FIELD_C1665 = { - // C1665 modulus - // Base Bits= 23 - Modulus: [0x7ffffb, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x1f], - R2modp: [0x0, 0x32000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - ROI: [0x7ffffa, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x1f], - MConst: 0x5, - }; - return ROM_FIELD_C1665; -}; - -ROM_FIELD_MDC = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - var ROM_FIELD_MDC = { - // Million Dollar Curve modulus - // Base Bits= 24 - Modulus: [ - 0x79ec13, 0x104057, 0x9ec137, 0xef07af, 0x6a9037, 0xfd4f08, 0xfdd7a5, 0x532f92, 0x56afb4, - 0x68b9d4, 0xf13b, - ], - R2modp: [ - 0xfff702, 0x31619a, 0xba623e, 0xc672c1, 0xf5883f, 0x39e4ab, 0x4589, 0x972c4a, 0xd61255, - 0x6e22d, 0x7c41, - ], - ROI: [ - 0x79ec12, 0x104057, 0x9ec137, 0xef07af, 0x6a9037, 0xfd4f08, 0xfdd7a5, 0x532f92, 0x56afb4, - 0x68b9d4, 0xf13b, - ], - MConst: 0xe541e5, - }; - return ROM_FIELD_MDC; -}; - -ROM_FIELD_GOLDILOCKS = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_GOLDILOCKS = { - // GOLDILOCKS modulus - // Base Bits= 23 - Modulus: [ - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - ROI: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7dffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7ff, - ], - R2modp: [ - 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, - ], - MConst: 0x1, - }; - return ROM_FIELD_GOLDILOCKS; -}; - -ROM_FIELD_HIFIVE = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_HIFIVE = { - // HIFIVE modulus - // Base Bits= 23 - Modulus: [ - 0x7ffffd, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x3fff, - ], - ROI: [ - 0x59d3b8, 0x104fea, 0xdae01, 0x49f563, 0x14538b, 0x2bb499, 0x7f2a2e, 0x30f6d4, 0x18c41f, - 0x2a7bef, 0x62cad1, 0x408fe1, 0x1ef527, 0x787c06, 0x3e4f, - ], - R2modp: [0x240000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0x3, - }; - return ROM_FIELD_HIFIVE; -}; - -ROM_FIELD_NIST256 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_NIST256 = { - // NIST256 Modulus - // Base Bits= 24 - Modulus: [0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x0, 0x0, 0x0, 0x0, 0x1, 0xffff00, 0xffff], - ROI: [0xfffffe, 0xffffff, 0xffffff, 0xffffff, 0x0, 0x0, 0x0, 0x0, 0x1, 0xffff00, 0xffff], - R2modp: [ - 0x30000, 0x0, 0x0, 0xffff00, 0xfbffff, 0xffffff, 0xfffffe, 0xffffff, 0xfdffff, 0xffffff, 0x4, - ], - MConst: 0x1, - }; - return ROM_FIELD_NIST256; -}; - -ROM_FIELD_SM2 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_SM2 = { - // SM2 Modulus - // Base Bits= 24 - Modulus: [ - 0xffffff, 0xffffff, 0xffff, 0x0, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffeff, - 0xffff, - ], - ROI: [ - 0xfffffe, 0xffffff, 0xffff, 0x0, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffeff, - 0xffff, - ], - R2modp: [0x30000, 0x0, 0x2, 0xffff00, 0x2ffff, 0x0, 0x1, 0x100, 0x20000, 0x0, 0x4], - MConst: 0x1, - }; - return ROM_FIELD_SM2; -}; - -ROM_FIELD_NIST384 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_NIST384 = { - // NIST384 modulus - // Base Bits= 23 - Modulus: [ - 0x7fffff, 0x1ff, 0x0, 0x0, 0x7ffff0, 0x7fdfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - ROI: [ - 0x7ffffe, 0x1ff, 0x0, 0x0, 0x7ffff0, 0x7fdfff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0xffff, - ], - R2modp: [ - 0x4000, 0x0, 0x7ffffe, 0x1ff, 0x80000, 0x0, 0x0, 0x7fc000, 0x3fffff, 0x0, 0x200, 0x20000, 0x0, - 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x1, - }; - return ROM_FIELD_NIST384; -}; - -ROM_FIELD_NIST521 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_NIST521 = { - // NIST521 modulus - // Base Bits= 23 - Modulus: [ - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - ROI: [ - 0x7ffffe, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, - 0x7fffff, 0x7fffff, 0x7fffff, 0x7fffff, 0x7fff, - ], - R2modp: [ - 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, - ], - MConst: 0x1, - }; - return ROM_FIELD_NIST521; -}; - -ROM_FIELD_SECP256K1 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_SECP256K1 = { - // SECP256K1 modulus - // Base Bits= 24 - Modulus: [ - 0xfffc2f, 0xfffeff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - ROI: [ - 0xfffc2e, 0xfffeff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, - 0xffffff, 0xffff, - ], - R2modp: [0xa10000, 0xe90, 0x7a2, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], - MConst: 0x253531, - SQRTm3: [ - 0xd5f852, 0x27ae1c, 0xd47d8d, 0xda14ec, 0x1f6d15, 0x962cc6, 0xc2a797, 0x233770, 0x7f1df, - 0x2ba935, 0xa2d, - ], - }; - return ROM_FIELD_SECP256K1; -}; - -ROM_FIELD_SECP160R1 = function () { - 'use strict'; - /* Fixed Data in ROM - Field and Curve parameters */ - - var ROM_FIELD_SECP160R1 = { - // SECP160R1 modulus - // Base Bits= 24 - Modulus: [0xffffff, 0xffff7f, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffff], - R2modp: [0x10000, 0x0, 0x1, 0x40, 0x0, 0x0, 0x0], - ROI: [0xfffffe, 0xffff7f, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffff], - MConst: 0x1, - }; - return ROM_FIELD_SECP160R1; -}; - -ROM_FIELD_JUBJUB = function () { - 'use strict'; - // Fixed Data in ROM - Field and Curve parameters - - var ROM_FIELD_JUBJUB = { - // Base Bits= 24 - Modulus: [ - 0x1, 0xffff00, 0xfeffff, 0xfffe5b, 0xbda402, 0xd80553, 0x809a1, 0x3339d8, 0x9d7d48, 0xa75329, - 0x73ed, - ], - R2modp: [ - 0x6cefea, 0x4089c, 0xafe991, 0x7687f1, 0x3f3f50, 0x45bbe1, 0x94826, 0x101d61, 0xb3be6b, - 0xb9a93, 0x8f8, - ], - ROI: [ - 0x912f1f, 0x8f500b, 0x941b78, 0x70b3e0, 0x24ff2, 0xd6c0c4, 0xc8d168, 0xfd56d, 0x416b6f, - 0xd79e5b, 0x212, - ], - MConst: 0xffffff, - }; - return ROM_FIELD_JUBJUB; -}; - -ROM_FIELD_TWEEDLEDUM = function () { - 'use strict'; - // Fixed Data in ROM - Field and Curve parameters - - var ROM_FIELD_TWEEDLEDUM = { - // Base bits= 24 - Modulus: [0x1, 0x64e200, 0xb9a140, 0x6c3f59, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - R2modp: [ - 0xffcde, 0xf3fc00, 0x817083, 0x90fd10, 0x4e767f, 0x919928, 0x94c659, 0x28e190, 0xedd7b, - 0x7ccca, 0x2d91, - ], - ROI: [ - 0x8837ce, 0x9f31b8, 0xd653de, 0xf3ea99, 0x46e8f3, 0x2d57ff, 0xeaaf8c, 0xf624f2, 0xee2fc, - 0x511789, 0x2ae4, - ], - SQRTm3: [ - 0xde6c70, 0xd7ab7, 0x6c960f, 0x34f725, 0x86aae0, 0x84cb12, 0xd7220f, 0xc8286d, 0x2d06d6, - 0x7d4a94, 0x15ef, - ], - MConst: 0xffffff, - }; - return ROM_FIELD_TWEEDLEDUM; -}; - -ROM_FIELD_TWEEDLEDEE = function () { - 'use strict'; - // Fixed Data in ROM - Field and Curve parameters - - var ROM_FIELD_TWEEDLEDEE = { - // Base bits= 24 - Modulus: [0x1, 0xafd400, 0xc9842c, 0x696286, 0x8aa127, 0x3, 0x0, 0x0, 0x0, 0x0, 0x4000], - R2modp: [ - 0xffcde, 0x29d800, 0x45e681, 0x2b8642, 0x18e911, 0x7e0b8d, 0x3aa0a2, 0xe6fcb0, 0x13f4c0, - 0x68860, 0x2d91, - ], - ROI: [ - 0x9d57ec, 0x323486, 0xbf1cbd, 0xb8084f, 0x287dd1, 0x72930a, 0x645a98, 0xf1dbcb, 0xc03c0b, - 0xfc510d, 0x113e, - ], - SQRTm3: [ - 0x1f49fa, 0xd5a629, 0xb902fc, 0xd867d6, 0x147aa6, 0x3ffcd0, 0xbff2e6, 0xf5b16, 0x934b1, - 0xda743c, 0x2d8c, - ], - MConst: 0xffffff, - }; - return ROM_FIELD_TWEEDLEDEE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - ROM_FIELD_25519: ROM_FIELD_25519, - ROM_FIELD_256PM: ROM_FIELD_256PM, - ROM_FIELD_384PM: ROM_FIELD_384PM, - ROM_FIELD_512PM: ROM_FIELD_512PM, - ROM_FIELD_ANSSI: ROM_FIELD_ANSSI, - ROM_FIELD_FP256BN: ROM_FIELD_FP256BN, - ROM_FIELD_FP512BN: ROM_FIELD_FP512BN, - ROM_FIELD_BN254: ROM_FIELD_BN254, - ROM_FIELD_BN254CX: ROM_FIELD_BN254CX, - ROM_FIELD_BRAINPOOL: ROM_FIELD_BRAINPOOL, - ROM_FIELD_C41417: ROM_FIELD_C41417, - ROM_FIELD_GOLDILOCKS: ROM_FIELD_GOLDILOCKS, - ROM_FIELD_HIFIVE: ROM_FIELD_HIFIVE, - ROM_FIELD_NIST256: ROM_FIELD_NIST256, - ROM_FIELD_NIST384: ROM_FIELD_NIST384, - ROM_FIELD_NIST521: ROM_FIELD_NIST521, - ROM_FIELD_SECP256K1: ROM_FIELD_SECP256K1, - ROM_FIELD_BLS12383: ROM_FIELD_BLS12383, - ROM_FIELD_BLS24479: ROM_FIELD_BLS24479, - ROM_FIELD_BLS48556: ROM_FIELD_BLS48556, - ROM_FIELD_BLS48286: ROM_FIELD_BLS48286, - ROM_FIELD_BLS48581: ROM_FIELD_BLS48581, - ROM_FIELD_BLS12381: ROM_FIELD_BLS12381, - ROM_FIELD_BLS12461: ROM_FIELD_BLS12461, - ROM_FIELD_BN462: ROM_FIELD_BN462, - ROM_FIELD_C1174: ROM_FIELD_C1174, - ROM_FIELD_C1665: ROM_FIELD_C1665, - ROM_FIELD_MDC: ROM_FIELD_MDC, - ROM_FIELD_SECP160R1: ROM_FIELD_SECP160R1, - ROM_FIELD_SM2: ROM_FIELD_SM2, - ROM_FIELD_JUBJUB: ROM_FIELD_JUBJUB, - ROM_FIELD_TWEEDLEDUM: ROM_FIELD_TWEEDLEDUM, - ROM_FIELD_TWEEDLEDEE: ROM_FIELD_TWEEDLEDEE, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/rsa.js b/packages/bls-verify/src/vendor/amcl-js/src/rsa.js deleted file mode 100644 index 9134e6b75..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/rsa.js +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* RSA API Functions */ -var RSA, rsa_private_key, rsa_public_key; - -RSA = function (ctx) { - 'use strict'; - - var RSA = { - RFS: ctx.BIG.MODBYTES * ctx.FF.FFLEN, - HASH_TYPE: 32, - - bytestohex: function (b) { - var s = '', - len = b.length, - ch, - i; - - for (i = 0; i < len; i++) { - ch = b[i]; - s += ((ch >>> 4) & 15).toString(16); - s += (ch & 15).toString(16); - } - return s; - }, - - bytestostring: function (b) { - var s = '', - i; - - for (i = 0; i < b.length; i++) { - s += String.fromCharCode(b[i]); - } - - return s; - }, - - stringtobytes: function (s) { - var b = [], - i; - - for (i = 0; i < s.length; i++) { - b.push(s.charCodeAt(i)); - } - - return b; - }, - - KEY_PAIR: function (rng, e, PRIV, PUB) { - /* IEEE1363 A16.11/A16.12 more or less */ - var n = PUB.n.length >> 1, - t = new ctx.FF(n), - p1 = new ctx.FF(n), - q1 = new ctx.FF(n); - - for (;;) { - PRIV.p.random(rng); - - while (PRIV.p.lastbits(2) != 3) { - PRIV.p.inc(1); - } - - while (!ctx.FF.prime(PRIV.p, rng)) { - PRIV.p.inc(4); - } - - p1.copy(PRIV.p); - p1.dec(1); - - if (p1.cfactor(e)) { - continue; - } - - break; - } - - for (;;) { - PRIV.q.random(rng); - - while (PRIV.q.lastbits(2) != 3) { - PRIV.q.inc(1); - } - - while (!ctx.FF.prime(PRIV.q, rng)) { - PRIV.q.inc(4); - } - - q1.copy(PRIV.q); - q1.dec(1); - - if (q1.cfactor(e)) { - continue; - } - - break; - } - - PUB.n = ctx.FF.mul(PRIV.p, PRIV.q); - PUB.e = e; - - t.copy(p1); - t.shr(); - PRIV.dp.set(e); - PRIV.dp.invmodp(t); - if (PRIV.dp.parity() === 0) { - PRIV.dp.add(t); - } - PRIV.dp.norm(); - - t.copy(q1); - t.shr(); - PRIV.dq.set(e); - PRIV.dq.invmodp(t); - if (PRIV.dq.parity() === 0) { - PRIV.dq.add(t); - } - PRIV.dq.norm(); - - PRIV.c.copy(PRIV.p); - PRIV.c.invmodp(PRIV.q); - - return; - }, - - /* destroy the Private Key structure */ - PRIVATE_KEY_KILL: function (PRIV) { - PRIV.p.zero(); - PRIV.q.zero(); - PRIV.dp.zero(); - PRIV.dq.zero(); - PRIV.c.zero(); - }, - - /* RSA encryption with the public key */ - ENCRYPT: function (PUB, F, G) { - var n = PUB.n.getlen(), - f = new ctx.FF(n); - - ctx.FF.fromBytes(f, F); - - f.power(PUB.e, PUB.n); - - f.toBytes(G); - }, - - /* RSA decryption with the private key */ - DECRYPT: function (PRIV, G, F) { - var n = PRIV.p.getlen(), - g = new ctx.FF(2 * n), - jp, - jq, - t; - - ctx.FF.fromBytes(g, G); - - jp = g.dmod(PRIV.p); - jq = g.dmod(PRIV.q); - - jp.skpow(PRIV.dp, PRIV.p); - jq.skpow(PRIV.dq, PRIV.q); - - g.zero(); - g.dscopy(jp); - jp.mod(PRIV.q); - if (ctx.FF.comp(jp, jq) > 0) { - jq.add(PRIV.q); - } - jq.sub(jp); - jq.norm(); - - t = ctx.FF.mul(PRIV.c, jq); - jq = t.dmod(PRIV.q); - - t = ctx.FF.mul(jq, PRIV.p); - g.add(t); - g.norm(); - - g.toBytes(F); - }, - }; - - return RSA; -}; - -rsa_private_key = function (ctx) { - 'use strict'; - - var rsa_private_key = function (n) { - this.p = new ctx.FF(n); - this.q = new ctx.FF(n); - this.dp = new ctx.FF(n); - this.dq = new ctx.FF(n); - this.c = new ctx.FF(n); - }; - - rsa_private_key.prototype = { - set: function (p, q, dp, dq, c) { - this.p = p; - this.q = q; - this.dp = dp; - this.dq = dq; - this.c = c; - }, - - set_p: function (p) { - this.p = p; - }, - - set_q: function (q) { - this.q = q; - }, - - set_dp: function (dp) { - this.dp = dp; - }, - - set_dq: function (dq) { - this.dq = dq; - }, - - set_c: function (c) { - this.c = c; - }, - }; - - rsa_private_key.get_instance = function (p, q, dp, dq, c) { - let priv = new rsa_private_key(ctx.FF.HFLEN); - priv.set(p, q, dp, dq, c); - return priv; - }; - - return rsa_private_key; -}; - -rsa_public_key = function (ctx) { - 'use strict'; - - var rsa_public_key = function (m) { - this.e = 0; - this.n = new ctx.FF(m); - }; - - rsa_public_key.prototype = { - set: function (n, e) { - this.e = e; - ctx.FF.fromBytes(this.n, n); - }, - - set_e: function (e) { - this.e = e; - }, - - set_n: function (n) { - ctx.FF.fromBytes(this.n, n); - }, - }; - - rsa_public_key.get_instance = function (n, e) { - var pub = new rsa_public_key(ctx.FF.FFLEN); - pub.set(n, e); - return pub; - }; - - return rsa_public_key; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - RSA: RSA, - rsa_private_key: rsa_private_key, - rsa_public_key: rsa_public_key, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/sha3.js b/packages/bls-verify/src/vendor/amcl-js/src/sha3.js deleted file mode 100644 index 8d3fc1bfd..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/sha3.js +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Implementation of the Secure Hashing Algorithm SHA-3 - - * Generates a message digest. It should be impossible to come - * come up with two messages that hash to the same value ("collision free"). - * - * For use with byte-oriented messages only. - */ - -var SHA3 = function (ctx) { - 'use strict'; - - var SHA3 = function (olen) { - this.length = 0; - this.rate = 0; - this.len = 0; - this.S = []; - this.init(olen); - }; - - SHA3.prototype = { - transform: function () { - var C = [], - D = [], - B = [], - i, - j, - k; - - for (k = 0; k < SHA3.ROUNDS; k++) { - C[0] = new ctx.UInt64( - this.S[0][0].top ^ - this.S[0][1].top ^ - this.S[0][2].top ^ - this.S[0][3].top ^ - this.S[0][4].top, - this.S[0][0].bot ^ - this.S[0][1].bot ^ - this.S[0][2].bot ^ - this.S[0][3].bot ^ - this.S[0][4].bot, - ); - C[1] = new ctx.UInt64( - this.S[1][0].top ^ - this.S[1][1].top ^ - this.S[1][2].top ^ - this.S[1][3].top ^ - this.S[1][4].top, - this.S[1][0].bot ^ - this.S[1][1].bot ^ - this.S[1][2].bot ^ - this.S[1][3].bot ^ - this.S[1][4].bot, - ); - C[2] = new ctx.UInt64( - this.S[2][0].top ^ - this.S[2][1].top ^ - this.S[2][2].top ^ - this.S[2][3].top ^ - this.S[2][4].top, - this.S[2][0].bot ^ - this.S[2][1].bot ^ - this.S[2][2].bot ^ - this.S[2][3].bot ^ - this.S[2][4].bot, - ); - C[3] = new ctx.UInt64( - this.S[3][0].top ^ - this.S[3][1].top ^ - this.S[3][2].top ^ - this.S[3][3].top ^ - this.S[3][4].top, - this.S[3][0].bot ^ - this.S[3][1].bot ^ - this.S[3][2].bot ^ - this.S[3][3].bot ^ - this.S[3][4].bot, - ); - C[4] = new ctx.UInt64( - this.S[4][0].top ^ - this.S[4][1].top ^ - this.S[4][2].top ^ - this.S[4][3].top ^ - this.S[4][4].top, - this.S[4][0].bot ^ - this.S[4][1].bot ^ - this.S[4][2].bot ^ - this.S[4][3].bot ^ - this.S[4][4].bot, - ); - - D[0] = SHA3.xor(C[4], SHA3.rotl(C[1], 1)); - D[1] = SHA3.xor(C[0], SHA3.rotl(C[2], 1)); - D[2] = SHA3.xor(C[1], SHA3.rotl(C[3], 1)); - D[3] = SHA3.xor(C[2], SHA3.rotl(C[4], 1)); - D[4] = SHA3.xor(C[3], SHA3.rotl(C[0], 1)); - - for (i = 0; i < 5; i++) { - B[i] = []; - for (j = 0; j < 5; j++) { - B[i][j] = new ctx.UInt64(0, 0); - this.S[i][j] = SHA3.xor(this.S[i][j], D[i]); - } - } - - B[0][0] = this.S[0][0].copy(); - B[1][3] = SHA3.rotl(this.S[0][1], 36); - B[2][1] = SHA3.rotl(this.S[0][2], 3); - B[3][4] = SHA3.rotl(this.S[0][3], 41); - B[4][2] = SHA3.rotl(this.S[0][4], 18); - - B[0][2] = SHA3.rotl(this.S[1][0], 1); - B[1][0] = SHA3.rotl(this.S[1][1], 44); - B[2][3] = SHA3.rotl(this.S[1][2], 10); - B[3][1] = SHA3.rotl(this.S[1][3], 45); - B[4][4] = SHA3.rotl(this.S[1][4], 2); - - B[0][4] = SHA3.rotl(this.S[2][0], 62); - B[1][2] = SHA3.rotl(this.S[2][1], 6); - B[2][0] = SHA3.rotl(this.S[2][2], 43); - B[3][3] = SHA3.rotl(this.S[2][3], 15); - B[4][1] = SHA3.rotl(this.S[2][4], 61); - - B[0][1] = SHA3.rotl(this.S[3][0], 28); - B[1][4] = SHA3.rotl(this.S[3][1], 55); - B[2][2] = SHA3.rotl(this.S[3][2], 25); - B[3][0] = SHA3.rotl(this.S[3][3], 21); - B[4][3] = SHA3.rotl(this.S[3][4], 56); - - B[0][3] = SHA3.rotl(this.S[4][0], 27); - B[1][1] = SHA3.rotl(this.S[4][1], 20); - B[2][4] = SHA3.rotl(this.S[4][2], 39); - B[3][2] = SHA3.rotl(this.S[4][3], 8); - B[4][0] = SHA3.rotl(this.S[4][4], 14); - - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - this.S[i][j] = SHA3.xor( - B[i][j], - SHA3.and(SHA3.not(B[(i + 1) % 5][j]), B[(i + 2) % 5][j]), - ); - } - } - - this.S[0][0] = SHA3.xor(this.S[0][0], SHA3.RC[k]); - } - }, - - copy: function (b) { - var i, j; - this.length = b.length; - this.len = b.len; - this.rate = b.rate; - for (i = 0; i < 5; i++) for (j = 0; j < 5; j++) this.S[i][j] = b.S[i][j].copy(); - }, - - /* Initialise Hash function */ - init: function (olen) { - /* initialise */ - var i, j; - for (i = 0; i < 5; i++) { - this.S[i] = []; - for (j = 0; j < 5; j++) { - this.S[i][j] = new ctx.UInt64(0, 0); - } - } - this.length = 0; - this.len = olen; - this.rate = 200 - 2 * olen; - }, - - /* process a single byte */ - process: function (byt) { - /* process the next message byte */ - var i, j, k, b, cnt, el; - - cnt = this.length % this.rate; - b = cnt % 8; - cnt >>= 3; - i = cnt % 5; - j = Math.floor(cnt / 5); /* process by columns! */ - - el = new ctx.UInt64(0, byt); - for (k = 0; k < b; k++) { - el.shlb(); - } - this.S[i][j] = SHA3.xor(this.S[i][j], el); - - this.length++; - if (this.length % this.rate == 0) { - this.transform(); - } - }, - - /* process an array of bytes */ - process_array: function (b) { - for (var i = 0; i < b.length; i++) { - this.process(b[i]); - } - }, - - /* process a 32-bit integer */ - process_num: function (n) { - this.process((n >> 24) & 0xff); - this.process((n >> 16) & 0xff); - this.process((n >> 8) & 0xff); - this.process(n & 0xff); - }, - - /* squeeze the sponge */ - squeeze: function (buff, olen) { - var done, - m = 0, - i, - j, - k, - el; - - /* extract by columns */ - done = false; - - for (;;) { - for (j = 0; j < 5; j++) { - for (i = 0; i < 5; i++) { - el = this.S[i][j].copy(); - for (k = 0; k < 8; k++) { - buff[m++] = el.bot & 0xff; - if (m >= olen || m % this.rate == 0) { - done = true; - break; - } - el = SHA3.rotl(el, 56); - } - - if (done) { - break; - } - } - - if (done) { - break; - } - } - - if (m >= olen) { - break; - } - - done = false; - this.transform(); - } - }, - - hash: function () { - /* pad message and finish - supply digest */ - var buff = []; - var q = this.rate - (this.length % this.rate); - if (q == 1) { - this.process(0x86); - } else { - this.process(0x06); /* 0x06 for SHA-3 */ - while (this.length % this.rate != this.rate - 1) { - this.process(0x00); - } - this.process(0x80); /* this will force a final transform */ - } - this.squeeze(buff, this.len); - return buff; - }, - - continuing_hash() { - var sh = new SHA3(); - sh.copy(this); - return sh.hash(); - }, - - shake: function (buff, olen) { - /* pad message and finish - supply digest */ - var q = this.rate - (this.length % this.rate); - if (q == 1) { - this.process(0x9f); - } else { - this.process(0x1f); /* 0x06 for SHA-3 */ - while (this.length % this.rate != this.rate - 1) { - this.process(0x00); - } - this.process(0x80); /* this will force a final transform */ - } - this.squeeze(buff, olen); - }, - - continuing_shake(buff, olen) { - var sh = new SHA3(); - sh.copy(this); - sh.shake(buff, olen); - }, - }; - - /* static functions */ - SHA3.rotl = function (x, n) { - if (n == 0) { - return x; - } - - if (n < 32) { - return new ctx.UInt64( - (x.top << n) | (x.bot >>> (32 - n)), - (x.bot << n) | (x.top >>> (32 - n)), - ); - } else { - return new ctx.UInt64( - (x.bot << (n - 32)) | (x.top >>> (64 - n)), - (x.top << (n - 32)) | (x.bot >>> (64 - n)), - ); - } - }; - - SHA3.xor = function (a, b) { - return new ctx.UInt64(a.top ^ b.top, a.bot ^ b.bot); - }; - - SHA3.and = function (a, b) { - return new ctx.UInt64(a.top & b.top, a.bot & b.bot); - }; - - SHA3.not = function (a) { - return new ctx.UInt64(~a.top, ~a.bot); - }; - - /* constants */ - SHA3.ROUNDS = 24; - SHA3.HASH224 = 28; - SHA3.HASH256 = 32; - SHA3.HASH384 = 48; - SHA3.HASH512 = 64; - SHA3.SHAKE128 = 16; - SHA3.SHAKE256 = 32; - - SHA3.RC = [ - new ctx.UInt64(0x00000000, 0x00000001), - new ctx.UInt64(0x00000000, 0x00008082), - new ctx.UInt64(0x80000000, 0x0000808a), - new ctx.UInt64(0x80000000, 0x80008000), - new ctx.UInt64(0x00000000, 0x0000808b), - new ctx.UInt64(0x00000000, 0x80000001), - new ctx.UInt64(0x80000000, 0x80008081), - new ctx.UInt64(0x80000000, 0x00008009), - new ctx.UInt64(0x00000000, 0x0000008a), - new ctx.UInt64(0x00000000, 0x00000088), - new ctx.UInt64(0x00000000, 0x80008009), - new ctx.UInt64(0x00000000, 0x8000000a), - new ctx.UInt64(0x00000000, 0x8000808b), - new ctx.UInt64(0x80000000, 0x0000008b), - new ctx.UInt64(0x80000000, 0x00008089), - new ctx.UInt64(0x80000000, 0x00008003), - new ctx.UInt64(0x80000000, 0x00008002), - new ctx.UInt64(0x80000000, 0x00000080), - new ctx.UInt64(0x00000000, 0x0000800a), - new ctx.UInt64(0x80000000, 0x8000000a), - new ctx.UInt64(0x80000000, 0x80008081), - new ctx.UInt64(0x80000000, 0x00008080), - new ctx.UInt64(0x00000000, 0x80000001), - new ctx.UInt64(0x80000000, 0x80008008), - ]; - - return SHA3; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - SHA3: SHA3, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/share.js b/packages/bls-verify/src/vendor/amcl-js/src/share.js deleted file mode 100644 index 5075f1b41..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/share.js +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Shamir threshold secret sharing module */ -/* Split any byte array into number of shares < 256 */ -/* Specify number of shares required for recovery - nsr */ - -/* See TestMPIN.html for an example of use */ - -var SHARE = function (ctx) { - 'use strict'; - - /* Return a share of M */ - /* input id - Unique share ID */ - /* input nsr - Number of shares required for recovery */ - /* input Message M to be shared */ - /* input Random seed R */ - /* return share structure */ - var SHARE = function (id, nsr, M, R) { - this.ID = 0; - this.NSR = 0; - this.B = []; - if (id < 1 || id >= 256 || nsr < 2 || nsr >= 256) return; - this.ID = id; - this.NSR = nsr; - var m = M.length; - var rng = new ctx.RAND(); - rng.clean(); - rng.seed(R.length, R); - for (var j = 0; j < m; j++) { - var x = this.ID; - this.B[j] = M[j]; - for (var n = 1; n < nsr; n++) { - this.B[j] = SHARE.add(this.B[j], SHARE.mul(rng.getByte(), x)); - x = SHARE.mul(x, this.ID); - } - } - }; - - /* recover M from shares */ - SHARE.recover = function (S) { - var m = S[0].B.length; - var nsr = S[0].NSR; - if (nsr != S.length) return null; - for (var i = 1; i < nsr; i++) { - if (S[i].NSR != nsr || S[i].B.length != m) return null; - } - var M = []; - var x = []; - var y = []; - for (var j = 0; j < m; j++) { - for (var i = 0; i < nsr; i++) { - x[i] = S[i].ID; - y[i] = S[i].B[j]; - } - M[j] = SHARE.interpolate(nsr, x, y); - } - return M; - }; - - /* Internal functions */ - - SHARE.add = function (x, y) { - return x ^ y; - }; - - SHARE.mul = function (x, y) { - var ix = x & 0xff, - iy = y & 0xff, - lx = SHARE.ltab[ix] & 0xff, - ly = SHARE.ltab[iy] & 0xff; - - if (x !== 0 && y !== 0) { - return SHARE.ptab[(lx + ly) % 255]; - } else { - return 0; - } - }; - - SHARE.inv = function (x) { - var ix = x & 0xff; - var lx = SHARE.ltab[ix] & 0xff; - return SHARE.ptab[255 - lx]; - }; - - SHARE.interpolate = function (n, x, y) { - var i, j; - var p, - yp = 0; - for (i = 0; i < n; i++) { - p = 1; - for (j = 0; j < n; j++) - if (i != j) p = SHARE.mul(p, SHARE.mul(x[j], SHARE.inv(SHARE.add(x[i], x[j])))); - yp = SHARE.add(yp, SHARE.mul(p, y[i])); - } - return yp; - }; - - SHARE.ptab = [ - 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53, 95, 225, 56, 72, 216, 115, - 149, 164, 247, 2, 6, 10, 30, 34, 102, 170, 229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, - 112, 144, 171, 230, 49, 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205, - 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136, 131, 158, 185, 208, 107, - 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154, 181, 196, 87, 249, 16, 48, 80, 240, 11, - 29, 39, 105, 187, 214, 97, 163, 254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, - 32, 96, 160, 251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65, 195, 94, - 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117, 159, 186, 213, 100, 172, 239, - 42, 126, 130, 157, 188, 223, 122, 142, 137, 128, 155, 182, 193, 88, 232, 35, 101, 175, 234, 37, - 111, 177, 200, 67, 197, 84, 252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, - 202, 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14, 18, 54, 90, 238, - 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23, 57, 75, 221, 124, 132, 151, 162, 253, - 28, 36, 108, 180, 199, 82, 246, 1, - ]; - SHARE.ltab = [ - 0, 255, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3, 100, 4, 224, 14, 52, 141, 129, - 239, 76, 113, 8, 200, 248, 105, 28, 193, 125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, - 114, 154, 201, 9, 120, 101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142, - 150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56, 102, 221, 253, 48, - 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16, 126, 110, 72, 195, 163, 182, 30, 66, 58, - 107, 40, 84, 250, 133, 61, 186, 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, - 167, 87, 175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232, 44, 215, - 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160, 127, 12, 246, 111, 23, 196, 73, - 236, 216, 67, 31, 45, 164, 118, 123, 183, 204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, - 170, 85, 41, 157, 151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209, - 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171, 68, 17, 146, 217, 35, 32, - 46, 137, 180, 124, 184, 38, 119, 153, 227, 165, 103, 74, 237, 222, 197, 49, 254, 24, 13, 99, - 140, 128, 192, 247, 112, 7, - ]; - return SHARE; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - SHARE: SHARE, - }; -} diff --git a/packages/bls-verify/src/vendor/amcl-js/src/uint64.js b/packages/bls-verify/src/vendor/amcl-js/src/uint64.js deleted file mode 100644 index 75cbd7137..000000000 --- a/packages/bls-verify/src/vendor/amcl-js/src/uint64.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2020 MIRACL UK Ltd. - * - * This file is part of MIRACL Core - * (see https://github.com/miracl/core). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* rudimentary unsigned 64-bit type for SHA384 and SHA512 */ - -var UInt64 = function () { - 'use strict'; - - var UInt64 = function (top, bot) { - this.top = top; - this.bot = bot; - }; - - UInt64.prototype = { - add: function (y) { - var t = (this.bot >>> 0) + (y.bot >>> 0), - low = t >>> 0, - high = (this.top >>> 0) + (y.top >>> 0); - - this.bot = low; - - if (low != t) { - this.top = (high + 1) >>> 0; - } else { - this.top = high; - } - - return this; - }, - - copy: function () { - var r = new UInt64(this.top, this.bot); - return r; - }, - - shlb: function () { - var t = this.bot >>> 24; - this.top = t + (this.top << 8); - this.bot <<= 8; - return this; - }, - }; - - return UInt64; -}; - -if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = { - UInt64: UInt64, - }; -} From 06a203d8d37b196f8a767762fe903d007adef7ea Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 12:43:50 -0800 Subject: [PATCH 06/11] bls verification working --- README.md | 2 ++ package-lock.json | 9 +++------ packages/bls-verify/package.json | 4 ++-- packages/bls-verify/src/index.test.ts | 8 +++----- packages/bls-verify/src/index.ts | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5b4bb747d..d6e554c66 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Use an Agent to interact with the Internet Computer from your JavaScript program This source code repository contains multiple npm packages, each under `./packages/`. +Note: the `@noble/curves` `verifyShortSignature` function has been audited and merged, but has not yet been released. Once the release is available, we will update the `@dfinity/agent` dependency to use it instead of this manually compiled version + ## Development ### Getting Started diff --git a/package-lock.json b/package-lock.json index c7b8ee476..bba6567e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1983,6 +1983,8 @@ }, "node_modules/@noble/curves": { "version": "1.2.0", + "resolved": "file:noble-curves-1.2.0.tgz", + "integrity": "sha512-Ow/xR1GC0+Qwlos9GA4ueaG7fT48u04ifqmobWr9wtmA+uwWsYcoRToJosUTf2OBqdjVCdc8ZAHjjsNAzYvCCw==", "license": "MIT", "dependencies": { "@noble/hashes": "1.3.2" @@ -5612,10 +5614,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/amcl-js": { - "resolved": "packages/bls-verify/src/vendor/amcl-js", - "link": true - }, "node_modules/amp": { "version": "0.3.1", "dev": true, @@ -20755,7 +20753,7 @@ "version": "0.20.2", "license": "Apache-2.0", "dependencies": { - "amcl-js": "file:src/vendor/amcl-js" + "@noble/curves": "file:../../noble-curves-1.2.0.tgz" }, "devDependencies": { "@types/jest": "^29.5.5", @@ -20783,7 +20781,6 @@ "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "packages/bls-verify/src/vendor/amcl-js": {}, "packages/candid": { "name": "@dfinity/candid", "version": "0.20.2", diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index c0a05c054..df0d45f85 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -39,16 +39,16 @@ "build": "tsc -b && tsc -p tsconfig-cjs.json", "bundle": "esbuild --bundle src/index.ts --outfile=dist/index.js --platform=node", "size-limit": "size-limit", + "test": "vitest", "ci": "npm run prettier && npm run lint && npm run test", "lint": "eslint 'src' --ext '.js,.jsx,.ts,.tsx'", "lint:fix": "npm run lint -- --fix", "make:docs/reference": "typedoc src/index.ts --out ../../docs/generated/bls-verify --excludeInternal", - "test": "jest", "prettier": "prettier --check \"src/**/*.ts\"", "prettier:write": "npm run prettier -- --write" }, "dependencies": { - "amcl-js": "file:src/vendor/amcl-js" + "@noble/curves": "file:../../noble-curves-1.2.0.tgz" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/bls-verify/src/index.test.ts b/packages/bls-verify/src/index.test.ts index fa835156f..a37d87446 100644 --- a/packages/bls-verify/src/index.test.ts +++ b/packages/bls-verify/src/index.test.ts @@ -3,6 +3,7 @@ import * as Cert from '../../agent/src/certificate'; import * as cbor from '../../agent/src/cbor'; import { fromHex } from '../../agent/src/utils/buffer'; import { Principal } from '@dfinity/principal'; +import { test, expect, vi } from 'vitest'; // Root public key for the IC main net, encoded as hex const IC_ROOT_KEY = @@ -16,9 +17,6 @@ const IC_ROOT_KEY = const SAMPLE_CERT = 'd9d9f7a364747265658301830182045820250f5e26868d9c1ea7ab29cbe9c15bf1c47c0d7605e803e39e375a7fe09c6ebb830183024e726571756573745f7374617475738301820458204b268227774ec77ff2b37ecb12157329d54cf376694bdd59ded7803efd82386f83025820edad510eaaa08ed2acd4781324e6446269da6753ec17760f206bbe81c465ff528301830183024b72656a6563745f636f64658203410383024e72656a6563745f6d6573736167658203584443616e69737465722069766733372d71696161612d61616161622d61616167612d63616920686173206e6f20757064617465206d6574686f64202772656769737465722783024673746174757382034872656a65637465648204582097232f31f6ab7ca4fe53eb6568fc3e02bc22fe94ab31d010e5fb3c642301f1608301820458203a48d1fc213d49307103104f7d72c2b5930edba8787b90631f343b3aa68a5f0a83024474696d65820349e2dc939091c696eb16697369676e6174757265583089a2be21b5fa8ac9fab1527e041327ce899d7da971436a1f2165393947b4d942365bfe5488710e61a619ba48388a21b16a64656c65676174696f6ea2697375626e65745f6964581dd77b2a2f7199b9a8aec93fe6fb588661358cf12223e9a3af7b4ebac4026b6365727469666963617465590231d9d9f7a26474726565830182045820ae023f28c3b9d966c8fb09f9ed755c828aadb5152e00aaf700b18c9c067294b483018302467375626e6574830182045820e83bb025f6574c8f31233dc0fe289ff546dfa1e49bd6116dd6e8896d90a4946e830182045820e782619092d69d5bebf0924138bd4116b0156b5a95e25c358ea8cf7e7161a661830183018204582062513fa926c9a9ef803ac284d620f303189588e1d3904349ab63b6470856fc4883018204582060e9a344ced2c9c4a96a0197fd585f2d259dbd193e4eada56239cac26087f9c58302581dd77b2a2f7199b9a8aec93fe6fb588661358cf12223e9a3af7b4ebac402830183024f63616e69737465725f72616e6765738203581bd9d9f781824a000000000020000001014a00000000002fffff010183024a7075626c69635f6b657982035885308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c050302010361009933e1f89e8a3c4d7fdcccdbd518089e2bd4d8180a261f18d9c247a52768ebce98dc7328a39814a8f911086a1dd50cbe015e2a53b7bf78b55288893daa15c346640e8831d72a12bdedd979d28470c34823b8d1c3f4795d9c3984a247132e94fe82045820996f17bb926be3315745dea7282005a793b58e76afeb5d43d1a28ce29d2d158583024474696d6582034995b8aac0e4eda2ea16697369676e61747572655830ace9fcdd9bc977e05d6328f889dc4e7c99114c737a494653cb27a1f55c06f4555e0f160980af5ead098acc195010b2f7'; -beforeEach(() => { - jest.setTimeout(10_000); -}); test('delegation works for canisters within the subnet range', async () => { // The certificate specifies the range from // 0x00000000002000000101 @@ -27,9 +25,9 @@ test('delegation works for canisters within the subnet range', async () => { const rangeStart = Principal.fromHex('00000000002000000101'); const rangeInterior = Principal.fromHex('000000000020000C0101'); const rangeEnd = Principal.fromHex('00000000002FFFFF0101'); - jest.useFakeTimers(); + vi.useFakeTimers(); async function verifies(canisterId) { - jest.setSystemTime(new Date(Date.parse('2022-02-23T07:38:00.652Z'))); + vi.setSystemTime(new Date(Date.parse('2022-02-23T07:38:00.652Z'))); await expect( Cert.Certificate.create({ certificate: fromHex(SAMPLE_CERT), diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index 189f8fcb6..c69a22777 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -9,5 +9,5 @@ export const blsVerify = async ( const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - return bls.verify(sig, msg, pk); + return bls.verifyShortSignature(sig, msg, pk); }; From 67e09f54890acd1929f566cf12934a7bbd05ac37 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 15:00:30 -0800 Subject: [PATCH 07/11] vitest --- packages/bls-verify/vitest.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/bls-verify/vitest.config.ts diff --git a/packages/bls-verify/vitest.config.ts b/packages/bls-verify/vitest.config.ts new file mode 100644 index 000000000..285af81da --- /dev/null +++ b/packages/bls-verify/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + setupFiles: ['./test-setup.ts'], + testTimeout: 100_000, + }, +}); From 4b7459674955c2d5f5e557497b18fb1a7ac967c7 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 8 Nov 2023 16:54:18 -0800 Subject: [PATCH 08/11] working build --- packages/agent/src/actor.ts | 17 +- packages/agent/src/canisterStatus/index.ts | 1 - packages/agent/src/certificate.ts | 10 +- packages/agent/src/index.ts | 1 - packages/agent/src/polling/index.ts | 2 - packages/agent/src/utils/bls.test.ts | 21 - packages/agent/src/utils/bls.ts | 28 - packages/bls-verify/README.md | 7 - packages/bls-verify/package.json | 1 - packages/bls-verify/src/index.test.ts | 1 - packages/bls-verify/src/index.ts | 6 +- .../bls-verify/src/verifyShortSignature.js | 3066 +++++++++++++++++ packages/bls-verify/tsconfig.json | 2 +- 13 files changed, 3076 insertions(+), 87 deletions(-) delete mode 100644 packages/agent/src/utils/bls.test.ts delete mode 100644 packages/agent/src/utils/bls.ts create mode 100644 packages/bls-verify/src/verifyShortSignature.js diff --git a/packages/agent/src/actor.ts b/packages/agent/src/actor.ts index 6d1947314..73df8d355 100644 --- a/packages/agent/src/actor.ts +++ b/packages/agent/src/actor.ts @@ -14,7 +14,6 @@ import { pollForResponse, PollStrategyFactory, strategy } from './polling'; import { Principal } from '@dfinity/principal'; import { RequestId } from './request_id'; import { toHex } from './utils/buffer'; -import { CreateCertificateOptions } from './certificate'; import managementCanisterIdl from './canisters/management_idl'; import _SERVICE from './canisters/management_service'; @@ -130,11 +129,6 @@ export interface ActorConfig extends CallConfig { args: unknown[], callConfig: CallConfig, ): Partial | void; - - /** - * Polyfill for BLS Certificate verification in case wasm is not supported - */ - blsVerify?: CreateCertificateOptions['blsVerify']; } // TODO: move this to proper typing when Candid support TypeScript. @@ -308,7 +302,7 @@ export class Actor { func.annotations.push(ACTOR_METHOD_WITH_HTTP_DETAILS); } - this[methodName] = _createActorMethod(this, methodName, func, config.blsVerify); + this[methodName] = _createActorMethod(this, methodName, func); } } } @@ -369,12 +363,7 @@ export type ActorConstructor = new (config: ActorConfig) => ActorSubclass; export const ACTOR_METHOD_WITH_HTTP_DETAILS = 'http-details'; -function _createActorMethod( - actor: Actor, - methodName: string, - func: IDL.FuncClass, - blsVerify?: CreateCertificateOptions['blsVerify'], -): ActorMethod { +function _createActorMethod(actor: Actor, methodName: string, func: IDL.FuncClass): ActorMethod { let caller: (options: CallConfig, ...args: unknown[]) => Promise; if (func.annotations.includes('query') || func.annotations.includes('composite_query')) { caller = async (options, ...args) => { @@ -437,7 +426,7 @@ function _createActorMethod( } const pollStrategy = pollingStrategyFactory(); - const responseBytes = await pollForResponse(agent, ecid, requestId, pollStrategy, blsVerify); + const responseBytes = await pollForResponse(agent, ecid, requestId, pollStrategy); const shouldIncludeHttpDetails = func.annotations.includes(ACTOR_METHOD_WITH_HTTP_DETAILS); if (responseBytes !== undefined) { diff --git a/packages/agent/src/canisterStatus/index.ts b/packages/agent/src/canisterStatus/index.ts index a680cd7d0..e7ab822b8 100644 --- a/packages/agent/src/canisterStatus/index.ts +++ b/packages/agent/src/canisterStatus/index.ts @@ -90,7 +90,6 @@ export type CanisterStatusOptions = { canisterId: Principal; agent: HttpAgent; paths?: Path[] | Set; - blsVerify?: CreateCertificateOptions['blsVerify']; }; /** diff --git a/packages/agent/src/certificate.ts b/packages/agent/src/certificate.ts index af156aa5f..d13346ba5 100644 --- a/packages/agent/src/certificate.ts +++ b/packages/agent/src/certificate.ts @@ -3,7 +3,7 @@ import { AgentError } from './errors'; import { hash } from './request_id'; import { concat, fromHex, toHex } from './utils/buffer'; import { Principal } from '@dfinity/principal'; -import * as bls from './utils/bls'; +import { blsVerify as blsVerifyImport } from '@dfinity/bls-verify'; import { decodeTime } from './utils/leb'; /** @@ -179,13 +179,12 @@ export class Certificate { private static createUnverified(options: CreateCertificateOptions): Certificate { let blsVerify = options.blsVerify; if (!blsVerify) { - blsVerify = bls.blsVerify; + blsVerify = blsVerifyImport; } return new Certificate( options.certificate, options.rootKey, options.canisterId, - blsVerify, options.maxAgeInMinutes, ); } @@ -194,8 +193,6 @@ export class Certificate { certificate: ArrayBuffer, private _rootKey: ArrayBuffer, private _canisterId: Principal, - private _blsVerify: VerifyFunc, - // Default to 5 minutes private _maxAgeInMinutes: number = 5, ) { this.cert = cbor.decode(new Uint8Array(certificate)); @@ -249,7 +246,7 @@ export class Certificate { } try { - sigVer = await this._blsVerify(new Uint8Array(key), new Uint8Array(sig), new Uint8Array(msg)); + sigVer = await blsVerify(new Uint8Array(key), new Uint8Array(sig), new Uint8Array(msg)); } catch (err) { sigVer = false; } @@ -267,7 +264,6 @@ export class Certificate { certificate: d.certificate, rootKey: this._rootKey, canisterId: this._canisterId, - blsVerify: this._blsVerify, // Do not check max age for delegation certificates maxAgeInMinutes: Infinity, }); diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index 5d195a5e1..500b2c4cc 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -11,7 +11,6 @@ export * from './der'; export * from './fetch_candid'; export * from './public_key'; export * from './request_id'; -export * from './utils/bls'; export * from './utils/buffer'; export * from './utils/random'; export * as polling from './polling'; diff --git a/packages/agent/src/polling/index.ts b/packages/agent/src/polling/index.ts index 09c1e445d..d8f18e452 100644 --- a/packages/agent/src/polling/index.ts +++ b/packages/agent/src/polling/index.ts @@ -29,7 +29,6 @@ export async function pollForResponse( strategy: PollStrategy, // eslint-disable-next-line request?: any, - blsVerify?: CreateCertificateOptions['blsVerify'], ): Promise { const path = [new TextEncoder().encode('request_status'), requestId]; const currentRequest = request ?? (await agent.createReadStateRequest?.({ paths: [path] })); @@ -39,7 +38,6 @@ export async function pollForResponse( certificate: state.certificate, rootKey: agent.rootKey, canisterId: canisterId, - blsVerify, }); const maybeBuf = cert.lookup([...path, new TextEncoder().encode('status')]); let status; diff --git a/packages/agent/src/utils/bls.test.ts b/packages/agent/src/utils/bls.test.ts deleted file mode 100644 index 65d6f6303..000000000 --- a/packages/agent/src/utils/bls.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { blsVerify } from './bls'; -import { fromHex } from './buffer'; - -test('verify', async () => { - const pk = new Uint8Array( - fromHex( - 'a7623a93cdb56c4d23d99c14216afaab3dfd6d4f9eb3db23d038280b6d5cb2caaee2a19dd92c9df7001d' + - 'ede23bf036bc0f33982dfb41e8fa9b8e96b5dc3e83d55ca4dd146c7eb2e8b6859cb5a5db815db86810b8' + - 'd12cee1588b5dbf34a4dc9a5', - ), - ); - const sig = new Uint8Array( - fromHex( - 'b89e13a212c830586eaa9ad53946cd968718ebecc27eda849d9232673dcd4f440e8b5df39bf14a88048c15e16cbcaabe', - ), - ); - - const msg = new Uint8Array(new TextEncoder().encode('hello')); - expect(await blsVerify(pk, sig, msg)).toBe(true); - expect(await blsVerify(pk, sig, new Uint8Array(new TextEncoder().encode('hallo')))).toBe(false); -}, 10000); // Default timer is flaky with WASM. diff --git a/packages/agent/src/utils/bls.ts b/packages/agent/src/utils/bls.ts deleted file mode 100644 index 1688e93ea..000000000 --- a/packages/agent/src/utils/bls.ts +++ /dev/null @@ -1,28 +0,0 @@ -import init, { bls_init, bls_verify } from '../vendor/bls/bls'; - -export let verify: (pk: Uint8Array, sig: Uint8Array, msg: Uint8Array) => boolean; - -/** - * - * @param pk primary key: Uint8Array - * @param sig signature: Uint8Array - * @param msg message: Uint8Array - * @returns Promise resolving a boolean - */ -export async function blsVerify( - pk: Uint8Array, - sig: Uint8Array, - msg: Uint8Array, -): Promise { - if (!verify) { - await init(); - if (bls_init() !== 0) { - throw new Error('Cannot initialize BLS'); - } - verify = (pk1, sig1, msg1) => { - // Reorder things from what the WASM expects (sig, m, w). - return bls_verify(sig1, msg1, pk1) === 0; - }; - } - return verify(pk, sig, msg); -} diff --git a/packages/bls-verify/README.md b/packages/bls-verify/README.md index 9d601693f..83c218816 100644 --- a/packages/bls-verify/README.md +++ b/packages/bls-verify/README.md @@ -20,11 +20,4 @@ npm i --save @dfinity/bls-verify ```ts import { blsVerify } from '@dfinity/bls-verify'; -import { createActor, canisterId } from '../declarations/example'; - -const exampleActor = createActor(canisterId, { - actorOptions: { - blsVerify, - }, -}); ``` diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index df0d45f85..c776eeb1a 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -13,7 +13,6 @@ "bugs": { "url": "https://github.com/dfinity/agent-js/issues" }, - "type": "module", "keywords": [ "internet computer", "ic", diff --git a/packages/bls-verify/src/index.test.ts b/packages/bls-verify/src/index.test.ts index a37d87446..fc658fd19 100644 --- a/packages/bls-verify/src/index.test.ts +++ b/packages/bls-verify/src/index.test.ts @@ -33,7 +33,6 @@ test('delegation works for canisters within the subnet range', async () => { certificate: fromHex(SAMPLE_CERT), rootKey: fromHex(IC_ROOT_KEY), canisterId: canisterId, - blsVerify, }), ).resolves.not.toThrow(); } diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index c69a22777..86c2ca04d 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -1,13 +1,13 @@ import { toHex } from './utils'; -import { bls12_381 as bls } from '@noble/curves/bls12-381'; - export const blsVerify = async ( primaryKey: Uint8Array | string, signature: Uint8Array | string, message: Uint8Array | string, ): Promise => { + const { verifyShortSignature } = (await import('./verifyShortSignature')).default() as any; + const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - return bls.verifyShortSignature(sig, msg, pk); + return verifyShortSignature(sig, msg, pk); }; diff --git a/packages/bls-verify/src/verifyShortSignature.js b/packages/bls-verify/src/verifyShortSignature.js new file mode 100644 index 000000000..575a3fc5d --- /dev/null +++ b/packages/bls-verify/src/verifyShortSignature.js @@ -0,0 +1,3066 @@ +/* eslint-disable */ +// Extracted from @noble/curves commit fb02e93ff66ecd7bc7257d8f76e6cdf88b54bfa9 +export default () => { + var __defProp = Object.defineProperty; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __esm = (fn, res) => + function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res; + }; + var __commonJS = (cb, mod2) => + function __require() { + return ( + mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), + mod2.exports + ); + }; + var __export = (target, all) => { + for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); + }; + + // node_modules/@noble/hashes/esm/_assert.js + function bytes(b, ...lengths) { + if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); + } + function exists(instance, checkFinished = true) { + if (instance.destroyed) throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); + } + function output(out, instance) { + bytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error(`digestInto() expects output buffer of length at least ${min}`); + } + } + var init_assert = __esm({ + 'node_modules/@noble/hashes/esm/_assert.js'() {}, + }); + + // node_modules/@noble/hashes/esm/crypto.js + var crypto; + var init_crypto = __esm({ + 'node_modules/@noble/hashes/esm/crypto.js'() { + crypto = + typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : void 0; + }, + }); + + // node_modules/@noble/hashes/esm/utils.js + function utf8ToBytes(str) { + if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); + } + function toBytes(data) { + if (typeof data === 'string') data = utf8ToBytes(data); + if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`); + return data; + } + function wrapConstructor(hashCons) { + const hashC = msg => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; + } + function randomBytes(bytesLength = 32) { + if (crypto && typeof crypto.getRandomValues === 'function') { + return crypto.getRandomValues(new Uint8Array(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); + } + var u8a, createView, rotr, isLE, Hash, toStr; + var init_utils = __esm({ + 'node_modules/@noble/hashes/esm/utils.js'() { + init_crypto(); + u8a = a => a instanceof Uint8Array; + createView = arr => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); + rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); + isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; + if (!isLE) throw new Error('Non little-endian hardware is not supported'); + Hash = class { + // Safe version that clones internal state + clone() { + return this._cloneInto(); + } + }; + toStr = {}.toString; + }, + }); + + // node_modules/@noble/hashes/esm/_sha2.js + function setBigUint64(view, byteOffset, value, isLE2) { + if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE2); + const _32n = BigInt(32); + const _u32_max = BigInt(4294967295); + const wh = Number((value >> _32n) & _u32_max); + const wl = Number(value & _u32_max); + const h = isLE2 ? 4 : 0; + const l = isLE2 ? 0 : 4; + view.setUint32(byteOffset + h, wh, isLE2); + view.setUint32(byteOffset + l, wl, isLE2); + } + var SHA2; + var init_sha2 = __esm({ + 'node_modules/@noble/hashes/esm/_sha2.js'() { + init_assert(); + init_utils(); + SHA2 = class extends Hash { + constructor(blockLen, outputLen, padOffset, isLE2) { + super(); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE2; + this.finished = false; + this.length = 0; + this.pos = 0; + this.destroyed = false; + this.buffer = new Uint8Array(blockLen); + this.view = createView(this.buffer); + } + update(data) { + exists(this); + const { view, buffer, blockLen } = this; + data = toBytes(data); + const len = data.length; + for (let pos = 0; pos < len; ) { + const take = Math.min(blockLen - this.pos, len - pos); + if (take === blockLen) { + const dataView = createView(data); + for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos); + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + exists(this); + output(out, this); + this.finished = true; + const { buffer, view, blockLen, isLE: isLE2 } = this; + let { pos } = this; + buffer[pos++] = 128; + this.buffer.subarray(pos).fill(0); + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + for (let i = pos; i < blockLen; i++) buffer[i] = 0; + setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); + this.process(view, 0); + const oview = createView(out); + const len = this.outputLen; + if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit'); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state'); + for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE2); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to || (to = new this.constructor()); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.length = length; + to.pos = pos; + to.finished = finished; + to.destroyed = destroyed; + if (length % blockLen) to.buffer.set(buffer); + return to; + } + }; + }, + }); + + // node_modules/@noble/hashes/esm/sha256.js + var Chi, Maj, SHA256_K, IV, SHA256_W, SHA256, sha256; + var init_sha256 = __esm({ + 'node_modules/@noble/hashes/esm/sha256.js'() { + init_sha2(); + init_utils(); + Chi = (a, b, c) => (a & b) ^ (~a & c); + Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); + SHA256_K = /* @__PURE__ */ new Uint32Array([ + 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, + 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, + 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, + 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, + 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, + 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, + 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, + 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, + 2361852424, 2428436474, 2756734187, 3204031479, 3329325298, + ]); + IV = /* @__PURE__ */ new Uint32Array([ + 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, + 1541459225, + ]); + SHA256_W = /* @__PURE__ */ new Uint32Array(64); + SHA256 = class extends SHA2 { + constructor() { + super(64, 32, 8, false); + this.A = IV[0] | 0; + this.B = IV[1] | 0; + this.C = IV[2] | 0; + this.D = IV[3] | 0; + this.E = IV[4] | 0; + this.F = IV[5] | 0; + this.G = IV[6] | 0; + this.H = IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); + const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); + const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); + const T2 = (sigma0 + Maj(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + SHA256_W.fill(0); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + this.buffer.fill(0); + } + }; + sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); + }, + }); + + // node_modules/@noble/curves/esm/abstract/utils.js + var utils_exports = {}; + __export(utils_exports, { + bitGet: () => bitGet, + bitLen: () => bitLen, + bitMask: () => bitMask, + bitSet: () => bitSet, + bytesToHex: () => bytesToHex, + bytesToNumberBE: () => bytesToNumberBE, + bytesToNumberLE: () => bytesToNumberLE, + concatBytes: () => concatBytes, + createHmacDrbg: () => createHmacDrbg, + ensureBytes: () => ensureBytes, + equalBytes: () => equalBytes, + hexToBytes: () => hexToBytes, + hexToNumber: () => hexToNumber, + numberToBytesBE: () => numberToBytesBE, + numberToBytesLE: () => numberToBytesLE, + numberToHexUnpadded: () => numberToHexUnpadded, + numberToVarBytesBE: () => numberToVarBytesBE, + utf8ToBytes: () => utf8ToBytes2, + validateObject: () => validateObject, + }); + function bytesToHex(bytes2) { + if (!u8a2(bytes2)) throw new Error('Uint8Array expected'); + let hex = ''; + for (let i = 0; i < bytes2.length; i++) { + hex += hexes[bytes2[i]]; + } + return hex; + } + function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? `0${hex}` : hex; + } + function hexToNumber(hex) { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + return BigInt(hex === '' ? '0' : `0x${hex}`); + } + function asciiToBase16(char) { + if (char >= asciis._0 && char <= asciis._9) return char - asciis._0; + if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10); + if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10); + return; + } + function hexToBytes(hex) { + if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); + const hl = hex.length; + const al = hl / 2; + if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl); + const array = new Uint8Array(al); + for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { + const n1 = asciiToBase16(hex.charCodeAt(hi)); + const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); + if (n1 === void 0 || n2 === void 0) { + const char = hex[hi] + hex[hi + 1]; + throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); + } + array[ai] = n1 * 16 + n2; + } + return array; + } + function bytesToNumberBE(bytes2) { + return hexToNumber(bytesToHex(bytes2)); + } + function bytesToNumberLE(bytes2) { + if (!u8a2(bytes2)) throw new Error('Uint8Array expected'); + return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse())); + } + function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); + } + function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); + } + function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); + } + function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } catch (e) { + throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); + } + } else if (u8a2(hex)) { + res = Uint8Array.from(hex); + } else { + throw new Error(`${title} must be hex string or Uint8Array`); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); + return res; + } + function concatBytes(...arrays) { + const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); + let pad = 0; + arrays.forEach(a => { + if (!u8a2(a)) throw new Error('Uint8Array expected'); + r.set(a, pad); + pad += a.length; + }); + return r; + } + function equalBytes(b1, b2) { + if (b1.length !== b2.length) return false; + for (let i = 0; i < b1.length; i++) if (b1[i] !== b2[i]) return false; + return true; + } + function utf8ToBytes2(str) { + if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); + return new Uint8Array(new TextEncoder().encode(str)); + } + function bitLen(n) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1); + return len; + } + function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n; + } + function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') throw new Error('hmacFn must be a function'); + let v = u8n(hashLen); + let k = u8n(hashLen); + let i = 0; + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); + const reseed = (seed = u8n()) => { + k = h(u8fr([0]), seed); + v = h(); + if (seed.length === 0) return; + k = h(u8fr([1]), seed); + v = h(); + }; + const gen = () => { + if (i++ >= 1e3) throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); + let res = void 0; + while (!(res = pred(gen()))) reseed(); + reset(); + return res; + }; + return genUntil; + } + function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error(`Invalid validator "${type}", expected function`); + const val = object[fieldName]; + if (isOptional && val === void 0) return; + if (!checkVal(val, object)) { + throw new Error( + `Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`, + ); + } + }; + for (const [fieldName, type] of Object.entries(validators)) checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; + } + var _0n, _1n, _2n, u8a2, hexes, asciis, bitSet, bitMask, u8n, u8fr, validatorFns; + var init_utils2 = __esm({ + 'node_modules/@noble/curves/esm/abstract/utils.js'() { + _0n = BigInt(0); + _1n = BigInt(1); + _2n = BigInt(2); + u8a2 = a => a instanceof Uint8Array; + hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => + i.toString(16).padStart(2, '0'), + ); + asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; + bitSet = (n, pos, value) => { + return n | ((value ? _1n : _0n) << BigInt(pos)); + }; + bitMask = n => (_2n << BigInt(n - 1)) - _1n; + u8n = data => new Uint8Array(data); + u8fr = arr => Uint8Array.from(arr); + validatorFns = { + bigint: val => typeof val === 'bigint', + function: val => typeof val === 'function', + boolean: val => typeof val === 'boolean', + string: val => typeof val === 'string', + stringOrUint8Array: val => typeof val === 'string' || val instanceof Uint8Array, + isSafeInteger: val => Number.isSafeInteger(val), + array: val => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: val => typeof val === 'function' && Number.isSafeInteger(val.outputLen), + }; + }, + }); + + // node_modules/@noble/curves/esm/abstract/modular.js + function mod(a, b) { + const result = a % b; + return result >= _0n2 ? result : b + result; + } + function pow(num, power, modulo) { + if (modulo <= _0n2 || power < _0n2) throw new Error('Expected power/modulo > 0'); + if (modulo === _1n2) return _0n2; + let res = _1n2; + while (power > _0n2) { + if (power & _1n2) res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n2; + } + return res; + } + function invert(number, modulo) { + if (number === _0n2 || modulo <= _0n2) { + throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); + } + let a = mod(number, modulo); + let b = modulo; + let x = _0n2, + y = _1n2, + u = _1n2, + v = _0n2; + while (a !== _0n2) { + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + (b = a), (a = r), (x = u), (y = v), (u = m), (v = n); + } + const gcd = b; + if (gcd !== _1n2) throw new Error('invert: does not exist'); + return mod(x, modulo); + } + function tonelliShanks(P) { + const legendreC = (P - _1n2) / _2n2; + let Q, S, Z; + for (Q = P - _1n2, S = 0; Q % _2n2 === _0n2; Q /= _2n2, S++); + for (Z = _2n2; Z < P && pow(Z, legendreC, P) !== P - _1n2; Z++); + if (S === 1) { + const p1div4 = (P + _1n2) / _4n; + return function tonelliFast(Fp3, n) { + const root = Fp3.pow(n, p1div4); + if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + const Q1div2 = (Q + _1n2) / _2n2; + return function tonelliSlow(Fp3, n) { + if (Fp3.pow(n, legendreC) === Fp3.neg(Fp3.ONE)) throw new Error('Cannot find square root'); + let r = S; + let g = Fp3.pow(Fp3.mul(Fp3.ONE, Z), Q); + let x = Fp3.pow(n, Q1div2); + let b = Fp3.pow(n, Q); + while (!Fp3.eql(b, Fp3.ONE)) { + if (Fp3.eql(b, Fp3.ZERO)) return Fp3.ZERO; + let m = 1; + for (let t2 = Fp3.sqr(b); m < r; m++) { + if (Fp3.eql(t2, Fp3.ONE)) break; + t2 = Fp3.sqr(t2); + } + const ge = Fp3.pow(g, _1n2 << BigInt(r - m - 1)); + g = Fp3.sqr(ge); + x = Fp3.mul(x, ge); + b = Fp3.mul(b, g); + r = m; + } + return x; + }; + } + function FpSqrt(P) { + if (P % _4n === _3n) { + const p1div4 = (P + _1n2) / _4n; + return function sqrt3mod4(Fp3, n) { + const root = Fp3.pow(n, p1div4); + if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + if (P % _8n === _5n) { + const c1 = (P - _5n) / _8n; + return function sqrt5mod8(Fp3, n) { + const n2 = Fp3.mul(n, _2n2); + const v = Fp3.pow(n2, c1); + const nv = Fp3.mul(n, v); + const i = Fp3.mul(Fp3.mul(nv, _2n2), v); + const root = Fp3.mul(nv, Fp3.sub(i, Fp3.ONE)); + if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); + return root; + }; + } + if (P % _16n === _9n) { + } + return tonelliShanks(P); + } + function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return validateObject(field, opts); + } + function FpPow(f, num, power) { + if (power < _0n2) throw new Error('Expected power > 0'); + if (power === _0n2) return f.ONE; + if (power === _1n2) return num; + let p = f.ONE; + let d = num; + while (power > _0n2) { + if (power & _1n2) p = f.mul(p, d); + d = f.sqr(d); + power >>= _1n2; + } + return p; + } + function FpInvertBatch(f, nums) { + const tmp = new Array(nums.length); + const lastMultiplied = nums.reduce((acc, num, i) => { + if (f.is0(num)) return acc; + tmp[i] = acc; + return f.mul(acc, num); + }, f.ONE); + const inverted = f.inv(lastMultiplied); + nums.reduceRight((acc, num, i) => { + if (f.is0(num)) return acc; + tmp[i] = f.mul(acc, tmp[i]); + return f.mul(acc, num); + }, inverted); + return tmp; + } + function nLength(n, nBitLength) { + const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; + } + function Field(ORDER, bitLen2, isLE2 = false, redef = {}) { + if (ORDER <= _0n2) throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2); + if (BYTES > 2048) throw new Error('Field lengths over 2048 bytes are not supported'); + const sqrtP = FpSqrt(ORDER); + const f = Object.freeze({ + ORDER, + BITS, + BYTES, + MASK: bitMask(BITS), + ZERO: _0n2, + ONE: _1n2, + create: num => mod(num, ORDER), + isValid: num => { + if (typeof num !== 'bigint') + throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); + return _0n2 <= num && num < ORDER; + }, + is0: num => num === _0n2, + isOdd: num => (num & _1n2) === _1n2, + neg: num => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: num => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: num => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: num => invert(num, ORDER), + sqrt: redef.sqrt || (n => sqrtP(f, n)), + invertBatch: lst => FpInvertBatch(f, lst), + // TODO: do we really need constant cmov? + // We don't have const-time bigints anyway, so probably will be not very useful + cmov: (a, b, c) => (c ? b : a), + toBytes: num => (isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), + fromBytes: bytes2 => { + if (bytes2.length !== BYTES) + throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`); + return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2); + }, + }); + return Object.freeze(f); + } + function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); + } + function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); + } + function mapHashToField(key, fieldOrder, isLE2 = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + if (len < 16 || len < minLen || len > 1024) + throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); + const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key); + const reduced = mod(num, fieldOrder - _1n2) + _1n2; + return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); + } + var _0n2, _1n2, _2n2, _3n, _4n, _5n, _8n, _9n, _16n, FIELD_FIELDS; + var init_modular = __esm({ + 'node_modules/@noble/curves/esm/abstract/modular.js'() { + init_utils2(); + _0n2 = BigInt(0); + _1n2 = BigInt(1); + _2n2 = BigInt(2); + _3n = BigInt(3); + _4n = BigInt(4); + _5n = BigInt(5); + _8n = BigInt(8); + _9n = BigInt(9); + _16n = BigInt(16); + FIELD_FIELDS = [ + 'create', + 'isValid', + 'is0', + 'neg', + 'inv', + 'sqrt', + 'sqr', + 'eql', + 'add', + 'sub', + 'mul', + 'pow', + 'div', + 'addN', + 'subN', + 'mulN', + 'sqrN', + ]; + }, + }); + + // node_modules/@noble/curves/esm/abstract/hash-to-curve.js + function validateDST(dst) { + if (dst instanceof Uint8Array) return dst; + if (typeof dst === 'string') return utf8ToBytes2(dst); + throw new Error('DST must be Uint8Array or string'); + } + function i2osp(value, length) { + if (value < 0 || value >= 1 << (8 * length)) { + throw new Error(`bad I2OSP call: value=${value} length=${length}`); + } + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 255; + value >>>= 8; + } + return new Uint8Array(res); + } + function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; + } + function isBytes(item) { + if (!(item instanceof Uint8Array)) throw new Error('Uint8Array expected'); + } + function isNum(item) { + if (!Number.isSafeInteger(item)) throw new Error('number expected'); + } + function expand_message_xmd(msg, DST, lenInBytes, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + if (DST.length > 255) DST = H(concatBytes(utf8ToBytes2('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (ell > 255) throw new Error('Invalid xmd length'); + const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); + const b = new Array(ell); + const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H(concatBytes(...args)); + } + const pseudo_random_bytes = concatBytes(...b); + return pseudo_random_bytes.slice(0, lenInBytes); + } + function expand_message_xof(msg, DST, lenInBytes, k, H) { + isBytes(msg); + isBytes(DST); + isNum(lenInBytes); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update(utf8ToBytes2('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest(); + } + function hash_to_field(msg, count, options) { + validateObject(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + isBytes(msg); + isNum(count); + const DST = validateDST(_DST); + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); + const len_in_bytes = count * m * L; + let prb; + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } else if (expand === '_internal_pass') { + prb = msg; + } else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = mod(os2ip(tv), p); + } + u[i] = e; + } + return u; + } + function isogenyMap(field, map) { + const COEFF = map.map(i => Array.from(i).reverse()); + return (x, y) => { + const [xNum, xDen, yNum, yDen] = COEFF.map(val => + val.reduce((acc, i) => field.add(field.mul(acc, x), i)), + ); + x = field.div(xNum, xDen); + y = field.mul(y, field.div(yNum, yDen)); + return { x, y }; + }; + } + function createHasher(Point, mapToCurve, def) { + if (typeof mapToCurve !== 'function') throw new Error('mapToCurve() must be defined'); + return { + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); + const u0 = Point.fromAffine(mapToCurve(u[0])); + const u1 = Point.fromAffine(mapToCurve(u[1])); + const P = u0.add(u1).clearCofactor(); + P.assertValidity(); + return P; + }, + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); + const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); + P.assertValidity(); + return P; + }, + }; + } + var os2ip; + var init_hash_to_curve = __esm({ + 'node_modules/@noble/curves/esm/abstract/hash-to-curve.js'() { + init_modular(); + init_utils2(); + os2ip = bytesToNumberBE; + }, + }); + + // node_modules/@noble/curves/esm/abstract/curve.js + function wNAF(c, bits) { + const constTimeNegate = (condition, item) => { + const neg = item.negate(); + return condition ? neg : item; + }; + const opts = W => { + const windows = Math.ceil(bits / W) + 1; + const windowSize = 2 ** (W - 1); + return { windows, windowSize }; + }; + return { + constTimeNegate, + // non-const time multiplication ladder + unsafeLadder(elm, n) { + let p = c.ZERO; + let d = elm; + while (n > _0n3) { + if (n & _1n3) p = p.add(d); + d = d.double(); + n >>= _1n3; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = opts(W); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + const { windows, windowSize } = opts(W); + let p = c.ZERO; + let f = c.BASE; + const mask = BigInt(2 ** W - 1); + const maxNumber = 2 ** W; + const shiftBy = BigInt(W); + for (let window = 0; window < windows; window++) { + const offset = window * windowSize; + let wbits = Number(n & mask); + n >>= shiftBy; + if (wbits > windowSize) { + wbits -= maxNumber; + n += _1n3; + } + const offset1 = offset; + const offset2 = offset + Math.abs(wbits) - 1; + const cond1 = window % 2 !== 0; + const cond2 = wbits < 0; + if (wbits === 0) { + f = f.add(constTimeNegate(cond1, precomputes[offset1])); + } else { + p = p.add(constTimeNegate(cond2, precomputes[offset2])); + } + } + return { p, f }; + }, + wNAFCached(P, precomputesMap, n, transform) { + const W = P._WINDOW_SIZE || 1; + let comp = precomputesMap.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) { + precomputesMap.set(P, transform(comp)); + } + } + return this.wNAF(W, comp, n); + }, + }; + } + function validateBasic(curve) { + validateField(curve.Fp); + validateObject( + curve, + { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, + { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }, + ); + return Object.freeze({ + ...nLength(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); + } + var _0n3, _1n3; + var init_curve = __esm({ + 'node_modules/@noble/curves/esm/abstract/curve.js'() { + init_modular(); + init_utils2(); + _0n3 = BigInt(0); + _1n3 = BigInt(1); + }, + }); + + // node_modules/@noble/curves/esm/abstract/weierstrass.js + function validatePointOpts(curve) { + const opts = validateBasic(curve); + validateObject( + opts, + { + a: 'field', + b: 'field', + }, + { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }, + ); + const { endo, Fp: Fp3, a } = opts; + if (endo) { + if (!Fp3.eql(a, Fp3.ZERO)) { + throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); + } + if ( + typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function' + ) { + throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); + } + function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp: Fp3 } = CURVE; + const toBytes2 = + CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return concatBytes(Uint8Array.from([4]), Fp3.toBytes(a.x), Fp3.toBytes(a.y)); + }); + const fromBytes = + CURVE.fromBytes || + (bytes2 => { + const tail = bytes2.subarray(1); + const x = Fp3.fromBytes(tail.subarray(0, Fp3.BYTES)); + const y = Fp3.fromBytes(tail.subarray(Fp3.BYTES, 2 * Fp3.BYTES)); + return { x, y }; + }); + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp3.sqr(x); + const x3 = Fp3.mul(x2, x); + return Fp3.add(Fp3.add(x3, Fp3.mul(x, a)), b); + } + if (!Fp3.eql(Fp3.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + function isWithinCurveOrder(num) { + return typeof num === 'bigint' && _0n4 < num && num < CURVE.n; + } + function assertGE(num) { + if (!isWithinCurveOrder(num)) throw new Error('Expected valid bigint: 0 < bigint < curve.n'); + } + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; + if (lengths && typeof key !== 'bigint') { + if (key instanceof Uint8Array) key = bytesToHex(key); + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('Invalid key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : bytesToNumberBE(ensureBytes('private key', key, nByteLength)); + } catch (error) { + throw new Error( + `private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`, + ); + } + if (wrapPrivateKey) num = mod(num, n); + assertGE(num); + return num; + } + const pointPrecomputes = /* @__PURE__ */ new Map(); + function assertPrjPoint(other) { + if (!(other instanceof Point)) throw new Error('ProjectivePoint expected'); + } + class Point { + constructor(px, py, pz) { + this.px = px; + this.py = py; + this.pz = pz; + if (px == null || !Fp3.isValid(px)) throw new Error('x required'); + if (py == null || !Fp3.isValid(py)) throw new Error('y required'); + if (pz == null || !Fp3.isValid(pz)) throw new Error('z required'); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp3.isValid(x) || !Fp3.isValid(y)) throw new Error('invalid affine point'); + if (p instanceof Point) throw new Error('projective point not allowed'); + const is0 = i => Fp3.eql(i, Fp3.ZERO); + if (is0(x) && is0(y)) return Point.ZERO; + return new Point(x, y, Fp3.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = Fp3.invertBatch(points.map(p => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + this._WINDOW_SIZE = windowSize; + pointPrecomputes.delete(this); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + if (this.is0()) { + if (CURVE.allowInfinityPoint && !Fp3.is0(this.py)) return; + throw new Error('bad point: ZERO'); + } + const { x, y } = this.toAffine(); + if (!Fp3.isValid(x) || !Fp3.isValid(y)) throw new Error('bad point: x or y not FE'); + const left = Fp3.sqr(y); + const right = weierstrassEquation(x); + if (!Fp3.eql(left, right)) throw new Error('bad point: equation left != right'); + if (!this.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp3.isOdd) return !Fp3.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp3.eql(Fp3.mul(X1, Z2), Fp3.mul(X2, Z1)); + const U2 = Fp3.eql(Fp3.mul(Y1, Z2), Fp3.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp3.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp3.mul(b, _3n2); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp3.ZERO, + Y3 = Fp3.ZERO, + Z3 = Fp3.ZERO; + let t0 = Fp3.mul(X1, X1); + let t1 = Fp3.mul(Y1, Y1); + let t2 = Fp3.mul(Z1, Z1); + let t3 = Fp3.mul(X1, Y1); + t3 = Fp3.add(t3, t3); + Z3 = Fp3.mul(X1, Z1); + Z3 = Fp3.add(Z3, Z3); + X3 = Fp3.mul(a, Z3); + Y3 = Fp3.mul(b3, t2); + Y3 = Fp3.add(X3, Y3); + X3 = Fp3.sub(t1, Y3); + Y3 = Fp3.add(t1, Y3); + Y3 = Fp3.mul(X3, Y3); + X3 = Fp3.mul(t3, X3); + Z3 = Fp3.mul(b3, Z3); + t2 = Fp3.mul(a, t2); + t3 = Fp3.sub(t0, t2); + t3 = Fp3.mul(a, t3); + t3 = Fp3.add(t3, Z3); + Z3 = Fp3.add(t0, t0); + t0 = Fp3.add(Z3, t0); + t0 = Fp3.add(t0, t2); + t0 = Fp3.mul(t0, t3); + Y3 = Fp3.add(Y3, t0); + t2 = Fp3.mul(Y1, Z1); + t2 = Fp3.add(t2, t2); + t0 = Fp3.mul(t2, t3); + X3 = Fp3.sub(X3, t0); + Z3 = Fp3.mul(t2, t1); + Z3 = Fp3.add(Z3, Z3); + Z3 = Fp3.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + assertPrjPoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp3.ZERO, + Y3 = Fp3.ZERO, + Z3 = Fp3.ZERO; + const a = CURVE.a; + const b3 = Fp3.mul(CURVE.b, _3n2); + let t0 = Fp3.mul(X1, X2); + let t1 = Fp3.mul(Y1, Y2); + let t2 = Fp3.mul(Z1, Z2); + let t3 = Fp3.add(X1, Y1); + let t4 = Fp3.add(X2, Y2); + t3 = Fp3.mul(t3, t4); + t4 = Fp3.add(t0, t1); + t3 = Fp3.sub(t3, t4); + t4 = Fp3.add(X1, Z1); + let t5 = Fp3.add(X2, Z2); + t4 = Fp3.mul(t4, t5); + t5 = Fp3.add(t0, t2); + t4 = Fp3.sub(t4, t5); + t5 = Fp3.add(Y1, Z1); + X3 = Fp3.add(Y2, Z2); + t5 = Fp3.mul(t5, X3); + X3 = Fp3.add(t1, t2); + t5 = Fp3.sub(t5, X3); + Z3 = Fp3.mul(a, t4); + X3 = Fp3.mul(b3, t2); + Z3 = Fp3.add(X3, Z3); + X3 = Fp3.sub(t1, Z3); + Z3 = Fp3.add(t1, Z3); + Y3 = Fp3.mul(X3, Z3); + t1 = Fp3.add(t0, t0); + t1 = Fp3.add(t1, t0); + t2 = Fp3.mul(a, t2); + t4 = Fp3.mul(b3, t4); + t1 = Fp3.add(t1, t2); + t2 = Fp3.sub(t0, t2); + t2 = Fp3.mul(a, t2); + t4 = Fp3.add(t4, t2); + t0 = Fp3.mul(t1, t4); + Y3 = Fp3.add(Y3, t0); + t0 = Fp3.mul(t5, t4); + X3 = Fp3.mul(t3, X3); + X3 = Fp3.sub(X3, t0); + t0 = Fp3.mul(t3, t1); + Z3 = Fp3.mul(t5, Z3); + Z3 = Fp3.add(Z3, t0); + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, pointPrecomputes, n, comp => { + const toInv = Fp3.invertBatch(comp.map(p => p.pz)); + return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + }); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(n) { + const I = Point.ZERO; + if (n === _0n4) return I; + assertGE(n); + if (n === _1n4) return this; + const { endo } = CURVE; + if (!endo) return wnaf.unsafeLadder(this, n); + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n4 || k2 > _0n4) { + if (k1 & _1n4) k1p = k1p.add(d); + if (k2 & _1n4) k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n4; + k2 >>= _1n4; + } + if (k1neg) k1p = k1p.negate(); + if (k2neg) k2p = k2p.negate(); + k2p = new Point(Fp3.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + assertGE(scalar); + let n = scalar; + let point, fake; + const { endo } = CURVE; + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp3.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } else { + const { p, f } = this.wNAF(n); + point = p; + fake = f; + } + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; + const mul = (P, a2) => + a2 === _0n4 || a2 === _1n4 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? void 0 : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + const { px: x, py: y, pz: z } = this; + const is0 = this.is0(); + if (iz == null) iz = is0 ? Fp3.ONE : Fp3.inv(z); + const ax = Fp3.mul(x, iz); + const ay = Fp3.mul(y, iz); + const zz = Fp3.mul(z, iz); + if (is0) return { x: Fp3.ZERO, y: Fp3.ZERO }; + if (!Fp3.eql(zz, Fp3.ONE)) throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n4) return true; + if (isTorsionFree) return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n4) return this; + if (clearCofactor) return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + this.assertValidity(); + return toBytes2(Point, this, isCompressed); + } + toHex(isCompressed = true) { + return bytesToHex(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp3.ONE); + Point.ZERO = new Point(Fp3.ZERO, Fp3.ONE, Fp3.ZERO); + const _bits = CURVE.nBitLength; + const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; + } + function SWUFpSqrtRatio(Fp3, Z) { + const q = Fp3.ORDER; + let l = _0n4; + for (let o = q - _1n4; o % _2n3 === _0n4; o /= _2n3) l += _1n4; + const c1 = l; + const _2n_pow_c1_1 = _2n3 << (c1 - _1n4 - _1n4); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n3; + const c2 = (q - _1n4) / _2n_pow_c1; + const c3 = (c2 - _1n4) / _2n3; + const c4 = _2n_pow_c1 - _1n4; + const c5 = _2n_pow_c1_1; + const c6 = Fp3.pow(Z, c2); + const c7 = Fp3.pow(Z, (c2 + _1n4) / _2n3); + let sqrtRatio = (u, v) => { + let tv1 = c6; + let tv2 = Fp3.pow(v, c4); + let tv3 = Fp3.sqr(tv2); + tv3 = Fp3.mul(tv3, v); + let tv5 = Fp3.mul(u, tv3); + tv5 = Fp3.pow(tv5, c3); + tv5 = Fp3.mul(tv5, tv2); + tv2 = Fp3.mul(tv5, v); + tv3 = Fp3.mul(tv5, u); + let tv4 = Fp3.mul(tv3, tv2); + tv5 = Fp3.pow(tv4, c5); + let isQR = Fp3.eql(tv5, Fp3.ONE); + tv2 = Fp3.mul(tv3, c7); + tv5 = Fp3.mul(tv4, tv1); + tv3 = Fp3.cmov(tv2, tv3, isQR); + tv4 = Fp3.cmov(tv5, tv4, isQR); + for (let i = c1; i > _1n4; i--) { + let tv52 = i - _2n3; + tv52 = _2n3 << (tv52 - _1n4); + let tvv5 = Fp3.pow(tv4, tv52); + const e1 = Fp3.eql(tvv5, Fp3.ONE); + tv2 = Fp3.mul(tv3, tv1); + tv1 = Fp3.mul(tv1, tv1); + tvv5 = Fp3.mul(tv4, tv1); + tv3 = Fp3.cmov(tv2, tv3, e1); + tv4 = Fp3.cmov(tvv5, tv4, e1); + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp3.ORDER % _4n2 === _3n2) { + const c12 = (Fp3.ORDER - _3n2) / _4n2; + const c22 = Fp3.sqrt(Fp3.neg(Z)); + sqrtRatio = (u, v) => { + let tv1 = Fp3.sqr(v); + const tv2 = Fp3.mul(u, v); + tv1 = Fp3.mul(tv1, tv2); + let y1 = Fp3.pow(tv1, c12); + y1 = Fp3.mul(y1, tv2); + const y2 = Fp3.mul(y1, c22); + const tv3 = Fp3.mul(Fp3.sqr(y1), v); + const isQR = Fp3.eql(tv3, u); + let y = Fp3.cmov(y2, y1, isQR); + return { isValid: isQR, value: y }; + }; + } + return sqrtRatio; + } + function mapToCurveSimpleSWU(Fp3, opts) { + validateField(Fp3); + if (!Fp3.isValid(opts.A) || !Fp3.isValid(opts.B) || !Fp3.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp3, opts.Z); + if (!Fp3.isOdd) throw new Error('Fp.isOdd is not implemented!'); + return u => { + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp3.sqr(u); + tv1 = Fp3.mul(tv1, opts.Z); + tv2 = Fp3.sqr(tv1); + tv2 = Fp3.add(tv2, tv1); + tv3 = Fp3.add(tv2, Fp3.ONE); + tv3 = Fp3.mul(tv3, opts.B); + tv4 = Fp3.cmov(opts.Z, Fp3.neg(tv2), !Fp3.eql(tv2, Fp3.ZERO)); + tv4 = Fp3.mul(tv4, opts.A); + tv2 = Fp3.sqr(tv3); + tv6 = Fp3.sqr(tv4); + tv5 = Fp3.mul(tv6, opts.A); + tv2 = Fp3.add(tv2, tv5); + tv2 = Fp3.mul(tv2, tv3); + tv6 = Fp3.mul(tv6, tv4); + tv5 = Fp3.mul(tv6, opts.B); + tv2 = Fp3.add(tv2, tv5); + x = Fp3.mul(tv1, tv3); + const { isValid, value } = sqrtRatio(tv2, tv6); + y = Fp3.mul(tv1, u); + y = Fp3.mul(y, value); + x = Fp3.cmov(x, tv3, isValid); + y = Fp3.cmov(y, value, isValid); + const e1 = Fp3.isOdd(u) === Fp3.isOdd(y); + y = Fp3.cmov(Fp3.neg(y), y, e1); + x = Fp3.div(x, tv4); + return { x, y }; + }; + } + var b2n, h2b, _0n4, _1n4, _2n3, _3n2, _4n2; + var init_weierstrass = __esm({ + 'node_modules/@noble/curves/esm/abstract/weierstrass.js'() { + init_modular(); + init_utils2(); + init_utils2(); + init_curve(); + ({ bytesToNumberBE: b2n, hexToBytes: h2b } = utils_exports); + _0n4 = BigInt(0); + _1n4 = BigInt(1); + _2n3 = BigInt(2); + _3n2 = BigInt(3); + _4n2 = BigInt(4); + }, + }); + + // node_modules/@noble/curves/esm/abstract/bls.js + function bls(CURVE) { + const { Fp: Fp3, Fr: Fr2, Fp2: Fp22, Fp6: Fp62, Fp12: Fp122 } = CURVE.fields; + const BLS_X_LEN2 = bitLen(CURVE.params.x); + function calcPairingPrecomputes(p) { + const { x, y } = p; + const Qx = x, + Qy = y, + Qz = Fp22.ONE; + let Rx = Qx, + Ry = Qy, + Rz = Qz; + let ell_coeff = []; + for (let i = BLS_X_LEN2 - 2; i >= 0; i--) { + let t0 = Fp22.sqr(Ry); + let t1 = Fp22.sqr(Rz); + let t2 = Fp22.multiplyByB(Fp22.mul(t1, _3n3)); + let t3 = Fp22.mul(t2, _3n3); + let t4 = Fp22.sub(Fp22.sub(Fp22.sqr(Fp22.add(Ry, Rz)), t1), t0); + ell_coeff.push([ + Fp22.sub(t2, t0), + Fp22.mul(Fp22.sqr(Rx), _3n3), + Fp22.neg(t4), + // -T4 + ]); + Rx = Fp22.div(Fp22.mul(Fp22.mul(Fp22.sub(t0, t3), Rx), Ry), _2n4); + Ry = Fp22.sub(Fp22.sqr(Fp22.div(Fp22.add(t0, t3), _2n4)), Fp22.mul(Fp22.sqr(t2), _3n3)); + Rz = Fp22.mul(t0, t4); + if (bitGet(CURVE.params.x, i)) { + let t02 = Fp22.sub(Ry, Fp22.mul(Qy, Rz)); + let t12 = Fp22.sub(Rx, Fp22.mul(Qx, Rz)); + ell_coeff.push([ + Fp22.sub(Fp22.mul(t02, Qx), Fp22.mul(t12, Qy)), + Fp22.neg(t02), + t12, + // T1 + ]); + let t22 = Fp22.sqr(t12); + let t32 = Fp22.mul(t22, t12); + let t42 = Fp22.mul(t22, Rx); + let t5 = Fp22.add(Fp22.sub(t32, Fp22.mul(t42, _2n4)), Fp22.mul(Fp22.sqr(t02), Rz)); + Rx = Fp22.mul(t12, t5); + Ry = Fp22.sub(Fp22.mul(Fp22.sub(t42, t5), t02), Fp22.mul(t32, Ry)); + Rz = Fp22.mul(Rz, t32); + } + } + return ell_coeff; + } + function millerLoop(ell, g1) { + const { x } = CURVE.params; + const Px = g1[0]; + const Py = g1[1]; + let f12 = Fp122.ONE; + for (let j = 0, i = BLS_X_LEN2 - 2; i >= 0; i--, j++) { + const E = ell[j]; + f12 = Fp122.multiplyBy014(f12, E[0], Fp22.mul(E[1], Px), Fp22.mul(E[2], Py)); + if (bitGet(x, i)) { + j += 1; + const F = ell[j]; + f12 = Fp122.multiplyBy014(f12, F[0], Fp22.mul(F[1], Px), Fp22.mul(F[2], Py)); + } + if (i !== 0) f12 = Fp122.sqr(f12); + } + return Fp122.conjugate(f12); + } + const utils = { + randomPrivateKey: () => { + const length = getMinHashLength(Fr2.ORDER); + return mapHashToField(CURVE.randomBytes(length), Fr2.ORDER); + }, + calcPairingPrecomputes, + }; + const G1_ = weierstrassPoints({ n: Fr2.ORDER, ...CURVE.G1 }); + const G1 = Object.assign( + G1_, + createHasher(G1_.ProjectivePoint, CURVE.G1.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G1.htfDefaults, + }), + ); + function pairingPrecomputes(point) { + const p = point; + if (p._PPRECOMPUTES) return p._PPRECOMPUTES; + p._PPRECOMPUTES = calcPairingPrecomputes(point.toAffine()); + return p._PPRECOMPUTES; + } + const G2_ = weierstrassPoints({ n: Fr2.ORDER, ...CURVE.G2 }); + const G2 = Object.assign( + G2_, + createHasher(G2_.ProjectivePoint, CURVE.G2.mapToCurve, { + ...CURVE.htfDefaults, + ...CURVE.G2.htfDefaults, + }), + ); + const { ShortSignature } = CURVE.G1; + const { Signature } = CURVE.G2; + function pairing(Q, P, withFinalExponent = true) { + if (Q.equals(G1.ProjectivePoint.ZERO) || P.equals(G2.ProjectivePoint.ZERO)) + throw new Error('pairing is not available for ZERO point'); + Q.assertValidity(); + P.assertValidity(); + const Qa = Q.toAffine(); + const looped = millerLoop(pairingPrecomputes(P), [Qa.x, Qa.y]); + return withFinalExponent ? Fp122.finalExponentiate(looped) : looped; + } + function normP1(point) { + return point instanceof G1.ProjectivePoint ? point : G1.ProjectivePoint.fromHex(point); + } + function normP1Hash(point, htfOpts) { + return point instanceof G1.ProjectivePoint + ? point + : G1.hashToCurve(ensureBytes('point', point), htfOpts); + } + function normP2(point) { + return point instanceof G2.ProjectivePoint ? point : Signature.fromHex(point); + } + function normP2Hash(point, htfOpts) { + return point instanceof G2.ProjectivePoint + ? point + : G2.hashToCurve(ensureBytes('point', point), htfOpts); + } + function getPublicKey(privateKey) { + return G1.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + function getPublicKeyForShortSignatures(privateKey) { + return G2.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); + } + function sign(message, privateKey, htfOpts) { + const msgPoint = normP2Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G2.ProjectivePoint) return sigPoint; + return Signature.toRawBytes(sigPoint); + } + function signShortSignature(message, privateKey, htfOpts) { + const msgPoint = normP1Hash(message, htfOpts); + msgPoint.assertValidity(); + const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); + if (message instanceof G1.ProjectivePoint) return sigPoint; + return ShortSignature.toRawBytes(sigPoint); + } + function verify(signature, message, publicKey, htfOpts) { + const P = normP1(publicKey); + const Hm = normP2Hash(message, htfOpts); + const G = G1.ProjectivePoint.BASE; + const S = normP2(signature); + const ePHm = pairing(P.negate(), Hm, false); + const eGS = pairing(G, S, false); + const exp = Fp122.finalExponentiate(Fp122.mul(eGS, ePHm)); + return Fp122.eql(exp, Fp122.ONE); + } + function verifyShortSignature(signature, message, publicKey, htfOpts) { + const P = normP2(publicKey); + const Hm = normP1Hash(message, htfOpts); + const G = G2.ProjectivePoint.BASE; + const S = normP1(signature); + const eHmP = pairing(Hm, P, false); + const eSG = pairing(S, G.negate(), false); + const exp = Fp122.finalExponentiate(Fp122.mul(eSG, eHmP)); + return Fp122.eql(exp, Fp122.ONE); + } + function aggregatePublicKeys(publicKeys) { + if (!publicKeys.length) throw new Error('Expected non-empty array'); + const agg = publicKeys.map(normP1).reduce((sum, p) => sum.add(p), G1.ProjectivePoint.ZERO); + const aggAffine = agg; + if (publicKeys[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return aggAffine.toRawBytes(true); + } + function aggregateSignatures(signatures) { + if (!signatures.length) throw new Error('Expected non-empty array'); + const agg = signatures.map(normP2).reduce((sum, s) => sum.add(s), G2.ProjectivePoint.ZERO); + const aggAffine = agg; + if (signatures[0] instanceof G2.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return Signature.toRawBytes(aggAffine); + } + function aggregateShortSignatures(signatures) { + if (!signatures.length) throw new Error('Expected non-empty array'); + const agg = signatures.map(normP1).reduce((sum, s) => sum.add(s), G1.ProjectivePoint.ZERO); + const aggAffine = agg; + if (signatures[0] instanceof G1.ProjectivePoint) { + aggAffine.assertValidity(); + return aggAffine; + } + return ShortSignature.toRawBytes(aggAffine); + } + function verifyBatch(signature, messages, publicKeys, htfOpts) { + if (!messages.length) throw new Error('Expected non-empty messages array'); + if (publicKeys.length !== messages.length) + throw new Error('Pubkey count should equal msg count'); + const sig = normP2(signature); + const nMessages = messages.map(i => normP2Hash(i, htfOpts)); + const nPublicKeys = publicKeys.map(normP1); + try { + const paired = []; + for (const message of new Set(nMessages)) { + const groupPublicKey = nMessages.reduce( + (groupPublicKey2, subMessage, i) => + subMessage === message ? groupPublicKey2.add(nPublicKeys[i]) : groupPublicKey2, + G1.ProjectivePoint.ZERO, + ); + paired.push(pairing(groupPublicKey, message, false)); + } + paired.push(pairing(G1.ProjectivePoint.BASE.negate(), sig, false)); + const product = paired.reduce((a, b) => Fp122.mul(a, b), Fp122.ONE); + const exp = Fp122.finalExponentiate(product); + return Fp122.eql(exp, Fp122.ONE); + } catch { + return false; + } + } + G1.ProjectivePoint.BASE._setWindowSize(4); + return { + getPublicKey, + getPublicKeyForShortSignatures, + sign, + signShortSignature, + verify, + verifyBatch, + verifyShortSignature, + aggregatePublicKeys, + aggregateSignatures, + aggregateShortSignatures, + millerLoop, + pairing, + G1, + G2, + Signature, + ShortSignature, + fields: { + Fr: Fr2, + Fp: Fp3, + Fp2: Fp22, + Fp6: Fp62, + Fp12: Fp122, + }, + params: { + x: CURVE.params.x, + r: CURVE.params.r, + G1b: CURVE.G1.b, + G2b: CURVE.G2.b, + }, + utils, + }; + } + var _2n4, _3n3; + var init_bls = __esm({ + 'node_modules/@noble/curves/esm/abstract/bls.js'() { + init_modular(); + init_utils2(); + init_hash_to_curve(); + init_weierstrass(); + _2n4 = BigInt(2); + _3n3 = BigInt(3); + }, + }); + + // node_modules/@noble/curves/esm/bls12-381.js + function Fp4Square(a, b) { + const a2 = Fp2.sqr(a); + const b2 = Fp2.sqr(b); + return { + first: Fp2.add(Fp2.mulByNonresidue(b2), a2), + second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), + // (a + b)² - a² - b² + }; + } + function psi(x, y) { + const x2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wsq_inv, x), 1), wsq).c0.c0; + const y2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wcu_inv, y), 1), wcu).c0.c0; + return [x2, y2]; + } + function G2psi(c, P) { + const affine = P.toAffine(); + const p = psi(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); + } + function psi2(x, y) { + return [Fp2.mul(x, PSI2_C1), Fp2.neg(y)]; + } + function G2psi2(c, P) { + const affine = P.toAffine(); + const p = psi2(affine.x, affine.y); + return new c(p[0], p[1], Fp2.ONE); + } + function signatureG1ToRawBytes(point) { + point.assertValidity(); + const isZero = point.equals(bls12_381.G1.ProjectivePoint.ZERO); + const { x, y } = point.toAffine(); + if (isZero) return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = bitSet(x, C_BIT_POS, Boolean((y * _2n5) / P)); + num = bitSet(num, S_BIT_POS, true); + return numberToBytesBE(num, Fp.BYTES); + } + function signatureG2ToRawBytes(point) { + point.assertValidity(); + const len = Fp.BYTES; + if (point.equals(bls12_381.G2.ProjectivePoint.ZERO)) + return concatBytes(COMPRESSED_ZERO, numberToBytesBE(_0n5, len)); + const { x, y } = point.toAffine(); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + const tmp = y1 > _0n5 ? y1 * _2n5 : y0 * _2n5; + const aflag1 = Boolean((tmp / Fp.ORDER) & _1n5); + const z1 = bitSet(bitSet(x1, 381, aflag1), S_BIT_POS, true); + const z2 = x0; + return concatBytes(numberToBytesBE(z1, len), numberToBytesBE(z2, len)); + } + var _0n5, + _1n5, + _2n5, + _3n4, + _4n3, + _8n2, + _16n2, + Fp_raw, + Fp, + Fr, + Fp2Add, + Fp2Subtract, + Fp2Multiply, + Fp2Square, + FP2_ORDER, + Fp2, + FP2_FROBENIUS_COEFFICIENTS, + rv1, + FP2_ROOTS_OF_UNITY, + Fp6Add, + Fp6Subtract, + Fp6Multiply, + Fp6Square, + Fp6, + FP6_FROBENIUS_COEFFICIENTS_1, + FP6_FROBENIUS_COEFFICIENTS_2, + BLS_X, + BLS_X_LEN, + Fp12Add, + Fp12Subtract, + Fp12Multiply, + Fp12Square, + Fp12, + FP12_FROBENIUS_COEFFICIENTS, + isogenyMapG2, + isogenyMapG1, + G2_SWU, + G1_SWU, + ut_root, + wsq, + wcu, + wsq_inv, + wcu_inv, + PSI2_C1, + htfDefaults, + C_BIT_POS, + I_BIT_POS, + S_BIT_POS, + COMPRESSED_ZERO, + bls12_381; + var init_bls12_381 = __esm({ + 'node_modules/@noble/curves/esm/bls12-381.js'() { + init_sha256(); + init_utils(); + init_bls(); + init_modular(); + init_utils2(); + init_weierstrass(); + init_hash_to_curve(); + _0n5 = BigInt(0); + _1n5 = BigInt(1); + _2n5 = BigInt(2); + _3n4 = BigInt(3); + _4n3 = BigInt(4); + _8n2 = BigInt(8); + _16n2 = BigInt(16); + Fp_raw = BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab', + ); + Fp = Field(Fp_raw); + Fr = Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')); + Fp2Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.add(c0, r0), + c1: Fp.add(c1, r1), + }); + Fp2Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp.sub(c0, r0), + c1: Fp.sub(c1, r1), + }); + Fp2Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') return { c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }; + const { c0: r0, c1: r1 } = rhs; + let t1 = Fp.mul(c0, r0); + let t2 = Fp.mul(c1, r1); + const o0 = Fp.sub(t1, t2); + const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); + return { c0: o0, c1: o1 }; + }; + Fp2Square = ({ c0, c1 }) => { + const a = Fp.add(c0, c1); + const b = Fp.sub(c0, c1); + const c = Fp.add(c0, c0); + return { c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }; + }; + FP2_ORDER = Fp_raw * Fp_raw; + Fp2 = { + ORDER: FP2_ORDER, + BITS: bitLen(FP2_ORDER), + BYTES: Math.ceil(bitLen(FP2_ORDER) / 8), + MASK: bitMask(bitLen(FP2_ORDER)), + ZERO: { c0: Fp.ZERO, c1: Fp.ZERO }, + ONE: { c0: Fp.ONE, c1: Fp.ZERO }, + create: num => num, + isValid: ({ c0, c1 }) => typeof c0 === 'bigint' && typeof c1 === 'bigint', + is0: ({ c0, c1 }) => Fp.is0(c0) && Fp.is0(c1), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp.eql(c0, r0) && Fp.eql(c1, r1), + neg: ({ c0, c1 }) => ({ c0: Fp.neg(c0), c1: Fp.neg(c1) }), + pow: (num, power) => FpPow(Fp2, num, power), + invertBatch: nums => FpInvertBatch(Fp2, nums), + // Normalized + add: Fp2Add, + sub: Fp2Subtract, + mul: Fp2Multiply, + sqr: Fp2Square, + // NonNormalized stuff + addN: Fp2Add, + subN: Fp2Subtract, + mulN: Fp2Multiply, + sqrN: Fp2Square, + // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? + div: (lhs, rhs) => + Fp2.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp2.inv(rhs)), + inv: ({ c0: a, c1: b }) => { + const factor = Fp.inv(Fp.create(a * a + b * b)); + return { c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }; + }, + sqrt: num => { + if (Fp2.eql(num, Fp2.ZERO)) return Fp2.ZERO; + const candidateSqrt = Fp2.pow(num, (Fp2.ORDER + _8n2) / _16n2); + const check = Fp2.div(Fp2.sqr(candidateSqrt), num); + const R = FP2_ROOTS_OF_UNITY; + const divisor = [R[0], R[2], R[4], R[6]].find(r => Fp2.eql(r, check)); + if (!divisor) throw new Error('No root'); + const index = R.indexOf(divisor); + const root = R[index / 2]; + if (!root) throw new Error('Invalid root'); + const x1 = Fp2.div(candidateSqrt, root); + const x2 = Fp2.neg(x1); + const { re: re1, im: im1 } = Fp2.reim(x1); + const { re: re2, im: im2 } = Fp2.reim(x2); + if (im1 > im2 || (im1 === im2 && re1 > re2)) return x1; + return x2; + }, + // Same as sgn0_m_eq_2 in RFC 9380 + isOdd: x => { + const { re: x0, im: x1 } = Fp2.reim(x); + const sign_0 = x0 % _2n5; + const zero_0 = x0 === _0n5; + const sign_1 = x1 % _2n5; + return BigInt(sign_0 || (zero_0 && sign_1)) == _1n5; + }, + // Bytes util + fromBytes(b) { + if (b.length !== Fp2.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), + c1: Fp.fromBytes(b.subarray(Fp.BYTES)), + }; + }, + toBytes: ({ c0, c1 }) => concatBytes(Fp.toBytes(c0), Fp.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp.cmov(c0, r0, c), + c1: Fp.cmov(c1, r1, c), + }), + // Specific utils + // toString() { + // return `Fp2(${this.c0} + ${this.c1}×i)`; + // } + reim: ({ c0, c1 }) => ({ re: c0, im: c1 }), + // multiply by u + 1 + mulByNonresidue: ({ c0, c1 }) => ({ c0: Fp.sub(c0, c1), c1: Fp.add(c0, c1) }), + multiplyByB: ({ c0, c1 }) => { + let t0 = Fp.mul(c0, _4n3); + let t1 = Fp.mul(c1, _4n3); + return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; + }, + fromBigTuple: tuple => { + if (tuple.length !== 2) throw new Error('Invalid tuple'); + const fps = tuple.map(n => Fp.create(n)); + return { c0: fps[0], c1: fps[1] }; + }, + frobeniusMap: ({ c0, c1 }, power) => ({ + c0, + c1: Fp.mul(c1, FP2_FROBENIUS_COEFFICIENTS[power % 2]), + }), + }; + FP2_FROBENIUS_COEFFICIENTS = [ + BigInt('0x1'), + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', + ), + ].map(item => Fp.create(item)); + rv1 = BigInt( + '0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', + ); + FP2_ROOTS_OF_UNITY = [ + [_1n5, _0n5], + [rv1, -rv1], + [_0n5, _1n5], + [rv1, rv1], + [-_1n5, _0n5], + [-rv1, rv1], + [_0n5, -_1n5], + [-rv1, -rv1], + ].map(pair => Fp2.fromBigTuple(pair)); + Fp6Add = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.add(c0, r0), + c1: Fp2.add(c1, r1), + c2: Fp2.add(c2, r2), + }); + Fp6Subtract = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ + c0: Fp2.sub(c0, r0), + c1: Fp2.sub(c1, r1), + c2: Fp2.sub(c2, r2), + }); + Fp6Multiply = ({ c0, c1, c2 }, rhs) => { + if (typeof rhs === 'bigint') { + return { + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }; + } + const { c0: r0, c1: r1, c2: r2 } = rhs; + const t0 = Fp2.mul(c0, r0); + const t1 = Fp2.mul(c1, r1); + const t2 = Fp2.mul(c2, r2); + return { + // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) + c0: Fp2.add( + t0, + Fp2.mulByNonresidue( + Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2)), + ), + ), + // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) + c1: Fp2.add( + Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), + Fp2.mulByNonresidue(t2), + ), + // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 + c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), + }; + }; + Fp6Square = ({ c0, c1, c2 }) => { + let t0 = Fp2.sqr(c0); + let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n5); + let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n5); + let t4 = Fp2.sqr(c2); + return { + c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), + c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), + // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 + c2: Fp2.sub( + Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), + t4, + ), + }; + }; + Fp6 = { + ORDER: Fp2.ORDER, + BITS: 3 * Fp2.BITS, + BYTES: 3 * Fp2.BYTES, + MASK: bitMask(3 * Fp2.BITS), + ZERO: { c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }, + ONE: { c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }, + create: num => num, + isValid: ({ c0, c1, c2 }) => Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2), + is0: ({ c0, c1, c2 }) => Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2), + neg: ({ c0, c1, c2 }) => ({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }), + eql: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => + Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2), + sqrt: () => { + throw new Error('Not implemented'); + }, + // Do we need division by bigint at all? Should be done via order: + div: (lhs, rhs) => + Fp6.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp6.inv(rhs)), + pow: (num, power) => FpPow(Fp6, num, power), + invertBatch: nums => FpInvertBatch(Fp6, nums), + // Normalized + add: Fp6Add, + sub: Fp6Subtract, + mul: Fp6Multiply, + sqr: Fp6Square, + // NonNormalized stuff + addN: Fp6Add, + subN: Fp6Subtract, + mulN: Fp6Multiply, + sqrN: Fp6Square, + inv: ({ c0, c1, c2 }) => { + let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); + let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); + let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); + let t4 = Fp2.inv( + Fp2.add( + Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), + Fp2.mul(c0, t0), + ), + ); + return { c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }; + }, + // Bytes utils + fromBytes: b => { + if (b.length !== Fp6.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp2.fromBytes(b.subarray(0, Fp2.BYTES)), + c1: Fp2.fromBytes(b.subarray(Fp2.BYTES, 2 * Fp2.BYTES)), + c2: Fp2.fromBytes(b.subarray(2 * Fp2.BYTES)), + }; + }, + toBytes: ({ c0, c1, c2 }) => concatBytes(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)), + cmov: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }, c) => ({ + c0: Fp2.cmov(c0, r0, c), + c1: Fp2.cmov(c1, r1, c), + c2: Fp2.cmov(c2, r2, c), + }), + // Utils + // fromTriple(triple: [Fp2, Fp2, Fp2]) { + // return new Fp6(...triple); + // } + // toString() { + // return `Fp6(${this.c0} + ${this.c1} * v, ${this.c2} * v^2)`; + // } + fromBigSix: t => { + if (!Array.isArray(t) || t.length !== 6) throw new Error('Invalid Fp6 usage'); + return { + c0: Fp2.fromBigTuple(t.slice(0, 2)), + c1: Fp2.fromBigTuple(t.slice(2, 4)), + c2: Fp2.fromBigTuple(t.slice(4, 6)), + }; + }, + frobeniusMap: ({ c0, c1, c2 }, power) => ({ + c0: Fp2.frobeniusMap(c0, power), + c1: Fp2.mul(Fp2.frobeniusMap(c1, power), FP6_FROBENIUS_COEFFICIENTS_1[power % 6]), + c2: Fp2.mul(Fp2.frobeniusMap(c2, power), FP6_FROBENIUS_COEFFICIENTS_2[power % 6]), + }), + mulByNonresidue: ({ c0, c1, c2 }) => ({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }), + // Sparse multiplication + multiplyBy1: ({ c0, c1, c2 }, b1) => ({ + c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), + c1: Fp2.mul(c0, b1), + c2: Fp2.mul(c1, b1), + }), + // Sparse multiplication + multiplyBy01({ c0, c1, c2 }, b0, b1) { + let t0 = Fp2.mul(c0, b0); + let t1 = Fp2.mul(c1, b1); + return { + // ((c1 + c2) * b1 - T1) * (u + 1) + T0 + c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), + // (b0 + b1) * (c0 + c1) - T0 - T1 + c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), + // (c0 + c2) * b0 - T0 + T1 + c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1, c2 }, rhs) => ({ + c0: Fp2.mul(c0, rhs), + c1: Fp2.mul(c1, rhs), + c2: Fp2.mul(c2, rhs), + }), + }; + FP6_FROBENIUS_COEFFICIENTS_1 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt('0x0'), + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + BigInt('0x0'), + ], + [BigInt('0x0'), BigInt('0x1')], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + BigInt('0x0'), + ], + [ + BigInt('0x0'), + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + ], + ].map(pair => Fp2.fromBigTuple(pair)); + FP6_FROBENIUS_COEFFICIENTS_2 = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff', + ), + BigInt('0x0'), + ], + ].map(pair => Fp2.fromBigTuple(pair)); + BLS_X = BigInt('0xd201000000010000'); + BLS_X_LEN = bitLen(BLS_X); + Fp12Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.add(c0, r0), + c1: Fp6.add(c1, r1), + }); + Fp12Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ + c0: Fp6.sub(c0, r0), + c1: Fp6.sub(c1, r1), + }); + Fp12Multiply = ({ c0, c1 }, rhs) => { + if (typeof rhs === 'bigint') return { c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }; + let { c0: r0, c1: r1 } = rhs; + let t1 = Fp6.mul(c0, r0); + let t2 = Fp6.mul(c1, r1); + return { + c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), + // (c0 + c1) * (r0 + r1) - (T1 + T2) + c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), + }; + }; + Fp12Square = ({ c0, c1 }) => { + let ab = Fp6.mul(c0, c1); + return { + // (c1 * v + c0) * (c0 + c1) - AB - AB * v + c0: Fp6.sub( + Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), + Fp6.mulByNonresidue(ab), + ), + c1: Fp6.add(ab, ab), + }; + }; + Fp12 = { + ORDER: Fp2.ORDER, + BITS: 2 * Fp2.BITS, + BYTES: 2 * Fp2.BYTES, + MASK: bitMask(2 * Fp2.BITS), + ZERO: { c0: Fp6.ZERO, c1: Fp6.ZERO }, + ONE: { c0: Fp6.ONE, c1: Fp6.ZERO }, + create: num => num, + isValid: ({ c0, c1 }) => Fp6.isValid(c0) && Fp6.isValid(c1), + is0: ({ c0, c1 }) => Fp6.is0(c0) && Fp6.is0(c1), + neg: ({ c0, c1 }) => ({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }), + eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp6.eql(c0, r0) && Fp6.eql(c1, r1), + sqrt: () => { + throw new Error('Not implemented'); + }, + inv: ({ c0, c1 }) => { + let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); + return { c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }; + }, + div: (lhs, rhs) => + Fp12.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp12.inv(rhs)), + pow: (num, power) => FpPow(Fp12, num, power), + invertBatch: nums => FpInvertBatch(Fp12, nums), + // Normalized + add: Fp12Add, + sub: Fp12Subtract, + mul: Fp12Multiply, + sqr: Fp12Square, + // NonNormalized stuff + addN: Fp12Add, + subN: Fp12Subtract, + mulN: Fp12Multiply, + sqrN: Fp12Square, + // Bytes utils + fromBytes: b => { + if (b.length !== Fp12.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); + return { + c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), + c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), + }; + }, + toBytes: ({ c0, c1 }) => concatBytes(Fp6.toBytes(c0), Fp6.toBytes(c1)), + cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ + c0: Fp6.cmov(c0, r0, c), + c1: Fp6.cmov(c1, r1, c), + }), + // Utils + // toString() { + // return `Fp12(${this.c0} + ${this.c1} * w)`; + // }, + // fromTuple(c: [Fp6, Fp6]) { + // return new Fp12(...c); + // } + fromBigTwelve: t => ({ + c0: Fp6.fromBigSix(t.slice(0, 6)), + c1: Fp6.fromBigSix(t.slice(6, 12)), + }), + // Raises to q**i -th power + frobeniusMap(lhs, power) { + const r0 = Fp6.frobeniusMap(lhs.c0, power); + const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); + const coeff = FP12_FROBENIUS_COEFFICIENTS[power % 12]; + return { + c0: r0, + c1: Fp6.create({ + c0: Fp2.mul(c0, coeff), + c1: Fp2.mul(c1, coeff), + c2: Fp2.mul(c2, coeff), + }), + }; + }, + // Sparse multiplication + multiplyBy014: ({ c0, c1 }, o0, o1, o4) => { + let t0 = Fp6.multiplyBy01(c0, o0, o1); + let t1 = Fp6.multiplyBy1(c1, o4); + return { + c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), + // (c1 + c0) * [o0, o1+o4] - T0 - T1 + c1: Fp6.sub(Fp6.sub(Fp6.multiplyBy01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), + }; + }, + multiplyByFp2: ({ c0, c1 }, rhs) => ({ + c0: Fp6.multiplyByFp2(c0, rhs), + c1: Fp6.multiplyByFp2(c1, rhs), + }), + conjugate: ({ c0, c1 }) => ({ c0, c1: Fp6.neg(c1) }), + // A cyclotomic group is a subgroup of Fp^n defined by + // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} + // The result of any pairing is in a cyclotomic subgroup + // https://eprint.iacr.org/2009/565.pdf + _cyclotomicSquare: ({ c0, c1 }) => { + const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; + const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; + const { first: t3, second: t4 } = Fp4Square(c0c0, c1c1); + const { first: t5, second: t6 } = Fp4Square(c1c0, c0c2); + const { first: t7, second: t8 } = Fp4Square(c0c1, c1c2); + let t9 = Fp2.mulByNonresidue(t8); + return { + c0: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n5), t3), + c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n5), t5), + c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n5), t7), + }), + c1: Fp6.create({ + c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n5), t9), + c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n5), t4), + c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n5), t6), + }), + }; + }, + _cyclotomicExp(num, n) { + let z = Fp12.ONE; + for (let i = BLS_X_LEN - 1; i >= 0; i--) { + z = Fp12._cyclotomicSquare(z); + if (bitGet(n, i)) z = Fp12.mul(z, num); + } + return z; + }, + // https://eprint.iacr.org/2010/354.pdf + // https://eprint.iacr.org/2009/565.pdf + finalExponentiate: num => { + const x = BLS_X; + const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); + const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); + const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); + const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); + const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); + const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); + const t6 = Fp12.mul( + Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), + Fp12._cyclotomicSquare(t2), + ); + const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); + const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); + const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); + const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); + const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); + return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); + }, + }; + FP12_FROBENIUS_COEFFICIENTS = [ + [BigInt('0x1'), BigInt('0x0')], + [ + BigInt( + '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8', + ), + BigInt( + '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3', + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2', + ), + BigInt( + '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', + ), + ], + [ + BigInt( + '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995', + ), + BigInt( + '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116', + ), + ], + [ + BigInt( + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3', + ), + BigInt( + '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8', + ), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', + ), + BigInt( + '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2', + ), + ], + [ + BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad', + ), + BigInt('0x0'), + ], + [ + BigInt( + '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116', + ), + BigInt( + '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995', + ), + ], + ].map(n => Fp2.fromBigTuple(n)); + isogenyMapG2 = isogenyMap( + Fp2, + [ + // xNum + [ + [ + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', + ], + [ + '0x0', + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', + ], + [ + '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', + '0x0', + ], + ], + // xDen + [ + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', + ], + [ + '0xc', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', + ], + ['0x1', '0x0'], + // LAST 1 + ], + // yNum + [ + [ + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', + ], + [ + '0x0', + '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', + ], + [ + '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', + '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', + ], + [ + '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', + '0x0', + ], + ], + // yDen + [ + [ + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', + ], + [ + '0x0', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', + ], + [ + '0x12', + '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', + ], + ['0x1', '0x0'], + // LAST 1 + ], + ].map(i => i.map(pair => Fp2.fromBigTuple(pair.map(BigInt)))), + ); + isogenyMapG1 = isogenyMap( + Fp, + [ + // xNum + [ + '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', + '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', + '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', + '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', + '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', + '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', + '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', + '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', + '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', + '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', + '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', + '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', + ], + // xDen + [ + '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', + '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', + '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', + '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', + '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', + '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', + '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', + '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', + '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', + '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', + // LAST 1 + ], + // yNum + [ + '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', + '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', + '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', + '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', + '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', + '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', + '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', + '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', + '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', + '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', + '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', + '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', + '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', + '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', + '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', + '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', + ], + // yDen + [ + '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', + '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', + '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', + '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', + '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', + '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', + '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', + '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', + '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', + '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', + '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', + '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', + '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', + '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', + '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', + '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', + // LAST 1 + ], + ].map(i => i.map(j => BigInt(j))), + ); + G2_SWU = mapToCurveSimpleSWU(Fp2, { + A: Fp2.create({ c0: Fp.create(_0n5), c1: Fp.create(BigInt(240)) }), + B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), + Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), + // Z: -(2 + I) + }); + G1_SWU = mapToCurveSimpleSWU(Fp, { + A: Fp.create( + BigInt( + '0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d', + ), + ), + B: Fp.create( + BigInt( + '0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0', + ), + ), + Z: Fp.create(BigInt(11)), + }); + ut_root = Fp6.create({ c0: Fp2.ZERO, c1: Fp2.ONE, c2: Fp2.ZERO }); + wsq = Fp12.create({ c0: ut_root, c1: Fp6.ZERO }); + wcu = Fp12.create({ c0: Fp6.ZERO, c1: ut_root }); + [wsq_inv, wcu_inv] = Fp12.invertBatch([wsq, wcu]); + PSI2_C1 = BigInt( + '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', + ); + htfDefaults = Object.freeze({ + // DST: a domain separation tag + // defined in section 2.2.5 + // Use utils.getDSTLabel(), utils.setDSTLabel(value) + DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', + // p: the characteristic of F + // where F is a finite field of characteristic p and order q = p^m + p: Fp.ORDER, + // m: the extension degree of F, m >= 1 + // where F is a finite field of characteristic p and order q = p^m + m: 2, + // k: the target security level for the suite in bits + // defined in section 5.1 + k: 128, + // option to use a message that has already been processed by + // expand_message_xmd + expand: 'xmd', + // Hash functions for: expand_message_xmd is appropriate for use with a + // wide range of hash functions, including SHA-2, SHA-3, BLAKE2, and others. + // BBS+ uses blake2: https://github.com/hyperledger/aries-framework-go/issues/2247 + hash: sha256, + }); + C_BIT_POS = Fp.BITS; + I_BIT_POS = Fp.BITS + 1; + S_BIT_POS = Fp.BITS + 2; + COMPRESSED_ZERO = Fp.toBytes(bitSet(bitSet(_0n5, I_BIT_POS, true), S_BIT_POS, true)); + bls12_381 = bls({ + // Fields + fields: { + Fp, + Fp2, + Fp6, + Fp12, + Fr, + }, + // G1 is the order-q subgroup of E1(Fp) : y² = x³ + 4, #E1(Fp) = h1q, where + // characteristic; z + (z⁴ - z² + 1)(z - 1)²/3 + G1: { + Fp, + // cofactor; (z - 1)²/3 + h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), + // generator's coordinates + // x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 + // y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 + Gx: BigInt( + '0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb', + ), + Gy: BigInt( + '0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1', + ), + a: Fp.ZERO, + b: _4n3, + htfDefaults: { ...htfDefaults, m: 1, DST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_' }, + wrapPrivateKey: true, + allowInfinityPoint: true, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, point) => { + const cubicRootOfUnityModP = BigInt( + '0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', + ); + const phi = new c(Fp.mul(point.px, cubicRootOfUnityModP), point.py, point.pz); + const xP = point.multiplyUnsafe(bls12_381.params.x).negate(); + const u2P = xP.multiplyUnsafe(bls12_381.params.x); + return u2P.equals(phi); + }, + // Clear cofactor of G1 + // https://eprint.iacr.org/2019/403 + clearCofactor: (_c, point) => { + return point.multiplyUnsafe(bls12_381.params.x).add(point); + }, + mapToCurve: scalars => { + const { x, y } = G1_SWU(Fp.create(scalars[0])); + return isogenyMapG1(x, y); + }, + fromBytes: bytes2 => { + bytes2 = bytes2.slice(); + if (bytes2.length === 48) { + const P = Fp.ORDER; + const compressedValue = bytesToNumberBE(bytes2); + const bflag = bitGet(compressedValue, I_BIT_POS); + if (bflag === _1n5) return { x: _0n5, y: _0n5 }; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n4), Fp.create(bls12_381.params.G1b)); + let y = Fp.sqrt(right); + if (!y) throw new Error('Invalid compressed G1 point'); + const aflag = bitGet(compressedValue, C_BIT_POS); + if ((y * _2n5) / P !== aflag) y = Fp.neg(y); + return { x: Fp.create(x), y: Fp.create(y) }; + } else if (bytes2.length === 96) { + if ((bytes2[0] & (1 << 6)) !== 0) return bls12_381.G1.ProjectivePoint.ZERO.toAffine(); + const x = bytesToNumberBE(bytes2.subarray(0, Fp.BYTES)); + const y = bytesToNumberBE(bytes2.subarray(Fp.BYTES)); + return { x: Fp.create(x), y: Fp.create(y) }; + } else { + throw new Error('Invalid point G1, expected 48/96 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) return COMPRESSED_ZERO.slice(); + const P = Fp.ORDER; + let num; + num = bitSet(x, C_BIT_POS, Boolean((y * _2n5) / P)); + num = bitSet(num, S_BIT_POS, true); + return numberToBytesBE(num, Fp.BYTES); + } else { + if (isZero) { + const x2 = concatBytes(new Uint8Array([64]), new Uint8Array(2 * Fp.BYTES - 1)); + return x2; + } else { + return concatBytes(numberToBytesBE(x, Fp.BYTES), numberToBytesBE(y, Fp.BYTES)); + } + } + }, + ShortSignature: { + fromHex(hex) { + const bytes2 = ensureBytes('signatureHex', hex, 48); + const P = Fp.ORDER; + const compressedValue = bytesToNumberBE(bytes2); + const bflag = bitGet(compressedValue, I_BIT_POS); + if (bflag === _1n5) return bls12_381.G1.ProjectivePoint.ZERO; + const x = Fp.create(compressedValue & Fp.MASK); + const right = Fp.add(Fp.pow(x, _3n4), Fp.create(bls12_381.params.G1b)); + let y = Fp.sqrt(right); + if (!y) throw new Error('Invalid compressed G1 point'); + const aflag = bitGet(compressedValue, C_BIT_POS); + if ((y * _2n5) / P !== aflag) y = Fp.neg(y); + const point = bls12_381.G1.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point) { + return signatureG1ToRawBytes(point); + }, + toHex(point) { + return bytesToHex(signatureG1ToRawBytes(point)); + }, + }, + }, + // G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), + // where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where + // G² - 1 + // h2q + G2: { + Fp: Fp2, + // cofactor + h: BigInt( + '0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5', + ), + Gx: Fp2.fromBigTuple([ + BigInt( + '0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8', + ), + BigInt( + '0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e', + ), + ]), + // y = + // 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582, + // 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 + Gy: Fp2.fromBigTuple([ + BigInt( + '0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801', + ), + BigInt( + '0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be', + ), + ]), + a: Fp2.ZERO, + b: Fp2.fromBigTuple([_4n3, _4n3]), + hEff: BigInt( + '0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551', + ), + htfDefaults: { ...htfDefaults }, + wrapPrivateKey: true, + allowInfinityPoint: true, + mapToCurve: scalars => { + const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars)); + return isogenyMapG2(x, y); + }, + // Checks is the point resides in prime-order subgroup. + // point.isTorsionFree() should return true for valid points + // It returns false for shitty points. + // https://eprint.iacr.org/2021/1130.pdf + isTorsionFree: (c, P) => { + return P.multiplyUnsafe(bls12_381.params.x).negate().equals(G2psi(c, P)); + }, + // Maps the point into the prime-order subgroup G2. + // clear_cofactor_bls12381_g2 from cfrg-hash-to-curve-11 + // https://eprint.iacr.org/2017/419.pdf + // prettier-ignore + clearCofactor: (c, P) => { + const x = bls12_381.params.x; + let t1 = P.multiplyUnsafe(x).negate(); + let t2 = G2psi(c, P); + let t3 = P.double(); + t3 = G2psi2(c, t3); + t3 = t3.subtract(t2); + t2 = t1.add(t2); + t2 = t2.multiplyUnsafe(x).negate(); + t3 = t3.add(t2); + t3 = t3.subtract(t1); + const Q = t3.subtract(P); + return Q; + }, + fromBytes: bytes2 => { + bytes2 = bytes2.slice(); + const m_byte = bytes2[0] & 224; + if (m_byte === 32 || m_byte === 96 || m_byte === 224) { + throw new Error('Invalid encoding flag: ' + m_byte); + } + const bitC = m_byte & 128; + const bitI = m_byte & 64; + const bitS = m_byte & 32; + const L = Fp.BYTES; + const slc = (b, from, to) => bytesToNumberBE(b.slice(from, to)); + if (bytes2.length === 96 && bitC) { + const b = bls12_381.params.G2b; + const P = Fp.ORDER; + bytes2[0] = bytes2[0] & 31; + if (bitI) { + if (bytes2.reduce((p, c) => (p !== 0 ? c + 1 : c), 0) > 0) { + throw new Error('Invalid compressed G2 point'); + } + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x_1 = slc(bytes2, 0, L); + const x_0 = slc(bytes2, L, 2 * L); + const x = Fp2.create({ c0: Fp.create(x_0), c1: Fp.create(x_1) }); + const right = Fp2.add(Fp2.pow(x, _3n4), b); + let y = Fp2.sqrt(right); + const Y_bit = y.c1 === _0n5 ? (y.c0 * _2n5) / P : (y.c1 * _2n5) / P ? _1n5 : _0n5; + y = bitS > 0 && Y_bit > 0 ? y : Fp2.neg(y); + return { x, y }; + } else if (bytes2.length === 192 && !bitC) { + if ((bytes2[0] & (1 << 6)) !== 0) { + return { x: Fp2.ZERO, y: Fp2.ZERO }; + } + const x1 = slc(bytes2, 0, L); + const x0 = slc(bytes2, L, 2 * L); + const y1 = slc(bytes2, 2 * L, 3 * L); + const y0 = slc(bytes2, 3 * L, 4 * L); + return { x: Fp2.fromBigTuple([x0, x1]), y: Fp2.fromBigTuple([y0, y1]) }; + } else { + throw new Error('Invalid point G2, expected 96/192 bytes'); + } + }, + toBytes: (c, point, isCompressed) => { + const { BYTES: len, ORDER: P } = Fp; + const isZero = point.equals(c.ZERO); + const { x, y } = point.toAffine(); + if (isCompressed) { + if (isZero) return concatBytes(COMPRESSED_ZERO, numberToBytesBE(_0n5, len)); + const flag = Boolean(y.c1 === _0n5 ? (y.c0 * _2n5) / P : (y.c1 * _2n5) / P); + let x_1 = bitSet(x.c1, C_BIT_POS, flag); + x_1 = bitSet(x_1, S_BIT_POS, true); + return concatBytes(numberToBytesBE(x_1, len), numberToBytesBE(x.c0, len)); + } else { + if (isZero) return concatBytes(new Uint8Array([64]), new Uint8Array(4 * len - 1)); + const { re: x0, im: x1 } = Fp2.reim(x); + const { re: y0, im: y1 } = Fp2.reim(y); + return concatBytes( + numberToBytesBE(x1, len), + numberToBytesBE(x0, len), + numberToBytesBE(y1, len), + numberToBytesBE(y0, len), + ); + } + }, + Signature: { + // TODO: Optimize, it's very slow because of sqrt. + fromHex(hex) { + hex = ensureBytes('signatureHex', hex); + const P = Fp.ORDER; + const half = hex.length / 2; + if (half !== 48 && half !== 96) + throw new Error('Invalid compressed signature length, must be 96 or 192'); + const z1 = bytesToNumberBE(hex.slice(0, half)); + const z2 = bytesToNumberBE(hex.slice(half)); + const bflag1 = bitGet(z1, I_BIT_POS); + if (bflag1 === _1n5) return bls12_381.G2.ProjectivePoint.ZERO; + const x1 = Fp.create(z1 & Fp.MASK); + const x2 = Fp.create(z2); + const x = Fp2.create({ c0: x2, c1: x1 }); + const y2 = Fp2.add(Fp2.pow(x, _3n4), bls12_381.params.G2b); + let y = Fp2.sqrt(y2); + if (!y) throw new Error('Failed to find a square root'); + const { re: y0, im: y1 } = Fp2.reim(y); + const aflag1 = bitGet(z1, 381); + const isGreater = y1 > _0n5 && (y1 * _2n5) / P !== aflag1; + const isZero = y1 === _0n5 && (y0 * _2n5) / P !== aflag1; + if (isGreater || isZero) y = Fp2.neg(y); + const point = bls12_381.G2.ProjectivePoint.fromAffine({ x, y }); + point.assertValidity(); + return point; + }, + toRawBytes(point) { + return signatureG2ToRawBytes(point); + }, + toHex(point) { + return bytesToHex(signatureG2ToRawBytes(point)); + }, + }, + }, + params: { + x: BLS_X, + r: Fr.ORDER, + // order; z⁴ − z² + 1; CURVE.n from other curves + }, + htfDefaults, + hash: sha256, + randomBytes, + }); + }, + }); + + // index.js + var require_bls = __commonJS({ + 'index.js'(exports, module) { + init_bls12_381(); + module.exports = { + verifyShortSignature: bls12_381.verifyShortSignature, + }; + }, + }); + return require_bls(); +}; +/*! Bundled license information: + +@noble/hashes/esm/utils.js: + (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/utils.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/modular.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/curve.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/abstract/weierstrass.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) + +@noble/curves/esm/bls12-381.js: + (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) +*/ diff --git a/packages/bls-verify/tsconfig.json b/packages/bls-verify/tsconfig.json index d6fb55d23..bc24095c8 100644 --- a/packages/bls-verify/tsconfig.json +++ b/packages/bls-verify/tsconfig.json @@ -4,7 +4,7 @@ "allowJs": true, "baseUrl": "./", "composite": false, - "declaration": false, + "declaration": true, "esModuleInterop": false, "forceConsistentCasingInFileNames": true, "incremental": true, From 683c8f55446da42efa63a39f414b69d6120099c3 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 13 Dec 2023 11:19:38 -0800 Subject: [PATCH 09/11] updating @noble/hashes --- package-lock.json | 25 +- packages/agent/package.json | 4 +- packages/bls-verify/package.json | 3 +- packages/bls-verify/src/index.ts | 5 +- .../bls-verify/src/verifyShortSignature.js | 3066 ----------------- packages/identity/package.json | 4 +- 6 files changed, 21 insertions(+), 3086 deletions(-) delete mode 100644 packages/bls-verify/src/verifyShortSignature.js diff --git a/package-lock.json b/package-lock.json index bba6567e1..0e8565629 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1982,20 +1982,20 @@ ] }, "node_modules/@noble/curves": { - "version": "1.2.0", - "resolved": "file:noble-curves-1.2.0.tgz", - "integrity": "sha512-Ow/xR1GC0+Qwlos9GA4ueaG7fT48u04ifqmobWr9wtmA+uwWsYcoRToJosUTf2OBqdjVCdc8ZAHjjsNAzYvCCw==", - "license": "MIT", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", "dependencies": { - "@noble/hashes": "1.3.2" + "@noble/hashes": "1.3.3" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@noble/hashes": { - "version": "1.3.2", - "license": "MIT", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", "engines": { "node": ">= 16" }, @@ -19896,8 +19896,8 @@ "version": "0.20.2", "license": "Apache-2.0", "dependencies": { - "@noble/curves": "^1.2.0", - "@noble/hashes": "^1.3.1", + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", "base64-arraybuffer": "^0.2.0", "borc": "^2.1.1", "buffer": "^6.0.3", @@ -20753,7 +20753,8 @@ "version": "0.20.2", "license": "Apache-2.0", "dependencies": { - "@noble/curves": "file:../../noble-curves-1.2.0.tgz" + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3" }, "devDependencies": { "@types/jest": "^29.5.5", @@ -20987,8 +20988,8 @@ "version": "0.20.2", "license": "Apache-2.0", "dependencies": { - "@noble/curves": "^1.2.0", - "@noble/hashes": "^1.3.1", + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", "borc": "^2.1.1" }, "devDependencies": { diff --git a/packages/agent/package.json b/packages/agent/package.json index c7e6ef0b5..335a3b9b9 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -51,8 +51,8 @@ "@dfinity/principal": "^0.20.2" }, "dependencies": { - "@noble/curves": "^1.2.0", - "@noble/hashes": "^1.3.1", + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", "base64-arraybuffer": "^0.2.0", "borc": "^2.1.1", "buffer": "^6.0.3", diff --git a/packages/bls-verify/package.json b/packages/bls-verify/package.json index c776eeb1a..f3775949e 100644 --- a/packages/bls-verify/package.json +++ b/packages/bls-verify/package.json @@ -47,7 +47,8 @@ "prettier:write": "npm run prettier -- --write" }, "dependencies": { - "@noble/curves": "file:../../noble-curves-1.2.0.tgz" + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/bls-verify/src/index.ts b/packages/bls-verify/src/index.ts index 86c2ca04d..633752cec 100644 --- a/packages/bls-verify/src/index.ts +++ b/packages/bls-verify/src/index.ts @@ -1,13 +1,12 @@ +import { bls12_381 } from '@noble/curves/bls12-381'; import { toHex } from './utils'; export const blsVerify = async ( primaryKey: Uint8Array | string, signature: Uint8Array | string, message: Uint8Array | string, ): Promise => { - const { verifyShortSignature } = (await import('./verifyShortSignature')).default() as any; - const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); const sig = typeof signature === 'string' ? signature : toHex(signature); const msg = typeof message === 'string' ? message : toHex(message); - return verifyShortSignature(sig, msg, pk); + return bls12_381.verifyShortSignature(sig, msg, pk); }; diff --git a/packages/bls-verify/src/verifyShortSignature.js b/packages/bls-verify/src/verifyShortSignature.js deleted file mode 100644 index 575a3fc5d..000000000 --- a/packages/bls-verify/src/verifyShortSignature.js +++ /dev/null @@ -1,3066 +0,0 @@ -/* eslint-disable */ -// Extracted from @noble/curves commit fb02e93ff66ecd7bc7257d8f76e6cdf88b54bfa9 -export default () => { - var __defProp = Object.defineProperty; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __esm = (fn, res) => - function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res; - }; - var __commonJS = (cb, mod2) => - function __require() { - return ( - mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), - mod2.exports - ); - }; - var __export = (target, all) => { - for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); - }; - - // node_modules/@noble/hashes/esm/_assert.js - function bytes(b, ...lengths) { - if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array'); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); - } - function exists(instance, checkFinished = true) { - if (instance.destroyed) throw new Error('Hash instance has been destroyed'); - if (checkFinished && instance.finished) - throw new Error('Hash#digest() has already been called'); - } - function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } - } - var init_assert = __esm({ - 'node_modules/@noble/hashes/esm/_assert.js'() {}, - }); - - // node_modules/@noble/hashes/esm/crypto.js - var crypto; - var init_crypto = __esm({ - 'node_modules/@noble/hashes/esm/crypto.js'() { - crypto = - typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : void 0; - }, - }); - - // node_modules/@noble/hashes/esm/utils.js - function utf8ToBytes(str) { - if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); - } - function toBytes(data) { - if (typeof data === 'string') data = utf8ToBytes(data); - if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; - } - function wrapConstructor(hashCons) { - const hashC = msg => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; - } - function randomBytes(bytesLength = 32) { - if (crypto && typeof crypto.getRandomValues === 'function') { - return crypto.getRandomValues(new Uint8Array(bytesLength)); - } - throw new Error('crypto.getRandomValues must be defined'); - } - var u8a, createView, rotr, isLE, Hash, toStr; - var init_utils = __esm({ - 'node_modules/@noble/hashes/esm/utils.js'() { - init_crypto(); - u8a = a => a instanceof Uint8Array; - createView = arr => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); - rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift); - isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; - if (!isLE) throw new Error('Non little-endian hardware is not supported'); - Hash = class { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } - }; - toStr = {}.toString; - }, - }); - - // node_modules/@noble/hashes/esm/_sha2.js - function setBigUint64(view, byteOffset, value, isLE2) { - if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE2); - const _32n = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number((value >> _32n) & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE2 ? 4 : 0; - const l = isLE2 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE2); - view.setUint32(byteOffset + l, wl, isLE2); - } - var SHA2; - var init_sha2 = __esm({ - 'node_modules/@noble/hashes/esm/_sha2.js'() { - init_assert(); - init_utils(); - SHA2 = class extends Hash { - constructor(blockLen, outputLen, padOffset, isLE2) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE2; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE2 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) buffer[i] = 0; - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit'); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state'); - for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE2); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) to.buffer.set(buffer); - return to; - } - }; - }, - }); - - // node_modules/@noble/hashes/esm/sha256.js - var Chi, Maj, SHA256_K, IV, SHA256_W, SHA256, sha256; - var init_sha256 = __esm({ - 'node_modules/@noble/hashes/esm/sha256.js'() { - init_sha2(); - init_utils(); - Chi = (a, b, c) => (a & b) ^ (~a & c); - Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c); - SHA256_K = /* @__PURE__ */ new Uint32Array([ - 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, - 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, - 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, - 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, - 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, - 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, - 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, - 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, - 2361852424, 2428436474, 2756734187, 3204031479, 3329325298, - ]); - IV = /* @__PURE__ */ new Uint32Array([ - 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, - 1541459225, - ]); - SHA256_W = /* @__PURE__ */ new Uint32Array(64); - SHA256 = class extends SHA2 { - constructor() { - super(64, 32, 8, false); - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3); - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10); - SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; - } - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = (sigma0 + Maj(A, B, C)) | 0; - H = G; - G = F; - F = E; - E = (D + T1) | 0; - D = C; - C = B; - B = A; - A = (T1 + T2) | 0; - } - A = (A + this.A) | 0; - B = (B + this.B) | 0; - C = (C + this.C) | 0; - D = (D + this.D) | 0; - E = (E + this.E) | 0; - F = (F + this.F) | 0; - G = (G + this.G) | 0; - H = (H + this.H) | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } - }; - sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); - }, - }); - - // node_modules/@noble/curves/esm/abstract/utils.js - var utils_exports = {}; - __export(utils_exports, { - bitGet: () => bitGet, - bitLen: () => bitLen, - bitMask: () => bitMask, - bitSet: () => bitSet, - bytesToHex: () => bytesToHex, - bytesToNumberBE: () => bytesToNumberBE, - bytesToNumberLE: () => bytesToNumberLE, - concatBytes: () => concatBytes, - createHmacDrbg: () => createHmacDrbg, - ensureBytes: () => ensureBytes, - equalBytes: () => equalBytes, - hexToBytes: () => hexToBytes, - hexToNumber: () => hexToNumber, - numberToBytesBE: () => numberToBytesBE, - numberToBytesLE: () => numberToBytesLE, - numberToHexUnpadded: () => numberToHexUnpadded, - numberToVarBytesBE: () => numberToVarBytesBE, - utf8ToBytes: () => utf8ToBytes2, - validateObject: () => validateObject, - }); - function bytesToHex(bytes2) { - if (!u8a2(bytes2)) throw new Error('Uint8Array expected'); - let hex = ''; - for (let i = 0; i < bytes2.length; i++) { - hex += hexes[bytes2[i]]; - } - return hex; - } - function numberToHexUnpadded(num) { - const hex = num.toString(16); - return hex.length & 1 ? `0${hex}` : hex; - } - function hexToNumber(hex) { - if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); - return BigInt(hex === '' ? '0' : `0x${hex}`); - } - function asciiToBase16(char) { - if (char >= asciis._0 && char <= asciis._9) return char - asciis._0; - if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10); - if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10); - return; - } - function hexToBytes(hex) { - if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === void 0 || n2 === void 0) { - const char = hex[hi] + hex[hi + 1]; - throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; - } - return array; - } - function bytesToNumberBE(bytes2) { - return hexToNumber(bytesToHex(bytes2)); - } - function bytesToNumberLE(bytes2) { - if (!u8a2(bytes2)) throw new Error('Uint8Array expected'); - return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse())); - } - function numberToBytesBE(n, len) { - return hexToBytes(n.toString(16).padStart(len * 2, '0')); - } - function numberToBytesLE(n, len) { - return numberToBytesBE(n, len).reverse(); - } - function numberToVarBytesBE(n) { - return hexToBytes(numberToHexUnpadded(n)); - } - function ensureBytes(title, hex, expectedLength) { - let res; - if (typeof hex === 'string') { - try { - res = hexToBytes(hex); - } catch (e) { - throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); - } - } else if (u8a2(hex)) { - res = Uint8Array.from(hex); - } else { - throw new Error(`${title} must be hex string or Uint8Array`); - } - const len = res.length; - if (typeof expectedLength === 'number' && len !== expectedLength) - throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); - return res; - } - function concatBytes(...arrays) { - const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); - let pad = 0; - arrays.forEach(a => { - if (!u8a2(a)) throw new Error('Uint8Array expected'); - r.set(a, pad); - pad += a.length; - }); - return r; - } - function equalBytes(b1, b2) { - if (b1.length !== b2.length) return false; - for (let i = 0; i < b1.length; i++) if (b1[i] !== b2[i]) return false; - return true; - } - function utf8ToBytes2(str) { - if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); - } - function bitLen(n) { - let len; - for (len = 0; n > _0n; n >>= _1n, len += 1); - return len; - } - function bitGet(n, pos) { - return (n >> BigInt(pos)) & _1n; - } - function createHmacDrbg(hashLen, qByteLen, hmacFn) { - if (typeof hashLen !== 'number' || hashLen < 2) throw new Error('hashLen must be a number'); - if (typeof qByteLen !== 'number' || qByteLen < 2) throw new Error('qByteLen must be a number'); - if (typeof hmacFn !== 'function') throw new Error('hmacFn must be a function'); - let v = u8n(hashLen); - let k = u8n(hashLen); - let i = 0; - const reset = () => { - v.fill(1); - k.fill(0); - i = 0; - }; - const h = (...b) => hmacFn(k, v, ...b); - const reseed = (seed = u8n()) => { - k = h(u8fr([0]), seed); - v = h(); - if (seed.length === 0) return; - k = h(u8fr([1]), seed); - v = h(); - }; - const gen = () => { - if (i++ >= 1e3) throw new Error('drbg: tried 1000 values'); - let len = 0; - const out = []; - while (len < qByteLen) { - v = h(); - const sl = v.slice(); - out.push(sl); - len += v.length; - } - return concatBytes(...out); - }; - const genUntil = (seed, pred) => { - reset(); - reseed(seed); - let res = void 0; - while (!(res = pred(gen()))) reseed(); - reset(); - return res; - }; - return genUntil; - } - function validateObject(object, validators, optValidators = {}) { - const checkField = (fieldName, type, isOptional) => { - const checkVal = validatorFns[type]; - if (typeof checkVal !== 'function') - throw new Error(`Invalid validator "${type}", expected function`); - const val = object[fieldName]; - if (isOptional && val === void 0) return; - if (!checkVal(val, object)) { - throw new Error( - `Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`, - ); - } - }; - for (const [fieldName, type] of Object.entries(validators)) checkField(fieldName, type, false); - for (const [fieldName, type] of Object.entries(optValidators)) - checkField(fieldName, type, true); - return object; - } - var _0n, _1n, _2n, u8a2, hexes, asciis, bitSet, bitMask, u8n, u8fr, validatorFns; - var init_utils2 = __esm({ - 'node_modules/@noble/curves/esm/abstract/utils.js'() { - _0n = BigInt(0); - _1n = BigInt(1); - _2n = BigInt(2); - u8a2 = a => a instanceof Uint8Array; - hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => - i.toString(16).padStart(2, '0'), - ); - asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; - bitSet = (n, pos, value) => { - return n | ((value ? _1n : _0n) << BigInt(pos)); - }; - bitMask = n => (_2n << BigInt(n - 1)) - _1n; - u8n = data => new Uint8Array(data); - u8fr = arr => Uint8Array.from(arr); - validatorFns = { - bigint: val => typeof val === 'bigint', - function: val => typeof val === 'function', - boolean: val => typeof val === 'boolean', - string: val => typeof val === 'string', - stringOrUint8Array: val => typeof val === 'string' || val instanceof Uint8Array, - isSafeInteger: val => Number.isSafeInteger(val), - array: val => Array.isArray(val), - field: (val, object) => object.Fp.isValid(val), - hash: val => typeof val === 'function' && Number.isSafeInteger(val.outputLen), - }; - }, - }); - - // node_modules/@noble/curves/esm/abstract/modular.js - function mod(a, b) { - const result = a % b; - return result >= _0n2 ? result : b + result; - } - function pow(num, power, modulo) { - if (modulo <= _0n2 || power < _0n2) throw new Error('Expected power/modulo > 0'); - if (modulo === _1n2) return _0n2; - let res = _1n2; - while (power > _0n2) { - if (power & _1n2) res = (res * num) % modulo; - num = (num * num) % modulo; - power >>= _1n2; - } - return res; - } - function invert(number, modulo) { - if (number === _0n2 || modulo <= _0n2) { - throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`); - } - let a = mod(number, modulo); - let b = modulo; - let x = _0n2, - y = _1n2, - u = _1n2, - v = _0n2; - while (a !== _0n2) { - const q = b / a; - const r = b % a; - const m = x - u * q; - const n = y - v * q; - (b = a), (a = r), (x = u), (y = v), (u = m), (v = n); - } - const gcd = b; - if (gcd !== _1n2) throw new Error('invert: does not exist'); - return mod(x, modulo); - } - function tonelliShanks(P) { - const legendreC = (P - _1n2) / _2n2; - let Q, S, Z; - for (Q = P - _1n2, S = 0; Q % _2n2 === _0n2; Q /= _2n2, S++); - for (Z = _2n2; Z < P && pow(Z, legendreC, P) !== P - _1n2; Z++); - if (S === 1) { - const p1div4 = (P + _1n2) / _4n; - return function tonelliFast(Fp3, n) { - const root = Fp3.pow(n, p1div4); - if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); - return root; - }; - } - const Q1div2 = (Q + _1n2) / _2n2; - return function tonelliSlow(Fp3, n) { - if (Fp3.pow(n, legendreC) === Fp3.neg(Fp3.ONE)) throw new Error('Cannot find square root'); - let r = S; - let g = Fp3.pow(Fp3.mul(Fp3.ONE, Z), Q); - let x = Fp3.pow(n, Q1div2); - let b = Fp3.pow(n, Q); - while (!Fp3.eql(b, Fp3.ONE)) { - if (Fp3.eql(b, Fp3.ZERO)) return Fp3.ZERO; - let m = 1; - for (let t2 = Fp3.sqr(b); m < r; m++) { - if (Fp3.eql(t2, Fp3.ONE)) break; - t2 = Fp3.sqr(t2); - } - const ge = Fp3.pow(g, _1n2 << BigInt(r - m - 1)); - g = Fp3.sqr(ge); - x = Fp3.mul(x, ge); - b = Fp3.mul(b, g); - r = m; - } - return x; - }; - } - function FpSqrt(P) { - if (P % _4n === _3n) { - const p1div4 = (P + _1n2) / _4n; - return function sqrt3mod4(Fp3, n) { - const root = Fp3.pow(n, p1div4); - if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); - return root; - }; - } - if (P % _8n === _5n) { - const c1 = (P - _5n) / _8n; - return function sqrt5mod8(Fp3, n) { - const n2 = Fp3.mul(n, _2n2); - const v = Fp3.pow(n2, c1); - const nv = Fp3.mul(n, v); - const i = Fp3.mul(Fp3.mul(nv, _2n2), v); - const root = Fp3.mul(nv, Fp3.sub(i, Fp3.ONE)); - if (!Fp3.eql(Fp3.sqr(root), n)) throw new Error('Cannot find square root'); - return root; - }; - } - if (P % _16n === _9n) { - } - return tonelliShanks(P); - } - function validateField(field) { - const initial = { - ORDER: 'bigint', - MASK: 'bigint', - BYTES: 'isSafeInteger', - BITS: 'isSafeInteger', - }; - const opts = FIELD_FIELDS.reduce((map, val) => { - map[val] = 'function'; - return map; - }, initial); - return validateObject(field, opts); - } - function FpPow(f, num, power) { - if (power < _0n2) throw new Error('Expected power > 0'); - if (power === _0n2) return f.ONE; - if (power === _1n2) return num; - let p = f.ONE; - let d = num; - while (power > _0n2) { - if (power & _1n2) p = f.mul(p, d); - d = f.sqr(d); - power >>= _1n2; - } - return p; - } - function FpInvertBatch(f, nums) { - const tmp = new Array(nums.length); - const lastMultiplied = nums.reduce((acc, num, i) => { - if (f.is0(num)) return acc; - tmp[i] = acc; - return f.mul(acc, num); - }, f.ONE); - const inverted = f.inv(lastMultiplied); - nums.reduceRight((acc, num, i) => { - if (f.is0(num)) return acc; - tmp[i] = f.mul(acc, tmp[i]); - return f.mul(acc, num); - }, inverted); - return tmp; - } - function nLength(n, nBitLength) { - const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length; - const nByteLength = Math.ceil(_nBitLength / 8); - return { nBitLength: _nBitLength, nByteLength }; - } - function Field(ORDER, bitLen2, isLE2 = false, redef = {}) { - if (ORDER <= _0n2) throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); - const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2); - if (BYTES > 2048) throw new Error('Field lengths over 2048 bytes are not supported'); - const sqrtP = FpSqrt(ORDER); - const f = Object.freeze({ - ORDER, - BITS, - BYTES, - MASK: bitMask(BITS), - ZERO: _0n2, - ONE: _1n2, - create: num => mod(num, ORDER), - isValid: num => { - if (typeof num !== 'bigint') - throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); - return _0n2 <= num && num < ORDER; - }, - is0: num => num === _0n2, - isOdd: num => (num & _1n2) === _1n2, - neg: num => mod(-num, ORDER), - eql: (lhs, rhs) => lhs === rhs, - sqr: num => mod(num * num, ORDER), - add: (lhs, rhs) => mod(lhs + rhs, ORDER), - sub: (lhs, rhs) => mod(lhs - rhs, ORDER), - mul: (lhs, rhs) => mod(lhs * rhs, ORDER), - pow: (num, power) => FpPow(f, num, power), - div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), - // Same as above, but doesn't normalize - sqrN: num => num * num, - addN: (lhs, rhs) => lhs + rhs, - subN: (lhs, rhs) => lhs - rhs, - mulN: (lhs, rhs) => lhs * rhs, - inv: num => invert(num, ORDER), - sqrt: redef.sqrt || (n => sqrtP(f, n)), - invertBatch: lst => FpInvertBatch(f, lst), - // TODO: do we really need constant cmov? - // We don't have const-time bigints anyway, so probably will be not very useful - cmov: (a, b, c) => (c ? b : a), - toBytes: num => (isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)), - fromBytes: bytes2 => { - if (bytes2.length !== BYTES) - throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`); - return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2); - }, - }); - return Object.freeze(f); - } - function getFieldBytesLength(fieldOrder) { - if (typeof fieldOrder !== 'bigint') throw new Error('field order must be bigint'); - const bitLength = fieldOrder.toString(2).length; - return Math.ceil(bitLength / 8); - } - function getMinHashLength(fieldOrder) { - const length = getFieldBytesLength(fieldOrder); - return length + Math.ceil(length / 2); - } - function mapHashToField(key, fieldOrder, isLE2 = false) { - const len = key.length; - const fieldLen = getFieldBytesLength(fieldOrder); - const minLen = getMinHashLength(fieldOrder); - if (len < 16 || len < minLen || len > 1024) - throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); - const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key); - const reduced = mod(num, fieldOrder - _1n2) + _1n2; - return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); - } - var _0n2, _1n2, _2n2, _3n, _4n, _5n, _8n, _9n, _16n, FIELD_FIELDS; - var init_modular = __esm({ - 'node_modules/@noble/curves/esm/abstract/modular.js'() { - init_utils2(); - _0n2 = BigInt(0); - _1n2 = BigInt(1); - _2n2 = BigInt(2); - _3n = BigInt(3); - _4n = BigInt(4); - _5n = BigInt(5); - _8n = BigInt(8); - _9n = BigInt(9); - _16n = BigInt(16); - FIELD_FIELDS = [ - 'create', - 'isValid', - 'is0', - 'neg', - 'inv', - 'sqrt', - 'sqr', - 'eql', - 'add', - 'sub', - 'mul', - 'pow', - 'div', - 'addN', - 'subN', - 'mulN', - 'sqrN', - ]; - }, - }); - - // node_modules/@noble/curves/esm/abstract/hash-to-curve.js - function validateDST(dst) { - if (dst instanceof Uint8Array) return dst; - if (typeof dst === 'string') return utf8ToBytes2(dst); - throw new Error('DST must be Uint8Array or string'); - } - function i2osp(value, length) { - if (value < 0 || value >= 1 << (8 * length)) { - throw new Error(`bad I2OSP call: value=${value} length=${length}`); - } - const res = Array.from({ length }).fill(0); - for (let i = length - 1; i >= 0; i--) { - res[i] = value & 255; - value >>>= 8; - } - return new Uint8Array(res); - } - function strxor(a, b) { - const arr = new Uint8Array(a.length); - for (let i = 0; i < a.length; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr; - } - function isBytes(item) { - if (!(item instanceof Uint8Array)) throw new Error('Uint8Array expected'); - } - function isNum(item) { - if (!Number.isSafeInteger(item)) throw new Error('number expected'); - } - function expand_message_xmd(msg, DST, lenInBytes, H) { - isBytes(msg); - isBytes(DST); - isNum(lenInBytes); - if (DST.length > 255) DST = H(concatBytes(utf8ToBytes2('H2C-OVERSIZE-DST-'), DST)); - const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; - const ell = Math.ceil(lenInBytes / b_in_bytes); - if (ell > 255) throw new Error('Invalid xmd length'); - const DST_prime = concatBytes(DST, i2osp(DST.length, 1)); - const Z_pad = i2osp(0, r_in_bytes); - const l_i_b_str = i2osp(lenInBytes, 2); - const b = new Array(ell); - const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); - b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime)); - for (let i = 1; i <= ell; i++) { - const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; - b[i] = H(concatBytes(...args)); - } - const pseudo_random_bytes = concatBytes(...b); - return pseudo_random_bytes.slice(0, lenInBytes); - } - function expand_message_xof(msg, DST, lenInBytes, k, H) { - isBytes(msg); - isBytes(DST); - isNum(lenInBytes); - if (DST.length > 255) { - const dkLen = Math.ceil((2 * k) / 8); - DST = H.create({ dkLen }).update(utf8ToBytes2('H2C-OVERSIZE-DST-')).update(DST).digest(); - } - if (lenInBytes > 65535 || DST.length > 255) - throw new Error('expand_message_xof: invalid lenInBytes'); - return H.create({ dkLen: lenInBytes }) - .update(msg) - .update(i2osp(lenInBytes, 2)) - .update(DST) - .update(i2osp(DST.length, 1)) - .digest(); - } - function hash_to_field(msg, count, options) { - validateObject(options, { - DST: 'stringOrUint8Array', - p: 'bigint', - m: 'isSafeInteger', - k: 'isSafeInteger', - hash: 'hash', - }); - const { p, k, m, hash, expand, DST: _DST } = options; - isBytes(msg); - isNum(count); - const DST = validateDST(_DST); - const log2p = p.toString(2).length; - const L = Math.ceil((log2p + k) / 8); - const len_in_bytes = count * m * L; - let prb; - if (expand === 'xmd') { - prb = expand_message_xmd(msg, DST, len_in_bytes, hash); - } else if (expand === 'xof') { - prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); - } else if (expand === '_internal_pass') { - prb = msg; - } else { - throw new Error('expand must be "xmd" or "xof"'); - } - const u = new Array(count); - for (let i = 0; i < count; i++) { - const e = new Array(m); - for (let j = 0; j < m; j++) { - const elm_offset = L * (j + i * m); - const tv = prb.subarray(elm_offset, elm_offset + L); - e[j] = mod(os2ip(tv), p); - } - u[i] = e; - } - return u; - } - function isogenyMap(field, map) { - const COEFF = map.map(i => Array.from(i).reverse()); - return (x, y) => { - const [xNum, xDen, yNum, yDen] = COEFF.map(val => - val.reduce((acc, i) => field.add(field.mul(acc, x), i)), - ); - x = field.div(xNum, xDen); - y = field.mul(y, field.div(yNum, yDen)); - return { x, y }; - }; - } - function createHasher(Point, mapToCurve, def) { - if (typeof mapToCurve !== 'function') throw new Error('mapToCurve() must be defined'); - return { - // Encodes byte string to elliptic curve. - // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 - hashToCurve(msg, options) { - const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); - const u0 = Point.fromAffine(mapToCurve(u[0])); - const u1 = Point.fromAffine(mapToCurve(u[1])); - const P = u0.add(u1).clearCofactor(); - P.assertValidity(); - return P; - }, - // Encodes byte string to elliptic curve. - // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 - encodeToCurve(msg, options) { - const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); - const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor(); - P.assertValidity(); - return P; - }, - }; - } - var os2ip; - var init_hash_to_curve = __esm({ - 'node_modules/@noble/curves/esm/abstract/hash-to-curve.js'() { - init_modular(); - init_utils2(); - os2ip = bytesToNumberBE; - }, - }); - - // node_modules/@noble/curves/esm/abstract/curve.js - function wNAF(c, bits) { - const constTimeNegate = (condition, item) => { - const neg = item.negate(); - return condition ? neg : item; - }; - const opts = W => { - const windows = Math.ceil(bits / W) + 1; - const windowSize = 2 ** (W - 1); - return { windows, windowSize }; - }; - return { - constTimeNegate, - // non-const time multiplication ladder - unsafeLadder(elm, n) { - let p = c.ZERO; - let d = elm; - while (n > _0n3) { - if (n & _1n3) p = p.add(d); - d = d.double(); - n >>= _1n3; - } - return p; - }, - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @returns precomputed point tables flattened to a single array - */ - precomputeWindow(elm, W) { - const { windows, windowSize } = opts(W); - const points = []; - let p = elm; - let base = p; - for (let window = 0; window < windows; window++) { - base = p; - points.push(base); - for (let i = 1; i < windowSize; i++) { - base = base.add(p); - points.push(base); - } - p = base.double(); - } - return points; - }, - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * @param W window size - * @param precomputes precomputed tables - * @param n scalar (we don't check here, but should be less than curve order) - * @returns real and fake (for const-time) points - */ - wNAF(W, precomputes, n) { - const { windows, windowSize } = opts(W); - let p = c.ZERO; - let f = c.BASE; - const mask = BigInt(2 ** W - 1); - const maxNumber = 2 ** W; - const shiftBy = BigInt(W); - for (let window = 0; window < windows; window++) { - const offset = window * windowSize; - let wbits = Number(n & mask); - n >>= shiftBy; - if (wbits > windowSize) { - wbits -= maxNumber; - n += _1n3; - } - const offset1 = offset; - const offset2 = offset + Math.abs(wbits) - 1; - const cond1 = window % 2 !== 0; - const cond2 = wbits < 0; - if (wbits === 0) { - f = f.add(constTimeNegate(cond1, precomputes[offset1])); - } else { - p = p.add(constTimeNegate(cond2, precomputes[offset2])); - } - } - return { p, f }; - }, - wNAFCached(P, precomputesMap, n, transform) { - const W = P._WINDOW_SIZE || 1; - let comp = precomputesMap.get(P); - if (!comp) { - comp = this.precomputeWindow(P, W); - if (W !== 1) { - precomputesMap.set(P, transform(comp)); - } - } - return this.wNAF(W, comp, n); - }, - }; - } - function validateBasic(curve) { - validateField(curve.Fp); - validateObject( - curve, - { - n: 'bigint', - h: 'bigint', - Gx: 'field', - Gy: 'field', - }, - { - nBitLength: 'isSafeInteger', - nByteLength: 'isSafeInteger', - }, - ); - return Object.freeze({ - ...nLength(curve.n, curve.nBitLength), - ...curve, - ...{ p: curve.Fp.ORDER }, - }); - } - var _0n3, _1n3; - var init_curve = __esm({ - 'node_modules/@noble/curves/esm/abstract/curve.js'() { - init_modular(); - init_utils2(); - _0n3 = BigInt(0); - _1n3 = BigInt(1); - }, - }); - - // node_modules/@noble/curves/esm/abstract/weierstrass.js - function validatePointOpts(curve) { - const opts = validateBasic(curve); - validateObject( - opts, - { - a: 'field', - b: 'field', - }, - { - allowedPrivateKeyLengths: 'array', - wrapPrivateKey: 'boolean', - isTorsionFree: 'function', - clearCofactor: 'function', - allowInfinityPoint: 'boolean', - fromBytes: 'function', - toBytes: 'function', - }, - ); - const { endo, Fp: Fp3, a } = opts; - if (endo) { - if (!Fp3.eql(a, Fp3.ZERO)) { - throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0'); - } - if ( - typeof endo !== 'object' || - typeof endo.beta !== 'bigint' || - typeof endo.splitScalar !== 'function' - ) { - throw new Error('Expected endomorphism with beta: bigint and splitScalar: function'); - } - } - return Object.freeze({ ...opts }); - } - function weierstrassPoints(opts) { - const CURVE = validatePointOpts(opts); - const { Fp: Fp3 } = CURVE; - const toBytes2 = - CURVE.toBytes || - ((_c, point, _isCompressed) => { - const a = point.toAffine(); - return concatBytes(Uint8Array.from([4]), Fp3.toBytes(a.x), Fp3.toBytes(a.y)); - }); - const fromBytes = - CURVE.fromBytes || - (bytes2 => { - const tail = bytes2.subarray(1); - const x = Fp3.fromBytes(tail.subarray(0, Fp3.BYTES)); - const y = Fp3.fromBytes(tail.subarray(Fp3.BYTES, 2 * Fp3.BYTES)); - return { x, y }; - }); - function weierstrassEquation(x) { - const { a, b } = CURVE; - const x2 = Fp3.sqr(x); - const x3 = Fp3.mul(x2, x); - return Fp3.add(Fp3.add(x3, Fp3.mul(x, a)), b); - } - if (!Fp3.eql(Fp3.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) - throw new Error('bad generator point: equation left != right'); - function isWithinCurveOrder(num) { - return typeof num === 'bigint' && _0n4 < num && num < CURVE.n; - } - function assertGE(num) { - if (!isWithinCurveOrder(num)) throw new Error('Expected valid bigint: 0 < bigint < curve.n'); - } - function normPrivateKeyToScalar(key) { - const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; - if (lengths && typeof key !== 'bigint') { - if (key instanceof Uint8Array) key = bytesToHex(key); - if (typeof key !== 'string' || !lengths.includes(key.length)) - throw new Error('Invalid key'); - key = key.padStart(nByteLength * 2, '0'); - } - let num; - try { - num = - typeof key === 'bigint' - ? key - : bytesToNumberBE(ensureBytes('private key', key, nByteLength)); - } catch (error) { - throw new Error( - `private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`, - ); - } - if (wrapPrivateKey) num = mod(num, n); - assertGE(num); - return num; - } - const pointPrecomputes = /* @__PURE__ */ new Map(); - function assertPrjPoint(other) { - if (!(other instanceof Point)) throw new Error('ProjectivePoint expected'); - } - class Point { - constructor(px, py, pz) { - this.px = px; - this.py = py; - this.pz = pz; - if (px == null || !Fp3.isValid(px)) throw new Error('x required'); - if (py == null || !Fp3.isValid(py)) throw new Error('y required'); - if (pz == null || !Fp3.isValid(pz)) throw new Error('z required'); - } - // Does not validate if the point is on-curve. - // Use fromHex instead, or call assertValidity() later. - static fromAffine(p) { - const { x, y } = p || {}; - if (!p || !Fp3.isValid(x) || !Fp3.isValid(y)) throw new Error('invalid affine point'); - if (p instanceof Point) throw new Error('projective point not allowed'); - const is0 = i => Fp3.eql(i, Fp3.ZERO); - if (is0(x) && is0(y)) return Point.ZERO; - return new Point(x, y, Fp3.ONE); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - /** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - */ - static normalizeZ(points) { - const toInv = Fp3.invertBatch(points.map(p => p.pz)); - return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); - } - /** - * Converts hash string or Uint8Array to Point. - * @param hex short/long ECDSA hex - */ - static fromHex(hex) { - const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex))); - P.assertValidity(); - return P; - } - // Multiplies generator point by privateKey. - static fromPrivateKey(privateKey) { - return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); - } - // "Private method", don't use it directly - _setWindowSize(windowSize) { - this._WINDOW_SIZE = windowSize; - pointPrecomputes.delete(this); - } - // A point on curve is valid if it conforms to equation. - assertValidity() { - if (this.is0()) { - if (CURVE.allowInfinityPoint && !Fp3.is0(this.py)) return; - throw new Error('bad point: ZERO'); - } - const { x, y } = this.toAffine(); - if (!Fp3.isValid(x) || !Fp3.isValid(y)) throw new Error('bad point: x or y not FE'); - const left = Fp3.sqr(y); - const right = weierstrassEquation(x); - if (!Fp3.eql(left, right)) throw new Error('bad point: equation left != right'); - if (!this.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup'); - } - hasEvenY() { - const { y } = this.toAffine(); - if (Fp3.isOdd) return !Fp3.isOdd(y); - throw new Error("Field doesn't support isOdd"); - } - /** - * Compare one point to another. - */ - equals(other) { - assertPrjPoint(other); - const { px: X1, py: Y1, pz: Z1 } = this; - const { px: X2, py: Y2, pz: Z2 } = other; - const U1 = Fp3.eql(Fp3.mul(X1, Z2), Fp3.mul(X2, Z1)); - const U2 = Fp3.eql(Fp3.mul(Y1, Z2), Fp3.mul(Y2, Z1)); - return U1 && U2; - } - /** - * Flips point to one corresponding to (x, -y) in Affine coordinates. - */ - negate() { - return new Point(this.px, Fp3.neg(this.py), this.pz); - } - // Renes-Costello-Batina exception-free doubling formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 3 - // Cost: 8M + 3S + 3*a + 2*b3 + 15add. - double() { - const { a, b } = CURVE; - const b3 = Fp3.mul(b, _3n2); - const { px: X1, py: Y1, pz: Z1 } = this; - let X3 = Fp3.ZERO, - Y3 = Fp3.ZERO, - Z3 = Fp3.ZERO; - let t0 = Fp3.mul(X1, X1); - let t1 = Fp3.mul(Y1, Y1); - let t2 = Fp3.mul(Z1, Z1); - let t3 = Fp3.mul(X1, Y1); - t3 = Fp3.add(t3, t3); - Z3 = Fp3.mul(X1, Z1); - Z3 = Fp3.add(Z3, Z3); - X3 = Fp3.mul(a, Z3); - Y3 = Fp3.mul(b3, t2); - Y3 = Fp3.add(X3, Y3); - X3 = Fp3.sub(t1, Y3); - Y3 = Fp3.add(t1, Y3); - Y3 = Fp3.mul(X3, Y3); - X3 = Fp3.mul(t3, X3); - Z3 = Fp3.mul(b3, Z3); - t2 = Fp3.mul(a, t2); - t3 = Fp3.sub(t0, t2); - t3 = Fp3.mul(a, t3); - t3 = Fp3.add(t3, Z3); - Z3 = Fp3.add(t0, t0); - t0 = Fp3.add(Z3, t0); - t0 = Fp3.add(t0, t2); - t0 = Fp3.mul(t0, t3); - Y3 = Fp3.add(Y3, t0); - t2 = Fp3.mul(Y1, Z1); - t2 = Fp3.add(t2, t2); - t0 = Fp3.mul(t2, t3); - X3 = Fp3.sub(X3, t0); - Z3 = Fp3.mul(t2, t1); - Z3 = Fp3.add(Z3, Z3); - Z3 = Fp3.add(Z3, Z3); - return new Point(X3, Y3, Z3); - } - // Renes-Costello-Batina exception-free addition formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 1 - // Cost: 12M + 0S + 3*a + 3*b3 + 23add. - add(other) { - assertPrjPoint(other); - const { px: X1, py: Y1, pz: Z1 } = this; - const { px: X2, py: Y2, pz: Z2 } = other; - let X3 = Fp3.ZERO, - Y3 = Fp3.ZERO, - Z3 = Fp3.ZERO; - const a = CURVE.a; - const b3 = Fp3.mul(CURVE.b, _3n2); - let t0 = Fp3.mul(X1, X2); - let t1 = Fp3.mul(Y1, Y2); - let t2 = Fp3.mul(Z1, Z2); - let t3 = Fp3.add(X1, Y1); - let t4 = Fp3.add(X2, Y2); - t3 = Fp3.mul(t3, t4); - t4 = Fp3.add(t0, t1); - t3 = Fp3.sub(t3, t4); - t4 = Fp3.add(X1, Z1); - let t5 = Fp3.add(X2, Z2); - t4 = Fp3.mul(t4, t5); - t5 = Fp3.add(t0, t2); - t4 = Fp3.sub(t4, t5); - t5 = Fp3.add(Y1, Z1); - X3 = Fp3.add(Y2, Z2); - t5 = Fp3.mul(t5, X3); - X3 = Fp3.add(t1, t2); - t5 = Fp3.sub(t5, X3); - Z3 = Fp3.mul(a, t4); - X3 = Fp3.mul(b3, t2); - Z3 = Fp3.add(X3, Z3); - X3 = Fp3.sub(t1, Z3); - Z3 = Fp3.add(t1, Z3); - Y3 = Fp3.mul(X3, Z3); - t1 = Fp3.add(t0, t0); - t1 = Fp3.add(t1, t0); - t2 = Fp3.mul(a, t2); - t4 = Fp3.mul(b3, t4); - t1 = Fp3.add(t1, t2); - t2 = Fp3.sub(t0, t2); - t2 = Fp3.mul(a, t2); - t4 = Fp3.add(t4, t2); - t0 = Fp3.mul(t1, t4); - Y3 = Fp3.add(Y3, t0); - t0 = Fp3.mul(t5, t4); - X3 = Fp3.mul(t3, X3); - X3 = Fp3.sub(X3, t0); - t0 = Fp3.mul(t3, t1); - Z3 = Fp3.mul(t5, Z3); - Z3 = Fp3.add(Z3, t0); - return new Point(X3, Y3, Z3); - } - subtract(other) { - return this.add(other.negate()); - } - is0() { - return this.equals(Point.ZERO); - } - wNAF(n) { - return wnaf.wNAFCached(this, pointPrecomputes, n, comp => { - const toInv = Fp3.invertBatch(comp.map(p => p.pz)); - return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); - }); - } - /** - * Non-constant-time multiplication. Uses double-and-add algorithm. - * It's faster, but should only be used when you don't care about - * an exposed private key e.g. sig verification, which works over *public* keys. - */ - multiplyUnsafe(n) { - const I = Point.ZERO; - if (n === _0n4) return I; - assertGE(n); - if (n === _1n4) return this; - const { endo } = CURVE; - if (!endo) return wnaf.unsafeLadder(this, n); - let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); - let k1p = I; - let k2p = I; - let d = this; - while (k1 > _0n4 || k2 > _0n4) { - if (k1 & _1n4) k1p = k1p.add(d); - if (k2 & _1n4) k2p = k2p.add(d); - d = d.double(); - k1 >>= _1n4; - k2 >>= _1n4; - } - if (k1neg) k1p = k1p.negate(); - if (k2neg) k2p = k2p.negate(); - k2p = new Point(Fp3.mul(k2p.px, endo.beta), k2p.py, k2p.pz); - return k1p.add(k2p); - } - /** - * Constant time multiplication. - * Uses wNAF method. Windowed method may be 10% faster, - * but takes 2x longer to generate and consumes 2x memory. - * Uses precomputes when available. - * Uses endomorphism for Koblitz curves. - * @param scalar by which the point would be multiplied - * @returns New point - */ - multiply(scalar) { - assertGE(scalar); - let n = scalar; - let point, fake; - const { endo } = CURVE; - if (endo) { - const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); - let { p: k1p, f: f1p } = this.wNAF(k1); - let { p: k2p, f: f2p } = this.wNAF(k2); - k1p = wnaf.constTimeNegate(k1neg, k1p); - k2p = wnaf.constTimeNegate(k2neg, k2p); - k2p = new Point(Fp3.mul(k2p.px, endo.beta), k2p.py, k2p.pz); - point = k1p.add(k2p); - fake = f1p.add(f2p); - } else { - const { p, f } = this.wNAF(n); - point = p; - fake = f; - } - return Point.normalizeZ([point, fake])[0]; - } - /** - * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. - * Not using Strauss-Shamir trick: precomputation tables are faster. - * The trick could be useful if both P and Q are not G (not in our case). - * @returns non-zero affine point - */ - multiplyAndAddUnsafe(Q, a, b) { - const G = Point.BASE; - const mul = (P, a2) => - a2 === _0n4 || a2 === _1n4 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2); - const sum = mul(this, a).add(mul(Q, b)); - return sum.is0() ? void 0 : sum; - } - // Converts Projective point to affine (x, y) coordinates. - // Can accept precomputed Z^-1 - for example, from invertBatch. - // (x, y, z) ∋ (x=x/z, y=y/z) - toAffine(iz) { - const { px: x, py: y, pz: z } = this; - const is0 = this.is0(); - if (iz == null) iz = is0 ? Fp3.ONE : Fp3.inv(z); - const ax = Fp3.mul(x, iz); - const ay = Fp3.mul(y, iz); - const zz = Fp3.mul(z, iz); - if (is0) return { x: Fp3.ZERO, y: Fp3.ZERO }; - if (!Fp3.eql(zz, Fp3.ONE)) throw new Error('invZ was invalid'); - return { x: ax, y: ay }; - } - isTorsionFree() { - const { h: cofactor, isTorsionFree } = CURVE; - if (cofactor === _1n4) return true; - if (isTorsionFree) return isTorsionFree(Point, this); - throw new Error('isTorsionFree() has not been declared for the elliptic curve'); - } - clearCofactor() { - const { h: cofactor, clearCofactor } = CURVE; - if (cofactor === _1n4) return this; - if (clearCofactor) return clearCofactor(Point, this); - return this.multiplyUnsafe(CURVE.h); - } - toRawBytes(isCompressed = true) { - this.assertValidity(); - return toBytes2(Point, this, isCompressed); - } - toHex(isCompressed = true) { - return bytesToHex(this.toRawBytes(isCompressed)); - } - } - Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp3.ONE); - Point.ZERO = new Point(Fp3.ZERO, Fp3.ONE, Fp3.ZERO); - const _bits = CURVE.nBitLength; - const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); - return { - CURVE, - ProjectivePoint: Point, - normPrivateKeyToScalar, - weierstrassEquation, - isWithinCurveOrder, - }; - } - function SWUFpSqrtRatio(Fp3, Z) { - const q = Fp3.ORDER; - let l = _0n4; - for (let o = q - _1n4; o % _2n3 === _0n4; o /= _2n3) l += _1n4; - const c1 = l; - const _2n_pow_c1_1 = _2n3 << (c1 - _1n4 - _1n4); - const _2n_pow_c1 = _2n_pow_c1_1 * _2n3; - const c2 = (q - _1n4) / _2n_pow_c1; - const c3 = (c2 - _1n4) / _2n3; - const c4 = _2n_pow_c1 - _1n4; - const c5 = _2n_pow_c1_1; - const c6 = Fp3.pow(Z, c2); - const c7 = Fp3.pow(Z, (c2 + _1n4) / _2n3); - let sqrtRatio = (u, v) => { - let tv1 = c6; - let tv2 = Fp3.pow(v, c4); - let tv3 = Fp3.sqr(tv2); - tv3 = Fp3.mul(tv3, v); - let tv5 = Fp3.mul(u, tv3); - tv5 = Fp3.pow(tv5, c3); - tv5 = Fp3.mul(tv5, tv2); - tv2 = Fp3.mul(tv5, v); - tv3 = Fp3.mul(tv5, u); - let tv4 = Fp3.mul(tv3, tv2); - tv5 = Fp3.pow(tv4, c5); - let isQR = Fp3.eql(tv5, Fp3.ONE); - tv2 = Fp3.mul(tv3, c7); - tv5 = Fp3.mul(tv4, tv1); - tv3 = Fp3.cmov(tv2, tv3, isQR); - tv4 = Fp3.cmov(tv5, tv4, isQR); - for (let i = c1; i > _1n4; i--) { - let tv52 = i - _2n3; - tv52 = _2n3 << (tv52 - _1n4); - let tvv5 = Fp3.pow(tv4, tv52); - const e1 = Fp3.eql(tvv5, Fp3.ONE); - tv2 = Fp3.mul(tv3, tv1); - tv1 = Fp3.mul(tv1, tv1); - tvv5 = Fp3.mul(tv4, tv1); - tv3 = Fp3.cmov(tv2, tv3, e1); - tv4 = Fp3.cmov(tvv5, tv4, e1); - } - return { isValid: isQR, value: tv3 }; - }; - if (Fp3.ORDER % _4n2 === _3n2) { - const c12 = (Fp3.ORDER - _3n2) / _4n2; - const c22 = Fp3.sqrt(Fp3.neg(Z)); - sqrtRatio = (u, v) => { - let tv1 = Fp3.sqr(v); - const tv2 = Fp3.mul(u, v); - tv1 = Fp3.mul(tv1, tv2); - let y1 = Fp3.pow(tv1, c12); - y1 = Fp3.mul(y1, tv2); - const y2 = Fp3.mul(y1, c22); - const tv3 = Fp3.mul(Fp3.sqr(y1), v); - const isQR = Fp3.eql(tv3, u); - let y = Fp3.cmov(y2, y1, isQR); - return { isValid: isQR, value: y }; - }; - } - return sqrtRatio; - } - function mapToCurveSimpleSWU(Fp3, opts) { - validateField(Fp3); - if (!Fp3.isValid(opts.A) || !Fp3.isValid(opts.B) || !Fp3.isValid(opts.Z)) - throw new Error('mapToCurveSimpleSWU: invalid opts'); - const sqrtRatio = SWUFpSqrtRatio(Fp3, opts.Z); - if (!Fp3.isOdd) throw new Error('Fp.isOdd is not implemented!'); - return u => { - let tv1, tv2, tv3, tv4, tv5, tv6, x, y; - tv1 = Fp3.sqr(u); - tv1 = Fp3.mul(tv1, opts.Z); - tv2 = Fp3.sqr(tv1); - tv2 = Fp3.add(tv2, tv1); - tv3 = Fp3.add(tv2, Fp3.ONE); - tv3 = Fp3.mul(tv3, opts.B); - tv4 = Fp3.cmov(opts.Z, Fp3.neg(tv2), !Fp3.eql(tv2, Fp3.ZERO)); - tv4 = Fp3.mul(tv4, opts.A); - tv2 = Fp3.sqr(tv3); - tv6 = Fp3.sqr(tv4); - tv5 = Fp3.mul(tv6, opts.A); - tv2 = Fp3.add(tv2, tv5); - tv2 = Fp3.mul(tv2, tv3); - tv6 = Fp3.mul(tv6, tv4); - tv5 = Fp3.mul(tv6, opts.B); - tv2 = Fp3.add(tv2, tv5); - x = Fp3.mul(tv1, tv3); - const { isValid, value } = sqrtRatio(tv2, tv6); - y = Fp3.mul(tv1, u); - y = Fp3.mul(y, value); - x = Fp3.cmov(x, tv3, isValid); - y = Fp3.cmov(y, value, isValid); - const e1 = Fp3.isOdd(u) === Fp3.isOdd(y); - y = Fp3.cmov(Fp3.neg(y), y, e1); - x = Fp3.div(x, tv4); - return { x, y }; - }; - } - var b2n, h2b, _0n4, _1n4, _2n3, _3n2, _4n2; - var init_weierstrass = __esm({ - 'node_modules/@noble/curves/esm/abstract/weierstrass.js'() { - init_modular(); - init_utils2(); - init_utils2(); - init_curve(); - ({ bytesToNumberBE: b2n, hexToBytes: h2b } = utils_exports); - _0n4 = BigInt(0); - _1n4 = BigInt(1); - _2n3 = BigInt(2); - _3n2 = BigInt(3); - _4n2 = BigInt(4); - }, - }); - - // node_modules/@noble/curves/esm/abstract/bls.js - function bls(CURVE) { - const { Fp: Fp3, Fr: Fr2, Fp2: Fp22, Fp6: Fp62, Fp12: Fp122 } = CURVE.fields; - const BLS_X_LEN2 = bitLen(CURVE.params.x); - function calcPairingPrecomputes(p) { - const { x, y } = p; - const Qx = x, - Qy = y, - Qz = Fp22.ONE; - let Rx = Qx, - Ry = Qy, - Rz = Qz; - let ell_coeff = []; - for (let i = BLS_X_LEN2 - 2; i >= 0; i--) { - let t0 = Fp22.sqr(Ry); - let t1 = Fp22.sqr(Rz); - let t2 = Fp22.multiplyByB(Fp22.mul(t1, _3n3)); - let t3 = Fp22.mul(t2, _3n3); - let t4 = Fp22.sub(Fp22.sub(Fp22.sqr(Fp22.add(Ry, Rz)), t1), t0); - ell_coeff.push([ - Fp22.sub(t2, t0), - Fp22.mul(Fp22.sqr(Rx), _3n3), - Fp22.neg(t4), - // -T4 - ]); - Rx = Fp22.div(Fp22.mul(Fp22.mul(Fp22.sub(t0, t3), Rx), Ry), _2n4); - Ry = Fp22.sub(Fp22.sqr(Fp22.div(Fp22.add(t0, t3), _2n4)), Fp22.mul(Fp22.sqr(t2), _3n3)); - Rz = Fp22.mul(t0, t4); - if (bitGet(CURVE.params.x, i)) { - let t02 = Fp22.sub(Ry, Fp22.mul(Qy, Rz)); - let t12 = Fp22.sub(Rx, Fp22.mul(Qx, Rz)); - ell_coeff.push([ - Fp22.sub(Fp22.mul(t02, Qx), Fp22.mul(t12, Qy)), - Fp22.neg(t02), - t12, - // T1 - ]); - let t22 = Fp22.sqr(t12); - let t32 = Fp22.mul(t22, t12); - let t42 = Fp22.mul(t22, Rx); - let t5 = Fp22.add(Fp22.sub(t32, Fp22.mul(t42, _2n4)), Fp22.mul(Fp22.sqr(t02), Rz)); - Rx = Fp22.mul(t12, t5); - Ry = Fp22.sub(Fp22.mul(Fp22.sub(t42, t5), t02), Fp22.mul(t32, Ry)); - Rz = Fp22.mul(Rz, t32); - } - } - return ell_coeff; - } - function millerLoop(ell, g1) { - const { x } = CURVE.params; - const Px = g1[0]; - const Py = g1[1]; - let f12 = Fp122.ONE; - for (let j = 0, i = BLS_X_LEN2 - 2; i >= 0; i--, j++) { - const E = ell[j]; - f12 = Fp122.multiplyBy014(f12, E[0], Fp22.mul(E[1], Px), Fp22.mul(E[2], Py)); - if (bitGet(x, i)) { - j += 1; - const F = ell[j]; - f12 = Fp122.multiplyBy014(f12, F[0], Fp22.mul(F[1], Px), Fp22.mul(F[2], Py)); - } - if (i !== 0) f12 = Fp122.sqr(f12); - } - return Fp122.conjugate(f12); - } - const utils = { - randomPrivateKey: () => { - const length = getMinHashLength(Fr2.ORDER); - return mapHashToField(CURVE.randomBytes(length), Fr2.ORDER); - }, - calcPairingPrecomputes, - }; - const G1_ = weierstrassPoints({ n: Fr2.ORDER, ...CURVE.G1 }); - const G1 = Object.assign( - G1_, - createHasher(G1_.ProjectivePoint, CURVE.G1.mapToCurve, { - ...CURVE.htfDefaults, - ...CURVE.G1.htfDefaults, - }), - ); - function pairingPrecomputes(point) { - const p = point; - if (p._PPRECOMPUTES) return p._PPRECOMPUTES; - p._PPRECOMPUTES = calcPairingPrecomputes(point.toAffine()); - return p._PPRECOMPUTES; - } - const G2_ = weierstrassPoints({ n: Fr2.ORDER, ...CURVE.G2 }); - const G2 = Object.assign( - G2_, - createHasher(G2_.ProjectivePoint, CURVE.G2.mapToCurve, { - ...CURVE.htfDefaults, - ...CURVE.G2.htfDefaults, - }), - ); - const { ShortSignature } = CURVE.G1; - const { Signature } = CURVE.G2; - function pairing(Q, P, withFinalExponent = true) { - if (Q.equals(G1.ProjectivePoint.ZERO) || P.equals(G2.ProjectivePoint.ZERO)) - throw new Error('pairing is not available for ZERO point'); - Q.assertValidity(); - P.assertValidity(); - const Qa = Q.toAffine(); - const looped = millerLoop(pairingPrecomputes(P), [Qa.x, Qa.y]); - return withFinalExponent ? Fp122.finalExponentiate(looped) : looped; - } - function normP1(point) { - return point instanceof G1.ProjectivePoint ? point : G1.ProjectivePoint.fromHex(point); - } - function normP1Hash(point, htfOpts) { - return point instanceof G1.ProjectivePoint - ? point - : G1.hashToCurve(ensureBytes('point', point), htfOpts); - } - function normP2(point) { - return point instanceof G2.ProjectivePoint ? point : Signature.fromHex(point); - } - function normP2Hash(point, htfOpts) { - return point instanceof G2.ProjectivePoint - ? point - : G2.hashToCurve(ensureBytes('point', point), htfOpts); - } - function getPublicKey(privateKey) { - return G1.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); - } - function getPublicKeyForShortSignatures(privateKey) { - return G2.ProjectivePoint.fromPrivateKey(privateKey).toRawBytes(true); - } - function sign(message, privateKey, htfOpts) { - const msgPoint = normP2Hash(message, htfOpts); - msgPoint.assertValidity(); - const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); - if (message instanceof G2.ProjectivePoint) return sigPoint; - return Signature.toRawBytes(sigPoint); - } - function signShortSignature(message, privateKey, htfOpts) { - const msgPoint = normP1Hash(message, htfOpts); - msgPoint.assertValidity(); - const sigPoint = msgPoint.multiply(G1.normPrivateKeyToScalar(privateKey)); - if (message instanceof G1.ProjectivePoint) return sigPoint; - return ShortSignature.toRawBytes(sigPoint); - } - function verify(signature, message, publicKey, htfOpts) { - const P = normP1(publicKey); - const Hm = normP2Hash(message, htfOpts); - const G = G1.ProjectivePoint.BASE; - const S = normP2(signature); - const ePHm = pairing(P.negate(), Hm, false); - const eGS = pairing(G, S, false); - const exp = Fp122.finalExponentiate(Fp122.mul(eGS, ePHm)); - return Fp122.eql(exp, Fp122.ONE); - } - function verifyShortSignature(signature, message, publicKey, htfOpts) { - const P = normP2(publicKey); - const Hm = normP1Hash(message, htfOpts); - const G = G2.ProjectivePoint.BASE; - const S = normP1(signature); - const eHmP = pairing(Hm, P, false); - const eSG = pairing(S, G.negate(), false); - const exp = Fp122.finalExponentiate(Fp122.mul(eSG, eHmP)); - return Fp122.eql(exp, Fp122.ONE); - } - function aggregatePublicKeys(publicKeys) { - if (!publicKeys.length) throw new Error('Expected non-empty array'); - const agg = publicKeys.map(normP1).reduce((sum, p) => sum.add(p), G1.ProjectivePoint.ZERO); - const aggAffine = agg; - if (publicKeys[0] instanceof G1.ProjectivePoint) { - aggAffine.assertValidity(); - return aggAffine; - } - return aggAffine.toRawBytes(true); - } - function aggregateSignatures(signatures) { - if (!signatures.length) throw new Error('Expected non-empty array'); - const agg = signatures.map(normP2).reduce((sum, s) => sum.add(s), G2.ProjectivePoint.ZERO); - const aggAffine = agg; - if (signatures[0] instanceof G2.ProjectivePoint) { - aggAffine.assertValidity(); - return aggAffine; - } - return Signature.toRawBytes(aggAffine); - } - function aggregateShortSignatures(signatures) { - if (!signatures.length) throw new Error('Expected non-empty array'); - const agg = signatures.map(normP1).reduce((sum, s) => sum.add(s), G1.ProjectivePoint.ZERO); - const aggAffine = agg; - if (signatures[0] instanceof G1.ProjectivePoint) { - aggAffine.assertValidity(); - return aggAffine; - } - return ShortSignature.toRawBytes(aggAffine); - } - function verifyBatch(signature, messages, publicKeys, htfOpts) { - if (!messages.length) throw new Error('Expected non-empty messages array'); - if (publicKeys.length !== messages.length) - throw new Error('Pubkey count should equal msg count'); - const sig = normP2(signature); - const nMessages = messages.map(i => normP2Hash(i, htfOpts)); - const nPublicKeys = publicKeys.map(normP1); - try { - const paired = []; - for (const message of new Set(nMessages)) { - const groupPublicKey = nMessages.reduce( - (groupPublicKey2, subMessage, i) => - subMessage === message ? groupPublicKey2.add(nPublicKeys[i]) : groupPublicKey2, - G1.ProjectivePoint.ZERO, - ); - paired.push(pairing(groupPublicKey, message, false)); - } - paired.push(pairing(G1.ProjectivePoint.BASE.negate(), sig, false)); - const product = paired.reduce((a, b) => Fp122.mul(a, b), Fp122.ONE); - const exp = Fp122.finalExponentiate(product); - return Fp122.eql(exp, Fp122.ONE); - } catch { - return false; - } - } - G1.ProjectivePoint.BASE._setWindowSize(4); - return { - getPublicKey, - getPublicKeyForShortSignatures, - sign, - signShortSignature, - verify, - verifyBatch, - verifyShortSignature, - aggregatePublicKeys, - aggregateSignatures, - aggregateShortSignatures, - millerLoop, - pairing, - G1, - G2, - Signature, - ShortSignature, - fields: { - Fr: Fr2, - Fp: Fp3, - Fp2: Fp22, - Fp6: Fp62, - Fp12: Fp122, - }, - params: { - x: CURVE.params.x, - r: CURVE.params.r, - G1b: CURVE.G1.b, - G2b: CURVE.G2.b, - }, - utils, - }; - } - var _2n4, _3n3; - var init_bls = __esm({ - 'node_modules/@noble/curves/esm/abstract/bls.js'() { - init_modular(); - init_utils2(); - init_hash_to_curve(); - init_weierstrass(); - _2n4 = BigInt(2); - _3n3 = BigInt(3); - }, - }); - - // node_modules/@noble/curves/esm/bls12-381.js - function Fp4Square(a, b) { - const a2 = Fp2.sqr(a); - const b2 = Fp2.sqr(b); - return { - first: Fp2.add(Fp2.mulByNonresidue(b2), a2), - second: Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(a, b)), a2), b2), - // (a + b)² - a² - b² - }; - } - function psi(x, y) { - const x2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wsq_inv, x), 1), wsq).c0.c0; - const y2 = Fp12.mul(Fp12.frobeniusMap(Fp12.multiplyByFp2(wcu_inv, y), 1), wcu).c0.c0; - return [x2, y2]; - } - function G2psi(c, P) { - const affine = P.toAffine(); - const p = psi(affine.x, affine.y); - return new c(p[0], p[1], Fp2.ONE); - } - function psi2(x, y) { - return [Fp2.mul(x, PSI2_C1), Fp2.neg(y)]; - } - function G2psi2(c, P) { - const affine = P.toAffine(); - const p = psi2(affine.x, affine.y); - return new c(p[0], p[1], Fp2.ONE); - } - function signatureG1ToRawBytes(point) { - point.assertValidity(); - const isZero = point.equals(bls12_381.G1.ProjectivePoint.ZERO); - const { x, y } = point.toAffine(); - if (isZero) return COMPRESSED_ZERO.slice(); - const P = Fp.ORDER; - let num; - num = bitSet(x, C_BIT_POS, Boolean((y * _2n5) / P)); - num = bitSet(num, S_BIT_POS, true); - return numberToBytesBE(num, Fp.BYTES); - } - function signatureG2ToRawBytes(point) { - point.assertValidity(); - const len = Fp.BYTES; - if (point.equals(bls12_381.G2.ProjectivePoint.ZERO)) - return concatBytes(COMPRESSED_ZERO, numberToBytesBE(_0n5, len)); - const { x, y } = point.toAffine(); - const { re: x0, im: x1 } = Fp2.reim(x); - const { re: y0, im: y1 } = Fp2.reim(y); - const tmp = y1 > _0n5 ? y1 * _2n5 : y0 * _2n5; - const aflag1 = Boolean((tmp / Fp.ORDER) & _1n5); - const z1 = bitSet(bitSet(x1, 381, aflag1), S_BIT_POS, true); - const z2 = x0; - return concatBytes(numberToBytesBE(z1, len), numberToBytesBE(z2, len)); - } - var _0n5, - _1n5, - _2n5, - _3n4, - _4n3, - _8n2, - _16n2, - Fp_raw, - Fp, - Fr, - Fp2Add, - Fp2Subtract, - Fp2Multiply, - Fp2Square, - FP2_ORDER, - Fp2, - FP2_FROBENIUS_COEFFICIENTS, - rv1, - FP2_ROOTS_OF_UNITY, - Fp6Add, - Fp6Subtract, - Fp6Multiply, - Fp6Square, - Fp6, - FP6_FROBENIUS_COEFFICIENTS_1, - FP6_FROBENIUS_COEFFICIENTS_2, - BLS_X, - BLS_X_LEN, - Fp12Add, - Fp12Subtract, - Fp12Multiply, - Fp12Square, - Fp12, - FP12_FROBENIUS_COEFFICIENTS, - isogenyMapG2, - isogenyMapG1, - G2_SWU, - G1_SWU, - ut_root, - wsq, - wcu, - wsq_inv, - wcu_inv, - PSI2_C1, - htfDefaults, - C_BIT_POS, - I_BIT_POS, - S_BIT_POS, - COMPRESSED_ZERO, - bls12_381; - var init_bls12_381 = __esm({ - 'node_modules/@noble/curves/esm/bls12-381.js'() { - init_sha256(); - init_utils(); - init_bls(); - init_modular(); - init_utils2(); - init_weierstrass(); - init_hash_to_curve(); - _0n5 = BigInt(0); - _1n5 = BigInt(1); - _2n5 = BigInt(2); - _3n4 = BigInt(3); - _4n3 = BigInt(4); - _8n2 = BigInt(8); - _16n2 = BigInt(16); - Fp_raw = BigInt( - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab', - ); - Fp = Field(Fp_raw); - Fr = Field(BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001')); - Fp2Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ - c0: Fp.add(c0, r0), - c1: Fp.add(c1, r1), - }); - Fp2Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ - c0: Fp.sub(c0, r0), - c1: Fp.sub(c1, r1), - }); - Fp2Multiply = ({ c0, c1 }, rhs) => { - if (typeof rhs === 'bigint') return { c0: Fp.mul(c0, rhs), c1: Fp.mul(c1, rhs) }; - const { c0: r0, c1: r1 } = rhs; - let t1 = Fp.mul(c0, r0); - let t2 = Fp.mul(c1, r1); - const o0 = Fp.sub(t1, t2); - const o1 = Fp.sub(Fp.mul(Fp.add(c0, c1), Fp.add(r0, r1)), Fp.add(t1, t2)); - return { c0: o0, c1: o1 }; - }; - Fp2Square = ({ c0, c1 }) => { - const a = Fp.add(c0, c1); - const b = Fp.sub(c0, c1); - const c = Fp.add(c0, c0); - return { c0: Fp.mul(a, b), c1: Fp.mul(c, c1) }; - }; - FP2_ORDER = Fp_raw * Fp_raw; - Fp2 = { - ORDER: FP2_ORDER, - BITS: bitLen(FP2_ORDER), - BYTES: Math.ceil(bitLen(FP2_ORDER) / 8), - MASK: bitMask(bitLen(FP2_ORDER)), - ZERO: { c0: Fp.ZERO, c1: Fp.ZERO }, - ONE: { c0: Fp.ONE, c1: Fp.ZERO }, - create: num => num, - isValid: ({ c0, c1 }) => typeof c0 === 'bigint' && typeof c1 === 'bigint', - is0: ({ c0, c1 }) => Fp.is0(c0) && Fp.is0(c1), - eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp.eql(c0, r0) && Fp.eql(c1, r1), - neg: ({ c0, c1 }) => ({ c0: Fp.neg(c0), c1: Fp.neg(c1) }), - pow: (num, power) => FpPow(Fp2, num, power), - invertBatch: nums => FpInvertBatch(Fp2, nums), - // Normalized - add: Fp2Add, - sub: Fp2Subtract, - mul: Fp2Multiply, - sqr: Fp2Square, - // NonNormalized stuff - addN: Fp2Add, - subN: Fp2Subtract, - mulN: Fp2Multiply, - sqrN: Fp2Square, - // Why inversion for bigint inside Fp instead of Fp2? it is even used in that context? - div: (lhs, rhs) => - Fp2.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp2.inv(rhs)), - inv: ({ c0: a, c1: b }) => { - const factor = Fp.inv(Fp.create(a * a + b * b)); - return { c0: Fp.mul(factor, Fp.create(a)), c1: Fp.mul(factor, Fp.create(-b)) }; - }, - sqrt: num => { - if (Fp2.eql(num, Fp2.ZERO)) return Fp2.ZERO; - const candidateSqrt = Fp2.pow(num, (Fp2.ORDER + _8n2) / _16n2); - const check = Fp2.div(Fp2.sqr(candidateSqrt), num); - const R = FP2_ROOTS_OF_UNITY; - const divisor = [R[0], R[2], R[4], R[6]].find(r => Fp2.eql(r, check)); - if (!divisor) throw new Error('No root'); - const index = R.indexOf(divisor); - const root = R[index / 2]; - if (!root) throw new Error('Invalid root'); - const x1 = Fp2.div(candidateSqrt, root); - const x2 = Fp2.neg(x1); - const { re: re1, im: im1 } = Fp2.reim(x1); - const { re: re2, im: im2 } = Fp2.reim(x2); - if (im1 > im2 || (im1 === im2 && re1 > re2)) return x1; - return x2; - }, - // Same as sgn0_m_eq_2 in RFC 9380 - isOdd: x => { - const { re: x0, im: x1 } = Fp2.reim(x); - const sign_0 = x0 % _2n5; - const zero_0 = x0 === _0n5; - const sign_1 = x1 % _2n5; - return BigInt(sign_0 || (zero_0 && sign_1)) == _1n5; - }, - // Bytes util - fromBytes(b) { - if (b.length !== Fp2.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); - return { - c0: Fp.fromBytes(b.subarray(0, Fp.BYTES)), - c1: Fp.fromBytes(b.subarray(Fp.BYTES)), - }; - }, - toBytes: ({ c0, c1 }) => concatBytes(Fp.toBytes(c0), Fp.toBytes(c1)), - cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ - c0: Fp.cmov(c0, r0, c), - c1: Fp.cmov(c1, r1, c), - }), - // Specific utils - // toString() { - // return `Fp2(${this.c0} + ${this.c1}×i)`; - // } - reim: ({ c0, c1 }) => ({ re: c0, im: c1 }), - // multiply by u + 1 - mulByNonresidue: ({ c0, c1 }) => ({ c0: Fp.sub(c0, c1), c1: Fp.add(c0, c1) }), - multiplyByB: ({ c0, c1 }) => { - let t0 = Fp.mul(c0, _4n3); - let t1 = Fp.mul(c1, _4n3); - return { c0: Fp.sub(t0, t1), c1: Fp.add(t0, t1) }; - }, - fromBigTuple: tuple => { - if (tuple.length !== 2) throw new Error('Invalid tuple'); - const fps = tuple.map(n => Fp.create(n)); - return { c0: fps[0], c1: fps[1] }; - }, - frobeniusMap: ({ c0, c1 }, power) => ({ - c0, - c1: Fp.mul(c1, FP2_FROBENIUS_COEFFICIENTS[power % 2]), - }), - }; - FP2_FROBENIUS_COEFFICIENTS = [ - BigInt('0x1'), - BigInt( - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', - ), - ].map(item => Fp.create(item)); - rv1 = BigInt( - '0x6af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', - ); - FP2_ROOTS_OF_UNITY = [ - [_1n5, _0n5], - [rv1, -rv1], - [_0n5, _1n5], - [rv1, rv1], - [-_1n5, _0n5], - [-rv1, rv1], - [_0n5, -_1n5], - [-rv1, -rv1], - ].map(pair => Fp2.fromBigTuple(pair)); - Fp6Add = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ - c0: Fp2.add(c0, r0), - c1: Fp2.add(c1, r1), - c2: Fp2.add(c2, r2), - }); - Fp6Subtract = ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => ({ - c0: Fp2.sub(c0, r0), - c1: Fp2.sub(c1, r1), - c2: Fp2.sub(c2, r2), - }); - Fp6Multiply = ({ c0, c1, c2 }, rhs) => { - if (typeof rhs === 'bigint') { - return { - c0: Fp2.mul(c0, rhs), - c1: Fp2.mul(c1, rhs), - c2: Fp2.mul(c2, rhs), - }; - } - const { c0: r0, c1: r1, c2: r2 } = rhs; - const t0 = Fp2.mul(c0, r0); - const t1 = Fp2.mul(c1, r1); - const t2 = Fp2.mul(c2, r2); - return { - // t0 + (c1 + c2) * (r1 * r2) - (T1 + T2) * (u + 1) - c0: Fp2.add( - t0, - Fp2.mulByNonresidue( - Fp2.sub(Fp2.mul(Fp2.add(c1, c2), Fp2.add(r1, r2)), Fp2.add(t1, t2)), - ), - ), - // (c0 + c1) * (r0 + r1) - (T0 + T1) + T2 * (u + 1) - c1: Fp2.add( - Fp2.sub(Fp2.mul(Fp2.add(c0, c1), Fp2.add(r0, r1)), Fp2.add(t0, t1)), - Fp2.mulByNonresidue(t2), - ), - // T1 + (c0 + c2) * (r0 + r2) - T0 + T2 - c2: Fp2.sub(Fp2.add(t1, Fp2.mul(Fp2.add(c0, c2), Fp2.add(r0, r2))), Fp2.add(t0, t2)), - }; - }; - Fp6Square = ({ c0, c1, c2 }) => { - let t0 = Fp2.sqr(c0); - let t1 = Fp2.mul(Fp2.mul(c0, c1), _2n5); - let t3 = Fp2.mul(Fp2.mul(c1, c2), _2n5); - let t4 = Fp2.sqr(c2); - return { - c0: Fp2.add(Fp2.mulByNonresidue(t3), t0), - c1: Fp2.add(Fp2.mulByNonresidue(t4), t1), - // T1 + (c0 - c1 + c2)² + T3 - T0 - T4 - c2: Fp2.sub( - Fp2.sub(Fp2.add(Fp2.add(t1, Fp2.sqr(Fp2.add(Fp2.sub(c0, c1), c2))), t3), t0), - t4, - ), - }; - }; - Fp6 = { - ORDER: Fp2.ORDER, - BITS: 3 * Fp2.BITS, - BYTES: 3 * Fp2.BYTES, - MASK: bitMask(3 * Fp2.BITS), - ZERO: { c0: Fp2.ZERO, c1: Fp2.ZERO, c2: Fp2.ZERO }, - ONE: { c0: Fp2.ONE, c1: Fp2.ZERO, c2: Fp2.ZERO }, - create: num => num, - isValid: ({ c0, c1, c2 }) => Fp2.isValid(c0) && Fp2.isValid(c1) && Fp2.isValid(c2), - is0: ({ c0, c1, c2 }) => Fp2.is0(c0) && Fp2.is0(c1) && Fp2.is0(c2), - neg: ({ c0, c1, c2 }) => ({ c0: Fp2.neg(c0), c1: Fp2.neg(c1), c2: Fp2.neg(c2) }), - eql: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }) => - Fp2.eql(c0, r0) && Fp2.eql(c1, r1) && Fp2.eql(c2, r2), - sqrt: () => { - throw new Error('Not implemented'); - }, - // Do we need division by bigint at all? Should be done via order: - div: (lhs, rhs) => - Fp6.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp6.inv(rhs)), - pow: (num, power) => FpPow(Fp6, num, power), - invertBatch: nums => FpInvertBatch(Fp6, nums), - // Normalized - add: Fp6Add, - sub: Fp6Subtract, - mul: Fp6Multiply, - sqr: Fp6Square, - // NonNormalized stuff - addN: Fp6Add, - subN: Fp6Subtract, - mulN: Fp6Multiply, - sqrN: Fp6Square, - inv: ({ c0, c1, c2 }) => { - let t0 = Fp2.sub(Fp2.sqr(c0), Fp2.mulByNonresidue(Fp2.mul(c2, c1))); - let t1 = Fp2.sub(Fp2.mulByNonresidue(Fp2.sqr(c2)), Fp2.mul(c0, c1)); - let t2 = Fp2.sub(Fp2.sqr(c1), Fp2.mul(c0, c2)); - let t4 = Fp2.inv( - Fp2.add( - Fp2.mulByNonresidue(Fp2.add(Fp2.mul(c2, t1), Fp2.mul(c1, t2))), - Fp2.mul(c0, t0), - ), - ); - return { c0: Fp2.mul(t4, t0), c1: Fp2.mul(t4, t1), c2: Fp2.mul(t4, t2) }; - }, - // Bytes utils - fromBytes: b => { - if (b.length !== Fp6.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); - return { - c0: Fp2.fromBytes(b.subarray(0, Fp2.BYTES)), - c1: Fp2.fromBytes(b.subarray(Fp2.BYTES, 2 * Fp2.BYTES)), - c2: Fp2.fromBytes(b.subarray(2 * Fp2.BYTES)), - }; - }, - toBytes: ({ c0, c1, c2 }) => concatBytes(Fp2.toBytes(c0), Fp2.toBytes(c1), Fp2.toBytes(c2)), - cmov: ({ c0, c1, c2 }, { c0: r0, c1: r1, c2: r2 }, c) => ({ - c0: Fp2.cmov(c0, r0, c), - c1: Fp2.cmov(c1, r1, c), - c2: Fp2.cmov(c2, r2, c), - }), - // Utils - // fromTriple(triple: [Fp2, Fp2, Fp2]) { - // return new Fp6(...triple); - // } - // toString() { - // return `Fp6(${this.c0} + ${this.c1} * v, ${this.c2} * v^2)`; - // } - fromBigSix: t => { - if (!Array.isArray(t) || t.length !== 6) throw new Error('Invalid Fp6 usage'); - return { - c0: Fp2.fromBigTuple(t.slice(0, 2)), - c1: Fp2.fromBigTuple(t.slice(2, 4)), - c2: Fp2.fromBigTuple(t.slice(4, 6)), - }; - }, - frobeniusMap: ({ c0, c1, c2 }, power) => ({ - c0: Fp2.frobeniusMap(c0, power), - c1: Fp2.mul(Fp2.frobeniusMap(c1, power), FP6_FROBENIUS_COEFFICIENTS_1[power % 6]), - c2: Fp2.mul(Fp2.frobeniusMap(c2, power), FP6_FROBENIUS_COEFFICIENTS_2[power % 6]), - }), - mulByNonresidue: ({ c0, c1, c2 }) => ({ c0: Fp2.mulByNonresidue(c2), c1: c0, c2: c1 }), - // Sparse multiplication - multiplyBy1: ({ c0, c1, c2 }, b1) => ({ - c0: Fp2.mulByNonresidue(Fp2.mul(c2, b1)), - c1: Fp2.mul(c0, b1), - c2: Fp2.mul(c1, b1), - }), - // Sparse multiplication - multiplyBy01({ c0, c1, c2 }, b0, b1) { - let t0 = Fp2.mul(c0, b0); - let t1 = Fp2.mul(c1, b1); - return { - // ((c1 + c2) * b1 - T1) * (u + 1) + T0 - c0: Fp2.add(Fp2.mulByNonresidue(Fp2.sub(Fp2.mul(Fp2.add(c1, c2), b1), t1)), t0), - // (b0 + b1) * (c0 + c1) - T0 - T1 - c1: Fp2.sub(Fp2.sub(Fp2.mul(Fp2.add(b0, b1), Fp2.add(c0, c1)), t0), t1), - // (c0 + c2) * b0 - T0 + T1 - c2: Fp2.add(Fp2.sub(Fp2.mul(Fp2.add(c0, c2), b0), t0), t1), - }; - }, - multiplyByFp2: ({ c0, c1, c2 }, rhs) => ({ - c0: Fp2.mul(c0, rhs), - c1: Fp2.mul(c1, rhs), - c2: Fp2.mul(c2, rhs), - }), - }; - FP6_FROBENIUS_COEFFICIENTS_1 = [ - [BigInt('0x1'), BigInt('0x0')], - [ - BigInt('0x0'), - BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', - ), - ], - [ - BigInt( - '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', - ), - BigInt('0x0'), - ], - [BigInt('0x0'), BigInt('0x1')], - [ - BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', - ), - BigInt('0x0'), - ], - [ - BigInt('0x0'), - BigInt( - '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', - ), - ], - ].map(pair => Fp2.fromBigTuple(pair)); - FP6_FROBENIUS_COEFFICIENTS_2 = [ - [BigInt('0x1'), BigInt('0x0')], - [ - BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff', - ), - BigInt('0x0'), - ], - ].map(pair => Fp2.fromBigTuple(pair)); - BLS_X = BigInt('0xd201000000010000'); - BLS_X_LEN = bitLen(BLS_X); - Fp12Add = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ - c0: Fp6.add(c0, r0), - c1: Fp6.add(c1, r1), - }); - Fp12Subtract = ({ c0, c1 }, { c0: r0, c1: r1 }) => ({ - c0: Fp6.sub(c0, r0), - c1: Fp6.sub(c1, r1), - }); - Fp12Multiply = ({ c0, c1 }, rhs) => { - if (typeof rhs === 'bigint') return { c0: Fp6.mul(c0, rhs), c1: Fp6.mul(c1, rhs) }; - let { c0: r0, c1: r1 } = rhs; - let t1 = Fp6.mul(c0, r0); - let t2 = Fp6.mul(c1, r1); - return { - c0: Fp6.add(t1, Fp6.mulByNonresidue(t2)), - // (c0 + c1) * (r0 + r1) - (T1 + T2) - c1: Fp6.sub(Fp6.mul(Fp6.add(c0, c1), Fp6.add(r0, r1)), Fp6.add(t1, t2)), - }; - }; - Fp12Square = ({ c0, c1 }) => { - let ab = Fp6.mul(c0, c1); - return { - // (c1 * v + c0) * (c0 + c1) - AB - AB * v - c0: Fp6.sub( - Fp6.sub(Fp6.mul(Fp6.add(Fp6.mulByNonresidue(c1), c0), Fp6.add(c0, c1)), ab), - Fp6.mulByNonresidue(ab), - ), - c1: Fp6.add(ab, ab), - }; - }; - Fp12 = { - ORDER: Fp2.ORDER, - BITS: 2 * Fp2.BITS, - BYTES: 2 * Fp2.BYTES, - MASK: bitMask(2 * Fp2.BITS), - ZERO: { c0: Fp6.ZERO, c1: Fp6.ZERO }, - ONE: { c0: Fp6.ONE, c1: Fp6.ZERO }, - create: num => num, - isValid: ({ c0, c1 }) => Fp6.isValid(c0) && Fp6.isValid(c1), - is0: ({ c0, c1 }) => Fp6.is0(c0) && Fp6.is0(c1), - neg: ({ c0, c1 }) => ({ c0: Fp6.neg(c0), c1: Fp6.neg(c1) }), - eql: ({ c0, c1 }, { c0: r0, c1: r1 }) => Fp6.eql(c0, r0) && Fp6.eql(c1, r1), - sqrt: () => { - throw new Error('Not implemented'); - }, - inv: ({ c0, c1 }) => { - let t = Fp6.inv(Fp6.sub(Fp6.sqr(c0), Fp6.mulByNonresidue(Fp6.sqr(c1)))); - return { c0: Fp6.mul(c0, t), c1: Fp6.neg(Fp6.mul(c1, t)) }; - }, - div: (lhs, rhs) => - Fp12.mul(lhs, typeof rhs === 'bigint' ? Fp.inv(Fp.create(rhs)) : Fp12.inv(rhs)), - pow: (num, power) => FpPow(Fp12, num, power), - invertBatch: nums => FpInvertBatch(Fp12, nums), - // Normalized - add: Fp12Add, - sub: Fp12Subtract, - mul: Fp12Multiply, - sqr: Fp12Square, - // NonNormalized stuff - addN: Fp12Add, - subN: Fp12Subtract, - mulN: Fp12Multiply, - sqrN: Fp12Square, - // Bytes utils - fromBytes: b => { - if (b.length !== Fp12.BYTES) throw new Error(`fromBytes wrong length=${b.length}`); - return { - c0: Fp6.fromBytes(b.subarray(0, Fp6.BYTES)), - c1: Fp6.fromBytes(b.subarray(Fp6.BYTES)), - }; - }, - toBytes: ({ c0, c1 }) => concatBytes(Fp6.toBytes(c0), Fp6.toBytes(c1)), - cmov: ({ c0, c1 }, { c0: r0, c1: r1 }, c) => ({ - c0: Fp6.cmov(c0, r0, c), - c1: Fp6.cmov(c1, r1, c), - }), - // Utils - // toString() { - // return `Fp12(${this.c0} + ${this.c1} * w)`; - // }, - // fromTuple(c: [Fp6, Fp6]) { - // return new Fp12(...c); - // } - fromBigTwelve: t => ({ - c0: Fp6.fromBigSix(t.slice(0, 6)), - c1: Fp6.fromBigSix(t.slice(6, 12)), - }), - // Raises to q**i -th power - frobeniusMap(lhs, power) { - const r0 = Fp6.frobeniusMap(lhs.c0, power); - const { c0, c1, c2 } = Fp6.frobeniusMap(lhs.c1, power); - const coeff = FP12_FROBENIUS_COEFFICIENTS[power % 12]; - return { - c0: r0, - c1: Fp6.create({ - c0: Fp2.mul(c0, coeff), - c1: Fp2.mul(c1, coeff), - c2: Fp2.mul(c2, coeff), - }), - }; - }, - // Sparse multiplication - multiplyBy014: ({ c0, c1 }, o0, o1, o4) => { - let t0 = Fp6.multiplyBy01(c0, o0, o1); - let t1 = Fp6.multiplyBy1(c1, o4); - return { - c0: Fp6.add(Fp6.mulByNonresidue(t1), t0), - // (c1 + c0) * [o0, o1+o4] - T0 - T1 - c1: Fp6.sub(Fp6.sub(Fp6.multiplyBy01(Fp6.add(c1, c0), o0, Fp2.add(o1, o4)), t0), t1), - }; - }, - multiplyByFp2: ({ c0, c1 }, rhs) => ({ - c0: Fp6.multiplyByFp2(c0, rhs), - c1: Fp6.multiplyByFp2(c1, rhs), - }), - conjugate: ({ c0, c1 }) => ({ c0, c1: Fp6.neg(c1) }), - // A cyclotomic group is a subgroup of Fp^n defined by - // GΦₙ(p) = {α ∈ Fpⁿ : α^Φₙ(p) = 1} - // The result of any pairing is in a cyclotomic subgroup - // https://eprint.iacr.org/2009/565.pdf - _cyclotomicSquare: ({ c0, c1 }) => { - const { c0: c0c0, c1: c0c1, c2: c0c2 } = c0; - const { c0: c1c0, c1: c1c1, c2: c1c2 } = c1; - const { first: t3, second: t4 } = Fp4Square(c0c0, c1c1); - const { first: t5, second: t6 } = Fp4Square(c1c0, c0c2); - const { first: t7, second: t8 } = Fp4Square(c0c1, c1c2); - let t9 = Fp2.mulByNonresidue(t8); - return { - c0: Fp6.create({ - c0: Fp2.add(Fp2.mul(Fp2.sub(t3, c0c0), _2n5), t3), - c1: Fp2.add(Fp2.mul(Fp2.sub(t5, c0c1), _2n5), t5), - c2: Fp2.add(Fp2.mul(Fp2.sub(t7, c0c2), _2n5), t7), - }), - c1: Fp6.create({ - c0: Fp2.add(Fp2.mul(Fp2.add(t9, c1c0), _2n5), t9), - c1: Fp2.add(Fp2.mul(Fp2.add(t4, c1c1), _2n5), t4), - c2: Fp2.add(Fp2.mul(Fp2.add(t6, c1c2), _2n5), t6), - }), - }; - }, - _cyclotomicExp(num, n) { - let z = Fp12.ONE; - for (let i = BLS_X_LEN - 1; i >= 0; i--) { - z = Fp12._cyclotomicSquare(z); - if (bitGet(n, i)) z = Fp12.mul(z, num); - } - return z; - }, - // https://eprint.iacr.org/2010/354.pdf - // https://eprint.iacr.org/2009/565.pdf - finalExponentiate: num => { - const x = BLS_X; - const t0 = Fp12.div(Fp12.frobeniusMap(num, 6), num); - const t1 = Fp12.mul(Fp12.frobeniusMap(t0, 2), t0); - const t2 = Fp12.conjugate(Fp12._cyclotomicExp(t1, x)); - const t3 = Fp12.mul(Fp12.conjugate(Fp12._cyclotomicSquare(t1)), t2); - const t4 = Fp12.conjugate(Fp12._cyclotomicExp(t3, x)); - const t5 = Fp12.conjugate(Fp12._cyclotomicExp(t4, x)); - const t6 = Fp12.mul( - Fp12.conjugate(Fp12._cyclotomicExp(t5, x)), - Fp12._cyclotomicSquare(t2), - ); - const t7 = Fp12.conjugate(Fp12._cyclotomicExp(t6, x)); - const t2_t5_pow_q2 = Fp12.frobeniusMap(Fp12.mul(t2, t5), 2); - const t4_t1_pow_q3 = Fp12.frobeniusMap(Fp12.mul(t4, t1), 3); - const t6_t1c_pow_q1 = Fp12.frobeniusMap(Fp12.mul(t6, Fp12.conjugate(t1)), 1); - const t7_t3c_t1 = Fp12.mul(Fp12.mul(t7, Fp12.conjugate(t3)), t1); - return Fp12.mul(Fp12.mul(Fp12.mul(t2_t5_pow_q2, t4_t1_pow_q3), t6_t1c_pow_q1), t7_t3c_t1); - }, - }; - FP12_FROBENIUS_COEFFICIENTS = [ - [BigInt('0x1'), BigInt('0x0')], - [ - BigInt( - '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8', - ), - BigInt( - '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3', - ), - ], - [ - BigInt( - '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffeffff', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2', - ), - BigInt( - '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', - ), - ], - [ - BigInt( - '0x00000000000000005f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995', - ), - BigInt( - '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116', - ), - ], - [ - BigInt( - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x00fc3e2b36c4e03288e9e902231f9fb854a14787b6c7b36fec0c8ec971f63c5f282d5ac14d6c7ec22cf78a126ddc4af3', - ), - BigInt( - '0x1904d3bf02bb0667c231beb4202c0d1f0fd603fd3cbd5f4f7b2443d784bab9c4f67ea53d63e7813d8d0775ed92235fb8', - ), - ], - [ - BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09', - ), - BigInt( - '0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2', - ), - ], - [ - BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad', - ), - BigInt('0x0'), - ], - [ - BigInt( - '0x05b2cfd9013a5fd8df47fa6b48b1e045f39816240c0b8fee8beadf4d8e9c0566c63a3e6e257f87329b18fae980078116', - ), - BigInt( - '0x144e4211384586c16bd3ad4afa99cc9170df3560e77982d0db45f3536814f0bd5871c1908bd478cd1ee605167ff82995', - ), - ], - ].map(n => Fp2.fromBigTuple(n)); - isogenyMapG2 = isogenyMap( - Fp2, - [ - // xNum - [ - [ - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6', - ], - [ - '0x0', - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a', - ], - [ - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e', - '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d', - ], - [ - '0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1', - '0x0', - ], - ], - // xDen - [ - [ - '0x0', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63', - ], - [ - '0xc', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f', - ], - ['0x1', '0x0'], - // LAST 1 - ], - // yNum - [ - [ - '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', - '0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706', - ], - [ - '0x0', - '0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be', - ], - [ - '0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c', - '0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f', - ], - [ - '0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10', - '0x0', - ], - ], - // yDen - [ - [ - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb', - ], - [ - '0x0', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3', - ], - [ - '0x12', - '0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99', - ], - ['0x1', '0x0'], - // LAST 1 - ], - ].map(i => i.map(pair => Fp2.fromBigTuple(pair.map(BigInt)))), - ); - isogenyMapG1 = isogenyMap( - Fp, - [ - // xNum - [ - '0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7', - '0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb', - '0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0', - '0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861', - '0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9', - '0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983', - '0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84', - '0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e', - '0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317', - '0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e', - '0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b', - '0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229', - ], - // xDen - [ - '0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c', - '0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff', - '0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19', - '0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8', - '0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e', - '0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5', - '0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a', - '0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e', - '0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641', - '0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a', - '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', - // LAST 1 - ], - // yNum - [ - '0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33', - '0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696', - '0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6', - '0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb', - '0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb', - '0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0', - '0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2', - '0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29', - '0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587', - '0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30', - '0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132', - '0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e', - '0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8', - '0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133', - '0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b', - '0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604', - ], - // yDen - [ - '0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1', - '0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d', - '0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2', - '0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416', - '0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d', - '0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac', - '0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c', - '0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9', - '0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a', - '0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55', - '0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8', - '0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092', - '0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc', - '0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7', - '0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f', - '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', - // LAST 1 - ], - ].map(i => i.map(j => BigInt(j))), - ); - G2_SWU = mapToCurveSimpleSWU(Fp2, { - A: Fp2.create({ c0: Fp.create(_0n5), c1: Fp.create(BigInt(240)) }), - B: Fp2.create({ c0: Fp.create(BigInt(1012)), c1: Fp.create(BigInt(1012)) }), - Z: Fp2.create({ c0: Fp.create(BigInt(-2)), c1: Fp.create(BigInt(-1)) }), - // Z: -(2 + I) - }); - G1_SWU = mapToCurveSimpleSWU(Fp, { - A: Fp.create( - BigInt( - '0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d', - ), - ), - B: Fp.create( - BigInt( - '0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0', - ), - ), - Z: Fp.create(BigInt(11)), - }); - ut_root = Fp6.create({ c0: Fp2.ZERO, c1: Fp2.ONE, c2: Fp2.ZERO }); - wsq = Fp12.create({ c0: ut_root, c1: Fp6.ZERO }); - wcu = Fp12.create({ c0: Fp6.ZERO, c1: ut_root }); - [wsq_inv, wcu_inv] = Fp12.invertBatch([wsq, wcu]); - PSI2_C1 = BigInt( - '0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac', - ); - htfDefaults = Object.freeze({ - // DST: a domain separation tag - // defined in section 2.2.5 - // Use utils.getDSTLabel(), utils.setDSTLabel(value) - DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', - encodeDST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_', - // p: the characteristic of F - // where F is a finite field of characteristic p and order q = p^m - p: Fp.ORDER, - // m: the extension degree of F, m >= 1 - // where F is a finite field of characteristic p and order q = p^m - m: 2, - // k: the target security level for the suite in bits - // defined in section 5.1 - k: 128, - // option to use a message that has already been processed by - // expand_message_xmd - expand: 'xmd', - // Hash functions for: expand_message_xmd is appropriate for use with a - // wide range of hash functions, including SHA-2, SHA-3, BLAKE2, and others. - // BBS+ uses blake2: https://github.com/hyperledger/aries-framework-go/issues/2247 - hash: sha256, - }); - C_BIT_POS = Fp.BITS; - I_BIT_POS = Fp.BITS + 1; - S_BIT_POS = Fp.BITS + 2; - COMPRESSED_ZERO = Fp.toBytes(bitSet(bitSet(_0n5, I_BIT_POS, true), S_BIT_POS, true)); - bls12_381 = bls({ - // Fields - fields: { - Fp, - Fp2, - Fp6, - Fp12, - Fr, - }, - // G1 is the order-q subgroup of E1(Fp) : y² = x³ + 4, #E1(Fp) = h1q, where - // characteristic; z + (z⁴ - z² + 1)(z - 1)²/3 - G1: { - Fp, - // cofactor; (z - 1)²/3 - h: BigInt('0x396c8c005555e1568c00aaab0000aaab'), - // generator's coordinates - // x = 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507 - // y = 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569 - Gx: BigInt( - '0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb', - ), - Gy: BigInt( - '0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1', - ), - a: Fp.ZERO, - b: _4n3, - htfDefaults: { ...htfDefaults, m: 1, DST: 'BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_' }, - wrapPrivateKey: true, - allowInfinityPoint: true, - // Checks is the point resides in prime-order subgroup. - // point.isTorsionFree() should return true for valid points - // It returns false for shitty points. - // https://eprint.iacr.org/2021/1130.pdf - isTorsionFree: (c, point) => { - const cubicRootOfUnityModP = BigInt( - '0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe', - ); - const phi = new c(Fp.mul(point.px, cubicRootOfUnityModP), point.py, point.pz); - const xP = point.multiplyUnsafe(bls12_381.params.x).negate(); - const u2P = xP.multiplyUnsafe(bls12_381.params.x); - return u2P.equals(phi); - }, - // Clear cofactor of G1 - // https://eprint.iacr.org/2019/403 - clearCofactor: (_c, point) => { - return point.multiplyUnsafe(bls12_381.params.x).add(point); - }, - mapToCurve: scalars => { - const { x, y } = G1_SWU(Fp.create(scalars[0])); - return isogenyMapG1(x, y); - }, - fromBytes: bytes2 => { - bytes2 = bytes2.slice(); - if (bytes2.length === 48) { - const P = Fp.ORDER; - const compressedValue = bytesToNumberBE(bytes2); - const bflag = bitGet(compressedValue, I_BIT_POS); - if (bflag === _1n5) return { x: _0n5, y: _0n5 }; - const x = Fp.create(compressedValue & Fp.MASK); - const right = Fp.add(Fp.pow(x, _3n4), Fp.create(bls12_381.params.G1b)); - let y = Fp.sqrt(right); - if (!y) throw new Error('Invalid compressed G1 point'); - const aflag = bitGet(compressedValue, C_BIT_POS); - if ((y * _2n5) / P !== aflag) y = Fp.neg(y); - return { x: Fp.create(x), y: Fp.create(y) }; - } else if (bytes2.length === 96) { - if ((bytes2[0] & (1 << 6)) !== 0) return bls12_381.G1.ProjectivePoint.ZERO.toAffine(); - const x = bytesToNumberBE(bytes2.subarray(0, Fp.BYTES)); - const y = bytesToNumberBE(bytes2.subarray(Fp.BYTES)); - return { x: Fp.create(x), y: Fp.create(y) }; - } else { - throw new Error('Invalid point G1, expected 48/96 bytes'); - } - }, - toBytes: (c, point, isCompressed) => { - const isZero = point.equals(c.ZERO); - const { x, y } = point.toAffine(); - if (isCompressed) { - if (isZero) return COMPRESSED_ZERO.slice(); - const P = Fp.ORDER; - let num; - num = bitSet(x, C_BIT_POS, Boolean((y * _2n5) / P)); - num = bitSet(num, S_BIT_POS, true); - return numberToBytesBE(num, Fp.BYTES); - } else { - if (isZero) { - const x2 = concatBytes(new Uint8Array([64]), new Uint8Array(2 * Fp.BYTES - 1)); - return x2; - } else { - return concatBytes(numberToBytesBE(x, Fp.BYTES), numberToBytesBE(y, Fp.BYTES)); - } - } - }, - ShortSignature: { - fromHex(hex) { - const bytes2 = ensureBytes('signatureHex', hex, 48); - const P = Fp.ORDER; - const compressedValue = bytesToNumberBE(bytes2); - const bflag = bitGet(compressedValue, I_BIT_POS); - if (bflag === _1n5) return bls12_381.G1.ProjectivePoint.ZERO; - const x = Fp.create(compressedValue & Fp.MASK); - const right = Fp.add(Fp.pow(x, _3n4), Fp.create(bls12_381.params.G1b)); - let y = Fp.sqrt(right); - if (!y) throw new Error('Invalid compressed G1 point'); - const aflag = bitGet(compressedValue, C_BIT_POS); - if ((y * _2n5) / P !== aflag) y = Fp.neg(y); - const point = bls12_381.G1.ProjectivePoint.fromAffine({ x, y }); - point.assertValidity(); - return point; - }, - toRawBytes(point) { - return signatureG1ToRawBytes(point); - }, - toHex(point) { - return bytesToHex(signatureG1ToRawBytes(point)); - }, - }, - }, - // G2 is the order-q subgroup of E2(Fp²) : y² = x³+4(1+√−1), - // where Fp2 is Fp[√−1]/(x2+1). #E2(Fp2 ) = h2q, where - // G² - 1 - // h2q - G2: { - Fp: Fp2, - // cofactor - h: BigInt( - '0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5', - ), - Gx: Fp2.fromBigTuple([ - BigInt( - '0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8', - ), - BigInt( - '0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e', - ), - ]), - // y = - // 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582, - // 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905 - Gy: Fp2.fromBigTuple([ - BigInt( - '0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801', - ), - BigInt( - '0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be', - ), - ]), - a: Fp2.ZERO, - b: Fp2.fromBigTuple([_4n3, _4n3]), - hEff: BigInt( - '0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551', - ), - htfDefaults: { ...htfDefaults }, - wrapPrivateKey: true, - allowInfinityPoint: true, - mapToCurve: scalars => { - const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars)); - return isogenyMapG2(x, y); - }, - // Checks is the point resides in prime-order subgroup. - // point.isTorsionFree() should return true for valid points - // It returns false for shitty points. - // https://eprint.iacr.org/2021/1130.pdf - isTorsionFree: (c, P) => { - return P.multiplyUnsafe(bls12_381.params.x).negate().equals(G2psi(c, P)); - }, - // Maps the point into the prime-order subgroup G2. - // clear_cofactor_bls12381_g2 from cfrg-hash-to-curve-11 - // https://eprint.iacr.org/2017/419.pdf - // prettier-ignore - clearCofactor: (c, P) => { - const x = bls12_381.params.x; - let t1 = P.multiplyUnsafe(x).negate(); - let t2 = G2psi(c, P); - let t3 = P.double(); - t3 = G2psi2(c, t3); - t3 = t3.subtract(t2); - t2 = t1.add(t2); - t2 = t2.multiplyUnsafe(x).negate(); - t3 = t3.add(t2); - t3 = t3.subtract(t1); - const Q = t3.subtract(P); - return Q; - }, - fromBytes: bytes2 => { - bytes2 = bytes2.slice(); - const m_byte = bytes2[0] & 224; - if (m_byte === 32 || m_byte === 96 || m_byte === 224) { - throw new Error('Invalid encoding flag: ' + m_byte); - } - const bitC = m_byte & 128; - const bitI = m_byte & 64; - const bitS = m_byte & 32; - const L = Fp.BYTES; - const slc = (b, from, to) => bytesToNumberBE(b.slice(from, to)); - if (bytes2.length === 96 && bitC) { - const b = bls12_381.params.G2b; - const P = Fp.ORDER; - bytes2[0] = bytes2[0] & 31; - if (bitI) { - if (bytes2.reduce((p, c) => (p !== 0 ? c + 1 : c), 0) > 0) { - throw new Error('Invalid compressed G2 point'); - } - return { x: Fp2.ZERO, y: Fp2.ZERO }; - } - const x_1 = slc(bytes2, 0, L); - const x_0 = slc(bytes2, L, 2 * L); - const x = Fp2.create({ c0: Fp.create(x_0), c1: Fp.create(x_1) }); - const right = Fp2.add(Fp2.pow(x, _3n4), b); - let y = Fp2.sqrt(right); - const Y_bit = y.c1 === _0n5 ? (y.c0 * _2n5) / P : (y.c1 * _2n5) / P ? _1n5 : _0n5; - y = bitS > 0 && Y_bit > 0 ? y : Fp2.neg(y); - return { x, y }; - } else if (bytes2.length === 192 && !bitC) { - if ((bytes2[0] & (1 << 6)) !== 0) { - return { x: Fp2.ZERO, y: Fp2.ZERO }; - } - const x1 = slc(bytes2, 0, L); - const x0 = slc(bytes2, L, 2 * L); - const y1 = slc(bytes2, 2 * L, 3 * L); - const y0 = slc(bytes2, 3 * L, 4 * L); - return { x: Fp2.fromBigTuple([x0, x1]), y: Fp2.fromBigTuple([y0, y1]) }; - } else { - throw new Error('Invalid point G2, expected 96/192 bytes'); - } - }, - toBytes: (c, point, isCompressed) => { - const { BYTES: len, ORDER: P } = Fp; - const isZero = point.equals(c.ZERO); - const { x, y } = point.toAffine(); - if (isCompressed) { - if (isZero) return concatBytes(COMPRESSED_ZERO, numberToBytesBE(_0n5, len)); - const flag = Boolean(y.c1 === _0n5 ? (y.c0 * _2n5) / P : (y.c1 * _2n5) / P); - let x_1 = bitSet(x.c1, C_BIT_POS, flag); - x_1 = bitSet(x_1, S_BIT_POS, true); - return concatBytes(numberToBytesBE(x_1, len), numberToBytesBE(x.c0, len)); - } else { - if (isZero) return concatBytes(new Uint8Array([64]), new Uint8Array(4 * len - 1)); - const { re: x0, im: x1 } = Fp2.reim(x); - const { re: y0, im: y1 } = Fp2.reim(y); - return concatBytes( - numberToBytesBE(x1, len), - numberToBytesBE(x0, len), - numberToBytesBE(y1, len), - numberToBytesBE(y0, len), - ); - } - }, - Signature: { - // TODO: Optimize, it's very slow because of sqrt. - fromHex(hex) { - hex = ensureBytes('signatureHex', hex); - const P = Fp.ORDER; - const half = hex.length / 2; - if (half !== 48 && half !== 96) - throw new Error('Invalid compressed signature length, must be 96 or 192'); - const z1 = bytesToNumberBE(hex.slice(0, half)); - const z2 = bytesToNumberBE(hex.slice(half)); - const bflag1 = bitGet(z1, I_BIT_POS); - if (bflag1 === _1n5) return bls12_381.G2.ProjectivePoint.ZERO; - const x1 = Fp.create(z1 & Fp.MASK); - const x2 = Fp.create(z2); - const x = Fp2.create({ c0: x2, c1: x1 }); - const y2 = Fp2.add(Fp2.pow(x, _3n4), bls12_381.params.G2b); - let y = Fp2.sqrt(y2); - if (!y) throw new Error('Failed to find a square root'); - const { re: y0, im: y1 } = Fp2.reim(y); - const aflag1 = bitGet(z1, 381); - const isGreater = y1 > _0n5 && (y1 * _2n5) / P !== aflag1; - const isZero = y1 === _0n5 && (y0 * _2n5) / P !== aflag1; - if (isGreater || isZero) y = Fp2.neg(y); - const point = bls12_381.G2.ProjectivePoint.fromAffine({ x, y }); - point.assertValidity(); - return point; - }, - toRawBytes(point) { - return signatureG2ToRawBytes(point); - }, - toHex(point) { - return bytesToHex(signatureG2ToRawBytes(point)); - }, - }, - }, - params: { - x: BLS_X, - r: Fr.ORDER, - // order; z⁴ − z² + 1; CURVE.n from other curves - }, - htfDefaults, - hash: sha256, - randomBytes, - }); - }, - }); - - // index.js - var require_bls = __commonJS({ - 'index.js'(exports, module) { - init_bls12_381(); - module.exports = { - verifyShortSignature: bls12_381.verifyShortSignature, - }; - }, - }); - return require_bls(); -}; -/*! Bundled license information: - -@noble/hashes/esm/utils.js: - (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/utils.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/modular.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/curve.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/weierstrass.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/bls12-381.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) -*/ diff --git a/packages/identity/package.json b/packages/identity/package.json index 085ffd4af..4c13f791c 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -50,8 +50,8 @@ "@peculiar/webcrypto": "^1.4.0" }, "dependencies": { - "@noble/curves": "^1.2.0", - "@noble/hashes": "^1.3.1", + "@noble/curves": "^1.3.0", + "@noble/hashes": "^1.3.3", "borc": "^2.1.1" }, "devDependencies": { From 39d1e868618b6cf5dd32edd87f30bb1cf6c77e3e Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 13 Dec 2023 15:49:52 -0800 Subject: [PATCH 10/11] removing wasm and bls-verify deps --- package.json | 3 - packages/agent/src/certificate.ts | 23 +++++-- packages/agent/src/vendor/bls/README.md | 15 ----- packages/agent/src/vendor/bls/bls.ts | 90 ------------------------- packages/agent/src/vendor/bls/wasm.ts | 1 - 5 files changed, 16 insertions(+), 116 deletions(-) delete mode 100644 packages/agent/src/vendor/bls/README.md delete mode 100644 packages/agent/src/vendor/bls/bls.ts delete mode 100644 packages/agent/src/vendor/bls/wasm.ts diff --git a/package.json b/package.json index 95ef0afaf..fb2f9830c 100644 --- a/package.json +++ b/package.json @@ -146,8 +146,5 @@ "draft": true, "autoGenerate": true } - }, - "dependencies": { - "@noble/curves": "^1.2.0" } } diff --git a/packages/agent/src/certificate.ts b/packages/agent/src/certificate.ts index d13346ba5..93776e73a 100644 --- a/packages/agent/src/certificate.ts +++ b/packages/agent/src/certificate.ts @@ -3,9 +3,20 @@ import { AgentError } from './errors'; import { hash } from './request_id'; import { concat, fromHex, toHex } from './utils/buffer'; import { Principal } from '@dfinity/principal'; -import { blsVerify as blsVerifyImport } from '@dfinity/bls-verify'; +import { bls12_381 } from '@noble/curves/bls12-381'; import { decodeTime } from './utils/leb'; +const verifyFunc = async ( + primaryKey: Uint8Array | string, + signature: Uint8Array | string, + message: Uint8Array | string, +): Promise => { + const pk = typeof primaryKey === 'string' ? primaryKey : toHex(primaryKey); + const sig = typeof signature === 'string' ? signature : toHex(signature); + const msg = typeof message === 'string' ? message : toHex(message); + return bls12_381.verifyShortSignature(sig, msg, pk); +}; + /** * A certificate may fail verification with respect to the provided public key */ @@ -29,7 +40,7 @@ const NodeId = { Pruned: 4, }; -export type NodeIdType = typeof NodeId[keyof typeof NodeId]; +export type NodeIdType = (typeof NodeId)[keyof typeof NodeId]; export { NodeId }; @@ -103,7 +114,7 @@ export function hashTreeToString(tree: HashTree): string { } } -interface Delegation extends Record { +interface Delegation extends Record { subnet_id: ArrayBuffer; certificate: ArrayBuffer; } @@ -153,8 +164,6 @@ export interface CreateCertificateOptions { maxAgeInMinutes?: number; } -type MetricsResult = number | bigint | Map | undefined; - export class Certificate { private readonly cert: Cert; @@ -179,7 +188,7 @@ export class Certificate { private static createUnverified(options: CreateCertificateOptions): Certificate { let blsVerify = options.blsVerify; if (!blsVerify) { - blsVerify = blsVerifyImport; + blsVerify = verifyFunc; } return new Certificate( options.certificate, @@ -246,7 +255,7 @@ export class Certificate { } try { - sigVer = await blsVerify(new Uint8Array(key), new Uint8Array(sig), new Uint8Array(msg)); + sigVer = await verifyFunc(new Uint8Array(key), new Uint8Array(sig), new Uint8Array(msg)); } catch (err) { sigVer = false; } diff --git a/packages/agent/src/vendor/bls/README.md b/packages/agent/src/vendor/bls/README.md deleted file mode 100644 index 30471ec53..000000000 --- a/packages/agent/src/vendor/bls/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# How to Generate `wasm.ts` - -This WASM is generated from the miracl BLS Rust code (see https://github.com/dfinity/miracl_core_bls12381/) - -Run the following commands to build, minify, and base64 encode the wasm. - -```bash -wasm-pack build --out-name bls --no-default-features --features="wasm-bindgen allow_alt_compress" --profile=wasm - -echo -n "export const wasmBytesBase64 = \`" >pkg/wasm.ts -base64 ./pkg/bls_bg.wasm | tr -d "\n" >>pkg/wasm.ts -echo "\`;" >>pkg/wasm.ts -``` - -Copy the resulting `pkg/wasm.ts` to `packages/agent/src/vendor/bls/wasm.ts`. diff --git a/packages/agent/src/vendor/bls/bls.ts b/packages/agent/src/vendor/bls/bls.ts deleted file mode 100644 index 5cec7d8db..000000000 --- a/packages/agent/src/vendor/bls/bls.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as base64Arraybuffer from 'base64-arraybuffer'; - -// This WASM is generated from the miracl BLS Rust code (see -// https://github.com/dfinity/miracl_core_bls12381/) -import { wasmBytesBase64 } from './wasm'; - -let wasm: InitOutput; - -const wasmBytes = base64Arraybuffer.decode(wasmBytesBase64); - -/** - * @returns {number} - */ -export function bls_init() { - let ret = wasm.bls_init(); - return ret; -} - -let cachegetUint8Memory0: any = null; -function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory0; -} - -function passArray8ToWasm0(arg: any, malloc: any): [number, number] { - const ptr = malloc(arg.length * 1); - getUint8Memory0().set(arg, ptr / 1); - return [ptr, arg.length]; -} - -/** - * @param {Uint8Array} sig - * @param {Uint8Array} m - * @param {Uint8Array} w - * @returns {number} - */ -export function bls_verify(sig: Uint8Array, m: Uint8Array, w: Uint8Array): number { - const [ptr0, len0] = passArray8ToWasm0(sig, wasm.__wbindgen_malloc); - const [ptr1, len1] = passArray8ToWasm0(m, wasm.__wbindgen_malloc); - const [ptr2, len2] = passArray8ToWasm0(w, wasm.__wbindgen_malloc); - - const ret = wasm.bls_verify(ptr0, len0, ptr1, len1, ptr2, len2); - return ret; -} - -async function load(module: any, imports: any) { - if (typeof Response === 'function' && module instanceof Response) { - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - } else { - const instance = await WebAssembly.instantiate(module, imports); - - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; - } else { - return instance; - } - } -} - -async function init(): Promise { - const imports = {}; - const { instance, module } = await load(wasmBytes, imports); - - wasm = instance.exports as any as InitOutput; - (init as any).__wbindgen_wasm_module = module; - - return wasm; -} - -export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; - -export interface InitOutput { - readonly memory: WebAssembly.Memory; - readonly bls_init: () => number; - readonly bls_verify: (a: number, b: number, c: number, d: number, e: number, f: number) => number; - readonly __wbindgen_malloc: (a: number) => number; -} - -/** - * If `module_or_path` is {RequestInfo} or {URL}, makes a request and - * for everything else, calls `WebAssembly.instantiate` directly. - * - * @param {InitInput | Promise} module_or_path - * - * @returns {Promise} - */ -export default init; diff --git a/packages/agent/src/vendor/bls/wasm.ts b/packages/agent/src/vendor/bls/wasm.ts deleted file mode 100644 index c155311bc..000000000 --- a/packages/agent/src/vendor/bls/wasm.ts +++ /dev/null @@ -1 +0,0 @@ -export const wasmBytesBase64 = `AGFzbQEAAAABXg9gAn9/AGABfwBgAX8Bf2ADf39/AGACf38Bf2ADf39/AX9gBH9/f38AYAF/AX5gBX9/f39/AGAAAX9gBn9/f39/fwBgBn9/f39/fwF/YAJ/fwF+YAV/fn5+fgBgAAAD3wHdAQIAAAABAwoAAAAIBgQAAwEDAAEBAQAAAQAJAQMAAwEACAEDAwQAAwsADAIBAAEADQMEAAAAAgEBAAABAwABAQMEAAEBAQEBAQEAAAMBAgUABAEFBAEBAgIEAwQDAAAAAwAAAAABDgABAgAAAAEAAwMAAQMAAwYCAAAABAABAAABAQYBAwAAAgICAgIBAAMABAACAQAAAwAAAAAAAQEBAQIAAAEEAQMAAAABAAAEAgABAQEBAQEBAQEBBAQAAgMAAAABAAICAAIEBAEBAgICAgAEBQQEAgIJBwcHAQMDBAUBcAESEgUDAQARBgkBfwFBgIDAAAsHNwQGbWVtb3J5AgAIYmxzX2luaXQA1gEKYmxzX3ZlcmlmeQAnEV9fd2JpbmRnZW5fbWFsbG9jAGgJIQEAQQELEcgBQdoBTroBQH/XAdgBgAEcJVy7AccB2gHZAQr44QLdAd0hAg9/AX4jAEEQayIIJAACQAJAIABB9QFPBEBBgIB8QQhBCBCjAUEUQQgQowFqQRBBCBCjAWprQXdxQQNrIgJBAEEQQQgQowFBAnRrIgUgAiAFSRsgAE0NAiAAQQRqQQgQowEhBEHgu8AAKAIARQ0BQQAgBGshAQJAAkACf0EAIARBgAJJDQAaQR8gBEH///8HSw0AGiAEQQYgBEEIdmciAGt2QQFxIABBAXRrQT5qCyIHQQJ0Qey9wABqKAIAIgAEQCAEIAcQnwF0IQZBACECA0ACQCAAEMsBIgUgBEkNACAFIARrIgUgAU8NACAAIQIgBSIBDQBBACEBDAMLIABBFGooAgAiBSADIAUgACAGQR12QQRxakEQaigCACIARxsgAyAFGyEDIAZBAXQhBiAADQALIAMEQCADIQAMAgsgAg0CC0EAIQJBASAHdBCtAUHgu8AAKAIAcSIARQ0DIAAQwwFoQQJ0Qey9wABqKAIAIgBFDQMLA0AgACACIAAQywEiAiAETyACIARrIgMgAUlxIgUbIQIgAyABIAUbIQEgABCRASIADQALIAJFDQILIARB7L7AACgCACIATSABIAAgBGtPcQ0BIAIgBBDSASEAIAIQFwJAQRBBCBCjASABTQRAIAIgBBDFASAAIAEQoAEgAUGAAk8EQCAAIAEQFgwCCyABQQN2IgNBA3RB5LvAAGohAQJ/Qdy7wAAoAgAiBUEBIAN0IgNxBEAgASgCCAwBC0Hcu8AAIAMgBXI2AgAgAQshAyABIAA2AgggAyAANgIMIAAgATYCDCAAIAM2AggMAQsgAiABIARqEIUBCyACENQBIgFFDQEMAgtBECAAQQRqQRBBCBCjAUEFayAASxtBCBCjASEEAkACQAJAAn8CQAJAQdy7wAAoAgAiBSAEQQN2IgF2IgBBA3FFBEAgBEHsvsAAKAIATQ0HIAANAUHgu8AAKAIAIgBFDQcgABDDAWhBAnRB7L3AAGooAgAiAhDLASAEayEBIAIQkQEiAARAA0AgABDLASAEayIDIAEgASADSyIDGyEBIAAgAiADGyECIAAQkQEiAA0ACwsgAiAEENIBIQUgAhAXQRBBCBCjASABSw0FIAIgBBDFASAFIAEQoAFB7L7AACgCACIARQ0EIABBA3YiBkEDdEHku8AAaiEAQfS+wAAoAgAhA0Hcu8AAKAIAIgdBASAGdCIGcUUNAiAAKAIIDAMLAkAgAEF/c0EBcSABaiIAQQN0IgNB7LvAAGooAgAiAUEIaigCACICIANB5LvAAGoiA0cEQCACIAM2AgwgAyACNgIIDAELQdy7wAAgBUF+IAB3cTYCAAsgASAAQQN0EIUBIAEQ1AEhAQwHCwJAQQEgAUEfcSIBdBCtASAAIAF0cRDDAWgiAEEDdCIDQey7wABqKAIAIgJBCGooAgAiASADQeS7wABqIgNHBEAgASADNgIMIAMgATYCCAwBC0Hcu8AAQdy7wAAoAgBBfiAAd3E2AgALIAIgBBDFASACIAQQ0gEiBSAAQQN0IARrIgQQoAFB7L7AACgCACIABEAgAEEDdiIDQQN0QeS7wABqIQBB9L7AACgCACEBAn9B3LvAACgCACIGQQEgA3QiA3EEQCAAKAIIDAELQdy7wAAgAyAGcjYCACAACyEDIAAgATYCCCADIAE2AgwgASAANgIMIAEgAzYCCAtB9L7AACAFNgIAQey+wAAgBDYCACACENQBIQEMBgtB3LvAACAGIAdyNgIAIAALIQYgACADNgIIIAYgAzYCDCADIAA2AgwgAyAGNgIIC0H0vsAAIAU2AgBB7L7AACABNgIADAELIAIgASAEahCFAQsgAhDUASIBDQELAkACQAJAAkACQAJAAkACQCAEQey+wAAoAgAiAUsEQEHwvsAAKAIAIgAgBEsNAkEIQQgQowEgBGpBFEEIEKMBakEQQQgQowFqQYCABBCjASIBQRB2QAAhACAIQQA2AgggCEEAIAFBgIB8cSAAQX9GIgEbNgIEIAhBACAAQRB0IAEbNgIAIAgoAgAiAQ0BQQAhAQwJC0H0vsAAKAIAIQBBEEEIEKMBIAEgBGsiAUsEQEH0vsAAQQA2AgBB7L7AACgCACEBQey+wABBADYCACAAIAEQhQEgABDUASEBDAkLIAAgBBDSASECQey+wAAgATYCAEH0vsAAIAI2AgAgAiABEKABIAAgBBDFASAAENQBIQEMCAsgCCgCCCEFQfy+wAAgCCgCBCIDQfy+wAAoAgBqIgA2AgBBgL/AAEGAv8AAKAIAIgIgACAAIAJJGzYCAAJAAkBB+L7AACgCAARAQYS/wAAhAANAIAAQxgEgAUYNAiAAKAIIIgANAAsMAgtBmL/AACgCACIARSAAIAFLcg0DDAcLIAAQzQENACAAEM4BIAVHDQAgACgCACICQfi+wAAoAgAiBk0EfyACIAAoAgRqIAZLBUEACw0DC0GYv8AAQZi/wAAoAgAiACABIAAgAUkbNgIAIAEgA2ohAkGEv8AAIQACQAJAA0AgAiAAKAIARwRAIAAoAggiAA0BDAILCyAAEM0BDQAgABDOASAFRg0BC0H4vsAAKAIAIQJBhL/AACEAAkADQCACIAAoAgBPBEAgABDGASACSw0CCyAAKAIIIgANAAtBACEACyACIAAQxgEiD0EUQQgQowEiDmtBF2siABDUASIGQQgQowEgBmsgAGoiACAAQRBBCBCjASACakkbIgYQ1AEhByAGIA4Q0gEhAEEIQQgQowEhCUEUQQgQowEhC0EQQQgQowEhDEH4vsAAIAEgARDUASIKQQgQowEgCmsiDRDSASIKNgIAQfC+wAAgA0EIaiAMIAkgC2pqIA1qayIJNgIAIAogCUEBcjYCBEEIQQgQowEhC0EUQQgQowEhDEEQQQgQowEhDSAKIAkQ0gEgDSAMIAtBCGtqajYCBEGUv8AAQYCAgAE2AgAgBiAOEMUBQYS/wAApAgAhECAHQQhqQYy/wAApAgA3AgAgByAQNwIAQZC/wAAgBTYCAEGIv8AAIAM2AgBBhL/AACABNgIAQYy/wAAgBzYCAANAIABBBBDSASEBIABBBzYCBCAPIAEiAEEEaksNAAsgAiAGRg0HIAIgBiACayIAIAIgABDSARCDASAAQYACTwRAIAIgABAWDAgLIABBA3YiAUEDdEHku8AAaiEAAn9B3LvAACgCACIDQQEgAXQiAXEEQCAAKAIIDAELQdy7wAAgASADcjYCACAACyEBIAAgAjYCCCABIAI2AgwgAiAANgIMIAIgATYCCAwHCyAAKAIAIQUgACABNgIAIAAgACgCBCADajYCBCABENQBIgBBCBCjASECIAUQ1AEiA0EIEKMBIQYgASACIABraiICIAQQ0gEhASACIAQQxQEgBSAGIANraiIAIAIgBGprIQQgAEH4vsAAKAIARwRAQfS+wAAoAgAgAEYNBCAAKAIEQQNxQQFHDQUCQCAAEMsBIgNBgAJPBEAgABAXDAELIABBDGooAgAiBSAAQQhqKAIAIgZHBEAgBiAFNgIMIAUgBjYCCAwBC0Hcu8AAQdy7wAAoAgBBfiADQQN2d3E2AgALIAMgBGohBCAAIAMQ0gEhAAwFC0H4vsAAIAE2AgBB8L7AAEHwvsAAKAIAIARqIgA2AgAgASAAQQFyNgIEIAIQ1AEhAQwHC0HwvsAAIAAgBGsiATYCAEH4vsAAQfi+wAAoAgAiACAEENIBIgI2AgAgAiABQQFyNgIEIAAgBBDFASAAENQBIQEMBgtBmL/AACABNgIADAMLIAAgACgCBCADajYCBEHwvsAAKAIAIANqIQFB+L7AACgCACIAIAAQ1AEiAEEIEKMBIABrIgIQ0gEhAEHwvsAAIAEgAmsiATYCAEH4vsAAIAA2AgAgACABQQFyNgIEQQhBCBCjASECQRRBCBCjASEDQRBBCBCjASEFIAAgARDSASAFIAMgAkEIa2pqNgIEQZS/wABBgICAATYCAAwDC0H0vsAAIAE2AgBB7L7AAEHsvsAAKAIAIARqIgA2AgAgASAAEKABIAIQ1AEhAQwDCyABIAQgABCDASAEQYACTwRAIAEgBBAWIAIQ1AEhAQwDCyAEQQN2IgNBA3RB5LvAAGohAAJ/Qdy7wAAoAgAiBUEBIAN0IgNxBEAgACgCCAwBC0Hcu8AAIAMgBXI2AgAgAAshAyAAIAE2AgggAyABNgIMIAEgADYCDCABIAM2AgggAhDUASEBDAILQZy/wABB/x82AgBBkL/AACAFNgIAQYi/wAAgAzYCAEGEv8AAIAE2AgBB8LvAAEHku8AANgIAQfi7wABB7LvAADYCAEHsu8AAQeS7wAA2AgBBgLzAAEH0u8AANgIAQfS7wABB7LvAADYCAEGIvMAAQfy7wAA2AgBB/LvAAEH0u8AANgIAQZC8wABBhLzAADYCAEGEvMAAQfy7wAA2AgBBmLzAAEGMvMAANgIAQYy8wABBhLzAADYCAEGgvMAAQZS8wAA2AgBBlLzAAEGMvMAANgIAQai8wABBnLzAADYCAEGcvMAAQZS8wAA2AgBBsLzAAEGkvMAANgIAQaS8wABBnLzAADYCAEGsvMAAQaS8wAA2AgBBuLzAAEGsvMAANgIAQbS8wABBrLzAADYCAEHAvMAAQbS8wAA2AgBBvLzAAEG0vMAANgIAQci8wABBvLzAADYCAEHEvMAAQby8wAA2AgBB0LzAAEHEvMAANgIAQcy8wABBxLzAADYCAEHYvMAAQcy8wAA2AgBB1LzAAEHMvMAANgIAQeC8wABB1LzAADYCAEHcvMAAQdS8wAA2AgBB6LzAAEHcvMAANgIAQeS8wABB3LzAADYCAEHwvMAAQeS8wAA2AgBB+LzAAEHsvMAANgIAQey8wABB5LzAADYCAEGAvcAAQfS8wAA2AgBB9LzAAEHsvMAANgIAQYi9wABB/LzAADYCAEH8vMAAQfS8wAA2AgBBkL3AAEGEvcAANgIAQYS9wABB/LzAADYCAEGYvcAAQYy9wAA2AgBBjL3AAEGEvcAANgIAQaC9wABBlL3AADYCAEGUvcAAQYy9wAA2AgBBqL3AAEGcvcAANgIAQZy9wABBlL3AADYCAEGwvcAAQaS9wAA2AgBBpL3AAEGcvcAANgIAQbi9wABBrL3AADYCAEGsvcAAQaS9wAA2AgBBwL3AAEG0vcAANgIAQbS9wABBrL3AADYCAEHIvcAAQby9wAA2AgBBvL3AAEG0vcAANgIAQdC9wABBxL3AADYCAEHEvcAAQby9wAA2AgBB2L3AAEHMvcAANgIAQcy9wABBxL3AADYCAEHgvcAAQdS9wAA2AgBB1L3AAEHMvcAANgIAQei9wABB3L3AADYCAEHcvcAAQdS9wAA2AgBB5L3AAEHcvcAANgIAQQhBCBCjASECQRRBCBCjASEFQRBBCBCjASEGQfi+wAAgASABENQBIgBBCBCjASAAayIBENIBIgA2AgBB8L7AACADQQhqIAYgAiAFamogAWprIgE2AgAgACABQQFyNgIEQQhBCBCjASECQRRBCBCjASEDQRBBCBCjASEFIAAgARDSASAFIAMgAkEIa2pqNgIEQZS/wABBgICAATYCAAtBACEBQfC+wAAoAgAiACAETQ0AQfC+wAAgACAEayIBNgIAQfi+wABB+L7AACgCACIAIAQQ0gEiAjYCACACIAFBAXI2AgQgACAEEMUBIAAQ1AEhAQsgCEEQaiQAIAEL+A4BCX8jAEHADWsiAiQAAkACQAJAAkACQAJAAkACQAJAIAAoAoAGIgVBAUcEQCABKAKABiIGQQFGDQkgBkEDSw0BIAVBfnFBAkYNAiACIAAQjAEgAkGAAmoiBEE4ENABGiACQQE2ArgCIAJBwAJqQTgQ0AEaIAJB+AJqQQE2AgAgAkGAA2pBOBDQARogAkG4A2pBATYCACACQcADakE4ENABGiACQfgDakEBNgIAIAJBgARqQTgQ0AEaIAJBATYCuAQgAkHABGpBOBDQARogAkH4BGpBATYCACACQYAFakE4ENABGiACQbgFakEBNgIAIAJBwAVqQTgQ0AEaIAJB+AVqQQE2AgAgAkGABmoiB0E4ENABGiACQQE2ArgGIAJBwAZqQTgQ0AEaIAJB+AZqQQE2AgAgAkGAB2pBOBDQARogAkG4B2pBATYCACACQcAHakE4ENABGiACQfgHakEBNgIAIAJBgAhqIgMgABCMASACQYAKakE4ENABGiACQQE2ArgKIAJBwApqQTgQ0AEaIAJB+ApqQQE2AgAgAkGAC2pBOBDQARogAkG4C2pBATYCACACQcALakE4ENABGiACQfgLakEBNgIAIAIgARAYIAMgAEGAAmoiBhCXASADELABIAQgAxCWASAEIAEQGCADIAYQlgEgAyAAQYAEaiIFEJcBIAMQsAEgByADEJYBIAEoAoAGQQJGDQMgAkHADGoiAyABQYAFahBeIAJBgAZqIAMQpgEMBAsgACABEG0MCAsgAiAAEIwBIAJBgAJqQTgQ0AEaIAJBATYCuAIgAkHAAmpBOBDQARogAkH4AmpBATYCACACQYADakE4ENABGiACQbgDakEBNgIAIAJBwANqQTgQ0AEaIAJB+ANqQQE2AgAgAkGABGpBOBDQARogAkEBNgK4BCACQcAEakE4ENABGiACQfgEakEBNgIAIAJBgAVqQTgQ0AEaIAJBuAVqQQE2AgAgAkHABWpBOBDQARogAkH4BWpBATYCACACQYAGakE4ENABGiACQQE2ArgGIAJBwAZqQTgQ0AEaIAJB+AZqQQE2AgAgAkGAB2pBOBDQARogAkG4B2pBATYCACACQcAHakE4ENABGiACQfgHakEBNgIAIAIgARAYAkAgASgCgAZBBEYNACAAKAKABkEERg0AIAJBgARqIgMgAEGAAmoQlgEgAyABQYACahAYDAYLIAJBwAxqIgdBOBDQARogAkEBNgL4DCACQYANakE4ENABGiACQbgNakEBNgIAIAJBgAhqIgRBOBDQARogAkEBNgK4CCACQcAIakE4ENABGiACQfgIakEBNgIAIAJBgApqIgMgAEGAA2oiBRBeIAQgAxCZASADIAFBgANqIgYQXiAEIAMQESAHELYBIAEoAoAGQQRHDQMMBAsgACABEAMMBgsgAkHADGoiAyABQYAFahBeIAJBgAxqIgQgA0HAABDRARogAkGABmogBBCnAQsgAkGABmoQZCACQYAIaiIDIAIQlgEgAxArIAJBgAJqIgQgAxCXASAGIAQQlgEgAkGABGoiByADEJYBIAMgABCWASADIAUQlwEgAxCwASACQYAKaiIEIAEQlgEgBCABQYAEahCXASAEELABIAMgBBAYIAcgAxCXASADIAUQlgECQCABKAKABkECRwRAIAJBwAxqIgMgAUGABWoQXiACQYAIaiADEKYBDAELIAJBwAxqIgMgAUGABWoQXiACQYAMaiIBIANBwAAQ0QEaIAJBgAhqIAEQpwELIAJBgAhqIgEQZCACQYAKaiIDIAEQlgEgAxArIAUgAkGABGoQlgEgBSADEJcBIAJBgAZqIgQgAxCXASABEGQgBiABEJcBIAQQsAEgBBBkIAAgAhCWASAAIAQQlwEMAwsgAkGACmoiAyAFEF4gAkHADGoiBCADEJkBIAMgAUGAAmoQXiAEIAMQEQsgACgCgAZBBEcEQCACQYAKaiIDIABBgAJqEF4gAkHADGoiBCADEJkBIAMgBhBeIAQgAxARCyACQYAEaiIDIAJBwAxqIAJBgAhqEKUBIAMQZAsgAkGACGoiAyAAEIwBIAJBgApqIgQgARCMASADIABBgAJqIgUQlwEgAxCwASAEIAFBgAJqIggQlwEgBBCwASACQYACaiIJIAMQlgEgCSAEEBggAyAFEJYBIAMgAEGABGoiBhCXASADELABIAQgCBCWASAEIAFBgARqIggQlwEgBBCwASACQYAGaiIHIAMQlgEgByAEEBggAyACEJYBIAMQKyAEIAJBgARqIgoQlgEgBBArIAkgAxCXASAFIAkQlgEgBSAEEJcBIAcgBBCXASAKIAMQlwEgAyAAEJYBIAMgBhCXASADELABIAQgARCWASAEIAgQlwEgBBCwASADIAQQGCAKIAMQlwEgAyAGEJYBIAMgCBAYIAQgAxCWASAEECsgBiAKEJYBIAYgBBCXASAHIAQQlwEgAxBkIAUgAxCXASAHELABIAcQZCAAIAIQlgEgACAHEJcBCyAAQQU2AoAGIAAQnQELIAJBwA1qJAALqAsBEX8jAEGAC2siAiQAIAJBCGoQZyACQcgBaiIKQTgQ0AEaIAJBATYCgAIgAkGIAmoiD0E4ENABGiACQQE2AsACIAJByAJqIhBBOBDQARogAkEBNgKAAyACQYgDaiIJQTgQ0AEaIAJBATYCwAMgAkHIA2oiDkE4ENABGiACQQE2AoAEIAJBiARqIhFBARA5IAJByARqIgtBOBDQARogAkEBNgKABSACQYgFaiIEQTgQ0AEaIAJBATYCwAUgAkHIBWoiBSABEJABIAJBiAZqIgNBOBDQARogAkEBNgLABiACQcgGaiIGQTgQ0AEaIAJBATYCgAcgAkGIB2oiDEE4ENABGiACQQE2AsAHIAJByAdqIghBOBDQARogAkEBNgKACCAFEFYhEiACQcgJaiINQZCCwAAQSSACQYgKaiIHIA0QjgEgCiAHEK4BIA1ByILAABBJIAcgDRCOASAPIAcQrgEgBRBMIAVBCxA0IAMgBRCuASADIBEQdyADEEIgAyAFEEogBCAKEK4BIAQgAxBKIAMgERB3IAJBiAZqEEIgAyAPEEogAxBDIAJBiAZqEEIgCSADEK4BIA4gBRCuASAOIAkQSiAIIAkQrgEgCBBMIAYgBBCuASAGEEwgAyAKEK4BIAMgBhBKIAggAxB3IAgQQiAIIAkQSiAGIAQQSiADIA8QrgEgAyAGEEogCCADEHcgAkHIB2oQQiADIAgQrgEgAyAEEEogAyAMEFohCiAEIAMQrgEgBCAMEDMgBCAIEEogCSAEEEogDiAEEEogBSABEEogBiAEEK4BIAYQTCAEIAYQrgEgBCAFEEogBSADEK4BIAVBCxA0IA1BgIPAABBJIAcgDRCOASAQIAcQrgEgECAMEEogCSAOQQEgCmsiARByIAYgBCABEHIgAyAFIAEQciAMIBAgARByIAcgAyAMECMgCyAHEK4BIAsgBhBKIAsQViEBIAMgCxCuASADEEMgAkGIBmoQQiALIAMgASAScxByIAdBuIPAABBJIAJBiAhqIAcQjgFBOCEBA0AgAUGgBUZFBEAgAkGICGoiAyACQYgDahBKIAJByAlqIgQgAUG4g8AAahBJIAFBOGohASACQYgKaiIFIAQQjgEgAkGIBmoiBCAFEK4BIAMgBBB3IAMQQgwBCwsgAkHICGoiASACQYgDahCQASACQcgJaiIDQdiIwAAQSSACQYgKaiIEIAMQjgEgAkGIBmoiAyAEEK4BIAEgAxB3IAEQQkEAIQEDQCABQfgDRkUEQCACQcgIaiIDIAJBiANqEEogAkHICWoiBCABQZCJwABqEEkgAUE4aiEBIAJBiApqIgUgBBCOASACQYgGaiIEIAUQrgEgAyAEEHcgAxBCDAELCyACQYgKaiIBQYiNwAAQSSACQYgJaiABEI4BQQAhAQNAIAFByAZGRQRAIAJBiAlqIgMgAkGIA2oQSiACQcgJaiIEIAFBwI3AAGoQSSABQThqIQEgAkGICmoiBSAEEI4BIAJBiAZqIgQgBRCuASADIAQQdyADEEIMAQsLIAJByAlqIgEgAkGIA2oQkAEgAkHICmoiA0GIlMAAEEkgAkGICmoiBCADEI4BIAJBiAZqIgMgBBCuASABIAMQdyABEEJBACEBA0AgAUGQBkYEQCACQYgJaiIDIAJByARqEEogAkGIBmoiASACQYgIahCuASABIAJByAlqIgQQSiACQQhqIgUgARCuASABIAMQrgEgASACQcgIaiIDEEogAkHIAGogARCuASABIAMQrgEgASAEEEogAkGIAWogARCuASAAIAVBwAEQ0QEaIAJBgAtqJAAFIAJByAlqIgMgAkGIA2oQSiACQcgKaiIEIAFBwJTAAGoQSSABQThqIQEgAkGICmoiBSAEEI4BIAJBiAZqIgQgBRCuASADIAQQdyADEEIMAQsLC/oGAQx/IwBBgAlrIgMkACADQYAIaiICIAAQXiADIAIQXiACIABBgAFqIgoQXiADQYABaiIEIAIQXiACIAEQXiADIAIQESACIAFBgAFqIgsQXiAEIAIQEQJAIAEoAoAGIgJBAkYgACgCgAYiBEECRnJFBEAgA0GACGoiAiAAQYAFahBeIANBgAJqIgQgAhBeIAIgAUGABWoQXiAEIAIQEQwBCyACQQJGIARBAkZxRQRAIAJBAkYEQCADQYAIaiICIABBgAVqEF4gA0GAAmoiBCACEF4gAiABQYAFahBeIANBgAdqIgUgAkHAABDRARogBCAFEKoBDAILIANBgAhqIgIgAUGABWoQXiADQYACaiIEIAIQXiACIABBgAVqEF4gA0GAB2oiBSACQcAAENEBGiAEIAUQqgEMAQsgA0GACGoiAiAAQYAFahBeIANBgAdqIgQgAkHAABDRARogA0GABmoiBSAEEJABIAIgAUGABWoQXiAEIAJBwAAQ0QEaIAUgBBBKIANBgAJqQTgQ0AEiAkEBNgI4IAJBQGtBOBDQASACQfgAakEBNgIAIAIgBRCuARDBAQsgA0GACGoiAiAAEF4gA0GAA2oiBCACEF4gAiABEF4gA0GABGoiBSACEF4gAiAKEF4gBCACEJoBIAQQqQEgAiALEF4gBSACEJoBIAUQqQEgA0GABWoiByAEEF4gByAFEBEgA0GABmoiBiADEF4gBiADQYABaiIIEJoBIAYQNiAHIAYQmgEgAiAAEF4gBCACEJkBIAIgAEGABWoiDBBeIAQgAhCaASAEEKkBIAIgARBeIAUgAhCZASACIAFBgAVqIg0QXiAFIAIQmgEgBRCpASADQYAHaiIJIAQQXiAJIAUQESAGIAMQmQEgBiADQYACaiIBEJoBIAYQNiAJIAYQmgEgAiAKEF4gBCACEJkBIAIgDBBeIAQgAhCaASAEEKkBIAIgCxBeIAUgAhCZASACIA0QXiAFIAIQmgEgBRCpASACIAQQXiACIAUQESAGIAgQmQEgBiABEJoBIAYQNiACIAYQmgEgCBB8IAMgCBCaASAAIAMgBxClASABEHwgARCpASAAQYACaiIEQYABaiABEJkBIAQQtgEgAhCpASACEHwgAEGABGoiASACIAkQpQEgABCwASABELABIABBBDYCgAYgA0GACWokAAuHBwEFfyAAENUBIgAgABDLASICENIBIQECQAJAAkAgABDMAQ0AIAAoAgAhAwJAIAAQxAFFBEAgAiADaiECIAAgAxDTASIAQfS+wAAoAgBHDQEgASgCBEEDcUEDRw0CQey+wAAgAjYCACAAIAIgARCDAQ8LIAIgA2pBEGohAAwCCyADQYACTwRAIAAQFwwBCyAAQQxqKAIAIgQgAEEIaigCACIFRwRAIAUgBDYCDCAEIAU2AggMAQtB3LvAAEHcu8AAKAIAQX4gA0EDdndxNgIACwJAIAEQvAEEQCAAIAIgARCDAQwBCwJAAkACQEH4vsAAKAIAIAFHBEAgAUH0vsAAKAIARw0BQfS+wAAgADYCAEHsvsAAQey+wAAoAgAgAmoiATYCACAAIAEQoAEPC0H4vsAAIAA2AgBB8L7AAEHwvsAAKAIAIAJqIgE2AgAgACABQQFyNgIEIABB9L7AACgCAEYNAQwCCyABEMsBIgMgAmohAgJAIANBgAJPBEAgARAXDAELIAFBDGooAgAiBCABQQhqKAIAIgFHBEAgASAENgIMIAQgATYCCAwBC0Hcu8AAQdy7wAAoAgBBfiADQQN2d3E2AgALIAAgAhCgASAAQfS+wAAoAgBHDQJB7L7AACACNgIADAMLQey+wABBADYCAEH0vsAAQQA2AgALQZS/wAAoAgAgAU8NAUGAgHxBCEEIEKMBQRRBCBCjAWpBEEEIEKMBamtBd3FBA2siAEEAQRBBCBCjAUECdGsiASAAIAFJG0UNAUH4vsAAKAIARQ0BQQhBCBCjASEAQRRBCBCjASEBQRBBCBCjASECQQACQEHwvsAAKAIAIgQgAiABIABBCGtqaiICTQ0AQfi+wAAoAgAhAUGEv8AAIQACQANAIAEgACgCAE8EQCAAEMYBIAFLDQILIAAoAggiAA0AC0EAIQALIAAQzQENACAAQQxqKAIAGgwAC0EAEBlrRw0BQfC+wAAoAgBBlL/AACgCAE0NAUGUv8AAQX82AgAPCyACQYACSQ0BIAAgAhAWQZy/wABBnL/AACgCAEEBayIANgIAIAANABAZGg8LDwsgAkEDdiIDQQN0QeS7wABqIQECf0Hcu8AAKAIAIgJBASADdCIDcQRAIAEoAggMAQtB3LvAACACIANyNgIAIAELIQMgASAANgIIIAMgADYCDCAAIAE2AgwgACADNgIIC4kHAgV+EH8jAEGQAmsiCSQAIABB6AAQ0AEhEiAJQTBqIgBB4AEQ0AEaA0AgCEE4RgRAIAFBCGohFCACQQhqIRUgAiENIAEhE0EBIQsgCSkDMCIDIQYgCUE4aikDACIEIQcFIAlBIGogAiAIaikDACIDIANCP4cgASAIaikDACIDIANCP4cQLyAAIAlBKGopAwA3AwggACAJKQMgNwMAIABBEGohACAIQQhqIQgMAQsLA0AgEiAQQQN0aiADQv//////////A4M3AwAgBEIGhiADQjqIhCEDIARCOochBAJAAkACQCALQQdGBEBBByEKQQAhDkEGIQsMAQsgECALQQF2IgBrIQwgDSAAQQN0IhFrIRYgEyARayEXIAQgCUEwaiALQQR0aiIKQQhqKQMAIAd8IAopAwAiBCAGfCIGIARUrXwiB3wgAyAGfCIDIAZUrXwhBCALQQFqIQ9BMCEIIBQhCiAVIQ4DQCAAIAtPDQMgCCARRg0CIAxBB0kEQCAJQRBqIAggFmpBMGspAwAgDiARaikDAH0iBSAFQj+HIAogEWopAwAgCCAXakEwaykDAH0iBSAFQj+HEC8gCSkDECIFIAN8IgMgBVStIAlBGGopAwAgBHx8IQQgAEEBaiEAIAxBAWshDCAKQQhqIQogDkEIaiEOIAhBCGshCAwBCwsgDEEHQdSbwAAQOwALA0ACQCAKQQ1HBEAgCyAKQQF2Ig1rIQwgDiANQQN0IgBrIQggAEEIaiEAIAQgByAKQQR0IAlqQUBqIg9BCGopAwB9IAYgDykDACIEVK19Igd8IAYgBH0iBiADfCIDIAZUrXwhBCAKQQFqIQ8DQCANQQVLDQIgDEEGTQRAIAkgAiAIakEwaikDACAAIAJqKQMAfSIFIAVCP4cgACABaikDACABIAhqQTBqKQMAfSIFIAVCP4cQLyAJKQMAIgUgA3wiAyAFVK0gCUEIaikDACAEfHwhBCANQQFqIQ0gCEEIayEIIAxBAWshDCAAQQhqIQAMAQsLIAxBB0Hkm8AAEDsACyASIAM3A2ggCUGQAmokAA8LIBIgCkEDdGogA0L//////////wODNwMAIARCBoYgA0I6iIQhAyAOQQhqIQ4gC0EBaiELIARCOochBCAPIQoMAAsAC0EHQQdBxJvAABA7AAsgDUEIaiENIBNBCGohEyAQQQFqIRAgDyELDAALAAuqAwEBfyMAQdAGayIGJAAgBkHAABDQASIGQUBrQagCENABEEQDQCABBEAgBkFAa0EAEDwgAUEBayEBDAEFIAIEQCAGQUBrIAIgAxB0CwsLIAQEQCAGQUBrIAQgBRB0CyAGQZAGaiIDQgA3AAAgA0EYakIANwAAIANBEGpCADcAACADQQhqQgA3AAAgBkFAayIBKAIEIQQgASgCACEFQYABIQIDQCABIAIQPEEAIQIgASgCAEH/A3FBwANHDQALIAFB5ABqIAU2AgAgAUHgAGogBDYCACABEA9BACEEA0AgAkEgRgRAIAEQRAUgAiADaiABIAJBfHFqQQhqKAIAIARBf3NBGHF2OgAAIARBCGohBCACQQFqIQIMAQsLQQAhAQNAIAFBIEcEQCABIAZqIAZBkAZqIAFqLQAAOgAAIAFBAWohAQwBCwtBACEBAkACQANAAkAgAUEgRg0DIAFBwABGDQAgAUHAAEYNAiAAIAFqIAEgBmotAAA6AAAgAUEBaiEBDAELC0HAAEHAAEH8qsAAEDsAC0HAAEHAAEGMq8AAEDsACyAGQdAGaiQAC74EAQl/IwBBgAxrIgIkACACIAAQjAEgAkGAAmoiCUE4ENABGiACQQE2ArgCIAJBwAJqQTgQ0AEaIAJB+AJqQQE2AgAgAkGAA2pBOBDQARogAkG4A2pBATYCACACQcADakE4ENABGiACQfgDakEBNgIAIAJBgARqIgYgAEGAAmoiBxCMASACQYAGaiIFQTgQ0AEaIAJBATYCuAYgAkHABmpBOBDQARogAkH4BmpBATYCACACQYAHakE4ENABGiACQbgHakEBNgIAIAJBwAdqQTgQ0AEaIAJB+AdqQQE2AgAgAkGACGoiAyAAEIwBIAJBgApqIgQgARCMASACIAEQGCAGIAFBgAJqIggQGCADIAcQlwEgBCAIEJcBIAMQsAEgBBCwASAJIAMQlgEgCSAEEBggAyAHEJYBIAMgAEGABGoiChCXASAEIAgQlgEgBCABQYAEaiIIEJcBIAMQsAEgBBCwASAFIAMQlgEgBSAEEBggAyACEJYBIAMQKyAEIAYQlgEgBBArIAkgAxCXASAHIAkQlgEgByAEEJcBIAUgBBCXASAGIAMQlwEgAyAAEJYBIAMgChCXASADELABIAQgARCWASAEIAgQlwEgBBCwASADIAQQGCAGIAMQlwEgAyAKEJYBIAMgCBAYIAQgAxCWASAEECsgCiAGEJYBIAogBBCXASAFIAQQlwEgAxBkIAcgAxCXASAFELABIAUQZCAAIAIQlgEgACAFEJcBIABBBTYCgAYgABCdASACQYAMaiQAC4oEAQp/IwBBgAhrIgIkACACIAAQXiACIAEQESACQYABaiIHIABBgAFqIgkQXiAHIAFBgAFqIgQQESACQYACaiIGIABBgAJqIgoQXiAGIAFBgAJqIgsQESACQYADaiIIIAAQXiAIIAkQmgEgCBCpASACQYAEaiIFIAEQXiAFIAQQmgEgBRCpASAIIAUQESAFIAIQmQEgBSAHEJoBIAggBRB7IAgQqQEgBSAJEJkBIAUgChCaASAFEKkBIAJBgAVqIgMgBBBeIAMgCxCaASADEKkBIAUgAxARIAMgBxCZASADIAYQmgEgBSADEHsgBRCpASADIAAQmQEgAyAKEJoBIAMQqQEgAkGABmoiBCABEF4gBCALEJoBIAQQqQEgAyAEEBEgBCACEJkBIAQgBhCaASAEIAMQvwEgBBCpASADIAIQmQEgAyACEJoBIAIgAxCaASACEKkBIAZBDBCrASAGEHwgBhCpASACQYAHaiIBIAcQXiABIAYQmgEgARCpASAHIAYQeyAHEKkBIARBDBCrASAEEHwgBBCpASADIAQQmQEgAyAFEBEgBiAIEJkBIAYgBxARIAMgBhC/ASAEIAIQESAHIAEQESAEIAcQmgEgAiAIEBEgASAFEBEgASACEJoBIAAgAxCZASAAEKkBIAkgBBCZASAJEKkBIAogARCZASAKEKkBIAJBgAhqJAAL8gMBCn8jAEGABGsiAiQAIAIgABCQASACIAEQSiACQUBrIgYgAEFAayIJEJABIAYgAUFAayIEEEogAkGAAWoiByAAQYABaiIKEJABIAcgAUGAAWoiCxBKIAJBwAFqIgggABCQASAIIAkQdyAIEEIgAkGAAmoiBSABEJABIAUgBBB3IAUQQiAIIAUQSiAFIAIQrgEgBSAGEHcgCCAFEH4gAkHAAWoQQiAFIAkQrgEgBSAKEHcgAkGAAmoQQiACQcACaiIDIAQQkAEgAyALEHcgAxBCIAUgAxBKIAMgBhCuASADIAcQdyAFIAMQfiACQYACahBCIAMgABCuASADIAoQdyACQcACahBCIAJBgANqIgQgARCQASAEIAsQdyAEEEIgAyAEEEogBCACEK4BIAQgBxB3IAQgAxDCASACQYADahBCIAMgAhCuASADIAIQdyACIAMQdyACEEIgB0EMEDQgAkHAA2oiASAGEJABIAEgBxB3IAEQQiAGIAcQfiAGEEIgBEEMEDQgAyAEEK4BIAMgBRBKIAcgCBCuASAHIAYQSiADIAcQwgEgBCACEEogBiABEEogBCAGEHcgAiAIEEogASAFEEogASACEHcgACADEK4BIAAQQiAJIAQQrgEgCRBCIAogARCuASAKEEIgAkGABGokAAu/BQEJfyMAQYALayIHJAAgB0E4ENABIgVBATYCOCAFQUBrQTgQ0AEaIAVB+ABqQQE2AgAgBUGAAWpBOBDQARogBUG4AWpBATYCACAFQcABakE4ENABGiAFQfgBakEBNgIAIAVBgAJqIg1BOBDQARogBUEBNgK4AiAFQcACakE4ENABGiAFQfgCakEBNgIAIAVBgANqQTgQ0AEaIAVBuANqQQE2AgAgBUHAA2pBOBDQARogBUH4A2pBATYCACAFQYAEaiILQTgQ0AEaIAVBATYCuAQgBUHABGpBOBDQARogBUH4BGpBATYCACAFQYAFakE4ENABGiAFQbgFakEBNgIAIAVBwAVqQTgQ0AEaIAVB+AVqQQE2AgAgBUGABmoiCEE4ENABGiAFQQE2ArgGIAVBwAZqQTgQ0AEaIAVB+AZqQQE2AgAgBUGAB2oiCUE4ENABGiAFQQE2ArgHIAVBwAdqQTgQ0AEaIAVB+AdqQQE2AgAgBUGACGoiB0E4ENABGiAFQQE2ArgIIAVBwAhqQTgQ0AEaIAVB+AhqQQE2AgAjAEGAAmsiCiQAIApBgAFqIgYgARBeIAggBhCZASAGIAFBgAFqEF4gByAGEJkBIAYgAUGAAmoiDBBeIAogBhBeIAYgDBBeIAkgBhCZASAGIAJBgAFqIgwQXiAKIAYQESAGIAIQXiAJIAYQESAIIAkQeyAIEKkBIAcgChB7IAcQqQEgCiAIEJkBIAgQfCAIEKkBIAYgDBBeIAogBhARIAkgBxCZASAGIAIQXiAJIAYQESAJIAoQeyAJEKkBIAcQNiAHEKkBIAEgAhAIIApBgAJqJAAgByADEKoBIAggBBCqASAFQYAJaiIBIAggCRCVASAFIAEQlgEgASAHEKEBIAsgARCWASALEGQgACAFIA0gCxB1IABBAzYCgAYgBUGAC2okAAuJBQEIfyMAQYALayIFJAAgBUE4ENABIgRBATYCOCAEQUBrQTgQ0AEaIARB+ABqQQE2AgAgBEGAAWpBOBDQARogBEG4AWpBATYCACAEQcABakE4ENABGiAEQfgBakEBNgIAIARBgAJqIgtBOBDQARogBEEBNgK4AiAEQcACakE4ENABGiAEQfgCakEBNgIAIARBgANqQTgQ0AEaIARBuANqQQE2AgAgBEHAA2pBOBDQARogBEH4A2pBATYCACAEQYAEaiIKQTgQ0AEaIARBATYCuAQgBEHABGpBOBDQARogBEH4BGpBATYCACAEQYAFakE4ENABGiAEQbgFakEBNgIAIARBwAVqQTgQ0AEaIARB+AVqQQE2AgAgBEGABmoiBkE4ENABGiAEQQE2ArgGIARBwAZqQTgQ0AEaIARB+AZqQQE2AgAgBEGAB2oiBUE4ENABGiAEQQE2ArgHIARBwAdqQTgQ0AEaIARB+AdqQQE2AgAgBEGACGoiCEE4ENABGiAEQQE2ArgIIARBwAhqQTgQ0AEaIARB+AhqQQE2AgAjAEGAAmsiByQAIAdBgAFqIgkgARBeIAggCRCZASAJIAFBgAFqEF4gByAJEF4gCSABQYACahBeIAUgCRCZASAGIAcQmQEgBiAFEBEgCBAtIAcQLSAFEC0gBhC4ASAGEDYgBhCpASAGEHwgBhCpASAFQQwQqwEgCEEDEKsBIAUQfCAFEKkBIAUgBxB7IAUQqQEgARASIAdBgAJqJAAgCCACEKoBIAYgAxCqASAEQYAJaiIBIAYgBRCVASAEIAEQlgEgASAIEKEBIAogARCWASAKEGQgACAEIAsgChB1IABBAzYCgAYgBEGAC2okAAuBBQELfyMAQTBrIgIkACACQSRqQai1wAA2AgAgAkEDOgAoIAJCgICAgIAENwMIIAIgADYCICACQQA2AhggAkEANgIQAkACQAJAIAEoAggiCkUEQCABQRRqKAIAIgRFDQEgASgCACEDIAEoAhAhACAEQQFrQf////8BcUEBaiIHIQUDQCADQQRqKAIAIgQEQCACKAIgIAMoAgAgBCACKAIkKAIMEQUADQQLIAAoAgAgAkEIaiAAQQRqKAIAEQQADQMgAEEIaiEAIANBCGohAyAFQQFrIgUNAAsMAQsgAUEMaigCACIARQ0AIABBBXQhCyAAQQFrQf///z9xQQFqIQcgASgCACEDA0AgA0EEaigCACIABEAgAigCICADKAIAIAAgAigCJCgCDBEFAA0DCyACIAUgCmoiBEEcai0AADoAKCACIARBBGopAgBCIIk3AwggBEEYaigCACEGIAEoAhAhCEEAIQlBACEAAkACQAJAIARBFGooAgBBAWsOAgACAQsgBkEDdCAIaiIMKAIEQQ9HDQEgDCgCACgCACEGC0EBIQALIAIgBjYCFCACIAA2AhAgBEEQaigCACEAAkACQAJAIARBDGooAgBBAWsOAgACAQsgAEEDdCAIaiIGKAIEQQ9HDQEgBigCACgCACEAC0EBIQkLIAIgADYCHCACIAk2AhggCCAEKAIAQQN0aiIAKAIAIAJBCGogACgCBBEEAA0CIANBCGohAyALIAVBIGoiBUcNAAsLQQAhACAHIAEoAgRJIgNFDQEgAigCICABKAIAIAdBA3RqQQAgAxsiASgCACABKAIEIAIoAiQoAgwRBQBFDQELQQEhAAsgAkEwaiQAIAAL1wQBBH8gACABENIBIQICQAJAAkAgABDMAQ0AIAAoAgAhAwJAIAAQxAFFBEAgASADaiEBIAAgAxDTASIAQfS+wAAoAgBHDQEgAigCBEEDcUEDRw0CQey+wAAgATYCACAAIAEgAhCDAQ8LIAEgA2pBEGohAAwCCyADQYACTwRAIAAQFwwBCyAAQQxqKAIAIgQgAEEIaigCACIFRwRAIAUgBDYCDCAEIAU2AggMAQtB3LvAAEHcu8AAKAIAQX4gA0EDdndxNgIACyACELwBBEAgACABIAIQgwEMAgsCQEH4vsAAKAIAIAJHBEAgAkH0vsAAKAIARw0BQfS+wAAgADYCAEHsvsAAQey+wAAoAgAgAWoiATYCACAAIAEQoAEPC0H4vsAAIAA2AgBB8L7AAEHwvsAAKAIAIAFqIgE2AgAgACABQQFyNgIEIABB9L7AACgCAEcNAUHsvsAAQQA2AgBB9L7AAEEANgIADwsgAhDLASIDIAFqIQECQCADQYACTwRAIAIQFwwBCyACQQxqKAIAIgQgAkEIaigCACICRwRAIAIgBDYCDCAEIAI2AggMAQtB3LvAAEHcu8AAKAIAQX4gA0EDdndxNgIACyAAIAEQoAEgAEH0vsAAKAIARw0BQey+wAAgATYCAAsPCyABQYACTwRAIAAgARAWDwsgAUEDdiICQQN0QeS7wABqIQECf0Hcu8AAKAIAIgNBASACdCICcQRAIAEoAggMAQtB3LvAACACIANyNgIAIAELIQIgASAANgIIIAIgADYCDCAAIAE2AgwgACACNgIIC+UDAQN/IwBB0CJrIgMkACADQcAWaiIEQcitwAAQSSADQcgcaiIFQYCuwAAQSSADQQhqIAQgBRBLIANBiAFqQTgQ0AEaIANBwAFqQTgQ0AEaIANB+AFqED0CQCACEIYBBEAgABBVDAELIANB+ARqIgQQPSAEIAEQfSAEEEcgA0H4B2oiARBnIAEgAhB4IAEQRiADQcgcaiICIAEQkAEgA0G4CWogAhCQASACIANBuAhqEJABIANB+AlqIAIQkAEgA0G4CmoiARA9IANBuA1qEFUgASAEEH0gA0HAE2oiARA9IAEgBBB9IAEQogEgA0HAAWogA0GIAWoQUEECayECA0AgAkEBakEBTQRAIANBuA1qIgEQngEgACABQYgGENEBGgUgA0G4DWoQGiADQcAWaiADQbgKaiADQbgJaiADQfgJahALAkACQAJAIANBwAFqIAIQUyADQYgBaiACEFNrQQFqDgMBAgACCyADQcgcaiIBIANBuApqIANB+ARqIANBuAlqIANB+AlqEAogA0HAFmogARADDAELIANByBxqIgEgA0G4CmogA0HAE2ogA0G4CWogA0H4CWoQCiADQcAWaiABEAMLIAJBAWshAiADQbgNaiADQcAWahABDAELCwsgA0HQImokAAvBAwEVfwNAIANBwAFGBEACQCAAQShqIQsgAEEUaigCACIMIQggAEEQaigCACINIQIgAEEMaigCACIOIQEgACgCCCIPIQMgAEEYaigCACIQIQogAEEcaigCACIRIQQgAEEgaigCACISIQcgAEEkaigCACITIQYDQCAHIQkgBCEHIAohBCAFQYACRg0BIAEgAnEhFCABIAJzIRUgBSALaigCACAFQcCiwABqKAIAIAkgBEF/c3EgBCAHcXIgBmogBEEadyAEQRV3cyAEQQd3c2pqaiIGIAhqIQogBUEEaiEFIAIhCCABIQIgAyIBQR53IAFBE3dzIAFBCndzIBQgASAVcXNqIAZqIQMgCSEGDAALAAsFIAAgA2oiAkHoAGogAkEoaigCACACQcwAaigCACACQeAAaigCACIBQQ93IAFBDXdzIAFBCnZzamogAkEsaigCACIBQRl3IAFBDndzIAFBA3ZzajYCACADQQRqIQMMAQsLIAAgBiATajYCJCAAIAkgEmo2AiAgACAHIBFqNgIcIAAgBCAQajYCGCAAIAggDGo2AhQgACACIA1qNgIQIAAgASAOajYCDCAAIAMgD2o2AggL5AEBAn8jAEGAA2siAyQAIAMQPSAAIAEgAkEfdSIEIAJzIARBf3NqQQJtIgJBAWtBH3YQbyAAIAFBgANqIAJBAXNBAWtBH3YQbyAAIAFBgAZqIAJBAnNBAWtBH3YQbyAAIAFBgAlqIAJBA3NBAWtBH3YQbyAAIAFBgAxqIAJBBHNBAWtBH3YQbyAAIAFBgA9qIAJBBXNBAWtBH3YQbyAAIAFBgBJqIAJBBnNBAWtBH3YQbyAAIAFBgBVqIAJBB3NBAWtBH3YQbyADIAAQfSADEKIBIAAgAyAEQQFxEG8gA0GAA2okAAvlAwEIfyMAQZAGayICJAAgAEFAayEIAkAgAUH4AGooAgAgASgCOGqsIABB+ABqKAIAIgcgACgCOCIEaqx+Qv///w9XDQAgBEEBSgR/IAAQHiAAKAJ4BSAHC0EBTA0AIAgQHgsgAkHYpMAAEEkgAkE4aiIHQfAAENABGiACIQNBACECA0AgAkE4RgRAAkAgB0E4aiEEQQAhAgNAIAJBOEYNASACIARqIAIgA2opAwA3AwAgAkEIaiECDAALAAsFIAIgB2pCADcDACACQQhqIQIMAQsLIANBqAFqIgYgABBdIANB4AFqIgUgARBdIANBmAJqIgIgACABEAUgA0GIA2oiBCAIIAFBQGsiARAFIAYgCBBgIAYQQiAFIAEQYCAFEEIgA0H4A2oiCSAGIAUQBUEAIQEgA0HoBGoiBkHwABDQASEFA0AgAUHwAEcEQCABIAVqIAEgAmopAwA3AwAgAUEIaiEBDAELCyAGIAQQYkEAIQEDQCABQfAARwRAIAEgBGoiBSABIAdqKQMAIAUpAwB9NwMAIAFBCGohAQwBCwsgAiAEEGIgAhBIIAkgBhBjIAkQSCADQdgFaiIBIAIQayAAIAEQaiAAQQM2AjggASAJEGsgCCABEGogAEECNgJ4IANBkAZqJAALowIBCH8jAEGABmsiAiQAIAIgAEGAAWoiBxBeIAJBgAFqIgQgBxBeIAQQLSACQYACaiIFIAIQXiAFIABBgAJqIgMQESACQYADaiIBIAMQXiABEC0gAyAEEJkBIAMgBBCaASADEKkBIAMQuAEgAxC4ASADEKkBIAFBDBCrASABEHwgARCpASACQYAEaiIIIAEQXiAIIAMQESACQYAFaiIGIAQQXiAGIAEQmgEgBhCpASADIAUQESAFIAEQmQEgBSABEJoBIAEgBRCaASABEKkBIAQgARB7IAQQqQEgBiAEEBEgBiAIEJoBIAUgABCZASAFIAIQESAAIAQQmQEgABCpASAAIAUQESAAELgBIAAQqQEgByAGEJkBIAcQqQEgAkGABmokAAu8AgEGfyMAQYAIayIBJAAgASAAEIwBIAFBgAJqIgMgAEGABGoiBRCMASABQYAEaiIEIABBgAJqIgYQjAEgAUGABmoiAkE4ENABGiABQQE2ArgGIAFBwAZqQTgQ0AEaIAFB+AZqQQE2AgAgAUGAB2pBOBDQARogAUG4B2pBATYCACABQcAHakE4ENABGiABQfgHakEBNgIAIAAQISACIAAQlgEgAiAAEJcBIAAgAhCXASAAELABIAEQyQEgARCzASAAIAEQlwEgAxAhIAMQZCACIAMQlgEgAiADEJcBIAMgAhCXASADELABIAQQISACIAQQlgEgAiAEEJcBIAQgAhCXASAEELABIAYQsgEgBhCzASAFEMkBIAUQswEgBiADEJcBIAUgBBCXASAAQQU2AoAGIAAQnAEgAUGACGokAAv/AQEHfyMAQcACayIBJAAgASAAQUBrIgYQkAEgARBMIAFBQGsiAyAGEJABIAMgAEGAAWoiAhBKIAFBgAFqIgQgAhCQASAEEEwgAiABEK4BIAIgARB3IAIQQiACEIIBIAIQggEgAhBCIARBDBA0IAFBwAFqIgcgBBCQASAHIAIQSiABQYACaiIFIAEQkAEgBSAEEHcgBRBCIAIgAxBKIAMgBBCuASADIAQQdyAEIAMQdyABIAQQfiABEEIgBSABEEogBSAHEHcgAyAAEK4BIAMgBhBKIAAgARCuASAAEEIgACADEEogABCCASAAEEIgBiAFEK4BIAYQQiABQcACaiQAC84CAgd/An4CQAJAAkBBDSABQTpuIgJrIgRBDU0EQEEMIAJrIgNBDk8NASAAIAAgA0EDdGopAwBBOiABIAJBOmxrIgNrrSIKhyAAIARBA3RqKQMAIAOtIgmGhDcDaCAEQQ1rIQUgAEHgAGohBCACQQFqIQZBACACQQN0ayEHQQshAwNAAkAgA0ECaiAGTQRAIAFBrAZPDQEgACACQQN0aiAAKQMAIAmGQv//////////A4M3AwADQCACRQ0HIABCADcDACACQQFrIQIgAEEIaiEADAALAAsgAyAFakEOTw0EIAQgBCAHaiIIQQhrKQMAIAqHIAgpAwAgCYZC//////////8Dg4Q3AwAgA0EBayEDIARBCGshBAwBCwsgAkEOQYCywAAQOwALIARBDkHQscAAEDsACyADQQ5B4LHAABA7AAtBf0EOQfCxwAAQOwALC6cCAQR/IABCADcCECAAAn9BACABQYACSQ0AGkEfIAFB////B0sNABogAUEGIAFBCHZnIgNrdkEBcSADQQF0a0E+agsiBDYCHCAEQQJ0Qey9wABqIQMgACECAkACQAJAAkBB4LvAACgCACIAQQEgBHQiBXEEQCADKAIAIQMgBBCfASEAIAMQywEgAUcNASADIQAMAgtB4LvAACAAIAVyNgIAIAMgAjYCAAwDCyABIAB0IQQDQCADIARBHXZBBHFqQRBqIgUoAgAiAEUNAiAEQQF0IQQgACIDEMsBIAFHDQALCyAAKAIIIgEgAjYCDCAAIAI2AgggAiAANgIMIAIgATYCCCACQQA2AhgPCyAFIAI2AgALIAIgAzYCGCACIAI2AgggAiACNgIMC7YCAQV/IAAoAhghBAJAAkAgACAAKAIMRgRAIABBFEEQIABBFGoiASgCACIDG2ooAgAiAg0BQQAhAQwCCyAAKAIIIgIgACgCDCIBNgIMIAEgAjYCCAwBCyABIABBEGogAxshAwNAIAMhBSACIgFBFGoiAygCACICRQRAIAFBEGohAyABKAIQIQILIAINAAsgBUEANgIACwJAIARFDQACQCAAIAAoAhxBAnRB7L3AAGoiAigCAEcEQCAEQRBBFCAEKAIQIABGG2ogATYCACABDQEMAgsgAiABNgIAIAENAEHgu8AAQeC7wAAoAgBBfiAAKAIcd3E2AgAPCyABIAQ2AhggACgCECICBEAgASACNgIQIAIgATYCGAsgAEEUaigCACIARQ0AIAFBFGogADYCACAAIAE2AhgLC+UBAQZ/IwBBgARrIgIkACACIAAQXiACQYABaiIFIABBgAFqIgYQXiACQYACaiIDQTgQ0AEaIAJBATYCuAIgAkHAAmpBOBDQARogAkH4AmpBATYCACACQYADaiIEIAYQXiACIAEQESAFIAFBgAFqIgcQESADIAcQmQEgAyABEJoBIAQgABCaASADEKkBIAQQqQEgBCADEBEgAyACEJkBIAMQNiAEIAMQmgEgBBCpASADIAUQmQEgAxA2IAYgBBCZASAGIAMQmgEgBRB8IAAgBRCZASAAIAIQmgEgABCwASACQYAEaiQAC28BDH9BjL/AACgCACICRQRAQZy/wABB/x82AgBBAA8LQYS/wAAhBgNAIAIiASgCCCECIAEoAgQhAyABKAIAIQQgAUEMaigCABogASEGIAVBAWohBSACDQALQZy/wAAgBUH/HyAFQf8fSxs2AgBBAAuAAgEGfyMAQYAIayIBJAAgACgCgAZBAUcEQCABIAAQjAEgAUGAAmoiAiAAQYACaiIEEIwBIAFBgARqIgUgAEGABGoiAxCMASABQYAGaiIGIAAQjAEgARAhIAIgAxAYIAIQswEgAhCwASAFECEgBiAEEBggBhCzASADIAAQlwEgAyAEEJcBIAMQsAEgAxAhIAAgARCWASABIAIQlwEgARCwASABIAUQlwEgASAGEJcBIAEQsAEgARArIAIQZCAFEGQgACACEJcBIAQgBRCWASAEIAYQlwEgAyABEJcBIABBBEEFIAAoAoAGQX5xQQJGGzYCgAYgABCdAQsgAUGACGokAAuZAgEBfyMAQYANayIDJAAgAyABEGkgAxCdASADQYgGaiIBIAIQXSABEEIgA0HABmoiAiABEF0gAkEDECkaIAIQQiADQfgGaiADEGkCQCACEFdFBEAgA0HABmoQKkECayECA0AgAkEBakEBTQRAIANB+AZqIgEQnAEMAwUgA0H4BmoQEwJAAkACQCADQcAGaiACEFMgA0GIBmogAhBTa0EBag4DAQIAAgsgA0H4BmogAxAHDAELIAMQngEgA0H4BmogAxAHIAMQngELIAJBAWshAgwBCwALAAsgA0H4BmoiARC3ASABQYABahC2ASABQYACahCxASABQYAEahCxASABQQE2AoAGCyAAIAFBiAYQ0QEaIANBgA1qJAALhgICBH8BfiMAQTBrIgIkACABQQRqIQQgASgCBEUEQCABKAIAIQMgAkEQaiIFQQA2AgAgAkIBNwMIIAIgAkEIajYCFCACQShqIANBEGopAgA3AwAgAkEgaiADQQhqKQIANwMAIAIgAykCADcDGCACQRRqIAJBGGoQDBogBEEIaiAFKAIANgIAIAQgAikDCDcCAAsgAkEgaiIDIARBCGooAgA2AgAgAUEMakEANgIAIAQpAgAhBiABQgE3AgQgAiAGNwMYQQxBBBC5ASIBRQRAQQxBBBDPAQALIAEgAikDGDcCACABQQhqIAMoAgA2AgAgAEGEt8AANgIEIAAgATYCACACQTBqJAAL5AEBAn8jAEHAAWsiAyQAIAMQZyAAIAEgAkEfdSIEIAJzIARBf3NqQQJtIgJBAWtBH3YQbiAAIAFBwAFqIAJBAXNBAWtBH3YQbiAAIAFBgANqIAJBAnNBAWtBH3YQbiAAIAFBwARqIAJBA3NBAWtBH3YQbiAAIAFBgAZqIAJBBHNBAWtBH3YQbiAAIAFBwAdqIAJBBXNBAWtBH3YQbiAAIAFBgAlqIAJBBnNBAWtBH3YQbiAAIAFBwApqIAJBB3NBAWtBH3YQbiADIAAQeCADEKQBIAAgAyAEQQFxEG4gA0HAAWokAAvDAwIGfwN+IwBB8ABrIgEkACABQcCywAAQSSABQThqIAEQXSAAEEICQAJAAkAgAQJ/IAAoAjgiAkEQTARAIAJBAWsQNQwBCyABKQMwIghCAXwiByAIVA0BIAApAzAiCEKAgICAgICAgIB/USAHQn9RcQ0CIAFBOGoiAiAIIAd/pxApIQcgASABKQNoIAdCOoZ8NwNoIAAgAhBhIAAQQkECCyIEECgDQCAERQ0DQQAhAyABIAEpAwgiCEI5hkKAgICAgICAgAKDIAEpAwBCAYeEIgc3AwAgACkDACAHfSEHIABBCGohBSAAIAFBOGoiAkEBA38gAiADaiAHQv//////////A4M3AwAgB0I6hyEHIANBKEYEfyABIAEpAzBCAYciCDcDMCACIAApAzAgCH0gB3wiBzcDMCAHQj+IpwUgASADaiIGQQhqIAhCAYcgBkEQaikDACIIQjmGQoCAgICAgICAAoOEIgk3AwAgAyAFaikDACAHfCAJfSEHIANBCGohAwwBCwtrEDAgBEEBayEEDAALAAtB4LPAAEEZQcSzwAAQWQALQYC0wABBH0HEs8AAEFkACyAAQQE2AjggAUHwAGokAAvuAQECfyMAQbABayIDJAAgA0EwENABIQMCQAJAA0AgAkEwRgRAIANBMGogAxBwIAFBMGohAUEAIQIDQCACQTBGDQMgAkEwRg0EIAIgA2ogASACai0AADoAACACQQFqIQIMAAsACyACQeAARwRAIAIgA2ogASACai0AADoAACACQQFqIQIMAQsLQeAAQeAAQYCmwAAQOwALIANB8ABqIgEgAxBwIABBOBDQASIAQQE2AjggAEFAa0E4ENABIABB+ABqQQE2AgAgACABEK4BIANBMGoQrgEgA0GwAWokAA8LIAJBMGpB4ABBkKbAABA7AAuPAgEDfyMAQSBrIgUkAEEBIQZB2LvAAEHYu8AAKAIAIgdBAWo2AgACQEGgv8AALQAABEBBpL/AACgCAEEBaiEGDAELQaC/wABBAToAAAtBpL/AACAGNgIAAkACQCAHQQBIIAZBAktyDQAgBSAEOgAYIAUgAzYCFCAFIAI2AhBBzLvAACgCACICQQBIDQBBzLvAACACQQFqIgI2AgBBzLvAAEHUu8AAKAIAIgMEf0HQu8AAKAIAIAUgACABKAIQEQAAIAUgBSkDADcDCCAFQQhqIAMoAhQRAABBzLvAACgCAAUgAgtBAWs2AgAgBkEBSw0AIAQNAQsACyMAQRBrIgIkACACIAE2AgwgAiAANgIIAAucAQEEfyMAQYADayICJAAgAiAAEF4gAkGAAWoiASAAQYABaiIEEF4gAkGAAmoiAyAAEF4gAyAEEBEgAiAEEJoBIAEQfCABIAAQmgEgAhCpASABEKkBIAAgAhCZASAAIAEQESABIAMQmQEgARB8IAEgAxCaASABEKkBIAEQNiAAIAEQmgEgAxC4ASAEIAMQmQEgABCwASACQYADaiQAC7kBAQJ/IwBBIGsiAyQAAkAgASABIAJqIgFLDQAgAEEEaigCACICQQF0IgQgASABIARJGyIBQQggAUEISxshAQJAIAIEQCADQRhqQQE2AgAgAyACNgIUIAMgACgCADYCEAwBCyADQQA2AhALIAMgASADQRBqECYgAygCAARAIANBCGooAgAiAEUNASADKAIEIAAQzwEACyADKAIEIQIgAEEEaiABNgIAIAAgAjYCACADQSBqJAAPCxBlAAusAQECfyMAQYADayIDJAAgA0EIaiABEJABAkAgAgRAIANBCGogAhCuAQwBCyADQQhqEDoLIANByABqIgJB8LTAABBJIANBgAFqIAIQjgEgA0HAAWoiAiADQQhqIgQQkAEgAhBMIAIgARBKIAAgARCQASAAIAQQSiADQYACaiACEJABIAAQViEBIANBwAJqIgIgABCQASACEEMgAhBCIAAgAiABEHIgA0GAA2okAAueAQEFfyMAQYABayICJAAgAkE4ENABIgJBATYCOCACQUBrIgNBOBDQARogAkEBNgJ4IAIgABCuASACIAFBgAFqIgUQSiADIAEQrgEgAyAAQYABaiIGEEoCQCACIAMQWEUNACACIABBQGsQrgEgAiAFEEogAkFAayIAIAFBQGsQrgEgACAGEEogAiAAEFhFDQBBASEECyACQYABaiQAIAQLpwEBA38jAEEwayICJAAgAUEEaiEDIAEoAgRFBEAgASgCACEBIAJBEGoiBEEANgIAIAJCATcDCCACIAJBCGo2AhQgAkEoaiABQRBqKQIANwMAIAJBIGogAUEIaikCADcDACACIAEpAgA3AxggAkEUaiACQRhqEAwaIANBCGogBCgCADYCACADIAIpAwg3AgALIABBhLfAADYCBCAAIAM2AgAgAkEwaiQAC5UBAQJ/AkACQAJAAkACfwJAAkACf0EBIgMgAUEASA0AGiACKAIAIgRFDQEgAigCBCICDQQgAQ0CQQEMAwshA0EAIQEMBgsgAQ0AQQEMAQsgAUEBELkBCyICRQ0BDAILIAQgARCsASICDQELIAAgATYCBEEBIQEMAQsgACACNgIEQQAhAwsgACADNgIAIABBCGogATYCAAvvMwISfwV+IwBBMGsiDiQAIA5BEGogACABEFsgDiAOKAIUIgA2AhwgDiAOKAIQIgg2AhggDkEIaiACIAMQWyAOIA4oAgwiATYCJCAOIA4oAggiAzYCICAOIAQgBRBbIA4gDigCBCIFNgIsIA4gDigCACINNgIoIAAhBCMAQZAVayICJAAjAEGwBmsiCiQAIApBEGpBOBDQARogCkHQAGpBOBDQASEVIApBiAFqQQE2AgAgCkEBNgJIIApBkAFqIgBB2KTAABBJIAAQKiEPIApByAFqIhNBgAIQ0AEaIApByANqQYABENABGiMAQdAAayIRJAAgEUEQakHAABDQARogASEJQQAhACMAQYAEayIHJAAgB0EvakGBAhDQARogB0GwAmpBwAAQ0AEaIAdB8AJqQcAAENABGiAHQbADakHAABDQARogByAPQf8AakEDdkEBaiISQQF0IgFBCHQgAUGA/gNxQQh2cjsALCABQQFrQQV2QQFqIQsCQANAIAYgB2pBLmogADoAACAGQStGBEAgB0EsaiIGQS5qQSs6AAAgB0EgaiAGQS8QX0EAIQAgB0GwAmpBwAAgAyAJIAcoAiAgBygCJBAGIAdBADoA+AMgByALNgL0A0EAIAFrIRQgB0EBNgLwAyAGQSxqIRYMAgsgBkGBAkcEQCAGQcClwABqLQAAIQAgBkEBaiEGDAELCyAGQQNqQYQCQfCrwAAQOwALA0ACQCAHQRhqIQlBACEGQQAhCwJAIAdB8ANqIgMtAAgNACADKAIAIgsgAygCBCIXSw0AIAsgF08EQEEBIQYgA0EBOgAIDAELQQEhBiADIAtBAWo2AgALIAkgCzYCBCAJIAY2AgACQCAHKAIYBEAgBygCHCEDQQAhBgNAIAZBIEYEQCAHIAM6ACxBACEGAkACQANAIAZBK0YEQCAWQSs6AAAjAEEQayIDJAAgA0EIaiAHQbADakHAAEEgEIEBIAMoAgwhCSAHQRBqIgYgAygCCDYCACAGIAk2AgQgA0EQaiQAIAcoAhQhAyAHKAIQIQkgB0EIaiAHQSxqQS0QX0EAIQYgB0HwAmpBACAJIAMgBygCCCAHKAIMEAZBAEGAAiAAayIDIANBgAJLGyEDIAAgE2ohCSAAIBRqIQsDQCAGQSBGDQggBkHAAEYNBCADIAZGDQMgBiAJaiAHQfACaiAGai0AADoAACAGQQFqIgYgC2oNAAsgASEADAkLIAZBgwJHBEAgBiAHakEtaiAGQcClwABqLQAAOgAAIAZBAWohBgwBCwsgBkEBakGEAkGwrMAAEDsACyAAIAZqQYACQYCtwAAQOwALQcAAQcAAQfCswAAQOwALIAZBwABHBEAgB0HwAmogBmoiCSAJLQAAIAdBsAJqIAZqLQAAcyIJOgAAIAdBsANqIAZqIAk6AAAgBkEBaiEGDAELC0HAAEHAAEGgrMAAEDsACyAHQYAEaiQADAELIAAgBmohAAwBCwsgEUHQAGokACASQQN0IA9rIQlBACEAAkACQANAIABBAkcEQCAAQQFqIApByAFqIBBqIQZBACEDAkADQCADIBJGDQEgAyAQaiIHQf8BSw0EIANBgAFHBEAgCkHIA2ogA2ogAyAGai0AADoAACADQQFqIQMMAQsLQYABQYABQaClwAAQOwALIwBBEGsiAyQAIANBCGogCkHIA2pBgAEgEhCBASADKAIMIQYgCkEIaiIHIAMoAgg2AgAgByAGNgIEIANBEGokACAKKAIIIQMgCigCDCELIApBwAVqIg9B8AAQ0AEhBgNAIAsEQCAGQQgQFSAGIAYpAwAgAzEAAHw3AwAgC0EBayELIANBAWohAwwBCwsgCkGIBWohEyMAQeABayILJAAgDxBIIAsgCkGQAWoQLiALQfAAakHwABDQARogCyAJIgMQFQNAIAtB8ABqIQZBACEHA0AgB0HwAEcEQCAGIAdqIAcgD2opAwA3AwAgB0EIaiEHDAELCyAGIAsQYyAGEEhBACEHQgAhGCAGKQMIIA8pAwCFIhlCAYZCAYchG0F/IAspA9gBQj+Hp2usIRwDfiAHQfAARgR+IBgFIAcgD2oiESARKQMAIhogGYUgBiAHaikDACAahSAcg4UiGiAbhTcDACAYIBqFIRggB0EIaiEHDAELCxogAwRAQQAhBkEAIQdBACERAkACQANAIAZB6ABGBEAgC0HoAGogCykDaEIBhzcDACALQfAAaiEGA0AgB0UNBCAGQgA3AwAgB0EBayEHIAZBCGohBgwACwALIAZB8ABGDQEgBkHwAEcEQCAGIAtqIhQgFEEIaikDAEI5hkL//////////wODIBQpAwBCAYeENwMAIBFBAWohESAGQQhqIQYMAQsLQQ5BDkGgssAAEDsACyARQQ5BkLLAABA7AAsgA0EBayEDDAEFIBMgDxBdIAtB4AFqJAALCyAKQcgEaiIDIBMQjgEgCkEQaiAAQQZ0aiADQcAAENEBGiAQIBJqIRAhAAwBCwsgAiAKQRBqEAIgCkHIAWoiACAVEAIgAiAAEAkjAEGAAmsiACQAIABBCGoiAUHYgcAAEEkgAEFAayIDIAIgARC9ASACIAMQeCAAQYACaiQAIAIQRiAKQbAGaiQADAELIAdBgAJBkKXAABA7AAsgAkHAAWohASMAQeACayIAJAAgAEEwENABIgBBMGpB0IDAABBJAkACQAJAAkADQAJAIAxBMEYEQCAAIAAtAABBH3E6AAAgAEHoAGogABC+ASAEDQFBAEEAQZiBwAAQOwALIAQgDEYNAiAAIAxqIAggDGotAAA6AAAgDEEBaiEMDAELC0EAIQwgCCwAACIJQQBIDQIgCEEwaiEDIARBMCAEQTBLG0EwayEIA0AgDEEwRgRAIABBoAFqIgQgABC+ASMAQYABayIDJAAgARBnIAEgAEHoAGoQwAEgAUFAayIIIAQQwAEgAUGAAWoQygEgARBCIAMgARBPIANBQGsiBCAIEJABIAQQTCAEIAMQWEUEQCABEJIBCyADQYABaiQADAULIAggDEYNAiAAIAxqIAMgDGotAAA6AAAgDEEBaiEMDAALAAsgBCAEQYiBwAAQOwALIAxBMGogBEGogcAAEDsACyMAQcABayIDJAAgAEGgAWoiBBBnIANBOBDQASIDQQE2AjggBCAAQegAahDAASAEEEIgBEGAAWoQygEgA0FAayIIIAQQTwJAAkACQCAIIAMQWkEBRgRAIANBgAFqIgggA0FAayADECMgCBBWDQEMAgsgBBCSAQwCCyADQYABaiIIEEMgCBBCCyAEQUBrIANBgAFqEK4BCyADQcABaiQAIAlBIHEiA0EAIABB4AFqEE0iBEEBRxtBASADIARBAUdyGwRAIABBoAFqEKQBCyABIABBoAFqQcABENEBGgsgAEHgAmokAAJ/QQAhAyMAQcAFayIAJAACQCABEIYBDQAgAEEIaiIIQZCtwAAQSSAAQYAEaiIEQbiuwAAQSSAAQUBrIgkgBBCOASAAQYABaiIEEGcgBCABEHggBCAJEEogAEHAAmoiBCABIAgQvQEgASAEECQNACAAQYAEaiIEIABBwAJqIgEgAEEIahC9ASABIARBwAEQ0QEaIAEQpAEgAEGAAWogARAkRQ0AQQEhAwsgAEHABWokAEF/IANFDQAaIAJBwAFqEKQBIAJBgANqIQhBACEAIwBB4ARrIgEkACABQeAAENABIQECQCAFBEADQCAAQeAARgRAIAEgAS0AAEEfcToAACABQeAAaiABEB9BACEAAkAgDSwAACILQQBOBEAgDUHgAGohAyAFQeAAIAVB4ABLG0HgAGshBANAIABB4ABGBEAgAUHgAWoiACABEB8gCCABQeAAaiAAED8MAwsgACAERwRAIAAgAWogACADai0AADoAACAAQQFqIQAMAQsLIABB4ABqIAVB1KfAABA7AAsjAEHAAWsiAyQAIAFB4AFqIgAQPSADQTgQ0AEiDUEBNgI4IAAgAUHgAGoQmQEgAEGAAWoiDxC3ASAAQYACahC3ASAAEKkBIA1BQGsiBCAAEDgjAEHAAWsiAyQAIAMgBBBeIAMQpAEgAyAEEBEgA0GAAWoiBCADQcAAENEBGiAEIA0QWiEEIANBwAFqJAACQAJAAkAgBEEBRgRAIwBBwANrIgAkACANQUBrIgQQiAFFBEAgACAEQUBrIgcQkAEgAEFAayIDIAQQkAEgAEGAAWoiBSAEEJABIABBwAFqIgZBOBDQARogAEEBNgL4ASAAQYACaiIKQTgQ0AEaIABBATYCuAIgABBMIAMQTCAAIAMQdyAAEEIgAEHAAmoiCSAAIA0QIyADIAkQrgEgACADEK4BIAMgBBCuASADIAAQdyADEEIgAxA3IAAgBxCuASAAEDcgAyAKEFohDCAFIAoQrgEgBRBDIAUQQiAGIAMQrgEgBhBDIAYQQiADIAZBASAMayIMEHIgCiAFIAwQciAJIAMgChAjIAQgCRCuASAFIAMQrgEgBSAKEDMgBSAEEEogByAFEK4BIAcgABBKIAYgBBCuASAEIAcgDBByIAcgBiAMEHIgBBCJASEDIAkgBBBeIAkQNiAJEKkBIAQgCSADEI0BCyAAQcADaiQAIAQQiQENAQwCCyAAEJsBDAILIA1BQGsQNgsgDUFAayIAELUBIA8gABCZAQsgDUHAAWokAEEAIQACQCABQeACaiIDEIgBDQAgA0FAaxBNIgANACADEE0hAAsgC0EgcSIDQQAgAEEBRyIAG0EBIAAgA3IbBEAgAUHgAWoQogELIAggAUHgAWpBgAMQ0QEaCyABQeAEaiQADAMLIAAgBUcEQCAAIAFqIAAgDWotAAA6AAAgAEEBaiEADAELCyAFIAVBxKfAABA7AAtBAEEAQbSnwAAQOwALIwBBwAdrIg0kACANQcABaiIDQcitwAAQSSANQcAEaiIFQYCuwAAQSSANQQhqIgEgAyAFEEsgARA+IAEQqQEgDUGIAWoiCUGQrcAAEEkgAxA9IAMgCBB9IwBBgAFrIgAkACAAIAEQXiAAEC0gAxCkASADQYABaiIEEKQBIANBgAJqIgYQpAEgBhC1ASADIAAQESAEIAAQESAEIAEQESAAQYABaiQAQQAhBCMAQfA2ayIAJAAgAEE4ENABIgFBOGpBOBDQARogAUHwAGoQPSABQfADahA9IAFB8AZqED0CQAJAIAgQigFFBEAgAUHwIWoiBhA9IAFB8CRqIgcQPSABQfAnaiIKED0gAUHwKmoiDBA9IAFB8C1qIgsQPSABQfAwaiIPED0gAUHwM2oiABA9IAFB8B5qED0gAUHwCWoiECAGQYADENEBGiABQfAMaiAHQYADENEBGiABQfAPaiAKQYADENEBGiABQfASaiAMQYADENEBGiABQfAVaiALQYADENEBGiABQfAYaiAPQYADENEBGiABQfAbaiAAQYADENEBGiAAQecAENABGiABQfADaiIAIAgQfSAAEBIgECAIEH0MAQsgBSABQfAAakGAAxDRARoMAQsDQCAEQYAVRwRAIAFB8AZqIgAgAUHwCWogBGoiBhB9IAZBgANqIgYgABB9IAYgAUHwA2oQCCAEQYADaiEEDAELCyABQThqIgAgCRBqIAEpAzghGCAAQQEQkwEgABBCIAEpAzghGSABIAAQaiABQQEQkwEgARBCIAAgASAYQgKBpxAwIAFB8ANqIgQgCCAZQgKBpxBvIAFB8AZqIAQQfSAAECpBA2oiBkECdiIAQQFqIQhBACEEAkACQANAIAFBOGpBBRCPASEJIAQgCEYEQCAGQZgDTw0CIAFB8DNqIAhqIAk6AAAgAUHwAGogAUHwCWogCUEYdEEYdRAQDAMLIARB5wBHBEAgAUHwM2ogBGogCUEQayIHOgAAIAFBOGoiCSAHQRh0QRh1EJQBIAkQQiAJQQQQLCAEQQFqIQQMAQsLQecAQecAQaCowAAQOwALIAhB5wBBsKjAABA7AAsDQCAAQX9HBEAgAUHwA2oiCCABQfAJaiABQfAzaiAAaiwAABAQIABBAWshACABQfAAaiIEEBIgBBASIAQQEiAEEBIgBCAIEAgMAQsLIwBBgANrIgAkACAAED0gACABQfAGahB9IAAQogEgAUHwAGoiBCAAEAggAEGAA2okACAFIARBgAMQ0QEaCyABQfA2aiQAIAUQogEjAEGAAmsiACQAIAAgAxBeIABBgAFqIgEgBRBeIAAgBUGAAmoiBBARIAEgA0GAAmoiCBARAn8CQCAAIAEQegRAIAAgA0GAAWoQmQEgACAEEBEgAEGAAWoiASAFQYABahCZASABIAgQESAAIAEQeg0BC0EADAELQQELIQEgAEGAAmokACANQcAHaiQAQX8gAUUNABojAEHgA2siACQAIABBgAFqIgFBwKjAABBJIABBuAFqIgNB+KjAABBJIAAgASADEEsgAEHwAmoiAUGwqcAAEEkgAEGoA2oiA0HoqcAAEEkgAEHwAWoiBCABIAMQSyACQYAGaiIBIAAgBBA/IABB4ANqJAAgAkGACWohByACQYADaiEIIwBBkDRrIgAkACAAQYAoaiIDQcitwAAQSSAAQYguaiIEQYCuwAAQSSAAIAMgBBBLIABBgAFqQTgQ0AEaIABBuAFqQTgQ0AEaIABB8AFqED0CQCACQcABaiIEEIYBRQRAIAIQhgEEQCAHIAEgBBAODAILIABB8ARqIgMQPSADIAEQfSADEEcgAEHwB2oiBRBnIAUgBBB4IAUQRiAAQbAJaiIEED0gBCAIEH0gBBBHIABBsAxqIggQZyAIIAIQeCAIEEYgAEGILmoiASAFEJABIABB8A1qIAEQkAEgASAAQbAIahCQASAAQbAOaiABEJABIAEgCBCQASAAQfAOaiABEJABIAEgAEHwDGoQkAEgAEGwD2ogARCQASAAQfAPaiIBED0gAEHwEmoiBRA9IABB8BVqEFUgASADEH0gBSAEEH0gAEH4G2oiARA9IAEgAxB9IAEQogEgAEH4HmoiARA9IAEgBBB9IAEQogEgAEG4AWogAEGAAWoQUEECayEBA0AgAUEBakEBTQRAIABB8BVqIgEQngEgByABQYgGENEBGgwDBSAAQfAVaiIEEBogAEH4IWoiAyAAQfAPaiAAQfANaiAAQbAOahALIABBgChqIgUgAEHwEmogAEHwDmogAEGwD2oQCyADIAUQAyAEIAMQAQJAAkACQCAAQbgBaiABEFMgAEGAAWogARBTa0EBag4DAQIAAgsgAEGILmoiAyAAQfAPaiAAQfAEaiAAQfANaiAAQbAOahAKIABB+CFqIgQgA0GIBhDRARogAyAAQfASaiAAQbAJaiAAQfAOaiAAQbAPahAKIAQgAxADIABB8BVqIAQQAQwBCyAAQYguaiIDIABB8A9qIABB+BtqIABB8A1qIABBsA5qEAogAEH4IWoiBCADQYgGENEBGiADIABB8BJqIABB+B5qIABB8A5qIABBsA9qEAogBCADEAMgAEHwFWogBBABCyABQQFrIQEMAQsACwALIAcgCCACEA4LIABBkDRqJAAjAEHgH2siCCQAIAhB0BNqIgFByK3AABBJIAhB2BlqIg1BgK7AABBJIAggASANEEsgCEGAAWoiC0GQrcAAEEkgAkGID2oiACAHEGkgCEG4AWoiBSAAEGkjAEGACGsiAyQAIAMgBRCMASADQYACaiIJIAVBgAJqIg8QjAEgA0GABGoiCiAFEIwBIANBgAZqIgRBOBDQARogA0EBNgK4BiADQcAGakE4ENABGiADQfgGakEBNgIAIANBgAdqQTgQ0AEaIANBuAdqQQE2AgAgA0HAB2pBOBDQARogA0H4B2pBATYCACAFEJ0BIAMQISAJIAVBgARqIgwQGCAJEGQgAyAJEHkgAxCwASAJIAwQlgEgCRAhIAkQZCAKIA8QGCAJIAoQeSAJELABIAogDxCWASAKECEgBCAFEJYBIAQgDBAYIAogBBB5IAoQsAEgBCAPEJYBIAQgChAYIAQQZCAFIAMQGCAEIAUQlwEgDCAJEBggDBBkIAQgDBCXASAEELABIwBBgAJrIgYkACAGIAQQXiAGQYABaiIQIARBgAFqIhIQXiAGEC0gEBAtIBAQfCAQEKkBIAYgEBB7IAYQPiAEIAYQESAGEDYgBhCpASASIAYQESAGQYACaiQAIAUgAxCWASAFIAQQGCAPIAkQlgEgDyAEEBggDCAKEJYBIAwgBBAYIAVBBTYCgAYgA0GACGokACAAEJ4BIAAgBRAHIAUgABBtIAAgCBAyIAAgCBAyIAAgBRAHIAhBwAdqIgQgABBpIAQQEyAEIAAQByANIAAgCxAbIAhByA1qIgMgDRBpIAMQngEgASAAEGkgARCeASAAIAMQbSAAIAEQByANIAAgCxAbIAMgDRBtIAMQngEgASAAEG0gARCeASAAIAMQbSAAIAEQByANIAAgCxAbIAMgDRBtIAMQngEgASAAEG0gASAIEDIgACADEG0gACABEAcgDSAAIAsQGyADIA0QbSANIAMgCxAbIAMgDRBtIAEgABBtIAEgCBAyIAEgCBAyIAMgARAHIAEgABBtIAEQngEgACADEG0gACABEAcgACAEEAcgABCcASAIQeAfaiQAIAcgAEGIBhDRARpBACEAIwBBgAJrIgEkACABEGwCQCAHIAEQegR/IAdBgAFqIAFBgAFqEHoFQQALRQ0AIAdBgAJqEIcBRQ0AIAdBgARqEIcBIQALIAFBgAJqJABBACAADQAaQX8LIAJBkBVqJAAgDkEoahC0ASAOQSBqELQBIA5BGGoQtAEgDkEwaiQAC58BAgJ/BX4gAEEwaiICKQMAIAFBP3GtIgSGIQUgACkDKCIGQTogAWtBP3GtIgiHIQdBBiEBA38gAiAFIAeENwMAIAFBAU0EfyAAIAApAwAgBIZC//////////8DgzcDACAAKQMwQiSHpwUgAUEBayEBIAJBEGsiA0EIaiECIAYgBIZC//////////8DgyEHIAMpAwAiBiAIhyEFDAELCxoLiAECA34DfyMAQRBrIgUkAAN+IAZBOEYEfiAFQRBqJAAgAwUgBSAAIAZqIgcpAwAiAiACQj+HIAGsIgIgAkI/hxAvIAcgBSkDACIEIAN8IgJC//////////8DgzcDACACIARUrSAFQQhqKQMAIANCP4d8fEIGhiACQjqIhCEDIAZBCGohBgwBCwsLigECA38BfiMAQUBqIgIkACACQQhqIgEgABBdIAEQQiACQThqIQFBBiEDQdwCIQACQAJAA0AgA0EATgRAIAEpAwAiBEIAUg0CIAFBCGshASAAQTprIQAgA0EBayEDDAELC0EAIQAMAQsDQCAEUA0BIABBAWohACAEQgJ/IQQMAAsACyACQUBrJAAgAAuHAQEDfyMAQYACayIBJAAgABCwASABIAAQXiABQYABaiICQTgQ0AEaIAFBATYCuAEgAUHAAWpBOBDQARogAUH4AWpBATYCACABIABBgAFqIgMQmgEgARA2IAIgARCZASACIAMQmgEgAyABEJkBIAMgABCaASAAIAIQmQEgABCwASABQYACaiQAC30CBH4BfyABQT9xrSECQTogAWtBP3GtIQRBACEBIAApAwAiBSEDA38gAUEwRgR/IAAgACkDMCAChzcDMCAFQn8gAoZCf4WDpwUgACABaiIGIAMgAocgBkEIaikDACIDIASGQv//////////A4OENwMAIAFBCGohAQwBCwsaC2kBBH8jAEHAAWsiASQAIAEgABCQASABQUBrIgIgABCQASABQYABaiIDIABBQGsiBBCQASABIAQQdyACIAAQdyACEEIgBCACEEogAxBDIAAgAxB3IAEQQiAAEEIgACABEEogAUHAAWokAAuCAQIBfwF+IABB8AAQ0AEhAANAIAJBOEYEQAJAIAAgASkDMCIDQjqHNwM4IAAgA0L//////////wODNwMwIABBQGshAEEAIQIDQCACQTBGDQEgACACakIANwMAIAJBCGohAgwACwALBSAAIAJqIAEgAmopAwA3AwAgAkEIaiECDAELCwtuAQZ+IAAgA0L/////D4MiBSABQv////8PgyIGfiIHIAUgAUIgiCIIfiIJIAYgA0IgiCIGfnwiBUIghnwiCjcDACAAIAcgClatIAYgCH4gBSAJVK1CIIYgBUIgiIR8fCABIAR+IAIgA358fDcDCAtqAgF/BX4gASkDCCAAKQMAhSIGQgGGQgGHIQdBACACa6whCAN+IANBOEYEfiAFBSAAIANqIgIgAikDACIEIAaFIAEgA2opAwAgBIUgCIOFIgQgB4U3AwAgBCAFhSEFIANBCGohAwwBCwsaC18CAX8EfkIBIQNBMCECA38gAkF4RgR/IARCAYYgA3ynQQFrBSABIAJqKQMAIgUgACACaikDACIGfUI6hyADgyAEhCEEIAJBCGshAiAFIAaFQgF9QjqHIAODIQMMAQsLC2kBBH8jAEGAAmsiAiQAIAIgARBeIAJBgAFqIgMgARBeIAIQLSADIAIQESAAIAMQmAEgAEGAAmoiBCADEJgBIABBgARqIgUgAxCYASAEIAEQpgEgBSACEKYBIABBBTYCgAYgAkGAAmokAAtiAQJ/IwBBQGoiAiQAIAAQQiACIAAQkAECQCABBEAgACABEK4BDAELIAAQOgtBACEBA0AgA0UEQCAAEExBASABQQFqIAFBAUYiAxshAQwBCwsgACACEEogABAeIAJBQGskAAtnAQJ/IwBBQGoiAyQAAkAgASABQR91IgJqIAJzIgIgACgCOGxBgICAEE4EQCADIAIQOSAAIAMQSgwBCyAAIAIQKRogACAAKAI4IAJsNgI4CyABQQBIBEAgABBDIAAQQgsgA0FAayQAC2cAIABBAXYgAHIiAEECdiAAciIAQQR2IAByIgBBCHYgAHIiAEEQdiAAciIAIABBAXZB1arVqgVxayIAQQJ2QbPmzJkDcSAAQbPmzJkDcWoiAEEEdiAAakGPnrz4AHFBgYKECGxBGHYLYQEDfyMAQYABayIBJAAgASAAEJABIAFBQGsiAkE4ENABGiABQQE2AnggASAAQUBrIgMQdyABEEMgAiABEK4BIAIgAxB3IAMgARCuASADIAAQdyAAIAIQrgEgAUGAAWokAAtVAgJ/AX4jAEHwAGsiASQAIAFBwLLAABBJIAApAwAhAyABQThqIgIgABBdIABBARAsIAIgARBgIAIQQiACQQEQLCAAIAIgA0ICgacQMCABQfAAaiQAC5gBAQZ/IwBBwAFrIgMkACAAIAEQXiAAEC0gA0GIAWoiBkHop8AAEEkjAEFAaiIEJAAgA0EIaiICQTgQ0AEiBUEBNgI4IAVBQGtBOBDQASAFQfgAakEBNgIAIAQgBhCOASAFIAQQrgEQwQEgBEFAayQAIAIQqQEgAhB8IAIQqQEgACABEBEgACACEJoBIAAQtQEgA0HAAWokAAtZAQJ/IwBBQGoiAyQAIABBOBDQASIAQQE2AjgCQCABQQBOBEAgACABEJMBDAELIANBCGoiAkHAssAAEEkgAiABEJMBIAIQQiAAIAIQagsgABBUIANBQGskAAu9CAEKfyMAQYABayIHJAAgB0EIaiIDQcCywAAQSSADQQEQlAECQAJAA0AgAUEwRgRAIANBMGogAykDMEIBhzcDACADQThqIQEDQCACRQ0EIAFCADcDACACQQFrIQIgAUEIaiEBDAALAAsgAUE4Rg0BIAFBOEcEQCABIANqIAEgA2oiBEEIaikDAEI5hkL//////////wODIAQpAwBCAYeENwMAIAVBAWohBSABQQhqIQEMAQsLQQdBB0GEm8AAEDsACyAFQQdB9JrAABA7AAsgA0EBEJQBIANBARAsIAdBQGshBUEAIQIjAEGgCmsiASQAIAFBOBDQASIBQUBrQTgQ0AEhBiABQYABakE4ENABGiABQcABakE4ENABGiABQYACakE4ENABGiABQcACakE4ENABGiABQYADakE4ENABGiABQcADakE4ENABGiABQYAEakE4ENABGiABQcAEakE4ENABGiABQYAFakE4ENABGiABQcAFakE4ENABGiABQYAGakE4ENABGiABQcAGakE4ENABGiABQYAHakE4ENABGiABQcAHakE4ENABGiABQfgHakEBNgIAIAFBuAdqQQE2AgAgAUH4BmpBATYCACABQbgGakEBNgIAIAFB+AVqQQE2AgAgAUG4BWpBATYCACABQfgEakEBNgIAIAFBuARqQQE2AgAgAUH4A2pBATYCACABQbgDakEBNgIAIAFB+AJqQQE2AgAgAUG4AmpBATYCACABQfgBakEBNgIAIAFBuAFqQQE2AgAgAUH4AGpBATYCACABQQE2AjggAUGBCGpB5wAQ0AEaIAFB6AhqIgQgABCQASAEEEIgAUGoCWoiBCADEF0gBBBCIAQQKkEDaiIIQQJ2IgNBAWohCQJAA0AgAiAJRgRAIAEQygEgBiABQegIahCuASABQeAJakE4ENABGiABQQE2ApgKQYB5IQIMAgsgAUGoCWoiBCAEQQQQjwEiChCUASAEEEIgAkHnAEcEQCABQYEIaiACaiAKOgAAIAFBqAlqQQQQLCACQQFqIQIMAQsLQecAQecAQaC0wAAQOwALA0AgAgRAIAFB4AlqIgQgASACaiIGQcAHahCuASAGQYAIaiIGIAQQrgEgBiABQegIahBKIAJBQGshAgwBCwsCQAJAAkACQCAIQZwDSQRAIAFBgQhqIANqLAAAIgJBEE8NASAFIAEgAkEGdGoQkAEgA0EBayICQeYASyEEA0AgAkF/Rg0DIAUQTCAFEEwgBRBMIAUQTCAEDQQgAUGBCGogAmotAAAiA0EQSQRAIAUgASADQQZ0ahBKIAJBAWshAgwBCwsgA0EYdEEYdUEQQeC0wAAQOwALIANB5wBBsLTAABA7AAsgAkEQQcC0wAAQOwALIAUQHiABQaAKaiQADAELIAJB5wBB0LTAABA7AAsgACAFEK4BIAdBgAFqJAALbAEBfyMAQTBrIgMkACADIAE2AgQgAyAANgIAIANBHGpBAjYCACADQSxqQQE2AgAgA0ICNwIMIANB2LjAADYCCCADQQE2AiQgAyADQSBqNgIYIAMgAzYCKCADIANBBGo2AiAgA0EIaiACEGYAC2UBAn8gACAAKAIAIgJBCGoiAzYCACAAIAJBA3ZBPHFqQShqIgIgAUH/AXEgAigCAEEIdHI2AgACQAJAIANFBEAgAEEANgIAIAAgACgCBEEBajYCBAwBCyADQf8DcQ0BCyAAEA8LC1wAIABBOBDQASIAQQE2AjggAEFAa0E4ENABGiAAQfgAakEBNgIAIABBgAFqEFEgAEGAAmpBOBDQARogAEG4AmpBATYCACAAQcACakE4ENABGiAAQfgCakEBNgIAC1sBA38jAEGAAWsiASQAIAAQqQEgASAAEJABIAFBQGsiAiAAQUBrIgMQkAEgARBMIAIQTCABIAIQdyABQQAQMyAAIAEQSiABEEMgARBCIAMgARBKIAFBgAFqJAALYQEBfyMAQYACayIDJAAgABA9IAAgARCZASAAQYABaiIBIAIQmQEgAEGAAmoQtwEgABCpASADIAAQOCADQYABaiICIAEQXiACEC0gAiADEHpFBEAgABCbAQsgA0GAAmokAAtUAQF/IwBBIGsiAiQAIAIgACgCADYCBCACQRhqIAFBEGopAgA3AwAgAkEQaiABQQhqKQIANwMAIAIgASkCADcDCCACQQRqIAJBCGoQDCACQSBqJAALZwAjAEEwayIBJABBpLvAAC0AAARAIAFBHGpBATYCACABQgI3AgwgAUGQtsAANgIIIAFBATYCJCABIAA2AiwgASABQSBqNgIYIAEgAUEsajYCICABQQhqQbi2wAAQZgALIAFBMGokAAtiAgF+An8gACkDACEBA34gACACaiIDIAFC//////////8DgzcDACABQjqHIQEgAkEoRgR+IAAgACkDMCABfCIBNwMwIAFCJIcFIAJBCGohAiADQQhqKQMAIAF8IQEMAQsLGgt8AQV/IwBBQGoiAyQAIANBCGoiAkHAssAAEEkgAiAAKAI4QQFrEDUiBBAoA0AgAUE4RwRAIAAgAWoiBSABIAJqKQMAIAUpAwB9NwMAIAFBCGohAQwBCwsgAEEBIARBAWp0IgI2AjggAkH///8PSgRAIAAQHgsgA0FAayQAC3sBAn8gAEEoaiECA0AgAUGAAkYEQCAAQufMp9DW0Ouzu383AgggAEIANwIAIABBIGpCq7OP/JGjs/DbADcCACAAQRhqQv+kuYjFkdqCm383AgAgAEEQakLy5rvjo6f9p6V/NwIABSABIAJqQQA2AgAgAUEEaiEBDAELCwtUACAAQTgQ0AEiAEEBNgI4IABBQGtBOBDQARogAEH4AGpBATYCACAAQYABakE4ENABGiAAQbgBakEBNgIAIABBwAFqQTgQ0AEaIABB+AFqQQE2AgALWAECfyMAQUBqIgEkAAJAIAAQhgENACABQQEQOSAAQYABaiICIAEQWA0AIAJBABAzIAAgAhBKIAAQHiAAQUBrIgAgAhBKIAAQHiACIAEQrgELIAFBQGskAAtZAQJ/IwBBgAFrIgEkAAJAIAAQigENACABEFEgAEGAAmoiAiABEHoNACACED4gACACEBEgABC1ASAAQYABaiIAIAIQESAAELUBIAIgARCZAQsgAUGAAWokAAtbAgF+An8gACkDACEBA0AgACACaiIDIAFC//////////8DgzcDACABQjqHIQEgAkHgAEYEQCAAIAApA2ggAXw3A2gFIAJBCGohAiADQQhqKQMAIAF8IQEMAQsLC08BAX8gAEE4ENABGgJAA0AgAkEHRwRAIAJBB0YNAiAAIAEpAwA3AwAgAEEIaiEAIAFBCGohASACQQFqIQIMAQsLDwtBB0EHQeSawAAQOwALVAECfyMAQbABayICJAAgATQCOCAANAI4fkL///8PVQRAIAAQHgsgAkEIaiIDIAAgARAFIAJB+ABqIgEgAxBrIAAgARBqIABBAjYCOCACQbABaiQAC1EBAn8jAEFAaiIDJAAgAEE4ENABIgBBATYCOCAAQUBrQTgQ0AEgAEH4AGpBATYCACADIAEQjgEgACADEK4BIAMgAhCOASADEK4BIANBQGskAAvwDAIRfwh+IwBBsAFrIg8kACAANAI4IhIgEn5C////D1YEQCAAEB4LIwBB0AFrIgEkACAPQQhqIgZBCGpB0AAQ0AEaIAFBwAFqIAApAwAiFyAXQj+HIhYgFyAWEC8gBiABKQPAASISQv//////////A4M3AwAgAUHIAWopAwAiFUIGhiASQjqIhCETIBVCOoghGCAAQQhqIgwhDSAAIQlBASEKQQEhBwJAA0AgCkEERgRAIABBGGohCiAAQRBqIQkgAEEoaiEMIAApAzAhF0EHIQUgAUHIAGohCwNAIAVBC0kEQCABQUBrIAVBA3QiCCAAakEwaykDACISIBJCP4cgFyAXQj+HIhYQLyAFQQFqIg1BAXYhByALKQMAIRUgASkDQCESIAkhAiAMIQQgBUEFayIOIQMDQCADIAdJBEAgASACKQMAIhQgFEI/hyAEKQMAIhQgFEI/hxAvIAEpAwAiFCASfCISIBRUrSABQQhqKQMAIBV8fCEVIAJBCGohAiAEQQhrIQQgA0EBaiEDDAELCyAGIAhqIBJCAYYiFCATfCITQv//////////A4M3AwAgAUEwaiAAIA5BA3RqKQMAIhkgGUI/hyAXIBYQLyATIBRUrSAVQgGGIBJCP4iEIBh8fCEYIAVBBGshAyAFQQJqIgVBAXYhCCABQThqKQMAIRUgASkDMCESIAohAiAMIQQDQCADIAhPBEAgAUEgaiAAIAdBA3RqKQMAIhYgFkI/hyIUIBYgFBAvIAYgDUEDdGogEkIBhiIUIBhCBoYgE0I6iIR8IhMgASkDIHwiFkL//////////wODNwMAIBMgFlatIAFBKGopAwAgEyAUVK0gFUIBhiASQj+IhCAYQjqHfHx8fCISQjqHIRggEkIGhiAWQjqIhCETIApBEGohCiAJQRBqIQkMAwUgAUEQaiACKQMAIhYgFkI/hyAEKQMAIhYgFkI/hxAvIAEpAxAiFiASfCISIBZUrSABQRhqKQMAIBV8fCEVIAJBCGohAiAEQQhrIQQgA0EBaiEDDAELAAsACwsgAUHQAGogFyAXQj+HIhIgACkDKCIVIBVCP4cQLyAGIBMgASkDUCIWQgGGIhR8IhVC//////////8DgzcDWCABQeAAaiAXIBIgFyASEC8gBiAUIBVWrSABQdgAaikDAEIBhiAWQj+IhCAYfHwiF0IGhiAVQjqIhCIVIAEpA2B8IhJC//////////8DgzcDYCAGIBIgFVStIAFB6ABqKQMAIBdCOod8fEIGhiASQjqIhDcDaCABQdABaiQADAILIAFBsAFqIAAgB0EDdCIOaikDACISIBJCP4cgFyAWEC8gB0EBaiIQQQF2IREgAUG4AWopAwAhFSABKQOwASESIAUhAyAMIQQgCSELIAghAgNAIANFBEAgBiAOaiASQgGGIhQgE3wiE0L//////////wODNwMAIAFBkAFqIAAgEEEDdCIOaikDACIZIBlCP4cgFyAWEC8gEyAUVK0gFUIBhiASQj+IhCAYfHwiEkI6hyEYIBJCBoYgE0I6iIQhFCAHQQJqIQsgAUGYAWopAwAhFUEAIQMgASkDkAEhEiAMIQIgDSEEA0AgAyAFakUEQCABQfAAaiAAIBFBA3RqKQMAIhMgE0I/hyIZIBMgGRAvIAYgDmogEkIBhiIZIBR8IhMgASkDcHwiFEL//////////wODNwMAIBMgFFatIAFB+ABqKQMAIBMgGVStIBVCAYYgEkI/iIQgGHx8fHwiEkI6hyEYIBJCBoYgFEI6iIQhEyANQRBqIQ0gBUEBaiEFIAlBEGohCSAIQQJqIQggCkEBaiEKIAshBwwECyADIAdqIhBBB0kEQCABQYABaiACKQMAIhMgE0I/hyAEKQMAIhMgE0I/hxAvIAEpA4ABIhMgEnwiEiATVK0gAUGIAWopAwAgFXx8IRUgAkEIaiECIARBCGshBCADQQFrIQMMAQsLIBBBB0GEnMAAEDsACyACQQdJBEAgAUGgAWogBCkDACIUIBRCP4cgCykDACIUIBRCP4cQLyABKQOgASIUIBJ8IhIgFFStIAFBqAFqKQMAIBV8fCEVIANBAWshAyAEQQhqIQQgC0EIayELIAJBAWshAgwBCwsLIAJBB0H0m8AAEDsACyAPQfgAaiICIAYQayAAIAIQaiAAQQI2AjggD0GwAWokAAtHAQJ/IwBB8ABrIgEkACAAEHZFBEAgAUHAssAAEEkgAUE4aiICIAAQhAEgASACEGEgARBCIAIgARAxIQILIAFB8ABqJAAgAgtPAQJ/IAIgACgCACIDQQRqKAIAIANBCGoiBCgCACIAa0sEQCADIAAgAhAiIAQoAgAhAAsgAygCACAAaiABIAIQ0QEaIAQgACACajYCAEEAC0wBA38jAEGAAWsiAiQAIAAgARCQASAAEEwgAkHIAGoiA0GAgMAAEEkgAkEIaiIEIAMQjgEgACABEEogACAEEHcgABAeIAJBgAFqJAALQQECfyMAQUBqIgIkACACQQhqIgNBkK3AABBJIAEgAxBqIAEQQiAAIAEQaiAAQQMQKRogABBCIAAQKiACQUBrJAALRwECfyMAQUBqIgEkACAAQTgQ0AEiAEEBNgI4IABBQGtBOBDQASAAQfgAakEBNgIAIAFBARA5IAAgARCuARDBASABQUBrJAALSwACQAJ/IAFBgIDEAEcEQEEBIAAoAhggASAAQRxqKAIAKAIQEQQADQEaCyACDQFBAAsPCyAAKAIYIAJBACAAQRxqKAIAKAIMEQUAC0MCAX8BfiABQTpuIQIgAUGVA00EQCAAIAJBA3RqKQMAQgEgAUH//wNxQTpwrSIDhoMgA4inDwsgAkEHQbSbwAAQOwALRQEDfyMAQeABayIBJAAgAUH4ssAAEEkgAUE4aiICIAAgARAFIAFBqAFqIgMgAhBrIAAgAxBqIABBAjYCOCABQeABaiQAC0ABAX8jAEGAAmsiASQAIAAQiwEgARBsIAAgARCWASAAQYACahCxASAAQYAEahCxASAAQQE2AoAGIAFBgAJqJAALPAICfwF+IwBBgAFrIgEkACABQQhqIgIgABCQASACEB4gAUHIAGogAhCEASABKQNIIAFBgAFqJABCAoGnCzwCAX8BfgN/IAFBOEYEfyACQgF9QoCAgICAgICABINCOoinBSAAIAFqKQMAIAKEIQIgAUEIaiEBDAELCws4AQF/IwBBgAFrIgIkACACIAAQkAEgAkFAayIAIAEQkAEgAhAeIAAQHiACIAAQMSACQYABaiQARQtHAQF/IwBBIGsiAyQAIANBFGpBADYCACADQZS4wAA2AhAgA0IBNwIEIAMgATYCHCADIAA2AhggAyADQRhqNgIAIAMgAhBmAAukAQICfwF+IwBBQGoiAiQAIAIgABCQASACEDogAQRAIAEgAhCuAQsgAhBMIAIgABBKIwBBgAFrIgEkACABQQhqIgAgAhCQASAAEB4gAUHIAGoiAyAAEIQBQQghAAN/IABBOEYEfyAEQgF9IAMpAwBCAYVCAX2DQjqIp0EBcQUgACADaikDACAEhCEEIABBCGohAAwBCwsgAUGAAWokACACQUBrJAALxQMBBn8jAEEgayIGJAAgBiACNgIYIAYgAjYCFCAGIAE2AhAgBkEQaiICKAIIIgEgAigCBEkEQAJAIwBBEGsiBSQAIwBBIGsiBCQAAkACQCABIAIoAgRNBEAgBEEIaiEDAkAgAigCBCIHBEAgAyAHNgIEIANBCGpBATYCACADIAIoAgA2AgAMAQsgA0EANgIACwJAAkAgBCgCCCIIBEAgBEEQaigCACEDIAQoAgwhBwJAAkAgAUUEQEEBIQMMAQsgA0EBRg0DIAFBARC5ASIDRQ0BIAMgCCABENEBGgsgCCAHEKgBDAULDAILIAVBADYCAAwECyAIIAEQrAEiAw0CCyAFIAE2AgQgBUEBNgIAIAVBCGpBATYCAAwCCyAEQRxqQQA2AgAgBEG0nMAANgIYIARCATcCDCAEQdicwAA2AgggBEEIakGsncAAEGYACyACIAE2AgQgAiADNgIAIAVBADYCAAsgBEEgaiQAAkAgBSgCAARAIAVBCGooAgAiAEUNASAFKAIEIAAQzwEACyAFQRBqJAAMAQsQZQALCyAGQQhqIgEgAigCCDYCBCABIAIoAgA2AgAgACAGKQMINwMAIAZBIGokAAtGAQJ/IAEoAgQhAiABKAIAIQNBCEEEELkBIgFFBEBBCEEEEM8BAAsgASACNgIEIAEgAzYCACAAQZS3wAA2AgQgACABNgIACzEBAX8gAEE4ENABIQADQCACQThHBEAgACACaiABIAJqKQMANwMAIAJBCGohAgwBCwsLNgEBfyAAQTgQ0AEiAEEBNgI4IABBQGtBOBDQASAAQfgAakEBNgIAIAAgARCuASABQUBrEK4BCzsBAX8jAEEQayIDJAAgA0EIaiABQYQCIAIQgQEgAygCDCEBIAAgAygCCDYCACAAIAE2AgQgA0EQaiQACwsAIAAgAUE4ENsBCwsAIAAgAUE4ENwBCwwAIAAgAUHwABDbAQsMACAAIAFB8AAQ3AELOQECfyMAQYABayIBJAAgASAAQYABaiICEF4gAiAAEJkBIAEQfCAAIAEQmQEgABCwASABQYABaiQACz8BAX8jAEEgayIAJAAgAEEcakEANgIAIABBzLfAADYCGCAAQgE3AgwgAEH8t8AANgIIIABBCGpBhLjAABBmAAu8AgEDfyMAQSBrIgIkACACQQE6ABggAiABNgIUIAIgADYCECACQZS4wAA2AgwgAkGUuMAANgIIIwBBEGsiACQAIAJBCGoiASgCDCICRQRAQcC1wABBK0HktsAAEFkACyABKAIIIgRFBEBBwLXAAEErQfS2wAAQWQALIAAgAjYCCCAAIAE2AgQgACAENgIAIAAoAgAhASAAKAIEIQIgACgCCCEEIwBBEGsiACQAIAFBFGooAgAhAwJAAn8CQAJAIAFBBGooAgAOAgABAwsgAw0CQQAhAUHAtcAADAELIAMNASABKAIAIgMoAgQhASADKAIACyEDIAAgATYCBCAAIAM2AgAgAEG4t8AAIAIoAgggBCACLQAQECAACyAAQQA2AgQgACABNgIAIABBpLfAACACKAIIIAQgAi0AEBAgAAswACAAQTgQ0AEiAEEBNgI4IABBQGtBARA5IABBgAFqQTgQ0AEaIABBuAFqQQE2AgALKwACQCAAQXxLDQAgAEUEQEEEDwsgACAAQX1JQQJ0ELkBIgBFDQAgAA8LAAs4ACAAEIsBIAAgARCWASAAQYACaiABQYACahCWASAAQYAEaiABQYAEahCWASAAIAEoAoAGNgKABgsoAQF/A0AgAkE4RwRAIAAgAmogASACaikDADcDACACQQhqIQIMAQsLC4QJAg1/Cn4jAEFAaiILJAAgC0EIaiIJQcCywAAQSSMAQZACayICJAAgAEEwENABIQogAkHoAGpB8AAQ0AEaIAJB4AFqQTAQ0AEaIAoQcSACIAEiDCkDACIQQv3/8//P///5AX5C//////////8DgyISNwPYASACQdgAaiASQgAgCSkDACIXIBdCP4ciGBAvIBAgAikDWCIPfCITIA9UrSACQeAAaikDACAQQj+HfHwiEEI6hyABKQMIIg9CP4d8IA8gEEIGhiATQjqIhCITfCIQIBNUrXwhD0EBIQBCACETAkACQANAAkAgAEEHRgRAQQYhB0EAIQhBByEADAELIABBAXYiAUEBaiEGIAggAWshAyABQQN0IgFBCGohBCAHIAFrIQUgAkHIAGogCSAAQQN0Ig1qKQMAIhUgFUI/hyIWIBJCABAvIAJB0ABqKQMAIBAgECATfCIRVq0gDyAUfHx8IBEgAikDSHwiDyARVK18IRAgAEEBaiEBA0AgACAGTQRAIAJB2AFqIA1qIA9C/f/z/8////kBfkL//////////wODIhE3AwAgAkE4aiARQgAgFyAYEC8gAkEoaiARQgAgFSAWEC8gAkHoAGogAEEEdGoiACACQTBqKQMAIhE3AwggACACKQMoIhU3AwAgDyACKQM4IhZ8Ig8gFlStIAJBQGspAwAgEHx8IhBCOocgDCABQQN0aikDACIWQj+HfCAWIBBCBoYgD0I6iIQiD3wiECAPVK18IQ8gEyAVfCITIBVUrSARIBR8fCEUIAdBCGohByAIQQFqIQggASEADAMLIANBB08NAyACQRhqIAQgCWopAwAgBSAJaikDAH0iESARQj+HIAJB2AFqIg4gBWopAwAgBCAOaikDAH0iESARQj+HEC8gAikDGCIRIA98Ig8gEVStIAJBIGopAwAgEHx8IRAgBkEBaiEGIARBCGohBCAFQQhrIQUgA0EBayEDDAALAAsLA0ACQAJAIABBDUcEQCAHIABBAXYiBmshAyAIIAZBA3QiAWshBCABQQhqIQUgDyAUfCAQIBN8Ig8gEFStfCEQIABBAWohAQNAIAZBBUsNAyADQQdPDQIgAkEIaiAFIAlqKQMAIAQgCWpBMGopAwB9IhIgEkI/hyACIARqQYgCaikDACACQdgBaiAFaikDAH0iEiASQj+HEC8gAikDCCISIA98Ig8gElStIAJBEGopAwAgEHx8IRAgBkEBaiEGIARBCGshBCADQQFrIQMgBUEIaiEFDAALAAsgCiAQQv//////////A4M3AzAgAkGQAmokAAwECyADQQdBpJzAABA7AAsgAEEDdCAKakE4ayAPQv//////////A4M3AwAgEEI6hyAMIAFBA3RqKQMAIhJCP4d8IBIgEEIGhiAPQjqIhCIPfCIQIA9UrXwhDyAUIABBBHQgAmpBCGoiAEEIaikDAH0gEyAAKQMAIhJUrX0hFCAIQQhqIQggB0EBaiEHIBMgEn0hEyABIQAMAAsACyADQQdBlJzAABA7AAsgC0FAayQACy4BAX8jAEGAAWsiASQAIAAQRSABEFEgACABEJkBIABBgAFqELYBIAFBgAFqJAALMwAgACABEJYBIABBgAJqIAFBgAJqEJYBIABBgARqIAFBgARqEJYBIAAgASgCgAY2AoAGCygAIAAgASACEHIgAEFAayABQUBrIAIQciAAQYABaiABQYABaiACEHILLQAgACABIAIQjQEgAEGAAWogAUGAAWogAhCNASAAQYACaiABQYACaiACEI0BCycBAn8jAEFAaiICJAAgAkEIaiIDIAEQvgEgACADEI4BIAJBQGskAAsiAQF/A0AgAUE4RwRAIAAgAWpCADcDACABQQhqIQEMAQsLCyUAIAAgASACEDAgAEEAIAJrIAAoAjgiACABKAI4c3EgAHM2AjgLJwAgACAAKAIEQQFxIAFyQQJyNgIEIAAgAWoiACAAKAIEQQFyNgIECyMAA0AgAgRAIAAgAS0AABA8IAJBAWshAiABQQFqIQEMAQsLCywAIAAQiwEgACABEJYBIABBgAJqIAIQlgEgAEGABGogAxCWASAAQQU2AoAGCyMBAX8jAEFAaiIBJAAgASAAEJABIAEQHiABEFcgAUFAayQACykAIAAgARBgIAAgACgCOCABKAI4aiIBNgI4IAFB////D0oEQCAAEB4LCyUAIAAgARCuASAAQUBrIAFBQGsQrgEgAEGAAWogAUGAAWoQrgELKAEBfyMAQYACayICJAAgAiABEIwBIAIQKyAAIAIQlwEgAkGAAmokAAscAQF/IAAgARBYBH8gAEFAayABQUBrEFgFQQALCycBAX8jAEGAAWsiAiQAIAIgARBeIAIQNiAAIAIQmgEgAkGAAWokAAtRAQN/IwBBgAFrIgEkACABIAAQXiMAQUBqIgIkACACIAAQkAEgACAAQUBrIgMQrgEgABBDIAMgAhCuASACQUBrJAAgACABEJoBIAFBgAFqJAALJwAgACABEJkBIABBgAFqIAFBgAFqEJkBIABBgAJqIAFBgAJqEJkBCyUBAX8jAEFAaiICJAAgAiABEJABIAIQQyAAIAIQdyACQUBrJAALHgACQCAAQQRqKAIARQ0AIAAoAgAiAEUNACAAEAQLCyABAX8CQCAAKAIEIgFFDQAgAEEIaigCAEUNACABEAQLC4MBACACIANJBEAjAEEwayIAJAAgACACNgIEIAAgAzYCACAAQRxqQQI2AgAgAEEsakEBNgIAIABCAjcCDCAAQYS7wAA2AgggAEEBNgIkIAAgAEEgajYCGCAAIABBBGo2AiggACAANgIgIABBCGpBlLvAABBmAAsgACADNgIEIAAgATYCAAtIAQJ/A0AgAUE4RwRAIAAgAWoiAiACKQMAQgGGNwMAIAFBCGohAQwBCwsgACAAKAI4QQF0IgE2AjggAUH///8PSgRAIAAQHgsLIwAgAiACKAIEQX5xNgIEIAAgAUEBcjYCBCAAIAFqIAE2AgALIgEBfyMAQfAAayICJAAgAiABEC4gACACEGsgAkHwAGokAAseACAAIAFBA3I2AgQgACABaiIAIAAoAgRBAXI2AgQLFgEBfyAAEHYEfyAAQYABahB2BUEACwsYAQF/IAAQiAEEfyAAQYABahCIAQVBAAsLFQEBfyAAEHYEfyAAQUBrEHYFQQALCxoBAX8gABBWIgEgAEFAaxBWIAFzIAAQdnFzCxgBAX8gABCIAQR/IABBgAJqEIgBBUEACwseACAAEEUgAEGAAmoQRSAAQYAEahBFIABBADYCgAYLHAAgABBFIAAgARCZASAAQYABaiABQYABahCZAQsYACAAIAEgAhByIABBQGsgAUFAayACEHILGgAgAEE4ENABIgBBATYCOCAAIAEQaiAAEFQLFAAgABBCIAAoAgBBfyABdEF/c3ELGQAgAEE4ENABIgAgARBqIAAgASgCODYCOAsZAQF/IAAoAhAiAQR/IAEFIABBFGooAgALCxgAIAAQwQEgAEFAaxDKASAAQYABahDBAQsUACAAEEIgACAAKQMAIAGsfDcDAAsUACAAEEIgACAAKQMAIAGsfTcDAAsYACAAEEUgACABEJkBIABBgAFqIAIQmQELGAAgACABEJkBIABBgAFqIAFBgAFqEJkBCxgAIAAgARCaASAAQYABaiABQYABahCaAQsYACAAEKQBIABBgAFqIgAQpAEgACABEBELFgAgACABEK4BIABBQGsgAUFAaxCuAQsUACAAIAEQdyAAQUBrIAFBQGsQdwsZACAAELYBIABBgAFqELcBIABBgAJqELYBCxkAIAAQrwEgAEGAAmoQrwEgAEGABGoQrwELGQAgABCwASAAQYACahCwASAAQYAEahCwAQsZACAAELIBIABBgAJqEMkBIABBgARqELIBCxIAQQBBGSAAQQF2ayAAQR9GGwsWACAAIAFBAXI2AgQgACABaiABNgIACxYAIAAQRSAAIAEQmQEgAEGAAWoQtgELFgAgAEGAAWoiABCpASAAEDYgABCpAQsQACAAIAFqQQFrQQAgAWtxCw8AIABBQGsiABBDIAAQQgsUACAAIAEQmQEgAEGAAWogAhCZAQsSACAAIAEQESAAQYABaiABEBELFAAgACABEKoBIABBgAFqIAEQqgELCwAgAQRAIAAQBAsLDQAgABBCIABBQGsQQgsRACAAIAEQSiAAQUBrIAEQSgsRACAAIAEQNCAAQUBrIAEQNAu+BQEHfwJ/AkACQEGAgHxBCEEIEKMBQRRBCBCjAWpBEEEIEKMBamtBd3FBA2siAkEAQRBBCBCjAUECdGsiBCACIARJGyABTQ0AQRAgAUEEakEQQQgQowFBBWsgAUsbQQgQowEhAiAAENUBIgQgBBDLASIFENIBIQMCQAJAAkACQAJAAkACQCAEEMQBRQRAIAIgBU0NASADQfi+wAAoAgBGDQIgA0H0vsAAKAIARg0DIAMQvAENByADEMsBIgYgBWoiByACSQ0HIAcgAmshBSAGQYACSQ0EIAMQFwwFCyAEEMsBIQMgAkGAAkkNBiADIAJrQYGACEkgAkEEaiADTXENBSAEKAIAGiACQR9qQYCABBCjARoMBgtBEEEIEKMBIAUgAmsiA0sNBCAEIAIQ0gEhBSAEIAIQcyAFIAMQcyAFIAMQDQwEC0HwvsAAKAIAIAVqIgUgAk0NBCAEIAIQ0gEhAyAEIAIQcyADIAUgAmsiAkEBcjYCBEHwvsAAIAI2AgBB+L7AACADNgIADAMLQey+wAAoAgAgBWoiBSACSQ0DAkBBEEEIEKMBIAUgAmsiA0sEQCAEIAUQc0EAIQNBACEFDAELIAQgAhDSASIFIAMQ0gEhBiAEIAIQcyAFIAMQoAEgBiAGKAIEQX5xNgIEC0H0vsAAIAU2AgBB7L7AACADNgIADAILIANBDGooAgAiCCADQQhqKAIAIgNHBEAgAyAINgIMIAggAzYCCAwBC0Hcu8AAQdy7wAAoAgBBfiAGQQN2d3E2AgALQRBBCBCjASAFTQRAIAQgAhDSASEDIAQgAhBzIAMgBRBzIAMgBRANDAELIAQgBxBzCyAEDQILIAEQACICRQ0AIAIgACABIAQQywFBeEF8IAQQxAEbaiICIAEgAkkbENEBIAAQBAwCC0EADAELIAQQxAEaIAQQ1AELCw8AIABBAXQiAEEAIABrcgsSACAAIAEQaiAAIAEoAjg2AjgLEAAgABC1ASAAQYABahC1AQsQACAAEKkBIABBgAFqEKkBCxAAIAAQtgEgAEGAAWoQtgELDwAgAEGAAWoQNiAAELABCxAAIAAQuAEgAEGAAWoQuAELDwAgACgCACAAKAIEEKgBCw0AIAAQHiAAQUBrEB4LDwAgABDBASAAQUBrEMEBCw8AIAAQygEgAEFAaxDBAQsPACAAEIIBIABBQGsQggELgwMBA38CfwJAAkACQAJAIAFBCU8EQEEQQQgQowEgAUsNAQwCCyAAEAAhAwwCC0EQQQgQowEhAQtBgIB8QQhBCBCjAUEUQQgQowFqQRBBCBCjAWprQXdxQQNrIgRBAEEQQQgQowFBAnRrIgIgAiAESxsgAWsgAE0NACABQRAgAEEEakEQQQgQowFBBWsgAEsbQQgQowEiBGpBEEEIEKMBakEEaxAAIgJFDQAgAhDVASEAAkAgAUEBayIDIAJxRQRAIAAhAQwBCyACIANqQQAgAWtxENUBIQJBEEEIEKMBIQMgABDLASACQQAgASACIABrIANLG2oiASAAayICayEDIAAQxAFFBEAgASADEHMgACACEHMgACACEA0MAQsgACgCACEAIAEgAzYCBCABIAAgAmo2AgALIAEQxAENASABEMsBIgJBEEEIEKMBIARqTQ0BIAEgBBDSASEAIAEgBBBzIAAgAiAEayIEEHMgACAEEA0MAQsgAwwBCyABENQBIAEQxAEaCwuOBAEFfyAAKAIAIQAjAEEQayIEJAACQAJ/AkAgAUGAAU8EQCAEQQA2AgwgAUGAEE8NASAEIAFBP3FBgAFyOgANIAQgAUEGdkHAAXI6AAxBAgwCCyAAKAIIIgIgAEEEaigCAEYEQCMAQSBrIgMkAAJAAkAgAiACQQFqIgVLDQAgAEEEaigCACICQQF0IgYgBSAFIAZJGyIFQQggBUEISxshBQJAIAIEQCADQRhqQQE2AgAgAyACNgIUIAMgACgCADYCEAwBCyADQQA2AhALIAMgBSADQRBqECYgAygCAARAIANBCGooAgAiAEUNASADKAIEIAAQzwEACyADKAIEIQIgAEEEaiAFNgIAIAAgAjYCACADQSBqJAAMAQsQZQALIAAoAgghAgsgACACQQFqNgIIIAAoAgAgAmogAToAAAwCCyABQYCABE8EQCAEIAFBP3FBgAFyOgAPIAQgAUESdkHwAXI6AAwgBCABQQZ2QT9xQYABcjoADiAEIAFBDHZBP3FBgAFyOgANQQQMAQsgBCABQT9xQYABcjoADiAEIAFBDHZB4AFyOgAMIAQgAUEGdkE/cUGAAXI6AA1BAwshASABIABBBGooAgAgAEEIaiIDKAIAIgJrSwRAIAAgAiABECIgAygCACECCyAAKAIAIAJqIARBDGogARDRARogAyABIAJqNgIACyAEQRBqJABBAAsTACAAQZS3wAA2AgQgACABNgIACw0AIAAtAARBAnFBAXYL5QYCDH8CfiMAQbAcayIDJAACQAJAAkAgAhBXDQAgARCGAQ0AIANBCGoQZyADQcgBaiIFIAIQXQNAIARBOEcEQCAEIAVqIgYgBikDACACIARqKQMAhDcDACAEQQhqIQQMAQsLIAUQKiEHQQAhBCADQYACakE4ENABGiADQbgCakE4ENABGiADQfACaiIFEGcgA0GwBGoQZyADQfARaiIIEGcgA0GwE2oiCRBnIANB8BRqIgoQZyADQbAWaiILEGcgA0HwF2oiDBBnIANBsBlqIg0QZyADQfAaaiIGEGcgA0GwEGoQZyADQfAFaiIOIAhBwAEQ0QEaIANBsAdqIAlBwAEQ0QEaIANB8AhqIApBwAEQ0QEaIANBsApqIAtBwAEQ0QEaIANB8AtqIAxBwAEQ0QEaIANBsA1qIA1BwAEQ0QEaIANB8A5qIAZBwAEQ0QEaIAZB5wAQ0AEaIAUgARB4IAUQFCAOIAEQeAwBCyAAEGcMAQsDQCAEQcAKRwRAIANBsARqIgUgA0HwBWogBGoiBhB4IAZBwAFqIgYgBRB4IAYgA0HwAmoQCSAEQcABaiEEDAELCyADQbgCaiIEIAIQaiADKQO4AiEPIARBARCTASAEEEIgAykDuAIhECADQYACaiICIAQQaiACQQEQkwEgAhBCIAQgAiAPQgKBpxAwIANB8AJqIgQgASAQQgKBpxBuIAdBA2oiBkECdiIBQQFqIQIgA0GwBGogBBB4QQAhBAJAAkADQCADQbgCakEFEI8BIQUgAiAERgRAIAZBmANPDQIgA0HwGmogAmogBToAACADQQhqIANB8AVqIAVBGHRBGHUQHQwDCyAEQecARwRAIANB8BpqIARqIAVBEGsiBzoAACADQbgCaiIFIAdBGHRBGHUQlAEgBRBCIAVBBBAsIARBAWohBAwBCwtB5wBB5wBBuIHAABA7AAsgAkHnAEHIgcAAEDsACwNAIAFBf0cEQCADQfACaiIEIANB8AVqIANB8BpqIAFqLAAAEB0gAUEBayEBIANBCGoiAhAUIAIQFCACEBQgAhAUIAIgBBAJDAELCyMAQcABayIBJAAgARBnIAEgA0GwBGoQeCABEKQBIANBCGoiAiABEAkgAUHAAWokACAAIAJBwAEQ0QEaCyADQbAcaiQAC1ABAX8gAEE4ENABIQACQANAIAJBMEYNASAAQQgQKCACQTBHBEAgACAAKQMAIAEgAmoxAAB8NwMAIAJBAWohAgwBCwsgAkEwQaSbwAAQOwALCw0AIAAQNiAAIAEQmgELDAAgACABEGogABBUCw0AIAAQcSAAQQE2AjgLDAAgABBDIAAgARB3CwoAQQAgAGsgAHELCwAgAC0ABEEDcUULDAAgACABQQNyNgIECw0AIAAoAgAgACgCBGoLDgAgACgCABoDQAwACwALgQgCCX8CfiAANQIAIQsjAEEwayIGJABBJyEAAkAgC0KQzgBUBEAgCyEMDAELA0AgBkEJaiAAaiICQQRrIAsgC0KQzgCAIgxCkM4Afn2nIgNB//8DcUHkAG4iBEEBdEHouMAAai8AADsAACACQQJrIAMgBEHkAGxrQf//A3FBAXRB6LjAAGovAAA7AAAgAEEEayEAIAtC/8HXL1YgDCELDQALCyAMpyICQeMASwRAIABBAmsiACAGQQlqaiAMpyICIAJB//8DcUHkAG4iAkHkAGxrQf//A3FBAXRB6LjAAGovAAA7AAALAkAgAkEKTwRAIABBAmsiACAGQQlqaiACQQF0Qei4wABqLwAAOwAADAELIABBAWsiACAGQQlqaiACQTBqOgAACwJ/IAZBCWogAGohCEErQYCAxAAgASgCACIDQQFxIgIbIQQgAkEnIABrIglqIQJBlLjAAEEAIANBBHEbIQUCQAJAIAEoAghFBEBBASEAIAEgBCAFEFINAQwCCwJAAkACQAJAIAIgAUEMaigCACIDSQRAIAEtAABBCHENBEEAIQAgAyACayICIQNBASABLQAgIgcgB0EDRhtBA3FBAWsOAgECAwtBASEAIAEgBCAFEFINBAwFC0EAIQMgAiEADAELIAJBAXYhACACQQFqQQF2IQMLIABBAWohACABQRxqKAIAIQcgASgCBCECIAEoAhghCgJAA0AgAEEBayIARQ0BIAogAiAHKAIQEQQARQ0AC0EBDAQLQQEhACACQYCAxABGDQEgASAEIAUQUg0BIAEoAhggCCAJIAEoAhwoAgwRBQANASABKAIcIQQgASgCGCEBQQAhAAJ/A0AgAyAAIANGDQEaIABBAWohACABIAIgBCgCEBEEAEUNAAsgAEEBawsgA0khAAwBCyABKAIEIQcgAUEwNgIEIAEtACAhCkEBIQAgAUEBOgAgIAEgBCAFEFINAEEAIQAgAyACayICIQMCQAJAAkBBASABLQAgIgQgBEEDRhtBA3FBAWsOAgABAgtBACEDIAIhAAwBCyACQQF2IQAgAkEBakEBdiEDCyAAQQFqIQAgAUEcaigCACECIAEoAgQhBCABKAIYIQUCQANAIABBAWsiAEUNASAFIAQgAigCEBEEAEUNAAtBAQwDC0EBIQAgBEGAgMQARg0AIAEoAhggCCAJIAEoAhwoAgwRBQANACABKAIcIQAgASgCGCEFQQAhAgJAA0AgAiADRg0BIAJBAWohAiAFIAQgACgCEBEEAEUNAAtBASEAIAJBAWsgA0kNAQsgASAKOgAgIAEgBzYCBEEADAILIAAMAQsgASgCGCAIIAkgAUEcaigCACgCDBEFAAsgBkEwaiQACwsAIAAQNiAAELABCysCAX8BfkIBIQIDQCAAIAFqIAI3AwBCACECIAFBCGoiAUE4Rw0ACyAAEFQLCgAgACgCBEF4cQsKACAAKAIEQQFxCwoAIAAoAgxBAXELCgAgACgCDEEBdgsZACAAIAFByLvAACgCACIAQQIgABsRAAAAC58BAQN/AkAgASICQQ9NBEAgACEBDAELIABBACAAa0EDcSIEaiEDIAQEQCAAIQEDQCABQQA6AAAgAUEBaiIBIANJDQALCyADIAIgBGsiAkF8cSIEaiEBIARBAEoEQANAIANBADYCACADQQRqIgMgAUkNAAsLIAJBA3EhAgsgAgRAIAEgAmohAgNAIAFBADoAACABQQFqIgEgAkkNAAsLIAALuAIBB38CQCACIgRBD00EQCAAIQIMAQsgAEEAIABrQQNxIgNqIQUgAwRAIAAhAiABIQYDQCACIAYtAAA6AAAgBkEBaiEGIAJBAWoiAiAFSQ0ACwsgBSAEIANrIghBfHEiB2ohAgJAIAEgA2oiA0EDcQRAIAdBAEwNASADQQN0IgRBGHEhCSADQXxxIgZBBGohAUEAIARrQRhxIQQgBigCACEGA0AgBSAGIAl2IAEoAgAiBiAEdHI2AgAgAUEEaiEBIAVBBGoiBSACSQ0ACwwBCyAHQQBMDQAgAyEBA0AgBSABKAIANgIAIAFBBGohASAFQQRqIgUgAkkNAAsLIAhBA3EhBCADIAdqIQELIAQEQCACIARqIQMDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADSQ0ACwsgAAsHACAAIAFqCwcAIAAgAWsLBwAgAEEIagsHACAAQQhrCwQAQQALDQBC0oGc3sHF/O+ofwsNAEKL5OeV8riP17h/Cw0AQu7u59vMr5Ho5gALAwABCzABAn8DQCADIAJHBEAgACADaiIEIAQpAwAgASADaikDAHw3AwAgA0EIaiEDDAELCwswAQJ/A0AgAyACRwRAIAAgA2oiBCAEKQMAIAEgA2opAwB9NwMAIANBCGohAwwBCwsLC/k5BwBBgIDAAAsBBABBuIDAAAupAXNyYy9ibHMxMjM4MS9lY3AucnMAAAAAAKuq//////4B7v//VKz//wLqQWIPaw8qAcOc/UoUzhMCS3dk16xLQwLt6caSpvlfAqMeEaABAAAAOAAQABMAAADOAQAAFgAAADgAEAATAAAA0gEAABEAAAA4ABAAEwAAANQBAAAaAAAAOAAQABMAAAB0BAAAEQAAADgAEAATAAAAeQQAAA0AAAABAAEAAAABAjQAQZCCwAAL2SUdTFgtCCj0ANdfPjho49sAickaiP2ugQGiY6OauQ9OAZjqsIJJbckCgE5az1A67gCKaUQBAAAAAOArF47pSMwBdKk6W4xWyACiVe817/wUAOeCwgE9ycMDwRYgO+4+dQC6xGIADCBaANEIKS4BAAAAuCHovWIQxQDf/hWXO0ilAYsIMfwD1L0BuxH8JzRS0gMd8BLaG9ejASo9zjbdL9sCyGJ0HwAAAAAp0qKLLrrIAepHTpMt4MYCJIy2xiS88QMCj/DeIIv4AZ3XMT3u7YEDiKVHL5yDiQNIwghuAAAAAHv7BRY/32cCMnsXCuPH3QJpb4YUOwA2AytUW/7hmXcDzH36DVtW0gECO7ac+IFzAgfaIQMBAAAAngw5vmcQJANf3skAt8tCAjH6t7FLr0sBjJ1lcjHoAALLLt0ijxNdAdQNgwvx6fMC4fixaQEAAAAX45eEaphxAVul062lfKUA+uQdXYySbAEWi9JVfZ6zAXU7xA2ZvmMBzSzkHvHjaQIfz9OAAAAAAI7I8OMYVssA52sdPTI+8gGbM1MnD+9iAAuaxjZtnawC5W01U34R0QAhDh26+PZqAHDngXsBAAAAhO05oSXy1wG3sktBMEqUANqosoacjyECI0CGMz48mQCGFbG/UuaKA7DJjVpKE/kDU2Xt1gAAAACDKWVvxsETAXNGz7lyS8MBCAr5aH4JuQJOe27mSWX3AbE827VKp/cDBkh0wP/EXANQMgxjAQAAANmViKzpTBUBFPGdB8wbigKFicH6glm2Arsh/OxfSWgBmduZVI4R5AMsrZDZEH1mAKMml+kAAAAAYWibHWSIswHxZBzEOJe4ATM1CDMbnygDzMaX/DaqlQHk9dcSVOUHA3SCgdNtG/MDZnGOdwEAAACw3J6snZ8XAPinXIJKjw8DWMkljsYeUALjoZUPZqXMASQDzhuaCtEBMRJEBzueXQLbBUDVAAAAALuDy7Px7jQAutUwxrypPAKDtIYeDcczApfVXxCqvWwB5xd8HKhHIQKsLmLBy+pQAj7tlHIBAAAAt0lGc2IWrAKrW4u5fLUwAGGFLE7bbLUDicl/AVyLIgI+MGuFFZjZAQdEAi7QzKADsfIFGgEAAAAK3exo0YRjAQtAGd7SktMBMVnBMY+XMwF9291A31u6A7SC9oBmpbMCj1vbEbVKegKrE/yVAAAAAEHWoXk67HYDEdyQ7qqkmQA4UIOY82faAEDQrdmExXUAjX/gzKPHrwHPgqSX4FNpA2rPDqEAAAAAXlrMvZvZ9wHEtHhEJ1JuAfqAxSKY3xwCW2agoilvCANjf26ZAc90AGz9LIwsKlkDqcJ6SgEAAAA6SuhuSXQlADsbeMPj1OwAp87p7SoGcwC4OCWGTr1mAlcPVyFnWeADGIPPQ4ZNWgDPqix3AAAAAKUEY5+i+S0AcMSjCPGSNABA94KJS/LOAw4pNLVyOqcDNVc56cYGBQPfQ05V7pk5AY5fNecAAAAAHqIyNVs5nQNUB17NB+qmAL2pbTA7g04ArTXuioGEZgHH3/99oOdDA1fHmwIqRYoAIBaOOgEAAADYLMaNk+gNAwRxPbsPSbUBlwT91ii8igIyU0WVxVr8ACQIW1TrQHwD+6sOsr+4YgEaWCU0AAAAABk+uFy6OcIAP7c/JZ8l9ABqzeqsEQvgAJnyRzPGab0BQYlvH5nyvwGK+U2gl8joAeUvlrIAAAAA/zsryG4nyAF5ugksGyGqAj1x9YvEiCUAmwQwAMIzKAPoQXA2NuWYAkQcLdIQZ9UC3qVhJQEAAAAcG9JA+vk8ASZ+D41voDUCVSvGivwXhgBWcuoibY0uAe/VAW/600sDi7kshmvGPwNI1aiMAAAAAAS2yGm+VrQAwR0HsL+fQAFmKxvwWqlPAbde5WhZEj4CHRjLtS7fQgPOQqmT88BDAunka14BAAAASyJ1VHEeawLh7Wte2SZBALpGzqeW0/UArGajlaFfBwI9Z178o8RIA31WqEDEM5EDRZYSXAAAAAAzAZjb9dPZAhCZyghHK+QDbMxZBsTTMgKZTwBWMDUgADt7ddwV43sCKwC/3KayRwNKOVokAAAAAPgelwvwBEwBg3yEZGRwFAJs8DNGe4AOAZwAO8Ka0KgAsad6RD/1BABYQlV05uQGAMHKgrEAAAAAjk0H0KTIBwKzgTXRBn1zAp0kQ/YR+ecDr7kYCcOr4gJZNVLM7dL+A1AwRq63vc0DCKlGiwEAAAAywRHQGnETADq/7o8zl84DGwNhnjgW5ANgRP8kvbItA8svzZP7Qx0D40J/g2803wB55BOXAQAAADAcc8rrqq8DypuuU3cV3AOzuUNNHu3nAWEa+NtrRZ4CDCrEI0qhrQN5r45Iba9hAKGnu+EAAAAAh6Xbe1cONwDY6IHhcYCUAZ3mqwzyoeYCLXqwCXeeWQC9Oo+7oU0eAognI/oSmmUDiwHEnwAAAAAp+3AYo0xeAWhN+rc/VJEBL2RCyCZs2gAO9H9g947/AgUKF3TGpiwBr0mm9xuuzgBTjXyYAAAAAPLW6V+F+GEBslfQg5GwHgJ6dPM01sQTAMVILROGrygDuFvnPGt5JwD0XbIs7wbrA7y5sEoAAAAA8KUzNrE6sgGmHKBWssnYAwPiRFWt08MBQdn13ra+UgPQp3SgpvC4AUd4hIja0hgApPwDZgEAAADb/ujy7Nq2ARAqEGQCN/4B7sKtURMi/QMM5uFCOY/vAzZVGcQpFaIC+NMr18Q/+APeP8CMAAAAAMv05bB3XDUCKXuHsaeuFgDknc9RMsA+ApIncOStO+QCpyrUV2d02AJGHSZeCAcmAm43hh8AAAAA9uEtx0Di3wDuSAEsioVUAyZ92gAUueQDEg2Lc4xiWQPiUiWUSTtqADLhKL2Zm6UCuobHDAAAAACWxkEuWueXAPgv6otlxFkBbE3TerY+NAJBPvTgPJWwAekjEoNG+3YDtQ1EdQSWOwEQapk0AQAAADO7B5dxRZgCr/Dozqa7HgPQPD1UVsn2AkqtSKWhIjkCE60R+tyASQHCR2cJuJPoAoF82ZAAAAAAj0tjHTpHFQAR4CVNPFy9AMoFospWY80DO8lM4c6JlwEPxHHBGXgNAlcJyZoPcLcBgR364AAAAAD3Bu0mE9z6ATQgM8Vh70UBIOSAJJQn3wDSLQefpJxTAltWv/J2zVMBQ/ei2M6TywIOQGAmAAAAAMxFM1c4sZkCR7BC7vjYAQAwabjZAJrvAnP1mQh8K2YDRjNUlhRftABRTNjw+J8dAxSVa60AAAAAkhBW4im1hAKl+q7fGyZaAm9RE3nqjKgBPjBKCzm/KwL/lH9HDMVIAgdLYf3PQAcCdLbLrAAAAACoao+6nLT4AACBweDTp3ABGodcamNuswFkOaSYhu3mANBtnB2R0hoAKAQ8Um8BqQOeJS9NAAAAAFU/kbiL9G4AjddsSvWoFwJzvE996ueSASFM7R72hI8B9xYykIRK2QNlgaA6h5vCAdpcpWcBAAAASl1TVZ09IwPaIJLk7r34AyyFtDm/xFADFa+CZL0akwMM+/nETNfRA1P5hsZIGNsA045shgEAAADZLoEVWkHuABi5dwACbD0AkisTV2Mg/QDN+l8/feh7ATek5W7/prsCfjfvgPqpjwOL8D5qAQAAAFx3ahKZExoBT+7HYmkApwJfHQWgAMRbAk13veMzNOoD/exeS4LprADNoe7wy3amAgh8AGYBAAAArLf5qn9HxgKAOHPqd27jAJ9EpvXwtocBsxcHYkNVGQNSAbeCMXisArqZ7GfLtmEAl1KejQAAAAAdAKURIxQ5AnZ7u/QDd8UCIGqR7J38oAG7UMHupj18ApzRxtyNIvgCRDIDLPnQFwGVBw6+AAAAABZUX0SYbdIAauuloLA82QAnF/Rqcp5IAvZIOEzzdm8DxRXR0bTtiQPvSIN85ZRjAocofWsBAAAA8me/PbU4JQJH4lu+jTVfAWfKLs150l0C1jDE/LlGVQGFxHhXsY5uAZ+r6tuJNpABBjPfWAAAAAA9oEkuLBD2AkyNp9TYgQkBivcBPkVvNQCEknJWE8fcA0/IhbhIw0MAWy+DhgdI4ADCdS2WAQAAAMFjNrBTkkcBQBsIg70j2gB/oOdyvrUyAgy7my9g4pUDbRpg6erQ+gBQBIaULCanAsPEEmEBAAAAc3JjL2JsczEyMzgxL2JpZy5ycwBQDRAAEwAAAE4AAAAWAAAAUA0QABMAAADtAAAAGgAAAFANEAATAAAA7QAAAA0AAABQDRAAEwAAAO8AAAAJAAAAUA0QABMAAACmAQAAFwAAAFANEAATAAAALQIAABIAAABQDRAAEwAAAFIDAAAYAAAAUA0QABMAAABSAwAAIQAAAFANEAATAAAAXAMAACEAAABQDRAAEwAAAHUDAAAXAAAAUA0QABMAAAB+AwAAFwAAAFANEAATAAAAwQMAABgAAABQDRAAEwAAAM8DAAAYAAAAVHJpZWQgdG8gc2hyaW5rIHRvIGEgbGFyZ2VyIGNhcGFjaXR5NA4QACQAAAAvcnVzdGMvZmU1YjEzZDY4MWYyNWVlNjQ3NGJlMjlkNzQ4YzY1YWRjZDkxZjY5ZS9saWJyYXJ5L2FsbG9jL3NyYy9yYXdfdmVjLnJzYA4QAEwAAACpAQAACQAAAAAAAAAirijXmC+KQs1l7yORRDdxLztN7M/7wLW824mBpdu16Ti1SPNbwlY5GdAFtvER8VmbTxmvpII/khiBbdrVXhyrQgIDo5iqB9i+b3BFAVuDEoyy5E6+hTEk4rT/1cN9DFVviXvydF2+crGWFjv+sd6ANRLHJacG3JuUJmnPdPGbwdJK8Z7BaZvk4yVPOIZHvu+11YyLxp3BD2WcrHfMoQwkdQIrWW8s6S2D5KZuqoR0StT7Qb3cqbBctVMRg9qI+Xar32buUlE+mBAytC1txjGoPyH7mMgnA7DkDu++x39Zv8KPqD3zC+DGJacKk0eRp9VvggPgUWPKBnBuDgpnKSkU/C/SRoUKtycmySZcOCEbLu0qxFr8bSxN37OVnRMNOFPeY6+LVHMKZaiydzy7Cmp25q7tRy7JwoE7NYIUhSxykmQD8Uyh6L+iATBCvEtmGqiRl/jQcItLwjC+VAajUWzHGFLv1hnoktEQqWVVJAaZ1iogcVeFNQ70uNG7MnCgahDI0NK4FsGkGVOrQVEIbDcemeuO30x3SCeoSJvhtbywNGNaycWzDBw5y4pB40qq2E5z42N3T8qcW6O4stbzby5o/LLvXe6Cj3RgLxdDb2OleHKr8KEUeMiE7DlkGggCx4woHmMj+v++kOm9gt7rbFCkFXnGsvej+b4rU3Lj8nhxxpxhJurOPifKB8LAIce4htEe6+DN1n3a6njRbu5/T331um8Xcqpn8AammMiixX1jCq4N+b4EmD8RG0ccEzULcRuEfQQj9XfbKJMkx0B7q8oyvL7JFQq+njxMDRCcxGcdQ7ZCPsu+1MVMKn5l/Jwpf1ns+tY6q2/LXxdYR0qMGURsmC+KQpFEN3HP+8C1pdu16VvCVjnxEfFZpII/ktVeHKuYqgfYAVuDEr6FMSTDfQxVdF2+cv6x3oCnBtybdPGbwcFpm+SGR77vxp3BD8yhDCRvLOktqoR0StypsFzaiPl2UlE+mG3GMajIJwOwx39Zv/ML4MZHkafVUWPKBmcpKRSFCrcnOCEbLvxtLE0TDThTVHMKZbsKanYuycKBhSxykqHov6JLZhqocItLwqNRbMcZ6JLRJAaZ1oU1DvRwoGoQFsGkGQhsNx5Md0gntbywNLMMHDlKqthOT8qcW/NvLmjugo90b2OleBR4yIQIAseM+v++kOtsUKT3o/m+8nhxxnNyYy9ibHMxMjM4MS9ibHMucnMAAAAAAKuq//////4B7v//VKz//wLqQWIPaw8qAcOc/UoUzhMCS3dk16xLQwLt6caSpvlfAqMeEaABAAAAQBIQABMAAABBAAAAEwAAAEASEAATAAAAQQAAAA0AAABAEhAAEwAAAEMAAAAsAAAAQkxTX1NJR19CTFMxMjM4MUcxX1hNRDpTSEEtMjU2X1NTV1VfUk9fTlVMX3NyYy9ibHMxMjM4MS9mcDIucnMAAOsSEAATAAAAmwAAABIAAADrEhAAEwAAAJ8AAAASAAAAc3JjL2JsczEyMzgxL2VjcDIucnMgExAAFAAAAJMAAAAVAAAAIBMQABQAAACUAAAAFQAAACATEAAUAAAAlQAAABUAAAAgExAAFAAAAJYAAAAVAAAAIBMQABQAAACXAAAAFQAAACATEAAUAAAAmAAAABUAAAAgExAAFAAAAJkAAAAVAAAAIBMQABQAAACaAAAAFQAAACATEAAUAAAAGQEAABEAAAAgExAAFAAAACIBAAAWAAAAIBMQABQAAAAoAQAAGgAAAAAAAAAEAEGgqMAAC/kEIBMQABQAAABXAgAADQAAACATEAAUAAAAXAIAAAkAAAC4vSHByFaAAPX7bgGqyQADunAXPa5HtgBE0QrsAOlTA3rkxlEQxS0DSQGCSaTCIwAvK6okAAAAAH4rBF0FfawB+VUX5YREPAM0kwT1x70bAmnXatiCZEID0GtZZU8niADoNGsf2GecAAW2Aj4BAAAAASi4CIZUkwF4oijrDnOyAiPJEg0WlaYBCrWdTvcyqgKb/a0aNS7aAnFzMmOEW58Ad1JdzgAAAAC+eV/wXwepAmpoBzvXScMB87Oa6XK1KgHSmbyOnRb6ASg+y5mLwisArDSrDDPNqQMCSmxgAAAAAHNyYy9obWFjLnJzACAVEAALAAAAewAAABQAAAAgFRAACwAAAHsAAAANAAAAIBUQAAsAAAB/AAAAIAAAACAVEAALAAAAfwAAAA0AAAAgFRAACwAAAIIAAAANAAAAIBUQAAsAAAB3AAAAFAAAACAVEAALAAAAdwAAAA0AAAAAAAAAYXR0ZW1wdCB0byBkaXZpZGUgYnkgemVybwAAACAVEAALAAAARAEAAAUAAABIMkMtT1ZFUlNJWkUtRFNULQAAACAVEAALAAAAWwEAADYAAAAgFRAACwAAAHABAAAJAAAAIBUQAAsAAAByAQAABQAAACAVEAALAAAAdAEAAEAAAAAgFRAACwAAAHkBAAAUAAAAIBUQAAsAAAB/AQAADQAAACAVEAALAAAAgQEAAAkAAAAgFRAACwAAAIMBAAAzAAAAIBUQAAsAAACDAQAASwAAACAVEAALAAAAhQEAABQAAAAgFRAACwAAAIUBAAANAAAAAAABAAAAAQI0AEHIrcAAC5wBuF8jku11BwFjT+D5WE+pA2dPnKtLeD0Akew9ffXy9AMD1g8fDSwgAK1vjPCZwa4A8DtNkAEAAADzStxtEor3AIuwH1tTsFYDgvLFYx+X7AAysL/NHtseAkehVLifHyMCQHo6ogw4sQGz4sMPAAAAAP7//v///wECiwCAgtgE9gHhjWiJb76TAs52q989qB0Axmm6Uc523wPLWcYXAEHwrsAAC+EEAQAAAAAAAACCgAAAAAAAAIqAAAAAAACAAIAAgAAAAICLgAAAAAAAAAEAAIAAAAAAgYAAgAAAAIAJgAAAAAAAgIoAAAAAAAAAiAAAAAAAAAAJgACAAAAAAAoAAIAAAAAAi4AAgAAAAACLAAAAAAAAgImAAAAAAACAA4AAAAAAAIACgAAAAAAAgIAAAAAAAACACoAAAAAAAAAKAACAAAAAgIGAAIAAAACAgIAAAAAAAIABAACAAAAAAAiAAIAAAACAc3JjL3NoYTMucnMAMBgQAAsAAAC/AAAACQAAADAYEAALAAAA2QAAABAAAAAAAAAAYXR0ZW1wdCB0byBkaXZpZGUgYnkgemVybwAAADAYEAALAAAA3QAAABwAAAAwGBAACwAAAN8AAAAVAAAAMBgQAAsAAADpAAAAGAAAADAYEAALAAAA6wAAABEAAABzcmMvYmxzMTIzODEvZGJpZy5yc7wYEAAUAAAAXAAAAA4AAAC8GBAAFAAAAFwAAAAyAAAAvBgQABQAAABfAAAAOAAAALwYEAAUAAAAYgAAAAkAAAC8GBAAFAAAAG4AAAASAAAAvBgQABQAAABtAAAADQAAALwYEAAUAAAAcAAAAAkAAACrqv/////+Ae7//1Ss//8C6kFiD2sPKgHDnP1KFM4TAkt3ZNesS0MC7enGkqb5XwKjHhGgAQAAAK73vtWhOQYC6JPdYmRMJAHSLG5OtQktAtvlcDG2xBEBmWM2++htigO8nB/tzxZPACtqpp4BAAAAc3JjL2JsczEyMzgxL2ZwLnJzAACwGRAAEgAAAHoBAAANAEHgs8AAC8EHYXR0ZW1wdCB0byBkaXZpZGUgYnkgemVybwAAAAAAAABhdHRlbXB0IHRvIGRpdmlkZSB3aXRoIG92ZXJmbG93ALAZEAASAAAADAIAAA0AAACwGRAAEgAAABgCAAAmAAAAsBkQABIAAAAYAgAAIwAAALAZEAASAAAAHgIAABcAAACwGRAAEgAAAB4CAAAUAAAAqqr//////gHu//9UrP//AupBYg9rDyoBw5z9ShTOEwJLd2TXrEtDAu3pxpKm+V8Cox4RoAEAAAADAAAABAAAAAQAAAAEAAAABQAAAAYAAABjYWxsZWQgYE9wdGlvbjo6dW53cmFwKClgIG9uIGEgYE5vbmVgIHZhbHVlbWVtb3J5IGFsbG9jYXRpb24gb2YgIGJ5dGVzIGZhaWxlZAoAAOsaEAAVAAAAABsQAA4AAABsaWJyYXJ5L3N0ZC9zcmMvYWxsb2MucnMgGxAAGAAAAEkBAAAJAAAAbGlicmFyeS9zdGQvc3JjL3Bhbmlja2luZy5yc0gbEAAcAAAARgIAAB8AAABIGxAAHAAAAEcCAAAeAAAABwAAAAwAAAAEAAAACAAAAAMAAAAIAAAABAAAAAkAAAAKAAAAEAAAAAQAAAALAAAADAAAAAMAAAAIAAAABAAAAA0AAAAOAAAAbGlicmFyeS9hbGxvYy9zcmMvcmF3X3ZlYy5yc2NhcGFjaXR5IG92ZXJmbG93AAAA6BsQABEAAADMGxAAHAAAAAUCAAAFAAAAEAAAAAAAAAABAAAAEQAAAGluZGV4IG91dCBvZiBib3VuZHM6IHRoZSBsZW4gaXMgIGJ1dCB0aGUgaW5kZXggaXMgAAAkHBAAIAAAAEQcEAASAAAAMDAwMTAyMDMwNDA1MDYwNzA4MDkxMDExMTIxMzE0MTUxNjE3MTgxOTIwMjEyMjIzMjQyNTI2MjcyODI5MzAzMTMyMzMzNDM1MzYzNzM4Mzk0MDQxNDI0MzQ0NDU0NjQ3NDg0OTUwNTE1MjUzNTQ1NTU2NTc1ODU5NjA2MTYyNjM2NDY1NjY2NzY4Njk3MDcxNzI3Mzc0NzU3Njc3Nzg3OTgwODE4MjgzODQ4NTg2ODc4ODg5OTA5MTkyOTM5NDk1OTY5Nzk4OTkgb3V0IG9mIHJhbmdlIGZvciBzbGljZSBvZiBsZW5ndGggbGlicmFyeS9jb3JlL3NyYy9zbGljZS9pbmRleC5yc3JhbmdlIGVuZCBpbmRleCAAAABxHRAAEAAAADAdEAAiAAAAUh0QAB8AAABJAAAABQB7CXByb2R1Y2VycwIIbGFuZ3VhZ2UBBFJ1c3QADHByb2Nlc3NlZC1ieQMFcnVzdGMdMS42MS4wIChmZTViMTNkNjggMjAyMi0wNS0xOCkGd2FscnVzBjAuMTkuMAx3YXNtLWJpbmRnZW4SMC4yLjgxICgwNjJhYTVmNzAp`; From ebe6af3c2e5b5e1982b065875ac2dabc3a976d08 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 3 Jan 2024 13:03:59 -0800 Subject: [PATCH 11/11] npm audit --- package-lock.json | 2004 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 1800 insertions(+), 204 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4853e597e..2be4266f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -900,6 +900,70 @@ "node": "^14 || ^16 || ^17 || ^18 || ^19" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/darwin-arm64": { "version": "0.19.5", "cpu": [ @@ -915,6 +979,294 @@ "node": ">=12" } }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "dev": true, @@ -1953,35 +2305,100 @@ "darwin" ] }, - "node_modules/@mischnic/json-sourcemap": { - "version": "0.1.1", + "node_modules/@lmdb/lmdb-darwin-x64": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-2.8.5.tgz", + "integrity": "sha512-w/sLhN4T7MW1nB3R/U8WK5BgQLz904wh+/SmA2jD8NnF7BLLoUgflCNxOeSPOWp8geP6nP/+VjWzZVip7rZ1ug==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "@lezer/common": "^1.0.0", - "@lezer/lr": "^1.0.0", - "json5": "^2.2.1" - }, - "engines": { - "node": ">=12.0.0" - } + "optional": true, + "os": [ + "darwin" + ] }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { - "version": "3.0.2", + "node_modules/@lmdb/lmdb-linux-arm": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-2.8.5.tgz", + "integrity": "sha512-c0TGMbm2M55pwTDIfkDLB6BpIsgxV4PjYck2HiOX+cy/JWiBXz32lYbarPqejKs9Flm7YVAKSILUducU9g2RVg==", "cpu": [ - "arm64" + "arm" ], "dev": true, - "license": "MIT", "optional": true, "os": [ - "darwin" + "linux" ] }, - "node_modules/@noble/curves": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { + "node_modules/@lmdb/lmdb-linux-arm64": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-2.8.5.tgz", + "integrity": "sha512-vtbZRHH5UDlL01TT5jB576Zox3+hdyogvpcbvVJlmU5PdL3c5V7cj1EODdh1CHPksRl+cws/58ugEHi8bcj4Ww==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@lmdb/lmdb-linux-x64": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-2.8.5.tgz", + "integrity": "sha512-Xkc8IUx9aEhP0zvgeKy7IQ3ReX2N8N1L0WPcQwnZweWmOuKfwpS3GRIYqLtK5za/w3E60zhFfNdS+3pBZPytqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@lmdb/lmdb-win32-x64": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.8.5.tgz", + "integrity": "sha512-4wvrf5BgnR8RpogHhtpCPJMKBmvyZPhhUtEwMJbXh0ni2BucpfF07jlmyM11zRqQ2XIq6PbC2j7W7UCCcm1rRQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@mischnic/json-sourcemap": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0", + "@lezer/lr": "^1.0.0", + "json5": "^2.2.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { + "version": "3.0.2", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@noble/curves": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { "@noble/hashes": "1.3.3" }, "funding": { @@ -4350,8 +4767,9 @@ }, "node_modules/@pm2/pm2-version-check": { "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@pm2/pm2-version-check/-/pm2-version-check-1.0.4.tgz", + "integrity": "sha512-SXsM27SGH3yTWKc2fKR4SYNxsmnvuBQ9dd6QHtEWmiZ/VqaOYPAIlS8+vMcn27YLtAEBGvNRSh3TPNvtjZgfqA==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^4.3.1" } @@ -4388,6 +4806,175 @@ "node": ">=12" } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.2.tgz", + "integrity": "sha512-RKzxFxBHq9ysZ83fn8Iduv3A283K7zPPYuhL/z9CQuyFrjwpErJx0h4aeb/bnJ+q29GRLgJpY66ceQ/Wcsn3wA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.2.tgz", + "integrity": "sha512-yZ+MUbnwf3SHNWQKJyWh88ii2HbuHCFQnAYTeeO1Nb8SyEiWASEi5dQUygt3ClHWtA9My9RQAYkjvrsZ0WK8Xg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.2.tgz", + "integrity": "sha512-vqJ/pAUh95FLc/G/3+xPqlSBgilPnauVf2EXOQCZzhZJCXDXt/5A8mH/OzU6iWhb3CNk5hPJrh8pqJUPldN5zw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.2.tgz", + "integrity": "sha512-otPHsN5LlvedOprd3SdfrRNhOahhVBwJpepVKUN58L0RnC29vOAej1vMEaVU6DadnpjivVsNTM5eNt0CcwTahw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.2.tgz", + "integrity": "sha512-ewG5yJSp+zYKBYQLbd1CUA7b1lSfIdo9zJShNTyc2ZP1rcPrqyZcNlsHgs7v1zhgfdS+kW0p5frc0aVqhZCiYQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.2.tgz", + "integrity": "sha512-pL6QtV26W52aCWTG1IuFV3FMPL1m4wbsRG+qijIvgFO/VBsiXJjDPE/uiMdHBAO6YcpV4KvpKtd0v3WFbaxBtg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.2.tgz", + "integrity": "sha512-On+cc5EpOaTwPSNetHXBuqylDW+765G/oqB9xGmWU3npEhCh8xu0xqHGUA+4xwZLqBbIZNcBlKSIYfkBm6ko7g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.2.tgz", + "integrity": "sha512-Wnx/IVMSZ31D/cO9HSsU46FjrPWHqtdF8+0eyZ1zIB5a6hXaZXghUKpRrC4D5DcRTZOjml2oBhXoqfGYyXKipw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.2.tgz", + "integrity": "sha512-ym5x1cj4mUAMBummxxRkI4pG5Vht1QMsJexwGP8547TZ0sox9fCLDHw9KCH9c1FO5d9GopvkaJsBIOkTKxksdw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.2.tgz", + "integrity": "sha512-m0hYELHGXdYx64D6IDDg/1vOJEaiV8f1G/iO+tejvRCJNSwK4jJ15e38JQy5Q6dGkn1M/9KcyEOwqmlZ2kqaZg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.2.tgz", + "integrity": "sha512-x1CWburlbN5JjG+juenuNa4KdedBdXLjZMp56nHFSHTOsb/MI2DYiGzLtRGHNMyydPGffGId+VgjOMrcltOksA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.2.tgz", + "integrity": "sha512-VVzCB5yXR1QlfsH1Xw1zdzQ4Pxuzv+CPr5qpElpKhVxlxD3CRdfubAG9mJROl6/dmj5gVYDDWk8sC+j9BI9/kQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.2.tgz", + "integrity": "sha512-SYRedJi+mweatroB+6TTnJYLts0L0bosg531xnQWtklOI6dezEagx4Q0qDyvRdK+qgdA3YZpjjGuPFtxBmddBA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@sinclair/typebox": { "version": "0.24.35", "dev": true, @@ -4420,17 +5007,353 @@ "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@size-limit/preset-small-lib": { - "version": "9.0.0", + "node_modules/@size-limit/preset-small-lib": { + "version": "9.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@size-limit/esbuild": "9.0.0", + "@size-limit/file": "9.0.0", + "size-limit": "9.0.0" + }, + "peerDependencies": { + "size-limit": "9.0.0" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/android-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/android-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/android-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/darwin-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/freebsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-loong64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-mips64el": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-ppc64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-riscv64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-s390x": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/linux-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/netbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/openbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/sunos-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/win32-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/win32-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@esbuild/win32-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "@size-limit/esbuild": "9.0.0", - "@size-limit/file": "9.0.0", - "size-limit": "9.0.0" - }, - "peerDependencies": { - "size-limit": "9.0.0" + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" } }, "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/esbuild": { @@ -8765,16 +9688,352 @@ "esbuild-windows-arm64": "0.15.16" } }, - "node_modules/esbuild-darwin-arm64": { + "node_modules/esbuild-android-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.16.tgz", + "integrity": "sha512-Vwkv/sT0zMSgPSVO3Jlt1pUbnZuOgtOQJkJkyyJFAlLe7BiT8e9ESzo0zQSx4c3wW4T6kGChmKDPMbWTgtliQA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.16.tgz", + "integrity": "sha512-lqfKuofMExL5niNV3gnhMUYacSXfsvzTa/58sDlBET/hCOG99Zmeh+lz6kvdgvGOsImeo6J9SW21rFCogNPLxg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.16.tgz", + "integrity": "sha512-wo2VWk/n/9V2TmqUZ/KpzRjCEcr00n7yahEdmtzlrfQ3lfMCf3Wa+0sqHAbjk3C6CKkR3WKK/whkMq5Gj4Da9g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.16", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.16.tgz", + "integrity": "sha512-UzIc0xlRx5x9kRuMr+E3+hlSOxa/aRqfuMfiYBXu2jJ8Mzej4lGL7+o6F5hzhLqWfWm1GWHNakIdlqg1ayaTNQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.16.tgz", + "integrity": "sha512-8xyiYuGc0DLZphFQIiYaLHlfoP+hAN9RHbE+Ibh8EUcDNHAqbQgUrQg7pE7Bo00rXmQ5Ap6KFgcR0b4ALZls1g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.16.tgz", + "integrity": "sha512-iGijUTV+0kIMyUVoynK0v+32Oi8yyp0xwMzX69GX+5+AniNy/C/AL1MjFTsozRp/3xQPl7jVux/PLe2ds10/2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.16.tgz", + "integrity": "sha512-tuSOjXdLw7VzaUj89fIdAaQT7zFGbKBcz4YxbWrOiXkwscYgE7HtTxUavreBbnRkGxKwr9iT/gmeJWNm4djy/g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.16.tgz", + "integrity": "sha512-XKcrxCEXDTOuoRj5l12tJnkvuxXBMKwEC5j0JISw3ziLf0j4zIwXbKbTmUrKFWbo6ZgvNpa7Y5dnbsjVvH39bQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.16.tgz", + "integrity": "sha512-mPYksnfHnemNrvjrDhZyixL/AfbJN0Xn9S34ZOHYdh6/jJcNd8iTsv3JwJoEvTJqjMggjMhGUPJAdjnFBHoH8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.16.tgz", + "integrity": "sha512-kSJO2PXaxfm0pWY39+YX+QtpFqyyrcp0ZeI8QPTrcFVQoWEPiPVtOfTZeS3ZKedfH+Ga38c4DSzmKMQJocQv6A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.16.tgz", + "integrity": "sha512-NimPikwkBY0yGABw6SlhKrtT35sU4O23xkhlrTT/O6lSxv3Pm5iSc6OYaqVAHWkLdVf31bF4UDVFO+D990WpAA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.16.tgz", + "integrity": "sha512-ty2YUHZlwFOwp7pR+J87M4CVrXJIf5ZZtU/umpxgVJBXvWjhziSLEQxvl30SYfUPq0nzeWKBGw5i/DieiHeKfw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.16.tgz", + "integrity": "sha512-VkZaGssvPDQtx4fvVdZ9czezmyWyzpQhEbSNsHZZN0BHvxRLOYAQ7sjay8nMQwYswP6O2KlZluRMNPYefFRs+w==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.16.tgz", + "integrity": "sha512-ElQ9rhdY51et6MJTWrCPbqOd/YuPowD7Cxx3ee8wlmXQQVW7UvQI6nSprJ9uVFQISqSF5e5EWpwWqXZsECLvXg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.16.tgz", + "integrity": "sha512-KgxMHyxMCT+NdLQE1zVJEsLSt2QQBAvJfmUGDmgEq8Fvjrf6vSKB00dVHUEDKcJwMID6CdgCpvYNt999tIYhqA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.16.tgz", + "integrity": "sha512-exSAx8Phj7QylXHlMfIyEfNrmqnLxFqLxdQF6MBHPdHAjT7fsKaX6XIJn+aQEFiOcE4X8e7VvdMCJ+WDZxjSRQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.16.tgz", + "integrity": "sha512-zQgWpY5pUCSTOwqKQ6/vOCJfRssTvxFuEkpB4f2VUGPBpdddZfdj8hbZuFRdZRPIVHvN7juGcpgCA/XCF37mAQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.16.tgz", + "integrity": "sha512-HjW1hHRLSncnM3MBCP7iquatHVJq9l0S2xxsHHj4yzf4nm9TU4Z7k4NkeMlD/dHQ4jPlQQhwcMvwbJiOefSuZw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.16.tgz", + "integrity": "sha512-oCcUKrJaMn04Vxy9Ekd8x23O8LoU01+4NOkQ2iBToKgnGj5eo1vU9i27NQZ9qC8NFZgnQQZg5oZWAejmbsppNA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/android-arm": { + "version": "0.15.16", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.16.tgz", + "integrity": "sha512-nyB6CH++2mSgx3GbnrJsZSxzne5K0HMyNIWafDHqYy7IwxFc4fd/CgHVZXr8Eh+Q3KbIAcAe3vGyqIPhGblvMQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-loong64": { "version": "0.15.16", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.16.tgz", + "integrity": "sha512-SDLfP1uoB0HZ14CdVYgagllgrG7Mdxhkt4jDJOKl/MldKrkQ6vDJMZKl2+5XsEY/Lzz37fjgLQoJBGuAw/x8kQ==", "cpu": [ - "arm64" + "loong64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ - "darwin" + "linux" ], "engines": { "node": ">=12" @@ -14690,9 +15949,10 @@ "license": "MIT" }, "node_modules/msgpackr": { - "version": "1.9.9", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.10.1.tgz", + "integrity": "sha512-r5VRLv9qouXuLiIBrLpl2d5ZvPt8svdQTl5/vMvE4nzDMyEX4sgW5yWhuBBj5UmgwOTWj8CIdSXn5sAfsHAWIQ==", "dev": true, - "license": "MIT", "optionalDependencies": { "msgpackr-extract": "^3.0.2" } @@ -14755,7 +16015,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.6", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true, "funding": [ { @@ -14763,7 +16025,6 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -16140,7 +17401,9 @@ } }, "node_modules/postcss": { - "version": "8.4.31", + "version": "8.4.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", + "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", "dev": true, "funding": [ { @@ -16156,9 +17419,8 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -17283,17 +18545,31 @@ } }, "node_modules/rollup": { - "version": "3.29.4", + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.2.tgz", + "integrity": "sha512-66RB8OtFKUTozmVEh3qyNfH+b+z2RXBVloqO2KCC/pjFaGaHtxP9fVfOQKPSGXg2mElmjmxjW/fZ7iKrEpMH5Q==", "dev": true, - "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=14.18.0", + "node": ">=18.0.0", "npm": ">=8.0.0" }, "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.9.2", + "@rollup/rollup-android-arm64": "4.9.2", + "@rollup/rollup-darwin-arm64": "4.9.2", + "@rollup/rollup-darwin-x64": "4.9.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.9.2", + "@rollup/rollup-linux-arm64-gnu": "4.9.2", + "@rollup/rollup-linux-arm64-musl": "4.9.2", + "@rollup/rollup-linux-riscv64-gnu": "4.9.2", + "@rollup/rollup-linux-x64-gnu": "4.9.2", + "@rollup/rollup-linux-x64-musl": "4.9.2", + "@rollup/rollup-win32-arm64-msvc": "4.9.2", + "@rollup/rollup-win32-ia32-msvc": "4.9.2", + "@rollup/rollup-win32-x64-msvc": "4.9.2", "fsevents": "~2.3.2" } }, @@ -17506,160 +18782,496 @@ "sha.js": "bin.js" } }, - "node_modules/shebang-command": { - "version": "2.0.0", + "node_modules/shebang-command": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shelljs/node_modules/interpret": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shelljs/node_modules/rechoir": { + "version": "0.6.2", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shiki": { + "version": "0.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, + "node_modules/shimmer": { + "version": "1.2.1", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "dev": true, + "license": "ISC" + }, + "node_modules/simple-cbor": { + "version": "0.4.1", + "license": "ISC" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/size-limit": { + "version": "10.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^13.2.2", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/size-limit-node-esbuild": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@size-limit/esbuild": "^8.1.0", + "nanoid": "^3.2.0", + "tslib": "^2.4.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/shebang-regex": { - "version": "3.0.0", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], "dev": true, - "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=12" } }, - "node_modules/shell-quote": { - "version": "1.8.1", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "cpu": [ + "loong64" + ], "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" } }, - "node_modules/shelljs": { - "version": "0.8.5", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=4" + "node": ">=12" } }, - "node_modules/shelljs/node_modules/interpret": { - "version": "1.4.0", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], "dev": true, - "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 0.10" + "node": ">=12" } }, - "node_modules/shelljs/node_modules/rechoir": { - "version": "0.6.2", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], "dev": true, - "dependencies": { - "resolve": "^1.1.6" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 0.10" + "node": ">=12" } }, - "node_modules/shiki": { - "version": "0.14.5", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], "dev": true, - "license": "MIT", - "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" } }, - "node_modules/shimmer": { - "version": "1.2.1", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/side-channel": { - "version": "1.0.4", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" } }, - "node_modules/siginfo": { - "version": "2.0.0", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], "dev": true, - "license": "ISC" + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/signal-exit": { - "version": "3.0.7", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], "dev": true, - "license": "ISC" - }, - "node_modules/simple-cbor": { - "version": "0.4.1", - "license": "ISC" + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/sisteransi": { - "version": "1.0.5", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT" + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/size-limit": { - "version": "10.0.2", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "bytes-iec": "^3.1.1", - "chokidar": "^3.5.3", - "globby": "^13.2.2", - "lilconfig": "^2.1.0", - "nanospinner": "^1.1.0", - "picocolors": "^1.0.0" - }, - "bin": { - "size-limit": "bin.js" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": ">=12" } }, - "node_modules/size-limit-node-esbuild": { - "version": "0.2.0", + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], "dev": true, - "license": "MIT", - "dependencies": { - "@size-limit/esbuild": "^8.1.0", - "nanoid": "^3.2.0", - "tslib": "^2.4.0" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" + "node": ">=12" } }, - "node_modules/size-limit-node-esbuild/node_modules/@esbuild/darwin-arm64": { + "node_modules/size-limit-node-esbuild/node_modules/@esbuild/win32-x64": { "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "cpu": [ - "arm64" + "x64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ - "darwin" + "win32" ], "engines": { "node": ">=12" @@ -19155,28 +20767,29 @@ } }, "node_modules/vite": { - "version": "4.5.0", + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz", + "integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==", "dev": true, - "license": "MIT", "dependencies": { - "esbuild": "^0.18.10", - "postcss": "^8.4.27", - "rollup": "^3.27.1" + "esbuild": "^0.19.3", + "postcss": "^8.4.32", + "rollup": "^4.2.0" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { - "fsevents": "~2.3.2" + "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": ">= 14", + "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", @@ -19231,12 +20844,13 @@ } }, "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", "cpu": [ "arm64" ], "dev": true, - "license": "MIT", "optional": true, "os": [ "darwin" @@ -19246,10 +20860,11 @@ } }, "node_modules/vite/node_modules/esbuild": { - "version": "0.18.20", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", "dev": true, "hasInstallScript": true, - "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -19257,28 +20872,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.18.20", - "@esbuild/android-arm64": "0.18.20", - "@esbuild/android-x64": "0.18.20", - "@esbuild/darwin-arm64": "0.18.20", - "@esbuild/darwin-x64": "0.18.20", - "@esbuild/freebsd-arm64": "0.18.20", - "@esbuild/freebsd-x64": "0.18.20", - "@esbuild/linux-arm": "0.18.20", - "@esbuild/linux-arm64": "0.18.20", - "@esbuild/linux-ia32": "0.18.20", - "@esbuild/linux-loong64": "0.18.20", - "@esbuild/linux-mips64el": "0.18.20", - "@esbuild/linux-ppc64": "0.18.20", - "@esbuild/linux-riscv64": "0.18.20", - "@esbuild/linux-s390x": "0.18.20", - "@esbuild/linux-x64": "0.18.20", - "@esbuild/netbsd-x64": "0.18.20", - "@esbuild/openbsd-x64": "0.18.20", - "@esbuild/sunos-x64": "0.18.20", - "@esbuild/win32-arm64": "0.18.20", - "@esbuild/win32-ia32": "0.18.20", - "@esbuild/win32-x64": "0.18.20" + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" } }, "node_modules/vitest": { @@ -20998,26 +22614,6 @@ "@types/hdkey": "^2.0.3" } }, - "packages/identity/node_modules/@noble/curves": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.3.3" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "packages/identity/node_modules/@noble/hashes": { - "version": "1.3.3", - "license": "MIT", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "packages/identity/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "dev": true,