Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tkhq/sdk/llms.txt
Use this file to discover all available pages before exploring further.
@turnkey/api-key-stamper stamps Turnkey API requests using a P-256 API key pair. It is intended for server-side or CLI environments where the key pair is stored securely in environment variables or a secrets manager.
Installation
Usage
TurnkeyClient, call any API method and the stamper signs the request automatically:
ApiKeyStamper constructor
The hex-encoded P-256 public key from your Turnkey API key pair. Included in every stamp so Turnkey can identify which authenticator signed the request.
The hex-encoded P-256 private key used to sign request payloads. Keep this value in a secure secrets store and never commit it to source control.
Override the automatic runtime detection. By default the stamper detects whether it is running in a browser (Web Crypto API), Node.js (
node:crypto), or a pure-JS fallback for environments without native crypto (e.g., older React Native). Only set this if the automatic detection produces the wrong result.signWithApiKey function
If you need a raw signature rather than a full HTTP stamp, the package also exports signWithApiKey directly:
stamper.sign(payload, format) to get either a DER or raw signature:
Runtime detection
The stamper automatically selects the signing backend based on the JavaScript environment:| Runtime | Signing backend |
|---|---|
Browser with Web Crypto (window.crypto.subtle) | webcrypto |
Node.js (process.versions.node) | nodecrypto |
| Fallback (old browsers, React Native) | Pure-JS P-256 implementation |
Generating API keys
Create an API key pair from the Turnkey dashboard:Open the Turnkey dashboard
Go to app.turnkey.com and sign in.
Create a new API key
Click Create API key, give it a name, and copy both the public and private key values. The private key is shown only once.