Skip to content

Conversation

@shineli1984
Copy link
Collaborator

@shineli1984 shineli1984 commented Nov 18, 2025

Summary

next version of Immutable Passport SDK.
Tasks (all tasks below must keep Passport SDK and Passport sample app working)

  • split Passport SDK to wallet and auth packages and make Passport SDK refer to them internally.
  • remove the concept of environment from wallet and auth packages.
  • create new usage pattern for wallet and auth packages (see below)

new wallet and auth interface

For apps that only need wallet functionality:

// Old: Required OAuth client setup
import { Auth } from '@imtbl/auth';
import { connectWallet } from '@imtbl/wallet';

const auth = new Auth({ clientId: '...', redirectUri: '...' });
const provider = await connectWallet({ auth });

// New: Wallet-only mode (no OAuth client needed)
import { connectWallet } from '@imtbl/wallet';

const provider = await connectWallet();
// SDK automatically handles authentication with a shared client owned by Immutable

For apps that need user profile access:

// Still works: Provide your own auth client
import { Auth } from '@imtbl/auth';
import { connectWallet } from '@imtbl/wallet';

const auth = new Auth({ 
  clientId: 'your-client-id', 
  redirectUri: 'https://your-app.com/callback',
  scope: 'openid profile email transact', // Full access
});
const provider = await connectWallet({ auth });

Note

Introduces new @imtbl/auth and @imtbl/wallet packages and refactors the Passport SDK to consume them, adding new configs/errors, confirmation/guardian flows, zkEVM provider, and updated exports/workspace deps.

  • Monorepo/Packages:
    • Add new packages @imtbl/auth and @imtbl/wallet with build configs and workspace wiring; update @imtbl/sdk and @imtbl/passport dependencies.
  • Auth (@imtbl/auth):
    • Implement AuthManager, PKCE/device token storage, embedded login prompt/overlays, confirmation screen, utils, and AuthConfiguration.
    • Introduce AuthError types and export auth types/helpers.
  • Wallet (@imtbl/wallet):
    • Add ZkEvmProvider, WalletConfiguration, GuardianClient, MagicTEESigner, relayer client, signing/helpers, EIP-6963 provider announce, session activity, and WalletError types.
  • Passport SDK:
    • Refactor to use @imtbl/auth and @imtbl/wallet: build auth/wallet configs, construct GuardianClient, and return ZkEvmProvider.
    • Update IMX provider factory/workflows to depend on new guard/magic/auth types; simplify metrics wrapper; adjust exports (re-export wallet/auth types).
  • Misc:
    • Replace legacy error types/usages; tweak overlays/options and login flows; remove large legacy test suite aligned with new package split.

Written by Cursor Bugbot for commit f164052. This will update automatically on new commits. Configure here.

@shineli1984 shineli1984 requested a review from a team as a code owner November 18, 2025 09:13
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

} = this.embeddedLoginPrompt
? await this.embeddedLoginPrompt.displayEmbeddedLoginPrompt(anonymousId)
: { imPassportTraceId: undefined };
directLoginOptionsToUse = (embeddedLoginPromptDirectLoginOptions as any).directLoginMethod ? embeddedLoginPromptDirectLoginOptions as DirectLoginOptions : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Always-true condition breaks login prompt.

The login method contains a ternary operator that checks this.embeddedLoginPrompt ? ... on line 253, but embeddedLoginPrompt is a required constructor parameter (not optional). This conditional will always be true, making the fallback { imPassportTraceId: undefined } unreachable dead code. More importantly, if embeddedLoginPrompt were somehow undefined/null, the fallback object lacks the properties needed for proper destructuring, causing embeddedLoginPromptDirectLoginOptions to be an empty object and imPassportTraceId to be undefined, which breaks the embedded login prompt flow.

Fix in Cursor Fix in Web

@nx-cloud
Copy link

nx-cloud bot commented Nov 18, 2025

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit f164052

Command Status Duration Result
nx affected -t build,lint,test ❌ Failed 1m 37s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ❌ Failed 29s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-18 09:24:49 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants