mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-08-04 22:40:11 +00:00
feat: add support for PRF extension request based on browser compatibility
This commit is contained in:
@@ -161,6 +161,11 @@ function shouldRetryCreateWithoutPrf(error: unknown): boolean {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function canRequestPrfExtension(): Promise<boolean> {
|
||||||
|
if (/\bFirefox\//i.test(navigator.userAgent)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
async function getPublicKeyCredentialWithPrf(
|
async function getPublicKeyCredentialWithPrf(
|
||||||
options: PublicKeyCredentialRequestOptions,
|
options: PublicKeyCredentialRequestOptions,
|
||||||
salt: Uint8Array,
|
salt: Uint8Array,
|
||||||
@@ -291,7 +296,7 @@ export async function createAccountPasskeyCredential(
|
|||||||
return credential;
|
return credential;
|
||||||
};
|
};
|
||||||
let credential: PublicKeyCredential;
|
let credential: PublicKeyCredential;
|
||||||
if (requestPrf) {
|
if (requestPrf && await canRequestPrfExtension()) {
|
||||||
const prfOptions: PublicKeyCredentialCreationOptions = {
|
const prfOptions: PublicKeyCredentialCreationOptions = {
|
||||||
...nativeOptions,
|
...nativeOptions,
|
||||||
extensions: {
|
extensions: {
|
||||||
|
|||||||
Reference in New Issue
Block a user