pub struct SignedRefMap {
pub repo_id: RepoId,
pub refs: BTreeMap<String, String>,
pub seq: u64,
pub timestamp: u64,
pub signer: DeviceId,
pub signer_key: IdentityKey,
pub signature: Vec<u8>,
}Expand description
Signed snapshot of repository Git references (ref_name -> oid) with monotonic sequence protection against replay.
Fields§
§repo_id: RepoId§refs: BTreeMap<String, String>§seq: u64§timestamp: u64§signer: DeviceId§signer_key: IdentityKey§signature: Vec<u8>Implementations§
Source§impl SignedRefMap
impl SignedRefMap
Sourcepub async fn sign(
repo_id: RepoId,
refs: BTreeMap<String, String>,
seq: u64,
timestamp: u64,
identity: &dyn Identity,
) -> Result<Self, SigRefsError>
pub async fn sign( repo_id: RepoId, refs: BTreeMap<String, String>, seq: u64, timestamp: u64, identity: &dyn Identity, ) -> Result<Self, SigRefsError>
Signs a new ref snapshot under identity for repo_id.
Sourcepub fn canonical_signing_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_signing_bytes(&self) -> Vec<u8> ⓘ
Assembles the domain-separated canonical CBOR signing input covering repo, refs, sequence, timestamp, and signer identity.
Sourcepub async fn verify(
&self,
identity: &dyn Identity,
expected_repo_id: Option<&RepoId>,
) -> Result<(), SigRefsError>
pub async fn verify( &self, identity: &dyn Identity, expected_repo_id: Option<&RepoId>, ) -> Result<(), SigRefsError>
Verifies repo scope, ref/OID syntax, self-certifying signer_key, and signature.
Sourcepub async fn verify_monotonic(
&self,
identity: &dyn Identity,
expected_repo_id: Option<&RepoId>,
last_accepted_seq: Option<u64>,
) -> Result<(), SigRefsError>
pub async fn verify_monotonic( &self, identity: &dyn Identity, expected_repo_id: Option<&RepoId>, last_accepted_seq: Option<u64>, ) -> Result<(), SigRefsError>
Verifies cryptographic authenticity and enforces strictly monotonic seq relative to last_accepted_seq.
Trait Implementations§
Source§impl Clone for SignedRefMap
impl Clone for SignedRefMap
Source§impl Debug for SignedRefMap
impl Debug for SignedRefMap
Source§impl Decode<'_, ()> for SignedRefMap
impl Decode<'_, ()> for SignedRefMap
Source§impl<'de> Deserialize<'de> for SignedRefMap
impl<'de> Deserialize<'de> for SignedRefMap
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encode<()> for SignedRefMap
impl Encode<()> for SignedRefMap
impl Eq for SignedRefMap
Source§impl PartialEq for SignedRefMap
impl PartialEq for SignedRefMap
Source§impl Serialize for SignedRefMap
impl Serialize for SignedRefMap
impl StructuralPartialEq for SignedRefMap
Auto Trait Implementations§
impl Forget for SignedRefMap
impl Freeze for SignedRefMap
impl Move for SignedRefMap
impl RefUnwindSafe for SignedRefMap
impl Send for SignedRefMap
impl Sync for SignedRefMap
impl Unpin for SignedRefMap
impl UnsafeUnpin for SignedRefMapwhere
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for SignedRefMap
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