Skip to main content

Introduction

The @turnkey/http package is a fully-typed lower-level HTTP client for developers integrating with Turnkey.

Installing

To get started install the @turnkey/http client.

Initializing

Create a new client for use in your JavaScript/Typescript applications. You can initialize a new TurnkeyClient using the TurnkeyClient constructor. The TurnkeyClient serves as your entry point to interact with the Turnkey API.

Parameters

config
THttpConfig
required
An object containing configuration settings for the client.
baseUrl
string
required
The base URL for the Turnkey API. Note: An error Missing base URL. Please verify env vars. will be thrown if a value is not provided.
stamper
TStamper
required
An instance of a stamper class (e.g. ApiKeyStamper) used to create signatures for authenticating API requests.
Currently Turnkey provides 3 stampers:
  • applications signing requests with Passkeys or webauthn devices should use @turnkey/webauthn-stamper
  • applications signing requests with API keys should use @turnkey/api-key-stamper
  • applications that need to sign requests within an iframe, particularly when handling sensitive operations like Auth, or Key or Wallet Export, should use the @turnkey/iframe-stamper.
You can also implement the TStamper interface yourself. For more information on implementing a custom stamper checkout the API Design docs.

Types

THttpConfig

TStamper

Example