mongoid-kms 0.0.30 → 0.0.31
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/lib/mongoid/kms/version.rb +1 -1
- data/lib/mongoid/kms.rb +1 -1
- data/spec/lib/mongoid/kms_spec.rb +32 -19
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37ae0463add173e91447c34a3c39113b63ffb3b6
|
4
|
+
data.tar.gz: e03daf701ac8a8bca65770bc304cafa7bcb0b45e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b70d8aff3d48a2e1f6810beb55d06ab0bba560ac457753ebef754745a548d1fade9018ab98993488c3c3995fcadf9dd96e6610452ccbcddb3a560cf9f0a6b06
|
7
|
+
data.tar.gz: 8d5dedead0ff718b5d40b38cb8fbd6a63e010ff95fdb9beb67d274af7b515c5799543ed8721d8b41834e4f8cd522fc852062634b2d8cd4fea8266d5dd691d094
|
data/lib/mongoid/kms/version.rb
CHANGED
data/lib/mongoid/kms.rb
CHANGED
@@ -153,7 +153,7 @@ module Mongoid
|
|
153
153
|
encrypted_field_name = get_encrypted_field_name(field_name)
|
154
154
|
|
155
155
|
create_dirty_methods field_name, field_name
|
156
|
-
|
156
|
+
after_validation :set_kms_values
|
157
157
|
|
158
158
|
kms_field_map[field_name.to_s] = {context: args.delete(:context), type: args[:type]}
|
159
159
|
|
@@ -87,33 +87,46 @@ describe Mongoid::Kms do
|
|
87
87
|
o.bla
|
88
88
|
end
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
describe "works with embedded documents" do
|
91
|
+
before do
|
92
|
+
class ParentClass
|
93
|
+
include Mongoid::Document
|
93
94
|
|
94
|
-
|
95
|
+
embeds_one :child_class, class_name: "ChildClass"
|
95
96
|
|
96
|
-
|
97
|
-
|
97
|
+
field :unsecure, type: String
|
98
|
+
end
|
98
99
|
|
99
|
-
|
100
|
-
|
101
|
-
|
100
|
+
class ChildClass
|
101
|
+
include Mongoid::Document
|
102
|
+
include Mongoid::Kms
|
102
103
|
|
103
|
-
|
104
|
+
embedded_in :parent_class
|
104
105
|
|
105
|
-
|
106
|
-
|
106
|
+
secure_field :secure, type: String
|
107
|
+
field :unsecure, type: String
|
108
|
+
end
|
107
109
|
end
|
108
110
|
|
109
|
-
|
110
|
-
|
111
|
-
|
111
|
+
it "on save" do
|
112
|
+
o = ParentClass.create!(unsecure: "wonder woman")
|
113
|
+
o.child_class = ChildClass.new(secure: "invisible ship", unsecure: "a whip")
|
114
|
+
o.save!
|
112
115
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
116
|
+
o.reload
|
117
|
+
expect(o.unsecure).to eq("wonder woman")
|
118
|
+
expect(o.child_class.secure).to eq("invisible ship")
|
119
|
+
expect(o.child_class.unsecure).to eq("a whip")
|
120
|
+
end
|
121
|
+
|
122
|
+
it "on create" do
|
123
|
+
o = ParentClass.create!(unsecure: "wonder woman", child_class: ChildClass.new(secure: "invisible ship", unsecure: "a whip"))
|
124
|
+
o.reload
|
125
|
+
|
126
|
+
expect(o.unsecure).to eq("wonder woman")
|
127
|
+
expect(o.child_class.secure).to eq("invisible ship")
|
128
|
+
expect(o.child_class.unsecure).to eq("a whip")
|
129
|
+
end
|
117
130
|
end
|
118
131
|
|
119
132
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-kms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Winslett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
193
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.4.
|
194
|
+
rubygems_version: 2.4.7
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: Easy plugin for Mongoid + AWS KMS for security
|