Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update iframestamper and add an example for email auth #169

Merged
merged 5 commits into from
Dec 5, 2023

Conversation

andrewkmin
Copy link
Collaborator

@andrewkmin andrewkmin commented Nov 22, 2023

Summary & Motivation

$title

Related: tkhq/frames#19

How I Tested These Changes

Did you add a changeset?

To add a changeset for your pr run pnpm changeset. pnpm changest will generate a file where you should write a human friendly message about the changes. Note how this (example) includes the package name (should be auto added by the command) along with the type of semver change (major.minor.patch) (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.

Copy link

codesandbox-ci bot commented Nov 22, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

@oliviathet oliviathet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

Comment on lines 239 to 245
/**
* Function to inject a new credential into the iframe
* The bundle should be encrypted to the iframe's initial public key
* Encryption should be performed with HPKE (RFC 9180).
* This is used during auth flows.
*/
async injectAuthBundle(bundle: string): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except for the name / purpose, is there a difference between recovery and auth bundles? I'm thinking we should rename the event to "INJECT_CREDENTIAL_BUNDLE" and use it in both recovery and auth use cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep great idea! made the relevant changes here and in frames here: tkhq/frames#19

still begs the question: got any suggestions for a good name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about InjectCredentialBundle? Are you happy with it or do you think we should try to find something better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love InjectCredentialBundle ! Sorry, meant a name for the consolidated bundle -- and seems like we're good with auth

Copy link
Contributor

@r-n-o r-n-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good with the consolidation!

Let's add a changeset for iframe-stamper since we're breaking its API (injectRecoveryBundle won't exist anymore)

Comment on lines 58 to 60

Auth

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be deleted/consolidated with the first section. The code snippet is exactly the same :)

const walletId = refineNonNull(wallet.walletId);
const address = refineNonNull(wallet.addresses[0]);

// Instead of simply alerting, redirect the user to your app's login page.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment should be deleted. Redirecting is a recovery-only thing

@andrewkmin andrewkmin force-pushed the andrew/email-auth branch 2 times, most recently from 4d43c8a to 7e8075a Compare November 28, 2023 19:25
@andrewkmin
Copy link
Collaborator Author

Looking good with the consolidation!

Let's add a changeset for iframe-stamper since we're breaking its API (injectRecoveryBundle won't exist anymore)

good call! ultimately i'll be holding off on merging/releasing until the next release that ships the email auth activity, just so that protos/etc are consistent

@@ -0,0 +1,6 @@
---
"@turnkey/iframe-stamper": minor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we flag this as major to follow semver? Another option is to keep compatibility and mark injectRecoverBundle as deprecated. Under the hood it can still send the same event (and if we do this, then we have a minor, backwards-compatible release)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no strong feelings on this one. maybe leave as minor/deprecation for now, and then have a stricter change later?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me! Let's keep both function names/implementation around then 👍

(and we can deprecate if we make a breaking change at some point)

Copy link
Contributor

@r-n-o r-n-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Agree that it's probably best to wait until next release so we can pull in the exact protos!

@andrewkmin andrewkmin merged commit 9d10797 into main Dec 5, 2023
5 checks passed
@andrewkmin andrewkmin deleted the andrew/email-auth branch December 5, 2023 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants