pwss 0.5.1 → 0.6.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.
@@ -1,18 +0,0 @@
1
- require 'pwss/entry'
2
-
3
- module Pwss
4
- class BankAccount < Entry
5
- def initialize
6
- super
7
- @fields = {
8
- "title" => ["Readline.readline('title: ')", "'title'"],
9
- "name" => ["Readline.readline('name: ')", "'name'"],
10
- "iban" => ["Readline.readline('iban: ')", "ITkk xaaa aabb bbbc cccc cccc ccc"],
11
- "created_at" => ["", "Date.today"],
12
- "updated_at" => ["", "nil"],
13
- "url" => ["Readline.readline('url: ')", "''"],
14
- "description" => ["get_lines", "''"]
15
- }
16
- end
17
- end
18
- end
@@ -1,23 +0,0 @@
1
- require 'pwss/entry'
2
-
3
- module Pwss
4
- class CreditCard < Entry
5
- def initialize
6
- super
7
- @fields = {
8
- "title" => ["Readline.readline('title: ')", "'title'"],
9
- "issuer" => ["Readline.readline('issuer: ')", "MasterCard"],
10
- "name_on_card" => ["Readline.readline('name on card: ')", "'john doe'"],
11
- "card_number" => ["Readline.readline('number: ')", "000-0000-0000-0000"],
12
- "valid_from" => ["Readline.readline('valid from: ')", "Sep 2014"],
13
- "valid_till" => ["Readline.readline('valid till: ')", "Sep 2018"],
14
- "verification_number" => ["Readline.readline('verification number: ')", "000"],
15
- "pin" => ["Readline.readline('pin: ')", "0000"],
16
- "created_at" => ["", "Date.today"],
17
- "updated_at" => ["", "nil"],
18
- "url" => ["Readline.readline('url: ')", "''"],
19
- "notes" => ["get_lines", "''"]
20
- }
21
- end
22
- end
23
- end
@@ -1,69 +0,0 @@
1
- require 'readline'
2
- require 'pwss/cipher'
3
- require 'date'
4
-
5
- module Pwss
6
- #
7
- # Entry manages an entry in the password safe
8
- # It is a wrapper to a Hash
9
- #
10
- class Entry
11
- INPUT_F = 0
12
- DEFAULT = 1
13
-
14
- attr_reader :entry, :fields
15
-
16
- def initialize
17
- @entry = Hash.new
18
-
19
- # the fields of an entry, together with:
20
- # - the function to ask the value
21
- # - the default value
22
- @fields = {
23
- "title" => ["Readline.readline('title: ')", "'title'"],
24
- "username" => ["Readline.readline('username: ')", "''"],
25
- "password" => ["Cipher.check_or_generate('password for entry', length, alnum)", "''"],
26
- "created_at" => ["", "Date.today"],
27
- "updated_at" => ["", "nil"],
28
- "url" => ["Readline.readline('url: ')", "''"],
29
- "description" => ["get_lines", "''"]
30
- }
31
- end
32
-
33
- # interactively ask from command line all fields specified in FIELDS
34
- # arguments length and alnum are for password generation
35
- def ask length = 8, alnum = true, overrides = {}
36
- @fields.merge! overrides
37
- @fields.keys.each do |key|
38
- value = eval @fields[key][INPUT_F]
39
- if value == nil or value == "" then
40
- @entry[key] = eval @fields[key][DEFAULT]
41
- else
42
- @entry[key] = value
43
- end
44
- end
45
- end
46
-
47
- # initialize all fields with the default values
48
- # (and set title to the argument)
49
- # def set_fields title
50
- # fields.keys.each do |k|
51
- # @entry[k] = eval(fields[k][DEFAULT])
52
- # end
53
- # @entry['title'] = title
54
- # end
55
-
56
- # read n-lines (terminated by a ".")
57
- def get_lines
58
- puts "description (terminate with '.'):"
59
- lines = []
60
- line = ""
61
- until line == "."
62
- line = Readline.readline
63
- lines << line
64
- end
65
- lines.join("\n")
66
- end
67
-
68
- end
69
- end
@@ -1,21 +0,0 @@
1
- require 'pwss/entry'
2
-
3
- module Pwss
4
- class SoftwareLicense < Entry
5
- def initialize
6
- super
7
- @fields = {
8
- "title" => ["Readline.readline('title: ')", "'title'"],
9
- "version" => ["Readline.readline('version: ')", "0.0.1"],
10
- "license_number" => ["Readline.readline('license number: ')", "000-0000-0000-0000"],
11
- "licensed_to" => ["Readline.readline('licensed to: ')", "'John Doe'"],
12
- "email" => ["Readline.readline('email: ')", "jdoe@example.com"],
13
- "purchased_on" => ["Readline.readline('purchased on: ')", "'Date.today'"],
14
- "created_at" => ["", "Date.today"],
15
- "updated_at" => ["", "nil"],
16
- "url" => ["Readline.readline('url: ')", "''"],
17
- "notes" => ["get_lines", "''"]
18
- }
19
- end
20
- end
21
- end