Class: Duse::Client::Secret
Constant Summary
Constants inherited
from Entity
Entity::MAP
Instance Attribute Summary
Attributes inherited from Entity
#attributes, #curry
Instance Method Summary
collapse
Methods inherited from Entity
add_attribute, attributes, base_path, #delete, id_field, ignore_in_json, #initialize, #load_attribute, many, #missing?, one, #reload, #save, #set_attribute, subclasses, #to_h
Instance Method Details
#decrypt(private_key) ⇒ Object
96
97
98
99
100
101
102
103
|
# File 'lib/duse/client/secret.rb', line 96
def decrypt(private_key)
shares = self.shares.map(&:content)
Encryption.decrypt(self.cipher_text, shares, private_key)
end
|
#signatures_valid? ⇒ Boolean
105
106
107
108
109
110
|
# File 'lib/duse/client/secret.rb', line 105
def signatures_valid?
self.shares.each do |s|
return false if !s.valid_signature?
end
true
end
|
#to_s ⇒ Object
112
113
114
|
# File 'lib/duse/client/secret.rb', line 112
def to_s
"🔐 #{self.id}: #{self.title}"
end
|