MARS documentation
Rust librariesmars-serverValidation

mars-server · validation::resolver

Public declarations and documentation for mars-server::validation::resolver.

Package: mars-server · Workspace version: 0.1.0 · Module: validation::resolver

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

validation::resolver::PublisherKeyResolver

Resolves an Ed25519 public key for a given signature.keyId.

The key_id is a DID URL of the form "did:oas:...#fragment". The fragment after # identifies a specific key under the controller DID.

#[async_trait]
pub trait PublisherKeyResolver: Send + Sync {
    /// Look up the verifying key for `key_id`.
    ///
    /// Returns `Ok(None)` if the key is not known to this resolver (callers
    /// should treat this as "try the next layer" or, at the outermost layer,
    /// as a signature rejection). Returns `Err` only on resolver failures
    /// (e.g. backing store IO error).
    async fn resolve(&self, key_id: &str) -> Result<Option<VerifyingKey>, ResolverError>;
}

Source line: 33.

validation::resolver::ResolverError

Errors that can occur during key resolution.

#[derive(Debug, thiserror::Error)]
pub enum ResolverError {
    /// The backing store returned an error.
    #[error("store error: {0}")]
    Store(String),

    /// The candidate entry's `item_data` does not contain a usable public key.
    #[error("invalid key material for `{key_id}`: {reason}")]
    InvalidKeyMaterial { key_id: String, reason: String },
}

Source line: 45.

validation::resolver::StaticKeyResolver

Resolver backed by an in-memory key_id → VerifyingKey map.

Used for tests and for explicitly pinning operator-trusted keys at startup.

#[derive(Default, Clone)]
pub struct StaticKeyResolver {

}

Source line: 63.

validation::resolver::StaticKeyResolver::new

Create an empty resolver.

pub fn new() -> Self;

Source line: 69.

validation::resolver::StaticKeyResolver::from_trust_config

Parse all configured publisher and peer pins into the startup resolver. Invalid pins fail startup instead of surfacing per request.

pub fn from_trust_config(trust: &TrustConfig) -> Result<Self, ResolverError>;

Source line: 75.

validation::resolver::StaticKeyResolver::insert

Insert a key. Returns the previously-pinned key, if any.

pub fn insert(&self, key_id: impl Into<String>, key: VerifyingKey) -> Option<VerifyingKey>;

Source line: 99.

validation::resolver::StaticKeyResolver::remove

Remove a key.

pub fn remove(&self, key_id: &str) -> Option<VerifyingKey>;

Source line: 104.

validation::resolver::StaticKeyResolver::len

Current number of pinned keys.

pub fn len(&self) -> usize;

Source line: 109.

validation::resolver::StaticKeyResolver::is_empty

Whether the resolver has no pinned keys.

pub fn is_empty(&self) -> bool;

Source line: 114.

validation::resolver::StoreBackedKeyResolver

Resolver backed by an [EntryStore].

Given key_id = "did:oas:hmr:alice#key-1", looks up the entry whose entry_did == "did:oas:hmr:alice". If that entry is a HumanRootRecord (or other key-bearing record), pulls the verifying key from item_data.publicKeys[fragment] (preferred) or item_data.publicKey (fallback for single-key records).

The expected item_data shape is:

{
    "publicKeys": {
        "key-1": { "type": "Ed25519", "publicKeyHex": "..." }
    }
}

Falls back to a top-level "publicKey" (hex or base64url) for compatibility with simpler HMR shapes.

pub struct StoreBackedKeyResolver {

}

Source line: 148.

validation::resolver::StoreBackedKeyResolver::new

Wrap an entry store.

pub fn new(store: Arc<dyn EntryStore>) -> Self;

Source line: 154.

validation::resolver::LayeredKeyResolver

Composes multiple resolvers. First non-None hit wins; errors short-circuit.

pub struct LayeredKeyResolver {

}

Source line: 183.

validation::resolver::LayeredKeyResolver::new

Build a new layered resolver.

pub fn new(layers: Vec<Arc<dyn PublisherKeyResolver>>) -> Self;

Source line: 189.

Source provenance

Source: mars-server/src/validation/resolver.rs · SHA-256 a24301f4ff1040cd02ac0a750e361791bb073c6d7d570df8a5c225c9718cfb5a. Package overview.

On this page