@dotenvx/next-env 0.1.0 → 1.74.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/index.cjs +191 -0
- package/node_modules/@dotenvx/dotenvx/CHANGELOG.md +2104 -0
- package/node_modules/@dotenvx/dotenvx/LICENSE +28 -0
- package/node_modules/@dotenvx/dotenvx/README.md +2781 -0
- package/node_modules/@dotenvx/dotenvx/package.json +77 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/armor/down.js +37 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/armor/move.js +42 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/armor/pull.js +37 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/armor/push.js +37 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/armor/up.js +37 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/decrypt.js +93 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/doctor.js +22 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/encrypt.js +114 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/ext/genexample.js +36 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/ext/gitignore.js +105 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/ext/prebuild.js +30 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/ext/precommit.js +30 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/ext/scan.js +34 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/get.js +98 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/keypair.js +66 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/login.js +62 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/logout.js +36 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/ls.js +24 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/normalizeArmorOptions.js +10 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/rotate.js +87 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/run.js +126 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/actions/set.js +92 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/commands/armor.js +72 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/commands/ext.js +85 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/dotenvx.js +297 -0
- package/node_modules/@dotenvx/dotenvx/src/cli/examples.js +99 -0
- package/node_modules/@dotenvx/dotenvx/src/db/device.js +73 -0
- package/node_modules/@dotenvx/dotenvx/src/db/session.js +279 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/getAccount.js +32 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postArmorDown.js +48 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postArmorMove.js +48 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postArmorPull.js +48 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postArmorPush.js +48 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postArmorUp.js +51 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postKeypair.js +60 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postLogout.js +34 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postOauthDeviceCode.js +38 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/api/postOauthToken.js +35 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/config.d.ts +1 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/config.js +1 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/append.js +61 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/armoredKeyDisplay.js +10 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/arrayToTree.js +27 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/buildApiError.js +16 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/buildEnvs.js +24 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/buildOauthError.js +14 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/canonicalEnvFilename.js +13 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/catchAndLog.js +13 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/chomp.js +5 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/colorDepth.js +17 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/conventions.js +28 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/createSpinner.js +24 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/armorKeypair.js +42 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/armorKeypairSync.js +55 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/decryptKeyValue.js +50 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/encryptValue.js +12 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/index.js +18 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/isEncrypted.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/isPublicKey.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/localKeypair.js +21 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/mutateKeysSrc.js +38 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/mutateKeysSrcSync.js +38 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/mutateSrc.js +24 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/provision.js +56 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/provisionSync.js +51 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/cryptography/provisionWithPrivateKey.js +26 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/decryptDeviceValue.js +10 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/detectEncoding.js +22 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/detectEncodingSync.js +22 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/dotenvOptionPaths.js +21 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/dotenvParse.js +55 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/dotenvPrivateKeyNames.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/encryptDeviceValue.js +9 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/envResolution/determine.js +46 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/envResolution/environment.js +27 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/envResolution/index.js +8 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/errors.js +295 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/escape.js +5 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/escapeDollarSigns.js +5 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/escapeForRegex.js +5 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/evalKeyValue.js +23 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/execute.js +12 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/executeCommand.js +181 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/executeDynamic.js +106 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/executeExtension.js +39 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/findEnvFiles.js +25 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/formatCode.js +11 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/fsx.js +54 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/getCommanderVersion.js +10 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/guessPrivateKeyFilename.js +15 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/http.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/installPrecommitHook.js +79 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/isFullyEncrypted.js +27 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/isIgnoringDotenvKeys.js +19 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/jsonToEnv.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/index.js +16 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/keyNamesForEnvFile.js +24 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/keyValues.js +99 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/keyValuesFromEnvSrc.js +80 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/keyValuesSync.js +103 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/readFileKey.js +17 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/readFileKeySync.js +15 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keyResolution/readProcessKey.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/keypairMetadata.js +77 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/kits/sample.js +23 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/listenForOpenKey.js +46 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/localDisplayPath.js +11 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/normalizeToken.js +5 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/openUrl.js +7 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/packageJson.js +3 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/parse.js +214 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/pluralize.js +10 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/prependPublicKey.js +17 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/preserveShebang.js +16 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/prompts.js +43 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/quotes.js +36 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/readEnvKey.js +31 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/removeDynamicHelpSection.js +21 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/removeEnvKey.js +50 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/removeOptionsHelpParts.js +42 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/replace.js +82 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/resolveEscapeSequences.js +5 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/resolveHome.js +12 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/sanitizeCommandForMetadata.js +64 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/teamChoicesFromMeta.js +8 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/truncate.js +10 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/helpers/upsertEnvKey.js +61 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/main.d.ts +420 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/main.js +347 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/armorDown.js +71 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/armorKeypair.js +156 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/armorMove.js +54 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/armorPull.js +71 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/armorPush.js +76 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/armorUp.js +73 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/decrypt.js +157 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/doctor.js +93 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/encrypt.js +214 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/genexample.js +101 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/get.js +76 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/keypair.js +60 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/login.js +26 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/loginPoll.js +36 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/logout.js +26 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/ls.js +57 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/prebuild.js +86 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/precommit.js +133 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/rotate.js +198 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/run.js +255 -0
- package/node_modules/@dotenvx/dotenvx/src/lib/services/sets.js +326 -0
- package/node_modules/@dotenvx/dotenvx/src/shared/colors.js +67 -0
- package/node_modules/@dotenvx/dotenvx/src/shared/logger.js +147 -0
- package/node_modules/@ecies/ciphers/LICENSE +21 -0
- package/node_modules/@ecies/ciphers/README.md +71 -0
- package/node_modules/@ecies/ciphers/dist/_node/compat.d.ts +9 -0
- package/node_modules/@ecies/ciphers/dist/_node/compat.js +49 -0
- package/node_modules/@ecies/ciphers/dist/_node/hchacha.d.ts +4 -0
- package/node_modules/@ecies/ciphers/dist/_node/hchacha.js +89 -0
- package/node_modules/@ecies/ciphers/dist/aes/noble.d.ts +3 -0
- package/node_modules/@ecies/ciphers/dist/aes/noble.js +8 -0
- package/node_modules/@ecies/ciphers/dist/aes/node.d.ts +3 -0
- package/node_modules/@ecies/ciphers/dist/aes/node.js +8 -0
- package/node_modules/@ecies/ciphers/dist/chacha/noble.d.ts +3 -0
- package/node_modules/@ecies/ciphers/dist/chacha/noble.js +8 -0
- package/node_modules/@ecies/ciphers/dist/chacha/node.d.ts +3 -0
- package/node_modules/@ecies/ciphers/dist/chacha/node.js +26 -0
- package/node_modules/@ecies/ciphers/dist/index.d.ts +1 -0
- package/node_modules/@ecies/ciphers/dist/index.js +3 -0
- package/node_modules/@ecies/ciphers/package.json +76 -0
- package/node_modules/@noble/ciphers/LICENSE +22 -0
- package/node_modules/@noble/ciphers/README.md +543 -0
- package/node_modules/@noble/ciphers/_arx.d.ts +59 -0
- package/node_modules/@noble/ciphers/_arx.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/_arx.js +175 -0
- package/node_modules/@noble/ciphers/_arx.js.map +1 -0
- package/node_modules/@noble/ciphers/_assert.d.ts +19 -0
- package/node_modules/@noble/ciphers/_assert.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/_assert.js +20 -0
- package/node_modules/@noble/ciphers/_assert.js.map +1 -0
- package/node_modules/@noble/ciphers/_micro.d.ts +41 -0
- package/node_modules/@noble/ciphers/_micro.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/_micro.js +260 -0
- package/node_modules/@noble/ciphers/_micro.js.map +1 -0
- package/node_modules/@noble/ciphers/_poly1305.d.ts +29 -0
- package/node_modules/@noble/ciphers/_poly1305.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/_poly1305.js +281 -0
- package/node_modules/@noble/ciphers/_poly1305.js.map +1 -0
- package/node_modules/@noble/ciphers/_polyval.d.ts +33 -0
- package/node_modules/@noble/ciphers/_polyval.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/_polyval.js +233 -0
- package/node_modules/@noble/ciphers/_polyval.js.map +1 -0
- package/node_modules/@noble/ciphers/aes.d.ts +117 -0
- package/node_modules/@noble/ciphers/aes.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/aes.js +906 -0
- package/node_modules/@noble/ciphers/aes.js.map +1 -0
- package/node_modules/@noble/ciphers/chacha.d.ts +56 -0
- package/node_modules/@noble/ciphers/chacha.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/chacha.js +320 -0
- package/node_modules/@noble/ciphers/chacha.js.map +1 -0
- package/node_modules/@noble/ciphers/crypto.d.ts +2 -0
- package/node_modules/@noble/ciphers/crypto.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/crypto.js +5 -0
- package/node_modules/@noble/ciphers/crypto.js.map +1 -0
- package/node_modules/@noble/ciphers/cryptoNode.d.ts +2 -0
- package/node_modules/@noble/ciphers/cryptoNode.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/cryptoNode.js +18 -0
- package/node_modules/@noble/ciphers/cryptoNode.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/_arx.d.ts +59 -0
- package/node_modules/@noble/ciphers/esm/_arx.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/_arx.js +171 -0
- package/node_modules/@noble/ciphers/esm/_arx.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/_assert.d.ts +19 -0
- package/node_modules/@noble/ciphers/esm/_assert.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/_assert.js +17 -0
- package/node_modules/@noble/ciphers/esm/_assert.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/_micro.d.ts +41 -0
- package/node_modules/@noble/ciphers/esm/_micro.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/_micro.js +252 -0
- package/node_modules/@noble/ciphers/esm/_micro.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/_poly1305.d.ts +29 -0
- package/node_modules/@noble/ciphers/esm/_poly1305.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/_poly1305.js +277 -0
- package/node_modules/@noble/ciphers/esm/_poly1305.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/_polyval.d.ts +33 -0
- package/node_modules/@noble/ciphers/esm/_polyval.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/_polyval.js +229 -0
- package/node_modules/@noble/ciphers/esm/_polyval.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/aes.d.ts +117 -0
- package/node_modules/@noble/ciphers/esm/aes.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/aes.js +903 -0
- package/node_modules/@noble/ciphers/esm/aes.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/chacha.d.ts +56 -0
- package/node_modules/@noble/ciphers/esm/chacha.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/chacha.js +315 -0
- package/node_modules/@noble/ciphers/esm/chacha.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/crypto.d.ts +2 -0
- package/node_modules/@noble/ciphers/esm/crypto.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/crypto.js +2 -0
- package/node_modules/@noble/ciphers/esm/crypto.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/cryptoNode.d.ts +2 -0
- package/node_modules/@noble/ciphers/esm/cryptoNode.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/cryptoNode.js +15 -0
- package/node_modules/@noble/ciphers/esm/cryptoNode.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/ff1.d.ts +9 -0
- package/node_modules/@noble/ciphers/esm/ff1.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/ff1.js +160 -0
- package/node_modules/@noble/ciphers/esm/ff1.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/index.d.ts +2 -0
- package/node_modules/@noble/ciphers/esm/index.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/index.js +28 -0
- package/node_modules/@noble/ciphers/esm/index.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/package.json +10 -0
- package/node_modules/@noble/ciphers/esm/salsa.d.ts +33 -0
- package/node_modules/@noble/ciphers/esm/salsa.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/salsa.js +201 -0
- package/node_modules/@noble/ciphers/esm/salsa.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/utils.d.ts +155 -0
- package/node_modules/@noble/ciphers/esm/utils.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/utils.js +339 -0
- package/node_modules/@noble/ciphers/esm/utils.js.map +1 -0
- package/node_modules/@noble/ciphers/esm/webcrypto.d.ts +31 -0
- package/node_modules/@noble/ciphers/esm/webcrypto.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/esm/webcrypto.js +135 -0
- package/node_modules/@noble/ciphers/esm/webcrypto.js.map +1 -0
- package/node_modules/@noble/ciphers/ff1.d.ts +9 -0
- package/node_modules/@noble/ciphers/ff1.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/ff1.js +164 -0
- package/node_modules/@noble/ciphers/ff1.js.map +1 -0
- package/node_modules/@noble/ciphers/index.d.ts +1 -0
- package/node_modules/@noble/ciphers/index.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/index.js +28 -0
- package/node_modules/@noble/ciphers/index.js.map +1 -0
- package/node_modules/@noble/ciphers/package.json +177 -0
- package/node_modules/@noble/ciphers/salsa.d.ts +33 -0
- package/node_modules/@noble/ciphers/salsa.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/salsa.js +206 -0
- package/node_modules/@noble/ciphers/salsa.js.map +1 -0
- package/node_modules/@noble/ciphers/src/_arx.ts +224 -0
- package/node_modules/@noble/ciphers/src/_assert.ts +25 -0
- package/node_modules/@noble/ciphers/src/_micro.ts +311 -0
- package/node_modules/@noble/ciphers/src/_poly1305.ts +305 -0
- package/node_modules/@noble/ciphers/src/_polyval.ts +267 -0
- package/node_modules/@noble/ciphers/src/aes.ts +1016 -0
- package/node_modules/@noble/ciphers/src/chacha.ts +290 -0
- package/node_modules/@noble/ciphers/src/crypto.ts +9 -0
- package/node_modules/@noble/ciphers/src/cryptoNode.ts +15 -0
- package/node_modules/@noble/ciphers/src/ff1.ts +162 -0
- package/node_modules/@noble/ciphers/src/index.ts +26 -0
- package/node_modules/@noble/ciphers/src/package.json +3 -0
- package/node_modules/@noble/ciphers/src/salsa.ts +189 -0
- package/node_modules/@noble/ciphers/src/utils.ts +453 -0
- package/node_modules/@noble/ciphers/src/webcrypto.ts +169 -0
- package/node_modules/@noble/ciphers/utils.d.ts +155 -0
- package/node_modules/@noble/ciphers/utils.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/utils.js +374 -0
- package/node_modules/@noble/ciphers/utils.js.map +1 -0
- package/node_modules/@noble/ciphers/webcrypto.d.ts +31 -0
- package/node_modules/@noble/ciphers/webcrypto.d.ts.map +1 -0
- package/node_modules/@noble/ciphers/webcrypto.js +141 -0
- package/node_modules/@noble/ciphers/webcrypto.js.map +1 -0
- package/node_modules/@noble/curves/LICENSE +21 -0
- package/node_modules/@noble/curves/README.md +1009 -0
- package/node_modules/@noble/curves/_shortw_utils.d.ts +19 -0
- package/node_modules/@noble/curves/_shortw_utils.d.ts.map +1 -0
- package/node_modules/@noble/curves/_shortw_utils.js +20 -0
- package/node_modules/@noble/curves/_shortw_utils.js.map +1 -0
- package/node_modules/@noble/curves/abstract/bls.d.ts +190 -0
- package/node_modules/@noble/curves/abstract/bls.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/bls.js +411 -0
- package/node_modules/@noble/curves/abstract/bls.js.map +1 -0
- package/node_modules/@noble/curves/abstract/curve.d.ts +231 -0
- package/node_modules/@noble/curves/abstract/curve.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/curve.js +476 -0
- package/node_modules/@noble/curves/abstract/curve.js.map +1 -0
- package/node_modules/@noble/curves/abstract/edwards.d.ts +243 -0
- package/node_modules/@noble/curves/abstract/edwards.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/edwards.js +634 -0
- package/node_modules/@noble/curves/abstract/edwards.js.map +1 -0
- package/node_modules/@noble/curves/abstract/fft.d.ts +122 -0
- package/node_modules/@noble/curves/abstract/fft.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/fft.js +438 -0
- package/node_modules/@noble/curves/abstract/fft.js.map +1 -0
- package/node_modules/@noble/curves/abstract/hash-to-curve.d.ts +102 -0
- package/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/hash-to-curve.js +211 -0
- package/node_modules/@noble/curves/abstract/hash-to-curve.js.map +1 -0
- package/node_modules/@noble/curves/abstract/modular.d.ts +171 -0
- package/node_modules/@noble/curves/abstract/modular.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/modular.js +554 -0
- package/node_modules/@noble/curves/abstract/modular.js.map +1 -0
- package/node_modules/@noble/curves/abstract/montgomery.d.ts +30 -0
- package/node_modules/@noble/curves/abstract/montgomery.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/montgomery.js +160 -0
- package/node_modules/@noble/curves/abstract/montgomery.js.map +1 -0
- package/node_modules/@noble/curves/abstract/poseidon.d.ts +68 -0
- package/node_modules/@noble/curves/abstract/poseidon.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/poseidon.js +305 -0
- package/node_modules/@noble/curves/abstract/poseidon.js.map +1 -0
- package/node_modules/@noble/curves/abstract/tower.d.ts +95 -0
- package/node_modules/@noble/curves/abstract/tower.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/tower.js +718 -0
- package/node_modules/@noble/curves/abstract/tower.js.map +1 -0
- package/node_modules/@noble/curves/abstract/utils.d.ts +78 -0
- package/node_modules/@noble/curves/abstract/utils.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/utils.js +73 -0
- package/node_modules/@noble/curves/abstract/utils.js.map +1 -0
- package/node_modules/@noble/curves/abstract/weierstrass.d.ts +416 -0
- package/node_modules/@noble/curves/abstract/weierstrass.d.ts.map +1 -0
- package/node_modules/@noble/curves/abstract/weierstrass.js +1427 -0
- package/node_modules/@noble/curves/abstract/weierstrass.js.map +1 -0
- package/node_modules/@noble/curves/bls12-381.d.ts +16 -0
- package/node_modules/@noble/curves/bls12-381.d.ts.map +1 -0
- package/node_modules/@noble/curves/bls12-381.js +708 -0
- package/node_modules/@noble/curves/bls12-381.js.map +1 -0
- package/node_modules/@noble/curves/bn254.d.ts +18 -0
- package/node_modules/@noble/curves/bn254.d.ts.map +1 -0
- package/node_modules/@noble/curves/bn254.js +218 -0
- package/node_modules/@noble/curves/bn254.js.map +1 -0
- package/node_modules/@noble/curves/ed25519.d.ts +106 -0
- package/node_modules/@noble/curves/ed25519.d.ts.map +1 -0
- package/node_modules/@noble/curves/ed25519.js +472 -0
- package/node_modules/@noble/curves/ed25519.js.map +1 -0
- package/node_modules/@noble/curves/ed448.d.ts +100 -0
- package/node_modules/@noble/curves/ed448.d.ts.map +1 -0
- package/node_modules/@noble/curves/ed448.js +463 -0
- package/node_modules/@noble/curves/ed448.js.map +1 -0
- package/node_modules/@noble/curves/esm/_shortw_utils.d.ts +19 -0
- package/node_modules/@noble/curves/esm/_shortw_utils.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/_shortw_utils.js +16 -0
- package/node_modules/@noble/curves/esm/_shortw_utils.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/bls.d.ts +190 -0
- package/node_modules/@noble/curves/esm/abstract/bls.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/bls.js +408 -0
- package/node_modules/@noble/curves/esm/abstract/bls.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/curve.d.ts +231 -0
- package/node_modules/@noble/curves/esm/abstract/curve.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/curve.js +465 -0
- package/node_modules/@noble/curves/esm/abstract/curve.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/edwards.d.ts +243 -0
- package/node_modules/@noble/curves/esm/abstract/edwards.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/edwards.js +627 -0
- package/node_modules/@noble/curves/esm/abstract/edwards.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/fft.d.ts +122 -0
- package/node_modules/@noble/curves/esm/abstract/fft.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/fft.js +425 -0
- package/node_modules/@noble/curves/esm/abstract/fft.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/hash-to-curve.d.ts +102 -0
- package/node_modules/@noble/curves/esm/abstract/hash-to-curve.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/hash-to-curve.js +203 -0
- package/node_modules/@noble/curves/esm/abstract/hash-to-curve.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/modular.d.ts +171 -0
- package/node_modules/@noble/curves/esm/abstract/modular.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/modular.js +530 -0
- package/node_modules/@noble/curves/esm/abstract/modular.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/montgomery.d.ts +30 -0
- package/node_modules/@noble/curves/esm/abstract/montgomery.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/montgomery.js +157 -0
- package/node_modules/@noble/curves/esm/abstract/montgomery.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/poseidon.d.ts +68 -0
- package/node_modules/@noble/curves/esm/abstract/poseidon.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/poseidon.js +296 -0
- package/node_modules/@noble/curves/esm/abstract/poseidon.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/tower.d.ts +95 -0
- package/node_modules/@noble/curves/esm/abstract/tower.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/tower.js +714 -0
- package/node_modules/@noble/curves/esm/abstract/tower.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/utils.d.ts +78 -0
- package/node_modules/@noble/curves/esm/abstract/utils.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/utils.js +70 -0
- package/node_modules/@noble/curves/esm/abstract/utils.js.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/weierstrass.d.ts +416 -0
- package/node_modules/@noble/curves/esm/abstract/weierstrass.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/abstract/weierstrass.js +1413 -0
- package/node_modules/@noble/curves/esm/abstract/weierstrass.js.map +1 -0
- package/node_modules/@noble/curves/esm/bls12-381.d.ts +16 -0
- package/node_modules/@noble/curves/esm/bls12-381.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/bls12-381.js +705 -0
- package/node_modules/@noble/curves/esm/bls12-381.js.map +1 -0
- package/node_modules/@noble/curves/esm/bn254.d.ts +18 -0
- package/node_modules/@noble/curves/esm/bn254.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/bn254.js +214 -0
- package/node_modules/@noble/curves/esm/bn254.js.map +1 -0
- package/node_modules/@noble/curves/esm/ed25519.d.ts +106 -0
- package/node_modules/@noble/curves/esm/ed25519.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/ed25519.js +467 -0
- package/node_modules/@noble/curves/esm/ed25519.js.map +1 -0
- package/node_modules/@noble/curves/esm/ed448.d.ts +100 -0
- package/node_modules/@noble/curves/esm/ed448.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/ed448.js +459 -0
- package/node_modules/@noble/curves/esm/ed448.js.map +1 -0
- package/node_modules/@noble/curves/esm/index.d.ts +2 -0
- package/node_modules/@noble/curves/esm/index.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/index.js +17 -0
- package/node_modules/@noble/curves/esm/index.js.map +1 -0
- package/node_modules/@noble/curves/esm/jubjub.d.ts +12 -0
- package/node_modules/@noble/curves/esm/jubjub.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/jubjub.js +12 -0
- package/node_modules/@noble/curves/esm/jubjub.js.map +1 -0
- package/node_modules/@noble/curves/esm/misc.d.ts +19 -0
- package/node_modules/@noble/curves/esm/misc.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/misc.js +109 -0
- package/node_modules/@noble/curves/esm/misc.js.map +1 -0
- package/node_modules/@noble/curves/esm/nist.d.ts +21 -0
- package/node_modules/@noble/curves/esm/nist.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/nist.js +132 -0
- package/node_modules/@noble/curves/esm/nist.js.map +1 -0
- package/node_modules/@noble/curves/esm/p256.d.ts +16 -0
- package/node_modules/@noble/curves/esm/p256.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/p256.js +16 -0
- package/node_modules/@noble/curves/esm/p256.js.map +1 -0
- package/node_modules/@noble/curves/esm/p384.d.ts +16 -0
- package/node_modules/@noble/curves/esm/p384.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/p384.js +16 -0
- package/node_modules/@noble/curves/esm/p384.js.map +1 -0
- package/node_modules/@noble/curves/esm/p521.d.ts +16 -0
- package/node_modules/@noble/curves/esm/p521.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/p521.js +16 -0
- package/node_modules/@noble/curves/esm/p521.js.map +1 -0
- package/node_modules/@noble/curves/esm/package.json +4 -0
- package/node_modules/@noble/curves/esm/pasta.d.ts +10 -0
- package/node_modules/@noble/curves/esm/pasta.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/pasta.js +10 -0
- package/node_modules/@noble/curves/esm/pasta.js.map +1 -0
- package/node_modules/@noble/curves/esm/secp256k1.d.ts +89 -0
- package/node_modules/@noble/curves/esm/secp256k1.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/secp256k1.js +294 -0
- package/node_modules/@noble/curves/esm/secp256k1.js.map +1 -0
- package/node_modules/@noble/curves/esm/utils.d.ts +110 -0
- package/node_modules/@noble/curves/esm/utils.d.ts.map +1 -0
- package/node_modules/@noble/curves/esm/utils.js +322 -0
- package/node_modules/@noble/curves/esm/utils.js.map +1 -0
- package/node_modules/@noble/curves/index.d.ts +1 -0
- package/node_modules/@noble/curves/index.d.ts.map +1 -0
- package/node_modules/@noble/curves/index.js +17 -0
- package/node_modules/@noble/curves/index.js.map +1 -0
- package/node_modules/@noble/curves/jubjub.d.ts +12 -0
- package/node_modules/@noble/curves/jubjub.d.ts.map +1 -0
- package/node_modules/@noble/curves/jubjub.js +15 -0
- package/node_modules/@noble/curves/jubjub.js.map +1 -0
- package/node_modules/@noble/curves/misc.d.ts +19 -0
- package/node_modules/@noble/curves/misc.d.ts.map +1 -0
- package/node_modules/@noble/curves/misc.js +114 -0
- package/node_modules/@noble/curves/misc.js.map +1 -0
- package/node_modules/@noble/curves/nist.d.ts +21 -0
- package/node_modules/@noble/curves/nist.d.ts.map +1 -0
- package/node_modules/@noble/curves/nist.js +135 -0
- package/node_modules/@noble/curves/nist.js.map +1 -0
- package/node_modules/@noble/curves/p256.d.ts +16 -0
- package/node_modules/@noble/curves/p256.d.ts.map +1 -0
- package/node_modules/@noble/curves/p256.js +13 -0
- package/node_modules/@noble/curves/p256.js.map +1 -0
- package/node_modules/@noble/curves/p384.d.ts +16 -0
- package/node_modules/@noble/curves/p384.d.ts.map +1 -0
- package/node_modules/@noble/curves/p384.js +13 -0
- package/node_modules/@noble/curves/p384.js.map +1 -0
- package/node_modules/@noble/curves/p521.d.ts +16 -0
- package/node_modules/@noble/curves/p521.d.ts.map +1 -0
- package/node_modules/@noble/curves/p521.js +13 -0
- package/node_modules/@noble/curves/p521.js.map +1 -0
- package/node_modules/@noble/curves/package.json +295 -0
- package/node_modules/@noble/curves/pasta.d.ts +10 -0
- package/node_modules/@noble/curves/pasta.d.ts.map +1 -0
- package/node_modules/@noble/curves/pasta.js +13 -0
- package/node_modules/@noble/curves/pasta.js.map +1 -0
- package/node_modules/@noble/curves/secp256k1.d.ts +89 -0
- package/node_modules/@noble/curves/secp256k1.d.ts.map +1 -0
- package/node_modules/@noble/curves/secp256k1.js +297 -0
- package/node_modules/@noble/curves/secp256k1.js.map +1 -0
- package/node_modules/@noble/curves/src/_shortw_utils.ts +21 -0
- package/node_modules/@noble/curves/src/abstract/bls.ts +747 -0
- package/node_modules/@noble/curves/src/abstract/curve.ts +692 -0
- package/node_modules/@noble/curves/src/abstract/edwards.ts +914 -0
- package/node_modules/@noble/curves/src/abstract/fft.ts +519 -0
- package/node_modules/@noble/curves/src/abstract/hash-to-curve.ts +306 -0
- package/node_modules/@noble/curves/src/abstract/modular.ts +605 -0
- package/node_modules/@noble/curves/src/abstract/montgomery.ts +194 -0
- package/node_modules/@noble/curves/src/abstract/poseidon.ts +335 -0
- package/node_modules/@noble/curves/src/abstract/tower.ts +867 -0
- package/node_modules/@noble/curves/src/abstract/utils.ts +80 -0
- package/node_modules/@noble/curves/src/abstract/weierstrass.ts +1884 -0
- package/node_modules/@noble/curves/src/bls12-381.ts +781 -0
- package/node_modules/@noble/curves/src/bn254.ts +243 -0
- package/node_modules/@noble/curves/src/ed25519.ts +554 -0
- package/node_modules/@noble/curves/src/ed448.ts +552 -0
- package/node_modules/@noble/curves/src/index.ts +15 -0
- package/node_modules/@noble/curves/src/jubjub.ts +12 -0
- package/node_modules/@noble/curves/src/misc.ts +124 -0
- package/node_modules/@noble/curves/src/nist.ts +197 -0
- package/node_modules/@noble/curves/src/p256.ts +15 -0
- package/node_modules/@noble/curves/src/p384.ts +15 -0
- package/node_modules/@noble/curves/src/p521.ts +15 -0
- package/node_modules/@noble/curves/src/package.json +3 -0
- package/node_modules/@noble/curves/src/pasta.ts +9 -0
- package/node_modules/@noble/curves/src/secp256k1.ts +362 -0
- package/node_modules/@noble/curves/src/utils.ts +376 -0
- package/node_modules/@noble/curves/utils.d.ts +110 -0
- package/node_modules/@noble/curves/utils.d.ts.map +1 -0
- package/node_modules/@noble/curves/utils.js +360 -0
- package/node_modules/@noble/curves/utils.js.map +1 -0
- package/node_modules/@noble/hashes/LICENSE +21 -0
- package/node_modules/@noble/hashes/README.md +521 -0
- package/node_modules/@noble/hashes/_assert.d.ts +17 -0
- package/node_modules/@noble/hashes/_assert.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_assert.js +18 -0
- package/node_modules/@noble/hashes/_assert.js.map +1 -0
- package/node_modules/@noble/hashes/_blake.d.ts +14 -0
- package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_blake.js +50 -0
- package/node_modules/@noble/hashes/_blake.js.map +1 -0
- package/node_modules/@noble/hashes/_md.d.ts +51 -0
- package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_md.js +162 -0
- package/node_modules/@noble/hashes/_md.js.map +1 -0
- package/node_modules/@noble/hashes/_u64.d.ts +55 -0
- package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_u64.js +90 -0
- package/node_modules/@noble/hashes/_u64.js.map +1 -0
- package/node_modules/@noble/hashes/argon2.d.ts +32 -0
- package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/argon2.js +401 -0
- package/node_modules/@noble/hashes/argon2.js.map +1 -0
- package/node_modules/@noble/hashes/blake1.d.ts +106 -0
- package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake1.js +459 -0
- package/node_modules/@noble/hashes/blake1.js.map +1 -0
- package/node_modules/@noble/hashes/blake2.d.ts +116 -0
- package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake2.js +420 -0
- package/node_modules/@noble/hashes/blake2.js.map +1 -0
- package/node_modules/@noble/hashes/blake2b.d.ts +11 -0
- package/node_modules/@noble/hashes/blake2b.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake2b.js +14 -0
- package/node_modules/@noble/hashes/blake2b.js.map +1 -0
- package/node_modules/@noble/hashes/blake2s.d.ts +20 -0
- package/node_modules/@noble/hashes/blake2s.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake2s.js +24 -0
- package/node_modules/@noble/hashes/blake2s.js.map +1 -0
- package/node_modules/@noble/hashes/blake3.d.ts +54 -0
- package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake3.js +255 -0
- package/node_modules/@noble/hashes/blake3.js.map +1 -0
- package/node_modules/@noble/hashes/crypto.d.ts +2 -0
- package/node_modules/@noble/hashes/crypto.d.ts.map +1 -0
- package/node_modules/@noble/hashes/crypto.js +5 -0
- package/node_modules/@noble/hashes/crypto.js.map +1 -0
- package/node_modules/@noble/hashes/cryptoNode.d.ts +2 -0
- package/node_modules/@noble/hashes/cryptoNode.d.ts.map +1 -0
- package/node_modules/@noble/hashes/cryptoNode.js +18 -0
- package/node_modules/@noble/hashes/cryptoNode.js.map +1 -0
- package/node_modules/@noble/hashes/eskdf.d.ts +47 -0
- package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/eskdf.js +166 -0
- package/node_modules/@noble/hashes/eskdf.js.map +1 -0
- package/node_modules/@noble/hashes/esm/_assert.d.ts +17 -0
- package/node_modules/@noble/hashes/esm/_assert.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/_assert.js +15 -0
- package/node_modules/@noble/hashes/esm/_assert.js.map +1 -0
- package/node_modules/@noble/hashes/esm/_blake.d.ts +14 -0
- package/node_modules/@noble/hashes/esm/_blake.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/_blake.js +45 -0
- package/node_modules/@noble/hashes/esm/_blake.js.map +1 -0
- package/node_modules/@noble/hashes/esm/_md.d.ts +51 -0
- package/node_modules/@noble/hashes/esm/_md.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/_md.js +155 -0
- package/node_modules/@noble/hashes/esm/_md.js.map +1 -0
- package/node_modules/@noble/hashes/esm/_u64.d.ts +55 -0
- package/node_modules/@noble/hashes/esm/_u64.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/_u64.js +67 -0
- package/node_modules/@noble/hashes/esm/_u64.js.map +1 -0
- package/node_modules/@noble/hashes/esm/argon2.d.ts +32 -0
- package/node_modules/@noble/hashes/esm/argon2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/argon2.js +392 -0
- package/node_modules/@noble/hashes/esm/argon2.js.map +1 -0
- package/node_modules/@noble/hashes/esm/blake1.d.ts +106 -0
- package/node_modules/@noble/hashes/esm/blake1.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/blake1.js +452 -0
- package/node_modules/@noble/hashes/esm/blake1.js.map +1 -0
- package/node_modules/@noble/hashes/esm/blake2.d.ts +116 -0
- package/node_modules/@noble/hashes/esm/blake2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/blake2.js +413 -0
- package/node_modules/@noble/hashes/esm/blake2.js.map +1 -0
- package/node_modules/@noble/hashes/esm/blake2b.d.ts +11 -0
- package/node_modules/@noble/hashes/esm/blake2b.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/blake2b.js +11 -0
- package/node_modules/@noble/hashes/esm/blake2b.js.map +1 -0
- package/node_modules/@noble/hashes/esm/blake2s.d.ts +20 -0
- package/node_modules/@noble/hashes/esm/blake2s.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/blake2s.js +21 -0
- package/node_modules/@noble/hashes/esm/blake2s.js.map +1 -0
- package/node_modules/@noble/hashes/esm/blake3.d.ts +54 -0
- package/node_modules/@noble/hashes/esm/blake3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/blake3.js +251 -0
- package/node_modules/@noble/hashes/esm/blake3.js.map +1 -0
- package/node_modules/@noble/hashes/esm/crypto.d.ts +2 -0
- package/node_modules/@noble/hashes/esm/crypto.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/crypto.js +2 -0
- package/node_modules/@noble/hashes/esm/crypto.js.map +1 -0
- package/node_modules/@noble/hashes/esm/cryptoNode.d.ts +2 -0
- package/node_modules/@noble/hashes/esm/cryptoNode.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/cryptoNode.js +15 -0
- package/node_modules/@noble/hashes/esm/cryptoNode.js.map +1 -0
- package/node_modules/@noble/hashes/esm/eskdf.d.ts +47 -0
- package/node_modules/@noble/hashes/esm/eskdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/eskdf.js +160 -0
- package/node_modules/@noble/hashes/esm/eskdf.js.map +1 -0
- package/node_modules/@noble/hashes/esm/hkdf.d.ts +36 -0
- package/node_modules/@noble/hashes/esm/hkdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/hkdf.js +82 -0
- package/node_modules/@noble/hashes/esm/hkdf.js.map +1 -0
- package/node_modules/@noble/hashes/esm/hmac.d.ts +35 -0
- package/node_modules/@noble/hashes/esm/hmac.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/hmac.js +86 -0
- package/node_modules/@noble/hashes/esm/hmac.js.map +1 -0
- package/node_modules/@noble/hashes/esm/index.d.ts +2 -0
- package/node_modules/@noble/hashes/esm/index.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/index.js +33 -0
- package/node_modules/@noble/hashes/esm/index.js.map +1 -0
- package/node_modules/@noble/hashes/esm/legacy.d.ts +71 -0
- package/node_modules/@noble/hashes/esm/legacy.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/legacy.js +281 -0
- package/node_modules/@noble/hashes/esm/legacy.js.map +1 -0
- package/node_modules/@noble/hashes/esm/package.json +10 -0
- package/node_modules/@noble/hashes/esm/pbkdf2.d.ts +23 -0
- package/node_modules/@noble/hashes/esm/pbkdf2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/pbkdf2.js +97 -0
- package/node_modules/@noble/hashes/esm/pbkdf2.js.map +1 -0
- package/node_modules/@noble/hashes/esm/ripemd160.d.ts +13 -0
- package/node_modules/@noble/hashes/esm/ripemd160.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/ripemd160.js +13 -0
- package/node_modules/@noble/hashes/esm/ripemd160.js.map +1 -0
- package/node_modules/@noble/hashes/esm/scrypt.d.ts +34 -0
- package/node_modules/@noble/hashes/esm/scrypt.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/scrypt.js +228 -0
- package/node_modules/@noble/hashes/esm/scrypt.js.map +1 -0
- package/node_modules/@noble/hashes/esm/sha1.d.ts +11 -0
- package/node_modules/@noble/hashes/esm/sha1.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/sha1.js +11 -0
- package/node_modules/@noble/hashes/esm/sha1.js.map +1 -0
- package/node_modules/@noble/hashes/esm/sha2.d.ts +159 -0
- package/node_modules/@noble/hashes/esm/sha2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/sha2.js +375 -0
- package/node_modules/@noble/hashes/esm/sha2.js.map +1 -0
- package/node_modules/@noble/hashes/esm/sha256.d.ts +20 -0
- package/node_modules/@noble/hashes/esm/sha256.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/sha256.js +20 -0
- package/node_modules/@noble/hashes/esm/sha256.js.map +1 -0
- package/node_modules/@noble/hashes/esm/sha3-addons.d.ts +142 -0
- package/node_modules/@noble/hashes/esm/sha3-addons.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/sha3-addons.js +393 -0
- package/node_modules/@noble/hashes/esm/sha3-addons.js.map +1 -0
- package/node_modules/@noble/hashes/esm/sha3.d.ts +53 -0
- package/node_modules/@noble/hashes/esm/sha3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/sha3.js +234 -0
- package/node_modules/@noble/hashes/esm/sha3.js.map +1 -0
- package/node_modules/@noble/hashes/esm/sha512.d.ts +26 -0
- package/node_modules/@noble/hashes/esm/sha512.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/sha512.js +26 -0
- package/node_modules/@noble/hashes/esm/sha512.js.map +1 -0
- package/node_modules/@noble/hashes/esm/utils.d.ts +161 -0
- package/node_modules/@noble/hashes/esm/utils.d.ts.map +1 -0
- package/node_modules/@noble/hashes/esm/utils.js +281 -0
- package/node_modules/@noble/hashes/esm/utils.js.map +1 -0
- package/node_modules/@noble/hashes/hkdf.d.ts +36 -0
- package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/hkdf.js +88 -0
- package/node_modules/@noble/hashes/hkdf.js.map +1 -0
- package/node_modules/@noble/hashes/hmac.d.ts +35 -0
- package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
- package/node_modules/@noble/hashes/hmac.js +91 -0
- package/node_modules/@noble/hashes/hmac.js.map +1 -0
- package/node_modules/@noble/hashes/index.d.ts +1 -0
- package/node_modules/@noble/hashes/index.d.ts.map +1 -0
- package/node_modules/@noble/hashes/index.js +33 -0
- package/node_modules/@noble/hashes/index.js.map +1 -0
- package/node_modules/@noble/hashes/legacy.d.ts +71 -0
- package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
- package/node_modules/@noble/hashes/legacy.js +287 -0
- package/node_modules/@noble/hashes/legacy.js.map +1 -0
- package/node_modules/@noble/hashes/package.json +266 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts +23 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/pbkdf2.js +101 -0
- package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
- package/node_modules/@noble/hashes/ripemd160.d.ts +13 -0
- package/node_modules/@noble/hashes/ripemd160.d.ts.map +1 -0
- package/node_modules/@noble/hashes/ripemd160.js +16 -0
- package/node_modules/@noble/hashes/ripemd160.js.map +1 -0
- package/node_modules/@noble/hashes/scrypt.d.ts +34 -0
- package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
- package/node_modules/@noble/hashes/scrypt.js +232 -0
- package/node_modules/@noble/hashes/scrypt.js.map +1 -0
- package/node_modules/@noble/hashes/sha1.d.ts +11 -0
- package/node_modules/@noble/hashes/sha1.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha1.js +14 -0
- package/node_modules/@noble/hashes/sha1.js.map +1 -0
- package/node_modules/@noble/hashes/sha2.d.ts +159 -0
- package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha2.js +384 -0
- package/node_modules/@noble/hashes/sha2.js.map +1 -0
- package/node_modules/@noble/hashes/sha256.d.ts +20 -0
- package/node_modules/@noble/hashes/sha256.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha256.js +23 -0
- package/node_modules/@noble/hashes/sha256.js.map +1 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts +142 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha3-addons.js +402 -0
- package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
- package/node_modules/@noble/hashes/sha3.d.ts +53 -0
- package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha3.js +239 -0
- package/node_modules/@noble/hashes/sha3.js.map +1 -0
- package/node_modules/@noble/hashes/sha512.d.ts +26 -0
- package/node_modules/@noble/hashes/sha512.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha512.js +29 -0
- package/node_modules/@noble/hashes/sha512.js.map +1 -0
- package/node_modules/@noble/hashes/src/_assert.ts +22 -0
- package/node_modules/@noble/hashes/src/_blake.ts +50 -0
- package/node_modules/@noble/hashes/src/_md.ts +176 -0
- package/node_modules/@noble/hashes/src/_u64.ts +91 -0
- package/node_modules/@noble/hashes/src/argon2.ts +497 -0
- package/node_modules/@noble/hashes/src/blake1.ts +534 -0
- package/node_modules/@noble/hashes/src/blake2.ts +486 -0
- package/node_modules/@noble/hashes/src/blake2b.ts +10 -0
- package/node_modules/@noble/hashes/src/blake2s.ts +20 -0
- package/node_modules/@noble/hashes/src/blake3.ts +272 -0
- package/node_modules/@noble/hashes/src/crypto.ts +9 -0
- package/node_modules/@noble/hashes/src/cryptoNode.ts +15 -0
- package/node_modules/@noble/hashes/src/eskdf.ts +187 -0
- package/node_modules/@noble/hashes/src/hkdf.ts +88 -0
- package/node_modules/@noble/hashes/src/hmac.ts +94 -0
- package/node_modules/@noble/hashes/src/index.ts +31 -0
- package/node_modules/@noble/hashes/src/legacy.ts +293 -0
- package/node_modules/@noble/hashes/src/pbkdf2.ts +122 -0
- package/node_modules/@noble/hashes/src/ripemd160.ts +12 -0
- package/node_modules/@noble/hashes/src/scrypt.ts +257 -0
- package/node_modules/@noble/hashes/src/sha1.ts +10 -0
- package/node_modules/@noble/hashes/src/sha2.ts +402 -0
- package/node_modules/@noble/hashes/src/sha256.ts +24 -0
- package/node_modules/@noble/hashes/src/sha3-addons.ts +499 -0
- package/node_modules/@noble/hashes/src/sha3.ts +258 -0
- package/node_modules/@noble/hashes/src/sha512.ts +34 -0
- package/node_modules/@noble/hashes/src/utils.ts +395 -0
- package/node_modules/@noble/hashes/utils.d.ts +161 -0
- package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
- package/node_modules/@noble/hashes/utils.js +313 -0
- package/node_modules/@noble/hashes/utils.js.map +1 -0
- package/node_modules/ajv/.runkit_example.js +23 -0
- package/node_modules/ajv/LICENSE +22 -0
- package/node_modules/ajv/README.md +207 -0
- package/node_modules/ajv/dist/2019.d.ts +19 -0
- package/node_modules/ajv/dist/2019.js +61 -0
- package/node_modules/ajv/dist/2019.js.map +1 -0
- package/node_modules/ajv/dist/2020.d.ts +19 -0
- package/node_modules/ajv/dist/2020.js +55 -0
- package/node_modules/ajv/dist/2020.js.map +1 -0
- package/node_modules/ajv/dist/ajv.d.ts +18 -0
- package/node_modules/ajv/dist/ajv.js +50 -0
- package/node_modules/ajv/dist/ajv.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/code.d.ts +40 -0
- package/node_modules/ajv/dist/compile/codegen/code.js +156 -0
- package/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/index.js +697 -0
- package/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/node_modules/ajv/dist/compile/errors.d.ts +13 -0
- package/node_modules/ajv/dist/compile/errors.js +123 -0
- package/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/node_modules/ajv/dist/compile/index.d.ts +80 -0
- package/node_modules/ajv/dist/compile/index.js +242 -0
- package/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/parse.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js +350 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js +236 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/types.d.ts +6 -0
- package/node_modules/ajv/dist/compile/jtd/types.js +14 -0
- package/node_modules/ajv/dist/compile/jtd/types.js.map +1 -0
- package/node_modules/ajv/dist/compile/names.d.ts +20 -0
- package/node_modules/ajv/dist/compile/names.js +28 -0
- package/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/node_modules/ajv/dist/compile/ref_error.d.ts +6 -0
- package/node_modules/ajv/dist/compile/ref_error.js +12 -0
- package/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/node_modules/ajv/dist/compile/resolve.d.ts +12 -0
- package/node_modules/ajv/dist/compile/resolve.js +155 -0
- package/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/node_modules/ajv/dist/compile/rules.d.ts +28 -0
- package/node_modules/ajv/dist/compile/rules.js +26 -0
- package/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/node_modules/ajv/dist/compile/util.d.ts +40 -0
- package/node_modules/ajv/dist/compile/util.js +178 -0
- package/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/applicability.d.ts +6 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +4 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/dataType.d.ts +17 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/defaults.d.ts +2 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/index.d.ts +42 -0
- package/node_modules/ajv/dist/compile/validate/index.js +520 -0
- package/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/keyword.d.ts +8 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/node_modules/ajv/dist/core.d.ts +174 -0
- package/node_modules/ajv/dist/core.js +618 -0
- package/node_modules/ajv/dist/core.js.map +1 -0
- package/node_modules/ajv/dist/jtd.d.ts +47 -0
- package/node_modules/ajv/dist/jtd.js +72 -0
- package/node_modules/ajv/dist/jtd.js.map +1 -0
- package/node_modules/ajv/dist/refs/data.json +13 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +28 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/dist/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/dist/refs/jtd-schema.d.ts +3 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js +118 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/runtime/equal.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/equal.js +7 -0
- package/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/node_modules/ajv/dist/runtime/parseJson.d.ts +18 -0
- package/node_modules/ajv/dist/runtime/parseJson.js +185 -0
- package/node_modules/ajv/dist/runtime/parseJson.js.map +1 -0
- package/node_modules/ajv/dist/runtime/quote.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/quote.js +30 -0
- package/node_modules/ajv/dist/runtime/quote.js.map +1 -0
- package/node_modules/ajv/dist/runtime/re2.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/re2.js +6 -0
- package/node_modules/ajv/dist/runtime/re2.js.map +1 -0
- package/node_modules/ajv/dist/runtime/timestamp.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/timestamp.js +42 -0
- package/node_modules/ajv/dist/runtime/timestamp.js.map +1 -0
- package/node_modules/ajv/dist/runtime/ucs2length.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/node_modules/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/node_modules/ajv/dist/runtime/validation_error.js +11 -0
- package/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/node_modules/ajv/dist/standalone/index.d.ts +6 -0
- package/node_modules/ajv/dist/standalone/index.js +90 -0
- package/node_modules/ajv/dist/standalone/index.js.map +1 -0
- package/node_modules/ajv/dist/standalone/instance.d.ts +12 -0
- package/node_modules/ajv/dist/standalone/instance.js +35 -0
- package/node_modules/ajv/dist/standalone/instance.js.map +1 -0
- package/node_modules/ajv/dist/types/index.d.ts +183 -0
- package/node_modules/ajv/dist/types/index.js +3 -0
- package/node_modules/ajv/dist/types/index.js.map +1 -0
- package/node_modules/ajv/dist/types/json-schema.d.ts +125 -0
- package/node_modules/ajv/dist/types/json-schema.js +3 -0
- package/node_modules/ajv/dist/types/json-schema.js.map +1 -0
- package/node_modules/ajv/dist/types/jtd-schema.d.ts +174 -0
- package/node_modules/ajv/dist/types/jtd-schema.js +3 -0
- package/node_modules/ajv/dist/types/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +7 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +21 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/code.d.ts +17 -0
- package/node_modules/ajv/dist/vocabularies/code.js +131 -0
- package/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/id.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js +23 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft7.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js +9 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/errors.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/errors.js +3 -0
- package/node_modules/ajv/dist/vocabularies/errors.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/format.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +71 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js +24 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js +43 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js +20 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js +29 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js +25 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +15 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js +149 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js +67 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js +69 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js +12 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js +51 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/metadata.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/next.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/next.js +8 -0
- package/node_modules/ajv/dist/vocabularies/next.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js +7 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +65 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.d.ts +16 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js +15 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +11 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/node_modules/ajv/lib/2019.ts +81 -0
- package/node_modules/ajv/lib/2020.ts +75 -0
- package/node_modules/ajv/lib/ajv.ts +70 -0
- package/node_modules/ajv/lib/compile/codegen/code.ts +169 -0
- package/node_modules/ajv/lib/compile/codegen/index.ts +852 -0
- package/node_modules/ajv/lib/compile/codegen/scope.ts +215 -0
- package/node_modules/ajv/lib/compile/errors.ts +184 -0
- package/node_modules/ajv/lib/compile/index.ts +324 -0
- package/node_modules/ajv/lib/compile/jtd/parse.ts +411 -0
- package/node_modules/ajv/lib/compile/jtd/serialize.ts +277 -0
- package/node_modules/ajv/lib/compile/jtd/types.ts +16 -0
- package/node_modules/ajv/lib/compile/names.ts +27 -0
- package/node_modules/ajv/lib/compile/ref_error.ts +13 -0
- package/node_modules/ajv/lib/compile/resolve.ts +149 -0
- package/node_modules/ajv/lib/compile/rules.ts +50 -0
- package/node_modules/ajv/lib/compile/util.ts +213 -0
- package/node_modules/ajv/lib/compile/validate/applicability.ts +22 -0
- package/node_modules/ajv/lib/compile/validate/boolSchema.ts +47 -0
- package/node_modules/ajv/lib/compile/validate/dataType.ts +230 -0
- package/node_modules/ajv/lib/compile/validate/defaults.ts +32 -0
- package/node_modules/ajv/lib/compile/validate/index.ts +582 -0
- package/node_modules/ajv/lib/compile/validate/keyword.ts +171 -0
- package/node_modules/ajv/lib/compile/validate/subschema.ts +135 -0
- package/node_modules/ajv/lib/core.ts +892 -0
- package/node_modules/ajv/lib/jtd.ts +132 -0
- package/node_modules/ajv/lib/refs/data.json +13 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +28 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +30 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/lib/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/lib/refs/jtd-schema.ts +130 -0
- package/node_modules/ajv/lib/runtime/equal.ts +7 -0
- package/node_modules/ajv/lib/runtime/parseJson.ts +177 -0
- package/node_modules/ajv/lib/runtime/quote.ts +31 -0
- package/node_modules/ajv/lib/runtime/re2.ts +6 -0
- package/node_modules/ajv/lib/runtime/timestamp.ts +46 -0
- package/node_modules/ajv/lib/runtime/ucs2length.ts +20 -0
- package/node_modules/ajv/lib/runtime/uri.ts +6 -0
- package/node_modules/ajv/lib/runtime/validation_error.ts +13 -0
- package/node_modules/ajv/lib/standalone/index.ts +100 -0
- package/node_modules/ajv/lib/standalone/instance.ts +36 -0
- package/node_modules/ajv/lib/types/index.ts +244 -0
- package/node_modules/ajv/lib/types/json-schema.ts +187 -0
- package/node_modules/ajv/lib/types/jtd-schema.ts +273 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +56 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +118 -0
- package/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +22 -0
- package/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/applicator/contains.ts +109 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +112 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +11 -0
- package/node_modules/ajv/lib/vocabularies/applicator/if.ts +80 -0
- package/node_modules/ajv/lib/vocabularies/applicator/index.ts +53 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items.ts +59 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +36 -0
- package/node_modules/ajv/lib/vocabularies/applicator/not.ts +38 -0
- package/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +82 -0
- package/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +91 -0
- package/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/applicator/properties.ts +57 -0
- package/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +50 -0
- package/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +13 -0
- package/node_modules/ajv/lib/vocabularies/code.ts +168 -0
- package/node_modules/ajv/lib/vocabularies/core/id.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/core/index.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/core/ref.ts +129 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/index.ts +113 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/types.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/draft2020.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/draft7.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +31 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +51 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/index.ts +9 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/errors.ts +18 -0
- package/node_modules/ajv/lib/vocabularies/format/format.ts +120 -0
- package/node_modules/ajv/lib/vocabularies/format/index.ts +6 -0
- package/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +89 -0
- package/node_modules/ajv/lib/vocabularies/jtd/elements.ts +32 -0
- package/node_modules/ajv/lib/vocabularies/jtd/enum.ts +45 -0
- package/node_modules/ajv/lib/vocabularies/jtd/error.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/jtd/index.ts +37 -0
- package/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +24 -0
- package/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +21 -0
- package/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +15 -0
- package/node_modules/ajv/lib/vocabularies/jtd/properties.ts +184 -0
- package/node_modules/ajv/lib/vocabularies/jtd/ref.ts +76 -0
- package/node_modules/ajv/lib/vocabularies/jtd/type.ts +75 -0
- package/node_modules/ajv/lib/vocabularies/jtd/union.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/jtd/values.ts +58 -0
- package/node_modules/ajv/lib/vocabularies/metadata.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/next.ts +8 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +7 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +47 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +85 -0
- package/node_modules/ajv/lib/vocabularies/validation/const.ts +28 -0
- package/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/validation/enum.ts +54 -0
- package/node_modules/ajv/lib/vocabularies/validation/index.ts +49 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +30 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +42 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +34 -0
- package/node_modules/ajv/lib/vocabularies/validation/pattern.ts +39 -0
- package/node_modules/ajv/lib/vocabularies/validation/required.ts +98 -0
- package/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +79 -0
- package/node_modules/ajv/package.json +126 -0
- package/node_modules/ajv-formats/LICENSE +21 -0
- package/node_modules/ajv-formats/README.md +123 -0
- package/node_modules/ajv-formats/dist/formats.d.ts +9 -0
- package/node_modules/ajv-formats/dist/formats.js +173 -0
- package/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/node_modules/ajv-formats/dist/index.d.ts +15 -0
- package/node_modules/ajv-formats/dist/index.js +37 -0
- package/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/node_modules/ajv-formats/dist/limit.d.ts +10 -0
- package/node_modules/ajv-formats/dist/limit.js +69 -0
- package/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/node_modules/ajv-formats/package.json +74 -0
- package/node_modules/ajv-formats/src/formats.ts +232 -0
- package/node_modules/ajv-formats/src/index.ts +62 -0
- package/node_modules/ajv-formats/src/limit.ts +99 -0
- package/node_modules/ansi-colors/LICENSE +21 -0
- package/node_modules/ansi-colors/README.md +315 -0
- package/node_modules/ansi-colors/index.js +184 -0
- package/node_modules/ansi-colors/package.json +129 -0
- package/node_modules/ansi-colors/symbols.js +69 -0
- package/node_modules/ansi-colors/types/index.d.ts +235 -0
- package/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/atomically/.editorconfig +13 -0
- package/node_modules/atomically/.nvmrc +1 -0
- package/node_modules/atomically/LICENSE +21 -0
- package/node_modules/atomically/README.md +147 -0
- package/node_modules/atomically/dist/consts.d.ts +13 -0
- package/node_modules/atomically/dist/consts.js +28 -0
- package/node_modules/atomically/dist/index.d.ts +13 -0
- package/node_modules/atomically/dist/index.js +177 -0
- package/node_modules/atomically/dist/types.d.ts +28 -0
- package/node_modules/atomically/dist/types.js +3 -0
- package/node_modules/atomically/dist/utils/attemptify.d.ts +4 -0
- package/node_modules/atomically/dist/utils/attemptify.js +25 -0
- package/node_modules/atomically/dist/utils/fs.d.ts +34 -0
- package/node_modules/atomically/dist/utils/fs.js +42 -0
- package/node_modules/atomically/dist/utils/fs_handlers.d.ts +7 -0
- package/node_modules/atomically/dist/utils/fs_handlers.js +28 -0
- package/node_modules/atomically/dist/utils/lang.d.ts +6 -0
- package/node_modules/atomically/dist/utils/lang.js +16 -0
- package/node_modules/atomically/dist/utils/retryify.d.ts +4 -0
- package/node_modules/atomically/dist/utils/retryify.js +45 -0
- package/node_modules/atomically/dist/utils/retryify_queue.d.ts +15 -0
- package/node_modules/atomically/dist/utils/retryify_queue.js +58 -0
- package/node_modules/atomically/dist/utils/scheduler.d.ts +6 -0
- package/node_modules/atomically/dist/utils/scheduler.js +35 -0
- package/node_modules/atomically/dist/utils/temp.d.ts +11 -0
- package/node_modules/atomically/dist/utils/temp.js +56 -0
- package/node_modules/atomically/package.json +51 -0
- package/node_modules/atomically/src/consts.ts +30 -0
- package/node_modules/atomically/src/index.ts +270 -0
- package/node_modules/atomically/src/types.ts +37 -0
- package/node_modules/atomically/src/utils/attemptify.ts +42 -0
- package/node_modules/atomically/src/utils/fs.ts +51 -0
- package/node_modules/atomically/src/utils/fs_handlers.ts +45 -0
- package/node_modules/atomically/src/utils/lang.ts +28 -0
- package/node_modules/atomically/src/utils/retryify.ts +78 -0
- package/node_modules/atomically/src/utils/retryify_queue.ts +95 -0
- package/node_modules/atomically/src/utils/scheduler.ts +60 -0
- package/node_modules/atomically/src/utils/temp.ts +97 -0
- package/node_modules/atomically/tasks/benchmark.js +72 -0
- package/node_modules/atomically/test/basic.js +510 -0
- package/node_modules/atomically/test/concurrency.js +153 -0
- package/node_modules/atomically/test/integration.js +291 -0
- package/node_modules/atomically/tsconfig.json +28 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1148 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +26 -0
- package/node_modules/commander/lib/argument.js +145 -0
- package/node_modules/commander/lib/command.js +2179 -0
- package/node_modules/commander/lib/error.js +43 -0
- package/node_modules/commander/lib/help.js +462 -0
- package/node_modules/commander/lib/option.js +329 -0
- package/node_modules/commander/lib/suggestSimilar.js +100 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +80 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +884 -0
- package/node_modules/conf/dist/source/index.d.ts +88 -0
- package/node_modules/conf/dist/source/index.js +484 -0
- package/node_modules/conf/dist/source/types.d.ts +233 -0
- package/node_modules/conf/dist/source/types.js +2 -0
- package/node_modules/conf/license +9 -0
- package/node_modules/conf/package.json +100 -0
- package/node_modules/conf/readme.md +445 -0
- package/node_modules/cross-spawn/LICENSE +21 -0
- package/node_modules/cross-spawn/README.md +89 -0
- package/node_modules/cross-spawn/index.js +39 -0
- package/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/node_modules/cross-spawn/lib/parse.js +91 -0
- package/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/node_modules/cross-spawn/node_modules/isexe/.npmignore +2 -0
- package/node_modules/cross-spawn/node_modules/isexe/LICENSE +15 -0
- package/node_modules/cross-spawn/node_modules/isexe/README.md +51 -0
- package/node_modules/cross-spawn/node_modules/isexe/index.js +57 -0
- package/node_modules/cross-spawn/node_modules/isexe/mode.js +41 -0
- package/node_modules/cross-spawn/node_modules/isexe/package.json +31 -0
- package/node_modules/cross-spawn/node_modules/isexe/test/basic.js +221 -0
- package/node_modules/cross-spawn/node_modules/isexe/windows.js +42 -0
- package/node_modules/cross-spawn/node_modules/which/CHANGELOG.md +166 -0
- package/node_modules/cross-spawn/node_modules/which/LICENSE +15 -0
- package/node_modules/cross-spawn/node_modules/which/README.md +54 -0
- package/node_modules/cross-spawn/node_modules/which/bin/node-which +52 -0
- package/node_modules/cross-spawn/node_modules/which/package.json +43 -0
- package/node_modules/cross-spawn/node_modules/which/which.js +125 -0
- package/node_modules/cross-spawn/package.json +73 -0
- package/node_modules/debounce-fn/index.d.ts +74 -0
- package/node_modules/debounce-fn/index.js +54 -0
- package/node_modules/debounce-fn/license +9 -0
- package/node_modules/debounce-fn/package.json +42 -0
- package/node_modules/debounce-fn/readme.md +64 -0
- package/node_modules/define-lazy-prop/index.d.ts +33 -0
- package/node_modules/define-lazy-prop/index.js +19 -0
- package/node_modules/define-lazy-prop/license +9 -0
- package/node_modules/define-lazy-prop/package.json +48 -0
- package/node_modules/define-lazy-prop/readme.md +64 -0
- package/node_modules/dot-prop/index.d.ts +109 -0
- package/node_modules/dot-prop/index.js +138 -0
- package/node_modules/dot-prop/license +9 -0
- package/node_modules/dot-prop/package.json +51 -0
- package/node_modules/dot-prop/readme.md +125 -0
- package/node_modules/dotenv/CHANGELOG.md +643 -0
- package/node_modules/dotenv/LICENSE +23 -0
- package/node_modules/dotenv/README-es.md +757 -0
- package/node_modules/dotenv/README.md +812 -0
- package/node_modules/dotenv/SECURITY.md +1 -0
- package/node_modules/dotenv/config.d.ts +1 -0
- package/node_modules/dotenv/config.js +9 -0
- package/node_modules/dotenv/lib/cli-options.js +17 -0
- package/node_modules/dotenv/lib/env-options.js +28 -0
- package/node_modules/dotenv/lib/main.d.ts +179 -0
- package/node_modules/dotenv/lib/main.js +423 -0
- package/node_modules/dotenv/package.json +62 -0
- package/node_modules/dotenv/skills/dotenv/SKILL.md +200 -0
- package/node_modules/dotenv/skills/dotenvx/SKILL.md +118 -0
- package/node_modules/eciesjs/LICENSE +21 -0
- package/node_modules/eciesjs/README.md +213 -0
- package/node_modules/eciesjs/dist/config.d.ts +24 -0
- package/node_modules/eciesjs/dist/config.js +55 -0
- package/node_modules/eciesjs/dist/consts.d.ts +7 -0
- package/node_modules/eciesjs/dist/consts.js +12 -0
- package/node_modules/eciesjs/dist/index.d.ts +36 -0
- package/node_modules/eciesjs/dist/index.js +79 -0
- package/node_modules/eciesjs/dist/keys/PrivateKey.d.ts +34 -0
- package/node_modules/eciesjs/dist/keys/PrivateKey.js +71 -0
- package/node_modules/eciesjs/dist/keys/PublicKey.d.ts +26 -0
- package/node_modules/eciesjs/dist/keys/PublicKey.js +72 -0
- package/node_modules/eciesjs/dist/keys/index.d.ts +2 -0
- package/node_modules/eciesjs/dist/keys/index.js +9 -0
- package/node_modules/eciesjs/dist/types.d.ts +1 -0
- package/node_modules/eciesjs/dist/types.js +4 -0
- package/node_modules/eciesjs/dist/utils/elliptic.d.ts +7 -0
- package/node_modules/eciesjs/dist/utils/elliptic.js +75 -0
- package/node_modules/eciesjs/dist/utils/hash.d.ts +2 -0
- package/node_modules/eciesjs/dist/utils/hash.js +19 -0
- package/node_modules/eciesjs/dist/utils/hex.d.ts +2 -0
- package/node_modules/eciesjs/dist/utils/hex.js +10 -0
- package/node_modules/eciesjs/dist/utils/index.d.ts +4 -0
- package/node_modules/eciesjs/dist/utils/index.js +20 -0
- package/node_modules/eciesjs/dist/utils/symmetric.d.ts +6 -0
- package/node_modules/eciesjs/dist/utils/symmetric.js +63 -0
- package/node_modules/eciesjs/package.json +81 -0
- package/node_modules/enquirer/LICENSE +21 -0
- package/node_modules/enquirer/README.md +1839 -0
- package/node_modules/enquirer/index.d.ts +156 -0
- package/node_modules/enquirer/index.js +254 -0
- package/node_modules/enquirer/lib/ansi.js +125 -0
- package/node_modules/enquirer/lib/combos.js +75 -0
- package/node_modules/enquirer/lib/completer.js +52 -0
- package/node_modules/enquirer/lib/interpolate.js +266 -0
- package/node_modules/enquirer/lib/keypress.js +245 -0
- package/node_modules/enquirer/lib/placeholder.js +63 -0
- package/node_modules/enquirer/lib/prompt.js +497 -0
- package/node_modules/enquirer/lib/prompts/autocomplete.js +118 -0
- package/node_modules/enquirer/lib/prompts/basicauth.js +41 -0
- package/node_modules/enquirer/lib/prompts/confirm.js +13 -0
- package/node_modules/enquirer/lib/prompts/editable.js +136 -0
- package/node_modules/enquirer/lib/prompts/form.js +195 -0
- package/node_modules/enquirer/lib/prompts/index.js +28 -0
- package/node_modules/enquirer/lib/prompts/input.js +55 -0
- package/node_modules/enquirer/lib/prompts/invisible.js +11 -0
- package/node_modules/enquirer/lib/prompts/list.js +36 -0
- package/node_modules/enquirer/lib/prompts/multiselect.js +11 -0
- package/node_modules/enquirer/lib/prompts/numeral.js +1 -0
- package/node_modules/enquirer/lib/prompts/password.js +18 -0
- package/node_modules/enquirer/lib/prompts/quiz.js +37 -0
- package/node_modules/enquirer/lib/prompts/scale.js +237 -0
- package/node_modules/enquirer/lib/prompts/select.js +139 -0
- package/node_modules/enquirer/lib/prompts/snippet.js +185 -0
- package/node_modules/enquirer/lib/prompts/sort.js +37 -0
- package/node_modules/enquirer/lib/prompts/survey.js +163 -0
- package/node_modules/enquirer/lib/prompts/text.js +1 -0
- package/node_modules/enquirer/lib/prompts/toggle.js +109 -0
- package/node_modules/enquirer/lib/queue.js +33 -0
- package/node_modules/enquirer/lib/render.js +33 -0
- package/node_modules/enquirer/lib/roles.js +46 -0
- package/node_modules/enquirer/lib/state.js +69 -0
- package/node_modules/enquirer/lib/styles.js +144 -0
- package/node_modules/enquirer/lib/symbols.js +66 -0
- package/node_modules/enquirer/lib/theme.js +11 -0
- package/node_modules/enquirer/lib/timer.js +38 -0
- package/node_modules/enquirer/lib/types/array.js +664 -0
- package/node_modules/enquirer/lib/types/auth.js +29 -0
- package/node_modules/enquirer/lib/types/boolean.js +88 -0
- package/node_modules/enquirer/lib/types/index.js +7 -0
- package/node_modules/enquirer/lib/types/number.js +86 -0
- package/node_modules/enquirer/lib/types/string.js +209 -0
- package/node_modules/enquirer/lib/utils.js +279 -0
- package/node_modules/enquirer/package.json +112 -0
- package/node_modules/env-paths/index.d.ts +101 -0
- package/node_modules/env-paths/index.js +74 -0
- package/node_modules/env-paths/license +9 -0
- package/node_modules/env-paths/package.json +45 -0
- package/node_modules/env-paths/readme.md +115 -0
- package/node_modules/execa/index.d.ts +564 -0
- package/node_modules/execa/index.js +268 -0
- package/node_modules/execa/lib/command.js +52 -0
- package/node_modules/execa/lib/error.js +88 -0
- package/node_modules/execa/lib/kill.js +115 -0
- package/node_modules/execa/lib/promise.js +46 -0
- package/node_modules/execa/lib/stdio.js +52 -0
- package/node_modules/execa/lib/stream.js +97 -0
- package/node_modules/execa/license +9 -0
- package/node_modules/execa/package.json +74 -0
- package/node_modules/execa/readme.md +663 -0
- package/node_modules/fast-deep-equal/LICENSE +21 -0
- package/node_modules/fast-deep-equal/README.md +96 -0
- package/node_modules/fast-deep-equal/es6/index.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/index.js +72 -0
- package/node_modules/fast-deep-equal/es6/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/react.js +79 -0
- package/node_modules/fast-deep-equal/index.d.ts +4 -0
- package/node_modules/fast-deep-equal/index.js +46 -0
- package/node_modules/fast-deep-equal/package.json +61 -0
- package/node_modules/fast-deep-equal/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/react.js +53 -0
- package/node_modules/fast-uri/.gitattributes +2 -0
- package/node_modules/fast-uri/.github/dependabot.yml +13 -0
- package/node_modules/fast-uri/.github/workflows/ci.yml +106 -0
- package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
- package/node_modules/fast-uri/LICENSE +30 -0
- package/node_modules/fast-uri/README.md +152 -0
- package/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/node_modules/fast-uri/benchmark/package.json +17 -0
- package/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/node_modules/fast-uri/eslint.config.js +6 -0
- package/node_modules/fast-uri/index.js +406 -0
- package/node_modules/fast-uri/lib/schemes.js +267 -0
- package/node_modules/fast-uri/lib/utils.js +443 -0
- package/node_modules/fast-uri/package.json +68 -0
- package/node_modules/fast-uri/test/ajv.test.js +43 -0
- package/node_modules/fast-uri/test/equal.test.js +117 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/node_modules/fast-uri/test/parse.test.js +323 -0
- package/node_modules/fast-uri/test/resolve.test.js +87 -0
- package/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +39 -0
- package/node_modules/fast-uri/test/security.test.js +133 -0
- package/node_modules/fast-uri/test/serialize.test.js +151 -0
- package/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/node_modules/fast-uri/test/uri-js.test.js +912 -0
- package/node_modules/fast-uri/test/util.test.js +38 -0
- package/node_modules/fast-uri/tsconfig.json +9 -0
- package/node_modules/fast-uri/types/index.d.ts +60 -0
- package/node_modules/fast-uri/types/index.test-d.ts +17 -0
- package/node_modules/fdir/LICENSE +7 -0
- package/node_modules/fdir/README.md +91 -0
- package/node_modules/fdir/dist/index.cjs +588 -0
- package/node_modules/fdir/dist/index.d.cts +155 -0
- package/node_modules/fdir/dist/index.d.mts +155 -0
- package/node_modules/fdir/dist/index.mjs +570 -0
- package/node_modules/fdir/package.json +103 -0
- package/node_modules/find-up/index.js +46 -0
- package/node_modules/find-up/license +9 -0
- package/node_modules/find-up/package.json +50 -0
- package/node_modules/find-up/readme.md +87 -0
- package/node_modules/get-stream/buffer-stream.js +52 -0
- package/node_modules/get-stream/index.d.ts +105 -0
- package/node_modules/get-stream/index.js +61 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/get-stream/package.json +47 -0
- package/node_modules/get-stream/readme.md +124 -0
- package/node_modules/human-signals/CHANGELOG.md +11 -0
- package/node_modules/human-signals/LICENSE +201 -0
- package/node_modules/human-signals/README.md +165 -0
- package/node_modules/human-signals/build/src/core.js +273 -0
- package/node_modules/human-signals/build/src/core.js.map +1 -0
- package/node_modules/human-signals/build/src/main.d.ts +52 -0
- package/node_modules/human-signals/build/src/main.js +71 -0
- package/node_modules/human-signals/build/src/main.js.map +1 -0
- package/node_modules/human-signals/build/src/realtime.js +19 -0
- package/node_modules/human-signals/build/src/realtime.js.map +1 -0
- package/node_modules/human-signals/build/src/signals.js +35 -0
- package/node_modules/human-signals/build/src/signals.js.map +1 -0
- package/node_modules/human-signals/package.json +64 -0
- package/node_modules/ignore/LICENSE-MIT +21 -0
- package/node_modules/ignore/README.md +412 -0
- package/node_modules/ignore/index.d.ts +61 -0
- package/node_modules/ignore/index.js +636 -0
- package/node_modules/ignore/legacy.js +559 -0
- package/node_modules/ignore/package.json +74 -0
- package/node_modules/is-docker/cli.js +5 -0
- package/node_modules/is-docker/index.d.ts +15 -0
- package/node_modules/is-docker/index.js +29 -0
- package/node_modules/is-docker/license +9 -0
- package/node_modules/is-docker/package.json +42 -0
- package/node_modules/is-docker/readme.md +27 -0
- package/node_modules/is-obj/index.d.ts +22 -0
- package/node_modules/is-obj/index.js +6 -0
- package/node_modules/is-obj/license +9 -0
- package/node_modules/is-obj/package.json +34 -0
- package/node_modules/is-obj/readme.md +39 -0
- package/node_modules/is-stream/index.d.ts +79 -0
- package/node_modules/is-stream/index.js +28 -0
- package/node_modules/is-stream/license +9 -0
- package/node_modules/is-stream/package.json +42 -0
- package/node_modules/is-stream/readme.md +60 -0
- package/node_modules/is-wsl/index.d.ts +15 -0
- package/node_modules/is-wsl/index.js +31 -0
- package/node_modules/is-wsl/license +9 -0
- package/node_modules/is-wsl/package.json +45 -0
- package/node_modules/is-wsl/readme.md +36 -0
- package/node_modules/isexe/LICENSE.md +55 -0
- package/node_modules/isexe/README.md +80 -0
- package/node_modules/isexe/dist/commonjs/index.d.ts +14 -0
- package/node_modules/isexe/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/isexe/dist/commonjs/index.js +56 -0
- package/node_modules/isexe/dist/commonjs/index.js.map +1 -0
- package/node_modules/isexe/dist/commonjs/index.min.js +2 -0
- package/node_modules/isexe/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/isexe/dist/commonjs/options.d.ts +32 -0
- package/node_modules/isexe/dist/commonjs/options.d.ts.map +1 -0
- package/node_modules/isexe/dist/commonjs/options.js +3 -0
- package/node_modules/isexe/dist/commonjs/options.js.map +1 -0
- package/node_modules/isexe/dist/commonjs/package.json +3 -0
- package/node_modules/isexe/dist/commonjs/posix.d.ts +18 -0
- package/node_modules/isexe/dist/commonjs/posix.d.ts.map +1 -0
- package/node_modules/isexe/dist/commonjs/posix.js +67 -0
- package/node_modules/isexe/dist/commonjs/posix.js.map +1 -0
- package/node_modules/isexe/dist/commonjs/win32.d.ts +18 -0
- package/node_modules/isexe/dist/commonjs/win32.d.ts.map +1 -0
- package/node_modules/isexe/dist/commonjs/win32.js +63 -0
- package/node_modules/isexe/dist/commonjs/win32.js.map +1 -0
- package/node_modules/isexe/dist/esm/index.d.ts +14 -0
- package/node_modules/isexe/dist/esm/index.d.ts.map +1 -0
- package/node_modules/isexe/dist/esm/index.js +16 -0
- package/node_modules/isexe/dist/esm/index.js.map +1 -0
- package/node_modules/isexe/dist/esm/index.min.js +2 -0
- package/node_modules/isexe/dist/esm/index.min.js.map +7 -0
- package/node_modules/isexe/dist/esm/options.d.ts +32 -0
- package/node_modules/isexe/dist/esm/options.d.ts.map +1 -0
- package/node_modules/isexe/dist/esm/options.js +2 -0
- package/node_modules/isexe/dist/esm/options.js.map +1 -0
- package/node_modules/isexe/dist/esm/package.json +3 -0
- package/node_modules/isexe/dist/esm/posix.d.ts +18 -0
- package/node_modules/isexe/dist/esm/posix.d.ts.map +1 -0
- package/node_modules/isexe/dist/esm/posix.js +62 -0
- package/node_modules/isexe/dist/esm/posix.js.map +1 -0
- package/node_modules/isexe/dist/esm/win32.d.ts +18 -0
- package/node_modules/isexe/dist/esm/win32.d.ts.map +1 -0
- package/node_modules/isexe/dist/esm/win32.js +58 -0
- package/node_modules/isexe/dist/esm/win32.js.map +1 -0
- package/node_modules/isexe/package.json +78 -0
- package/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
- package/node_modules/json-schema-traverse/.github/FUNDING.yml +2 -0
- package/node_modules/json-schema-traverse/.github/workflows/build.yml +28 -0
- package/node_modules/json-schema-traverse/.github/workflows/publish.yml +27 -0
- package/node_modules/json-schema-traverse/LICENSE +21 -0
- package/node_modules/json-schema-traverse/README.md +95 -0
- package/node_modules/json-schema-traverse/index.d.ts +40 -0
- package/node_modules/json-schema-traverse/index.js +93 -0
- package/node_modules/json-schema-traverse/package.json +43 -0
- package/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
- package/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
- package/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
- package/node_modules/json-schema-typed/LICENSE +27 -0
- package/node_modules/json-schema-typed/README.md +63 -0
- package/node_modules/json-schema-typed/dist-node/index.js +50 -0
- package/node_modules/json-schema-typed/dist-node/index.js.map +1 -0
- package/node_modules/json-schema-typed/dist-src/index.js +51 -0
- package/node_modules/json-schema-typed/dist-types/__tests__/index.test.d.ts +1 -0
- package/node_modules/json-schema-typed/dist-types/index.d.ts +909 -0
- package/node_modules/json-schema-typed/dist-web/index.js +52 -0
- package/node_modules/json-schema-typed/dist-web/index.js.map +1 -0
- package/node_modules/json-schema-typed/package.json +76 -0
- package/node_modules/locate-path/index.js +24 -0
- package/node_modules/locate-path/license +9 -0
- package/node_modules/locate-path/package.json +44 -0
- package/node_modules/locate-path/readme.md +99 -0
- package/node_modules/merge-stream/LICENSE +21 -0
- package/node_modules/merge-stream/README.md +78 -0
- package/node_modules/merge-stream/index.js +41 -0
- package/node_modules/merge-stream/package.json +19 -0
- package/node_modules/mimic-fn/index.d.ts +56 -0
- package/node_modules/mimic-fn/index.js +75 -0
- package/node_modules/mimic-fn/license +9 -0
- package/node_modules/mimic-fn/package.json +42 -0
- package/node_modules/mimic-fn/readme.md +95 -0
- package/node_modules/npm-run-path/index.d.ts +89 -0
- package/node_modules/npm-run-path/index.js +47 -0
- package/node_modules/npm-run-path/license +9 -0
- package/node_modules/npm-run-path/package.json +44 -0
- package/node_modules/npm-run-path/readme.md +115 -0
- package/node_modules/object-treeify/LICENSE +22 -0
- package/node_modules/object-treeify/README.md +120 -0
- package/node_modules/object-treeify/lib/index.js +49 -0
- package/node_modules/object-treeify/package.json +109 -0
- package/node_modules/onetime/index.d.ts +64 -0
- package/node_modules/onetime/index.js +44 -0
- package/node_modules/onetime/license +9 -0
- package/node_modules/onetime/node_modules/mimic-fn/index.d.ts +54 -0
- package/node_modules/onetime/node_modules/mimic-fn/index.js +13 -0
- package/node_modules/onetime/node_modules/mimic-fn/license +9 -0
- package/node_modules/onetime/node_modules/mimic-fn/package.json +42 -0
- package/node_modules/onetime/node_modules/mimic-fn/readme.md +69 -0
- package/node_modules/onetime/package.json +43 -0
- package/node_modules/onetime/readme.md +94 -0
- package/node_modules/open/index.d.ts +153 -0
- package/node_modules/open/index.js +334 -0
- package/node_modules/open/license +9 -0
- package/node_modules/open/package.json +61 -0
- package/node_modules/open/readme.md +171 -0
- package/node_modules/open/xdg-open +1066 -0
- package/node_modules/p-limit/index.d.ts +38 -0
- package/node_modules/p-limit/index.js +57 -0
- package/node_modules/p-limit/license +9 -0
- package/node_modules/p-limit/package.json +52 -0
- package/node_modules/p-limit/readme.md +101 -0
- package/node_modules/p-locate/index.js +34 -0
- package/node_modules/p-locate/license +9 -0
- package/node_modules/p-locate/package.json +51 -0
- package/node_modules/p-locate/readme.md +88 -0
- package/node_modules/p-try/index.d.ts +39 -0
- package/node_modules/p-try/index.js +9 -0
- package/node_modules/p-try/license +9 -0
- package/node_modules/p-try/package.json +42 -0
- package/node_modules/p-try/readme.md +58 -0
- package/node_modules/path-exists/index.js +17 -0
- package/node_modules/path-exists/license +21 -0
- package/node_modules/path-exists/package.json +40 -0
- package/node_modules/path-exists/readme.md +50 -0
- package/node_modules/path-key/index.d.ts +40 -0
- package/node_modules/path-key/index.js +16 -0
- package/node_modules/path-key/license +9 -0
- package/node_modules/path-key/package.json +39 -0
- package/node_modules/path-key/readme.md +61 -0
- package/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/picomatch/README.md +749 -0
- package/node_modules/picomatch/index.js +17 -0
- package/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/picomatch/lib/parse.js +1386 -0
- package/node_modules/picomatch/lib/picomatch.js +349 -0
- package/node_modules/picomatch/lib/scan.js +391 -0
- package/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/picomatch/package.json +82 -0
- package/node_modules/picomatch/posix.js +3 -0
- package/node_modules/pkg-up/index.d.ts +48 -0
- package/node_modules/pkg-up/index.js +5 -0
- package/node_modules/pkg-up/license +9 -0
- package/node_modules/pkg-up/package.json +52 -0
- package/node_modules/pkg-up/readme.md +68 -0
- package/node_modules/require-from-string/index.js +34 -0
- package/node_modules/require-from-string/license +21 -0
- package/node_modules/require-from-string/package.json +28 -0
- package/node_modules/require-from-string/readme.md +56 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +573 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/shebang-command/index.js +19 -0
- package/node_modules/shebang-command/license +9 -0
- package/node_modules/shebang-command/package.json +34 -0
- package/node_modules/shebang-command/readme.md +34 -0
- package/node_modules/shebang-regex/index.d.ts +22 -0
- package/node_modules/shebang-regex/index.js +2 -0
- package/node_modules/shebang-regex/license +9 -0
- package/node_modules/shebang-regex/package.json +35 -0
- package/node_modules/shebang-regex/readme.md +33 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +202 -0
- package/node_modules/signal-exit/package.json +38 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/strip-final-newline/index.js +16 -0
- package/node_modules/strip-final-newline/license +9 -0
- package/node_modules/strip-final-newline/package.json +40 -0
- package/node_modules/strip-final-newline/readme.md +30 -0
- package/node_modules/systeminformation/LICENSE +20 -0
- package/node_modules/systeminformation/README.md +1208 -0
- package/node_modules/systeminformation/lib/audio.js +276 -0
- package/node_modules/systeminformation/lib/battery.js +330 -0
- package/node_modules/systeminformation/lib/bluetooth.js +311 -0
- package/node_modules/systeminformation/lib/bluetoothVendors.js +1138 -0
- package/node_modules/systeminformation/lib/cli.js +100 -0
- package/node_modules/systeminformation/lib/cpu.js +2237 -0
- package/node_modules/systeminformation/lib/docker.js +803 -0
- package/node_modules/systeminformation/lib/dockerSocket.js +322 -0
- package/node_modules/systeminformation/lib/filesystem.js +1745 -0
- package/node_modules/systeminformation/lib/graphics.js +1235 -0
- package/node_modules/systeminformation/lib/index.d.ts +1053 -0
- package/node_modules/systeminformation/lib/index.js +518 -0
- package/node_modules/systeminformation/lib/internet.js +259 -0
- package/node_modules/systeminformation/lib/memory.js +613 -0
- package/node_modules/systeminformation/lib/network.js +1992 -0
- package/node_modules/systeminformation/lib/osinfo.js +1310 -0
- package/node_modules/systeminformation/lib/printer.js +209 -0
- package/node_modules/systeminformation/lib/processes.js +1425 -0
- package/node_modules/systeminformation/lib/system.js +856 -0
- package/node_modules/systeminformation/lib/usb.js +313 -0
- package/node_modules/systeminformation/lib/users.js +412 -0
- package/node_modules/systeminformation/lib/util.js +2787 -0
- package/node_modules/systeminformation/lib/virtualbox.js +110 -0
- package/node_modules/systeminformation/lib/wifi.js +822 -0
- package/node_modules/systeminformation/package.json +101 -0
- package/node_modules/undici/LICENSE +21 -0
- package/node_modules/undici/README.md +741 -0
- package/node_modules/undici/docs/docs/api/Agent.md +84 -0
- package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
- package/node_modules/undici/docs/docs/api/Client.md +288 -0
- package/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +128 -0
- package/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1392 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +60 -0
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
- package/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/node_modules/undici/docs/docs/api/MockClient.md +81 -0
- package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/node_modules/undici/docs/docs/api/MockPool.md +555 -0
- package/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
- package/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
- package/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
- package/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
- package/node_modules/undici/index-fetch.js +65 -0
- package/node_modules/undici/index.d.ts +3 -0
- package/node_modules/undici/index.js +234 -0
- package/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/node_modules/undici/lib/api/api-connect.js +110 -0
- package/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/node_modules/undici/lib/api/api-request.js +214 -0
- package/node_modules/undici/lib/api/api-stream.js +209 -0
- package/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/undici/lib/api/readable.js +580 -0
- package/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
- package/node_modules/undici/lib/core/connect.js +153 -0
- package/node_modules/undici/lib/core/constants.js +143 -0
- package/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/node_modules/undici/lib/core/errors.js +477 -0
- package/node_modules/undici/lib/core/request.js +453 -0
- package/node_modules/undici/lib/core/socks5-client.js +422 -0
- package/node_modules/undici/lib/core/socks5-utils.js +212 -0
- package/node_modules/undici/lib/core/symbols.js +75 -0
- package/node_modules/undici/lib/core/tree.js +160 -0
- package/node_modules/undici/lib/core/util.js +992 -0
- package/node_modules/undici/lib/dispatcher/agent.js +158 -0
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +219 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +1722 -0
- package/node_modules/undici/lib/dispatcher/client-h2.js +995 -0
- package/node_modules/undici/lib/dispatcher/client.js +664 -0
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
- package/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
- package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
- package/node_modules/undici/lib/encoding/index.js +33 -0
- package/node_modules/undici/lib/global.js +59 -0
- package/node_modules/undici/lib/handler/cache-handler.js +578 -0
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
- package/node_modules/undici/lib/handler/redirect-handler.js +238 -0
- package/node_modules/undici/lib/handler/retry-handler.js +394 -0
- package/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/node_modules/undici/lib/interceptor/cache.js +495 -0
- package/node_modules/undici/lib/interceptor/decompress.js +259 -0
- package/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
- package/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/node_modules/undici/lib/interceptor/dump.js +112 -0
- package/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
- package/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
- package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
- package/node_modules/undici/lib/util/cache.js +414 -0
- package/node_modules/undici/lib/util/date.js +653 -0
- package/node_modules/undici/lib/util/promise.js +28 -0
- package/node_modules/undici/lib/util/runtime-features.js +124 -0
- package/node_modules/undici/lib/util/stats.js +32 -0
- package/node_modules/undici/lib/util/timers.js +425 -0
- package/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/node_modules/undici/lib/web/cookies/parse.js +314 -0
- package/node_modules/undici/lib/web/cookies/util.js +282 -0
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
- package/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
- package/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/node_modules/undici/lib/web/fetch/index.js +2413 -0
- package/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/node_modules/undici/lib/web/fetch/util.js +1522 -0
- package/node_modules/undici/lib/web/infra/index.js +229 -0
- package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/node_modules/undici/lib/web/webidl/index.js +1006 -0
- package/node_modules/undici/lib/web/websocket/connection.js +329 -0
- package/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
- package/node_modules/undici/lib/web/websocket/receiver.js +507 -0
- package/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +498 -0
- package/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/node_modules/undici/lib/web/websocket/websocket.js +758 -0
- package/node_modules/undici/package.json +152 -0
- package/node_modules/undici/scripts/strip-comments.js +10 -0
- package/node_modules/undici/types/README.md +6 -0
- package/node_modules/undici/types/agent.d.ts +32 -0
- package/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
- package/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/undici/types/client-stats.d.ts +15 -0
- package/node_modules/undici/types/client.d.ts +139 -0
- package/node_modules/undici/types/connector.d.ts +36 -0
- package/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/undici/types/cookies.d.ts +30 -0
- package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/node_modules/undici/types/dispatcher.d.ts +275 -0
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici/types/errors.d.ts +177 -0
- package/node_modules/undici/types/eventsource.d.ts +66 -0
- package/node_modules/undici/types/fetch.d.ts +231 -0
- package/node_modules/undici/types/formdata.d.ts +114 -0
- package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/undici/types/h2c-client.d.ts +73 -0
- package/node_modules/undici/types/handlers.d.ts +14 -0
- package/node_modules/undici/types/header.d.ts +160 -0
- package/node_modules/undici/types/index.d.ts +91 -0
- package/node_modules/undici/types/interceptors.d.ts +80 -0
- package/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/node_modules/undici/types/mock-client.d.ts +27 -0
- package/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/undici/types/mock-interceptor.d.ts +94 -0
- package/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/node_modules/undici/types/patch.d.ts +29 -0
- package/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/undici/types/pool.d.ts +41 -0
- package/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/node_modules/undici/types/readable.d.ts +68 -0
- package/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/node_modules/undici/types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici/types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/undici/types/utility.d.ts +7 -0
- package/node_modules/undici/types/webidl.d.ts +347 -0
- package/node_modules/undici/types/websocket.d.ts +188 -0
- package/node_modules/which/LICENSE +15 -0
- package/node_modules/which/README.md +51 -0
- package/node_modules/which/bin/which.js +52 -0
- package/node_modules/which/lib/index.js +111 -0
- package/node_modules/which/package.json +57 -0
- package/node_modules/yocto-spinner/index.d.ts +162 -0
- package/node_modules/yocto-spinner/index.js +428 -0
- package/node_modules/yocto-spinner/license +9 -0
- package/node_modules/yocto-spinner/package.json +64 -0
- package/node_modules/yocto-spinner/readme.md +237 -0
- package/node_modules/yoctocolors/base.d.ts +47 -0
- package/node_modules/yoctocolors/base.js +94 -0
- package/node_modules/yoctocolors/index.d.ts +2 -0
- package/node_modules/yoctocolors/index.js +2 -0
- package/node_modules/yoctocolors/license +9 -0
- package/node_modules/yoctocolors/package.json +69 -0
- package/node_modules/yoctocolors/readme.md +138 -0
- package/package.json +20 -2
|
@@ -0,0 +1,1884 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Short Weierstrass curve methods. The formula is: y² = x³ + ax + b.
|
|
3
|
+
*
|
|
4
|
+
* ### Design rationale for types
|
|
5
|
+
*
|
|
6
|
+
* * Interaction between classes from different curves should fail:
|
|
7
|
+
* `k256.Point.BASE.add(p256.Point.BASE)`
|
|
8
|
+
* * For this purpose we want to use `instanceof` operator, which is fast and works during runtime
|
|
9
|
+
* * Different calls of `curve()` would return different classes -
|
|
10
|
+
* `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve,
|
|
11
|
+
* it won't affect others
|
|
12
|
+
*
|
|
13
|
+
* TypeScript can't infer types for classes created inside a function. Classes is one instance
|
|
14
|
+
* of nominative types in TypeScript and interfaces only check for shape, so it's hard to create
|
|
15
|
+
* unique type for every function call.
|
|
16
|
+
*
|
|
17
|
+
* We can use generic types via some param, like curve opts, but that would:
|
|
18
|
+
* 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)
|
|
19
|
+
* which is hard to debug.
|
|
20
|
+
* 2. Params can be generic and we can't enforce them to be constant value:
|
|
21
|
+
* if somebody creates curve from non-constant params,
|
|
22
|
+
* it would be allowed to interact with other curves with non-constant params
|
|
23
|
+
*
|
|
24
|
+
* @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
28
|
+
import { hmac as nobleHmac } from '@noble/hashes/hmac.js';
|
|
29
|
+
import { ahash } from '@noble/hashes/utils';
|
|
30
|
+
import {
|
|
31
|
+
_validateObject,
|
|
32
|
+
_abool2 as abool,
|
|
33
|
+
_abytes2 as abytes,
|
|
34
|
+
aInRange,
|
|
35
|
+
bitLen,
|
|
36
|
+
bitMask,
|
|
37
|
+
bytesToHex,
|
|
38
|
+
bytesToNumberBE,
|
|
39
|
+
concatBytes,
|
|
40
|
+
createHmacDrbg,
|
|
41
|
+
ensureBytes,
|
|
42
|
+
hexToBytes,
|
|
43
|
+
inRange,
|
|
44
|
+
isBytes,
|
|
45
|
+
memoized,
|
|
46
|
+
numberToHexUnpadded,
|
|
47
|
+
randomBytes as randomBytesWeb,
|
|
48
|
+
type CHash,
|
|
49
|
+
type Hex,
|
|
50
|
+
type PrivKey,
|
|
51
|
+
} from '../utils.ts';
|
|
52
|
+
import {
|
|
53
|
+
_createCurveFields,
|
|
54
|
+
mulEndoUnsafe,
|
|
55
|
+
negateCt,
|
|
56
|
+
normalizeZ,
|
|
57
|
+
pippenger,
|
|
58
|
+
wNAF,
|
|
59
|
+
type AffinePoint,
|
|
60
|
+
type BasicCurve,
|
|
61
|
+
type CurveLengths,
|
|
62
|
+
type CurvePoint,
|
|
63
|
+
type CurvePointCons,
|
|
64
|
+
} from './curve.ts';
|
|
65
|
+
import {
|
|
66
|
+
Field,
|
|
67
|
+
FpInvertBatch,
|
|
68
|
+
getMinHashLength,
|
|
69
|
+
mapHashToField,
|
|
70
|
+
nLength,
|
|
71
|
+
validateField,
|
|
72
|
+
type IField,
|
|
73
|
+
type NLength,
|
|
74
|
+
} from './modular.ts';
|
|
75
|
+
|
|
76
|
+
export type { AffinePoint };
|
|
77
|
+
export type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
78
|
+
|
|
79
|
+
type EndoBasis = [[bigint, bigint], [bigint, bigint]];
|
|
80
|
+
/**
|
|
81
|
+
* When Weierstrass curve has `a=0`, it becomes Koblitz curve.
|
|
82
|
+
* Koblitz curves allow using **efficiently-computable GLV endomorphism ψ**.
|
|
83
|
+
* Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.
|
|
84
|
+
* For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.
|
|
85
|
+
*
|
|
86
|
+
* Endomorphism consists of beta, lambda and splitScalar:
|
|
87
|
+
*
|
|
88
|
+
* 1. GLV endomorphism ψ transforms a point: `P = (x, y) ↦ ψ(P) = (β·x mod p, y)`
|
|
89
|
+
* 2. GLV scalar decomposition transforms a scalar: `k ≡ k₁ + k₂·λ (mod n)`
|
|
90
|
+
* 3. Then these are combined: `k·P = k₁·P + k₂·ψ(P)`
|
|
91
|
+
* 4. Two 128-bit point-by-scalar multiplications + one point addition is faster than
|
|
92
|
+
* one 256-bit multiplication.
|
|
93
|
+
*
|
|
94
|
+
* where
|
|
95
|
+
* * beta: β ∈ Fₚ with β³ = 1, β ≠ 1
|
|
96
|
+
* * lambda: λ ∈ Fₙ with λ³ = 1, λ ≠ 1
|
|
97
|
+
* * splitScalar decomposes k ↦ k₁, k₂, by using reduced basis vectors.
|
|
98
|
+
* Gauss lattice reduction calculates them from initial basis vectors `(n, 0), (-λ, 0)`
|
|
99
|
+
*
|
|
100
|
+
* Check out `test/misc/endomorphism.js` and
|
|
101
|
+
* [gist](https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066).
|
|
102
|
+
*/
|
|
103
|
+
export type EndomorphismOpts = {
|
|
104
|
+
beta: bigint;
|
|
105
|
+
basises?: EndoBasis;
|
|
106
|
+
splitScalar?: (k: bigint) => { k1neg: boolean; k1: bigint; k2neg: boolean; k2: bigint };
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// We construct basis in such way that den is always positive and equals n, but num sign depends on basis (not on secret value)
|
|
110
|
+
const divNearest = (num: bigint, den: bigint) => (num + (num >= 0 ? den : -den) / _2n) / den;
|
|
111
|
+
|
|
112
|
+
export type ScalarEndoParts = { k1neg: boolean; k1: bigint; k2neg: boolean; k2: bigint };
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Splits scalar for GLV endomorphism.
|
|
116
|
+
*/
|
|
117
|
+
export function _splitEndoScalar(k: bigint, basis: EndoBasis, n: bigint): ScalarEndoParts {
|
|
118
|
+
// Split scalar into two such that part is ~half bits: `abs(part) < sqrt(N)`
|
|
119
|
+
// Since part can be negative, we need to do this on point.
|
|
120
|
+
// TODO: verifyScalar function which consumes lambda
|
|
121
|
+
const [[a1, b1], [a2, b2]] = basis;
|
|
122
|
+
const c1 = divNearest(b2 * k, n);
|
|
123
|
+
const c2 = divNearest(-b1 * k, n);
|
|
124
|
+
// |k1|/|k2| is < sqrt(N), but can be negative.
|
|
125
|
+
// If we do `k1 mod N`, we'll get big scalar (`> sqrt(N)`): so, we do cheaper negation instead.
|
|
126
|
+
let k1 = k - c1 * a1 - c2 * a2;
|
|
127
|
+
let k2 = -c1 * b1 - c2 * b2;
|
|
128
|
+
const k1neg = k1 < _0n;
|
|
129
|
+
const k2neg = k2 < _0n;
|
|
130
|
+
if (k1neg) k1 = -k1;
|
|
131
|
+
if (k2neg) k2 = -k2;
|
|
132
|
+
// Double check that resulting scalar less than half bits of N: otherwise wNAF will fail.
|
|
133
|
+
// This should only happen on wrong basises. Also, math inside is too complex and I don't trust it.
|
|
134
|
+
const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n; // Half bits of N
|
|
135
|
+
if (k1 < _0n || k1 >= MAX_NUM || k2 < _0n || k2 >= MAX_NUM) {
|
|
136
|
+
throw new Error('splitScalar (endomorphism): failed, k=' + k);
|
|
137
|
+
}
|
|
138
|
+
return { k1neg, k1, k2neg, k2 };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type ECDSASigFormat = 'compact' | 'recovered' | 'der';
|
|
142
|
+
export type ECDSARecoverOpts = {
|
|
143
|
+
prehash?: boolean;
|
|
144
|
+
};
|
|
145
|
+
export type ECDSAVerifyOpts = {
|
|
146
|
+
prehash?: boolean;
|
|
147
|
+
lowS?: boolean;
|
|
148
|
+
format?: ECDSASigFormat;
|
|
149
|
+
};
|
|
150
|
+
export type ECDSASignOpts = {
|
|
151
|
+
prehash?: boolean;
|
|
152
|
+
lowS?: boolean;
|
|
153
|
+
format?: ECDSASigFormat;
|
|
154
|
+
extraEntropy?: Uint8Array | boolean;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
function validateSigFormat(format: string): ECDSASigFormat {
|
|
158
|
+
if (!['compact', 'recovered', 'der'].includes(format))
|
|
159
|
+
throw new Error('Signature format must be "compact", "recovered", or "der"');
|
|
160
|
+
return format as ECDSASigFormat;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function validateSigOpts<T extends ECDSASignOpts, D extends Required<ECDSASignOpts>>(
|
|
164
|
+
opts: T,
|
|
165
|
+
def: D
|
|
166
|
+
): Required<ECDSASignOpts> {
|
|
167
|
+
const optsn: ECDSASignOpts = {};
|
|
168
|
+
for (let optName of Object.keys(def)) {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
optsn[optName] = opts[optName] === undefined ? def[optName] : opts[optName];
|
|
171
|
+
}
|
|
172
|
+
abool(optsn.lowS!, 'lowS');
|
|
173
|
+
abool(optsn.prehash!, 'prehash');
|
|
174
|
+
if (optsn.format !== undefined) validateSigFormat(optsn.format);
|
|
175
|
+
return optsn as Required<ECDSASignOpts>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Instance methods for 3D XYZ projective points. */
|
|
179
|
+
export interface WeierstrassPoint<T> extends CurvePoint<T, WeierstrassPoint<T>> {
|
|
180
|
+
/** projective X coordinate. Different from affine x. */
|
|
181
|
+
readonly X: T;
|
|
182
|
+
/** projective Y coordinate. Different from affine y. */
|
|
183
|
+
readonly Y: T;
|
|
184
|
+
/** projective z coordinate */
|
|
185
|
+
readonly Z: T;
|
|
186
|
+
/** affine x coordinate. Different from projective X. */
|
|
187
|
+
get x(): T;
|
|
188
|
+
/** affine y coordinate. Different from projective Y. */
|
|
189
|
+
get y(): T;
|
|
190
|
+
/** Encodes point using IEEE P1363 (DER) encoding. First byte is 2/3/4. Default = isCompressed. */
|
|
191
|
+
toBytes(isCompressed?: boolean): Uint8Array;
|
|
192
|
+
toHex(isCompressed?: boolean): string;
|
|
193
|
+
|
|
194
|
+
/** @deprecated use `.X` */
|
|
195
|
+
readonly px: T;
|
|
196
|
+
/** @deprecated use `.Y` */
|
|
197
|
+
readonly py: T;
|
|
198
|
+
/** @deprecated use `.Z` */
|
|
199
|
+
readonly pz: T;
|
|
200
|
+
/** @deprecated use `toBytes` */
|
|
201
|
+
toRawBytes(isCompressed?: boolean): Uint8Array;
|
|
202
|
+
/** @deprecated use `multiplyUnsafe` */
|
|
203
|
+
multiplyAndAddUnsafe(
|
|
204
|
+
Q: WeierstrassPoint<T>,
|
|
205
|
+
a: bigint,
|
|
206
|
+
b: bigint
|
|
207
|
+
): WeierstrassPoint<T> | undefined;
|
|
208
|
+
/** @deprecated use `p.y % 2n === 0n` */
|
|
209
|
+
hasEvenY(): boolean;
|
|
210
|
+
/** @deprecated use `p.precompute(windowSize)` */
|
|
211
|
+
_setWindowSize(windowSize: number): void;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Static methods for 3D XYZ projective points. */
|
|
215
|
+
export interface WeierstrassPointCons<T> extends CurvePointCons<WeierstrassPoint<T>> {
|
|
216
|
+
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
217
|
+
new (X: T, Y: T, Z: T): WeierstrassPoint<T>;
|
|
218
|
+
CURVE(): WeierstrassOpts<T>;
|
|
219
|
+
/** @deprecated use `Point.BASE.multiply(Point.Fn.fromBytes(privateKey))` */
|
|
220
|
+
fromPrivateKey(privateKey: PrivKey): WeierstrassPoint<T>;
|
|
221
|
+
/** @deprecated use `import { normalizeZ } from '@noble/curves/abstract/curve.js';` */
|
|
222
|
+
normalizeZ(points: WeierstrassPoint<T>[]): WeierstrassPoint<T>[];
|
|
223
|
+
/** @deprecated use `import { pippenger } from '@noble/curves/abstract/curve.js';` */
|
|
224
|
+
msm(points: WeierstrassPoint<T>[], scalars: bigint[]): WeierstrassPoint<T>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Weierstrass curve options.
|
|
229
|
+
*
|
|
230
|
+
* * p: prime characteristic (order) of finite field, in which arithmetics is done
|
|
231
|
+
* * n: order of prime subgroup a.k.a total amount of valid curve points
|
|
232
|
+
* * h: cofactor, usually 1. h*n is group order; n is subgroup order
|
|
233
|
+
* * a: formula param, must be in field of p
|
|
234
|
+
* * b: formula param, must be in field of p
|
|
235
|
+
* * Gx: x coordinate of generator point a.k.a. base point
|
|
236
|
+
* * Gy: y coordinate of generator point
|
|
237
|
+
*/
|
|
238
|
+
export type WeierstrassOpts<T> = Readonly<{
|
|
239
|
+
p: bigint;
|
|
240
|
+
n: bigint;
|
|
241
|
+
h: bigint;
|
|
242
|
+
a: T;
|
|
243
|
+
b: T;
|
|
244
|
+
Gx: T;
|
|
245
|
+
Gy: T;
|
|
246
|
+
}>;
|
|
247
|
+
|
|
248
|
+
// When a cofactor != 1, there can be an effective methods to:
|
|
249
|
+
// 1. Determine whether a point is torsion-free
|
|
250
|
+
// 2. Clear torsion component
|
|
251
|
+
// wrapPrivateKey: bls12-381 requires mod(n) instead of rejecting keys >= n
|
|
252
|
+
export type WeierstrassExtraOpts<T> = Partial<{
|
|
253
|
+
Fp: IField<T>;
|
|
254
|
+
Fn: IField<bigint>;
|
|
255
|
+
allowInfinityPoint: boolean;
|
|
256
|
+
endo: EndomorphismOpts;
|
|
257
|
+
isTorsionFree: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>) => boolean;
|
|
258
|
+
clearCofactor: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>) => WeierstrassPoint<T>;
|
|
259
|
+
fromBytes: (bytes: Uint8Array) => AffinePoint<T>;
|
|
260
|
+
toBytes: (
|
|
261
|
+
c: WeierstrassPointCons<T>,
|
|
262
|
+
point: WeierstrassPoint<T>,
|
|
263
|
+
isCompressed: boolean
|
|
264
|
+
) => Uint8Array;
|
|
265
|
+
}>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Options for ECDSA signatures over a Weierstrass curve.
|
|
269
|
+
*
|
|
270
|
+
* * lowS: (default: true) whether produced / verified signatures occupy low half of ecdsaOpts.p. Prevents malleability.
|
|
271
|
+
* * hmac: (default: noble-hashes hmac) function, would be used to init hmac-drbg for k generation.
|
|
272
|
+
* * randomBytes: (default: webcrypto os-level CSPRNG) custom method for fetching secure randomness.
|
|
273
|
+
* * bits2int, bits2int_modN: used in sigs, sometimes overridden by curves
|
|
274
|
+
*/
|
|
275
|
+
export type ECDSAOpts = Partial<{
|
|
276
|
+
lowS: boolean;
|
|
277
|
+
hmac: HmacFnSync;
|
|
278
|
+
randomBytes: (bytesLength?: number) => Uint8Array;
|
|
279
|
+
bits2int: (bytes: Uint8Array) => bigint;
|
|
280
|
+
bits2int_modN: (bytes: Uint8Array) => bigint;
|
|
281
|
+
}>;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Elliptic Curve Diffie-Hellman interface.
|
|
285
|
+
* Provides keygen, secret-to-public conversion, calculating shared secrets.
|
|
286
|
+
*/
|
|
287
|
+
export interface ECDH {
|
|
288
|
+
keygen: (seed?: Uint8Array) => { secretKey: Uint8Array; publicKey: Uint8Array };
|
|
289
|
+
getPublicKey: (secretKey: PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
290
|
+
getSharedSecret: (secretKeyA: PrivKey, publicKeyB: Hex, isCompressed?: boolean) => Uint8Array;
|
|
291
|
+
Point: WeierstrassPointCons<bigint>;
|
|
292
|
+
utils: {
|
|
293
|
+
isValidSecretKey: (secretKey: PrivKey) => boolean;
|
|
294
|
+
isValidPublicKey: (publicKey: Uint8Array, isCompressed?: boolean) => boolean;
|
|
295
|
+
randomSecretKey: (seed?: Uint8Array) => Uint8Array;
|
|
296
|
+
/** @deprecated use `randomSecretKey` */
|
|
297
|
+
randomPrivateKey: (seed?: Uint8Array) => Uint8Array;
|
|
298
|
+
/** @deprecated use `isValidSecretKey` */
|
|
299
|
+
isValidPrivateKey: (secretKey: PrivKey) => boolean;
|
|
300
|
+
/** @deprecated use `Point.Fn.fromBytes()` */
|
|
301
|
+
normPrivateKeyToScalar: (key: PrivKey) => bigint;
|
|
302
|
+
/** @deprecated use `point.precompute()` */
|
|
303
|
+
precompute: (windowSize?: number, point?: WeierstrassPoint<bigint>) => WeierstrassPoint<bigint>;
|
|
304
|
+
};
|
|
305
|
+
lengths: CurveLengths;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* ECDSA interface.
|
|
310
|
+
* Only supported for prime fields, not Fp2 (extension fields).
|
|
311
|
+
*/
|
|
312
|
+
export interface ECDSA extends ECDH {
|
|
313
|
+
sign: (message: Hex, secretKey: PrivKey, opts?: ECDSASignOpts) => ECDSASigRecovered;
|
|
314
|
+
verify: (
|
|
315
|
+
signature: Uint8Array,
|
|
316
|
+
message: Uint8Array,
|
|
317
|
+
publicKey: Uint8Array,
|
|
318
|
+
opts?: ECDSAVerifyOpts
|
|
319
|
+
) => boolean;
|
|
320
|
+
recoverPublicKey(signature: Uint8Array, message: Uint8Array, opts?: ECDSARecoverOpts): Uint8Array;
|
|
321
|
+
Signature: ECDSASignatureCons;
|
|
322
|
+
}
|
|
323
|
+
export class DERErr extends Error {
|
|
324
|
+
constructor(m = '') {
|
|
325
|
+
super(m);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
export type IDER = {
|
|
329
|
+
// asn.1 DER encoding utils
|
|
330
|
+
Err: typeof DERErr;
|
|
331
|
+
// Basic building block is TLV (Tag-Length-Value)
|
|
332
|
+
_tlv: {
|
|
333
|
+
encode: (tag: number, data: string) => string;
|
|
334
|
+
// v - value, l - left bytes (unparsed)
|
|
335
|
+
decode(tag: number, data: Uint8Array): { v: Uint8Array; l: Uint8Array };
|
|
336
|
+
};
|
|
337
|
+
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
338
|
+
// since we always use positive integers here. It must always be empty:
|
|
339
|
+
// - add zero byte if exists
|
|
340
|
+
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
|
341
|
+
_int: {
|
|
342
|
+
encode(num: bigint): string;
|
|
343
|
+
decode(data: Uint8Array): bigint;
|
|
344
|
+
};
|
|
345
|
+
toSig(hex: string | Uint8Array): { r: bigint; s: bigint };
|
|
346
|
+
hexFromSig(sig: { r: bigint; s: bigint }): string;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* ASN.1 DER encoding utilities. ASN is very complex & fragile. Format:
|
|
350
|
+
*
|
|
351
|
+
* [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S]
|
|
352
|
+
*
|
|
353
|
+
* Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html
|
|
354
|
+
*/
|
|
355
|
+
export const DER: IDER = {
|
|
356
|
+
// asn.1 DER encoding utils
|
|
357
|
+
Err: DERErr,
|
|
358
|
+
// Basic building block is TLV (Tag-Length-Value)
|
|
359
|
+
_tlv: {
|
|
360
|
+
encode: (tag: number, data: string): string => {
|
|
361
|
+
const { Err: E } = DER;
|
|
362
|
+
if (tag < 0 || tag > 256) throw new E('tlv.encode: wrong tag');
|
|
363
|
+
if (data.length & 1) throw new E('tlv.encode: unpadded data');
|
|
364
|
+
const dataLen = data.length / 2;
|
|
365
|
+
const len = numberToHexUnpadded(dataLen);
|
|
366
|
+
if ((len.length / 2) & 0b1000_0000) throw new E('tlv.encode: long form length too big');
|
|
367
|
+
// length of length with long form flag
|
|
368
|
+
const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) | 0b1000_0000) : '';
|
|
369
|
+
const t = numberToHexUnpadded(tag);
|
|
370
|
+
return t + lenLen + len + data;
|
|
371
|
+
},
|
|
372
|
+
// v - value, l - left bytes (unparsed)
|
|
373
|
+
decode(tag: number, data: Uint8Array): { v: Uint8Array; l: Uint8Array } {
|
|
374
|
+
const { Err: E } = DER;
|
|
375
|
+
let pos = 0;
|
|
376
|
+
if (tag < 0 || tag > 256) throw new E('tlv.encode: wrong tag');
|
|
377
|
+
if (data.length < 2 || data[pos++] !== tag) throw new E('tlv.decode: wrong tlv');
|
|
378
|
+
const first = data[pos++];
|
|
379
|
+
const isLong = !!(first & 0b1000_0000); // First bit of first length byte is flag for short/long form
|
|
380
|
+
let length = 0;
|
|
381
|
+
if (!isLong) length = first;
|
|
382
|
+
else {
|
|
383
|
+
// Long form: [longFlag(1bit), lengthLength(7bit), length (BE)]
|
|
384
|
+
const lenLen = first & 0b0111_1111;
|
|
385
|
+
if (!lenLen) throw new E('tlv.decode(long): indefinite length not supported');
|
|
386
|
+
if (lenLen > 4) throw new E('tlv.decode(long): byte length is too big'); // this will overflow u32 in js
|
|
387
|
+
const lengthBytes = data.subarray(pos, pos + lenLen);
|
|
388
|
+
if (lengthBytes.length !== lenLen) throw new E('tlv.decode: length bytes not complete');
|
|
389
|
+
if (lengthBytes[0] === 0) throw new E('tlv.decode(long): zero leftmost byte');
|
|
390
|
+
for (const b of lengthBytes) length = (length << 8) | b;
|
|
391
|
+
pos += lenLen;
|
|
392
|
+
if (length < 128) throw new E('tlv.decode(long): not minimal encoding');
|
|
393
|
+
}
|
|
394
|
+
const v = data.subarray(pos, pos + length);
|
|
395
|
+
if (v.length !== length) throw new E('tlv.decode: wrong value length');
|
|
396
|
+
return { v, l: data.subarray(pos + length) };
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
400
|
+
// since we always use positive integers here. It must always be empty:
|
|
401
|
+
// - add zero byte if exists
|
|
402
|
+
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
|
403
|
+
_int: {
|
|
404
|
+
encode(num: bigint): string {
|
|
405
|
+
const { Err: E } = DER;
|
|
406
|
+
if (num < _0n) throw new E('integer: negative integers are not allowed');
|
|
407
|
+
let hex = numberToHexUnpadded(num);
|
|
408
|
+
// Pad with zero byte if negative flag is present
|
|
409
|
+
if (Number.parseInt(hex[0], 16) & 0b1000) hex = '00' + hex;
|
|
410
|
+
if (hex.length & 1) throw new E('unexpected DER parsing assertion: unpadded hex');
|
|
411
|
+
return hex;
|
|
412
|
+
},
|
|
413
|
+
decode(data: Uint8Array): bigint {
|
|
414
|
+
const { Err: E } = DER;
|
|
415
|
+
if (data[0] & 0b1000_0000) throw new E('invalid signature integer: negative');
|
|
416
|
+
if (data[0] === 0x00 && !(data[1] & 0b1000_0000))
|
|
417
|
+
throw new E('invalid signature integer: unnecessary leading zero');
|
|
418
|
+
return bytesToNumberBE(data);
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
toSig(hex: string | Uint8Array): { r: bigint; s: bigint } {
|
|
422
|
+
// parse DER signature
|
|
423
|
+
const { Err: E, _int: int, _tlv: tlv } = DER;
|
|
424
|
+
const data = ensureBytes('signature', hex);
|
|
425
|
+
const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data);
|
|
426
|
+
if (seqLeftBytes.length) throw new E('invalid signature: left bytes after parsing');
|
|
427
|
+
const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes);
|
|
428
|
+
const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes);
|
|
429
|
+
if (sLeftBytes.length) throw new E('invalid signature: left bytes after parsing');
|
|
430
|
+
return { r: int.decode(rBytes), s: int.decode(sBytes) };
|
|
431
|
+
},
|
|
432
|
+
hexFromSig(sig: { r: bigint; s: bigint }): string {
|
|
433
|
+
const { _tlv: tlv, _int: int } = DER;
|
|
434
|
+
const rs = tlv.encode(0x02, int.encode(sig.r));
|
|
435
|
+
const ss = tlv.encode(0x02, int.encode(sig.s));
|
|
436
|
+
const seq = rs + ss;
|
|
437
|
+
return tlv.encode(0x30, seq);
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// Be friendly to bad ECMAScript parsers by not using bigint literals
|
|
442
|
+
// prettier-ignore
|
|
443
|
+
const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);
|
|
444
|
+
|
|
445
|
+
export function _normFnElement(Fn: IField<bigint>, key: PrivKey): bigint {
|
|
446
|
+
const { BYTES: expected } = Fn;
|
|
447
|
+
let num: bigint;
|
|
448
|
+
if (typeof key === 'bigint') {
|
|
449
|
+
num = key;
|
|
450
|
+
} else {
|
|
451
|
+
let bytes = ensureBytes('private key', key);
|
|
452
|
+
try {
|
|
453
|
+
num = Fn.fromBytes(bytes);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key}`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (!Fn.isValidNot0(num)) throw new Error('invalid private key: out of range [1..N-1]');
|
|
459
|
+
return num;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Creates weierstrass Point constructor, based on specified curve options.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
```js
|
|
467
|
+
const opts = {
|
|
468
|
+
p: BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'),
|
|
469
|
+
n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'),
|
|
470
|
+
h: BigInt(1),
|
|
471
|
+
a: BigInt('0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc'),
|
|
472
|
+
b: BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'),
|
|
473
|
+
Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'),
|
|
474
|
+
Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'),
|
|
475
|
+
};
|
|
476
|
+
const p256_Point = weierstrass(opts);
|
|
477
|
+
```
|
|
478
|
+
*/
|
|
479
|
+
export function weierstrassN<T>(
|
|
480
|
+
params: WeierstrassOpts<T>,
|
|
481
|
+
extraOpts: WeierstrassExtraOpts<T> = {}
|
|
482
|
+
): WeierstrassPointCons<T> {
|
|
483
|
+
const validated = _createCurveFields('weierstrass', params, extraOpts);
|
|
484
|
+
const { Fp, Fn } = validated;
|
|
485
|
+
let CURVE = validated.CURVE as WeierstrassOpts<T>;
|
|
486
|
+
const { h: cofactor, n: CURVE_ORDER } = CURVE;
|
|
487
|
+
_validateObject(
|
|
488
|
+
extraOpts,
|
|
489
|
+
{},
|
|
490
|
+
{
|
|
491
|
+
allowInfinityPoint: 'boolean',
|
|
492
|
+
clearCofactor: 'function',
|
|
493
|
+
isTorsionFree: 'function',
|
|
494
|
+
fromBytes: 'function',
|
|
495
|
+
toBytes: 'function',
|
|
496
|
+
endo: 'object',
|
|
497
|
+
wrapPrivateKey: 'boolean',
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
const { endo } = extraOpts;
|
|
502
|
+
if (endo) {
|
|
503
|
+
// validateObject(endo, { beta: 'bigint', splitScalar: 'function' });
|
|
504
|
+
if (!Fp.is0(CURVE.a) || typeof endo.beta !== 'bigint' || !Array.isArray(endo.basises)) {
|
|
505
|
+
throw new Error('invalid endo: expected "beta": bigint and "basises": array');
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const lengths = getWLengths(Fp, Fn);
|
|
510
|
+
|
|
511
|
+
function assertCompressionIsSupported() {
|
|
512
|
+
if (!Fp.isOdd) throw new Error('compression is not supported: Field does not have .isOdd()');
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Implements IEEE P1363 point encoding
|
|
516
|
+
function pointToBytes(
|
|
517
|
+
_c: WeierstrassPointCons<T>,
|
|
518
|
+
point: WeierstrassPoint<T>,
|
|
519
|
+
isCompressed: boolean
|
|
520
|
+
): Uint8Array {
|
|
521
|
+
const { x, y } = point.toAffine();
|
|
522
|
+
const bx = Fp.toBytes(x);
|
|
523
|
+
abool(isCompressed, 'isCompressed');
|
|
524
|
+
if (isCompressed) {
|
|
525
|
+
assertCompressionIsSupported();
|
|
526
|
+
const hasEvenY = !Fp.isOdd!(y);
|
|
527
|
+
return concatBytes(pprefix(hasEvenY), bx);
|
|
528
|
+
} else {
|
|
529
|
+
return concatBytes(Uint8Array.of(0x04), bx, Fp.toBytes(y));
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function pointFromBytes(bytes: Uint8Array) {
|
|
533
|
+
abytes(bytes, undefined, 'Point');
|
|
534
|
+
const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths; // e.g. for 32-byte: 33, 65
|
|
535
|
+
const length = bytes.length;
|
|
536
|
+
const head = bytes[0];
|
|
537
|
+
const tail = bytes.subarray(1);
|
|
538
|
+
// No actual validation is done here: use .assertValidity()
|
|
539
|
+
if (length === comp && (head === 0x02 || head === 0x03)) {
|
|
540
|
+
const x = Fp.fromBytes(tail);
|
|
541
|
+
if (!Fp.isValid(x)) throw new Error('bad point: is not on curve, wrong x');
|
|
542
|
+
const y2 = weierstrassEquation(x); // y² = x³ + ax + b
|
|
543
|
+
let y: T;
|
|
544
|
+
try {
|
|
545
|
+
y = Fp.sqrt(y2); // y = y² ^ (p+1)/4
|
|
546
|
+
} catch (sqrtError) {
|
|
547
|
+
const err = sqrtError instanceof Error ? ': ' + sqrtError.message : '';
|
|
548
|
+
throw new Error('bad point: is not on curve, sqrt error' + err);
|
|
549
|
+
}
|
|
550
|
+
assertCompressionIsSupported();
|
|
551
|
+
const isYOdd = Fp.isOdd!(y); // (y & _1n) === _1n;
|
|
552
|
+
const isHeadOdd = (head & 1) === 1; // ECDSA-specific
|
|
553
|
+
if (isHeadOdd !== isYOdd) y = Fp.neg(y);
|
|
554
|
+
return { x, y };
|
|
555
|
+
} else if (length === uncomp && head === 0x04) {
|
|
556
|
+
// TODO: more checks
|
|
557
|
+
const L = Fp.BYTES;
|
|
558
|
+
const x = Fp.fromBytes(tail.subarray(0, L));
|
|
559
|
+
const y = Fp.fromBytes(tail.subarray(L, L * 2));
|
|
560
|
+
if (!isValidXY(x, y)) throw new Error('bad point: is not on curve');
|
|
561
|
+
return { x, y };
|
|
562
|
+
} else {
|
|
563
|
+
throw new Error(
|
|
564
|
+
`bad point: got length ${length}, expected compressed=${comp} or uncompressed=${uncomp}`
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const encodePoint = extraOpts.toBytes || pointToBytes;
|
|
570
|
+
const decodePoint = extraOpts.fromBytes || pointFromBytes;
|
|
571
|
+
function weierstrassEquation(x: T): T {
|
|
572
|
+
const x2 = Fp.sqr(x); // x * x
|
|
573
|
+
const x3 = Fp.mul(x2, x); // x² * x
|
|
574
|
+
return Fp.add(Fp.add(x3, Fp.mul(x, CURVE.a)), CURVE.b); // x³ + a * x + b
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// TODO: move top-level
|
|
578
|
+
/** Checks whether equation holds for given x, y: y² == x³ + ax + b */
|
|
579
|
+
function isValidXY(x: T, y: T): boolean {
|
|
580
|
+
const left = Fp.sqr(y); // y²
|
|
581
|
+
const right = weierstrassEquation(x); // x³ + ax + b
|
|
582
|
+
return Fp.eql(left, right);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Validate whether the passed curve params are valid.
|
|
586
|
+
// Test 1: equation y² = x³ + ax + b should work for generator point.
|
|
587
|
+
if (!isValidXY(CURVE.Gx, CURVE.Gy)) throw new Error('bad curve params: generator point');
|
|
588
|
+
|
|
589
|
+
// Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0.
|
|
590
|
+
// Guarantees curve is genus-1, smooth (non-singular).
|
|
591
|
+
const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n);
|
|
592
|
+
const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));
|
|
593
|
+
if (Fp.is0(Fp.add(_4a3, _27b2))) throw new Error('bad curve params: a or b');
|
|
594
|
+
|
|
595
|
+
/** Asserts coordinate is valid: 0 <= n < Fp.ORDER. */
|
|
596
|
+
function acoord(title: string, n: T, banZero = false) {
|
|
597
|
+
if (!Fp.isValid(n) || (banZero && Fp.is0(n))) throw new Error(`bad point coordinate ${title}`);
|
|
598
|
+
return n;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function aprjpoint(other: unknown) {
|
|
602
|
+
if (!(other instanceof Point)) throw new Error('ProjectivePoint expected');
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function splitEndoScalarN(k: bigint) {
|
|
606
|
+
if (!endo || !endo.basises) throw new Error('no endo');
|
|
607
|
+
return _splitEndoScalar(k, endo.basises, Fn.ORDER);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// Memoized toAffine / validity check. They are heavy. Points are immutable.
|
|
611
|
+
|
|
612
|
+
// Converts Projective point to affine (x, y) coordinates.
|
|
613
|
+
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
614
|
+
// (X, Y, Z) ∋ (x=X/Z, y=Y/Z)
|
|
615
|
+
const toAffineMemo = memoized((p: Point, iz?: T): AffinePoint<T> => {
|
|
616
|
+
const { X, Y, Z } = p;
|
|
617
|
+
// Fast-path for normalized points
|
|
618
|
+
if (Fp.eql(Z, Fp.ONE)) return { x: X, y: Y };
|
|
619
|
+
const is0 = p.is0();
|
|
620
|
+
// If invZ was 0, we return zero point. However we still want to execute
|
|
621
|
+
// all operations, so we replace invZ with a random number, 1.
|
|
622
|
+
if (iz == null) iz = is0 ? Fp.ONE : Fp.inv(Z);
|
|
623
|
+
const x = Fp.mul(X, iz);
|
|
624
|
+
const y = Fp.mul(Y, iz);
|
|
625
|
+
const zz = Fp.mul(Z, iz);
|
|
626
|
+
if (is0) return { x: Fp.ZERO, y: Fp.ZERO };
|
|
627
|
+
if (!Fp.eql(zz, Fp.ONE)) throw new Error('invZ was invalid');
|
|
628
|
+
return { x, y };
|
|
629
|
+
});
|
|
630
|
+
// NOTE: on exception this will crash 'cached' and no value will be set.
|
|
631
|
+
// Otherwise true will be return
|
|
632
|
+
const assertValidMemo = memoized((p: Point) => {
|
|
633
|
+
if (p.is0()) {
|
|
634
|
+
// (0, 1, 0) aka ZERO is invalid in most contexts.
|
|
635
|
+
// In BLS, ZERO can be serialized, so we allow it.
|
|
636
|
+
// (0, 0, 0) is invalid representation of ZERO.
|
|
637
|
+
if (extraOpts.allowInfinityPoint && !Fp.is0(p.Y)) return;
|
|
638
|
+
throw new Error('bad point: ZERO');
|
|
639
|
+
}
|
|
640
|
+
// Some 3rd-party test vectors require different wording between here & `fromCompressedHex`
|
|
641
|
+
const { x, y } = p.toAffine();
|
|
642
|
+
if (!Fp.isValid(x) || !Fp.isValid(y)) throw new Error('bad point: x or y not field elements');
|
|
643
|
+
if (!isValidXY(x, y)) throw new Error('bad point: equation left != right');
|
|
644
|
+
if (!p.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup');
|
|
645
|
+
return true;
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
function finishEndo(
|
|
649
|
+
endoBeta: EndomorphismOpts['beta'],
|
|
650
|
+
k1p: Point,
|
|
651
|
+
k2p: Point,
|
|
652
|
+
k1neg: boolean,
|
|
653
|
+
k2neg: boolean
|
|
654
|
+
) {
|
|
655
|
+
k2p = new Point(Fp.mul(k2p.X, endoBeta), k2p.Y, k2p.Z);
|
|
656
|
+
k1p = negateCt(k1neg, k1p);
|
|
657
|
+
k2p = negateCt(k2neg, k2p);
|
|
658
|
+
return k1p.add(k2p);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Projective Point works in 3d / projective (homogeneous) coordinates:(X, Y, Z) ∋ (x=X/Z, y=Y/Z).
|
|
663
|
+
* Default Point works in 2d / affine coordinates: (x, y).
|
|
664
|
+
* We're doing calculations in projective, because its operations don't require costly inversion.
|
|
665
|
+
*/
|
|
666
|
+
class Point implements WeierstrassPoint<T> {
|
|
667
|
+
// base / generator point
|
|
668
|
+
static readonly BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
|
|
669
|
+
// zero / infinity / identity point
|
|
670
|
+
static readonly ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0
|
|
671
|
+
// math field
|
|
672
|
+
static readonly Fp = Fp;
|
|
673
|
+
// scalar field
|
|
674
|
+
static readonly Fn = Fn;
|
|
675
|
+
|
|
676
|
+
readonly X: T;
|
|
677
|
+
readonly Y: T;
|
|
678
|
+
readonly Z: T;
|
|
679
|
+
|
|
680
|
+
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
681
|
+
constructor(X: T, Y: T, Z: T) {
|
|
682
|
+
this.X = acoord('x', X);
|
|
683
|
+
this.Y = acoord('y', Y, true);
|
|
684
|
+
this.Z = acoord('z', Z);
|
|
685
|
+
Object.freeze(this);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
static CURVE(): WeierstrassOpts<T> {
|
|
689
|
+
return CURVE;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
693
|
+
static fromAffine(p: AffinePoint<T>): Point {
|
|
694
|
+
const { x, y } = p || {};
|
|
695
|
+
if (!p || !Fp.isValid(x) || !Fp.isValid(y)) throw new Error('invalid affine point');
|
|
696
|
+
if (p instanceof Point) throw new Error('projective point not allowed');
|
|
697
|
+
// (0, 0) would've produced (0, 0, 1) - instead, we need (0, 1, 0)
|
|
698
|
+
if (Fp.is0(x) && Fp.is0(y)) return Point.ZERO;
|
|
699
|
+
return new Point(x, y, Fp.ONE);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
static fromBytes(bytes: Uint8Array): Point {
|
|
703
|
+
const P = Point.fromAffine(decodePoint(abytes(bytes, undefined, 'point')));
|
|
704
|
+
P.assertValidity();
|
|
705
|
+
return P;
|
|
706
|
+
}
|
|
707
|
+
static fromHex(hex: Hex): Point {
|
|
708
|
+
return Point.fromBytes(ensureBytes('pointHex', hex));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
get x(): T {
|
|
712
|
+
return this.toAffine().x;
|
|
713
|
+
}
|
|
714
|
+
get y(): T {
|
|
715
|
+
return this.toAffine().y;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
*
|
|
720
|
+
* @param windowSize
|
|
721
|
+
* @param isLazy true will defer table computation until the first multiplication
|
|
722
|
+
* @returns
|
|
723
|
+
*/
|
|
724
|
+
precompute(windowSize: number = 8, isLazy = true): Point {
|
|
725
|
+
wnaf.createCache(this, windowSize);
|
|
726
|
+
if (!isLazy) this.multiply(_3n); // random number
|
|
727
|
+
return this;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// TODO: return `this`
|
|
731
|
+
/** A point on curve is valid if it conforms to equation. */
|
|
732
|
+
assertValidity(): void {
|
|
733
|
+
assertValidMemo(this);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
hasEvenY(): boolean {
|
|
737
|
+
const { y } = this.toAffine();
|
|
738
|
+
if (!Fp.isOdd) throw new Error("Field doesn't support isOdd");
|
|
739
|
+
return !Fp.isOdd(y);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/** Compare one point to another. */
|
|
743
|
+
equals(other: Point): boolean {
|
|
744
|
+
aprjpoint(other);
|
|
745
|
+
const { X: X1, Y: Y1, Z: Z1 } = this;
|
|
746
|
+
const { X: X2, Y: Y2, Z: Z2 } = other;
|
|
747
|
+
const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));
|
|
748
|
+
const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));
|
|
749
|
+
return U1 && U2;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
753
|
+
negate(): Point {
|
|
754
|
+
return new Point(this.X, Fp.neg(this.Y), this.Z);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Renes-Costello-Batina exception-free doubling formula.
|
|
758
|
+
// There is 30% faster Jacobian formula, but it is not complete.
|
|
759
|
+
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
760
|
+
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
761
|
+
double() {
|
|
762
|
+
const { a, b } = CURVE;
|
|
763
|
+
const b3 = Fp.mul(b, _3n);
|
|
764
|
+
const { X: X1, Y: Y1, Z: Z1 } = this;
|
|
765
|
+
let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore
|
|
766
|
+
let t0 = Fp.mul(X1, X1); // step 1
|
|
767
|
+
let t1 = Fp.mul(Y1, Y1);
|
|
768
|
+
let t2 = Fp.mul(Z1, Z1);
|
|
769
|
+
let t3 = Fp.mul(X1, Y1);
|
|
770
|
+
t3 = Fp.add(t3, t3); // step 5
|
|
771
|
+
Z3 = Fp.mul(X1, Z1);
|
|
772
|
+
Z3 = Fp.add(Z3, Z3);
|
|
773
|
+
X3 = Fp.mul(a, Z3);
|
|
774
|
+
Y3 = Fp.mul(b3, t2);
|
|
775
|
+
Y3 = Fp.add(X3, Y3); // step 10
|
|
776
|
+
X3 = Fp.sub(t1, Y3);
|
|
777
|
+
Y3 = Fp.add(t1, Y3);
|
|
778
|
+
Y3 = Fp.mul(X3, Y3);
|
|
779
|
+
X3 = Fp.mul(t3, X3);
|
|
780
|
+
Z3 = Fp.mul(b3, Z3); // step 15
|
|
781
|
+
t2 = Fp.mul(a, t2);
|
|
782
|
+
t3 = Fp.sub(t0, t2);
|
|
783
|
+
t3 = Fp.mul(a, t3);
|
|
784
|
+
t3 = Fp.add(t3, Z3);
|
|
785
|
+
Z3 = Fp.add(t0, t0); // step 20
|
|
786
|
+
t0 = Fp.add(Z3, t0);
|
|
787
|
+
t0 = Fp.add(t0, t2);
|
|
788
|
+
t0 = Fp.mul(t0, t3);
|
|
789
|
+
Y3 = Fp.add(Y3, t0);
|
|
790
|
+
t2 = Fp.mul(Y1, Z1); // step 25
|
|
791
|
+
t2 = Fp.add(t2, t2);
|
|
792
|
+
t0 = Fp.mul(t2, t3);
|
|
793
|
+
X3 = Fp.sub(X3, t0);
|
|
794
|
+
Z3 = Fp.mul(t2, t1);
|
|
795
|
+
Z3 = Fp.add(Z3, Z3); // step 30
|
|
796
|
+
Z3 = Fp.add(Z3, Z3);
|
|
797
|
+
return new Point(X3, Y3, Z3);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// Renes-Costello-Batina exception-free addition formula.
|
|
801
|
+
// There is 30% faster Jacobian formula, but it is not complete.
|
|
802
|
+
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
803
|
+
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
804
|
+
add(other: Point): Point {
|
|
805
|
+
aprjpoint(other);
|
|
806
|
+
const { X: X1, Y: Y1, Z: Z1 } = this;
|
|
807
|
+
const { X: X2, Y: Y2, Z: Z2 } = other;
|
|
808
|
+
let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore
|
|
809
|
+
const a = CURVE.a;
|
|
810
|
+
const b3 = Fp.mul(CURVE.b, _3n);
|
|
811
|
+
let t0 = Fp.mul(X1, X2); // step 1
|
|
812
|
+
let t1 = Fp.mul(Y1, Y2);
|
|
813
|
+
let t2 = Fp.mul(Z1, Z2);
|
|
814
|
+
let t3 = Fp.add(X1, Y1);
|
|
815
|
+
let t4 = Fp.add(X2, Y2); // step 5
|
|
816
|
+
t3 = Fp.mul(t3, t4);
|
|
817
|
+
t4 = Fp.add(t0, t1);
|
|
818
|
+
t3 = Fp.sub(t3, t4);
|
|
819
|
+
t4 = Fp.add(X1, Z1);
|
|
820
|
+
let t5 = Fp.add(X2, Z2); // step 10
|
|
821
|
+
t4 = Fp.mul(t4, t5);
|
|
822
|
+
t5 = Fp.add(t0, t2);
|
|
823
|
+
t4 = Fp.sub(t4, t5);
|
|
824
|
+
t5 = Fp.add(Y1, Z1);
|
|
825
|
+
X3 = Fp.add(Y2, Z2); // step 15
|
|
826
|
+
t5 = Fp.mul(t5, X3);
|
|
827
|
+
X3 = Fp.add(t1, t2);
|
|
828
|
+
t5 = Fp.sub(t5, X3);
|
|
829
|
+
Z3 = Fp.mul(a, t4);
|
|
830
|
+
X3 = Fp.mul(b3, t2); // step 20
|
|
831
|
+
Z3 = Fp.add(X3, Z3);
|
|
832
|
+
X3 = Fp.sub(t1, Z3);
|
|
833
|
+
Z3 = Fp.add(t1, Z3);
|
|
834
|
+
Y3 = Fp.mul(X3, Z3);
|
|
835
|
+
t1 = Fp.add(t0, t0); // step 25
|
|
836
|
+
t1 = Fp.add(t1, t0);
|
|
837
|
+
t2 = Fp.mul(a, t2);
|
|
838
|
+
t4 = Fp.mul(b3, t4);
|
|
839
|
+
t1 = Fp.add(t1, t2);
|
|
840
|
+
t2 = Fp.sub(t0, t2); // step 30
|
|
841
|
+
t2 = Fp.mul(a, t2);
|
|
842
|
+
t4 = Fp.add(t4, t2);
|
|
843
|
+
t0 = Fp.mul(t1, t4);
|
|
844
|
+
Y3 = Fp.add(Y3, t0);
|
|
845
|
+
t0 = Fp.mul(t5, t4); // step 35
|
|
846
|
+
X3 = Fp.mul(t3, X3);
|
|
847
|
+
X3 = Fp.sub(X3, t0);
|
|
848
|
+
t0 = Fp.mul(t3, t1);
|
|
849
|
+
Z3 = Fp.mul(t5, Z3);
|
|
850
|
+
Z3 = Fp.add(Z3, t0); // step 40
|
|
851
|
+
return new Point(X3, Y3, Z3);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
subtract(other: Point) {
|
|
855
|
+
return this.add(other.negate());
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
is0(): boolean {
|
|
859
|
+
return this.equals(Point.ZERO);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Constant time multiplication.
|
|
864
|
+
* Uses wNAF method. Windowed method may be 10% faster,
|
|
865
|
+
* but takes 2x longer to generate and consumes 2x memory.
|
|
866
|
+
* Uses precomputes when available.
|
|
867
|
+
* Uses endomorphism for Koblitz curves.
|
|
868
|
+
* @param scalar by which the point would be multiplied
|
|
869
|
+
* @returns New point
|
|
870
|
+
*/
|
|
871
|
+
multiply(scalar: bigint): Point {
|
|
872
|
+
const { endo } = extraOpts;
|
|
873
|
+
if (!Fn.isValidNot0(scalar)) throw new Error('invalid scalar: out of range'); // 0 is invalid
|
|
874
|
+
let point: Point, fake: Point; // Fake point is used to const-time mult
|
|
875
|
+
const mul = (n: bigint) => wnaf.cached(this, n, (p) => normalizeZ(Point, p));
|
|
876
|
+
/** See docs for {@link EndomorphismOpts} */
|
|
877
|
+
if (endo) {
|
|
878
|
+
const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(scalar);
|
|
879
|
+
const { p: k1p, f: k1f } = mul(k1);
|
|
880
|
+
const { p: k2p, f: k2f } = mul(k2);
|
|
881
|
+
fake = k1f.add(k2f);
|
|
882
|
+
point = finishEndo(endo.beta, k1p, k2p, k1neg, k2neg);
|
|
883
|
+
} else {
|
|
884
|
+
const { p, f } = mul(scalar);
|
|
885
|
+
point = p;
|
|
886
|
+
fake = f;
|
|
887
|
+
}
|
|
888
|
+
// Normalize `z` for both points, but return only real one
|
|
889
|
+
return normalizeZ(Point, [point, fake])[0];
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
894
|
+
* It's faster, but should only be used when you don't care about
|
|
895
|
+
* an exposed secret key e.g. sig verification, which works over *public* keys.
|
|
896
|
+
*/
|
|
897
|
+
multiplyUnsafe(sc: bigint): Point {
|
|
898
|
+
const { endo } = extraOpts;
|
|
899
|
+
const p = this as Point;
|
|
900
|
+
if (!Fn.isValid(sc)) throw new Error('invalid scalar: out of range'); // 0 is valid
|
|
901
|
+
if (sc === _0n || p.is0()) return Point.ZERO;
|
|
902
|
+
if (sc === _1n) return p; // fast-path
|
|
903
|
+
if (wnaf.hasCache(this)) return this.multiply(sc);
|
|
904
|
+
if (endo) {
|
|
905
|
+
const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc);
|
|
906
|
+
const { p1, p2 } = mulEndoUnsafe(Point, p, k1, k2); // 30% faster vs wnaf.unsafe
|
|
907
|
+
return finishEndo(endo.beta, p1, p2, k1neg, k2neg);
|
|
908
|
+
} else {
|
|
909
|
+
return wnaf.unsafe(p, sc);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
multiplyAndAddUnsafe(Q: Point, a: bigint, b: bigint): Point | undefined {
|
|
914
|
+
const sum = this.multiplyUnsafe(a).add(Q.multiplyUnsafe(b));
|
|
915
|
+
return sum.is0() ? undefined : sum;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Converts Projective point to affine (x, y) coordinates.
|
|
920
|
+
* @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
|
|
921
|
+
*/
|
|
922
|
+
toAffine(invertedZ?: T): AffinePoint<T> {
|
|
923
|
+
return toAffineMemo(this, invertedZ);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Checks whether Point is free of torsion elements (is in prime subgroup).
|
|
928
|
+
* Always torsion-free for cofactor=1 curves.
|
|
929
|
+
*/
|
|
930
|
+
isTorsionFree(): boolean {
|
|
931
|
+
const { isTorsionFree } = extraOpts;
|
|
932
|
+
if (cofactor === _1n) return true;
|
|
933
|
+
if (isTorsionFree) return isTorsionFree(Point, this);
|
|
934
|
+
return wnaf.unsafe(this, CURVE_ORDER).is0();
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
clearCofactor(): Point {
|
|
938
|
+
const { clearCofactor } = extraOpts;
|
|
939
|
+
if (cofactor === _1n) return this; // Fast-path
|
|
940
|
+
if (clearCofactor) return clearCofactor(Point, this) as Point;
|
|
941
|
+
return this.multiplyUnsafe(cofactor);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
isSmallOrder(): boolean {
|
|
945
|
+
// can we use this.clearCofactor()?
|
|
946
|
+
return this.multiplyUnsafe(cofactor).is0();
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
toBytes(isCompressed = true): Uint8Array {
|
|
950
|
+
abool(isCompressed, 'isCompressed');
|
|
951
|
+
this.assertValidity();
|
|
952
|
+
return encodePoint(Point, this, isCompressed);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
toHex(isCompressed = true): string {
|
|
956
|
+
return bytesToHex(this.toBytes(isCompressed));
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
toString() {
|
|
960
|
+
return `<Point ${this.is0() ? 'ZERO' : this.toHex()}>`;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// TODO: remove
|
|
964
|
+
get px(): T {
|
|
965
|
+
return this.X;
|
|
966
|
+
}
|
|
967
|
+
get py(): T {
|
|
968
|
+
return this.X;
|
|
969
|
+
}
|
|
970
|
+
get pz(): T {
|
|
971
|
+
return this.Z;
|
|
972
|
+
}
|
|
973
|
+
toRawBytes(isCompressed = true): Uint8Array {
|
|
974
|
+
return this.toBytes(isCompressed);
|
|
975
|
+
}
|
|
976
|
+
_setWindowSize(windowSize: number) {
|
|
977
|
+
this.precompute(windowSize);
|
|
978
|
+
}
|
|
979
|
+
static normalizeZ(points: Point[]): Point[] {
|
|
980
|
+
return normalizeZ(Point, points);
|
|
981
|
+
}
|
|
982
|
+
static msm(points: Point[], scalars: bigint[]): Point {
|
|
983
|
+
return pippenger(Point, Fn, points, scalars);
|
|
984
|
+
}
|
|
985
|
+
static fromPrivateKey(privateKey: PrivKey) {
|
|
986
|
+
return Point.BASE.multiply(_normFnElement(Fn, privateKey));
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
const bits = Fn.BITS;
|
|
990
|
+
const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits);
|
|
991
|
+
Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms.
|
|
992
|
+
return Point;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/** Methods of ECDSA signature instance. */
|
|
996
|
+
export interface ECDSASignature {
|
|
997
|
+
readonly r: bigint;
|
|
998
|
+
readonly s: bigint;
|
|
999
|
+
readonly recovery?: number;
|
|
1000
|
+
addRecoveryBit(recovery: number): ECDSASigRecovered;
|
|
1001
|
+
hasHighS(): boolean;
|
|
1002
|
+
toBytes(format?: string): Uint8Array;
|
|
1003
|
+
toHex(format?: string): string;
|
|
1004
|
+
|
|
1005
|
+
/** @deprecated */
|
|
1006
|
+
assertValidity(): void;
|
|
1007
|
+
/** @deprecated */
|
|
1008
|
+
normalizeS(): ECDSASignature;
|
|
1009
|
+
/** @deprecated use standalone method `curve.recoverPublicKey(sig.toBytes('recovered'), msg)` */
|
|
1010
|
+
recoverPublicKey(msgHash: Hex): WeierstrassPoint<bigint>;
|
|
1011
|
+
/** @deprecated use `.toBytes('compact')` */
|
|
1012
|
+
toCompactRawBytes(): Uint8Array;
|
|
1013
|
+
/** @deprecated use `.toBytes('compact')` */
|
|
1014
|
+
toCompactHex(): string;
|
|
1015
|
+
/** @deprecated use `.toBytes('der')` */
|
|
1016
|
+
toDERRawBytes(): Uint8Array;
|
|
1017
|
+
/** @deprecated use `.toBytes('der')` */
|
|
1018
|
+
toDERHex(): string;
|
|
1019
|
+
}
|
|
1020
|
+
export type ECDSASigRecovered = ECDSASignature & {
|
|
1021
|
+
readonly recovery: number;
|
|
1022
|
+
};
|
|
1023
|
+
/** Methods of ECDSA signature constructor. */
|
|
1024
|
+
export type ECDSASignatureCons = {
|
|
1025
|
+
new (r: bigint, s: bigint, recovery?: number): ECDSASignature;
|
|
1026
|
+
fromBytes(bytes: Uint8Array, format?: ECDSASigFormat): ECDSASignature;
|
|
1027
|
+
fromHex(hex: string, format?: ECDSASigFormat): ECDSASignature;
|
|
1028
|
+
|
|
1029
|
+
/** @deprecated use `.fromBytes(bytes, 'compact')` */
|
|
1030
|
+
fromCompact(hex: Hex): ECDSASignature;
|
|
1031
|
+
/** @deprecated use `.fromBytes(bytes, 'der')` */
|
|
1032
|
+
fromDER(hex: Hex): ECDSASignature;
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
// Points start with byte 0x02 when y is even; otherwise 0x03
|
|
1036
|
+
function pprefix(hasEvenY: boolean): Uint8Array {
|
|
1037
|
+
return Uint8Array.of(hasEvenY ? 0x02 : 0x03);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Implementation of the Shallue and van de Woestijne method for any weierstrass curve.
|
|
1042
|
+
* TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.
|
|
1043
|
+
* b = True and y = sqrt(u / v) if (u / v) is square in F, and
|
|
1044
|
+
* b = False and y = sqrt(Z * (u / v)) otherwise.
|
|
1045
|
+
* @param Fp
|
|
1046
|
+
* @param Z
|
|
1047
|
+
* @returns
|
|
1048
|
+
*/
|
|
1049
|
+
export function SWUFpSqrtRatio<T>(
|
|
1050
|
+
Fp: IField<T>,
|
|
1051
|
+
Z: T
|
|
1052
|
+
): (u: T, v: T) => { isValid: boolean; value: T } {
|
|
1053
|
+
// Generic implementation
|
|
1054
|
+
const q = Fp.ORDER;
|
|
1055
|
+
let l = _0n;
|
|
1056
|
+
for (let o = q - _1n; o % _2n === _0n; o /= _2n) l += _1n;
|
|
1057
|
+
const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.
|
|
1058
|
+
// We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.
|
|
1059
|
+
// 2n ** c1 == 2n << (c1-1)
|
|
1060
|
+
const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);
|
|
1061
|
+
const _2n_pow_c1 = _2n_pow_c1_1 * _2n;
|
|
1062
|
+
const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic
|
|
1063
|
+
const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic
|
|
1064
|
+
const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic
|
|
1065
|
+
const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic
|
|
1066
|
+
const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2
|
|
1067
|
+
const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)
|
|
1068
|
+
let sqrtRatio = (u: T, v: T): { isValid: boolean; value: T } => {
|
|
1069
|
+
let tv1 = c6; // 1. tv1 = c6
|
|
1070
|
+
let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4
|
|
1071
|
+
let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2
|
|
1072
|
+
tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v
|
|
1073
|
+
let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3
|
|
1074
|
+
tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3
|
|
1075
|
+
tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2
|
|
1076
|
+
tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v
|
|
1077
|
+
tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u
|
|
1078
|
+
let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2
|
|
1079
|
+
tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5
|
|
1080
|
+
let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1
|
|
1081
|
+
tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7
|
|
1082
|
+
tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1
|
|
1083
|
+
tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)
|
|
1084
|
+
tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)
|
|
1085
|
+
// 17. for i in (c1, c1 - 1, ..., 2):
|
|
1086
|
+
for (let i = c1; i > _1n; i--) {
|
|
1087
|
+
let tv5 = i - _2n; // 18. tv5 = i - 2
|
|
1088
|
+
tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5
|
|
1089
|
+
let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5
|
|
1090
|
+
const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1
|
|
1091
|
+
tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1
|
|
1092
|
+
tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1
|
|
1093
|
+
tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1
|
|
1094
|
+
tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)
|
|
1095
|
+
tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)
|
|
1096
|
+
}
|
|
1097
|
+
return { isValid: isQR, value: tv3 };
|
|
1098
|
+
};
|
|
1099
|
+
if (Fp.ORDER % _4n === _3n) {
|
|
1100
|
+
// sqrt_ratio_3mod4(u, v)
|
|
1101
|
+
const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic
|
|
1102
|
+
const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)
|
|
1103
|
+
sqrtRatio = (u: T, v: T) => {
|
|
1104
|
+
let tv1 = Fp.sqr(v); // 1. tv1 = v^2
|
|
1105
|
+
const tv2 = Fp.mul(u, v); // 2. tv2 = u * v
|
|
1106
|
+
tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2
|
|
1107
|
+
let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1
|
|
1108
|
+
y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2
|
|
1109
|
+
const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2
|
|
1110
|
+
const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v
|
|
1111
|
+
const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u
|
|
1112
|
+
let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)
|
|
1113
|
+
return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
// No curves uses that
|
|
1117
|
+
// if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8
|
|
1118
|
+
return sqrtRatio;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Simplified Shallue-van de Woestijne-Ulas Method
|
|
1122
|
+
* https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2
|
|
1123
|
+
*/
|
|
1124
|
+
export function mapToCurveSimpleSWU<T>(
|
|
1125
|
+
Fp: IField<T>,
|
|
1126
|
+
opts: {
|
|
1127
|
+
A: T;
|
|
1128
|
+
B: T;
|
|
1129
|
+
Z: T;
|
|
1130
|
+
}
|
|
1131
|
+
): (u: T) => { x: T; y: T } {
|
|
1132
|
+
validateField(Fp);
|
|
1133
|
+
const { A, B, Z } = opts;
|
|
1134
|
+
if (!Fp.isValid(A) || !Fp.isValid(B) || !Fp.isValid(Z))
|
|
1135
|
+
throw new Error('mapToCurveSimpleSWU: invalid opts');
|
|
1136
|
+
const sqrtRatio = SWUFpSqrtRatio(Fp, Z);
|
|
1137
|
+
if (!Fp.isOdd) throw new Error('Field does not have .isOdd()');
|
|
1138
|
+
// Input: u, an element of F.
|
|
1139
|
+
// Output: (x, y), a point on E.
|
|
1140
|
+
return (u: T): { x: T; y: T } => {
|
|
1141
|
+
// prettier-ignore
|
|
1142
|
+
let tv1, tv2, tv3, tv4, tv5, tv6, x, y;
|
|
1143
|
+
tv1 = Fp.sqr(u); // 1. tv1 = u^2
|
|
1144
|
+
tv1 = Fp.mul(tv1, Z); // 2. tv1 = Z * tv1
|
|
1145
|
+
tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2
|
|
1146
|
+
tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1
|
|
1147
|
+
tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1
|
|
1148
|
+
tv3 = Fp.mul(tv3, B); // 6. tv3 = B * tv3
|
|
1149
|
+
tv4 = Fp.cmov(Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)
|
|
1150
|
+
tv4 = Fp.mul(tv4, A); // 8. tv4 = A * tv4
|
|
1151
|
+
tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2
|
|
1152
|
+
tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2
|
|
1153
|
+
tv5 = Fp.mul(tv6, A); // 11. tv5 = A * tv6
|
|
1154
|
+
tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5
|
|
1155
|
+
tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3
|
|
1156
|
+
tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4
|
|
1157
|
+
tv5 = Fp.mul(tv6, B); // 15. tv5 = B * tv6
|
|
1158
|
+
tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5
|
|
1159
|
+
x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3
|
|
1160
|
+
const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)
|
|
1161
|
+
y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1
|
|
1162
|
+
y = Fp.mul(y, value); // 20. y = y * y1
|
|
1163
|
+
x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)
|
|
1164
|
+
y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)
|
|
1165
|
+
const e1 = Fp.isOdd!(u) === Fp.isOdd!(y); // 23. e1 = sgn0(u) == sgn0(y)
|
|
1166
|
+
y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)
|
|
1167
|
+
const tv4_inv = FpInvertBatch(Fp, [tv4], true)[0];
|
|
1168
|
+
x = Fp.mul(x, tv4_inv); // 25. x = x / tv4
|
|
1169
|
+
return { x, y };
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
function getWLengths<T>(Fp: IField<T>, Fn: IField<bigint>) {
|
|
1174
|
+
return {
|
|
1175
|
+
secretKey: Fn.BYTES,
|
|
1176
|
+
publicKey: 1 + Fp.BYTES,
|
|
1177
|
+
publicKeyUncompressed: 1 + 2 * Fp.BYTES,
|
|
1178
|
+
publicKeyHasPrefix: true,
|
|
1179
|
+
signature: 2 * Fn.BYTES,
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* Sometimes users only need getPublicKey, getSharedSecret, and secret key handling.
|
|
1185
|
+
* This helper ensures no signature functionality is present. Less code, smaller bundle size.
|
|
1186
|
+
*/
|
|
1187
|
+
export function ecdh(
|
|
1188
|
+
Point: WeierstrassPointCons<bigint>,
|
|
1189
|
+
ecdhOpts: { randomBytes?: (bytesLength?: number) => Uint8Array } = {}
|
|
1190
|
+
): ECDH {
|
|
1191
|
+
const { Fn } = Point;
|
|
1192
|
+
const randomBytes_ = ecdhOpts.randomBytes || randomBytesWeb;
|
|
1193
|
+
const lengths = Object.assign(getWLengths(Point.Fp, Fn), { seed: getMinHashLength(Fn.ORDER) });
|
|
1194
|
+
|
|
1195
|
+
function isValidSecretKey(secretKey: PrivKey) {
|
|
1196
|
+
try {
|
|
1197
|
+
return !!_normFnElement(Fn, secretKey);
|
|
1198
|
+
} catch (error) {
|
|
1199
|
+
return false;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
function isValidPublicKey(publicKey: Uint8Array, isCompressed?: boolean): boolean {
|
|
1204
|
+
const { publicKey: comp, publicKeyUncompressed } = lengths;
|
|
1205
|
+
try {
|
|
1206
|
+
const l = publicKey.length;
|
|
1207
|
+
if (isCompressed === true && l !== comp) return false;
|
|
1208
|
+
if (isCompressed === false && l !== publicKeyUncompressed) return false;
|
|
1209
|
+
return !!Point.fromBytes(publicKey);
|
|
1210
|
+
} catch (error) {
|
|
1211
|
+
return false;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Produces cryptographically secure secret key from random of size
|
|
1217
|
+
* (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
|
|
1218
|
+
*/
|
|
1219
|
+
function randomSecretKey(seed = randomBytes_(lengths.seed)): Uint8Array {
|
|
1220
|
+
return mapHashToField(abytes(seed, lengths.seed, 'seed'), Fn.ORDER);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Computes public key for a secret key. Checks for validity of the secret key.
|
|
1225
|
+
* @param isCompressed whether to return compact (default), or full key
|
|
1226
|
+
* @returns Public key, full when isCompressed=false; short when isCompressed=true
|
|
1227
|
+
*/
|
|
1228
|
+
function getPublicKey(secretKey: PrivKey, isCompressed = true): Uint8Array {
|
|
1229
|
+
return Point.BASE.multiply(_normFnElement(Fn, secretKey)).toBytes(isCompressed);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
function keygen(seed?: Uint8Array) {
|
|
1233
|
+
const secretKey = randomSecretKey(seed);
|
|
1234
|
+
return { secretKey, publicKey: getPublicKey(secretKey) };
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* Quick and dirty check for item being public key. Does not validate hex, or being on-curve.
|
|
1239
|
+
*/
|
|
1240
|
+
function isProbPub(item: PrivKey | PubKey): boolean | undefined {
|
|
1241
|
+
if (typeof item === 'bigint') return false;
|
|
1242
|
+
if (item instanceof Point) return true;
|
|
1243
|
+
const { secretKey, publicKey, publicKeyUncompressed } = lengths;
|
|
1244
|
+
if (Fn.allowedLengths || secretKey === publicKey) return undefined;
|
|
1245
|
+
const l = ensureBytes('key', item).length;
|
|
1246
|
+
return l === publicKey || l === publicKeyUncompressed;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* ECDH (Elliptic Curve Diffie Hellman).
|
|
1251
|
+
* Computes shared public key from secret key A and public key B.
|
|
1252
|
+
* Checks: 1) secret key validity 2) shared key is on-curve.
|
|
1253
|
+
* Does NOT hash the result.
|
|
1254
|
+
* @param isCompressed whether to return compact (default), or full key
|
|
1255
|
+
* @returns shared public key
|
|
1256
|
+
*/
|
|
1257
|
+
function getSharedSecret(secretKeyA: PrivKey, publicKeyB: Hex, isCompressed = true): Uint8Array {
|
|
1258
|
+
if (isProbPub(secretKeyA) === true) throw new Error('first arg must be private key');
|
|
1259
|
+
if (isProbPub(publicKeyB) === false) throw new Error('second arg must be public key');
|
|
1260
|
+
const s = _normFnElement(Fn, secretKeyA);
|
|
1261
|
+
const b = Point.fromHex(publicKeyB); // checks for being on-curve
|
|
1262
|
+
return b.multiply(s).toBytes(isCompressed);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
const utils = {
|
|
1266
|
+
isValidSecretKey,
|
|
1267
|
+
isValidPublicKey,
|
|
1268
|
+
randomSecretKey,
|
|
1269
|
+
|
|
1270
|
+
// TODO: remove
|
|
1271
|
+
isValidPrivateKey: isValidSecretKey,
|
|
1272
|
+
randomPrivateKey: randomSecretKey,
|
|
1273
|
+
normPrivateKeyToScalar: (key: PrivKey) => _normFnElement(Fn, key),
|
|
1274
|
+
precompute(windowSize = 8, point = Point.BASE): WeierstrassPoint<bigint> {
|
|
1275
|
+
return point.precompute(windowSize, false);
|
|
1276
|
+
},
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths });
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function.
|
|
1284
|
+
* We need `hash` for 2 features:
|
|
1285
|
+
* 1. Message prehash-ing. NOT used if `sign` / `verify` are called with `prehash: false`
|
|
1286
|
+
* 2. k generation in `sign`, using HMAC-drbg(hash)
|
|
1287
|
+
*
|
|
1288
|
+
* ECDSAOpts are only rarely needed.
|
|
1289
|
+
*
|
|
1290
|
+
* @example
|
|
1291
|
+
* ```js
|
|
1292
|
+
* const p256_Point = weierstrass(...);
|
|
1293
|
+
* const p256_sha256 = ecdsa(p256_Point, sha256);
|
|
1294
|
+
* const p256_sha224 = ecdsa(p256_Point, sha224);
|
|
1295
|
+
* const p256_sha224_r = ecdsa(p256_Point, sha224, { randomBytes: (length) => { ... } });
|
|
1296
|
+
* ```
|
|
1297
|
+
*/
|
|
1298
|
+
export function ecdsa(
|
|
1299
|
+
Point: WeierstrassPointCons<bigint>,
|
|
1300
|
+
hash: CHash,
|
|
1301
|
+
ecdsaOpts: ECDSAOpts = {}
|
|
1302
|
+
): ECDSA {
|
|
1303
|
+
ahash(hash);
|
|
1304
|
+
_validateObject(
|
|
1305
|
+
ecdsaOpts,
|
|
1306
|
+
{},
|
|
1307
|
+
{
|
|
1308
|
+
hmac: 'function',
|
|
1309
|
+
lowS: 'boolean',
|
|
1310
|
+
randomBytes: 'function',
|
|
1311
|
+
bits2int: 'function',
|
|
1312
|
+
bits2int_modN: 'function',
|
|
1313
|
+
}
|
|
1314
|
+
);
|
|
1315
|
+
|
|
1316
|
+
const randomBytes = ecdsaOpts.randomBytes || randomBytesWeb;
|
|
1317
|
+
const hmac: HmacFnSync =
|
|
1318
|
+
ecdsaOpts.hmac ||
|
|
1319
|
+
(((key, ...msgs) => nobleHmac(hash, key, concatBytes(...msgs))) satisfies HmacFnSync);
|
|
1320
|
+
|
|
1321
|
+
const { Fp, Fn } = Point;
|
|
1322
|
+
const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;
|
|
1323
|
+
const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts);
|
|
1324
|
+
const defaultSigOpts: Required<ECDSASignOpts> = {
|
|
1325
|
+
prehash: false,
|
|
1326
|
+
lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS : false,
|
|
1327
|
+
format: undefined as any, //'compact' as ECDSASigFormat,
|
|
1328
|
+
extraEntropy: false,
|
|
1329
|
+
};
|
|
1330
|
+
const defaultSigOpts_format = 'compact';
|
|
1331
|
+
|
|
1332
|
+
function isBiggerThanHalfOrder(number: bigint) {
|
|
1333
|
+
const HALF = CURVE_ORDER >> _1n;
|
|
1334
|
+
return number > HALF;
|
|
1335
|
+
}
|
|
1336
|
+
function validateRS(title: string, num: bigint): bigint {
|
|
1337
|
+
if (!Fn.isValidNot0(num))
|
|
1338
|
+
throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);
|
|
1339
|
+
return num;
|
|
1340
|
+
}
|
|
1341
|
+
function validateSigLength(bytes: Uint8Array, format: ECDSASigFormat) {
|
|
1342
|
+
validateSigFormat(format);
|
|
1343
|
+
const size = lengths.signature!;
|
|
1344
|
+
const sizer = format === 'compact' ? size : format === 'recovered' ? size + 1 : undefined;
|
|
1345
|
+
return abytes(bytes, sizer, `${format} signature`);
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* ECDSA signature with its (r, s) properties. Supports compact, recovered & DER representations.
|
|
1350
|
+
*/
|
|
1351
|
+
class Signature implements ECDSASignature {
|
|
1352
|
+
readonly r: bigint;
|
|
1353
|
+
readonly s: bigint;
|
|
1354
|
+
readonly recovery?: number;
|
|
1355
|
+
constructor(r: bigint, s: bigint, recovery?: number) {
|
|
1356
|
+
this.r = validateRS('r', r); // r in [1..N-1];
|
|
1357
|
+
this.s = validateRS('s', s); // s in [1..N-1];
|
|
1358
|
+
if (recovery != null) this.recovery = recovery;
|
|
1359
|
+
Object.freeze(this);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
static fromBytes(bytes: Uint8Array, format: ECDSASigFormat = defaultSigOpts_format): Signature {
|
|
1363
|
+
validateSigLength(bytes, format);
|
|
1364
|
+
let recid: number | undefined;
|
|
1365
|
+
if (format === 'der') {
|
|
1366
|
+
const { r, s } = DER.toSig(abytes(bytes));
|
|
1367
|
+
return new Signature(r, s);
|
|
1368
|
+
}
|
|
1369
|
+
if (format === 'recovered') {
|
|
1370
|
+
recid = bytes[0];
|
|
1371
|
+
format = 'compact';
|
|
1372
|
+
bytes = bytes.subarray(1);
|
|
1373
|
+
}
|
|
1374
|
+
const L = Fn.BYTES;
|
|
1375
|
+
const r = bytes.subarray(0, L);
|
|
1376
|
+
const s = bytes.subarray(L, L * 2);
|
|
1377
|
+
return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
static fromHex(hex: string, format?: ECDSASigFormat) {
|
|
1381
|
+
return this.fromBytes(hexToBytes(hex), format);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
addRecoveryBit(recovery: number): RecoveredSignature {
|
|
1385
|
+
return new Signature(this.r, this.s, recovery) as RecoveredSignature;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
recoverPublicKey(messageHash: Hex): WeierstrassPoint<bigint> {
|
|
1389
|
+
const FIELD_ORDER = Fp.ORDER;
|
|
1390
|
+
const { r, s, recovery: rec } = this;
|
|
1391
|
+
if (rec == null || ![0, 1, 2, 3].includes(rec)) throw new Error('recovery id invalid');
|
|
1392
|
+
|
|
1393
|
+
// ECDSA recovery is hard for cofactor > 1 curves.
|
|
1394
|
+
// In sign, `r = q.x mod n`, and here we recover q.x from r.
|
|
1395
|
+
// While recovering q.x >= n, we need to add r+n for cofactor=1 curves.
|
|
1396
|
+
// However, for cofactor>1, r+n may not get q.x:
|
|
1397
|
+
// r+n*i would need to be done instead where i is unknown.
|
|
1398
|
+
// To easily get i, we either need to:
|
|
1399
|
+
// a. increase amount of valid recid values (4, 5...); OR
|
|
1400
|
+
// b. prohibit non-prime-order signatures (recid > 1).
|
|
1401
|
+
const hasCofactor = CURVE_ORDER * _2n < FIELD_ORDER;
|
|
1402
|
+
if (hasCofactor && rec > 1) throw new Error('recovery id is ambiguous for h>1 curve');
|
|
1403
|
+
|
|
1404
|
+
const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;
|
|
1405
|
+
if (!Fp.isValid(radj)) throw new Error('recovery id 2 or 3 invalid');
|
|
1406
|
+
const x = Fp.toBytes(radj);
|
|
1407
|
+
const R = Point.fromBytes(concatBytes(pprefix((rec & 1) === 0), x));
|
|
1408
|
+
const ir = Fn.inv(radj); // r^-1
|
|
1409
|
+
const h = bits2int_modN(ensureBytes('msgHash', messageHash)); // Truncate hash
|
|
1410
|
+
const u1 = Fn.create(-h * ir); // -hr^-1
|
|
1411
|
+
const u2 = Fn.create(s * ir); // sr^-1
|
|
1412
|
+
// (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1). unsafe is fine: there is no private data.
|
|
1413
|
+
const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2));
|
|
1414
|
+
if (Q.is0()) throw new Error('point at infinify');
|
|
1415
|
+
Q.assertValidity();
|
|
1416
|
+
return Q;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
// Signatures should be low-s, to prevent malleability.
|
|
1420
|
+
hasHighS(): boolean {
|
|
1421
|
+
return isBiggerThanHalfOrder(this.s);
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
toBytes(format: ECDSASigFormat = defaultSigOpts_format) {
|
|
1425
|
+
validateSigFormat(format);
|
|
1426
|
+
if (format === 'der') return hexToBytes(DER.hexFromSig(this));
|
|
1427
|
+
const r = Fn.toBytes(this.r);
|
|
1428
|
+
const s = Fn.toBytes(this.s);
|
|
1429
|
+
if (format === 'recovered') {
|
|
1430
|
+
if (this.recovery == null) throw new Error('recovery bit must be present');
|
|
1431
|
+
return concatBytes(Uint8Array.of(this.recovery), r, s);
|
|
1432
|
+
}
|
|
1433
|
+
return concatBytes(r, s);
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
toHex(format?: ECDSASigFormat) {
|
|
1437
|
+
return bytesToHex(this.toBytes(format));
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
// TODO: remove
|
|
1441
|
+
assertValidity(): void {}
|
|
1442
|
+
static fromCompact(hex: Hex) {
|
|
1443
|
+
return Signature.fromBytes(ensureBytes('sig', hex), 'compact');
|
|
1444
|
+
}
|
|
1445
|
+
static fromDER(hex: Hex) {
|
|
1446
|
+
return Signature.fromBytes(ensureBytes('sig', hex), 'der');
|
|
1447
|
+
}
|
|
1448
|
+
normalizeS() {
|
|
1449
|
+
return this.hasHighS() ? new Signature(this.r, Fn.neg(this.s), this.recovery) : this;
|
|
1450
|
+
}
|
|
1451
|
+
toDERRawBytes() {
|
|
1452
|
+
return this.toBytes('der');
|
|
1453
|
+
}
|
|
1454
|
+
toDERHex() {
|
|
1455
|
+
return bytesToHex(this.toBytes('der'));
|
|
1456
|
+
}
|
|
1457
|
+
toCompactRawBytes() {
|
|
1458
|
+
return this.toBytes('compact');
|
|
1459
|
+
}
|
|
1460
|
+
toCompactHex() {
|
|
1461
|
+
return bytesToHex(this.toBytes('compact'));
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
type RecoveredSignature = Signature & { recovery: number };
|
|
1465
|
+
|
|
1466
|
+
// RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.
|
|
1467
|
+
// FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.
|
|
1468
|
+
// bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.
|
|
1469
|
+
// int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors
|
|
1470
|
+
const bits2int =
|
|
1471
|
+
ecdsaOpts.bits2int ||
|
|
1472
|
+
function bits2int_def(bytes: Uint8Array): bigint {
|
|
1473
|
+
// Our custom check "just in case", for protection against DoS
|
|
1474
|
+
if (bytes.length > 8192) throw new Error('input is too large');
|
|
1475
|
+
// For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)
|
|
1476
|
+
// for some cases, since bytes.length * 8 is not actual bitLength.
|
|
1477
|
+
const num = bytesToNumberBE(bytes); // check for == u8 done here
|
|
1478
|
+
const delta = bytes.length * 8 - fnBits; // truncate to nBitLength leftmost bits
|
|
1479
|
+
return delta > 0 ? num >> BigInt(delta) : num;
|
|
1480
|
+
};
|
|
1481
|
+
const bits2int_modN =
|
|
1482
|
+
ecdsaOpts.bits2int_modN ||
|
|
1483
|
+
function bits2int_modN_def(bytes: Uint8Array): bigint {
|
|
1484
|
+
return Fn.create(bits2int(bytes)); // can't use bytesToNumberBE here
|
|
1485
|
+
};
|
|
1486
|
+
// Pads output with zero as per spec
|
|
1487
|
+
const ORDER_MASK = bitMask(fnBits);
|
|
1488
|
+
/** Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. */
|
|
1489
|
+
function int2octets(num: bigint): Uint8Array {
|
|
1490
|
+
// IMPORTANT: the check ensures working for case `Fn.BYTES != Fn.BITS * 8`
|
|
1491
|
+
aInRange('num < 2^' + fnBits, num, _0n, ORDER_MASK);
|
|
1492
|
+
return Fn.toBytes(num);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
function validateMsgAndHash(message: Uint8Array, prehash: boolean) {
|
|
1496
|
+
abytes(message, undefined, 'message');
|
|
1497
|
+
return prehash ? abytes(hash(message), undefined, 'prehashed message') : message;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Steps A, D of RFC6979 3.2.
|
|
1502
|
+
* Creates RFC6979 seed; converts msg/privKey to numbers.
|
|
1503
|
+
* Used only in sign, not in verify.
|
|
1504
|
+
*
|
|
1505
|
+
* Warning: we cannot assume here that message has same amount of bytes as curve order,
|
|
1506
|
+
* this will be invalid at least for P521. Also it can be bigger for P224 + SHA256.
|
|
1507
|
+
*/
|
|
1508
|
+
function prepSig(message: Uint8Array, privateKey: PrivKey, opts: ECDSASignOpts) {
|
|
1509
|
+
if (['recovered', 'canonical'].some((k) => k in opts))
|
|
1510
|
+
throw new Error('sign() legacy options not supported');
|
|
1511
|
+
const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts);
|
|
1512
|
+
message = validateMsgAndHash(message, prehash); // RFC6979 3.2 A: h1 = H(m)
|
|
1513
|
+
// We can't later call bits2octets, since nested bits2int is broken for curves
|
|
1514
|
+
// with fnBits % 8 !== 0. Because of that, we unwrap it here as int2octets call.
|
|
1515
|
+
// const bits2octets = (bits) => int2octets(bits2int_modN(bits))
|
|
1516
|
+
const h1int = bits2int_modN(message);
|
|
1517
|
+
const d = _normFnElement(Fn, privateKey); // validate secret key, convert to bigint
|
|
1518
|
+
const seedArgs = [int2octets(d), int2octets(h1int)];
|
|
1519
|
+
// extraEntropy. RFC6979 3.6: additional k' (optional).
|
|
1520
|
+
if (extraEntropy != null && extraEntropy !== false) {
|
|
1521
|
+
// K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')
|
|
1522
|
+
// gen random bytes OR pass as-is
|
|
1523
|
+
const e = extraEntropy === true ? randomBytes(lengths.secretKey) : extraEntropy;
|
|
1524
|
+
seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes
|
|
1525
|
+
}
|
|
1526
|
+
const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2
|
|
1527
|
+
const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!
|
|
1528
|
+
// Converts signature params into point w r/s, checks result for validity.
|
|
1529
|
+
// To transform k => Signature:
|
|
1530
|
+
// q = k⋅G
|
|
1531
|
+
// r = q.x mod n
|
|
1532
|
+
// s = k^-1(m + rd) mod n
|
|
1533
|
+
// Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to
|
|
1534
|
+
// https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:
|
|
1535
|
+
// a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT
|
|
1536
|
+
function k2sig(kBytes: Uint8Array): RecoveredSignature | undefined {
|
|
1537
|
+
// RFC 6979 Section 3.2, step 3: k = bits2int(T)
|
|
1538
|
+
// Important: all mod() calls here must be done over N
|
|
1539
|
+
const k = bits2int(kBytes); // mod n, not mod p
|
|
1540
|
+
if (!Fn.isValidNot0(k)) return; // Valid scalars (including k) must be in 1..N-1
|
|
1541
|
+
const ik = Fn.inv(k); // k^-1 mod n
|
|
1542
|
+
const q = Point.BASE.multiply(k).toAffine(); // q = k⋅G
|
|
1543
|
+
const r = Fn.create(q.x); // r = q.x mod n
|
|
1544
|
+
if (r === _0n) return;
|
|
1545
|
+
const s = Fn.create(ik * Fn.create(m + r * d)); // Not using blinding here, see comment above
|
|
1546
|
+
if (s === _0n) return;
|
|
1547
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)
|
|
1548
|
+
let normS = s;
|
|
1549
|
+
if (lowS && isBiggerThanHalfOrder(s)) {
|
|
1550
|
+
normS = Fn.neg(s); // if lowS was passed, ensure s is always
|
|
1551
|
+
recovery ^= 1; // // in the bottom half of N
|
|
1552
|
+
}
|
|
1553
|
+
return new Signature(r, normS, recovery) as RecoveredSignature; // use normS, not s
|
|
1554
|
+
}
|
|
1555
|
+
return { seed, k2sig };
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Signs message hash with a secret key.
|
|
1560
|
+
*
|
|
1561
|
+
* ```
|
|
1562
|
+
* sign(m, d) where
|
|
1563
|
+
* k = rfc6979_hmac_drbg(m, d)
|
|
1564
|
+
* (x, y) = G × k
|
|
1565
|
+
* r = x mod n
|
|
1566
|
+
* s = (m + dr) / k mod n
|
|
1567
|
+
* ```
|
|
1568
|
+
*/
|
|
1569
|
+
function sign(message: Hex, secretKey: PrivKey, opts: ECDSASignOpts = {}): RecoveredSignature {
|
|
1570
|
+
message = ensureBytes('message', message);
|
|
1571
|
+
const { seed, k2sig } = prepSig(message, secretKey, opts); // Steps A, D of RFC6979 3.2.
|
|
1572
|
+
const drbg = createHmacDrbg<RecoveredSignature>(hash.outputLen, Fn.BYTES, hmac);
|
|
1573
|
+
const sig = drbg(seed, k2sig); // Steps B, C, D, E, F, G
|
|
1574
|
+
return sig;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
function tryParsingSig(sg: Hex | SignatureLike) {
|
|
1578
|
+
// Try to deduce format
|
|
1579
|
+
let sig: Signature | undefined = undefined;
|
|
1580
|
+
const isHex = typeof sg === 'string' || isBytes(sg);
|
|
1581
|
+
const isObj =
|
|
1582
|
+
!isHex &&
|
|
1583
|
+
sg !== null &&
|
|
1584
|
+
typeof sg === 'object' &&
|
|
1585
|
+
typeof sg.r === 'bigint' &&
|
|
1586
|
+
typeof sg.s === 'bigint';
|
|
1587
|
+
if (!isHex && !isObj)
|
|
1588
|
+
throw new Error('invalid signature, expected Uint8Array, hex string or Signature instance');
|
|
1589
|
+
if (isObj) {
|
|
1590
|
+
sig = new Signature(sg.r, sg.s);
|
|
1591
|
+
} else if (isHex) {
|
|
1592
|
+
try {
|
|
1593
|
+
sig = Signature.fromBytes(ensureBytes('sig', sg), 'der');
|
|
1594
|
+
} catch (derError) {
|
|
1595
|
+
if (!(derError instanceof DER.Err)) throw derError;
|
|
1596
|
+
}
|
|
1597
|
+
if (!sig) {
|
|
1598
|
+
try {
|
|
1599
|
+
sig = Signature.fromBytes(ensureBytes('sig', sg), 'compact');
|
|
1600
|
+
} catch (error) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
if (!sig) return false;
|
|
1606
|
+
return sig;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* Verifies a signature against message and public key.
|
|
1611
|
+
* Rejects lowS signatures by default: see {@link ECDSAVerifyOpts}.
|
|
1612
|
+
* Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:
|
|
1613
|
+
*
|
|
1614
|
+
* ```
|
|
1615
|
+
* verify(r, s, h, P) where
|
|
1616
|
+
* u1 = hs^-1 mod n
|
|
1617
|
+
* u2 = rs^-1 mod n
|
|
1618
|
+
* R = u1⋅G + u2⋅P
|
|
1619
|
+
* mod(R.x, n) == r
|
|
1620
|
+
* ```
|
|
1621
|
+
*/
|
|
1622
|
+
function verify(
|
|
1623
|
+
signature: Hex | SignatureLike,
|
|
1624
|
+
message: Hex,
|
|
1625
|
+
publicKey: Hex,
|
|
1626
|
+
opts: ECDSAVerifyOpts = {}
|
|
1627
|
+
): boolean {
|
|
1628
|
+
const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts);
|
|
1629
|
+
publicKey = ensureBytes('publicKey', publicKey);
|
|
1630
|
+
message = validateMsgAndHash(ensureBytes('message', message), prehash);
|
|
1631
|
+
if ('strict' in opts) throw new Error('options.strict was renamed to lowS');
|
|
1632
|
+
const sig =
|
|
1633
|
+
format === undefined
|
|
1634
|
+
? tryParsingSig(signature)
|
|
1635
|
+
: Signature.fromBytes(ensureBytes('sig', signature as Hex), format);
|
|
1636
|
+
if (sig === false) return false;
|
|
1637
|
+
try {
|
|
1638
|
+
const P = Point.fromBytes(publicKey);
|
|
1639
|
+
if (lowS && sig.hasHighS()) return false;
|
|
1640
|
+
const { r, s } = sig;
|
|
1641
|
+
const h = bits2int_modN(message); // mod n, not mod p
|
|
1642
|
+
const is = Fn.inv(s); // s^-1 mod n
|
|
1643
|
+
const u1 = Fn.create(h * is); // u1 = hs^-1 mod n
|
|
1644
|
+
const u2 = Fn.create(r * is); // u2 = rs^-1 mod n
|
|
1645
|
+
const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2)); // u1⋅G + u2⋅P
|
|
1646
|
+
if (R.is0()) return false;
|
|
1647
|
+
const v = Fn.create(R.x); // v = r.x mod n
|
|
1648
|
+
return v === r;
|
|
1649
|
+
} catch (e) {
|
|
1650
|
+
return false;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
function recoverPublicKey(
|
|
1655
|
+
signature: Uint8Array,
|
|
1656
|
+
message: Uint8Array,
|
|
1657
|
+
opts: ECDSARecoverOpts = {}
|
|
1658
|
+
): Uint8Array {
|
|
1659
|
+
const { prehash } = validateSigOpts(opts, defaultSigOpts);
|
|
1660
|
+
message = validateMsgAndHash(message, prehash);
|
|
1661
|
+
return Signature.fromBytes(signature, 'recovered').recoverPublicKey(message).toBytes();
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
return Object.freeze({
|
|
1665
|
+
keygen,
|
|
1666
|
+
getPublicKey,
|
|
1667
|
+
getSharedSecret,
|
|
1668
|
+
utils,
|
|
1669
|
+
lengths,
|
|
1670
|
+
Point,
|
|
1671
|
+
sign,
|
|
1672
|
+
verify,
|
|
1673
|
+
recoverPublicKey,
|
|
1674
|
+
Signature,
|
|
1675
|
+
hash,
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
// TODO: remove everything below
|
|
1680
|
+
/** @deprecated use ECDSASignature */
|
|
1681
|
+
export type SignatureType = ECDSASignature;
|
|
1682
|
+
/** @deprecated use ECDSASigRecovered */
|
|
1683
|
+
export type RecoveredSignatureType = ECDSASigRecovered;
|
|
1684
|
+
/** @deprecated switch to Uint8Array signatures in format 'compact' */
|
|
1685
|
+
export type SignatureLike = { r: bigint; s: bigint };
|
|
1686
|
+
export type ECDSAExtraEntropy = Hex | boolean;
|
|
1687
|
+
/** @deprecated use `ECDSAExtraEntropy` */
|
|
1688
|
+
export type Entropy = Hex | boolean;
|
|
1689
|
+
export type BasicWCurve<T> = BasicCurve<T> & {
|
|
1690
|
+
// Params: a, b
|
|
1691
|
+
a: T;
|
|
1692
|
+
b: T;
|
|
1693
|
+
|
|
1694
|
+
// Optional params
|
|
1695
|
+
allowedPrivateKeyLengths?: readonly number[]; // for P521
|
|
1696
|
+
wrapPrivateKey?: boolean; // bls12-381 requires mod(n) instead of rejecting keys >= n
|
|
1697
|
+
endo?: EndomorphismOpts;
|
|
1698
|
+
// When a cofactor != 1, there can be an effective methods to:
|
|
1699
|
+
// 1. Determine whether a point is torsion-free
|
|
1700
|
+
isTorsionFree?: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>) => boolean;
|
|
1701
|
+
// 2. Clear torsion component
|
|
1702
|
+
clearCofactor?: (c: WeierstrassPointCons<T>, point: WeierstrassPoint<T>) => WeierstrassPoint<T>;
|
|
1703
|
+
};
|
|
1704
|
+
/** @deprecated use ECDSASignOpts */
|
|
1705
|
+
export type SignOpts = ECDSASignOpts;
|
|
1706
|
+
/** @deprecated use ECDSASignOpts */
|
|
1707
|
+
export type VerOpts = ECDSAVerifyOpts;
|
|
1708
|
+
|
|
1709
|
+
/** @deprecated use WeierstrassPoint */
|
|
1710
|
+
export type ProjPointType<T> = WeierstrassPoint<T>;
|
|
1711
|
+
/** @deprecated use WeierstrassPointCons */
|
|
1712
|
+
export type ProjConstructor<T> = WeierstrassPointCons<T>;
|
|
1713
|
+
/** @deprecated use ECDSASignatureCons */
|
|
1714
|
+
export type SignatureConstructor = ECDSASignatureCons;
|
|
1715
|
+
|
|
1716
|
+
// TODO: remove
|
|
1717
|
+
export type CurvePointsType<T> = BasicWCurve<T> & {
|
|
1718
|
+
fromBytes?: (bytes: Uint8Array) => AffinePoint<T>;
|
|
1719
|
+
toBytes?: (
|
|
1720
|
+
c: WeierstrassPointCons<T>,
|
|
1721
|
+
point: WeierstrassPoint<T>,
|
|
1722
|
+
isCompressed: boolean
|
|
1723
|
+
) => Uint8Array;
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
// LegacyWeierstrassOpts
|
|
1727
|
+
export type CurvePointsTypeWithLength<T> = Readonly<CurvePointsType<T> & Partial<NLength>>;
|
|
1728
|
+
|
|
1729
|
+
// LegacyWeierstrass
|
|
1730
|
+
export type CurvePointsRes<T> = {
|
|
1731
|
+
Point: WeierstrassPointCons<T>;
|
|
1732
|
+
|
|
1733
|
+
/** @deprecated use `Point.CURVE()` */
|
|
1734
|
+
CURVE: CurvePointsType<T>;
|
|
1735
|
+
/** @deprecated use `Point` */
|
|
1736
|
+
ProjectivePoint: WeierstrassPointCons<T>;
|
|
1737
|
+
/** @deprecated use `Point.Fn.fromBytes(privateKey)` */
|
|
1738
|
+
normPrivateKeyToScalar: (key: PrivKey) => bigint;
|
|
1739
|
+
/** @deprecated */
|
|
1740
|
+
weierstrassEquation: (x: T) => T;
|
|
1741
|
+
/** @deprecated use `Point.Fn.isValidNot0(num)` */
|
|
1742
|
+
isWithinCurveOrder: (num: bigint) => boolean;
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
// Aliases to legacy types
|
|
1746
|
+
// export type CurveType = LegacyECDSAOpts;
|
|
1747
|
+
// export type CurveFn = LegacyECDSA;
|
|
1748
|
+
// export type CurvePointsRes<T> = LegacyWeierstrass<T>;
|
|
1749
|
+
// export type CurvePointsType<T> = LegacyWeierstrassOpts<T>;
|
|
1750
|
+
// export type CurvePointsTypeWithLength<T> = LegacyWeierstrassOpts<T>;
|
|
1751
|
+
// export type BasicWCurve<T> = LegacyWeierstrassOpts<T>;
|
|
1752
|
+
|
|
1753
|
+
/** @deprecated use `Uint8Array` */
|
|
1754
|
+
export type PubKey = Hex | WeierstrassPoint<bigint>;
|
|
1755
|
+
export type CurveType = BasicWCurve<bigint> & {
|
|
1756
|
+
hash: CHash; // CHash not FHash because we need outputLen for DRBG
|
|
1757
|
+
hmac?: HmacFnSync;
|
|
1758
|
+
randomBytes?: (bytesLength?: number) => Uint8Array;
|
|
1759
|
+
lowS?: boolean;
|
|
1760
|
+
bits2int?: (bytes: Uint8Array) => bigint;
|
|
1761
|
+
bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
1762
|
+
};
|
|
1763
|
+
export type CurveFn = {
|
|
1764
|
+
/** @deprecated use `Point.CURVE()` */
|
|
1765
|
+
CURVE: CurvePointsType<bigint>;
|
|
1766
|
+
keygen: ECDSA['keygen'];
|
|
1767
|
+
getPublicKey: ECDSA['getPublicKey'];
|
|
1768
|
+
getSharedSecret: ECDSA['getSharedSecret'];
|
|
1769
|
+
sign: ECDSA['sign'];
|
|
1770
|
+
verify: ECDSA['verify'];
|
|
1771
|
+
Point: WeierstrassPointCons<bigint>;
|
|
1772
|
+
/** @deprecated use `Point` */
|
|
1773
|
+
ProjectivePoint: WeierstrassPointCons<bigint>;
|
|
1774
|
+
Signature: ECDSASignatureCons;
|
|
1775
|
+
utils: ECDSA['utils'];
|
|
1776
|
+
lengths: ECDSA['lengths'];
|
|
1777
|
+
};
|
|
1778
|
+
/** @deprecated use `weierstrass` in newer releases */
|
|
1779
|
+
export function weierstrassPoints<T>(c: CurvePointsTypeWithLength<T>): CurvePointsRes<T> {
|
|
1780
|
+
const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);
|
|
1781
|
+
const Point = weierstrassN(CURVE, curveOpts);
|
|
1782
|
+
return _weierstrass_new_output_to_legacy(c, Point);
|
|
1783
|
+
}
|
|
1784
|
+
export type WsPointComposed<T> = {
|
|
1785
|
+
CURVE: WeierstrassOpts<T>;
|
|
1786
|
+
curveOpts: WeierstrassExtraOpts<T>;
|
|
1787
|
+
};
|
|
1788
|
+
export type WsComposed = {
|
|
1789
|
+
/** @deprecated use `Point.CURVE()` */
|
|
1790
|
+
CURVE: WeierstrassOpts<bigint>;
|
|
1791
|
+
hash: CHash;
|
|
1792
|
+
curveOpts: WeierstrassExtraOpts<bigint>;
|
|
1793
|
+
ecdsaOpts: ECDSAOpts;
|
|
1794
|
+
};
|
|
1795
|
+
function _weierstrass_legacy_opts_to_new<T>(c: CurvePointsType<T>): WsPointComposed<T> {
|
|
1796
|
+
const CURVE: WeierstrassOpts<T> = {
|
|
1797
|
+
a: c.a,
|
|
1798
|
+
b: c.b,
|
|
1799
|
+
p: c.Fp.ORDER,
|
|
1800
|
+
n: c.n,
|
|
1801
|
+
h: c.h,
|
|
1802
|
+
Gx: c.Gx,
|
|
1803
|
+
Gy: c.Gy,
|
|
1804
|
+
};
|
|
1805
|
+
const Fp = c.Fp;
|
|
1806
|
+
let allowedLengths = c.allowedPrivateKeyLengths
|
|
1807
|
+
? Array.from(new Set(c.allowedPrivateKeyLengths.map((l) => Math.ceil(l / 2))))
|
|
1808
|
+
: undefined;
|
|
1809
|
+
const Fn = Field(CURVE.n, {
|
|
1810
|
+
BITS: c.nBitLength,
|
|
1811
|
+
allowedLengths: allowedLengths,
|
|
1812
|
+
modFromBytes: c.wrapPrivateKey,
|
|
1813
|
+
});
|
|
1814
|
+
const curveOpts: WeierstrassExtraOpts<T> = {
|
|
1815
|
+
Fp,
|
|
1816
|
+
Fn,
|
|
1817
|
+
allowInfinityPoint: c.allowInfinityPoint,
|
|
1818
|
+
endo: c.endo,
|
|
1819
|
+
isTorsionFree: c.isTorsionFree,
|
|
1820
|
+
clearCofactor: c.clearCofactor,
|
|
1821
|
+
fromBytes: c.fromBytes,
|
|
1822
|
+
toBytes: c.toBytes,
|
|
1823
|
+
};
|
|
1824
|
+
return { CURVE, curveOpts };
|
|
1825
|
+
}
|
|
1826
|
+
function _ecdsa_legacy_opts_to_new(c: CurveType): WsComposed {
|
|
1827
|
+
const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);
|
|
1828
|
+
const ecdsaOpts: ECDSAOpts = {
|
|
1829
|
+
hmac: c.hmac,
|
|
1830
|
+
randomBytes: c.randomBytes,
|
|
1831
|
+
lowS: c.lowS,
|
|
1832
|
+
bits2int: c.bits2int,
|
|
1833
|
+
bits2int_modN: c.bits2int_modN,
|
|
1834
|
+
};
|
|
1835
|
+
return { CURVE, curveOpts, hash: c.hash, ecdsaOpts };
|
|
1836
|
+
}
|
|
1837
|
+
export function _legacyHelperEquat<T>(Fp: IField<T>, a: T, b: T): (x: T) => T {
|
|
1838
|
+
/**
|
|
1839
|
+
* y² = x³ + ax + b: Short weierstrass curve formula. Takes x, returns y².
|
|
1840
|
+
* @returns y²
|
|
1841
|
+
*/
|
|
1842
|
+
function weierstrassEquation(x: T): T {
|
|
1843
|
+
const x2 = Fp.sqr(x); // x * x
|
|
1844
|
+
const x3 = Fp.mul(x2, x); // x² * x
|
|
1845
|
+
return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x³ + a * x + b
|
|
1846
|
+
}
|
|
1847
|
+
return weierstrassEquation;
|
|
1848
|
+
}
|
|
1849
|
+
function _weierstrass_new_output_to_legacy<T>(
|
|
1850
|
+
c: CurvePointsType<T>,
|
|
1851
|
+
Point: WeierstrassPointCons<T>
|
|
1852
|
+
): CurvePointsRes<T> {
|
|
1853
|
+
const { Fp, Fn } = Point;
|
|
1854
|
+
function isWithinCurveOrder(num: bigint): boolean {
|
|
1855
|
+
return inRange(num, _1n, Fn.ORDER);
|
|
1856
|
+
}
|
|
1857
|
+
const weierstrassEquation = _legacyHelperEquat(Fp, c.a, c.b);
|
|
1858
|
+
return Object.assign(
|
|
1859
|
+
{},
|
|
1860
|
+
{
|
|
1861
|
+
CURVE: c,
|
|
1862
|
+
Point: Point,
|
|
1863
|
+
ProjectivePoint: Point,
|
|
1864
|
+
normPrivateKeyToScalar: (key: PrivKey) => _normFnElement(Fn, key),
|
|
1865
|
+
weierstrassEquation,
|
|
1866
|
+
isWithinCurveOrder,
|
|
1867
|
+
}
|
|
1868
|
+
);
|
|
1869
|
+
}
|
|
1870
|
+
function _ecdsa_new_output_to_legacy(c: CurveType, _ecdsa: ECDSA): CurveFn {
|
|
1871
|
+
const Point = _ecdsa.Point;
|
|
1872
|
+
return Object.assign({}, _ecdsa, {
|
|
1873
|
+
ProjectivePoint: Point,
|
|
1874
|
+
CURVE: Object.assign({}, c, nLength(Point.Fn.ORDER, Point.Fn.BITS)),
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
// _ecdsa_legacy
|
|
1879
|
+
export function weierstrass(c: CurveType): CurveFn {
|
|
1880
|
+
const { CURVE, curveOpts, hash, ecdsaOpts } = _ecdsa_legacy_opts_to_new(c);
|
|
1881
|
+
const Point = weierstrassN(CURVE, curveOpts);
|
|
1882
|
+
const signs = ecdsa(Point, hash, ecdsaOpts);
|
|
1883
|
+
return _ecdsa_new_output_to_legacy(c, signs);
|
|
1884
|
+
}
|