refactor(kms): share a KMS client for all KMS operations (#744)

This commit is contained in:
Sanchith Hegde
2023-03-15 21:53:38 +05:30
committed by GitHub
parent 5c9bec9f53
commit a3ff2e8d4f
14 changed files with 347 additions and 306 deletions

View File

@ -55,9 +55,12 @@ where
let api_key = api_keys::PlaintextApiKey::from(api_key);
let hash_key = {
let config = state.conf();
api_keys::HASH_KEY
.get_or_try_init(|| api_keys::get_hash_key(&config.api_keys))
.await?
api_keys::get_hash_key(
&config.api_keys,
#[cfg(feature = "kms")]
&config.kms,
)
.await?
};
let hashed_api_key = api_key.keyed_hash(hash_key.peek());