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

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(