identity_storage/storage/
mod.rs1mod error;
7#[macro_use]
8mod jwk_document_ext;
9#[cfg(feature = "jpt-bbs-plus")]
10mod jwp_document_ext;
11mod signature_options;
12#[cfg(feature = "jpt-bbs-plus")]
13mod timeframe_revocation_ext;
14
15#[cfg(feature = "storage-signer")]
16mod storage_signer;
17#[cfg(all(test, feature = "memstore"))]
18pub(crate) mod tests;
19
20pub use error::*;
21
22pub use jwk_document_ext::*;
23#[cfg(feature = "jpt-bbs-plus")]
24pub use jwp_document_ext::*;
25pub use signature_options::*;
26#[cfg(feature = "storage-signer")]
27pub use storage_signer::*;
28#[cfg(feature = "jpt-bbs-plus")]
29pub use timeframe_revocation_ext::*;
30
31pub struct Storage<K, I> {
35 key_storage: K,
36 key_id_storage: I,
37}
38
39impl<K, I> Storage<K, I> {
40 pub fn new(key_storage: K, key_id_storage: I) -> Self {
42 Self {
43 key_storage,
44 key_id_storage,
45 }
46 }
47
48 pub fn key_storage(&self) -> &K {
50 &self.key_storage
51 }
52
53 pub fn key_id_storage(&self) -> &I {
55 &self.key_id_storage
56 }
57}
58
59#[cfg(feature = "keytool")]
60mod keytool {
61 use super::Storage;
62 use iota_interaction::KeytoolStorage as Keytool;
63
64 pub type KeytoolStorage = Storage<Keytool, Keytool>;
66
67 impl From<Keytool> for KeytoolStorage {
68 fn from(keytool: Keytool) -> Self {
69 KeytoolStorage::new(keytool.clone(), keytool)
70 }
71 }
72}
73
74#[cfg(feature = "keytool")]
75pub use keytool::*;