hyperledger / anoncreds-rs

anoncreds-rs
https://wiki.hyperledger.org/display/anoncreds
Apache License 2.0
74 stars 55 forks source link

Initially created W3cCredential uses string for number values #321

Closed TimoGlastra closed 9 months ago

TimoGlastra commented 9 months ago

When I create a W3c credential using AnonCreds RS and directly transform it into JSON, I get back the credentialSubject with string values for numbers (so "height": "175").

However if i now convert the credential to legacy and back to w3c format if I now encode it to json again it will set number values as numbers (so "height": 175).

305 addressed supporting numbers, but I thin there may be a bug in the initial credential creation where values are not set as number

@Artemkaaas any idea where this should be fixed?

I can now work around it by doing create_w3c -> to_legacy -> to_w3c but that's a bit of overhead of course

TimoGlastra commented 9 months ago

FYI @2mau not sure if you're running into issues with this?

Artemkaaas commented 9 months ago

@TimoGlastra were you able to reproduce it in rust? I updated demo test to print credential as JSON and see that number values are represented as expected.

TimoGlastra commented 9 months ago

were you able to reproduce it in rust?

No I only did it in the JS wrapper, I'm not really experienced with Rust 🙈

But it seems to be if you call toJson before calling credential.process

So in FFI calls it'd be: