From b0b72dfebabe3ada892b6b304f8d1b7b3ed3d73f Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 4 Aug 2025 10:54:56 -0700 Subject: [PATCH] Add convenience getter for entropy as bigint. Add constructor overload for unknown inputs to get type checking working. --- src/lib/entropy.ts | 2 ++ 1 file changed, 2 insertions(+) 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) { -- 2.47.3