pub struct Manifest { /* private fields */ }Expand description
The root metadata structure for a bucket.
A manifest contains everything needed to access and verify a bucket:
- Identity: Global UUID and human-readable name
- Access control: Principal shares for decryption
- Content pointers: Links to entry node, pin set, and crdt op log
- Version chain: Previous link and height for history
- Publication: Optional plaintext secret for public access
§Serialization
Manifests are serialized using DAG-CBOR and stored as content-addressed blobs. The manifest’s CID serves as the bucket’s current state identifier.
§Example
let manifest = Manifest::new(
Uuid::new_v4(),
"my-bucket".to_string(),
owner_public_key,
secret_share,
entry_link,
pins_link,
0, // initial height
);Implementations§
Source§impl Manifest
impl Manifest
Sourcepub fn new(
id: Uuid,
name: String,
owner: PublicKey,
share: SecretShare,
entry: Link,
pins: Link,
height: u64,
) -> Self
pub fn new( id: Uuid, name: String, owner: PublicKey, share: SecretShare, entry: Link, pins: Link, height: u64, ) -> Self
Create a new manifest with an initial owner.
§Arguments
id- Global unique identifier for the bucketname- Human-readable display nameowner- Public key of the initial ownershare- Encrypted secret share for the ownerentry- Link to the root nodepins- Link to the pin setheight- Version chain height (usually 0 for new buckets)
Get all shares.
Get mutable access to shares.
Get a principal’s share by their public key.
Sourcepub fn get_peer_ids(&self) -> Vec<PublicKey>
pub fn get_peer_ids(&self) -> Vec<PublicKey>
Get all peer public keys from shares.
Get all shares with a specific role.
Sourcepub fn is_published(&self) -> bool
pub fn is_published(&self) -> bool
Check if the bucket is published.
Published buckets have their secret stored in plaintext, allowing anyone with the manifest to decrypt contents.
Get the author (signer’s public key) if the manifest is signed.
Sourcepub fn set_previous(&mut self, previous: Link)
pub fn set_previous(&mut self, previous: Link)
Set the previous manifest link.
Sourcepub fn set_height(&mut self, height: u64)
pub fn set_height(&mut self, height: u64)
Set the version chain height.
Sourcepub fn set_ops_log(&mut self, link: Link)
pub fn set_ops_log(&mut self, link: Link)
Set the operations log link.
Sourcepub fn clear_ops_log(&mut self)
pub fn clear_ops_log(&mut self)
Clear the operations log link.
This should be called when creating a new version from an existing manifest, since each version has its own independent ops_log.
Add a share to the manifest.
Use Share::new_owner or Share::new_mirror to construct the share.
Sourcepub fn publish(&mut self, secret: &Secret)
pub fn publish(&mut self, secret: &Secret)
Publish the bucket by storing the secret in plaintext.
Warning: Once published, this version’s secret is exposed and anyone with the manifest can decrypt bucket contents.
Sourcepub fn unpublish(&mut self)
pub fn unpublish(&mut self)
Unpublish the bucket by clearing the public secret.
This removes public read access. Mirrors will no longer be able to decrypt bucket contents until republished.
Sourcepub fn sign(&mut self, secret_key: &SecretKey) -> Result<(), ManifestError>
pub fn sign(&mut self, secret_key: &SecretKey) -> Result<(), ManifestError>
Sign this manifest with the given secret key.
Sets the author field to the public key and signature to the Ed25519
signature over the manifest’s signable bytes.
§Errors
Returns an error if the manifest cannot be serialized for signing.
Sourcepub fn verify_signature(&self) -> Result<bool, ManifestError>
pub fn verify_signature(&self) -> Result<bool, ManifestError>
Verify the manifest’s signature.
Returns Ok(true) if the signature is valid, Ok(false) if the manifest
is unsigned (no author or signature), and an error if verification fails.
§Errors
Returns an error if:
- The manifest cannot be serialized for verification
- The signature is invalid (tampered or wrong key)
Trait Implementations§
Source§impl BlockEncoded<DagCborCodec> for Manifest
impl BlockEncoded<DagCborCodec> for Manifest
Source§impl<'de> Deserialize<'de> for Manifest
impl<'de> Deserialize<'de> for Manifest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Manifest
Auto Trait Implementations§
impl Freeze for Manifest
impl RefUnwindSafe for Manifest
impl Send for Manifest
impl Sync for Manifest
impl Unpin for Manifest
impl UnwindSafe for Manifest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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