pub struct CommitReader { /* private fields */ }Expand description
Encapsulates the key derivation chain for reading a commit’s objects.
Created by decrypting a commit blob, which extracts the envelope nonce and derives the content key. The content key is then used to decrypt metadata and shards.
Implementations§
Source§impl CommitReader
impl CommitReader
Create a CommitReader from a share key (for share-based unseal).
In share-based unseal the derived key serves directly as the content key — there is no commit envelope involved.
Sourcepub fn from_content_key(content_key: ContentKey) -> Self
pub fn from_content_key(content_key: ContentKey) -> Self
Create a CommitReader from a content key directly (for scoped-key clone).
Used when cloning from a published repo with --content-key. The content
key is the only key available – no root key exists in scoped mode.
Sourcepub fn open_with_vault(
vault: &KeyVault,
commit_blob: &EncryptedCommit,
) -> Result<(CommitPlaintext, Self)>
pub fn open_with_vault( vault: &KeyVault, commit_blob: &EncryptedCommit, ) -> Result<(CommitPlaintext, Self)>
Decrypt a commit blob using a KeyVault, routing key material through
the vault rather than accepting raw bytes.
This is the preferred constructor. The vault decrypts the commit and
produces a crypto-layer CommitReader, whose parts are transferred
into this core-layer reader. Callers never handle raw key bytes.
Sourcepub fn decrypt_metadata<T>(&self, blob: &EncryptedMetadata) -> Result<T>where
T: DeserializeOwned,
pub fn decrypt_metadata<T>(&self, blob: &EncryptedMetadata) -> Result<T>where
T: DeserializeOwned,
Decrypt a metadata bundle blob and deserialize from CBOR.
Sourcepub fn decrypt_shard(
&self,
blob: &EncryptedShard,
wrapped_key: Option<&WrappedKey>,
ancestor_keys: &[ContentKey],
) -> Result<DecryptedShard>
pub fn decrypt_shard( &self, blob: &EncryptedShard, wrapped_key: Option<&WrappedKey>, ancestor_keys: &[ContentKey], ) -> Result<DecryptedShard>
Decrypt a shard blob. Handles wrapped keys, content key, and optional ancestor key fallback.
Fallback chain:
- If
wrapped_keyisSome, try unwrapping with content_key, then each ancestor key - Try content_key directly
- Try each ancestor key directly
Sourcepub fn decrypt_repo_manifest(
&self,
blob: &EncryptedRepoManifest,
) -> Result<Manifest>
pub fn decrypt_repo_manifest( &self, blob: &EncryptedRepoManifest, ) -> Result<Manifest>
Decrypt a repo manifest blob into a typed Manifest.
Sourcepub fn decrypt_envelope_body(
&self,
blob: &EncryptedCommit,
) -> Result<(CommitPlaintext, KeyNonce)>
pub fn decrypt_envelope_body( &self, blob: &EncryptedCommit, ) -> Result<(CommitPlaintext, KeyNonce)>
Decrypt a VD01 envelope body of a commit blob using the content key.
Returns the commit plaintext and the envelope nonce. Used by share-based unseal where the share key IS the content key.
Sourcepub fn content_key(&self) -> &ContentKey
pub fn content_key(&self) -> &ContentKey
Get the content key (derived key for envelope commits).
Auto Trait Implementations§
impl Freeze for CommitReader
impl RefUnwindSafe for CommitReader
impl Send for CommitReader
impl Sync for CommitReader
impl Unpin for CommitReader
impl UnsafeUnpin for CommitReader
impl UnwindSafe for CommitReader
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
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