Skip to content
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

refactor: only issuer id for legacy->w3c #320

Merged
merged 5 commits into from
Feb 6, 2024
Merged

Conversation

TimoGlastra
Copy link
Member

We were running into some issues when needing to transform between legacy -> w3c anoncreds as the method requires the cred_def to be passed. It seems the cred_def is only required for the issuer_id, and this PR updates it to only require a string issuer_id rather than the whole cred def.

In our case we know the issuer_id, but we'd have to resolve the cred_def from the ledger

Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Timo Glastra <timo@animo.id>
@@ -148,8 +149,8 @@ pub extern "C" fn anoncreds_credential_to_w3c(
None => None,
};

let w3c_credential =
credential_to_w3c(credential, cred_def.load()?.cast_ref()?, w3c_version)?;
let issuer_id = IssuerId::new(issuer_id).expect("Invalid issuer ID");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a rust expert. Is this validated and handled correctly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If new returns an error it will panic. You can use ? instead to not panic but pass along the error back over ffi.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will update

Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Timo Glastra <timo@animo.id>
@TimoGlastra TimoGlastra merged commit c12eb3c into main Feb 6, 2024
26 checks passed
@TimoGlastra TimoGlastra deleted the refactor/only-issuer-id branch February 6, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants