Skip to main content

ProtectedSecret

Struct ProtectedSecret 

Source
pub struct ProtectedSecret<'provider, P, State, Level>{ /* private fields */ }
Expand description

Exact provider-owned protected allocation in one typestate.

Moving this handle may not move the provider’s backing bytes. The type is !Sync, !UnwindSafe, and !RefUnwindSafe. Those traits communicate API friction only; cleanup remains correct when callers use AssertUnwindSafe.

Implementations§

Source§

impl<'provider, P, Level> ProtectedSecret<'provider, P, Uninitialized, Level>

Source

pub fn try_new( provider: &'provider P, token: &AssuranceToken<'provider, Level>, logical_bytes: usize, ) -> Result<Self, ProtectionError>

Reserves all bounded resources and creates zeroed protected storage.

Source§

impl<P, Level> ProtectedSecret<'_, P, Validated, Level>

Source

pub fn expose_secret(&self) -> ExposedProtectedSecret<'_>

Creates an explicit redacted exposure guard over validated bytes.

Source§

impl<'provider, P, State, Level> ProtectedSecret<'provider, P, State, Level>

Source

pub fn capacity(&self) -> usize

Complete logical allocation capacity.

Source

pub const fn initialized_len(&self) -> usize

Initialized plaintext bytes tracked by this typestate.

Source

pub fn operation_report( &self, token: &AssuranceToken<'provider, Level>, ) -> Result<ProtectedOperationReport, ProtectionError>

Reports posture only for this exact allocation and its recorded operation. Stale tokens fail instead of returning historical assurance.

Source

pub fn try_close(self) -> Result<CleanupReport, CleanupError>

Consumes the public owner and reports the ordered cleanup result.

Trait Implementations§

Source§

impl<P, State, Level> Debug for ProtectedSecret<'_, P, State, Level>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P, State, Level> Drop for ProtectedSecret<'_, P, State, Level>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<P, State, Level> Send for ProtectedSecret<'_, P, State, Level>
where P: ThreadMovableProvider + Sync, P::Handle: Send, State: Send, Level: AssuranceLevel + Send,

Auto Trait Implementations§

§

impl<'provider, P, State, Level> !RefUnwindSafe for ProtectedSecret<'provider, P, State, Level>

§

impl<'provider, P, State, Level> !Sync for ProtectedSecret<'provider, P, State, Level>

§

impl<'provider, P, State, Level> !UnwindSafe for ProtectedSecret<'provider, P, State, Level>

§

impl<'provider, P, State, Level> Freeze for ProtectedSecret<'provider, P, State, Level>

§

impl<'provider, P, State, Level> Unpin for ProtectedSecret<'provider, P, State, Level>
where <P as ProtectedMemoryProvider>::Handle: Unpin, State: Unpin, Level: Unpin,

§

impl<'provider, P, State, Level> UnsafeUnpin for ProtectedSecret<'provider, P, State, Level>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.