Implement NIP-19 bech32-encoded private and public keys

https://github.com/nostr-protocol/nips/blob/master/19.md
This commit is contained in:
Wilson Silva
2023-11-20 09:59:27 +07:00
parent 3fffcd1a4e
commit 3520cf8219
58 changed files with 1189 additions and 104 deletions

View File

@@ -159,11 +159,11 @@ module Nostr
# pubkey = '48df4af6e240ac5f7c5de89bf5941b249880be0e87d03685b178ccb1a315f52e'
# event.add_pubkey_reference(pubkey)
#
# @param pubkey [String] 32-bytes hex-encoded public key.
# @param pubkey [PublicKey] 32-bytes hex-encoded public key.
#
# @return [Array<String>] The event's updated list of tags
#
def add_pubkey_reference(pubkey) = tags.push(['p', pubkey])
def add_pubkey_reference(pubkey) = tags.push(['p', pubkey.to_s])
# Signs an event with the user's private key
#
@@ -172,7 +172,7 @@ module Nostr
# @example Signing an event
# event.sign(private_key)
#
# @param private_key [String] 32-bytes hex-encoded private key.
# @param private_key [PrivateKey] 32-bytes hex-encoded private key.
#
# @return [Event] A signed event.
#