Problem
Currently Mostrix only accepts bech32-encoded Nostr keys:
- Add Solver (Settings) → only accepts
npub1... format
- Setup Admin Key → only accepts
nsec1... format
However, operators often have hex-encoded keys from:
- rana output
- Mostro config files (
config.toml, config.sample.toml)
- Raw Nostr tooling
Having to manually convert hex → bech32 to use Mostrix adds friction and causes errors.
Proposal
Accept both formats in all key input fields:
npub1... (bech32) — current behavior
nsec1... (bech32) — current behavior
- 64-char hex string — new
Scope
Two main input paths:
-
Add Solver (AdminMode::AddSolver)
- Input: solver public key (hex or npub)
- Validation:
validate_npub() → try PublicKey::from_bech32(), fall back to PublicKey::from_hex()
- Wire format: normalize to npub before sending
AdminAddSolver to Mostro (so the node always receives bech32)
-
Setup Admin Key (AdminMode::SetupAdminKey)
- Input: admin private key (hex or nsec)
- Validation:
validate_nsec() → try SecretKey::from_bech32(), fall back to SecretKey::from_str() (or equivalent hex parser)
UX
- Update placeholders in the input popup:
- Add Solver:
"npub... / hex..."
- Setup Admin Key:
"nsec... / hex..."
- Error messages should guide users:
"expected npub1... (bech32) or 64-char hex string"
Context
This complements Mostro node's solver permission levels (PR #708), making it easier for operators to register AI agents (read-only) and human solvers (read-write) through Mostrix.
Problem
Currently Mostrix only accepts bech32-encoded Nostr keys:
npub1...formatnsec1...formatHowever, operators often have hex-encoded keys from:
config.toml,config.sample.toml)Having to manually convert hex → bech32 to use Mostrix adds friction and causes errors.
Proposal
Accept both formats in all key input fields:
npub1...(bech32) — current behaviornsec1...(bech32) — current behaviorScope
Two main input paths:
Add Solver (
AdminMode::AddSolver)validate_npub()→ tryPublicKey::from_bech32(), fall back toPublicKey::from_hex()AdminAddSolverto Mostro (so the node always receives bech32)Setup Admin Key (
AdminMode::SetupAdminKey)validate_nsec()→ trySecretKey::from_bech32(), fall back toSecretKey::from_str()(or equivalent hex parser)UX
"npub... / hex...""nsec... / hex...""expected npub1... (bech32) or 64-char hex string"Context
This complements Mostro node's solver permission levels (PR #708), making it easier for operators to register AI agents (read-only) and human solvers (read-write) through Mostrix.