Required Variables
You must provide your Secret Key and at least one way to resolve your Frontend API URL (usually via the Publishable Key).Your Secret API Key (
wk_test_... or wk_live_...). This key grants full administrative access to your deployment’s backend APIs (api.wacht.dev). Never expose this key to the frontend.Your Publishable Key (
pk_test_... or pk_live_...). When provided, the SDK uses this key to automatically derive your normalized WACHT_FRONTEND_HOST behind the scenes.The base URL of your Wacht Frontend API. If you have provided
WACHT_PUBLISHABLE_KEY, this variable is purely optional and takes precedence if set. Use this if you are using a custom domain for your frontend API.Optional Variables
A static PEM-encoded RSA public key used to verify JWT session tokens.By default, the SDK dynamically fetches your deployment’s JSON Web Key Set (JWKS) via an HTTP request. Providing this environment variable tells the SDK to use the static key instead, eliminating the network request. This is highly recommended for serverless or edge environments where cold start times matter.
Example .env File
.env
