Skip to content

Commit

Permalink
change error name, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Jan 26, 2024
1 parent 1c0a167 commit 33670b6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub enum StatusList2021CredentialError {
Unreferenceable,
/// Credentials cannot be unrevoked.
#[error("A previously revoked credential cannot be unrevoked.")]
UnrevocableCredential,
UnreversibleRevocation,
}

use crate::credential::Credential;
Expand Down Expand Up @@ -148,7 +148,7 @@ impl StatusList2021Credential {
let mut status_list = self.status_list()?;
let entry_status = status_list.get(index)?;
if self.purpose() == StatusPurpose::Revocation && !value && entry_status {
return Err(StatusList2021CredentialError::UnrevocableCredential);
return Err(StatusList2021CredentialError::UnreversibleRevocation);
}
status_list.set(index, value)?;
self.subject.encoded_list = status_list.into_encoded_str();
Expand Down Expand Up @@ -429,7 +429,7 @@ mod tests {
status_list_credential.set_entry(420, true).unwrap();
assert_eq!(
status_list_credential.set_entry(420, false),
Err(StatusList2021CredentialError::UnrevocableCredential)
Err(StatusList2021CredentialError::UnreversibleRevocation)
);
}
#[test]
Expand All @@ -443,5 +443,7 @@ mod tests {
.unwrap();

assert!(status_list_credential.set_entry(420, false).is_ok());
status_list_credential.set_entry(420, true).unwrap();
assert!(status_list_credential.set_entry(420, false).is_ok());
}
}

0 comments on commit 33670b6

Please sign in to comment.