-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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 <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Landed in b8bc652 |
Improve argument type checking and move into js, use internal/errors PR-URL: nodejs/node#15757 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Improve argument type checking and move into js, use internal/errors PR-URL: nodejs/node#15757 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
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