From 4e87195739f2a5d9a05451b48773c8afdc680765 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Sun, 24 Sep 2023 23:22:21 +1000 Subject: Initial commit (by create-cloudflare CLI) --- .../blake3-wasm/esm/base/hash-instance.d.ts | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 node_modules/blake3-wasm/esm/base/hash-instance.d.ts (limited to 'node_modules/blake3-wasm/esm/base/hash-instance.d.ts') diff --git a/node_modules/blake3-wasm/esm/base/hash-instance.d.ts b/node_modules/blake3-wasm/esm/base/hash-instance.d.ts new file mode 100644 index 0000000..3f55095 --- /dev/null +++ b/node_modules/blake3-wasm/esm/base/hash-instance.d.ts @@ -0,0 +1,79 @@ +import { BaseHashInput, IBaseHashOptions } from './hash-fn'; +import { IHashReader } from './hash-reader'; +/** + * A blake3 hash. Quite similar to Node's crypto hashing. + * + * Note that you must call {@link IHash#dispose} or {@link IHash#done} when + * you're finished with it to free memory. + */ +export interface IHasher { + /** + * Adds the given data to the hash. + * @throws {Error} if {@link IHash#digest} has already been called. + */ + update(data: BaseHashInput): this; + /** + * Returns a digest of the hash. + * + * If `dispose: false` is given in the options, the hash will not + * automatically be disposed of, allowing you to continue updating + * it after obtaining the current reader. + */ + digest(options?: IBaseHashOptions & { + dispose?: boolean; + }): T; + /** + * Returns a {@link HashReader} for the current hash. + * + * If `dispose: false` is given in the options, the hash will not + * automatically be disposed of, allowing you to continue updating + * it after obtaining the current reader. + */ + reader(options?: { + dispose?: boolean; + }): IHashReader; + /** + * Frees data associated with the hash. This *must* be called if + * {@link IHash#digest} is not called in order to free memory. + */ + dispose(): void; +} +/** + * @hidden + */ +export interface IInternalHash { + free(): void; + reader(): Reader; + update(bytes: Uint8Array): void; + digest(into: Uint8Array): void; +} +export interface IHasherDigestOptions extends IBaseHashOptions { + dispose?: boolean; +} +/** + * Base implementation of hashing. + */ +export declare class BaseHash> implements IHasher { + private readonly alloc; + private readonly getReader; + private hash; + constructor(implementation: IInternalHash, alloc: (length: number) => Binary, getReader: (internal: InternalReader) => Reader); + /** + * @inheritdoc + */ + update(data: BaseHashInput): this; + /** + * @inheritdoc + */ + digest({ length, dispose }?: IHasherDigestOptions): Binary; + /** + * @inheritdoc + */ + reader({ dispose }?: { + dispose?: boolean; + }): Reader; + /** + * @inheritdoc + */ + dispose(): void; +} -- cgit v1.2.3