Struct KeyVaultClient

Source
pub struct KeyVaultClient { /* private fields */ }

Implementations§

Source§

impl KeyVaultClient

Source

pub fn get_key( &mut self, key_name: &str, key_version: Option<&str>, ) -> Result<KeyVaultKey, Error>

Gets the public part of a stored key. https://docs.microsoft.com/en-us/rest/api/keyvault/get-key/get-key

Source

pub fn import_key( &mut self, key_name: &str, key: KeyVaultKey, ) -> Result<KeyVaultKey, Error>

Imports an externally created key, stores it, and returns key parameters and attributes to the client. https://docs.microsoft.com/en-us/rest/api/keyvault/import-key/import-key

Source

pub fn sign( &mut self, algorithm: SignatureAlgorithm, key_name: &str, key_version: &str, digest: &[u8], ) -> Result<SignResult, Error>

Creates a signature from a digest using the specified key. digest must be the same hash used in algorithm. https://docs.microsoft.com/en-us/rest/api/keyvault/sign/sign

Source

pub fn verify( &mut self, algorithm: SignatureAlgorithm, key_name: &str, key_version: &str, digest: &[u8], value: &[u8], ) -> Result<bool, Error>

Verifies a signature using a specified key.

Source§

impl KeyVaultClient

Source

pub fn get_secret( &mut self, secret_name: &str, secret_version: Option<&str>, ) -> Result<KeyVaultSecret, Error>

Get a specified secret from a given key vault. https://docs.microsoft.com/en-us/rest/api/keyvault/get-secret/get-secret

Source

pub fn set_secret( &mut self, secret_name: &str, secret: KeyVaultSecret, ) -> Result<KeyVaultSecret, Error>

Sets a secret in a specified key vault. https://docs.microsoft.com/en-us/rest/api/keyvault/set-secret/set-secret

Source§

impl KeyVaultClient

Source

pub fn with_resolver( vault_url: &str, identity_config: IdentityConfig, resolver: impl Resolver + 'static, ) -> Result<Self, Error>

Source

pub fn new( vault_url: &str, identity_config: IdentityConfig, ) -> Result<Self, Error>

Examples found in repository?
examples/client.rs (line 10)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Setup identity for getting access token
7    let identity_config = IdentityConfig::new("[client_id]", "[client_secret]", "[tenant_id]");
8
9    // Initialize the client
10    let client = KeyVaultClient::new("https://myvault.vault.azure.net", identity_config)?;
11
12    // Make some requests!
13    // client.get_key(key_name, key_version)
14    // client.get_secret(secret_name, secret_version)
15
16    Ok(())
17}
Source

pub fn _new( agent: Agent, vault_url: &str, identity_config: IdentityConfig, ) -> Result<Self, Error>

Trait Implementations§

Source§

impl Debug for KeyVaultClient

Source§

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

Formats the value using the given formatter. 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, 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, 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