ruby-keepassx 0.2.0 → 0.2.1
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 +4 -4
- data/README.md +4 -0
- data/lib/keepassx.rb +19 -0
- data/lib/keepassx/database.rb +1 -1
- data/lib/keepassx/entry.rb +2 -2
- data/lib/keepassx/field.rb +0 -1
- data/lib/keepassx/utilities.rb +4 -4
- data/ruby-keepassx.gemspec +7 -2
- data/spec/keepassx/database_spec.rb +1 -2
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: becc633558db7f94287984345437f06a2b54428b
|
4
|
+
data.tar.gz: 2421c2d007dcbc4ce0499afceeca5631aab4c939
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59384fb219670347067b58848b930b05f67510b3e557801070a111a359209c31ec6807e70a229c0254b476eec3902cc90f52b2ca0b9f334bb58d07a285df7eac
|
7
|
+
data.tar.gz: 8f939f54f2f68507f8aab8827a0c722c8f159934cbf6fe1cc64751ecfa926c80f9d7708ff2779d263c645e84c075ec97636fa165a7fd48b82eaa1793dfe4529f
|
data/README.md
CHANGED
@@ -26,3 +26,7 @@ puts database.entry("entry's title").password
|
|
26
26
|
## Security Warning
|
27
27
|
|
28
28
|
No attempt is made to protect the memory used by this library; there may be something we can do with libgcrypt's secure-malloc functions, but right now your master password is unencrypted in ram that could possibly be paged to disk.
|
29
|
+
|
30
|
+
|
31
|
+
[](https://travis-ci.org/tioteath/ruby-keepassx)
|
data/lib/keepassx.rb
CHANGED
@@ -5,6 +5,25 @@ require 'digest/sha2'
|
|
5
5
|
require 'securerandom'
|
6
6
|
require 'rexml/document'
|
7
7
|
|
8
|
+
# Add backward compatibility stuff
|
9
|
+
if RUBY_VERSION =~ /1\.8/
|
10
|
+
require 'backports/tools'
|
11
|
+
require 'backports/1.9.1/symbol/empty'
|
12
|
+
require 'backports/1.9.3/io/write'
|
13
|
+
require 'time' # Get Time.parse
|
14
|
+
|
15
|
+
unless SecureRandom.method_defined? :uuid
|
16
|
+
module SecureRandom
|
17
|
+
# Based on this post https://www.ruby-forum.com/topic/3171049#1035902
|
18
|
+
def self.uuid
|
19
|
+
s = hex 16
|
20
|
+
[s[0..7], s[8..11], s[12..15], s[16..19], s[20..-1]].join '-'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
8
27
|
require 'keepassx/exceptions'
|
9
28
|
require 'keepassx/header'
|
10
29
|
require 'keepassx/utilities'
|
data/lib/keepassx/database.rb
CHANGED
data/lib/keepassx/entry.rb
CHANGED
@@ -87,8 +87,8 @@ module Keepassx
|
|
87
87
|
fail "'group' is required" if payload[:group].nil?
|
88
88
|
self.group = payload[:group]
|
89
89
|
|
90
|
-
|
91
|
-
data = payload.
|
90
|
+
fields = self.class.fields
|
91
|
+
data = payload.reject { |k, _| !fields.include? k }
|
92
92
|
data[:group_id] = group.id
|
93
93
|
|
94
94
|
@fields = []
|
data/lib/keepassx/field.rb
CHANGED
data/lib/keepassx/utilities.rb
CHANGED
@@ -109,9 +109,9 @@ module Keepassx
|
|
109
109
|
if previous_group.nil? or group.level.eql? 0
|
110
110
|
group.parent = nil
|
111
111
|
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
# If group has level greater than parent's level by one,
|
113
|
+
# it gets parent set to the first previous group with level less
|
114
|
+
# than group's level by one
|
115
115
|
elsif group.level == previous_group.level + 1 or
|
116
116
|
group.level == previous_group.level
|
117
117
|
|
@@ -187,7 +187,7 @@ module Keepassx
|
|
187
187
|
# Remove groups and entries from options, so new group could be
|
188
188
|
# initialized from incoming Hash
|
189
189
|
fields = Keepassx::Group.fields
|
190
|
-
group_opts = opts.
|
190
|
+
group_opts = opts.reject { |k, _| !fields.include? k }
|
191
191
|
group = add_group group_opts
|
192
192
|
|
193
193
|
entries.each do |e|
|
data/ruby-keepassx.gemspec
CHANGED
@@ -3,16 +3,21 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = 'Ruby API access for KeePassX databases'
|
4
4
|
s.description = 'This is fork of Tony Pitluga\'s ' \
|
5
5
|
'Ruby API for keepassx with read-write support.'
|
6
|
-
s.version = '0.2.
|
6
|
+
s.version = '0.2.1'
|
7
7
|
s.authors = ['Tony Pitluga', 'Paul Hinze', 'Tio Teath']
|
8
8
|
s.email = ['tony.pitluga@gmail.com', 'paul.t.hinze@gmail.com',
|
9
9
|
'tioteath@gmail.com']
|
10
10
|
s.homepage = 'https://github.com/tioteath/ruby-keepassx.git'
|
11
11
|
s.files = `git ls-files`.split "\n"
|
12
12
|
|
13
|
+
# TODO: This won't work, figure out why.
|
14
|
+
if RUBY_VERSION =~ /1\.8/
|
15
|
+
s.add_dependency 'backports', '~> 3.6.0'
|
16
|
+
end
|
17
|
+
|
13
18
|
s.add_development_dependency 'rspec', '~> 3.0'
|
14
19
|
s.add_development_dependency 'pry', '~> 0'
|
15
20
|
s.add_development_dependency 'rake', '~> 0.8', '>= 0.8.7'
|
16
|
-
|
21
|
+
s.add_development_dependency 'respect', '~> 0.1', '>= 0.1.1'
|
17
22
|
# s.add_development_dependency 'rspec-prof', '~> 0'
|
18
23
|
end
|
@@ -16,9 +16,8 @@ describe Keepassx::Database do
|
|
16
16
|
subject { Keepassx }
|
17
17
|
let(:db1) { subject.new data_array }
|
18
18
|
let(:db2) { subject.new data_array }
|
19
|
+
|
19
20
|
it 'has the same checksum for the same data' do
|
20
|
-
# warn "db1: #{File.write '/tmp/db1', db1.entries.inspect}>><<"
|
21
|
-
# warn "db2: #{File.write '/tmp/db2', db2.entries.inspect}>><<"
|
22
21
|
expect(db1.checksum).to eq db2.checksum
|
23
22
|
end
|
24
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-keepassx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitluga
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-09-
|
13
|
+
date: 2014-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -60,6 +60,26 @@ dependencies:
|
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.8.7
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: respect
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.1'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.1.1
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.1'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.1
|
63
83
|
description: This is fork of Tony Pitluga's Ruby API for keepassx with read-write
|
64
84
|
support.
|
65
85
|
email:
|
@@ -120,4 +140,3 @@ signing_key:
|
|
120
140
|
specification_version: 4
|
121
141
|
summary: Ruby API access for KeePassX databases
|
122
142
|
test_files: []
|
123
|
-
has_rdoc:
|