SimpleWebAuthn: Error in verifyAttestationResponse when using apple format and FaceID/TouchID sometimes not showing up
There is an error thrown in verifyAssertionOptions when using apple FaceID to solve the attestation request.
Attestation options:
{
challenge: 'VNT_3_E2tFGe4NUoLRdJhsztnVMbI_98Vr3GgMmRVlg',
rp: { name: 'IPS Hosting', id: 'ips-hosting.eu.ngrok.io' },
user: { id: '21', name: 'P4sca1', displayName: 'P4sca1' },
pubKeyCredParams: [
{ alg: -7, type: 'public-key' },
{ alg: -8, type: 'public-key' },
{ alg: -36, type: 'public-key' },
{ alg: -37, type: 'public-key' },
{ alg: -38, type: 'public-key' },
{ alg: -39, type: 'public-key' },
{ alg: -257, type: 'public-key' },
{ alg: -258, type: 'public-key' },
{ alg: -259, type: 'public-key' }
],
timeout: 60000,
attestation: 'direct',
excludeCredentials: [],
authenticatorSelection: { userVerification: 'discouraged' },
extensions: undefined
}
Attestation response (SimpleWebAuthn Debugger link)
{
id: '24qeQ_g9SbjwmEdgagzhrzhN_DI',
rawId: '24qeQ_g9SbjwmEdgagzhrzhN_DI',
response: {
attestationObject: 'o2NmbXRlYXBwbGVnYXR0U3RtdKJjYWxnJmN4NWOCWQJIMIICRDCCAcmgAwIBAgIGAXUUh_QAMAoGCCqGSM49BAMCMEgxHDAaBgNVBAMME0FwcGxlIFdlYkF1dGhuIENBIDExEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwHhcNMjAxMDA5MjIwMDU1WhcNMjAxMDEyMjIwMDU1WjCBkTFJMEcGA1UEAwxANjEyMTQyMmNmNWY1MWNhMWQ4NTIyZDEwZDlhYzY3OGYxZjNjNTRhYjBmZDk5M2ViZWI2NDI3NzY4NDY2NjNhNjEaMBgGA1UECwwRQUFBIENlcnRpZmljYXRpb24xEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQ7qQ-_z-C1n5CYXuYzYNrW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TDBSHhR2WDtanXx60rKvjjNJbiX0MgFvvDH94sHpXHG6A4HaGF1dGhEYXRhWJgBpwTFUgYt_G45iIlHM9dA5ir7lBILi7_AbJl0nYyG-UUAAAAAAAAAAAAAAAAAAAAAAAAAAAAU24qeQ_g9SbjwmEdgagzhrzhN_DKlAQIDJiABIVggO6kPv8_gtZ-QmF7mM2Da1rfTQj6XztouyorIrvuSB8MiWCAhRcDk6RJgiKDb5R2ZwZyni5kyfM0IfOXL9ICO4ijUVg',
clientDataJSON: 'eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiVk5UXzNfRTJ0RkdlNE5Vb0xSZEpoc3p0blZNYklfOThWcjNHZ01tUlZsZyIsIm9yaWdpbiI6Imh0dHBzOi8vaXBzLWhvc3RpbmcuZXUubmdyb2suaW8ifQ'
},
type: 'public-key'
}
Error:
Error: Cannot get schema for 'Certificate' target
at AsnSchemaStorage.get (/Users/pascal/code/ips-hosting/node_modules/@simplewebauthn/server/node_modules/@peculiar/asn1-schema/build/cjs/schema.js:17:19)
at Function.fromASN (/Users/pascal/code/ips-hosting/node_modules/@simplewebauthn/server/node_modules/@peculiar/asn1-schema/build/cjs/parser.js:38:52)
at Function.parse (/Users/pascal/code/ips-hosting/node_modules/@simplewebauthn/server/node_modules/@peculiar/asn1-schema/build/cjs/parser.js:28:26)
at Object.verifyApple [as default] (/Users/pascal/code/ips-hosting/node_modules/@simplewebauthn/server/src/attestation/verifications/verifyApple.ts:40:36)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Object.verifyAttestationResponse (/Users/pascal/code/ips-hosting/node_modules/@simplewebauthn/server/src/attestation/verifyAttestationResponse.ts:198:16)
at Function.verifyAttestationResponse (/Users/pascal/code/ips-hosting/apps/api/src/controllers/auth/two-step-verification/web-authn.ts:72:47)
at /Users/pascal/code/ips-hosting/apps/api/src/router/auth/two-step-verifiation/web-authn.ts:85:24
Also I noticed that you need to start the attestation 2 times to be able to use FaceID. In the first attempt, Safari only asks for a security key. Only when you cancel and restart the attestation, you can select from security key and FaceID. I don`t know whether this is an issue with the attestation options or with Safari.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (17 by maintainers)
For face/touch ID to show up in the dialog, the webauthn create/get methods need to be called in a handler that is user initiated, e.g. in a click handler. If you call these methods automatically (on load) it will only show the security key option.
Sorry, didn’t had time to test this. I will open a new issue if the issue occurs again. Thanks for your effort!
Thanks! Great new docs by the way 😃
Issue 1 should be fixed with the new server@0.10.2 I just published. I went ahead and updated the ASN.1 parsing libraries so everything is using the same version, sub-dependencies included. No one should have to add
"resolutions"to their Yarn projects (for now).Issue 2 will be addressed with an eventual docs update to the homepage.
After hours of debugging @MasterKale and I figured out that the root cause of the issue is using the
yarnpackage manager instead ofnpm. This is because@simplewebauthn/serverrequires@peculiar/asn1-schemaversion 2.0.8 while@peculiar/asn1-x509(which is also a dependency of@simplewebauthn/server) uses version ^2.0.8 (2.0.23 as of now). Those 2 versions seem to be incompatible. Thenpmandyarnresolution algorithms differ in some way that causes this issue. A temporary fix is to add a yarn resolution.So to sum things up
Issue 1 (Error: Cannot get schema for ‘Certificate’ target)
This is a dependency issue when using the
yarnpackage manager. For a temporary fix, add the following to yourpackage.jsonand then runyarn.Issue 2 (FaceID / TouchID not showing up in list)
startAttestationin a native button click listener.Maybe it is worth adding those hints to the docs? @MasterKale
This assumption was wrong. I have set
userVerification: 'discouraged'and it shows FaceID everytime. The issue was that I was using the vue@clickhandler on my button and it seems like Safari was not always considering this as a user action. Changing the listener to@click.nativefixes the issue. Thanks for giving the hint @madwizard-thomas.