pub struct AuthStore { /* private fields */ }Expand description
Keys held for this machine, keyed by normalised endpoint.
Serialize/Deserialize drive the on-disk TOML directly; there is no
separate wire type because the file is drep’s own and has one shape.
Implementations§
Source§impl AuthStore
impl AuthStore
Sourcepub fn load(path: &Path) -> Result<Self, AuthError>
pub fn load(path: &Path) -> Result<Self, AuthError>
Read the store at path.
A missing file is an empty store, not an error: never having stored a key is the normal first-run state, and making the caller distinguish it from a real read failure would put that branch at every call site. A file that exists but cannot be read or parsed is an error, because silently treating a corrupt store as empty would send a user to re-paste keys they already have.
Sourcepub fn save(&self, path: &Path) -> Result<(), AuthError>
pub fn save(&self, path: &Path) -> Result<(), AuthError>
Write the store to path, creating the directory if needed.
The file is created mode 0600 and the directory 0700 on Unix, and the mode is applied to an existing file too - a store written before this ran, or one whose mode a user widened, is narrowed on the next save rather than left as found.
Sourcepub fn set(&mut self, endpoint: &str, key: &str) -> Result<(), AuthError>
pub fn set(&mut self, endpoint: &str, key: &str) -> Result<(), AuthError>
Store key for endpoint, replacing any previous one.
The rule about what a credential may be is vet’s, not this method’s;
only the wording is here, because a paste at the prompt and a helper’s
stdout send the reader to different fixes.
Sourcepub fn remove(&mut self, endpoint: &str) -> bool
pub fn remove(&mut self, endpoint: &str) -> bool
Forget the key for endpoint. Returns whether one was held.
Trait Implementations§
Source§impl Debug for AuthStore
Hand-written so a key cannot reach a log.
impl Debug for AuthStore
Hand-written so a key cannot reach a log.
The same reasoning as LlmConfig and LlmClient: a derived Debug prints
every value, so one {:?} anywhere would emit every credential the user has.
The endpoints are printed because they are not secret and they are the useful
half when debugging.