Skip to main content
Version: 2.x

Class OdinCrypto

Wrapper class of OdinNative.Wrapper.Crypto for Unity.

This convenient class provides predefined encryption helper functions for Unity. If Peers do not have the same cipher they can not communicate with each other besides some events.

Declaration
[HelpURL("https://docs.4players.io/voice/unity/next/api/OdinNative.Unity/OdinCrypto/")]
[AddComponentMenu("Odin/Instance/OdinCrypto")]
public class OdinCrypto : MonoBehaviour

Inheritance: System.Object -> UnityEngine.Object -> UnityEngine.Component -> UnityEngine.Behaviour -> UnityEngine.MonoBehaviour

Fields

InitialPassword

Initial cipher value

Declaration
[Tooltip("Shared password for peers so they can send messages, hear and speak to each other. This should be (re)set by clients.")]
public string InitialPassword

Methods

GetCryptoCipher()

Get handle to cipher

Declaration
public OdinCipherHandle GetCryptoCipher()
Returns

OdinNative.Core.Imports.OdinCipherHandle: Handle or null

ChangePassword(string)

Set a password for encryption. Peers with the same password can hear each other. null == unencrypted

Declaration
public bool ChangePassword(string password)
Returns

System.Boolean: false on failure

Parameters
TypeNameDescription
System.Stringpasswordcipher password

GetPeerStatus(int)

Get the encryption status of peer

Declaration
public bool GetPeerStatus(int peerId)
Returns

System.Boolean: true if encrypted or false

Parameters
TypeNameDescription
System.Int32peerIdpeer id to check

GetPeerStatus(OdinPeer)

Get the encryption status of peer

Declaration
public bool GetPeerStatus(OdinPeer peer)
Returns

System.Boolean: true if encrypted or false

Parameters
TypeNameDescription
OdinNative.Unity.OdinPeerpeerpeer to check