export type Bytes = Uint8Array<ArrayBuffer>
export type Words = Uint32Array<ArrayBuffer>
+const Buffer = ArrayBuffer
const Bytes = Uint8Array
const Words = Uint32Array
const TypedArray = Object.getPrototypeOf(Bytes.prototype)
/** Reads internal slot `[[ViewedArrayBuffer]]`. */
const getBuffer = getter(TypedArray, 'buffer')
/** Throws if passed `SharedArrayBuffer`, distinguishing it from `ArrayBuffer`. */
-const getBufferByteLength = getter(ArrayBuffer.prototype, 'byteLength')
+const getBufferByteLength = getter(Buffer.prototype, 'byteLength')
/** Reads internal slot `[[ByteLength]]`. */
const getByteLength = getter(TypedArray, 'byteLength')
/** Reads internal slot `[[ByteOffset]]`. */
if (typeof length !== 'number') {
throw new Nano25519TypeError('Invalid byte length')
}
- return new Bytes(length)
+ const buffer = new Buffer(length)
+ return new Bytes(buffer)
}
/** Captured version of `Uint8Array.prototype.byteLength`. */