Skip to content

fix(hbsig): strip publickey: prefix from keyid before computing address - #2

Open
droter wants to merge 1 commit into
masterfrom
fix/extract-pubkey-prefix
Open

fix(hbsig): strip publickey: prefix from keyid before computing address#2
droter wants to merge 1 commit into
masterfrom
fix/extract-pubkey-prefix

Conversation

@droter

@droter droter commented Jan 26, 2026

Copy link
Copy Markdown

Summary

  • Fixes extractPubKey to properly strip the publickey: prefix from keyid before computing the committer address
  • Converts standard base64 encoding to base64url for the decoder

Problem

The keyid format in HTTP signatures is type:value (e.g., publickey:base64data). The extractPubKey function was passing the entire keyid including the prefix to base64url.toBuffer(), which caused incorrect address computation.

This resulted in:

  • Committer addresses not matching expected wallet addresses
  • Authorization failures in HyperBEAM cache writes and other ACL-protected operations

Solution

  1. Strip the prefix before the first colon
  2. Convert standard base64 (+/) to base64url (-_) format before decoding

Test

Before fix:

Committer: wwFglwhijt2HEiK1PpfLF9v_B8DJ3ig7eJV8R_3i8Eo
Expected:  LpguSJsRZmtKQWFOp9wE3sdyPTBpDI79VTbjyeAZF0M
Match: false

After fix:

Committer: LpguSJsRZmtKQWFOp9wE3sdyPTBpDI79VTbjyeAZF0M
Expected:  LpguSJsRZmtKQWFOp9wE3sdyPTBpDI79VTbjyeAZF0M
Match: true

🤖 Generated with Claude Code

The extractPubKey function was returning the full keyid including the
"publickey:" prefix, causing incorrect committer address computation.

The keyid format is "type:value" (e.g., "publickey:base64data"). The
function now:
1. Strips the prefix before the first colon
2. Converts standard base64 (+/) to base64url (-_) for the decoder

This fixes authorization failures where HyperBEAM couldn't match the
computed committer address against cache_writers or other ACLs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant