Description
First off thanks for the work on this library, I can see a lot of thought has gone into it and the tools around it.
I have a question regarding the username
parameter when registering on the client, specifically this line.
// ID should not be directly "identifiable" for privacy concerns
id: await utils.sha256(new TextEncoder().encode(username))
https://github.com/passwordless-id/webauthn/blob/main/src/client.ts#L84
A plain client side sha256
would still be seen as PII as no secret salt was included from the server. I double checked the spec after seeing this and it confirmed it.
Relying Party MUST NOT include personally identifying information, e.g., e-mail addresses or usernames, in the user handle. This includes hash values of personally identifying information, unless the hash function is salted with salt values private to the Relying Party, since hashing does not prevent probing for guessable input values.
https://w3c.github.io/webauthn/#sctn-user-handle-privacy
If I'm correct and not misread your code, then I believe you'll need to open up the registration to allow provision of the handle + the PII (displayName, name) separately, and make it clear the handle must not be a raw username or similar.
You may want to let user's of the library know this issue as PII could possibly be leaked (may need GDPR disclosures for those businesses?) so would need clients to re-register customer passkeys? I'm not entirely sure the flows there, still getting to grips with those.