Skip to content

buzz-db: unify pubkey representation (bytes vs hex string) #16

Description

@TheSentinel454

Pubkeys are passed as &[u8] (compressed 33-byte form) in some modules (dm, api_token, moderation, reactions, channel membership) and as &str (hex string) in others (relay_members, archived_identities, git_repo, community ownership). This forces callers to know which form each function expects and convert at every call site. A newtype wrapping the byte form with AsRef<[u8]> and hex display would standardize the interface and catch misuse at compile time. Priority: Medium — independent effort, improves type safety across the crate.

🤖 AI review update (2026-08-23)

Correct the target representation: Nostr public keys stored by Buzz are 32-byte x-only keys, not 33-byte compressed keys. Introduce a validated 32-byte newtype with hex parsing/display and database conversion at boundaries, then migrate one domain at a time. Avoid a flag-day signature change across all consumers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions