trustworthy 0.3.2 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e42d985518ef469697ee1454988f9e2b8ff259fc
4
- data.tar.gz: e0313923ab5df072cd1c79e4b7776348ee0876ad
3
+ metadata.gz: 6163419b9bd1c5182869f67d2aae6729a17902c7
4
+ data.tar.gz: 36cf221396e73c5c21a120d16960aa3c0c51330c
5
5
  SHA512:
6
- metadata.gz: 1bd3eb61ba0642ef2c0ddef733b4cc2f53c04bfd027a2a6d6f1e8562b27caf778dba100495e6e80998a2257e6b4da15c08be8ff9ef057269827aa0933b33872b
7
- data.tar.gz: a330f89c54ce12a6b8eb8500d1b5dc00f3502b1293d37500fbb2e9f659fc270fd320b3a51b1e76ddbc9c370c74eaa99074eb118e07d0ad93338067f37cd3e623
6
+ metadata.gz: f358807df4c238f84f30efa2f61cf8a1940cef345ce6e506965aac2cf3b922050101f7e33a77d84bdbf78af717a92b9e822e6ce8ec62524bdb13cc44bd276f3e
7
+ data.tar.gz: bd8fe45b4dc039201e1155462f609837e633e5ac0326764a19ad5f22988c8d8302ec264ddb586f210b23cbf442a3a52a16bd7f651006b1bb4159cba7d229470d
data/README.md CHANGED
@@ -20,13 +20,13 @@ The master key will be loaded so that a new user key can be added to the configu
20
20
 
21
21
  ### Encrypt a file
22
22
 
23
- trustworthy encrypt -i foo.txt -o foo.txt.tw
23
+ trustworthy encrypt foo.txt
24
24
 
25
25
  The master key will be loaded and then used to encrypt the file specified.
26
26
 
27
27
  ### Decrypt a file
28
28
 
29
- trustworthy decrypt -i foo.txt.tw -o foo.txt
29
+ trustworthy decrypt foo.txt.tw
30
30
 
31
31
  Decrypting works similar to encrypting, first the master key will be loaded and then used to decrypt the file.
32
32
 
@@ -6,15 +6,13 @@ module Trustworthy
6
6
  end
7
7
 
8
8
  def parse_options(args)
9
- super(_command, args) do |opts, options|
10
- opts.on('-i', '--input FILE', "File to #{_command}") do |file|
11
- options[:input_file] = file
12
- end
13
-
9
+ options = super(_command, args) do |opts, options|
14
10
  opts.on('-o', '--output FILE', "File to write #{_command}ed contents to") do |file|
15
11
  options[:output_file] = file
16
12
  end
17
13
  end
14
+ options[:input_file] = args.shift
15
+ options
18
16
  end
19
17
 
20
18
  def run(args)
@@ -33,7 +31,7 @@ module Trustworthy
33
31
 
34
32
  def _check_options(args)
35
33
  options = parse_options(args)
36
- unless options.has_key?(:input_file) && options.has_key?(:output_file)
34
+ unless options[:input_file] && options[:output_file]
37
35
  print_help
38
36
  throw :error
39
37
  end
@@ -5,7 +5,15 @@ module Trustworthy
5
5
  include Trustworthy::CLI::Crypt
6
6
 
7
7
  def self._command
8
- 'decrypt'
8
+ 'decrypt filename'
9
+ end
10
+
11
+ def parse_options(args)
12
+ options = super(args)
13
+ if options[:input_file].to_s.end_with?('.tw') && !options.has_key?(:output_file)
14
+ options[:output_file] = File.basename(options[:input_file], '.tw')
15
+ end
16
+ options
9
17
  end
10
18
 
11
19
  def _transform(prompt, options, input_file)
@@ -5,7 +5,15 @@ module Trustworthy
5
5
  include Trustworthy::CLI::Crypt
6
6
 
7
7
  def self._command
8
- 'encrypt'
8
+ 'encrypt filename'
9
+ end
10
+
11
+ def parse_options(args)
12
+ options = super(args)
13
+ unless options.has_key?(:output_file)
14
+ options[:output_file] = "#{options[:input_file]}.tw"
15
+ end
16
+ options
9
17
  end
