aries-sdk-ruby 0.0.1 → 0.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/README.md +4 -4
- data/aries-sdk-ruby.gemspec +1 -1
- data/spec/aries-sdk-ruby_spec.rb +16 -10
- data/src/lib.rs +37 -0
- 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: 65f082151b5a43c2b463923111842d29953d2ce3a40167ca6d4ec01e8db79b08
|
4
|
+
data.tar.gz: a6d8afea49c93d83441527cd75c0de7121822d0182535716823acfe2615c1dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 489bc9b91111c123484e5bfb76f13fbed7d32d1daf4a3766d99c031b7ae1484b67ecd08a8a116d289504ce3f09f7bed08183ad22c9d36a6554aadbdb83337bbd
|
7
|
+
data.tar.gz: 98e13cd3397b179e54c6019101f9c683fea0c6b840d668259fce20772ac2b2924eb10d6aa808b9bfa5140b5de0b60220ee51e5eafdcf9c3761865f7a8054d926
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://opensource.org/licenses/Apache-2.0)
|
4
4
|
|
5
|
-
A ruby gem for [aries-sdk](https://github.com/hyperledger/aries-sdk).
|
5
|
+
A [ruby gem](https://rubygems.org/gems/aries-sdk-ruby) for [aries-sdk](https://github.com/hyperledger/aries-sdk).
|
6
6
|
|
7
7
|
## Migration notice
|
8
8
|
|
@@ -41,9 +41,9 @@ WARNING: You may have to wait a bit for the native extension to build the aries-
|
|
41
41
|
To try out the gem, execute:
|
42
42
|
|
43
43
|
$ bundle exec rails c
|
44
|
-
> wallet =
|
44
|
+
> wallet = AriesWallet.new("mywallet")
|
45
45
|
> wallet.create
|
46
|
-
> pool =
|
46
|
+
> pool = AriesPool.new("mypool")
|
47
47
|
> pool.create
|
48
48
|
>
|
49
49
|
|
@@ -68,4 +68,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/hyperl
|
|
68
68
|
|
69
69
|
## License
|
70
70
|
|
71
|
-
The gem is available as open source under the terms of the [
|
71
|
+
The gem is available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
|
data/aries-sdk-ruby.gemspec
CHANGED
data/spec/aries-sdk-ruby_spec.rb
CHANGED
@@ -4,28 +4,26 @@ describe "aries-sdk-ruby" do
|
|
4
4
|
it "can create a wallet" do
|
5
5
|
wallet = AriesWallet.new("WALLET1")
|
6
6
|
wallet.create
|
7
|
+
wallet.delete
|
7
8
|
end
|
8
9
|
it "cannot create a duplicate wallet" do
|
9
10
|
wallet1 = AriesWallet.new("WALLET2")
|
10
11
|
wallet1.create
|
11
12
|
wallet2 = AriesWallet.new("WALLET2")
|
12
13
|
expect{wallet2.create}.to raise_error(/Wallet with this name already exists/)
|
14
|
+
wallet1.delete
|
13
15
|
end
|
14
16
|
it "can delete a wallet" do
|
15
17
|
wallet = AriesWallet.new("WALLET3")
|
16
18
|
wallet.create
|
17
19
|
wallet.delete
|
18
20
|
end
|
19
|
-
it "can open a wallet" do
|
20
|
-
wallet = AriesWallet.new("WALLET4")
|
21
|
-
wallet.create
|
22
|
-
wallet.open
|
23
|
-
end
|
24
21
|
it "can open and close a wallet" do
|
25
22
|
wallet = AriesWallet.new("WALLET5")
|
26
23
|
wallet.create
|
27
24
|
wallet.open
|
28
25
|
wallet.close
|
26
|
+
wallet.delete
|
29
27
|
end
|
30
28
|
it "cannot delete a wallet twice" do
|
31
29
|
wallet = AriesWallet.new("WALLET6")
|
@@ -37,28 +35,26 @@ describe "aries-sdk-ruby" do
|
|
37
35
|
it "can create a pool" do
|
38
36
|
pool = AriesPool.new("POOL1")
|
39
37
|
pool.create
|
38
|
+
pool.delete
|
40
39
|
end
|
41
40
|
it "cannot create a duplicate pool" do
|
42
41
|
pool1 = AriesPool.new("POOL2")
|
43
42
|
pool1.create
|
44
43
|
pool2 = AriesPool.new("POOL2")
|
45
44
|
expect{pool2.create}.to raise_error(/Pool ledger config file with name/)
|
45
|
+
pool1.delete
|
46
46
|
end
|
47
47
|
it "can delete a pool" do
|
48
48
|
pool = AriesPool.new("POOL3")
|
49
49
|
pool.create
|
50
50
|
pool.delete
|
51
51
|
end
|
52
|
-
it "can open a pool" do
|
53
|
-
pool = AriesPool.new("POOL4")
|
54
|
-
pool.create
|
55
|
-
pool.open
|
56
|
-
end
|
57
52
|
it "can open and close a pool" do
|
58
53
|
pool = AriesPool.new("POOL5")
|
59
54
|
pool.create
|
60
55
|
pool.open
|
61
56
|
pool.close
|
57
|
+
pool.delete
|
62
58
|
end
|
63
59
|
it "cannot delete a pool twice" do
|
64
60
|
pool = AriesPool.new("POOL6")
|
@@ -66,4 +62,14 @@ describe "aries-sdk-ruby" do
|
|
66
62
|
pool.delete
|
67
63
|
expect{pool.delete}.to raise_error(/No such file or directory/)
|
68
64
|
end
|
65
|
+
|
66
|
+
it "can create a DID" do
|
67
|
+
wallet = AriesWallet.new("WALLET0")
|
68
|
+
wallet.create
|
69
|
+
wallet.open
|
70
|
+
did = AriesDID.new("000000000000000000000000Steward1")
|
71
|
+
did.create(wallet)
|
72
|
+
wallet.close
|
73
|
+
wallet.delete
|
74
|
+
end
|
69
75
|
end
|
data/src/lib.rs
CHANGED
@@ -5,6 +5,7 @@ extern crate indyrs as indy;
|
|
5
5
|
|
6
6
|
use indy::pool;
|
7
7
|
use indy::wallet;
|
8
|
+
use indy::did;
|
8
9
|
use std::string::String;
|
9
10
|
|
10
11
|
use indy::future::Future;
|
@@ -79,6 +80,42 @@ ruby! {
|
|
79
80
|
pool::delete_pool_ledger(&self.name).wait().unwrap();
|
80
81
|
}
|
81
82
|
}
|
83
|
+
|
84
|
+
class AriesDID {
|
85
|
+
struct {
|
86
|
+
seed: String,
|
87
|
+
did: String,
|
88
|
+
verkey: String
|
89
|
+
}
|
90
|
+
|
91
|
+
def initialize(helix, seed: String) {
|
92
|
+
let did: String = "".to_string();
|
93
|
+
let verkey: String = "".to_string();
|
94
|
+
AriesDID { helix, seed, did, verkey }
|
95
|
+
}
|
96
|
+
|
97
|
+
def create(&mut self, wallet: &AriesWallet) {
|
98
|
+
let (did,verkey) = create_did(wallet.handle, &self.seed);
|
99
|
+
self.did = did;
|
100
|
+
self.verkey = verkey;
|
101
|
+
}
|
102
|
+
|
103
|
+
def get_did(&self) -> String {
|
104
|
+
return self.did.to_string();
|
105
|
+
}
|
106
|
+
|
107
|
+
def get_verkey(&self) -> String {
|
108
|
+
return self.verkey.to_string();
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
fn create_did(wallet_handle: i32, seed: &str) -> (String,String) {
|
114
|
+
let first_json_seed = json!({
|
115
|
+
"seed":seed
|
116
|
+
}).to_string();
|
117
|
+
let (did,verkey) = did::create_and_store_my_did(wallet_handle, &first_json_seed).wait().unwrap();
|
118
|
+
return (did,verkey);
|
82
119
|
}
|
83
120
|
|
84
121
|
fn create_genesis_txn_file_for_pool(pool_name: &str) -> String {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aries-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Callahan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: helix_runtime
|