Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions infrastructure/signature-validator/src/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -68,7 +59,6 @@ async function decodeMultibasePublicKey(multibaseKey: string): Promise<Uint8Arra

// Try base58btc (standard multibase 'z' prefix)
try {
const base58btc = await getBase58btc();
return base58btc.decode(encoded);
} catch (error) {
throw new Error(
Expand All @@ -87,7 +77,6 @@ async function decodeSignature(signature: string): Promise<Uint8Array> {
// 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)}`);
Expand Down