@@ -170,8 +170,6 @@ export class SessionKit {
170170 // Initialize session key support if configured
171171 if ( options . sessionKey ) {
172172 this . sessionKeyManager = new SessionKeyManager ( options . sessionKey , this . ui )
173- // Always add SessionKeyWalletPlugin so restore works
174- // Use disableWalletPlugin to hide from picker UI only
175173 this . walletPlugins = [
176174 ...this . walletPlugins ,
177175 new SessionKeyWalletPlugin ( {
@@ -395,18 +393,43 @@ export class SessionKit {
395393 // Tell the UI a login request is beginning.
396394 await context . ui . onLogin ( )
397395
396+ // Get the list of selectable wallet plugins (excluding hidden ones like session key wallet)
397+ const selectableWalletPlugins = this . walletPlugins . filter ( ( plugin ) => {
398+ if (
399+ this . sessionKeyManager ?. config . disableWalletPlugin &&
400+ plugin . id === 'session-key-wallet'
401+ ) {
402+ return false
403+ }
404+ return true
405+ } )
406+
407+ // DEBUG: Log wallet plugin filtering
408+ console . log ( '[SessionKit] Wallet plugin selection debug:' , {
409+ totalWalletPlugins : this . walletPlugins . length ,
410+ walletPluginIds : this . walletPlugins . map ( ( p ) => p . id ) ,
411+ sessionKeyManager : ! ! this . sessionKeyManager ,
412+ disableWalletPlugin : this . sessionKeyManager ?. config . disableWalletPlugin ,
413+ selectableWalletPlugins : selectableWalletPlugins . length ,
414+ selectableIds : selectableWalletPlugins . map ( ( p ) => p . id ) ,
415+ } )
416+
398417 // Predetermine WalletPlugin (if possible) to prevent uneeded UI interactions.
399418 let walletPlugin : WalletPlugin | undefined = undefined
400- if ( this . walletPlugins . length === 1 ) {
401- walletPlugin = this . walletPlugins [ 0 ] // Default to first when only one.
402- context . walletPluginIndex = 0
419+ if ( selectableWalletPlugins . length === 1 ) {
420+ walletPlugin = selectableWalletPlugins [ 0 ] // Default to first when only one.
421+ context . walletPluginIndex = this . walletPlugins . indexOf ( walletPlugin )
403422 context . uiRequirements . requiresWalletSelect = false
423+ console . log ( '[SessionKit] Auto-selected wallet:' , walletPlugin . id )
404424 } else if ( options ?. walletPlugin ) {
405425 walletPlugin = this . getWalletPlugin ( options . walletPlugin )
406426 if ( walletPlugin ) {
407427 context . walletPluginIndex = this . walletPlugins . indexOf ( walletPlugin )
408428 context . uiRequirements . requiresWalletSelect = false
429+ console . log ( '[SessionKit] Wallet selected via options:' , walletPlugin . id )
409430 }
431+ } else {
432+ console . log ( '[SessionKit] Multiple wallets available, UI will prompt for selection' )
410433 }
411434 // Set any uiRequirement overrides from the wallet plugin
412435 if ( walletPlugin ) {
0 commit comments