Class: KStor::Model::Secret
Overview
A secret, with metadata and a value that are kept encrypted on disk.
Instance Attribute Summary collapse
-
#ciphertext ⇒ Object
Returns value of property ciphertext.
-
#encrypted_metadata ⇒ Object
Returns value of property encrypted_metadata.
-
#group_id ⇒ Object
Returns value of property group_id.
-
#id ⇒ Object
Returns value of property id.
-
#meta_author_id ⇒ Object
Returns value of property meta_author_id.
-
#metadata ⇒ Object
Returns value of property metadata.
-
#plaintext ⇒ Object
Returns value of property plaintext.
-
#value_author_id ⇒ Object
Returns value of property value_author_id.
Instance Method Summary collapse
-
#lock ⇒ Object
Forget about the decrypted value and metadata.
-
#to_h ⇒ Object
Dump properties except #ciphertext, #encrypted_metadata, #value_author_id and #meta_author_id.
-
#unlock(author_pubk, group_privk) ⇒ Object
Decrypt secret value.
-
#unlock_metadata(author_pubk, group_privk) ⇒ Object
Decrypt secret metadata.
Methods inherited from Base
#clean, #dirty?, #initialize, property, property?
Constructor Details
This class inherits a constructor from KStor::Model::Base
Instance Attribute Details
#ciphertext ⇒ Object
Returns value of property ciphertext
378 |
# File 'lib/kstor/model.rb', line 378 property :ciphertext |
#encrypted_metadata ⇒ Object
Returns value of property encrypted_metadata
382 |
# File 'lib/kstor/model.rb', line 382 property :encrypted_metadata |
#group_id ⇒ Object
Returns value of property group_id
376 |
# File 'lib/kstor/model.rb', line 376 property :group_id |
#id ⇒ Object
Returns value of property id
370 |
# File 'lib/kstor/model.rb', line 370 property :id |
#meta_author_id ⇒ Object
Returns value of property meta_author_id
374 |
# File 'lib/kstor/model.rb', line 374 property :meta_author_id |
#metadata ⇒ Object
Returns value of property metadata
384 |
# File 'lib/kstor/model.rb', line 384 property :metadata, read_only: true |
#plaintext ⇒ Object
Returns value of property plaintext
380 |
# File 'lib/kstor/model.rb', line 380 property :plaintext |
#value_author_id ⇒ Object
Returns value of property value_author_id
372 |
# File 'lib/kstor/model.rb', line 372 property :value_author_id |
Instance Method Details
#lock ⇒ Object
Forget about the decrypted value and metadata.
419 420 421 422 |
# File 'lib/kstor/model.rb', line 419 def lock self. = nil self.plaintext = nil end |
#to_h ⇒ Object
Dump properties except #ciphertext, #encrypted_metadata, #value_author_id and #meta_author_id.
426 427 428 429 430 431 432 433 434 |
# File 'lib/kstor/model.rb', line 426 def to_h h = super h.delete('ciphertext') h.delete('encrypted_metadata') h.delete('value_author_id') h.delete('meta_author_id') h end |
#unlock(author_pubk, group_privk) ⇒ Object
Decrypt secret value.
This will set the #plaintext property.
398 399 400 401 402 |
# File 'lib/kstor/model.rb', line 398 def unlock(, group_privk) self.plaintext = Crypto.decrypt_secret_value( , group_privk, ciphertext ) end |