decord/alpha/source/modules/webauthn/WebAuthnStore.tsx

116 lines
3 KiB
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 15279
// Function ID: 15280
// Name: WebAuthnStore
2026-10-09 10:00:15 +00:00
// Dependencies: [1998, 504, 584, 2]
2026-07-21 22:01:30 +00:00
2026-10-13 12:43:34 +00:00
// Module 15279 (WebAuthnStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-09 10:00:15 +00:00
import Server from "Server" /* 1998 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
let c2 = false;
let closure_3 = [];
let c4 = false;
2026-10-03 08:58:59 +00:00
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class WebAuthnStore extends Store {
2026-10-03 08:58:59 +00:00
hasFetchedCredentials() {
return c2;
}
getCredentials() {
return closure_3;
}
hasPendingRegisterTrigger() {
return c4;
}
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
Object.defineProperty(WebAuthnStore.prototype, "hasCredentials", {
2026-07-29 08:29:29 +00:00
get: function hasCredentials() {
return closure_3.length > 0;
},
set: undefined
});
WebAuthnStore.displayName = "WebAuthnStore";
2026-10-03 08:58:59 +00:00
const obj = {
2026-07-20 16:05:17 +00:00
LOGOUT: function handleReset() {
2026-08-24 06:08:38 +00:00
closure_3 = [];
c2 = false;
c4 = false;
2026-07-20 16:05:17 +00:00
},
MFA_WEBAUTHN_CREDENTIALS_LOADED: function handleWebAuthnCredentialsLoaded(credentials) {
credentials = credentials.credentials;
let flag = false;
if (closure_3 !== credentials) {
closure_3 = credentials;
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-10-03 08:58:59 +00:00
const tmp = c2;
if (!tmp) {
2026-07-29 08:29:29 +00:00
c2 = true;
2026-07-20 16:05:17 +00:00
flag = true;
}
return flag;
},
AUTHENTICATOR_CREATE: function handleAuthenticatorCreate(credential) {
2026-10-03 08:58:59 +00:00
let flag;
2026-07-20 16:05:17 +00:00
credential = credential.credential;
if (credential.type === Server.AuthenticatorType.WEBAUTHN) {
2026-10-03 08:58:59 +00:00
const tmp3 = undefined === closure_3.find((id) => id.id === credential.id);
if (tmp3) {
const items = [];
2026-10-03 08:58:59 +00:00
items[HermesBuiltin.arraySpread(items, closure_3, 0)] = credential;
closure_3 = items;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
flag = tmp3;
2026-07-20 16:05:17 +00:00
} else {
const type = credential.type;
flag = false;
}
return flag;
},
AUTHENTICATOR_UPDATE: function handleAuthenticatorUpdate(credential) {
credential = credential.credential;
if (credential.type !== Server.AuthenticatorType.WEBAUTHN) {
2026-07-20 16:05:17 +00:00
const type = credential.type;
return false;
} else {
2026-10-03 08:58:59 +00:00
let tmp = closure_3;
2026-07-29 08:29:29 +00:00
closure_3 = closure_3.map((id) => {
2026-07-20 16:05:17 +00:00
let tmp = id;
if (id.id === credential.id) {
tmp = credential;
}
return tmp;
});
}
},
AUTHENTICATOR_DELETE: function handleAuthenticatorDelete(credential) {
credential = credential.credential;
if (credential.type !== Server.AuthenticatorType.WEBAUTHN) {
2026-07-20 16:05:17 +00:00
const type = credential.type;
return false;
} else {
2026-07-29 08:29:29 +00:00
closure_3 = closure_3.filter((id) => id.id !== credential.id);
2026-07-20 16:05:17 +00:00
}
},
WEBAUTHN_TRIGGER_REGISTER: function handleTriggerRegister() {
2026-10-03 08:58:59 +00:00
const tmp = c4;
if (tmp) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-07-29 08:29:29 +00:00
c4 = true;
2026-07-20 16:05:17 +00:00
}
},
WEBAUTHN_CLEAR_REGISTER_TRIGGER: function handleClearRegisterTrigger() {
2026-07-29 08:29:29 +00:00
if (c4) {
c4 = false;
2026-07-20 16:05:17 +00:00
} else {
return false;
}
}
2026-10-03 08:58:59 +00:00
};
const webAuthnStore = new WebAuthnStore(DispatcherDefault, obj);
const result = size.fileFinishedImporting("modules/webauthn/WebAuthnStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default webAuthnStore;