10
18
 
11
19
  def _transform(prompt, options, input_file)
@@ -1,3 +1,3 @@
1
1
  module Trustworthy
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -29,9 +29,9 @@ describe Trustworthy::CLI::AddKey do
29
29
 
30
30
  contents = File.read(TestValues::SettingsFile)
31
31
  subkeys = YAML.load(contents)
32
- subkeys.should have_key('user1')
33
- subkeys.should have_key('user2')
34
- subkeys.should have_key('user3')
32
+ expect(subkeys).to have_key('user1')
33
+ expect(subkeys).to have_key('user2')
34
+ expect(subkeys).to have_key('user3')
35
35
  end
36
36
  end
37
37
  end
@@ -8,7 +8,8 @@ describe Trustworthy::CLI::Decrypt do
8
8
  around(:each) do |example|
9
9
  within_construct do |construct|
10
10
  construct.file(TestValues::SettingsFile)
11
- construct.file('input.txt', TestValues::EncryptedFile)
11
+ construct.file('input.txt.tw', TestValues::EncryptedFile)
12
+ construct.file('input.txt')
12
13
  construct.file('output.txt')
13
14
  create_config(TestValues::SettingsFile)
14
15
  example.run
@@ -23,11 +24,14 @@ describe Trustworthy::CLI::Decrypt do
23
24
  'user2',
24
25
  'password2'
25
26
  ) do
26
- Trustworthy::CLI::Decrypt.new.run(['-i', 'input.txt', '-o', 'output.txt'])
27
+ Trustworthy::CLI::Decrypt.new.run(['input.txt.tw'])
27
28
  end
28
29
 
30
+ plaintext = File.read('input.txt')
31
+ expect(plaintext).to eq(TestValues::Plaintext)
32
+
29
33
  plaintext = File.read('output.txt')
30
- plaintext.should == TestValues::Plaintext
34
+ expect(plaintext).to be_empty
31
35
  end
32
36
 
33
37
  it 'should require an input file' do
@@ -38,12 +42,12 @@ describe Trustworthy::CLI::Decrypt do
38
42
  'password2'
39
43
  ) do
40
44
  decrypt = Trustworthy::CLI::Decrypt.new
41
- decrypt.should_receive(:print_help)
45
+ expect(decrypt).to receive(:print_help)
42
46
  decrypt.run([])
43
47
  end
44
48
  end
45
49
 
46
- it 'should require an output file' do
50
+ it 'should require an output file if input does not end in .tw' do
47
51
  HighLine::Simulate.with(
48
52
  'user1',
49
53
  'password1',
@@ -51,19 +55,36 @@ describe Trustworthy::CLI::Decrypt do
51
55
  'password2'
52
56
  ) do
53
57
  decrypt = Trustworthy::CLI::Decrypt.new
54
- decrypt.should_receive(:print_help)
55
- decrypt.run(['-i', 'input.txt'])
58
+ expect(decrypt).to receive(:print_help)
59
+ decrypt.run(['input.txt'])
56
60
  end
57
61
  end
58
62
 
63
+ it 'should take an optional output file' do
64
+ HighLine::Simulate.with(
65
+ 'user1',
66
+ 'password1',
67
+ 'user2',
68
+ 'password2'
69
+ ) do
70
+ Trustworthy::CLI::Decrypt.new.run(['input.txt.tw', '-o', 'output.txt'])
71
+ end
72
+
73
+ plaintext = File.read('output.txt')
74
+ expect(plaintext).to eq(TestValues::Plaintext)
75
+
76
+ plaintext = File.read('input.txt')
77
+ expect(plaintext).to be_empty
78
+ end
79
+
59
80
  it 'should error on non-trustworthy input files' do
60
- File.open('input.txt', 'w+') do |file|
81
+ File.open('input.txt.tw', 'w+') do |file|
61
82
  file.write('bad file')
62
83
  end
63
84
 
64
85
  decrypt = Trustworthy::CLI::Decrypt.new
65
- decrypt.should_receive(:say).with('File input.txt does not appear to be a trustworthy encrypted file')
66
- decrypt.run(['-i', 'input.txt', '-o', 'output.txt'])
86
+ expect(decrypt).to receive(:say).with('File input.txt.tw does not appear to be a trustworthy encrypted file')
87
+ decrypt.run(['input.txt.tw'])
67
88
  end
68
89
  end
69
90
  end
@@ -10,6 +10,7 @@ describe Trustworthy::CLI::Encrypt do
10
10
  within_construct do |construct|
11
11
  construct.file(TestValues::SettingsFile)
12
12
  construct.file('input.txt', TestValues::Plaintext)
13
+ construct.file('input.txt.tw')
13
14
  construct.file('output.txt')
14
15
  create_config(TestValues::SettingsFile)
15
16
  example.run
@@ -24,11 +25,14 @@ describe Trustworthy::CLI::Encrypt do
24
25
  'user2',
25
26
  'password2'
26
27
  ) do
27
- Trustworthy::CLI::Encrypt.new.run(['-i', 'input.txt', '-o', 'output.txt'])
28
+ Trustworthy::CLI::Encrypt.new.run(['input.txt'])
28
29
  end
29
30
 
31
+ ciphertext = File.read('input.txt.tw')
32
+ expect(ciphertext).to eq(TestValues::EncryptedFile)
33
+
30
34
  ciphertext = File.read('output.txt')
31
- ciphertext.should == TestValues::EncryptedFile
35
+ expect(ciphertext).to be_empty
32
36
  end
33
37
 
34
38
  it 'should require an input file' do
@@ -39,22 +43,26 @@ describe Trustworthy::CLI::Encrypt do
39
43
  'password2'
40
44
  ) do
41
45
  encrypt = Trustworthy::CLI::Encrypt.new
42
- encrypt.should_receive(:print_help)
46
+ expect(encrypt).to receive(:print_help)
43
47
  encrypt.run([])
44
48
  end
45
49
  end
46
50
 
47
- it 'should require an output file' do
51
+ it 'should allow a named output file' do
48
52
  HighLine::Simulate.with(
49
53
  'user1',
50
54
  'password1',
51
55
  'user2',
52
56
  'password2'
53
57
  ) do
54
- encrypt = Trustworthy::CLI::Encrypt.new
55
- encrypt.should_receive(:print_help)
56
- encrypt.run(['-i', 'input.txt'])
58
+ Trustworthy::CLI::Encrypt.new.run(['input.txt', '-o', 'output.txt'])
57
59
  end
60
+
61
+ ciphertext = File.read('output.txt')
62
+ expect(ciphertext).to eq(TestValues::EncryptedFile)
63
+
64
+ ciphertext = File.read('input.txt.tw')
65
+ expect(ciphertext).to be_empty
58
66
  end
59
67
  end
60
68
  end
@@ -15,7 +15,7 @@ describe Trustworthy::CLI::Init do
15
15
  describe 'run' do
16
16
  it 'should not allow any previous keys to exist' do
17
17
  create_config(TestValues::SettingsFile)
18
- $terminal.should_receive(:say).with('Config trustworthy.yml already exists')
18
+ expect($terminal).to receive(:say).with('Config trustworthy.yml already exists')
19
19
  Trustworthy::CLI::Init.new.run([])
20
20
  end
21
21
 
@@ -33,8 +33,8 @@ describe Trustworthy::CLI::Init do
33
33
 
34
34
  contents = File.read(TestValues::SettingsFile)
35
35
  subkeys = YAML.load(contents)
36
- subkeys.should have_key('user1')
37
- subkeys.should have_key('user2')
36
+ expect(subkeys).to have_key('user1')
37
+ expect(subkeys).to have_key('user2')
38
38
  end
39
39
 
40
40
  it 'should write to a specified file' do
@@ -54,8 +54,8 @@ describe Trustworthy::CLI::Init do
54
54
 
55
55
  contents = File.read(filename)
56
56
  subkeys = YAML.load(contents)
57
- subkeys.should have_key('user1')
58
- subkeys.should have_key('user2')
57
+ expect(subkeys).to have_key('user1')
58
+ expect(subkeys).to have_key('user2')
59
59
  end
