Optional
sodium: SodiumPlusOptional
sodiumGet the encryption key for a given message.
!!!! IMPORTANT !!!! This is a very rough proof-of-concept that doesn't support out-of-order messages.
Instead, it derives a 512-bit hash from the current key, then updates the session key with the leftmost 256 bits of that hash, and returns the rightmost 256 bits as the encryption key.
You should design your session key management protocol more appropriately for your use case.
Optional
recipient: booleanOverride the session key for a given participation partner.
Note that the actual sending/receiving keys will be derived from a BLAKE2b hash with domain separation (sending vs receiving) to ensure that messages sent/received are encrypted under different keys.
Participant ID.
Incoming key.
Optional
recipient: booleanAre we the recipient? (Default: No.)
This is a very basic symmetric ratchet based on BLAKE2b-512.
The first 256 bits of the output are stored as the future ratcheting key.
The remaining bits are returned as the encryption key.
This is a very basic example class for a session key manager.
If you do not specify one, the X3DH library will use this.