High-performance WhatsApp utilities powered by Rust and WebAssembly.
| Feature | Status |
|---|---|
| Binary Protocol | ✅ |
| Libsignal | ✅ |
| App State Sync | ✅ |
| Audio (waveform, duration) | ✅ |
| Image (thumbnails, conversion) | ✅ |
| Sticker Metadata | ✅ |
Every commit CI builds and tests — on main and on every pull request — then
uploads that build to
pkg.pr.new, installable from a
URL. Nothing is published to npm, so a fix can be tried before it reaches a
release:
# the head of a pull request, following it as new commits land
npm install https://pkg.pr.new/@oxidezap/whatsapp-rust-bridge@88
# one specific commit
npm install https://pkg.pr.new/@oxidezap/whatsapp-rust-bridge@7ef8db0Every open pull request comments the URL for its own head, and pkg.pr.new/~/oxidezap/whatsapp-rust-bridge lists what is available. Two things leave a commit without one. A release version bump is not built at all — CI skips a diff that cannot reach the build, and that commit is on its way to npm anyway. And the upload does not fail the run: pkg.pr.new is not this repository's to keep up, so a green commit with no preview means it was unreachable, not that the build was bad.
The tarball is the one the run built and tested: the same bun run build
output, packed through the same prepack guard a real publish goes through.
What it is not is a release. Preview builds carry the version
0.0.0-preview-<sha>, which no range written for a real release can match — an
install is a deliberate pin, and it stays on that commit until you change it.
They are for trying a change, not for running one.
bun run build normalizes source roots to bridge, core, crate/version and
rust/library. Diagnostic filenames and line numbers remain available.
A persistent host implements seven JsStoreCallbacks methods. These are
get, set, delete, commitPatch, commitSnapshot, touchTcTokenSenderTimestamp,
and storeReceivedTcToken. Client construction rejects missing or non-function
callbacks with kind: "invalid-argument" and field: "store" before storage I/O.
The built-in in-memory backend requires no JS callbacks.
commitPatch must atomically persist the version and MAC changes, including
the self-index when requested.
When upgrading an existing host, add commitSnapshot(name, state, entries, maintainIndex).
In the same transaction or shared lock as commitPatch, delete the rows in
mutation_mac whose keys start with name + ":", insert all replacement entries,
and write state to sync_version[name]. If maintainIndex is true, replace the
same prefix in meta[mutation_mac_keys] in that transaction. An empty snapshot
still clears the collection's MACs and writes its version. The existing keys
and byte layouts carry forward.
Token callbacks must merge against the latest row, preserve the other timestamp/token fields, and share serialization with every writer in the device scope. Timestamps cross as signed decimal i64 strings. Use a transaction, CAS, or a lock shared by all relevant adapters/processes; separate writes, a non-transactional batch, or an adapter-local mutex are insufficient. Resolve only at the host's persistence boundary and propagate post-commit errors. The generated callback declarations describe the existing namespaces and byte layouts.
ADV identity recovery requires listKeys with capabilities.enumerate: true,
including historical state in the account scope. If enumeration is unavailable,
recovery fails with a storage error. The backend cannot detect incomplete
successful listKeys results. The in-memory backend supports this directly.
On Node and Bun the default entrypoint finds and loads the wasm itself:
import { createWhatsAppClient } from "@oxidezap/whatsapp-rust-bridge";Hosts without filesystem access (Cloudflare Workers, workerd, Deno,
browsers) supply the wasm instead. Import the asset through the ./wasm
subpath — a static import, which workerd/wrangler compile to a
WebAssembly.Module — and pass it to initSync from ./host:
import wasm from "@oxidezap/whatsapp-rust-bridge/wasm";
import {
initSync,
createWhatsAppClient,
} from "@oxidezap/whatsapp-rust-bridge/host";
initSync({ module: wasm });Call initSync once per isolate, and on workerd create clients inside a
request handler rather than at global scope (crypto.getRandomValues is
unavailable during global-scope evaluation).