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/dist/browser/encoding.d.ts | 5 +++ node_modules/blake3-wasm/dist/browser/encoding.js | 30 ++++++++++++++ .../blake3-wasm/dist/browser/encoding.js.map | 1 + node_modules/blake3-wasm/dist/browser/hash-fn.d.ts | 24 +++++++++++ node_modules/blake3-wasm/dist/browser/hash-fn.js | 47 ++++++++++++++++++++++ .../blake3-wasm/dist/browser/hash-fn.js.map | 1 + .../blake3-wasm/dist/browser/hash-instance.d.ts | 31 ++++++++++++++ .../blake3-wasm/dist/browser/hash-instance.js | 44 ++++++++++++++++++++ .../blake3-wasm/dist/browser/hash-instance.js.map | 1 + .../blake3-wasm/dist/browser/hash-reader.d.ts | 17 ++++++++ .../blake3-wasm/dist/browser/hash-reader.js | 28 +++++++++++++ .../blake3-wasm/dist/browser/hash-reader.js.map | 1 + node_modules/blake3-wasm/dist/browser/hash.d.ts | 11 +++++ node_modules/blake3-wasm/dist/browser/hash.js | 29 +++++++++++++ node_modules/blake3-wasm/dist/browser/hash.js.map | 1 + node_modules/blake3-wasm/dist/browser/index.d.ts | 3 ++ node_modules/blake3-wasm/dist/browser/index.js | 12 ++++++ node_modules/blake3-wasm/dist/browser/index.js.map | 1 + node_modules/blake3-wasm/dist/browser/wasm.d.ts | 10 +++++ node_modules/blake3-wasm/dist/browser/wasm.js | 20 +++++++++ node_modules/blake3-wasm/dist/browser/wasm.js.map | 1 + 21 files changed, 318 insertions(+) create mode 100644 node_modules/blake3-wasm/dist/browser/encoding.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/encoding.js create mode 100644 node_modules/blake3-wasm/dist/browser/encoding.js.map create mode 100644 node_modules/blake3-wasm/dist/browser/hash-fn.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/hash-fn.js create mode 100644 node_modules/blake3-wasm/dist/browser/hash-fn.js.map create mode 100644 node_modules/blake3-wasm/dist/browser/hash-instance.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/hash-instance.js create mode 100644 node_modules/blake3-wasm/dist/browser/hash-instance.js.map create mode 100644 node_modules/blake3-wasm/dist/browser/hash-reader.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/hash-reader.js create mode 100644 node_modules/blake3-wasm/dist/browser/hash-reader.js.map create mode 100644 node_modules/blake3-wasm/dist/browser/hash.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/hash.js create mode 100644 node_modules/blake3-wasm/dist/browser/hash.js.map create mode 100644 node_modules/blake3-wasm/dist/browser/index.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/index.js create mode 100644 node_modules/blake3-wasm/dist/browser/index.js.map create mode 100644 node_modules/blake3-wasm/dist/browser/wasm.d.ts create mode 100644 node_modules/blake3-wasm/dist/browser/wasm.js create mode 100644 node_modules/blake3-wasm/dist/browser/wasm.js.map (limited to 'node_modules/blake3-wasm/dist/browser') diff --git a/node_modules/blake3-wasm/dist/browser/encoding.d.ts b/node_modules/blake3-wasm/dist/browser/encoding.d.ts new file mode 100644 index 0000000..4c8b547 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/encoding.d.ts @@ -0,0 +1,5 @@ +export declare type BrowserEncoding = 'hex' | 'base64' | 'utf8'; +/** + * @hidden + */ +export declare const mustGetEncoder: (encoding: BrowserEncoding) => (data: Uint8Array) => string; diff --git a/node_modules/blake3-wasm/dist/browser/encoding.js b/node_modules/blake3-wasm/dist/browser/encoding.js new file mode 100644 index 0000000..2d61341 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/encoding.js @@ -0,0 +1,30 @@ +"use strict"; +// A small collection of encodings for convenience of use in the browser. +Object.defineProperty(exports, "__esModule", { value: true }); +const decoder = new TextDecoder(); +const encoders = { + // certainly not the fastest, but hashes are pretty small + base64: data => btoa(String.fromCharCode(...data)), + hex: data => { + let out = ''; + for (const byte of data) { + if (byte < 0x10) { + out += '0'; + } + out += byte.toString(16); + } + return out; + }, + utf8: data => decoder.decode(data), +}; +/** + * @hidden + */ +exports.mustGetEncoder = (encoding) => { + const encoder = encoders[encoding]; + if (!encoder) { + throw new Error(`Unknown encoding ${encoding}`); + } + return encoder; +}; +//# sourceMappingURL=encoding.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/encoding.js.map b/node_modules/blake3-wasm/dist/browser/encoding.js.map new file mode 100644 index 0000000..b524e4a --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/encoding.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../ts/browser/encoding.ts"],"names":[],"mappings":";AAAA,yEAAyE;;AAIzE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,MAAM,QAAQ,GAA6D;IACzE,yDAAyD;IACzD,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;IAElD,GAAG,EAAE,IAAI,CAAC,EAAE;QACV,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;YACvB,IAAI,IAAI,GAAG,IAAI,EAAE;gBACf,GAAG,IAAI,GAAG,CAAC;aACZ;YAED,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SAC1B;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;CACnC,CAAC;AAEF;;GAEG;AACU,QAAA,cAAc,GAAG,CAAC,QAAyB,EAAE,EAAE;IAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAC;KACjD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash-fn.d.ts b/node_modules/blake3-wasm/dist/browser/hash-fn.d.ts new file mode 100644 index 0000000..a341ea2 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-fn.d.ts @@ -0,0 +1,24 @@ +import { BaseHashInput, IBaseHashOptions } from '../base/hash-fn'; +import { Hash } from './hash'; +/** + * Input used for browser-based hashes. + */ +export declare type HashInput = BaseHashInput | string; +/** + * @hidden + */ +export declare const normalizeInput: (input: import("..").HashInput) => Uint8Array; +/** + * Returns a blake3 hash of the input. + */ +export declare function hash(input: HashInput, { length }?: IBaseHashOptions): Hash; +/** + * Given cryptographic key material and a context string, services a subkey of + * any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html} + * for more information. + */ +export declare function deriveKey(context: string, material: HashInput, { length }?: IBaseHashOptions): Hash; +/** + * The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}. + */ +export declare function keyedHash(key: Uint8Array, input: HashInput, { length }?: IBaseHashOptions): Hash; diff --git a/node_modules/blake3-wasm/dist/browser/hash-fn.js b/node_modules/blake3-wasm/dist/browser/hash-fn.js new file mode 100644 index 0000000..5259980 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-fn.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const hash_fn_1 = require("../base/hash-fn"); +const hash_1 = require("./hash"); +const wasm_1 = require("./wasm"); +const textEncoder = new TextEncoder(); +/** + * @hidden + */ +exports.normalizeInput = (input) => hash_fn_1.inputToArray(typeof input === 'string' ? textEncoder.encode(input) : input); +/** + * Returns a blake3 hash of the input. + */ +function hash(input, { length = hash_fn_1.defaultHashLength } = {}) { + const result = new hash_1.Hash(length); + wasm_1.getWasm().hash(exports.normalizeInput(input), result); + return result; +} +exports.hash = hash; +/** + * Given cryptographic key material and a context string, services a subkey of + * any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html} + * for more information. + */ +function deriveKey(context, material, { length = hash_fn_1.defaultHashLength } = {}) { + const derive = wasm_1.getWasm().create_derive(context); + derive.update(exports.normalizeInput(material)); + const result = new hash_1.Hash(length); + derive.digest(result); + return result; +} +exports.deriveKey = deriveKey; +/** + * The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}. + */ +function keyedHash(key, input, { length = hash_fn_1.defaultHashLength } = {}) { + if (key.length !== 32) { + throw new Error(`key provided to keyedHash must be 32 bytes, got ${key.length}`); + } + const derive = wasm_1.getWasm().create_keyed(key); + derive.update(exports.normalizeInput(input)); + const result = new hash_1.Hash(length); + derive.digest(result); + return result; +} +exports.keyedHash = keyedHash; +//# sourceMappingURL=hash-fn.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash-fn.js.map b/node_modules/blake3-wasm/dist/browser/hash-fn.js.map new file mode 100644 index 0000000..9ce0b9c --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-fn.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash-fn.js","sourceRoot":"","sources":["../../ts/browser/hash-fn.ts"],"names":[],"mappings":";;AAAA,6CAAmG;AACnG,iCAA8B;AAC9B,iCAAiC;AAOjC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC;;GAEG;AACU,QAAA,cAAc,GAAG,CAAC,KAAgB,EAAc,EAAE,CAC7D,sBAAY,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAE9E;;GAEG;AACH,SAAgB,IAAI,CAClB,KAAgB,EAChB,EAAE,MAAM,GAAG,2BAAiB,KAAuB,EAAE;IAErD,MAAM,MAAM,GAAG,IAAI,WAAI,CAAC,MAAM,CAAC,CAAC;IAChC,cAAO,EAAE,CAAC,IAAI,CAAC,sBAAc,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC;AAPD,oBAOC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CACvB,OAAe,EACf,QAAmB,EACnB,EAAE,MAAM,GAAG,2BAAiB,KAAuB,EAAE;IAErD,MAAM,MAAM,GAAG,cAAO,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,CAAC,MAAM,CAAC,sBAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,WAAI,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,8BAUC;AAED;;GAEG;AACH,SAAgB,SAAS,CACvB,GAAe,EACf,KAAgB,EAChB,EAAE,MAAM,GAAG,2BAAiB,KAAuB,EAAE;IAErD,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;KAClF;IAED,MAAM,MAAM,GAAG,cAAO,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,sBAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,WAAI,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,8BAcC"} \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash-instance.d.ts b/node_modules/blake3-wasm/dist/browser/hash-instance.d.ts new file mode 100644 index 0000000..0a706b3 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-instance.d.ts @@ -0,0 +1,31 @@ +import { BaseHash as BaseHasher } from '../base/index'; +import { HashInput } from './hash-fn'; +import { BrowserEncoding } from './encoding'; +import { IBaseHashOptions } from '../base/hash-fn'; +import { BrowserHashReader } from './hash-reader'; +import { IInternalReader } from '../base/hash-reader'; +import { Hash } from './hash'; +/** + * @inheritdoc + */ +export declare class BrowserHasher extends BaseHasher { + /** + * @inheritdoc + * @override + */ + update(data: HashInput): this; + /** + * Returns a digest of the hash with the given encoding. + */ + digest(options?: IBaseHashOptions): Hash; + digest(encoding: undefined, options: IBaseHashOptions): Hash; + digest(encoding: BrowserEncoding, options?: IBaseHashOptions): string; +} +/** + * A Node.js crypto-like createHash method. + */ +export declare const createHash: () => BrowserHasher; +/** + * A Node.js crypto-like createHash method. + */ +export declare const createKeyed: (key: Uint8Array) => BrowserHasher; diff --git a/node_modules/blake3-wasm/dist/browser/hash-instance.js b/node_modules/blake3-wasm/dist/browser/hash-instance.js new file mode 100644 index 0000000..6319357 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-instance.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const index_1 = require("../base/index"); +const hash_fn_1 = require("./hash-fn"); +const encoding_1 = require("./encoding"); +const hash_reader_1 = require("./hash-reader"); +const hash_1 = require("./hash"); +const wasm_1 = require("./wasm"); +/** + * @inheritdoc + */ +class BrowserHasher extends index_1.BaseHash { + /** + * @inheritdoc + * @override + */ + update(data) { + return super.update(hash_fn_1.normalizeInput(data)); + } + digest(encoding, options) { + let resolvedOpts; + let resolvedEnc; + if (encoding && typeof encoding === 'object') { + resolvedOpts = encoding; + resolvedEnc = undefined; + } + else { + resolvedOpts = options; + resolvedEnc = encoding; + } + const result = super.digest(resolvedOpts); + return resolvedEnc ? encoding_1.mustGetEncoder(resolvedEnc)(result) : result; + } +} +exports.BrowserHasher = BrowserHasher; +/** + * A Node.js crypto-like createHash method. + */ +exports.createHash = () => new BrowserHasher(wasm_1.getWasm().create_hasher(), l => new hash_1.Hash(l), r => new hash_reader_1.BrowserHashReader(r)); +/** + * A Node.js crypto-like createHash method. + */ +exports.createKeyed = (key) => new BrowserHasher(wasm_1.getWasm().create_keyed(key), l => new hash_1.Hash(l), r => new hash_reader_1.BrowserHashReader(r)); +//# sourceMappingURL=hash-instance.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash-instance.js.map b/node_modules/blake3-wasm/dist/browser/hash-instance.js.map new file mode 100644 index 0000000..211b802 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-instance.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash-instance.js","sourceRoot":"","sources":["../../ts/browser/hash-instance.ts"],"names":[],"mappings":";;AAAA,yCAAuD;AACvD,uCAAsD;AACtD,yCAA6D;AAE7D,+CAAkD;AAElD,iCAA8B;AAC9B,iCAAiC;AAEjC;;GAEG;AACH,MAAa,aAAc,SAAQ,gBAAoD;IACrF;;;OAGG;IACI,MAAM,CAAC,IAAe;QAC3B,OAAO,KAAK,CAAC,MAAM,CAAC,wBAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;IAQM,MAAM,CACX,QAA6C,EAC7C,OAA0B;QAE1B,IAAI,YAA0C,CAAC;QAC/C,IAAI,WAAwC,CAAC;QAC7C,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAC5C,YAAY,GAAG,QAAQ,CAAC;YACxB,WAAW,GAAG,SAAS,CAAC;SACzB;aAAM;YACL,YAAY,GAAG,OAAO,CAAC;YACvB,WAAW,GAAG,QAAQ,CAAC;SACxB;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC1C,OAAO,WAAW,CAAC,CAAC,CAAC,yBAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACpE,CAAC;CACF;AAhCD,sCAgCC;AAED;;GAEG;AACU,QAAA,UAAU,GAAG,GAAG,EAAE,CAC7B,IAAI,aAAa,CACf,cAAO,EAAE,CAAC,aAAa,EAAE,EACzB,CAAC,CAAC,EAAE,CAAC,IAAI,WAAI,CAAC,CAAC,CAAC,EAChB,CAAC,CAAC,EAAE,CAAC,IAAI,+BAAiB,CAAC,CAAC,CAAC,CAC9B,CAAC;AAEJ;;GAEG;AACU,QAAA,WAAW,GAAG,CAAC,GAAe,EAAE,EAAE,CAC7C,IAAI,aAAa,CACf,cAAO,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,EAC3B,CAAC,CAAC,EAAE,CAAC,IAAI,WAAI,CAAC,CAAC,CAAC,EAChB,CAAC,CAAC,EAAE,CAAC,IAAI,+BAAiB,CAAC,CAAC,CAAC,CAC9B,CAAC"} \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash-reader.d.ts b/node_modules/blake3-wasm/dist/browser/hash-reader.d.ts new file mode 100644 index 0000000..f2a75c7 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-reader.d.ts @@ -0,0 +1,17 @@ +import { BaseHashReader } from '../base/hash-reader'; +import { BrowserEncoding } from './encoding'; +import { Hash } from './hash'; +/** + * A hash reader for WebAssembly targets. + */ +export declare class BrowserHashReader extends BaseHashReader { + /** + * Converts first 32 bytes of the hash to a string with the given encoding. + */ + toString(encoding?: BrowserEncoding): string; + /** + * Converts first 32 bytes of the hash to an array. + */ + toArray(): Hash; + protected alloc(bytes: number): Hash; +} diff --git a/node_modules/blake3-wasm/dist/browser/hash-reader.js b/node_modules/blake3-wasm/dist/browser/hash-reader.js new file mode 100644 index 0000000..a48c3b2 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-reader.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const hash_reader_1 = require("../base/hash-reader"); +const hash_1 = require("./hash"); +const index_1 = require("../base/index"); +/** + * A hash reader for WebAssembly targets. + */ +class BrowserHashReader extends hash_reader_1.BaseHashReader { + /** + * Converts first 32 bytes of the hash to a string with the given encoding. + */ + toString(encoding = 'hex') { + return this.toArray().toString(encoding); + } + /** + * Converts first 32 bytes of the hash to an array. + */ + toArray() { + this.position = BigInt(0); + return this.read(index_1.defaultHashLength); + } + alloc(bytes) { + return new hash_1.Hash(bytes); + } +} +exports.BrowserHashReader = BrowserHashReader; +//# sourceMappingURL=hash-reader.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash-reader.js.map b/node_modules/blake3-wasm/dist/browser/hash-reader.js.map new file mode 100644 index 0000000..b25f1a0 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash-reader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash-reader.js","sourceRoot":"","sources":["../../ts/browser/hash-reader.ts"],"names":[],"mappings":";;AAAA,qDAAqD;AAErD,iCAA8B;AAC9B,yCAAkD;AAElD;;GAEG;AACH,MAAa,iBAAkB,SAAQ,4BAAoB;IACzD;;OAEG;IACI,QAAQ,CAAC,WAA4B,KAAK;QAC/C,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,yBAAiB,CAAC,CAAC;IACtC,CAAC;IAES,KAAK,CAAC,KAAa;QAC3B,OAAO,IAAI,WAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACF;AAnBD,8CAmBC"} \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash.d.ts b/node_modules/blake3-wasm/dist/browser/hash.d.ts new file mode 100644 index 0000000..6487771 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash.d.ts @@ -0,0 +1,11 @@ +import { BrowserEncoding } from './encoding'; +/** + * Hash returned from functions in the browser. + */ +export declare class Hash extends Uint8Array { + /** + * A constant-time comparison against the other hash/array. + */ + equals(other: unknown): boolean; + toString(encoding?: BrowserEncoding): string; +} diff --git a/node_modules/blake3-wasm/dist/browser/hash.js b/node_modules/blake3-wasm/dist/browser/hash.js new file mode 100644 index 0000000..16145aa --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const encoding_1 = require("./encoding"); +/** + * Hash returned from functions in the browser. + */ +class Hash extends Uint8Array { + /** + * A constant-time comparison against the other hash/array. + */ + equals(other) { + if (!(other instanceof Uint8Array)) { + return false; + } + if (other.length !== this.length) { + return false; + } + let cmp = 0; + for (let i = 0; i < this.length; i++) { + cmp |= this[i] ^ other[i]; + } + return cmp === 0; + } + toString(encoding = 'hex') { + return encoding_1.mustGetEncoder(encoding)(this); + } +} +exports.Hash = Hash; +//# sourceMappingURL=hash.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/hash.js.map b/node_modules/blake3-wasm/dist/browser/hash.js.map new file mode 100644 index 0000000..33039d2 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/hash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../ts/browser/hash.ts"],"names":[],"mappings":";;AAAA,yCAA6D;AAE7D;;GAEG;AACH,MAAa,IAAK,SAAQ,UAAU;IAClC;;OAEG;IACI,MAAM,CAAC,KAAc;QAC1B,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE;YAClC,OAAO,KAAK,CAAC;SACd;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;QAED,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3B;QAED,OAAO,GAAG,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,QAAQ,CAAC,WAA4B,KAAK;QAC/C,OAAO,yBAAc,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF;AAxBD,oBAwBC"} \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/index.d.ts b/node_modules/blake3-wasm/dist/browser/index.d.ts new file mode 100644 index 0000000..f44c7ed --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/index.d.ts @@ -0,0 +1,3 @@ +export { hash, HashInput, deriveKey, keyedHash } from './hash-fn'; +export * from './hash-instance'; +export * from '../base/index'; diff --git a/node_modules/blake3-wasm/dist/browser/index.js b/node_modules/blake3-wasm/dist/browser/index.js new file mode 100644 index 0000000..3a8ca9e --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/index.js @@ -0,0 +1,12 @@ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +var hash_fn_1 = require("./hash-fn"); +exports.hash = hash_fn_1.hash; +exports.deriveKey = hash_fn_1.deriveKey; +exports.keyedHash = hash_fn_1.keyedHash; +__export(require("./hash-instance")); +__export(require("../base/index")); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/index.js.map b/node_modules/blake3-wasm/dist/browser/index.js.map new file mode 100644 index 0000000..9595245 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/browser/index.ts"],"names":[],"mappings":";;;;;AAAA,qCAAkE;AAAzD,yBAAA,IAAI,CAAA;AAAa,8BAAA,SAAS,CAAA;AAAE,8BAAA,SAAS,CAAA;AAC9C,qCAAgC;AAChC,mCAA8B"} \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/wasm.d.ts b/node_modules/blake3-wasm/dist/browser/wasm.d.ts new file mode 100644 index 0000000..559b61e --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/wasm.d.ts @@ -0,0 +1,10 @@ +import * as rawWasm from '../../dist/wasm/browser/blake3_js'; +/** + * Gets the webassembly module provided in provideWasm. + */ +export declare const getWasm: () => typeof rawWasm; +/** + * Sets the webassembly module used for the browser build. This indirection is + * needed to provide compatibility between the "browser" and "browser-async" modes. + */ +export declare const provideWasm: (w: typeof rawWasm) => void; diff --git a/node_modules/blake3-wasm/dist/browser/wasm.js b/node_modules/blake3-wasm/dist/browser/wasm.js new file mode 100644 index 0000000..8bef8fe --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/wasm.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let wasm; +/** + * Gets the webassembly module provided in provideWasm. + */ +exports.getWasm = () => { + if (!wasm) { + throw new Error('BLAKE3 webassembly not loaded. Please import the module via `blake3/browser` or `blake3/browser-async`'); + } + return wasm; +}; +/** + * Sets the webassembly module used for the browser build. This indirection is + * needed to provide compatibility between the "browser" and "browser-async" modes. + */ +exports.provideWasm = (w) => { + wasm = w; +}; +//# sourceMappingURL=wasm.js.map \ No newline at end of file diff --git a/node_modules/blake3-wasm/dist/browser/wasm.js.map b/node_modules/blake3-wasm/dist/browser/wasm.js.map new file mode 100644 index 0000000..7ee45c5 --- /dev/null +++ b/node_modules/blake3-wasm/dist/browser/wasm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../../ts/browser/wasm.ts"],"names":[],"mappings":";;AAEA,IAAI,IAAoB,CAAC;AAEzB;;GAEG;AACU,QAAA,OAAO,GAAG,GAAG,EAAE;IAC1B,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CACb,wGAAwG,CACzG,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;GAGG;AACU,QAAA,WAAW,GAAG,CAAC,CAAiB,EAAE,EAAE;IAC/C,IAAI,GAAG,CAAC,CAAC;AACX,CAAC,CAAC"} \ No newline at end of file -- cgit v1.2.3