Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking #273

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ac45196
workflow file to build app using Grunt
kunnapool Feb 24, 2022
7130af6
update env name
kunnapool Feb 24, 2022
903a431
added $ to matrix mapping
kunnapool Feb 24, 2022
3704355
Delete build-with-grunt.yml
kunnapool Feb 24, 2022
4e42fbe
github workflow: build app with Grunt
kunnapool Feb 24, 2022
cbc94a2
lock file
kunnapool Feb 25, 2022
ac3b74c
Merge pull request #1 from kunnapool/add-workflow
kunnapool Feb 25, 2022
d8e94fc
fixed dirctory name with 's'
kunnapool Feb 25, 2022
f5b737b
Merge pull request #4 from kunnapool/fix-workflow-dir-name
kunnapool Feb 25, 2022
84d007d
separate npm install and grunt
kunnapool Feb 25, 2022
9012510
grunt path
kunnapool Feb 25, 2022
c8b86a9
Merge pull request #5 from kunnapool/workflow-errors
kunnapool Feb 25, 2022
949257d
installed and ran prettier
kunnapool Feb 25, 2022
3f75e5e
Merge pull request #6 from kunnapool/install-and-run-prettier
kunnapool Feb 25, 2022
3b4bddc
tests and lint checks
kunnapool Feb 25, 2022
5fae543
Merge pull request #7 from kunnapool/tests-and-lint
kunnapool Feb 25, 2022
9fc91b7
fix lint issues
kunnapool Feb 25, 2022
6a14468
Merge pull request #15 from kunnapool/fix-test-errors
kunnapool Feb 25, 2022
ce2a30f
fix prettier errors
kunnapool Feb 25, 2022
18e4749
Merge pull request #16 from kunnapool/fix-tests-prettier
kunnapool Feb 25, 2022
9f8c2b9
Allow prettier/lint errors to fail (#17)
kunnapool Feb 25, 2022
3b229af
Refactor checkLength functionality into function (#29)
kunnapool Mar 18, 2022
ae5b85a
removed assignment inside ternary operator (#30)
kunnapool Mar 18, 2022
5dd9a20
refactor variable name (#32)
ivandenys Mar 18, 2022
be9543b
fixed context binding issue (#33)
kunnapool Mar 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint issues
  • Loading branch information
kunnapool committed Feb 25, 2022
commit 9fc91b79ba10d5d6fd737174aa22d083b37c867f
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
semi: ["error", "always"],
"array-bracket-spacing": ["error", "always"],
"brace-style": ["error"],
camelcase: ["error"],
"comma-spacing": ["error"],
"comma-style": ["error"],
"eol-last": ["error"],
Expand All @@ -47,6 +46,7 @@ module.exports = {
"comma-dangle": ["error", "always-multiline"],
},
settings: {
emitWarning: true,
react: {
version: "detect",
},
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run-tests-and-lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Run Tests
run: ./node_modules/grunt/bin/grunt coveralls

eslint:
lint:
needs: runTests # if code is failing tests, lint and prettier don't matter
runs-on: ${{ matrix.runEnv }}
strategy:
Expand All @@ -46,4 +46,5 @@ jobs:
run: npm install

- name: Run checks
if: always()
run: ${{ matrix.checks }}
16 changes: 8 additions & 8 deletions lib/elliptic.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";
'use strict';

var elliptic = exports;

elliptic.version = require("../package.json").version;
elliptic.utils = require("./elliptic/utils");
elliptic.rand = require("brorand");
elliptic.curve = require("./elliptic/curve");
elliptic.curves = require("./elliptic/curves");
elliptic.version = require('../package.json').version;
elliptic.utils = require('./elliptic/utils');
elliptic.rand = require('brorand');
elliptic.curve = require('./elliptic/curve');
elliptic.curves = require('./elliptic/curves');

// Protocols
elliptic.ec = require("./elliptic/ec");
elliptic.eddsa = require("./elliptic/eddsa");
elliptic.ec = require('./elliptic/ec');
elliptic.eddsa = require('./elliptic/eddsa');
34 changes: 17 additions & 17 deletions lib/elliptic/curve/base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
'use strict';

var BN = require("bn.js");
var utils = require("../utils");
var BN = require('bn.js');
var utils = require('../utils');
var getNAF = utils.getNAF;
var getJSF = utils.getJSF;
var assert = utils.assert;
Expand Down Expand Up @@ -42,11 +42,11 @@ function BaseCurve(type, conf) {
module.exports = BaseCurve;

BaseCurve.prototype.point = function point() {
throw new Error("Not implemented");
throw new Error('Not implemented');
};

BaseCurve.prototype.validate = function validate() {
throw new Error("Not implemented");
throw new Error('Not implemented');
};

BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
Expand Down Expand Up @@ -102,7 +102,7 @@ BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
if (i < 0) break;
var z = naf[i];
assert(z !== 0);
if (p.type === "affine") {
if (p.type === 'affine') {
// J +- P
if (z > 0) acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
else acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
Expand All @@ -112,15 +112,15 @@ BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
else acc = acc.add(wnd[(-z - 1) >> 1].neg());
}
}
return p.type === "affine" ? acc.toP() : acc;
return p.type === 'affine' ? acc.toP() : acc;
};

BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(
defW,
points,
coeffs,
len,
jacobianResult
jacobianResult,
) {
var wndWidth = this._wnafT1;
var wnd = this._wnafT2;
Expand Down Expand Up @@ -214,7 +214,7 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(
else if (z > 0) p = wnd[j][(z - 1) >> 1];
else if (z < 0) p = wnd[j][(-z - 1) >> 1].neg();

if (p.type === "affine") acc = acc.mixedAdd(p);
if (p.type === 'affine') acc = acc.mixedAdd(p);
else acc = acc.add(p);
}
}
Expand All @@ -233,7 +233,7 @@ function BasePoint(curve, type) {
BaseCurve.BasePoint = BasePoint;

BasePoint.prototype.eq = function eq(/*other*/) {
throw new Error("Not implemented");
throw new Error('Not implemented');
};

BasePoint.prototype.validate = function validate() {
Expand All @@ -255,7 +255,7 @@ BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {

var res = this.point(
bytes.slice(1, 1 + len),
bytes.slice(1 + len, 1 + 2 * len)
bytes.slice(1 + len, 1 + 2 * len),
);

return res;
Expand All @@ -265,7 +265,7 @@ BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
) {
return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
}
throw new Error("Unknown point format");
throw new Error('Unknown point format');
};

BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
Expand All @@ -274,11 +274,11 @@ BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {

BasePoint.prototype._encode = function _encode(compact) {
var len = this.curve.p.byteLength();
var x = this.getX().toArray("be", len);
var x = this.getX().toArray('be', len);

if (compact) return [this.getY().isEven() ? 0x02 : 0x03].concat(x);
if (compact) return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);

return [0x04].concat(x, this.getY().toArray("be", len));
return [ 0x04 ].concat(x, this.getY().toArray('be', len));
};

BasePoint.prototype.encode = function encode(enc, compact) {
Expand Down Expand Up @@ -314,7 +314,7 @@ BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
if (this.precomputed && this.precomputed.doubles)
return this.precomputed.doubles;

var doubles = [this];
var doubles = [ this ];
var acc = this;
for (var i = 0; i < power; i += step) {
for (var j = 0; j < step; j++) acc = acc.dbl();
Expand All @@ -329,7 +329,7 @@ BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
if (this.precomputed && this.precomputed.naf) return this.precomputed.naf;

var res = [this];
var res = [ this ];
var max = (1 << wnd) - 1;
var dbl = max === 1 ? null : this.dbl();
for (var i = 1; i < max; i++) res[i] = res[i - 1].add(dbl);
Expand Down
36 changes: 18 additions & 18 deletions lib/elliptic/curve/edwards.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use strict";
'use strict';

var utils = require("../utils");
var BN = require("bn.js");
var inherits = require("inherits");
var Base = require("./base");
var utils = require('../utils');
var BN = require('bn.js');
var inherits = require('inherits');
var Base = require('./base');

var assert = utils.assert;

Expand All @@ -13,7 +13,7 @@ function EdwardsCurve(conf) {
this.mOneA = this.twisted && (conf.a | 0) === -1;
this.extended = this.mOneA;

Base.call(this, "edwards", conf);
Base.call(this, 'edwards', conf);

this.a = new BN(conf.a, 16).umod(this.red.m);
this.a = this.a.toRed(this.red);
Expand Down Expand Up @@ -54,7 +54,7 @@ EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
var y2 = rhs.redMul(lhs.redInvm());
var y = y2.redSqrt();
if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
throw new Error("invalid point");
throw new Error('invalid point');

var isOdd = y.fromRed().isOdd();
if ((odd && !isOdd) || (!odd && isOdd)) y = y.redNeg();
Expand All @@ -73,13 +73,13 @@ EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
var x2 = lhs.redMul(rhs.redInvm());

if (x2.cmp(this.zero) === 0) {
if (odd) throw new Error("invalid point");
if (odd) throw new Error('invalid point');
else return this.point(this.zero, y);
}

var x = x2.redSqrt();
if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
throw new Error("invalid point");
throw new Error('invalid point');

if (x.fromRed().isOdd() !== odd) x = x.redNeg();

Expand All @@ -101,7 +101,7 @@ EdwardsCurve.prototype.validate = function validate(point) {
};

function Point(curve, x, y, z, t) {
Base.BasePoint.call(this, curve, "projective");
Base.BasePoint.call(this, curve, 'projective');
if (x === null && y === null && z === null) {
this.x = this.curve.zero;
this.y = this.curve.one;
Expand Down Expand Up @@ -141,15 +141,15 @@ Point.fromJSON = function fromJSON(curve, obj) {
};

Point.prototype.inspect = function inspect() {
if (this.isInfinity()) return "<EC Point Infinity>";
if (this.isInfinity()) return '<EC Point Infinity>';
return (
"<EC Point x: " +
'<EC Point x: ' +
this.x.fromRed().toString(16, 2) +
" y: " +
' y: ' +
this.y.fromRed().toString(16, 2) +
" z: " +
' z: ' +
this.z.fromRed().toString(16, 2) +
">"
'>'
);
};

Expand Down Expand Up @@ -348,11 +348,11 @@ Point.prototype.mul = function mul(k) {
};

Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false);
return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
};

Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true);
return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
};

Point.prototype.normalize = function normalize() {
Expand All @@ -373,7 +373,7 @@ Point.prototype.neg = function neg() {
this.x.redNeg(),
this.y,
this.z,
this.t && this.t.redNeg()
this.t && this.t.redNeg(),
);
};

Expand Down
10 changes: 5 additions & 5 deletions lib/elliptic/curve/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
'use strict';

var curve = exports;

curve.base = require("./base");
curve.short = require("./short");
curve.mont = require("./mont");
curve.edwards = require("./edwards");
curve.base = require('./base');
curve.short = require('./short');
curve.mont = require('./mont');
curve.edwards = require('./edwards');
30 changes: 15 additions & 15 deletions lib/elliptic/curve/mont.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";
'use strict';

var BN = require("bn.js");
var inherits = require("inherits");
var Base = require("./base");
var BN = require('bn.js');
var inherits = require('inherits');
var Base = require('./base');

var utils = require("../utils");
var utils = require('../utils');

function MontCurve(conf) {
Base.call(this, "mont", conf);
Base.call(this, 'mont', conf);

this.a = new BN(conf.a, 16).toRed(this.red);
this.b = new BN(conf.b, 16).toRed(this.red);
Expand All @@ -28,7 +28,7 @@ MontCurve.prototype.validate = function validate(point) {
};

function Point(curve, x, z) {
Base.BasePoint.call(this, curve, "projective");
Base.BasePoint.call(this, curve, 'projective');
if (x === null && z === null) {
this.x = this.curve.one;
this.z = this.curve.zero;
Expand Down Expand Up @@ -58,21 +58,21 @@ Point.prototype.precompute = function precompute() {
};

Point.prototype._encode = function _encode() {
return this.getX().toArray("be", this.curve.p.byteLength());
return this.getX().toArray('be', this.curve.p.byteLength());
};

Point.fromJSON = function fromJSON(curve, obj) {
return new Point(curve, obj[0], obj[1] || curve.one);
};

Point.prototype.inspect = function inspect() {
if (this.isInfinity()) return "<EC Point Infinity>";
if (this.isInfinity()) return '<EC Point Infinity>';
return (
"<EC Point x: " +
'<EC Point x: ' +
this.x.fromRed().toString(16, 2) +
" z: " +
' z: ' +
this.z.fromRed().toString(16, 2) +
">"
'>'
);
};

Expand Down Expand Up @@ -103,7 +103,7 @@ Point.prototype.dbl = function dbl() {
};

Point.prototype.add = function add() {
throw new Error("Not supported on Montgomery curve");
throw new Error('Not supported on Montgomery curve');
};

Point.prototype.diffAdd = function diffAdd(p, diff) {
Expand Down Expand Up @@ -154,11 +154,11 @@ Point.prototype.mul = function mul(k) {
};

Point.prototype.mulAdd = function mulAdd() {
throw new Error("Not supported on Montgomery curve");
throw new Error('Not supported on Montgomery curve');
};

Point.prototype.jumlAdd = function jumlAdd() {
throw new Error("Not supported on Montgomery curve");
throw new Error('Not supported on Montgomery curve');
};

Point.prototype.eq = function eq(other) {
Expand Down
Loading