wamu_core/
traits.rs

1//! Traits for core types.
2
3use crate::crypto::{Signature, VerifyingKey};
4
5/// Interface for a [decentralized identity](https://ethereum.org/en/decentralized-identity/) provider.
6///
7/// **NOTE:** For interoperability with existing wallet solutions,
8/// the only requirement for decentralized identity providers is
9/// the ability to compute cryptographic signatures for any arbitrary message in such a way that
10/// the output signature can be verified in a non-interactive manner.
11pub trait IdentityProvider: Clone + std::fmt::Debug {
12    /// Returns the verifying key (i.e public key or address) for the identity.
13    fn verifying_key(&self) -> VerifyingKey;
14
15    /// Computes signature for a message.
16    fn sign(&self, msg: &[u8]) -> Signature;
17
18    /// Computes signature for a message and returns (`r`, `s`) as (`[u8; 32]`, `[u8; 32]`).
19    fn sign_message_share(&self, msg: &[u8]) -> ([u8; 32], [u8; 32]);
20}