diff --git a/Facepunch.Steamworks.Test/Client.cs b/Facepunch.Steamworks.Test/Client.cs
index 12276d7..a18bf88 100644
--- a/Facepunch.Steamworks.Test/Client.cs
+++ b/Facepunch.Steamworks.Test/Client.cs
@@ -40,5 +40,22 @@ public void ClientSteamId()
Assert.AreNotEqual( 0, steamid );
}
}
+
+ [TestMethod]
+ public void ClientAuthSessionTicket()
+ {
+ using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
+ {
+ var ticket = client.GetAuthSessionTicket();
+
+ Assert.IsTrue( ticket != null );
+ Assert.IsTrue( ticket.Handle != 0 );
+ Assert.IsTrue( ticket.Data.Length > 0 );
+
+ client.CancelAuthTicket( ticket );
+
+ Assert.IsTrue( ticket.Handle == 0 );
+ }
+ }
}
}
diff --git a/Facepunch.Steamworks/Client.Auth.cs b/Facepunch.Steamworks/Client.Auth.cs
new file mode 100644
index 0000000..cb2f440
--- /dev/null
+++ b/Facepunch.Steamworks/Client.Auth.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Facepunch.Steamworks
+{
+ public partial class Client : IDisposable
+ {
+ public class AuthTicket
+ {
+ public byte[] Data;
+ public uint Handle;
+ }
+
+ ///
+ /// Creates an auth ticket.
+ /// Which you can send to a server to authenticate that you are who you say you are.
+ ///
+ public unsafe AuthTicket GetAuthSessionTicket()
+ {
+ var data = new byte[1024];
+
+ fixed ( byte* b = data )
+ {
+ uint ticketLength = 0;
+ uint ticket = _user.GetAuthSessionTicket( (IntPtr) b, data.Length, ref ticketLength );
+
+ if ( ticket == 0 )
+ return null;
+
+ return new AuthTicket()
+ {
+ Data = data.Take( (int)ticketLength ).ToArray(),
+ Handle = ticket
+ };
+ }
+ }
+
+ ///
+ /// Cancels a ticket.
+ /// You should cancel your ticket when you close the game or leave a server.
+ ///
+ public void CancelAuthTicket( AuthTicket ticket )
+ {
+ _user.CancelAuthTicket( ticket.Handle );
+ ticket.Handle = 0;
+ ticket.Data = null;
+ }
+ }
+}
diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs
index 6ee2c9b..8f2aaea 100644
--- a/Facepunch.Steamworks/Client.cs
+++ b/Facepunch.Steamworks/Client.cs
@@ -5,7 +5,7 @@
namespace Facepunch.Steamworks
{
- public class Client : IDisposable
+ public partial class Client : IDisposable
{
private Valve.Steamworks.ISteamClient _client;
private uint _hpipe;
diff --git a/Facepunch.Steamworks/Facepunch.Steamworks.csproj b/Facepunch.Steamworks/Facepunch.Steamworks.csproj
index 33bc167..5732628 100644
--- a/Facepunch.Steamworks/Facepunch.Steamworks.csproj
+++ b/Facepunch.Steamworks/Facepunch.Steamworks.csproj
@@ -21,6 +21,7 @@
DEBUG;TRACE
prompt
4
+ true
pdbonly
@@ -31,6 +32,7 @@
4
+ true
@@ -41,6 +43,7 @@
+