Struct tink_core::keyset::Manager[][src]

pub struct Manager { /* fields omitted */ }
Expand description

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

Implementations

impl Manager[src]

pub fn new() -> Self[src]

Create a new instance with an empty Keyset.

pub fn new_from_handle(kh: Handle) -> Self[src]

Create a new instance from the given Handle.

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

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.

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

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.

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

Create a new Handle for the managed keyset.

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

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.

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

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.

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

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.

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

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.

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

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

pub fn key_count(&self) -> usize[src]

Return the count of all keys in the keyset.

Trait Implementations

impl Default for Manager[src]

fn default() -> Manager[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl RefUnwindSafe for Manager

impl Send for Manager

impl Sync for Manager

impl Unpin for Manager

impl UnwindSafe for Manager

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

pub fn vzip(self) -> V