mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Update to eslint 1.2.1
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
"babel-eslint": "^4.0.5",
|
||||
"babel-loader": "^5.3.2",
|
||||
"coveralls": "~2.10.0",
|
||||
"eslint": "^1.2.0",
|
||||
"eslint": "^1.2.1",
|
||||
"eventemitter2": "^0.4.14",
|
||||
"istanbul": "~0.3.5",
|
||||
"lodash": "^3.10.0",
|
||||
|
||||
@@ -10,14 +10,14 @@ const {Ed25519Pair} = require('./ed25519');
|
||||
const {K256Pair, accountPublicFromPublicGenerator} = require('./secp256k1');
|
||||
const {decodeSeed, encodeNodePublic, decodeNodePublic, encodeAccountID} = codec;
|
||||
|
||||
function parseSeed(seed, type=KeyType.secp256k1) {
|
||||
function parseSeed(seed, type = KeyType.secp256k1) {
|
||||
if (typeof seed !== 'string') {
|
||||
return {bytes: seed, type};
|
||||
}
|
||||
return decodeSeed(seed);
|
||||
}
|
||||
|
||||
KeyPair.fromSeed = function(seed, type=KeyType.secp256k1, options) {
|
||||
KeyPair.fromSeed = function(seed, type = KeyType.secp256k1, options) {
|
||||
if (typeof seed === 'string') {
|
||||
const decoded = decodeSeed(seed);
|
||||
const optionsArg = type;
|
||||
@@ -47,8 +47,8 @@ function deriveValidator(seedBytes) {
|
||||
};
|
||||
}
|
||||
|
||||
function generateWallet(opts={}) {
|
||||
const {type='secp256k1', random=brorand} = opts;
|
||||
function generateWallet(opts = {}) {
|
||||
const {type = 'secp256k1', random = brorand} = opts;
|
||||
const seedBytes = random(16);
|
||||
return deriveWallet(seedBytes, type);
|
||||
}
|
||||
@@ -62,8 +62,8 @@ function walletFromPhrase(phrase, type) {
|
||||
return walletFromSeed(seedFromPhrase(phrase), type);
|
||||
}
|
||||
|
||||
function generateValidatorKeys(opts={}) {
|
||||
const {random=brorand} = opts;
|
||||
function generateValidatorKeys(opts = {}) {
|
||||
const {random = brorand} = opts;
|
||||
return deriveValidator(random(16));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function deriveScalar(bytes, discrim) {
|
||||
* @return {bn.js} - 256 bit scalar value
|
||||
*
|
||||
*/
|
||||
function deriveSecret(seed, opts={}) {
|
||||
function deriveSecret(seed, opts = {}) {
|
||||
const root = opts.validator;
|
||||
const order = secp256k1.curve.n;
|
||||
|
||||
@@ -68,7 +68,7 @@ class K256Pair extends KeyPair {
|
||||
this.validator = options.validator;
|
||||
}
|
||||
|
||||
static fromSeed(seedBytes, opts={}) {
|
||||
static fromSeed(seedBytes, opts = {}) {
|
||||
return new K256Pair({seedBytes, validator: opts.validator});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,19 @@
|
||||
const hashjs = require('hash.js');
|
||||
const Sha512 = require('./sha512');
|
||||
|
||||
function unused() {}
|
||||
|
||||
function isVirtual(_, __, descriptor) {
|
||||
unused(_, __);
|
||||
|
||||
descriptor.value = function() {
|
||||
throw new Error('virtual method not implemented ');
|
||||
};
|
||||
}
|
||||
|
||||
function cached(_, name, descriptor) {
|
||||
unused(_);
|
||||
|
||||
const computer = descriptor.value;
|
||||
const key = '_' + name;
|
||||
descriptor.value = function() {
|
||||
|
||||
Reference in New Issue
Block a user