pub struct MemoryKeyManagementClient { /* private fields */ }Expand description
In-memory KMS for testing. Not suitable for production use.
use iceberg::encryption::KeyManagementClient;
use iceberg::encryption::kms::MemoryKeyManagementClient;
let kms = MemoryKeyManagementClient::new();
kms.add_master_key("my-master-key")?;
let dek = vec![0u8; 16];
let wrapped = kms.wrap_key(&dek, "my-master-key").await?;
let unwrapped = kms.unwrap_key(&wrapped, "my-master-key").await?;
assert_eq!(dek.as_slice(), unwrapped.as_bytes());Implementations§
Source§impl MemoryKeyManagementClient
impl MemoryKeyManagementClient
Sourcepub fn with_master_key_size(master_key_size: AesKeySize) -> Self
pub fn with_master_key_size(master_key_size: AesKeySize) -> Self
Creates a new in-memory KMS with the specified master key size.
Sourcepub fn add_master_key(&self, key_id: impl Into<String>) -> Result<()>
pub fn add_master_key(&self, key_id: impl Into<String>) -> Result<()>
Adds a randomly generated master key with the given ID.
Sourcepub fn add_master_key_bytes(
&self,
key_id: impl Into<String>,
key_bytes: SensitiveBytes,
) -> Result<()>
pub fn add_master_key_bytes( &self, key_id: impl Into<String>, key_bytes: SensitiveBytes, ) -> Result<()>
Adds a master key with explicit key bytes.
Use this to seed the KMS with known key material, e.g. for cross-language integration tests where both Java and Rust must share the same master key bytes.
Trait Implementations§
Source§impl Clone for MemoryKeyManagementClient
impl Clone for MemoryKeyManagementClient
Source§fn clone(&self) -> MemoryKeyManagementClient
fn clone(&self) -> MemoryKeyManagementClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryKeyManagementClient
impl Debug for MemoryKeyManagementClient
Source§impl Default for MemoryKeyManagementClient
impl Default for MemoryKeyManagementClient
Source§fn default() -> MemoryKeyManagementClient
fn default() -> MemoryKeyManagementClient
Returns the “default value” for a type. Read more
Source§impl KeyManagementClient for MemoryKeyManagementClient
impl KeyManagementClient for MemoryKeyManagementClient
Source§fn wrap_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
wrapping_key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn wrap_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
wrapping_key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Wrap (encrypt) a key using a wrapping key managed by the KMS.
Source§fn unwrap_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
wrapped_key: &'life1 [u8],
wrapping_key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SensitiveBytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn unwrap_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
wrapped_key: &'life1 [u8],
wrapping_key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SensitiveBytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Unwrap (decrypt) a previously wrapped key.
Source§fn supports_key_generation(&self) -> bool
fn supports_key_generation(&self) -> bool
Whether this KMS supports server-side key generation. Read more
Source§fn generate_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_wrapping_key_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GeneratedKey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_wrapping_key_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GeneratedKey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a new key and wrap it atomically on the server side. Read more
Auto Trait Implementations§
impl Freeze for MemoryKeyManagementClient
impl RefUnwindSafe for MemoryKeyManagementClient
impl Send for MemoryKeyManagementClient
impl Sync for MemoryKeyManagementClient
impl Unpin for MemoryKeyManagementClient
impl UnwindSafe for MemoryKeyManagementClient
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more