Skip to content

Commit 872b93d

Browse files
committed
[eslint] switch from standard to eslint
1 parent b029f00 commit 872b93d

File tree

8 files changed

+440
-392
lines changed

8 files changed

+440
-392
lines changed

.eslintrc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"root": true,
3+
4+
"extends": "@ljharb",
5+
6+
"rules": {
7+
"camelcase": "off",
8+
"func-style": "off",
9+
"id-length": "off",
10+
"max-lines-per-function": "off",
11+
"multiline-comment-style": "off",
12+
"no-negated-condition": "off",
13+
"no-param-reassign": "warn",
14+
"sort-keys": "off",
15+
},
16+
17+
"overrides": [
18+
{
19+
"files": "./asn1.js",
20+
"rules": {
21+
"no-underscore-dangle": "off",
22+
}
23+
},
24+
{
25+
"files": [
26+
"./asn1.js",
27+
"./certificate.js",
28+
],
29+
"rules": {
30+
"no-invalid-this": "off",
31+
}
32+
},
33+
]
34+
}

asn1.js

Lines changed: 101 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,123 @@
11
// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
22
// Fedor, you are amazing.
3-
'use strict'
43

5-
var asn1 = require('asn1.js')
4+
'use strict';
65

7-
exports.certificate = require('./certificate')
6+
var asn1 = require('asn1.js');
7+
8+
exports.certificate = require('./certificate');
89

910
var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
10-
this.seq().obj(
11-
this.key('version').int(),
12-
this.key('modulus').int(),
13-
this.key('publicExponent').int(),
14-
this.key('privateExponent').int(),
15-
this.key('prime1').int(),
16-
this.key('prime2').int(),
17-
this.key('exponent1').int(),
18-
this.key('exponent2').int(),
19-
this.key('coefficient').int()
20-
)
21-
})
22-
exports.RSAPrivateKey = RSAPrivateKey
11+
this.seq().obj(
12+
this.key('version')['int'](),
13+
this.key('modulus')['int'](),
14+
this.key('publicExponent')['int'](),
15+
this.key('privateExponent')['int'](),
16+
this.key('prime1')['int'](),
17+
this.key('prime2')['int'](),
18+
this.key('exponent1')['int'](),
19+
this.key('exponent2')['int'](),
20+
this.key('coefficient')['int']()
21+
);
22+
});
23+
exports.RSAPrivateKey = RSAPrivateKey;
2324

2425
var RSAPublicKey = asn1.define('RSAPublicKey', function () {
25-
this.seq().obj(
26-
this.key('modulus').int(),
27-
this.key('publicExponent').int()
28-
)
29-
})
30-
exports.RSAPublicKey = RSAPublicKey
31-
32-
var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
33-
this.seq().obj(
34-
this.key('algorithm').use(AlgorithmIdentifier),
35-
this.key('subjectPublicKey').bitstr()
36-
)
37-
})
38-
exports.PublicKey = PublicKey
26+
this.seq().obj(
27+
this.key('modulus')['int'](),
28+
this.key('publicExponent')['int']()
29+
);
30+
});
31+
exports.RSAPublicKey = RSAPublicKey;
3932

4033
var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
41-
this.seq().obj(
42-
this.key('algorithm').objid(),
43-
this.key('none').null_().optional(),
44-
this.key('curve').objid().optional(),
45-
this.key('params').seq().obj(
46-
this.key('p').int(),
47-
this.key('q').int(),
48-
this.key('g').int()
49-
).optional()
50-
)
51-
})
34+
this.seq().obj(
35+
this.key('algorithm').objid(),
36+
this.key('none').null_().optional(),
37+
this.key('curve').objid().optional(),
38+
this.key('params').seq().obj(
39+
this.key('p')['int'](),
40+
this.key('q')['int'](),
41+
this.key('g')['int']()
42+
).optional()
43+
);
44+
});
45+
46+
var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
47+
this.seq().obj(
48+
this.key('algorithm').use(AlgorithmIdentifier),
49+
this.key('subjectPublicKey').bitstr()
50+
);
51+
});
52+
exports.PublicKey = PublicKey;
5253

