rbsecp256k1 6.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +24 -0
- data/README.md +5 -0
- data/Rakefile +6 -1
- data/documentation/context.md +31 -4
- data/documentation/index.md +14 -1
- data/documentation/key_pair.md +0 -0
- data/documentation/private_key.md +0 -0
- data/documentation/public_key.md +0 -0
- data/documentation/recoverable_signature.md +0 -0
- data/documentation/schnorr_signature.md +5 -1
- data/documentation/secp256k1.md +0 -0
- data/documentation/shared_secret.md +0 -0
- data/documentation/signature.md +0 -0
- data/documentation/util.md +0 -0
- data/documentation/xonly_public_key.md +0 -0
- data/ext/rbsecp256k1/extconf.rb +7 -66
- data/ext/rbsecp256k1/rbsecp256k1.c +424 -239
- data/ext/rbsecp256k1/secp256k1_recipe.rb +76 -0
- data/lib/rbsecp256k1/context.rb +5 -1
- data/lib/rbsecp256k1/util.rb +0 -0
- data/lib/rbsecp256k1/version.rb +1 -1
- data/lib/rbsecp256k1.rb +0 -0
- metadata +72 -13
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mini_portile2'
|
|
4
|
+
require 'zip'
|
|
5
|
+
|
|
6
|
+
# Enable the recovery module by default
|
|
7
|
+
WITH_RECOVERY = ENV.fetch('WITH_RECOVERY', '1') == '1'
|
|
8
|
+
|
|
9
|
+
# Recipe for downloading and building libsecp256k1 as part of installation
|
|
10
|
+
class Secp256k1Recipe < MiniPortile
|
|
11
|
+
# Hard-coded URL for libsecp256k1 zipfile (Official release v0.8.0)
|
|
12
|
+
LIBSECP256K1_ZIP_URL = 'https://github.com/bitcoin-core/secp256k1/archive/refs/tags/v0.8.0.zip'
|
|
13
|
+
|
|
14
|
+
# Expected SHA-256 of the zipfile above (computed using sha256sum)
|
|
15
|
+
LIBSECP256K1_SHA256 = 'ecece6a1cec8bdecdccbf22e1ee65455feae1a5312913bd62c45bbdc912b442c'
|
|
16
|
+
|
|
17
|
+
def initialize
|
|
18
|
+
super('libsecp256k1', '0.8.0')
|
|
19
|
+
@tarball = File.join(Dir.pwd, "/ports/archives/libsecp256k1.zip")
|
|
20
|
+
@files = ["file://#{@tarball}"]
|
|
21
|
+
self.configure_options += [
|
|
22
|
+
"--with-pic=yes"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# MiniPortile builds a static library. Its benchmark consumers also need
|
|
26
|
+
# this definition on Windows to avoid references to DLL import symbols.
|
|
27
|
+
if RUBY_PLATFORM =~ /mingw|mswin/
|
|
28
|
+
configure_options << "CPPFLAGS=#{ENV.fetch('CPPFLAGS', '')} -DSECP256K1_STATIC"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# ECDH, extrakeys and schnorrsig are enabled by default in release v0.8.0,
|
|
32
|
+
# but recovery still needs to be enabled manually.
|
|
33
|
+
configure_options << "--enable-module-recovery" if WITH_RECOVERY
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def configure
|
|
37
|
+
# Need to run autogen.sh before configure since it creates it
|
|
38
|
+
if RUBY_PLATFORM =~ /mingw|mswin/
|
|
39
|
+
# Windows doesn't recognize the shebang.
|
|
40
|
+
execute('autogen', %w[sh ./autogen.sh])
|
|
41
|
+
else
|
|
42
|
+
execute('chmod', %w[chmod +x ./autogen.sh])
|
|
43
|
+
execute('autogen', %w[./autogen.sh])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
super
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def download
|
|
50
|
+
download_file_http(LIBSECP256K1_ZIP_URL, @tarball)
|
|
51
|
+
verify_file(local_path: @tarball, sha256: LIBSECP256K1_SHA256)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def downloaded?
|
|
55
|
+
File.exist?(@tarball)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def extract_zip_file(file, destination)
|
|
59
|
+
FileUtils.mkdir_p(destination)
|
|
60
|
+
|
|
61
|
+
Zip::File.open(file) do |zip_file|
|
|
62
|
+
zip_file.each do |f|
|
|
63
|
+
fpath = File.join(destination, f.name)
|
|
64
|
+
zip_file.extract(f, fpath) unless File.exist?(fpath)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def extract
|
|
70
|
+
files_hashs.each do |file|
|
|
71
|
+
# Cached and interrupted downloads also reach extraction without download.
|
|
72
|
+
verify_file(local_path: file[:local_path], sha256: LIBSECP256K1_SHA256)
|
|
73
|
+
extract_zip_file(file[:local_path], tmp_path)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/lib/rbsecp256k1/context.rb
CHANGED
|
@@ -26,7 +26,11 @@ module Secp256k1
|
|
|
26
26
|
key_pair_from_private_key(SecureRandom.random_bytes(32))
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# Sign message bytes directly with fresh 32-byte auxiliary randomness.
|
|
30
|
+
# No implicit hashing, padding, or truncation is performed.
|
|
31
|
+
#
|
|
32
|
+
# @param keypair [Secp256k1::KeyPair] key pair used for signing
|
|
33
|
+
# @param message [String] message of any byte length, including zero
|
|
30
34
|
#
|
|
31
35
|
# @return [Secp256k1::SchnorrSignature] schnorr signature
|
|
32
36
|
def sign_schnorr(keypair, message)
|
data/lib/rbsecp256k1/util.rb
CHANGED
|
File without changes
|
data/lib/rbsecp256k1/version.rb
CHANGED
data/lib/rbsecp256k1.rb
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbsecp256k1
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Scrivner
|
|
8
|
-
|
|
8
|
+
- Afri Blanck
|
|
9
|
+
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2026-10-09 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: mini_portile2
|
|
@@ -44,14 +45,56 @@ dependencies:
|
|
|
44
45
|
requirements:
|
|
45
46
|
- - "~>"
|
|
46
47
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
48
|
+
version: '3.4'
|
|
48
49
|
type: :runtime
|
|
49
50
|
prerelease: false
|
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
52
|
requirements:
|
|
52
53
|
- - "~>"
|
|
53
54
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
55
|
+
version: '3.4'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: base64
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - "~>"
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0.3'
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - "~>"
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0.3'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: benchmark
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - "~>"
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0.5'
|
|
77
|
+
type: :development
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - "~>"
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0.5'
|
|
84
|
+
- !ruby/object:Gem::Dependency
|
|
85
|
+
name: csv
|
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - "~>"
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '3.0'
|
|
91
|
+
type: :development
|
|
92
|
+
prerelease: false
|
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - "~>"
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '3.0'
|
|
55
98
|
- !ruby/object:Gem::Dependency
|
|
56
99
|
name: keccak
|
|
57
100
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,6 +109,20 @@ dependencies:
|
|
|
66
109
|
- - "~>"
|
|
67
110
|
- !ruby/object:Gem::Version
|
|
68
111
|
version: '1.3'
|
|
112
|
+
- !ruby/object:Gem::Dependency
|
|
113
|
+
name: ostruct
|
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - "~>"
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: '0.6'
|
|
119
|
+
type: :development
|
|
120
|
+
prerelease: false
|
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - "~>"
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: '0.6'
|
|
69
126
|
- !ruby/object:Gem::Dependency
|
|
70
127
|
name: rake
|
|
71
128
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,14 +185,14 @@ dependencies:
|
|
|
128
185
|
requirements:
|
|
129
186
|
- - "~>"
|
|
130
187
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '
|
|
188
|
+
version: '3.0'
|
|
132
189
|
type: :development
|
|
133
190
|
prerelease: false
|
|
134
191
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
192
|
requirements:
|
|
136
193
|
- - "~>"
|
|
137
194
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
195
|
+
version: '3.0'
|
|
139
196
|
- !ruby/object:Gem::Dependency
|
|
140
197
|
name: yard
|
|
141
198
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,13 +207,14 @@ dependencies:
|
|
|
150
207
|
- - "~>"
|
|
151
208
|
- !ruby/object:Gem::Version
|
|
152
209
|
version: '0.9'
|
|
153
|
-
description:
|
|
154
|
-
email:
|
|
210
|
+
description:
|
|
211
|
+
email:
|
|
155
212
|
executables: []
|
|
156
213
|
extensions:
|
|
157
214
|
- ext/rbsecp256k1/extconf.rb
|
|
158
215
|
extra_rdoc_files: []
|
|
159
216
|
files:
|
|
217
|
+
- LICENSE
|
|
160
218
|
- README.md
|
|
161
219
|
- Rakefile
|
|
162
220
|
- documentation/context.md
|
|
@@ -173,15 +231,16 @@ files:
|
|
|
173
231
|
- documentation/xonly_public_key.md
|
|
174
232
|
- ext/rbsecp256k1/extconf.rb
|
|
175
233
|
- ext/rbsecp256k1/rbsecp256k1.c
|
|
234
|
+
- ext/rbsecp256k1/secp256k1_recipe.rb
|
|
176
235
|
- lib/rbsecp256k1.rb
|
|
177
236
|
- lib/rbsecp256k1/context.rb
|
|
178
237
|
- lib/rbsecp256k1/util.rb
|
|
179
238
|
- lib/rbsecp256k1/version.rb
|
|
180
239
|
homepage: https://github.com/etscrivner/rbsecp256k1
|
|
181
240
|
licenses:
|
|
182
|
-
-
|
|
241
|
+
- Unlicense
|
|
183
242
|
metadata: {}
|
|
184
|
-
post_install_message:
|
|
243
|
+
post_install_message:
|
|
185
244
|
rdoc_options: []
|
|
186
245
|
require_paths:
|
|
187
246
|
- ext
|
|
@@ -197,8 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
197
256
|
- !ruby/object:Gem::Version
|
|
198
257
|
version: '0'
|
|
199
258
|
requirements: []
|
|
200
|
-
rubygems_version: 3.4.
|
|
201
|
-
signing_key:
|
|
259
|
+
rubygems_version: 3.4.20
|
|
260
|
+
signing_key:
|
|
202
261
|
specification_version: 4
|
|
203
262
|
summary: Native extension gem for secp256k1 ECDSA and Schnorr signatures. Wraps libsecp256k1
|
|
204
263
|
natively without any need for FFI.
|