@@ -16,6 +16,7 @@ import { PassportImxProviderFactory } from './starkEx';
1616import { PassportConfiguration } from './config' ;
1717import {
1818 DirectLoginOptions ,
19+ DeviceTokenResponse ,
1920 isUserImx ,
2021 isUserZkEvm ,
2122 LinkedWallet ,
@@ -192,7 +193,7 @@ export class Passport {
192193 * Note: This takes precedence over useCachedSession if both are true
193194 * @param {boolean } [options.useRedirectFlow] - If true, uses redirect flow instead of popup flow
194195 * @param {DirectLoginOptions } [options.directLoginOptions] - If provided, contains login method and marketing consent options
195- * @param {DirectLoginMethod } [options.directLoginOptions.directLoginMethod] - The login method to use (e.g., 'google', 'apple', 'email')
196+ * @param {string } [options.directLoginOptions.directLoginMethod] - The login method to use (e.g., 'google', 'apple', 'email')
196197 * @param {MarketingConsentStatus } [options.directLoginOptions.marketingConsentStatus] - Marketing consent status ('opted_in' or 'unsubscribed')
197198 * @param {string } [options.directLoginOptions.email] - Required when directLoginMethod is 'email'
198199 * @returns {Promise<UserProfile | null> } A promise that resolves to the user profile if logged in, null otherwise
@@ -305,6 +306,14 @@ export class Passport {
305306 } , 'loginWithPKCEFlowCallback' ) ;
306307 }
307308
309+ public async storeTokens ( tokenResponse : DeviceTokenResponse ) : Promise < UserProfile > {
310+ return withMetricsAsync ( async ( ) => {
311+ const user = await this . authManager . storeTokens ( tokenResponse ) ;
312+ this . passportEventEmitter . emit ( PassportEvents . LOGGED_IN , user ) ;
313+ return user . profile ;
314+ } , 'storeTokens' ) ;
315+ }
316+
308317 /**
309318 * Logs out the current user.
310319 * @returns {Promise<void> } A promise that resolves when the logout is complete
0 commit comments