linea-mcp
Version:
A Model Context Protocol server for interacting with the Linea blockchain
55 lines • 2.06 kB
TypeScript
import { PrivateKeyAccount, HDAccount } from 'viem/accounts';
type SupportedAccount = PrivateKeyAccount | HDAccount;
/**
* Service for managing cryptographic keys and accounts using viem
*/
declare class KeyManagementService {
private encryptionKey;
private defaultPrivateKey;
/**
* Create a new KeyManagementService instance
*/
constructor();
/**
* Generate a new random private key account
* @returns A new PrivateKeyAccount instance
*/
generateAccount(): PrivateKeyAccount;
/**
* Get the default account from environment variable or config
* @returns The default account (PrivateKeyAccount or HDAccount) or a random one if not configured
*/
getDefaultAccount(): SupportedAccount;
/**
* Create an account from a private key
* @param privateKey The private key (hex string, optionally starting with 0x)
* @returns A PrivateKeyAccount instance
*/
createAccountFromPrivateKey(privateKey: string): PrivateKeyAccount;
/**
* Encrypt a private key for secure storage
* @param privateKey The private key to encrypt (should be hex string)
* @returns The encrypted private key string (iv:encryptedKey)
*/
encryptPrivateKey(privateKey: string): string;
/**
* Decrypt a stored private key
* @param encryptedKey The encrypted private key string (iv:encryptedKey)
* @returns The decrypted private key (hex string, without 0x prefix)
*/
decryptPrivateKey(encryptedKey: string): string;
/**
* Create an account from an encrypted private key
* @param encryptedKey The encrypted private key string
* @returns A PrivateKeyAccount instance
*/
createAccountFromEncryptedKey(encryptedKey: string): PrivateKeyAccount;
/**
* Generate a secure encryption key
* @returns A new random encryption key (hex string)
*/
static generateEncryptionKey(): string;
}
export default KeyManagementService;
export type { SupportedAccount };
//# sourceMappingURL=keyManagement.d.ts.map