@hiprax/crypto
Version:
High-security encryption/decryption library using AES-256-GCM and Argon2id
45 lines • 1.48 kB
JavaScript
/**
* Security level enumeration
*/
export var SecurityLevel;
(function (SecurityLevel) {
SecurityLevel["LOW"] = "low";
SecurityLevel["MEDIUM"] = "medium";
SecurityLevel["HIGH"] = "high";
SecurityLevel["ULTRA"] = "ultra";
})(SecurityLevel || (SecurityLevel = {}));
/**
* Supported encryption algorithms
*/
export var EncryptionAlgorithm;
(function (EncryptionAlgorithm) {
EncryptionAlgorithm["AES_256_GCM"] = "aes-256-gcm";
EncryptionAlgorithm["AES_256_CBC"] = "aes-256-cbc";
})(EncryptionAlgorithm || (EncryptionAlgorithm = {}));
/**
* Error types for better error handling
*/
export var CryptoErrorType;
(function (CryptoErrorType) {
CryptoErrorType["INVALID_PASSWORD"] = "INVALID_PASSWORD";
CryptoErrorType["INVALID_INPUT"] = "INVALID_INPUT";
CryptoErrorType["ENCRYPTION_FAILED"] = "ENCRYPTION_FAILED";
CryptoErrorType["DECRYPTION_FAILED"] = "DECRYPTION_FAILED";
CryptoErrorType["FILE_ERROR"] = "FILE_ERROR";
CryptoErrorType["MEMORY_ERROR"] = "MEMORY_ERROR";
CryptoErrorType["VALIDATION_ERROR"] = "VALIDATION_ERROR";
})(CryptoErrorType || (CryptoErrorType = {}));
/**
* Custom error class for crypto operations
*/
export class CryptoError extends Error {
type;
code;
constructor(message, type = CryptoErrorType.VALIDATION_ERROR, code = 'CRYPTO_ERROR') {
super(message);
this.name = 'CryptoError';
this.type = type;
this.code = code;
}
}
//# sourceMappingURL=types.js.map