Fix the generation of private keys

00c2660584
This commit is contained in:
Wilson Silva
2023-11-20 12:39:58 +07:00
parent b45370e65f
commit bba18d1bc0
2 changed files with 2 additions and 1 deletions

View File

@@ -47,7 +47,7 @@ module Nostr
# @return [PrivateKey] A 32-bytes hex-encoded private key.
#
def generate_private_key
hex_value = (SecureRandom.random_number(group.order - 1) + 1).to_s(16)
hex_value = (SecureRandom.random_number(group.order - 1) + 1).to_s(16).rjust(64, '0')
PrivateKey.new(hex_value)
end