diff --git a/bindings/wasm/src/credential/revocation/status_list_2021/entry.rs b/bindings/wasm/src/credential/revocation/status_list_2021/entry.rs index 85ecb2eafe..32194ceade 100644 --- a/bindings/wasm/src/credential/revocation/status_list_2021/entry.rs +++ b/bindings/wasm/src/credential/revocation/status_list_2021/entry.rs @@ -47,8 +47,8 @@ impl WasmStatusList2021Entry { /// Returns the index of this entry. #[wasm_bindgen] - pub fn index(&self) -> usize { - self.0.index() + pub fn index(&self) -> String { + self.0.index().to_string() } /// Returns the referenced {@link StatusList2021Credential}'s url. diff --git a/identity_credential/src/revocation/status_list_2021/credential.rs b/identity_credential/src/revocation/status_list_2021/credential.rs index ed96643cb7..9f6958abf9 100644 --- a/identity_credential/src/revocation/status_list_2021/credential.rs +++ b/identity_credential/src/revocation/status_list_2021/credential.rs @@ -135,6 +135,7 @@ impl StatusList2021Credential { .id() .cloned() .ok_or(StatusList2021CredentialError::Unreferenceable)?; + let entry = StatusList2021Entry::new(id, self.purpose(), index, None); self.set_entry(index, revoked_or_suspended)?; diff --git a/identity_credential/src/revocation/status_list_2021/entry.rs b/identity_credential/src/revocation/status_list_2021/entry.rs index 7eecf2f28e..cd8c583a3a 100644 --- a/identity_credential/src/revocation/status_list_2021/entry.rs +++ b/identity_credential/src/revocation/status_list_2021/entry.rs @@ -45,8 +45,7 @@ pub struct StatusList2021Entry { #[serde(rename = "type", deserialize_with = "deserialize_status_entry_type")] type_: String, status_purpose: StatusPurpose, - #[serde(deserialize_with = "serde_aux::prelude::deserialize_number_from_string")] - status_list_index: usize, + status_list_index: String, status_list_credential: Url, } @@ -79,7 +78,7 @@ impl StatusList2021Entry { type_: CREDENTIAL_STATUS_TYPE.to_owned(), status_purpose: purpose, status_list_credential: status_list, - status_list_index: index, + status_list_index: index.to_string(), } } @@ -94,8 +93,8 @@ impl StatusList2021Entry { } /// Returns the index of this entry. - pub const fn index(&self) -> usize { - self.status_list_index + pub fn index(&self) -> &str { + &self.status_list_index } /// Returns the referenced [`StatusList2021Credential`]'s [`Url`]. diff --git a/identity_credential/src/validator/jwt_credential_validation/jwt_credential_validator_utils.rs b/identity_credential/src/validator/jwt_credential_validation/jwt_credential_validator_utils.rs index d454122c15..c6d989af64 100644 --- a/identity_credential/src/validator/jwt_credential_validation/jwt_credential_validator_utils.rs +++ b/identity_credential/src/validator/jwt_credential_validation/jwt_credential_validator_utils.rs @@ -109,7 +109,7 @@ impl JwtCredentialValidatorUtils { && status.purpose() == status_list_credential.purpose() { let entry_status = status_list_credential - .entry(status.index()) + .entry(status.index().parse().expect("Failed to parse index")) .map_err(|e| JwtValidationError::InvalidStatus(crate::Error::InvalidStatus(e.to_string())))?; match entry_status { CredentialStatus::Revoked => Err(JwtValidationError::Revoked),