fix linting and devdeps issues by using eslint for ripple-address-codec and removing the misc plugins used by ripple-keypairs

run 'npx lerna link convert' to hoist common devDependencies to top
This commit is contained in:
Greg Weisbrod
2021-11-07 18:15:08 -05:00
parent 43b55ab598
commit 9f19d771d2
3 changed files with 18537 additions and 211 deletions

18699
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
{
"name": "xrpl.js",
"private": true,
"scripts": {
"test": "lerna run test",
@@ -7,6 +8,12 @@
"lint": "lerna run lint",
"build": "lerna run build"
},
"dependencies": {
"ripple-address-codec": "file:packages/ripple-address-codec",
"ripple-binary-codec": "file:packages/ripple-binary-codec",
"ripple-keypairs": "file:packages/ripple-keypairs",
"xrpl": "file:packages/xrpl"
},
"devDependencies": {
"@types/chai": "^4.2.21",
"@types/jest": "^26.0.7",
@@ -17,7 +24,7 @@
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.0.0",
"@xrplf/eslint-config": "^1.5.0",
"@xrplf/eslint-config": "^1.6.0",
"@xrplf/prettier-config": "^1.5.0",
"assert": "^2.0.0",
"buffer": "^6.0.2",
@@ -25,14 +32,10 @@
"crypto-browserify": "^3.12.0",
"ejs": "^3.0.1",
"eslint": "^7.5.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-airbnb-typescript": "^7.0.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-array-func": "^3.1.7",
"eslint-plugin-consistent-default-export-name": "^0.0.13",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jsdoc": "^36.0.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-node": "^11.1.0",
@@ -55,8 +58,6 @@
"ts-jest": "^26.4.4",
"ts-loader": "^9.2.5",
"ts-node": "^10.2.1",
"tslint": "^5.19.0",
"tslint-eslint-rules": "^5.4.0",
"typedoc": "^0.22.5",
"typescript": "^4.4.2",
"url": "^0.11.0",
@@ -70,12 +71,5 @@
"engines": {
"node": ">=10.0.0",
"npm": ">=7.0.0 < 8.0.0"
},
"name": "xrpl.js",
"dependencies": {
"ripple-address-codec": "file:packages/ripple-address-codec",
"ripple-binary-codec": "file:packages/ripple-binary-codec",
"ripple-keypairs": "file:packages/ripple-keypairs",
"xrpl": "file:packages/xrpl"
}
}

View File

@@ -1,4 +1,5 @@
import * as elliptic from 'elliptic'
import Sha512 from './Sha512'
const secp256k1 = elliptic.ec('secp256k1')
@@ -20,25 +21,25 @@ function deriveScalar(bytes, discrim?: number) {
return key
}
}
/* This error is practically impossible to reach.
* The order of the curve describes the (finite) amount of points on the curve
* https://github.com/indutny/elliptic/blob/master/lib/elliptic/curves.js#L182
* How often will an (essentially) random number generated by Sha512 be larger than that?
* There's 2^32 chances (the for loop) to get a number smaller than the order,
* and it's rare that you'll even get past the first loop iteration.
* Note that in TypeScript we actually need the throw, otherwise the function signature would be BN | undefined
*/
// This error is practically impossible to reach.
// The order of the curve describes the (finite) amount of points on the curve
// https://github.com/indutny/elliptic/blob/master/lib/elliptic/curves.js#L182
// How often will an (essentially) random number generated by Sha512 be larger than that?
// There's 2^32 chances (the for loop) to get a number smaller than the order,
// and it's rare that you'll even get past the first loop iteration.
// Note that in TypeScript we actually need the throw, otherwise the function signature would be BN | undefined
//
/* istanbul ignore next */
throw new Error('impossible unicorn ;)')
}
/**
* @param {Array} seed - bytes
* @param {Object} [opts] - object
* @param {Number} [opts.accountIndex=0] - the account number to generate
* @param {Boolean} [opts.validator=false] - generate root key-pair,
* @param seed - Bytes.
* @param [opts] - Object.
* @param [opts.accountIndex=0] - The account number to generate.
* @param [opts.validator=false] - Generate root key-pair,
* as used by validators.
* @return {bn.js} - 256 bit scalar value
* @returns {bn.js} 256 bit scalar value.
*
*/
export function derivePrivateKey(