mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 19:08:50 +03:00
Not Tachyon
This commit is contained in:
parent
49dd9a7c7c
commit
8678c0e8fd
4 changed files with 20 additions and 41 deletions
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
// Run with: php test/crypt-forgery.php
|
||||
|
||||
// Crypt logs through Tachyon\Util\Log and reads its cipher from Tachyon\Api at
|
||||
// Crypt logs through SnappyMail\Log and reads its cipher from RainLoop\Api at
|
||||
// load time, both of which need the whole application. Stand-ins are declared
|
||||
// before the autoloader could load the real classes; Config returns defaults.
|
||||
namespace Tachyon\Util {
|
||||
namespace SnappyMail {
|
||||
abstract class Log
|
||||
{
|
||||
public static function __callStatic(string $name, array $arguments) : void {}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Tachyon {
|
||||
namespace RainLoop {
|
||||
abstract class Api
|
||||
{
|
||||
public static function Config() : object
|
||||
|
|
@ -25,18 +25,12 @@ namespace Tachyon {
|
|||
}
|
||||
|
||||
namespace {
|
||||
define('APP_SALT', 'test-salt-'.bin2hex(random_bytes(8)));
|
||||
define('APP_VERSION', 'test');
|
||||
// Enable SnappyMail Api and include index file
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
require '../index.php';
|
||||
// define('APP_SALT', 'test-salt-'.bin2hex(random_bytes(8)));
|
||||
|
||||
$_COOKIE['smctoken'] = base64_encode(random_bytes(16));
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$base = dirname(__DIR__).'/tachyon/v/0.0.0/app/libraries/';
|
||||
$file = str_starts_with($class, 'Tachyon\\Util\\')
|
||||
? $base.'tachyon_util/'.strtolower(str_replace('\\', '/', substr($class, 13))).'.php'
|
||||
: $base.str_replace('\\', '/', $class).'.php';
|
||||
if (is_file($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
});
|
||||
|
||||
function check(bool $condition, string $message): void
|
||||
{
|
||||
|
|
@ -45,7 +39,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
$Crypt = 'Tachyon\\Util\\Crypt';
|
||||
$Crypt = 'SnappyMail\\Crypt';
|
||||
|
||||
check(is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt'), 'test needs sodium');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
// Run with: php test/header-injection.php
|
||||
define('APP_VERSION', 'test');
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$file = dirname(__DIR__).'/tachyon/v/0.0.0/app/libraries/'.str_replace('\\', '/', $class).'.php';
|
||||
if (is_file($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
});
|
||||
// Enable SnappyMail Api and include index file
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
require '../index.php';
|
||||
|
||||
function check(bool $condition, string $message): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
|
||||
// Run with: php test/raw-inline-type.php
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$file = dirname(__DIR__).'/tachyon/v/0.0.0/app/libraries/'.str_replace('\\', '/', $class).'.php';
|
||||
if (is_file($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
});
|
||||
// Enable SnappyMail Api and include index file
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
require '../index.php';
|
||||
|
||||
function check(bool $condition, string $message): void
|
||||
{
|
||||
|
|
@ -17,7 +14,7 @@ function check(bool $condition, string $message): void
|
|||
|
||||
class RawInlineType
|
||||
{
|
||||
use \Tachyon\Actions\Raw;
|
||||
use \RainLoop\Actions\Raw;
|
||||
}
|
||||
|
||||
$cases = [
|
||||
|
|
|
|||
|
|
@ -1,15 +1,7 @@
|
|||
<?php
|
||||
|
||||
// Run with: php test/smime-verify.php
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$base = dirname(__DIR__).'/tachyon/v/0.0.0/app/libraries/';
|
||||
$file = str_starts_with($class, 'Tachyon\\Util\\')
|
||||
? $base.'tachyon_util/'.strtolower(str_replace('\\', '/', substr($class, 13))).'.php'
|
||||
: $base.str_replace('\\', '/', $class).'.php';
|
||||
if (is_file($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
});
|
||||
// Enable SnappyMail Api and include index file
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
require '../index.php';
|
||||
|
||||
function check(bool $condition, string $message): void
|
||||
{
|
||||
|
|
@ -28,7 +20,7 @@ openssl_pkey_export_to_file($key, "{$dir}/key.pem");
|
|||
$content = "Content-Type: text/plain\r\n\r\nPay 100 EUR to account A.\r\n";
|
||||
file_put_contents("{$dir}/in.txt", $content);
|
||||
|
||||
$smime = new \Tachyon\Util\SMime\OpenSSL($dir);
|
||||
$smime = new \SnappyMail\SMime\OpenSSL($dir);
|
||||
|
||||
// Detached (multipart/signed) and opaque (application/pkcs7-mime) signatures.
|
||||
foreach (['detached' => PKCS7_DETACHED, 'opaque' => 0] as $kind => $flags) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue