# Create key (generate a key for encrypting the file(s))

The below code is implemented from[ here](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey), where we create a[ CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey):

```javascript
 const key = await window.crypto.subtle.generateKey(
     {
       name: "AES-GCM",
       length: 256,
     },
     true,
     ["encrypt", "decrypt"]
   );

```

The appearance of the key in the application is extracted by the function:

```javascript
const readKey = await window.crypto.subtle.exportKey("jwk", key);
console.log(readKey.k);
```

This key will be used for encryption and decryption. &#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eueno.io/eueno-libraries/eueno-lib-browser/create-key-generate-a-key-for-encrypting-the-file-s.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
