stellar-base 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +4 -4
- data/lib/stellar-base.rb +1 -0
- data/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/signer_key.rb +40 -0
- data/lib/stellar/transaction.rb +1 -1
- data/lib/stellar/transaction_envelope.rb +7 -0
- data/ruby-stellar-base.gemspec +3 -3
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2062b56ea0a8fd01a7917fe0e602098d9233896c0189bc3551ce594397f394a4
|
4
|
+
data.tar.gz: 9dfca2d0f18a86ec0d36c3b7e97fd9c75e61339c39d0f4a7c834129ad48bdf46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf5bca3ecc1b9bfc27198bf8d0712a4c0f4780ef851f8894c67a5bdaea13ae82b34696618ba298f31ddec9f726f298d6e6242b8474a29d1a225cbd206bb1bc0
|
7
|
+
data.tar.gz: 92f331fdad439135cac96063346ce2e1426efe1766a73e8c2151e87ecd7f7a351b76028569566a84431887ee67e45b8437f8824defb50fd051cbc99f02d75e52
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -58,15 +58,15 @@ This library also provides an impementation of Stellar's "StrKey" encoding (RFC-
|
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
|
61
|
-
Stellar::Util::
|
62
|
-
Stellar::Util::
|
61
|
+
Stellar::Util::StrKey.check_encode(:account_id, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF") # => "GD777777777764TU"
|
62
|
+
Stellar::Util::StrKey.check_encode(:seed, "\x00\x00\x00\x00\x00\x00\x39") # => "SAAAAAAAAAADST3H"
|
63
63
|
|
64
64
|
# To prevent interpretation mistakes, you must pass the expected version byte
|
65
65
|
# when decoding a check_encoded value
|
66
66
|
|
67
67
|
encoded = Stellar::Util::StrCheck.check_encode(:account_id, "\x61\x6b\x04\xab\x8b\xf6\x1b")
|
68
|
-
Stellar::Util::
|
69
|
-
Stellar::Util::
|
68
|
+
Stellar::Util::StrKey.check_decode(:account_id, encoded) # => "\x61\x6b\x04\xab\x8b\xf6\x1b"
|
69
|
+
Stellar::Util::StrKey.check_decode(:seed, encoded) # => throws ArgumentError: Unexpected version: :account_id
|
70
70
|
|
71
71
|
```
|
72
72
|
|
data/lib/stellar-base.rb
CHANGED
@@ -22,6 +22,7 @@ require_relative './stellar/key_pair'
|
|
22
22
|
require_relative './stellar/operation'
|
23
23
|
require_relative './stellar/path_payment_result'
|
24
24
|
require_relative './stellar/price'
|
25
|
+
require_relative './stellar/signer_key'
|
25
26
|
require_relative './stellar/thresholds'
|
26
27
|
require_relative './stellar/transaction'
|
27
28
|
require_relative './stellar/transaction_envelope'
|
data/lib/stellar/base/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Stellar
|
2
|
+
class SignerKey
|
3
|
+
|
4
|
+
def self.ed25519(keypair)
|
5
|
+
raise ArgumentError, "Bad keypair" unless keypair.is_a?(KeyPair)
|
6
|
+
new(:signer_key_type_ed25519, keypair.raw_public_key)
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
def self.preauthorized_transaction(tx)
|
11
|
+
new(:signer_key_type_pre_auth_tx, tx.hash)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def self.onetime_signer(preimage)
|
16
|
+
hash_x = Digest::SHA256.digest(preimage)
|
17
|
+
new(:signer_key_type_hash_x, hash_x)
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
case switch
|
22
|
+
when SignerKeyType.signer_key_type_ed25519
|
23
|
+
address = Stellar::Convert.pk_to_address(self)
|
24
|
+
"ed25519: #{address}"
|
25
|
+
when SignerKeyType.signer_key_type_pre_auth_tx
|
26
|
+
tx = Stellar::Convert.to_hex(pre_auth_tx!)
|
27
|
+
"pre_auth_tx: #{tx}"
|
28
|
+
when SignerKeyType.signer_key_type_hash_x
|
29
|
+
hx = Stellar::Convert.to_hex(hash_x!)
|
30
|
+
"hash_x: #{hx}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def inspect
|
35
|
+
label = switch.to_s
|
36
|
+
"#<Stellar::SignerKey #{to_s}>"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/lib/stellar/transaction.rb
CHANGED
data/ruby-stellar-base.gemspec
CHANGED
@@ -15,12 +15,12 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ["generated", "lib"]
|
17
17
|
|
18
|
-
spec.add_dependency "xdr", "~>
|
18
|
+
spec.add_dependency "xdr", "~> 3.0.0"
|
19
19
|
spec.add_dependency "digest-crc"
|
20
20
|
spec.add_dependency "base32"
|
21
21
|
spec.add_dependency "rbnacl"
|
22
|
-
spec.add_dependency "rbnacl-libsodium", "~> 1.0.
|
23
|
-
spec.add_dependency "activesupport", ">=
|
22
|
+
spec.add_dependency "rbnacl-libsodium", "~> 1.0.16"
|
23
|
+
spec.add_dependency "activesupport", ">= 5.2.0"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.7"
|
26
26
|
spec.add_development_dependency "rake", "~> 12.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdr
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: digest-crc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0.
|
75
|
+
version: 1.0.16
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0.
|
82
|
+
version: 1.0.16
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activesupport
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 5.2.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 5.2.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -399,6 +399,7 @@ files:
|
|
399
399
|
- lib/stellar/operation.rb
|
400
400
|
- lib/stellar/path_payment_result.rb
|
401
401
|
- lib/stellar/price.rb
|
402
|
+
- lib/stellar/signer_key.rb
|
402
403
|
- lib/stellar/thresholds.rb
|
403
404
|
- lib/stellar/transaction.rb
|
404
405
|
- lib/stellar/transaction_envelope.rb
|