new version of dfido2-lib.js

This commit is contained in:
dqj
2026-01-03 17:41:58 +09:00
parent e941063dbd
commit 44a35fb45a

View File

@@ -433,6 +433,11 @@ async function doAttestation(username, displayName, rpId, userVerification = 'pr
}, },
}; };
// Capture transports if available (WebAuthn Level 2+)
if (res.response.getTransports) {
attResult.transports = res.response.getTransports();
}
const result = await fetch(localStorage.getItem(DFIDO2_LIB_LOCALSTG_NAME_SVR_URL) + "/attestation/result", { const result = await fetch(localStorage.getItem(DFIDO2_LIB_LOCALSTG_NAME_SVR_URL) + "/attestation/result", {
method: "POST", method: "POST",
cache: "no-cache", cache: "no-cache",
@@ -476,11 +481,13 @@ async function doAssertion(username = null, rpId = null, userVerification = 'pre
var process_time_limit = Number.MAX_SAFE_INTEGER var process_time_limit = Number.MAX_SAFE_INTEGER
try { try {
let authnOptions; let authnOptions;
/*if (!username) { /*
Tested the codes below, but most browsers cannot find correct account when username is null.
if (!username || 0 === username.length) {
authnOptions = { authnOptions = {
authenticatorSelection: { authenticatorSelection: {
//authenticatorAttachment: "platform", //authenticatorAttachment: "platform",
userVerification: "discouraged" userVerification: userVerification
} }
}; };
} else { } else {
@@ -488,7 +495,7 @@ async function doAssertion(username = null, rpId = null, userVerification = 'pre
username: username, username: username,
authenticatorSelection: { authenticatorSelection: {
//authenticatorAttachment: "platform", //authenticatorAttachment: "platform",
userVerification: "preferred" userVerification: userVerification
} }
}; };
}*/ }*/