Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: expectation did not contain value for 'userHandle' #155

Closed
lilac-milena opened this issue Jan 20, 2024 · 4 comments
Closed

Error: expectation did not contain value for 'userHandle' #155

lilac-milena opened this issue Jan 20, 2024 · 4 comments
Labels

Comments

@lilac-milena
Copy link
Contributor

When I try to call the assertionResult function, I got the following error:
image

Here's some contextual code that may be relevant to the issue:

const assertionExpectations = {
        // Remove the following comment if allowCredentials has been added into authnOptions so the credential received will be validate against allowCredentials array.
        // allowCredentials: [],
        // userVerification: "required",
        challenge: systemFunction.base64ToUint8Array(challenge),
        origin: "https://*",
        factor: "either",
        publicKey: logingAccount["publicKey"],
        prevCounter: logingAccount["counter"]
    };

    

    const keyDataDecoded = {
        rawId: systemFunction.base64ToArrayBuffer(keyData.rawId),
        response: {
            authenticatorData: systemFunction.base64ToArrayBuffer(keyData.response.authenticatorData),
            signature: systemFunction.base64ToArrayBuffer(keyData.response.signature),
            userHandle: systemFunction.base64ToArrayBuffer(keyData.response.userHandle),
            clientDataJSON: systemFunction.base64ToArrayBuffer(keyData.response.clientDataJSON),
        },
        id: keyData.id,
        type: keyData.type,
    }

    //console.log(keyDataDecoded)

    const authnResult = await f2l.assertionResult(keyDataDecoded, assertionExpectations);
const f2l = new Fido2Lib({
    timeout: 42000,
    rpId: "*",
    rpName: "Identity",
    // rpIcon: "https://example.com/logo.png",
    challengeSize: 128,
    attestation: "none",
    cryptoParams: [-7, -257],
    // authenticatorAttachment: "cross-platform",
    authenticatorRequireResidentKey: true,
    requireResidentKey: true,
    userVerification: "required"
    // requireResidentKey: true,
    // authenticatorUserVerification: "required"
});

I've checked my runtime environment, I'm using the Webauthn debugging tool for Chrome to debug, and the debugging tool shows that the "User Handle" parameter is already available
image
image

@JamesCullum
Copy link
Member

Is this related to your PR #154 ?

@lilac-milena
Copy link
Contributor Author

Is this related to your PR #154 ?

No, they're not related, it's a separate issue.

@Jaepe
Copy link

Jaepe commented Jun 5, 2024

In your "assertionExpectations" JSON, include the user's userHandle, which is the user's ID used at signup encoded as base64url.

@lilac-milena
Copy link
Contributor Author

In your "assertionExpectations" JSON, include the user's userHandle, which is the user's ID used at signup encoded as base64url.

Thank you so much for your help, it has helped me a lot, have a great day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants