<?php

defined( 'ABSPATH' ) || exit;

use Vendtics\Firebase\JWT\JWT;
use Vendtics\Firebase\JWT\Key;

function vendtics_generate_jwt_token( array $payload ) {
    $payload['iat'] = time();
    return JWT::encode( $payload, AUTH_SALT, 'HS256' );
}

function vendtics_verify_jwt_token( $token ) {
    $decoded = JWT::decode( $token, new Key( AUTH_SALT, 'HS256' ) );
    return (array) $decoded; 
}