-
Notifications
You must be signed in to change notification settings - Fork 7
Fix/anoncreds w3c ios build #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cbbathaglini
wants to merge
5
commits into
LF-Decentralized-Trust-labs:main
Choose a base branch
from
cbbathaglini:fix/anoncreds-w3c-ios-build
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cafcaef
feat: add anoncreds W3C processing and fix iOS builds
cbbathaglini 74aa6e3
fix: update anoncreds W3C wrappers
cbbathaglini 4dba536
fix: align Swift tests and publishing config
cbbathaglini a2202d9
fix: keep android native libs 16kb compatible
cbbathaglini 77acd20
fix: align anoncreds build.gradle.kts with askar and indy-vdr patterns
cbbathaglini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 +1,5 @@ | ||
| .DS_Store | ||
| ._* | ||
| /.build | ||
| /Packages | ||
| /*.xcodeproj | ||
|
|
@@ -8,4 +9,4 @@ DerivedData/ | |
| .netrc | ||
| target/ | ||
| out/ | ||
| .kotlin | ||
| .kotlin | ||
This file contains hidden or 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 hidden or 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 hidden or 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,13 +1,15 @@ | ||
| mod uffi; | ||
| use uffi::credential_conversions::CredentialConversions; | ||
| use uffi::issuer::Issuer; | ||
| use uffi::prover::Prover; | ||
| use uffi::types::{ | ||
| Credential, CredentialDefinition, CredentialDefinitionPrivate, CredentialKeyCorrectnessProof, | ||
| CredentialOffer, CredentialRequest, CredentialRequestMetadata, CredentialRevocationState, | ||
| Presentation, PresentationRequest, RevocationRegistryDefinition, | ||
| RevocationRegistryDefinitionPrivate, RevocationRegistryDelta, RevocationStatusList, Schema, | ||
| W3CCredential, | ||
| }; | ||
| use uffi::verifier::Verifier; | ||
| use uffi::credential_conversions::CredentialConversions; | ||
| use uffi::w3c::W3cProcess; | ||
|
|
||
| uniffi::include_scaffolding!("anoncreds_uniffi"); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 super::error::ErrorCode; | ||
| use super::types::{ | ||
| CredentialDefinition, CredentialRequestMetadata, RevocationRegistryDefinition, W3CCredential, | ||
| }; | ||
|
|
||
| use anoncreds::types::LinkSecret; | ||
| use anoncreds::Error; | ||
| use std::sync::Arc; | ||
|
|
||
| pub struct W3cProcess {} | ||
|
|
||
| impl W3cProcess { | ||
| pub fn new() -> Self { | ||
| Self {} | ||
| } | ||
| } | ||
|
|
||
| #[uniffi::export] | ||
| impl W3cProcess { | ||
| pub fn process_credential( | ||
| &self, | ||
| cred: Arc<W3CCredential>, | ||
| cred_req_metadata: Arc<CredentialRequestMetadata>, | ||
| link_secret: String, | ||
| cred_def: Arc<CredentialDefinition>, | ||
| rev_reg_def: Option<Arc<RevocationRegistryDefinition>>, | ||
| ) -> Result<Arc<W3CCredential>, ErrorCode> { | ||
| let link_secret = | ||
| LinkSecret::try_from(link_secret.as_str()).map_err(|err| Error::from(err))?; | ||
| let rev_reg_def = rev_reg_def.as_ref().map(|def| &def.0); | ||
| let mut new_cred = cred.0.clone(); | ||
|
|
||
| anoncreds::w3c::prover::process_credential( | ||
| &mut new_cred, | ||
| &cred_req_metadata.0, | ||
| &link_secret, | ||
| &cred_def.0, | ||
| rev_reg_def, | ||
| )?; | ||
|
|
||
| Ok(Arc::new(W3CCredential(new_cred))) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't these changes break the 16kb page requirement for Google play?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheTreek
Thank you for the review! That's a valid concern. At the time of your comment (commit 4dba536), the anoncreds build.gradle.kts did not have the RUSTFLAGS for 16KB page size — you were right to call that out.
In the latest commits (f877234 and 10638f9/77acd20), we've addressed this:
The final result is that anoncreds now has the same Android build configuration as askar and indy-vdr, including the 16KB page size compatibility. No regression was introduced.