@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
to build flows.
Usage:
Recovery
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.IFRAME_URL!,
iframeContainerId: TurnkeyIframeContainerId,
iframeElementId: TurnkeyIframeElementId,
});
const publicKey = await iframeStamper.init();
const injected = await iframeStamper.injectRecoveryBundle(recoveryBundle);
const httpClient = new TurnkeyClient(
{ baseUrl: "https://api.turnkey.com" },
iframeStamper
);
Key or Wallet Export
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.IFRAME_URL!,
iframeContainerId: TurnkeyIframeContainerId,
iframeElementId: TurnkeyIframeElementId,
});
const publicKey = await iframeStamper.init();
const injected = await iframeStamper.injectKeyExportBundle(exportBundle);