@starryn/crypto
Version:
basic crypto base on openssl 3.3.2
22 lines (21 loc) • 1.21 kB
TypeScript
import type { Instance, Buffer, ActionWasm } from './wasm';
import type { Action, ExportType } from './enum';
export declare class Crypto {
protected static wasm: Promise<Instance>;
protected static getInstanceAsync(): Promise<Instance>;
protected static readBufferAsync(buffer: Buffer): Promise<Uint8Array>;
protected static getAction(action: Action, instance: Instance): ActionWasm;
static toBase64(data: Uint8Array): string;
static fromBase64(data: string): Uint8Array;
static toHex(data: Uint8Array): string;
static fromHex(data: string): Uint8Array;
static toUtf8(data: Uint8Array): string;
static fromUtf8(data: string): Uint8Array;
static mergeUint8Array(arrs: Array<Uint8Array>): Uint8Array;
static exportData(data: Uint8Array | Array<Uint8Array>, type?: ExportType): string | Uint8Array;
static importData(data: Uint8Array | string, type?: ExportType): Uint8Array;
protected getInstanceAsync(): Promise<Instance>;
protected readBufferAsync(buffer: Buffer): Promise<Uint8Array>;
protected getAction(action: Action, instance: Instance): ActionWasm;
protected exportData(data: Uint8Array, type?: ExportType): Uint8Array | string;
}