2. Textile Host Stores (fleetmesh_protocols.textile)#
fleetmesh_protocols.textile implements the host-side components of the Textile data plane: a content-addressed fiber store and quilt store with mountable HTTP route handlers (/api/fibers*, /api/quilts*), together with the hosted leaf relay that serves NIP-77 negentropy synchronization and DIDComm mediation to browser leaves. Its browser counterpart is @fleetmesh/textile.
2.1. Key Derivation#
HostedLeafRelay derives its cryptographic keys from FLEETMESH_LEAF_RELAY_SECRET or, when that variable is unset, from the engine’s node key. Initialization fails if neither key source is available. Because leaves cache the mediator’s descriptor, changing the secret rotates the keys to which leaves seal envelopes.
2.2. Fiber Store#
Content-addressed Fiber Store (node.protocols.textile.fiber_store).
Every fiber’s bytes are stored once, keyed by their 1,024-byte-leaf Bao root (fiber_root). Each author who publishes those bytes holds a claim recording the fiber’s kind, MIME type, visibility and (for interaction fibers) the strand it points at.
- class fleetmesh_protocols.textile.fiber_store.StandaloneFiberStore[source]#
Bases:
objectThread-safe fiber blobs + per-author claims, persisted to SQLite (or held in memory).
- put(raw, principal, *, kind, mime_type='', visibility='vault_only', target_strand_id='', enforce_quota=True)[source]#
/api/fibers* HTTP routing for StandaloneFiberStore (node.protocols.textile.fiber_routes).
GET /api/fibers the caller’s own fiber manifests
GET /api/fibers/<root> bytes as an opaque download (?format=json for base64 + manifest)
GET /api/fibers/<root>/manifest manifest only
GET /api/fibers/interactions?target=<strand_id> public interaction counts by kind
POST /api/fibers {data_b64, kind, mime_type?, visibility?, target_strand_id?}
POST /api/fibers/visibility {fiber_root, visibility} on the caller’s claim
POST /api/fibers/release {fiber_root} drops the caller’s claim
Unreadable and missing fibers both answer 404.
- fleetmesh_protocols.textile.fiber_routes.binary_http_response(raw, *, bao_root, sha256_hex, mime_type, public, filename, as_json, json_extra=None)[source]#
Serve stored bytes so they can never render as a page on the app’s origin.
2.3. Quilt Store#
Quilt store: per-owner quilt views for cross-device sync and channel pages (node.protocols.textile.quilt_store).
- fleetmesh_protocols.textile.quilt_store.validate_quilt_view(view, principal, *, owner_ref=None)[source]#
Problems with a published view (empty when it may be stored).
- fleetmesh_protocols.textile.quilt_store.group_owner_id(circle_id)[source]#
A circle’s identity as a quilt owner: its own namespace, apart from user identity ids.
- class fleetmesh_protocols.textile.quilt_store.StandaloneQuiltStore[source]#
Bases:
objectLatest quilt view per (owner, audience), persisted to SQLite (or held in memory).
/api/quilts* HTTP routing for StandaloneQuiltStore (node.protocols.textile.quilt_routes).
POST /api/quilts {views: [MeshQuiltView…]} publishes the caller’s quilt views
GET /api/quilts/me?audience=self the caller’s own view (cross-device sync)
GET /api/quilts/<identity_id|did> an owner’s public view (channel pages)
POST /api/quilts/group {circle_id, view} a member publishes their circle’s quilt view
GET /api/quilts/group/<circle_id>?audience=circle|public a circle’s view (circle for members)
GET answers {ok: true, view: null} when there is no view the caller may read.
2.4. Hosted Leaf Relay#
FleetMesh Hosted Leaf Relay & Mediator (node.protocols.textile.hosted_relay).
Hosts an embedded Nostr/Fleetmesh Leaf Relay & Mediator, advertising a signed kind 11801 descriptor, mediating DIDComm v2 envelopes (coordinate-mediation/2.0, routing/2.0, messagepickup/2.0 & 3.0), and indexing the 4-layer Textile hierarchy (Fibers -> Strands -> Fabrics -> Quilts).
- class fleetmesh_protocols.textile.hosted_relay.HostedLeafRelay[source]#
Bases:
objectEmbedded Leaf Relay, DIDComm v2 Mediator, and Textile Negentropy Engine.
- get_mediator_config(endpoint_override=None)[source]#
- Parameters:
endpoint_override (str | None)
- Return type:
- release_owner(leaf_did, owner_did)[source]#
A leaf no longer picks up for an owner it has moved away from.
Hosted Leaf Relay Inventory & RFC 6455 WebSocket Transport (node.protocols.textile.leaf_relay).
- fleetmesh_protocols.textile.leaf_relay.det_hex(seed)[source]#
SHA-256 hex of seed: how hosted relays derive their keys and synthetic inventory ids.
Not canonical_bao_hex (a Bao leaf hash, sha256(0x00 || seed)): deployed mediators derived their agreement, transport and operator keys with plain SHA-256, and leaves cache the descriptor carrying those keys, so a different derivation silently rotates every hosted mediator’s keys.
- fleetmesh_protocols.textile.leaf_relay.neg_fingerprint(items)#
NIP-77’s, over the ids in order-independent fashion. fleetmesh_core/storage/replication.py owns the algorithm; this exists so the caller reads in terms of items.
- fleetmesh_protocols.textile.leaf_relay.encode_neg_message(ranges)#
ranges: [(upper Bound, mode, payload)] in ascending order.
- fleetmesh_protocols.textile.leaf_relay.decode_neg_message(buf)#
Bytes to ranges, or an exception. Never a partial parse.
A message arrives from a peer that has proved nothing yet, so this rejects rather than repairs. The reference implementation makes the same choices, and where it normalises instead of rejecting - a bound after infinity - so does this, because two implementations that read the same bytes differently is the failure this whole module exists to avoid.
- class fleetmesh_protocols.textile.leaf_relay.NegentropyServer[source]#
Bases:
objectServer-side NIP-77 Negentropy V1 reconciler.
- fleetmesh_protocols.textile.leaf_relay.build_engine_textile_inventory(engine, node_pk, descriptors_map, verify_event_fn=<function <lambda>>)[source]#
Collect the 8-layer Textile inventory (Fibers, Strands, Fabrics, Quilts, Spools, Chunks, Suits, Fits).