From: Chris Duncan Date: Mon, 4 Aug 2025 17:54:56 +0000 (-0700) Subject: Add convenience getter for entropy as bigint. Add constructor overload for unknown... X-Git-Tag: v0.10.5~46^2~12 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=b0b72dfebabe3ada892b6b304f8d1b7b3ed3d73f;p=libnemo.git Add convenience getter for entropy as bigint. Add constructor overload for unknown inputs to get type checking working. --- diff --git a/src/lib/entropy.ts b/src/lib/entropy.ts index bd77362..5d34ff6 100644 --- a/src/lib/entropy.ts +++ b/src/lib/entropy.ts @@ -31,6 +31,7 @@ export class Entropy { } get bits (): string { return bytes.toBin(this.#bytes) } get buffer (): ArrayBuffer { return this.#bytes.buffer } + get byteLength (): number { return this.#bytes.byteLength } get bytes (): Uint8Array { return this.#bytes } get hex (): string { return bytes.toHex(this.#bytes) } @@ -58,6 +59,7 @@ export class Entropy { * @param {string} hex - Hexadecimal string */ constructor (hex: string) + constructor (input?: unknown) constructor (input?: unknown) { if (input == null) {