facezk-core
Version:
ZKP-AI Proof of Humanity: Live Selfie Check with Biometric Template Extraction and Fuzzy Hashing
79 lines • 2.46 kB
TypeScript
/**
* Secure Cryptographic Plugin
* Implements proper encryption, key derivation, and secure hashing
*/
import type { ICryptoPlugin, EncryptedData, PluginState } from '../core/interfaces';
export interface CryptoPluginConfig {
algorithm: 'AES-GCM' | 'AES-CBC';
keyDerivation: 'PBKDF2' | 'Argon2';
iterations: number;
keyLength: number;
saltLength: number;
ivLength: number;
}
export declare class CryptoPlugin implements ICryptoPlugin {
readonly id = "crypto-plugin";
readonly name = "Secure Cryptographic Plugin";
readonly version = "2.0.0";
state: PluginState;
private config;
private masterKey;
private keyCache;
constructor(config?: Partial<CryptoPluginConfig>);
initialize(config?: Partial<CryptoPluginConfig>): Promise<void>;
dispose(): Promise<void>;
isReady(): boolean;
/**
* Encrypt data with a specific key
*/
encrypt(data: Uint8Array, key: CryptoKey): Promise<EncryptedData>;
/**
* Decrypt data with a specific key
*/
decrypt(data: EncryptedData, key: CryptoKey): Promise<Uint8Array>;
/**
* Generate a new cryptographic key
*/
generateKey(): Promise<CryptoKey>;
/**
* Derive a key from a password and salt
*/
deriveKey(password: string, salt: Uint8Array): Promise<CryptoKey>;
/**
* Generate a secure hash of data
*/
hash(data: Uint8Array): Promise<string>;
/**
* Encrypt biometric template with secure key derivation
*/
encryptTemplate(templateData: Uint8Array, systemSalt: string, userSalt?: string): Promise<EncryptedData>;
/**
* Decrypt biometric template
*/
decryptTemplate(encryptedData: EncryptedData, systemSalt: string): Promise<Uint8Array>;
/**
* Generate a secure humanity code
*/
generateHumanityCode(biometricId: string, systemSalt: string, additionalData?: string): Promise<string>;
/**
* Generate a secure random salt
*/
generateRandomSalt(): Uint8Array;
/**
* Generate a secure random IV
*/
generateRandomIV(): Uint8Array;
/**
* Generate master key for internal operations
*/
private generateMasterKey;
/**
* Get plugin configuration
*/
getConfig(): Required<CryptoPluginConfig>;
/**
* Update plugin configuration
*/
updateConfig(newConfig: Partial<CryptoPluginConfig>): Promise<void>;
}
//# sourceMappingURL=crypto-plugin.d.ts.map