{"_id":"@0xkey-io/iframe-stamper","name":"@0xkey-io/iframe-stamper","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@0xkey-io/iframe-stamper","version":"0.1.0","main":"./dist/index.js","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js","default":"./dist/index.mjs"}},"types":"./dist/index.d.ts","license":"Apache-2.0","description":"Iframe-based stamper for @0xkey-io/http","keywords":["0xkey","http","stamper"],"author":{"name":"0xkey","url":"https://0xkey.com/"},"homepage":"https://github.com/0xkey-io/sdk-js/tree/main/packages/iframe-stamper","bugs":{"url":"https://github.com/0xkey-io/sdk-js/issues"},"repository":{"type":"git","url":"git+https://github.com/0xkey-io/sdk-js.git","directory":"packages/iframe-stamper"},"publishConfig":{"access":"public"},"engines":{"node":">=18.0.0"},"scripts":{"build":"rollup -c","clean":"rimraf ./dist ./.cache","test":"jest","typecheck":"tsc -p tsconfig.typecheck.json"},"_id":"@0xkey-io/iframe-stamper@0.1.0","_integrity":"sha512-JDuzvxCXZaoPI8h9RckPZ28jOWqhwZSaobGmXSUqjROTh8omhwcJwVSdN/ZgW+1rPAJF9E5DMuCDih0t1kLpdg==","_resolved":"/private/var/folders/lf/b69416ms3zvccf0ght6bq02r0000gn/T/5e8db5d8d9ae5974b92801c389cd0720/0xkey-io-iframe-stamper-0.1.0.tgz","_from":"file:0xkey-io-iframe-stamper-0.1.0.tgz","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"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"}]},"_npmUser":{"name":"0xkey-developer","email":"developer@0xkey.io"},"directories":{},"maintainers":[{"name":"0xkey-developer","email":"developer@0xkey.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/iframe-stamper_0.1.0_1779443498322_0.4331394636499959"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T09:51:38.168Z","0.1.0":"2026-05-22T09:51:38.456Z","modified":"2026-05-22T09:51:38.766Z"},"maintainers":[{"name":"0xkey-developer","email":"developer@0xkey.io"}],"description":"Iframe-based stamper for @0xkey-io/http","homepage":"https://github.com/0xkey-io/sdk-js/tree/main/packages/iframe-stamper","keywords":["0xkey","http","stamper"],"repository":{"type":"git","url":"git+https://github.com/0xkey-io/sdk-js.git","directory":"packages/iframe-stamper"},"author":{"name":"0xkey","url":"https://0xkey.com/"},"bugs":{"url":"https://github.com/0xkey-io/sdk-js/issues"},"license":"Apache-2.0","readme":"# @0xkey-io/iframe-stamper\n\n[![npm](https://img.shields.io/npm/v/@0xkey-io/iframe-stamper?color=%234C48FF)](https://www.npmjs.com/package/@0xkey-io/iframe-stamper)\n\nThis package contains functions to stamp a ZeroXKey request through credentials contained in an iframe. It is meant to be used with [`@0xkey-io/http`](https://www.npmjs.com/package/@0xkey-io/http) to build flows. To stamp the request, use the Recovery and Auth flows to request and inject a credential bundle.\n\nUsage:\n\nRecovery and Auth\n\n```ts\nimport { IframeStamper } from \"@0xkey-io/iframe-stamper\";\nimport { ZeroXKeyClient } from \"@0xkey-io/http\";\n\nconst ZeroXKeyIframeContainerId = \"0xkey-iframe-container\";\nconst ZeroXKeyIframeElementId = \"0xkey-iframe\";\n\nconst iframeStamper = new IframeStamper({\n  iframeUrl: process.env.AUTH_IFRAME_URL!,\n  iframeContainer: document.getElementById(ZeroXKeyIframeContainerId),\n  iframeElementId: ZeroXKeyIframeElementId,\n});\n\n// This inserts the iframe in the DOM and returns the public key\nconst publicKey = await iframeStamper.init();\n\n// Injects a new credential in the iframe\nconst injected = await iframeStamper.injectCredentialBundle(credentialBundle);\n\n// New HTTP client able to sign with the credentials inside of the iframe\nconst httpClient = new ZeroXKeyClient(\n  { baseUrl: \"https://api.0xkey.com\" },\n  iframeStamper,\n);\n```\n\nKey or Wallet Export\n\n```ts\nimport { IframeStamper } from \"@0xkey-io/iframe-stamper\";\nimport { ZeroXKeyClient } from \"@0xkey-io/http\";\n\nconst ZeroXKeyIframeContainerId = \"0xkey-iframe-container\";\nconst ZeroXKeyIframeElementId = \"0xkey-iframe\";\n\nconst iframeStamper = new IframeStamper({\n  iframeUrl: process.env.EXPORT_IFRAME_URL!,\n  iframeContainer: document.getElementById(ZeroXKeyIframeContainerId),\n  iframeElementId: ZeroXKeyIframeElementId,\n});\n\n// This inserts the iframe in the DOM and returns the public key\nconst publicKey = await iframeStamper.init();\n\n// Injects a bundle containing the encrypted wallet seedphrase into the iframe\n// `exportBundle` is the response from requesting ACTIVITY_TYPE_EXPORT_WALLET\nconst injected = await iframeStamper.injectWalletExportBundle(exportBundle);\n\n// If the bundle is successfully injected, the iframe is now displaying the\n// wallet seedphrase to the user\nif (injected !== true) {\n  throw new Error(\"unexpected error while injecting export bundle\");\n}\n\n// Display the iframe to the user with their seedphrase.\nsetIframeDisplay(\"block\");\n```\n\nKey or Wallet Import\n\n```ts\nimport { IframeStamper } from \"@0xkey-io/iframe-stamper\";\nimport { ZeroXKeyClient } from \"@0xkey-io/http\";\n\nconst ZeroXKeyIframeContainerId = \"0xkey-iframe-container\";\nconst ZeroXKeyIframeElementId = \"0xkey-iframe\";\n\nconst iframeStamper = new IframeStamper({\n  iframeUrl: process.env.IMPORT_IFRAME_URL!,\n  iframeContainer: document.getElementById(ZeroXKeyIframeContainerId),\n  iframeElementId: ZeroXKeyIframeElementId,\n});\n\n// This inserts the iframe in the DOM\nawait iframeStamper.init();\n\n// Injects a bundle containing the secure enclave's public key into the iframe's local storage\n// `importBundle` is the response from requesting ACTIVITY_TYPE_INIT_IMPORT_WALLET\nconst injected = await iframeStamper.injectImportBundle(importBundle);\n\nif (injected !== true) {\n  throw new Error(\"unexpected error while injecting import bundle\");\n}\n\n// Display the text input that the user can enter their seedphrase into\nsetIframeDisplay(\"block\");\n\n// Once the user has entered their seedphrase, trigger this call to the iframe that\n// 1) encrypts their seedphrase using the secure enclave's public key from the previous step\n// 2) sends this ciphertext and a public key generated by the client to your page\nconst encryptedBundle = await iframeStamper.extractWalletEncryptedBundle();\n\n// Now you can pass this encryptedBundle as a request to ACTIVITY_TYPE_IMPORT_WALLET.\n```\n","readmeFilename":"README.md","_rev":"1-b636bd6786e99bec28a7518888609684"}