pub struct SecretKey(/* private fields */);Expand description
The key secrets are encrypted under: 32 bytes. Its Debug never shows it.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn generate() -> Result<Self, SecretsError>
pub fn generate() -> Result<Self, SecretsError>
Sourcepub fn from_base64(text: &str) -> Result<Self, SecretsError>
pub fn from_base64(text: &str) -> Result<Self, SecretsError>
The key from its base64 text (as SCHEDR_SECRET_KEY holds it).
§Errors
SecretsError::Key if it isn’t base64 of 32 bytes (the message never shows it).
Sourcepub fn encrypt(
&self,
path: &str,
key: &str,
value: &str,
) -> Result<String, SecretsError>
pub fn encrypt( &self, path: &str, key: &str, value: &str, ) -> Result<String, SecretsError>
value encrypted for path#key.
§Errors
SecretsError::Key if the system’s random source fails (no nonce).
Sourcepub fn decrypt(
&self,
path: &str,
key: &str,
stored: &str,
) -> Result<String, SecretsError>
pub fn decrypt( &self, path: &str, key: &str, stored: &str, ) -> Result<String, SecretsError>
The value stored for path#key.
§Errors
SecretsError::Decrypt if it isn’t one written under this key for path#key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecretKey
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnsafeUnpin for SecretKey
impl UnwindSafe for SecretKey
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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