WICG / digital-credentials

Digital Credentials, like driver's licenses
https://wicg.github.io/digital-credentials/
Other
76 stars 9 forks source link

Safeguarding devs from potential per-protocol use of Uint8Array values #171

Open MasterKale opened 1 day ago

MasterKale commented 1 day ago

One possible foot gun in the structure of the Digital Credentials API is that instances of DigitalCredentialsProvider (soon DigitalCredentialsRequest) maybe require certain values to be specified as Uint8Array values. Is there anything that can be defined at the navigator.credentials.get({ digital: ... }) level here to help developers treat Uint8Array values exclusively as (Base64url) strings into and out of this .get() call?

My motivation here is to reduce the need to write/pull in a base64url-to-bytes helper when using this API for lack of standard functionality in JavaScript to pull this off. JSON serialization of Uint8Array is awkward. Improvements to Uint8Array to add things like toBase64() and fromBase64() are in Stage 3 and so likely to become available to devs over bespoke helpers, but even when those are available it'd be great to handle most of the back-and-forth automatically if possible for easing adoption.

MasterKale commented 1 day ago

I wonder if this has inadvertently become a dupe of https://github.com/WICG/digital-credentials/issues/125 🤔