w3c / vc-data-model

W3C Verifiable Credentials Working Group — VC Data Model and Representations specification
https://w3c.github.io/vc-data-model/
Other
283 stars 98 forks source link

Pin down the input type of securing mechanisms #1517

Open jyasskin opened 4 days ago

jyasskin commented 4 days ago

https://w3c.github.io/vc-data-model/#securing-mechanism-specifications says

A securing mechanism's verification algorithm MUST provide an interface that receives inputs of a media type (string inputMediaType) paired with either a sequence of bytes (byte sequence inputBytes) or a document (map inputDocument)

Does this require that the securing mechanisms accept whichever of byte-sequence or map their caller wants to provide, or does it require the caller to send whichever the securing mechanism prefers? If the latter, how does the caller figure out which one the mechanism prefers, since that's not included in the associated registry?

msporny commented 3 days ago

It's the latter, and the presumption here is that human readable documentation for the cryptosuite library clearly defines what input types it supports. I could add a comment to that effect (and try to figure out how to align the input options so they're used in the algorithms), but at this point, I'm questioning if we should just say that it's up to the library author to pick one or both and understanding what the library supports is implementation specific and requires the implementer to read the library documentation?

Thoughts on what you'd prefer here, @jyasskin?

jyasskin commented 2 days ago

If you handle #1518 by parsing to an Infra map early, then I think it's easiest to have the securing specs take that map. Otherwise, you could have the call sites in this spec include something like "if the securing mechanism expects bytes, pass theBytes, otherwise pass the result of [=parsing JSON bytes to an Infra value=] given theBytes".