diff options
| author | Gab <24553253+gabrix73@users.noreply.github.com> | 2026-08-14 20:39:22 +0200 |
|---|---|---|
| committer | Gab <24553253+gabrix73@users.noreply.github.com> | 2026-08-14 20:39:22 +0200 |
| commit | 43fbddf016f94f4ba006d82c9a67dca61b5852a1 (patch) | |
| tree | 70054d5fa8a34bb094b8c3ef8ddc9c1fcea3b3d5 /katzenpost_sender.php | |
| parent | 994071243fc80990cf09e820b671006e9bd31c76 (diff) | |
| download | yamnweb-43fbddf016f94f4ba006d82c9a67dca61b5852a1.tar.gz yamnweb-43fbddf016f94f4ba006d82c9a67dca61b5852a1.tar.xz yamnweb-43fbddf016f94f4ba006d82c9a67dca61b5852a1.zip | |
Complete Nym and YAMN transport integration
Diffstat (limited to 'katzenpost_sender.php')
| -rw-r--r-- | katzenpost_sender.php | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/katzenpost_sender.php b/katzenpost_sender.php deleted file mode 100644 index 88ce2ae..0000000 --- a/katzenpost_sender.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** Send an already prepared YAMN payload through the local Katzenpost sender. */ -function sendKatzenpostEnvelope(string $entryAddress, string $payload, int $copies = 1): array -{ - $sender = getenv('YAMN_KP_SENDER') ?: '/usr/local/bin/yamn-submit'; - $config = getenv('YAMN_KP_CONFIG') ?: '/etc/yamnweb/thinclient.toml'; - if (!is_executable($sender)) { - return ['success' => false, 'error' => 'Katzenpost sender is not available']; - } - if (!filter_var($entryAddress, FILTER_VALIDATE_EMAIL) || !str_ends_with(strtolower($entryAddress), '@remailer.example')) { - return ['success' => false, 'error' => 'Invalid YAMN entry address']; - } - if ($payload === '' || strlen($payload) > 65536) { - return ['success' => false, 'error' => 'Invalid YAMN payload']; - } - - $message = "To: {$entryAddress}\n" . $payload; - if (!str_contains($message, "-----BEGIN REMAILER MESSAGE-----\n")) { - $message = "To: {$entryAddress}\n\n-----BEGIN REMAILER MESSAGE-----\n" . $payload; - } - if ($copies !== 1) return ['success' => false, 'error' => 'Multiple copies are not enabled in the PoC']; - $input = json_encode(['entry_address' => $entryAddress, 'message' => $message], JSON_THROW_ON_ERROR); - $descriptor = [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; - $process = proc_open([$sender, '-config', $config, '-settle', '2s'], $descriptor, $pipes); - if (!is_resource($process)) return ['success' => false, 'error' => 'Unable to start Katzenpost sender']; - fwrite($pipes[0], $input); - fclose($pipes[0]); - $stdout = stream_get_contents($pipes[1]); fclose($pipes[1]); - $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); - $status = proc_close($process); - return $status === 0 ? ['success' => true] : ['success' => false, 'error' => 'Katzenpost submission failed']; -} |
