donjon 1.0.1 → 2.0.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: 940c4424826fe9f8701b29bb26a9af71af4f217c
4
- data.tar.gz: c637c714b56d5682b6d0752b6b4cafb44d8c08ad
3
+ metadata.gz: 13b97b25c7492ea9cd2e839f3782fc514f69951e
4
+ data.tar.gz: 9dd7c77553f48b0462ae6024752689b8f0743b20
5
5
  SHA512:
6
- metadata.gz: 0a00ccb3a4016e2886e419000acf945246d4e9f7c08cdd69da88c51d7c609ae0a5740d1c5c58f067236d711b34872e0b010365073381e52f38450376bda8b5d0
7
- data.tar.gz: 5811899c6508678844795cc3eee9bc47469a556b289fb17cf48bf4fc200ca21ee5bb0266e7f75644b4f99b1bd2344239a2b03473e6333af321055000e784b281
6
+ metadata.gz: 7ef534ceda3824fbe3538223ddf4a7d70b9a1661411659df0fb71fc534222f1b4c6508d0948b705712b8d98a3e71f61c1252d85cf96b752c40ca695c90e1533a
7
+ data.tar.gz: c8da58337bb8b1ad3dccb9030253a6b742eae9ee78576dfdac49d7e74d05212ccc4a58f28ed8c65b8951b44a5eb23b25c72ea7fb0b5ac883d7269b03ce3d199c
data/README.md CHANGED
@@ -3,10 +3,11 @@
3
3
  Donjon is a secure, multi-user store for key-value pairs.
4
4
 
