소스 검색

Specify timeout for passkey

Neeraj Gupta 1 년 전
부모
커밋
5df7a2a10f
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      apps/accounts/src/pages/passkeys/flow/index.tsx

+ 4 - 3
apps/accounts/src/pages/passkeys/flow/index.tsx

@@ -128,19 +128,20 @@ const PasskeysFlow = () => {
     };
 
     const getCredential = async (
-        publicKey: any
+        publicKey: any,
+        timeoutMillis: number = 60000 // Default timeout of 60 seconds
     ): Promise<Credential | null> => {
         publicKey.challenge = _sodium.from_base64(
             publicKey.challenge,
             _sodium.base64_variants.URLSAFE_NO_PADDING
         );
-        publicKey.allowCredentials?.forEach(function(listItem: any) {
+        publicKey.allowCredentials?.forEach(function (listItem: any) {
             listItem.id = _sodium.from_base64(
                 listItem.id,
                 _sodium.base64_variants.URLSAFE_NO_PADDING
             );
         });
-
+        publicKey.timeout = timeoutMillis;
         const credential = await navigator.credentials.get({
             publicKey,
         });