1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! The gated per-scope app-blob provider. A SEPARATE transport from
//! the roster blob (`roster::transport::RosterBlobs`, MemStore, `iroh_blobs::ALPN`, ungated): an
//! `FsStore` at `<data_dir>/blobs/` advertised on `APP_BLOB_ALPN`, built with
//! `BlobsProtocol::new(&fsstore, Some(events))` so a request-time Intercept hook (`provider`) can
//! serve a hash ONLY to callers a scope grants (`scope`). Hashes are integrity proofs, never
//! capabilities: authorization is a separate scope-membership decision keyed on the AUTHENTICATED
//! endpoint id resolved via the daemon's trust gate.
/// The app-blob ALPN (the named `mcpmesh/blob/1` protocol), DISTINCT from `iroh_blobs::ALPN`
/// (which the untouched roster provider AND the iroh-blobs `Downloader` are pinned to). The daemon
/// accept loop dispatches this ALPN to the gated `AppBlobs` provider; the caller-side fetch opens a
/// connection on it and uses `store.remote().fetch` (the Downloader cannot — it hardcodes
/// `iroh_blobs::ALPN`).
pub const APP_BLOB_ALPN: & = b"mcpmesh/blob/1";
/// Parse a blake3 hash from a caller-supplied string WITHOUT panicking.
///
/// `iroh_blobs::Hash: FromStr` decodes into a fixed 32-byte buffer via `data-encoding`'s
/// `decode_mut`, which opens with `assert_eq!(Ok(output.len()), self.decode_len(input.len()))`.
/// The base32 branch has no length guard, so **any** input that is neither 64 chars nor 52 chars
/// panics rather than returning `Err` — `""`, `"nope"`, or a 64-hex string with a trailing newline
/// all abort the calling task. On the control socket that unwinds the per-connection handler and
/// the client gets EOF with no JSON-RPC response at all, instead of the error the docs promise.
///
/// Guarding the LENGTH is sufficient: at 64 (hex) and 52 (base32) `decode_len` matches the buffer,
/// so invalid symbols return `Err` normally. The charset check is belt-and-braces.
pub