Skip to content

keyset create displays wrong npub #43

@DocNR

Description

@DocNR

Hey FROSTR team... ran into an issue where the npub displayed after creating a new keyset didn't match the npub derived from the nsec and the shares that were generated. Here's the analysis Claude code did after getting the issue figured out:


Root cause: KeysetCreate.tsx computes the displayed npub using ed25519.getPublicKey(), but Nostr and FROST both use secp256k1. The same private key bytes on different elliptic curves produce different public keys, so the displayed npub is wrong.

The nsec itself is correct — nak decode returns the right pubkey, which also matches the group_pk in the bfgroup1 credential.

Fix: Either use secp256k1 to derive the pubkey from the nsec, or decode group_pk directly from the generated bfgroup1 credential (safest, since it's the ground truth):
const group = PackageEncoder.group.decode(groupCredential);
const npub = nip19.npubEncode(group.group_pk.slice(2)); // x-only, strip 02/03 prefix

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions