@mickdarling/dollhousemcp
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
65 lines • 1.93 kB
TypeScript
/**
* Secure Token Manager for DollhouseMCP
*
* Provides secure GitHub token management with validation,
* caching, and error sanitization.
*
* Security: SEC-004 - Token exposure vulnerability protection
*/
export declare enum TokenScope {
READ = "read",
WRITE = "write",
ADMIN = "admin"
}
export declare class SecureTokenManager {
private static tokenCache;
private static readonly TOKEN_ROTATION_INTERVAL;
private static readonly TOKEN_PATTERNS;
private static readonly VALID_TOKEN_FORMATS;
/**
* Get a secure GitHub token for the specified scope
* @param scope The required permission scope
* @returns The validated token
* @throws SecurityError if token is invalid or missing
*/
static getSecureGitHubToken(scope: TokenScope): Promise<string>;
/**
* Validate token format
* @param token The token to validate
* @throws SecurityError if format is invalid
*/
private static validateTokenFormat;
/**
* Validate token has required permissions
* @param token The token to validate
* @param scope The required scope
* @throws SecurityError if permissions are insufficient
*/
private static validateTokenPermissions;
/**
* Check if token has required OAuth scopes
*/
private static hasRequiredScopes;
/**
* Check if cached token is still fresh
*/
private static isTokenFresh;
/**
* Sanitize error messages to remove sensitive data
* @param error The error to sanitize
* @returns A safe error object
*/
private static sanitizeError;
/**
* Clear cached tokens (useful for testing or forced rotation)
*/
static clearCache(): void;
/**
* Get token cache statistics (for monitoring)
*/
static getCacheStats(): {
size: number;
tokens: string[];
};
}
//# sourceMappingURL=tokenManager.d.ts.map