chenzehaoo/moon_guard/lib/trust does not have a README file

    TrustLevel

    pub(all) enum TrustLevel {
    Full
    Partial
    Untrusted
    } derive(Eq)

    impl Show for TrustLevel

    TrustLevel::to_string

    fn TrustLevel::to_string(self : TrustLevel) -> String

    TrustStore

    pub(all) struct TrustStore {
    keys : Array[TrustedKey]
    }

    TrustStore::add_key

    fn TrustStore::add_key(self : TrustStore, key_id : String, public_key : String, owner : String, trust_level : TrustLevel) -> Bool

    TrustStore::find_by_owner

    fn TrustStore::find_by_owner(self : TrustStore, owner : String) -> Array[TrustedKey]

    TrustStore::get_key

    fn TrustStore::get_key(self : TrustStore, key_id : String) -> TrustedKey?

    TrustStore::is_trusted

    fn TrustStore::is_trusted(self : TrustStore, key_id : String) -> Bool

    TrustStore::key_count

    fn TrustStore::key_count(self : TrustStore) -> Int

    TrustStore::list_all

    fn TrustStore::list_all(self : TrustStore) -> Array[TrustedKey]

    TrustStore::new

    fn TrustStore::new() -> TrustStore

    TrustStore::remove_key

    fn TrustStore::remove_key(self : TrustStore, key_id : String) -> Bool

    TrustStore::replace_all

    fn TrustStore::replace_all(self : TrustStore, keys : Array[TrustedKey]) -> Unit

    Replace the contents of the store. Used by load_from_json to restore from persistence and by tests to set up fixtures.

    TrustStore::save_to_file

    fn TrustStore::save_to_file(self : TrustStore, path : String) -> Bool

    Persist this store to a JSON file at path, truncating any existing file. Returns false when the write fails (unwritable path, I/O error). This is the cross-process persistence entry point: one process writes, another process can load_from_file the same path and get the keys.

    TrustedKey

    pub(all) struct TrustedKey {
    key_id : String
    public_key : String
    owner : String
    trust_level : TrustLevel
    added_at : String
    }

    load_store_from_file

    fn load_store_from_file(path : String) -> TrustStore?

    Load a trust store from a JSON file written by save_to_file. Returns None when the file is missing, unreadable, or contains a malformed trust-store document.

    normalize_public_key

    fn normalize_public_key(public_key : String) -> String?

    Normalize an Ed25519 public key to lower-case hex, accepting mixed-case input from PEM files or operator copy-paste. Returns None when the input has the wrong shape.

    public_key_from_pem

    fn public_key_from_pem(pem : String) -> String?

    Inverse of public_key_to_pem. Accepts both upper- and lower-case hex inside the PEM envelope. Returns None when the input doesn't look like a MoonGuard public key PEM.

    public_key_to_pem

    fn public_key_to_pem(public_key : String) -> String

    PEM encode an Ed25519 public key for storage in .pem files. Format follows RFC 7468 section 13 ("PUBLIC KEY") which is the same shape libsodium / age / OpenSSH use for raw Ed25519 keys.

    trust_store_from_json

    fn trust_store_from_json(json : String) -> TrustStore?

    Parse a trust_store_to_json document into a fresh store. Returns None when the document is malformed so the caller can surface a useful error rather than a partial store.

    trust_store_to_json

    fn trust_store_to_json(store : TrustStore) -> String

    Stable JSON encoding used by both the CLI and the file persistence path. Kept in one place so the wire format stays consistent across consumers.

    validate_public_key_format

    fn validate_public_key_format(public_key : String) -> Bool

    Source Files