From 34fa55334df1b0b11b9daa013aa204836bfa6c05 Mon Sep 17 00:00:00 2001 From: oleiade Date: Mon, 20 Mar 2023 16:59:24 +0100 Subject: [PATCH] Add example demonstrating the usage of generateKey with AES algorithms --- examples/generateKey/generateKey-aes.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/generateKey/generateKey-aes.js diff --git a/examples/generateKey/generateKey-aes.js b/examples/generateKey/generateKey-aes.js new file mode 100644 index 0000000..4b5b6c1 --- /dev/null +++ b/examples/generateKey/generateKey-aes.js @@ -0,0 +1,17 @@ +import { crypto } from "k6/x/webcrypto"; + +export default async function () { + const key = await crypto.subtle.generateKey( + { + name: "AES-CBC", + length: 256 + }, + true, + [ + "encrypt", + "decrypt", + ] + ); + + console.log(JSON.stringify(key)) +} \ No newline at end of file