@nuwa-ai/identity-kit-web
Version:
Web extensions for Nuwa Identity Kit
29 lines (28 loc) • 865 B
TypeScript
import { IdentityKitWeb } from '..';
import { NIP1SignedObject } from '@nuwa-ai/identity-kit';
export interface IdentityKitState {
isConnected: boolean;
isConnecting: boolean;
agentDid: string | null;
keyId: string | null;
error: string | null;
}
export interface IdentityKitHook {
state: IdentityKitState;
connect: () => Promise<void>;
sign: (payload: any) => Promise<NIP1SignedObject>;
verify: (sig: NIP1SignedObject) => Promise<boolean>;
logout: () => Promise<void>;
sdk: IdentityKitWeb | null;
}
export interface UseIdentityKitOptions {
appName?: string;
cadopDomain?: string;
storage?: 'local' | 'indexeddb';
autoConnect?: boolean;
roochRpcUrl?: string;
}
/**
* React hook for Nuwa Identity Kit (Web)
*/
export declare function useIdentityKit(options?: UseIdentityKitOptions): IdentityKitHook;