schnorrkel_rb 0.1.0 → 0.1.1
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/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +6 -6
- data/lib/schnorrkel_rb/version.rb +1 -1
- data/lib/schnorrkel_rb.rb +8 -8
- data/schnorrkel_rb.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4060d9b92831275160cdc567835e0eaa6b54b9a8c7c4240b53ea0551b97295e0
|
4
|
+
data.tar.gz: a872603a75729ba0da58c9b8c7da830313ea1a448f5617c74b61fa8e0125b33c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e049214a3b9832713218dabb866f14359daf6e9e834ecbfaf590f45adbf1f4acc75666f8b14404ee09403841031e26de35ae83e5ea21c9f210a20ac2b8b2d24a
|
7
|
+
data.tar.gz: 7e6450f279acf4a99d38bff37ccee70fff8defe33d60096aebeff18de67eef84737fd7268386b2e619deaf5866378f845e57cb164bdbdd5183dd032f2a073929
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require "
|
4
|
+
require "thermite/tasks"
|
5
5
|
|
6
|
-
|
6
|
+
Thermite::Tasks.new
|
7
7
|
|
8
|
-
|
8
|
+
task default: %w[thermite:build]
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
desc "Run Rust & Ruby testsuites"
|
11
|
+
task test: ["thermite:build", "thermite:test"] do
|
12
|
+
end
|
data/lib/schnorrkel_rb.rb
CHANGED
@@ -9,7 +9,7 @@ class Str < FFI::AutoPointer
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s
|
12
|
-
@str ||=
|
12
|
+
@str ||= read_string.force_encoding("UTF-8")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -23,15 +23,15 @@ module SchnorrkelRb
|
|
23
23
|
attach_function :free, :free_s, [Str], :void
|
24
24
|
|
25
25
|
def self.sr25519_sign(seed, message)
|
26
|
-
message = message[2..] if message.start_with?(
|
27
|
-
seed = seed[2..] if seed.start_with?(
|
28
|
-
|
26
|
+
message = message[2..] if message.start_with?("0x")
|
27
|
+
seed = seed[2..] if seed.start_with?("0x")
|
28
|
+
sign_by_seed(message, seed).to_s
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.sr25519_verify(signature, message, pubkey)
|
32
|
-
pubkey = pubkey[2..] if pubkey.start_with?(
|
33
|
-
message = message[2..] if message.start_with?(
|
34
|
-
signature = signature[2..] if signature.start_with?(
|
35
|
-
|
32
|
+
pubkey = pubkey[2..] if pubkey.start_with?("0x")
|
33
|
+
message = message[2..] if message.start_with?("0x")
|
34
|
+
signature = signature[2..] if signature.start_with?("0x")
|
35
|
+
verify(signature, message, pubkey)
|
36
36
|
end
|
37
37
|
end
|
data/schnorrkel_rb.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.extensions <<
|
34
|
-
spec.add_runtime_dependency
|
33
|
+
spec.extensions << "ext/Rakefile"
|
34
|
+
spec.add_runtime_dependency "thermite", "~> 0"
|
35
35
|
spec.add_dependency "ffi", "~> 1.0"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schnorrkel_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aki Wu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thermite
|