From bd04087a97a13c085ca878e4028b84c3e9c59d89 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 3 Sep 2023 20:54:57 -0400 Subject: [PATCH] refactor: only prefix ED25519 if its not the 1st byte --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d1779f5..1d3f593 100644 --- a/src/index.ts +++ b/src/index.ts @@ -115,7 +115,9 @@ async function handleGetRegistryEntry(aq: ActiveQuery) { pubkey = ensureBytes("registry entry ", pubkey, 32); - pubkey = concatBytes(Uint8Array.from([CID_HASH_TYPES.ED25519]), pubkey); + if (pubkey[0] !== CID_HASH_TYPES.ED25519) { + pubkey = concatBytes(Uint8Array.from([CID_HASH_TYPES.ED25519]), pubkey); + } const ret = await node.services.registry.get(pubkey);