Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
promiseTest(async () => {
const keyPair = await crypto.subtle.generateKey({
name: "RSASSA-PKCS1-v1_5",
modulusLength: 1024,
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
hash: "SHA-256",
}, true, ["sign", "verify"]);
// Detach the buffer backing the stored publicExponent, then serialize the key by cloning it.
keyPair.publicKey.algorithm.publicExponent.buffer.transfer();
try {
structuredClone(keyPair.publicKey);
println("PASS (didn't crash): cloned");
} catch (e) {
println("PASS (didn't crash): " + e.name);
}
});
</script>