Compare commits
6 Commits
v0.2.0-dev
...
v0.2.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | c69420ae90 | |
Derrick Hammer | 0cbb09b247 | |
Derrick Hammer | cb4048b963 | |
Derrick Hammer | a530a07f01 | |
Derrick Hammer | 1c738c8aae | |
Derrick Hammer | afd79e308f |
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.8",
|
"version": "0.2.0-develop.9",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.8",
|
"version": "0.2.0-develop.9",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@noble/curves": "^1.1.0",
|
"@noble/curves": "^1.1.0",
|
||||||
"@noble/hashes": "^1.3.1",
|
"@noble/hashes": "^1.3.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.8",
|
"version": "0.2.0-develop.9",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "lib/index.mjs",
|
"module": "lib/index.mjs",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|
|
@ -36,7 +36,7 @@ export function encodeCid(hash: any, size: bigint) {
|
||||||
export function decodeCid(cid: string): CID {
|
export function decodeCid(cid: string): CID {
|
||||||
let bytes = base58btc.decode(cid);
|
let bytes = base58btc.decode(cid);
|
||||||
|
|
||||||
if (!arrayBufferEqual(bytes.slice(0, 2).buffer, bytes.buffer)) {
|
if (!arrayBufferEqual(bytes.slice(0, 2).buffer, MAGIC_BYTES.buffer)) {
|
||||||
throw new Error("Invalid cid");
|
throw new Error("Invalid cid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ export class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
async login(): Promise<LoginResponse> {
|
async login(): Promise<LoginResponse> {
|
||||||
if (!this._options.privateKey) {
|
if (this._options.privateKey) {
|
||||||
return this.loginPubkey();
|
return this.loginPubkey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,11 @@ export async function getVerifiableStream(
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
await getNextBytes();
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const wasmId = callExports("start");
|
const wasmId = callExports("start");
|
||||||
getWasmProperty(wasmId, "set_root")(root);
|
getWasmProperty(wasmId, "set_root")(root);
|
||||||
getWasmProperty(wasmId, "set_proof")(proof);
|
getWasmProperty(wasmId, "set_proof")(proof);
|
||||||
|
await getNextBytes();
|
||||||
|
|
||||||
return new ReadableStream({
|
return new ReadableStream({
|
||||||
async pull(controller) {
|
async pull(controller) {
|
||||||
|
|
|
@ -5,12 +5,12 @@ export default async function (imports) {
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const wasmPath = new URL("wasm/bao.wasm", import.meta.url);
|
const wasmPath = new URL("wasm/bao.wasm", import.meta.url);
|
||||||
|
|
||||||
const wasm = await fs.readFile(wasmPath);
|
const wasm = await fs.readFile(wasmPath);
|
||||||
|
return (await WebAssembly.instantiate(wasm, imports)).instance;
|
||||||
return WebAssembly.instantiate(wasm, imports);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return await import("./wasm/bao.wasm");
|
let wasm = await import("./wasm/bao.wasm");
|
||||||
|
wasm = wasm.default || wasm;
|
||||||
|
return (await wasm(imports)).instance;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue