attr_vault 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 665d59b886d2def98f4dba40d043b122df96c006
4
- data.tar.gz: 802078b40c30978a0aa43f180660d5585a414085
3
+ metadata.gz: d7089817e9f22b5f911c5f3bfd6eeb2197b35a7d
4
+ data.tar.gz: e173b33246bbac4540d340acfb2e83498987f6ff
5
5
  SHA512:
6
- metadata.gz: 3f1f5f7de00b590168706e5cf49fe8ea2639aac757f04eacb4148e45e270bbd3759d37762fa8010b894340e8d3cfac16516f6d7d40aa6232f5b61052ec8bb74a
7
- data.tar.gz: a5b15e48c3380ad4d55bd8900d4119a02ce14314f9eecb499f2b2714c65d12b0ea942b6944786a180d0152ae6c3a0d0f8414cd14db0fd7394375fe5eb1dd7912
6
+ metadata.gz: 5591b127128faeb99e02e2be60f46b2e77b85742f40982bd505f595050c652236f979a9e7d501fa1628ba36f4722aad8904ad12509cfb37032213de3d5e5e968
7
+ data.tar.gz: ea680acfb48abdf5b3214105b4a56e85f9725382d175207309b4a8fc9b830aea87310974b80162702ff7349d82568d037fc4d35850eaa6510874ab414c4fe35e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attr_vault (0.0.1)
4
+ attr_vault (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AttrVault
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/attr_vault.rb CHANGED
@@ -81,6 +81,11 @@ module AttrVault
81
81
 
82
82
  keyring = self.class.vault_keys
83
83
  key_id = self[self.class.vault_key_field]
84
+ if key_id.nil?
85
+ # if there is no recorded key, this is not an encrypted
86
+ # record so we return nil
87
+ return nil
88
+ end
84
89
  record_key = self.class.vault_keys.fetch(key_id)
85
90
 
86
91
  encrypted_value = self[attr.encrypted_field]
@@ -108,6 +108,11 @@ describe AttrVault do
108
108
  s.reload
109
109
  expect(s.key_id).to eq(key_id)
110
110
  end
111
+
112
+ it "reads a never-set encrypted field as nil" do
113
+ s = item.create
114
+ expect(s.secret).to be_nil
115
+ end
111
116
  end
112
117
  end
113
118
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciek Sakrejda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec