Skip to main content

OdinCipher

typedef struct OdinCipher {
void (*init)(struct OdinCipher *cipher, struct OdinRoom *room);
void (*free)(struct OdinCipher *cipher);
void (*on_event)(struct OdinCipher *cipher, const unsigned char *bytes, uint32_t length);
int32_t (*encrypt_datagram)(struct OdinCipher *cipher,
const unsigned char *plaintext,
uint32_t plaintext_length,
unsigned char *ciphertext,
uint32_t ciphertext_capacity);
int32_t (*decrypt_datagram)(struct OdinCipher *cipher,
uint64_t peer_id,
const unsigned char *ciphertext,
uint32_t ciphertext_length,
unsigned char *plaintext,
uint32_t plaintext_capacity);
// ... Additional callbacks for messages and user data ...
// See full struct definition in headers for advanced usage
} OdinCipher;

Overview

Optional, pluggable encryption module for room communications. An cipher can be attached to an ODIN room handle on creation to enable customizable, end-to-end encryption (E2EE).

When enabled, it intercepts data right before transmission and immediately after reception, allowing custom processing of datagrams, messages and custom peer user data. The structure provides a suite of callback functions for initialization, cleanup, event handling and encryption/decryption tasks, along with parameters to adjust for any additional capacity overhead.