Skip to content

Quick Start

using Byteria.SDK;
using UnityEngine;
public class GameInitializer : MonoBehaviour
{
void Start()
{
AlphynSDK.OnInitialized += OnSDKInitialized;
// Pass "" as the second argument in production (see note below).
AlphynSDK.Initialize(30f, "");
}
private void OnSDKInitialized(bool success, string message)
{
if (success)
{
Debug.Log("Alphyn SDK ready!");
CheckSecurityStatus();
}
else
{
Debug.LogError($"SDK init failed: {message}");
}
}
private void CheckSecurityStatus()
{
string scanJson = AlphynSDK.GetScanResult();
ScanResult result = ScanResult.Parse(scanJson);
if (result != null && result.HasThreats())
{
Debug.LogWarning($"Threats: {result.GetThreatSummary()}");
}
}
}

Note: The second argument of Initialize is a development-only debug hash. Always call AlphynSDK.Initialize(30f, "") in production builds. During development you can pass your app’s debug hash from the Alphyn Portal instead of "".

using Byteria.SDK;
using UnityEngine;
public class PaymentHandler : MonoBehaviour
{
// `userId` is your own identifier for the logged-in user, and EnrollForMfa(userId) must have run
// once on this device first. The PIN is optional. See https://docs.byteria.dev/mfa/
public void ProcessWithdrawal(string userId, float amount, string destination, char[] pin)
{
string context = $"{{\"amount\":{amount},\"destination\":\"{destination}\"}}";
string resultJson = AlphynSDK.SignAction(userId, "WITHDRAW", context, pin);
var result = ActionVerificationResult.Parse(resultJson);
if (result.success && result.IsTokenValid())
{
SendToBackend(result.verificationToken);
}
else
{
Debug.LogError($"Verification failed: {result.errorMessage}");
}
}
}