Skip to content

Commit

Permalink
Merge pull request #122 from wwWallet/authenticator-prf-incompat
Browse files Browse the repository at this point in the history
Add error message if authenticator does not support PRF
  • Loading branch information
pstamatop committed Nov 29, 2023
2 parents 3bbb2e9 + 356ea28 commit 9d5cbc3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
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

0 comments on commit 9d5cbc3

Please sign in to comment.