ROUTERELAY — ONE-TIME TESLA SETUP ON YOUR MAC

The hosted domain and public-key file must be publicly reachable first.
This helper is not a substitute for activating DNS or approving public access.

Tesla application settings:
  Grant: Authorization Code and Machine-to-Machine
  Allowed Origin: https://routerelay.jaykreps.com
  Redirect URI: https://routerelay.jaykreps.com/tesla/callback
  Allowed Returned URLs: leave empty
  Permission: Vehicle Commands

1. Finish the Tesla developer application and find its client ID and client secret.
2. Install Node.js 22 or later if needed (https://nodejs.org).
3. Open “Run Tesla Setup.command”. If macOS blocks a downloaded launcher, use
   Terminal in this folder and run: node authorize-tesla.mjs
4. In the local browser page, enter client ID, client secret and your vehicle VIN.
5. The helper checks the published public key and registers the application in
   Tesla's North America region. It then opens Tesla's own sign-in page.
6. Use the same Mac and browser throughout. On the return page, click
   “Finish connecting on this Mac”. The helper checks the response and exchanges
   its one-time code directly with Tesla.
7. Copy VIN, client ID, access token and refresh token to the iPhone app's
   Connection screen. Save in Keychain, then clear and close the Mac helper.

If the application/domain was already regionally registered, select the
advanced checkbox before starting. Use it only for a registration you completed.
Sign-in attempts expire after 10 minutes; the helper session expires after 30.
The helper binds only to 127.0.0.1:8766, does not save credentials to disk,
does not log tokens or authorization URLs, and sends no vehicle commands.
The hosted callback receives a short-lived authorization code, not the issued
access/refresh tokens. The Mac helper performs the token exchange locally.

The EC public key in this folder is public, not a password. Its matching private
key is stored as a secret in the RouteRelay connection Site, not in this download.

This helper has been tested with simulated Tesla responses. Actual Tesla sign-in,
registration and iPhone routing still need to be tested with your account/device.
