pub struct SignedRole<T> { /* private fields */ }Expand description
A signed role, including its serialized form (buffer) which is meant to
be written to file. The sha256 and length are calculated from this
buffer and included in metadata for other roles, which makes it
imperative that this buffer is what is written to disk.
Convenience methods are provided on SignedRepository to ensure that
each role’s buffer is written correctly.
Implementations§
Source§impl<T> SignedRole<T>
impl<T> SignedRole<T>
Sourcepub async fn new(
role: T,
key_holder: &KeyHolder,
keys: &[Box<dyn KeySource>],
rng: &(dyn SecureRandom + Sync),
) -> Result<Self>
pub async fn new( role: T, key_holder: &KeyHolder, keys: &[Box<dyn KeySource>], rng: &(dyn SecureRandom + Sync), ) -> Result<Self>
Creates a new SignedRole
Sourcepub fn buffer(&self) -> &Vec<u8> ⓘ
pub fn buffer(&self) -> &Vec<u8> ⓘ
Provides access to the internal buffer containing the serialized form of the signed role. This buffer should be used anywhere this role is written to file.
Sourcepub fn length(&self) -> &u64
pub fn length(&self) -> &u64
Provides the length in bytes of the serialized representation of the signed role.
Sourcepub async fn write<P>(&self, outdir: P, consistent_snapshot: bool) -> Result<()>
pub async fn write<P>(&self, outdir: P, consistent_snapshot: bool) -> Result<()>
Write the current role’s buffer to the given directory with the appropriate file name.
Sourcepub fn add_old_signatures(self, old_signatures: Vec<Signature>) -> Result<Self>
pub fn add_old_signatures(self, old_signatures: Vec<Signature>) -> Result<Self>
Append the old signatures for root role
Trait Implementations§
Source§impl<T: Clone> Clone for SignedRole<T>
impl<T: Clone> Clone for SignedRole<T>
Source§fn clone(&self) -> SignedRole<T>
fn clone(&self) -> SignedRole<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more