Class MegolmMessage
java.lang.Object
io.github.fherbreteau.vodozemac.megolm.MegolmMessage
A structured Megolm message, containing the ciphertext, message index,
MAC, and Ed25519 signature.
A MegolmMessage is produced by
OutboundGroupSession.encrypt(byte[]) and consumed by
InboundGroupSession.decrypt(MegolmMessage).
The toString() method produces the base64-encoded wire
representation of the message, which is what the native vodozemac layer
expects for serialisation and deserialisation.
To reconstruct a MegolmMessage from a base64 string received over
the wire, use fromBase64(String).
- Author:
- François HERBRETEAU
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the base64-encoded ciphertext of the message.booleanstatic MegolmMessagefromBase64(String base64) Reconstructs aMegolmMessagefrom its base64-encoded wire representation.inthashCode()mac()Returns the base64-encoded MAC (message authentication code) of the message.intReturns the message index, which indicates the ratchet position at which the message was encrypted.Returns the Ed25519 signature of the message.toString()Returns the base64-encoded wire representation of this message.
-
Method Details
-
ciphertext
Returns the base64-encoded ciphertext of the message.- Returns:
- the ciphertext as a base64 string
-
messageIndex
public int messageIndex()Returns the message index, which indicates the ratchet position at which the message was encrypted.- Returns:
- the message index
-
mac
Returns the base64-encoded MAC (message authentication code) of the message.- Returns:
- the MAC as a base64 string
-
signature
Returns the Ed25519 signature of the message.- Returns:
- the signature
-
toString
-
fromBase64
Reconstructs aMegolmMessagefrom its base64-encoded wire representation.- Parameters:
base64- the base64-encoded Megolm message- Returns:
- a new
MegolmMessageinstance - Throws:
VodozemacException- if the input is not a valid Megolm message
-
equals
-
hashCode
-