From: Chris Duncan Date: Sat, 26 Sep 2026 08:57:55 +0000 (-0700) Subject: Fix buffer handling. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=1d1078dae1d12b7e35f61654a7267d37d881604e;p=nano25519.git Fix buffer handling. --- diff --git a/src/lib/primordials.ts b/src/lib/primordials.ts index 8bc4393..4849056 100644 --- a/src/lib/primordials.ts +++ b/src/lib/primordials.ts @@ -128,7 +128,7 @@ export function isBytes (a: unknown): a is Bytes { /** Captured version of `DataView` reusing input offset and length. */ export function view (bytes: Bytes): View { - return new View(getBuffer.call(bytes), getByteOffset.call(bytes), getByteLength.call(bytes)) + return new View(getBuffer.call(bytes) as ArrayBuffer, getByteOffset.call(bytes), getByteLength.call(bytes)) } /** @@ -147,7 +147,7 @@ export function words (bytes: Bytes): Words { if (offset !== 0) { throw new Nano25519RangeError('Unexpected byte offset', { cause: offset }) } - return new Words(bytes.buffer, 0, getByteLength.call(bytes) >> 2) + return new Words(getBuffer.call(bytes) as ArrayBuffer, 0, getByteLength.call(bytes) >> 2) } const LOWER = '0123456789abcdef'