refactor: switch to using hexToBytes
This commit is contained in:
parent
81851d9595
commit
7856713abf
|
@ -1,6 +1,7 @@
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { Client, factory } from "@lumeweb/libkernel/module";
|
import { Client, factory } from "@lumeweb/libkernel/module";
|
||||||
import { DataFn, ErrTuple, hexToBuf, logErr } from "@lumeweb/libkernel";
|
import { DataFn, ErrTuple, logErr } from "@lumeweb/libkernel";
|
||||||
|
import { hexToBytes } from "@lumeweb/libweb";
|
||||||
import { blake2b } from "@noble/hashes/blake2b";
|
import { blake2b } from "@noble/hashes/blake2b";
|
||||||
import b4a from "b4a";
|
import b4a from "b4a";
|
||||||
|
|
||||||
|
@ -54,8 +55,7 @@ export class SwarmClient extends Client {
|
||||||
|
|
||||||
public async connect(pubkey: string | Uint8Array): Promise<Socket> {
|
public async connect(pubkey: string | Uint8Array): Promise<Socket> {
|
||||||
if (typeof pubkey === "string") {
|
if (typeof pubkey === "string") {
|
||||||
const buf = hexToBuf(pubkey);
|
pubkey = hexToBytes(pubkey);
|
||||||
pubkey = this.handleErrorOrReturn(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let existing = Array.from(this._sockets.values()).filter((socket) => {
|
let existing = Array.from(this._sockets.values()).filter((socket) => {
|
||||||
|
|
Loading…
Reference in New Issue