Skip to content

Commit

Permalink
Update TokenId type
Browse files Browse the repository at this point in the history
  • Loading branch information
kkohbrok authored Apr 9, 2024
2 parents 5198d86 + aeee111 commit d135953
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/memory_stores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use async_trait::async_trait;
use privacypass::TokenKeyId;
use privacypass::TruncatedTokenKeyId;
use std::{
collections::{HashMap, HashSet},
sync::Arc,
Expand Down Expand Up @@ -35,17 +35,17 @@ impl NonceStore for MemoryNonceStore {

#[derive(Default, Clone)]
pub struct MemoryKeyStore {
keys: Arc<Mutex<HashMap<TokenKeyId, VoprfServer<Ristretto255>>>>,
keys: Arc<Mutex<HashMap<TruncatedTokenKeyId, VoprfServer<Ristretto255>>>>,
}

#[async_trait]
impl BatchedKeyStore for MemoryKeyStore {
async fn insert(&self, token_key_id: TokenKeyId, server: VoprfServer<Ristretto255>) {
async fn insert(&self, token_key_id: TruncatedTokenKeyId, server: VoprfServer<Ristretto255>) {
let mut keys = self.keys.lock().await;
keys.insert(token_key_id, server);
}

async fn get(&self, token_key_id: &TokenKeyId) -> Option<VoprfServer<Ristretto255>> {
async fn get(&self, token_key_id: &TruncatedTokenKeyId) -> Option<VoprfServer<Ristretto255>> {
self.keys.lock().await.get(token_key_id).cloned()
}
}

0 comments on commit d135953

Please sign in to comment.