60
60
  end
61
61
 
@@ -76,14 +76,14 @@ describe Trustworthy::CLI::Init do
76
76
 
77
77
  contents = File.read(TestValues::SettingsFile)
78
78
  subkeys = YAML.load(contents)
79
- subkeys.should have_key('user1')
80
- subkeys.should have_key('user2')
81
- subkeys.should have_key('user3')
79
+ expect(subkeys).to have_key('user1')
80
+ expect(subkeys).to have_key('user2')
81
+ expect(subkeys).to have_key('user3')
82
82
  end
83
83
 
84
84
  it 'should require two subkeys minimum' do
85
85
  init = Trustworthy::CLI::Init.new
86
- init.should_receive(:print_help)
86
+ expect(init).to receive(:print_help)
87
87
  init.run(['-k', '1'])
88
88
  end
89
89
  end
@@ -5,15 +5,15 @@ describe Trustworthy::Key do
5
5
  it 'should create a key along the slope and intercept' do
6
6
  Trustworthy::Random.stub(:number).and_return(BigDecimal.new('10'))
7
7
  key = Trustworthy::Key.create(6, 24)
8
- key.y.should == 84
8
+ expect(key.y).to eq(84)
9
9
  end
10
10
  end
11
11
 
12
12
  describe 'self.create_from_string' do
13
13
  it 'should create a key from the string representation' do
14
14
  key = Trustworthy::Key.create_from_string('4.0,5.0')
15
- key.x.should == BigDecimal.new('4.0')
16
- key.y.should == BigDecimal.new('5.0')
15
+ expect(key.x).to eq(BigDecimal.new('4.0'))
16
+ expect(key.y).to eq(BigDecimal.new('5.0'))
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ describe Trustworthy::Key do
22
22
  x = BigDecimal.new('4')
23
23
  y = BigDecimal.new('5')
24
24
  key = Trustworthy::Key.new(x, y)
25
- key.to_s.should == '4.0,5.0'
25
+ expect(key.to_s).to eq('4.0,5.0')
26
26
  end
27
27
  end
28
28
  end
@@ -10,7 +10,7 @@ describe Trustworthy::MasterKey do
10
10
 
11
11
  new_master_key = Trustworthy::MasterKey.create_from_keys(key1, key2)
12
12
  plaintext = new_master_key.decrypt(ciphertext)
13
- plaintext.should == TestValues::Plaintext
13
+ expect(plaintext).to eq(TestValues::Plaintext)
14
14
  end
15
15
 
16
16
  it 'should function with any 2 of n keys' do
@@ -25,7 +25,7 @@ describe Trustworthy::MasterKey do
25
25
 
26
26
  master_key3 = Trustworthy::MasterKey.create_from_keys(key1, key3)
27
27
  plaintext = master_key3.decrypt(ciphertext)
28
- plaintext.should == TestValues::Plaintext
28
+ expect(plaintext).to eq(TestValues::Plaintext)
29
29
  end
30
30
 
31
31
  describe 'self.create' do
@@ -33,8 +33,8 @@ describe Trustworthy::MasterKey do
33
33
  Trustworthy::Random.stub(:number).and_return(BigDecimal.new('10'))
34
34
  master_key = Trustworthy::MasterKey.create
35
35
  key = master_key.create_key
36
- key.x.should == 10
37
- key.y.should == 110
36
+ expect(key.x).to eq(10)
37
+ expect(key.y).to eq(110)
38
38
  end
39
39
  end
40
40
 
@@ -47,8 +47,8 @@ describe Trustworthy::MasterKey do
47
47
 
48
48
  master_key = Trustworthy::MasterKey.create_from_keys(key1, key2)
49
49
  new_key = master_key.create_key
50
- new_key.x.should == 10
51
- new_key.y.should == 110
50
+ expect(new_key.x).to eq(10)
51
+ expect(new_key.y).to eq(110)
52
52
  end
53
53
  end
54
54
 
@@ -56,8 +56,8 @@ describe Trustworthy::MasterKey do
56
56
  it 'should define a new key' do
