pub enum Credential {
ApiKey {
key: String,
},
OAuth {
access: String,
expires_at_unix_secs: Option<i64>,
},
}Expand description
One type-tagged credential per provider — pi’s Credential union.
CodeWhale stores API keys in the secret store and OAuth material in provider-specific files that this type deliberately does not try to unify; the OAuth variant carries only what a status surface needs, so adopting this type never moves a token between stores.
Variants§
ApiKey
A bearer API key held in Codewhale’s durable store or process memory.
OAuth
An OAuth access token plus its expiry, if the flow reported one.
Constructed today only by this module’s own tests: CodeWhale’s OAuth
stores (xAI’s generation files, the read-only external grants) have not
been moved behind CredentialStore in this change, so nothing in the
production path mints one yet. The variant is kept because it is half
of the ported contract and the store’s serialization guarantee exists
precisely for it.
Implementations§
Source§impl Credential
impl Credential
Sourcepub fn kind(&self) -> CredentialKind
pub fn kind(&self) -> CredentialKind
Only store::InMemoryCredentialStore::list needs this today; the
secret-store adapter knows every slot it holds is an api key.
Sourcepub fn expose_secret(&self) -> &str
pub fn expose_secret(&self) -> &str
Borrow the secret. Callers must not log or render the result; this is
the single narrow accessor so rg "expose_secret" finds every use.
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§impl Debug for Credential
Never print secret material, even through a derived Debug on a
surrounding struct.
impl Debug for Credential
Never print secret material, even through a derived Debug on a
surrounding struct.
impl Eq for Credential
Source§impl PartialEq for Credential
impl PartialEq for Credential
impl StructuralPartialEq for Credential
Auto Trait Implementations§
impl Forget for Credential
impl Freeze for Credential
impl Move for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnsafeUnpin for Credential
impl UnwindSafe for Credential
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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.