100 lines
3.6 KiB
TypeScript
100 lines
3.6 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
|
|
/**
|
|
* Streaming hash for very large files (chunked processing)
|
|
*/
|
|
export class StreamingHasher {
|
|
free(): void;
|
|
[Symbol.dispose](): void;
|
|
finalize(): string;
|
|
constructor();
|
|
reset(): void;
|
|
update(chunk: Uint8Array): void;
|
|
}
|
|
|
|
/**
|
|
* Compute SHA256 hash of a file (async for large files)
|
|
*/
|
|
export function compute_sha256(file: File): Promise<string>;
|
|
|
|
/**
|
|
* Batch hash multiple files (returns JSON array)
|
|
*/
|
|
export function compute_sha256_batch(files: Array<any>): Promise<string>;
|
|
|
|
/**
|
|
* Compute SHA256 hash of bytes directly
|
|
*/
|
|
export function compute_sha256_bytes(bytes: Uint8Array): string;
|
|
|
|
/**
|
|
* Compute SHA256 hash of a string (for block verification)
|
|
*/
|
|
export function compute_sha256_string(input: string): string;
|
|
|
|
/**
|
|
* Test function to verify WASM is working
|
|
*/
|
|
export function ping(): string;
|
|
|
|
/**
|
|
* Initialize the WASM module
|
|
*/
|
|
export function start(): void;
|
|
|
|
/**
|
|
* Verify a hash against expected value
|
|
*/
|
|
export function verify_hash(computed: string, expected: string): boolean;
|
|
|
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
|
|
export interface InitOutput {
|
|
readonly memory: WebAssembly.Memory;
|
|
readonly __wbg_streaminghasher_free: (a: number, b: number) => void;
|
|
readonly compute_sha256: (a: any) => any;
|
|
readonly compute_sha256_batch: (a: any) => any;
|
|
readonly compute_sha256_bytes: (a: number, b: number) => [number, number];
|
|
readonly ping: () => [number, number];
|
|
readonly streaminghasher_finalize: (a: number) => [number, number];
|
|
readonly streaminghasher_new: () => number;
|
|
readonly streaminghasher_reset: (a: number) => void;
|
|
readonly streaminghasher_update: (a: number, b: number, c: number) => void;
|
|
readonly verify_hash: (a: number, b: number, c: number, d: number) => number;
|
|
readonly start: () => void;
|
|
readonly compute_sha256_string: (a: number, b: number) => [number, number];
|
|
readonly wasm_bindgen__closure__destroy__h21c7a480edf193b0: (a: number, b: number) => void;
|
|
readonly wasm_bindgen__convert__closures_____invoke__he384f79bbef4be39: (a: number, b: number, c: any) => [number, number];
|
|
readonly wasm_bindgen__convert__closures_____invoke__h1708fce7cc4bbb73: (a: number, b: number, c: any, d: any) => void;
|
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
readonly __externref_table_alloc: () => number;
|
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
readonly __wbindgen_start: () => void;
|
|
}
|
|
|
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
|
|
/**
|
|
* Instantiates the given `module`, which can either be bytes or
|
|
* a precompiled `WebAssembly.Module`.
|
|
*
|
|
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
*
|
|
* @returns {InitOutput}
|
|
*/
|
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
|
|
/**
|
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
*
|
|
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
*
|
|
* @returns {Promise<InitOutput>}
|
|
*/
|
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|