Compare commits

..

No commits in common. "1eaba3e7340e913baa464984bfe1d31905db7851" and "211cd874373ab5f571c828378dfb869e9e954ca7" have entirely different histories.

1 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { Client, factory } from "@lumeweb/libkernel/module";
import type { Peer } from "@lumeweb/libpeerdiscovery";
import { hexToBytes } from "@lumeweb/libweb";
import { hexToBuf } from "@lumeweb/libweb";
const MODULE = "zdiLW9MtAAMssP5vLBgd1FitouiVXzNUYZszFYG44uVKqCPDqUQox9aq1y";
@ -29,9 +29,13 @@ export class PeerDiscoveryClient extends Client {
public async discover(pubkey: string | Uint8Array): Promise<Peer | boolean> {
if (typeof pubkey === "string") {
pubkey = hexToBytes(pubkey);
}
let buf = hexToBuf(pubkey);
if (buf[1]) {
throw new Error(buf[1]);
}
pubkey = buf[0];
}
return await this.callModuleReturn("discover", { pubkey });
}
}