sd-jwt-js icon indicating copy to clipboard operation
sd-jwt-js copied to clipboard

Support JWS JSON Serialization

Open lukasjhan opened this issue 1 year ago • 4 comments

In sd-jwt draft 09 section 9, JSON Serialization method is added. Let's support this feature in our library

lukasjhan avatar Jun 15 '24 14:06 lukasjhan

There are two kinds of serialization, flatten and general.

I was thinking about adding the converting function between:

  • SD-JWT <=> JWS flatten serialization
  • SD-JWT <=> JWS general serialization

What do you think about it? @cre8

lukasjhan avatar Aug 18 '24 22:08 lukasjhan

That does not make so much sense: A generalised Json serialisation can have multiple issuer signatures (required for jades signature). So we can not transfer from this to compact when there are more than one. With flattened it should be possible.

I started the implementation that you pass the issuance function a value what kind of type do you want and the return value is based on this.

Then we need to update the decode function and verify so the three options can be consumed. The default one should be compact to not break any existing implementations

cre8 avatar Aug 19 '24 05:08 cre8

Yeah, you're right. A generalised Json serialisation can have multiple signatures. So there is a possibility that it cannot be converted to a compact one.

I think it's better to approach it the way you said. :)

lukasjhan avatar Aug 19 '24 11:08 lukasjhan

I have implemented it for the issuance, but decoding and tests are missing. Maybe I am able to create a pr until Friday

cre8 avatar Aug 19 '24 21:08 cre8

To prevent too many changes to the internal implementation, I'm considering creating a new class for JWS JSON-related functions.

lukasjhan avatar Oct 17 '24 02:10 lukasjhan

I don't think that is possible, see my current PR. The jwt object needs to hold multiple signatures, so we need to touch some of the core classes

cre8 avatar Oct 17 '24 05:10 cre8

@lukasjhan I think we can close this issue since it was added with your pr, correct?

cre8 avatar Dec 10 '24 07:12 cre8

Yes, we can close this.

lukasjhan avatar Dec 10 '24 07:12 lukasjhan