const key = await window.crypto.subtle.generateKey({
name: 'RSA-OAEP',
modulusLength: 2048, // can be 1024, 2048, or 4096
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
hash: {name: 'SHA-256'},
},
false, // key is extractable?
['encrypt', 'decrypt']
);
// returns a keypair object
console.log(key);
console.log(key.publicKey);
console.log(key.privateKey);