Skip to content

Commit

Permalink
docs: Update connection-approval.md (Unity-Technologies#366)
Browse files Browse the repository at this point in the history
Give clarity what namespaces need to be included
  • Loading branch information
xackery authored Oct 8, 2020
1 parent 806b06d commit 5f474e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/_docs/getting-started/connection-approval.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ During every new connection the MLAPI performs a handshake on top of the one(s)

However, when ConnectionApproval is true you are also required to provide a callback where you put your approval logic inside. (Server only) Example:
```csharp
using MLAPI;
using MLAPI.Spawning;

private void Setup()
{
NetworkingManager.Singleton.ConnectionApprovalCallback += ApprovalCheck;
Expand All @@ -31,6 +34,8 @@ private void ApprovalCheck(byte[] connectionData, ulong clientId, MLAPI.Networki
### Connection data
The connectionData parameter is any custom data of your choice that the client should send to the server. Usually, this should be some sort of ticket, room password or similar that will decide if a connection should be approved or not. The connectionData is specified on the Client side in the NetworkingConfig supplied when connecting. Example:
```csharp
using MLAPI;

NetworkingManager.Singleton.NetworkConfig.ConnectionData = System.Text.Encoding.ASCII.GetBytes("room password");
NetworkingManager.Singleton.StartClient();
```
Expand All @@ -45,4 +50,4 @@ The MLAPI uses a callback system in order to allow for external validation. For
If connection approval is enabled. Any messages sent before a connection is setup are silently ignored.

#### Connection Data
If Encryption is enabled, the connection handshake with the buffer will be encrypted AND authenticated. (AES-256 encryption and HMAC-SHA-256 authentication). Please note that if the key exchange is not signed, a man in the middle attack can be done. If you plan on sending authentication tokens such as steam tickets. It's strongly suggested that you sign the handshake.
If Encryption is enabled, the connection handshake with the buffer will be encrypted AND authenticated. (AES-256 encryption and HMAC-SHA-256 authentication). Please note that if the key exchange is not signed, a man in the middle attack can be done. If you plan on sending authentication tokens such as steam tickets. It's strongly suggested that you sign the handshake.

0 comments on commit 5f474e5

Please sign in to comment.