#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
for f in app/*.php public/index.php public/api/*.php scripts/*.php; do php -l "$f"; done
node --check public/assets/app.js
node tests/crypto.mjs
php -r '
require "app/bootstrap.php";
function test(bool $passed, string $name): void { if (!$passed) { throw new Exception($name); } echo "OK: $name\n"; }
$value = secret_base64url(random_bytes(32));
test(secret_valid_encoding($value, 32, 32), "Base64url validation");
test(!secret_valid_encoding($value . "=", 32, 32), "Noncanonical padding rejected");
test(!secret_valid_encoding($value, 12, 12), "Incorrect IV size rejected");
test(secret_id_valid(secret_base64url(random_bytes(18))), "24-char identifier accepted");
test(!secret_id_valid("id_with_wrong_length"), "Invalid identifier rejected");
'
