@kya-os/mcp-i
Version:
The TypeScript MCP framework with identity features built-in
97 lines (96 loc) • 2.73 kB
TypeScript
/**
* Mock Identity Provider for testing
*/
import { type MockIdentity, type MockDelegationStatus, type MockKTAFailureType, type MockIdentityProviderConfig } from "@kya-os/contracts/test";
/**
* Mock Identity Provider for testing XMCP-I applications
*/
export declare class MockIdentityProvider {
private identities;
private delegations;
private ktaFailures;
private deterministicSeed?;
constructor(config?: Partial<MockIdentityProviderConfig>);
/**
* Configure the mock provider
*/
configure(config: Partial<MockIdentityProviderConfig>): void;
/**
* Load predefined test identities
*/
private loadPredefinedIdentities;
/**
* Set identity for a given key
*/
setIdentity(key: string, identity: MockIdentity): void;
/**
* Get identity by key
*/
getIdentity(key: string): MockIdentity | undefined;
/**
* Generate and set a new test identity
*/
generateIdentity(key: string, testName: string, options?: {
did?: string;
kid?: string;
}): MockIdentity;
/**
* Set delegation status for a DID:KeyID combination
*/
setDelegation(didKeyId: string, status: MockDelegationStatus): void;
/**
* Get delegation status
*/
getDelegationStatus(did: string, kid: string): MockDelegationStatus;
/**
* Simulate KTA failure scenarios
*/
simulateKTAFailure(errorType: MockKTAFailureType): void;
/**
* Clear KTA failure simulation
*/
clearKTAFailure(errorType: MockKTAFailureType): void;
/**
* Check if a KTA failure should be simulated
*/
shouldSimulateKTAFailure(errorType: MockKTAFailureType): boolean;
/**
* Get all active KTA failures
*/
getActiveKTAFailures(): MockKTAFailureType[];
/**
* Mock KTA registration call
*/
mockRegister(did: string, _kid: string): Promise<{
success: boolean;
agentURL?: string;
error?: string;
}>;
/**
* Mock KTA delegation check
*/
mockCheckDelegation(did: string, kid: string): Promise<{
status: MockDelegationStatus;
error?: string;
}>;
/**
* Reset the mock provider to initial state
*/
reset(): void;
/**
* Get all configured identities
*/
getAllIdentities(): Record<string, MockIdentity>;
/**
* Get all delegation statuses
*/
getAllDelegations(): Record<string, MockDelegationStatus>;
}
/**
* Get or create the global mock identity provider
*/
export declare function getMockIdentityProvider(): MockIdentityProvider;
/**
* Reset the global mock identity provider
*/
export declare function resetMockIdentityProvider(): void;