Skip to main content

ResolvedSecrets

Struct ResolvedSecrets 

Source
pub struct ResolvedSecrets {
    pub values: HashMap<String, String>,
    pub fingerprints: HashMap<String, String>,
}
Expand description

Resolved secrets ready for injection

Fields§

§values: HashMap<String, String>

Secret name -> resolved value

§fingerprints: HashMap<String, String>

Secret name -> HMAC fingerprint (for cache keys)

Implementations§

Source§

impl ResolvedSecrets

Source

pub fn new() -> Self

Create empty resolved secrets

Source

pub async fn resolve<R: SecretResolver>( resolver: &R, secrets: &HashMap<String, SecretSpec>, salt_config: &SaltConfig, ) -> Result<Self, SecretError>

Resolve secrets using a resolver with salt configuration

§Arguments
  • resolver - The secret resolver to use
  • secrets - Map of secret names to their configuration
  • salt_config - Salt configuration for fingerprinting
§Errors

Returns error if a secret cannot be resolved or if salt is missing when secrets have cache_key: true

Source

pub fn from_batch(batch: BatchSecrets) -> Self

Create from a BatchSecrets instance.

This consumes the batch and converts it to the legacy format. Note that this exposes the secret values from the secure storage.

Source

pub async fn resolve_batch<R: SecretResolver>( resolver: &R, secrets: &HashMap<String, SecretSpec>, salt_config: &SaltConfig, ) -> Result<Self, SecretError>

Resolve secrets using batch resolution with a resolver.

This is the preferred method for resolving multiple secrets efficiently. It uses the resolver’s batch resolution method which may use native batch APIs (e.g., AWS BatchGetSecretValue, 1Password Secrets.ResolveAll).

§Arguments
  • resolver - The secret resolver to use
  • secrets - Map of secret names to their configuration
  • salt_config - Salt configuration for fingerprinting
§Errors

Returns error if a secret cannot be resolved or if salt is missing when secrets have cache_key: true

Source

pub fn is_empty(&self) -> bool

Check if any secrets were resolved

Source

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

Get a resolved secret value by name

Source

pub fn fingerprint_matches( &self, name: &str, cached_fingerprint: &str, salt_config: &SaltConfig, ) -> bool

Check if a cached fingerprint matches with salt rotation support

During salt rotation, this checks if the cached fingerprint matches using either the current or previous salt. This allows cache hits during the rotation window.

§Arguments
  • name - Secret name
  • cached_fingerprint - Fingerprint from cache
  • salt_config - Salt configuration with current and optional previous salt
§Returns

true if the fingerprint matches with either salt, false otherwise

Source

pub fn compute_fingerprints_for_validation( &self, name: &str, salt_config: &SaltConfig, ) -> (Option<String>, Option<String>)

Compute fingerprints using both current and previous salts

Returns a tuple of (current_fingerprint, previous_fingerprint) for cache validation. Either may be None if the corresponding salt is not configured.

Trait Implementations§

Source§

impl Clone for ResolvedSecrets

Source§

fn clone(&self) -> ResolvedSecrets

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResolvedSecrets

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResolvedSecrets

Source§

fn default() -> ResolvedSecrets

Returns the “default value” for a 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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