UNPKG

@make-software/csprclick-core-types

Version:

Typescript definitions for CSPR.click core packages

59 lines (58 loc) 2.4 kB
import { Transaction } from "casper-js-sdk"; export interface ICSPRClickCore { logger: any; parent: Window; appOrigin: string; options: any; cachedMetadata: Array<any>; init(parent: Window, options: any, cb?: () => void): void; w3aSession: Promise<IW3ASession>; collectApi(data: object): void; } export declare enum W3AStatus { EMPTY = 0, CONFIGURED = 1, LOGIN_TRIGGERED = 2, LOGIN_COMPLETED = 3, INITIALIZING_KEY = 4, KEY_INITIALIZED = 5, PASSWORD_REQUIRED = 6, THRESHOLD_NOT_REACHED = 7, KEY_RECONSTRUCTED = 8, ERROR = 1000, SESSION_EXPIRED = 1001, WRONG_RECOVERY_SHARE = 1307 } export interface ITKeyService { status: W3AStatus; initServiceProvider(verifierDetails: string, token?: string): Promise<W3AStatus>; initializeNewAccount(verifierDetails: string, token: string, unlockPin?: string): Promise<W3AStatus>; restoreSession(verifierDetails: string): Promise<W3AStatus>; getPublicKey(): Promise<string | null>; getPublicKeyOrCreateNewAccount(): Promise<string | null>; unlockWithDeviceShare(): Promise<W3AStatus>; unlockWithPasswordShare(passwd: string, trustDevice?: boolean): Promise<W3AStatus>; unlockWithRecoveryPhrase(phrase: string): Promise<W3AStatus>; isUnlocked(): Boolean; signTransaction(transactionObject: Transaction): Promise<Transaction>; signMessage(message: string): Promise<string>; setPassword(passwd: string): Promise<boolean>; generateRecoveryPhrase(): Promise<string>; getKeyAsPem(): Promise<string>; disconnect(): Promise<void>; encryptPin(unlockPin: string, publicKey: string): string; } export interface IW3ASession { createSessionWithIdToken(openidProvider: string, verifierDetails: string, idToken: string): Promise<string | undefined>; getPublicKey(): Promise<string | null>; unlockWithDeviceShare(): Promise<W3AStatus>; unlockWithPasswordShare(passwd: string, trustDevice?: boolean): Promise<W3AStatus>; unlockWithRecoveryPhrase(phrase: string): Promise<W3AStatus>; isUnlocked(): Promise<Boolean>; signTransaction(transactionObject: Transaction): Promise<Transaction>; signMessage(message: string): Promise<string>; setPassword(passwd: string): Promise<boolean>; generateRecoveryPhrase(): Promise<string>; getKeyAsPem(): Promise<string>; disconnect(): Promise<void>; }