@openagentid/arsenal-sdk API
Exported TypeScript types, signatures and source documentation.
Package manifest, subpaths, and integration guide.
This reference resolves exported symbols from the package entry point with the TypeScript parser/type checker. It includes declarations and inferred types, not implementation bodies. External dependencies unavailable to the extraction environment can remain unresolved; this is source documentation, not proof that all packages typecheck or are published.
VERSION
export declare const VERSION: "0.1.0";Source: arsenal/sdks/typescript/src/index.ts:48.
isClientError
Returns true if the error code falls into the 1000..5999 client-error range.
export declare const isClientError: (code: number) => boolean;Source: arsenal/sdks/typescript/src/core/errors.ts:108.
isServerError
Returns true if the error code falls into the 6000..6999 server-error range.
export declare const isServerError: (code: number) => boolean;Source: arsenal/sdks/typescript/src/core/errors.ts:113.
isProxyError
Returns true if the error code falls into the 8000..8999 proxy error range.
export declare const isProxyError: (code: number) => boolean;Source: arsenal/sdks/typescript/src/core/errors.ts:118.
isConsentError
Returns true if the error code falls into the 9000..9999 consent error range.
export declare const isConsentError: (code: number) => boolean;Source: arsenal/sdks/typescript/src/core/errors.ts:123.
isFingerprintError
Returns true if the error code falls into the 10000..10999 fingerprint range.
export declare const isFingerprintError: (code: number) => boolean;Source: arsenal/sdks/typescript/src/core/errors.ts:128.
isPermanentError
Returns true if the error is permanent (retry will not help).
export declare const isPermanentError: (code: number) => boolean;Source: arsenal/sdks/typescript/src/core/errors.ts:133.
sanitizeResourceId
Strip path-traversal characters and cap length.
export declare const sanitizeResourceId: (id: string) => string;Source: arsenal/sdks/typescript/src/core/errors.ts:360.
sanitizeScope
Strip unsafe characters from a scope; keep separators.
export declare const sanitizeScope: (scope: string) => string;Source: arsenal/sdks/typescript/src/core/errors.ts:371.
sanitizeFieldName
Strip unsafe characters from a field name.
export declare const sanitizeFieldName: (field: string) => string;Source: arsenal/sdks/typescript/src/core/errors.ts:382.
ErrorCode
Error codes for programmatic handling. Numeric values match the Rust crate
arsenal_core::error::ErrorCode so wire-level cross-language parity holds.
export declare const ErrorCode: { readonly AuthenticationFailed: 1001; readonly TokenExpired: 1002; readonly TokenSignatureInvalid: 1003; readonly PopVerificationFailed: 1004; readonly IdentityInvalid: 1005; readonly SessionExpired: 1006; readonly InsufficientPermissions: 2001; readonly ScopeExceeded: 2002; readonly PolicyDenied: 2003; readonly DelegationInvalid: 2004; readonly RateLimitExceeded: 2005; readonly BudgetExhausted: 2006; readonly TimeConstraintViolation: 3001; readonly EnvironmentBindingViolation: 3002; readonly NetworkConstraintViolation: 3003; readonly DeviceBindingViolation: 3004; readonly OriginBindingViolation: 3005; readonly SecretNotFound: 4001; readonly SecretVersionNotFound: 4002; readonly SecretRevoked: 4003; readonly SecretRotationInProgress: 4004; readonly SecretUnwrapLimitExceeded: 4005; readonly CryptoOperationFailed: 4006; readonly ValidationFailed: 5001; readonly MalformedRequest: 5002; readonly InvalidTokenFormat: 5003; readonly InvalidScopeFormat: 5004; readonly InvalidConstraint: 5005; readonly InternalError: 6001; readonly StorageError: 6002; readonly ConfigurationError: 6003; readonly CryptoSubsystemError: 6004; readonly AuditError: 6005; readonly SerializationFailed: 6006; readonly TokenRevoked: 7001; readonly AgentDeactivated: 7002; readonly TenantSuspended: 7003; readonly RevocationStatusUnknown: 7004; readonly ProxyDestinationViolation: 8001; readonly ProxyRequestFailed: 8002; readonly ProxyTimeout: 8003; readonly SsrfBlocked: 8004; readonly TemplateVariableNotFound: 8005; readonly TemplateVariableAccessDenied: 8006; readonly InvalidTemplateVariable: 8007; readonly OAuthReauthRequired: 8008; readonly ConsentRequired: 9001; readonly ConsentDenied: 9002; readonly ConsentExpired: 9003; readonly ConsentRevoked: 9004; readonly FingerprintMismatch: 10001; readonly FingerprintStateNotFound: 10002; readonly DctScopeAmplification: 11001; readonly DctDepthExceeded: 11002; };Source: arsenal/sdks/typescript/src/core/errors.ts:15.
ErrorCodeValue
export type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];Source: arsenal/sdks/typescript/src/core/errors.ts:93.
ErrorContext
Additional structured context attached to an ArsenalError. All fields are sanitized — never include raw secrets or internal paths.
/**
* Additional structured context attached to an ArsenalError. All fields are
* sanitized — never include raw secrets or internal paths.
*/
export interface ErrorContext {
operation?: string;
resource?: string;
constraint?: string;
timestamp?: string; // ISO 8601
}Source: arsenal/sdks/typescript/src/core/errors.ts:141.
ArsenalError
Main error type for ARSENAL operations.
Extends the native Error class so it interoperates with standard JS error
handling while carrying structured code/correlation/context fields.
export declare class ArsenalError {
name: "ArsenalError";
code: number;
correlationId: string | undefined;
context: ErrorContext | undefined;
constructor(code: number, message: string, options?: { correlationId?: string; context?: ErrorContext; cause?: unknown; }): ArsenalError;
toString(): string;
toJSON(): { code: number; message: string; correlation_id?: string; context?: ErrorContext; };
withCorrelationId(id: string): ArsenalError;
withContext(context: ErrorContext): ArsenalError;
authenticationFailed(): ArsenalError;
tokenExpired(): ArsenalError;
tokenSignatureInvalid(): ArsenalError;
tokenRevoked(): ArsenalError;
scopeExceeded(): ArsenalError;
insufficientPermissions(requiredScope: string): ArsenalError;
policyDenied(policyId: string): ArsenalError;
rateLimitExceeded(retryAfterSecs?: number): ArsenalError;
secretNotFound(): ArsenalError;
validationFailed(field: string, reason: string): ArsenalError;
internal(): ArsenalError;
sessionExpired(): ArsenalError;
proxyDestinationViolation(domain: string): ArsenalError;
ssrfBlocked(): ArsenalError;
templateVariableNotFound(variable: string): ArsenalError;
invalidTemplateVariable(name: string): ArsenalError;
consentRequired(): ArsenalError;
consentDenied(): ArsenalError;
fingerprintMismatch(): ArsenalError;
configurationError(component: string): ArsenalError;
cryptoOperationFailed(): ArsenalError;
}Source: arsenal/sdks/typescript/src/core/errors.ts:154.
TenantId
Tenant identifier — represents an organization or customer.
export declare class TenantId {
parse(id: string): TenantId;
generate(): TenantId;
asString(): string;
toString(): string;
toJSON(): string;
equals(other: TenantId): boolean;
}Source: arsenal/sdks/typescript/src/core/identity.ts:21.
PrincipalId
Principal identifier — user, service account, or system principal.
export declare class PrincipalId {
parse(id: string): PrincipalId;
generate(): PrincipalId;
system(): PrincipalId;
isSystem(): boolean;
asString(): string;
toString(): string;
toJSON(): string;
}Source: arsenal/sdks/typescript/src/core/identity.ts:63.
AgentId
Agent identifier (UUID v4).
export declare class AgentId {
fromUuid(uuid: string): AgentId;
generate(): AgentId;
asUuid(): string;
toString(): string;
toJSON(): string;
equals(other: AgentId): boolean;
}Source: arsenal/sdks/typescript/src/core/identity.ts:109.
DeviceId
Device identifier for device binding.
export declare class DeviceId {
parse(id: string): DeviceId;
asString(): string;
toString(): string;
toJSON(): string;
}Source: arsenal/sdks/typescript/src/core/identity.ts:145.
KeyFingerprint
Public-key fingerprint — BLAKE3 hash (32 bytes) of a public key.
Uses a constant-time compare for equality checks.
export declare class KeyFingerprint {
fromBytes(bytes: Uint8Array): KeyFingerprint;
fromPublicKey(publicKey: Uint8Array): Promise<KeyFingerprint>;
fromHex(hex: string): KeyFingerprint;
asBytes(): Uint8Array;
toHex(): string;
toString(): string;
constantTimeEquals(other: KeyFingerprint): boolean;
toJSON(): string;
}Source: arsenal/sdks/typescript/src/core/identity.ts:180.
AgentIdentityData
Agent identity — the public cryptographic identity of an agent.
Contains only public key material — the private key is never stored.
/**
* Agent identity — the public cryptographic identity of an agent.
*
* Contains only public key material — the private key is never stored.
*/
export interface AgentIdentityData {
id: AgentId;
publicKeyFingerprint: KeyFingerprint;
tenantId: TenantId;
name: string;
createdAt: string; // ISO 8601
expiresAt: string | null;
isActive: boolean;
tags: readonly string[];
}Source: arsenal/sdks/typescript/src/core/identity.ts:249.
AgentIdentity
export declare class AgentIdentity {
create(tenantId: TenantId, name: string, publicKeyFingerprint: KeyFingerprint): AgentIdentity;
id(): AgentId;
publicKeyFingerprint(): KeyFingerprint;
tenantId(): TenantId;
name(): string;
isActive(): boolean;
tags(): readonly string[];
isValid(now?: Date): boolean;
deactivate(): AgentIdentity;
withExpiresAt(expiresAt: Date): AgentIdentity;
withTag(tag: string): AgentIdentity;
toJSON(): { id: string; public_key_fingerprint: string; tenant_id: string; name: string; created_at: string; expires_at: string | null; is_active: boolean; tags: readonly string[]; };
}Source: arsenal/sdks/typescript/src/core/identity.ts:260.
permissionImplies
Check if permission a implies permission b.
export declare const permissionImplies: (a: PermissionValue, b: PermissionValue) => boolean;Source: arsenal/sdks/typescript/src/core/scope.ts:228.
parsePermission
Parse a string into a Permission value. Throws on unknown input.
export declare const parsePermission: (s: string) => PermissionValue;Source: arsenal/sdks/typescript/src/core/scope.ts:234.
Scope
A single permission scope.
export declare class Scope {
parse(scope: string): Scope;
wildcard(): Scope;
readOnly(service: string): Scope;
fullAccess(service: string): Scope;
service(): string;
resource(): string;
action(): string;
isWildcard(): boolean;
implies(other: Scope): boolean;
asString(): string;
toString(): string;
toJSON(): string;
equals(other: Scope): boolean;
}Source: arsenal/sdks/typescript/src/core/scope.ts:19.
ScopeSet
A set of scopes, maintained as a sorted list for deterministic encoding.
export declare class ScopeSet {
empty(): ScopeSet;
single(scope: Scope): ScopeSet;
fromStrings(scopes: readonly string[]): ScopeSet;
fromScopes(scopes: readonly Scope[]): ScopeSet;
add(scope: Scope): ScopeSet;
remove(scope: Scope): ScopeSet;
contains(scope: Scope): boolean;
allows(requested: Scope): boolean;
isSupersetOf(other: ScopeSet): boolean;
intersection(other: ScopeSet): ScopeSet;
union(other: ScopeSet): ScopeSet;
length(): number;
isEmpty(): boolean;
toArray(): readonly Scope[];
toStrings(): readonly string[];
[Symbol.iterator](): Iterator<Scope>;
toJSON(): readonly string[];
}Source: arsenal/sdks/typescript/src/core/scope.ts:124.
Permission
CRUD permission classification.
export declare const Permission: { readonly Read: "read"; readonly Create: "create"; readonly Update: "update"; readonly Delete: "delete"; readonly Admin: "admin"; };Source: arsenal/sdks/typescript/src/core/scope.ts:217.
PermissionValue
export type PermissionValue = (typeof Permission)[keyof typeof Permission];Source: arsenal/sdks/typescript/src/core/scope.ts:225.
noConstraints
Build an empty constraint object (no restrictions).
export declare const noConstraints: () => Constraints;Source: arsenal/sdks/typescript/src/core/constraints.ts:75.
withPop
Create constraints requiring proof-of-possession.
export declare const withPop: () => Constraints;Source: arsenal/sdks/typescript/src/core/constraints.ts:80.
withDevice
Create constraints with a required device binding.
export declare const withDevice: (base: Constraints, deviceId: string) => Constraints;Source: arsenal/sdks/typescript/src/core/constraints.ts:85.
withOrigins
Create constraints with an allowed-origins binding.
export declare const withOrigins: (base: Constraints, origins: readonly string[]) => Constraints;Source: arsenal/sdks/typescript/src/core/constraints.ts:95.
withTimeWindow
Create constraints with a time window.
export declare const withTimeWindow: (base: Constraints, notBefore: Date, notAfter: Date) => Constraints;Source: arsenal/sdks/typescript/src/core/constraints.ts:103.
contextNow
Create a fresh ConstraintContext with current_time=now().
export declare const contextNow: () => ConstraintContext;Source: arsenal/sdks/typescript/src/core/constraints.ts:118.
validateConstraints
Validate a set of constraints against a request context. Throws an
ArsenalError on the first violation.
export declare const validateConstraints: (constraints: Constraints, ctx: ConstraintContext) => void;Source: arsenal/sdks/typescript/src/core/constraints.ts:129.
ipInCidrRange
Check if a dotted-quad or IPv6 address falls inside a CIDR range. Supports both IPv4 and IPv6. Invalid CIDR or IP input returns false.
export declare const ipInCidrRange: (ip: string, cidr: string) => boolean;Source: arsenal/sdks/typescript/src/core/constraints.ts:317.
BindingType
export declare const BindingType: { readonly Required: "required"; readonly Preferred: "preferred"; };Source: arsenal/sdks/typescript/src/core/constraints.ts:12.
BindingTypeValue
export type BindingTypeValue = (typeof BindingType)[keyof typeof BindingType];Source: arsenal/sdks/typescript/src/core/constraints.ts:17.
DeviceBinding
export interface DeviceBinding {
device_id: string;
binding_type: BindingTypeValue;
}Source: arsenal/sdks/typescript/src/core/constraints.ts:19.
SessionBinding
export interface SessionBinding {
session_id: string;
session_key_hash?: Uint8Array; // 32 bytes when set
}Source: arsenal/sdks/typescript/src/core/constraints.ts:24.
OriginBinding
export interface OriginBinding {
allowed_origins: ReadonlySet<string>;
}Source: arsenal/sdks/typescript/src/core/constraints.ts:29.
NetworkConstraints
export interface NetworkConstraints {
allowed_ips?: ReadonlySet<string>;
denied_ips?: ReadonlySet<string>;
allowed_cidrs?: readonly string[];
allowed_asns?: ReadonlySet<number>;
}Source: arsenal/sdks/typescript/src/core/constraints.ts:33.
TimeConstraints
export interface TimeConstraints {
not_before?: string; // ISO 8601
not_after?: string; // ISO 8601
allowed_hours?: readonly number[];
allowed_days?: readonly number[];
}Source: arsenal/sdks/typescript/src/core/constraints.ts:40.
EnvironmentConstraint
export interface EnvironmentConstraint {
required_environment?: string;
required_tags?: ReadonlySet<string>;
forbidden_tags?: ReadonlySet<string>;
}Source: arsenal/sdks/typescript/src/core/constraints.ts:47.
Constraints
export interface Constraints {
device_binding?: DeviceBinding;
session_binding?: SessionBinding;
origin_binding?: OriginBinding;
network_constraints?: NetworkConstraints;
time_constraints?: TimeConstraints;
environment_constraints?: EnvironmentConstraint;
require_pop: boolean;
}Source: arsenal/sdks/typescript/src/core/constraints.ts:53.
ConstraintContext
export interface ConstraintContext {
current_time: Date;
device_id?: string;
session_id?: string;
session_key_hash?: Uint8Array;
origin?: string;
client_ip?: string;
environment?: string;
tags: ReadonlySet<string>;
}Source: arsenal/sdks/typescript/src/core/constraints.ts:63.
defaultRateLimits
Default moderate rate limits (same as Rust RateLimits::default()).
export declare const defaultRateLimits: () => RateLimits;Source: arsenal/sdks/typescript/src/core/limits.ts:17.
unlimitedRateLimits
All unlimited — use with care.
export declare const unlimitedRateLimits: () => RateLimits;Source: arsenal/sdks/typescript/src/core/limits.ts:29.
strictRateLimits
Strict lockdown rate limits.
export declare const strictRateLimits: () => RateLimits;Source: arsenal/sdks/typescript/src/core/limits.ts:34.
mergeRateLimits
Merge two limit configs taking the more restrictive (minimum) value.
export declare const mergeRateLimits: (a: RateLimits, b: RateLimits) => RateLimits;Source: arsenal/sdks/typescript/src/core/limits.ts:46.
defaultUsageBudget
export declare const defaultUsageBudget: () => UsageBudget;Source: arsenal/sdks/typescript/src/core/limits.ts:78.
unlimitedUsageBudget
export declare const unlimitedUsageBudget: () => UsageBudget;Source: arsenal/sdks/typescript/src/core/limits.ts:88.
minimalUsageBudget
export declare const minimalUsageBudget: () => UsageBudget;Source: arsenal/sdks/typescript/src/core/limits.ts:92.
mergeUsageBudget
export declare const mergeUsageBudget: (a: UsageBudget, b: UsageBudget) => UsageBudget;Source: arsenal/sdks/typescript/src/core/limits.ts:102.
RateLimits
export interface RateLimits {
requests_per_second?: number;
requests_per_minute?: number;
requests_per_hour?: number;
max_concurrent?: number;
max_request_size?: number;
max_response_size?: number;
}Source: arsenal/sdks/typescript/src/core/limits.ts:7.
UsageBudget
export interface UsageBudget {
max_requests?: number;
max_bytes?: number;
max_cost_units?: number;
max_secret_unwraps?: number;
max_delegation_depth?: number;
}Source: arsenal/sdks/typescript/src/core/limits.ts:70.
UsageStats
Current usage snapshot.
/** Current usage snapshot. */
export interface UsageStats {
request_count: number;
bytes_transferred: number;
cost_units: number;
secret_unwraps: number;
elapsed_ms: number;
}Source: arsenal/sdks/typescript/src/core/limits.ts:126.
RemainingBudget
Remaining budget (undefined entries are unlimited).
/** Remaining budget (undefined entries are unlimited). */
export interface RemainingBudget {
requests?: number;
bytes?: number;
cost_units?: number;
secret_unwraps?: number;
}Source: arsenal/sdks/typescript/src/core/limits.ts:135.
UsageTracker
Runtime usage tracker that enforces a budget.
Each record* call either succeeds or throws an ArsenalError with code
BudgetExhausted (or SecretUnwrapLimitExceeded).
export declare class UsageTracker {
constructor(budget: UsageBudget): UsageTracker;
recordRequest(): void;
recordBytes(bytes: number): void;
recordCost(units: number): void;
recordSecretUnwrap(): void;
getStats(): UsageStats;
remaining(): RemainingBudget;
}Source: arsenal/sdks/typescript/src/core/limits.ts:148.
TokenBucketLimiter
Token-bucket rate limiter. Lock-free single-threaded (JS single-threaded execution model) — refills on each try_acquire based on elapsed wall clock.
export declare class TokenBucketLimiter {
constructor(maxTokens: number, refillAmount: number, refillIntervalMs: number): TokenBucketLimiter;
perSecond(rate: number): TokenBucketLimiter;
perMinute(rate: number): TokenBucketLimiter;
perHour(rate: number): TokenBucketLimiter;
tryAcquire(): void;
available(): number;
}Source: arsenal/sdks/typescript/src/core/limits.ts:236.
CompositeRateLimiter
Composite rate limiter combining multiple time windows + concurrent cap.
Use acquire() which returns a release function — call it when the
request completes (e.g. in a finally) to decrement the concurrent
counter. If any individual limit rejects, already-consumed slots are
rolled back.
export declare class CompositeRateLimiter {
constructor(limits: RateLimits): CompositeRateLimiter;
acquire(): () => void;
}Source: arsenal/sdks/typescript/src/core/limits.ts:295.
createSecretMetadata
Create a new secret metadata record.
export declare const createSecretMetadata: (tenantId: string, name: string, secretType: SecretTypeValue) => SecretMetadata;Source: arsenal/sdks/typescript/src/core/secret.ts:142.
latestSecretRef
Reference to the latest version.
export declare const latestSecretRef: (id: string) => SecretRef;Source: arsenal/sdks/typescript/src/core/secret.ts:178.
specificSecretRef
Reference to a specific version.
export declare const specificSecretRef: (id: string, version: number) => SecretRef;Source: arsenal/sdks/typescript/src/core/secret.ts:183.
SecretId
Secret identifier.
export declare class SecretId {
generate(): SecretId;
fromString(id: string): SecretId;
asString(): string;
toString(): string;
toJSON(): string;
}Source: arsenal/sdks/typescript/src/core/secret.ts:18.
SecretVersion
Secret version number (1-based).
export declare class SecretVersion {
initial(): SecretVersion;
fromNumber(n: number): SecretVersion;
asNumber(): number;
next(): SecretVersion;
isInitial(): boolean;
toString(): string;
toJSON(): number;
}Source: arsenal/sdks/typescript/src/core/secret.ts:52.
SecretType
export declare const SecretType: { readonly ApiKey: "api_key"; readonly OAuthClientCredentials: "o_auth_client_credentials"; readonly OAuthAccessToken: "o_auth_access_token"; readonly OAuthRefreshToken: "o_auth_refresh_token"; readonly DatabaseCredentials: "database_credentials"; readonly SshKey: "ssh_key"; readonly TlsCertificate: "tls_certificate"; readonly SigningKey: "signing_key"; readonly EncryptionKey: "encryption_key"; readonly Generic: "generic"; };Source: arsenal/sdks/typescript/src/core/secret.ts:91.
SecretTypeValue
export type SecretTypeValue = (typeof SecretType)[keyof typeof SecretType];Source: arsenal/sdks/typescript/src/core/secret.ts:104.
SecretVersionState
export declare const SecretVersionState: { readonly Active: "active"; readonly Previous: "previous"; readonly Disabled: "disabled"; readonly PendingDeletion: "pending_deletion"; };Source: arsenal/sdks/typescript/src/core/secret.ts:106.
SecretVersionStateValue
export type SecretVersionStateValue = (typeof SecretVersionState)[keyof typeof SecretVersionState];Source: arsenal/sdks/typescript/src/core/secret.ts:113.
SecretVersionInfo
export interface SecretVersionInfo {
version: number;
created_at: string;
created_by?: string;
state: SecretVersionStateValue;
}Source: arsenal/sdks/typescript/src/core/secret.ts:116.
SecretMetadata
export interface SecretMetadata {
id: string;
tenant_id: string;
name: string;
description?: string;
secret_type: SecretTypeValue;
current_version: number;
versions: readonly SecretVersionInfo[];
created_at: string;
updated_at: string;
expires_at?: string;
last_rotated_at?: string;
next_rotation_at?: string;
is_active: boolean;
labels: Readonly<Record<string, string>>;
service?: string;
}Source: arsenal/sdks/typescript/src/core/secret.ts:123.
SecretRef
Reference to a secret — used when the value shouldn't be inlined.
/** Reference to a secret — used when the value shouldn't be inlined. */
export interface SecretRef {
id: string;
version?: number;
}Source: arsenal/sdks/typescript/src/core/secret.ts:172.
SecretValue
Secret value holder that clears its internal buffer when zeroize() is
called. JS has no destructors, so callers must explicitly invoke
zeroize() in a finally block after use.
export declare class SecretValue {
fromBytes(bytes: Uint8Array): SecretValue;
fromString(s: string): SecretValue;
asBytes(): Uint8Array;
asString(): string;
length(): number;
isEmpty(): boolean;
zeroize(): void;
}Source: arsenal/sdks/typescript/src/core/secret.ts:192.
buildTokenClaims
Validate and build a fresh set of token claims.
export declare const buildTokenClaims: (opts: TokenClaimsBuildOptions) => TokenClaims;Source: arsenal/sdks/typescript/src/core/token.ts:89.
SignatureAlgorithm
export declare const SignatureAlgorithm: { readonly Ed25519: "ED25519"; readonly Es256: "ES256"; readonly Es384: "ES384"; };Source: arsenal/sdks/typescript/src/core/token.ts:23.
SignatureAlgorithmValue
export type SignatureAlgorithmValue = (typeof SignatureAlgorithm)[keyof typeof SignatureAlgorithm];Source: arsenal/sdks/typescript/src/core/token.ts:29.
TokenSignature
export interface TokenSignature {
bytes: Uint8Array;
algorithm: SignatureAlgorithmValue;
key_id?: string;
}Source: arsenal/sdks/typescript/src/core/token.ts:32.
ProofOfPossession
export interface ProofOfPossession {
/** Hex-encoded BLAKE3 public key fingerprint. */
key_fingerprint: string;
/** Algorithm label, e.g. "Ed25519". */
alg: string;
}Source: arsenal/sdks/typescript/src/core/token.ts:38.
TokenTrace
export interface TokenTrace {
issuance_id: string;
parent_token_id?: string;
policy_id?: string;
delegation_depth: number;
}Source: arsenal/sdks/typescript/src/core/token.ts:45.
TokenClaims
export interface TokenClaims {
jti: string; // Token ID (UUID v7)
sub: string; // Subject (agent ID UUID)
iss: string; // Issuer
aud: string; // Audience
iat: string; // Issued-at ISO timestamp
nbf: string; // Not-before ISO timestamp
exp: string; // Expiration ISO timestamp
tenant_id: string;
scope: readonly string[];
constraints?: Constraints;
limits?: RateLimits;
budget?: UsageBudget;
trace?: TokenTrace;
cnf?: ProofOfPossession;
delegated_variables?: readonly string[];
max_delegation_depth?: number;
}Source: arsenal/sdks/typescript/src/core/token.ts:52.
TokenClaimsBuildOptions
Options for building a fresh set of claims.
/** Options for building a fresh set of claims. */
export interface TokenClaimsBuildOptions {
subject: string;
issuer: string;
audience: string;
tenant_id: string;
scopes: ScopeSet;
ttl_seconds?: number;
constraints?: Constraints;
limits?: RateLimits;
budget?: UsageBudget;
parent_token_id?: string;
cnf?: ProofOfPossession;
delegated_variables?: readonly string[];
max_delegation_depth?: number;
}Source: arsenal/sdks/typescript/src/core/token.ts:72.
AgentCapabilityToken
Immutable Agent Capability Token. Wraps a set of claims and an optional signature, and provides validation + CBOR (de)serialization.
export declare class AgentCapabilityToken {
fromClaims(claims: TokenClaims): AgentCapabilityToken;
fromClaimsAndSignature(claims: TokenClaims, signature: TokenSignature): AgentCapabilityToken;
id(): string;
subject(): string;
audience(): string;
scopes(): ScopeSet;
isExpired(now?: Date): boolean;
isNotYetValid(now?: Date): boolean;
isTimeValid(now?: Date): boolean;
remainingTtlMs(now?: Date): number;
isSigned(): boolean;
validateStructure(now?: Date): void;
toCbor(): Uint8Array;
claimsToCbor(): Uint8Array;
toBase64Url(): string;
fromCbor(bytes: Uint8Array): AgentCapabilityToken;
fromBase64Url(s: string): AgentCapabilityToken;
}Source: arsenal/sdks/typescript/src/core/token.ts:135.
consentStatusAllowsOperation
export declare const consentStatusAllowsOperation: (status: ConsentStatusValue) => boolean;Source: arsenal/sdks/typescript/src/core/consent.ts:26.
consentRecordIsValid
Validity check (not revoked and not expired).
export declare const consentRecordIsValid: (record: ConsentRecord, now?: Date) => boolean;Source: arsenal/sdks/typescript/src/core/consent.ts:61.
consentRecordCoversVariable
Returns true if the record covers the given variable name.
export declare const consentRecordCoversVariable: (record: ConsentRecord, variable: string) => boolean;Source: arsenal/sdks/typescript/src/core/consent.ts:67.
consentRecordCoversDomain
Returns true if the record covers the given destination domain (case-insensitive).
export declare const consentRecordCoversDomain: (record: ConsentRecord, domain: string) => boolean;Source: arsenal/sdks/typescript/src/core/consent.ts:75.
revokeConsentRecord
Return a revoked copy of the consent record.
export declare const revokeConsentRecord: (record: ConsentRecord, at?: Date) => ConsentRecord;Source: arsenal/sdks/typescript/src/core/consent.ts:84.
consentRecordSigningBytes
Canonical CBOR encoding of the signable subset (excludes signature,
revoked, revoked_at). This is the byte sequence a human root key signs
with Ed25519 to produce record.signature.
export declare const consentRecordSigningBytes: (record: ConsentRecord) => Uint8Array;Source: arsenal/sdks/typescript/src/core/consent.ts:96.
createConsentRequest
Create a new consent request with validation.
export declare const createConsentRequest: (opts: { agent_did: string; human_root_did: string; variables: readonly string[]; destination_domains: readonly string[]; scopes: readonly string[]; ttl_seconds?: number; }) => ConsentRequest;Source: arsenal/sdks/typescript/src/core/consent.ts:123.
consentRequestIsExpired
export declare const consentRequestIsExpired: (req: ConsentRequest, now?: Date) => boolean;Source: arsenal/sdks/typescript/src/core/consent.ts:156.
ConsentStatus
export declare const ConsentStatus: { readonly PreApproved: "pre_approved"; readonly Approved: "approved"; readonly Pending: "pending"; readonly Denied: "denied"; readonly Revoked: "revoked"; readonly NotRequired: "not_required"; };Source: arsenal/sdks/typescript/src/core/consent.ts:15.
ConsentStatusValue
export type ConsentStatusValue = (typeof ConsentStatus)[keyof typeof ConsentStatus];Source: arsenal/sdks/typescript/src/core/consent.ts:24.
ConsentPolicy
export declare const ConsentPolicy: { readonly PerVariable: "per_variable"; readonly PerProvider: "per_provider"; readonly PerAgent: "per_agent"; };Source: arsenal/sdks/typescript/src/core/consent.ts:34.
ConsentPolicyValue
export type ConsentPolicyValue = (typeof ConsentPolicy)[keyof typeof ConsentPolicy];Source: arsenal/sdks/typescript/src/core/consent.ts:40.
ConsentRecord
export interface ConsentRecord {
consent_id: string;
tenant_id: string;
agent_did: string;
human_root_did: string;
variables: readonly string[];
destination_domains: readonly string[];
scopes: readonly string[];
granted_by: string;
granted_at: string;
expires_at: string;
/** Ed25519 signature bytes over the signing payload. */
signature: Uint8Array;
revocable: boolean;
revoked: boolean;
revoked_at?: string;
}Source: arsenal/sdks/typescript/src/core/consent.ts:42.
ConsentRequest
export interface ConsentRequest {
request_id: string;
agent_did: string;
human_root_did: string;
variables: readonly string[];
destination_domains: readonly string[];
scopes: readonly string[];
created_at: string;
expires_at: string;
}Source: arsenal/sdks/typescript/src/core/consent.ts:111.
createDestinationBinding
Create and validate a destination binding.
export declare const createDestinationBinding: (allowedDomains: readonly string[], opts?: Partial<Omit<DestinationBinding, "allowed_domains">>) => DestinationBinding;Source: arsenal/sdks/typescript/src/core/proxy.ts:61.
validateDestinationBinding
Throws if the binding is malformed.
export declare const validateDestinationBinding: (binding: DestinationBinding) => void;Source: arsenal/sdks/typescript/src/core/proxy.ts:78.
isDomainAllowed
Check if a domain is allowed by the binding.
export declare const isDomainAllowed: (binding: DestinationBinding, domain: string) => boolean;Source: arsenal/sdks/typescript/src/core/proxy.ts:109.
isMethodAllowed
export declare const isMethodAllowed: (binding: DestinationBinding, method: string) => boolean;Source: arsenal/sdks/typescript/src/core/proxy.ts:119.
isPortAllowed
export declare const isPortAllowed: (binding: DestinationBinding, port: number) => boolean;Source: arsenal/sdks/typescript/src/core/proxy.ts:124.
isPathAllowed
export declare const isPathAllowed: (binding: DestinationBinding, path: string) => boolean;Source: arsenal/sdks/typescript/src/core/proxy.ts:129.
createTemplateVariable
Create a template variable, validating the name.
export declare const createTemplateVariable: (name: string) => TemplateVariable;Source: arsenal/sdks/typescript/src/core/proxy.ts:165.
validateVariableName
export declare const validateVariableName: (name: string) => void;Source: arsenal/sdks/typescript/src/core/proxy.ts:170.
inferVariablePrefix
Infer the credential-type prefix from a variable name.
export declare const inferVariablePrefix: (name: string) => VariablePrefixValue;Source: arsenal/sdks/typescript/src/core/proxy.ts:192.
parseTemplateVariables
Parse all {{VARIABLE}} placeholders from a string. Invalid names
inside {{}} are silently skipped. Duplicates are deduplicated.
export declare const parseTemplateVariables: (input: string) => readonly TemplateVariable[];Source: arsenal/sdks/typescript/src/core/proxy.ts:207.
validateProxyRequest
Validate structural fields of a proxy request.
export declare const validateProxyRequest: (req: ProxyRequest) => void;Source: arsenal/sdks/typescript/src/core/proxy.ts:243.
effectiveTimeoutMs
Resolve the effective timeout, capped to MAX_TIMEOUT_MS.
export declare const effectiveTimeoutMs: (req: ProxyRequest) => number;Source: arsenal/sdks/typescript/src/core/proxy.ts:263.
extractProxyRequestVariables
Extract all template variables used anywhere in a proxy request.
export declare const extractProxyRequestVariables: (req: ProxyRequest) => readonly TemplateVariable[];Source: arsenal/sdks/typescript/src/core/proxy.ts:268.
VariablePrefix
export declare const VariablePrefix: { readonly OAuth2: "OAUTH2"; readonly OAuth1: "OAUTH1"; readonly ApiKey: "API_KEY"; readonly Basic: "BASIC"; readonly Bearer: "BEARER"; readonly Cert: "CERT"; readonly Custom: "CUSTOM"; };Source: arsenal/sdks/typescript/src/core/proxy.ts:38.
VariablePrefixValue
export type VariablePrefixValue = (typeof VariablePrefix)[keyof typeof VariablePrefix];Source: arsenal/sdks/typescript/src/core/proxy.ts:48.
DestinationBinding
Destination binding restricting which endpoints a credential can reach.
/** Destination binding restricting which endpoints a credential can reach. */
export interface DestinationBinding {
allowed_domains: readonly string[];
allowed_paths?: readonly string[];
allowed_methods?: readonly string[];
allowed_ports?: readonly number[];
require_tls: boolean;
allow_subdomains: boolean;
}Source: arsenal/sdks/typescript/src/core/proxy.ts:51.
TemplateVariable
Parsed template variable reference.
/** Parsed template variable reference. */
export interface TemplateVariable {
name: string;
prefix: VariablePrefixValue;
}Source: arsenal/sdks/typescript/src/core/proxy.ts:159.
ProxyRequest
Proxy request envelope sent to the broker.
/** Proxy request envelope sent to the broker. */
export interface ProxyRequest {
method: string;
url: string;
headers?: Readonly<Record<string, string>>;
body?: Uint8Array;
capability_token: string;
timeout_ms?: number;
}Source: arsenal/sdks/typescript/src/core/proxy.ts:233.
ProxyResponse
Response from a proxy request.
/** Response from a proxy request. */
export interface ProxyResponse {
status: number;
headers: Readonly<Record<string, string>>;
body: Uint8Array;
proxy_metadata: ProxyMetadata;
}Source: arsenal/sdks/typescript/src/core/proxy.ts:296.
ProxyMetadata
Metadata about proxy processing (never includes resolved values).
/** Metadata about proxy processing (never includes resolved values). */
export interface ProxyMetadata {
variables_resolved: readonly string[];
destination_verified: boolean;
fingerprint_verified: boolean;
consent_status: ConsentStatusValue;
latency_ms: number;
request_id: string;
}Source: arsenal/sdks/typescript/src/core/proxy.ts:304.
VariableResolutionTable
In-memory variable → secret-ref table used by the broker.
export declare class VariableResolutionTable {
register(variableName: string, secretRef: { id: string; version?: number; }): void;
unregister(variableName: string): boolean;
resolve(variableName: string): { id: string; version?: number; } | undefined;
variableNames(): readonly string[];
size(): number;
isEmpty(): boolean;
}Source: arsenal/sdks/typescript/src/core/proxy.ts:314.
createPolicyRule
Create a simple rule. Conditions are added via spread.
export declare const createPolicyRule: (id: string, effect: PolicyEffectValue, conditions?: readonly PolicyCondition[]) => PolicyRule;Source: arsenal/sdks/typescript/src/core/policy.ts:104.
createPolicyDocument
Build a new policy document (no rules yet).
export declare const createPolicyDocument: (tenantId: string, name: string) => PolicyDocument;Source: arsenal/sdks/typescript/src/core/policy.ts:136.
addPolicyRule
Append a rule to a policy, returning a new document.
export declare const addPolicyRule: (doc: PolicyDocument, rule: PolicyRule) => PolicyDocument;Source: arsenal/sdks/typescript/src/core/policy.ts:160.
createPolicyRequest
Create a new policy request with current timestamp.
export declare const createPolicyRequest: (agentId: string, tenantId: string, requestedScope: string) => PolicyRequest;Source: arsenal/sdks/typescript/src/core/policy.ts:182.
decisionIsAllowed
Returns true if the decision allows the action.
export declare const decisionIsAllowed: (d: PolicyDecision) => boolean;Source: arsenal/sdks/typescript/src/core/policy.ts:203.
decisionIsDenied
Returns true if the decision denies the action.
export declare const decisionIsDenied: (d: PolicyDecision) => boolean;Source: arsenal/sdks/typescript/src/core/policy.ts:208.
MAX_CONDITION_DEPTH
Maximum recursion depth for nested And/Or/Not conditions.
export declare const MAX_CONDITION_DEPTH: 16;Source: arsenal/sdks/typescript/src/core/policy.ts:17.
PolicyId
export declare class PolicyId {
parse(id: string): PolicyId;
generate(): PolicyId;
asString(): string;
toString(): string;
toJSON(): string;
}Source: arsenal/sdks/typescript/src/core/policy.ts:19.
PolicyEffect
export declare const PolicyEffect: { readonly Allow: "allow"; readonly Deny: "deny"; };Source: arsenal/sdks/typescript/src/core/policy.ts:53.
PolicyEffectValue
export type PolicyEffectValue = (typeof PolicyEffect)[keyof typeof PolicyEffect];Source: arsenal/sdks/typescript/src/core/policy.ts:58.
ConditionOperator
export declare const ConditionOperator: { readonly Equals: "equals"; readonly NotEquals: "not_equals"; readonly Contains: "contains"; readonly StartsWith: "starts_with"; readonly EndsWith: "ends_with"; readonly Matches: "matches"; readonly In: "in"; readonly NotIn: "not_in"; };Source: arsenal/sdks/typescript/src/core/policy.ts:60.
ConditionOperatorValue
export type ConditionOperatorValue = (typeof ConditionOperator)[keyof typeof ConditionOperator];Source: arsenal/sdks/typescript/src/core/policy.ts:71.
PolicyCondition
export type PolicyCondition = {
type: "agent_id";
operator: ConditionOperatorValue;
value: string;
} | {
type: "tenant_id";
operator: ConditionOperatorValue;
value: string;
} | {
type: "scope";
operator: ConditionOperatorValue;
value: string;
} | {
type: "environment";
operator: ConditionOperatorValue;
value: string;
} | {
type: "time_of_day";
allowed_hours: readonly number[];
} | {
type: "day_of_week";
allowed_days: readonly number[];
} | {
type: "ip_address";
allowed_cidrs: readonly string[];
} | {
type: "attribute";
key: string;
operator: ConditionOperatorValue;
value: string;
} | {
type: "and";
conditions: readonly PolicyCondition[];
} | {
type: "or";
conditions: readonly PolicyCondition[];
} | {
type: "not";
condition: PolicyCondition;
};Source: arsenal/sdks/typescript/src/core/policy.ts:74.
PolicyRule
export interface PolicyRule {
id: string;
description?: string;
effect: PolicyEffectValue;
conditions: readonly PolicyCondition[];
scopes?: ScopeSet;
constraints?: Constraints;
rate_limits?: RateLimits;
budget?: UsageBudget;
}Source: arsenal/sdks/typescript/src/core/policy.ts:92.
PolicySignature
export interface PolicySignature {
bytes: Uint8Array;
algorithm: string;
key_id: string;
signed_at: string;
}Source: arsenal/sdks/typescript/src/core/policy.ts:112.
PolicyDocument
export interface PolicyDocument {
id: string;
version: number;
tenant_id: string;
name: string;
description?: string;
rules: readonly PolicyRule[];
default_effect: PolicyEffectValue;
is_active: boolean;
priority: number;
created_at: string;
updated_at: string;
signature?: PolicySignature;
labels: Readonly<Record<string, string>>;
}Source: arsenal/sdks/typescript/src/core/policy.ts:119.
PolicyRequest
export interface PolicyRequest {
agent_id: string;
tenant_id: string;
requested_scope: string;
timestamp: Date;
environment?: string;
client_ip?: string;
attributes: Readonly<Record<string, string>>;
}Source: arsenal/sdks/typescript/src/core/policy.ts:171.
PolicyDecision
export interface PolicyDecision {
effect: PolicyEffectValue;
matched_rule?: string;
reason?: string;
}Source: arsenal/sdks/typescript/src/core/policy.ts:196.
denyDelegation
Default: delegation denied.
export declare const denyDelegation: () => DelegationConstraints;Source: arsenal/sdks/typescript/src/core/delegation.ts:29.
allowDelegation
Allow up to depth levels of delegation to any agent.
export declare const allowDelegation: (depth: number) => DelegationConstraints;Source: arsenal/sdks/typescript/src/core/delegation.ts:41.
canDelegateTo
Check whether a delegation to the given agent id is permitted.
export declare const canDelegateTo: (constraints: DelegationConstraints, agentId: string) => boolean;Source: arsenal/sdks/typescript/src/core/delegation.ts:53.
validateDelegationDepth
Validate a delegation chain length and scope non-amplification rule.
export declare const validateDelegationDepth: (depth: number) => void;Source: arsenal/sdks/typescript/src/core/delegation.ts:63.
MAX_DELEGATION_DEPTH
Maximum absolute delegation depth allowed anywhere in the system.
export declare const MAX_DELEGATION_DEPTH: 5;Source: arsenal/sdks/typescript/src/core/delegation.ts:12.
MAX_CHAIN_LENGTH
Maximum number of tokens in a delegation chain.
export declare const MAX_CHAIN_LENGTH: 10;Source: arsenal/sdks/typescript/src/core/delegation.ts:15.
DelegationConstraints
export interface DelegationConstraints {
allow_delegation: boolean;
max_depth: number;
delegatable_scopes?: ScopeSet;
allowed_delegates: readonly string[];
allow_any_delegate: boolean;
/** Minimum TTL reduction (seconds) between parent and child token. */
min_ttl_reduction: number;
require_approval: boolean;
}Source: arsenal/sdks/typescript/src/core/delegation.ts:17.
sessionStateCanUseTools
export declare const sessionStateCanUseTools: (state: SessionStateValue) => boolean;Source: arsenal/sdks/typescript/src/core/session.ts:55.
sessionStateCanRequestCapabilities
export declare const sessionStateCanRequestCapabilities: (state: SessionStateValue) => boolean;Source: arsenal/sdks/typescript/src/core/session.ts:59.
sessionStateIsTerminal
export declare const sessionStateIsTerminal: (state: SessionStateValue) => boolean;Source: arsenal/sdks/typescript/src/core/session.ts:67.
sessionStateIsActive
export declare const sessionStateIsActive: (state: SessionStateValue) => boolean;Source: arsenal/sdks/typescript/src/core/session.ts:71.
validSessionStateTransitions
Returns the set of valid transitions from a given state.
export declare const validSessionStateTransitions: (state: SessionStateValue) => readonly SessionStateValue[];Source: arsenal/sdks/typescript/src/core/session.ts:76.
canTransitionTo
export declare const canTransitionTo: (from: SessionStateValue, to: SessionStateValue) => boolean;Source: arsenal/sdks/typescript/src/core/session.ts:107.
SessionId
Session identifier (UUID v7 in Rust; UUID v4 is acceptable here).
export declare class SessionId {
generate(): SessionId;
fromString(s: string): SessionId;
asString(): string;
toString(): string;
toJSON(): string;
}Source: arsenal/sdks/typescript/src/core/session.ts:10.
SessionState
export declare const SessionState: { readonly AgentBootstrapped: "agent_bootstrapped"; readonly SessionStarted: "session_started"; readonly CapabilitiesGranted: "capabilities_granted"; readonly ToolUse: "tool_use"; readonly Renewal: "renewal"; readonly Escalation: "escalation"; readonly SessionEnded: "session_ended"; };Source: arsenal/sdks/typescript/src/core/session.ts:43.
SessionStateValue
export type SessionStateValue = (typeof SessionState)[keyof typeof SessionState];Source: arsenal/sdks/typescript/src/core/session.ts:53.
SessionEndReason
export declare const SessionEndReason: { readonly Completed: "completed"; readonly Logout: "logout"; readonly Timeout: "timeout"; readonly TokenExpired: "token_expired"; readonly Revoked: "revoked"; readonly SecurityViolation: "security_violation"; readonly PolicyViolation: "policy_violation"; readonly SystemShutdown: "system_shutdown"; };Source: arsenal/sdks/typescript/src/core/session.ts:114.
SessionEndReasonValue
export type SessionEndReasonValue = (typeof SessionEndReason)[keyof typeof SessionEndReason] | {
error: string;
};Source: arsenal/sdks/typescript/src/core/session.ts:125.
createAuditEvent
Create a new audit event.
export declare const createAuditEvent: (opts: { kind: AuditEventKindValue; tenant_id: string; severity?: AuditSeverityValue; outcome?: AuditOutcomeValue; description?: string; metadata?: Record<string, unknown>; agent_id?: string; session_id?: string; token_id?: string; client_ip?: string; user_agent?: string; request_id?: string; }) => AuditEvent;Source: arsenal/sdks/typescript/src/core/audit.ts:88.
hashAuditEvent
Compute a BLAKE3 hash of an audit event. The hash is used for chain
linkage and tamper detection. The result is a 32-byte Uint8Array.
export declare const hashAuditEvent: (event: AuditEvent) => Promise<Uint8Array>;Source: arsenal/sdks/typescript/src/core/audit.ts:125.
AuditSeverity
export declare const AuditSeverity: { readonly Info: "info"; readonly Warning: "warning"; readonly Error: "error"; readonly Critical: "critical"; };Source: arsenal/sdks/typescript/src/core/audit.ts:11.
AuditSeverityValue
export type AuditSeverityValue = (typeof AuditSeverity)[keyof typeof AuditSeverity];Source: arsenal/sdks/typescript/src/core/audit.ts:18.
AuditOutcome
export declare const AuditOutcome: { readonly Success: "success"; readonly Failure: "failure"; readonly Partial: "partial"; readonly Pending: "pending"; };Source: arsenal/sdks/typescript/src/core/audit.ts:20.
AuditOutcomeValue
export type AuditOutcomeValue = (typeof AuditOutcome)[keyof typeof AuditOutcome];Source: arsenal/sdks/typescript/src/core/audit.ts:27.
AuditEventKind
Kind of audit event.
export declare const AuditEventKind: { readonly AgentAuthenticated: "agent_authenticated"; readonly AuthenticationFailed: "authentication_failed"; readonly SessionStarted: "session_started"; readonly SessionEnded: "session_ended"; readonly CapabilityRequested: "capability_requested"; readonly CapabilityGranted: "capability_granted"; readonly CapabilityDenied: "capability_denied"; readonly TokenRevoked: "token_revoked"; readonly SecretRead: "secret_read"; readonly SecretRotated: "secret_rotated"; readonly ProxyRequest: "proxy_request"; readonly ProxyDenied: "proxy_denied"; readonly ConsentRequested: "consent_requested"; readonly ConsentApproved: "consent_approved"; readonly ConsentDenied: "consent_denied"; readonly ConsentRevoked: "consent_revoked"; readonly PolicyEvaluated: "policy_evaluated"; readonly PolicyViolation: "policy_violation"; readonly ConfigChanged: "config_changed"; readonly KeyRotated: "key_rotated"; };Source: arsenal/sdks/typescript/src/core/audit.ts:30.
AuditEventKindValue
export type AuditEventKindValue = (typeof AuditEventKind)[keyof typeof AuditEventKind];Source: arsenal/sdks/typescript/src/core/audit.ts:66.
AuditEvent
export interface AuditEvent {
id: string;
timestamp: string;
kind: AuditEventKindValue;
severity: AuditSeverityValue;
tenant_id: string;
agent_id?: string;
session_id?: string;
token_id?: string;
outcome: AuditOutcomeValue;
description: string;
metadata: Readonly<Record<string, unknown>>;
client_ip?: string;
user_agent?: string;
request_id?: string;
previous_hash?: Uint8Array;
event_hash?: Uint8Array;
}Source: arsenal/sdks/typescript/src/core/audit.ts:68.
base64Encode
Encode bytes to base64 (standard alphabet, no padding).
export declare const base64Encode: (bytes: Uint8Array) => string;Source: arsenal/sdks/typescript/src/core/codec.ts:11.
base64UrlEncode
Encode bytes to base64url (URL-safe alphabet, no padding).
export declare const base64UrlEncode: (bytes: Uint8Array) => string;Source: arsenal/sdks/typescript/src/core/codec.ts:16.
base64Decode
Decode a base64 string (standard or URL alphabet, with or without padding).
export declare const base64Decode: (s: string) => Uint8Array;Source: arsenal/sdks/typescript/src/core/codec.ts:21.
base64UrlDecode
Decode a base64url string. Same as base64Decode for convenience.
export declare const base64UrlDecode: (s: string) => Uint8Array;Source: arsenal/sdks/typescript/src/core/codec.ts:26.
hexEncode
Encode bytes as lowercase hex.
export declare const hexEncode: (bytes: Uint8Array) => string;Source: arsenal/sdks/typescript/src/core/codec.ts:114.
hexDecode
Decode a hex string into bytes. Throws on invalid input.
export declare const hexDecode: (s: string) => Uint8Array;Source: arsenal/sdks/typescript/src/core/codec.ts:123.
zeroize
Zeroize a Uint8Array in place. Use in finally blocks for secret buffers.
export declare const zeroize: (bytes: Uint8Array) => void;Source: arsenal/sdks/typescript/src/core/codec.ts:135.
encodeCbor
Encode a value to deterministic CBOR bytes.
export declare const encodeCbor: (value: unknown) => Uint8Array;Source: arsenal/sdks/typescript/src/core/cbor.ts:94.
decodeCbor
Decode a CBOR byte string into a plain JS value.
export declare const decodeCbor: (bytes: Uint8Array) => unknown;Source: arsenal/sdks/typescript/src/core/cbor.ts:236.
evaluatePolicy
Evaluate a single policy against a request. Returns the first matching rule's decision or the policy's default effect.
export declare const evaluatePolicy: (policy: PolicyDocument, request: PolicyRequest) => PolicyDecision;Source: arsenal/sdks/typescript/src/policy/engine.ts:80.
compareOperator
Compare two strings using a condition operator.
export declare const compareOperator: (operator: ConditionOperatorValue, actual: string, expected: string) => boolean;Source: arsenal/sdks/typescript/src/policy/engine.ts:152.
policyAllows
Convenience alias: true if the policy decision allows the request.
export declare const policyAllows: (decision: PolicyDecision) => boolean;Source: arsenal/sdks/typescript/src/policy/engine.ts:197.
denyWith
Build a deny decision with a reason string.
export declare const denyWith: (reason: string) => PolicyDecision;Source: arsenal/sdks/typescript/src/policy/engine.ts:202.
PolicyEngine
A policy engine evaluates multiple policies in priority order.
Policies are added via addPolicy and removed via removePolicy. On
each evaluate(request) call, policies are sorted by descending
priority and the first matching rule's decision is returned. When no
rule matches, the default effect of the first policy (ordered by
priority) is used, and if there are no policies the engine returns
Deny.
export declare class PolicyEngine {
addPolicy(policy: PolicyDocument): void;
removePolicy(policyId: string): PolicyDocument | undefined;
getPolicy(policyId: string): PolicyDocument | undefined;
policyIds(): readonly string[];
size(): number;
evaluate(request: PolicyRequest): PolicyDecision;
}Source: arsenal/sdks/typescript/src/policy/engine.ts:34.
BrokerClientOptions
Configuration for the broker client.
/** Configuration for the broker client. */
export interface BrokerClientOptions {
/** Base URL of the broker (e.g. `https://broker.example.com`). */
baseUrl: string;
/** Per-request timeout in milliseconds. Default: 30_000. */
timeoutMs?: number;
/** Extra headers applied to every outbound request. */
defaultHeaders?: Record<string, string>;
/** Custom `fetch` implementation (defaults to `globalThis.fetch`). */
fetch?: typeof globalThis.fetch;
}Source: arsenal/sdks/typescript/src/broker/client.ts:43.
BrokerClient
Broker HTTP client.
All methods throw ArsenalError on failure. Response bodies are
validated with Zod schemas at the boundary.
export declare class BrokerClient {
constructor(opts: BrokerClientOptions): BrokerClient;
health(): Promise<HealthResponse>;
requestCapability(payload: CapabilityRequestPayload): Promise<CapabilityResponsePayload>;
requestSecret(payload: SecretRequestPayload): Promise<SecretResponsePayload>;
revokeToken(tokenId: string, reason?: string): Promise<RevokeTokenResponse>;
verifyToken(token: string): Promise<VerifyTokenResponse>;
proxyRequest(req: ProxyRequest, opts?: { fingerprintHex?: string; }): Promise<ProxyResponse>;
approveConsent(payload: ConsentApprovalPayload): Promise<ConsentRecordPayload>;
denyConsent(payload: ConsentDenialPayload): Promise<void>;
revokeConsent(payload: ConsentRevocationPayload): Promise<void>;
listConsents(agentDid: string): Promise<readonly ConsentRecordPayload[]>;
decodeCapabilityToken(response: CapabilityResponsePayload): AgentCapabilityToken;
}Source: arsenal/sdks/typescript/src/broker/client.ts:62.
ConstraintsPayloadSchema
export declare const ConstraintsPayloadSchema: z.ZodObject<{ require_pop: z.ZodBoolean; allowed_origins: z.ZodOptional<z.ZodArray<z.ZodString>>; device_id: z.ZodOptional<z.ZodString>; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:12.
ConstraintsPayload
export type ConstraintsPayload = z.infer<typeof ConstraintsPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:20.
CapabilityRequestPayloadSchema
export declare const CapabilityRequestPayloadSchema: z.ZodObject<{ scopes: z.ZodArray<z.ZodString>; ttl_seconds: z.ZodOptional<z.ZodNumber>; audience: z.ZodString; constraints: z.ZodOptional<z.ZodObject<{ require_pop: z.ZodBoolean; allowed_origins: z.ZodOptional<z.ZodArray<z.ZodString>>; device_id: z.ZodOptional<z.ZodString>; }, z.core.$strict>>; pop_key_fingerprint: z.ZodOptional<z.ZodString>; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:22.
CapabilityRequestPayload
export type CapabilityRequestPayload = z.infer<typeof CapabilityRequestPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:32.
CapabilityResponsePayloadSchema
export declare const CapabilityResponsePayloadSchema: z.ZodObject<{ token_id: z.ZodString; token: z.ZodString; expires_at: z.ZodString; granted_scopes: z.ZodArray<z.ZodString>; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:34.
CapabilityResponsePayload
export type CapabilityResponsePayload = z.infer<typeof CapabilityResponsePayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:43.
SecretRequestPayloadSchema
export declare const SecretRequestPayloadSchema: z.ZodObject<{ secret_id: z.ZodString; version: z.ZodOptional<z.ZodNumber>; capability_token: z.ZodString; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:47.
SecretRequestPayload
export type SecretRequestPayload = z.infer<typeof SecretRequestPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:55.
SecretResponsePayloadSchema
export declare const SecretResponsePayloadSchema: z.ZodObject<{ secret_id: z.ZodString; version: z.ZodNumber; wrapped_value: z.ZodString; wrap_key_id: z.ZodString; ephemeral_public_key: z.ZodString; expires_at: z.ZodString; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:57.
SecretResponsePayload
export type SecretResponsePayload = z.infer<typeof SecretResponsePayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:68.
RevokeTokenPayloadSchema
export declare const RevokeTokenPayloadSchema: z.ZodObject<{ token_id: z.ZodString; reason: z.ZodOptional<z.ZodString>; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:72.
RevokeTokenPayload
export type RevokeTokenPayload = z.infer<typeof RevokeTokenPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:79.
RevokeTokenResponseSchema
export declare const RevokeTokenResponseSchema: z.ZodObject<{ success: z.ZodBoolean; message: z.ZodString; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:81.
RevokeTokenResponse
export type RevokeTokenResponse = z.infer<typeof RevokeTokenResponseSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:88.
VerifyTokenPayloadSchema
export declare const VerifyTokenPayloadSchema: z.ZodObject<{ token: z.ZodString; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:90.
VerifyTokenPayload
export type VerifyTokenPayload = z.infer<typeof VerifyTokenPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:96.
VerifyTokenResponseSchema
export declare const VerifyTokenResponseSchema: z.ZodObject<{ valid: z.ZodBoolean; token_id: z.ZodOptional<z.ZodString>; subject: z.ZodOptional<z.ZodString>; audience: z.ZodOptional<z.ZodString>; expires_at: z.ZodOptional<z.ZodString>; scopes: z.ZodOptional<z.ZodArray<z.ZodString>>; error: z.ZodOptional<z.ZodString>; }, z.core.$loose>;Source: arsenal/sdks/typescript/src/broker/wire.ts:98.
VerifyTokenResponse
export type VerifyTokenResponse = z.infer<typeof VerifyTokenResponseSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:110.
ProxyRequestPayloadSchema
export declare const ProxyRequestPayloadSchema: z.ZodObject<{ method: z.ZodString; url: z.ZodString; headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; body: z.ZodOptional<z.ZodString>; capability_token: z.ZodString; timeout_ms: z.ZodOptional<z.ZodNumber>; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:114.
ProxyRequestPayload
export type ProxyRequestPayload = z.infer<typeof ProxyRequestPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:125.
ProxyMetadataPayloadSchema
export declare const ProxyMetadataPayloadSchema: z.ZodObject<{ variables_resolved: z.ZodArray<z.ZodString>; destination_verified: z.ZodBoolean; fingerprint_verified: z.ZodBoolean; consent_status: z.ZodString; latency_ms: z.ZodNumber; request_id: z.ZodOptional<z.ZodString>; }, z.core.$loose>;Source: arsenal/sdks/typescript/src/broker/wire.ts:127.
ProxyMetadataPayload
export type ProxyMetadataPayload = z.infer<typeof ProxyMetadataPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:138.
ProxyResponsePayloadSchema
export declare const ProxyResponsePayloadSchema: z.ZodObject<{ status: z.ZodNumber; headers: z.ZodRecord<z.ZodString, z.ZodString>; body: z.ZodString; proxy_metadata: z.ZodObject<{ variables_resolved: z.ZodArray<z.ZodString>; destination_verified: z.ZodBoolean; fingerprint_verified: z.ZodBoolean; consent_status: z.ZodString; latency_ms: z.ZodNumber; request_id: z.ZodOptional<z.ZodString>; }, z.core.$loose>; }, z.core.$loose>;Source: arsenal/sdks/typescript/src/broker/wire.ts:140.
ProxyResponsePayload
export type ProxyResponsePayload = z.infer<typeof ProxyResponsePayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:149.
ConsentApprovalPayloadSchema
export declare const ConsentApprovalPayloadSchema: z.ZodObject<{ agent_did: z.ZodString; human_root_did: z.ZodString; variables: z.ZodArray<z.ZodString>; destination_domains: z.ZodArray<z.ZodString>; scopes: z.ZodArray<z.ZodString>; granted_by: z.ZodString; expires_in_seconds: z.ZodOptional<z.ZodNumber>; signature: z.ZodString; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:153.
ConsentApprovalPayload
export type ConsentApprovalPayload = z.infer<typeof ConsentApprovalPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:166.
ConsentRecordPayloadSchema
export declare const ConsentRecordPayloadSchema: z.ZodObject<{ consent_id: z.ZodString; agent_did: z.ZodString; human_root_did: z.ZodOptional<z.ZodString>; variables: z.ZodArray<z.ZodString>; destination_domains: z.ZodOptional<z.ZodArray<z.ZodString>>; scopes: z.ZodOptional<z.ZodArray<z.ZodString>>; granted_by: z.ZodOptional<z.ZodString>; granted_at: z.ZodString; expires_at: z.ZodString; revoked: z.ZodOptional<z.ZodBoolean>; }, z.core.$loose>;Source: arsenal/sdks/typescript/src/broker/wire.ts:168.
ConsentRecordPayload
export type ConsentRecordPayload = z.infer<typeof ConsentRecordPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:183.
ConsentDenialPayloadSchema
export declare const ConsentDenialPayloadSchema: z.ZodObject<{ agent_did: z.ZodString; human_root_did: z.ZodString; variables: z.ZodArray<z.ZodString>; destination_domains: z.ZodArray<z.ZodString>; scopes: z.ZodArray<z.ZodString>; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:185.
ConsentDenialPayload
export type ConsentDenialPayload = z.infer<typeof ConsentDenialPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:195.
ConsentRevocationPayloadSchema
export declare const ConsentRevocationPayloadSchema: z.ZodObject<{ consent_id: z.ZodString; }, z.core.$strict>;Source: arsenal/sdks/typescript/src/broker/wire.ts:197.
ConsentRevocationPayload
export type ConsentRevocationPayload = z.infer<typeof ConsentRevocationPayloadSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:203.
HealthResponseSchema
export declare const HealthResponseSchema: z.ZodObject<{ status: z.ZodString; version: z.ZodString; registered_agents: z.ZodOptional<z.ZodNumber>; revoked_tokens: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>;Source: arsenal/sdks/typescript/src/broker/wire.ts:207.
HealthResponse
export type HealthResponse = z.infer<typeof HealthResponseSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:216.
ApiErrorResponseSchema
export declare const ApiErrorResponseSchema: z.ZodObject<{ code: z.ZodNumber; message: z.ZodString; correlation_id: z.ZodOptional<z.ZodString>; retry_after: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>;Source: arsenal/sdks/typescript/src/broker/wire.ts:218.
ApiErrorResponse
export type ApiErrorResponse = z.infer<typeof ApiErrorResponseSchema>;Source: arsenal/sdks/typescript/src/broker/wire.ts:227.
ArsenalClientConfig
Configuration for the Arsenal client.
/** Configuration for the Arsenal client. */
export interface ArsenalClientConfig {
/** Agent identity (public key fingerprint + metadata). */
identity: AgentIdentity;
/** Broker client options. Required for any server-backed operation. */
broker?: BrokerClientOptions;
/** Session configuration. Default: 24-hour session, 30s renewal threshold. */
sessionConfig?: SessionConfig;
/** Auto-renew capability tokens when they are close to expiry. Default: true. */
autoRenew?: boolean;
/** Token issuer label. Default: "arsenal". */
issuer?: string;
/** Default audience (service) for broker-issued tokens. Default: "default". */
defaultAudience?: string;
}Source: arsenal/sdks/typescript/src/sdk/client.ts:33.
ArsenalClient
High-level ARSENAL client. Combines session management, capability requests, proxy calls, and consent operations.
Construct with ArsenalClient.create({...}) and then:
await client.startSession()await client.requestCapabilityForScopes([...], 300)await client.proxyHttp({...})or other proxy callsawait client.endSession()when done
export declare class ArsenalClient {
create(opts: ArsenalClientConfig): ArsenalClient;
identity(): AgentIdentity;
broker(): BrokerClient | undefined;
startSession(): Promise<string>;
endSession(): Promise<void>;
revokeSession(): Promise<void>;
hasActiveSession(): boolean;
sessionStats(): SessionStats;
currentToken(): AgentCapabilityToken | undefined;
requestCapability(request: CapabilityRequest): Promise<CapabilityHandle>;
requestCapabilityForScopes(scopes: readonly string[], ttlSeconds: number): Promise<CapabilityHandle>;
renewCurrentCapability(): Promise<CapabilityHandle>;
proxyHttp(request: ProxyRequest): Promise<ProxyResponse>;
callToolSimple(_toolId: string, _method: string, params: unknown, opts?: { scopes?: readonly string[]; ttlSeconds?: number; }): Promise<unknown>;
approveConsent(payload: ConsentApprovalPayload): Promise<ConsentRecordPayload>;
denyConsent(payload: ConsentDenialPayload): Promise<void>;
revokeConsent(payload: ConsentRevocationPayload): Promise<void>;
listConsents(): Promise<readonly ConsentRecordPayload[]>;
requestSecret(secretId: string, capabilityToken: string, version?: number): Promise<SecretResponsePayload>;
verifyToken(tokenBase64: string): Promise<{ valid: boolean; subject?: string; audience?: string; scopes?: string[]; }>;
revokeToken(tokenId: string, reason?: string): Promise<void>;
}Source: arsenal/sdks/typescript/src/sdk/client.ts:58.
CapabilityRequest
Builder for capability requests.
export declare class CapabilityRequest {
create(): CapabilityRequest;
scope(scope: string): CapabilityRequest;
scopes(scopes: readonly string[]): CapabilityRequest;
ttlSeconds(ttl: number): CapabilityRequest;
audience(audience: string): CapabilityRequest;
constraints(constraints: Constraints): CapabilityRequest;
getScopes(): ScopeSet;
getTtl(): number;
getAudience(): string;
getConstraints(): Constraints | undefined;
}Source: arsenal/sdks/typescript/src/sdk/capability.ts:12.
CapabilityHandle
Handle wrapping an issued capability token. Provides convenient inspection methods — the token itself is immutable.
export declare class CapabilityHandle {
constructor(token: AgentCapabilityToken): CapabilityHandle;
tokenId(): string;
audience(): string;
scopes(): ScopeSet;
isExpired(now?: Date): boolean;
remainingTtlMs(now?: Date): number;
encode(): string;
}Source: arsenal/sdks/typescript/src/sdk/capability.ts:93.
defaultSessionConfig
export declare const defaultSessionConfig: () => SessionConfig;Source: arsenal/sdks/typescript/src/sdk/session.ts:27.
SessionConfig
Configuration for session lifecycle.
/** Configuration for session lifecycle. */
export interface SessionConfig {
/** Session TTL in seconds. Default: 24 hours. */
sessionTtlSeconds: number;
/**
* Renew tokens when their remaining lifetime drops below this many
* seconds. Default: 30.
*/
renewalThresholdSeconds: number;
}Source: arsenal/sdks/typescript/src/sdk/session.ts:17.
SessionStats
Aggregate session statistics.
/** Aggregate session statistics. */
export interface SessionStats {
state: SessionStateValue;
created_at: string | null;
last_activity_at: string | null;
has_active_token: boolean;
}Source: arsenal/sdks/typescript/src/sdk/session.ts:35.
SessionManager
In-memory session manager. Not thread-safe in the shared-memory sense, but JavaScript is single-threaded so method calls cannot interleave.
export declare class SessionManager {
constructor(config?: SessionConfig): SessionManager;
startSession(): Promise<SessionId>;
sessionIdOrThrow(): SessionId;
hasActiveSession(): boolean;
stats(): SessionStats;
setCurrentToken(token: AgentCapabilityToken): void;
currentToken(): AgentCapabilityToken | undefined;
recordActivity(): void;
needsTokenRenewal(now?: Date): boolean;
endSession(): Promise<void>;
revokeSession(): Promise<void>;
}Source: arsenal/sdks/typescript/src/sdk/session.ts:46.