diff --git a/infrastructure/signature-validator/src/index.ts b/infrastructure/signature-validator/src/index.ts index c8970229..633c4414 100644 --- a/infrastructure/signature-validator/src/index.ts +++ b/infrastructure/signature-validator/src/index.ts @@ -1,15 +1,6 @@ import axios from "axios"; import * as jose from "jose"; - -// Lazy initialization for base58btc to handle ESM module resolution -let base58btcModule: { base58btc: { decode: (input: string) => Uint8Array } } | null = null; - -async function getBase58btc() { - if (!base58btcModule) { - base58btcModule = await import("multiformats/bases/base58"); - } - return base58btcModule.base58btc; -} +import { base58btc } from "multiformats/bases/base58"; /** * Options for signature verification @@ -68,7 +59,6 @@ async function decodeMultibasePublicKey(multibaseKey: string): Promise { // If it starts with 'z', it's multibase base58btc if (signature.startsWith("z")) { try { - const base58btc = await getBase58btc(); return base58btc.decode(signature.slice(1)); } catch (error) { throw new Error(`Failed to decode multibase signature: ${error instanceof Error ? error.message : String(error)}`);