default-features=false dropped too much; tls-ring brings back presets::N0 (ring works on wasm). wasm Rust code now compiles except the runtime refactor; the remaining build blocker is ring's build script needing a wasm-capable clang. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
76 lines
3.0 KiB
TOML
76 lines
3.0 KiB
TOML
[package]
|
|
name = "tethercore"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "Shared tether sync engine: codec + SSE client + reconnect, FFI-exported via UniFFI."
|
|
|
|
[lib]
|
|
# lib → examples/tests can link it natively
|
|
# staticlib → iOS .a / desktop agent
|
|
# cdylib → Android .so / bindgen library mode
|
|
crate-type = ["lib", "staticlib", "cdylib"]
|
|
name = "tethercore"
|
|
|
|
[[bin]]
|
|
name = "uniffi-bindgen"
|
|
path = "src/bin/uniffi-bindgen.rs"
|
|
|
|
# Common, wasm-safe dependencies (no OS sockets / threads).
|
|
[dependencies]
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
futures-util = "0.3"
|
|
sha2 = "0.11.0"
|
|
bytes = "1.12.0"
|
|
chacha20poly1305 = "0.10.1"
|
|
base64 = "0.22.1"
|
|
|
|
[features]
|
|
default = []
|
|
iroh-transport = ["dep:iroh", "dep:iroh-gossip", "dep:iroh-blobs"]
|
|
|
|
# ── Native (desktop/mobile): legacy transports + UniFFI + full tokio ──
|
|
# The hand-rolled SSE/RTC/LAN stack and its OS-socket deps live here; none of it
|
|
# compiles to wasm. iroh (behind the feature) takes full default features.
|
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
|
uniffi = { version = "0.28", features = ["cli"] }
|
|
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream", "json"] }
|
|
tokio = { version = "1", features = ["rt-multi-thread", "time", "sync", "macros", "net", "io-util"] }
|
|
webrtc = "0.17.1"
|
|
mdns-sd = "0.20.0"
|
|
getrandom = "0.4.3"
|
|
iroh = { version = "1", optional = true }
|
|
iroh-gossip = { version = "0.101", optional = true }
|
|
iroh-blobs = { version = "0.103", optional = true }
|
|
|
|
# ── wasm32 (browser): iroh-only, no OS sockets / UniFFI ──
|
|
# Browser iroh is relay-only; reqwest uses fetch; the runtime is the JS event
|
|
# loop (wasm-bindgen-futures) instead of a tokio runtime.
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
tokio = { version = "1", features = ["sync", "macros"] }
|
|
reqwest = { version = "0.12", default-features = false, features = ["json"] }
|
|
# wasm rng: getrandom 0.4 uses a build-cfg (--cfg getrandom_backend="wasm_js"),
|
|
# but a transitive getrandom 0.2 needs the `js` *feature* — enable it via the
|
|
# rename-alias trick (cargo unifies it with the transitive copy).
|
|
getrandom = "0.4.3"
|
|
getrandom_02 = { package = "getrandom", version = "0.2", features = ["js"] }
|
|
wasm-bindgen-futures = "0.4"
|
|
# Browser iroh: default-features off (drops native portmapper/apple-datapath),
|
|
# but keep tls-ring — ring works on wasm and presets::N0 needs it. (Matches n0's
|
|
# own browser-chat example.)
|
|
iroh = { version = "1", optional = true, default-features = false, features = ["tls-ring"] }
|
|
iroh-gossip = { version = "0.101", optional = true, default-features = false, features = ["net"] }
|
|
iroh-blobs = { version = "0.103", optional = true, default-features = false }
|
|
|
|
[dev-dependencies]
|
|
# Iroh spikes (examples/iroh_*.rs) link iroh directly regardless of the feature.
|
|
iroh = "1"
|
|
iroh-gossip = "0.101"
|
|
anyhow = "1"
|
|
|
|
# The M4 integration example drives the real Engine over IrohTransport, so it
|
|
# needs the feature (and Engine::iroh_id, which only exists under it).
|
|
[[example]]
|
|
name = "iroh_engine"
|
|
required-features = ["iroh-transport"]
|