> For the complete documentation index, see [llms.txt](https://mobilecoin.gitbook.io/full-service-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mobilecoin.gitbook.io/full-service-api/usage/mirror/running-with-encryption.md).

# Running With Encryption

It is possible to run the mirror in a mode that causes it to encrypt requests and responses between the private side and the client. In this mode, anyone having access to the public side of the mirror will be unable to tamper with requests/responses or view them. When running in this mode, which is enabled by passing the `--mirror-key` argument to the private side of the mirror, only encrypted requests will be processed and only encrypted responses will be returned.

In order to use this mode, follow the following steps.

1. Ensure that you have NodeJS installed. **The minimum supported version is v12.9.0** (`node -v`)
2. Generate a keypair: `./bin/generate-rsa-keypair`. This will generate two files: `mirror-client.pem` and `mirror-private.pem`.

To run with encryption (tls is optional but recommended), use the following command to start the private service:

```sh
./bin/wallet-service-mirror-private \
  --mirror-public-uri "wallet-service-mirror://localhost/?ca-bundle=server.crt&tls-hostname=localhost" \
  --wallet-service-uri http://localhost:9090/wallet/v2 \
  --mirror-key mirror-private.pem
```

{% hint style="info" %}
Notice the --mirror-key flag with the mirror-private.pem file, generated with the generate-rsa-keypair binary.
{% endhint %}

To test with encryption, please use the [example mirror-client.js](https://github.com/mobilecoinofficial/full-service/blob/main/mirror/test/mirror-client.js).

```bash
node example-client.js 127.0.0.1 9091 mirror-client.pem \
'{"method": "get_block", "params": {"block_index": "0"}, "jsonrpc": "2.0", "id": 1}'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mobilecoin.gitbook.io/full-service-api/usage/mirror/running-with-encryption.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
