<?php
// 1. Include the autoloader that Composer created for you
require_once 'vendor/autoload.php';

use Firebase\JWT\JWT;

// 2. Your Safehaven Credentials
$clientId = 'f395d64a1cc4cb4ae0f6a56194513536';
$privateKey = "privatekey.pem"; 
$tokenUrl = "https://api.sandbox.safehavenmfb.com"; //

// 3. Create the Payload
$payload = [
    'sub' => $clientId,
    'jti' => bin2hex(random_bytes(16)),
    'aud' => $tokenUrl,
    'iat' => time(),
    'exp' => time() + 3600 // Valid for 1 hour
];

// 4. Generate the Client Assertion
$clientAssertion = JWT::encode($payload, $privateKey, 'RS256');

echo "Generated Client Assertion: " . $clientAssertion;
?>
