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",
|
"no-with": "error",
|
||||||
"nonblock-statement-body-position": "error",
|
"nonblock-statement-body-position": "error",
|
||||||
"object-curly-newline": "off",
|
"object-curly-newline": "off",
|
||||||
"object-curly-spacing": "off",
|
"object-curly-spacing": "error",
|
||||||
"object-property-newline": [
|
"object-property-newline": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -314,6 +314,7 @@ module.exports = {
|
||||||
"error",
|
"error",
|
||||||
"never"
|
"never"
|
||||||
],
|
],
|
||||||
|
"indent": [ "error", 2, { "SwitchCase": 1 } ],
|
||||||
|
|
||||||
// Custom silencers:
|
// Custom silencers:
|
||||||
"camelcase": 0,
|
"camelcase": 0,
|
||||||
|
@ -335,7 +336,6 @@ module.exports = {
|
||||||
"no-unused-vars": 1,
|
"no-unused-vars": 1,
|
||||||
|
|
||||||
// TODO Consider fixing these:
|
// TODO Consider fixing these:
|
||||||
"indent": [ 0, 2, { "SwitchCase": 1 } ],
|
|
||||||
"valid-jsdoc": 0,
|
"valid-jsdoc": 0,
|
||||||
"new-cap": [ 0, { "properties": false, "capIsNewExceptionPattern": "^type_.*" }],
|
"new-cap": [ 0, { "properties": false, "capIsNewExceptionPattern": "^type_.*" }],
|
||||||
"no-lonely-if": 0,
|
"no-lonely-if": 0,
|
||||||
|
|
|
@ -84,8 +84,10 @@ export default {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return { r: r.toArrayLike(Uint8Array),
|
return {
|
||||||
s: s.toArrayLike(Uint8Array) };
|
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 curve = new Curve(oid);
|
||||||
const key = curve.keyFromPrivate(d);
|
const key = curve.keyFromPrivate(d);
|
||||||
const signature = await key.sign(m, hash_algo, hashed);
|
const signature = await key.sign(m, hash_algo, hashed);
|
||||||
return { r: signature.r.toArrayLike(Uint8Array),
|
return {
|
||||||
s: signature.s.toArrayLike(Uint8Array) };
|
r: signature.r.toArrayLike(Uint8Array),
|
||||||
|
s: signature.s.toArrayLike(Uint8Array)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,8 +65,10 @@ export default {
|
||||||
case enums.publicKey.eddsa: {
|
case enums.publicKey.eddsa: {
|
||||||
const oid = pub_MPIs[0];
|
const oid = pub_MPIs[0];
|
||||||
// EdDSA signature params are expected in little-endian format
|
// EdDSA signature params are expected in little-endian format
|
||||||
const signature = { R: msg_MPIs[0].toUint8Array('le', 32),
|
const signature = {
|
||||||
S: msg_MPIs[1].toUint8Array('le', 32) };
|
R: msg_MPIs[0].toUint8Array('le', 32),
|
||||||
|
S: msg_MPIs[1].toUint8Array('le', 32)
|
||||||
|
};
|
||||||
const Q = pub_MPIs[1].toUint8Array('be', 33);
|
const Q = pub_MPIs[1].toUint8Array('be', 33);
|
||||||
return publicKey.elliptic.eddsa.verify(oid, hash_algo, signature, data, Q, hashed);
|
return publicKey.elliptic.eddsa.verify(oid, hash_algo, signature, data, Q, hashed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1564,7 +1564,7 @@ async function wrapKeyObject(secretKeyPacket, secretSubkeyPackets, options) {
|
||||||
}
|
}
|
||||||
await subkeySignaturePacket.sign(secretKeyPacket, dataToSign);
|
await subkeySignaturePacket.sign(secretKeyPacket, dataToSign);
|
||||||
|
|
||||||
return { secretSubkeyPacket, subkeySignaturePacket};
|
return { secretSubkeyPacket, subkeySignaturePacket };
|
||||||
})).then(packets => {
|
})).then(packets => {
|
||||||
packets.forEach(({ secretSubkeyPacket, subkeySignaturePacket }) => {
|
packets.forEach(({ secretSubkeyPacket, subkeySignaturePacket }) => {
|
||||||
packetlist.push(secretSubkeyPacket);
|
packetlist.push(secretSubkeyPacket);
|
||||||
|
|
|
@ -543,7 +543,7 @@ export async function createSignaturePackets(literalDataPacket, privateKeys, sig
|
||||||
throw new Error(`Could not find valid signing key packet in key ${
|
throw new Error(`Could not find valid signing key packet in key ${
|
||||||
privateKey.getKeyId().toHex()}`);
|
privateKey.getKeyId().toHex()}`);
|
||||||
}
|
}
|
||||||
return createSignaturePacket(literalDataPacket, privateKey, signingKey.keyPacket, {signatureType}, date, userId);
|
return createSignaturePacket(literalDataPacket, privateKey, signingKey.keyPacket, { signatureType }, date, userId);
|
||||||
})).then(signatureList => {
|
})).then(signatureList => {
|
||||||
signatureList.forEach(signaturePacket => packetlist.push(signaturePacket));
|
signatureList.forEach(signaturePacket => packetlist.push(signaturePacket));
|
||||||
});
|
});
|
||||||
|
|
|
@ -157,7 +157,7 @@ export function generateKey({ userIds=[], passphrase="", numBits=2048, keyExpira
|
||||||
* @async
|
* @async
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
export function reformatKey({privateKey, userIds=[], passphrase="", keyExpirationTime=0, date, revocationCertificate=true}) {
|
export function reformatKey({ privateKey, userIds=[], passphrase="", keyExpirationTime=0, date, revocationCertificate=true }) {
|
||||||
userIds = toArray(userIds);
|
userIds = toArray(userIds);
|
||||||
const options = { privateKey, userIds, passphrase, keyExpirationTime, date, revocationCertificate };
|
const options = { privateKey, userIds, passphrase, keyExpirationTime, date, revocationCertificate };
|
||||||
if (asyncProxy) {
|
if (asyncProxy) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
||||||
value.postMessage({ action: 'cancel' });
|
value.postMessage({ action: 'cancel' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {highWaterMark: 0});
|
}, { highWaterMark: 0 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
util.restoreStreams(value);
|
util.restoreStreams(value);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user