-
Notifications
You must be signed in to change notification settings - Fork 31.3k
crypto: allow inspecting a crypto key prototype #57890
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
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
This would fail so far due to accessing a undefined property.
18d0465
to
25242b2
Compare
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.
test/parallel/test-crypto-key-objects.js is possibly a better place to put this test in
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 had a look at the file but I could not find a CryptoKey in there.
I understand that this test is not ideal but I believe it is not as crucial for the specific case.
Or would you have another spot where to place it?
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 had a look at the file but I could not find a CryptoKey in there.
You are correct, apologies.
I understand that this test is not ideal but I believe it is not as crucial for the specific case.
Any generic enough place is fitting, this one here however tests a regression. If there isn't one (such as import/key gen tests that assert resulting instances), feel free to create a new one.
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'd prefer it go into a separate test file on its own.
'use strict';
const common = require('../common');
const { subtle } = require('crypto');
const { strictEqual } = require('assert');
const promise = subtle.importKey('raw', Buffer.from([1,2,3]), {
name:'HMAC', hash: 'SHA-256'
}, true, ['sign','verify']);
promise.then(common.mustCall((key) => {
const inspected = inspect(Object.getPrototypeOf(key));
strictEqual(
inspected,
'CryptoKey {\n' +
' type: undefined,\n' +
' extractable: undefined,\n' +
' algorithm: undefined,\n' +
' usages: undefined\n' +
'}'
);
}));
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #57890 +/- ##
==========================================
- Coverage 90.24% 90.24% -0.01%
==========================================
Files 630 630
Lines 185670 185687 +17
Branches 36401 36406 +5
==========================================
+ Hits 167567 167581 +14
- Misses 10992 10997 +5
+ Partials 7111 7109 -2
🚀 New features to boost your workflow:
|
This would fail so far due to accessing a undefined property.