Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8e0e71f
feat(truapi): add testing API and versioned wiring
pgherveou Jun 30, 2026
dea080a
fixup! feat(truapi): add testing API and versioned wiring
pgherveou Jul 1, 2026
3409152
fixup! feat(truapi): add testing API and versioned wiring
pgherveou Jul 1, 2026
0569aaf
fixup! feat(truapi): add testing API and versioned wiring
pgherveou Jul 2, 2026
8c93e99
feat(truapi-platform): add host capability traits
pgherveou Jun 30, 2026
97d0b79
fixup! feat(truapi-platform): add host capability traits
pgherveou Jul 2, 2026
d2e3674
fixup! feat(truapi-platform): add host capability traits
pgherveou Jul 3, 2026
c6f888c
feat(truapi-codegen): emit Rust dispatcher, wire table, and host call…
pgherveou Jun 30, 2026
a37abae
fixup! feat(truapi-codegen): emit Rust dispatcher, wire table, and ho…
pgherveou Jul 2, 2026
99d1b7e
fixup! feat(truapi-codegen): emit Rust dispatcher, wire table, and ho…
pgherveou Jul 2, 2026
1c46353
fixup! feat(truapi-codegen): emit Rust dispatcher, wire table, and ho…
pgherveou Jul 2, 2026
2c52262
fixup! feat(truapi-codegen): emit Rust dispatcher, wire table, and ho…
pgherveou Jul 3, 2026
7bd57b8
fixup! feat(truapi-codegen): emit Rust dispatcher, wire table, and ho…
pgherveou Jul 3, 2026
6964df3
feat(truapi-server): add host logic primitives
pgherveou Jul 1, 2026
c8c4595
fixup! feat(truapi-server): add host logic primitives
pgherveou Jul 1, 2026
88cf1a9
fixup! feat(truapi-server): add host logic primitives
pgherveou Jul 2, 2026
2d88bdf
fixup! feat(truapi-server): add host logic primitives
pgherveou Jul 3, 2026
fa642c1
fixup! feat(truapi-server): add host logic primitives
pgherveou Jul 3, 2026
dab5395
Merge origin/main into rust-core/04-codegen
pgherveou Jul 3, 2026
15e1594
Merge branch 'rust-core/04-codegen' into rust-core/04a-server-host-logic
pgherveou Jul 3, 2026
54f0b20
docs(host-logic): link host-spec sections
pgherveou Jul 3, 2026
750e623
Merge branch 'main' into rust-core/04a-server-host-logic
pgherveou Jul 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,883 changes: 3,448 additions & 435 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
allow = [
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"CC0-1.0",
"Unicode-3.0",
"Unlicense",
"Zlib",
Expand Down
67 changes: 67 additions & 0 deletions rust/crates/truapi-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[package]
name = "truapi-server"
version = "0.1.0"
edition.workspace = true
description = "TrUAPI server runtime: dispatcher, frames, SCALE, streams"
license = "MIT"

[lib]
crate-type = ["rlib", "cdylib"]

[features]
default = []

[dependencies]
truapi = { path = "../truapi" }
truapi-platform = { path = "../truapi-platform" }
async-trait = "0.1"
derive_more = { version = "2", features = ["display"] }
futures = "0.3"
futures-timer = { version = "3", features = ["wasm-bindgen"] }
parity-scale-codec = { version = "3", features = ["derive"] }
primitive-types = { version = "0.13", default-features = false, features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "1"
unicode-normalization = "0.1"
url = "2"
hex = "0.4"
blake2-rfc = { version = "0.2", default-features = false }
sp-crypto-hashing = { version = "0.1", default-features = false }
bs58 = { version = "0.5", default-features = false, features = ["alloc"] }
schnorrkel = { version = "0.11.5", default-features = false, features = ["alloc", "getrandom"] }
substrate-bip39 = { version = "0.6", default-features = false }
getrandom = { version = "0.2", features = ["js"] }
p256 = { version = "0.13", default-features = false, features = ["ecdh"] }
hkdf = "0.12"
sha2 = "0.10"
aes-gcm = { version = "0.10", default-features = false, features = ["aes", "alloc"] }
tracing = "0.1"
# `registry` + `std` only: pulls the Registry + per-layer filter/reload, but
# not `env-filter` (which drags in `regex`, heavy on wasm).
tracing-subscriber = { version = "0.3", default-features = false, features = ["registry", "std"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
subxt-rpcs = { version = "0.50.1", default-features = false, features = ["native"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3"
subxt-rpcs = { version = "0.50.1", default-features = false, features = ["web"] }
wasm-bindgen = "0.2.118"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1"
futures-util = "0.3"
pin-project = "1"
send_wrapper = { version = "0.6", features = ["futures"] }
web-time = "1"
web-sys = { version = "0.3", features = [
"BinaryType",
"CloseEvent",
"console",
"Event",
"MessageEvent",
"WebSocket",
] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"
33 changes: 33 additions & 0 deletions rust/crates/truapi-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# truapi-server

_Runtime core for TrUAPI: dispatcher, protocol frames, SCALE-coded wire envelope._

## What this crate is for

`truapi-server` is the runtime that turns trait implementations of the
`truapi` API into a working host. It owns:

- the [`ProtocolMessage`] wire envelope and SCALE codec
- the [`Dispatcher`] that routes incoming frames to per-method handlers
- the subscription lifecycle (start/receive/stop/interrupt)
- the [`Transport`] trait that platform-specific IPC backends implement
- the auto-generated dispatcher/wire-table tables shipped under
[`crate::generated`]

## Wire envelope

Every frame on the wire is encoded as:

```text
[requestId: SCALE str][discriminant: u8][payload bytes...]
```

The discriminant identifies a method + frame kind via the auto-generated
[`crate::generated::wire_table::WIRE_TABLE`]. Each method's ids are exposed
as a named const (`PREIMAGE_SUBMIT`, ...); both `WIRE_TABLE` and the generated
dispatcher reference those consts. Method ordering is part of the wire
protocol; only ever append.

The payload bytes are the SCALE-encoded inner value, inlined without a
length prefix. The discriminant is carried directly as `Payload::id`, and the
dispatcher routes on that numeric id via id-keyed tables.
16 changes: 16 additions & 0 deletions rust/crates/truapi-server/src/host_logic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Host-agnostic logic the Rust core owns on behalf of every platform host.
//!
//! Platform callbacks are a syscall layer for OS primitives (modals, native
//! storage, URL handler, notification center). Everything else lives here so
//! iOS, Android, and web hosts share one canonical implementation.

pub mod dotns;
pub mod entropy;
pub mod features;
pub mod identity;
pub mod permissions;
pub mod product_account;
pub mod session;
pub mod session_store;
pub mod sso;
pub mod statement_store;
Loading