pub struct Protected<T> { /* private fields */ }Expand description
A type-safe wrapper around TEE-protected data.
Protected<T> ensures the inner value T cannot be accessed without
going through the TEE. The encrypted data is serializable for persistence.
Created by Protected::new() or by the #[hyde::protect] macro.
Implementations§
Source§impl<T: Serialize + DeserializeOwned> Protected<T>
impl<T: Serialize + DeserializeOwned> Protected<T>
Sourcepub fn new(ctx: &mut HydeContext, value: &T) -> Result<Self>
pub fn new(ctx: &mut HydeContext, value: &T) -> Result<Self>
Protect a value by serializing it and encrypting with the TEE.
Sourcepub fn unprotect(&self, ctx: &mut HydeContext) -> Result<T>
pub fn unprotect(&self, ctx: &mut HydeContext) -> Result<T>
Decrypt and deserialize the protected value. Requires the same TEE.
Sourcepub fn protected_data(&self) -> &ProtectedData
pub fn protected_data(&self) -> &ProtectedData
Access the underlying ProtectedData for backup/restore operations.
Sourcepub fn from_protected_data(data: ProtectedData) -> Self
pub fn from_protected_data(data: ProtectedData) -> Self
Construct from raw ProtectedData (e.g., after restore).
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Protected<T>
impl<'de, T> Deserialize<'de> for Protected<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for Protected<T>
impl<T> RefUnwindSafe for Protected<T>where
T: RefUnwindSafe,
impl<T> Send for Protected<T>where
T: Send,
impl<T> Sync for Protected<T>where
T: Sync,
impl<T> Unpin for Protected<T>where
T: Unpin,
impl<T> UnsafeUnpin for Protected<T>
impl<T> UnwindSafe for Protected<T>where
T: UnwindSafe,
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