Fix pubkey generation adding leading 0s when < 64 bytes

This commit is contained in:
Wilson Silva
2023-02-25 12:14:49 +07:00
parent 4828272bd5
commit 0e8b38bf6e

View File

@@ -62,7 +62,7 @@ module Nostr
# @return [String] A 32-bytes hex-encoded public key.
#
def extract_public_key(private_key)
group.generator.multiply_by_scalar(private_key.to_i(16)).x.to_s(16)
group.generator.multiply_by_scalar(private_key.to_i(16)).x.to_s(16).rjust(64, '0')
end
private