openwallet-foundation-labs / sd-jwt-js

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

Some of features in decode, present package change the input object. #163

Closed lukasjhan closed 5 months ago

lukasjhan commented 6 months ago

What I found out while implementing PEX is that there are functions that directly modify objects received as input. I think this will confuse users, so I think I'll have to copy the object internally and use it.

I proposed:

selectDisclosures in @sd-jwt/present

unpack, unpackSync, unpackObj and unpackArray in @sd-jwt/decode

lukasjhan commented 6 months ago

@cre8 What do you think about it? If you think it's good, I'll make a PR today :)

cre8 commented 6 months ago

@lukasjhan I think this is a good idea to avoid side effects.