]> git.codecow.com Git - nano25519.git/commitdiff
Fix buffer handling.
authorChris Duncan <chris@codecow.com>
Sat, 26 Sep 2026 08:57:55 +0000 (01:57 -0700)
committerChris Duncan <chris@codecow.com>
Sat, 26 Sep 2026 08:57:55 +0000 (01:57 -0700)
src/lib/primordials.ts

index 8bc4393a66456001d607c62c00f43e1668c48b2f..4849056fab70d765d7c70a3b15e2094168948963 100644 (file)
@@ -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'