cairn_mod/label.rs
1//! Label record — in-memory shape of `com.atproto.label.defs#label` (§6.1).
2//!
3//! Fields mirror the wire schema exactly. `sig` is `Option` so the "pre-sign
4//! representation with sig absent" required by §6.2 step 3 is directly
5//! representable without shadow types.
6
7/// A label record per §6.1.
8///
9/// `ver` is always `1` in Cairn v1 but kept as a field (not a const) because
10/// §6.2 requires it appear in the signed bytes and in the wire output.
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub struct Label {
13 /// Label format version. Always `1` in v1 of the protocol.
14 pub ver: i64,
15 /// Labeler's DID (Cairn's configured service DID for emissions).
16 pub src: String,
17 /// Subject — an AT-URI for records or a DID for accounts.
18 pub uri: String,
19 /// Optional record-version pin. Present = "this specific
20 /// version"; absent = "all versions / the account" per §6.1.
21 pub cid: Option<String>,
22 /// Label value (≤128 bytes).
23 pub val: String,
24 /// Negation flag. `true` marks this as a withdrawal event for
25 /// the `(src, uri, val)` tuple.
26 pub neg: bool,
27 /// Created-at timestamp (RFC-3339 Z with millisecond
28 /// precision); monotonically clamped per §6.1.
29 pub cts: String,
30 /// Optional expiration timestamp (RFC-3339 Z). Stored only;
31 /// enforcement is v1.1.
32 pub exp: Option<String>,
33 /// Raw 64-byte compact `(r, s)` signature per §6.2 step 7. Absent on
34 /// records that have not yet been signed.
35 pub sig: Option<[u8; 64]>,
36}