UNPKG

@agentauth/sdk

Version:

MCP-native identity generation and authentication for AI agents.

80 lines 2.59 kB
/** * Defines the headers used for AgentAuth. */ export declare const AGENTAUTH_HEADERS: { readonly ADDRESS: "x-agentauth-address"; readonly PAYLOAD: "x-agentauth-payload"; readonly SIGNATURE: "x-agentauth-signature"; }; /** * Represents a generic request object with headers. */ export interface AgentAuthRequest { headers: Record<string, string | string[] | undefined>; } /** * Represents the structured, decoded payload for AgentAuth requests. * The payload must contain a timestamp for freshness validation, * and can include any additional data needed by the application. */ export interface AgentAuthPayload { /** ISO 8601 timestamp for request freshness validation */ timestamp: string; /** Additional payload data as needed by the application */ [key: string]: unknown; } /** * Represents the result of a successful verification. */ export interface VerificationResult { valid: boolean; agentauth_id?: string; } /** * Represents a generated AgentAuth identity. */ export interface GeneratedIdentity { agentauth_token: string; agentauth_id: string; agentauth_address: string; } /** * Represents the result of deriving identity from an AgentAuth Token. */ export interface DerivedIdentity { agentauth_id: string; agentauth_address: string; } /** * Configuration options for the verification functions. */ export interface VerifyOptions { /** * The acceptable time window in milliseconds for the request timestamp. * Defaults to 60000 (60 seconds). */ freshness?: number; } /** * Core verification function for AgentAuth. * It is stateless and performs address-based signature verification and timestamp validation. * * @param request The incoming request object containing headers. * @param options Optional configuration for verification. * @returns VerificationResult with valid flag and agentauth_id if successful. */ export declare function verify(request: AgentAuthRequest, options?: VerifyOptions): VerificationResult; /** * Generates a new AgentAuth identity with AgentAuth Token, ID, and Address. * * @returns GeneratedIdentity containing the AgentAuth Token, ID, and Address. */ export declare function generateIdentity(): GeneratedIdentity; /** * Derives an AgentAuth ID and Address from an existing AgentAuth Token. * * @param agentauth_token The AgentAuth Token to derive from. * @returns DerivedIdentity containing the ID and Address. */ export declare function deriveFromToken(agentauth_token: string): DerivedIdentity; //# sourceMappingURL=index.d.ts.map