-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto: migrate crypto sign to internal/errors #15757
Conversation
lib/internal/crypto/sig.js
Outdated
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'key', | ||
['string', 'Buffer', 'TypedArray', 'DataView']); | ||
} | ||
|
||
var ret = this._handle.sign(toBuf(key), passphrase, rsaPadding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: toBuf()
seems redundant here.
lib/internal/crypto/sig.js
Outdated
const { Writable } = require('stream'); | ||
const { inherits } = require('util'); | ||
|
||
function Sign(algorithm, options) { | ||
if (typeof algorithm !== 'string') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe it's better to move this after the instanceof
check to only run it once when Sign
is called without new
.
lib/internal/crypto/sig.js
Outdated
@@ -80,6 +94,8 @@ Sign.prototype.sign = function sign(options, encoding) { | |||
|
|||
|
|||
function Verify(algorithm, options) { | |||
if (typeof algorithm !== 'string') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@nodejs/tsc ... ping? Please review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Next step would be to migrate SignBase::CheckThrow
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked the wrong box before
Also after this patch, |
re: |
f143a84
to
2579276
Compare
@nodejs/tsc ... need at least one more TSC signoff on this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Improve argument type checking and move into js, use internal/errors
2579276
to
cee5974
Compare
CI was a bit too red, trying again: https://ci.nodejs.org/job/node-test-commit/13401/ |
Improve argument type checking and move into js, use internal/errors PR-URL: #15757 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Landed in b8bc652 |
Improve argument type checking and move into js, use internal/errors PR-URL: nodejs/node#15757 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Improve argument type checking and move into js, use internal/errors PR-URL: nodejs/node#15757 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Improve argument type checking and move into js, use internal/errors
Improve tests.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
crypto