> For the complete documentation index, see [llms.txt](https://docs.eueno.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eueno.io/eueno-libraries/eueno-lib-browser/create-key-generate-a-key-for-encrypting-the-file-s.md).

# 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;
