pub enum Domain {
Hello,
Welcome,
SyncRequest,
SyncAnswer,
}Expand description
The message kinds, each its own signing domain. The domain is mixed into the bytes a signature covers, so a signature made over one kind of message cannot be presented as another: a captured welcome cannot be replayed as a sync answer even though both are signed by the same key.
use majordomus_cli::mesh::identity::NodeIdentity;
use majordomus_cli::mesh::link::{sign, verify_signed, Domain};
let node = NodeIdentity::ephemeral().unwrap();
let hello = sign(&node, Domain::Hello, serde_json::json!({ "proto_min": 1 }));
assert!(verify_signed(&node.public.public_key, Domain::Hello, &hello));
for other in [Domain::Welcome, Domain::SyncRequest, Domain::SyncAnswer] {
assert!(!verify_signed(&node.public.public_key, other, &hello), "domains do not cross");
}Variants§
Hello
A dialer’s hello.
Welcome
An answerer’s welcome.
SyncRequest
A dialer’s sync round.
SyncAnswer
An answerer’s sync answer.
Trait Implementations§
impl Copy for Domain
impl Eq for Domain
impl StructuralPartialEq for Domain
Auto Trait Implementations§
impl Freeze for Domain
impl RefUnwindSafe for Domain
impl Send for Domain
impl Sync for Domain
impl Unpin for Domain
impl UnsafeUnpin for Domain
impl UnwindSafe for Domain
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.