pub trait KeyWrap:
Send
+ Sync
+ Debug {
// Required methods
fn key_id(&self) -> KeyId;
fn root(&self) -> &Key;
fn wrap(&self, tenant: TenantId, key: &Key) -> Result<Vec<u8>, WrapError>;
fn unwrap(&self, tenant: TenantId, wrapped: &[u8]) -> Result<Key, WrapError>;
}Expand description
A key-wrapping backend. Its methods are synchronous: the registry calls them from blocking threads.
Required Methods§
Sourcefn key_id(&self) -> KeyId
fn key_id(&self) -> KeyId
The id of the key that wraps tenant keys. The registry counts each wrap against it, and a key rotation records when its use began.
Sourcefn root(&self) -> &Key
fn root(&self) -> &Key
The root of the hierarchy: the key the server catalog key is derived
from (envelope::catalog_key).
Sourcefn unwrap(&self, tenant: TenantId, wrapped: &[u8]) -> Result<Key, WrapError>
fn unwrap(&self, tenant: TenantId, wrapped: &[u8]) -> Result<Key, WrapError>
Unwraps a key KeyWrap::wrap made for tenant, into a locked page
of its own.
§Errors
WrapError::Damaged when wrapped does not open for tenant
under the backend’s key, and WrapError::Memory when the key’s page
cannot be locked.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".