1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use crate::{Error, PublicKey, SecretKey};

use borrown::Borrown;

/// Keys container
pub trait Keystore {
    /// Keystore error implementation
    type Error: From<Error>;

    /// Identifier for the keypair
    type KeyId;

    /// Public key for a given id
    fn public(&self, id: Self::KeyId) -> Result<Borrown<'_, PublicKey>, Self::Error>;

    /// Secret key for a given id
    fn secret(&self, id: Self::KeyId) -> Result<Borrown<'_, SecretKey>, Self::Error>;
}