Skip to main content

Keyring

Struct Keyring 

Source
pub struct Keyring {
    pub ephemeral: bool,
    /* private fields */
}
Expand description

Holds decrypted API keys in memory. Keys are mlock’d and zeroized on drop.

Fields§

§ephemeral: bool

Whether keys were loaded from a sealed source (one-shot key). When true, credential files should be wiped after each use.

Implementations§

Source§

impl Keyring

Source

pub fn load(keyring_path: &Path) -> Result<Self, KeyringError>

Load the keyring: read sealed key file, decrypt keyring.enc, mlock memory.

The session key file is deleted immediately after reading.

Source

pub fn load_with_key( keyring_path: &Path, session_key: &[u8; 32], ) -> Result<Self, KeyringError>

Load from an already-known session key (for testing or orchestrator use).

Source

pub fn get(&self, key_name: &str) -> Option<&str>

Get a key by name (e.g. “parallel_api_key”).

Source

pub fn contains(&self, key_name: &str) -> bool

Check if the keyring contains a specific key.

Source

pub fn key_names(&self) -> Vec<&str>

List all key names (not values).

Source

pub fn load_credentials(path: &Path) -> Result<Self, KeyringError>

Load from a plaintext credentials file (JSON object: {“key_name”: “value”, …}).

Used in local mode where ~/.ati/credentials stores keys as plaintext JSON with 0600 permissions (same approach as AWS CLI, gh, Docker, Stripe).

Source

pub fn load_local( keyring_path: &Path, ati_dir: &Path, ) -> Result<Self, KeyringError>

Load keyring.enc using a persistent key stored alongside the ATI directory.

Looks for <ati_dir>/.keyring-key (base64-encoded 32-byte key). Unlike the sealed key in /run/ati/.key, this key is NOT deleted after reading — it’s for proxy servers with persistent storage.

Source

pub fn from_env() -> Self

Create a keyring from environment variables with ATI_KEY_ prefix.

Scans all env vars matching ATI_KEY_*, strips the prefix, lowercases the name. Example: ATI_KEY_FINNHUB_API_KEY=abc123 → key name finnhub_api_key.

Source

pub fn empty() -> Self

Create an empty keyring (for tools with auth_type = none).

Source

pub fn merge(&mut self, other: &Keyring)

Merge another keyring’s keys into this one (other’s keys take precedence).

Source

pub fn len(&self) -> usize

Number of keys in the keyring.

Source

pub fn is_empty(&self) -> bool

Whether the keyring has no keys.

Trait Implementations§

Source§

impl Drop for Keyring

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,