Closed RByers closed 1 month ago
For passkeys and WebAuthn, we typically recommend:
if ( typeof window.PublicKeyCredential !== 'undefined' ) {
// do stuff
}
I vaguely remember there being a reason why we didn't use in
, but I'm blanking on it.
@RByers you can probably steal this updated example: https://digitalcredentials.dev/docs/verifier-site/requesting-cred/
SGTM, happy to incorporate something like this into the explainer. Putting on my queue for now, but also happy for someone else to grab it if they get to it before me.
Now that we're back to using
navigator.credentials
, our simple feature detection mechanism ofif ('identity' in navigator)
won't work. Presumably we'd recommendif ('DigitalCredential' in window)
instead, right? Perhaps we should add this to the example in the explainer to make it clear?I know of one developer who wasn't sure how best to feature-detect our origin trial and so instead looked for a Chrome Android UA string with Chrome version >= 128. Obviously that's not what we want people doing since the API will become available on other browsers too. Our examples should document our best-practice recommendations.