export type LinxAuthType = 'client_credentials' | 'oidc_oauth'; export interface LinxClientConfig { url: string; webId: string; authType: LinxAuthType; } export interface LinxClientCredentialsSecrets { clientId: string; clientSecret: string; } export interface LinxOidcOAuthSecrets { oidcRefreshToken: string; oidcAccessToken: string; oidcExpiresAt: string; oidcClientId?: string; } export type LinxClientSecrets = LinxClientCredentialsSecrets | LinxOidcOAuthSecrets; export interface AccountSession { url: string; email: string; token: string; webId?: string; podUrl?: string; createdAt: string; } export interface LinxAccountControls { pod?: string; clientCredentials?: string; } export interface LinxAccountData { controls: LinxAccountControls; pods: Record; webIds: Record; clientCredentials: Record; } export interface LinxClientCredential { id: string; secret?: string; label?: string; webId?: string; } export interface LinxStoredCredentials { url: string; webId: string; authType: LinxAuthType; secrets: LinxClientSecrets; } export type LinxCredentialBootstrapStatus = 'reused' | 'created' | 'recreated'; export interface LinxWhoAmIField { key: 'email' | 'server' | 'webId' | 'pod' | 'session-created-at'; value: string; } export interface PerformLinxPasswordLoginInput { baseUrl?: string | null; fallbackBaseUrl?: string; email: string; password: string; requestedWebId?: string | null; credentialName?: string | null; existingCredentials?: LinxStoredCredentials | null; now?: Date; } export interface PerformLinxPasswordLoginResult { baseUrl: string; webId: string; account: LinxAccountData; session: AccountSession; credentialStatus: LinxCredentialBootstrapStatus; credentialsToSave?: { url: string; webId: string; authType: 'client_credentials'; secrets: LinxClientCredentialsSecrets; }; } export interface PerformLinxPasswordLoginDependencies { checkServer(baseUrl: string): Promise; login(email: string, password: string, baseUrl: string): Promise; getAccountData(token: string, baseUrl: string): Promise; validateClientCredentials?(credentials: LinxStoredCredentials): Promise; createClientCredentials(token: string, credentialsUrl: string, webId: string, name?: string): Promise; } export declare const LINX_HOME_DIRNAME = ".linx"; export declare const LINX_CONFIG_FILE_NAME = "config.json"; export declare const LINX_SECRETS_FILE_NAME = "secrets.json"; export declare const LINX_ACCOUNT_SESSION_FILE_NAME = "account.json"; export declare const LINX_CLOUD_IDENTITY_ORIGIN = "https://id.undefineds.co"; export declare const LINX_CLOUD_API_ORIGIN = "https://api.undefineds.co"; export declare const LINX_CLOUD_ACCOUNT_API_BASE_URL = "https://id.undefineds.co/"; export declare const LINX_CLOUD_RUNTIME_API_BASE_URL = "https://api.undefineds.co/v1"; export declare const LINX_CLOUD_API_BASE_URL = "https://id.undefineds.co/"; export declare const LINX_CLOUD_IDENTITY_HOSTS: readonly ["id.undefineds.co"]; export declare function resolveLinxBaseUrl(url?: string | null, fallbackBaseUrl?: string): string; export declare function resolveLinxRuntimeApiBaseUrl(url?: string | null, fallbackBaseUrl?: string): string; export declare function resolveLinxCloudAccountBaseUrl(url?: string | null): string; export declare function resolveLinxCloudRuntimeApiBaseUrl(url?: string | null): string; export declare function resolveLinxCloudApiBaseUrl(url?: string | null): string; export declare function isLinxCloudIdentityBaseUrl(url?: string | null): boolean; export declare function resolveLinxRuntimeOriginForIssuerUrl(url?: string | null): string; export declare function resolveLinxRuntimeApiBaseUrlForIssuerUrl(url?: string | null): string; export declare function resolveLinxPodUrl(webId: string): string; export declare function resolveLinxPodBaseUrl(webId: string): string; export declare function extractProfileUsernameFromWebId(webId: string): string; export declare function parseLinxClientConfig(raw: unknown): LinxClientConfig | null; export declare function isLinxClientCredentialsSecrets(secrets: LinxClientSecrets): secrets is LinxClientCredentialsSecrets; export declare function isLinxOidcOAuthSecrets(secrets: LinxClientSecrets): secrets is LinxOidcOAuthSecrets; export declare function parseLinxClientSecrets(raw: unknown): LinxClientSecrets | null; export declare function parseLinxAccountData(raw: unknown): LinxAccountData | null; export declare function parseLinxClientCredential(raw: unknown): LinxClientCredential | null; export declare function parseAccountSession(raw: unknown): AccountSession | null; export declare function selectLinxAccountWebId(account: LinxAccountData | null, preferredWebId?: string | null): string | null; export declare function resolveLinxAccountPodUrl(account: LinxAccountData | null, webId?: string | null): string | null; export declare function hasMatchingLinxStoredCredentials(credentials: Pick | null | undefined, baseUrl: string, webId: string): boolean; export declare function resolveLinxCredentialBootstrapStatus(input: { reusedExistingCredentials: boolean; hadMatchingStoredCredentials: boolean; }): LinxCredentialBootstrapStatus; export declare function listLinxWhoAmIFields(session: AccountSession, options?: { verbose?: boolean; }): LinxWhoAmIField[]; export declare function performLinxPasswordLogin(input: PerformLinxPasswordLoginInput, deps: PerformLinxPasswordLoginDependencies): Promise;