1) { echo " Plusieurs candidats : " . implode(', ', array_map('basename', $candidates)) . "\n"; } continue; } } $size = filesize($zip); echo " [hash] $version : " . basename($zip) . " ($size octets)..."; $sha = hash_file('sha256', $zip); echo " sha256={$sha}\n"; $v['download']['sizeBytes'] = $size; $v['download']['sha256'] = $sha; $updated++; $hashedVersions[] = $version; } unset($v); // Met à jour automatiquement le champ `latest` avec la plus haute version // effectivement uploadée (celle pour laquelle on a calculé un hash). if (!empty($hashedVersions)) { usort($hashedVersions, function ($a, $b) { return version_compare($a, $b); }); $newLatest = end($hashedVersions); if (($manifest['latest'] ?? null) !== $newLatest) { echo " [latest] {$manifest['latest']} -> {$newLatest}\n"; $manifest['latest'] = $newLatest; } } // (v0.4) Signature Ed25519 — pour l'instant on laisse 'signature' = null. // $config = require __DIR__ . '/../api/config.php'; // $sk = sodium_hex2bin($config['ed25519']['private_key_hex']); // $payload = json_encode($manifest, JSON_UNESCAPED_SLASHES); // $manifest['signature'] = base64_encode(sodium_crypto_sign_detached($payload, $sk)); file_put_contents( $manifestPath, json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n" ); echo "Manifest mis à jour ({$updated} version(s)) : $manifestPath\n";