pub struct VerifyingKey(VerifyingKey);Expand description
A P-256 public key that arrived from somewhere else.
There is no private counterpart in this crate by design.
Tuple Fields§
§0: VerifyingKeyImplementations§
Source§impl VerifyingKey
impl VerifyingKey
Sourcepub fn to_multibase(&self) -> String
pub fn to_multibase(&self) -> String
The publicKeyMultibase form: base58btc over the 0x1200 multicodec
and the 33-byte SEC1 compressed point.
Sourcepub fn to_did_key(&self) -> String
pub fn to_did_key(&self) -> String
The did:key URI form.
Sourcepub fn from_did_key(did: &str) -> Result<Self, KeyError>
pub fn from_did_key(did: &str) -> Result<Self, KeyError>
Parses a did:key:z... URI naming a P-256 key.
Sourcepub fn from_multibase(multibase: &str) -> Result<Self, KeyError>
pub fn from_multibase(multibase: &str) -> Result<Self, KeyError>
Parses a bare publicKeyMultibase string naming a P-256 key.
Refuses any other curve and any encoding but the 33-byte compressed point, exactly as the secp256k1 reader does: a key that round-trips through this crate is one atproto will accept.
Sourcepub fn verify(&self, message: &[u8], sig: &Signature) -> Result<(), KeyError>
pub fn verify(&self, message: &[u8], sig: &Signature) -> Result<(), KeyError>
Verifies a signature over message, refusing a high s.
The low-s check is written out rather than inherited. p256 accepts
a high-s signature and atproto does not, so a verifier that leaned on
the library the way the secp256k1 one does would accept exactly the
signatures the protocol exists to rule out.
Trait Implementations§
Source§impl Clone for VerifyingKey
impl Clone for VerifyingKey
Source§fn clone(&self) -> VerifyingKey
fn clone(&self) -> VerifyingKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VerifyingKey
impl Debug for VerifyingKey
Source§impl PartialEq for VerifyingKey
impl PartialEq for VerifyingKey
Source§fn eq(&self, other: &VerifyingKey) -> bool
fn eq(&self, other: &VerifyingKey) -> bool
self and other values to be equal, and is used by ==.impl Copy for VerifyingKey
impl Eq for VerifyingKey
impl StructuralPartialEq for VerifyingKey
Auto Trait Implementations§
impl Freeze for VerifyingKey
impl RefUnwindSafe for VerifyingKey
impl Send for VerifyingKey
impl Sync for VerifyingKey
impl Unpin for VerifyingKey
impl UnsafeUnpin for VerifyingKey
impl UnwindSafe for VerifyingKey
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
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
§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
key and return true if they are equal.