Skip to content

fix: accept buzz-admin hex secrets in desktop key import (#2815) - #4504

Open
Chessing234 wants to merge 6 commits into
block:mainfrom
Chessing234:fix/desktop-hex-key-import-2815
Open

Chessing234 wants to merge 6 commits into
block:mainfrom
Chessing234:fix/desktop-hex-key-import-2815

Conversation

@Chessing234

@Chessing234 Chessing234 commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • buzz-admin generate-key shows hex + nsec
  • paste the hex into Use an existing key → Next enables and npub preview matches
  • paste nsec / ncryptsec paths still work
  • cd desktop && npm test -- src/shared/lib/nostrUtils.test.mjs src/features/onboarding/lib/keyImportInput.test.mjs

buzz-admin was only emitting a hex secret, so operators following the
bootstrap hint could not paste into desktop onboarding (block#2815).

Signed-off-by: Taksh <takshkothari09@gmail.com>
Match Keys::parse / BUZZ_PRIVATE_KEY so buzz-admin generate-key output
enables Next instead of sitting on 'waiting for nsec1' (block#2815, block#3880).

Signed-off-by: Taksh <takshkothari09@gmail.com>
Lock buzz-admin hex secrets through classify/submit and npub preview.

Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234

Copy link
Copy Markdown
Contributor Author

hex import for buzz-admin secrets — pairs with the #3880/#2815 confusion. @wesbillman if hosted/onboarding is on your plate.

@Chessing234

Copy link
Copy Markdown
Contributor Author

@jurgenhaas @ashbrener small desktop fix for buzz-admin hex secrets on key import (#2815). easy review if you're in that area.

@ashbrener ashbrener left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read this closely because it fixes a papercut I hit yesterday: buzz-admin generate-key prints hex, the import form gated on startsWith("nsec1"), so the key it just gave me was rejected by the app. Frontend stricter than the backend for no reason. Adding npub to the generate-key output is a nice extra — I spent real time yesterday converting a hex pubkey by hand to find which identity a relay was configured with.

Two things I checked specifically, since they are where this kind of change tends to break, and both are fine:

The new "hex" kind cannot fall into a wrong branch. KeyImportKind is only ever branched on at keyImportInput.ts:123 (kind === "ncryptsec") and NostrKeyImportForm.tsx:66. Everything else routes through nsecToNpub, which now normalizes hex. No exhaustive switch to update.

Hex cannot leak into the keyring. The form submits the raw input, so I expected to find hex being persisted where the rest of the system assumes bech32 — but import_identity (commands/identity.rs:336) passes the parsed Keys object to persist_imported_identity, not the string. Storage stays normalized.

One inconsistency worth a look, inline below.

Comment thread desktop/src/shared/lib/nostrUtils.ts Outdated
Align pubkey/secret hex tolerance and stop duplicating the pattern in
keyImportInput.

Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234

Copy link
Copy Markdown
Contributor Author

good catch — tip now exports a shared case-insensitive HEX_64_REGEX from nostrUtils and keyImportInput imports it, so pubkey/secret stay aligned.

@Chessing234

Copy link
Copy Markdown
Contributor Author

@ashbrener tip exports the shared case-insensitive HEX_64_REGEX now. still good to merge from your side?

Signed-off-by: Taksh <takshkothari09@gmail.com>
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 016310d3cc44688779a7d517a13d9cc8024ddfa8...f314e8fead99be616179d845c3ee1e7ad695762b.
A new review must complete for this exact range. When manual authorization
is required, a user with write access must comment exactly
@buzz-security-review f314e8fead99be616179d845c3ee1e7ad695762b to authorize a new review.
Any previous review applies only to its recorded range.

keep hex nsec import and main's event-id parser.

Signed-off-by: Taksh <takshkothari09@gmail.com>

This branch has not been deployed

No deployments
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.

2 participants