p2panda_encryption/traits/
key_registry.rs1use std::error::Error;
4use std::fmt::Debug;
5
6use serde::{Deserialize, Serialize};
7
8use crate::crypto::x25519::PublicKey;
9
10pub trait IdentityRegistry<ID, Y> {
12 type Error: Error;
13
14 fn identity_key(y: &Y, id: &ID) -> Result<Option<PublicKey>, Self::Error>;
15}
16
17pub trait PreKeyRegistry<ID, KB> {
19 type State: Debug + Serialize + for<'a> Deserialize<'a>;
20
21 type Error: Error;
22
23 fn key_bundle(y: Self::State, id: &ID) -> Result<(Self::State, Option<KB>), Self::Error>;
24}