/** * CredentialStore implementation backed by auth.json. * Provider auth orchestration belongs to ModelRuntime and pi-ai Models. */ import type { Credential, CredentialInfo, CredentialStore } from "@earendil-works/pi-ai"; type AuthStorageData = Record; type LockResult = { result: T; next?: string; }; export interface AuthStorageBackend { withLock(fn: (current: string | undefined) => LockResult): T; withLockAsync(fn: (current: string | undefined) => Promise>): Promise; } export declare class FileAuthStorageBackend implements AuthStorageBackend { private authPath; constructor(authPath?: string); private ensureParentDir; private ensureFileExists; private acquireLockSyncWithRetry; withLock(fn: (current: string | undefined) => LockResult): T; withLockAsync(fn: (current: string | undefined) => Promise>): Promise; } export declare class InMemoryAuthStorageBackend implements AuthStorageBackend { private value; withLock(fn: (current: string | undefined) => LockResult): T; withLockAsync(fn: (current: string | undefined) => Promise>): Promise; } /** * Credential storage backed by a JSON file. */ export declare class AuthStorage implements CredentialStore { private data; private storage; private constructor(); static create(authPath?: string): AuthStorage; static fromStorage(storage: AuthStorageBackend): AuthStorage; static inMemory(data?: AuthStorageData): AuthStorage; private parseStorageData; /** * Reload credentials from storage. */ reload(): void; /** Legacy synchronous accessor retained for bundled extensions. */ get(provider: string): Credential | undefined; /** Legacy synchronous writer retained for bundled extensions. */ set(provider: string, credential: Credential): void; /** Legacy synchronous deleter retained for bundled extensions. */ remove(provider: string): void; read(provider: string): Promise; modify(provider: string, fn: (current: Credential | undefined) => Promise): Promise; delete(provider: string): Promise; /** List credential metadata without resolving configured key values. */ list(): Promise; } /** * One-off synchronous read of a stored credential from an auth.json file, * without instantiating a store or resolving configured key values. */ export declare function readStoredCredential(providerId: string, authPath?: string): Credential | undefined; export {}; //# sourceMappingURL=auth-storage.d.ts.map