donjon 0.0.4 → 0.0.5

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: 9d9c1aee2f9e8deb7f1916188d17e7c69dc7bdfb
4
- data.tar.gz: e7cae5314480d167f12b68c01f67cd46c6ca5b9a
3
+ metadata.gz: e9a0c01e1df31b4c611793b75976e0690b73fee9
4
+ data.tar.gz: f091e2d78dd1e66659f16c48d19e74083d33ff66
5
5
  SHA512:
6
- metadata.gz: d726b19737a97fe66cb1413b3a3b74cface9462327e23230427c26cb5f04e8763d2a9fabd7d0220d27f5f16197c379da48c5468544b41f71d4b3abc5367625d2
7
- data.tar.gz: 0ae68d0ea317b138591e997b660468c93d29b3488c3441a63f77ec7445c10f6a57363dafb3ecd7621fc03e087e9b5fc5ccbbfb1b389860923b637f5b95be381a
6
+ metadata.gz: 2015827701087c240407012bbf524aef2135c2e53a0e3e2cb84a2cc2b1164d50afb7106a98cd9dee5fb483cc13e20e46acd3bc312836de6bc1d0b84a48d2cde5
7
+ data.tar.gz: 5cd7db7b542216befb448c2d474fba6f292ce73b8772100d5cc053a8cfd20fbef58ab76e2e561e249f1aa96d9136c79908c614f2eafc564baf3d6dbeccec16ca
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ script:
5
+ - bundle exec rspec
data/README.md CHANGED
@@ -5,6 +5,10 @@ Donjon is a secure, multi-user store for key-value pairs.
5
5
  Skip to: [Purpose](#purpose) | [Concepts](#concepts) | [Setting
6
6
  up](#installation) | [Usage](#usage)
7
7
 
8
+ ![Version](https://badge.fury.io/rb/donjon.svg)
9
+ ![Build status](https://travis-ci.org/mezis/donjon.svg?branch=master)
10
+
11
+
8
12
  ## Purpose
9
13
 
10
14
  We built Donjon to share credentials in a (small) devops team, for services where
@@ -77,11 +81,15 @@ Bittorrent Sync.
77
81
 
78
82
  ### Connecting to an existing vault
79
83
 
84
+ Create an (empty) directory where you want the vault to be synced. Tyhis can
85
+ typically be `~/.donjon`.
86
+
80
87
  Download and install [Bittorrent Sync](http://www.bittorrent.com/sync/downloads).
81
88
 
82
89
  Ask a peer already using the vault you're interested in to provide you a "one
83
90
  time secret" for the shared vault directory. Add this to Bittorrent Sync, and
84
- wait for syncing to complete.
91
+ wait for syncing to complete. Note that one-time keys can only be used by one
92
+ user!
85
93
 
86
94
  Install Donjon:
87
95
 
@@ -12,6 +12,9 @@ module Donjon
12
12
  desc 'config:mget [REGEXP]', 'Decrypts multiple keys (all readable by default)'
13
13
  decl 'config:mget'
14
14
 
15
+ desc 'config:del KEY', 'Removes a key-value pair'
16
+ decl 'config:del'
17
+
15
18
  private
16
19
 
17
20
  def config_set(*keyvals)
@@ -36,6 +39,10 @@ module Donjon
36
39
  puts "#{key}: #{value}"
37
40
  end
38
41
  end
42
+
43
+ def config_del(key)
44
+ database[key] = nil
45
+ end
39
46
  end
40
47
  end
41
48
  end
@@ -3,6 +3,8 @@ require 'json'
3
3
 
4
4
  module Donjon
5
5
  class Database
6
+ include Enumerable
7
+
6
8
  def initialize(actor:)
7
9
  @actor = actor
8
10
  end
@@ -16,7 +18,11 @@ module Donjon
16
18
  end
17
19
 
18
20
  def []=(key, value)
19
- _file(key).write(_pack(key, value))
21
+ if value.nil?
22
+ _file(key).write(nil)
23
+ else
24
+ _file(key).write(_pack(key, value))
25
+ end
20
26
  end
21
27
 
22
28
  def each
@@ -67,7 +67,7 @@ module Donjon
67
67
 
68
68
  def _encrypt_for(user, data)
69
69
  encoding = data.encoding
70
- data = data.force_encoding(Encoding::BINARY)
70
+ data = data.dup.force_encoding(Encoding::BINARY)
71
71
 
72
72
  encoding_field = ("%-32s" % encoding).force_encoding(Encoding::BINARY)
73
73
  payload = encoding_field + data + OpenSSL::Random.random_bytes(PADDING)
@@ -1,3 +1,3 @@
1
1
  module Donjon
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -38,6 +38,13 @@ describe Donjon::Database do
38
38
  subject['foo'] = 'bar'
39
39
  }.not_to raise_error
40
40
  end
41
+
42
+ it 'deletes key when passed nil' do
43
+ subject['foo'] = 'bar'
44
+ subject['foo'] = nil
45
+ expect(subject['foo']).to be_nil
46
+ expect(subject.to_a).to be_empty
47
+ end
41
48
  end
42
49
 
43
50
  describe '#[]' do
@@ -53,6 +53,13 @@ describe Donjon::EncryptedFile do
53
53
  2.times { subject.write 'foo' }
54
54
  }.not_to raise_error
55
55
  end
56
+
57
+ it 'deletes when nil passed' do
58
+ subject.write('foo')
59
+ expect(subject).to exist
60
+ subject.write(nil)
61
+ expect(subject).not_to exist
62
+ end
56
63
  end
57
64
 
58
65
  describe '#read' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: donjon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-18 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -119,6 +119,7 @@ files:
119
119
  - ".gitignore"
120
120
  - ".rspec"
121
121
  - ".ruby-version"
122
+ - ".travis.yml"
122
123
  - Gemfile
123
124
  - Guardfile
124
125
  - LICENSE.txt