feat: accept hex pubkey/seckey in Add Solver and Setup Admin Key#56
Open
mostronatorcoder[bot] wants to merge 1 commit intomainfrom
Open
feat: accept hex pubkey/seckey in Add Solver and Setup Admin Key#56mostronatorcoder[bot] wants to merge 1 commit intomainfrom
mostronatorcoder[bot] wants to merge 1 commit intomainfrom
Conversation
- validation::validate_npub() now accepts both npub bech32 and hex (64-char) via PublicKey::from_bech32() + PublicKey::from_hex() fallback - validation::validate_nsec() now accepts both nsec bech32 and hex (64-char) via SecretKey::from_bech32() + SecretKey::from_str() fallback - Added hex_pubkey_to_npub() and hex_seckey_to_nsec() conversion helpers - execute_admin_add_solver() normalizes hex input to npub before sending to Mostro so the node always receives bech32 format - Updated UI placeholders in draw.rs: - Add Solver: 'npub... / hex...' instead of 'npub...' - Setup Admin Key: 'nsec... / hex...' instead of 'nsec...' - Error messages updated to guide users toward the correct format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Accept hex-encoded keys in the Add Solver and Setup Admin Key input popups, in addition to the existing bech32 (npub/nsec) support.
Changes
Validation (
src/ui/key_handler/validation.rs)validate_npub(): tryPublicKey::from_bech32()first, fall back toPublicKey::from_hex(). Accepts npub and 64-char hex.validate_nsec(): trySecretKey::from_bech32()first, fall back toSecretKey::from_str(). Accepts nsec and 64-char hex."expected npub1... (bech32) or 64-char hex string"/"expected nsec1... (bech32) or 64-char hex string"hex_pubkey_to_npub()andhex_seckey_to_nsec()conversion helpersMostro wire format (
src/util/order_utils/execute_admin_add_solver.rs)normalize_solver_pubkey()converts hex input to npub before sending to Mostro, so the node always receives bech32 regardless of how the operator entered the keyUI placeholders (
src/ui/draw.rs)"npub... / hex..."(was"npub...")"nsec... / hex..."(was"nsec...")Motivation
Currently the only way to add a solver or set the admin key is with bech32 keys. Operators who have hex-encoded keys (e.g. from
rana, raw Nostr tooling, or Mostro config files) must manually convert before pasting. Accepting hex directly reduces friction.Complements Mostro node's solver permission levels (PR #708).