# @turnkey/iframe-stamper

> Iframe-based stamper for @turnkey/http

Latest version **2.11.1** (published 2026-06-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @turnkey/iframe-stamper
pnpm add @turnkey/iframe-stamper
yarn add @turnkey/iframe-stamper
bun add @turnkey/iframe-stamper
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.11.1 |
| Published | 2026-06-12 |
| First published | 2023-10-20 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 0 |
| Unpacked size | 96 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 104 |
| Author | Turnkey |
| Maintainers | andrewtk, r-n-o, jack-kearney-tkhq |
| Keywords | Turnkey, http, stamper |

## Links

- npm: https://www.npmjs.com/package/@turnkey/iframe-stamper
- Repository: https://github.com/tkhq/sdk
- Issues: https://github.com/tkhq/sdk/issues
- npm.io page: https://npm.io/package/@turnkey/iframe-stamper

## Recent versions

- 2.11.1 (latest) — 2026-06-12
- 2.6.0-beta.0 (beta) — 2025-08-22
- 2.11.0 — 2026-02-25
- 2.10.0 — 2026-01-30
- 2.9.0 — 2025-12-11
- 2.8.0 — 2025-11-27
- 2.7.1 — 2025-11-13
- 2.7.0 — 2025-10-08
- 2.6.0 — 2025-09-10
- 2.5.0 — 2025-04-04
- 2.4.0 — 2025-04-01
- 2.3.0 — 2025-03-14
- 2.2.0 — 2025-01-29
- 2.1.0 — 2025-01-16
- 2.0.0 — 2024-05-08
- … 9 more at https://npm.io/package/@turnkey/iframe-stamper/versions

## README

# @turnkey/iframe-stamper

[![npm](https://img.shields.io/npm/v/@turnkey/iframe-stamper?color=%234C48FF)](https://www.npmjs.com/package/@turnkey/iframe-stamper)

This package contains functions to stamp a Turnkey request through credentials contained in an iframe. It is meant to be used with [`@turnkey/http`](https://www.npmjs.com/package/@turnkey/http) to build flows. To stamp the request, use the Recovery and Auth flows to request and inject a credential bundle.

Usage:

Recovery and Auth

```ts
import { IframeStamper } from "@turnkey/iframe-stamper";
import { TurnkeyClient } from "@turnkey/http";

const TurnkeyIframeContainerId = "turnkey-iframe-container";
const TurnkeyIframeElementId = "turnkey-iframe";

const iframeStamper = new IframeStamper({
  iframeUrl: process.env.AUTH_IFRAME_URL!,
  iframeContainer: document.getElementById(TurnkeyIframeContainerId),
  iframeElementId: TurnkeyIframeElementId,
});

// This inserts the iframe in the DOM and returns the public key
const publicKey = await iframeStamper.init();

// Injects a new credential in the iframe
const injected = await iframeStamper.injectCredentialBundle(credentialBundle);

// New HTTP client able to sign with the credentials inside of the iframe
const httpClient = new TurnkeyClient(
  { baseUrl: "https://api.turnkey.com" },
  iframeStamper,
);
```

Key or Wallet Export

```ts
import { IframeStamper } from "@turnkey/iframe-stamper";
import { TurnkeyClient } from "@turnkey/http";

const TurnkeyIframeContainerId = "turnkey-iframe-container";
const TurnkeyIframeElementId = "turnkey-iframe";

const iframeStamper = new IframeStamper({
  iframeUrl: process.env.EXPORT_IFRAME_URL!,
  iframeContainer: document.getElementById(TurnkeyIframeContainerId),
  iframeElementId: TurnkeyIframeElementId,
});

// This inserts the iframe in the DOM and returns the public key
const publicKey = await iframeStamper.init();

// Injects a bundle containing the encrypted wallet seedphrase into the iframe
// `exportBundle` is the response from requesting ACTIVITY_TYPE_EXPORT_WALLET
const injected = await iframeStamper.injectWalletExportBundle(exportBundle);

// If the bundle is successfully injected, the iframe is now displaying the
// wallet seedphrase to the user
if (injected !== true) {
  throw new Error("unexpected error while injecting export bundle");
}

// Display the iframe to the user with their seedphrase.
setIframeDisplay("block");
```

Key or Wallet Import

```ts
import { IframeStamper } from "@turnkey/iframe-stamper";
import { TurnkeyClient } from "@turnkey/http";

const TurnkeyIframeContainerId = "turnkey-iframe-container";
const TurnkeyIframeElementId = "turnkey-iframe";

const iframeStamper = new IframeStamper({
  iframeUrl: process.env.IMPORT_IFRAME_URL!,
  iframeContainer: document.getElementById(TurnkeyIframeContainerId),
  iframeElementId: TurnkeyIframeElementId,
});

// This inserts the iframe in the DOM
await iframeStamper.init();

// Injects a bundle containing the secure enclave's public key into the iframe's local storage
// `importBundle` is the response from requesting ACTIVITY_TYPE_INIT_IMPORT_WALLET
const injected = await iframeStamper.injectImportBundle(importBundle);

if (injected !== true) {
  throw new Error("unexpected error while injecting import bundle");
}

// Display the text input that the user can enter their seedphrase into
setIframeDisplay("block");

// Once the user has entered their seedphrase, trigger this call to the iframe that
// 1) encrypts their seedphrase using the secure enclave's public key from the previous step
// 2) sends this ciphertext and a public key generated by the client to your page
const encryptedBundle = await iframeStamper.extractWalletEncryptedBundle();

// Now you can pass this encryptedBundle as a request to ACTIVITY_TYPE_IMPORT_WALLET.
```

---
_Source: https://npm.io/package/@turnkey/iframe-stamper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
