vault-tree 0.3.4 → 0.6.0
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.
- 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
|
@@ -9,104 +9,54 @@ module VaultTree
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def close
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
@properties['contents'] = locked_contents
|
|
13
|
+
self
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def
|
|
16
|
+
def open
|
|
17
|
+
self.close
|
|
17
18
|
unlocked_contents
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
def fill_with
|
|
21
|
-
properties['fill_with']
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def lock_with
|
|
25
|
-
properties['lock_with']
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def unlock_with
|
|
29
|
-
properties['unlock_with']
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def contents
|
|
33
|
-
properties['contents']
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def empty?
|
|
37
|
-
contents.empty?
|
|
38
|
-
end
|
|
39
|
-
|
|
40
21
|
def filler
|
|
41
|
-
KeywordInterpreter.new(fill_with, self).evaluate
|
|
22
|
+
KeywordInterpreter.new(properties['fill_with'], self).evaluate
|
|
42
23
|
end
|
|
43
24
|
|
|
44
25
|
def locking_key
|
|
45
|
-
KeywordInterpreter.new(lock_with, self).evaluate
|
|
26
|
+
VaultKey.new KeywordInterpreter.new(properties['lock_with'], self).evaluate
|
|
46
27
|
end
|
|
47
28
|
|
|
48
29
|
def unlocking_key
|
|
49
|
-
KeywordInterpreter.new(unlock_with, self).evaluate
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
def close_ancestors
|
|
55
|
-
close_lock_ancestor
|
|
56
|
-
close_fill_ancestor
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def close_self
|
|
60
|
-
@properties['contents'] = locked_contents
|
|
61
|
-
self
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def unlocked_contents
|
|
65
|
-
Doorman.new(self).unlocked_contents
|
|
30
|
+
VaultKey.new KeywordInterpreter.new(properties['unlock_with'], self).evaluate
|
|
66
31
|
end
|
|
67
32
|
|
|
68
33
|
def locked_contents
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def close_fill_ancestor
|
|
77
|
-
contract.close_vault(fill_ancestor_id)
|
|
34
|
+
begin
|
|
35
|
+
already_locked? ? properties['contents'] : ciphertext(filler)
|
|
36
|
+
rescue RbNaCl::CryptoError => e
|
|
37
|
+
raise Exceptions::FailedLockAttempt.new(e, vault_id: id)
|
|
38
|
+
end
|
|
78
39
|
end
|
|
79
40
|
|
|
80
|
-
def
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def lock_with_key_or_contents?
|
|
89
|
-
(locking_word_base == 'CONTENTS') || (locking_word_base == 'KEY')
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def locking_word_base
|
|
93
|
-
KeywordInterpreter.new(lock_with,self).word_base
|
|
41
|
+
def unlocked_contents
|
|
42
|
+
begin
|
|
43
|
+
plaintext properties['contents']
|
|
44
|
+
rescue RbNaCl::CryptoError => e
|
|
45
|
+
raise Exceptions::FailedUnlockAttempt.new(e, vault_id: id)
|
|
46
|
+
end
|
|
94
47
|
end
|
|
95
48
|
|
|
96
|
-
def
|
|
97
|
-
(
|
|
49
|
+
def ciphertext(m)
|
|
50
|
+
ContentCiphertext.new(m, locking_key).evaluate
|
|
98
51
|
end
|
|
99
52
|
|
|
100
|
-
def
|
|
101
|
-
|
|
53
|
+
def plaintext(c)
|
|
54
|
+
ContentPlaintext.new(c, unlocking_key).evaluate
|
|
102
55
|
end
|
|
103
56
|
|
|
104
|
-
def
|
|
105
|
-
|
|
57
|
+
def already_locked?
|
|
58
|
+
! (properties['contents'].nil? || properties['contents'].empty?)
|
|
106
59
|
end
|
|
107
60
|
|
|
108
|
-
def fill_ancestor_id
|
|
109
|
-
fill_with.extract_ancestor_id if has_fill_ancestor?
|
|
110
|
-
end
|
|
111
61
|
end
|
|
112
62
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module VaultTree
|
|
2
|
+
class VaultKey
|
|
3
|
+
attr_reader :k
|
|
4
|
+
|
|
5
|
+
def initialize(k)
|
|
6
|
+
@k = k
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def secret
|
|
10
|
+
asymmetric? ? k.secret_key : k
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def public
|
|
14
|
+
asymmetric? ? k.public_key : nil
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def asymmetric?
|
|
18
|
+
k.kind_of?(DHKeyPair)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module VaultTree
|
|
2
|
+
class VaultList
|
|
3
|
+
attr_reader :vaults_hash, :contract
|
|
4
|
+
|
|
5
|
+
def initialize(vaults_hash, contract)
|
|
6
|
+
@vaults_hash = vaults_hash
|
|
7
|
+
@contract = contract
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def close_vault(id)
|
|
11
|
+
validate_vault(id)
|
|
12
|
+
update_vaults vault(id).close
|
|
13
|
+
self
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def open_vault(id)
|
|
17
|
+
validate_vault(id)
|
|
18
|
+
vault(id).open
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def vault_closed?(id)
|
|
22
|
+
non_empty_contents?(id)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_hash
|
|
26
|
+
@vaults_hash
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def non_empty_contents?(id)
|
|
32
|
+
! empty_contents?(id)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def empty_contents?(id)
|
|
36
|
+
vaults_hash[id]['contents'].nil? || vaults_hash[id]['contents'].empty?
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def update_vaults(vault)
|
|
40
|
+
@vaults_hash[vault.id] = vault.properties unless vault.kind_of?(NullVault)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def vault(id)
|
|
44
|
+
id.nil? ? NullVault.new : Vault.new(id, vaults_hash[id], contract)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def validate_vault(id)
|
|
48
|
+
raise Exceptions::VaultDoesNotExist.new(nil,vault_id: id) unless valid_id?(id)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def valid_id?(id)
|
|
52
|
+
id.nil? || vaults_hash.include?(id)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
module VaultTree
|
|
2
2
|
module Exceptions
|
|
3
|
-
class EmptyVault <
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
class EmptyVault < LibraryException
|
|
4
|
+
|
|
5
|
+
def post_initialize(params)
|
|
6
|
+
@vault_id = params[:vault_id]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def runtime_information
|
|
10
|
+
%Q{The following vault was empty: #{@vault_id}
|
|
11
|
+
|
|
12
|
+
Vault Tree does not allow you to open an empty vault.
|
|
13
|
+
An empty vault means the the vault contents field is an empty
|
|
14
|
+
string.
|
|
15
|
+
|
|
16
|
+
* Are you closing the vaults in the right order?
|
|
17
|
+
* Are you attempting to open a vault before all
|
|
18
|
+
of the vaults that it references have been closed?
|
|
19
|
+
}
|
|
20
|
+
end
|
|
6
21
|
end
|
|
7
22
|
end
|
|
8
23
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module VaultTree
|
|
2
|
+
module Exceptions
|
|
3
|
+
class FailedLockAttempt < LibraryException
|
|
4
|
+
|
|
5
|
+
def post_initialize(params)
|
|
6
|
+
@vault_id = params[:vault_id]
|
|
7
|
+
@locking_key = params[:locking_key]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def runtime_information
|
|
11
|
+
%Q{
|
|
12
|
+
Attempted to Lock Vault:
|
|
13
|
+
#{@vault_id}
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
module VaultTree
|
|
2
2
|
module Exceptions
|
|
3
|
-
class FailedUnlockAttempt <
|
|
3
|
+
class FailedUnlockAttempt < LibraryException
|
|
4
|
+
|
|
5
|
+
def post_initialize(params)
|
|
6
|
+
@vault_id = params[:vault_id]
|
|
7
|
+
@unlocking_key = params[:unlocking_key]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def runtime_information
|
|
11
|
+
%Q{
|
|
12
|
+
Attempted to Unlock Vault:
|
|
13
|
+
#{@vault_id}
|
|
14
|
+
|
|
15
|
+
* Can you access the vault key?
|
|
16
|
+
- Does the CPU that is executing this particular contract
|
|
17
|
+
have access to the vault key? It could be the case that
|
|
18
|
+
this contract does not permit you to open this particular vault.
|
|
19
|
+
- Are you providing the correct key to the Vault Tree Contract? It
|
|
20
|
+
could be that your are trying to open the vault with the wrong key.
|
|
21
|
+
* Invalid Ciphertext?
|
|
22
|
+
- Have the encrypted contents of the vault been tampered with?
|
|
23
|
+
The underlying Vault Tree Cryto library (NaCl) uses authenticated
|
|
24
|
+
encryption. This ensures that ciphertext cannot be modified.}
|
|
25
|
+
end
|
|
4
26
|
end
|
|
5
27
|
end
|
|
6
28
|
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
module VaultTree
|
|
2
|
+
module Exceptions
|
|
3
|
+
class LibraryException < StandardError
|
|
4
|
+
attr_reader :original_exception
|
|
5
|
+
|
|
6
|
+
def initialize(original_exception = nil, runtime_information = {})
|
|
7
|
+
@original_exception = original_exception
|
|
8
|
+
post_initialize(runtime_information)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def post_initialize(opts)
|
|
12
|
+
nil
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def runtime_information
|
|
16
|
+
{}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def exception
|
|
20
|
+
self
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def message
|
|
24
|
+
output_exception_message
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def background
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def troubleshooting_questions
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def name
|
|
36
|
+
self.class
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def output_exception_message
|
|
42
|
+
STDOUT.write(full_exception_message)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def full_exception_message
|
|
46
|
+
%Q{
|
|
47
|
+
#{message_banner}
|
|
48
|
+
#{name}
|
|
49
|
+
#{message_banner}
|
|
50
|
+
#{present_runtime_information}
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def message_banner
|
|
55
|
+
%Q{####################################################}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def present_runtime_information
|
|
59
|
+
"#{runtime_information}" unless runtime_information.empty?
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
module VaultTree
|
|
2
2
|
module Exceptions
|
|
3
|
-
class MissingPartnerDecryptionKey <
|
|
3
|
+
class MissingPartnerDecryptionKey < LibraryException
|
|
4
|
+
def post_initialize(params)
|
|
5
|
+
@vault_id = params[:vault_id]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def runtime_information
|
|
9
|
+
%Q{
|
|
10
|
+
Missing Decryption Key For:
|
|
11
|
+
#{@vault_id}
|
|
12
|
+
}
|
|
13
|
+
end
|
|
4
14
|
end
|
|
5
15
|
end
|
|
6
16
|
end
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
module VaultTree
|
|
2
2
|
module Exceptions
|
|
3
|
-
class UnsupportedKeyword <
|
|
3
|
+
class UnsupportedKeyword < LibraryException
|
|
4
|
+
def post_initialize(params)
|
|
5
|
+
@vault_id = params[:vault_id]
|
|
6
|
+
@keyword = params[:keyword]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def runtime_information
|
|
10
|
+
%Q{
|
|
11
|
+
It looks like you have used an unsupported Keyword.
|
|
12
|
+
|
|
13
|
+
Attempted Keyword:
|
|
14
|
+
#{@keyword}
|
|
15
|
+
|
|
16
|
+
Vault:
|
|
17
|
+
#{@vault_id}
|
|
18
|
+
}
|
|
19
|
+
end
|
|
4
20
|
end
|
|
5
21
|
end
|
|
6
22
|
end
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
module VaultTree
|
|
2
2
|
module Exceptions
|
|
3
|
-
class VaultDoesNotExist <
|
|
3
|
+
class VaultDoesNotExist < LibraryException
|
|
4
|
+
def post_initialize(params)
|
|
5
|
+
@vault_id = params[:vault_id]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def runtime_information
|
|
9
|
+
%Q{Can not find vault #{@vault_id}}
|
|
10
|
+
end
|
|
4
11
|
end
|
|
5
12
|
end
|
|
6
13
|
end
|