Fixed and unmuted a few eslint errors, ~10 remain

This commit is contained in:
Mahrud Sayrafi 2018-02-07 04:03:46 -08:00
parent b2e39ccaf9
commit 1383107202
No known key found for this signature in database
GPG Key ID: C24071B956C3245F
7 changed files with 13 additions and 16 deletions

View File

@ -333,6 +333,7 @@ module.exports = {
"require-await": 0, "require-await": 0,
"no-multi-assign": 0, "no-multi-assign": 0,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,
"no-restricted-syntax": 0,
"one-var-declaration-per-line": 0, "one-var-declaration-per-line": 0,
// Custom errors: // Custom errors:
@ -347,18 +348,13 @@ module.exports = {
"no-unused-vars": 0, "no-unused-vars": 0,
"indent": [ 0, 2, { "SwitchCase": 1 } ], "indent": [ 0, 2, { "SwitchCase": 1 } ],
// Consider fixing these: // TODO Consider fixing these:
"new-cap": [ 0, { "properties": false, "capIsNewExceptionPattern": "^type_.*" }], "new-cap": [ 0, { "properties": false, "capIsNewExceptionPattern": "^type_.*" }],
"no-lonely-if": 0, "no-lonely-if": 0,
"no-fallthrough": 0, "no-fallthrough": 0,
"consistent-this": 0,
"no-invalid-this": 0, "no-invalid-this": 0,
"callback-return": 0,
"no-useless-call": 0, // only occurs for workers
"import/extensions": 0, "import/extensions": 0,
"no-useless-escape": 0, "no-useless-escape": 0,
"no-case-declarations": 0,
"no-restricted-syntax": 0,
"no-array-constructor": 0, "no-array-constructor": 0,
"no-constant-condition": 0, "no-constant-condition": 0,
"no-buffer-constructor": 0, // deprecated "no-buffer-constructor": 0, // deprecated

View File

@ -43,7 +43,7 @@ OpenPGP.js [![Build Status](https://travis-ci.org/openpgpjs/openpgpjs.svg?branch
### Performance ### Performance
* Version 3.0.0 of the library introduces support for public-key cryptography using [elliptic curves](https://wiki.gnupg.org/ECC). We use native implementations on browsers and Node.js when available or [Elliptic](https://github.com/indutny/elliptic) when otherwise. Elliptic curve cryptography provides stronger security per bits of key, which allows for much faster operations. Currently the following curves are supported: ("Yes*" means "when available") * Version 3.0.0 of the library introduces support for public-key cryptography using [elliptic curves](https://wiki.gnupg.org/ECC). We use native implementations on browsers and Node.js when available or [Elliptic](https://github.com/indutny/elliptic) otherwise. Elliptic curve cryptography provides stronger security per bits of key, which allows for much faster operations. Currently the following curves are supported: ("Yes*" means "when available")
>| Curve | Encryption | Signature | Elliptic | NodeCrypto | WebCrypto | >| Curve | Encryption | Signature | Elliptic | NodeCrypto | WebCrypto |
>|:---------- |:----------:|:---------:|:--------:|:----------:|:---------:| >|:---------- |:----------:|:---------:|:--------:|:----------:|:---------:|

View File

@ -62,7 +62,7 @@ export default {
return dopublic.compareTo(s1) === 0; return dopublic.compareTo(s1) === 0;
case 19: case 19:
// ECDSA // ECDSA
const ecdsa = publicKey.elliptic.ecdsa; var ecdsa = publicKey.elliptic.ecdsa;
curve = publickey_MPIs[0]; curve = publickey_MPIs[0];
r = msg_MPIs[0].toBigInteger(); r = msg_MPIs[0].toBigInteger();
s = msg_MPIs[1].toBigInteger(); s = msg_MPIs[1].toBigInteger();
@ -71,7 +71,7 @@ export default {
return ecdsa.verify(curve.oid, hash_algo, {r: r, s: s}, m, Q); return ecdsa.verify(curve.oid, hash_algo, {r: r, s: s}, m, Q);
case 22: case 22:
// EdDSA // EdDSA
const eddsa = publicKey.elliptic.eddsa; var eddsa = publicKey.elliptic.eddsa;
curve = publickey_MPIs[0]; curve = publickey_MPIs[0];
r = msg_MPIs[0].toBigInteger(); r = msg_MPIs[0].toBigInteger();
s = msg_MPIs[1].toBigInteger(); s = msg_MPIs[1].toBigInteger();

View File

@ -1,3 +1,4 @@
/* eslint-disable callback-return */
/** /**
* This class represents a list of openpgp packets. * This class represents a list of openpgp packets.
* Take care when iterating over it - the packets themselves * Take care when iterating over it - the packets themselves

View File

@ -272,11 +272,11 @@ SecretKey.prototype.decrypt = function (passphrase) {
}; };
SecretKey.prototype.generate = function (bits, curve) { SecretKey.prototype.generate = function (bits, curve) {
var self = this; var that = this;
return crypto.generateParams(self.algorithm, bits, curve).then(function(params) { return crypto.generateParams(that.algorithm, bits, curve).then(function(params) {
self.params = params; that.params = params;
self.isDecrypted = true; that.isDecrypted = true;
}); });
}; };

View File

@ -90,7 +90,7 @@ AsyncProxy.prototype.onMessage = function(event) {
*/ */
AsyncProxy.prototype.seedRandom = function(size) { AsyncProxy.prototype.seedRandom = function(size) {
const buf = this.getRandomBuffer(size); const buf = this.getRandomBuffer(size);
this.worker.postMessage({ event:'seed-random', buf }, util.getTransferables.call(util, buf)); this.worker.postMessage({ event:'seed-random', buf }, util.getTransferables(buf));
}; };
/** /**
@ -125,7 +125,7 @@ AsyncProxy.prototype.delegate = function(method, options) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// clone packets (for web worker structured cloning algorithm) // clone packets (for web worker structured cloning algorithm)
this.worker.postMessage({ id:id, event:method, options:packet.clone.clonePackets(options) }, util.getTransferables.call(util, options)); this.worker.postMessage({ id:id, event:method, options:packet.clone.clonePackets(options) }, util.getTransferables(options));
// remember to handle parsing cloned packets from worker // remember to handle parsing cloned packets from worker
this.tasks[id] = { resolve: data => resolve(packet.clone.parseClonedPackets(data, method)), reject }; this.tasks[id] = { resolve: data => resolve(packet.clone.parseClonedPackets(data, method)), reject };

View File

@ -98,5 +98,5 @@ function response(event) {
if (openpgp.crypto.random.randomBuffer.size < MIN_SIZE_RANDOM_BUFFER) { if (openpgp.crypto.random.randomBuffer.size < MIN_SIZE_RANDOM_BUFFER) {
self.postMessage({event: 'request-seed'}); self.postMessage({event: 'request-seed'});
} }
self.postMessage(event, openpgp.util.getTransferables.call(openpgp.util, event.data)); self.postMessage(event, openpgp.util.getTransferables(event.data));
} }