openwallet-foundation / sd-jwt-js

A JavaScript implementation of the Selective Disclosure JWT (SD-JWT) spec.
https://sdjwt.js.org/
Apache License 2.0
44 stars 13 forks source link

feat: add jws serialization feature #253

Closed lukasjhan closed 6 days ago

lukasjhan commented 1 week ago

This PR implements new JWS JSON serialization in standard.

Currently, I implemented the converting features. If you want, I can implement issue, present, and verify feature additionally on it. It may have dup code but I think it's quite simple approach for the first version since It doesn't ruin the original code.

Perhaps I did a naive implementation or I might be wrong because I did not know the intended use cases of the standard. If there is anything you would like to point out, please feel free to do so. Thank you :)

cre8 commented 1 week ago

I like that the flattened approach is realized with some extra functions. However for the json format where there are multiple signatures, this approach will not work anymore. So is it good now to add it and later update it or better now? For JADES signatures we will need the generalized approach as object

lukasjhan commented 1 week ago

I like that the flattened approach is realized with some extra functions. However for the json format where there are multiple signatures, this approach will not work anymore. So is it good now to add it and later update it or better now? For JADES signatures we will need the generalized approach as object

Let's add it right away. I'll implement issue, present, verify feature for GeneralJSON to finish my pr :)

lukasjhan commented 1 week ago

@cre8 I added separated instance class for issue, present and verify for generalJSON. If this approach looks good to you, I'll be working on tests and examples :)

cre8 commented 6 days ago

@lukasjhan changes are looking good for me. I would prefer a more object oriented approach (and I think we have some redundancy), but it should be fine for now without a risk of breaking changes

lukasjhan commented 6 days ago

@lukasjhan changes are looking good for me. I would prefer a more object oriented approach (and I think we have some redundancy), but it should be fine for now without a risk of breaking changes

Thank you :) I'm merging this to start working on the examples and tests. Let's reduce redundant code after standard finalized.