Skip to content

Commit

Permalink
revocation feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Jan 16, 2024
1 parent 19d4aad commit 311bbb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions identity_credential/src/credential/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use serde::Serialize;
use identity_core::common::Object;
use identity_core::common::Url;

#[cfg(feature = "revocation-bitmap")]
use crate::revocation::status_list_2021::StatusList2021Entry;

/// Credential status interface
Expand All @@ -24,6 +25,7 @@ pub trait CredentialStatus {
#[serde(untagged)]
pub enum Status<T = Object> {
/// CredentialStatus using [`StatusList2021Entry`]
#[cfg(feature = "revocation-bitmap")]
StatusList2021(StatusList2021Entry),
/// Any other status
Other(CustomStatus<T>),
Expand All @@ -35,6 +37,7 @@ impl<T> From<CustomStatus<T>> for Status<T> {
}
}

#[cfg(feature = "revocation-bitmap")]
impl<T> From<StatusList2021Entry> for Status<T> {
fn from(value: StatusList2021Entry) -> Self {
Status::StatusList2021(value)
Expand All @@ -44,12 +47,14 @@ impl<T> From<StatusList2021Entry> for Status<T> {
impl CredentialStatus for Status {
fn id(&self) -> &Url {
match self {
#[cfg(feature = "revocation-bitmap")]
Self::StatusList2021(s) => s.id(),
Self::Other(s) => s.id(),
}
}
fn r#type(&self) -> &str {
match self {
#[cfg(feature = "revocation-bitmap")]
Self::StatusList2021(s) => s.r#type(),
Self::Other(s) => s.r#type(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use super::SignerContext;
use crate::credential::Credential;
use crate::credential::CredentialJwtClaims;
use crate::credential::Jwt;
#[cfg(feature = "revocation-bitmap")]
use crate::revocation::status_list_2021::StatusList2021Credential;
#[cfg(feature = "revocation-bitmap")]
use crate::revocation::status_list_2021::StatusPurpose;
use crate::validator::SubjectHolderRelationship;

Expand Down Expand Up @@ -86,6 +88,7 @@ impl JwtCredentialValidatorUtils {
/// Checks whether the status specified in `credentialStatus` has been set by the issuer
///
/// Only supports `StatusList2021`
#[cfg(feature = "revocation-bitmap")]
pub fn check_status_with_status_list_2021<T>(
credential: &Credential<T>,
status_list_credential: &StatusList2021Credential,
Expand Down

0 comments on commit 311bbb5

Please sign in to comment.