fix: have resolveModuleRegistryEntry decode the cid and pass the pubkey

This commit is contained in:
Derrick Hammer 2023-09-02 14:46:06 -04:00
parent 39497a6391
commit e6318cdc38
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import { internalModuleCall, modules } from "./queries.js"; import { internalModuleCall, modules } from "./queries.js";
import { SignedRegistryEntry } from "@lumeweb/libs5"; import { SignedRegistryEntry } from "@lumeweb/libs5";
import { base58btc } from "multiformats/bases/base58"; import { base58btc } from "multiformats/bases/base58";
import { decodeCid } from "@lumeweb/libweb";
const CORE_MODULES = { const CORE_MODULES = {
swarm: "z3o47ar8NBrnaEneBVzZD7QuMRMXjDtQDCpt4xP6mhsdw1cjnJ8mQKfNKGv3", swarm: "z3o47ar8NBrnaEneBVzZD7QuMRMXjDtQDCpt4xP6mhsdw1cjnJ8mQKfNKGv3",
@ -30,7 +31,11 @@ function moduleLoaded(module: string) {
return module in modules; return module in modules;
} }
export async function resolveModuleRegistryEntry(pubkey: string) { export async function resolveModuleRegistryEntry(module: string) {
const [cid] = decodeCid(module);
const pubkey = cid.hash;
const signedEntry = (await internalModuleCall( const signedEntry = (await internalModuleCall(
CORE_MODULES.s5, CORE_MODULES.s5,
"getRegistryEntry", "getRegistryEntry",