Style fixes and new style rules for eslint (#919)
This commit is contained in:
parent
1bd5689d75
commit
6d626ea70c
|
@ -244,7 +244,7 @@ module.exports = {
|
|||
"no-with": "error",
|
||||
"nonblock-statement-body-position": "error",
|
||||
"object-curly-newline": "off",
|
||||
"object-curly-spacing": "off",
|
||||
"object-curly-spacing": "error",
|
||||
"object-property-newline": [
|
||||
"error",
|
||||
{
|
||||
|
@ -314,6 +314,7 @@ module.exports = {
|
|||
"error",
|
||||
"never"
|
||||
],
|
||||
"indent": [ "error", 2, { "SwitchCase": 1 } ],
|
||||
|
||||
// Custom silencers:
|
||||
"camelcase": 0,
|
||||
|
@ -335,7 +336,6 @@ module.exports = {
|
|||
"no-unused-vars": 1,
|
||||
|
||||
// TODO Consider fixing these:
|
||||
"indent": [ 0, 2, { "SwitchCase": 1 } ],
|
||||
"valid-jsdoc": 0,
|
||||
"new-cap": [ 0, { "properties": false, "capIsNewExceptionPattern": "^type_.*" }],
|
||||
"no-lonely-if": 0,
|
||||
|
|
|
@ -84,8 +84,10 @@ export default {
|
|||
}
|
||||
break;
|
||||
}
|
||||
return { r: r.toArrayLike(Uint8Array),
|
||||
s: s.toArrayLike(Uint8Array) };
|
||||
return {
|
||||
r: r.toArrayLike(Uint8Array),
|
||||
s: s.toArrayLike(Uint8Array)
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,8 +38,10 @@ async function sign(oid, hash_algo, m, d, hashed) {
|
|||
const curve = new Curve(oid);
|
||||
const key = curve.keyFromPrivate(d);
|
||||
const signature = await key.sign(m, hash_algo, hashed);
|
||||
return { r: signature.r.toArrayLike(Uint8Array),
|
||||
s: signature.s.toArrayLike(Uint8Array) };
|
||||
return {
|
||||
r: signature.r.toArrayLike(Uint8Array),
|
||||
s: signature.s.toArrayLike(Uint8Array)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,8 +65,10 @@ export default {
|
|||
case enums.publicKey.eddsa: {
|
||||
const oid = pub_MPIs[0];
|
||||
// EdDSA signature params are expected in little-endian format
|
||||
const signature = { R: msg_MPIs[0].toUint8Array('le', 32),
|
||||
S: msg_MPIs[1].toUint8Array('le', 32) };
|
||||
const signature = {
|
||||
R: msg_MPIs[0].toUint8Array('le', 32),
|
||||
S: msg_MPIs[1].toUint8Array('le', 32)
|
||||
};
|
||||
const Q = pub_MPIs[1].toUint8Array('be', 33);
|
||||
return publicKey.elliptic.eddsa.verify(oid, hash_algo, signature, data, Q, hashed);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user