passwordless-id / webauthn

Webauthn / passkeys helper library to make your life easier. Client side, server side and demo included.
https://webauthn.passwordless.id
MIT License
436 stars 51 forks source link

crypto.randomUUID is not a function #74

Closed baoweili closed 1 week ago

baoweili commented 2 weeks ago

When I use iPhone 13 iOS 14, an error occurs: crypto.randomUUID is not a function. The code is as follows: const registration = await client.register({ user: username, challenge, hints: ['client-device'] });

@passwordless-id/webauthn version is 2.1.0

dagnelies commented 2 weeks ago

You need HTTPS or localhost for randomUUID to be available. Is it possible you are doing that over an unsecured connection?

dagnelies commented 2 weeks ago

Alternatively, you can specify the user id directly :

const registration = await client.register({ user: {id:'some-anonymous-id', name:username}, challenge, hints: ['client-device'] });

Please note that the user "id" should be anonymous as it can be exposed by the authenticator without user verification. In plain english, if you find a security key laying on the ground, you might be able to list the user ids present on it (but not the names).

dagnelies commented 1 week ago

@baoweili solved?