Reuse existing functions.
This commit is contained in:
parent
7626b541f5
commit
f50f171223
@ -100,8 +100,8 @@ var ibanChecksum = (function() {
|
||||
function SigningKey(privateKey) {
|
||||
if (!(this instanceof SigningKey)) { throw new Error('missing new'); }
|
||||
|
||||
if (typeof(privateKey) === 'string' && privateKey.match(/^0x[0-9A-Fa-f]{64}$/)) {
|
||||
privateKey = new Buffer(privateKey.substring(2), 'hex');
|
||||
if (utils.isHexString(privateKey, 32)) {
|
||||
privateKey = utils.hexOrBuffer(privateKey);
|
||||
} else if (!Buffer.isBuffer(privateKey) || privateKey.length !== 32) {
|
||||
throw new Error('invalid private key');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user