# Test a KeySigner approval over Tailscale

[Read this guide on KeySigner](https://keysigner.io/integrations/guides/test-a-keysigner-approval-over-tailscale/)

Send a test message from your Mac to KeySigner on your iPhone over a private Tailscale network. Check that the signature comes back only after you approve the exact message.

## Before you start

**KeySigner development setup on a Mac and iPhone**

- Use a private test Tailscale network with a policy that permits the iPhone to reach the Mac on the KeySigner test port. Use separate test state and an Ethereum key with no funds.

## Data and access

- **Shared or checked**. Tailscale carries traffic between the test iPhone and the Mac. The iPhone reviews the plain-text signing request and returns a signature after approval.
- **Check separately**. Keep the pairing link private and check the device fingerprint before trusting the iPhone. Tailscale access and signing approval are separate checks.

## 1. Connect the test Mac and iPhone

Join the same private Tailscale network on both devices. Use a trusted local network for the Mac and allow the iPhone to reach its KeySigner test port. Keep the server private and keep the pairing link between your devices.

~~~
tailscale ip -4
~~~

**Check.** Tailscale shows both test devices in the intended network, and you have the Mac’s private address.

## 2. Pair KeySigner over the private address

Run these commands from your KeySigner development checkout. Replace TAILSCALE_IP with the Mac’s address from step 1 and TEST_PORT with an unused port your Tailscale policy allows. Note the printed test directory for the next step. The address sets what the phone dials. Limit access to the development server’s port on other Mac network interfaces. On the iPhone, open the same private address and port at /health, then scan the pairing code, enroll and create a disposable Ethereum key.

~~~
KEYSIGNER_TEST_DIR="$(mktemp -d)"
printf "%s\n" "$KEYSIGNER_TEST_DIR"
XDG_CONFIG_HOME="$KEYSIGNER_TEST_DIR" \
  KEYSIGNER_CONFIG="$KEYSIGNER_TEST_DIR/sig/personal.json" \
  python3 tools/dev.py personal --host TAILSCALE_IP --port TEST_PORT
~~~

**Check.** The iPhone opens the health response for keysigner-api with profile personal and pairs with the test server.

## 3. Review and approve the test message

In a second terminal on the Mac, replace TEST_DIRECTORY with the path printed in step 2. Run the trust command and compare the printed fingerprint with the approval device fingerprint in KeySigner. Continue only if they match. Use the disposable key address in place of ADDRESS. In the iPhone app, compare the exact text in Inbox with what the Mac requested, then approve.

~~~
export KEYSIGNER_CONFIG="TEST_DIRECTORY/sig/personal.json"
keysigner-agent trust
keysigner-eth sign-message --from ADDRESS "KeySigner Tailscale test"
~~~

**Check.** The Mac has the intended approving device pinned. The exact request appears in KeySigner and the Mac receives a signature after approval.

## 4. Verify the returned signature

Use the same disposable address and replace SIGNATURE with the result. Verify the original text. Change one character and run verification again with the same address and signature. The test message sends no transaction.

~~~
cast wallet verify --address ADDRESS "KeySigner Tailscale test" SIGNATURE
~~~

### Read the three results

- **Server reachable.** The iPhone can reach the Mac’s private address and port. Next, check whether the paired app receives the request.
- **Request awaiting approval.** The iPhone displays the expected message and the Mac is still waiting for a signature.
- **Signature verified.** After approval, verification succeeds for the original text and fails for the changed text.

**Check.** The verifier accepts the original message and rejects the changed message.

## Check your result

Record the exact message, test address and verification result. Test again with the request denied to confirm that the Mac receives no signature. Stop the development server when the rehearsal ends.

[How to verify your setup](https://keysigner.io/integrations/verify-a-setup/)

## If you get stuck

### The iPhone cannot reach the Mac’s test server

Check the server is running, the private address and port printed at pairing match the Mac, and the test network and Mac firewall permit the connection. If the health check works but no request appears, check that KeySigner is open and paired to that same server.

## Tools in this guide

- [Tailscale](https://keysigner.io/integrations/tailscale/)
  - [Setup requirements](https://keysigner.io/integrations/setup-requirements/#tailscale)

## Setup instructions

- [Connect devices with Tailscale](https://tailscale.com/docs/how-to/connect-to-devices)
- [Check Tailscale network permissions](https://tailscale.com/docs/features/access-control)
- [Review Ethereum message verification](https://keysigner.io/integrations/guides/sign-an-ethereum-test-message/)

[More guides for this task](https://keysigner.io/integrations/tasks/check-key-approval/)
