node-ciphers
Version:
Lightweight AES and DES encryption library for Node.js, featuring flexible encoding, multiple cipher modes, and TypeScript support.
22 lines • 1.16 kB
TypeScript
import { Buffer } from 'node:buffer';
import type { BinaryLike, Cipheriv, Decipheriv } from 'node:crypto';
import type { RequiredDeep } from 'type-fest';
import type { BaseCipherEncodingOptions, HasAuthTagAesCipherEncodingOptions, Result } from './types';
export declare class BaseCipher<EncodingOptions extends HasAuthTagAesCipherEncodingOptions = BaseCipherEncodingOptions> {
#private;
constructor(encodingOptions?: EncodingOptions);
get encodingOptions(): Readonly<RequiredDeep<EncodingOptions>>;
protected createErrorResult(error: unknown): {
error: unknown;
ok: false;
};
protected createOkResult<T>(value: T): {
ok: true;
value: T;
};
protected dataToBuffer(data: BinaryLike, encoding: BufferEncoding): NodeJS.ArrayBufferView<ArrayBufferLike> | Buffer<ArrayBuffer>;
protected getCipherResult(cipher: Cipheriv, data: BinaryLike, encodingOptions?: EncodingOptions): string;
protected getDecipherResult(decipher: Decipheriv, encryptedData: BinaryLike, encodingOptions?: EncodingOptions): string;
protected parseJson<T>(data: string): Result<T>;
}
//# sourceMappingURL=base.d.ts.map