generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cred status list impl * update * lint and bind * update to bindings and kt code * lint * remove comments * lint * Update crates/web5/src/credentials/mod.rs Co-authored-by: Diane Huxley <[email protected]> * nits and updates * Add base vc to status list credential --------- Co-authored-by: Diane Huxley <[email protected]> Co-authored-by: Kendall Weihe <[email protected]>
- Loading branch information
1 parent
b07b7ed
commit c63823e
Showing
18 changed files
with
1,202 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod presentation_definition; | ||
pub mod status_list_credential; | ||
pub mod verifiable_credential_1_1; |
43 changes: 43 additions & 0 deletions
43
bindings/web5_uniffi_wrapper/src/credentials/status_list_credential.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use crate::credentials::verifiable_credential_1_1::VerifiableCredential; | ||
use crate::errors::Result; | ||
use std::sync::Arc; | ||
use web5::credentials::Issuer; | ||
use web5::{ | ||
credentials::verifiable_credential_1_1::VerifiableCredential as InnerVerifiableCredential, | ||
credentials::StatusListCredential as InnerStatusListCredential, json::FromJson, | ||
}; | ||
|
||
pub struct StatusListCredential(pub InnerStatusListCredential); | ||
|
||
impl StatusListCredential { | ||
pub fn create( | ||
json_serialized_issuer: String, | ||
status_purpose: String, | ||
credentials_to_disable: Option<Vec<Arc<VerifiableCredential>>>, | ||
) -> Result<Self> { | ||
let issuer = Issuer::from_json_string(&json_serialized_issuer)?; | ||
|
||
let inner_vcs: Option<Vec<InnerVerifiableCredential>> = | ||
credentials_to_disable.map(|credentials| { | ||
credentials | ||
.into_iter() | ||
.map(|vc| vc.inner_vc.clone()) | ||
.collect() | ||
}); | ||
|
||
Ok(Self(InnerStatusListCredential::create( | ||
issuer, | ||
status_purpose, | ||
inner_vcs, | ||
)?)) | ||
} | ||
|
||
pub fn get_base(&self) -> Result<Arc<VerifiableCredential>> { | ||
let vc = VerifiableCredential::from_inner(&self.0.base)?; | ||
Ok(Arc::new(vc)) | ||
} | ||
|
||
pub fn is_disabled(&self, credential: Arc<VerifiableCredential>) -> Result<bool> { | ||
Ok(self.0.is_disabled(&credential.inner_vc.clone())?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.