Tobias Nießen
7d84d67364
crypto: unify validation of checkPrime checks
...
Previously, the JS layer would validate that the value of the 'checks'
option was an unsigned 32-bit integer, otherwise throwing an appropriate
error but with a slightly misleading error message. Then the C++ layer
would validate that the value was an unsigned 31-bit integer, otherwise
throwing an appropriate error, but with a different (and even less
helpful) error message.
Instead, make the JS layer aware of the 31-bit restriction so that no
validation in C++ is necessary and so that the error message always
matches the exact requirement.
PR-URL: https://github.com/nodejs/node/pull/47165
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2023-03-22 11:41:06 +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
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
...
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-02-14 18:45:16 +01: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
Filip Skokan
3014c5d511
crypto: fix error when getRandomValues is called without arguments
...
PR-URL: https://github.com/nodejs/node/pull/45854
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-12-16 14:11:15 +01:00
Antoine du Hamel
e7f172c191
crypto: refactor ArrayBuffer to bigint conversion utils
...
PR-URL: https://github.com/nodejs/node/pull/45567
Refs: https://github.com/nodejs/performance/issues/16
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-11-27 18:27:21 +00:00
LiviaMedeiros
f3376f086b
crypto: use kEmptyObject
...
PR-URL: https://github.com/nodejs/node/pull/43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-06-11 12:18:12 +02:00
Tobias Nießen
e8697cfe38
crypto: improve prime size argument validation
...
The current validation in JavaScript is insufficient and also produces
an incorrect error message, restricting the size parameter to 32-bit
values, whereas the C++ backend restricts the size parameter to the
positive range of an int.
This change tightens the validation in JavaScript and adapts the error
message accordingly, making the validation in C++ superfluous.
Refs: https://github.com/nodejs/node/pull/42207
PR-URL: https://github.com/nodejs/node/pull/42234
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-03-08 17:33:38 +00:00
Mohammed Keyvanzadeh
8c4b8b201a
lib: replace validator and error
...
Refs: https://github.com/nodejs/node/pull/41660
PR-URL: https://github.com/nodejs/node/pull/41678
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-02-05 08:36:48 -08:00
LiviaMedeiros
b8de7aa4c2
crypto: adjust types for getRandomValues
...
prevents Web Crypto API's getRandomValues from accepting DataView
Fixes: https://github.com/nodejs/node/issues/41480
Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues
PR-URL: https://github.com/nodejs/node/pull/41481
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-01-22 15:20:40 +01:00
Guilherme Bernal
61df3d88a7
crypto: don't call callback twice in case crypto.randomBytes fails
...
PR-URL: https://github.com/nodejs/node/pull/40157
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-09-22 10:01:12 +02:00
Michaël Zasso
56a7e0aa90
crypto: support Big(U)Int64Array in getRandomValues
...
Refs: https://github.com/w3c/webcrypto/issues/255
Fixes: https://github.com/nodejs/node/issues/39442
PR-URL: https://github.com/nodejs/node/pull/39443
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
2021-07-23 08:34:25 +00: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
Qingyu Deng
993ed19f9c
crypto: reduce range of size to int max
...
Refs: https://github.com/nodejs/node/issues/38090
PR-URL: https://github.com/nodejs/node/pull/38096
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-04-12 14:49:13 -07:00
James M Snell
d2f116c6bb
crypto: fixup randomFill size and offset handling
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/38138
Fixes: https://github.com/nodejs/node/issues/38137
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-04-09 15:35:39 -07:00
Tobias Nießen
5dae7d6758
crypto: add buffering to randomInt
...
PR-URL: https://github.com/nodejs/node/pull/35110
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-04-03 15:37:53 +02:00
Dawid Rusnak
5694f7f0bf
crypto: improve randomUUID performance
...
PR-URL: https://github.com/nodejs/node/pull/37243
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-03-05 09:44:02 -08:00
Rich Trott
b461a1b125
doc,lib: prepare for stricter multi-line array linting
...
We're about to turn on a requirement for dangling commas.
PR-URL: https://github.com/nodejs/node/pull/37088
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-02-19 09:55:35 -08:00
Antoine du Hamel
08a2383a5e
crypto: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37364
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-02-19 12:55:54 +01:00
Tobias Nießen
406984ec7c
crypto: fix and simplify prime option validation
...
PR-URL: https://github.com/nodejs/node/pull/37164
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-06 08:56:13 -08:00
James M Snell
bb13469acb
crypto: add generatePrime/checkPrime
...
APIs for generating and checking pseudo-random primes
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36997
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-26 07:37:18 -08:00
Tobias Nießen and Andrey Pechkurov
4db9854d6e
crypto: fix randomInt bias
...
Co-authored-by: Andrey Pechkurov <apechkurov@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36894
Refs: https://github.com/nodejs/node/pull/34600
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-14 22:21:55 +01:00
James M Snell
0008a675ff
crypto: implement randomuuid
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36729
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Ben Coe <bencoe@gmail.com >
2021-01-07 12:44:36 -08:00
ZiJian Liu
b00bb01db9
lib: refactor to use validateCallback
...
PR-URL: https://github.com/nodejs/node/pull/36609
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2020-12-29 15:48:57 +00:00
James M Snell
4cbcfaee9c
crypto: fix regression on randomFillSync
...
Signed-off-by: James M Snell <jasnell@gmail.com >
Fixes: https://github.com/nodejs/node/issues/35722
PR-URL: https://github.com/nodejs/node/pull/35723
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Beth Griggs <bgriggs@redhat.com >
2020-10-21 15:10:36 +05:30
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
Rich Trott
40633351bc
crypto: improve invalid arg type message for randomInt()
...
Use "must be a safe integer" rather than "must be safe integer". I
believe the former is more easily understood/clear.
PR-URL: https://github.com/nodejs/node/pull/35089
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-09-09 07:59:02 -07:00
Rich Trott
d7d0fab70e
crypto: improve randomInt out-of-range error message
...
Previously, the crypto.randomInt() message when "max" was less than or
equal to "min" made it sound like the lower bound for "max" was
hard-coded. Make it clear that it is instead dynamic based on the value
of "min".
For crypto.randomInt(10,0):
Before:
RangeError [ERR_OUT_OF_RANGE]: The value of "max" is out of range. It
must be > 10. Received 0
After:
RangeError [ERR_OUT_OF_RANGE]: The value of "max" is out of range. It
must be greater than the value of "min" (10). Received 0
PR-URL: https://github.com/nodejs/node/pull/35088
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-09-09 07:57:24 -07:00
Tobias Nießen
cb2b82bddc
crypto: fix randomInt range check
...
Refs: https://github.com/nodejs/node/pull/34600
PR-URL: https://github.com/nodejs/node/pull/35052
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-09-07 13:20:31 +00:00
Rich Trott
53f7d3ee2c
crypto: align parameter names with documentation
...
Change _cb_ to _callback_ to align with documentation. This is so that
stack traces and error messages align with the documentation. If the
documentation says "callback", then the stack traces and error messages
should indicate that "callback" needs to be function or whatever, rather
than "cb".
PR-URL: https://github.com/nodejs/node/pull/35054
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2020-09-06 09:59:27 -07:00
Oli Lalonde
6e8701b923
crypto: add randomInt function
...
PR-URL: https://github.com/nodejs/node/pull/34600
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-09-04 10:51:13 +02:00
Brian White
59a1981a22
crypto: improve randomBytes() performance
...
PR-URL: https://github.com/nodejs/node/pull/31519
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-01-28 06:56:16 -08:00
Michaël Zasso
1f9a5ae7aa
lib: use static Number properties from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-11-30 13:45:38 +01:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
...
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-25 10:28:15 +01:00
Daniel Bevenius
556b38ab0a
crypto: move _randomBytes call out of handleError funct
...
This commit moves the _randomBytes function call out of the handleError
function, which now it takes in an error and a buf object as its
parameters.
PR-URL: https://github.com/nodejs/node/pull/28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-06-24 05:36:51 +02:00
Ruben Bridgewater
3b044962c4
errors: add more information in case of invalid callbacks
...
This adds the actual callback that is passed through to the error
message in case an ERR_INVALID_CALLBACK error is thrown.
PR-URL: https://github.com/nodejs/node/pull/27048
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-04-04 12:51:03 +02:00
Michaël Zasso
0817840f77
lib: force using primordials for JSON, Math and Reflect
...
Use the "no-restricted-globals" ESLint rule to lint for it.
PR-URL: https://github.com/nodejs/node/pull/27027
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-04-03 21:36:08 +08:00
Gus Caplan
e7f710c1d4
bootstrapper: move internalBinding to NativeModule
...
internalBinding is used so often that it should just automatically be
available for usage in internals.
PR-URL: https://github.com/nodejs/node/pull/23025
Refs: https://github.com/nodejs/node/commit/2a9eb31
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-04 11:55:34 +02:00
Daniel Bevenius
da8641f3b4
src: move process.binding('async_wrap') internal
...
This commit makes the async_wrap builtin an internal builtin, and
changes usage of the builtin from using process.binding('async_wrap')
to use internalBinding instead.
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/22469
Refs: https://github.com/nodejs/node/issues/22160
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-08-27 05:42:55 +02:00
Daniel Bevenius
bf5cc3bf1a
crypto: move process.binding('crypto') to internal
...
This commit makes the crypto builtin an internal builtin, and
changes usage of the builtin from using process.binding('crypto')
to use internalBinding instead.
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/22426
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-08-24 00:49:29 +02:00
Jon Moss
3e44b8c91e
lib: extract validateNumber validator
...
Pulls out another common argument validator to `internal/validators`
PR-URL: https://github.com/nodejs/node/pull/22249
Reviewed-By: Bryan English <bryan@bryanenglish.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-08-14 11:34:34 -04:00
cjihrig
573744caae
lib: consolidate redundant require() calls
...
PR-URL: https://github.com/nodejs/node/pull/21699
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
2018-07-09 22:50:37 -04:00
Ben Noordhuis
f1d9c7dbb9
crypto: drop Math.pow(), use static exponentation
...
PR-URL: https://github.com/nodejs/node/pull/20816
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-06-13 15:59:01 +02:00
Ben Noordhuis
078bb0f0a0
crypto: refactor randomBytes()
...
Use the scrypt() infrastructure to reimplement randomBytes() and
randomFill() in a simpler manner.
PR-URL: https://github.com/nodejs/node/pull/20816
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-06-13 15:58:59 +02:00
Ruben Bridgewater
333adf61eb
crypto: fix error handling
...
This fixes multiple cases where the wrong error was returned in
case of e.g. a overflow / wrong type.
PR-URL: https://github.com/nodejs/node/pull/19445
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-25 01:45:39 +01:00
Ruben Bridgewater
c6b6c92185
lib: always show ERR_INVALID_ARG_TYPE received part
...
This makes a effort to make sure all of these errors will actually
also show the received input.
On top of that it refactors a few tests for better maintainability.
It will also change the returned type to always be a simple typeof
instead of special handling null.
PR-URL: https://github.com/nodejs/node/pull/19445
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-25 01:45:37 +01:00
Michaël Zasso
1d2fd8b65b
lib: port remaining errors to new system
...
PR-URL: https://github.com/nodejs/node/pull/19137
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-07 14:54:38 +01:00
Ruben Bridgewater
96c57fbfaa
lib: switch to Number.isNaN
...
Number.isNaN is now as fast as `val !== val`. Switch to the more
readable version. Also switch all `isNaN` to `Number.isNaN`.
PR-URL: https://github.com/nodejs/node/pull/18744
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-02-16 18:09:56 +01:00
James M Snell
0a03e350fb
crypto: migrate crypto.randomBytes to internal/errors
...
PR-URL: https://github.com/nodejs/node/pull/16454
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-10-26 08:09:00 -07:00
Timothy Gu
7907534a8d
lib: faster type checks for some types
...
PR-URL: https://github.com/nodejs/node/pull/15663
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-01 23:58:59 -03:00