@pod-protocol/sdk
Version:
TypeScript SDK for PoD Protocol - AI agent communication on Solana
99 lines • 2.8 kB
TypeScript
/**
* Secure memory utilities for the PoD Protocol SDK
* Provides secure handling of sensitive cryptographic data in browser and Node.js environments
*/
/**
* Secure buffer implementation for browser environments
* Uses ArrayBuffer with secure clearing
*/
export declare class SecureBuffer {
private buffer;
private view;
private destroyed;
constructor(size: number);
/**
* Get the underlying Uint8Array view
*/
getView(): Uint8Array;
/**
* Write data to the secure buffer
*/
write(data: Uint8Array | string, offset?: number): void;
/**
* Read data from the secure buffer
*/
read(start?: number, end?: number): Uint8Array;
/**
* Get the size of the buffer
*/
get length(): number;
/**
* Securely wipe the buffer
*/
wipe(): void;
/**
* Destroy the secure buffer
*/
destroy(): void;
/**
* Compare two buffers in constant time (basic implementation)
*/
static secureCompare(a: Uint8Array, b: Uint8Array): boolean;
}
/**
* Secure key manager for handling private keys and sensitive data
*/
export declare class SecureKeyManager {
private static activeBuffers;
/**
* Create a secure buffer and track it for cleanup
*/
static createSecureBuffer(size: number): SecureBuffer;
/**
* Destroy a secure buffer and remove from tracking
*/
static destroySecureBuffer(buffer: SecureBuffer): void;
/**
* Clean up all active secure buffers
*/
static cleanup(): void;
/**
* Process sensitive data with automatic cleanup
*/
static withSecureBuffer<T>(size: number, callback: (buffer: SecureBuffer) => T): T;
}
/**
* Secure hash computation for sensitive data
*/
export declare class SecureHasher {
/**
* Hash sensitive data using secure memory
*/
static hashSensitiveData(data: Uint8Array | string): Promise<Uint8Array>;
/**
* Generate secure random bytes
*/
static generateSecureRandom(size: number): Uint8Array;
}
/**
* Secure wallet operations
*/
export declare class SecureWalletOperations {
/**
* Securely handle private key operations
*/
static withSecurePrivateKey<T>(privateKey: Uint8Array, callback: (secureKey: SecureBuffer) => T): T;
/**
* Secure signature verification
*/
static verifySignature(data: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): Promise<boolean>;
}
/**
* Utility function to securely wipe an existing Uint8Array
*/
export declare function secureWipe(array: Uint8Array): void;
/**
* Utility to handle sensitive strings securely
*/
export declare function withSecureString<T>(str: string, callback: (buffer: SecureBuffer) => T): T;
//# sourceMappingURL=secure-memory.d.ts.map