pub struct SignedRefsReader<'a, R, V> { /* private fields */ }Expand description
A SignedRefsReader reads and verifies a commit chain for a rad/sigrefs
entry.
To create a new reader, use SignedRefsReader::new.
The construction expects:
Implementations§
Source§impl<'a, R, V> SignedRefsReader<'a, R, V>
impl<'a, R, V> SignedRefsReader<'a, R, V>
Sourcepub fn new(
rid: RepoId,
tip: Tip,
repository: &'a R,
verifier: &'a V,
) -> SignedRefsReader<'a, R, V>
pub fn new( rid: RepoId, tip: Tip, repository: &'a R, verifier: &'a V, ) -> SignedRefsReader<'a, R, V>
Construct a new SignedRefsReader.
Sourcepub fn read(self) -> Result<VerifiedCommit, Read>
pub fn read(self) -> Result<VerifiedCommit, Read>
Read a VerifiedCommit using the SignedRefsReader, from a
linear history.
The VerifiedCommit will be the latest commit, if the commit verifies
and contains its parent in its Refs entry.
If the commit does not contain a parent, but its signature is not repeated, then it is still returned.
Otherwise, the latest commit that has no duplicate signatures in its ancestry is returned.
§Replay Attacks
The SignedRefsReader prevents replay attacks via two mechanisms:
- The first is recording the parent commit in the
/refsblob. This prevents a replay by not allowing the same signature payload to be used in a new commit, since the parents would not match. Note that this does not detect replays by older clients, since they will not include this entry in/refs. - The second mechanism uses the fact that a replay will give duplicate signatures. This means that any repeated signatures will be skipped, and the commit returned will be the first valid commit, that was not a replay.
Auto Trait Implementations§
impl<'a, R, V> Freeze for SignedRefsReader<'a, R, V>
impl<'a, R, V> RefUnwindSafe for SignedRefsReader<'a, R, V>where
R: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, R, V> Send for SignedRefsReader<'a, R, V>
impl<'a, R, V> Sync for SignedRefsReader<'a, R, V>
impl<'a, R, V> Unpin for SignedRefsReader<'a, R, V>
impl<'a, R, V> UnsafeUnpin for SignedRefsReader<'a, R, V>
impl<'a, R, V> UnwindSafe for SignedRefsReader<'a, R, V>where
R: RefUnwindSafe,
V: RefUnwindSafe,
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
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>
Converts
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>
Converts
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