@quadible/web-sdk
Version:
The web sdk for Quadible's behavioral authentication service.
101 lines (100 loc) • 3.46 kB
TypeScript
import { EventEmitter2, Listener } from 'eventemitter2';
import VideoWorker from './common/VideoWorker';
import WebcamSession from './common/WebcamSession';
import IConfiguration from './models/IConfiguration';
import ISessionInfo from './models/ISessionInfo';
export default class BehavioralAuthSDK extends EventEmitter2 {
readonly configuration: IConfiguration;
static getClientId(): string;
private static ensureClientId;
private static createUUID;
static readonly defaultApiKey = "#DEFAULT_API_KEY";
static readonly version = "#SDK_VERSION";
static readonly storageKey = "_bauthsdk_authorization";
static readonly cidKey = "__q_cid";
static isRUMInitialized: boolean;
private readonly api;
private readonly messages;
readonly videoWorker: VideoWorker;
readonly webcamSession: WebcamSession;
private readonly collectors;
private dataPushIntervalIndex?;
private status;
private isFaceAuthenticated;
private isScreenLocked;
private lockScreenContainer;
private lockScreenText;
private unlockScheduleId;
private lastAuthResult;
private debugUI?;
constructor(configuration: IConfiguration);
/**
* Sets the default value for compression if there is no current value
*/
private defaultCompressionValue;
/**
* Start collecting and pushing data to the server.
*/
start(forceUseThisVersion?: boolean): any;
/**
* Stop collecting and pushing data to the server.
*/
stop(): Promise<void>;
/**
* Clears all information from storage.
*/
clearSession(): void;
/** Deletes current user data. */
deleteUser(): Promise<void>;
setApiKey(apiKey: string): void;
isCollecting(): boolean;
/**
* Flushes any remaining data and asks the service to authenticate the user.
*/
authenticate(): Promise<{
isAuthenticated: boolean;
status: import("./API").AuthStatus;
confidenceLevel: import("./API").ConfidenceLevel;
comment: undefined | string;
}>;
assignPhotoToUserPopup(options?: {
clickOutsideToClose?: boolean;
}): Promise<unknown>;
assignPhotoToUser(base64DataUrl: string): Promise<void>;
setUserDisplayName(displayName: string): void;
getSessionInfo(): ISessionInfo;
private loadVersion;
/** Copy listeners to updated instance */
private _listeners;
on(event: string, listener: Listener): this;
off(event: string, listener: Listener): this;
private registerCollectorErrorListeners;
private buildLockScreen;
private updateScreenLockStatus;
private shouldLockScreen;
private lockScreen;
private scheduleUnlockScreen;
private unlockScreen;
private startVideoAuthenticationLoopIfNeeded;
private updateLockScreenMessageBasedOnFaceAuthResult;
private shouldRunVideoAuthentication;
private getVideoWorker;
private setStatus;
private stopAllCollectors;
private startDataPushLoop;
private flushAll;
private stopDataPushLoop;
private saveSessionInfo;
private startAllAvailableCollectors;
private tryStartCollectorIfAvailable;
private log;
}
export declare const enum SDKEvent {
Error = "error",
FaceEnrollmentSuccessful = "face-enrollment",
FaceAuthSuccess = "face-auth-success",
FaceAuthLost = "face-auth-lost",
Warn = "warning",
ModelLoaded = "model-loaded",
LocalFrameAnalysis = "predictions"
}