Struct SignatureScheme
pub struct SignatureScheme { /* private fields */ }Expand description
Represents a signature signed by a passkey (signer)
§Notes about the Passkey protocol.
The Passkey signing device is given a challenge. From this challenge is computed a
JSON object named clientData, and the Passkey device signs the following message:
[authenticatorData... sha256(clientData)]Where authenticatorData is computed (and returned) by the Passkey authenticator.
This is why, in order to verify messages, we need to have access to:
- to both
authenticatorDataandclientDatato derive the signed bytes and verify the ecdsa signature - to the original
challengeto make sure thatclientDatais correct.
Implementations§
§impl SignatureScheme
impl SignatureScheme
pub const fn new(
pub_key: PubKey,
signature: Signature,
client_data: String,
authenticator_data: String,
) -> SignatureScheme
pub const fn new( pub_key: PubKey, signature: Signature, client_data: String, authenticator_data: String, ) -> SignatureScheme
Creates a new signature scheme with the given public key and signature
pub fn from_bytes(
pub_key_bytes: &[u8],
signature_bytes: &[u8],
client_data: String,
authenticator_data: String,
) -> Result<SignatureScheme, Error>
pub fn from_bytes( pub_key_bytes: &[u8], signature_bytes: &[u8], client_data: String, authenticator_data: String, ) -> Result<SignatureScheme, Error>
Tries to create a new signature scheme by parsing the given bytes for the public key and for the signature.
pub const fn pub_key(&self) -> &PubKey
pub const fn pub_key(&self) -> &PubKey
Returns a reference to the public key
pub const fn signature(&self) -> &Signature
pub const fn signature(&self) -> &Signature
Returns a reference to the signature
pub fn client_data(&self) -> &str
pub fn client_data(&self) -> &str
Returns a reference to the client data
pub fn authenticator_data(&self) -> &str
pub fn authenticator_data(&self) -> &str
Returns a reference to the authenticator data
pub fn verify_bytes(&self, bytes: impl AsRef<[u8]>) -> Result<(), Error>
pub fn verify_bytes(&self, bytes: impl AsRef<[u8]>) -> Result<(), Error>
Verifies that Self::signature is valid and was computed over the same
data as the bytes passed in.
The bytes must come from the serialization of the Rust type which was serialized and given to the passkey authenticator.
This implements a subset of the verification algorithm as specified by the standard.
Trait Implementations§
§impl Clone for SignatureScheme
impl Clone for SignatureScheme
§fn clone(&self) -> SignatureScheme
fn clone(&self) -> SignatureScheme
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for SignatureScheme
impl Debug for SignatureScheme
§impl<'de> Deserialize<'de> for SignatureScheme
impl<'de> Deserialize<'de> for SignatureScheme
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SignatureScheme, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SignatureScheme, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for SignatureScheme
impl PartialEq for SignatureScheme
§impl Serialize for SignatureScheme
impl Serialize for SignatureScheme
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for SignatureScheme
impl StructuralPartialEq for SignatureScheme
Auto Trait Implementations§
impl Freeze for SignatureScheme
impl RefUnwindSafe for SignatureScheme
impl Send for SignatureScheme
impl Sync for SignatureScheme
impl Unpin for SignatureScheme
impl UnwindSafe for SignatureScheme
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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.§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request