Filip Skokan
90e3e5e173
crypto: add KeyObject.prototype.toCryptoKey
...
PR-URL: https://github.com/nodejs/node/pull/55262
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2024-10-06 18:09:02 +00:00
Filip Skokan
d65b17082b
crypto: make deriveBits length parameter optional and nullable
...
PR-URL: https://github.com/nodejs/node/pull/53601
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-06-28 22:21:29 +00:00
Filip Skokan
a30ae50860
cli: remove --no-experimental-global-webcrypto flag
...
PR-URL: https://github.com/nodejs/node/pull/52564
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-04-19 13:02:01 +00:00
Filip Skokan
457cedda9d
crypto: remove webcrypto EdDSA key checks and properties
...
As per https://github.com/WICG/webcrypto-secure-curves/pull/24
PR-URL: https://github.com/nodejs/node/pull/49408
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2023-09-01 12:00:16 +00:00
Filip Skokan
71eda57ba3
crypto: fix webcrypto private/secret import with empty usages
...
Refs: #47864
PR-URL: https://github.com/nodejs/node/pull/47877
Refs: https://github.com/nodejs/node/issues/47864
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-05-07 10:54:28 +00:00
Antoine du Hamel
ab8942848b
lib: enforce use of trailing commas
...
PR-URL: https://github.com/nodejs/node/pull/46881
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2023-03-06 10:44:14 +01:00
Filip Skokan
4c1a27716b
crypto: re-add padding for AES-KW wrapped JWKs
...
PR-URL: https://github.com/nodejs/node/pull/46563
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-02-17 13:11:43 +00:00
Filip Skokan
3ef38c4bd7
crypto: use WebIDL converters in WebCryptoAPI
...
WebCryptoAPI functions' arguments are now coersed and validated as per
their WebIDL definitions like in other Web Crypto API implementations.
This further improves interoperability with other implementations of
Web Crypto API.
PR-URL: https://github.com/nodejs/node/pull/46067
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-01-17 08:57:58 +00:00
Antoine du Hamel
bb908fc886
crypto: simplify lazy loading of internal modules
...
The internal `require()` is actually just one map load (to see if the
module is already loaded) + one property load (state check for circular
dependencies) for modules that are already loaded.
Refs: https://github.com/nodejs/node/pull/45659#discussion_r1033762328
PR-URL: https://github.com/nodejs/node/pull/45809
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-12-12 15:17:44 +00:00
Filip Skokan
214354fc9f
crypto: fix webcrypto HMAC "get key length" in deriveKey and generateKey
...
PR-URL: https://github.com/nodejs/node/pull/44917
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-10-12 19:18:38 +00:00
Filip Skokan
eeec3eb16a
crypto: simplify webcrypto ECDH deriveBits
...
PR-URL: https://github.com/nodejs/node/pull/44946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-10-12 18:38:20 +00:00
Antoine du Hamel
2849283c4c
crypto: remove non-standard `webcrypto.Crypto.prototype.CryptoKey`
...
`CryptoKey` is already available on the global object.
PR-URL: https://github.com/nodejs/node/pull/42083
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2022-09-17 15:54:36 +02:00
Filip Skokan
159b4d7a94
crypto: allow zero-length IKM in HKDF and in webcrypto PBKDF2
...
PR-URL: https://github.com/nodejs/node/pull/44201
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-08-12 21:36:29 +02:00
Filip Skokan
84db3e7b06
crypto: handle webcrypto generateKey() usages edge case
...
PR-URL: https://github.com/nodejs/node/pull/43454
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-06-25 06:22:35 +01:00
Filip Skokan
677bd668b7
crypto: fix webcrypto generateKey() with empty usages
...
PR-URL: https://github.com/nodejs/node/pull/43431
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-06-16 22:00:34 +02:00
Filip Skokan
fbfb91ba33
crypto: remove Node.js-specific webcrypto extensions
...
PR-URL: https://github.com/nodejs/node/pull/43310
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-06-11 08:04:20 +01:00
Filip Skokan
7e5da97d15
crypto: add CFRG curves to Web Crypto API
...
PR-URL: https://github.com/nodejs/node/pull/42507
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-06-04 07:20:27 +01:00
Antoine du Hamel
06d8606960
lib: use null-prototype objects for property descriptors
...
Refs: https://github.com/nodejs/node/pull/42921
PR-URL: https://github.com/nodejs/node/pull/43270
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-06-03 09:23:58 +01:00
Filip Skokan
603803ecb7
crypto: validate `this` in all webcrypto methods and getters
...
PR-URL: https://github.com/nodejs/node/pull/42815
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-04-23 18:42:45 +01:00
Filip Skokan
5d0eb10c80
crypto: do not add undefined hash in webcrypto normalizeAlgorithm
...
PR-URL: https://github.com/nodejs/node/pull/42559
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-04-03 11:11:21 +01:00
Filip Skokan
4fa6c89cd5
crypto: cleanup webcrypto jwk code
...
PR-URL: https://github.com/nodejs/node/pull/42562
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-04-03 11:11:02 +01:00
Filip Skokan
18bd02f245
crypto: fix webcrypto derive key lengths
...
PR-URL: https://github.com/nodejs/node/pull/42542
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-04-02 15:54:35 +01:00
Antoine du Hamel
6ee4228498
crypto: validate `this` value for `webcrypto.getRandomValues`
...
PR-URL: https://github.com/nodejs/node/pull/41760
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-02-26 17:12:48 +00:00
Antoine du Hamel
849991c6c4
crypto: expose Web Crypto API on the global scope
...
PR-URL: https://github.com/nodejs/node/pull/41938
Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property
Refs: https://github.com/nodejs/node/pull/41782
Refs: https://w3c.github.io/webcrypto
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2022-02-14 16:14:49 +00:00
Mestery
998e5acc69
lib: move kEnumerableProperty to internal/util
...
PR-URL: https://github.com/nodejs/node/pull/41877
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-02-11 17:30:47 +00:00
Antoine du Hamel
7123a00b03
crypto: fix `webcrypto.subtle` signature
...
PR-URL: https://github.com/nodejs/node/pull/41761
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-01-31 23:23:15 +01:00
Rich Trott
55ceaec111
tools,benchmark,lib,test: enable no-case-declarations lint rule
...
PR-URL: https://github.com/nodejs/node/pull/41385
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-01-05 07:42:19 -08:00
Filip Skokan
4441c3e3b5
crypto: fix JWK RSA-PSS SubtleCrypto.exportKey
...
PR-URL: https://github.com/nodejs/node/pull/39828
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-25 08:24:41 -07:00
Michaël Zasso
90736030d2
crypto: implement webcrypto.randomUUID
...
Refs: https://wicg.github.io/uuid/
Refs: https://www.chromestatus.com/feature/5689159362543616
PR-URL: https://github.com/nodejs/node/pull/39648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-08-05 16:52:13 +02:00
XadillaX
2de139b5d5
lib: make lazyDOMException more common
...
PR-URL: https://github.com/nodejs/node/pull/39105
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-06-28 13:44:28 +08:00
Filip Skokan
2130598e91
crypto: forbid NODE-ED25519 and NODE-ED448 "raw" key export
...
closes #38655
PR-URL: https://github.com/nodejs/node/pull/38668
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-05-17 10:28:37 +02:00
Antoine du Hamel
7919ced0c9
lib: harden lint checks for globals
...
PR-URL: https://github.com/nodejs/node/pull/38419
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-04-28 13:13:23 -07:00
Filip Skokan
c81d0fa9bc
crypto: use correct webcrypto RSASSA-PKCS1-v1_5 algorithm name
...
PR-URL: https://github.com/nodejs/node/pull/38029
Refs: https://www.w3.org/TR/WebCryptoAPI/#rsassa-pkcs1
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-04-04 00:08:37 +02:00
Antoine du Hamel
75259c7492
crypto: refactor hasAnyNotIn to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37433
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2021-02-26 16:34:04 +01:00
ExE Boss
beee53884d
lib: fix WebIDL `object` and dictionary type conversion
...
PR-URL: https://github.com/nodejs/node/pull/37047
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-02-08 17:02:16 -08:00
James M Snell
bd899bc656
crypto: experimental (Ed/X)25519/(Ed/X)448 support
...
Implements initial experimental support for Curve25519 and
Curve448 support for both ECDH and sign/verify in Web Crypto.
Introduced as a Node.js-specific extension to Web Crypto.
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: https://github.com/nodejs/node/issues/36076
PR-URL: https://github.com/nodejs/node/pull/36879
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2021-01-18 08:12:08 -08:00
Antoine du Hamel
da53a3caa3
crypto: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36012
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-11-09 20:23:07 -08:00
James M Snell
05bb1b3f94
crypto: fixup scrypt regressions
...
Fixes a handful of regressions in scrypt support following
the refactor.
Fixes: https://github.com/nodejs/node/issues/35815
PR-URL: https://github.com/nodejs/node/pull/35821
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-10-30 11:08:09 +00:00
James M Snell
dae283d96f
crypto: refactoring internals, add WebCrypto
...
Fixes: https://github.com/nodejs/node/issues/678
Refs: https://github.com/nodejs/node/issues/26854
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/35093
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-10-07 17:27:05 -07:00