Class: SelfCrypto::GroupMessage
- Inherits:
-
Object
- Object
- SelfCrypto::GroupMessage
- Defined in:
- lib/self_crypto/group_message.rb
Instance Method Summary collapse
- #get_message(identity) ⇒ Object
-
#initialize(msg) ⇒ GroupMessage
constructor
A new instance of GroupMessage.
-
#to_bytes ⇒ String
Bytes.
-
#to_s ⇒ String
Base64.
Constructor Details
#initialize(msg) ⇒ GroupMessage
Returns a new instance of GroupMessage.
8 9 10 11 |
# File 'lib/self_crypto/group_message.rb', line 8 def initialize(msg) @value = msg @data = JSON.parse(msg) end |
Instance Method Details
#get_message(identity) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/self_crypto/group_message.rb', line 23 def (identity) h = @data['recipients'][identity] if h['mtype'] == 0 PreKeyMessage.new(h['ciphertext']) else Message.new(h['ciphertext']) end end |
#to_bytes ⇒ String
Returns bytes.
14 15 16 |
# File 'lib/self_crypto/group_message.rb', line 14 def to_bytes Base64.decode64(value) end |
#to_s ⇒ String
Returns base64.
19 20 21 |
# File 'lib/self_crypto/group_message.rb', line 19 def to_s @value.dup end |