added methods to query keys

This commit is contained in:
TotallyNot 2023-02-22 18:54:55 +01:00
parent 71eef676d3
commit ddfbc0f7e8
3 changed files with 79 additions and 7 deletions

View file

@ -75,12 +75,17 @@ pub trait KeyPoolStorage {
domains: Vec<Self::Domain>,
) -> Result<Self::Key, Self::Error>;
async fn read_key(&self, key: KeySelector<Self::Key>) -> Result<Self::Key, Self::Error>;
async fn read_key(&self, key: KeySelector<Self::Key>)
-> Result<Option<Self::Key>, Self::Error>;
async fn read_user_keys(&self, user_id: i32) -> Result<Vec<Self::Key>, Self::Error>;
async fn remove_key(&self, key: KeySelector<Self::Key>) -> Result<Self::Key, Self::Error>;
async fn query_key(&self, domain: Self::Domain) -> Result<Option<Self::Key>, Self::Error>;
async fn query_all(&self, domain: Self::Domain) -> Result<Vec<Self::Key>, Self::Error>;
async fn add_domain_to_key(
&self,
key: KeySelector<Self::Key>,