pub struct LedgerKey(/* private fields */);Expand description
The HMAC-SHA256 key of ledger hashes (state/ledger.key). Keyed because
an inline-delivered entry holds secret values: a plain hash would let
anyone with the ledger test guesses offline.
Implementations§
Source§impl LedgerKey
impl LedgerKey
Sourcepub fn load(fs: &dyn Fs, state_dir: &Path) -> Result<Option<Self>, CoreError>
pub fn load(fs: &dyn Fs, state_dir: &Path) -> Result<Option<Self>, CoreError>
Reads the key in state_dir; None when there is none yet. A key
of the wrong length is invalid_value; it is never replaced
silently, since every hash in the ledger depends on it.
Sourcepub fn load_or_create(fs: &dyn Fs, state_dir: &Path) -> Result<Self, CoreError>
pub fn load_or_create(fs: &dyn Fs, state_dir: &Path) -> Result<Self, CoreError>
LedgerKey::load, creating 32 random bytes with user-only
permissions on first use.
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
A key for tests and tools that never persist hashes.
Trait Implementations§
Auto Trait Implementations§
impl Forget for LedgerKey
impl Freeze for LedgerKey
impl Move for LedgerKey
impl RefUnwindSafe for LedgerKey
impl Send for LedgerKey
impl Sync for LedgerKey
impl Unpin for LedgerKey
impl UnsafeUnpin for LedgerKey
impl UnwindSafe for LedgerKey
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