ai-auth
Version:
Complete Auth-Agent SDK - Agent authentication for AI developers + OAuth client integration for website developers
126 lines • 2.81 kB
TypeScript
/**
* Types for Auth-Agent Server-Side SDK
*/
export interface SDKConfig {
/**
* Agent identifier (register at https://console.auth-agent.com)
*/
agentId: string;
/**
* Agent secret (required for authentication)
*/
agentSecret: string;
/**
* AI model name (e.g., "openai/gpt-4o", "anthropic/claude-3-5-sonnet")
*/
modelName: string;
/**
* Request timeout in milliseconds
* @default 10000
*/
timeout?: number;
/**
* Custom fetch function
*/
customFetch?: typeof fetch;
}
export interface TokenManager {
accessToken: string | null;
idToken: string | null;
refreshToken: string | null;
tokenType: string;
expiresAt: number | null;
scopes: string | null;
}
export interface TokenResponse {
access_token: string;
token_type: 'Bearer';
expires_in: number;
refresh_token?: string;
id_token?: string;
scope: string;
}
export interface UserInfo {
sub: string;
agent_id: string;
name?: string;
email?: string;
model_name: string;
permissions?: string[];
[key: string]: any;
}
export interface AgentAuthRequest {
agent_id: string;
agent_secret: string;
model_name: string;
client_id: string;
redirect_uri: string;
state?: string;
scope?: string;
code_challenge?: string;
code_challenge_method?: string;
}
export interface AgentAuthResponse {
session_id: string;
next_step: 'challenge';
challenge_url: string;
expires_in: number;
}
export interface AgentProfile {
agent_id: string;
model_name: string;
owner_name: string;
owner_email: string;
permissions: string[];
disabled: boolean;
created_at: string;
updated_at: string;
}
export interface EventData {
event: string;
selector?: string;
site?: string;
evidence?: string;
result?: string;
[key: string]: any;
}
export interface ChallengeResponse {
ok: boolean;
challenge?: string;
expires?: number;
sig?: string;
verify_ctx_id?: string;
message?: string;
}
export interface VerificationConfirmRequest {
challenge: string;
expires: number;
sig: string;
verify_ctx_id: string;
}
export interface IntrospectionResponse {
active: boolean;
scope?: string;
client_id?: string;
username?: string;
token_type?: string;
exp?: number;
iat?: number;
sub?: string;
[key: string]: any;
}
export interface PKCEPair {
codeVerifier: string;
codeChallenge: string;
}
export interface AuthorizationUrlOptions {
redirectUri: string;
scope?: string;
state?: string;
}
export interface AuthError extends Error {
code: string;
description?: string;
statusCode?: number;
}
//# sourceMappingURL=types.d.ts.map