Stamps
Every request made to Turnkey must include a signature over the POST body attached as a HTTP header. Our secure enclave applications use this signature to verify the integrity and authenticity of the request.
API Keys
To create a valid, API key stamped request follow these steps:
- Sign the JSON-encoded POST body with your API key to produce a
signature
(DER-encoded) - Hex encode the
signature
- Create a JSON-encoded stamp:
publicKey
: the public key of API keysignature
: the signature produced by the API keyscheme
:SIGNATURE_SCHEME_TK_API_P256
- Base64URL encode the stamp
- Attach the encoded string to your request as a
X-Stamp
header - Submit the stamped request to Turnkey's API
Webauthn
To create a valid, Webauthn authenticator stamped request follow these steps:
- SHA256 hash the JSON-encoded POST body
- Sign the hash with WebAuthn credential.
- Create a JSON-encoded stamp:
credentialId
: the id of the webauthn authenticatorauthenticatorData
: the authenticator data produced by Webauthn assertionclientDataJson
: the client data produced by the Webauthn assertionsignature
: the signature produced by the Webauthn assertion
- Base64URL encode the stamp
- Attach the encoded string to your request as a
X-Stamp-Webauthn
header - Submit the stamped request to Turnkey's API
Stampers
Our JS SDK and CLI abstract request stamping for you. If you choose to use an independent client, you will need to implement this yourself. For reference, check out our implementations: