vault-tree 0.3.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/CHANGE_LOG.md +27 -0
- data/README.md +15 -73
- data/features/contracts/asymmetric_vault.feature +69 -2
- data/features/contracts/block_chain_key_transfer.feature +59 -0
- data/features/contracts/one_two_three.feature +109 -1
- data/features/contracts/readme.md +5 -6
- data/features/contracts_and_vaults.md +19 -24
- data/features/decision_tree.md +1 -1
- data/features/exceptions.feature +54 -43
- data/features/install_and_usage.md +38 -33
- data/features/keywords/assembled_shamir_key.feature +17 -17
- data/features/keywords/dh_key.feature +5 -5
- data/features/keywords/external_input.feature +35 -0
- data/features/keywords/external_key.feature +24 -0
- data/features/keywords/key.feature +3 -3
- data/features/keywords/random_number.feature +3 -3
- data/features/keywords/shamir_key_shares.feature +29 -0
- data/features/keywords/shamir_share.feature +40 -0
- data/features/keywords/split_key.feature +10 -9
- data/features/keywords/unlocked.feature +3 -3
- data/features/readme.md +1 -1
- data/features/steps/asymmetric_vault.steps.rb +14 -21
- data/features/steps/block_chain_key_transfer.steps.rb +17 -22
- data/features/steps/core.steps.rb +60 -71
- data/features/steps/exceptions.steps.rb +27 -64
- data/features/steps/external_input.steps.rb +17 -0
- data/features/steps/one_two_three.steps.rb +21 -27
- data/features/steps/secret_sharing.steps.rb +36 -19
- data/lib/vault-tree.rb +1 -1
- data/lib/vault-tree/contract/content_ciphertext.rb +33 -0
- data/lib/vault-tree/contract/content_plaintext.rb +33 -0
- data/lib/vault-tree/contract/contract.rb +15 -72
- data/lib/vault-tree/contract/contract_header.rb +11 -0
- data/lib/vault-tree/contract/vault.rb +24 -74
- data/lib/vault-tree/contract/vault_key.rb +21 -0
- data/lib/vault-tree/contract/vault_list.rb +56 -0
- data/lib/vault-tree/exceptions/empty_vault.rb +18 -3
- data/lib/vault-tree/exceptions/failed_lock_attempt.rb +18 -0
- data/lib/vault-tree/exceptions/failed_unlock_attempt.rb +23 -1
- data/lib/vault-tree/exceptions/invalid_external_input.rb +16 -0
- data/lib/vault-tree/exceptions/{missing_passphrase.rb → invalid_shamir_split.rb} +2 -1
- data/lib/vault-tree/exceptions/library_exception.rb +64 -0
- data/lib/vault-tree/exceptions/missing_partner_decryption_key.rb +11 -1
- data/lib/vault-tree/exceptions/unsupported_keyword.rb +17 -1
- data/lib/vault-tree/exceptions/vault_does_not_exist.rb +8 -1
- data/lib/vault-tree/keywords/assembled_shamir_key.rb +1 -1
- data/lib/vault-tree/keywords/contents.rb +1 -1
- data/lib/vault-tree/keywords/dh_key.rb +2 -2
- data/lib/vault-tree/keywords/external_input.rb +58 -0
- data/lib/vault-tree/keywords/external_key.rb +20 -0
- data/lib/vault-tree/keywords/key.rb +7 -1
- data/lib/vault-tree/keywords/keyword_interpreter.rb +5 -3
- data/lib/vault-tree/keywords/public_encryption_key.rb +1 -5
- data/lib/vault-tree/keywords/shamir_key_shares.rb +18 -0
- data/lib/vault-tree/keywords/shamir_share.rb +18 -0
- data/lib/vault-tree/keywords/split_key.rb +1 -1
- data/lib/vault-tree/lock_smith.rb +7 -8
- data/lib/vault-tree/lock_smith/{generated_shamir_key.rb → shamir_key_shares.rb} +22 -21
- data/lib/vault-tree/lock_smith/{split_key.rb → split_key_crypto.rb} +0 -0
- data/lib/vault-tree/version.rb +1 -1
- data/spec/assembled_shamir_key_spec.rb +0 -1
- data/spec/custom_exception_spec.rb +81 -0
- data/spec/lock_smith_spec.rb +0 -48
- data/spec/secret_sharing_spec.rb +0 -1
- data/spec/shamir_key_shares_spec.rb +27 -0
- data/vault-tree.gemspec +1 -1
- metadata +33 -139
- data/Gemfile.lock +0 -53
- data/VagrantFile +0 -30
- data/features/keywords/external_data.feature +0 -11
- data/features/keywords/generated_shamir_key.feature +0 -55
- data/features/keywords/master_passphrase.feature +0 -68
- data/features/manipulating_contracts.md +0 -84
- data/features/support/contract_fixtures/asymmetric_vault.0.1.0.json +0 -69
- data/features/support/contract_fixtures/blank_simple_test_contract.json +0 -14
- data/features/support/contract_fixtures/block_chain_key_transfer.0.1.0.json +0 -59
- data/features/support/contract_fixtures/broken_contract.json +0 -55
- data/features/support/contract_fixtures/one_two_three.0.7.0.json +0 -108
- data/features/support/contract_fixtures/simple_test_contract.json +0 -14
- data/features/support/contract_fixtures/template.json +0 -33
- data/lib/vault-tree/contract/close_validator.rb +0 -28
- data/lib/vault-tree/contract/doorman.rb +0 -113
- data/lib/vault-tree/contract/open_validator.rb +0 -20
- data/lib/vault-tree/exceptions/exception_template.erb +0 -0
- data/lib/vault-tree/exceptions/fill_attempt_master_password.rb +0 -6
- data/lib/vault-tree/exceptions/missing_external_data.rb +0 -6
- data/lib/vault-tree/exceptions/vault_tree_exception.rb +0 -25
- data/lib/vault-tree/keywords/external_data.rb +0 -32
- data/lib/vault-tree/keywords/generated_shamir_key.rb +0 -57
- data/lib/vault-tree/keywords/master_passphrase.rb +0 -9
- data/spec/generated_shamir_key_spec.rb +0 -52
- data/support/cookbooks/ark/.gitignore +0 -12
- data/support/cookbooks/ark/.kitchen.yml +0 -34
- data/support/cookbooks/ark/.travis.yml +0 -6
- data/support/cookbooks/ark/Berksfile +0 -9
- data/support/cookbooks/ark/CHANGELOG.md +0 -87
- data/support/cookbooks/ark/CONTRIBUTING.md +0 -257
- data/support/cookbooks/ark/README.md +0 -301
- data/support/cookbooks/ark/Rakefile +0 -36
- data/support/cookbooks/ark/TESTING.md +0 -25
- data/support/cookbooks/ark/Toftfile +0 -15
- data/support/cookbooks/ark/attributes/default.rb +0 -6
- data/support/cookbooks/ark/chefignore +0 -96
- data/support/cookbooks/ark/files/default/foo.tar.gz +0 -0
- data/support/cookbooks/ark/files/default/foo.tbz +0 -0
- data/support/cookbooks/ark/files/default/foo.tgz +0 -0
- data/support/cookbooks/ark/files/default/foo.zip +0 -0
- data/support/cookbooks/ark/files/default/tests/minitest/default_test.rb +0 -0
- data/support/cookbooks/ark/files/default/tests/minitest/support/helpers.rb +0 -0
- data/support/cookbooks/ark/files/default/tests/minitest/test_test.rb +0 -94
- data/support/cookbooks/ark/libraries/default.rb +0 -167
- data/support/cookbooks/ark/metadata.rb +0 -13
- data/support/cookbooks/ark/providers/default.rb +0 -370
- data/support/cookbooks/ark/recipes/default.rb +0 -31
- data/support/cookbooks/ark/recipes/test.rb +0 -138
- data/support/cookbooks/ark/resources/default.rb +0 -54
- data/support/cookbooks/ark/templates/default/add_to_path.sh.erb +0 -1
- data/support/cookbooks/ark/test/support/Gemfile +0 -4
- data/support/cookbooks/build-essential/README.md +0 -24
- data/support/cookbooks/build-essential/metadata.rb +0 -10
- data/support/cookbooks/build-essential/recipes/default.rb +0 -45
- data/support/cookbooks/chruby/.gitignore +0 -15
- data/support/cookbooks/chruby/.kitchen.yml +0 -26
- data/support/cookbooks/chruby/.ruby_version +0 -1
- data/support/cookbooks/chruby/Berksfile +0 -3
- data/support/cookbooks/chruby/Gemfile +0 -7
- data/support/cookbooks/chruby/LICENSE +0 -14
- data/support/cookbooks/chruby/README.md +0 -92
- data/support/cookbooks/chruby/Rakefile +0 -7
- data/support/cookbooks/chruby/Thorfile +0 -6
- data/support/cookbooks/chruby/Vagrantfile +0 -86
- data/support/cookbooks/chruby/attributes/default.rb +0 -10
- data/support/cookbooks/chruby/chefignore +0 -96
- data/support/cookbooks/chruby/metadata.rb +0 -11
- data/support/cookbooks/chruby/recipes/default.rb +0 -43
- data/support/cookbooks/chruby/recipes/system.rb +0 -25
- data/support/cookbooks/chruby/templates/default/chruby.sh.erb +0 -22
- data/support/cookbooks/chruby/test/integration/default/bash/embedded_test.sh +0 -1
- data/support/cookbooks/git/.gitignore +0 -14
- data/support/cookbooks/git/.kitchen.yml +0 -46
- data/support/cookbooks/git/Berksfile +0 -8
- data/support/cookbooks/git/CHANGELOG.md +0 -87
- data/support/cookbooks/git/CONTRIBUTING +0 -29
- data/support/cookbooks/git/Gemfile +0 -3
- data/support/cookbooks/git/LICENSE +0 -201
- data/support/cookbooks/git/README.md +0 -115
- data/support/cookbooks/git/TESTING.md +0 -25
- data/support/cookbooks/git/attributes/default.rb +0 -40
- data/support/cookbooks/git/metadata.rb +0 -35
- data/support/cookbooks/git/recipes/default.rb +0 -53
- data/support/cookbooks/git/recipes/server.rb +0 -58
- data/support/cookbooks/git/recipes/source.rb +0 -49
- data/support/cookbooks/git/recipes/windows.rb +0 -37
- data/support/cookbooks/git/templates/default/git-xinetd.d.erb +0 -10
- data/support/cookbooks/git/templates/default/sv-git-daemon-log-run.erb +0 -2
- data/support/cookbooks/git/templates/default/sv-git-daemon-run.erb +0 -3
- data/support/cookbooks/install_ruby/README.md +0 -3
- data/support/cookbooks/install_ruby/metadata.rb +0 -10
- data/support/cookbooks/install_ruby/recipes/default.rb +0 -14
- data/support/cookbooks/ruby_build/.gitignore +0 -6
- data/support/cookbooks/ruby_build/.kitchen.yml +0 -31
- data/support/cookbooks/ruby_build/.travis.yml +0 -4
- data/support/cookbooks/ruby_build/Berksfile +0 -10
- data/support/cookbooks/ruby_build/CHANGELOG.md +0 -72
- data/support/cookbooks/ruby_build/Gemfile +0 -14
- data/support/cookbooks/ruby_build/README.md +0 -338
- data/support/cookbooks/ruby_build/Rakefile +0 -21
- data/support/cookbooks/ruby_build/attributes/default.rb +0 -67
- data/support/cookbooks/ruby_build/chefignore +0 -53
- data/support/cookbooks/ruby_build/libraries/ruby_build_recipe_helpers.rb +0 -40
- data/support/cookbooks/ruby_build/metadata.rb +0 -18
- data/support/cookbooks/ruby_build/providers/ruby.rb +0 -88
- data/support/cookbooks/ruby_build/recipes/default.rb +0 -69
- data/support/cookbooks/ruby_build/resources/ruby.rb +0 -33
- data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/metadata.rb +0 -10
- data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/recipes/default.rb +0 -59
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/_verify_tests.bash +0 -33
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.8.7.bats +0 -29
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.2.bats +0 -18
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.3.bats +0 -18
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_2.0.0.bats +0 -18
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_jruby.bats +0 -20
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_rbx.bats +0 -18
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_ree.bats +0 -19
- data/support/cookbooks/ruby_build/test/integration/installation/bats/installation.bats +0 -6
- data/support/scripts/libsodium_ubuntu.sh +0 -80
- data/support/tasks/.gitkeep +0 -0
- data/support/tasks/libsodium_install.rb +0 -57
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"header": {
|
3
|
-
"title":"",
|
4
|
-
"description":""
|
5
|
-
},
|
6
|
-
"vaults": {
|
7
|
-
|
8
|
-
"":{
|
9
|
-
"description":"",
|
10
|
-
"fill_with": "",
|
11
|
-
"lock_with": "",
|
12
|
-
"unlock_with": "",
|
13
|
-
"contents": ""
|
14
|
-
},
|
15
|
-
|
16
|
-
"":{
|
17
|
-
"description":"",
|
18
|
-
"fill_with": "",
|
19
|
-
"lock_with": "",
|
20
|
-
"unlock_with": "",
|
21
|
-
"contents": ""
|
22
|
-
},
|
23
|
-
|
24
|
-
"":{
|
25
|
-
"description":"",
|
26
|
-
"fill_with": "",
|
27
|
-
"lock_with": "",
|
28
|
-
"unlock_with": "",
|
29
|
-
"contents": ""
|
30
|
-
}
|
31
|
-
|
32
|
-
}
|
33
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module VaultTree
|
2
|
-
class CloseValidator
|
3
|
-
attr_reader :vault
|
4
|
-
|
5
|
-
def initialize(vault)
|
6
|
-
@vault = vault
|
7
|
-
end
|
8
|
-
|
9
|
-
def validate!
|
10
|
-
confirm_valid_fill_keyword
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def confirm_valid_fill_keyword
|
17
|
-
raise Exceptions::FillAttemptMasterPassword if vault.fill_with == 'MASTER_PASSPHRASE'
|
18
|
-
end
|
19
|
-
|
20
|
-
def external_data_required?
|
21
|
-
vault.fill_with == 'EXTERNAL_DATA'
|
22
|
-
end
|
23
|
-
|
24
|
-
def external_data_missing?
|
25
|
-
vault.contract.external_data(vault.id).nil?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
module VaultTree
|
2
|
-
class Vault
|
3
|
-
class Doorman
|
4
|
-
attr_reader :vault
|
5
|
-
|
6
|
-
def initialize(vault)
|
7
|
-
@vault = vault
|
8
|
-
end
|
9
|
-
|
10
|
-
def locked_contents
|
11
|
-
CloseValidator.new(vault).validate!
|
12
|
-
already_locked? ? contents : ciphertext_contents
|
13
|
-
end
|
14
|
-
|
15
|
-
def unlocked_contents
|
16
|
-
OpenValidator.new(vault).validate!
|
17
|
-
plaintext_contents
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def ciphertext_contents
|
23
|
-
dh_locking_key? ? asymmetric_ciphertext : symmetric_ciphertext
|
24
|
-
end
|
25
|
-
|
26
|
-
def plaintext_contents
|
27
|
-
dh_unlocking_key? ? asymmetric_plaintext : symmetric_plaintext
|
28
|
-
end
|
29
|
-
|
30
|
-
def asymmetric_ciphertext
|
31
|
-
LockSmith.new(public_key: locking_public_key, private_key: locking_secret_key, message: filler).asymmetric_encrypt
|
32
|
-
end
|
33
|
-
|
34
|
-
def asymmetric_plaintext
|
35
|
-
begin
|
36
|
-
LockSmith.new(public_key: unlocking_public_key, private_key: unlocking_secret_key, cipher_text: contents).asymmetric_decrypt
|
37
|
-
rescue(RbNaCl::CryptoError)
|
38
|
-
raise(Exceptions::FailedUnlockAttempt)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def symmetric_ciphertext
|
43
|
-
key_hash = LockSmith.new(message: locking_key).secure_hash
|
44
|
-
LockSmith.new(message: filler, secret_key: key_hash).symmetric_encrypt
|
45
|
-
end
|
46
|
-
|
47
|
-
def symmetric_plaintext
|
48
|
-
begin
|
49
|
-
key_hash = LockSmith.new(message: unlocking_key).secure_hash
|
50
|
-
LockSmith.new(cipher_text: contents, secret_key: key_hash).symmetric_decrypt
|
51
|
-
rescue(RbNaCl::CryptoError)
|
52
|
-
raise(Exceptions::FailedUnlockAttempt)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def locking_key
|
57
|
-
vault.locking_key
|
58
|
-
end
|
59
|
-
|
60
|
-
def unlocking_key
|
61
|
-
vault.unlocking_key
|
62
|
-
end
|
63
|
-
|
64
|
-
def locking_public_key
|
65
|
-
locking_key_pair.public_key
|
66
|
-
end
|
67
|
-
|
68
|
-
def locking_secret_key
|
69
|
-
locking_key_pair.secret_key
|
70
|
-
end
|
71
|
-
|
72
|
-
def unlocking_public_key
|
73
|
-
unlocking_key_pair.public_key
|
74
|
-
end
|
75
|
-
|
76
|
-
def unlocking_secret_key
|
77
|
-
unlocking_key_pair.secret_key
|
78
|
-
end
|
79
|
-
|
80
|
-
def locking_key_pair
|
81
|
-
vault.locking_key if dh_locking_key?
|
82
|
-
end
|
83
|
-
|
84
|
-
def unlocking_key_pair
|
85
|
-
vault.unlocking_key if dh_unlocking_key?
|
86
|
-
end
|
87
|
-
|
88
|
-
def empty?
|
89
|
-
vault.empty?
|
90
|
-
end
|
91
|
-
|
92
|
-
def already_locked?
|
93
|
-
! empty?
|
94
|
-
end
|
95
|
-
|
96
|
-
def filler
|
97
|
-
vault.filler
|
98
|
-
end
|
99
|
-
|
100
|
-
def contents
|
101
|
-
vault.contents
|
102
|
-
end
|
103
|
-
|
104
|
-
def dh_locking_key?
|
105
|
-
vault.lock_with =~ /DH_KEY/
|
106
|
-
end
|
107
|
-
|
108
|
-
def dh_unlocking_key?
|
109
|
-
vault.unlock_with =~ /DH_KEY/
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module VaultTree
|
2
|
-
class OpenValidator
|
3
|
-
attr_reader :vault
|
4
|
-
|
5
|
-
def initialize(vault)
|
6
|
-
@vault = vault
|
7
|
-
end
|
8
|
-
|
9
|
-
def validate!
|
10
|
-
confirm_vault_not_empty
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def confirm_vault_not_empty
|
17
|
-
raise Exceptions::EmptyVault if vault.empty?
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
File without changes
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
module VaultTree
|
3
|
-
module Exceptions
|
4
|
-
class VaultTreeException < StandardError
|
5
|
-
# WORK IN PROGRESS
|
6
|
-
#
|
7
|
-
#def self.exception
|
8
|
-
# self.present_exception
|
9
|
-
# self.new
|
10
|
-
#end
|
11
|
-
|
12
|
-
#def self.present_exception
|
13
|
-
# STDOUT.write template.result(binding)
|
14
|
-
#end
|
15
|
-
|
16
|
-
#def self.template
|
17
|
-
# ERB.new File.new(template_path).read, nil, "%"
|
18
|
-
#end
|
19
|
-
|
20
|
-
#def self.template_path
|
21
|
-
# "lib/vault-tree/exceptions/exception_template.erb"
|
22
|
-
#end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module VaultTree
|
2
|
-
class ExternalData < Keyword
|
3
|
-
|
4
|
-
def evaluate
|
5
|
-
check_for_external_data
|
6
|
-
contract.external_data(id)
|
7
|
-
end
|
8
|
-
|
9
|
-
def id
|
10
|
-
vault.id
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def check_for_external_data
|
16
|
-
raise(Exceptions::MissingExternalData) if missing_external_data?
|
17
|
-
end
|
18
|
-
|
19
|
-
def missing_external_data?
|
20
|
-
nil_external_data? || empty_external_data?
|
21
|
-
end
|
22
|
-
|
23
|
-
def nil_external_data?
|
24
|
-
contract.external_data_hash.nil?
|
25
|
-
end
|
26
|
-
|
27
|
-
def empty_external_data?
|
28
|
-
contract.external_data_hash.empty?
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module VaultTree
|
2
|
-
class GeneratedShamirKey < Keyword
|
3
|
-
attr_reader :outstanding_shares, :recovery_threshold, :share_vaults
|
4
|
-
|
5
|
-
def post_initialize(arg_array)
|
6
|
-
@outstanding_shares = arg_array[0]
|
7
|
-
@recovery_threshold = arg_array[1]
|
8
|
-
@share_vaults = arg_array[2..arg_array.length]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Generate a new Shamir key.
|
12
|
-
#
|
13
|
-
# Check that shares can be saved in empty vaults
|
14
|
-
# Put the shares in their respective # vaults.
|
15
|
-
# Gnerate and Return the key.
|
16
|
-
#
|
17
|
-
# @return [String] Secure Hash digest of the generated key
|
18
|
-
def evaluate
|
19
|
-
validate_share_vaults
|
20
|
-
lock_away_key_shares
|
21
|
-
generated_key
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def lock_away_key_shares
|
27
|
-
c = contract
|
28
|
-
share_vaults.each do |v|
|
29
|
-
c = c.close_vault(v, data: data_for_vault(v) )
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def data_for_vault(id)
|
34
|
-
generated_key_shares[vault_index(id)]
|
35
|
-
end
|
36
|
-
|
37
|
-
def vault_index(id)
|
38
|
-
share_vaults.index(id)
|
39
|
-
end
|
40
|
-
|
41
|
-
def generated_key
|
42
|
-
key_object.key
|
43
|
-
end
|
44
|
-
|
45
|
-
def generated_key_shares
|
46
|
-
key_object.shares
|
47
|
-
end
|
48
|
-
|
49
|
-
def key_object
|
50
|
-
@key_object ||= Crypto::GeneratedShamirKey.new(outstanding_shares: outstanding_shares, recovery_threshold: recovery_threshold)
|
51
|
-
end
|
52
|
-
|
53
|
-
def validate_share_vaults
|
54
|
-
true # Add exception tests and functionality later
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
RSpec.configure{ |config| config.color_enabled = true }
|
3
|
-
require_relative '../lib/vault-tree/lock_smith/generated_shamir_key'
|
4
|
-
|
5
|
-
module VaultTree
|
6
|
-
module Crypto
|
7
|
-
describe GeneratedShamirKey do
|
8
|
-
|
9
|
-
describe '#generate | #assemble' do
|
10
|
-
|
11
|
-
context 'with 3 out of 5 secrets' do
|
12
|
-
it 'recovers a hash of the shared secret' do
|
13
|
-
generated_key = GeneratedShamirKey.new(outstanding_shares: 5, recovery_threshold: 3)
|
14
|
-
expected_digest = generated_key.key
|
15
|
-
key_shares = generated_key.shares
|
16
|
-
assembled_key = AssembledShamirKey.new(key_shares: key_shares)
|
17
|
-
assembled_key.assemble.should == expected_digest
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'recovers a hash of the shared secret when the shares are requested before the key' do
|
21
|
-
generated_key = GeneratedShamirKey.new(outstanding_shares: 5, recovery_threshold: 3)
|
22
|
-
key_shares = generated_key.shares
|
23
|
-
expected_digest = generated_key.key
|
24
|
-
assembled_key = AssembledShamirKey.new(key_shares: key_shares)
|
25
|
-
assembled_key.assemble.should == expected_digest
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'with 5 out of 5 secrets' do
|
30
|
-
it 'recovers a hash of the shared secret' do
|
31
|
-
generated_key = GeneratedShamirKey.new(outstanding_shares: 5, recovery_threshold: 5)
|
32
|
-
expected_digest = generated_key.key
|
33
|
-
key_shares = generated_key.shares
|
34
|
-
assembled_key = AssembledShamirKey.new(key_shares: key_shares)
|
35
|
-
assembled_key.assemble.should == expected_digest
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'with 2 out of 2 secrets' do
|
40
|
-
it 'recovers a hash of the shared secret' do
|
41
|
-
generated_key = GeneratedShamirKey.new(outstanding_shares: 2, recovery_threshold: 2)
|
42
|
-
expected_digest = generated_key.key
|
43
|
-
key_shares = generated_key.shares
|
44
|
-
assembled_key = AssembledShamirKey.new(key_shares: key_shares)
|
45
|
-
assembled_key.assemble.should == expected_digest
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
---
|
2
|
-
driver_plugin: vagrant
|
3
|
-
driver_config:
|
4
|
-
require_chef_omnibus: true
|
5
|
-
|
6
|
-
platforms:
|
7
|
-
- name: ubuntu-12.04
|
8
|
-
driver_config:
|
9
|
-
box: opscode-ubuntu-12.04
|
10
|
-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
|
11
|
-
run_list:
|
12
|
-
- recipe[apt]
|
13
|
-
|
14
|
-
- name: ubuntu-10.04
|
15
|
-
driver_config:
|
16
|
-
box: opscode-ubuntu-10.04
|
17
|
-
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
|
18
|
-
run_list:
|
19
|
-
- recipe[apt]
|
20
|
-
|
21
|
-
- name: centos-6.4
|
22
|
-
driver_config:
|
23
|
-
box: opscode-centos-6.4
|
24
|
-
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
|
25
|
-
run_list:
|
26
|
-
- recipe[yum::epel]
|
27
|
-
|
28
|
-
suites:
|
29
|
-
- name: default
|
30
|
-
run_list:
|
31
|
-
- recipe[minitest-handler]
|
32
|
-
- recipe[ark]
|
33
|
-
- recipe[ark::test]
|
34
|
-
attributes: {}
|