pub struct TrustStore {
pub schema: String,
pub pins: Vec<TrustPin>,
}Expand description
The persisted trust store: a schema tag plus the ordered list of pins.
Fields§
§schema: StringSchema identifier. Always TRUST_STORE_SCHEMA for files this
version writes; parsing tolerates a missing tag (legacy/empty).
pins: Vec<TrustPin>Pinned identities, in insertion order.
Implementations§
Source§impl TrustStore
impl TrustStore
Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
Default store path: <config-root>/trust-store.json.
Honors TSAFE_VAULT_DIR via crate::profile::config_path’s
sibling logic so tests and sandboxes can redirect it.
Sourcepub fn load(path: &Path) -> Result<TrustStore, TrustStoreError>
pub fn load(path: &Path) -> Result<TrustStore, TrustStoreError>
Load the store from path, returning an empty store if the file
does not exist (first-run is not an error).
Sourcepub fn load_default() -> Result<TrustStore, TrustStoreError>
pub fn load_default() -> Result<TrustStore, TrustStoreError>
Load from the default path.
Sourcepub fn save(&self, path: &Path) -> Result<(), TrustStoreError>
pub fn save(&self, path: &Path) -> Result<(), TrustStoreError>
Persist the store to path atomically (write-tmp + rename).
Sourcepub fn add(
&mut self,
name: &str,
algo: &str,
pubkey: &str,
) -> Result<(), TrustStoreError>
pub fn add( &mut self, name: &str, algo: &str, pubkey: &str, ) -> Result<(), TrustStoreError>
Add a pin. Validates that pubkey decodes to a real Ed25519 key
and algo is supported BEFORE persisting, so a corrupt pin can
never enter the store. Rejects a duplicate name (use
TrustStore::remove first to rotate a key under an existing
name).
Sourcepub fn remove(&mut self, name: &str) -> Result<TrustPin, TrustStoreError>
pub fn remove(&mut self, name: &str) -> Result<TrustPin, TrustStoreError>
Remove the pin named name. Errors if no such pin exists.
Sourcepub fn identity_for_pubkey(&self, pubkey_b64url: &str) -> Option<&TrustPin>
pub fn identity_for_pubkey(&self, pubkey_b64url: &str) -> Option<&TrustPin>
Look up the pinned identity that owns pubkey, if any.
Comparison is on the decoded key bytes, not the string, so two base64url encodings of the same key (or differing-by-padding representations) still match.
Sourcepub fn identity_for_signature(
&self,
sig: &SignaturePayload,
) -> Option<&TrustPin>
pub fn identity_for_signature( &self, sig: &SignaturePayload, ) -> Option<&TrustPin>
Resolve which pinned identity (if any) a signature payload’s embedded pubkey corresponds to. This is the fail-closed gate’s core question: “is the signer a key we have pinned?”
Trait Implementations§
Source§impl Clone for TrustStore
impl Clone for TrustStore
Source§fn clone(&self) -> TrustStore
fn clone(&self) -> TrustStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TrustStore
impl Debug for TrustStore
Source§impl Default for TrustStore
impl Default for TrustStore
Source§impl<'de> Deserialize<'de> for TrustStore
impl<'de> Deserialize<'de> for TrustStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TrustStore
Source§impl PartialEq for TrustStore
impl PartialEq for TrustStore
Source§fn eq(&self, other: &TrustStore) -> bool
fn eq(&self, other: &TrustStore) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TrustStore
impl Serialize for TrustStore
impl StructuralPartialEq for TrustStore
Auto Trait Implementations§
impl Freeze for TrustStore
impl RefUnwindSafe for TrustStore
impl Send for TrustStore
impl Sync for TrustStore
impl Unpin for TrustStore
impl UnsafeUnpin for TrustStore
impl UnwindSafe for TrustStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.