fix: ensure root and proof are Uint8Array's

This commit is contained in:
Derrick Hammer 2023-06-24 04:10:09 -04:00
parent 0cbb09b247
commit 0c320f992b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,13 @@ export async function getVerifiableStream(
const reader = new VariableChunkStream(data); const reader = new VariableChunkStream(data);
let bytesToRead; let bytesToRead;
if (root instanceof ArrayBuffer) {
root = new Uint8Array(root);
}
if (proof instanceof ArrayBuffer) {
proof = new Uint8Array(proof);
}
const getNextBytes = async () => { const getNextBytes = async () => {
bytesToRead = getWasmProperty(wasmId, "write_promise"); bytesToRead = getWasmProperty(wasmId, "write_promise");
bytesToRead = await bytesToRead; bytesToRead = await bytesToRead;