diff --git a/.changeset/quick-buttons-cross.md b/.changeset/quick-buttons-cross.md new file mode 100644 index 000000000..efd24f411 --- /dev/null +++ b/.changeset/quick-buttons-cross.md @@ -0,0 +1,6 @@ +--- +"@turnkey/iframe-stamper": minor +--- + +- Add support for auth (e.g. via email), and include recovery under it. Note that this is a **breaking change**, as we are now using `injectCredentialBundle` as opposed to `injectRecoveryBundle` +- Update protos diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4967c3e97..208548ed0 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,6 +4,6 @@ ## Did you add a changeset? -To add a changeset for your pr run [`pnpm changeset`](https://pnpm.io/using-changesets#adding-new-changesets). `pnpm changest` will generate a file where you should write a human friendly message about the changes. Note how this ([example](https://github.com/tkhq/sdk/blob/b409cd06790f011bf939adcf0755499b8e7497ae/.changeset/extra-http-exports.md?plain=1#L1)) includes the package name (should be auto added by the command) along with the type of [semver change (major.minor.patch)](https://semver.org/) (which you should set). +If updating one of our packages, you'll likely need to add a changeset to your PR. To do so, run [`pnpm changeset`](https://pnpm.io/using-changesets#adding-new-changesets). `pnpm changeset` will generate a file where you should write a human friendly message about the changes. Note how this ([example](https://github.com/tkhq/sdk/blob/b409cd06790f011bf939adcf0755499b8e7497ae/.changeset/extra-http-exports.md?plain=1#L1)) includes the package name (should be auto added by the command) along with the type of [semver change (major.minor.patch)](https://semver.org/) (which you should set). These changes will be used at release time to determine what packages to publish and how to bump their version. For more context see [this comment](https://github.com/tkhq/sdk/pull/67#issuecomment-1568838440). diff --git a/examples/email-auth/src/pages/index.tsx b/examples/email-auth/src/pages/index.tsx index b64e2a7ea..64dde7572 100644 --- a/examples/email-auth/src/pages/index.tsx +++ b/examples/email-auth/src/pages/index.tsx @@ -124,10 +124,8 @@ export default function AuthPage() { }); const wallet = refineNonNull(completedActivity.result.createWalletResult); - const walletId = refineNonNull(wallet.walletId); const address = refineNonNull(wallet.addresses[0]); - // Instead of simply alerting, redirect the user to your app's login page. alert(`SUCCESS! Wallet and new address created: ${address} `); }; diff --git a/packages/iframe-stamper/README.md b/packages/iframe-stamper/README.md index a413a9933..6bf94971e 100644 --- a/packages/iframe-stamper/README.md +++ b/packages/iframe-stamper/README.md @@ -6,7 +6,7 @@ This package contains functions to stamp a Turnkey request through credentials c Usage: -Recovery +Recovery and Auth ```ts import { IframeStamper } from "@turnkey/iframe-stamper"; @@ -25,7 +25,7 @@ const iframeStamper = new IframeStamper({ const publicKey = await iframeStamper.init(); // Injects a new credential in the iframe -const injected = await iframeStamper.injectCredentialBundle(recoveryBundle); +const injected = await iframeStamper.injectCredentialBundle(credentialBundle); // New HTTP client able to sign with the credentials inside of the iframe const httpClient = new TurnkeyClient( @@ -55,31 +55,3 @@ const publicKey = await iframeStamper.init(); // Injects a new private key in the iframe const injected = await iframeStamper.injectKeyExportBundle(exportBundle); ``` - -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.IFRAME_URL!, - iframeContainerId: 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(authBundle); - -// New HTTP client able to sign with the credentials inside of the iframe -const httpClient = new TurnkeyClient( - { baseUrl: "https://api.turnkey.com" }, - iframeStamper -); -```