pub struct SignedStatement {
pub statement: WitnessStatement,
pub public_key: [u8; 32],
pub signature: Vec<u8>,
}Expand description
A statement, the public key that signed it, and the signature.
The key travels with the statement because a reader checking a seed may hold nothing else, and it costs no trust: the statement names its witness by the key’s hash, so a substituted key names somebody else.
Fields§
§statement: WitnessStatementWhat was said.
public_key: [u8; 32]The seed’s ed25519 public key.
signature: Vec<u8>Its signature, made the way an op’s author signs one: over the
signing hash of [WITNESS_CHANNEL, canonical_bytes].
Implementations§
Source§impl SignedStatement
impl SignedStatement
Sourcepub fn sign(key: &ActorKey, statement: WitnessStatement) -> Self
pub fn sign(key: &ActorKey, statement: WitnessStatement) -> Self
Signs statement with key.
Sourcepub fn verify(&self) -> Result<(), String>
pub fn verify(&self) -> Result<(), String>
Checks the statement is one this build reads, is signed by the key it carries, and that key is the witness it names.
§Errors
Which of the three failed.
Sourcepub fn from_json(value: &Value) -> Option<Self>
pub fn from_json(value: &Value) -> Option<Self>
Reads one back from its JSON form, unchecked: see
SignedStatement::verify.
Trait Implementations§
Source§impl Clone for SignedStatement
impl Clone for SignedStatement
Source§fn clone(&self) -> SignedStatement
fn clone(&self) -> SignedStatement
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SignedStatement
impl Debug for SignedStatement
Source§impl PartialEq for SignedStatement
impl PartialEq for SignedStatement
Source§fn eq(&self, other: &SignedStatement) -> bool
fn eq(&self, other: &SignedStatement) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for SignedStatement
impl StructuralPartialEq for SignedStatement
Auto Trait Implementations§
impl Freeze for SignedStatement
impl RefUnwindSafe for SignedStatement
impl Send for SignedStatement
impl Sync for SignedStatement
impl Unpin for SignedStatement
impl UnsafeUnpin for SignedStatement
impl UnwindSafe for SignedStatement
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