Implement NIP-19 bech32-encoded private and public keys
https://github.com/nostr-protocol/nips/blob/master/19.md
This commit is contained in:
@@ -98,11 +98,17 @@ client = Nostr::Client.new
|
||||
|
||||
# a) Use an existing keypair
|
||||
keypair = Nostr::KeyPair.new(
|
||||
private_key: 'your-private-key',
|
||||
public_key: 'your-public-key',
|
||||
private_key: Nostr::PrivateKey.new('your-hex-private-key'),
|
||||
public_key: Nostr::PublicKey.new('your-hex-public-key'),
|
||||
)
|
||||
|
||||
# b) Or create a new keypair
|
||||
# b) Or build a keypair from a private key
|
||||
keygen = Nostr::Keygen.new
|
||||
keypair = keygen.get_key_pair_from_private_key(
|
||||
Nostr::PrivateKey.new('your-hex-private-key')
|
||||
)
|
||||
|
||||
# c) Or create a new keypair
|
||||
keygen = Nostr::Keygen.new
|
||||
keypair = keygen.generate_keypair
|
||||
|
||||
|
||||
Reference in New Issue
Block a user