pad output of signDigest
This commit is contained in:
parent
aa48dfcdf4
commit
5631f071c3
@ -14,6 +14,7 @@ var utils = (function() {
|
|||||||
|
|
||||||
arrayify: convert.arrayify,
|
arrayify: convert.arrayify,
|
||||||
hexlify: convert.hexlify,
|
hexlify: convert.hexlify,
|
||||||
|
padZeros: convert.padZeros,
|
||||||
|
|
||||||
getAddress: require('../utils/address').getAddress,
|
getAddress: require('../utils/address').getAddress,
|
||||||
|
|
||||||
@ -54,10 +55,13 @@ function SigningKey(privateKey) {
|
|||||||
|
|
||||||
utils.defineProperty(this, 'signDigest', function(digest) {
|
utils.defineProperty(this, 'signDigest', function(digest) {
|
||||||
var signature = keyPair.sign(utils.arrayify(digest), {canonical: true});
|
var signature = keyPair.sign(utils.arrayify(digest), {canonical: true});
|
||||||
|
const r = '0x' + signature.r.toString(16);
|
||||||
|
const s = '0x' + signature.s.toString(16);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
recoveryParam: signature.recoveryParam,
|
recoveryParam: signature.recoveryParam,
|
||||||
r: '0x' + signature.r.toString(16),
|
r: utils.hexlify(utils.padZeros(r, 32)),
|
||||||
s: '0x' + signature.s.toString(16)
|
s: utils.hexlify(utils.padZeros(s, 32))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user