@sorare/crypto
Advanced tools
Comparing version 1.3.5 to 2.0.0
@@ -1,12 +0,10 @@ | ||
import { ec } from 'elliptic'; | ||
import { LimitOrder, Transfer, Signature } from './types'; | ||
export { LimitOrder, Transfer, Signature } from './types'; | ||
export declare const generateKey: (mnemonic?: string | undefined) => ec.KeyPair; | ||
export declare const exportPrivateKey: (key: ec.KeyPair) => string; | ||
export declare const exportPublicKey: (key: ec.KeyPair) => string; | ||
export declare const exportPublicKeyX: (key: ec.KeyPair) => string; | ||
export declare const loadPrivateKey: (privateKey: string) => ec.KeyPair; | ||
export declare const loadPublicKey: (publicKey: string) => ec.KeyPair; | ||
/** | ||
* @returns {string} hex encoded 32 byte private string | ||
*/ | ||
export declare const generateKey: (mnemonic?: string | undefined) => string; | ||
export declare const exportPublicKey: (privateKey: string) => string; | ||
export declare const signMessage: (privateKey: string, message: string) => Signature; | ||
export declare const verifyMessage: (publicKey: string, message: string, signature: Signature) => any; | ||
export declare const verifyMessage: (publicKey: string, message: string, signature: Signature) => boolean; | ||
export declare const signTransfer: (privateKey: string, transfer: Transfer) => Signature; | ||
@@ -13,0 +11,0 @@ export declare const verifyTransfer: (publicKey: string, transfer: Transfer, signature: Signature) => boolean; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -24,31 +26,43 @@ value: true | ||
}); | ||
exports.verifyTransfer = exports.verifyMessage = exports.verifyLimitOrder = exports.signTransfer = exports.signMessage = exports.signLimitOrder = exports.loadPublicKey = exports.loadPrivateKey = exports.generateKey = exports.exportPublicKeyX = exports.exportPublicKey = exports.exportPrivateKey = void 0; | ||
exports.verifyTransfer = exports.verifyMessage = exports.verifyLimitOrder = exports.signTransfer = exports.signMessage = exports.signLimitOrder = exports.generateKey = exports.exportPublicKey = void 0; | ||
var _bn = _interopRequireDefault(require("bn.js")); | ||
var _bip = require("@scure/bip39"); | ||
var _bip = require("bip39"); | ||
var _french = require("@scure/bip39/wordlists/french"); | ||
var _ethereumjsWallet = require("ethereumjs-wallet"); | ||
var _bip2 = require("@scure/bip32"); | ||
var _hash = _interopRequireDefault(require("hash.js")); | ||
var _secp256k = require("@noble/curves/secp256k1"); | ||
var _keyDerivation = require("./starkware/keyDerivation"); | ||
var _sha = require("@noble/hashes/sha256"); | ||
var _sha2 = require("@noble/hashes/sha3"); | ||
var _utils = require("@noble/hashes/utils"); | ||
var starknet = _interopRequireWildcard(require("micro-starknet")); | ||
var _signature = require("./starkware/signature"); | ||
var _crypto = require("./starkware/crypto"); | ||
var _types = require("./types"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var PATH = "m/44'/60'/0'/0/0"; | ||
/** | ||
* @returns {string} hex encoded 32 byte private string | ||
*/ | ||
var generateKey = function generateKey(mnemonic) { | ||
var seed = (0, _bip.mnemonicToSeedSync)(mnemonic || (0, _bip.generateMnemonic)()); | ||
var seed = (0, _bip.mnemonicToSeedSync)(mnemonic || (0, _bip.generateMnemonic)(_french.wordlist)); // Ethereum wallet public key | ||
var ethereumAddress = _ethereumjsWallet.hdkey.fromMasterSeed(seed).derivePath(PATH).getWallet().getAddressString(); | ||
var publicKey = _secp256k.secp256k1.getPublicKey((0, _utils.bytesToHex)(_bip2.HDKey.fromMasterSeed(seed).derive(PATH).privateKey), false).slice(1); | ||
var path = (0, _keyDerivation.getAccountPath)('starkex', 'sorare', ethereumAddress, 0); | ||
return (0, _keyDerivation.getKeyPairFromPath)(mnemonic, path); | ||
var address = (0, _sha2.keccak_256)(publicKey).slice(-20); | ||
var path = starknet.getAccountPath('starkex', 'sorare', "0x".concat((0, _utils.bytesToHex)(address)), 0); | ||
var keySeed = (0, _utils.bytesToHex)(_bip2.HDKey.fromMasterSeed(seed).derive(path).privateKey); | ||
var privateKey = starknet.grindKey("0x".concat(keySeed)); | ||
return "0x".concat(privateKey.padStart(64, '0')); | ||
}; | ||
@@ -58,33 +72,8 @@ | ||
var exportPrivateKey = function exportPrivateKey(key) { | ||
return "0x".concat(key.getPrivate('hex').padStart(64, '0')); | ||
var exportPublicKey = function exportPublicKey(privateKey) { | ||
return "0x".concat((0, _utils.bytesToHex)(starknet.getPublicKey(privateKey, true))); | ||
}; | ||
exports.exportPrivateKey = exportPrivateKey; | ||
var exportPublicKey = function exportPublicKey(key) { | ||
return "0x".concat(key.getPublic(true, 'hex')); | ||
}; | ||
exports.exportPublicKey = exportPublicKey; | ||
var exportPublicKeyX = function exportPublicKeyX(key) { | ||
return "0x".concat(key // force line-break (https://github.com/prettier/prettier/issues/3107) | ||
.getPublic().getX().toString('hex').padStart(64, '0')); | ||
}; | ||
exports.exportPublicKeyX = exportPublicKeyX; | ||
var loadPrivateKey = function loadPrivateKey(privateKey) { | ||
return _signature.starkEc.keyFromPrivate(privateKey.substring(2), 'hex'); | ||
}; | ||
exports.loadPrivateKey = loadPrivateKey; | ||
var loadPublicKey = function loadPublicKey(publicKey) { | ||
return _signature.starkEc.keyFromPublic(publicKey.substring(2), 'hex'); | ||
}; | ||
exports.loadPublicKey = loadPublicKey; | ||
var hashTransfer = function hashTransfer(transfer) { | ||
@@ -121,8 +110,6 @@ var amount = transfer.amount, | ||
var sign = function sign(privateKey, message) { | ||
var key = loadPrivateKey(privateKey); | ||
var _starknet$sign = starknet.sign(message, privateKey), | ||
r = _starknet$sign.r, | ||
s = _starknet$sign.s; | ||
var _starkSign = (0, _signature.sign)(key, message), | ||
r = _starkSign.r, | ||
s = _starkSign.s; | ||
return { | ||
@@ -134,19 +121,12 @@ r: "0x".concat(r.toString(16)), | ||
var verify = function verify(publicKey, message, signature) { | ||
if (_crypto.useCryptoCpp) { | ||
return (0, _crypto.verify)(BigInt(publicKey), BigInt("0x".concat(message)), BigInt(signature.r), BigInt(signature.s)); | ||
} | ||
var key = loadPublicKey(publicKey); | ||
var sig = { | ||
r: new _bn.default(signature.r.substring(2), 16), | ||
s: new _bn.default(signature.s.substring(2), 16) | ||
}; | ||
return (0, _signature.verify)(key, message, sig); | ||
var verify = function verify(_ref, message, publicKey) { | ||
var r = _ref.r, | ||
s = _ref.s; | ||
var signature = new starknet.Signature(BigInt(r), BigInt(s)); | ||
return starknet.verify(signature, message, publicKey); | ||
}; | ||
var hashMessage = function hashMessage(message) { | ||
var h = _hash.default.sha256().update(message).digest('hex'); | ||
return (0, _signature.pedersen)([h.substring(0, 32), h.substring(32)]); | ||
var h = (0, _utils.bytesToHex)((0, _sha.sha256)(message)); | ||
return starknet.pedersen(h.substring(0, 32), h.substring(32)); | ||
}; | ||
@@ -161,3 +141,3 @@ | ||
var verifyMessage = function verifyMessage(publicKey, message, signature) { | ||
return verify(publicKey, hashMessage(message), signature); | ||
return verify(signature, hashMessage(message), publicKey); | ||
}; | ||
@@ -176,3 +156,3 @@ | ||
var message = hashTransfer(transfer); | ||
return verify(publicKey, message, signature); | ||
return verify(signature, message, publicKey); | ||
}; | ||
@@ -191,6 +171,6 @@ | ||
var message = hashLimitOrder(limitOrder); | ||
return verify(publicKey, message, signature); | ||
return verify(signature, message, publicKey); | ||
}; | ||
exports.verifyLimitOrder = verifyLimitOrder; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6WyJQQVRIIiwiZ2VuZXJhdGVLZXkiLCJtbmVtb25pYyIsInNlZWQiLCJldGhlcmV1bUFkZHJlc3MiLCJoZGtleSIsImZyb21NYXN0ZXJTZWVkIiwiZGVyaXZlUGF0aCIsImdldFdhbGxldCIsImdldEFkZHJlc3NTdHJpbmciLCJwYXRoIiwiZXhwb3J0UHJpdmF0ZUtleSIsImtleSIsImdldFByaXZhdGUiLCJwYWRTdGFydCIsImV4cG9ydFB1YmxpY0tleSIsImdldFB1YmxpYyIsImV4cG9ydFB1YmxpY0tleVgiLCJnZXRYIiwidG9TdHJpbmciLCJsb2FkUHJpdmF0ZUtleSIsInByaXZhdGVLZXkiLCJzdGFya0VjIiwia2V5RnJvbVByaXZhdGUiLCJzdWJzdHJpbmciLCJsb2FkUHVibGljS2V5IiwicHVibGljS2V5Iiwia2V5RnJvbVB1YmxpYyIsImhhc2hUcmFuc2ZlciIsInRyYW5zZmVyIiwiYW1vdW50Iiwibm9uY2UiLCJzZW5kZXJWYXVsdElkIiwidG9rZW4iLCJyZWNlaXZlclZhdWx0SWQiLCJyZWNlaXZlclB1YmxpY0tleSIsImV4cGlyYXRpb25UaW1lc3RhbXAiLCJjb25kaXRpb24iLCJmZWVJbmZvVXNlciIsImFyZ3MiLCJnZXRUcmFuc2Zlck1zZ0hhc2hXaXRoRmVlIiwidG9rZW5JZCIsInNvdXJjZVZhdWx0SWQiLCJmZWVMaW1pdCIsImdldFRyYW5z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function pedersen(input: any): any; | ||
export function getLimitOrderMsgHash(vaultSell: any, vaultBuy: any, amountSell: any, amountBuy: any, tokenSell: any, tokenBuy: any, nonce: any, expirationTimestamp: any): any; | ||
export function getLimitOrderMsgHashWithFee(vaultSell: any, vaultBuy: any, amountSell: any, amountBuy: any, tokenSell: any, tokenBuy: any, nonce: any, expirationTimestamp: any, feeToken: any, feeVaultId: any, feeLimit: any): any; | ||
export function getTransferMsgHash(amount: any, nonce: any, senderVaultId: any, token: any, receiverVaultId: any, receiverPublicKey: any, expirationTimestamp: any, condition: any): any; | ||
export function getTransferMsgHashWithFee(amount: any, nonce: any, senderVaultId: any, token: any, receiverVaultId: any, receiverStarkKey: any, expirationTimestamp: any, condition: any, feeToken: any, feeVaultId: any, feeLimit: any): any; | ||
export function sign(privateKey: any, msgHash: any): any; | ||
export function verify(publicKey: any, msgHash: any, msgSignature: any): any; | ||
export const prime: BN; | ||
export const maxEcdsaVal: BN; | ||
export const starkEc: EllipticCurve; | ||
export const constantPoints: any[]; | ||
export const shiftPoint: any; | ||
import BN from "bn.js"; | ||
import { ec as EllipticCurve } from "elliptic"; | ||
/** | ||
Serializes the order message in the canonical format expected by the verifier. | ||
party_a sells amountSell coins of tokenSell from vaultSell. | ||
party_a buys amountBuy coins of tokenBuy into vaultBuy. | ||
Expected types: | ||
--------------- | ||
@param {string|number} vaultSell - uint31 (as int) | ||
@param {string|number} vaultBuy - uint31 (as int) | ||
@param {string} amountSell - uint63 (as decimal string) | ||
@param {string} amountBuy - uint63 (as decimal string) | ||
@param {string} tokenSell - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {string} tokenBuy - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {number} nonce - uint31 (as int) | ||
@param {number} expirationTimestamp - uint22 (as int). | ||
*/ | ||
export function getLimitOrderMsgHash(vaultSell: string | number, vaultBuy: string | number, amountSell: string, amountBuy: string, tokenSell: string, tokenBuy: string, nonce: number, expirationTimestamp: number): string; | ||
/** | ||
Same as getLimitOrderMsgHash, but also requires the fee info. | ||
Expected types of fee info params: | ||
--------------- | ||
@param {string|number} vaultSell - uint31 (as int) | ||
@param {string|number} vaultBuy - uint31 (as int) | ||
@param {string} amountSell - uint63 (as decimal string) | ||
@param {string} amountBuy - uint63 (as decimal string) | ||
@param {string} tokenSell - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {string} tokenBuy - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {number} nonce - uint31 (as int) | ||
@param {number} expirationTimestamp - uint22 (as int). | ||
@param {string|number} feeVaultId - uint31 (as int) | ||
@param {string} feeLimit - uint63 (as decimal string) | ||
@param {string} feeToken - uint256 field element strictly less than the prime (as hex string with 0x) | ||
*/ | ||
export function getLimitOrderMsgHashWithFee(vaultSell: string | number, vaultBuy: string | number, amountSell: string, amountBuy: string, tokenSell: string, tokenBuy: string, nonce: number, expirationTimestamp: number, feeToken: string, feeVaultId: string | number, feeLimit: string): string; | ||
/** | ||
Serializes the transfer message in the canonical format expected by the verifier. | ||
The sender transfer 'amount' coins of 'token' from vault with id senderVaultId to vault with id | ||
receiverVaultId. The receiver's public key is receiverPublicKey. | ||
If a condition is added, it is verified before executing the transfer. The format of the condition | ||
is defined by the application. | ||
Expected types: | ||
--------------- | ||
@param {string} amount - uint63 (as decimal string) | ||
@param {number} nonce - uint31 (as int) | ||
@param {string|number} senderVaultId - uint31 (as int) | ||
@param {string} token - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {string|number} receiverVaultId - uint31 (as int) | ||
@param {string} receiverPublicKey - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {number} expirationTimestamp - uint22 (as int). | ||
@param {string|null} [condition] - uint256 field element strictly less than the prime (as hex string with 0x) | ||
*/ | ||
export function getTransferMsgHash(amount: string, nonce: number, senderVaultId: string | number, token: string, receiverVaultId: string | number, receiverPublicKey: string, expirationTimestamp: number, condition?: string | null | undefined): string; | ||
/** | ||
Same as getTransferMsgHash, but also requires the fee info. | ||
Expected types of fee info params: | ||
--------------- | ||
@param {string} amount - uint63 (as decimal string) | ||
@param {number} nonce - uint31 (as int) | ||
@param {string|number} senderVaultId - uint31 (as int) | ||
@param {string} token - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {string|number} receiverVaultId - uint31 (as int) | ||
@param {string} receiverStarkKey - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {number} expirationTimestamp - uint22 (as int). | ||
@param {string|null|undefined} condition - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {string} feeToken - uint256 field element strictly less than the prime (as hex string with 0x) | ||
@param {number|string} feeVaultId - uint31 (as int) | ||
@param {string} feeLimit - uint63 (as decimal string) | ||
*/ | ||
export function getTransferMsgHashWithFee(amount: string, nonce: number, senderVaultId: string | number, token: string, receiverVaultId: string | number, receiverStarkKey: string, expirationTimestamp: number, condition: string | null | undefined, feeToken: string, feeVaultId: number | string, feeLimit: string): string; |
@@ -1,3 +0,1 @@ | ||
import { ec } from 'elliptic'; | ||
export declare type KeyPair = ec.KeyPair; | ||
export interface Fee { | ||
@@ -4,0 +2,0 @@ tokenId: string; |
@@ -6,14 +6,10 @@ { | ||
"license": "MIT", | ||
"version": "1.3.5", | ||
"version": "2.0.0", | ||
"main": "lib.js", | ||
"dependencies": { | ||
"bigint-buffer": "^1.1.5", | ||
"bip39": "^3.0.4", | ||
"bn.js": "^5.2.0", | ||
"elliptic": "^6.5.4", | ||
"enc-utils": "^3.0.0", | ||
"ethereumjs-wallet": "^1.0.1", | ||
"ffi-napi": "^4.0.3", | ||
"hash.js": "^1.1.7", | ||
"patch-package": "^6.4.7" | ||
"@noble/curves": "^1.0.0", | ||
"@noble/hashes": "~1.3.0", | ||
"@scure/bip32": "1.3.0", | ||
"@scure/bip39": "^1.2.1", | ||
"micro-starknet": "0.2.3" | ||
}, | ||
@@ -23,12 +19,7 @@ "devDependencies": { | ||
"@babel/core": "^7.16.5", | ||
"@babel/plugin-transform-destructuring": "^7.16.5", | ||
"@babel/preset-env": "^7.16.5", | ||
"@babel/preset-typescript": "^7.16.5", | ||
"@babel/runtime": "^7.16.5", | ||
"@types/elliptic": "^6.4.14", | ||
"@types/jest": "^27.0.3", | ||
"@types/webpack-env": "^1.16.3", | ||
"@typescript-eslint/eslint-plugin": "^5.7.0", | ||
"@typescript-eslint/parser": "^5.7.0", | ||
"babel-plugin-macros": "^3.1.0", | ||
"eslint": "^8.4.1", | ||
@@ -42,7 +33,3 @@ "eslint-config-airbnb-base": "^15.0.0", | ||
"jest": "^27.4.5", | ||
"patch-package": "^6.4.7", | ||
"prettier": "^2.5.1", | ||
"prettier-eslint": "^13.0.0", | ||
"source-map-explorer": "^2.5.2", | ||
"ts-loader": "^9.2.6", | ||
"typescript": "^4.5.4" | ||
@@ -62,4 +49,2 @@ }, | ||
"prepublish": "yarn run build", | ||
"install": "(test -n \"$USE_STARKWARE_CRYPTO_CPP\" && node-gyp rebuild) || true", | ||
"postinstall": "patch-package", | ||
"test": "jest ./src", | ||
@@ -70,9 +55,3 @@ "package": "yarn build && rm dist/index.test.* && yarn pack", | ||
"files": [ | ||
"deps/crypto-cpp/LICENSE", | ||
"deps/crypto-cpp/src/**/*.cc", | ||
"deps/crypto-cpp/src/**/*.inl", | ||
"deps/crypto-cpp/src/**/*.hpp", | ||
"deps/crypto-cpp/src/**/*.h", | ||
"dist", | ||
"binding.gyp", | ||
"lib.js", | ||
@@ -85,4 +64,5 @@ "lib.d.ts" | ||
"not ie <= 11", | ||
"not op_mini all" | ||
"not op_mini all", | ||
"supports bigint" | ||
] | ||
} |
@@ -42,5 +42,6 @@ <!-- logo --> | ||
# C++ bindings | ||
# Release | ||
Starting from v1.3.2, C++ bindings can be used for faster `verifyTransfer` and `verifyLimitOrder` operations. It uses Starkware's [crypto-cpp](https://github.com/starkware-libs/crypto-cpp) library and can be enabled by adding `USE_STARKWARE_CRYPTO_CPP=true` to your env. Please note that this variable also needs to be set when `yarn install` runs in order to build the C++ bindings using [node-gyp](https://github.com/nodejs/node-gyp). | ||
- Bump version in package.json | ||
- Run `yarn release` | ||
@@ -47,0 +48,0 @@ # License |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
5
17
0
50
0
1
91461
12
590
2
+ Added@noble/curves@^1.0.0
+ Added@noble/hashes@~1.3.0
+ Added@scure/bip32@1.3.0
+ Added@scure/bip39@^1.2.1
+ Addedmicro-starknet@0.2.3
+ Added@noble/curves@1.0.01.8.1(transitive)
+ Added@noble/hashes@1.3.01.3.3(transitive)
+ Added@scure/base@1.1.91.2.4(transitive)
+ Added@scure/bip32@1.3.0(transitive)
+ Added@scure/bip39@1.5.4(transitive)
+ Addedmicro-starknet@0.2.3(transitive)
- Removedbigint-buffer@^1.1.5
- Removedbip39@^3.0.4
- Removedbn.js@^5.2.0
- Removedelliptic@^6.5.4
- Removedenc-utils@^3.0.0
- Removedethereumjs-wallet@^1.0.1
- Removedffi-napi@^4.0.3
- Removedhash.js@^1.1.7
- Removedpatch-package@^6.4.7
- Removed@types/bn.js@5.1.6(transitive)
- Removed@types/node@22.12.0(transitive)
- Removed@types/pbkdf2@3.1.2(transitive)
- Removed@types/secp256k1@4.0.6(transitive)
- Removed@yarnpkg/lockfile@1.1.0(transitive)
- Removedaes-js@3.1.2(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedat-least-node@1.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase-x@3.0.10(transitive)
- Removedbigint-buffer@1.1.5(transitive)
- Removedbindings@1.5.0(transitive)
- Removedbip39@3.1.0(transitive)
- Removedblakejs@1.2.1(transitive)
- Removedbn.js@4.12.15.2.1(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbraces@3.0.3(transitive)
- Removedbrorand@1.1.0(transitive)
- Removedbrowserify-aes@1.2.0(transitive)
- Removedbs58@4.0.1(transitive)
- Removedbs58check@2.1.2(transitive)
- Removedbuffer-xor@1.0.3(transitive)
- Removedchalk@4.1.2(transitive)
- Removedci-info@2.0.0(transitive)
- Removedcipher-base@1.0.6(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedcreate-hmac@1.1.7(transitive)
- Removedcross-spawn@6.0.6(transitive)
- Removeddebug@3.2.74.4.0(transitive)
- Removedelliptic@6.6.1(transitive)
- Removedenc-utils@3.0.0(transitive)
- Removedethereum-cryptography@0.1.3(transitive)
- Removedethereumjs-util@7.1.5(transitive)
- Removedethereumjs-wallet@1.0.2(transitive)
- Removedevp_bytestokey@1.0.3(transitive)
- Removedffi-napi@4.0.3(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedfind-yarn-workspace-root@2.0.0(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedget-symbol-from-current-process-h@1.0.2(transitive)
- Removedget-uv-event-loop-napi-h@1.0.6(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedhash.js@1.1.7(transitive)
- Removedhmac-drbg@1.0.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-ci@2.0.0(transitive)
- Removedis-docker@2.2.1(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedis-wsl@2.2.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removedkeccak@3.0.4(transitive)
- Removedklaw-sync@6.0.0(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedminimalistic-crypto-utils@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedms@2.1.3(transitive)
- Removednice-try@1.0.5(transitive)
- Removednode-addon-api@2.0.23.2.15.1.0(transitive)
- Removednode-gyp-build@4.8.4(transitive)
- Removedonce@1.4.0(transitive)
- Removedopen@7.4.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedpatch-package@6.5.1(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpbkdf2@3.1.2(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedref-napi@3.0.3(transitive)
- Removedref-struct-di@1.1.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedrlp@2.2.7(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedscrypt-js@3.0.1(transitive)
- Removedsecp256k1@4.0.4(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedslash@2.0.0(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtmp@0.0.33(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedtypedarray-to-buffer@3.1.5(transitive)
- Removedundici-types@6.20.0(transitive)
- Removeduniversalify@2.0.1(transitive)
- Removedutf8@3.0.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@8.3.2(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyaml@1.10.2(transitive)