public function encryptResponseWithSharedKey(
        ResponseInterface $response,
        SharedEncryptionKey $key
    ): ResponseInterface {
        $encrypted = Base64UrlSafe::encode(
            Simple::encrypt((string) $response->getBody(), $key)
        );
        return $response->withBody(
            $this->adapter->stringToStream($encrypted)
        );
    }
public function encryptResponseWithSharedKey(
        ResponseInterface $response,
        SharedEncryptionKey $key
    ): ResponseInterface {
        $encrypted = Base64UrlSafe::encode(
            Simple::encrypt((string) $response->getBody(), $key)
        );
        return $response->withBody(
            $this->adapter->stringToStream($encrypted)
        );
    }
public function encryptResponseWithSharedKey ( ResponseInterface $ response , SharedEncryptionKey $ key ) : ResponseInterface { $ encrypted = Base64UrlSafe :: encode ( Simple :: encrypt ( ( string ) $ response -> getBody ( ) , $ key ) ) ; return $ response -> withBody ( $ this -> adapter -> stringToStream ( $ encrypted ) ) ; }
Encrypt an HTTP response with a pre-shared key.

@param ResponseInterface $response
@param SharedEncryptionKey $key
@return ResponseInterface
Encrypt an HTTP response with a pre - shared key .