```js > 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 { type: 'secret', extractable: true, algorithm: { name: 'ChaCha20-Poly1305' }, usages: [ 'encrypt', 'encrypt' ] // duplicated } > await crypto.subtle.exportKey('jwk', _) { key_ops: [ 'encrypt', 'encrypt' ], // duplicated ext: true, alg: 'C20P', kty: 'oct', k: '...' } ``` ```js > const k = await crypto.subtle.exportKey('jwk', await crypto.subtle.generateKey({name: "AES-GCM", length: 256 }, true, ['encrypt'])) undefined > await crypto.subtle.importKey('jwk', k, {name: "AES-GCM", length: 256 }, true, ['encrypt', 'encrypt']) CryptoKey { type: 'secret', extractable: true, algorithm: { name: 'AES-GCM', length: 256 }, usages: [ 'encrypt', 'encrypt' ] // duplicated } > await crypto.subtle.exportKey('jwk', _) { key_ops: [ 'encrypt', 'encrypt' ], // duplicated ext: true, alg: 'A256GCM', kty: 'oct', k: '...' } ``` ```js > k = await crypto.subtle.generateKey({ name: "RSA-OAEP", hash: "SHA-256", modulusLength: 2048, publicExponent: Uint8Array.of(1, 0, 1) }, true, [ 'encrypt', 'decrypt']) > p = await crypto.subtle.exportKey('jwk', k.publicKey) > await crypto.subtle.importKey('jwk', p, { name: "RSA-OAEP", hash: "SHA-256" }, true, ['encrypt', 'encrypt']) CryptoKey { type: 'public', extractable: true, algorithm: { name: 'RSA-OAEP', modulusLength: 2048, publicExponent: [Uint8Array], hash: [Object] }, usages: [ 'encrypt', 'encrypt' ] // duplicate } > await crypto.subtle.exportKey('jwk', _) { key_ops: [ 'encrypt', 'encrypt' ], // duplicate ext: true, alg: 'RSA-OAEP-256', kty: 'RSA', n: '...', e: 'AQAB' } ``` Chrome deduplicates: <img width="707" height="117" alt="Image" src="https://github.com/user-attachments/assets/f0356072-3441-49ec-b8b9-71b684709e4b" /> Source: ### chacha20_poly1305 https://github.com/nodejs/node/blob/HEAD/lib/internal/crypto/chacha20_poly1305.js#L143 <img width="1066" height="109" alt="Image" src="https://github.com/user-attachments/assets/dc2d7727-e6b9-4090-8b7e-6dfb090c389b" /> ### aes https://github.com/nodejs/node/blob/HEAD/lib/internal/crypto/aes.js#L288 <img width="1066" height="109" alt="Image" src="https://github.com/user-attachments/assets/51de1d4d-5013-426d-873c-24f97d27cee1" /> ### rsa https://github.com/nodejs/node/blob/HEAD/lib/internal/crypto/rsa.js#L284 <img width="1051" height="92" alt="Image" src="https://github.com/user-attachments/assets/aa613aea-5e02-499e-b35e-2b0e738ea1aa" />