57
57
  master_key = Trustworthy::MasterKey.new(BigDecimal.new('6'), BigDecimal.new('24'))
58
58
  key = master_key.create_key
59
- key.x.should_not == 0
60
- key.y.should_not == 0
59
+ expect(key.x).to_not eq(0)
60
+ expect(key.y).to_not eq(0)
61
61
  end
62
62
  end
63
63
 
@@ -66,7 +66,7 @@ describe Trustworthy::MasterKey do
66
66
  AEAD::Cipher::AES_256_CBC_HMAC_SHA_256.stub(:generate_nonce).and_return(TestValues::InitializationVector)
67
67
  master_key = Trustworthy::MasterKey.new(BigDecimal.new('6'), BigDecimal.new('24'))
68
68
  ciphertext = master_key.encrypt(TestValues::Plaintext)
69
- ciphertext.should == TestValues::Ciphertext
69
+ expect(ciphertext).to eq(TestValues::Ciphertext)
70
70
  end
71
71
  end
72
72
 
@@ -74,7 +74,7 @@ describe Trustworthy::MasterKey do
74
74
  it 'should decrypt and verify the data using the intercept' do
75
75
  master_key = Trustworthy::MasterKey.new(BigDecimal.new('6'), BigDecimal.new('24'))
76
76
  plaintext = master_key.decrypt(TestValues::Ciphertext)
77
- plaintext.should == TestValues::Plaintext
77
+ expect(plaintext).to eq(TestValues::Plaintext)
78
78
  end
79
79
 
80
80
  it 'should raise an invalid signature error if signatures do not match' do
@@ -24,7 +24,7 @@ describe Trustworthy::Prompt do
24
24
  ) do
25
25
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
26
26
  username = prompt.add_user_key(test_key)
27
- username.should == 'user3'
27
+ expect(username).to eq('user3')
28
28
  end
29
29
  end
30
30
 
@@ -38,7 +38,7 @@ describe Trustworthy::Prompt do
38
38
  ) do
39
39
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
40
40
  username = prompt.add_user_key(test_key)
41
- username.should == 'user3'
41
+ expect(username).to eq('user3')
42
42
  end
43
43
  end
44
44
 
@@ -52,9 +52,9 @@ describe Trustworthy::Prompt do
52
52
  'password'
53
53
  ) do
54
54
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
55
- prompt.should_receive(:_error).with('Key user1 is already in use')
55
+ expect(prompt).to receive(:_error).with('Key user1 is already in use')
56
56
  username = prompt.add_user_key(test_key)
57
- username.should == 'user3'
57
+ expect(username).to eq('user3')
58
58
  end
59
59
  end
60
60
  end
@@ -69,7 +69,7 @@ describe Trustworthy::Prompt do
69
69
  ) do
70
70
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
71
71
  master_key = prompt.unlock_master_key
72
- master_key.should == TestValues::MasterKey
72
+ expect(master_key).to eq(TestValues::MasterKey)
73
73
  end
74
74
  end
75
75
 
@@ -81,7 +81,7 @@ describe Trustworthy::Prompt do
81
81
  expect do
82
82
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
83
83
  master_key = prompt.unlock_master_key
84
- master_key.should == TestValues::MasterKey
84
+ expect(master_key).to eq(TestValues::MasterKey)
85
85
  end.to raise_error('must have two keys to unlock master key')
86
86
  end
87
87
 
@@ -94,7 +94,7 @@ describe Trustworthy::Prompt do
94
94
  'password2'
95
95
  ) do
96
96
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
97
- prompt.should_receive(:_error).with('Key user1 is already in use')
97
+ expect(prompt).to receive(:_error).with('Key user1 is already in use')
98
98
  prompt.unlock_master_key
99
99
  end
100
100
  end
@@ -108,7 +108,7 @@ describe Trustworthy::Prompt do
108
108
  'password2'
109
109
  ) do
110
110
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
111
- prompt.should_receive(:_error).with('Key missing does not exist')
111
+ expect(prompt).to receive(:_error).with('Key missing does not exist')
112
112
  prompt.unlock_master_key
