Skip to content

Commit fae3e79

Browse files
committed
style: upgrade standard linter and fix lint issues
1 parent 67a8601 commit fae3e79

File tree

8 files changed

+59
-59
lines changed

8 files changed

+59
-59
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ private API and is subject to change between any versions.
339339
#### How do I use it outside of Node.js
340340

341341
It is **only built for ^10.13.0 || >=12.0.0 Node.js** environment - including @panva/jose in
342-
transpiled browser-environment targetted projects is not supported and may result in unexpected
342+
transpiled browser-environment targeted projects is not supported and may result in unexpected
343343
results.
344344

345345
#### How is it different from [`jws`](https://github.com/brianloveswords/node-jws), [`jwa`](https://github.com/brianloveswords/node-jwa) or [`jsonwebtoken`](https://github.com/auth0/node-jsonwebtoken)?

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060
"devDependencies": {
6161
"@commitlint/cli": "^8.1.0",
6262
"@commitlint/config-conventional": "^8.1.0",
63-
"ava": "^2.2.0",
63+
"ava": "^2.3.0",
6464
"babel-eslint": "^10.0.2",
6565
"c8": "^5.0.1",
66-
"husky": "^3.0.1",
67-
"standard": "^13.1.0"
66+
"husky": "^3.0.4",
67+
"standard": "^14.0.0"
6868
},
6969
"engines": {
7070
"node": "^10.13.0 || >=12.0.0"

test/jwk/ec.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const errors = require('../../lib/errors')
77

88
const ECKey = require('../../lib/jwk/key/ec')
99

10-
test(`EC key .algorithms invalid operation`, t => {
10+
test('EC key .algorithms invalid operation', t => {
1111
const key = new ECKey(createPrivateKey(fixtures.PEM['P-256'].private))
1212
t.throws(() => key.algorithms('foo'), { instanceOf: TypeError, message: 'invalid key operation' })
1313
})

test/jwk/import.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test('failed to import throws an error', t => {
8282

8383
if (!('electron' in process.versions) && keyObjectSupported) {
8484
;[
85-
`-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBANuHjLdqQcKozzWf9fUfe/mw4i5NLT8k\nCIA75k+GNYNbBaGZ2lGNeKsrjHzM8w7mE5k6qx5hDB4n88qFoauqCsUZ4knbTybn\nYV08gfWS375l/EGSpt3c/1dezVZuT/FmEeXbMhOIDORf/9f/6PpEMFN3eghszLvN\ng+L/19HVpWAXAhUAnOFG9vvOiZIz/ZxdpR+EVv8o4T8CgYBDk/ChY3fo4DrxzLZT\n7AjsAiJOzO8QnsV07Gh8gSzUCBsb+Hb4GvMs2U6rB5mxOMib3S2HGbs791uBva2a\nA6pzNzRmgV/w6CyOcxhCkZdVL7MwO9y5iq6V65R4GgfkCrIAYi/BW6XdXOyw/7J0\nt/4wB0/wKtsXf541NLfmUprJ+QOBhAACgYBGbXflbrGGg02+w8Xo6RO+tHoekREZ\nlJA0KKBN4jT0S3/OsLQeHtO7k/gkdMMbXD1J1fae9tIxy1SwYVTR6csgydGuvuyG\nB4A/ZtXEb+dumCBbtw8dyred4Okhl44Fdrs79F1rjSWEcwKqJghxS+GsbA0vcTaf\nAHDL6OblN04uzg==\n-----END PUBLIC KEY-----`,
85+
'-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBANuHjLdqQcKozzWf9fUfe/mw4i5NLT8k\nCIA75k+GNYNbBaGZ2lGNeKsrjHzM8w7mE5k6qx5hDB4n88qFoauqCsUZ4knbTybn\nYV08gfWS375l/EGSpt3c/1dezVZuT/FmEeXbMhOIDORf/9f/6PpEMFN3eghszLvN\ng+L/19HVpWAXAhUAnOFG9vvOiZIz/ZxdpR+EVv8o4T8CgYBDk/ChY3fo4DrxzLZT\n7AjsAiJOzO8QnsV07Gh8gSzUCBsb+Hb4GvMs2U6rB5mxOMib3S2HGbs791uBva2a\nA6pzNzRmgV/w6CyOcxhCkZdVL7MwO9y5iq6V65R4GgfkCrIAYi/BW6XdXOyw/7J0\nt/4wB0/wKtsXf541NLfmUprJ+QOBhAACgYBGbXflbrGGg02+w8Xo6RO+tHoekREZ\nlJA0KKBN4jT0S3/OsLQeHtO7k/gkdMMbXD1J1fae9tIxy1SwYVTR6csgydGuvuyG\nB4A/ZtXEb+dumCBbtw8dyred4Okhl44Fdrs79F1rjSWEcwKqJghxS+GsbA0vcTaf\nAHDL6OblN04uzg==\n-----END PUBLIC KEY-----',
8686
generateKeyPairSync('dsa', { modulusLength: 1024 }).publicKey,
8787
generateKeyPairSync('dsa', { modulusLength: 1024 }).privateKey
8888
].forEach((unsupported, i) => {

test/jwk/oct.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const { generateSync } = require('../../lib/jwk/generate')
1111
const keyObject = createSecretKey(Buffer.from('secret'))
1212
const key = new OctKey(keyObject)
1313

14-
test(`RSA key .algorithms invalid operation`, t => {
14+
test('RSA key .algorithms invalid operation', t => {
1515
t.throws(() => key.algorithms('foo'), { instanceOf: TypeError, message: 'invalid key operation' })
1616
})
1717

@@ -85,22 +85,22 @@ test('no verify support when `use` is "enc"', t => {
8585
})
8686

8787
if (!('electron' in process.versions)) {
88-
test(`oct keys (odd bits) deriveKey algorithms only have "PBES2"`, t => {
88+
test('oct keys (odd bits) deriveKey algorithms only have "PBES2"', t => {
8989
const key = generateSync('oct', 136)
9090
const result = key.algorithms('deriveKey')
9191
t.is(result.constructor, Set)
9292
t.deepEqual([...result], ['PBES2-HS256+A128KW', 'PBES2-HS384+A192KW', 'PBES2-HS512+A256KW'])
9393
})
9494
} else {
95-
test(`oct keys (odd bits) deriveKey don't even have "PBES2"`, t => {
95+
test('oct keys (odd bits) deriveKey don\'t even have "PBES2"', t => {
9696
const key = generateSync('oct', 136)
9797
const result = key.algorithms('deriveKey')
9898
t.is(result.constructor, Set)
9999
t.deepEqual([...result], [])
100100
})
101101
}
102102

103-
test(`oct keys (odd bits) wrap/unwrap algorithms cant wrap`, t => {
103+
test('oct keys (odd bits) wrap/unwrap algorithms cant wrap', t => {
104104
const key = generateSync('oct', 136)
105105
const result = key.algorithms('wrapKey')
106106
t.is(result.constructor, Set)

test/jwk/okp_enc.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const fixtures = require('../fixtures')
1010

1111
const OKPKey = require('../../lib/jwk/key/okp')
1212

13-
test(`OKP key .algorithms invalid operation`, t => {
14-
const key = new OKPKey(createPrivateKey(fixtures.PEM['X25519'].private))
13+
test('OKP key .algorithms invalid operation', t => {
14+
const key = new OKPKey(createPrivateKey(fixtures.PEM.X25519.private))
1515
t.throws(() => key.algorithms('foo'), { instanceOf: TypeError, message: 'invalid key operation' })
1616
})
1717

test/jwk/okp_sig.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const fixtures = require('../fixtures')
1010

1111
const OKPKey = require('../../lib/jwk/key/okp')
1212

13-
test(`OKP key .algorithms invalid operation`, t => {
14-
const key = new OKPKey(createPrivateKey(fixtures.PEM['Ed25519'].private))
13+
test('OKP key .algorithms invalid operation', t => {
14+
const key = new OKPKey(createPrivateKey(fixtures.PEM.Ed25519.private))
1515
t.throws(() => key.algorithms('foo'), { instanceOf: TypeError, message: 'invalid key operation' })
1616
})
1717

test/jwk/rsa.test.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { oaepHashSupported } = require('../../lib/help/node_support')
77
const { generateSync } = require('../../lib/jwk/generate')
88
const RSAKey = require('../../lib/jwk/key/rsa')
99

10-
test(`RSA key .algorithms invalid operation`, t => {
10+
test('RSA key .algorithms invalid operation', t => {
1111
const key = new RSAKey(createPrivateKey(fixtures.PEM.RSA.private))
1212
t.throws(() => key.algorithms('foo'), { instanceOf: TypeError, message: 'invalid key operation' })
1313
})
@@ -17,20 +17,20 @@ test(`RSA key .algorithms invalid operation`, t => {
1717
const keyObject = createPrivateKey(fixtures.PEM.RSA.private)
1818
const key = new RSAKey(keyObject)
1919

20-
test(`RSA Private key (with alg)`, hasProperty, new RSAKey(keyObject, { alg: 'RS256' }), 'alg', 'RS256')
21-
test(`RSA Private key (with kid)`, hasProperty, new RSAKey(keyObject, { kid: 'foobar' }), 'kid', 'foobar')
22-
test(`RSA Private key (with use)`, hasProperty, new RSAKey(keyObject, { use: 'sig' }), 'use', 'sig')
23-
test(`RSA Private key`, hasNoProperties, key, 'k', 'x', 'y')
24-
test(`RSA Private key`, hasProperties, key, 'e', 'n', 'p', 'q', 'dp', 'dq', 'qi', 'd')
25-
test(`RSA Private key`, hasProperty, key, 'alg', undefined)
26-
test(`RSA Private key`, hasProperty, key, 'kid', 'Bj1ccHv-y_ZoejJKWhAhBHLpnGSlawNAQUAMEQBd5L8')
27-
test(`RSA Private key`, hasProperty, key, 'kty', 'RSA')
28-
test(`RSA Private key`, hasProperty, key, 'length', 2048)
29-
test(`RSA Private key`, hasProperty, key, 'private', true)
30-
test(`RSA Private key`, hasProperty, key, 'public', false)
31-
test(`RSA Private key`, hasProperty, key, 'secret', false)
32-
test(`RSA Private key`, hasProperty, key, 'type', 'private')
33-
test(`RSA Private key`, hasProperty, key, 'use', undefined)
20+
test('RSA Private key (with alg)', hasProperty, new RSAKey(keyObject, { alg: 'RS256' }), 'alg', 'RS256')
21+
test('RSA Private key (with kid)', hasProperty, new RSAKey(keyObject, { kid: 'foobar' }), 'kid', 'foobar')
22+
test('RSA Private key (with use)', hasProperty, new RSAKey(keyObject, { use: 'sig' }), 'use', 'sig')
23+
test('RSA Private key', hasNoProperties, key, 'k', 'x', 'y')
24+
test('RSA Private key', hasProperties, key, 'e', 'n', 'p', 'q', 'dp', 'dq', 'qi', 'd')
25+
test('RSA Private key', hasProperty, key, 'alg', undefined)
26+
test('RSA Private key', hasProperty, key, 'kid', 'Bj1ccHv-y_ZoejJKWhAhBHLpnGSlawNAQUAMEQBd5L8')
27+
test('RSA Private key', hasProperty, key, 'kty', 'RSA')
28+
test('RSA Private key', hasProperty, key, 'length', 2048)
29+
test('RSA Private key', hasProperty, key, 'private', true)
30+
test('RSA Private key', hasProperty, key, 'public', false)
31+
test('RSA Private key', hasProperty, key, 'secret', false)
32+
test('RSA Private key', hasProperty, key, 'type', 'private')
33+
test('RSA Private key', hasProperty, key, 'use', undefined)
3434

3535
if (oaepHashSupported) {
3636
test('RSA Private key algorithms (no operation)', t => {
@@ -53,54 +53,54 @@ test(`RSA key .algorithms invalid operation`, t => {
5353
t.deepEqual([...result], ['RS256'])
5454
})
5555

56-
test(`RSA Private key supports sign alg (no use)`, t => {
56+
test('RSA Private key supports sign alg (no use)', t => {
5757
const result = key.algorithms('sign')
5858
t.is(result.constructor, Set)
5959
t.deepEqual([...result], ['PS256', 'RS256', 'PS384', 'RS384', 'PS512', 'RS512'])
6060
})
6161

62-
test(`RSA Private key supports verify alg (no use)`, t => {
62+
test('RSA Private key supports verify alg (no use)', t => {
6363
const result = key.algorithms('verify')
6464
t.is(result.constructor, Set)
6565
t.deepEqual([...result], ['PS256', 'RS256', 'PS384', 'RS384', 'PS512', 'RS512'])
6666
})
6767

68-
test(`RSA Private key supports sign alg when \`use\` is "sig")`, t => {
68+
test('RSA Private key supports sign alg when `use` is "sig")', t => {
6969
const sigKey = new RSAKey(keyObject, { use: 'sig' })
7070
const result = sigKey.algorithms('sign')
7171
t.is(result.constructor, Set)
7272
t.deepEqual([...result], ['PS256', 'RS256', 'PS384', 'RS384', 'PS512', 'RS512'])
7373
})
7474

75-
test(`RSA Private key supports verify alg when \`use\` is "sig")`, t => {
75+
test('RSA Private key supports verify alg when `use` is "sig")', t => {
7676
const sigKey = new RSAKey(keyObject, { use: 'sig' })
7777
const result = sigKey.algorithms('verify')
7878
t.is(result.constructor, Set)
7979
t.deepEqual([...result], ['PS256', 'RS256', 'PS384', 'RS384', 'PS512', 'RS512'])
8080
})
8181

82-
test(`RSA Private key supports single sign alg when \`alg\` is set)`, t => {
82+
test('RSA Private key supports single sign alg when `alg` is set)', t => {
8383
const sigKey = new RSAKey(keyObject, { alg: 'RS256' })
8484
const result = sigKey.algorithms('sign')
8585
t.is(result.constructor, Set)
8686
t.deepEqual([...result], ['RS256'])
8787
})
8888

89-
test(`RSA Private key supports single verify alg when \`alg\` is set)`, t => {
89+
test('RSA Private key supports single verify alg when `alg` is set)', t => {
9090
const sigKey = new RSAKey(keyObject, { alg: 'RS256' })
9191
const result = sigKey.algorithms('verify')
9292
t.is(result.constructor, Set)
9393
t.deepEqual([...result], ['RS256'])
9494
})
9595

96-
test(`RSA Private key no sign support when \`use\` is "enc"`, t => {
96+
test('RSA Private key no sign support when `use` is "enc"', t => {
9797
const encKey = new RSAKey(keyObject, { use: 'enc' })
9898
const result = encKey.algorithms('sign')
9999
t.is(result.constructor, Set)
100100
t.deepEqual([...result], [])
101101
})
102102

103-
test(`RSA Private key no verify support when \`use\` is "enc"`, t => {
103+
test('RSA Private key no verify support when `use` is "enc"', t => {
104104
const encKey = new RSAKey(keyObject, { use: 'enc' })
105105
const result = encKey.algorithms('verify')
106106
t.is(result.constructor, Set)
@@ -173,20 +173,20 @@ test(`RSA key .algorithms invalid operation`, t => {
173173
const keyObject = createPublicKey(fixtures.PEM.RSA.public)
174174
const key = new RSAKey(keyObject)
175175

176-
test(`RSA Public key (with alg)`, hasProperty, new RSAKey(keyObject, { alg: 'RS256' }), 'alg', 'RS256')
177-
test(`RSA Public key (with kid)`, hasProperty, new RSAKey(keyObject, { kid: 'foobar' }), 'kid', 'foobar')
178-
test(`RSA Public key (with use)`, hasProperty, new RSAKey(keyObject, { use: 'sig' }), 'use', 'sig')
179-
test(`RSA Public key`, hasNoProperties, key, 'k', 'x', 'y', 'd', 'p', 'q', 'dp', 'dq', 'qi')
180-
test(`RSA Public key`, hasProperties, key, 'e', 'n')
181-
test(`RSA Public key`, hasProperty, key, 'alg', undefined)
182-
test(`RSA Public key`, hasProperty, key, 'kid', 'Bj1ccHv-y_ZoejJKWhAhBHLpnGSlawNAQUAMEQBd5L8')
183-
test(`RSA Public key`, hasProperty, key, 'kty', 'RSA')
184-
test(`RSA Public key`, hasProperty, key, 'length', 2048)
185-
test(`RSA Public key`, hasProperty, key, 'private', false)
186-
test(`RSA Public key`, hasProperty, key, 'public', true)
187-
test(`RSA Public key`, hasProperty, key, 'secret', false)
188-
test(`RSA Public key`, hasProperty, key, 'type', 'public')
189-
test(`RSA Public key`, hasProperty, key, 'use', undefined)
176+
test('RSA Public key (with alg)', hasProperty, new RSAKey(keyObject, { alg: 'RS256' }), 'alg', 'RS256')
177+
test('RSA Public key (with kid)', hasProperty, new RSAKey(keyObject, { kid: 'foobar' }), 'kid', 'foobar')
178+
test('RSA Public key (with use)', hasProperty, new RSAKey(keyObject, { use: 'sig' }), 'use', 'sig')
179+
test('RSA Public key', hasNoProperties, key, 'k', 'x', 'y', 'd', 'p', 'q', 'dp', 'dq', 'qi')
180+
test('RSA Public key', hasProperties, key, 'e', 'n')
181+
test('RSA Public key', hasProperty, key, 'alg', undefined)
182+
test('RSA Public key', hasProperty, key, 'kid', 'Bj1ccHv-y_ZoejJKWhAhBHLpnGSlawNAQUAMEQBd5L8')
183+
test('RSA Public key', hasProperty, key, 'kty', 'RSA')
184+
test('RSA Public key', hasProperty, key, 'length', 2048)
185+
test('RSA Public key', hasProperty, key, 'private', false)
186+
test('RSA Public key', hasProperty, key, 'public', true)
187+
test('RSA Public key', hasProperty, key, 'secret', false)
188+
test('RSA Public key', hasProperty, key, 'type', 'public')
189+
test('RSA Public key', hasProperty, key, 'use', undefined)
190190

191191
if (oaepHashSupported) {
192192
test('RSA EC Public key algorithms (no operation)', t => {
@@ -209,54 +209,54 @@ test(`RSA key .algorithms invalid operation`, t => {
209209
t.deepEqual([...result], ['RS256'])
210210
})
211211

212-
test(`RSA Public key cannot sign`, t => {
212+
test('RSA Public key cannot sign', t => {
213213
const result = key.algorithms('sign')
214214
t.is(result.constructor, Set)
215215
t.deepEqual([...result], [])
216216
})
217217

218-
test(`RSA Public key supports verify alg (no use)`, t => {
218+
test('RSA Public key supports verify alg (no use)', t => {
219219
const result = key.algorithms('verify')
220220
t.is(result.constructor, Set)
221221
t.deepEqual([...result], ['PS256', 'RS256', 'PS384', 'RS384', 'PS512', 'RS512'])
222222
})
223223

224-
test(`RSA Public key cannot sign even when \`use\` is "sig")`, t => {
224+
test('RSA Public key cannot sign even when `use` is "sig")', t => {
225225
const sigKey = new RSAKey(keyObject, { use: 'sig' })
226226
const result = sigKey.algorithms('sign')
227227
t.is(result.constructor, Set)
228228
t.deepEqual([...result], [])
229229
})
230230

231-
test(`RSA Public key supports verify alg when \`use\` is "sig")`, t => {
231+
test('RSA Public key supports verify alg when `use` is "sig")', t => {
232232
const sigKey = new RSAKey(keyObject, { use: 'sig' })
233233
const result = sigKey.algorithms('verify')
234234
t.is(result.constructor, Set)
235235
t.deepEqual([...result], ['PS256', 'RS256', 'PS384', 'RS384', 'PS512', 'RS512'])
236236
})
237237

238-
test(`RSA Public key cannot sign even when \`alg\` is set)`, t => {
238+
test('RSA Public key cannot sign even when `alg` is set)', t => {
239239
const sigKey = new RSAKey(keyObject, { alg: 'RS256' })
240240
const result = sigKey.algorithms('sign')
241241
t.is(result.constructor, Set)
242242
t.deepEqual([...result], [])
243243
})
244244

245-
test(`RSA Public key supports single verify alg when \`alg\` is set)`, t => {
245+
test('RSA Public key supports single verify alg when `alg` is set)', t => {
246246
const sigKey = new RSAKey(keyObject, { alg: 'RS256' })
247247
const result = sigKey.algorithms('verify')
248248
t.is(result.constructor, Set)
249249
t.deepEqual([...result], ['RS256'])
250250
})
251251

252-
test(`RSA Public key no sign support when \`use\` is "enc"`, t => {
252+
test('RSA Public key no sign support when `use` is "enc"', t => {
253253
const encKey = new RSAKey(keyObject, { use: 'enc' })
254254
const result = encKey.algorithms('sign')
255255
t.is(result.constructor, Set)
256256
t.deepEqual([...result], [])
257257
})
258258

259-
test(`RSA Public key no verify support when \`use\` is "enc"`, t => {
259+
test('RSA Public key no verify support when `use` is "enc"', t => {
260260
const encKey = new RSAKey(keyObject, { use: 'enc' })
261261
const result = encKey.algorithms('verify')
262262
t.is(result.constructor, Set)

0 commit comments

Comments
 (0)