vault-tree 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +26 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +43 -0
- data/LICENSE.txt +22 -0
- data/README.md +118 -0
- data/Rakefile +17 -0
- data/VagrantFile +30 -0
- data/features/core.feature +44 -0
- data/features/exceptions.feature +41 -0
- data/features/steps/core.steps.rb +168 -0
- data/features/steps/exceptions.steps.rb +103 -0
- data/features/support/env.rb +1 -0
- data/features/world.rb +3 -0
- data/lib/vault-tree.rb +7 -0
- data/lib/vault-tree/config/dependencies.rb +4 -0
- data/lib/vault-tree/config/lib.rb +2 -0
- data/lib/vault-tree/config/path_helpers.rb +49 -0
- data/lib/vault-tree/config/string.rb +25 -0
- data/lib/vault-tree/contract/close_validator.rb +35 -0
- data/lib/vault-tree/contract/contract.rb +85 -0
- data/lib/vault-tree/contract/contract_presenter.rb +27 -0
- data/lib/vault-tree/contract/doorman.rb +112 -0
- data/lib/vault-tree/contract/null_vault.rb +16 -0
- data/lib/vault-tree/contract/open_validator.rb +20 -0
- data/lib/vault-tree/contract/vault.rb +96 -0
- data/lib/vault-tree/exceptions/empty_vault.rb +8 -0
- data/lib/vault-tree/exceptions/fill_attempt_master_password.rb +6 -0
- data/lib/vault-tree/exceptions/invalid_signature.rb +0 -0
- data/lib/vault-tree/exceptions/malformed_json.rb +0 -0
- data/lib/vault-tree/exceptions/missing_external_data.rb +6 -0
- data/lib/vault-tree/exceptions/missing_partner_decryption_key.rb +6 -0
- data/lib/vault-tree/exceptions/missing_passphrase.rb +6 -0
- data/lib/vault-tree/exceptions/non_unique_vault_id.rb +0 -0
- data/lib/vault-tree/exceptions/unsupported_keyword.rb +6 -0
- data/lib/vault-tree/exceptions/vault_does_not_exist.rb +6 -0
- data/lib/vault-tree/exceptions/vault_tree_exception.rb +6 -0
- data/lib/vault-tree/keywords/decryption_key.rb +14 -0
- data/lib/vault-tree/keywords/external_data.rb +13 -0
- data/lib/vault-tree/keywords/keyword.rb +19 -0
- data/lib/vault-tree/keywords/keyword_interpreter.rb +45 -0
- data/lib/vault-tree/keywords/master_passphrase.rb +9 -0
- data/lib/vault-tree/keywords/public_encryption_key.rb +27 -0
- data/lib/vault-tree/keywords/random_number.rb +9 -0
- data/lib/vault-tree/keywords/shared_key.rb +24 -0
- data/lib/vault-tree/keywords/unlocked.rb +9 -0
- data/lib/vault-tree/keywords/vault_contents.rb +13 -0
- data/lib/vault-tree/lock_smith/asymmetric_cipher.rb +31 -0
- data/lib/vault-tree/lock_smith/crypto_hash.rb +11 -0
- data/lib/vault-tree/lock_smith/digital_signature.rb +32 -0
- data/lib/vault-tree/lock_smith/encryption_key_pair.rb +25 -0
- data/lib/vault-tree/lock_smith/null_vault.rb +4 -0
- data/lib/vault-tree/lock_smith/random_number.rb +11 -0
- data/lib/vault-tree/lock_smith/shared_key_pair.rb +12 -0
- data/lib/vault-tree/lock_smith/signing_key_pair.rb +25 -0
- data/lib/vault-tree/lock_smith/symmetric_cipher.rb +25 -0
- data/lib/vault-tree/util/json.rb +16 -0
- data/lib/vault-tree/version.rb +3 -0
- data/spec/app/locksmith/asymmetric_cipher_spec.rb +25 -0
- data/spec/app/locksmith/signing_key_pair_spec.rb +22 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/fixtures/blank_simple_test_contract.json +14 -0
- data/spec/support/fixtures/broken_contract.json +55 -0
- data/spec/support/fixtures/one_two_three-0.5.0.EXP.json +105 -0
- data/spec/support/fixtures/reference_contract.1.0.0.json +227 -0
- data/spec/support/fixtures/simple_test_contract.json +14 -0
- data/support/cookbooks/ark/.gitignore +12 -0
- data/support/cookbooks/ark/.kitchen.yml +34 -0
- data/support/cookbooks/ark/.travis.yml +6 -0
- data/support/cookbooks/ark/Berksfile +9 -0
- data/support/cookbooks/ark/CHANGELOG.md +87 -0
- data/support/cookbooks/ark/CONTRIBUTING.md +257 -0
- data/support/cookbooks/ark/README.md +301 -0
- data/support/cookbooks/ark/Rakefile +36 -0
- data/support/cookbooks/ark/TESTING.md +25 -0
- data/support/cookbooks/ark/Toftfile +15 -0
- data/support/cookbooks/ark/attributes/default.rb +6 -0
- data/support/cookbooks/ark/chefignore +96 -0
- 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 +94 -0
- data/support/cookbooks/ark/libraries/default.rb +167 -0
- data/support/cookbooks/ark/metadata.rb +13 -0
- data/support/cookbooks/ark/providers/default.rb +370 -0
- data/support/cookbooks/ark/recipes/default.rb +31 -0
- data/support/cookbooks/ark/recipes/test.rb +138 -0
- data/support/cookbooks/ark/resources/default.rb +54 -0
- data/support/cookbooks/ark/templates/default/add_to_path.sh.erb +1 -0
- data/support/cookbooks/ark/test/support/Gemfile +4 -0
- data/support/cookbooks/build-essential/README.md +24 -0
- data/support/cookbooks/build-essential/metadata.rb +10 -0
- data/support/cookbooks/build-essential/recipes/default.rb +45 -0
- data/support/cookbooks/chruby/.gitignore +15 -0
- data/support/cookbooks/chruby/.kitchen.yml +26 -0
- data/support/cookbooks/chruby/.ruby_version +1 -0
- data/support/cookbooks/chruby/Berksfile +3 -0
- data/support/cookbooks/chruby/Gemfile +7 -0
- data/support/cookbooks/chruby/LICENSE +14 -0
- data/support/cookbooks/chruby/README.md +92 -0
- data/support/cookbooks/chruby/Rakefile +7 -0
- data/support/cookbooks/chruby/Thorfile +6 -0
- data/support/cookbooks/chruby/Vagrantfile +86 -0
- data/support/cookbooks/chruby/attributes/default.rb +10 -0
- data/support/cookbooks/chruby/chefignore +96 -0
- data/support/cookbooks/chruby/metadata.rb +11 -0
- data/support/cookbooks/chruby/recipes/default.rb +43 -0
- data/support/cookbooks/chruby/recipes/system.rb +25 -0
- data/support/cookbooks/chruby/templates/default/chruby.sh.erb +22 -0
- data/support/cookbooks/chruby/test/integration/default/bash/embedded_test.sh +1 -0
- data/support/cookbooks/git/.gitignore +14 -0
- data/support/cookbooks/git/.kitchen.yml +46 -0
- data/support/cookbooks/git/Berksfile +8 -0
- data/support/cookbooks/git/CHANGELOG.md +87 -0
- data/support/cookbooks/git/CONTRIBUTING +29 -0
- data/support/cookbooks/git/Gemfile +3 -0
- data/support/cookbooks/git/LICENSE +201 -0
- data/support/cookbooks/git/README.md +115 -0
- data/support/cookbooks/git/TESTING.md +25 -0
- data/support/cookbooks/git/attributes/default.rb +40 -0
- data/support/cookbooks/git/metadata.rb +35 -0
- data/support/cookbooks/git/recipes/default.rb +53 -0
- data/support/cookbooks/git/recipes/server.rb +58 -0
- data/support/cookbooks/git/recipes/source.rb +49 -0
- data/support/cookbooks/git/recipes/windows.rb +37 -0
- data/support/cookbooks/git/templates/default/git-xinetd.d.erb +10 -0
- data/support/cookbooks/git/templates/default/sv-git-daemon-log-run.erb +2 -0
- data/support/cookbooks/git/templates/default/sv-git-daemon-run.erb +3 -0
- data/support/cookbooks/install_ruby/README.md +3 -0
- data/support/cookbooks/install_ruby/metadata.rb +10 -0
- data/support/cookbooks/install_ruby/recipes/default.rb +14 -0
- data/support/cookbooks/ruby_build/.gitignore +6 -0
- data/support/cookbooks/ruby_build/.kitchen.yml +31 -0
- data/support/cookbooks/ruby_build/.travis.yml +4 -0
- data/support/cookbooks/ruby_build/Berksfile +10 -0
- data/support/cookbooks/ruby_build/CHANGELOG.md +72 -0
- data/support/cookbooks/ruby_build/Gemfile +14 -0
- data/support/cookbooks/ruby_build/README.md +338 -0
- data/support/cookbooks/ruby_build/Rakefile +21 -0
- data/support/cookbooks/ruby_build/attributes/default.rb +67 -0
- data/support/cookbooks/ruby_build/chefignore +53 -0
- data/support/cookbooks/ruby_build/libraries/ruby_build_recipe_helpers.rb +40 -0
- data/support/cookbooks/ruby_build/metadata.rb +18 -0
- data/support/cookbooks/ruby_build/providers/ruby.rb +88 -0
- data/support/cookbooks/ruby_build/recipes/default.rb +69 -0
- data/support/cookbooks/ruby_build/resources/ruby.rb +33 -0
- data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/metadata.rb +10 -0
- data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/recipes/default.rb +59 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/_verify_tests.bash +33 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.8.7.bats +29 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.2.bats +18 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.3.bats +18 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_2.0.0.bats +18 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_jruby.bats +20 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_rbx.bats +18 -0
- data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_ree.bats +19 -0
- data/support/cookbooks/ruby_build/test/integration/installation/bats/installation.bats +6 -0
- data/support/scripts/libsodium_ubuntu.sh +80 -0
- data/support/tasks/.gitkeep +0 -0
- data/support/tasks/libsodium_install.rb +57 -0
- data/vault-tree.gemspec +26 -0
- metadata +305 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
module VaultTree
|
2
|
+
module LockSmith
|
3
|
+
class DigitalSignature
|
4
|
+
attr_reader :signing_key, :verify_key, :message, :signature
|
5
|
+
|
6
|
+
def initialize(opts = {})
|
7
|
+
@message = opts[:message]
|
8
|
+
@signing_key = opts[:signing_key]
|
9
|
+
@verify_key = opts[:verify_key]
|
10
|
+
@signature = opts[:signature]
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate
|
14
|
+
sig_generator.sign(message, :base64)
|
15
|
+
end
|
16
|
+
|
17
|
+
def verify
|
18
|
+
sig_verifier.verify(@message, @signature, :base64)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def sig_generator
|
24
|
+
Crypto::SigningKey.new(signing_key, :base64)
|
25
|
+
end
|
26
|
+
|
27
|
+
def sig_verifier
|
28
|
+
Crypto::VerifyKey.new(verify_key, :base64)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VaultTree
|
2
|
+
module LockSmith
|
3
|
+
class EncryptionKeyPair
|
4
|
+
|
5
|
+
def generate_private_key
|
6
|
+
Crypto::PrivateKey.generate.to_s(:base64)
|
7
|
+
end
|
8
|
+
|
9
|
+
def public_key(pk)
|
10
|
+
lib_public_key(pk).to_s(:base64)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def lib_private_key(s)
|
16
|
+
Crypto::PrivateKey.new(s,:base64)
|
17
|
+
end
|
18
|
+
|
19
|
+
def lib_public_key(pk)
|
20
|
+
lib_private_key(pk).public_key
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VaultTree
|
2
|
+
module LockSmith
|
3
|
+
class SigningKeyPair
|
4
|
+
|
5
|
+
def signing_key
|
6
|
+
lib_signing_key.to_s(:base64)
|
7
|
+
end
|
8
|
+
|
9
|
+
def verify_key
|
10
|
+
lib_verify_key.to_s(:base64)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def lib_signing_key
|
16
|
+
@lib_signing_key ||= Crypto::SigningKey.generate
|
17
|
+
end
|
18
|
+
|
19
|
+
def lib_verify_key
|
20
|
+
lib_signing_key.verify_key
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VaultTree
|
2
|
+
module LockSmith
|
3
|
+
class SymmetricCipher
|
4
|
+
|
5
|
+
def encrypt(opts = {})
|
6
|
+
key = CryptoHash.compute(opts[:key])
|
7
|
+
plain_text = opts[:plain_text]
|
8
|
+
box_from_key(key).box(plain_text, :base64)
|
9
|
+
end
|
10
|
+
|
11
|
+
def decrypt(opts = {})
|
12
|
+
key = CryptoHash.compute(opts[:key])
|
13
|
+
cipher_text = opts[:cipher_text]
|
14
|
+
box_from_key(key).open(cipher_text , :base64)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def box_from_key(key)
|
20
|
+
sb = Crypto::SecretBox.new(key,:base64)
|
21
|
+
rnb = Crypto::RandomNonceBox.new(sb)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module VaultTree
|
4
|
+
describe 'AsymmetricCipher' do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
alice_key_pair = LockSmith::EncryptionKeyPair.new
|
8
|
+
@alice_priv_key = alice_key_pair.generate_private_key
|
9
|
+
@alice_pub_key = alice_key_pair.public_key(@alice_priv_key)
|
10
|
+
bob_key_pair = LockSmith::EncryptionKeyPair.new
|
11
|
+
@bob_priv_key = bob_key_pair.generate_private_key
|
12
|
+
@bob_pub_key = bob_key_pair.public_key(@bob_priv_key)
|
13
|
+
@message = 'ENCRYPT_ME!'
|
14
|
+
@asymmetric_cipher = LockSmith::AsymmetricCipher.new
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#encrypt | #decrypt' do
|
18
|
+
it 'Bob can encrypt with alice pub key and Alice can decrypt' do
|
19
|
+
cipher_text = @asymmetric_cipher.encrypt(public_key: @alice_pub_key, secret_key: @bob_priv_key, plain_text: @message)
|
20
|
+
plain_text = @asymmetric_cipher.decrypt(public_key: @bob_pub_key, secret_key: @alice_priv_key, cipher_text: cipher_text)
|
21
|
+
plain_text.should == @message
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module VaultTree
|
3
|
+
module LockSmith
|
4
|
+
|
5
|
+
describe 'SigningKeyPair' do
|
6
|
+
describe '#new' do
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@signing_key_pair = SigningKeyPair.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'generates a new private key' do
|
13
|
+
@signing_key_pair.signing_key.should be_an_instance_of(String)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'generates a new public key' do
|
17
|
+
@signing_key_pair.verify_key.should be_an_instance_of(String)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"header": {
|
3
|
+
|
4
|
+
"title":"Broken Contract",
|
5
|
+
"summary":"This is a test fixture for ensuring proper exception handling. These are examples of what NOT to do.",
|
6
|
+
"contributers":"Andrew Bashelor"
|
7
|
+
},
|
8
|
+
"vaults": {
|
9
|
+
|
10
|
+
"empty_vault":{
|
11
|
+
"fill_with": "RANDOM_NUMBER",
|
12
|
+
"lock_with": "MASTER_PASSPHRASE",
|
13
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
14
|
+
"contents": ""
|
15
|
+
},
|
16
|
+
|
17
|
+
"unsupported_keyword":{
|
18
|
+
"fill_with": "UNSUPPORTED_KEYWORD",
|
19
|
+
"lock_with": "UNLOCKED",
|
20
|
+
"unlock_with": "UNLOCKED",
|
21
|
+
"contents": ""
|
22
|
+
},
|
23
|
+
|
24
|
+
"fill_with_master_pass_vault":{
|
25
|
+
"fill_with": "MASTER_PASSPHRASE",
|
26
|
+
"lock_with": "UNLOCKED",
|
27
|
+
"unlock_with": "UNLOCKED",
|
28
|
+
"contents": ""
|
29
|
+
},
|
30
|
+
|
31
|
+
"missing_external_data_vault":{
|
32
|
+
"fill_with": "EXTERNAL_DATA",
|
33
|
+
"lock_with": "UNLOCKED",
|
34
|
+
"unlock_with": "UNLOCKED",
|
35
|
+
"contents": ""
|
36
|
+
},
|
37
|
+
|
38
|
+
"empty_decryption_key":{
|
39
|
+
"description": "Leave this empty.",
|
40
|
+
"fill_with": "DECRYPTION_KEY",
|
41
|
+
"lock_with": "UNLOCKED",
|
42
|
+
"unlock_with": "UNLOCKED",
|
43
|
+
"contents": ""
|
44
|
+
},
|
45
|
+
|
46
|
+
"orphaned_public_key":{
|
47
|
+
"description": "Attempt to establish a public key with first building a decryption key",
|
48
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY['empty_decryption_key']",
|
49
|
+
"lock_with": "UNLOCKED",
|
50
|
+
"unlock_with": "UNLOCKED",
|
51
|
+
"contents": ""
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
{
|
2
|
+
"header": {},
|
3
|
+
"vaults": {
|
4
|
+
|
5
|
+
"bob_contract_secret":{
|
6
|
+
"owner": "bob",
|
7
|
+
"fill_with": "RANDOM_NUMBER",
|
8
|
+
"lock_with": "MASTER_PASSPHRASE",
|
9
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
10
|
+
"contents": ""
|
11
|
+
},
|
12
|
+
|
13
|
+
"alice_contract_secret":{
|
14
|
+
"owner": "alice",
|
15
|
+
"fill_with": "RANDOM_NUMBER",
|
16
|
+
"lock_with": "MASTER_PASSPHRASE",
|
17
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
18
|
+
"contents": ""
|
19
|
+
},
|
20
|
+
|
21
|
+
"alice_public_encryption_key":{
|
22
|
+
"owner": "alice",
|
23
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY",
|
24
|
+
"lock_with": "UNLOCKED",
|
25
|
+
"unlock_with": "UNLOCKED",
|
26
|
+
"contents": ""
|
27
|
+
},
|
28
|
+
|
29
|
+
"bob_public_encryption_key":{
|
30
|
+
"owner": "bob",
|
31
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY",
|
32
|
+
"lock_with": "UNLOCKED",
|
33
|
+
"unlock_with": "UNLOCKED",
|
34
|
+
"contents": ""
|
35
|
+
},
|
36
|
+
|
37
|
+
"alice_decryption_key":{
|
38
|
+
"owner": "alice",
|
39
|
+
"fill_with": "DECRYPTION_KEY",
|
40
|
+
"lock_with": "VAULT_CONTENTS['alice_contract_secret']",
|
41
|
+
"unlock_with": "VAULT_CONTENTS['alice_contract_secret']",
|
42
|
+
"contents": ""
|
43
|
+
},
|
44
|
+
|
45
|
+
"bob_decryption_key":{
|
46
|
+
"owner": "bob",
|
47
|
+
"fill_with": "DECRYPTION_KEY",
|
48
|
+
"lock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
49
|
+
"unlock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
50
|
+
"contents": ""
|
51
|
+
},
|
52
|
+
|
53
|
+
"congratulations_message":{
|
54
|
+
"owner": "bob",
|
55
|
+
"fill_with": "EXTERNAL_DATA",
|
56
|
+
"lock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
57
|
+
"unlock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
58
|
+
"contents": ""
|
59
|
+
},
|
60
|
+
|
61
|
+
"vault_two_key":{
|
62
|
+
"owner": "bob",
|
63
|
+
"fill_with": "RANDOM_NUMBER",
|
64
|
+
"lock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
65
|
+
"unlock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
66
|
+
"contents": ""
|
67
|
+
},
|
68
|
+
|
69
|
+
"vault_three_key":{
|
70
|
+
"owner": "bob",
|
71
|
+
"fill_with": "RANDOM_NUMBER",
|
72
|
+
"lock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
73
|
+
"unlock_with": "VAULT_CONTENTS['bob_contract_secret']",
|
74
|
+
"contents": ""
|
75
|
+
},
|
76
|
+
|
77
|
+
"first":{
|
78
|
+
"owner": "bob",
|
79
|
+
"fill_with": "VAULT_CONTENTS['vault_two_key']",
|
80
|
+
"lock_with": "VAULT_CONTENTS['alice_public_encryption_key']",
|
81
|
+
"unlock_with": "VAULT_CONTENTS['alice_decryption_key']",
|
82
|
+
"lock_type": "ASYMMETRIC_MUTUAL_AUTH",
|
83
|
+
"asym_auth_with": "VAULT_CONTENTS['bob_decryption_key']",
|
84
|
+
"asym_verify_with": "VAULT_CONTENTS['bob_public_encryption_key']",
|
85
|
+
"contents": ""
|
86
|
+
},
|
87
|
+
|
88
|
+
"second":{
|
89
|
+
"owner": "bob",
|
90
|
+
"fill_with": "VAULT_CONTENTS['vault_three_key']",
|
91
|
+
"lock_with": "VAULT_CONTENTS['vault_two_key']",
|
92
|
+
"unlock_with": "VAULT_CONTENTS['first']",
|
93
|
+
"contents": ""
|
94
|
+
},
|
95
|
+
|
96
|
+
"third":{
|
97
|
+
"owner": "bob",
|
98
|
+
"fill_with": "VAULT_CONTENTS['congratulations_message']",
|
99
|
+
"lock_with": "VAULT_CONTENTS['vault_three_key']",
|
100
|
+
"unlock_with": "VAULT_CONTENTS['second']",
|
101
|
+
"contents": ""
|
102
|
+
}
|
103
|
+
|
104
|
+
}
|
105
|
+
}
|
@@ -0,0 +1,227 @@
|
|
1
|
+
{
|
2
|
+
"header": {
|
3
|
+
"title":"Reference Contract 1.0.0",
|
4
|
+
"description":"This is a test fixture. It is a contract built to use all Vault Tree functionality"
|
5
|
+
},
|
6
|
+
"vaults": {
|
7
|
+
|
8
|
+
"bob_contract_secret":{
|
9
|
+
"description":"contract specific password to lock private information",
|
10
|
+
"fill_with": "RANDOM_NUMBER",
|
11
|
+
"lock_with": "MASTER_PASSPHRASE",
|
12
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
13
|
+
"contents": ""
|
14
|
+
},
|
15
|
+
|
16
|
+
"alice_contract_secret":{
|
17
|
+
"description":"contract specific password to lock private information",
|
18
|
+
"fill_with": "RANDOM_NUMBER",
|
19
|
+
"lock_with": "MASTER_PASSPHRASE",
|
20
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
21
|
+
"contents": ""
|
22
|
+
},
|
23
|
+
|
24
|
+
"alice_public_encryption_key":{
|
25
|
+
"description":"public key for asymmetric encryption",
|
26
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY['alice_decryption_key']",
|
27
|
+
"lock_with": "UNLOCKED",
|
28
|
+
"unlock_with": "UNLOCKED",
|
29
|
+
"contents": ""
|
30
|
+
},
|
31
|
+
|
32
|
+
"bob_public_encryption_key":{
|
33
|
+
"description":"public key for asymmetric encryption",
|
34
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY['bob_decryption_key']",
|
35
|
+
"lock_with": "UNLOCKED",
|
36
|
+
"unlock_with": "UNLOCKED",
|
37
|
+
"contents": ""
|
38
|
+
},
|
39
|
+
|
40
|
+
"alice_decryption_key":{
|
41
|
+
"description":"private key for asymmetric decryption",
|
42
|
+
"fill_with": "DECRYPTION_KEY",
|
43
|
+
"lock_with": "CONTENTS['alice_contract_secret']",
|
44
|
+
"unlock_with": "CONTENTS['alice_contract_secret']",
|
45
|
+
"contents": ""
|
46
|
+
},
|
47
|
+
|
48
|
+
"bob_decryption_key":{
|
49
|
+
"description":"private key for asymmetric decryption",
|
50
|
+
"fill_with": "DECRYPTION_KEY",
|
51
|
+
"lock_with": "CONTENTS['bob_contract_secret']",
|
52
|
+
"unlock_with": "CONTENTS['bob_contract_secret']",
|
53
|
+
"contents": ""
|
54
|
+
},
|
55
|
+
|
56
|
+
"congratulations_message":{
|
57
|
+
"description":"A simple message for Bob to put in the final vault",
|
58
|
+
"fill_with": "EXTERNAL_DATA",
|
59
|
+
"lock_with": "CONTENTS['bob_contract_secret']",
|
60
|
+
"unlock_with": "CONTENTS['bob_contract_secret']",
|
61
|
+
"contents": ""
|
62
|
+
},
|
63
|
+
|
64
|
+
"vault_two_key":{
|
65
|
+
"description":"Key to lock vault two. Once Bob locks the second vault he will put this key inside vault one.",
|
66
|
+
"fill_with": "RANDOM_NUMBER",
|
67
|
+
"lock_with": "CONTENTS['bob_contract_secret']",
|
68
|
+
"unlock_with": "CONTENTS['bob_contract_secret']",
|
69
|
+
"contents": ""
|
70
|
+
},
|
71
|
+
|
72
|
+
"vault_three_key":{
|
73
|
+
"description":"Key to lock vault three. Once Bob locks the third vault he will put this key inside vault two.",
|
74
|
+
"fill_with": "RANDOM_NUMBER",
|
75
|
+
"lock_with": "CONTENTS['bob_contract_secret']",
|
76
|
+
"unlock_with": "CONTENTS['bob_contract_secret']",
|
77
|
+
"contents": ""
|
78
|
+
},
|
79
|
+
|
80
|
+
"first":{
|
81
|
+
"description":"This is an asymmetric vault with mutual authentication. It contains the key to vault two and is locked by Bob, with Alices public key. Only Alice can unlock it.",
|
82
|
+
"fill_with": "CONTENTS['vault_two_key']",
|
83
|
+
"lock_with": "SHARED_KEY['alice_public_encryption_key','bob_decryption_key']",
|
84
|
+
"unlock_with": "SHARED_KEY['bob_public_encryption_key','alice_decryption_key']",
|
85
|
+
"contents": ""
|
86
|
+
},
|
87
|
+
|
88
|
+
"second":{
|
89
|
+
"description":"Alice unlocks this vault with the key held in the first vault.",
|
90
|
+
"fill_with": "CONTENTS['vault_three_key']",
|
91
|
+
"lock_with": "CONTENTS['vault_two_key']",
|
92
|
+
"unlock_with": "CONTENTS['first']",
|
93
|
+
"contents": ""
|
94
|
+
},
|
95
|
+
|
96
|
+
"third":{
|
97
|
+
"description":"Contains a simple message. Unlock the key found in the second vault.",
|
98
|
+
"fill_with": "CONTENTS['congratulations_message']",
|
99
|
+
"lock_with": "CONTENTS['vault_three_key']",
|
100
|
+
"unlock_with": "CONTENTS['second']",
|
101
|
+
"contents": ""
|
102
|
+
},
|
103
|
+
|
104
|
+
"sender_btc_signing_key":{
|
105
|
+
"description":"This is the secret Bitcoin Signing Key that SENDER wishes to transfer to RECEIVER. The RECEIVER can unlock only after he has the revealed address.",
|
106
|
+
"fill_with": "EXTERNAL_DATA",
|
107
|
+
"lock_with": "CONTENTS['sender_concealed_destination_wallet_address']",
|
108
|
+
"unlock_with": "CONTENTS['receiver_revealed_destination_wallet_address']",
|
109
|
+
"contents": ""
|
110
|
+
},
|
111
|
+
|
112
|
+
"sender_origin_wallet_address":{
|
113
|
+
"description":"SENDER origin wallet address. Chosen by SENDER and known in advance to RECEIVER.",
|
114
|
+
"fill_with": "EXTERNAL_DATA",
|
115
|
+
"lock_with": "UNLOCKED",
|
116
|
+
"unlock_with": "UNLOCKED",
|
117
|
+
"contents": ""
|
118
|
+
},
|
119
|
+
|
120
|
+
"sender_concealed_destination_wallet_address":{
|
121
|
+
"description":"SENDER concealed copy of the destination wallet address. This wallet address is kept secret until SENDER chosed to transfer BTC to it",
|
122
|
+
"fill_with": "EXTERNAL_DATA",
|
123
|
+
"lock_with": "CONTENTS['sender_secret']",
|
124
|
+
"unlock_with": "CONTENTS['sender_secret']",
|
125
|
+
"contents": ""
|
126
|
+
},
|
127
|
+
|
128
|
+
"receiver_revealed_destination_wallet_address":{
|
129
|
+
"description":"RECEIVER monitors the Block Chain and fills this vault with the newly revealied destination address.",
|
130
|
+
"fill_with": "EXTERNAL_DATA",
|
131
|
+
"lock_with": "CONTENTS['receiver_secret']",
|
132
|
+
"unlock_with": "CONTENTS['receiver_secret']",
|
133
|
+
"contents": ""
|
134
|
+
},
|
135
|
+
|
136
|
+
"receiver_secret":{
|
137
|
+
"fill_with": "RANDOM_NUMBER",
|
138
|
+
"lock_with": "MASTER_PASSPHRASE",
|
139
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
140
|
+
"contents": ""
|
141
|
+
},
|
142
|
+
|
143
|
+
"sender_secret":{
|
144
|
+
"description":"Contract specific password for SENDER. Used to Lock the SENDER private information.",
|
145
|
+
"fill_with": "RANDOM_NUMBER",
|
146
|
+
"lock_with": "MASTER_PASSPHRASE",
|
147
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
148
|
+
"contents": ""
|
149
|
+
},
|
150
|
+
|
151
|
+
|
152
|
+
"message":{
|
153
|
+
"description":"Vault with a simple message.",
|
154
|
+
"fill_with": "EXTERNAL_DATA",
|
155
|
+
"lock_with": "MASTER_PASSPHRASE",
|
156
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
157
|
+
"contents": ""
|
158
|
+
},
|
159
|
+
|
160
|
+
"random_vault_key":{
|
161
|
+
"description":"Random Number",
|
162
|
+
"fill_with": "RANDOM_NUMBER",
|
163
|
+
"lock_with": "MASTER_PASSPHRASE",
|
164
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
165
|
+
"contents": ""
|
166
|
+
},
|
167
|
+
|
168
|
+
"message_locked_with_random":{
|
169
|
+
"description":"A simple message locked with a random number",
|
170
|
+
"fill_with": "EXTERNAL_DATA",
|
171
|
+
"lock_with": "CONTENTS['random_vault_key']",
|
172
|
+
"unlock_with": "CONTENTS['random_vault_key']",
|
173
|
+
"contents": ""
|
174
|
+
},
|
175
|
+
|
176
|
+
"message_locked_with_unlocked_random_number":{
|
177
|
+
"fill_with": "CONTENTS['message_locked_with_random']",
|
178
|
+
"lock_with": "CONTENTS['unlocked_random_key']",
|
179
|
+
"unlock_with": "CONTENTS['unlocked_random_key']",
|
180
|
+
"contents": ""
|
181
|
+
},
|
182
|
+
|
183
|
+
"unlocked_random_key":{
|
184
|
+
"description":"An unlocked random key",
|
185
|
+
"fill_with": "CONTENTS['random_vault_key']",
|
186
|
+
"lock_with": "UNLOCKED",
|
187
|
+
"unlock_with": "UNLOCKED",
|
188
|
+
"contents": ""
|
189
|
+
},
|
190
|
+
|
191
|
+
"another_decryption_key":{
|
192
|
+
"fill_with": "DECRYPTION_KEY",
|
193
|
+
"lock_with": "MASTER_PASSPHRASE",
|
194
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
195
|
+
"contents": ""
|
196
|
+
},
|
197
|
+
|
198
|
+
"another_public_key":{
|
199
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY['another_decryption_key']",
|
200
|
+
"lock_with": "UNLOCKED",
|
201
|
+
"unlock_with": "UNLOCKED",
|
202
|
+
"contents": ""
|
203
|
+
},
|
204
|
+
|
205
|
+
"my_decryption_key":{
|
206
|
+
"fill_with": "DECRYPTION_KEY",
|
207
|
+
"lock_with": "MASTER_PASSPHRASE",
|
208
|
+
"unlock_with": "MASTER_PASSPHRASE",
|
209
|
+
"contents": ""
|
210
|
+
},
|
211
|
+
|
212
|
+
"my_public_key":{
|
213
|
+
"fill_with": "PUBLIC_ENCRYPTION_KEY['my_decryption_key']",
|
214
|
+
"lock_with": "UNLOCKED",
|
215
|
+
"unlock_with": "UNLOCKED",
|
216
|
+
"contents": ""
|
217
|
+
},
|
218
|
+
|
219
|
+
"asymmetric_message":{
|
220
|
+
"fill_with": "EXTERNAL_DATA",
|
221
|
+
"lock_with": "SHARED_KEY['another_public_key','my_decryption_key']",
|
222
|
+
"unlock_with": "SHARED_KEY['my_public_key','another_decryption_key']",
|
223
|
+
"contents": ""
|
224
|
+
}
|
225
|
+
|
226
|
+
}
|
227
|
+
}
|