rift-wasm 0.1.3

WebAssembly bindings for Rift P2P browser clients
Documentation

rift-wasm


Part of the riftd project — serverless P2P voice + text chat over UDP.

What's in this crate?

rift-wasm brings rift to the browser:

  • WasmClient — Browser-compatible rift client
  • E2EE — Encrypt/decrypt messages in the browser
  • Voice Encoding — Encode/decode voice frames
  • Audio Utilities — Level detection, gain, mixing
  • PCM Conversion — Float32 ↔ PCM16 for Web Audio API

Usage

import init, { WasmClient, AudioConfig } from 'rift-wasm';

await init();

const client = new WasmClient();

// Encrypt a message
const encrypted = client.encrypt(plaintext);

// Encode voice for transmission
const encoded = client.encode_voice_pcm(pcmSamples);

// Audio utilities
const level = audio_level(samples);
const isActive = is_voice_active(samples);

Building

# Install wasm-pack
cargo install wasm-pack

# Build for web
wasm-pack build --target web

# Build for bundlers
wasm-pack build --target bundler

Browser Prototype

See README.browser.md for the browser demo setup.

Related Crates

Crate Description
rift-core Core types and crypto
rift-protocol Message encoding
rift-sdk Native SDK

Citation

If you use riftd in academic work, please cite:

de Beer, R. (2026). Predictive Rendezvous: Time–Intent–Deterministic Peer Coordination Without Infrastructure. Zenodo. https://doi.org/10.5281/zenodo.18528430

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.