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.
10 11 12 13 |
# File 'lib/self_crypto/group_message.rb', line 10 def initialize(msg) @value = msg @data = JSON.parse(msg) end |
Instance Method Details
#get_message(identity) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/self_crypto/group_message.rb', line 25 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.
16 17 18 |
# File 'lib/self_crypto/group_message.rb', line 16 def to_bytes Base64.decode64(value) end |
#to_s ⇒ String
Returns base64.
21 22 23 |
# File 'lib/self_crypto/group_message.rb', line 21 def to_s @value.dup end |