Add Sign in with passkey Button (#14577)

* Sign in with passkey (PoC)

* 💄 Added "Login with Passkey" Button

* refactor: Improve error response when WebAuthn challenge fails

* signinResponse should be placed under the SigninWithPasskeyResponse object.

* Frontend fix

* Fix: Rate limiting key for passkey signin

Use specific rate limiting key: 'signin-with-passkey'  for passkey sign-in API to avoid collisions with signin rate-limit.

* Refactor: enhance Passkey sign-in flow and error handling

- Increased the rate limit for Passkey sign-in attempts to accommodate the two API calls needed per sign-in.
- Improved error messages and handling in both the `WebAuthnService` and the `SigninWithPasskeyApiService`, providing more context and better usability.
- Updated error messages to provide more specific and helpful details to the user.

These changes aim to enhance the Passkey sign-in experience by providing more robust error handling, improving security by limiting API calls, and delivering a more user-friendly interface.

* Refactor: Streamline 2FA flow and remove redundant Passkey button.

- Separate the flow of 1FA and 2FA.
- Remove duplicate passkey buttons

* Fix: Add error messages to MkSignin

* chore: Hide passkey button if the entered user does not use passkey login

* Update CHANGELOG.md

* Refactor: Rename functions and Add comments

* Update locales/ja-JP.yml

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>

* Fix: Update translation

- update index.d.ts
- update ko-KR.yml, en-US.yml
- Fix: Reflect Changed i18n key on MkSignin

---------

Co-authored-by: Squarecat-meow <kw7551@gmail.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
Yuri Lee
2024-09-26 08:25:33 +09:00
committed by GitHub
parent fde94f638b
commit d8dd1683c9
12 changed files with 408 additions and 10 deletions

View File

@@ -1160,6 +1160,10 @@ export type Endpoints = Overwrite<Endpoints_2, {
req: SigninRequest;
res: SigninResponse;
};
'signin-with-passkey': {
req: SigninWithPasskeyRequest;
res: SigninWithPasskeyResponse;
};
'admin/roles/create': {
req: Overwrite<AdminRolesCreateRequest, {
policies: PartialRolePolicyOverride;
@@ -1191,6 +1195,8 @@ declare namespace entities {
SignupPendingRequest,
SignupPendingResponse,
SigninRequest,
SigninWithPasskeyRequest,
SigninWithPasskeyResponse,
SigninResponse,
PartialRolePolicyOverride,
EmptyRequest,
@@ -3029,6 +3035,19 @@ type SigninResponse = {
i: string;
};
// @public (undocumented)
type SigninWithPasskeyRequest = {
credential?: object;
context?: string;
};
// @public (undocumented)
type SigninWithPasskeyResponse = {
option?: object;
context?: string;
signinResponse?: SigninResponse;
};
// @public (undocumented)
type SignupPendingRequest = {
code: string;

View File

@@ -5,6 +5,8 @@ import {
PartialRolePolicyOverride,
SigninRequest,
SigninResponse,
SigninWithPasskeyRequest,
SigninWithPasskeyResponse,
SignupPendingRequest,
SignupPendingResponse,
SignupRequest,
@@ -82,6 +84,10 @@ export type Endpoints = Overwrite<
req: SigninRequest;
res: SigninResponse;
},
'signin-with-passkey': {
req: SigninWithPasskeyRequest;
res: SigninWithPasskeyResponse;
}
'admin/roles/create': {
req: Overwrite<AdminRolesCreateRequest, { policies: PartialRolePolicyOverride }>;
res: AdminRolesCreateResponse;

View File

@@ -271,6 +271,17 @@ export type SigninRequest = {
token?: string;
};
export type SigninWithPasskeyRequest = {
credential?: object;
context?: string;
};
export type SigninWithPasskeyResponse = {
option?: object;
context?: string;
signinResponse?: SigninResponse;
};
export type SigninResponse = {
id: User['id'],
i: string,