113
113
  end
114
114
  end
@@ -122,7 +122,7 @@ describe Trustworthy::Prompt do
122
122
  'password2'
123
123
  ) do
124
124
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
125
- prompt.should_receive(:_error).with('Key missing does not exist')
125
+ expect(prompt).to receive(:_error).with('Key missing does not exist')
126
126
  prompt.unlock_master_key
127
127
  end
128
128
  end
@@ -136,7 +136,7 @@ describe Trustworthy::Prompt do
136
136
  'password2'
137
137
  ) do
138
138
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
139
- prompt.should_receive(:_error).with('Password incorrect for user1')
139
+ expect(prompt).to receive(:_error).with('Password incorrect for user1')
140
140
  prompt.unlock_master_key
141
141
  end
142
142
  end
@@ -150,7 +150,7 @@ describe Trustworthy::Prompt do
150
150
  'password2'
151
151
  ) do
152
152
  prompt = Trustworthy::Prompt.new(TestValues::SettingsFile, $terminal)
153
- prompt.should_receive(:_error).with('Password incorrect for user2')
153
+ expect(prompt).to receive(:_error).with('Password incorrect for user2')
154
154
  prompt.unlock_master_key
155
155
  end
156
156
  end
@@ -4,25 +4,25 @@ describe Trustworthy::Random do
4
4
  describe 'self.number' do
5
5
  it 'should return a random number' do
6
6
  random = Trustworthy::Random.number
7
- random.should_not == Trustworthy::Random.number
7
+ expect(random).to_not eq(Trustworthy::Random.number)
8
8
  end
9
9
 
10
10
  it 'should return a number up to a given byte size' do
11
11
  random = Trustworthy::Random.number(2)
12
- random.should <= 2 ** 16
12
+ expect(random).to be <= 2 ** 16
13
13
  end
14
14
  end
15
15
 
16
16
  describe 'self.bytes' do
17
17
  it 'should return a string of the given length' do
18
18
  bytes = Trustworthy::Random.bytes(16)
19
- bytes.size.should == 16
19
+ expect(bytes.size).to eq(16)
20
20
  end
21
21
 
22
22
  it 'should return a random string' do
23
23
  bytes1 = Trustworthy::Random.bytes(16)
24
24
  bytes2 = Trustworthy::Random.bytes(16)
25
- bytes1.should_not == bytes2
25
+ expect(bytes1).to_not eq(bytes2)
26
26
  end
27
27
  end
28
28
  end
@@ -22,8 +22,8 @@ describe Trustworthy::Settings do
22
22
 
23
23
  Trustworthy::Settings.open(TestValues::SettingsFile) do |settings|
24
24
  found_key = settings.find_key('user')
25
- found_key['salt'].should == TestValues::Salt
26
- found_key['encrypted_point'].should == TestValues::EncryptedPoint
25
+ expect(found_key['salt']).to eq(TestValues::Salt)
26
+ expect(found_key['encrypted_point']).to eq(TestValues::EncryptedPoint)
27
27
  end
28
28
  end
29
29
 
@@ -43,10 +43,12 @@ describe Trustworthy::Settings do
43
43
  end.to raise_error
44
44
 
45
45
  Trustworthy::Settings.open(TestValues::SettingsFile) do |settings|
46
- settings.find_key('missing').should be_nil
46
+ missing_key = settings.find_key('missing')
47
+ expect(missing_key).to be_nil
48
+
47
49
  found_key = settings.find_key('user')
48
- found_key['salt'].should == TestValues::Salt
49
- found_key['encrypted_point'].should == TestValues::EncryptedPoint
50
+ expect(found_key['salt']).to eq(TestValues::Salt)
51
+ expect(found_key['encrypted_point']).to eq(TestValues::EncryptedPoint)
50
52
  end
51
53
  end
52
54
  end
@@ -57,8 +59,8 @@ describe Trustworthy::Settings do
57
59
  key = Trustworthy::Key.new(BigDecimal.new('2'), BigDecimal.new('3'))
58
60
  settings.add_key(key, 'user', 'password1')
59
61
  found_key = settings.find_key('user')
