convert nostr keys and note-ids between hex and bech32

Related tags

Command-line nostr
Overview

Key-Convertr

People are copy-pasting nostr private keys into webpages to convert between the original hex-encoding and bech32-encoding (specified in NIP-19).

This is kind of bonkers, so here's a command-line utility that you can run to convert public/private keys between hex-encoding and the NIP-19 bech32 encoding. IT can also convert note id's.

To use it, you need cargo installed. Then from the key-convertr directory, just do cargo install --path .. It will put a program called key-convertr in your $HOME/.cargo/bin directory.

Then, to convert from a hex-encoded pubkey to a bech32-encoded pubkey, you can do

$> key-convertr --kind npub 3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d
npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6

Just provide the hex-encoded key or note-id and a --kind argument. The kinds supported are:

  • npub
  • nsec
  • note

To convert from an npub to hex-encoding, you can do

$> key-convertr --to-hex npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6
3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d
You might also like...
Nostr CLI client built with Rust

Nostr CLI client built with Rust Encrypted chat inside Nostr leaks metadata of who talks to who. This small CLI app implements a "public inbox," which

A simple tool to mine nostr vanity pubkeys.

Nostr CPU pubkey miner A simple tool to mine nostr vanity pubkeys. Currently supports hexadecimal and bech32 vanity keys. Tested on Windows but should

A GPT-3 access point through Nostr, powered by lightning

Geppeto A Nostr based API for GPT-3, powered on Lightning. The bot listens for event kind 29000 (inspired by NIP-9000) and will query the prompt to th

This is an example Nostr rust project to enable '402 Payment Required' responses for requests to paid content.

Nostr Paywall Example This is an example Nostr rust project to enable 402 Payment Required responses for requests to paid content. To prove payment, a

siamstr.com Nostr Address Provider written in Rust.
siamstr.com Nostr Address Provider written in Rust.

Siamstr Nostr Address Provider Running project Rust Toolchain You'll need to use the nightly Rust toolchain, and install the wasm32-unknown-unknown ta

A small CLI wrapper for authenticating with SSH keys from Hashicorp Vault
A small CLI wrapper for authenticating with SSH keys from Hashicorp Vault

vaultssh A small CLI wrapper for authenticating with SSH keys from Hashicorp Vault vaultssh is a small CLI wrapper for automatically fetching and usin

ripsecrets is a command-line tool to prevent committing secret keys into your source code.

ripsecrets is a command-line tool to prevent committing secret keys into your source code. ripsecrets has a few features that distinguish it from other secret scanning tools:

CLI tool to generate aptos keys.

aptos-keygrind CLI tool to generate aptos keys. Credit to https://github.com/solana-labs/solana/tree/master/keygen for some code I took. Installation

g3k: Generate Good-looking GPG Keys

g3k: Generate Good-looking GPG Keys Yet another vanity key generator. Usage: git clone https://github.com/bnoctis/g3k cd g3k cargo build --release tar

Comments
  • add Dockerfile

    add Dockerfile

    if you have docker running already, there is no need to set up a rust dev environment to use the tool. Just use the docker image instead

    ➜  docker-key-converter git:(main) docker run --rm aphex3k/key-convertr:testing --help                                                                                                                 
    Usage: key-convertr [OPTIONS] <KEY>
    
    Arguments:
      <KEY>  the key or note id that you want to convert
    
    Options:
      -k, --kind <KIND>  the kind of entity you are converting [possible values: npub, nsec, note]
          --to-hex       you want to convert from bech32 to hex
      -h, --help         Print help information
      -V, --version      Print version information
    
    opened by aphex3k 0
Owner
Rijndael
Rijndael
Fast tool to scan for valid 7-long imgur ids for the ArchiveTeam imgur efforts (not affiliated or endorsed)

imgur_id7 Fast tool to scan for valid 7-long imgur ids for the ArchiveTeam imgur efforts (not affiliated or endorsed) Optionally uses supplied http pr

Robin Rolf 6 Jun 3, 2023
Command line linguistic tools: display pronunciation, convert between regional norms of orthography

Command line linguistic tools: display pronunciation, convert between regional norms of orthography; support for multiple modern and ancient languages: English, Latin, Polish, Quechua, Tikuna

Piotr Bajdek 7 Nov 28, 2022
Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers. It deals only with integer arithmetic. Expressions may involve mixed bases (limited to decimal, hexadecimal, octal and binary numbers). The global output format may be set to a particular radix - by default it is hex.

Deep Majumder 50 Dec 22, 2022
Parse hex colors to tui::style::Color

Color -> Tui Parse hex colors to tui rgb colors #c3f111 -> Color::Rgb(195,241,17) Note that the indexed colors are NOT HEX #142 -> Color::Indexed(142)

Uttarayan Mondal 1 Nov 8, 2021
hexyl is a simple hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes

hexyl is a simple hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes (NULL bytes, printable ASCII characters, ASCII whitespace characters, other ASCII characters and non-ASCII).

David Peter 7.3k Dec 29, 2022
A user-friendly re-implementation of existing hex tools in Rust

Hex A project to create alternate (and more user friendly) versions of existing hex tools. The project can be installed as a extension to the github-c

Sohom Datta 6 Sep 27, 2022
simple but convenient CLI-based Nostr client app for following users and sending DMs

nostr-commander-rs TLDR: simple but convenient CLI-based Nostr client app for publishing, sending DMs, as well as following users and channels nostr-c

null 18 Dec 30, 2022
Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded.

Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded. It also offers image optimization and storage options. It has configurable privacy and storage settings, as well as custom cache expiration.

Thomas 4 Dec 29, 2022
Nostr protocol implementation, SDK and FFI

Searchnos: an experimental implementation of NIP-50 This is a relay-like bridge server that provides a Nostr full-text search capability by using Elas

SAGE 8 Jul 2, 2023
A fast nostr opengraph server, built on nostrdb and egui.

notecrumbs A nostr opengraph server build on nostrdb, egui, and skia. It renders notes using the CPU in around 50ms. Status WIP! Local note fetching w

Damus 7 Dec 21, 2023