1use jsonwebtoken::DecodingKey;
7use std::collections::HashMap;
8
9pub struct KeySet {
10 keys: HashMap<String, DecodingKey>,
11}
12
13impl KeySet {
14 #[must_use]
15 pub fn new() -> Self {
16 Self {
17 keys: HashMap::new(),
18 }
19 }
20
21 pub fn insert(&mut self, kid: impl Into<String>, key: DecodingKey) {
22 self.keys.insert(kid.into(), key);
23 }
24
25 pub(crate) fn get(&self, kid: &str) -> Option<&DecodingKey> {
26 self.keys.get(kid)
27 }
28}
29
30impl Default for KeySet {
31 fn default() -> Self {
32 Self::new()
33 }
34}