60
- found_key['salt'].should == TestValues::Salt
61
- found_key['encrypted_point'].should == TestValues::EncryptedPoint
62
+ expect(found_key['salt']).to eq(TestValues::Salt)
63
+ expect(found_key['encrypted_point']).to eq(TestValues::EncryptedPoint)
62
64
  end
63
65
  end
64
66
  end
@@ -68,13 +70,13 @@ describe Trustworthy::Settings do
68
70
  Trustworthy::Settings.open(TestValues::SettingsFile) do |settings|
69
71
  key = Trustworthy::Key.new(BigDecimal.new('2'), BigDecimal.new('3'))
70
72
  settings.add_key(key, 'user', 'password1')
71
- settings.should have_key('user')
73
+ expect(settings).to have_key('user')
72
74
  end
73
75
  end
74
76
 
75
77
  it 'should be false if the key does exists' do
76
78
  Trustworthy::Settings.open(TestValues::SettingsFile) do |settings|
77
- settings.should_not have_key('missing')
79
+ expect(settings).to_not have_key('missing')
78
80
  end
79
81
  end
80
82
  end
@@ -82,7 +84,7 @@ describe Trustworthy::Settings do
82
84
  describe 'recoverable?' do
83
85
  it 'should not be recoverable with no user keys' do
84
86
  Trustworthy::Settings.open(TestValues::SettingsFile) do |settings|
85
- settings.should_not be_recoverable
87
+ expect(settings).to_not be_recoverable
86
88
  end
87
89
  end
88
90
 
@@ -90,7 +92,7 @@ describe Trustworthy::Settings do
90
92
  Trustworthy::Settings.open(TestValues::SettingsFile) do |settings|
91
93
  key = Trustworthy::Key.new(BigDecimal.new('2'), BigDecimal.new('3'))
92
94
  settings.add_key(key, 'user', 'password')
93
- settings.should_not be_recoverable
95
+ expect(settings).to_not be_recoverable
94
96
  end
95
97
  end
96
98
 
@@ -100,7 +102,7 @@ describe Trustworthy::Settings do
100
102
  key2 = Trustworthy::Key.new(BigDecimal.new('3'), BigDecimal.new('4'))
101
103
  settings.add_key(key1, 'user1', 'password')
102
104
  settings.add_key(key2, 'user2', 'password')
103
- settings.should be_recoverable
105
+ expect(settings).to be_recoverable
104
106
  end
105
107
  end
106
108
  end
@@ -111,8 +113,8 @@ describe Trustworthy::Settings do
111
113
  key = Trustworthy::Key.new(BigDecimal.new('2'), BigDecimal.new('3'))
112
114
  settings.add_key(key, 'user', 'password1')
113
115
  unlocked_key = settings.unlock_key('user', 'password1')
114
- unlocked_key.x.should == BigDecimal.new('2')
115
- unlocked_key.y.should == BigDecimal.new('3')
116
+ expect(unlocked_key.x).to eq(BigDecimal.new('2'))
117
+ expect(unlocked_key.y).to eq(BigDecimal.new('3'))
116
118
  end
117
119
  end
118
120
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trustworthy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Downey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-28 00:00:00.000000000 Z
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aead
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: 1.1.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '1.1'
68
+ version: 1.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: test-construct
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '2.13'
89
+ version: 2.14.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '2.13'
96
+ version: 2.14.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 10.0.3
103
+ version: 10.1.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 10.0.3
110
+ version: 10.1.0
111
111
  description: Implements a special case (k = 2) of Adi Shamir's secret sharing algorithm.
112
112
  This allows secret files to be encrypted on disk and require two secret holders
113
113
  to decrypt it.
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  requirements: []
167
167
  rubyforge_project:
168
- rubygems_version: 2.0.2
168
+ rubygems_version: 2.0.3
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: Encrypt and decrypt files with multiple key holders
@@ -180,4 +180,3 @@ test_files:
180
180
  - spec/trustworthy/prompt_spec.rb
181
181
  - spec/trustworthy/random_spec.rb
182
182
  - spec/trustworthy/settings_spec.rb
183
- has_rdoc: