vault-tree 0.1.0 → 0.3.3

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.
Files changed (97) hide show
  1. data/.gitignore +7 -3
  2. data/CHANGE_LOG.md +15 -0
  3. data/Gemfile.lock +15 -5
  4. data/README.md +12 -15
  5. data/Rakefile +19 -4
  6. data/features/.nav +11 -0
  7. data/features/contracts/asymmetric_vault.feature +23 -0
  8. data/features/contracts/block_chain_key_transfer.feature +34 -0
  9. data/features/contracts/one_two_three.feature +22 -0
  10. data/features/contracts/readme.md +111 -0
  11. data/features/contracts_and_vaults.md +134 -0
  12. data/features/contributing_to_vault_tree.md +42 -0
  13. data/features/decision_tree.md +16 -0
  14. data/features/enforcement_problem.md +20 -0
  15. data/features/exceptions.feature +56 -5
  16. data/features/install_and_usage.md +57 -0
  17. data/features/keywords/assembled_shamir_key.feature +57 -0
  18. data/features/keywords/contents.feature +24 -0
  19. data/features/keywords/decryption_key.feature +10 -0
  20. data/features/keywords/dh_key.feature +56 -0
  21. data/features/keywords/external_data.feature +11 -0
  22. data/features/keywords/generated_shamir_key.feature +55 -0
  23. data/features/keywords/key.feature +38 -0
  24. data/features/keywords/master_passphrase.feature +68 -0
  25. data/features/keywords/public_encryption_key.feature +14 -0
  26. data/features/keywords/random_number.feature +44 -0
  27. data/features/keywords/readme.md +3 -0
  28. data/features/keywords/split_key.feature +54 -0
  29. data/features/keywords/unlocked.feature +51 -0
  30. data/features/manipulating_contracts.md +84 -0
  31. data/features/readme.md +6 -0
  32. data/features/steps/asymmetric_vault.steps.rb +41 -0
  33. data/features/steps/block_chain_key_transfer.steps.rb +43 -0
  34. data/features/steps/core.steps.rb +57 -104
  35. data/features/steps/exceptions.steps.rb +45 -1
  36. data/features/steps/one_two_three.steps.rb +57 -0
  37. data/features/steps/secret_sharing.steps.rb +36 -0
  38. data/features/support/contract_fixtures/asymmetric_vault.0.1.0.json +69 -0
  39. data/{spec/support/fixtures → features/support/contract_fixtures}/blank_simple_test_contract.json +0 -0
  40. data/features/support/contract_fixtures/block_chain_key_transfer.0.1.0.json +59 -0
  41. data/{spec/support/fixtures → features/support/contract_fixtures}/broken_contract.json +0 -0
  42. data/features/support/contract_fixtures/one_two_three.0.7.0.json +108 -0
  43. data/{spec/support/fixtures → features/support/contract_fixtures}/simple_test_contract.json +0 -0
  44. data/features/support/contract_fixtures/template.json +33 -0
  45. data/features/what_is_vault_tree.md +18 -0
  46. data/lib/vault-tree.rb +23 -6
  47. data/lib/vault-tree/contract/close_validator.rb +0 -7
  48. data/lib/vault-tree/contract/contract.rb +13 -2
  49. data/lib/vault-tree/contract/doorman.rb +22 -21
  50. data/lib/vault-tree/contract/vault.rb +18 -2
  51. data/lib/vault-tree/exceptions/exception_template.erb +0 -0
  52. data/lib/vault-tree/exceptions/failed_unlock_attempt.rb +6 -0
  53. data/lib/vault-tree/exceptions/vault_tree_exception.rb +18 -0
  54. data/lib/vault-tree/keywords/assembled_shamir_key.rb +44 -0
  55. data/lib/vault-tree/keywords/{vault_contents.rb → contents.rb} +0 -0
  56. data/lib/vault-tree/keywords/decryption_key.rb +1 -6
  57. data/lib/vault-tree/keywords/{shared_key.rb → dh_key.rb} +2 -2
  58. data/lib/vault-tree/keywords/external_data.rb +19 -0
  59. data/lib/vault-tree/keywords/generated_shamir_key.rb +57 -0
  60. data/lib/vault-tree/keywords/key.rb +13 -0
  61. data/lib/vault-tree/keywords/keyword_interpreter.rb +6 -6
  62. data/lib/vault-tree/keywords/public_encryption_key.rb +1 -5
  63. data/lib/vault-tree/keywords/random_number.rb +1 -1
  64. data/lib/vault-tree/keywords/split_key.rb +19 -0
  65. data/lib/vault-tree/keywords/unlocked.rb +1 -1
  66. data/lib/vault-tree/lock_smith.rb +182 -0
  67. data/lib/vault-tree/lock_smith/assembled_shamir_key.rb +64 -0
  68. data/lib/vault-tree/lock_smith/dh_key_pair.rb +10 -0
  69. data/lib/vault-tree/lock_smith/generated_shamir_key.rb +65 -0
  70. data/lib/vault-tree/lock_smith/split_key.rb +23 -0
  71. data/lib/vault-tree/{config/path_helpers.rb → path_helpers.rb} +26 -2
  72. data/lib/vault-tree/util/json.rb +1 -0
  73. data/lib/vault-tree/{config → util}/string.rb +1 -5
  74. data/lib/vault-tree/version.rb +1 -1
  75. data/spec/assembled_shamir_key_spec.rb +79 -0
  76. data/spec/generated_shamir_key_spec.rb +52 -0
  77. data/spec/lock_smith_spec.rb +90 -0
  78. data/spec/secret_sharing_spec.rb +43 -0
  79. data/support/scripts/libsodium_ubuntu.sh +1 -1
  80. data/vault-tree.gemspec +3 -2
  81. metadata +123 -41
  82. data/features/core.feature +0 -44
  83. data/lib/vault-tree/config/dependencies.rb +0 -4
  84. data/lib/vault-tree/config/lib.rb +0 -2
  85. data/lib/vault-tree/lock_smith/asymmetric_cipher.rb +0 -31
  86. data/lib/vault-tree/lock_smith/crypto_hash.rb +0 -11
  87. data/lib/vault-tree/lock_smith/digital_signature.rb +0 -32
  88. data/lib/vault-tree/lock_smith/encryption_key_pair.rb +0 -25
  89. data/lib/vault-tree/lock_smith/random_number.rb +0 -11
  90. data/lib/vault-tree/lock_smith/shared_key_pair.rb +0 -12
  91. data/lib/vault-tree/lock_smith/signing_key_pair.rb +0 -25
  92. data/lib/vault-tree/lock_smith/symmetric_cipher.rb +0 -25
  93. data/spec/app/locksmith/asymmetric_cipher_spec.rb +0 -25
  94. data/spec/app/locksmith/signing_key_pair_spec.rb +0 -22
  95. data/spec/spec_helper.rb +0 -5
  96. data/spec/support/fixtures/one_two_three-0.5.0.EXP.json +0 -105
  97. data/spec/support/fixtures/reference_contract.1.0.0.json +0 -227
@@ -0,0 +1,42 @@
1
+ ### Submitting a New Contract
2
+
3
+ The example contracts in this documentation are a small collection that have been assembled for illustrative purposes. We can learn from these simplified examples, and use them as the foundation for more complex _real world_ contracts.
4
+
5
+ I encourage **anyone** interested, to submit new and innovative contracts. Here are some items to keep in mind when you are ready to contribute:
6
+ * Vault Tree was designed so that smart people of all different backgrounds could design and execute contracts. Don't feel that you need to be a programmer to get started.
7
+ * Try to familiarize yourself with Github best practices. Do you best understand Pull Requests before you attempt to submit.
8
+
9
+ ### Design Opinions
10
+
11
+ Vault Tree was written to give contract authors a large amount of flexibilty. There are however some design constraints that were put in place to get the community off to a good start.
12
+
13
+ I'll update these in the coming months as we get some more experience writing simple contracts.
14
+ * The Vault Tree interpreter is stateless and always takes a contract as an input
15
+ * All external data required for contract execution must be provided to the interpreter by the run time that is invoking the API. For example, there are no plans for the interpreter to make any network requests or do file IO.
16
+
17
+ ##### Notes for Developers
18
+
19
+ * Let's practice strict [semantic versioning] in managing our contracts.
20
+ * Edit contracts with the help of an application like [js beatifier].
21
+ * Ensure proper JSON format with a tool like this [json parser].
22
+ * Changes to core contracts should produce clean Git diffs.
23
+
24
+ [lab]: https://github.com/VaultTree/contracts/tree/master/lab
25
+ [core]: https://github.com/VaultTree/contracts/tree/master/core
26
+ [Contracts Repository]: https://github.com/VaultTree/contracts
27
+ [JSON]: http://www.json.org
28
+ [Vault Tree Homepage]: http://www.vault-tree.org
29
+ [Vault Tree Project]: http://www.vault-tree.org
30
+ [semantic versioning]: http://semver.org
31
+ [js beatifier]: http://jsbeautifier.org
32
+ [json parser]: http://json.parser.online.fr
33
+ [json]: http://json.org
34
+
35
+ ##### Website Documentation
36
+
37
+ A few comments on documentation:
38
+
39
+ * The website documentation is generated from the `*.features/` and `*.md` files in this project.
40
+ * We will standardize on Github flavored markdown
41
+ * As you build contracts and solve problems please consider contributing back to the documentation. It's time consuming but extremely important for the life of the project.
42
+ * Respect the established file naming conventions. Docs are generated with a build tool that makes assumptions.
@@ -0,0 +1,16 @@
1
+ ### Contracts as Decision Trees
2
+
3
+ Contracts can be modeled as a [Decision Tree]. Intuitively this means that:
4
+
5
+ * The set of contract events and final outcomes for all parties involved can be represented as a [Directed Graph].
6
+ * Often, the graph will take the form of a [Tree].
7
+ * **Events** are represented as nodes in the graph, **Outcomes** are events that correspond to [Leaf Nodes].
8
+ * Once a contract has been **Negotiated**, contract execution proceeds down the graph beginning at the [Root Node].
9
+ * Edges in the graph correspond to real world conditions that must be met before making a valid trasition between two events.
10
+ * **Well Written** contracts, in the eyes of all parties, correspond to well structured graphs.
11
+
12
+ [Directed Graph]: http://en.wikipedia.org/wiki/Directed_graph
13
+ [Tree]: http://en.wikipedia.org/wiki/Tree_%28graph_theory%29
14
+ [Decision Tree]: http://en.wikipedia.org/wiki/Decision_tree
15
+ [Leaf Nodes]: http://en.wikipedia.org/wiki/Tree_%28data_structure%29#Terminology
16
+ [Root Node]: http://en.wikipedia.org/wiki/Tree_%28data_structure%29#Terminology
@@ -0,0 +1,20 @@
1
+ Contracts become pointless if their terms cannot be effectly **enforced**. This enforcement problem is handled differently depenending on the nature of the contract and the parties involved.
2
+
3
+ One of the most primative, widespread, and **decentalized** enforcement mechanisms in the world is the **Network of Trust**. Breach of contract, even if no legal action is taken, undermines the reputation of of the offending party. This can translate into substantial costs and acts as an incentive toward honorable conduct.
4
+
5
+ In many cases however, a network of trust is an insufficient mechanism. When parties expect a more explict enforcement of their contract, they often turn to **centralized** solutions. Examples could include:
6
+ * Legal action within a justice system
7
+ * Private third party arbitration
8
+
9
+ This type of enforcement works well when the central enforcing authority is:
10
+ * Agreed to by all contract participants
11
+ * Competent and Efficient
12
+ * Trustworthy
13
+
14
+ Centralized enforcement is less effective or impossible when:
15
+ * Participants are distributed globally
16
+ * Business is conducted with a cutting edge internet finacial system that is ahead of established legal precedent
17
+ * Good people are are trying to conduct honorable business under extremely corrupt or incompetent legal systems
18
+
19
+
20
+
@@ -10,15 +10,48 @@ Scenario: Attempted Fill with Master Password
10
10
  When I attempt fill a vault with my Master Password
11
11
  Then a FillAttemptMasterPassword exception is raised
12
12
 
13
- Scenario: Missing External Data
13
+ Scenario: Missing External Data On Vault Fill
14
14
  Given the broken contract
15
15
  When I attempt fill a vault with External Data that does not exists
16
16
  Then a MissingExternalData exception is raised
17
17
 
18
- Scenario: Missing Passphrase
19
- Given a valid blank contract
20
- When I attempt fill a vault without providing a master passphrase
21
- Then a MissingPassphrase exception is raised
18
+ Scenario: Missing External Data On Lock
19
+ Given this broken contract:
20
+ """javascript
21
+ {
22
+ "header": {},
23
+ "vaults": {
24
+ "missing_external_data_vault":{
25
+ "fill_with": "EXTERNAL_DATA",
26
+ "lock_with": "UNLOCKED",
27
+ "unlock_with": "UNLOCKED",
28
+ "contents": ""
29
+ }
30
+ }
31
+ }
32
+ """
33
+ When I attempt lock a vault with External Data that does not exists
34
+ Then a MissingExternalData exception is raised
35
+
36
+ Scenario: Missing External Data On Unlock
37
+ Given this broken contract:
38
+ """javascript
39
+ {
40
+ "header": {},
41
+ "vaults": {
42
+ "missing_external_data_vault":{
43
+ "description": "The external data is not provided in the initialzer. See the step definitions in this case.",
44
+ "fill_with": "RANDOM_NUMBER",
45
+ "lock_with": "RANDOM_NUMBER",
46
+ "unlock_with": "EXTERNAL_DATA",
47
+ "contents": ""
48
+ }
49
+ }
50
+ }
51
+ """
52
+ When I lock the data away
53
+ And I attempt to unlock a vault with External Data that does not exists
54
+ Then a MissingExternalData exception is raised
22
55
 
23
56
  Scenario: Unsupported Keyword
24
57
  Given the broken contract
@@ -39,3 +72,21 @@ Scenario: Missing Partner Decryption Key
39
72
  Given the broken contract
40
73
  When I attempt to fill with an encryption key without first establishing the decryption key
41
74
  Then a MissingPartnerDecryptionKey exception is raised
75
+
76
+ Scenario: Failed Symmetric Unlock Attempt
77
+ Given this broken contract:
78
+ """javascript
79
+ {
80
+ "header": {},
81
+ "vaults": {
82
+ "missing_external_data_vault":{
83
+ "fill_with": "RANDOM_NUMBER",
84
+ "lock_with": "EXTERNAL_DATA",
85
+ "unlock_with": "EXTERNAL_DATA",
86
+ "contents": ""
87
+ }
88
+ }
89
+ }
90
+ """
91
+ When I lock a vault with External Data and attempt to unlock with the wrong External Data
92
+ Then a FailedUnlockAttempt exception is raised
@@ -0,0 +1,57 @@
1
+ Make sure you checkout the README in the [Github Repo] for the full install documentation.
2
+
3
+ [Github Repo]: https://github.com/VaultTree/vault-tree
4
+
5
+ ### Install With Vagrant
6
+
7
+ I think it should be easy for you to get a Vault Tree development environment up and running. If you don't know about Vagrant, you should, it's awesome!
8
+
9
+ * Follow the [Vagrant] download and install steps
10
+ * Clone the Vault Tree Repo and go into it:
11
+
12
+ [Vagrant]: http://www.vagrantup.com/
13
+
14
+ ```shell
15
+ git clone git@github.com:VaultTree/vault-tree.git
16
+ cd ~/path/to/vault-tree/
17
+ ```
18
+
19
+ Now you just need to Vagrant Up!
20
+
21
+ ```shell
22
+ vagrant up
23
+ ```
24
+
25
+ This will download and boot a pre-packaged Linux virtual machine with Vault-Tree and all dependencies already installed.
26
+
27
+ Once your VM is downloaded and built. You can go inside with:
28
+
29
+ ```shell
30
+ vagrant ssh
31
+ ```
32
+
33
+ As a developer working on Vault Tree you can now go to the VM's directory:
34
+
35
+ ```
36
+ /vagrant
37
+ ```
38
+ and run
39
+
40
+ ```
41
+ bundle
42
+ rake
43
+ ```
44
+
45
+ This will pull down the latest version of the code from [Ruby Gems] and then run all the core contracts and put you in a good spot to start exploring the library.
46
+
47
+ If you're not already familiar, take a few minutes to learn about how Vagrant will [sync your files] to and from the guest machine.
48
+
49
+ [vault-tree]: https://github.com/VaultTree/vault-tree
50
+ [main repo]: https://github.com/VaultTree/vault-tree
51
+ [Ruby Gems]: http://rubygems.org
52
+
53
+ ### Install With Bundler
54
+
55
+ If you are comfortable with Ruby and Bundler checkout the README in the [main repo] to get started with a direct install.
56
+
57
+ [main repo]: https://github.com/VaultTree/vault-tree
@@ -0,0 +1,57 @@
1
+ Feature: Assembled Shamir Key
2
+
3
+ Scenario: Lock with Generated Key. Unlock with Assembled Shamir Key
4
+ Given the blank contract:
5
+ """javascript
6
+ {
7
+ "header": {},
8
+ "vaults": {
9
+ "s_1":{
10
+ "fill_with": "EXTERNAL_DATA",
11
+ "lock_with": "UNLOCKED",
12
+ "unlock_with": "UNLOCKED",
13
+ "contents": ""
14
+ },
15
+
16
+ "s_2":{
17
+ "fill_with": "EXTERNAL_DATA",
18
+ "lock_with": "UNLOCKED",
19
+ "unlock_with": "UNLOCKED",
20
+ "contents": ""
21
+ },
22
+
23
+ "s_3":{
24
+ "fill_with": "EXTERNAL_DATA",
25
+ "lock_with": "UNLOCKED",
26
+ "unlock_with": "UNLOCKED",
27
+ "contents": ""
28
+ },
29
+
30
+ "s_4":{
31
+ "fill_with": "EXTERNAL_DATA",
32
+ "lock_with": "UNLOCKED",
33
+ "unlock_with": "UNLOCKED",
34
+ "contents": ""
35
+ },
36
+
37
+ "s_5":{
38
+ "fill_with": "EXTERNAL_DATA",
39
+ "lock_with": "UNLOCKED",
40
+ "unlock_with": "UNLOCKED",
41
+ "contents": ""
42
+ },
43
+
44
+ "message":{
45
+ "fill_with": "EXTERNAL_DATA",
46
+ "lock_with": "GENERATED_SHAMIR_KEY['5','3','s_1','s_2','s_3','s_4','s_5']",
47
+ "unlock_with": "ASSEMBLED_SHAMIR_KEY['s_1','s_2','s_3','s_4','s_5']",
48
+ "contents": ""
49
+ }
50
+ }
51
+ }
52
+ """
53
+ And I create a new message
54
+ When I attempt to lock the message with a generated shamir key
55
+ Then key shares are created and locked away in their cooresponding vaults
56
+ When I attempt to unlock the message with the assembled shamir key
57
+ Then I successfully gather the locked shares and unlock the message
@@ -0,0 +1,24 @@
1
+ Feature: Contents
2
+
3
+ The `CONTENTS` keyword is used to fetch the contents of another vault:
4
+
5
+ ```javascript
6
+ "fill_with": "CONTENTS['some_string']"
7
+ ```
8
+
9
+ It takes one argument, the name of the vault holding the desired contents.
10
+
11
+ The contents keyword should only be used in the **fill_with** field. If you want to use it in either
12
+
13
+ the **lock_with** or **unlock_with** fields, you should consider the alias `KEY` instead.
14
+
15
+ Here is an example of a vault that makes use of the `CONTENTS` keyword.
16
+
17
+ ```javascript
18
+ "locked_message":{
19
+ "fill_with": "CONTENTS['message_locked_with_random_key']",
20
+ "lock_with": "KEY['unlocked_random_key']",
21
+ "unlock_with": "KEY['unlocked_random_key']",
22
+ "contents": ""
23
+ }
24
+ ```
@@ -0,0 +1,10 @@
1
+ Feature: Decryption Key
2
+
3
+ Decryption keys are asymmetric private keys.
4
+
5
+ ```javascript
6
+ "fill_with": "DECRYPTION_KEY",
7
+ ```
8
+
9
+ When establishing a public private key pair, you need to generate the decryption
10
+ key first and reference its vault when building the associated public key.
@@ -0,0 +1,56 @@
1
+ Feature: DH Key
2
+
3
+ ```javascript
4
+ DH_KEY['public_key_vault_id','decryption_key_vault_id']
5
+ ```
6
+ This keyword enables the creation of **Asymmetric Vaults**.
7
+
8
+ DH Keys are very powerful and Vault Tree is written to encourage contract authors to make use of asymmetric encryption.
9
+
10
+ The underlying cryptographic library provides a set of expertly crafted opinionated conventions for using public keys. One such convention is [Mutual Authentication](http://en.wikipedia.org/wiki/Mutual_authentication) accomplished with the Elliptic Curve Diffie-Hellman key exchange protocol.
11
+
12
+ Feel free to study the example contracts for some good ideas on how to use this powerful keyword.
13
+
14
+ Scenario: Asymmetric Vault
15
+ Given the blank contract:
16
+ """javascript
17
+ {
18
+ "header": {},
19
+ "vaults": {
20
+ "asymmetric_message":{
21
+ "fill_with": "EXTERNAL_DATA",
22
+ "lock_with": "DH_KEY['another_public_key','my_decryption_key']",
23
+ "unlock_with": "DH_KEY['my_public_key','another_decryption_key']",
24
+ "contents": ""
25
+ },
26
+ "my_decryption_key":{
27
+ "fill_with": "DECRYPTION_KEY",
28
+ "lock_with": "MASTER_PASSPHRASE",
29
+ "unlock_with": "MASTER_PASSPHRASE",
30
+ "contents": ""
31
+ },
32
+ "my_public_key":{
33
+ "fill_with": "PUBLIC_ENCRYPTION_KEY['my_decryption_key']",
34
+ "lock_with": "UNLOCKED",
35
+ "unlock_with": "UNLOCKED",
36
+ "contents": ""
37
+ },
38
+ "another_decryption_key":{
39
+ "fill_with": "DECRYPTION_KEY",
40
+ "lock_with": "MASTER_PASSPHRASE",
41
+ "unlock_with": "MASTER_PASSPHRASE",
42
+ "contents": ""
43
+ },
44
+ "another_public_key":{
45
+ "fill_with": "PUBLIC_ENCRYPTION_KEY['another_decryption_key']",
46
+ "lock_with": "UNLOCKED",
47
+ "unlock_with": "UNLOCKED",
48
+ "contents": ""
49
+ }
50
+ }
51
+ }
52
+ """
53
+ And I have access to the another user's unlocked public key
54
+ And I lock a simple message with a DH Key
55
+ When I transfer the contract to the other user
56
+ Then they can create a DH Key and unlock the message
@@ -0,0 +1,11 @@
1
+ Feature: External Data
2
+
3
+ The Vault Tree interpreter does not interact directly with outside networks. Its
4
+ repsonsibility is limited to opening and closing vaults under the assumption
5
+ that all necessary external data will be explicitly passed in.
6
+
7
+ In short, you can expect the interpreter to stick to the following rules:
8
+
9
+ * External Data is relevent only when **closing** a vault.
10
+ * When a vault is being opened, the interpreter expects that all the necessary data has already been locked somewhere in the contract.
11
+ * External Data must be a string
@@ -0,0 +1,55 @@
1
+ Feature: Generated Shamir Key
2
+
3
+ Scenario: Lock Away Key Shares With Generated Shamir Key
4
+ Given the blank contract:
5
+ """javascript
6
+ {
7
+ "header": {},
8
+ "vaults": {
9
+ "s_1":{
10
+ "fill_with": "EXTERNAL_DATA",
11
+ "lock_with": "UNLOCKED",
12
+ "unlock_with": "UNLOCKED",
13
+ "contents": ""
14
+ },
15
+
16
+ "s_2":{
17
+ "fill_with": "EXTERNAL_DATA",
18
+ "lock_with": "UNLOCKED",
19
+ "unlock_with": "UNLOCKED",
20
+ "contents": ""
21
+ },
22
+
23
+ "s_3":{
24
+ "fill_with": "EXTERNAL_DATA",
25
+ "lock_with": "UNLOCKED",
26
+ "unlock_with": "UNLOCKED",
27
+ "contents": ""
28
+ },
29
+
30
+ "s_4":{
31
+ "fill_with": "EXTERNAL_DATA",
32
+ "lock_with": "UNLOCKED",
33
+ "unlock_with": "UNLOCKED",
34
+ "contents": ""
35
+ },
36
+
37
+ "s_5":{
38
+ "fill_with": "EXTERNAL_DATA",
39
+ "lock_with": "UNLOCKED",
40
+ "unlock_with": "UNLOCKED",
41
+ "contents": ""
42
+ },
43
+
44
+ "message":{
45
+ "fill_with": "EXTERNAL_DATA",
46
+ "lock_with": "GENERATED_SHAMIR_KEY['5','3','s_1','s_2','s_3','s_4','s_5']",
47
+ "unlock_with": "ASSEMBLED_SHAMIR_KEY['s_1','s_2','s_3','s_4','s_5']",
48
+ "contents": ""
49
+ }
50
+ }
51
+ }
52
+ """
53
+ And I create a new message
54
+ When I attempt to lock the message with a generated shamir key
55
+ Then key shares are created and locked away in their cooresponding vaults
@@ -0,0 +1,38 @@
1
+ Feature: Key
2
+
3
+ This keyword is an alias of the the `CONTENTS` keyword:
4
+
5
+ ```javascript
6
+ KEY['vault_id']
7
+ ```
8
+
9
+ Note that:
10
+ * It should be used specifically when the contents are a Symmetric vault key.
11
+ * It takes one argument, the name of the vault holding the desired string.
12
+ * The `KEY` keyword can be used in the **fill_with**, **lock_with** and **unlock_with** fields.
13
+
14
+ Scenario: Close And Open Using with a Key
15
+ Given the blank contract:
16
+ """javascript
17
+ {
18
+ "header": {},
19
+ "vaults": {
20
+ "random_vault_key":{
21
+ "description":"Random Number",
22
+ "fill_with": "RANDOM_NUMBER",
23
+ "lock_with": "MASTER_PASSPHRASE",
24
+ "unlock_with": "MASTER_PASSPHRASE",
25
+ "contents": ""
26
+ },
27
+ "message":{
28
+ "description": "Simple Congratulations Message",
29
+ "fill_with": "EXTERNAL_DATA",
30
+ "lock_with": "KEY['random_vault_key']",
31
+ "unlock_with": "KEY['random_vault_key']",
32
+ "contents": ""
33
+ }
34
+ }
35
+ }
36
+ """
37
+ When I lock a message in a vault using a symmetric vault key
38
+ Then I can recover the message using the same key