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

Add error message if authenticator does not support PRF #122

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ type SignupWebauthnError = (
| 'passkeySignupFailedTryAgain'
| 'passkeySignupFinishFailedServerError'
| 'passkeySignupKeystoreFailed'
| 'passkeySignupPrfNotSupported'
| { errorId: 'prfRetryFailed', retryFrom: SignupWebauthnRetryParams }
);
type SignupWebauthnRetryParams = { beginData: any, credential: PublicKeyCredential };
Expand Down Expand Up @@ -357,6 +358,8 @@ export async function signupWebauthn(
} catch (e) {
if (e?.errorId === "prf_retry_failed") {
return Err({ errorId: 'prfRetryFailed', retryFrom: { credential, beginData } });
} else if (e?.errorId === "prf_not_supported") {
return Err('passkeySignupPrfNotSupported');
} else {
return Err('passkeySignupKeystoreFailed');
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"passkeySignupFailedTryAgain": "Passkey creation failed, please try again.",
"passkeySignupFinishFailedServerError": "Failed to finalize passkey creation, please try again later.",
"passkeySignupKeystoreFailed": "Failed to initialize wallet key store, please try again.",
"passkeySignupPrfNotSupported": "This browser or security key is not supported. Please make sure that your browser supports the WebAuthn PRF extension and your security key, if any, supports the \"hmac-secret\" extension. <docLink>Learn more here</docLink>.",
"passwordLabel": "Password",
"passwordLength": "Minimum length: 8 characters",
"passwordsNotMatchError": "Passwords do not match",
Expand Down
14 changes: 14 additions & 0 deletions src/pages/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ const WebauthnSignupLogin = ({
setError(t('passkeySignupKeystoreFailed'));
break;

case 'passkeySignupPrfNotSupported':
setError(
<Trans
i18nKey ="passkeySignupPrfNotSupported"
components={{
docLink: <a
href="https://github.com/wwWallet/wallet-frontend#prf-compatibility" target='blank_'
className="font-medium text-custom-blue hover:underline dark:text-blue-500"
/>
}}
/>
);
break;

default:
if (result.val?.errorId === 'prfRetryFailed') {
setRetrySignupFrom(result.val?.retryFrom);
Expand Down