pub struct SignedMetadataBuilder<D, M>where
D: Pouf,{ /* private fields */ }Expand description
Helper to construct SignedMetadata.
Implementations§
Source§impl<D, M> SignedMetadataBuilder<D, M>
impl<D, M> SignedMetadataBuilder<D, M>
Sourcepub fn from_metadata(metadata: &M) -> Result<Self>
pub fn from_metadata(metadata: &M) -> Result<Self>
Create a new SignedMetadataBuilder from a given Metadata.
Sourcepub fn from_raw_metadata(metadata: D::RawData) -> Result<Self>
pub fn from_raw_metadata(metadata: D::RawData) -> Result<Self>
Create a new SignedMetadataBuilder from manually serialized metadata to be signed.
Returns an error if metadata cannot be parsed into M.
Sourcepub fn sign(self, private_key: &dyn PrivateKey) -> Result<Self>
pub fn sign(self, private_key: &dyn PrivateKey) -> Result<Self>
Sign the metadata using the given private_key, replacing any existing signatures with the
same KeyId.
WARNING: You should never have multiple TUF private keys on the same machine, so if
you’re using this to append several signatures at once, you are doing something wrong. The
preferred method is to generate your copy of the metadata locally and use
SignedMetadata::merge_signatures to perform the “append” operations.
Sourcepub fn build(self) -> SignedMetadata<D, M>
pub fn build(self) -> SignedMetadata<D, M>
Construct a new SignedMetadata using the included signatures, sorting the signatures by
KeyId.
Trait Implementations§
Source§impl<D, M: Clone> Clone for SignedMetadataBuilder<D, M>
impl<D, M: Clone> Clone for SignedMetadataBuilder<D, M>
Source§fn clone(&self) -> SignedMetadataBuilder<D, M>
fn clone(&self) -> SignedMetadataBuilder<D, M>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<D, M> Freeze for SignedMetadataBuilder<D, M>
impl<D, M> RefUnwindSafe for SignedMetadataBuilder<D, M>
impl<D, M> Send for SignedMetadataBuilder<D, M>
impl<D, M> Sync for SignedMetadataBuilder<D, M>
impl<D, M> Unpin for SignedMetadataBuilder<D, M>
impl<D, M> UnsafeUnpin for SignedMetadataBuilder<D, M>
impl<D, M> UnwindSafe for SignedMetadataBuilder<D, M>
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