Introduction
The@turnkey/api-key-stamper package simplifies the process of using your public/private API keys and passkeys to stamp and approve activity requests for Turnkey’s API. This stamping mechanism is central to the API’s security, ensuring that each request is authenticated and authorized. For an in-depth understanding of API keys see this section.
Installing
To get started install the@turnkey/api-key-stamper client.
Initializing
TheApiKeyStamper class implements the TStamper interface used by the TurnkeyClient in the @turnkey/http module. It encapsulates the logic necessary to sign activity requests and generates the appropriate HTTP headers for authentication. To get started with an ApiKeyStamper, you can initialize it using its constructor:
constructor(config: TApiKeyStamperConfig): TStamper
TApiKeyStamperConfig
required
An object containing configuration settings for the stamper.
string
required
Your Turnkey API private key.
string
required
Your Turnkey API public key.
Types
TApiKeyStamperConfig
TStamper
Example
The example below shows how to initialize and use theApiKeyStamper with the TurnkeyClient to make a request to Turnkey’s /public/v1/query/whoami endpoint:
Methods
stamp: (input: string) => Promise<TStamp>
Creates a digital stamp which includes the public key, signature scheme, and a signature.
Parameters
string
required
The payload that needs to be stamped.