From: Chris Duncan Date: Wed, 23 Jul 2025 19:55:24 +0000 (-0700) Subject: Add blake type definition. X-Git-Tag: v0.10.5~55^2~6 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=c159ab515a9cba8f153f25cec537f1fa5cd2fec6;p=libnemo.git Add blake type definition. --- diff --git a/src/types.d.ts b/src/types.d.ts index 64d87dd..5d945fd 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -216,6 +216,40 @@ export declare class Bip39Mnemonic { toBlake2bSeed (format: 'hex'): Promise } +/** +* Implementation derived from blake2b@2.1.4. Copyright 2017 Emil Bay +* (https://github.com/emilbayes/blake2b). See LICENSES/ISC.txt +* +* Modified to use BigUint64 values, eliminate dependencies, port to TypeScript, +* and embed in web workers. +* +* Original source commit: https://github.com/emilbayes/blake2b/blob/1f63e02e3f226642959506cdaa67c8819ff145cd/index.js +*/ +export declare class Blake2b { + #private + static get OUTBYTES_MIN (): 1 + static get OUTBYTES_MAX (): 64 + static get KEYBYTES_MIN (): 1 + static get KEYBYTES_MAX (): 64 + static get SALTBYTES (): 16 + static get PERSONALBYTES (): 16 + static get IV (): bigint[] + static get SIGMA (): number[][] + /** + * Creates a BLAKE2b hashing context. + * + * @param {number} length - Output length between 1-64 bytes + * @param {Uint8Array} [key] - (_optional_) Used for keyed hashing (MAC and PRF) + * @param {Uint8Array} [salt] - (_optional_) Used to simplify randomized hashing for digital signatures + * @param {Uint8Array} [personal] - (_optional_) Arbitrary user-specified value + */ + constructor (length: UnknownNumber, key?: UnknownUint8Array, salt?: UnknownUint8Array, personal?: UnknownUint8Array) + update (input: Uint8Array): Blake2b + digest (): Uint8Array + digest (out: 'hex'): string + digest (out: 'binary' | Uint8Array): Uint8Array +} + /** * Represents a block as defined by the Nano cryptocurrency protocol. The Block * class is abstract and cannot be directly instantiated. Every block must be one