5
5
  Skip to: [Purpose](#purpose) | [Concepts](#concepts) | [Setting
6
- up](#installation) | [Usage](#usage)
6
+ up](#installation) | [Usage](#usage) | [Storing QR
7
+ codes](#storing-qr-codes-in-donjon)
7
8
 
8
- ![Version](https://badge.fury.io/rb/donjon.svg)
9
- ![Build status](https://travis-ci.org/mezis/donjon.svg?branch=master)
9
+ [![Version](https://badge.fury.io/rb/donjon.svg)](https://rubygems.org/gems/donjon)
10
+ [![Build status](https://travis-ci.org/mezis/donjon.svg?branch=master)](https://travis-ci.org/mezis/donjon)
10
11
 
11
12
 
12
13
  ## Purpose
@@ -81,10 +82,14 @@ Bittorrent Sync.
81
82
 
82
83
  ### Connecting to an existing vault
83
84
 
84
- Create an (empty) directory where you want the vault to be synced. Tyhis can
85
- typically be `~/.donjon`.
85
+ **Note**: please follow these steps _in order_.
86
86
 
87
87
  Download and install [Bittorrent Sync](http://www.bittorrent.com/sync/downloads).
88
+ During install, let the software create a default sync directory (we won't use
89
+ it).
90
+
91
+ Create an (empty) directory where you want the vault to be synced. This can
92
+ typically be `~/.donjon`.
88
93
 
89
94
  Ask a peer already using the vault you're interested in to provide you a "one
90
95
  time secret" for the shared vault directory. Add this to Bittorrent Sync, and
@@ -121,15 +126,62 @@ vault, e.g. on Dropbox).
121
126
 
122
127
  ```
123
128
  Commands:
124
- dj config:get KEY... # Decrypts the value for KEY from the vault
125
- dj config:mget [REGEXP] # Decrypts multiple keys (all readable by default)
126
- dj config:set KEY=VALUE ... # Encrypts KEY and VALUE in the vault
127
- dj help [COMMAND] # Describe available commands or one specific command
128
- dj init # Creates a new vault, or connects to an existing vault.
129
- dj user:add NAME [PATH] # Adds user and their public key to the vault. Reads from standard input if no path is given.
130
- dj user:key # Prints your public key
129
+ dj config:get KEY... # Decrypts the value for KEY from the vault
130
+ dj config:set KEY # Reads a VALUE from standard input, encrypts KEY and VALUE in the vault
131
+ dj config:del KEY # Removes a key-value pair
132
+ dj config:fset KEY FILE # Encrypts KEY and the contents of FILE in the vault
133
+ dj config:mget [REGEXP] # Decrypts multiple keys (all keys by default)
134
+ dj config:mset KEY=VALUE ... # Encrypts KEY and VALUE in the vault
135
+ dj help [COMMAND] # Describe available commands or one specific command
136
+ dj init # Creates a new vault, or connects to an existing vault.
137
+ dj user:add NAME [PATH] # Adds user and their public key to the vault. Reads from standard input if no path is given.
138
+ dj user:key # Prints your public key
131
139
  ```
132
140
 
141
+
142
+ ## Storing QR codes in Donjon
143
+
144
+ Some service offer two factor authentication, which is a good thing.
145
+ Unfortunately some of those are not multi-user, which means the token for two
146
+ factor authentication also needs to be shared.
147
+
148
+ This token is usually shared as a QR code for convenience, to be used with
149
+ Google Authenticator or Authy.
150
+
151
+ You can store it in Donjon as follows:
152
+
153
+ 1. Get the QR code from the service. A screenshot is fine.
154
+
155
+ 2. Install [zbar](http://zbar.sourceforge.net/) (to scan the code) and
156
+ [qrencode](http://fukuchi.org/works/qrencode/) (to generate a new, compact
157
+ code)
158
+
159
+ 3. Extract a new QR code:
160
+
161
+ ```
162
+ $ zbarimg --raw -q <file>.png | \
163
+ tr -d '\n' | \
164
+ qrencode -m 2 -d 1 -t ASCII | \
165
+ sed -e "s/ /ESC[7m ESC[0m/g;s/#/ /g" | \
166
+ tr 'ESC' '\033' | \
167
+ tee /tmp/qr
168
+ ```
169
+
170
+ (this should output the QR code on your terminal)
171
+
172
+ 4. Store the QR code in Donjon:
173
+
174
+ ```
175
+ $ dj config:fset mykey /tmp/qr
176
+ ```
177
+
178
+ 5. Test the code has been properly stored:
179
+
180
+ ```
181
+ $ dj config:get mykey
182
+ ```
183
+
184
+
133
185
  ## Contributing
134
186
 
135
187
  1. Fork it ( http://github.com/mezis/donjon/fork )
@@ -54,8 +54,6 @@ module Donjon
54
54
  end
55
55
  end
56
56
 
57
- private
58
-
59
57
  def _get_password(message)
60
58
  say message, :green
61
59
  $stdout.write('> ')
@@ -3,7 +3,10 @@ require 'donjon/commands/base'
3
3
  module Donjon
4
4
  module Commands
5
5
  Base.class_eval do
6
- desc 'config:set KEY=VALUE ...', 'Encrypts KEY and VALUE in the vault'
6
+ desc 'config:mset KEY=VALUE ...', 'Encrypts KEY and VALUE in the vault'
7
+ decl 'config:mset'
8
+
9
+ desc 'config:set KEY', 'Reads a VALUE from standard input, encrypts KEY and VALUE in the vault'
7
10
  decl 'config:set'
8
11
 
9
12
  desc 'config:fset KEY FILE', 'Encrypts KEY and the contents of FILE in the vault'
@@ -20,13 +23,24 @@ module Donjon
20
23
 
21
24
  private
22
25
 
23
- def config_set(*keyvals)
26
+ def config_mset(*keyvals)
24
27
  keyvals.each do |keyval|
25
28
  m = /([^=]*)=(.*)/.match(keyval)
29
+ if m.nil?
30
+ say "Misformatted key-value pair '#{keyval}'"
31
+ exit 1
32
+ end
26
33
  key = m[1]
27
34
  value = m[2]
28
35
  database[key] = value
29
36
  end
37
+ say "Warning: the keys and values you just set may be saved to your shell history", :red
38
+ say "You can clear your history by running `history -c`."
39
+ end
40
+
41
+ def config_set(key)
42
+ value = _get_password("Please enter the value for '#{key}'")
43
+ database[key] = value
30
44
  end
31
45
 
32
46
  def config_fset(key, path)
@@ -45,6 +59,10 @@ module Donjon
45
59
  next if regexp && regexp !~ key
46
60
  puts "#{key}: #{value}"
47
61
  end
62
+ rescue RegexpError => e
63
+ say "Misformatted regular expression '#{regexp}'", :red
64
+ say "(#{e.message})"
65
+ exit 1
48
66
  end
49
67
 
50
68
  def config_del(key)
@@ -1,3 +1,3 @@
1
1
  module Donjon
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0.0"
3
3
  end
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: 1.0.1
4
+ version: 2.0.0
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-09-01 00:00:00.000000000 Z
11
+ date: 2014-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor