Module: ActiveCrypto::AssociationKeyHolder
- Includes:
- KeyHolder
- Defined in:
- lib/active_crypto.rb
Instance Method Summary collapse
- #save_session_key ⇒ Object
-
#session_key ⇒ Object
Returns the session_key.
- #session_key_id ⇒ Object
-
#set_session_key(key) ⇒ Object
Sets a session key for the object.
Methods included from KeyHolder
#enter_password, #set_encoded_key
Instance Method Details
#save_session_key ⇒ Object
158 159 160 |
# File 'lib/active_crypto.rb', line 158 def save_session_key ActiveRecord::Base.session_keys[session_key_id]=@session_key if @session_key end |
#session_key ⇒ Object
Returns the session_key
177 178 179 180 181 182 183 |
# File 'lib/active_crypto.rb', line 177 def session_key if self.new_record? @session_key else ActiveRecord::Base.session_keys[session_key_id] end end |
#session_key_id ⇒ Object
187 188 189 |
# File 'lib/active_crypto.rb', line 187 def session_key_id "#{self.class.to_s}:#{id}" end |
#set_session_key(key) ⇒ Object
Sets a session key for the object. This should be a EzCrypto::Key instance.
164 165 166 167 168 169 170 171 172 |
# File 'lib/active_crypto.rb', line 164 def set_session_key(key) if self.new_record? @session_key=key else ActiveRecord::Base.session_keys[session_key_id]=key end decrypt_attributes if self.class.include? Encrypted #if respond_to?(:decrypt_attributes) end |