node.jswebauthnpassword-less

Webauthn - Windows Hello authenticatorSelection is not working


I am just developing a sample node js application to play around webauthn on Windows 10.

        challenge: challenge,
        rp: {
            name: "Example CORP",
            id  : "localhost"
        },
        user: {
            id: new Uint8Array(16),
            name: "jdoe@example.com",
            displayName: "John Doe"
        },
        pubKeyCredParams: [
            {
            type: "public-key",
            alg: -7
            }
        ],authenticatorSelection: {
            authenticatorAttachment: "platform" //cross-platform is working fine
        },
        timeout: 60000
        };
        const credential = navigator.credentials.create({
            publicKey: publicKey 
        });

I do get back the following error and I am not seeing any modal window of Windows Hello.

login:32 publicKey.authenticatorSelection.userVerification was not set to any value in Web Authentication navigator.credentials.create() call. This defaults to 'preferred', which is probably not what you want. If in doubt, set to 'discouraged'. See https://chromium.googlesource.com/chromium/src/+/master/content/browser/webauth/uv_preferred.md for details

Are there any additional params I am missing ?

-- Siva


Solution

  • You didn't define userVerification property in the authenticatorSelection object.

    from the W3.org:

    Let userVerification be the effective user verification requirement for the assertion:

    is set to required Let userVerification be true.

    is set to discouraged Let userVerification be false.

    is set to preferred If the authenticator is capable of user verification Let userVerification be true. if the authenticator not capable of user verification Let userVerification be false.

    authenticatorSelection: {
      authenticatorAttachment: "platform",
      userVerification: "required" 
    },