<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>crypto on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/</link><description>Recent content in crypto on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/javascript-api/crypto/index.xml" rel="self" type="application/rss+xml"/><item><title>getRandomValues</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/getrandomvalues/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/getrandomvalues/</guid><content><![CDATA[&lt;h1 id=&#34;getrandomvalues&#34;&gt;getRandomValues&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;getRandomValues()&lt;/code&gt; method fills the passed &lt;code&gt;TypedArray&lt;/code&gt; with cryptographically sound random values.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;getRandomValues(typedArray)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Name&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;typedArray&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;TypedArray&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An integer-based &lt;code&gt;TypedArray&lt;/code&gt; to fill with random values. Accepted &lt;code&gt;TypedArray&lt;/code&gt; specific types are: &lt;code&gt;Int8Array&lt;/code&gt;, &lt;code&gt;Uint8Array&lt;/code&gt;, &lt;code&gt;Uint8ClampedArray&lt;/code&gt;, &lt;code&gt;Int16Array&lt;/code&gt;, &lt;code&gt;Uint16Array&lt;/code&gt;, &lt;code&gt;Int32Array&lt;/code&gt;, or &lt;code&gt;Uint32Array&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;return-value&#34;&gt;Return Value&lt;/h2&gt;
&lt;p&gt;The same array is passed as the &lt;code&gt;typedArray&lt;/code&gt; parameter with its contents replaced with the newly generated random numbers. The &lt;code&gt;typedArray&lt;/code&gt; parameter is modified in place, and no copy is made.&lt;/p&gt;
&lt;h2 id=&#34;throws&#34;&gt;Throws&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;TypeError&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Thrown when &lt;code&gt;typedArray&lt;/code&gt; is missing, &lt;code&gt;null&lt;/code&gt;, or &lt;code&gt;undefined&lt;/code&gt;, or its &lt;code&gt;length&lt;/code&gt; has been overridden with a negative value.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;QuotaExceededError&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Thrown when &lt;code&gt;typedArray&lt;/code&gt; is too large and its &lt;code&gt;byteLength&lt;/code&gt; exceeds 65536.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default function () {
  const array = new Uint32Array(10);
  crypto.getRandomValues(array);

  for (const num of array) {
    console.log(num);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="getrandomvalues">getRandomValues&lt;/h1>
&lt;p>The &lt;code>getRandomValues()&lt;/code> method fills the passed &lt;code>TypedArray&lt;/code> with cryptographically sound random values.&lt;/p>
&lt;h2 id="usage">Usage&lt;/h2>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">getRandomValues(typedArray)&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;h2 id="parameters">Parameters&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Name&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>typedArray&lt;/code>&lt;/td>
&lt;td style="text-align: left">&lt;code>TypedArray&lt;/code>&lt;/td>
&lt;td style="text-align: left">An integer-based &lt;code>TypedArray&lt;/code> to fill with random values. Accepted &lt;code>TypedArray&lt;/code> specific types are: &lt;code>Int8Array&lt;/code>, &lt;code>Uint8Array&lt;/code>, &lt;code>Uint8ClampedArray&lt;/code>, &lt;code>Int16Array&lt;/code>, &lt;code>Uint16Array&lt;/code>, &lt;code>Int32Array&lt;/code>, or &lt;code>Uint32Array&lt;/code>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="return-value">Return Value&lt;/h2>
&lt;p>The same array is passed as the &lt;code>typedArray&lt;/code> parameter with its contents replaced with the newly generated random numbers. The &lt;code>typedArray&lt;/code> parameter is modified in place, and no copy is made.&lt;/p></description></item><item><title>CryptoKey</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/</guid><content><![CDATA[&lt;h1 id=&#34;cryptokey&#34;&gt;CryptoKey&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;CryptoKey&lt;/code&gt; object represents a cryptographic key used for 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/&#34;&gt;encryption&lt;/a&gt;,
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/&#34;&gt;decryption&lt;/a&gt;,
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/&#34;&gt;signing&lt;/a&gt;, or 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/&#34;&gt;verification&lt;/a&gt; within the webcrypto module. The &lt;code&gt;CryptoKey&lt;/code&gt; object is created using the SubtleCrypto.generateKey() or SubtleCrypto.importKey() methods.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;type&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Indicates the type of the key material. Possible values are &lt;code&gt;public&lt;/code&gt;, &lt;code&gt;private&lt;/code&gt;, &lt;code&gt;secret&lt;/code&gt;, &lt;code&gt;unspecified&lt;/code&gt;, or &lt;code&gt;unknown&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;extractable&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Indicates whether the raw key material can be exported.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;algorithm&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;object&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An object containing the algorithm used to generate or import the key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;usages&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string[]&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An array of strings indicating the cryptographic operations that the key can be used for. Possible values are &lt;code&gt;encrypt&lt;/code&gt;, &lt;code&gt;decrypt&lt;/code&gt;, &lt;code&gt;sign&lt;/code&gt;, &lt;code&gt;verify&lt;/code&gt;, &lt;code&gt;deriveKey&lt;/code&gt;, &lt;code&gt;deriveBits&lt;/code&gt;, &lt;code&gt;wrapKey&lt;/code&gt;, and &lt;code&gt;unwrapKey&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="cryptokey">CryptoKey&lt;/h1>
&lt;p>The &lt;code>CryptoKey&lt;/code> object represents a cryptographic key used for
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/">encryption&lt;/a>,
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/">decryption&lt;/a>,
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/">signing&lt;/a>, or
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/">verification&lt;/a> within the webcrypto module. The &lt;code>CryptoKey&lt;/code> object is created using the SubtleCrypto.generateKey() or SubtleCrypto.importKey() methods.&lt;/p></description></item><item><title>randomUUID</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/randomuuid/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/randomuuid/</guid><content><![CDATA[&lt;h1 id=&#34;randomuuid&#34;&gt;randomUUID&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;randomUUID&lt;/code&gt; method produces a 36-characters long string that contains a cryptographically random UUID v4.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;randomUUID()&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;return-value&#34;&gt;Return Value&lt;/h2&gt;
&lt;p&gt;A string containing a 36-character cryptographically random UUID v4.&lt;/p&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default function () {
  const myUUID = crypto.randomUUID();

  console.log(myUUID);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="randomuuid">randomUUID&lt;/h1>
&lt;p>The &lt;code>randomUUID&lt;/code> method produces a 36-characters long string that contains a cryptographically random UUID v4.&lt;/p>
&lt;h2 id="usage">Usage&lt;/h2>
&lt;div class="code-snippet code-snippet__mini">&lt;div class="lang-toolbar__mini">
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;/div>&lt;div class="code-snippet code-snippet__border">
&lt;pre data-expanded="false">&lt;code class="language-none">randomUUID()&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;h2 id="return-value">Return Value&lt;/h2>
&lt;p>A string containing a 36-character cryptographically random UUID v4.&lt;/p></description></item><item><title>SubtleCrypto</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/</guid><content><![CDATA[&lt;h1 id=&#34;subtlecrypto&#34;&gt;SubtleCrypto&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;SubtleCrypto&lt;/code&gt; interface provides a set of low-level cryptographic primitives such as encryption, decryption, digital signature generation and verification, and key generation and management. It is useful for using secure and efficient cryptographic operations within k6 scripts.&lt;/p&gt;
&lt;h2 id=&#34;methods&#34;&gt;Methods&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Method&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/&#34;&gt;encrypt&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Encrypts the given plaintext data using the specified algorithm and key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/&#34;&gt;decrypt&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Decrypts the given ciphertext data using the specified algorithm and key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/&#34;&gt;sign&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Signs the given data using the specified algorithm and key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/&#34;&gt;verify&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Verifies the signature of the given data using the specified algorithm and key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/digest/&#34;&gt;digest&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Computes the digest (hash) of the given data using the specified algorithm.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/&#34;&gt;generateKey&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Generates a new cryptographic key for use with the specified algorithm.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/importkey/&#34;&gt;importKey&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Imports a raw key material into the Web Crypto API, generating a new key object to use with the specified algorithm.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/exportkey/&#34;&gt;exportKey&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Exports the raw key material of the given key object.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivebits/&#34;&gt;deriveBits&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Derives bits using provided input.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivekey/&#34;&gt;deriveKey&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Derives a secret key from a master key.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const plaintext = new TextEncoder().encode(&amp;#39;Hello, World!&amp;#39;);

  /**
   * Generate a symmetric key using the AES-CBC algorithm.
   */
  const key = await crypto.subtle.generateKey(
    {
      name: &amp;#39;AES-CBC&amp;#39;,
      length: 256,
    },
    true,
    [&amp;#39;encrypt&amp;#39;, &amp;#39;decrypt&amp;#39;]
  );

  /**
   * Encrypt the plaintext using the AES-CBC key with
   * have generated.
   */
  const iv = crypto.getRandomValues(new Uint8Array(16));
  const ciphertext = await crypto.subtle.encrypt(
    {
      name: &amp;#39;AES-CBC&amp;#39;,
      iv: iv,
    },
    key,
    plaintext
  );

  /**
   * Decrypt the ciphertext using the same key to verify
   * that the resulting plaintext is the same as the original.
   */
  const deciphered = await crypto.subtle.decrypt(
    {
      name: &amp;#39;AES-CBC&amp;#39;,
      iv: iv,
    },
    key,
    ciphertext
  );

  console.log(
    &amp;#39;deciphered text == original plaintext: &amp;#39;,
    arrayBufferToHex(deciphered) === arrayBufferToHex(plaintext)
  );
}

function arrayBufferToHex(buffer) {
  return [...new Uint8Array(buffer)].map((x) =&amp;gt; x.toString(16).padStart(2, &amp;#39;0&amp;#39;)).join(&amp;#39;&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="subtlecrypto">SubtleCrypto&lt;/h1>
&lt;p>The &lt;code>SubtleCrypto&lt;/code> interface provides a set of low-level cryptographic primitives such as encryption, decryption, digital signature generation and verification, and key generation and management. It is useful for using secure and efficient cryptographic operations within k6 scripts.&lt;/p></description></item><item><title>AesCbcParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aescbcparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aescbcparams/</guid><content><![CDATA[&lt;h1 id=&#34;aescbcparams&#34;&gt;AesCbcParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;AesCbcParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/&#34;&gt;encrypt&lt;/a&gt; and 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/&#34;&gt;decrypt&lt;/a&gt; operation when using the AES-CBC algorithm.&lt;/p&gt;
&lt;p&gt;For more details, head to the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/AesCbcParams&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;MDN Web Crypto API documentation on AES-CBC&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Should be set to &lt;code&gt;AES-CBC&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;iv&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;ArrayBuffer&lt;/code&gt;, &lt;code&gt;TypedArray&lt;/code&gt;, or &lt;code&gt;DataView&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The initialization vector. Must be 16 bytes, unpredictable and cryptographically random. Yet, it doesn&amp;rsquo;t need to be secret and can be transmitted along with the ciphertext.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const plaintext = new TextEncoder().encode(&amp;#39;Hello, World!&amp;#39;);

  /**
   * Generate a symmetric key using the AES-CBC algorithm.
   */
  const key = await crypto.subtle.generateKey(
    {
      name: &amp;#39;AES-CBC&amp;#39;,
      length: 256,
    },
    true,
    [&amp;#39;encrypt&amp;#39;, &amp;#39;decrypt&amp;#39;]
  );

  /**
   * Encrypt the plaintext using the AES-CBC key with
   * have generated.
   */
  const ciphertext = await crypto.subtle.encrypt(
    {
      name: &amp;#39;AES-CBC&amp;#39;,
      iv: crypto.getRandomValues(new Uint8Array(16)),
    },
    key,
    plaintext
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="aescbcparams">AesCbcParams&lt;/h1>
&lt;p>The &lt;code>AesCbcParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/">encrypt&lt;/a> and
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/">decrypt&lt;/a> operation when using the AES-CBC algorithm.&lt;/p>
&lt;p>For more details, head to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AesCbcParams" target="_blank" rel="noopener noreferrer">MDN Web Crypto API documentation on AES-CBC&lt;/a>.&lt;/p></description></item><item><title>AesCtrParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aesctrparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aesctrparams/</guid><content><![CDATA[&lt;h1 id=&#34;aesctrparams&#34;&gt;AesCtrParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;AesCtrParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/&#34;&gt;encrypt&lt;/a&gt; and 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/&#34;&gt;decrypt&lt;/a&gt; operation when using the AES-CTR algorithm.&lt;/p&gt;
&lt;p&gt;For more details, head to the MDN Web Crypto API documentation on &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/AesCtrParams&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AES-CTR&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Should be set to &lt;code&gt;AES-CTR&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;counter&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;ArrayBuffer&lt;/code&gt;, &lt;code&gt;TypedArray&lt;/code&gt;, or &lt;code&gt;DataView&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The initial value of the counter block. This must be 16-bytes long, like the AES block size.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;length&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The number of bits in the counter block that are used for the actual counter. It is recommended to use 64 (half of the counter block).&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const plaintext = new TextEncoder().encode(&amp;#39;Hello, World!&amp;#39;);

  /**
   * Generate a symmetric key using the AES-CTR algorithm.
   */
  const key = await crypto.subtle.generateKey(
    {
      name: &amp;#39;AES-CTR&amp;#39;,
      length: 256,
    },
    true,
    [&amp;#39;encrypt&amp;#39;, &amp;#39;decrypt&amp;#39;]
  );

  /**
   * Encrypt the plaintext using the AES-CTR key with
   * have generated.
   */
  const ciphertext = await crypto.subtle.encrypt(
    {
      name: &amp;#39;AES-CTR&amp;#39;,
      counter: crypto.getRandomValues(new Uint8Array(16)),
      length: 128,
    },
    key,
    plaintext
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="aesctrparams">AesCtrParams&lt;/h1>
&lt;p>The &lt;code>AesCtrParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/">encrypt&lt;/a> and
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/">decrypt&lt;/a> operation when using the AES-CTR algorithm.&lt;/p>
&lt;p>For more details, head to the MDN Web Crypto API documentation on &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AesCtrParams" target="_blank" rel="noopener noreferrer">AES-CTR&lt;/a>.&lt;/p></description></item><item><title>AesGcmParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aesgcmparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aesgcmparams/</guid><content><![CDATA[&lt;h1 id=&#34;aesgcmparams&#34;&gt;AesGcmParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;AesGcmParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/&#34;&gt;encrypt&lt;/a&gt; and 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/&#34;&gt;decrypt&lt;/a&gt; operation when using the AES-GCM algorithm.&lt;/p&gt;
&lt;p&gt;For more details, head to the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;MDN Web Crypto API documentation on AES-GCM&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Should be set to &lt;code&gt;AES-GCM&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;iv&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;ArrayBuffer&lt;/code&gt;, &lt;code&gt;TypedArray&lt;/code&gt;, or &lt;code&gt;DataView&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The initialization vector. It must be 12 bytes long, unpredictable and cryptographically random. It must be unique for every encryption operation carried out with a given key. Never reuse an iv with the same key. Yet, it doesn&amp;rsquo;t need to be secret and can be transmitted along with the ciphertext.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;additionalData (optional)&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;ArrayBuffer&lt;/code&gt;, &lt;code&gt;TypedArray&lt;/code&gt; or &lt;code&gt;DataView&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Additional data that should be authenticated, but not encrypted. It must be included in the calculation of the authentication tag, but not encrypted itself.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;tagLength (optional)&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The length of the authentication tag in bits. Should be set, and will default to 96.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const plaintext = new TextEncoder().encode(&amp;#39;Hello, World!&amp;#39;);

  /**
   * Generate a symmetric key using the AES-CBC algorithm.
   */
  const key = await crypto.subtle.generateKey(
    {
      name: &amp;#39;AES-GCM&amp;#39;,
      length: 256,
    },
    true,
    [&amp;#39;encrypt&amp;#39;, &amp;#39;decrypt&amp;#39;]
  );

  /**
   * Encrypt the plaintext using the AES-CBC key with
   * have generated.
   */
  const ciphertext = await crypto.subtle.encrypt(
    {
      name: &amp;#39;AES-GCM&amp;#39;,
      iv: crypto.getRandomValues(new Uint8Array(12)),
    },
    key,
    plaintext
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="aesgcmparams">AesGcmParams&lt;/h1>
&lt;p>The &lt;code>AesGcmParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/">encrypt&lt;/a> and
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/">decrypt&lt;/a> operation when using the AES-GCM algorithm.&lt;/p>
&lt;p>For more details, head to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams" target="_blank" rel="noopener noreferrer">MDN Web Crypto API documentation on AES-GCM&lt;/a>.&lt;/p></description></item><item><title>RsaOaepParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsaoaepparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsaoaepparams/</guid><content><![CDATA[&lt;h1 id=&#34;rsaoaepparams&#34;&gt;RsaOaepParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;RsaOaepParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/&#34;&gt;encrypt&lt;/a&gt; and 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/&#34;&gt;decrypt&lt;/a&gt; operation when using the RSA-OAEP algorithm.&lt;/p&gt;
&lt;p&gt;For more details, head to the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/RsaOaepParams&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;MDN Web Crypto API documentation on RSA-OAEP&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Should be set to &lt;code&gt;RSA-OAEP&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;label (optional)&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;ArrayBuffer&lt;/code&gt;, &lt;code&gt;TypedArray&lt;/code&gt;, or &lt;code&gt;DataView&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;It&amp;rsquo;s an array of bytes that does not itself need to be encrypted but which should be bound to the ciphertext. A digest of the label is part of the input to the encryption operation. Unless your application calls for a label, you can just omit this argument, and it will not affect the security of the encryption operation.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="rsaoaepparams">RsaOaepParams&lt;/h1>
&lt;p>The &lt;code>RsaOaepParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/encrypt/">encrypt&lt;/a> and
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/decrypt/">decrypt&lt;/a> operation when using the RSA-OAEP algorithm.&lt;/p>
&lt;p>For more details, head to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/RsaOaepParams" target="_blank" rel="noopener noreferrer">MDN Web Crypto API documentation on RSA-OAEP&lt;/a>.&lt;/p></description></item><item><title>AesKeyGenParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aeskeygenparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/aeskeygenparams/</guid><content><![CDATA[&lt;h1 id=&#34;aeskeygenparams&#34;&gt;AesKeyGenParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;AesKeyGenParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/&#34;&gt;generateKey&lt;/a&gt; operation when generating an AES key.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The name of the algorithm. Possible values are &lt;code&gt;AES-CBC&lt;/code&gt;, &lt;code&gt;AES-CTR&lt;/code&gt;, and &lt;code&gt;AES-GCM&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;length&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The length of the key in bits. Possible values are 128, 192 or 256.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const key = await crypto.subtle.generateKey(
    {
      name: &amp;#39;AES-CBC&amp;#39;,
      length: 256,
    },
    true,
    [&amp;#39;encrypt&amp;#39;, &amp;#39;decrypt&amp;#39;]
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="aeskeygenparams">AesKeyGenParams&lt;/h1>
&lt;p>The &lt;code>AesKeyGenParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/">generateKey&lt;/a> operation when generating an AES key.&lt;/p>
&lt;h2 id="properties">Properties&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Property&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">name&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">The name of the algorithm. Possible values are &lt;code>AES-CBC&lt;/code>, &lt;code>AES-CTR&lt;/code>, and &lt;code>AES-GCM&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">length&lt;/td>
&lt;td style="text-align: left">&lt;code>number&lt;/code>&lt;/td>
&lt;td style="text-align: left">The length of the key in bits. Possible values are 128, 192 or 256.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="example">Example&lt;/h2>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">export default async function () {
const key = await crypto.subtle.generateKey(
{
name: &amp;#39;AES-CBC&amp;#39;,
length: 256,
},
true,
[&amp;#39;encrypt&amp;#39;, &amp;#39;decrypt&amp;#39;]
);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>CryptoKeyPair</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/cryptokeypair/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/cryptokeypair/</guid><content><![CDATA[&lt;h1 id=&#34;cryptokeypair&#34;&gt;CryptoKeyPair&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;CryptoKeyPair&lt;/code&gt; object represents an asymmetric key pair with public and private keys.&lt;/p&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/&#34;&gt;&lt;code&gt;generateKey&lt;/code&gt;&lt;/a&gt; method can be used to create &lt;code&gt;CryptoKeyPair&lt;/code&gt; object for asymmetric algorithms such as &lt;code&gt;ECDH&lt;/code&gt; or &lt;code&gt;ECDSA&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;publicKey&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/&#34;&gt;&lt;code&gt;CryptoKey&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;A public key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;privateKey&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/&#34;&gt;&lt;code&gt;CryptoKey&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;A private key.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="cryptokeypair">CryptoKeyPair&lt;/h1>
&lt;p>The &lt;code>CryptoKeyPair&lt;/code> object represents an asymmetric key pair with public and private keys.&lt;/p>
&lt;p>The
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/">&lt;code>generateKey&lt;/code>&lt;/a> method can be used to create &lt;code>CryptoKeyPair&lt;/code> object for asymmetric algorithms such as &lt;code>ECDH&lt;/code> or &lt;code>ECDSA&lt;/code>.&lt;/p></description></item><item><title>EcKeyGenParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/eckeygenparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/eckeygenparams/</guid><content><![CDATA[&lt;h1 id=&#34;eckeygenparams&#34;&gt;EcKeyGenParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;EcKeyGenParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/&#34;&gt;generateKey&lt;/a&gt; operation when generating key pairs for ECDH or ECDSA algorithms.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An algorithm name. Possible values are &lt;code&gt;ECDH&lt;/code&gt; or &lt;code&gt;ECDSA&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;namedCurve&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;A elliptic curve&amp;rsquo;s name to use for key pair generation. Possible values are &lt;code&gt;P-256&lt;/code&gt;, &lt;code&gt;P-384&lt;/code&gt; or &lt;code&gt;P-521&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const keyPair = await crypto.subtle.generateKey(
    {
      name: &amp;#39;ECDSA&amp;#39;,
      namedCurve: &amp;#39;P-256&amp;#39;,
    },
    true,
    [&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;]
  );

  console.log(JSON.stringify(keyPair));
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="eckeygenparams">EcKeyGenParams&lt;/h1>
&lt;p>The &lt;code>EcKeyGenParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/">generateKey&lt;/a> operation when generating key pairs for ECDH or ECDSA algorithms.&lt;/p></description></item><item><title>EcdhKeyDeriveParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/ecdhkeyderiveparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/ecdhkeyderiveparams/</guid><content><![CDATA[&lt;h1 id=&#34;ecdhkeyderiveparams&#34;&gt;EcdhKeyDeriveParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;EcdhKeyDeriveParams&lt;/code&gt; represents the object that should be passed as the algorithm parameter into 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivebits/&#34;&gt;&lt;code&gt;deriveBits&lt;/code&gt;&lt;/a&gt;, when using the ECDH algorithm.&lt;/p&gt;
&lt;p&gt;ECDH is a secure communication method. Parties exchange public keys and use them with their private keys to generate a unique shared secret key.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An algorithm name. Should be &lt;code&gt;ECDH&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;publicKey&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/&#34;&gt;&lt;code&gt;CryptoKey&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Another party&amp;rsquo;s public key.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="ecdhkeyderiveparams">EcdhKeyDeriveParams&lt;/h1>
&lt;p>The &lt;code>EcdhKeyDeriveParams&lt;/code> represents the object that should be passed as the algorithm parameter into
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivebits/">&lt;code>deriveBits&lt;/code>&lt;/a>, when using the ECDH algorithm.&lt;/p>
&lt;p>ECDH is a secure communication method. Parties exchange public keys and use them with their private keys to generate a unique shared secret key.&lt;/p></description></item><item><title>EcdsaParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/ecdsaparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/ecdsaparams/</guid><content><![CDATA[&lt;h1 id=&#34;ecdsaparams&#34;&gt;EcdsaParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;EcdsaParams&lt;/code&gt; represents the object that should be passed as the algorithm parameter into 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/&#34;&gt;&lt;code&gt;sign&lt;/code&gt;&lt;/a&gt; or 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/&#34;&gt;&lt;code&gt;verify&lt;/code&gt;&lt;/a&gt; when using the ECDSA algorithm.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An algorithm name. Should be &lt;code&gt;ECDSA&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;hash&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An identifier for the digest algorithm to use. Possible values are &lt;code&gt;SHA-256&lt;/code&gt;, &lt;code&gt;SHA-384&lt;/code&gt; or &lt;code&gt;SHA-512&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="ecdsaparams">EcdsaParams&lt;/h1>
&lt;p>The &lt;code>EcdsaParams&lt;/code> represents the object that should be passed as the algorithm parameter into
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/">&lt;code>sign&lt;/code>&lt;/a> or
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/">&lt;code>verify&lt;/code>&lt;/a> when using the ECDSA algorithm.&lt;/p>
&lt;h2 id="properties">Properties&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Property&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">name&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">An algorithm name. Should be &lt;code>ECDSA&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">hash&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">An identifier for the digest algorithm to use. Possible values are &lt;code>SHA-256&lt;/code>, &lt;code>SHA-384&lt;/code> or &lt;code>SHA-512&lt;/code>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section></description></item><item><title>Pbkdf2Params</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/pbkdf2params/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/pbkdf2params/</guid><content><![CDATA[&lt;h1 id=&#34;pbkdf2params&#34;&gt;Pbkdf2Params&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;Pbkdf2Params&lt;/code&gt; object represents the parameters for the PBKDF2 algorithm. It should be passed as the &lt;code&gt;algorithm&lt;/code&gt; parameter into 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivebits/&#34;&gt;&lt;code&gt;deriveBits&lt;/code&gt;&lt;/a&gt; or 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivekey/&#34;&gt;&lt;code&gt;deriveKey&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;PBKDF2 (Password-Based Key Derivation Function 2) is designed to derive cryptographic keys from a password. It applies a pseudorandom function (such as HMAC) to the password along with a salt value and repeats the process many times to produce a derived key. The added computational work makes password cracking much more difficult.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Should be set to &lt;code&gt;PBKDF2&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;hash&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The hash function to use. Can be &lt;code&gt;SHA-1&lt;/code&gt;, &lt;code&gt;SHA-256&lt;/code&gt;, &lt;code&gt;SHA-384&lt;/code&gt;, or &lt;code&gt;SHA-512&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;salt&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;ArrayBuffer&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;A random or pseudo-random value of at least 16 bytes.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;iterations&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The number of iterations to perform. Must be greater than 0. Should be as high as possible (e.g., 310000 for SHA-256).&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const password = new TextEncoder().encode(&amp;#39;my secret password&amp;#39;);

  // Import the password as a key
  const baseKey = await crypto.subtle.importKey(&amp;#39;raw&amp;#39;, password, &amp;#39;PBKDF2&amp;#39;, false, [
    &amp;#39;deriveBits&amp;#39;,
    &amp;#39;deriveKey&amp;#39;,
  ]);

  // Generate a random salt
  const salt = crypto.getRandomValues(new Uint8Array(16));

  // Derive bits using PBKDF2
  const derivedBits = await crypto.subtle.deriveBits(
    {
      name: &amp;#39;PBKDF2&amp;#39;,
      hash: &amp;#39;SHA-256&amp;#39;,
      salt: salt,
      iterations: 310000,
    },
    baseKey,
    256
  );

  console.log(&amp;#39;derived bits: &amp;#39; &amp;#43; arrayBufferToHex(derivedBits));
}

function arrayBufferToHex(buffer) {
  return [...new Uint8Array(buffer)].map((x) =&amp;gt; x.toString(16).padStart(2, &amp;#39;0&amp;#39;)).join(&amp;#39;&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="pbkdf2params">Pbkdf2Params&lt;/h1>
&lt;p>The &lt;code>Pbkdf2Params&lt;/code> object represents the parameters for the PBKDF2 algorithm. It should be passed as the &lt;code>algorithm&lt;/code> parameter into
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivebits/">&lt;code>deriveBits&lt;/code>&lt;/a> or
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/derivekey/">&lt;code>deriveKey&lt;/code>&lt;/a>.&lt;/p>
&lt;p>PBKDF2 (Password-Based Key Derivation Function 2) is designed to derive cryptographic keys from a password. It applies a pseudorandom function (such as HMAC) to the password along with a salt value and repeats the process many times to produce a derived key. The added computational work makes password cracking much more difficult.&lt;/p></description></item><item><title>RsaPssParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsapssparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsapssparams/</guid><content><![CDATA[&lt;h1 id=&#34;rsapssparams&#34;&gt;RsaPssParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;RsaPssParams&lt;/code&gt; represents the object that should be passed as the algorithm parameter into 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/&#34;&gt;&lt;code&gt;sign&lt;/code&gt;&lt;/a&gt; or 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/&#34;&gt;&lt;code&gt;verify&lt;/code&gt;&lt;/a&gt; when using the RSA-PSS algorithm.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;An algorithm name. Should be &lt;code&gt;RSA-PSS&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;saltLength&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;A long integer representing the length of the random salt to use, in bytes.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;

&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Since under the hood we use Golang&amp;rsquo;s SDK the salt length 0 is not supported. In that case the maximum possible salt length will be used.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="rsapssparams">RsaPssParams&lt;/h1>
&lt;p>The &lt;code>RsaPssParams&lt;/code> represents the object that should be passed as the algorithm parameter into
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/sign/">&lt;code>sign&lt;/code>&lt;/a> or
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/verify/">&lt;code>verify&lt;/code>&lt;/a> when using the RSA-PSS algorithm.&lt;/p>
&lt;h2 id="properties">Properties&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Property&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">name&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">An algorithm name. Should be &lt;code>RSA-PSS&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">saltLength&lt;/td>
&lt;td style="text-align: left">&lt;code>number&lt;/code>&lt;/td>
&lt;td style="text-align: left">A long integer representing the length of the random salt to use, in bytes.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p></description></item><item><title>HmacKeyGenParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/hmackeygenparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/hmackeygenparams/</guid><content><![CDATA[&lt;h1 id=&#34;hmackeygenparams&#34;&gt;HmacKeyGenParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;HmacKeyGenParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/&#34;&gt;generateKey&lt;/a&gt; operation when generating an HMAC key.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;This should be set to &lt;code&gt;HMAC&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;hash&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The name of the digest function to use. Possible values are &lt;code&gt;SHA-1&lt;/code&gt;, &lt;code&gt;SHA-256&lt;/code&gt;, &lt;code&gt;SHA-384&lt;/code&gt; and &lt;code&gt;SHA-512&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;length (optional)&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The length of the key in bits. If this is omitted, the length of the key is equal to the block size of the hash function you have chosen. We recommend to leave this parameter empty, unless you have a good reason to use something different.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const key = await crypto.subtle.generateKey(
    {
      name: &amp;#39;HMAC&amp;#39;,
      hash: { name: &amp;#39;SHA-512&amp;#39; },
      length: 256,
    },
    true,
    [&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;]
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="hmackeygenparams">HmacKeyGenParams&lt;/h1>
&lt;p>The &lt;code>HmacKeyGenParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/">generateKey&lt;/a> operation when generating an HMAC key.&lt;/p>
&lt;h2 id="properties">Properties&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Property&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">name&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">This should be set to &lt;code>HMAC&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">hash&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">The name of the digest function to use. Possible values are &lt;code>SHA-1&lt;/code>, &lt;code>SHA-256&lt;/code>, &lt;code>SHA-384&lt;/code> and &lt;code>SHA-512&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">length (optional)&lt;/td>
&lt;td style="text-align: left">&lt;code>number&lt;/code>&lt;/td>
&lt;td style="text-align: left">The length of the key in bits. If this is omitted, the length of the key is equal to the block size of the hash function you have chosen. We recommend to leave this parameter empty, unless you have a good reason to use something different.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="example">Example&lt;/h2>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">export default async function () {
const key = await crypto.subtle.generateKey(
{
name: &amp;#39;HMAC&amp;#39;,
hash: { name: &amp;#39;SHA-512&amp;#39; },
length: 256,
},
true,
[&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;]
);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>RsaHashedImportParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsahashedimportparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsahashedimportparams/</guid><content><![CDATA[&lt;h1 id=&#34;rsahashedimportparams&#34;&gt;RsaHashedImportParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;RsaHashedImportParams&lt;/code&gt; represents the object that should be passed as the algorithm parameter into 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/importkey/&#34;&gt;&lt;code&gt;importKey&lt;/code&gt;&lt;/a&gt; when using the RSA algorithm.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;This should be set to &lt;code&gt;RSASSA-PKCS1-v1_5&lt;/code&gt;, &lt;code&gt;RSA-PSS&lt;/code&gt; or &lt;code&gt;RSA-OAEP&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;hash&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;object&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The name or an object with a &lt;code&gt;name&lt;/code&gt; property of the digest function to use. Possible values are &lt;code&gt;SHA-1&lt;/code&gt;, &lt;code&gt;SHA-256&lt;/code&gt;, &lt;code&gt;SHA-384&lt;/code&gt; and &lt;code&gt;SHA-512&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="rsahashedimportparams">RsaHashedImportParams&lt;/h1>
&lt;p>The &lt;code>RsaHashedImportParams&lt;/code> represents the object that should be passed as the algorithm parameter into
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/importkey/">&lt;code>importKey&lt;/code>&lt;/a> when using the RSA algorithm.&lt;/p>
&lt;h2 id="properties">Properties&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Property&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;th>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">name&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">This should be set to &lt;code>RSASSA-PKCS1-v1_5&lt;/code>, &lt;code>RSA-PSS&lt;/code> or &lt;code>RSA-OAEP&lt;/code>.&lt;/td>
&lt;td>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">hash&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">&lt;code>object&lt;/code>&lt;/td>
&lt;td>The name or an object with a &lt;code>name&lt;/code> property of the digest function to use. Possible values are &lt;code>SHA-1&lt;/code>, &lt;code>SHA-256&lt;/code>, &lt;code>SHA-384&lt;/code> and &lt;code>SHA-512&lt;/code>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section></description></item><item><title>RSAHashedKeyGenParams</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsahashedkeygenparams/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/rsahashedkeygenparams/</guid><content><![CDATA[&lt;h1 id=&#34;rsahashedkeygenparams&#34;&gt;RSAHashedKeyGenParams&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;RSAHashedKeyGenParams&lt;/code&gt; object represents the object that should be passed as the algorithm parameter into the 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/&#34;&gt;generateKey&lt;/a&gt; operation when generating an RSA key pair.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;name&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;This should be set to &lt;code&gt;RSASSA-PKCS1-v1_5&lt;/code&gt;, &lt;code&gt;RSA-PSS&lt;/code&gt; or &lt;code&gt;RSA-OAEP&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;modulusLength&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The length in bits of the RSA modulus. This should be at least 2048. Some organizations are now recommending that it should be 4096.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;publicExponent&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Uint8Array&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The public exponent. Unless you have a good reason to use something else, specify &lt;code&gt;65537&lt;/code&gt; here, which represented as a &lt;code&gt;Uint8Array&lt;/code&gt; is &lt;code&gt;new Uint8Array([1, 0, 1])&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;hash&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;object&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The name or an object with a &lt;code&gt;name&lt;/code&gt; property of the digest function to use. Possible values are &lt;code&gt;SHA-1&lt;/code&gt;, &lt;code&gt;SHA-256&lt;/code&gt;, &lt;code&gt;SHA-384&lt;/code&gt; and &lt;code&gt;SHA-512&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const keyPair = await crypto.subtle.generateKey(
    {
      name: &amp;#39;RSA-PSS&amp;#39;,
      modulusLength: 2048,
      publicExponent: new Uint8Array([1, 0, 1]),
      hash: { name: &amp;#39;SHA-256&amp;#39; },
    },
    true,
    [&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;]
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="rsahashedkeygenparams">RSAHashedKeyGenParams&lt;/h1>
&lt;p>The &lt;code>RSAHashedKeyGenParams&lt;/code> object represents the object that should be passed as the algorithm parameter into the
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/subtlecrypto/generatekey/">generateKey&lt;/a> operation when generating an RSA key pair.&lt;/p>
&lt;h2 id="properties">Properties&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Property&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;th>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">name&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">This should be set to &lt;code>RSASSA-PKCS1-v1_5&lt;/code>, &lt;code>RSA-PSS&lt;/code> or &lt;code>RSA-OAEP&lt;/code>.&lt;/td>
&lt;td>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">modulusLength&lt;/td>
&lt;td style="text-align: left">&lt;code>number&lt;/code>&lt;/td>
&lt;td style="text-align: left">The length in bits of the RSA modulus. This should be at least 2048. Some organizations are now recommending that it should be 4096.&lt;/td>
&lt;td>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">publicExponent&lt;/td>
&lt;td style="text-align: left">&lt;code>Uint8Array&lt;/code>&lt;/td>
&lt;td style="text-align: left">The public exponent. Unless you have a good reason to use something else, specify &lt;code>65537&lt;/code> here, which represented as a &lt;code>Uint8Array&lt;/code> is &lt;code>new Uint8Array([1, 0, 1])&lt;/code>&lt;/td>
&lt;td>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">hash&lt;/td>
&lt;td style="text-align: left">&lt;code>string&lt;/code>&lt;/td>
&lt;td style="text-align: left">&lt;code>object&lt;/code>&lt;/td>
&lt;td>The name or an object with a &lt;code>name&lt;/code> property of the digest function to use. Possible values are &lt;code>SHA-1&lt;/code>, &lt;code>SHA-256&lt;/code>, &lt;code>SHA-384&lt;/code> and &lt;code>SHA-512&lt;/code>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="example">Example&lt;/h2>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">export default async function () {
const keyPair = await crypto.subtle.generateKey(
{
name: &amp;#39;RSA-PSS&amp;#39;,
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1]),
hash: { name: &amp;#39;SHA-256&amp;#39; },
},
true,
[&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;]
);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div></description></item><item><title>JsonWebKey</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/jsonwebkey/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/crypto/jsonwebkey/</guid><content><![CDATA[&lt;h1 id=&#34;jsonwebkey&#34;&gt;JsonWebKey&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;JsonWebKey&lt;/code&gt; object represents object/dictionary generated by exporting a 
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/&#34;&gt;&lt;code&gt;CryptoKey&lt;/code&gt;&lt;/a&gt; or used as an input parameter for key import.&lt;/p&gt;
&lt;p&gt;The properties of the &lt;code&gt;JsonWebKey&lt;/code&gt; could vary depending on the algorithm and key type. See specification &lt;a href=&#34;https://www.w3.org/TR/WebCryptoAPI/#JsonWebKey-dictionary&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;JsonWebKey&lt;/a&gt; for details.&lt;/p&gt;
&lt;h2 id=&#34;properties&#34;&gt;Properties&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Property&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;kty&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The key type.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;k&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The key value.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;alg&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The algorithm.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;ext&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The key is extractable.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key_ops&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt; array&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The key operations.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;crv&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The curve name.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;x&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The x coordinate.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;y&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The y coordinate.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;d&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The private key.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;export default async function () {
  const jwk = {
    alg: &amp;#39;HS256&amp;#39;,
    ext: true,
    k: &amp;#39;H6gLp3lw7w27NrPUn00WpcKU-IJojJdNzhL_8F6se2k&amp;#39;,
    key_ops: [&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;],
    kty: &amp;#39;oct&amp;#39;,
  };

  const importedKey = await crypto.subtle.importKey(
    &amp;#39;jwk&amp;#39;,
    jwk,
    { name: &amp;#39;HMAC&amp;#39;, hash: { name: &amp;#39;SHA-256&amp;#39; } },
    true,
    [&amp;#39;sign&amp;#39;, &amp;#39;verify&amp;#39;]
  );

  const exportedAgain = await crypto.subtle.exportKey(&amp;#39;jwk&amp;#39;, importedKey);

  console.log(&amp;#39;exported again: &amp;#39; &amp;#43; JSON.stringify(exportedAgain));
  // should print
  // INFO[0000] exported again: {&amp;#34;k&amp;#34;:&amp;#34;H6gLp3lw7w27NrPUn00WpcKU-IJojJdNzhL_8F6se2k&amp;#34;,&amp;#34;kty&amp;#34;:&amp;#34;oct&amp;#34;,&amp;#34;ext&amp;#34;:true,&amp;#34;key_ops&amp;#34;:[&amp;#34;sign&amp;#34;,&amp;#34;verify&amp;#34;],&amp;#34;alg&amp;#34;:&amp;#34;HS256&amp;#34;}  source=console
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="jsonwebkey">JsonWebKey&lt;/h1>
&lt;p>The &lt;code>JsonWebKey&lt;/code> object represents object/dictionary generated by exporting a
&lt;a href="/docs/k6/v2.3.x/javascript-api/crypto/cryptokey/">&lt;code>CryptoKey&lt;/code>&lt;/a> or used as an input parameter for key import.&lt;/p>
&lt;p>The properties of the &lt;code>JsonWebKey&lt;/code> could vary depending on the algorithm and key type. See specification &lt;a href="https://www.w3.org/TR/WebCryptoAPI/#JsonWebKey-dictionary" target="_blank" rel="noopener noreferrer">JsonWebKey&lt;/a> for details.&lt;/p></description></item></channel></rss>