mathbdw / whatsapp-stream-encryption-test
Test task PSR-7 Stream decorators for WhatsApp encryption algorithms
v1.0.0
2025-06-09 18:16 UTC
Requires
- php: ^8.0
- ext-fileinfo: *
- ext-openssl: *
- psr/http-message: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^2.0
This package is auto-updated.
Last update: 2025-06-09 18:48:55 UTC
README
composer require mathbdw/whatsapp-media-encryption
Usage
Encrypt stream
$pathIn = './static/IMAGE.original'; $pathOut = './static/IMAGE.encrypted'; $key = './samples/IMAGE.key';
$encryption = new \WhatsApp\Stream\Encryption\Models\EncryptStreamImage($stream1, $stream2); $encryption->exec($key);
The key is not required. If there is no key after encryption, the key file will be added to the output file folder.
$pathIn = './static/IMAGE.original'; $pathOut = './static/IMAGE.encrypted'; $encryption = new \WhatsApp\Stream\Encryption\Models\EncryptStreamImage($pathIn, $pathOut); $encryption->exec();
Decrypt stream
$pathIn = './static/IMAGE.encrypted'; $pathOut = './static/IMAGE.original'; $key = './samples/IMAGE.key';$enStream = new \WhatsApp\Stream\Encryption\Models\DecryptStreamImage($pathIn, $pathOut); $enStream->exec($key);
Type file encryption
//Video $enStream = new \WhatsApp\Stream\Encryption\Models\EncryptStreamVideo($pathIn, $pathOut); $deStream = new \WhatsApp\Stream\Encryption\Models\DecryptStreamVideo($pathIn, $pathOut); //Audio $enStream = new \WhatsApp\Stream\Encryption\Models\EncryptStreamAudio($pathIn, $pathOut); $deStream = new \WhatsApp\Stream\Encryption\Models\DecryptStreamAudio($pathIn, $pathOut); //Image $enStream = new \WhatsApp\Stream\Encryption\Models\EncryptStreamImage($pathIn, $pathOut); $deStream = new \WhatsApp\Stream\Encryption\Models\DecryptStreamImage($pathIn, $pathOut); //Document $enStream = new \WhatsApp\Stream\Encryption\Models\EncryptStreamDocument($pathIn, $pathOut); $deStream = new \WhatsApp\Stream\Encryption\Models\DecryptStreamDocument($pathIn, $pathOut);