web3-mq-react
Version:
web3-mq-react-components
51 lines (50 loc) • 2.01 kB
TypeScript
/// <reference types="react" />
import { WalletType } from 'web3-mq';
import { SignAuditTypeEnum } from '../../../context';
export declare type LoginEventType = 'login' | 'register' | 'error';
export declare type LoginEventDataType = {
type: LoginEventType;
msg: string;
data: LoginResType | RegisterResType | null;
};
export declare type MainKeysType = {
publicKey: string;
privateKey: string;
walletAddress: string;
};
export declare type UserAccountType = {
userid: string;
address: string;
walletType: WalletType;
userExist: boolean;
};
export declare type LoginResType = {
privateKey: string;
publicKey: string;
tempPrivateKey: string;
tempPublicKey: string;
didKey: string;
userid: string;
address: string;
pubkeyExpiredTimestamp: number;
};
export declare type RegisterResType = {
privateKey: string;
publicKey: string;
address: string;
};
declare const useLogin: (handleLoginEvent: (eventData: LoginEventDataType) => void, keys?: MainKeysType | undefined, account?: UserAccountType | undefined) => {
login: (password: string, didType?: WalletType) => Promise<LoginResType | null>;
getUserAccount: (didType?: WalletType, address?: string | undefined) => Promise<{
address: string;
userExist: boolean;
}>;
register: (password: string, didType?: WalletType) => Promise<RegisterResType | null>;
userAccount: UserAccountType | undefined;
loginByQrCode: (password?: string | undefined) => Promise<void>;
setMainKeys: import("react").Dispatch<import("react").SetStateAction<MainKeysType | undefined>>;
registerByQrCode: (password?: string | undefined, signature?: string | undefined) => Promise<void>;
web3MqSignCallback: (signature: string, signType: SignAuditTypeEnum) => Promise<void>;
setUserAccount: import("react").Dispatch<import("react").SetStateAction<UserAccountType | undefined>>;
};
export default useLogin;