# Check native build
cargo check --package webtor
# Check WASM build
cargo check --package webtor --target wasm32-unknown-unknown
cargo check --package webtor-wasm --target wasm32-unknown-unknown
# Build WASM demo (includes embedded consensus)
wasm-pack build webtor-demo --target web --out-dir pkg --release
# Run example locally (alternative, requires npm)
cd example && npm install && npm run dev# Unit tests
cargo test -p webtor
# Property-based tests (proptest)
cargo test -p webtor proptest
# E2E tests (requires network)
npm run test:tls
# Criterion microbenchmarks
cargo bench -p webtor --bench circuit_params
# Fuzz tests (requires nightly)
cd subtle-tls/fuzz && cargo +nightly fuzz run fuzz_server_hellowebtor/- Core Tor client librarywebtor-wasm/- WASM bindings for webtorwebtor-demo/- Demo application libraryexample/- Web demo (Vite + TypeScript)subtle-tls/- SubtleCrypto-based TLS for WASMscripts/- Build and consensus fetch scripts
webtor/src/client.rs- Main TorClient implementationwebtor/src/circuit.rs- Circuit managementwebtor/src/directory.rs- Consensus fetching and parsingwebtor/src/relay.rs- Relay selectionwebtor/src/cached/- Embedded consensus data (updated daily)
- For WASM builds, consensus is embedded at compile time from
webtor/src/cached/ - The daily GitHub Action (
daily-consensus-update.yml) refreshes cached consensus - Snowflake bridge is WASM-only; WebTunnel is available for both WASM and native builds
ringcrate doesn't compile to WASM, sosubtle-tlsprovides TLS via SubtleCrypto
CRITICAL: std::time::Instant::now() panics on WASM with "time not implemented on this platform".
All time-related code in vendored Arti crates must use WASM-compatible alternatives:
| Native | WASM Replacement | Location |
|---|---|---|
std::time::Instant |
web_time::Instant |
tor-rtcompat/src/traits.rs |
coarsetime::Instant |
web_time::Instant |
tor-rtcompat/src/coarse_time.rs |
coarsetime::Instant |
web_time::Instant |
tor-proto/src/channel.rs (OpenedAtInstant) |
coarsetime::Instant |
web_time::Instant |
tor-proto/src/channel/handshake.rs (HandshakeInstant) |
coarsetime::Instant |
js_sys::Date::now() |
tor-proto/src/util/ts.rs (AtomicOptTimestamp) |
std::time::Instant |
web_time::Instant |
tor-proto/src/util/tunnel_activity.rs |
std::time::SystemTime::now() |
js_sys::Date::now() |
webtor/src/time.rs |
When upgrading vendored Arti crates, always check for new usages of:
std::time::Instantcoarsetime::InstantInstant::now()withoutweb_time::prefix
Use grep -rn "std::time::Instant\|coarsetime::Instant" vendor/arti/ to find violations.
- No emojis in documentation, README, or markdown files - use plain text instead
- Use plain ASCII characters (
+,-,|) instead of Unicode box-drawing characters (┌, ─, │, etc.) for diagrams in markdown - they render more reliably across platforms - Use
[x]for checkboxes, not emoji checkmarks
- Always bump the UI version in
webtor-demo/static/index.html(footer) on any UI-related changes - Current version format:
v0.X.Y
WASM artifacts are automatically published to Cloudflare R2 on each release:
- CDN URL:
https://webtor-wasm.53627.org - Versioned:
https://webtor-wasm.53627.org/webtor-wasm/v0.5.6/ - Latest:
https://webtor-wasm.53627.org/webtor-wasm/latest/
Files available:
webtor_wasm.js- JavaScript bindingswebtor_wasm_bg.wasm- WASM binarywebtor_wasm.d.ts- TypeScript definitionspackage.json- Package metadata
- NEVER release when CI is failing - always verify all checks pass first
- Create a release after every PR merged to this repo (only if CI passes)
- Every release must include a build artifact (not just source code)
- Release notes must include the changelog - copy the relevant section from CHANGELOG.md
- R2 upload is automatic - triggered by the Release WASM workflow on tags
- Steps:
- Verify CI passes:
gh pr view <PR> --json statusCheckRollupor check GitHub Actions - Update CHANGELOG.md (move Unreleased to new version)
- Commit and push changes
- Wait for CI to pass on main before tagging
- Create and push git tag:
git tag vX.Y.Z && git push origin main --tags - Build WASM:
wasm-pack build webtor-demo --target web --out-dir pkg --release - Package build:
cd webtor-demo && zip -r ../webtor-demo-vX.Y.Z.zip pkg/ - Create release with changelog in notes:
gh release create vX.Y.Z --title "vX.Y.Z" --notes "## Added - Feature 1 - Feature 2 ## Fixed - Bug fix 1 **Full Changelog**: https://github.com/privacy-ethereum/webtor-rs/compare/vPREV...vX.Y.Z" webtor-demo-vX.Y.Z.zip
- Verify CI passes: