UNPKG

@starryn/crypto

Version:

basic crypto base on openssl 3.3.2

22 lines (21 loc) 1.53 kB
import type { AesBaseWasm, ActionWasm, AesModeWasm, Instance } from '../wasm'; import type { AesKeySize, Action, AesMode, ExportType } from '../enum'; import { Crypto } from '../crypto'; export declare abstract class AesBase<T extends AesBaseWasm> extends Crypto { protected static getAes(key: Uint8Array | ArrayBuffer | string, iv: Uint8Array | ArrayBuffer | string, action: Action, mode?: AesMode): AesBase<AesBaseWasm>; static keyAsync(size?: AesKeySize): Promise<Uint8Array>; static ivAsync(size?: number): Promise<Uint8Array>; static encryptAsync(data: ArrayBuffer | Uint8Array | string, key: Uint8Array | ArrayBuffer | string, iv: Uint8Array | ArrayBuffer | string, mode?: AesMode): Promise<Uint8Array>; static decryptAsync(data: ArrayBuffer | Uint8Array | string, key: Uint8Array | ArrayBuffer | string, iv: Uint8Array | ArrayBuffer | string, mode?: AesMode, exportType?: ExportType): Promise<Uint8Array | string>; protected _key: Uint8Array | ArrayBuffer | string; protected _iv: Uint8Array | ArrayBuffer | string; protected _action: Action; protected _mode: AesMode; protected _ctx?: T; constructor(key: Uint8Array | ArrayBuffer | string, iv: Uint8Array | ArrayBuffer | string, action?: Action, mode?: AesMode); updateAsync(data: ArrayBuffer | Uint8Array | string): Promise<Uint8Array>; finalAsync(): Promise<Uint8Array>; protected abstract getContext(instance: Instance, action: ActionWasm, mode: AesModeWasm): T; private ensureContextAsync; private getMode; }