pub struct SecretFelt(/* private fields */);Expand description
A Felt that holds secret key material and is zeroized on drop.
This wrapper ensures that secret scalar values (private keys, seeds) are overwritten with zeros when they go out of scope, preventing them from lingering in memory after use.
§Security
- All access to the inner
Feltmust go through [expose_secret()], making every secret-access point explicit and greppable. Debugoutput is redacted to prevent accidental logging of secrets.LowerHexis delegated toFeltfor intentional serialization (e.g.,private_key_hex()methods).Dropuses a volatile write to prevent the compiler from optimizing away the zeroing.
Implementations§
Source§impl SecretFelt
impl SecretFelt
Sourcepub fn new(felt: Felt) -> SecretFelt
pub fn new(felt: Felt) -> SecretFelt
Create a new SecretFelt from a Felt.
Sourcepub fn expose_secret(&self) -> &Felt
pub fn expose_secret(&self) -> &Felt
Access the secret value. Every call site is explicit and greppable.
Trait Implementations§
Source§impl Clone for SecretFelt
impl Clone for SecretFelt
Source§fn clone(&self) -> SecretFelt
fn clone(&self) -> SecretFelt
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 SecretFelt
impl Debug for SecretFelt
Source§impl Drop for SecretFelt
impl Drop for SecretFelt
Source§impl From<Felt> for SecretFelt
impl From<Felt> for SecretFelt
Source§fn from(felt: Felt) -> SecretFelt
fn from(felt: Felt) -> SecretFelt
Converts to this type from the input type.
Source§impl LowerHex for SecretFelt
impl LowerHex for SecretFelt
Source§impl PartialEq<Felt> for SecretFelt
impl PartialEq<Felt> for SecretFelt
Source§impl PartialEq for SecretFelt
impl PartialEq for SecretFelt
Source§impl Zeroize for SecretFelt
impl Zeroize for SecretFelt
impl Eq for SecretFelt
Auto Trait Implementations§
impl Freeze for SecretFelt
impl RefUnwindSafe for SecretFelt
impl Send for SecretFelt
impl Sync for SecretFelt
impl Unpin for SecretFelt
impl UnsafeUnpin for SecretFelt
impl UnwindSafe for SecretFelt
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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