[ 'host' => 'localhost', 'port' => 8000, 'debug' => true, 'actorPath' => '/accounts/', ], 'logger' => [ 'driver' => '\Psr\Log\NullLogger' ], 'http' => [ 'timeout' => 15 ], 'cache' => [ 'enabled' => false, ] ]); // Create a response to a message for example $object = json_decode(" {\n "id": "http://localhost:8001/accounts/bob/status/123",\n "type": "Note",\n "published": "".date('Y-m-d\TH:i:s\Z')."",\n "attributedTo": "http://localhost:8001/accounts/bob",\n "inReplyTo": "http://localhost:8000/accounts/bob",\n "content": "

Hello world

",\n "to": "https://www.w3.org/ns/activitystreams#Public"\n }", true); $payload = json_encode( Type::create([ 'type' => 'Create', 'object' => $object ])->toArray() ); /* ------------------------------------------------------------------ | Prepare signature | ------------------------------------------------------------------ */ $date = gmdate('D, d M Y H:i:s T', time()); $host = 'localhost'; $path = '/my-path?q=ok'; $rsa = RSA::createKey() ->loadPrivateKey( file_get_contents( dirname(__DIR__, 2) . '/WebServer/distant/keys/private.pem' ) )->withHash("sha256"); // private key $plaintext = "(request-target) post $path\nhost: $host\ndate: $date"; $signature = $rsa->sign($plaintext); /* ------------------------------------------------------------------ | Prepare request | ------------------------------------------------------------------ */ $request = Request::create( 'http://localhost:8000' . $path, 'POST', [], // parameters [], // cookies [], // files $_SERVER, $payload ); $request->headers->set('accept', 'application/activity+json'); // Signature: keyId="",headers="(request-target) host date",signature="" $request->headers->set('Signature', 'keyId="http://localhost:8001/accounts/bob#main-key",headers="(request-target) host date",signature="' . base64_encode($signature) . '"'); $request->headers->set('host', $host); $request->headers->set('date', $date); $response = $server->inbox('bob@localhost:8000')->post($request); // Assert response type $this->assertInstanceOf(Response::class, $response); // Assert HTTP status code $this->assertEquals( 201, $response->getStatusCode() ); } } __halt_compiler();----SIGNATURE:----Qo5EZAlRylZNgRYLVRBKd7tsEKGa8IR5Yg78nFwOYUiJmNNABSRl0+Wj/sZS3tXazg0TiQVguIMgDaynx0v42WDIZSSucW3A81wvoL/Lu3O5o649P+CuX4SfNfK6xLGqV9LEo8fnCGuYfsdp66CgIkwjjcE98OcBlZuHgYlkW1XZcbn7ztBxlmM4HUkq25xK9rCwRD6xNS2JF7pPL0HMJG3x1ia0saK1BdGzoTqvpr6jHivFx9a6Cke9ZBelGdHvKqVNb6RAH/2Kdv7bA3gFuKxrCtWep9DHsOGs/Xq+VH9Uxm9TX6lltySOw5AWpJMcdJ+r5l+06ZQtyNwMyrCelNMeOz8H1gKjvh5A7CIOs8BRXCh/0rYOP3we7ruBwQ7AjunoVyIJMUJmIF/UuSfa1L5m5btVQx8sv+JC1aABkYaYHBxygTuSAnbvIQ4KWzvNAYFaaShSEHtopNf/9XMqQXwCefgmFPYrE/4Lip4PCwuGh08EjeUArjv3gbzIXipsufwPeIsGXO6l0/iIgbqMm5cffZJh/W2lFmv+PVSlmK0w94s2cuhU85SWP+r6wQJ736aBFfm2OhvToE/LIdXR/Q8CSgNenqxRduLMhQ7L0LhErvJy8EpGHFUvbm40duMdULLFrrdNoyoA3nfH2Df8as4CqOjgpuYTDq4N59IFzFA=----ATTACHMENT:----NzY1OTgwMDcwMzY5NDQ3NiA4NzA3MjA3NjIwNDEzNjI1IDgwODE0NzUyMDAzODM2NTM=