chore: Returns nonce cache as Arc
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
f47bc82b19
commit
e15c693421
2 changed files with 7 additions and 5 deletions
|
@ -30,7 +30,7 @@ pub trait DepotExt {
|
|||
/// Returns the server configuration
|
||||
fn config(&self) -> &Config;
|
||||
/// Retutns the nonce cache
|
||||
fn nonce_cache(&self) -> &NonceCache;
|
||||
fn nonce_cache(&self) -> Arc<NonceCache>;
|
||||
/// Returns the size of the nonce cache
|
||||
fn nonce_cache_size(&self) -> &usize;
|
||||
}
|
||||
|
@ -52,9 +52,11 @@ impl DepotExt for Depot {
|
|||
self.obtain::<Arc<Config>>().expect("Config not found")
|
||||
}
|
||||
|
||||
fn nonce_cache(&self) -> &NonceCache {
|
||||
self.obtain::<Arc<NonceCache>>()
|
||||
.expect("Nonce cache not found")
|
||||
fn nonce_cache(&self) -> Arc<NonceCache> {
|
||||
Arc::clone(
|
||||
self.obtain::<Arc<NonceCache>>()
|
||||
.expect("Nonce cache not found"),
|
||||
)
|
||||
}
|
||||
|
||||
fn nonce_cache_size(&self) -> &usize {
|
||||
|
|
|
@ -72,7 +72,7 @@ pub async fn signature_check(
|
|||
}
|
||||
};
|
||||
|
||||
if !utils::is_valid_nonce(&signature, depot.nonce_cache(), depot.nonce_cache_size())
|
||||
if !utils::is_valid_nonce(&signature, &depot.nonce_cache(), depot.nonce_cache_size())
|
||||
|| !utils::is_valid_signature(
|
||||
&sender_public_key,
|
||||
&depot.config().server.private_key,
|
||||
|
|
Loading…
Reference in a new issue