Skip to content

Commit

Permalink
Separate secp256k1 library calls into external gem
Browse files Browse the repository at this point in the history
  • Loading branch information
azuchi committed Nov 13, 2024
1 parent 8578bb6 commit 8eeb14f
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 366 deletions.
1 change: 1 addition & 0 deletions bitcoinrb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'base32', '>= 0.3.4'
spec.add_runtime_dependency 'base64', '~> 0.2.0'
spec.add_runtime_dependency 'observer', '~> 0.1.2'
spec.add_runtime_dependency 'secp256k1rb', '0.1.0'
end
2 changes: 1 addition & 1 deletion lib/bitcoin/bip324.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def v2_ecdh(priv_key, ellswift_theirs, ellswift_ours, initiating)
raise ArgumentError, "ellswift_ours must be a Bitcoin::BIP324::EllSwiftPubkey" unless ellswift_ours.is_a?(Bitcoin::BIP324::EllSwiftPubkey)

if Bitcoin.secp_impl.is_a?(Bitcoin::Secp256k1::Native)
Bitcoin::Secp256k1::Native.ellswift_ecdh_xonly(ellswift_theirs, ellswift_ours, priv_key, initiating)
Bitcoin::Secp256k1::Native.ellswift_ecdh_xonly(ellswift_theirs.key, ellswift_ours.key, priv_key, initiating)
else
ecdh_point_x32 = ellswift_ecdh_xonly(ellswift_theirs, priv_key).htb
content = initiating ? ellswift_ours.key + ellswift_theirs.key + ecdh_point_x32 :
Expand Down
Loading

0 comments on commit 8eeb14f

Please sign in to comment.