/** * Main entry point for creating an IA (Ident Agent) instance */ import { IdentClient } from '@ident-agency/core'; import { type Subject, type AsyncKV } from './subject/subject-store'; import { type PasswordProvider, type UnlockProvider, type GrantProvider, type DeviceKeyProvider, type DeviceKeyStorageProvider, type SshKeyProvider } from './default-providers'; export type CreateIAOptions = { api?: { baseUrl?: string; clientId?: string; redirectUri?: string; scopes?: string[]; passwordProvider?: PasswordProvider; unlockProvider?: UnlockProvider; grantProvider?: GrantProvider; deviceKeyProvider?: DeviceKeyProvider; deviceKeyStorageProvider?: DeviceKeyStorageProvider; sshKeyProvider?: SshKeyProvider; }; /** Advanced: fully control how Core is created (or swap in a mock) */ core?: { factory?: () => Promise; }; storage?: AsyncKV; ui?: { mount: HTMLElement; }; debug?: boolean | { wire?: boolean; storage?: boolean; grants?: boolean; }; consentPolicy?: any; unlockCache?: any; }; export interface InlineAgent { kind: 'inline'; id: string; name?: string; requested_capabilities?: { read_lenses?: string[]; write_patterns?: string[]; }; } export interface AgentIdentity { kind: 'inline' | 'iframe'; id?: string; origin?: string; bundle_sha256?: string; } export interface GrantCapabilities { read_lenses?: string[]; mutate_paths?: string[]; } export interface GrantRecord { subject: string; agent: AgentIdentity; capabilities: GrantCapabilities; created_at: string; updated_at?: string; expires_at?: string | null; revoked?: boolean; } export interface ListGrantsOptions { subjectId?: string; agentId?: string; agentKey?: string; } export interface IA { getSession(): { subject?: { id: string; hash: string; }; } | null; getAuthorizationUrl(scopes?: string[], redirectUri?: string): Promise; ensureAuthenticated(scopes?: string[]): Promise; signOut(): Promise; getSubject(): Promise; ensureSubject(): Promise; switchSubject(id?: string): Promise; isLocked(): boolean; unlock(): Promise; lock(opts: { clearCache?: boolean; grants?: boolean; }): Promise; hasKeychain(): Promise; getDetailedUnlockMethods(): Promise; addUnlockMethod(method: string, params?: any): Promise; removeUnlockMethod(method: string, keyId?: string): Promise; changePassword(options?: any): Promise; generateRecoveryPhrase(options?: any): Promise<{ phrase: string; }>; testUnlockMethod?(options?: any): Promise; getGrants(opts?: { subjectId?: string; agentId?: string; }): Promise; ensureGrant(input: { agent: any; manifest?: any; scope?: any; }): Promise; revokeGrant(agent: any, scope?: any): Promise; listGrants(opts?: ListGrantsOptions): Promise; listGrants(subjectId?: string): Promise; requestLens(req: { path: string; args?: unknown; agent: any; }): Promise; mutate(req: { path: string; op: string; body?: any; agent: any; }): Promise; registerInlineAgent(agent: InlineAgent): void; openAgent(opts: any): any; initAgent?(opts: { agentId: string; manifest?: any; }): Promise; on(event: string, cb: (payload: any) => void): () => void; } export type IframeAgentOptions = { id: string; url: string; container?: HTMLElement | null; className?: string; width?: string; height?: string; allow?: string; sandbox?: string; targetOrigin?: string; debug?: boolean; }; export type OpenedIframeAgent = { kind: 'iframe'; id: string; url: string; el: HTMLIFrameElement; ready: Promise; rpc(method: string, payload?: any): Promise; close(): void; }; export declare function openAgent(opts: IframeAgentOptions): { kind: "iframe"; id: string; url: string; el: HTMLIFrameElement; ready: Promise; rpc: (method: string, payload?: any) => Promise; close: () => void; }; export declare function createIA(opts: CreateIAOptions): Promise; //# sourceMappingURL=agent.d.ts.map