-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow also async Hasher functions #147
Comments
See also #132 (review) Main reason indeed is refactor work and If I remember correctly you would also have to decode the SD-JWT yourself when using async. I am not really happy about the asymmetry introduced between sync and async. Not sure if that is something which has been addressed in newer versions of the sd-jwt libs. IMO it should be solved there, instead of introducing asymmetry for the outside world. But to be honest, I haven't looked too much into the SD-JWT lib anyway, so I am currently not the best person to judge/comment ;) |
Right now it's mentioned that you need to decode itself when you want to use an async function. As far as I know it's not possible when you once had an async call (e.g. the hash function), to wrap it in a sync call. So we not not implement the sd-jwt lib have 100% apis, otherwise it would block the JS thread and slow down a website |
I'm fine with updating PEX to use an async hasher as well. I just didn't want to introduce this very big breaking change to the whole API of this library. There's quite some usefulness in having some of these methods sync, and it would mean all methods in this library will become async. That's why we decided to allow both in SD-JWT (in the lower level methods). The top-level API in our sd-jwt implementation is all async, but the lower level utility types work both sync and async. |
[ ] bug report
[X] feature request
[X] question about the decisions made in the repository
[ ] question about how to use this project
Right now the hasher function has to be async which is fine in environments like NodeJS where the native
crypto
API provides a sync call. Unfortunately this is not the case browser based environments where the webcrypto only offers async calls for non blocking execution. Therefor I would propose to change the hasher type from onlyHasher
to ´Hasher | AsyncHasher`. This requires updates to the PEX library and also to the ssi-types.Are there any reasons to stay with an only sync call beside the requirement of refactoring?
The text was updated successfully, but these errors were encountered: