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
396 |
# File 'lib/kstor/model.rb', line 396 property :ciphertext |
#encrypted_metadata ⇒ Object
Returns value of property encrypted_metadata
400 |
# File 'lib/kstor/model.rb', line 400 property :encrypted_metadata |
#group_id ⇒ Object
Returns value of property group_id
394 |
# File 'lib/kstor/model.rb', line 394 property :group_id |
#id ⇒ Object
Returns value of property id
388 |
# File 'lib/kstor/model.rb', line 388 property :id |
#meta_author_id ⇒ Object
Returns value of property meta_author_id
392 |
# File 'lib/kstor/model.rb', line 392 property :meta_author_id |
#metadata ⇒ Object
Returns value of property metadata
402 |
# File 'lib/kstor/model.rb', line 402 property :metadata, read_only: true |
#plaintext ⇒ Object
Returns value of property plaintext
398 |
# File 'lib/kstor/model.rb', line 398 property :plaintext |
#value_author_id ⇒ Object
Returns value of property value_author_id
390 |
# File 'lib/kstor/model.rb', line 390 property :value_author_id |
Instance Method Details
#lock ⇒ Object
Forget about the decrypted value and metadata.
440 441 442 443 |
# File 'lib/kstor/model.rb', line 440 def lock self. = nil self.plaintext = nil end |
#to_h ⇒ Object
Dump properties except #ciphertext, #encrypted_metadata, #value_author_id and #meta_author_id.
447 448 449 450 451 |
# File 'lib/kstor/model.rb', line 447 def to_h super.except( *%w[ciphertext encrypted_metadata value_author_id meta_author_id] ) end |
#unlock(author_pubk, group_privk) ⇒ Object
Decrypt secret value.
This will set the #plaintext property.
419 420 421 422 423 |
# File 'lib/kstor/model.rb', line 419 def unlock(, group_privk) self.plaintext = Crypto.decrypt_secret_value( , group_privk, ciphertext ) end |
#unlock_metadata(author_pubk, group_privk) ⇒ Object
Decrypt secret metadata.
This will set the #metadata property.
433 434 435 436 437 |
# File 'lib/kstor/model.rb', line 433 def (, group_privk) self. = Crypto.( , group_privk, ) end |