Key concepts and tips before starting:
Repository Structure
Files
world.wit — declare host imports
tenant-* world and refuses to load it if it imports an interface that isn’t part of any tenant world.
Cargo.toml — compile to a WASM component
lib.rs — contract entry point
search.rs — search_offers (synchronous http, no PII)
booking.rs — book_offer (PII via http-with-placeholders)
book-offer is the PII-bearing counterpart — it uses http-with-placeholders so the passenger’s name, DOB, and email never enter the contract.
api_key is read from the secrets map. The key is seeded by the SDK. There is no set-credentials function. Callers read it from the secrets map (tail only — the host prefixes z:<tid>:):
Key Design Rules
kv_store::get/kv_store::puttake the map tail only — neverz:<tid>:. The host prefixes it based on your contract’s tenant identity.- Error types use
Result<T, ContractError>with one variant per failure reason. Never returnboolor a stringly-typed error string. http_iface::callis synchronous — you get the response back before the function returns. Use it when you need to act on the API response in the same call.- For calls carrying user PII, use
http-with-placeholders: put{{profile.<field>}}markers in the request and the host resolves them from the caller’s profile inside the enclave, so plaintext PII never enters your contract.