@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
51 lines (50 loc) • 1.91 kB
TypeScript
import { AgentAuthClient } from './agent-auth-client';
export type AgentApprovalStrength = "none" | "session" | "webauthn";
export type AgentGrantStatus = "active" | "pending" | "denied" | "revoked";
export type AgentCapabilityGrant = {
capability: string;
description?: string;
status: AgentGrantStatus;
approvalStrength: AgentApprovalStrength;
reason?: string;
constraints?: Record<string, unknown>;
expiresAt?: Date;
};
export type AgentAuthorization = {
id: string;
name: string;
status: string;
mode: "delegated" | "autonomous";
hostId: string;
hostName?: string;
grants: AgentCapabilityGrant[];
createdAt: Date;
lastUsedAt?: Date;
expiresAt?: Date;
};
export type AgentApprovalRequest = {
agentId: string;
approvalId?: string;
userCode?: string;
};
export type AgentApproval = AgentAuthorization & {
requestedCapabilities: AgentCapabilityGrant[];
};
export type AgentApprovalDecision = AgentApprovalRequest & {
capabilities?: string[];
ttl?: number;
reason?: string;
};
export type AgentAuthPasskeyCeremony = (options: Record<string, unknown>) => Promise<Record<string, unknown>>;
export interface AgentAuthAdapter {
getApproval(request: AgentApprovalRequest, signal?: AbortSignal): Promise<AgentApproval>;
approve(decision: AgentApprovalDecision): Promise<void>;
deny(decision: AgentApprovalDecision): Promise<void>;
listAgents(signal?: AbortSignal): Promise<AgentAuthorization[]>;
revoke(agentId: string, capabilities: string[]): Promise<void>;
}
export type AgentAuthClientAdapterOptions = {
authenticateWithPasskey?: AgentAuthPasskeyCeremony;
};
/** Build BAUI's approval and grant-management adapter from Agent Auth's native client. */
export declare function createAgentAuthClientAdapter(authClient: AgentAuthClient, options?: AgentAuthClientAdapterOptions): AgentAuthAdapter;