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
impl Manager
Sourcepub fn new_from_handle(kh: Handle) -> Self
pub fn new_from_handle(kh: Handle) -> Self
Create a new instance from the given Handle
.
Sourcepub fn rotate(&mut self, kt: &KeyTemplate) -> Result<KeyId, TinkError>
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.
Sourcepub fn add(
&mut self,
kt: &KeyTemplate,
as_primary: bool,
) -> Result<KeyId, TinkError>
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.
Sourcepub fn enable(&mut self, key_id: KeyId) -> Result<(), TinkError>
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
.
Sourcepub fn disable(&mut self, key_id: KeyId) -> Result<(), TinkError>
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
.
Sourcepub fn destroy(&mut self, key_id: KeyId) -> Result<(), TinkError>
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
.
Sourcepub fn delete(&mut self, key_id: KeyId) -> Result<(), TinkError>
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.