Skip to main content

syncweb_core/
constants.rs

1//! Centralized protocol-level string constants for the syncweb wire format.
2//!
3//! All `syncweb/` prefixed topic seeds, signature contexts, blob pin prefixes,
4//! document keys, and runtime naming conventions live here so that protocol
5//! changes are visible in a single location.
6
7// ---------------------------------------------------------------------------
8// Gossip topic seeds (hashed with BLAKE3 to produce TopicId)
9// ---------------------------------------------------------------------------
10
11// (No global gossip topics remain after the package-catalog/provider-lease
12// gossip channels were removed. All topic derivation is local-only.)
13
14// ---------------------------------------------------------------------------
15// Cryptographic signature contexts (Ed25519 domain separators)
16// ---------------------------------------------------------------------------
17
18/// Domain separator for signed content links (name pointers).
19pub const LINK_SIGNATURE_CONTEXT: &[u8] = b"syncweb/name-pointer/v1\0";
20
21/// Domain separator for signed filter list entries.
22pub const FILTER_LIST_CONTEXT: &[u8] = b"syncweb/filter-list/v1\0";
23
24/// Domain separator for signed network membership lists.
25pub const MEMBER_LIST_SIGNATURE_CONTEXT: &[u8] = b"syncweb/network-membership/v1\0";
26
27// ---------------------------------------------------------------------------
28// Blob pin prefixes
29// ---------------------------------------------------------------------------
30
31/// Pin prefix for snapshot blobs.
32pub const SNAPSHOT_PIN_PREFIX: &str = "syncweb/snapshot/";
33
34/// Pin prefix for replication-rescue blobs.
35pub const REPLICATION_PIN_PREFIX: &str = "syncweb/replication/";
36
37/// Pin prefix for publicly shared folder blobs.
38pub const PUBLIC_PIN_PREFIX: &str = "syncweb/public/";
39
40/// Pin prefix for one-off download blobs.
41pub const DOWNLOAD_PIN_PREFIX: &str = "syncweb/download/";
42
43/// Pin prefix for collection manifest blobs.
44pub const COLLECTION_MANIFEST_PIN_PREFIX: &str = "syncweb/collection-manifest/";
45
46/// Pin prefix for collection content blobs.
47pub const COLLECTION_PIN_PREFIX: &str = "syncweb/collection/";
48
49// ---------------------------------------------------------------------------
50// Document key prefixes (iroh-docs namespaces)
51// ---------------------------------------------------------------------------
52
53/// Iroh-docs key for the folder sync mode.
54pub const MODE_KEY: &[u8] = b"sys/syncweb/mode";
55
56/// Iroh-docs key for catalog namespace metadata.
57pub const CATALOG_METADATA_KEY: &[u8] = b"sys/syncweb/catalog/metadata";
58
59/// Iroh-docs key for the owner-signed network member list.
60pub const NETWORK_MEMBERS_KEY: &[u8] = b"sys/network/members";
61
62// ---------------------------------------------------------------------------
63// URI scheme
64// ---------------------------------------------------------------------------
65
66/// The syncweb URI scheme prefix.
67pub const LINK_SCHEME: &str = "syncweb://";
68
69// ---------------------------------------------------------------------------
70// Runtime filesystem naming conventions
71// ---------------------------------------------------------------------------
72
73/// Prefix for the daemon runtime socket file.
74pub const RUNTIME_SOCKET_FILE_PREFIX: &str = "syncweb-";
75
76/// Directory name for installed collection packages.
77pub const PACKAGES_DIR_NAME: &str = ".syncweb-packages";
78
79/// Prefix for drop-export staging directories.
80pub const DROP_EXPORT_STAGING_PREFIX: &str = ".syncweb-drop-";
81
82/// Prefix for drop-export blob staging files.
83pub const DROP_EXPORT_BLOB_STAGING_PREFIX: &str = ".syncweb-drop-blob-";
84
85/// Prefix for drop-import staging directories.
86pub const DROP_IMPORT_STAGING_PREFIX: &str = ".syncweb-drop-import-";
87
88/// Prefix for materialization staging directories.
89pub const MATERIALIZATION_STAGING_PREFIX: &str = ".syncweb-materialize-";
90
91/// Prefix for CLI drop source staging directories.
92pub const DROP_SOURCE_STAGING_PREFIX: &str = ".syncweb-drop-source-";