Manager

Struct Manager 

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

Manager manages a Keyset-proto, with convenience methods that rotate, disable, enable or destroy keys. Note: It is not thread-safe.

Implementations§

Source§

impl Manager

Source

pub fn new() -> Self

Create a new instance with an empty Keyset.

Source

pub fn new_from_handle(kh: Handle) -> Self

Create a new instance from the given Handle.

Source

pub fn rotate(&mut self, kt: &KeyTemplate) -> Result<KeyId, TinkError>

Generate a fresh key using the given key template and set the new key as the primary key. The key that was primary prior to rotation remains Enabled. Returns the key ID of the new primary key.

Source

pub fn add( &mut self, kt: &KeyTemplate, as_primary: bool, ) -> Result<KeyId, TinkError>

Generate a fresh key using the given key template, and optionally set the new key as the primary key. Returns the key ID of the added key.

Source

pub fn handle(&self) -> Result<Handle, TinkError>

Create a new Handle for the managed keyset.

Source

pub fn enable(&mut self, key_id: KeyId) -> Result<(), TinkError>

Sets the status of the specified key to KeyStatusType::Enabled. Succeeds only if before the call the specified key has status KeyStatusType::Disabled or KeyStatusType::Enabled.

Source

pub fn disable(&mut self, key_id: KeyId) -> Result<(), TinkError>

Sets the status of the specified key to KeyStatusType::Disabled. Succeeds only if before the call the specified key is not primary and has status KeyStatusType::Disabled or KeyStatusType::Enabled.

Source

pub fn destroy(&mut self, key_id: KeyId) -> Result<(), TinkError>

Sets the status of the specified key to KeyStatusType::Destroyed, and removes the corresponding key material, if any. Succeeds only if before the call the specified key is not primary and has status KeyStatusType::Disabled, or KeyStatusType::Enabled, or KeyStatusType::Destroyed.

Source

pub fn delete(&mut self, key_id: KeyId) -> Result<(), TinkError>

Removes the specifed key from the managed keyset. Succeeds only if the specified key is not primary. After deletion the keyset contains one key fewer.

Source

pub fn set_primary(&mut self, key_id: KeyId) -> Result<(), TinkError>

Sets the specified key as the primary. Succeeds only if the specified key is Enabled.

Source

pub fn key_count(&self) -> usize

Return the count of all keys in the keyset.

Trait Implementations§

Source§

impl Default for Manager

Source§

fn default() -> Manager

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