-
Notifications
You must be signed in to change notification settings - Fork 55
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
Conversation
Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
src/ffi/w3c/credential.rs
Outdated
@@ -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"); |
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.
I'm not a rust expert. Is this validated and handled correctly?
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.
If new returns an error it will panic. You can use ?
instead to not panic but pass along the error back over ffi.
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.
Thanks! Will update
Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
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