@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 1.24 kB
JavaScript
import{Capability}from"./Target.js";import{SDKModel}from"./SDKModel.js";export class WebAuthnModel extends SDKModel{#e;constructor(e){super(e),this.#e=e.webAuthnAgent(),e.registerWebAuthnDispatcher(new WebAuthnDispatcher(this))}setVirtualAuthEnvEnabled(e){return e?this.#e.invoke_enable({enableUI:!0}):this.#e.invoke_disable()}async addAuthenticator(e){return(await this.#e.invoke_addVirtualAuthenticator({options:e})).authenticatorId}async removeAuthenticator(e){await this.#e.invoke_removeVirtualAuthenticator({authenticatorId:e})}async setAutomaticPresenceSimulation(e,t){await this.#e.invoke_setAutomaticPresenceSimulation({authenticatorId:e,enabled:t})}async getCredentials(e){return(await this.#e.invoke_getCredentials({authenticatorId:e})).credentials}async removeCredential(e,t){await this.#e.invoke_removeCredential({authenticatorId:e,credentialId:t})}credentialAdded(e){this.dispatchEventToListeners("CredentialAdded",e)}credentialAsserted(e){this.dispatchEventToListeners("CredentialAsserted",e)}}class WebAuthnDispatcher{#t;constructor(e){this.#t=e}credentialAdded(e){this.#t.credentialAdded(e)}credentialAsserted(e){this.#t.credentialAsserted(e)}}SDKModel.register(WebAuthnModel,{capabilities:Capability.WebAuthn,autostart:!1});