You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,6 +17,8 @@ On node (or bun), it'll use [`node:crypto`](https://nodejs.org/api/crypto.html#c
15
17
> You may need to polyfill [`crypto.getRandomValues`](https://github.com/LinusU/react-native-get-random-values) for React Native.
16
18
>
17
19
> There are some limitations, see [Known limitations](#known-limitations) below.
20
+
>
21
+
> This library is tree-shakeable, unused code will be excluded by bundlers.
18
22
19
23
Check the [example](./example/) folder for bun/deno usage.
20
24
@@ -44,11 +48,15 @@ The API follows `@noble/ciphers`'s API for ease of use, you can check their [exa
44
48
-`aes-256-cbc`
45
49
-**Only for legacy applications**. You should use `xchacha20-poly1305` or `aes-256-gcm` as possible.
46
50
- Nonce is always 16 bytes.
51
+
-`chacha20-poly1305`
52
+
- Nonce is always 12 bytes.
47
53
-`xchacha20-poly1305`
48
54
- Nonce is always 24 bytes.
49
55
56
+
If key is fixed and nonce is less than 16 bytes, avoid randomly generated nonce.
57
+
50
58
## Known limitations
51
59
52
-
-`xchacha20-poly1305` is implemented with pure JS [`hchacha`](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha#section-2.2) function and `node:crypto`'s `chacha20-poly1305`.
53
-
- Currently (Oct 2024), `node:crypto`'s `chacha20-poly1305` is not supported on deno and [bun](https://github.com/oven-sh/bun/issues/8072), `@noble/ciphers`'s implementation is used on both platforms instead.
60
+
-`xchacha20-poly1305` is implemented with pure JS [`hchacha20`](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha#section-2.2) function and `node:crypto`'s `chacha20-poly1305` on node.
61
+
- Currently (Nov 2024), `node:crypto`'s `chacha20-poly1305` is not supported on deno and [bun](https://github.com/oven-sh/bun/issues/8072), `@noble/ciphers`'s implementation is used on both platforms instead.
54
62
-`deno` does not support **indirect** conditional exports. If you use this library to build another library, client code of your library probably falls back to the `node:crypto` implementation and may not work properly, specifically `aes-256-gcm` (16 bytes nonce) and `chacha20-poly1305`.
0 commit comments