pub struct StagedKeystore { /* private fields */ }Expand description
A freshly-generated, fully-encrypted keystore written to a temp file in
data_dir, not yet committed to keystore.json.
Staging (generate + encrypt + chmod the temp) is separated from committing
(archive-old + rename) so a multi-file key rotation can generate all key
material before touching any canonical file — an encryption failure then
leaves the prior keystore (and the sibling node.secret) untouched rather
than half-rotated (#844). Produced by stage_keystore; finished with
Self::commit.
Dropping a StagedKeystore without committing removes the temp file, so an
abandoned stage never litters data_dir.
Implementations§
Source§impl StagedKeystore
impl StagedKeystore
Sourcepub const fn address(&self) -> Address
pub const fn address(&self) -> Address
The EIP-55 address derived from the staged key, for logging before the commit lands.
Sourcepub fn commit(self) -> Result<Option<PathBuf>>
pub fn commit(self) -> Result<Option<PathBuf>>
Commit the staged keystore: archive any existing keystore.json (so the
operator key-rotation runbook keeps the prior ciphertext) and atomically
rename the temp into place.
Returns the archive path if a prior keystore was moved aside, or None
when there was nothing to archive (fresh install).
§Errors
Returns an error if archiving the prior keystore or the install rename
fails. The commit is fail-safe via
decdn_common::identity::install_staged: if the install rename fails
after the prior keystore was archived, the archive is restored
(best-effort) so the old keystore stays live, and the error states whether
the restore succeeded or keystore.json is now missing. On any error the
staged temp is removed by the Drop handler (committed stays false).
Trait Implementations§
Source§impl Debug for StagedKeystore
impl Debug for StagedKeystore
Source§impl Drop for StagedKeystore
impl Drop for StagedKeystore
Auto Trait Implementations§
impl Freeze for StagedKeystore
impl RefUnwindSafe for StagedKeystore
impl Send for StagedKeystore
impl Sync for StagedKeystore
impl Unpin for StagedKeystore
impl UnsafeUnpin for StagedKeystore
impl UnwindSafe for StagedKeystore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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> ⓘ
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