Title: Key usages should be an unique set · Issue #62899 · nodejs/node · GitHub
Open Graph Title: Key usages should be an unique set · Issue #62899 · nodejs/node
X Title: Key usages should be an unique set · Issue #62899 · nodejs/node
Description: > const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: "ChaCha20-Poly1305" }, true, ['encrypt'])) > await crypto.subtle.importKey('jwk', k, "ChaCha20-Poly1305", true, ['encrypt', 'encrypt']) CryptoKey { t...
Open Graph Description: > const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: "ChaCha20-Poly1305" }, true, ['encrypt'])) > await crypto.subtle.importKey('jwk', k, "ChaCha20-Poly1305", tru...
X Description: > const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: "ChaCha20-Poly1305" }, true, ['encrypt'])) > await crypto.subtle.importKey(...
Opengraph URL: https://github.com/nodejs/node/issues/62899
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Key usages should be an unique set","articleBody":"```js\n\u003e const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: \"ChaCha20-Poly1305\" }, true, ['encrypt']))\n\u003e await crypto.subtle.importKey('jwk', k, \"ChaCha20-Poly1305\", true, ['encrypt', 'encrypt'])\nCryptoKey {\n type: 'secret',\n extractable: true,\n algorithm: { name: 'ChaCha20-Poly1305' },\n usages: [ 'encrypt', 'encrypt' ] // duplicated\n}\n\u003e await crypto.subtle.exportKey('jwk', _)\n{\n key_ops: [ 'encrypt', 'encrypt' ], // duplicated\n ext: true,\n alg: 'C20P',\n kty: 'oct',\n k: '...'\n}\n```\n\n```js\n\u003e const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: \"AES-GCM\", length: 256 }, true, ['encrypt']))\nundefined\n\u003e await crypto.subtle.importKey('jwk', k, {name: \"AES-GCM\", length: 256 }, true, ['encrypt', 'encrypt'])\nCryptoKey {\n type: 'secret',\n extractable: true,\n algorithm: { name: 'AES-GCM', length: 256 },\n usages: [ 'encrypt', 'encrypt' ] // duplicated\n}\n\u003e await crypto.subtle.exportKey('jwk', _)\n{\n key_ops: [ 'encrypt', 'encrypt' ], // duplicated\n ext: true,\n alg: 'A256GCM',\n kty: 'oct',\n k: '...'\n}\n```\n\n```js\n\u003e k = await crypto.subtle.generateKey({ name: \"RSA-OAEP\", hash: \"SHA-256\", modulusLength: 2048, publicExponent: Uint8Array.of(1, 0, 1) }, true, [ 'encrypt', 'decrypt'])\n\u003e p = await crypto.subtle.exportKey('jwk', k.publicKey)\n\u003e await crypto.subtle.importKey('jwk', p, { name: \"RSA-OAEP\", hash: \"SHA-256\" }, true, ['encrypt', 'encrypt'])\nCryptoKey {\n type: 'public',\n extractable: true,\n algorithm: {\n name: 'RSA-OAEP',\n modulusLength: 2048,\n publicExponent: [Uint8Array],\n hash: [Object]\n },\n usages: [ 'encrypt', 'encrypt' ] // duplicate\n}\n\u003e await crypto.subtle.exportKey('jwk', _)\n{\n key_ops: [ 'encrypt', 'encrypt' ], // duplicate\n ext: true,\n alg: 'RSA-OAEP-256',\n kty: 'RSA',\n n: '...',\n e: 'AQAB'\n}\n```\n\nChrome deduplicates:\n\n\u003cimg width=\"707\" height=\"117\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/f0356072-3441-49ec-b8b9-71b684709e4b\" /\u003e\n\nSource:\n\n### chacha20_poly1305\n\nhttps://github.com/nodejs/node/blob/HEAD/lib/internal/crypto/chacha20_poly1305.js#L143\n\n\u003cimg width=\"1066\" height=\"109\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/dc2d7727-e6b9-4090-8b7e-6dfb090c389b\" /\u003e\n\n### aes\n\nhttps://github.com/nodejs/node/blob/HEAD/lib/internal/crypto/aes.js#L288\n\n\u003cimg width=\"1066\" height=\"109\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/51de1d4d-5013-426d-873c-24f97d27cee1\" /\u003e\n\n### rsa\n\nhttps://github.com/nodejs/node/blob/HEAD/lib/internal/crypto/rsa.js#L284\n\n\u003cimg width=\"1051\" height=\"92\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/aa613aea-5e02-499e-b35e-2b0e738ea1aa\" /\u003e","author":{"url":"https://github.com/ChALkeR","@type":"Person","name":"ChALkeR"},"datePublished":"2026-04-22T21:47:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/62899/node/issues/62899"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bcdf3fd5-bd90-ed21-0ab4-755ccc632e01 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C51E:21F6EA:266700F:3642C76:6A4CE530 |
| html-safe-nonce | 840c4cecff24cd964729a70beb2dd0d344181ab864ec0ebec9f480cb25b7fdb3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTFFOjIxRjZFQToyNjY3MDBGOjM2NDJDNzY6NkE0Q0U1MzAiLCJ2aXNpdG9yX2lkIjoiMjI0MTI3Mzc4NjkyOTA0NjgzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fdc40ccded045526d7bbecff4bd66c26ab27d1ed5cbbe1c45c8974a6f261106f |
| hovercard-subject-tag | issue:4312036086 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62899/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e77d1dc75c31f7b07b8812359c91dc9bac722b0182267879a29dcfd78b1d103e/nodejs/node/issues/62899 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e77d1dc75c31f7b07b8812359c91dc9bac722b0182267879a29dcfd78b1d103e/nodejs/node/issues/62899 |
| og:image:alt | > const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: "ChaCha20-Poly1305" }, true, ['encrypt'])) > await crypto.subtle.importKey('jwk', k, "ChaCha20-Poly1305", tru... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ChALkeR |
| hostname | github.com |
| expected-hostname | github.com |
| None | 299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c5a57f04eeb310f57c73fd6d751d957e2ca27ed2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width