5354
var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
54-
this.seq().obj(
55-
this.key('version').int(),
56-
this.key('algorithm').use(AlgorithmIdentifier),
57-
this.key('subjectPrivateKey').octstr()
58-
)
59-
})
60-
exports.PrivateKey = PrivateKeyInfo
55+
this.seq().obj(
56+
this.key('version')['int'](),
57+
this.key('algorithm').use(AlgorithmIdentifier),
58+
this.key('subjectPrivateKey').octstr()
59+
);
60+
});
61+
exports.PrivateKey = PrivateKeyInfo;
6162
var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
62-
this.seq().obj(
63-
this.key('algorithm').seq().obj(
64-
this.key('id').objid(),
65-
this.key('decrypt').seq().obj(
66-
this.key('kde').seq().obj(
67-
this.key('id').objid(),
68-
this.key('kdeparams').seq().obj(
69-
this.key('salt').octstr(),
70-
this.key('iters').int()
71-
)
72-
),
73-
this.key('cipher').seq().obj(
74-
this.key('algo').objid(),
75-
this.key('iv').octstr()
76-
)
77-
)
78-
),
79-
this.key('subjectPrivateKey').octstr()
80-
)
81-
})
63+
this.seq().obj(
64+
this.key('algorithm').seq().obj(
65+
this.key('id').objid(),
66+
this.key('decrypt').seq().obj(
67+
this.key('kde').seq().obj(
68+
this.key('id').objid(),
69+
this.key('kdeparams').seq().obj(
70+
this.key('salt').octstr(),
71+
this.key('iters')['int']()
72+
)
73+
),
74+
this.key('cipher').seq().obj(
75+
this.key('algo').objid(),
76+
this.key('iv').octstr()
77+
)
78+
)
79+
),
80+
this.key('subjectPrivateKey').octstr()
81+
);
82+
});
8283

83-
exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
84+
exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;
8485

8586
var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
86-
this.seq().obj(
87-
this.key('version').int(),
88-
this.key('p').int(),
89-
this.key('q').int(),
90-
this.key('g').int(),
91-
this.key('pub_key').int(),
92-
this.key('priv_key').int()
93-
)
94-
})
95-
exports.DSAPrivateKey = DSAPrivateKey
87+
this.seq().obj(
88+
this.key('version')['int'](),
89+
this.key('p')['int'](),
90+
this.key('q')['int'](),
91+
this.key('g')['int'](),
92+
this.key('pub_key')['int'](),
93+
this.key('priv_key')['int']()
94+
);
95+
});
96+
exports.DSAPrivateKey = DSAPrivateKey;
9697

9798
exports.DSAparam = asn1.define('DSAparam', function () {
98-
this.int()
99-
})
100-
101-
var ECPrivateKey = asn1.define('ECPrivateKey', function () {
102-
this.seq().obj(
103-
this.key('version').int(),
104-
this.key('privateKey').octstr(),
105-
this.key('parameters').optional().explicit(0).use(ECParameters),
106-
this.key('publicKey').optional().explicit(1).bitstr()
107-
)
108-
})
109-
exports.ECPrivateKey = ECPrivateKey
99+
this['int']();
100+
});
110101

111102
var ECParameters = asn1.define('ECParameters', function () {
112-
this.choice({
113-
namedCurve: this.objid()
114-
})
115-
})
103+
this.choice({
104+
namedCurve: this.objid()
105+
});
106+
});
107+
108+
var ECPrivateKey = asn1.define('ECPrivateKey', function () {
109+
this.seq().obj(
110+
this.key('version')['int'](),
111+
this.key('privateKey').octstr(),
112+
this.key('parameters').optional().explicit(0).use(ECParameters),
113+
this.key('publicKey').optional().explicit(1).bitstr()
114+
);
115+
});
116+
exports.ECPrivateKey = ECPrivateKey;
116117

117118
exports.signature = asn1.define('signature', function () {
118-
this.seq().obj(
119-
this.key('r').int(),
120-
this.key('s').int()
121-
)
122-
})
119+
this.seq().obj(
120+
this.key('r')['int'](),
121+
this.key('s')['int']()
122+
);
123+
});

0 commit comments

Comments
 (0)