import { decryptText, encryptText } from "@asafarim/appsafe";
const encrypted = await encryptText("private note", password);
const plaintext = await decryptText(encrypted, password);NPM PACKAGE / HANDS-ON EXAMPLE
See the package work.
A small, public playground for @asafarim/appsafe. Run the same text and byte-level calls you would ship in your own browser app.
import { encryptBytes }
from "@asafarim/appsafe";
const payload = await encryptBytes(file, password);
// stays in this browser tab
01 / LIVE PLAYGROUND
Use the public package directly.
This demo has no owner gate because its purpose is to document the reusable npm API. All transforms still happen in browser memory.
The decrypt call uses the in-memory payload or a payload selected from disk. Both paths use the same package function.
02 / COPYABLE RECIPES
Three calls are enough.
Install the package, pass a password you manage, and keep the returned bytes wherever your browser app needs them.
import { decryptBytes, encryptBytes } from "@asafarim/appsafe";
const input = new Uint8Array(await file.arrayBuffer());
const encrypted = await encryptBytes(input, password);
const plaintext = await decryptBytes(encrypted, password);Install
pnpm add @asafarim/appsafeWorks in browser runtimes with Web Crypto support.
Encrypt
await encryptBytes(data, password)Returns a portable Uint8Array payload with authenticated metadata.
Decrypt
await decryptBytes(payload, password)Wrong passwords and modified payloads fail closed.