From c76c8e5b4cf89fc6e8d59892d69f67770e022e5d Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Tue, 7 May 2024 13:48:55 +0200 Subject: [PATCH] credential import --- common/nym-id/src/import_credential.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/common/nym-id/src/import_credential.rs b/common/nym-id/src/import_credential.rs index f5058dfe2a..97159372f9 100644 --- a/common/nym-id/src/import_credential.rs +++ b/common/nym-id/src/import_credential.rs @@ -4,7 +4,6 @@ use crate::NymIdError; use nym_credential_storage::models::StorableIssuedCredential; use nym_credential_storage::storage::Storage; -use nym_credentials::coconut::bandwidth::issued::BandwidthCredentialIssuedDataVariant; use nym_credentials::IssuedBandwidthCredential; use tracing::{debug, warn}; use zeroize::Zeroizing; @@ -28,22 +27,18 @@ where "attempting to import credential of type {}", credential.typ() ); + debug!( + "with expiration date at {}", + credential.expiration_date_formatted() + ); - match credential.variant_data() { - BandwidthCredentialIssuedDataVariant::Voucher(voucher_info) => { - debug!("with value of {}", voucher_info.value()) - } - BandwidthCredentialIssuedDataVariant::FreePass(freepass_info) => { - debug!("with expiry at {}", freepass_info.expiry_date()); - if freepass_info.expired() { - warn!("the free pass has already expired!"); + if credential.expired() { + warn!("the credential has already expired!"); - // technically we can import it, but the gateway will just reject it so what's the point - return Err(NymIdError::ExpiredCredentialImport { - expiration: freepass_info.expiry_date(), - }); - } - } + // technically we can import it, but the gateway will just reject it so what's the point + return Err(NymIdError::ExpiredCredentialImport { + expiration: credential.expiration_date_formatted(), + }); } // SAFETY: