@nopwdio/sdk-js
Version:
Nopwd JS SDK
51 lines (50 loc) • 1.97 kB
TypeScript
import { LitElement } from "lit";
export declare enum State {
REGISTERING = "registering",// registering the passkey
REGISTERED = "registered",// passkey has been registered
ERROR = "error"
}
/** Event's detail emitted when a passkey has been created. */
export interface RegisterEvent {
kid: string;
}
/**
* @summary `np-passkey-register` is a custom element that facilitates the creation of a passkey for this website.
*
* @description
* This component manages the registration process of a passkey, providing visual feedback during the process.
* It handles user interactions, communicates with the WebAuthn API, and manages the component's state.
* The component emits events to notify the parent application when the registration is successful or if an error occurs.
*
* @slot - The default slot for the button label.
* @slot registering - Content displayed while the registration is in progress.
* @slot registered - Content displayed when the passkey has been successfully created.
* @slot error - Content displayed when an error occurs during registration.
*
* @event np:register - Emitted when the registration process completes successfully.
* @event np:error - Emitted when an error occurs during the registration process.
*
* @csspart button - The component's button element.
*/
export declare class NpPasskeyRegister extends LitElement {
/** The component's state. */
state?: State;
resetDuration: number;
static styles: import("lit").CSSResult[];
private stateTimeoutId;
private abort;
connectedCallback(): Promise<void>;
disconnectedCallback(): Promise<void>;
private onClick;
register(): Promise<unknown>;
cancel(): void;
private resetState;
private dispatchRegisterEvent;
private dispatchErrorEvent;
render(): import("lit-html").TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
"np-passkey-register": NpPasskeyRegister;
}
}