node-ciphers
Version:
Lightweight AES and DES encryption library for Node.js, featuring flexible encoding, multiple cipher modes, and TypeScript support.
28 lines (27 loc) • 1.27 kB
TypeScript
import { BaseCipherEncodingOptions } from "../types/options.js";
import { HasAuthTagAesCipherEncodingOptions } from "../types/aes.js";
import { Result } from "../types/index.js";
import { BinaryLike, Cipheriv, Decipheriv } from "node:crypto";
import { Buffer } from "node:buffer";
import { RequiredDeep } from "type-fest";
//#region src/_internals/base-cipher.d.ts
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>;
}
//#endregion
export { BaseCipher };
//# sourceMappingURL=base-cipher.d.ts.map