#!/usr/bin/env php = 4) { $input = $argv[3]; } else { fail("missing token"); } if ($argc >= 5) { if (!ctype_digit($argv[4])) { fail("invalid ttl-seconds"); } $ttl = (int)$argv[4]; } echo encipher($public_key, make_token_payload($input, $now, $ttl)) . PHP_EOL; exit(0); } if ($mode === "decipher") { $input = $argc >= 4 ? $argv[3] : stream_get_contents(STDIN); $private_key = load_private_key($key_file); if ($input === false) { fail("failed to read input"); } echo parse_token_payload(decipher($private_key, $input)) . PHP_EOL; exit(0); } usage();