refactor(api_keys): use a KMS encrypted API key hashing key and remove key ID prefix from plaintext API keys (#639)

Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
Sanchith Hegde
2023-03-05 21:08:48 +05:30
committed by GitHub
parent 7916050450
commit 3a3b33ac17
17 changed files with 262 additions and 105 deletions

View File

@ -1,5 +1,4 @@
use diesel::{AsChangeset, AsExpression, Identifiable, Insertable, Queryable};
use masking::Secret;
use time::PrimitiveDateTime;
use crate::schema::api_keys;
@ -11,7 +10,6 @@ pub struct ApiKey {
pub merchant_id: String,
pub name: String,
pub description: Option<String>,
pub hash_key: Secret<String>,
pub hashed_api_key: HashedApiKey,
pub prefix: String,
pub created_at: PrimitiveDateTime,
@ -26,7 +24,6 @@ pub struct ApiKeyNew {
pub merchant_id: String,
pub name: String,
pub description: Option<String>,
pub hash_key: Secret<String>,
pub hashed_api_key: HashedApiKey,
pub prefix: String,
pub created_at: PrimitiveDateTime,