This repository provides Unity Plugin used by PrivMX to handle end-to-end (e2e) encryption.
PrivMX is a privacy-focused platform designed to offer secure collaboration solutions by integrating robust encryption across various data types and communication methods. This project enables seamless integration of PrivMX’s encryption functionalities in Unity Engine applications, preserving the security and performance of the original C++ library while making its capabilities accessible in the Unity projects.
PrivMX allows developers to build end-to-end encrypted apps used for communication. The Platform works according to privacy-by-design mindset, so all of our solutions are based on Zero-Knowledge architecture. This project extends PrivMX’s commitment to security by making its encryption features accessible to developers using C# in Unity Engine.
- End-to-End Encryption: Ensures that data is encrypted at the source and can only be decrypted by the intended recipient.
- Native C++ Library Integration: Leverages the performance and security of C++ while making it accessible in Unity applications.
- Cross-Platform Compatibility: Designed to support PrivMX on multiple operating systems and environments.
- Simple API: Easy-to-use interface for Unity developers without compromising security.
PrivMX Endpoint Unity Plugin provides functionality of PrivMX Endpoint C# and PrivMX Endpoint C# Extra, wrapping it all into a simple, ready to use package in Unity Engine. It adds utility data structures that simplify working with state and event processing and helps developers with base configuration of PrivMX Session.
Features:
CryptoApi
- Cryptographic methods used to encrypt/decrypt and sign your data or generate keys to work with PrivMX Bridge.Connection
- Methods for managing connection with PrivMX Bridge.ThreadApi
- Methods for managing Threads and sending/reading messages.StreamApi
- Methods for managing sending/receiving data via Streams.
- At least Unity
2022.3.x
. - Access to running PrivMX Bridge.
- Android
arm64-v8a
armeabi-v7a
- Windows
x86_64
In your Unity project, go to Window -> Package Manager, select the "Install package from git URL" option in + menu tab and paste: https://github.com/simplito/privmx-endpoint-unity-plugin.git
.
- Make sure that project is configured to use Mono as scripting backend.
- Configure PrivMX Bridge.
Example bellow shows how to join and manage a PrivMX Session. It assumes that there already is a context with at least one user added to it. To create your users and contexts use the Bridge API in your code.
- Create a empty GameObject and add PrivMX Session and SessionStateChange_EventDispatcher to it.

- Create a script that will handle PrivMX related logic.
- Create a GenerateKeyPair method and add a method that will allow the app to generate a private and public key for the user, that wants to join the session.
using Simplito;
using UnityEngine;
public class PrivMX_Example : MonoBehaviour
{
[SerializeField] private PrivMxSession session;
private string publicKey;
private string privateKey;
public void GenerateKeyPair(string password, string salt)
{
privateKey = PrivMXUtility.DerivePrivateKey(password, salt);
publicKey = PrivMXUtility.DerivePublicKey(privateKey);
}
}
- To connect to your Bridge, create a ConnectToPrivmx() method, that will authorize the user. If function returns true, user is logged in.
public async Task<bool> ConnectToPrivmx(string bridgeAddress, string solutionId, CancellationToken token = default)
{
try
{
using (token.LinkIfNeeded(destroyCancellationToken, out token))
{
token.ThrowIfCancellationRequested();
await session.Authorize(bridgeAddress, solutionId, privateKey, token);
}
return true;
}
catch (Exception ex)
{
Debug.Log("Authorize failed: " + ex.Message);
}
return false;
}
public async void JoinSession(string bridgeAddress, string solutionId)
{
bool loggedIn = await ConnectToPrivmx(bridgeAddress, solutionId);
if (loggedIn) Debug.Log("Logged in");
else Debug.Log("Unable to log in");
}
- To disconnect the user, create a LogOutOfSession() method.
public void LogOutOfSession()
{
try
{
session.DisconnectAsync();
}
catch (Exception exception)
{
Debug.LogException(exception);
}
}
- Now, in the Inspector, add callbacks to your SessionStateChange_EventDispatcher. First one should be called when a user joins session successfully. The other when user logs out.
public void JoinedSessionCallback()
{
Debug.Log("Logged in");
}
public void LoggedOutCallback()
{
Debug.Log("Logged out");
}
It should look like this:

PrivMX Endpoint Unity Plugin
Copyright © 2025 Simplito sp. z o.o.
This project is part of the PrivMX Platform (https://privmx.dev).
This project is Licensed under the MIT License.
PrivMX Endpoint and PrivMX Bridge are licensed under the PrivMX Free License.
See the License for the specific language governing permissions and limitations under the License.