1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Encrypted object management and release.
//!
//! This module provides traits and implementations for managing encrypted
//! objects and releasing them in a type-safe manner. It supports:
//!
//! - Type-safe object release
//! - Custom encryption strategies
//! - Error handling
//! - Async operations
use crateDEK;
use crateEncryptionStrategy;
use crateEncryptionError;
use async_trait;
/// A trait for releasing encrypted objects using a specific encryption strategy.
///
/// This trait enables type-safe decryption and conversion of encrypted objects
/// into their original type. Implementations should ensure:
///
/// - Proper decryption
/// - Type safety
/// - Error handling
/// - Resource cleanup
///
/// # Type Parameters
///
/// * `C` - The type of the released (decrypted) object
/// * `S` - The encryption strategy used for decryption
///
/// # Example
/// ```no_run
/// use async_trait::async_trait;
/// use hyokashi::{ReleaseHeldObject, DEK, EncryptionStrategy, EncryptionError};
///
/// struct MyEncryptedObject {
/// data: Vec<u8>
/// }
///
/// #[async_trait]
/// impl<S: EncryptionStrategy + Send> ReleaseHeldObject<String, S> for MyEncryptedObject {
/// async fn release_object(&self, dek: DEK, strategy: &S) -> Result<String, EncryptionError> {
/// // Implement decryption and conversion to String...
/// # Ok(String::new())
/// }
/// }
/// ```