Skip to main content

Secrets

Struct Secrets 

Source
pub struct Secrets { /* private fields */ }
Expand description

The daemon’s secrets: every driver, local first and the default.

Implementations§

Source§

impl Secrets

Source

pub fn new(local: LocalDriver) -> Secrets

Just the local driver.

Source

pub fn open( state_dir: &Path, keys: &KeySources, config: &SecretsConfig, ) -> Result<Opened>

Find (or generate) the daemon’s key, read the break-glass recipients, and open the local store under state_dir.

Source

pub fn open_existing( state_dir: &Path, keys: &KeySources, config: &SecretsConfig, ) -> Result<Secrets>

Open the store with an existing key only, for a client reading it while no daemon runs (isb up). Never generates a key.

Source

pub fn with_driver(self, d: Arc<dyn Driver>) -> Result<Secrets>

Add a driver. Names are unique.

Source

pub fn driver_names(&self) -> Vec<String>

Source

pub fn keyring(&self) -> &Arc<Keyring> ⓘ

Source

pub fn recipients(&self) -> Vec<String>

The recipient set, as strings (age1…, ssh-…).

Source

pub fn create( &self, org: &OrgId, name: &str, driver: Option<&str>, value: &[u8], labels: &BTreeMap<String, String>, ) -> Result<SecretMeta>

A new secret in driver (default local); fails if any driver has one by that name.

Source

pub fn set(&self, org: &OrgId, name: &str, value: &[u8]) -> Result<SecretMeta>

A new value for a secret, in the driver holding it; a missing one is created in local.

Source

pub fn get(&self, org: &OrgId, name: &str) -> Result<(Vec<u8>, SecretMeta)>

Source

pub fn version(&self, org: &OrgId, name: &str) -> Result<u64>

Source

pub fn put(&self, org: &OrgId, name: &str, value: &[u8]) -> Result<SecretMeta>

Store value under name unless it already holds exactly that, so the version moves only when the value does.

Source

pub fn get_in( &self, driver: &str, org: &OrgId, name: &str, ) -> Result<(Vec<u8>, u64)>

A value read through a named driver, by that driver’s reference (which need not be a store name: an op:// path, say).

Source

pub fn version_in(&self, driver: &str, org: &OrgId, name: &str) -> Result<u64>

The current version in a named driver: cheap, for polling.

Source

pub fn refresh_in(&self, driver: &str, org: &OrgId, name: &str) -> Result<u64>

Re-read from the source through a named driver.

Source

pub fn inspect(&self, org: &OrgId, name: &str) -> Result<SecretMeta>

Source

pub fn list(&self, org: &OrgId) -> Result<Vec<SecretMeta>>

Every driver’s secrets in the org, by name.

Source

pub fn delete(&self, org: &OrgId, name: &str) -> Result<()>

Source

pub fn refresh(&self, org: &OrgId, name: &str) -> Result<SecretMeta>

Source

pub fn reencrypt(&self, org: Option<&OrgId>) -> Result<usize>

Re-encrypt every value to the current recipients, in one org or all.

Source

pub fn decrypt_inline(&self, text: &str) -> Result<Vec<u8>>

Decrypt a compose file’s inline age: value with the daemon’s key.

Source

pub fn encrypt_inline(&self, value: &[u8]) -> Result<String>

Inline ciphertext to the daemon’s recipients.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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