Weave documentation
Rust referenceloom-mars

loom-mars · anchor

Source declarations, signatures and documentation for anchor.

Source: sigil/weave/tools/loom-mars/src/anchor.rs. SHA-256: 67d5b960bc4dde006b99810a569e8fe8ed378fae80444aea122c1a881721e9e7.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

anchor::AnchorAction

Lifecycle action a MARS anchor can be in. Mirrors Sigil's MarsAnchor* transaction kind enum.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AnchorAction {
    /// First-time registration.
    Register,
    /// Update of the pointed-at commit hash.
    Update,
    /// Tombstone.
    Revoke,
    /// Ownership transfer.
    Transfer,
    /// Third-party attestation.
    Attest,
}

Source line: 9.

anchor::MarsAnchorPayload

The signed payload for [AnchorAction::Register]. Mirrors MarsAnchorRegister so v2 chain anchoring is a serialization swap.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MarsAnchorPayload {
/// Schema version.

pub version: u32,
/// Globally-resolvable DID. Convention for loom: `did:loom:<owner_handle>:<repo_name>`.

pub did: String,
/// Loom repo id (matches `RepoConfig::repo_id`).

pub repo_id: String,
/// Owner's Ed25519 verifying key (hex-encoded).

pub owner_pubkey_hex: String,
/// Owner DID (e.g. `did:oas:l1fe:agent:abc...`).

pub owner_did: String,
/// Latest committed commit hash on the default branch — the

/// content-integrity pointer.

pub latest_commit_hash: String,
/// Default branch name.

pub default_branch: String,
/// UNIX millis registered.

pub registered_at_ms: u64
}

Source line: 25.

anchor::MarsAnchorPayload::canonical_bytes

Canonical JSON bytes for hashing/signing.

pub fn canonical_bytes(&self) -> Result<Vec<u8>, serde_json::Error>;

Source line: 47.

anchor::MarsAnchorPayload::id

16-hex content-addressed id.

pub fn id(&self) -> Result<String, serde_json::Error>;

Source line: 52.

anchor::MarsAnchor

A MARS anchor document — payload plus action metadata.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MarsAnchor {
/// Content-addressed id of the *register* payload (stable across

/// updates / transfers / attestations — all of those reference this

/// anchor by id).

pub id: String,
/// The signed register payload.

pub payload: MarsAnchorPayload,
/// Hex-encoded 64-byte Ed25519 signature over `payload`.

pub signature_hex: String,
/// Hex-encoded owner pubkey.

pub owner_pubkey_hex: String
}

Source line: 61.

anchor::MarsUpdate

Update event recording a new latest commit.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MarsUpdate {
/// Anchor id being updated.

pub anchor_id: String,
/// New latest commit hash.

pub new_latest_commit_hash: String,
/// UNIX millis.

pub updated_at_ms: u64,
/// Hex-encoded signature over `(anchor_id || new_hash || updated_at_ms)`.

pub signature_hex: String,
/// Updater pubkey hex (must match the anchor's owner_pubkey_hex on

/// chain; off-chain we accept any signed update by the owner).

pub updater_pubkey_hex: String
}

Source line: 76.

anchor::MarsRevocation

Revocation (tombstone) event.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MarsRevocation {
/// Anchor id being revoked.

pub anchor_id: String,
/// UNIX millis.

pub revoked_at_ms: u64,
/// Reason (free-form string, optional).

#[serde(default)]
pub reason: String,
/// Hex-encoded signature over `(anchor_id || revoked_at_ms || reason)`.

pub signature_hex: String,
/// Revoker pubkey hex.

pub revoker_pubkey_hex: String
}

Source line: 92.

anchor::MarsTransfer

Ownership transfer.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MarsTransfer {
/// Anchor id.

pub anchor_id: String,
/// New owner DID.

pub new_owner_did: String,
/// New owner pubkey hex.

pub new_owner_pubkey_hex: String,
/// UNIX millis.

pub transferred_at_ms: u64,
/// Hex-encoded signature by the *current* owner.

pub signature_hex: String,
/// Old owner pubkey hex (the signer).

pub old_owner_pubkey_hex: String
}

Source line: 108.

anchor::MarsAttestation

Third-party attestation. Useful for "build verified", "audited", "license compliant" badges in the UI.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MarsAttestation {
/// Anchor id being attested.

pub anchor_id: String,
/// Attestation kind (free-form: "build", "audit", "license", ...).

pub kind: String,
/// Attestation body (free-form, often a URL or commit hash).

pub body: String,
/// UNIX millis.

pub attested_at_ms: u64,
/// Attester DID.

pub attester_did: String,
/// Hex-encoded signature.

pub signature_hex: String,
/// Attester pubkey hex.

pub attester_pubkey_hex: String
}

Source line: 126.

On this page