-
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
assert,crypto: make KeyObject and CryptoKey testable for equality #50897
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
0965ede
to
5327861
Compare
5327861
to
ca444db
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ca444db
to
b008047
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
cc @nodejs/crypto |
cc @nodejs/crypto |
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.
I think the use case makes sense, and I'm not able to able to suggest a better implementation, so let's roll with this.
const a = crypto.createSecretKey(Buffer.alloc(1, 0)); | ||
const b = crypto.createSecretKey(Buffer.alloc(1, 1)); |
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: I find Buffer.from
easier to understand (I had to go read the docs to get what the second argument of Buffer.alloc
was for)
const a = crypto.createSecretKey(Buffer.alloc(1, 0)); | |
const b = crypto.createSecretKey(Buffer.alloc(1, 1)); | |
const a = crypto.createSecretKey(Buffer.from([0])); | |
const b = crypto.createSecretKey(Buffer.from([1])); |
Commit Queue failed- Loading data for nodejs/node/pull/50897 ✔ Done loading data for nodejs/node/pull/50897 ----------------------------------- PR info ------------------------------------ Title assert,crypto: make KeyObject and CryptoKey testable for equality (#50897) Author Filip Skokan (@panva) Branch panva:crypto-objects-equal -> nodejs:main Labels crypto, assert, util, needs-ci, review wanted, webcrypto, commit-queue-rebase Commits 2 - crypto: update CryptoKey symbol properties - assert,crypto: make KeyObject and CryptoKey testable for equality Committers 1 - Filip Skokan PR-URL: https://github.com/nodejs/node/pull/50897 Reviewed-By: Antoine du Hamel ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/50897 Reviewed-By: Antoine du Hamel -------------------------------------------------------------------------------- ℹ This PR was created on Fri, 24 Nov 2023 16:50:43 GMT ✔ Approvals: 1 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/50897#pullrequestreview-1785408839 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2023-11-25T19:19:00Z: https://ci.nodejs.org/job/node-test-pull-request/55920/ ⚠ Commits were pushed after the last Full PR CI run: ⚠ - crypto: update CryptoKey symbol properties ⚠ - assert,crypto: make KeyObject and CryptoKey testable for equality - Querying data for job/node-test-pull-request/55920/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/7237974363 |
Landed in 154afbe...0afe731 |
PR-URL: #50897 Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #50897 Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #50897 Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #50897 Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #50897 Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #50897 Reviewed-By: Antoine du Hamel <[email protected]>
Not sure if this is the right place to comment but I noticed a regression from v18 to v20, and this PR seems vaguely related. const a = ['a'];
assert.deepStrictEqual(new Set([a, ['b']]), new Set([a, ['b']]));
The bug seems to occur only when comparing |
@chharvey can you open a new issue to track this please? (FWIW I'm able to reproduce) |
@aduh95 thanks for your reply. I think I found the culprit and left a comment: #46593 (comment) |
@chharvey can you open a new issue to track this please? |
This makes CryptoKey and KeyObject instances testable using
assert.deepStrictEqual
andassert.deepEqual
.The state before was that