Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

@0xkey-io/iframe-stamper

Iframe-based stamper for @0xkey-io/http

0xkeyhttpstamper
Published22 May 2026
Direct dependencies0
Transitive dependenciesNot calculated

README

Current package documentation

@0xkey-io/iframe-stamper

npm

This package contains functions to stamp a ZeroXKey request through credentials contained in an iframe. It is meant to be used with @0xkey-io/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

import { IframeStamper } from "@0xkey-io/iframe-stamper";
import { ZeroXKeyClient } from "@0xkey-io/http";

const ZeroXKeyIframeContainerId = "0xkey-iframe-container";
const ZeroXKeyIframeElementId = "0xkey-iframe";

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

// 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 ZeroXKeyClient(
  { baseUrl: "https://api.0xkey.com" },
  iframeStamper,
);

Key or Wallet Export

import { IframeStamper } from "@0xkey-io/iframe-stamper";
import { ZeroXKeyClient } from "@0xkey-io/http";

const ZeroXKeyIframeContainerId = "0xkey-iframe-container";
const ZeroXKeyIframeElementId = "0xkey-iframe";

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

// 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

import { IframeStamper } from "@0xkey-io/iframe-stamper";
import { ZeroXKeyClient } from "@0xkey-io/http";

const ZeroXKeyIframeContainerId = "0xkey-iframe-container";
const ZeroXKeyIframeElementId = "0xkey-iframe";

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

// 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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-JDuzvxCXZaoPI8h9RckPZ28jOWqhwZSaobGmXSUqjROTh8omhwcJwVSdN/ZgW+1rPAJF9E5DMuCDih0t1kLpdg==",
  "shasum": "69b21323c634941f2909ccc5943c33308a349e5c",
  "tarball": "https://registry.npmjs.org/@0xkey-io/iframe-stamper/-/iframe-stamper-0.1.0.tgz",
  "fileCount": 10,
  "unpackedSize": 93064,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEYCIQDiaQIsYmEHtdOq2F8Mo96Rig6CrFpVswC5T1TsgnVMIQIhAP0PJNQhcenmLdTPBnw2yXpeWEpOMa0x9+j/pG2AXaKe"
    }
  ]
}

Repository

PENDING
0xkey-io/sdk-js

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:01 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:5a6812f7f701434d7e3c6d869f1298ef2b4105e6407bb5aa9b41d2f157bbbc99

Other collected versions

View all collected versions →