Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modular Passport SDK:
@imtbl/authand@imtbl/walletRefactors the monolithic
@imtbl/passportpackage into two focused, tree-shakeable packages with simplified APIs and reduced bundle size.Comparison
Auth Package (
@imtbl/auth)@imtbl/passportauth components)@imtbl/auth)oidc-client-ts)Wallet Package (
@imtbl/wallet)@imtbl/passportwallet components)@imtbl/wallet)viem,@imtbl/auth)ethers,@0xsequence/*,magic-sdk,axios,uuid,jwt-decode,localforageviem,oidc-client-tsNote: LOC counts include comments and blank lines. Code-only counts exclude comments and blank lines.
Major Changes
Architecture
@imtbl/auth(OAuth) and@imtbl/wallet(EIP-1193 provider)Environmentenum; replaced with explicitChainConfig[]arraysconnectWallet()factory replaces class-basedPassportinstanceauthclient provided (no explicitloginPopup()calls)API Simplifications
connectWallet()works standalone with default chainsauthclient for authenticated featuresRelayerClient,GuardianClient,ApiClientare stateless (no internal user/chain state)Technical Improvements
viemandethers(clients choose their preferred library)viemdependency is tree-shakeable (only imports what's used)vieminternally for EVM operations,oidc-client-tsfor OAuthcrossSdkBridgeEnabledmode for cross-SDK integrationBreaking Changes
Environment: Must provide explicitChainConfigobjectsPassportclass: UseconnectWallet()factory functionconnectEvm(): Provider returned directly fromconnectWallet()login()method: Login handled automatically when neededDependency Changes
Removed:
ethers→ replaced withviem(smaller, tree-shakeable)@0xsequence/abi,@0xsequence/core→ custom minimal implementationmagic-sdk,@magic-ext/oidc,@magic-sdk/provider→ removed (Magic TEE uses direct API calls)axios→ nativefetchAPIuuid→ removed (EIP-6963 UUID is constant)jwt-decode→ removed (not needed)localforage→ removed (uses nativelocalStorage)@imtbl/x-client,@imtbl/x-provider→ removed (IMX support removed)@imtbl/config,@imtbl/metrics→ removed (not used)Added:
viem→ modern EVM library (replacesethers)Wallet-Only Mode Design
Overview
Wallet-only mode allows apps to connect to user wallets without requiring their own OAuth client configuration. This enables a simpler onboarding experience where apps can interact with Passport wallets immediately, without needing to set up OAuth clients in Immutable Hub.
Problem Statement
Previously, apps needed to:
clientIdandredirectUrito the SDKThis created friction for apps that only wanted wallet functionality and didn't need access to user profile data.
Solution
The SDK now supports wallet-only mode where:
connectWallet()without providing anauthclienteth_requestAccountsis called, the SDK automatically uses a shared OAuth client IDProviderinterface but never see user profile/ID dataImplementation Details
Shared OAuth Client
The SDK uses a shared OAuth client ID (
immutable-passport-wallet-only) that:https://passport.immutable.com/wallet-callbackopenid transact(noprofileoremailaccess)Authentication Flow
App calls
connectWallet()without auth:App calls
eth_requestAccounts:SDK automatically:
Authinstance with shared client ID (immutable-passport-wallet-only)auth.getUser())Userobject stored internally (never exposed to app)App can now:
eth_sendTransaction(always requires confirmation popup)User Privacy
Apps using wallet-only mode:
subclaim)The
Userobject is stored internally in the SDK but never exposed through theProviderinterface, ensuring apps cannot access user identity information.Backend Requirements
For wallet-only mode to work, the backend needs:
OAuth Service: Create shared client ID
immutable-passport-wallet-onlywith:https://passport.immutable.com/wallet-callbackopenid transact(noprofileoremail)API Compatibility: All backend APIs must accept tokens from the shared client:
/v2/passport/{chain}/counterfactual-address) - for wallet registration/v1/transactions/evm/evaluate) - for transaction validation/v1/transactions) - for transaction submission/v1/wallet,/v1/wallet/sign/message) - for signing operationsBenefits
authclient for full accessMigration Path
For apps that only need wallet functionality:
For apps that need user profile access:
Migration Path