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

@param RequestInterface $request
@param SharedEncryptionKey $key
@return RequestInterface
Encrypt an HTTP request with a pre - shared key .