Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 4 additions & 8 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -1930,8 +1930,8 @@ added: v15.0.0
Example: Converting a `CryptoKey` instance to a `KeyObject`:

```mjs
const { webcrypto, KeyObject } = await import('node:crypto');
const { subtle } = webcrypto;
const { KeyObject } = await import('node:crypto');
const { subtle } = globalThis.crypto;

const key = await subtle.generateKey({
name: 'HMAC',
Expand All @@ -1945,12 +1945,8 @@ console.log(keyObject.symmetricKeySize);
```

```cjs
const {
webcrypto: {
subtle,
},
KeyObject,
} = require('node:crypto');
const { KeyObject } = require('node:crypto');
const { subtle } = globalThis.crypto;

(async function() {
const key = await subtle.generateKey({
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ crypto.randomFill(buf, (err, buf) => {
For the legacy Node.js crypto API, asynchronous single-call
operations use the traditional Node.js callback pattern, as
illustrated in the previous `randomFill()` example. In the
Web Crypto API (accessible via `require('node:crypto').webcrypto`),
Web Crypto API (accessible via `globalThis.crypto`),
all asynchronous single-call operations are Promise-based.

```js
// Example Web Crypto API asynchronous single-call operation
const { subtle } = require('node:crypto').webcrypto;
const { subtle } = globalThis.crypto;

subtle.generateKeys({ name: 'HMAC', length: 256 }, true, ['sign'])
.then((key) => {
Expand Down
14 changes: 13 additions & 1 deletion test/wpt/status/WebCryptoAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
"skip": "Not relevant in Node.js context"
},
"idlharness.https.any.js": {
"skip": "Various non-IDL-compliant things"
"fail": {
"expected": [
"Crypto interface: existence and properties of interface object",
"Crypto interface: calling getRandomValues(ArrayBufferView) on crypto with too few arguments must throw TypeError",
"CryptoKey interface: existence and properties of interface object",
"CryptoKey interface: existence and properties of interface prototype object",
"CryptoKey interface: attribute type",
"CryptoKey interface: attribute extractable",
"CryptoKey interface: attribute algorithm",
"CryptoKey interface: attribute usages",
"Window interface: attribute crypto"
]
}
}
}
2 changes: 2 additions & 0 deletions test/wpt/test-webcrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ runner.setInitScript(`
global.location = {};
`);

runner.pretendGlobalThisAs('Window');

runner.runJsTests();
17 changes: 16 additions & 1 deletion tools/node_modules/eslint/lib/rules/no-extra-parens.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 40 additions & 18 deletions tools/node_modules/eslint/lib/rules/no-invalid-regexp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 71 additions & 6 deletions tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading