diff --git a/CHANGELOG.md b/CHANGELOG.md index a9fbd8c..ef558d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -## 0.4.1 ~ 0.4.5 +## 0.4.1 ~ 0.4.6 - Drop Node 16 support - Support curve25519 (x25519 and ed25519) tentatively diff --git a/package.json b/package.json index df9ce46..b75af6f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "type": "git", "url": "https://github.com/ecies/js.git" }, - "version": "0.4.5", + "version": "0.4.6", "engines": { "node": ">=16.0.0" }, @@ -35,14 +35,14 @@ "test": "jest" }, "dependencies": { - "@noble/ciphers": "^0.3.0", + "@noble/ciphers": "^0.4.0", "@noble/curves": "^1.2.0", "@noble/hashes": "^1.3.2" }, "devDependencies": { - "@types/jest": "^29.5.5", - "@types/node": "^20.8.2", - "@types/node-fetch": "^2.6.6", + "@types/jest": "^29.5.8", + "@types/node": "^20.9.0", + "@types/node-fetch": "^2.6.9", "https-proxy-agent": "^7.0.2", "jest": "^29.7.0", "node-fetch": "^2.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db8f493..8f6d5d5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@noble/ciphers': - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.4.0 + version: 0.4.0 '@noble/curves': specifier: ^1.2.0 version: 1.2.0 @@ -17,29 +17,29 @@ dependencies: devDependencies: '@types/jest': - specifier: ^29.5.5 - version: 29.5.5 + specifier: ^29.5.8 + version: 29.5.8 '@types/node': - specifier: ^20.8.2 - version: 20.8.2 + specifier: ^20.9.0 + version: 20.9.0 '@types/node-fetch': - specifier: ^2.6.6 - version: 2.6.6 + specifier: ^2.6.9 + version: 2.6.9 https-proxy-agent: specifier: ^7.0.2 version: 7.0.2 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + version: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) node-fetch: specifier: ^2.7.0 version: 2.7.0 ts-jest: specifier: ^29.1.1 - version: 29.1.1(@babel/core@7.23.0)(jest@29.7.0)(typescript@5.2.2) + version: 29.1.1(@babel/core@7.23.3)(jest@29.7.0)(typescript@5.2.2) ts-node: specifier: ^10.9.1 - version: 10.9.1(@types/node@20.8.2)(typescript@5.2.2) + version: 10.9.1(@types/node@20.9.0)(typescript@5.2.2) typescript: specifier: ^5.2.2 version: 5.2.2 @@ -51,7 +51,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.19 + '@jridgewell/trace-mapping': 0.3.20 dev: true /@babel/code-frame@7.22.13: @@ -62,25 +62,25 @@ packages: chalk: 2.4.2 dev: true - /@babel/compat-data@7.22.20: - resolution: {integrity: sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw==} + /@babel/compat-data@7.23.3: + resolution: {integrity: sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==} engines: {node: '>=6.9.0'} dev: true - /@babel/core@7.23.0: - resolution: {integrity: sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==} + /@babel/core@7.23.3: + resolution: {integrity: sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.1 '@babel/code-frame': 7.22.13 - '@babel/generator': 7.23.0 + '@babel/generator': 7.23.3 '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-module-transforms': 7.23.0(@babel/core@7.23.0) - '@babel/helpers': 7.23.1 - '@babel/parser': 7.23.0 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.3) + '@babel/helpers': 7.23.2 + '@babel/parser': 7.23.3 '@babel/template': 7.22.15 - '@babel/traverse': 7.23.2 - '@babel/types': 7.23.0 + '@babel/traverse': 7.23.3 + '@babel/types': 7.23.3 convert-source-map: 2.0.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -90,13 +90,13 @@ packages: - supports-color dev: true - /@babel/generator@7.23.0: - resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==} + /@babel/generator@7.23.3: + resolution: {integrity: sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.19 + '@jridgewell/trace-mapping': 0.3.20 jsesc: 2.5.2 dev: true @@ -104,7 +104,7 @@ packages: resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/compat-data': 7.22.20 + '@babel/compat-data': 7.23.3 '@babel/helper-validator-option': 7.22.15 browserslist: 4.22.1 lru-cache: 5.1.1 @@ -121,30 +121,30 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-hoist-variables@7.22.5: resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-module-imports@7.22.15: resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true - /@babel/helper-module-transforms@7.23.0(@babel/core@7.23.0): - resolution: {integrity: sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==} + /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-module-imports': 7.22.15 '@babel/helper-simple-access': 7.22.5 @@ -161,14 +161,14 @@ packages: resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-split-export-declaration@7.22.6: resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-string-parser@7.22.5: @@ -186,13 +186,13 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/helpers@7.23.1: - resolution: {integrity: sha512-chNpneuK18yW5Oxsr+t553UZzzAs3aZnFm4bxhebsNTeshrC95yA7l5yl7GBAG+JG1rF0F7zzD2EixK9mWSDoA==} + /@babel/helpers@7.23.2: + resolution: {integrity: sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/traverse': 7.23.2 - '@babel/types': 7.23.0 + '@babel/traverse': 7.23.3 + '@babel/types': 7.23.3 transitivePeerDependencies: - supports-color dev: true @@ -206,140 +206,140 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/parser@7.23.0: - resolution: {integrity: sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==} + /@babel/parser@7.23.3: + resolution: {integrity: sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==} engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true - /@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.23.0): + /@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.23.3): resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.23.0): + /@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.23.0): + /@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.23.3): resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.23.0): + /@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.23.3): resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.23.0): + /@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-jsx@7.22.5(@babel/core@7.23.0): - resolution: {integrity: sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==} + /@babel/plugin-syntax-jsx@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.23.0): + /@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.23.3): resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.23.0): + /@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.23.0): + /@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.23.3): resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.23.0): + /@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.23.0): + /@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.23.0): + /@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.23.0): + /@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.23.3): resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-syntax-typescript@7.22.5(@babel/core@7.23.0): - resolution: {integrity: sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==} + /@babel/plugin-syntax-typescript@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true @@ -348,30 +348,30 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.13 - '@babel/parser': 7.23.0 - '@babel/types': 7.23.0 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 dev: true - /@babel/traverse@7.23.2: - resolution: {integrity: sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==} + /@babel/traverse@7.23.3: + resolution: {integrity: sha512-+K0yF1/9yR0oHdE0StHuEj3uTPzwwbrLGfNOndVJVV2TqA5+j3oljJUb4nmB954FLGjNem976+B+eDuLIjesiQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.13 - '@babel/generator': 7.23.0 + '@babel/generator': 7.23.3 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.23.0 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.23.0 - '@babel/types': 7.23.0 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color dev: true - /@babel/types@7.23.0: - resolution: {integrity: sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==} + /@babel/types@7.23.3: + resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.22.5 @@ -411,7 +411,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -432,14 +432,14 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + jest-config: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -467,7 +467,7 @@ packages: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 jest-mock: 29.7.0 dev: true @@ -494,7 +494,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.8.2 + '@types/node': 20.9.0 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -526,14 +526,14 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@jridgewell/trace-mapping': 0.3.19 - '@types/node': 20.8.2 + '@jridgewell/trace-mapping': 0.3.20 + '@types/node': 20.9.0 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 glob: 7.2.3 graceful-fs: 4.2.11 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 istanbul-lib-instrument: 6.0.1 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 4.0.1 @@ -560,7 +560,7 @@ packages: resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jridgewell/trace-mapping': 0.3.19 + '@jridgewell/trace-mapping': 0.3.20 callsites: 3.1.0 graceful-fs: 4.2.11 dev: true @@ -571,7 +571,7 @@ packages: dependencies: '@jest/console': 29.7.0 '@jest/types': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.4 + '@types/istanbul-lib-coverage': 2.0.6 collect-v8-coverage: 1.0.2 dev: true @@ -589,9 +589,9 @@ packages: resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@jest/types': 29.6.3 - '@jridgewell/trace-mapping': 0.3.19 + '@jridgewell/trace-mapping': 0.3.20 babel-plugin-istanbul: 6.1.1 chalk: 4.1.2 convert-source-map: 2.0.0 @@ -613,10 +613,10 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/schemas': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.4 - '@types/istanbul-reports': 3.0.2 - '@types/node': 20.8.2 - '@types/yargs': 17.0.26 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 20.9.0 + '@types/yargs': 17.0.31 chalk: 4.1.2 dev: true @@ -626,7 +626,7 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.19 + '@jridgewell/trace-mapping': 0.3.20 dev: true /@jridgewell/resolve-uri@3.1.1: @@ -643,8 +643,8 @@ packages: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} dev: true - /@jridgewell/trace-mapping@0.3.19: - resolution: {integrity: sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==} + /@jridgewell/trace-mapping@0.3.20: + resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 @@ -657,8 +657,8 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true - /@noble/ciphers@0.3.0: - resolution: {integrity: sha512-ldbrnOjmNRwFdXcTM6uXDcxpMIFrbzAWNnpBPp4oTJTFF0XByGD6vf45WrehZGXRQTRVV+Zm8YP+EgEf+e4cWA==} + /@noble/ciphers@0.4.0: + resolution: {integrity: sha512-xaUaUUDWbHIFSxaQ/pIe+33VG2mfJp6N/KxKLmZr5biWdNznCAmfu24QRhX10BbVAuqOahAoyp0S4M9md6GPDw==} dev: false /@noble/curves@1.2.0: @@ -704,96 +704,98 @@ packages: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} dev: true - /@types/babel__core@7.20.2: - resolution: {integrity: sha512-pNpr1T1xLUc2l3xJKuPtsEky3ybxN3m4fJkknfIpTCTfIZCDW57oAg+EfCgIIp2rvCe0Wn++/FfodDS4YXxBwA==} + /@types/babel__core@7.20.4: + resolution: {integrity: sha512-mLnSC22IC4vcWiuObSRjrLd9XcBTGf59vUSoq2jkQDJ/QQ8PMI9rSuzE+aEV8karUMbskw07bKYoUJCKTUaygg==} dependencies: - '@babel/parser': 7.23.0 - '@babel/types': 7.23.0 - '@types/babel__generator': 7.6.5 - '@types/babel__template': 7.4.2 - '@types/babel__traverse': 7.20.2 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 + '@types/babel__generator': 7.6.7 + '@types/babel__template': 7.4.4 + '@types/babel__traverse': 7.20.4 dev: true - /@types/babel__generator@7.6.5: - resolution: {integrity: sha512-h9yIuWbJKdOPLJTbmSpPzkF67e659PbQDba7ifWm5BJ8xTv+sDmS7rFmywkWOvXedGTivCdeGSIIX8WLcRTz8w==} + /@types/babel__generator@7.6.7: + resolution: {integrity: sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true - /@types/babel__template@7.4.2: - resolution: {integrity: sha512-/AVzPICMhMOMYoSx9MoKpGDKdBRsIXMNByh1PXSZoa+v6ZoLa8xxtsT/uLQ/NJm0XVAWl/BvId4MlDeXJaeIZQ==} + /@types/babel__template@7.4.4: + resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} dependencies: - '@babel/parser': 7.23.0 - '@babel/types': 7.23.0 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 dev: true - /@types/babel__traverse@7.20.2: - resolution: {integrity: sha512-ojlGK1Hsfce93J0+kn3H5R73elidKUaZonirN33GSmgTUMpzI/MIFfSpF3haANe3G1bEBS9/9/QEqwTzwqFsKw==} + /@types/babel__traverse@7.20.4: + resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true - /@types/graceful-fs@4.1.7: - resolution: {integrity: sha512-MhzcwU8aUygZroVwL2jeYk6JisJrPl/oov/gsgGCue9mkgl9wjGbzReYQClxiUgFDnib9FuHqTndccKeZKxTRw==} + /@types/graceful-fs@4.1.9: + resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} dependencies: - '@types/node': 20.8.2 + '@types/node': 20.9.0 dev: true - /@types/istanbul-lib-coverage@2.0.4: - resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} + /@types/istanbul-lib-coverage@2.0.6: + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} dev: true - /@types/istanbul-lib-report@3.0.1: - resolution: {integrity: sha512-gPQuzaPR5h/djlAv2apEG1HVOyj1IUs7GpfMZixU0/0KXT3pm64ylHuMUI1/Akh+sq/iikxg6Z2j+fcMDXaaTQ==} + /@types/istanbul-lib-report@3.0.3: + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} dependencies: - '@types/istanbul-lib-coverage': 2.0.4 + '@types/istanbul-lib-coverage': 2.0.6 dev: true - /@types/istanbul-reports@3.0.2: - resolution: {integrity: sha512-kv43F9eb3Lhj+lr/Hn6OcLCs/sSM8bt+fIaP11rCYngfV6NVjzWXJ17owQtDQTL9tQ8WSLUrGsSJ6rJz0F1w1A==} + /@types/istanbul-reports@3.0.4: + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} dependencies: - '@types/istanbul-lib-report': 3.0.1 + '@types/istanbul-lib-report': 3.0.3 dev: true - /@types/jest@29.5.5: - resolution: {integrity: sha512-ebylz2hnsWR9mYvmBFbXJXr+33UPc4+ZdxyDXh5w0FlPBTfCVN3wPL+kuOiQt3xvrK419v7XWeAs+AeOksafXg==} + /@types/jest@29.5.8: + resolution: {integrity: sha512-fXEFTxMV2Co8ZF5aYFJv+YeA08RTYJfhtN5c9JSv/mFEMe+xxjufCb+PHL+bJcMs/ebPUsBu+UNTEz+ydXrR6g==} dependencies: expect: 29.7.0 pretty-format: 29.7.0 dev: true - /@types/node-fetch@2.6.6: - resolution: {integrity: sha512-95X8guJYhfqiuVVhRFxVQcf4hW/2bCuoPwDasMf/531STFoNoWTT7YDnWdXHEZKqAGUigmpG31r2FE70LwnzJw==} + /@types/node-fetch@2.6.9: + resolution: {integrity: sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==} dependencies: - '@types/node': 20.8.2 + '@types/node': 20.9.0 form-data: 4.0.0 dev: true - /@types/node@20.8.2: - resolution: {integrity: sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==} + /@types/node@20.9.0: + resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==} + dependencies: + undici-types: 5.26.5 dev: true - /@types/stack-utils@2.0.1: - resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} + /@types/stack-utils@2.0.3: + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} dev: true - /@types/yargs-parser@21.0.1: - resolution: {integrity: sha512-axdPBuLuEJt0c4yI5OZssC19K2Mq1uKdrfZBzuxLvaztgqUtFYZUNw7lETExPYJR9jdEoIg4mb7RQKRQzOkeGQ==} + /@types/yargs-parser@21.0.3: + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} dev: true - /@types/yargs@17.0.26: - resolution: {integrity: sha512-Y3vDy2X6zw/ZCumcwLpdhM5L7jmyGpmBCTYMHDLqT2IKVMYRRLdv6ZakA+wxhra6Z/3bwhNbNl9bDGXaFU+6rw==} + /@types/yargs@17.0.31: + resolution: {integrity: sha512-bocYSx4DI8TmdlvxqGpVNXOgCNR1Jj0gNPhhAY+iz1rgKDAaYrAYdFYnhDV1IFuiuVc9HkOwyDcFxaTElF3/wg==} dependencies: - '@types/yargs-parser': 21.0.1 + '@types/yargs-parser': 21.0.3 dev: true - /acorn-walk@8.2.0: - resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} + /acorn-walk@8.3.0: + resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==} engines: {node: '>=0.4.0'} dev: true - /acorn@8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} + /acorn@8.11.2: + resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -860,17 +862,17 @@ packages: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} dev: true - /babel-jest@29.7.0(@babel/core@7.23.0): + /babel-jest@29.7.0(@babel/core@7.23.3): resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: '@babel/core': ^7.8.0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@jest/transform': 29.7.0 - '@types/babel__core': 7.20.2 + '@types/babel__core': 7.20.4 babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 29.6.3(@babel/core@7.23.0) + babel-preset-jest: 29.6.3(@babel/core@7.23.3) chalk: 4.1.2 graceful-fs: 4.2.11 slash: 3.0.0 @@ -896,40 +898,40 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/template': 7.22.15 - '@babel/types': 7.23.0 - '@types/babel__core': 7.20.2 - '@types/babel__traverse': 7.20.2 + '@babel/types': 7.23.3 + '@types/babel__core': 7.20.4 + '@types/babel__traverse': 7.20.4 dev: true - /babel-preset-current-node-syntax@1.0.1(@babel/core@7.23.0): + /babel-preset-current-node-syntax@1.0.1(@babel/core@7.23.3): resolution: {integrity: sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.23.0 - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.23.0) - '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.23.0) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.23.0) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.23.0) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.23.0) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.23.0) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.23.0) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.23.0) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.23.0) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.23.0) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.23.0) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.23.0) - dev: true - - /babel-preset-jest@29.6.3(@babel/core@7.23.0): + '@babel/core': 7.23.3 + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.23.3) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.23.3) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.23.3) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.23.3) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.23.3) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.23.3) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.23.3) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.23.3) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.23.3) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.23.3) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.23.3) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.23.3) + dev: true + + /babel-preset-jest@29.6.3(@babel/core@7.23.3): resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 babel-plugin-jest-hoist: 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.0) + babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.3) dev: true /balanced-match@1.0.2: @@ -955,8 +957,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001546 - electron-to-chromium: 1.4.543 + caniuse-lite: 1.0.30001561 + electron-to-chromium: 1.4.582 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -993,8 +995,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001546: - resolution: {integrity: sha512-zvtSJwuQFpewSyRrI3AsftF6rM0X80mZkChIt1spBGEvRglCrjTniXvinc8JKRoqTwXAgvqTImaN9igfSMtUBw==} + /caniuse-lite@1.0.30001561: + resolution: {integrity: sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==} dev: true /chalk@2.4.2: @@ -1082,7 +1084,7 @@ packages: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} dev: true - /create-jest@29.7.0(@types/node@20.8.2)(ts-node@10.9.1): + /create-jest@29.7.0(@types/node@20.9.0)(ts-node@10.9.1): resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -1091,7 +1093,7 @@ packages: chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + jest-config: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -1160,8 +1162,8 @@ packages: engines: {node: '>=0.3.1'} dev: true - /electron-to-chromium@1.4.543: - resolution: {integrity: sha512-t2ZP4AcGE0iKCCQCBx/K2426crYdxD3YU6l0uK2EO3FZH0pbC4pFz/sZm2ruZsND6hQBTcDWWlo/MLpiOdif5g==} + /electron-to-chromium@1.4.582: + resolution: {integrity: sha512-89o0MGoocwYbzqUUjc+VNpeOFSOK9nIdC5wY4N+PVUarUK0MtjyTjks75AZS2bW4Kl8MdewdFsWaH0jLy+JNoA==} dev: true /emittery@0.13.1: @@ -1277,6 +1279,10 @@ packages: dev: true optional: true + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + /gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -1327,9 +1333,11 @@ packages: engines: {node: '>=8'} dev: true - /has@1.0.4: - resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} - engines: {node: '>= 0.4.0'} + /hasown@2.0.0: + resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 dev: true /html-escaper@2.0.2: @@ -1380,10 +1388,10 @@ packages: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true - /is-core-module@2.13.0: - resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==} + /is-core-module@2.13.1: + resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} dependencies: - has: 1.0.4 + hasown: 2.0.0 dev: true /is-fullwidth-code-point@3.0.0: @@ -1410,8 +1418,8 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true - /istanbul-lib-coverage@3.2.0: - resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} + /istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} engines: {node: '>=8'} dev: true @@ -1419,10 +1427,10 @@ packages: resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} engines: {node: '>=8'} dependencies: - '@babel/core': 7.23.0 - '@babel/parser': 7.23.0 + '@babel/core': 7.23.3 + '@babel/parser': 7.23.3 '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -1432,10 +1440,10 @@ packages: resolution: {integrity: sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==} engines: {node: '>=10'} dependencies: - '@babel/core': 7.23.0 - '@babel/parser': 7.23.0 + '@babel/core': 7.23.3 + '@babel/parser': 7.23.3 '@istanbuljs/schema': 0.1.3 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 semver: 7.5.4 transitivePeerDependencies: - supports-color @@ -1445,7 +1453,7 @@ packages: resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} engines: {node: '>=10'} dependencies: - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 make-dir: 4.0.0 supports-color: 7.2.0 dev: true @@ -1455,7 +1463,7 @@ packages: engines: {node: '>=10'} dependencies: debug: 4.3.4 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: - supports-color @@ -1486,7 +1494,7 @@ packages: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.1 @@ -1507,7 +1515,7 @@ packages: - supports-color dev: true - /jest-cli@29.7.0(@types/node@20.8.2)(ts-node@10.9.1): + /jest-cli@29.7.0(@types/node@20.9.0)(ts-node@10.9.1): resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -1521,10 +1529,10 @@ packages: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + create-jest: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + jest-config: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -1535,7 +1543,7 @@ packages: - ts-node dev: true - /jest-config@29.7.0(@types/node@20.8.2)(ts-node@10.9.1): + /jest-config@29.7.0(@types/node@20.9.0)(ts-node@10.9.1): resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -1547,11 +1555,11 @@ packages: ts-node: optional: true dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 '@jest/test-sequencer': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 - babel-jest: 29.7.0(@babel/core@7.23.0) + '@types/node': 20.9.0 + babel-jest: 29.7.0(@babel/core@7.23.3) chalk: 4.1.2 ci-info: 3.9.0 deepmerge: 4.3.1 @@ -1570,7 +1578,7 @@ packages: pretty-format: 29.7.0 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.1(@types/node@20.8.2)(typescript@5.2.2) + ts-node: 10.9.1(@types/node@20.9.0)(typescript@5.2.2) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -1611,7 +1619,7 @@ packages: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 jest-mock: 29.7.0 jest-util: 29.7.0 dev: true @@ -1626,8 +1634,8 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/graceful-fs': 4.1.7 - '@types/node': 20.8.2 + '@types/graceful-fs': 4.1.9 + '@types/node': 20.9.0 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -1664,7 +1672,7 @@ packages: dependencies: '@babel/code-frame': 7.22.13 '@jest/types': 29.6.3 - '@types/stack-utils': 2.0.1 + '@types/stack-utils': 2.0.3 chalk: 4.1.2 graceful-fs: 4.2.11 micromatch: 4.0.5 @@ -1678,7 +1686,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 jest-util: 29.7.0 dev: true @@ -1719,7 +1727,7 @@ packages: jest-pnp-resolver: 1.2.3(jest-resolve@29.7.0) jest-util: 29.7.0 jest-validate: 29.7.0 - resolve: 1.22.6 + resolve: 1.22.8 resolve.exports: 2.0.2 slash: 3.0.0 dev: true @@ -1733,7 +1741,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -1764,7 +1772,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 chalk: 4.1.2 cjs-module-lexer: 1.2.3 collect-v8-coverage: 1.0.2 @@ -1787,15 +1795,15 @@ packages: resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/core': 7.23.0 - '@babel/generator': 7.23.0 - '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.23.0) - '@babel/plugin-syntax-typescript': 7.22.5(@babel/core@7.23.0) - '@babel/types': 7.23.0 + '@babel/core': 7.23.3 + '@babel/generator': 7.23.3 + '@babel/plugin-syntax-jsx': 7.23.3(@babel/core@7.23.3) + '@babel/plugin-syntax-typescript': 7.23.3(@babel/core@7.23.3) + '@babel/types': 7.23.3 '@jest/expect-utils': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.0) + babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.3) chalk: 4.1.2 expect: 29.7.0 graceful-fs: 4.2.11 @@ -1816,7 +1824,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -1841,7 +1849,7 @@ packages: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.2 + '@types/node': 20.9.0 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -1853,13 +1861,13 @@ packages: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 20.8.2 + '@types/node': 20.9.0 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true - /jest@29.7.0(@types/node@20.8.2)(ts-node@10.9.1): + /jest@29.7.0(@types/node@20.9.0)(ts-node@10.9.1): resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -1872,7 +1880,7 @@ packages: '@jest/core': 29.7.0(ts-node@10.9.1) '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + jest-cli: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -2174,11 +2182,11 @@ packages: engines: {node: '>=10'} dev: true - /resolve@1.22.6: - resolution: {integrity: sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw==} + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true dependencies: - is-core-module: 2.13.0 + is-core-module: 2.13.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 dev: true @@ -2338,7 +2346,7 @@ packages: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: true - /ts-jest@29.1.1(@babel/core@7.23.0)(jest@29.7.0)(typescript@5.2.2): + /ts-jest@29.1.1(@babel/core@7.23.3)(jest@29.7.0)(typescript@5.2.2): resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -2359,10 +2367,10 @@ packages: esbuild: optional: true dependencies: - '@babel/core': 7.23.0 + '@babel/core': 7.23.3 bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + jest: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 @@ -2372,7 +2380,7 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-node@10.9.1(@types/node@20.8.2)(typescript@5.2.2): + /ts-node@10.9.1(@types/node@20.9.0)(typescript@5.2.2): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -2391,9 +2399,9 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.8.2 - acorn: 8.10.0 - acorn-walk: 8.2.0 + '@types/node': 20.9.0 + acorn: 8.11.2 + acorn-walk: 8.3.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 @@ -2419,6 +2427,10 @@ packages: hasBin: true dev: true + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + dev: true + /update-browserslist-db@1.0.13(browserslist@4.22.1): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true @@ -2438,8 +2450,8 @@ packages: resolution: {integrity: sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==} engines: {node: '>=10.12.0'} dependencies: - '@jridgewell/trace-mapping': 0.3.19 - '@types/istanbul-lib-coverage': 2.0.4 + '@jridgewell/trace-mapping': 0.3.20 + '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 dev: true diff --git a/src/config.ts b/src/config.ts index 3419bab..db6a731 100644 --- a/src/config.ts +++ b/src/config.ts @@ -5,8 +5,11 @@ import { } from "./consts"; export type EllipticCurve = "secp256k1" | "x25519" | "ed25519"; -export type SymmetricAlgorithm = "aes-256-gcm" | "xchacha20"; -export type NonceLength = 12 | 16; +export type SymmetricAlgorithm = + | "aes-256-gcm" + | "xchacha20" + | "aes-256-cbc" /* NOT RECOMMENDED, only for compatibility */; +export type NonceLength = 12 | 16; // aes-256-gcm only class Config { ellipticCurve: EllipticCurve = "secp256k1"; diff --git a/src/utils/compat.ts b/src/utils/compat.ts index 285bb9d..f3f5ba7 100644 --- a/src/utils/compat.ts +++ b/src/utils/compat.ts @@ -1,40 +1,65 @@ import { Cipher, concatBytes } from "@noble/ciphers/utils"; -import { createCipheriv, createDecipheriv } from "crypto"; - +import { CipherGCM, DecipherGCM, createCipheriv, createDecipheriv } from "crypto"; import { AEAD_TAG_LENGTH } from "../consts"; +export const aes256gcm = ( + key: Uint8Array, + nonce: Uint8Array, + AAD?: Uint8Array +): Cipher => { + return _compatAES("aes-256-gcm", key, nonce, AAD); +}; + +// NOT RECOMMENDED. There is neither AAD nor AEAD tag in cbc mode +export const aes256cbc = ( + key: Uint8Array, + nonce: Uint8Array, + AAD?: Uint8Array +): Cipher => { + return _compatAES("aes-256-cbc", key, nonce); +}; + // make `node:crypto`'s aes compatible with `@noble/ciphers` -export function aes256gcm( +function _compatAES( + algorithm: "aes-256-cbc" | "aes-256-gcm", key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array ): Cipher { + const isAEAD = algorithm === "aes-256-gcm"; + const tagLength = isAEAD ? AEAD_TAG_LENGTH : 0; + const encrypt = (plainText: Uint8Array) => { - const cipher = createCipheriv("aes-256-gcm", key, nonce); - if (AAD) { - cipher.setAAD(AAD); + const cipher = createCipheriv(algorithm, key, nonce); + if (isAEAD && AAD) { + (cipher as CipherGCM).setAAD(AAD); } + const updated = cipher.update(plainText); const finalized = cipher.final(); - return concatBytes(updated, finalized, cipher.getAuthTag()); + if (isAEAD) { + return concatBytes(updated, finalized, (cipher as CipherGCM).getAuthTag()); + } + return concatBytes(updated, finalized); }; const decrypt = (cipherText: Uint8Array) => { - const encrypted = cipherText.subarray(0, cipherText.length - AEAD_TAG_LENGTH); - const tag = cipherText.subarray(-AEAD_TAG_LENGTH); + const encrypted = cipherText.subarray(0, cipherText.length - tagLength); + const tag = cipherText.subarray(cipherText.length - tagLength); - const decipher = createDecipheriv("aes-256-gcm", key, nonce); - if (AAD) { - decipher.setAAD(AAD); + const decipher = createDecipheriv(algorithm, key, nonce); + if (isAEAD) { + if (AAD) { + (decipher as DecipherGCM).setAAD(AAD); + } + (decipher as DecipherGCM).setAuthTag(tag); } - decipher.setAuthTag(tag); const updated = decipher.update(encrypted); const finalized = decipher.final(); return concatBytes(updated, finalized); }; return { - tagLength: AEAD_TAG_LENGTH, encrypt, decrypt, }; diff --git a/src/utils/symmetric.ts b/src/utils/symmetric.ts index fed89e3..3788c8a 100644 --- a/src/utils/symmetric.ts +++ b/src/utils/symmetric.ts @@ -6,7 +6,7 @@ import { sha256 } from "@noble/hashes/sha256"; import { symmetricAlgorithm, symmetricNonceLength } from "../config"; import { AEAD_TAG_LENGTH, XCHACHA20_NONCE_LENGTH } from "../consts"; -import { aes256gcm } from "./compat"; +import { aes256cbc, aes256gcm } from "./compat"; export function aesEncrypt(key: Uint8Array, plainText: Uint8Array): Uint8Array { // TODO: Rename to symEncrypt @@ -19,7 +19,7 @@ export function aesDecrypt(key: Uint8Array, cipherText: Uint8Array): Uint8Array } export function deriveKey(master: Uint8Array): Uint8Array { - // 32 bytes shared secret for aes and xchacha20 + // 32 bytes shared secret for aes256 and xchacha20 derived from HKDF-SHA256 return hkdf(sha256, master, undefined, undefined, 32); } @@ -30,6 +30,9 @@ function _exec(is_encryption: boolean, key: Uint8Array, data: Uint8Array): Uint8 return callback(aes256gcm, key, data, symmetricNonceLength()); } else if (algorithm === "xchacha20") { return callback(xchacha20, key, data, XCHACHA20_NONCE_LENGTH); + } else if (algorithm === "aes-256-cbc") { + // aes-256-cbc is always 16 bytes iv and there is no AEAD tag + return callback(aes256cbc, key, data, 16, 0); } else { throw new Error("Not implemented"); } @@ -39,14 +42,15 @@ function _encrypt( func: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher, key: Uint8Array, plainText: Uint8Array, - nonceLength: number + nonceLength: 12 | 16 | 24, + tagLength: 16 | 0 = AEAD_TAG_LENGTH ): Uint8Array { const nonce = randomBytes(nonceLength); const cipher = func(key, nonce); const ciphered = cipher.encrypt(plainText); // TAG + encrypted - const encrypted = ciphered.subarray(0, ciphered.length - AEAD_TAG_LENGTH); - const tag = ciphered.subarray(-AEAD_TAG_LENGTH); + const encrypted = ciphered.subarray(0, ciphered.length - tagLength); + const tag = ciphered.subarray(ciphered.length - tagLength); return concatBytes(nonce, tag, encrypted); } @@ -54,9 +58,10 @@ function _decrypt( func: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher, key: Uint8Array, cipherText: Uint8Array, - nonceLength: number + nonceLength: 12 | 16 | 24, + tagLength: 16 | 0 = AEAD_TAG_LENGTH ): Uint8Array { - const nonceTagLength = nonceLength + AEAD_TAG_LENGTH; + const nonceTagLength = nonceLength + tagLength; const nonce = cipherText.subarray(0, nonceLength); const tag = cipherText.subarray(nonceLength, nonceTagLength); const encrypted = cipherText.subarray(nonceTagLength); diff --git a/tests/crypt.test.ts b/tests/crypt/known.test.ts similarity index 54% rename from tests/crypt.test.ts rename to tests/crypt/known.test.ts index dd4b0fe..d76d06a 100644 --- a/tests/crypt.test.ts +++ b/tests/crypt/known.test.ts @@ -5,89 +5,29 @@ import { decrypt, encrypt, utils, -} from "../src/index"; +} from "../../src/index"; const decodeHex = utils.decodeHex; const TEXT = "helloworld🌍"; -describe("test random encrypt and decrypt", () => { - function check(sk: PrivateKey, compressed: boolean = false) { - if (compressed) { - const encrypted = encrypt(sk.publicKey.compressed, Buffer.from(TEXT)); - expect(decrypt(sk.secret, encrypted).toString()).toBe(TEXT); - } else { - const encrypted = encrypt(sk.publicKey.uncompressed, Buffer.from(TEXT)); - expect(decrypt(sk.secret, encrypted).toString()).toBe(TEXT); - } - } - - function checkHex(sk: PrivateKey) { - const encrypted = encrypt(sk.publicKey.toHex(), Buffer.from(TEXT)); - expect(decrypt(sk.secret, encrypted).toString()).toBe(TEXT); +describe("test known encrypt and decrypt", () => { + function testDecrypt(sk: PrivateKey, msg: string, data: Uint8Array) { + expect(decrypt(sk.secret, data).toString()).toBe(msg); } - function testRandom() { - const sk1 = new PrivateKey(); - check(sk1); - checkHex(sk1); - - const sk2 = new PrivateKey(); - check(sk2, true); - checkHex(sk2); + function testEncrypt(sk: PrivateKey, pk: PublicKey, msg: string) { + testDecrypt(sk, msg, encrypt(pk.toHex(), Buffer.from(msg))); } - it("tests default", () => { - testRandom(); - }); - - it("tests compressed ephemeral and hkdf key with 12 bytes nonce", () => { - ECIES_CONFIG.isEphemeralKeyCompressed = true; - ECIES_CONFIG.isHkdfKeyCompressed = true; - ECIES_CONFIG.symmetricNonceLength = 12; - - testRandom(); - - ECIES_CONFIG.isEphemeralKeyCompressed = false; - ECIES_CONFIG.isHkdfKeyCompressed = false; - ECIES_CONFIG.symmetricNonceLength = 16; - }); - - it("tests compressed ephemeral key and chacha", () => { - ECIES_CONFIG.symmetricAlgorithm = "xchacha20"; - ECIES_CONFIG.isEphemeralKeyCompressed = true; - - testRandom(); - - ECIES_CONFIG.symmetricAlgorithm = "aes-256-gcm"; - ECIES_CONFIG.isEphemeralKeyCompressed = false; - }); - - it("tests curve25519 and chacha", () => { - ECIES_CONFIG.ellipticCurve = "x25519"; - testRandom(); - - ECIES_CONFIG.symmetricAlgorithm = "xchacha20"; - testRandom(); - - ECIES_CONFIG.ellipticCurve = "ed25519"; - testRandom(); - - ECIES_CONFIG.symmetricAlgorithm = "aes-256-gcm"; - ECIES_CONFIG.ellipticCurve = "secp256k1"; - }); -}); - -describe("test known encrypt and decrypt", () => { function testKnown(sk: PrivateKey, pk: PublicKey, msg: string, enc?: Uint8Array) { if (enc === undefined) { - enc = encrypt(pk.toHex(), Buffer.from(msg)); + testEncrypt(sk, pk, msg); } else { // it should not be equal due to ephemeral key expect(enc).not.toStrictEqual(encrypt(pk.toHex(), Buffer.from(msg))); + testDecrypt(sk, msg, enc); } - - expect(decrypt(sk.toHex(), enc).toString()).toBe(msg); } it("tests default", () => { diff --git a/tests/crypt/random.test.ts b/tests/crypt/random.test.ts new file mode 100644 index 0000000..4b37d22 --- /dev/null +++ b/tests/crypt/random.test.ts @@ -0,0 +1,78 @@ +import { ECIES_CONFIG, PrivateKey, decrypt, encrypt } from "../../src/index"; + +const TEXT = "helloworld🌍"; + +describe("test random encrypt and decrypt", () => { + function check(sk: PrivateKey, compressed: boolean = false) { + if (compressed) { + const encrypted = encrypt(sk.publicKey.compressed, Buffer.from(TEXT)); + expect(decrypt(sk.secret, encrypted).toString()).toBe(TEXT); + } else { + const encrypted = encrypt(sk.publicKey.uncompressed, Buffer.from(TEXT)); + expect(decrypt(sk.secret, encrypted).toString()).toBe(TEXT); + } + } + + function checkHex(sk: PrivateKey) { + const encrypted = encrypt(sk.publicKey.toHex(), Buffer.from(TEXT)); + expect(decrypt(sk.secret, encrypted).toString()).toBe(TEXT); + } + + function testRandom() { + const sk1 = new PrivateKey(); + check(sk1); + checkHex(sk1); + + const sk2 = new PrivateKey(); + check(sk2, true); + checkHex(sk2); + } + + it("tests default", () => { + testRandom(); + }); + + it("tests compressed ephemeral and hkdf key with 12 bytes nonce", () => { + ECIES_CONFIG.isEphemeralKeyCompressed = true; + ECIES_CONFIG.isHkdfKeyCompressed = true; + ECIES_CONFIG.symmetricNonceLength = 12; + + testRandom(); + + ECIES_CONFIG.isEphemeralKeyCompressed = false; + ECIES_CONFIG.isHkdfKeyCompressed = false; + ECIES_CONFIG.symmetricNonceLength = 16; + }); + + it("tests compressed ephemeral key and chacha", () => { + ECIES_CONFIG.symmetricAlgorithm = "xchacha20"; + ECIES_CONFIG.isEphemeralKeyCompressed = true; + + testRandom(); + + ECIES_CONFIG.symmetricAlgorithm = "aes-256-gcm"; + ECIES_CONFIG.isEphemeralKeyCompressed = false; + }); + + it("tests curve25519 and chacha", () => { + ECIES_CONFIG.ellipticCurve = "x25519"; + testRandom(); + + ECIES_CONFIG.symmetricAlgorithm = "xchacha20"; + testRandom(); + + ECIES_CONFIG.ellipticCurve = "ed25519"; + testRandom(); + + ECIES_CONFIG.symmetricAlgorithm = "aes-256-gcm"; + ECIES_CONFIG.ellipticCurve = "secp256k1"; + }); + + it("tests aes256cbc", () => { + ECIES_CONFIG.symmetricAlgorithm = "aes-256-cbc"; + + testRandom(); + + ECIES_CONFIG.symmetricAlgorithm = "aes-256-gcm"; + }); +}); diff --git a/tests/keys.test.ts b/tests/keys.test.ts deleted file mode 100644 index cec123c..0000000 --- a/tests/keys.test.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { ECIES_CONFIG, PrivateKey, PublicKey, utils } from "../src/index"; - -const decodeHex = utils.decodeHex; - -describe("test random keys", () => { - function testRandom() { - const k1 = new PrivateKey(); - const k2 = new PrivateKey(); - expect(k1.multiply(k2.publicKey)).toStrictEqual(k2.multiply(k1.publicKey)); - - const sk = new PrivateKey(); - const skFromHex = PrivateKey.fromHex(sk.toHex()); - const pkFromHex = PublicKey.fromHex(sk.publicKey.toHex(false)); - - expect(pkFromHex).toStrictEqual(sk.publicKey); - expect(skFromHex).toStrictEqual(sk); - } - - it("tests secp256k1", () => { - testRandom(); - }); - - it("tests curve25519", () => { - ECIES_CONFIG.ellipticCurve = "x25519"; - - testRandom(); - - ECIES_CONFIG.ellipticCurve = "ed25519"; - - testRandom(); - - ECIES_CONFIG.ellipticCurve = "secp256k1"; - }); -}); - -describe("test known keys", () => { - it("tests invalid secp256k1", () => { - // 0 < private key < group order int - const ERROR = "Invalid private key"; - const groupOrderInt = - "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"; - expect(() => PrivateKey.fromHex(groupOrderInt)).toThrow(ERROR); - - const groupOrderIntAdd1 = - "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"; - - expect(() => PrivateKey.fromHex(groupOrderIntAdd1)).toThrow(ERROR); - expect(() => PrivateKey.fromHex("00")).toThrow(ERROR); - }); - - it("tests eth key compatibility", () => { - const skEth = PrivateKey.fromHex( - "0x95d3c5e483e9b1d4f5fc8e79b2deaf51362980de62dbb082a9a4257eef653d7d" - ); - const pkEth = PublicKey.fromHex( - "0x98afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140" + - "a4e28911fcf83ab1f457a30b4959efc4b9306f514a4c3711a16a80e3b47eb58b" - ); - expect(pkEth).toEqual(skEth.publicKey); - - expect(pkEth.toHex(true)).toEqual( - "0398afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140" - ); - expect(pkEth.toHex(false)).toEqual( - "0498afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140" + - "a4e28911fcf83ab1f457a30b4959efc4b9306f514a4c3711a16a80e3b47eb58b" - ); - }); - - it("tests hkdf", () => { - const two = new Uint8Array(32); - two[31] = 2; - const three = new Uint8Array(32); - three[31] = 3; - - const k1 = new PrivateKey(two); - const k2 = new PrivateKey(three); - - checkHkdf( - k1, - k2, - "6f982d63e8590c9d9b5b4c1959ff80315d772edd8f60287c9361d548d5200f82" - ); - - ECIES_CONFIG.isHkdfKeyCompressed = true; - - checkHkdf( - k1, - k2, - "b192b226edb3f02da11ef9c6ce4afe1c7e40be304e05ae3b988f4834b1cb6c69" - ); - - ECIES_CONFIG.isHkdfKeyCompressed = false; - }); -}); - -function checkHkdf(k1: PrivateKey, k2: PrivateKey, knownHex: string) { - const derived1 = k1.encapsulate(k2.publicKey); - const derived2 = k1.publicKey.decapsulate(k2); - const known = decodeHex(knownHex); - expect(derived1).toEqual(known); - expect(derived2).toEqual(known); -} diff --git a/tests/keys/known.test.ts b/tests/keys/known.test.ts new file mode 100644 index 0000000..0c7020b --- /dev/null +++ b/tests/keys/known.test.ts @@ -0,0 +1,58 @@ +import { ECIES_CONFIG, PrivateKey, PublicKey, utils } from "../../src/index"; + +const decodeHex = utils.decodeHex; + +describe("test known keys", () => { + function checkHkdf(k1: PrivateKey, k2: PrivateKey, knownHex: string) { + const derived1 = k1.encapsulate(k2.publicKey); + const derived2 = k1.publicKey.decapsulate(k2); + const known = decodeHex(knownHex); + expect(derived1).toEqual(known); + expect(derived2).toEqual(known); + } + + it("tests eth key compatibility", () => { + const skEth = PrivateKey.fromHex( + "0x95d3c5e483e9b1d4f5fc8e79b2deaf51362980de62dbb082a9a4257eef653d7d" + ); + const pkEth = PublicKey.fromHex( + "0x98afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140" + + "a4e28911fcf83ab1f457a30b4959efc4b9306f514a4c3711a16a80e3b47eb58b" + ); + expect(pkEth).toEqual(skEth.publicKey); + + expect(pkEth.toHex(true)).toEqual( + "0398afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140" + ); + expect(pkEth.toHex(false)).toEqual( + "0498afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140" + + "a4e28911fcf83ab1f457a30b4959efc4b9306f514a4c3711a16a80e3b47eb58b" + ); + }); + + it("tests hkdf", () => { + const two = new Uint8Array(32); + two[31] = 2; + const three = new Uint8Array(32); + three[31] = 3; + + const k1 = new PrivateKey(two); + const k2 = new PrivateKey(three); + + checkHkdf( + k1, + k2, + "6f982d63e8590c9d9b5b4c1959ff80315d772edd8f60287c9361d548d5200f82" + ); + + ECIES_CONFIG.isHkdfKeyCompressed = true; + + checkHkdf( + k1, + k2, + "b192b226edb3f02da11ef9c6ce4afe1c7e40be304e05ae3b988f4834b1cb6c69" + ); + + ECIES_CONFIG.isHkdfKeyCompressed = false; + }); +}); diff --git a/tests/keys/random.test.ts b/tests/keys/random.test.ts new file mode 100644 index 0000000..4e487da --- /dev/null +++ b/tests/keys/random.test.ts @@ -0,0 +1,32 @@ +import { ECIES_CONFIG, PrivateKey, PublicKey } from "../../src/index"; + +describe("test random keys", () => { + function testRandom() { + const k1 = new PrivateKey(); + const k2 = new PrivateKey(); + expect(k1.multiply(k2.publicKey)).toStrictEqual(k2.multiply(k1.publicKey)); + + const sk = new PrivateKey(); + const skFromHex = PrivateKey.fromHex(sk.toHex()); + const pkFromHex = PublicKey.fromHex(sk.publicKey.toHex(false)); + + expect(pkFromHex).toStrictEqual(sk.publicKey); + expect(skFromHex).toStrictEqual(sk); + } + + it("tests secp256k1", () => { + testRandom(); + }); + + it("tests curve25519", () => { + ECIES_CONFIG.ellipticCurve = "x25519"; + + testRandom(); + + ECIES_CONFIG.ellipticCurve = "ed25519"; + + testRandom(); + + ECIES_CONFIG.ellipticCurve = "secp256k1"; + }); +}); diff --git a/tests/keys/validation.test.ts b/tests/keys/validation.test.ts new file mode 100644 index 0000000..a6a1099 --- /dev/null +++ b/tests/keys/validation.test.ts @@ -0,0 +1,22 @@ +import { PrivateKey, PublicKey } from "../../src/index"; + +describe("test validation", () => { + it("tests invalid secp256k1", () => { + // 0 < private key < group order int + const ERROR = "Invalid private key"; + const groupOrderInt = + "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"; + expect(() => PrivateKey.fromHex(groupOrderInt)).toThrow(ERROR); + + const groupOrderIntAdd1 = + "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"; + + expect(() => PrivateKey.fromHex(groupOrderIntAdd1)).toThrow(ERROR); + expect(() => PrivateKey.fromHex("00")).toThrow(ERROR); + + const pk = + "04307bac038efaa5bf8a0ac8db53fd4de8024a0c0baf37283a9e6671589eba18e" + + "dc12b3915ff0df66e6ffad862440228a65ead99e3320e50aa90008961e3d68acc"; + expect(() => PublicKey.fromHex(pk)).toThrow("bad point: equation left != right"); + }); +}); diff --git a/tests/utils/compat.test.ts b/tests/utils/compat.test.ts index 06baa7d..15ba44f 100644 --- a/tests/utils/compat.test.ts +++ b/tests/utils/compat.test.ts @@ -1,5 +1,5 @@ import { concatBytes } from "@noble/ciphers/utils"; -import { aes_256_gcm as aes } from "@noble/ciphers/webcrypto/aes"; +import { gcm } from "@noble/ciphers/webcrypto/aes"; import { randomBytes } from "@noble/ciphers/webcrypto/utils"; import { decodeHex } from "../../src/utils"; @@ -14,7 +14,7 @@ describe("test random compat", () => { async function testRandom(aad?: Uint8Array) { const key = randomBytes(); const nonce = randomBytes(16); - const noble = aes(key, nonce, aad); + const noble = gcm(key, nonce, aad); const compat = aes256gcm(key, nonce, aad); // same encryption expect(await noble.encrypt(msg)).toStrictEqual(compat.encrypt(msg)); @@ -42,7 +42,7 @@ describe("test known compat", () => { const msg = encoder.encode("helloworld"); const aad = Uint8Array.from([]); - const noble = aes(key, nonce, aad); + const noble = gcm(key, nonce, aad); const compat = aes256gcm(key, nonce, aad); expect(compat.decrypt(known)).toStrictEqual(msg); expect(await noble.decrypt(known)).toStrictEqual(msg);