use crate::{didcore::Config, Document, Error, Payload, VerificationMethod};
pub trait KeyMaterial {
fn public_key_bytes(&self) -> Vec<u8>;
fn private_key_bytes(&self) -> Vec<u8>;
}
pub trait Generate: KeyMaterial {
fn new() -> Self;
fn new_with_seed(seed: &[u8]) -> Self;
fn from_public_key(public_key: &[u8]) -> Self;
fn from_secret_key(private_key: &[u8]) -> Self;
}
pub trait Ecdsa {
fn sign(&self, payload: Payload) -> Vec<u8>;
fn verify(&self, payload: Payload, signature: &[u8]) -> Result<(), Error>;
}
pub trait Ecdh {
fn key_exchange(&self, their_public: &Self) -> Vec<u8>;
}
pub trait DIDCore {
fn get_verification_methods(&self, config: Config, controller: &str) -> Vec<VerificationMethod>;
fn get_did_document(&self, config: Config) -> Document;
}
pub trait Fingerprint {
fn fingerprint(&self) -> String;
}