anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
118 lines • 3.42 kB
TypeScript
import { AgentIdentity } from './types';
import { AgentIdentityManager } from './agent-identity';
import { DelegationChainValidator } from './delegation-chain-validator';
export interface DepthConfiguration {
globalMaxDepth: number;
perAgentOverrides: Map<string, number>;
depthCalculationStrategy: 'absolute' | 'relative' | 'dynamic';
warningThreshold: number;
}
export interface DepthValidationResult {
valid: boolean;
currentDepth: number;
maxAllowedDepth: number;
remainingDepth: number;
warnings: string[];
metadata?: Record<string, any>;
}
export interface DepthAnalysis {
averageDepth: number;
maxDepthReached: number;
depthDistribution: Map<number, number>;
deepestChains: Array<{
leafAgentDID: string;
depth: number;
path: string[];
}>;
}
export declare class DelegationDepthController {
private agentManager;
private chainValidator;
private configuration;
private depthCache;
constructor(agentManager: AgentIdentityManager, chainValidator: DelegationChainValidator, config?: Partial<DepthConfiguration>);
/**
* Updates the global maximum depth
*/
setGlobalMaxDepth(depth: number): void;
/**
* Sets a depth override for a specific agent
*/
setAgentDepthOverride(agentDID: string, maxDepth: number): void;
/**
* Validates if a new delegation would exceed depth limits
*/
validateDelegationDepth(parentAgentDID: string, childAgentConfig?: {
name: string;
description: string;
}): Promise<DepthValidationResult>;
/**
* Gets the effective maximum depth for an agent considering all rules
*/
getEffectiveMaxDepth(agent: AgentIdentity): number;
/**
* Calculates the remaining delegation depth for an agent
*/
getRemainingDepth(agentDID: string): number;
/**
* Analyzes delegation depth across all agents
*/
analyzeDepthDistribution(): Promise<DepthAnalysis>;
/**
* Performs dynamic depth analysis to suggest optimal max depth
*/
private performDynamicDepthAnalysis;
/**
* Builds the path from an agent to the root
*/
private buildAgentPath;
/**
* Finds the root DID for an agent
*/
private findRootDID;
/**
* Gets all agents managed by the system
*/
private getAllAgents;
/**
* Clears the depth cache
*/
private clearCache;
/**
* Enforces depth limits by preventing over-deep delegations
*/
enforceDepthLimits(): Promise<{
processed: number;
violations: Array<{
agentDID: string;
currentDepth: number;
maxAllowed: number;
action: string;
}>;
}>;
/**
* Exports depth configuration
*/
exportConfiguration(): {
globalMaxDepth: number;
overrides: Array<{
agentDID: string;
maxDepth: number;
}>;
strategy: string;
warningThreshold: number;
};
/**
* Imports depth configuration
*/
importConfiguration(config: {
globalMaxDepth?: number;
overrides?: Array<{
agentDID: string;
maxDepth: number;
}>;
strategy?: 'absolute' | 'relative' | 'dynamic';
warningThreshold?: number;
}): void;
}
//# sourceMappingURL=delegation-depth-controller.d.ts.map