@openagentid/aegis-sdk/auth
API contract shipped by @openagentid/aegis-sdk 0.1.1. Exact exports, signatures, dependencies and availability.
All packages · Runnable examples · Start an agent
| Contract | Value |
|---|---|
| Package | @openagentid/aegis-sdk@0.1.1 |
| Entry point | @openagentid/aegis-sdk/auth |
| Availability | Published package |
| Reference source | Published TypeScript declarations |
| Package engines | node >=20 |
This reference is generated from the integrity-verified npm archive for this exact version. Signatures describe the public contract; they are not standalone programs. Complete examples are checked separately.
Import conditions
Use the public entry point above. The package resolves it to these shipped files; do not import its internal files directly.
| Condition | Published file |
|---|---|
| types | ./dist/auth/index.d.ts |
| import | ./dist/auth/index.js |
Exports
ApiKeyProviderbuildChallengePayloadChallenge— typeChallengeResponseProviderChallengeVerifiergenerateChallengeInMemoryNonceStoreInMemorySessionStoreNonceStore— typeSessionManagerSessionManagerOptions— typeSessionStore— type
ApiKeyProvider
Simple API key auth provider for service-to-service communication.
Maps opaque API keys to DIDs. Suitable for internal services that authenticate via pre-shared keys rather than challenge-response.
declare class ApiKeyProvider implements AuthProvider {
constructor(initial?: Record<string, string>);
providerName(): string;
registerKey(key: string, did: string): void;
revokeKey(key: string): boolean;
validate(credential: AuthCredential): Promise<AuthContext>;
getIdentity(ctx: AuthContext): Promise<AegisIdentity>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/auth/index.d.ts:77.
buildChallengePayload
Build the JCS-canonical payload bytes for challenge signing/verification.
Canonical form is a JSON object with keys in alphabetical order:
{"challenge":"<base64url>","did":"<did>","nonce":"<nonce>","timestamp":"<ISO8601>"}
The WASM crypto backend's jcsCanonicalize handles RFC 8785 ordering.
declare function buildChallengePayload(challenge: Challenge, did: string): Uint8Array;Source: @openagentid/aegis-sdk@0.1.1, dist/auth/index.d.ts:28.
Challenge
A challenge issued by the verifier to an authenticating entity.
Type-only declaration; it is not a runtime value.
interface Challenge {
challengeBytes: Uint8Array;
timestamp: string;
nonce: string;
expiresAt: string;
}Source: @openagentid/aegis-sdk@0.1.1, dist/auth/index.d.ts:7.
ChallengeResponseProvider
Auth provider implementing the AEGIS challenge-response protocol.
Validates signed_challenge credentials by:
- Resolving the DID via the registered DID resolver
- Extracting the primary authentication public key
- Reconstructing the challenge and verifying the Ed25519 signature
declare class ChallengeResponseProvider implements AuthProvider {
constructor(resolver: DidResolver);
providerName(): string;
verifier(): ChallengeVerifier;
validate(credential: AuthCredential): Promise<AuthContext>;
getIdentity(ctx: AuthContext): Promise<AegisIdentity>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/auth/index.d.ts:62.
ChallengeVerifier
Challenge-response verifier with in-memory nonce tracking.
Production deployments should swap the in-memory nonce set for a TTL-
backed cache or database via the {@link NonceStore } abstraction in
auth/store.ts.
declare class ChallengeVerifier {
verifyResponse(challenge: Challenge, did: string, signatureB64: string, publicKey: Uint8Array): void;
clearNonces(): void;
}Source: @openagentid/aegis-sdk@0.1.1, dist/auth/index.d.ts:36.
generateChallenge
Generate a new random challenge.
declare function generateChallenge(): Challenge;Source: @openagentid/aegis-sdk@0.1.1, dist/auth/index.d.ts:18.
InMemoryNonceStore
declare class InMemoryNonceStore implements NonceStore {
recordNonce(nonce: string): Promise<boolean>;
hasNonce(nonce: string): Promise<boolean>;
cleanup(): Promise<number>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/store-DM30q3CR.d.ts:48.
InMemorySessionStore
declare class InMemorySessionStore implements SessionStore {
storeSession(session: Session): Promise<void>;
getSession(sessionId: string): Promise<Session | null>;
deleteSession(sessionId: string): Promise<boolean>;
listByDid(did: string, pagination?: Pagination): Promise<Session[]>;
cleanupExpired(): Promise<number>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/store-DM30q3CR.d.ts:34.
NonceStore
Type-only declaration; it is not a runtime value.
interface NonceStore {
recordNonce(nonce: string): Promise<boolean>;
hasNonce(nonce: string): Promise<boolean>;
cleanup(): Promise<number>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/store-DM30q3CR.d.ts:42.
SessionManager
declare class SessionManager {
readonly humanLifetimeMs: number;
readonly agentLifetimeMs: number;
constructor(opts?: SessionManagerOptions);
createSession(params: {
did: string;
provider: string;
scope?: string[];
isAgent: boolean;
deviceBinding?: string | null;
}): Session;
getSession(sessionId: string): Session;
revokeSession(sessionId: string): void;
isValid(sessionId: string): boolean;
cleanupExpired(): number;
sessionCount(): number;
}Source: @openagentid/aegis-sdk@0.1.1, dist/store-DM30q3CR.d.ts:7.
SessionManagerOptions
Type-only declaration; it is not a runtime value.
interface SessionManagerOptions {
humanLifetimeMs?: number;
agentLifetimeMs?: number;
}Source: @openagentid/aegis-sdk@0.1.1, dist/store-DM30q3CR.d.ts:3.
SessionStore
Type-only declaration; it is not a runtime value.
interface SessionStore {
storeSession(session: Session): Promise<void>;
getSession(sessionId: string): Promise<Session | null>;
deleteSession(sessionId: string): Promise<boolean>;
listByDid(did: string, pagination?: Pagination): Promise<Session[]>;
cleanupExpired(): Promise<number>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/store-DM30q3CR.d.ts:27.
Supporting declarations
These package-owned declarations are referenced by the exports above. Their presence here does not make them importable from this entry point. Import only the names in Exports.
AegisIdentity
Identity information extracted from authentication.
Type-only declaration; it is not a runtime value.
interface AegisIdentity {
did: string;
identityType: IdentityType;
displayName?: string | null;
conformanceLevel?: number | null;
}Source: @openagentid/aegis-sdk@0.1.1, dist/types-Ck8QCcs2.d.ts:6.
AgentLineageProof
Type-only declaration; it is not a runtime value.
interface AgentLineageProof {
type: string;
verificationMethod: string;
created: string;
jws: string;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:19.
AuthContext
The output of successful authentication (AEGIS Spec §7.1).
Type-only declaration; it is not a runtime value.
interface AuthContext {
provider: string;
subject: string;
did?: string | null;
sessionId?: string | null;
expiresAt?: string | null;
claims: Record<string, unknown>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/types-Ck8QCcs2.d.ts:13.
AuthCredential
Discriminated union of credentials accepted by AEGIS auth providers (§7.2).
Type-only declaration; it is not a runtime value.
type AuthCredential = {
type: "bearer_token";
token: string;
} | {
type: "session_cookie";
cookie: string;
} | {
type: "api_key";
key: string;
} | {
type: "signed_challenge";
did: string;
challenge: string;
signature: string;
timestamp: string;
nonce: string;
} | {
type: "capability_token";
token: string;
} | {
type: "passkey_assertion";
credentialId: string;
authenticatorData: string;
clientDataJson: string;
signature: string;
} | {
type: "custom";
provider: string;
data: unknown;
};Source: @openagentid/aegis-sdk@0.1.1, dist/types-Ck8QCcs2.d.ts:22.
AuthProvider
Type-only declaration; it is not a runtime value.
interface AuthProvider {
validate(credential: AuthCredential): Promise<AuthContext>;
getIdentity(ctx: AuthContext): Promise<AegisIdentity>;
providerName(): string;
refresh?(ctx: AuthContext): Promise<AuthContext>;
revoke?(ctx: AuthContext): Promise<void>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:92.
CreateDidParams
Type-only declaration; it is not a runtime value.
interface CreateDidParams {
entityKind: string;
namespace: string;
identifier: string;
metadata: Record<string, string>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:66.
DidCreationResult
Type-only declaration; it is not a runtime value.
interface DidCreationResult {
did: string;
document: OasDocument;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:72.
DidResolver
DID Resolver plugin interface (§4.1).
Enables AEGIS to resolve any DID method without coupling to a specific resolution mechanism. Each resolver handles one or more DID methods.
Implementations MUST resolve within 5 seconds.
Type-only declaration; it is not a runtime value.
interface DidResolver {
resolve(did: string): Promise<OasDocument>;
handles(did: string): boolean;
supportedMethods(): readonly string[];
create?(params: CreateDidParams): Promise<DidCreationResult>;
update?(did: string, document: OasDocument): Promise<void>;
deactivate?(did: string): Promise<void>;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:84.
DocumentMetadata
Type-only declaration; it is not a runtime value.
interface DocumentMetadata {
created: string;
updated?: string | null;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:25.
DocumentProof
Type-only declaration; it is not a runtime value.
interface DocumentProof {
type: string;
verificationMethod: string;
created: string;
jws?: string;
proofValue?: string;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:29.
IdentityType
The type of entity being authenticated.
Type-only declaration; it is not a runtime value.
type IdentityType = "human" | "agent" | "organization" | "enterprise" | "delegated";Source: @openagentid/aegis-sdk@0.1.1, dist/types-Ck8QCcs2.d.ts:4.
LifecycleStatus
Type-only declaration; it is not a runtime value.
type LifecycleStatus = "active" | "suspended" | "terminated" | "deprecated" | "draft";Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:3.
LineageSection
Optional lineage section for non-root entities.
Type-only declaration; it is not a runtime value.
interface LineageSection {
parent: string;
generation: number;
humanRootChain: string[];
proof?: AgentLineageProof | null;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:13.
OasDocument
Minimal OAS Identity Document interface.
Type-only declaration; it is not a runtime value.
interface OasDocument {
id: string;
oasVersion: string;
kind: string;
verificationMethod: VerificationMethod[];
authentication?: string[];
assertionMethod?: string[];
delegationMethod?: string[];
metadata: DocumentMetadata;
lineage?: LineageSection | null;
lifecycleStatus?: LifecycleStatus | null;
revoked?: boolean;
proof?: DocumentProof | null;
[key: string]: unknown;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:37.
Pagination
Type-only declaration; it is not a runtime value.
interface Pagination {
limit: number;
offset: number;
}Source: @openagentid/aegis-sdk@0.1.1, dist/types-Ck8QCcs2.d.ts:204.
Session
Session token structure (AEGIS Spec §7.4).
Type-only declaration; it is not a runtime value.
interface Session {
sessionId: string;
did: string;
provider: string;
createdAt: string;
expiresAt: string;
scope: string[];
deviceBinding?: string | null;
}Source: @openagentid/aegis-sdk@0.1.1, dist/types-Ck8QCcs2.d.ts:53.
VerificationMethod
Verification method per W3C DID-Core.
Type-only declaration; it is not a runtime value.
interface VerificationMethod {
id: string;
type: string;
controller: string;
publicKeyMultibase: string;
}Source: @openagentid/aegis-sdk@0.1.1, dist/plugin-CzTTSkdE.d.ts:6.
Package requirements
Dependencies
| Package | Published range |
|---|---|
| uuid | ^11.0.0 |
| zod | ^3.23.0 |
Archive verification
Pinned integrity:
sha512-eKG79P17teM8i+ZQaNdBEPJnL0XT9723i04kDxgVRrOb0VOnNW5rt2doLq8g4mHBZ4rjHdPEuzZmj5LsL4iuVw==