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
Copy file name to clipboardExpand all lines: README.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
> [!WARNING]
4
4
> This package uses [`Uint8Array.prototype.toBase64()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64) and [`Uint8Array.fromBase64()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64), which, as of November 2025, are only supported by the latest versions of browsers, [Bun](https://bun.com/), [Deno 2.5 or later](https://deno.com/) and [Node.js 25 or later](https://nodejs.org/en). See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64#browser_compatibility) for compatibility.
5
5
6
-
A simple, secure, and fast symmetric encryption library that makes use of [AES-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode) and modern platform features. It leverages the native [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API), so it works both in browsers and JavaScript runtimes.
6
+
A simple, secure, and fast symmetric encryption library that makes use of [AES-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode) and modern platform features. It leverages the native [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API), so it works both in browsers (in secure contexts) and JavaScript runtimes.
7
7
8
8
## Why AES-GCM?
9
9
@@ -45,7 +45,10 @@ import { getMessageEncryptionKey } from "./lib/crypto/key";
45
45
46
46
exportconst cryptoMessage =newSingleCryptText(
47
47
awaitgetMessageEncryptionKey()
48
-
)
48
+
);
49
+
50
+
// Recommended: Freeze the instance to prevent modification of the `urlSafe` property.
51
+
Object.freeze(cryptoMessage);
49
52
```
50
53
51
54
#### Usage
@@ -197,6 +200,9 @@ new SingleCryptText(
197
200
198
201
-`urlSafe: boolean`
199
202
Indicates if the instance uses `base64url` encoding (`true`, default) or standard `base64` (`false`) for encrypted outputs.
203
+
204
+
> [!NOTE]
205
+
> It is recommended to freeze `SingleCryptText` instances with `Object.freeze()` to prevent its modification.
0 commit comments