pub struct SecretContext { /* private fields */ }Expand description
High-level context for encrypting and decrypting secrets. Bundles principal key, workspace keys, and environment to hide all crypto details.
Implementations§
Source§impl SecretContext
impl SecretContext
Sourcepub fn new(
principal_x25519_private_key: [u8; 32],
workspace_keys: WorkspaceKeys,
environment: Environment,
workspace_name: String,
project_name: String,
environment_name: String,
) -> Result<Self, SecretsError>
pub fn new( principal_x25519_private_key: [u8; 32], workspace_keys: WorkspaceKeys, environment: Environment, workspace_name: String, project_name: String, environment_name: String, ) -> Result<Self, SecretsError>
Create a new SecretContext from principal key, workspace keys, and environment.
Sourcepub fn decrypt_secret(&self, secret: &Secret) -> Result<String, SecretsError>
pub fn decrypt_secret(&self, secret: &Secret) -> Result<String, SecretsError>
Decrypt a secret using the bundled context. Handles all KEK/DEK unwrapping, ECDH, and AAD construction internally.
Sourcepub fn encrypt_secret(
&self,
key: &str,
value: &str,
) -> Result<EncryptedSecret, SecretsError>
pub fn encrypt_secret( &self, key: &str, value: &str, ) -> Result<EncryptedSecret, SecretsError>
Encrypt a secret using the bundled context. Handles all KEK/DEK unwrapping, ECDH, nonce generation, and AAD construction internally.
Auto Trait Implementations§
impl Freeze for SecretContext
impl RefUnwindSafe for SecretContext
impl Send for SecretContext
impl Sync for SecretContext
impl Unpin for SecretContext
impl UnwindSafe for SecretContext
Blanket Implementations§
Source§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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request