Skip to content

Commit

Permalink
chore: rename to RevocationStatusList
Browse files Browse the repository at this point in the history
  • Loading branch information
whalelephant committed Jan 6, 2023
1 parent 1577d79 commit 3c650af
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
16 changes: 8 additions & 8 deletions anoncreds/src/data_types/anoncreds/rev_reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct RevocationRegistryDeltaV1 {

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RevocationList {
pub struct RevocationStatusList {
rev_reg_id: RevocationRegistryId,
#[serde(with = "serde_revocation_list")]
revocation_list: bitvec::vec::BitVec,
Expand All @@ -64,13 +64,13 @@ pub struct RevocationList {
timestamp: u64,
}

impl From<&RevocationList> for ursa::cl::RevocationRegistry {
fn from(rev_reg_list: &RevocationList) -> ursa::cl::RevocationRegistry {
impl From<&RevocationStatusList> for ursa::cl::RevocationRegistry {
fn from(rev_reg_list: &RevocationStatusList) -> ursa::cl::RevocationRegistry {
rev_reg_list.registry.clone()
}
}

impl RevocationList {
impl RevocationStatusList {
pub(crate) fn timestamp(&self) -> u64 {
self.timestamp
}
Expand All @@ -89,7 +89,7 @@ impl RevocationList {
registry: ursa::cl::RevocationRegistry,
timestamp: u64,
) -> Result<Self, error::Error> {
Ok(RevocationList {
Ok(RevocationStatusList {
rev_reg_id: RevocationRegistryId::new(rev_reg_id)?,
revocation_list,
registry,
Expand Down Expand Up @@ -165,16 +165,16 @@ mod tests {

#[test]
fn json_rev_list_can_be_deserialized() {
let des = serde_json::from_str::<RevocationList>(REVOCATION_LIST).unwrap();
let des = serde_json::from_str::<RevocationStatusList>(REVOCATION_LIST).unwrap();
let expected_state = bitvec![1;4];
assert_eq!(des.state(), &expected_state);
}

#[test]
fn test_revocation_list_roundtrip_serde() {
let des_from_json = serde_json::from_str::<RevocationList>(REVOCATION_LIST).unwrap();
let des_from_json = serde_json::from_str::<RevocationStatusList>(REVOCATION_LIST).unwrap();
let ser = serde_json::to_string(&des_from_json).unwrap();
let des = serde_json::from_str::<RevocationList>(&ser).unwrap();
let des = serde_json::from_str::<RevocationStatusList>(&ser).unwrap();
let ser2 = serde_json::to_string(&des).unwrap();
assert_eq!(ser, ser2)
}
Expand Down
7 changes: 4 additions & 3 deletions anoncreds/src/ffi/revocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ use crate::services::{
prover::create_or_update_revocation_state,
tails::{TailsFileReader, TailsFileWriter},
types::{
CredentialRevocationState, IssuanceType, RegistryType, RevocationList, RevocationRegistry,
CredentialRevocationState, IssuanceType, RegistryType, RevocationRegistry,
RevocationRegistryDefinition, RevocationRegistryDefinitionPrivate, RevocationRegistryDelta,
RevocationStatusList,
},
};

Expand Down Expand Up @@ -239,8 +240,8 @@ impl_anoncreds_object_from_json!(
anoncreds_revocation_registry_delta_from_json
);

impl_anoncreds_object!(RevocationList, "RevocationList");
impl_anoncreds_object_from_json!(RevocationList, anoncreds_revocation_list_from_json);
impl_anoncreds_object!(RevocationStatusList, "RevocationStatusList");
impl_anoncreds_object_from_json!(RevocationStatusList, anoncreds_revocation_list_from_json);

#[no_mangle]
pub extern "C" fn anoncreds_create_or_update_revocation_state(
Expand Down
6 changes: 3 additions & 3 deletions anoncreds/src/services/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::data_types::anoncreds::{
AttributeValue, Identifier, RequestedProof, RevealedAttributeGroupInfo,
RevealedAttributeInfo, SubProofReferent,
},
rev_reg::RevocationList,
rev_reg::RevocationStatusList,
schema::{Schema, SchemaId},
};
use crate::error::{Error, Result};
Expand Down Expand Up @@ -254,10 +254,10 @@ pub fn create_presentation(
pub fn create_or_update_revocation_state(
tails_reader: TailsReader,
revoc_reg_def: &RevocationRegistryDefinition,
rev_reg_list: &RevocationList,
rev_reg_list: &RevocationStatusList,
rev_reg_idx: u32,
rev_state: Option<&CredentialRevocationState>, // for witness update
old_rev_reg_list: Option<&RevocationList>, // for witness update
old_rev_reg_list: Option<&RevocationStatusList>, // for witness update
) -> Result<CredentialRevocationState> {
trace!(
"create_or_update_revocation_state >>> , tails_reader: {:?}, revoc_reg_def: {:?}, \
Expand Down
2 changes: 1 addition & 1 deletion anoncreds/src/services/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use crate::data_types::anoncreds::{
master_secret::MasterSecret,
pres_request::PresentationRequest,
presentation::Presentation,
rev_reg::{RevocationList, RevocationRegistry, RevocationRegistryDelta},
rev_reg::{RevocationRegistry, RevocationRegistryDelta, RevocationStatusList},
rev_reg_def::{
IssuanceType, RegistryType, RevocationRegistryDefinition,
RevocationRegistryDefinitionPrivate,
Expand Down
4 changes: 2 additions & 2 deletions anoncreds/tests/anoncreds_demos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use anoncreds::{
types::{
CredentialDefinitionConfig, CredentialRevocationConfig, CredentialRevocationState,
IssuanceType, MakeCredentialValues, PresentCredentials, PresentationRequest, RegistryType,
RevocationList, RevocationRegistry, RevocationRegistryDefinition, SignatureType,
RevocationRegistry, RevocationRegistryDefinition, RevocationStatusList, SignatureType,
},
verifier,
};
Expand Down Expand Up @@ -469,7 +469,7 @@ fn anoncreds_with_revocation_works_for_single_issuer_single_prover() {
};

let revocation_list =
RevocationList::new(REV_REG_ID, list, ursa_rev_reg, prover_timestamp).unwrap();
RevocationStatusList::new(REV_REG_ID, list, ursa_rev_reg, prover_timestamp).unwrap();
let new_rev_state = prover::create_or_update_revocation_state(
tr,
&rev_reg_def_pub,
Expand Down

0 comments on commit 3c650af

Please sign in to comment.