safevibe
Version:
Safevibe CLI - Simple personal secret vault for AI developers and amateur vibe coders
90 lines (89 loc) • 2.43 kB
TypeScript
import type { Secret, SecretResult, SaveSecretResult } from "./types.js";
/**
* HTTP client that mimics tRPC interface
*/
declare class HttpTrpcClient {
private baseUrl;
private getHeaders;
constructor(baseUrl: string, getHeaders: () => Record<string, string>);
secret: {
save: {
mutate: (params: {
name: string;
ciphertext: string;
}) => Promise<SaveSecretResult>;
};
get: {
query: (params: {
name: string;
}) => Promise<SecretResult>;
};
list: {
query: () => Promise<Secret[]>;
};
rotate: {
mutate: (params: {
name: string;
newCiphertext: string;
}) => Promise<SaveSecretResult>;
};
};
}
/**
* Safevibe Client for MCP Server
*
* Handles:
* - HTTP communication with backend
* - Local X25519 encryption/decryption
* - Session management
* - Configuration persistence
*
* Simplified to work without projects - everything is user-scoped
*/
export declare class SafevibeClient {
trpc: HttpTrpcClient;
private config;
private configPath;
constructor();
/**
* Initialize the client
* Load configuration, ensure authentication, setup encryption keys
*/
initialize(): Promise<void>;
/**
* Cleanup resources
*/
cleanup(): Promise<void>;
/**
* Load configuration from file system
*/
private loadConfig;
/**
* Save configuration to file system
*/
private saveConfig;
/**
* Ensure user is authenticated
* Try to load session from CLI config, require proper authentication
*/
private ensureAuthenticated;
/**
* Ensure cryptographic keys are generated
* For demo purposes, we'll use a simple symmetric encryption
* In production, this would use X25519 with proper key derivation
*/
private ensureKeys;
/**
* Encrypt a secret value locally
* For demo: simple XOR encryption
* In production: use age encryption or similar with X25519
*/
encryptSecret(plaintext: string): Promise<string>;
/**
* Decrypt a secret value locally
* For demo: simple XOR decryption
* In production: use age decryption or similar with X25519
*/
decryptSecret(ciphertext: string): Promise<string>;
}
export {};