Commit graph

82 commits

Author SHA1 Message Date
Hannes Van De Vreken
b10f2fbf04 docs: remove double entry in KeyLike (#191) 2021-04-30 13:54:21 +02:00
Filip Skokan
d512ede073 fix: swallow promisified crypto.verify errors 2021-04-29 14:19:01 +02:00
Filip Skokan
7b1d98bb79 chore: update @types/node 2021-04-29 14:18:00 +02:00
Filip Skokan
7819df73eb fix: isObject helper in different vm contexts or jest re-assigned globals
closes #178
2021-04-13 22:01:58 +02:00
Filip Skokan
579485cb80 fix: defer AES CBC w/ HMAC decryption after tag verification passes 2021-04-09 22:04:46 +02:00
Filip Skokan
d0a26bdb37 refactor(node,webcrypto): remove unnecessary workaround 2021-04-07 10:33:45 +02:00
Filip Skokan
dab4b2f03e fix(node): check CryptoKey algorithm & usage before exporting KeyObject 2021-04-02 00:01:57 +02:00
Filip Skokan
0f990a46c1 docs: add notes about algorithm allow list defaults 2021-04-01 19:10:55 +02:00
Filip Skokan
8282c28bf1 docs: add note about createRemoteJWKSet to get key interfaces 2021-04-01 17:36:17 +02:00
Filip Skokan
373b83024c refactor: ecdh re-using existing APIs 2021-04-01 13:34:44 +02:00
Filip Skokan
435c74d864 docs: update Buffer note in KeyLike 2021-03-31 12:02:45 +02:00
Filip Skokan
b806c6dfbf docs: extend KeyLike documentation 2021-03-31 11:54:41 +02:00
Filip Skokan
a850303ffb docs: update jwk/parse example 2021-03-31 11:53:52 +02:00
Filip Skokan
e41c1bdade docs: remove jwk/parse from examples 2021-03-31 11:17:13 +02:00
Filip Skokan
49ba5616d7 docs: update example labels 2021-03-31 10:55:55 +02:00
Filip Skokan
d99b2172b7 chore: remove dist types.d.ts comments 2021-03-30 18:34:06 +02:00
Filip Skokan
edb83a846a fix: assert KeyLike input types, change "any" types to "unknown" 2021-03-30 17:53:53 +02:00
Filip Skokan
1d49c6b78c docs: update keylike interface description 2021-03-30 17:53:53 +02:00
Filip Skokan
d3d4acd8be fix(node): crypto.verify callback invocation with a private keyobject 2021-03-26 14:48:34 +01:00
Filip Skokan
04a6aa1cd7 doc: document both static and instance code properties 2021-03-24 13:36:21 +01:00
Alex Charles
89d8003875
feat: export error codes as static properties
closes #170
2021-03-24 13:35:37 +01:00
Filip Skokan
ae9a7f4186 feat(node): use libuv threadpool to verify in node >= 15.12.0 2021-03-17 14:11:47 +01:00
Filip Skokan
cf5074e7e1 feat(node): use libuv threadpool to sign in node >= 15.12.0 2021-03-17 14:11:15 +01:00
Filip Skokan
7f3cc44bd0 feat(node): use native JWK export in node >= 15.9.0 2021-03-17 14:10:50 +01:00
Filip Skokan
f0c2a64728 feat(node): use native JWK import in node >= 15.12.0 2021-03-17 14:10:11 +01:00
Filip Skokan
ba19ae0539 lint: prettier 2021-03-16 10:41:39 +01:00
Filip Skokan
5cba6b0fdd feat: add named exports for all modules 2021-03-15 15:47:42 +01:00
Filip Skokan
28d50d09aa docs: add markdown code block langauge 2021-03-12 15:30:13 +01:00
Filip Skokan
e0adf49e57 fix: swallow invalid signature encoding errors 2021-03-11 14:56:57 +01:00
Filip Skokan
348b83712d docs: fix fromKeyLike example 2021-03-11 09:37:12 +01:00
Filip Skokan
484e04ca8e refactor: use nullish coalescing instead of logical OR 2021-03-03 10:55:22 +01:00
Filip Skokan
433f020246 fix(electron): properly ASN.1 encode [0x00] when converting RSA JWKs 2021-03-03 00:00:39 +01:00
Filip Skokan
a5a6c4dc9f fix(electron): only call (de)cipher.setAAD() when aad is not empty 2021-03-02 23:58:48 +01:00
Filip Skokan
2c358e0ea5 fix(typescript): update maxTokenAge type and examples 2021-02-16 11:38:21 +01:00
Filip Skokan
fc584b2efd fix: node runtime json fetch handles connection errors properly 2021-02-10 13:36:29 +01:00
Filip Skokan
e8d41a9335 feat: allow CryptoKey instances in a regular non-webcrypto node runtime 2021-02-04 17:39:28 +01:00
Filip Skokan
eef442cb54 refactor: use long form web crypto algorithm values 2021-02-04 16:53:37 +01:00
Filip Skokan
0b3561181c chore: remove unused interfaces 2021-02-02 09:58:39 +01:00
Filip Skokan
bd1b7c4812 refactor(typescript): dont mess with the node types 2021-01-28 16:25:08 +01:00
Filip Skokan
69a7edea0a refactor: explicit new uint8array arg 2021-01-28 16:16:12 +01:00
Filip Skokan
d2a574818a refactor: remove checking for secure context 2021-01-28 16:13:53 +01:00
Filip Skokan
9998cb389a refactor: generate_key_pair type returns KeyLike 2021-01-22 14:31:08 +01:00
Filip Skokan
c068e46c68 refactor: src/runtime/node/fetch.ts 2021-01-21 18:16:14 +01:00
Filip Skokan
2e5800535a fix: workaround downstream dependency issues messing with http
ref #154
2021-01-20 17:07:03 +01:00
Filip Skokan
ad88ee2cd5 perf: use KeyObject.prototype asymmetricKeyDetails when available 2021-01-18 13:50:42 +01:00
Filip Skokan
808f06cd08 perf: use 'base64url' encoding when available in Node.js runtime 2021-01-18 13:50:37 +01:00
codedust
ed32b0d46e fix: workaround for RangeError in browser runtime base64url
Fixes RangeError in base64url.ts when encrypting large Uint8Arrays

String.fromCharCode.apply causes a RangeError for large Uint8Arrays
(> ~500kB). This happens, e.g., when encrypting larger files.

See this gist to reproduce the bug (select a large file and see the
browser console):
https://gist.github.com/codedust/88c8af3b2acd782e72ffbe0c3c8bf5af

Error message in Firefox:
```
Uncaught (in promise) RangeError: too many arguments provided for a
function call (in base64url.js:8:62)
    encode http://localhost:8000/jose/runtime/base64url.js:8
    encrypt http://localhost:8000/jose/jwe/flattened/encrypt.js:143
```

Error message in Chromium:
```
Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at encode (base64url.js:8)
    at FlattenedEncrypt.encrypt (encrypt.js:143)
    at async CompactEncrypt.encrypt (encrypt.js:23)
    at async jwe_test ((index):55)
```

Solution: Apply String.fromCharCode.apply in chunks of 32768 bytes,
see https://stackoverflow.com/a/12713326
2021-01-10 14:33:30 +01:00
Filip Skokan
3ebe3756fe style: use <> type casting syntax in embedded.ts 2021-01-10 14:32:36 +01:00
Filip Skokan
f362f6fde1 refactor: rename combinedHeader in embedded.ts 2021-01-10 14:32:27 +01:00
Filip Skokan
71d35a7d0e docs: update unsecured jwt docs 2020-12-29 10:27:29 +01:00