modify webauthn config

This commit is contained in:
MaysWind
2020-11-22 12:18:18 +08:00
parent 800e922aec
commit 6412519b53
+4 -4
View File
@@ -47,7 +47,7 @@ function isCompletelySupported() {
} }
function registerCredential({ username, nickname }, userSecret) { function registerCredential({ username, nickname }, userSecret) {
if (!window.location || !window.location.hostname || !document.title) { if (!window.location || !window.location.hostname) {
return Promise.reject({ return Promise.reject({
notSupported: true notSupported: true
}); });
@@ -63,13 +63,13 @@ function registerCredential({ username, nickname }, userSecret) {
const publicKeyCredentialCreationOptions = Object.assign({}, PUBLIC_KEY_CREDENTIAL_CREATION_OPTIONS_TEMPLATE, { const publicKeyCredentialCreationOptions = Object.assign({}, PUBLIC_KEY_CREDENTIAL_CREATION_OPTIONS_TEMPLATE, {
challenge: Uint8Array.from(challenge, c => c.charCodeAt(0)), challenge: Uint8Array.from(challenge, c => c.charCodeAt(0)),
rp: { rp: {
name: document.title, name: window.location.hostname,
id: window.location.hostname, id: window.location.hostname
}, },
user: { user: {
id: Uint8Array.from(userSecret, c => c.charCodeAt(0)), id: Uint8Array.from(userSecret, c => c.charCodeAt(0)),
name: username, name: username,
displayName: nickname, displayName: nickname
} }
}); });