walt-id / waltid-identity

All-in-one open-source identity and wallet toolkit.
Apache License 2.0
114 stars 41 forks source link

Simplify the <issuer>/raw/jwt/sign example #386

Open alegomes opened 3 months ago

alegomes commented 3 months ago

The endpoint /raw/jwt/sign requires 2 parameters walt-key and walt-subjectDid

If passed incorrectly, the endpoint returns unexplained messages, such as:

{"exception":"true","status":"Bad Request","code":"400","message":"Expected class kotlinx.serialization.json.JsonObject as the serialized body of kotlinx.serialization.Polymorphic<Key>, but had class kotlinx.serialization.json.JsonLiteral"}

If we were follow our intuition, we would use the /wallet-api/wallet/{wallet}/keys/generate and /wallet-api/wallet/{wallet}/dids/create/key endpoints to get the missing data.

However, two things make life difficult for the developer here:

  1. The key generation endpoint, for example, returns in such a format that is not accepted out of the box by the walt-key parameter.

  2. If the user manage to generate the key in the expected JWK format (e.g. XXXXXX), he tends to use the key in its raw form in the walt-key field instead of wrapping it as {"type":"local","jwk":"XXXX"}

How can we make this endpoint testing experience more intuitive and less laborious?

github-actions[bot] commented 1 month ago

This issue has been marked as stale.