Skip to content

Commit cc02d1b

Browse files
committed
Always hide session key wallet
1 parent ed4f124 commit cc02d1b

File tree

2 files changed

+11
-31
lines changed

2 files changed

+11
-31
lines changed

src/kit.ts

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ export class SessionKit {
357357
*/
358358
async login(options?: LoginOptions): Promise<LoginResult> {
359359
try {
360+
const selectableWalletPlugins = this.walletPlugins.filter(
361+
(plugin) => plugin.id !== 'session-key-wallet'
362+
)
363+
360364
// Create LoginContext for this login request.
361365
const context = new LoginContext({
362366
appName: this.appName,
@@ -369,41 +373,19 @@ export class SessionKit {
369373
fetch: this.fetch,
370374
loginPlugins: this.loginPlugins,
371375
ui: this.ui,
372-
walletPlugins: this.walletPlugins
373-
.filter((plugin) => {
374-
// Hide session key wallet from picker if disableWalletPlugin is set
375-
if (
376-
this.sessionKeyManager?.config.disableWalletPlugin &&
377-
plugin.id === 'session-key-wallet'
378-
) {
379-
return false
380-
}
381-
return true
382-
})
383-
.map((plugin): UserInterfaceWalletPlugin => {
384-
return {
385-
config: plugin.config,
386-
metadata: WalletPluginMetadata.from(plugin.metadata),
387-
retrievePublicKey: plugin.retrievePublicKey?.bind(plugin),
388-
}
389-
}),
376+
walletPlugins: selectableWalletPlugins.map((plugin): UserInterfaceWalletPlugin => {
377+
return {
378+
config: plugin.config,
379+
metadata: WalletPluginMetadata.from(plugin.metadata),
380+
retrievePublicKey: plugin.retrievePublicKey?.bind(plugin),
381+
}
382+
}),
390383
sessionKeyManager: this.sessionKeyManager,
391384
})
392385

393386
// Tell the UI a login request is beginning.
394387
await context.ui.onLogin()
395388

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-
407389
// Predetermine WalletPlugin (if possible) to prevent uneeded UI interactions.
408390
let walletPlugin: WalletPlugin | undefined = undefined
409391
if (selectableWalletPlugins.length === 1) {

src/sessionkey/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ export interface SessionKeyConfig {
3333
) => Promise<API.v1.AccountPermission | undefined>
3434
/** Skip showing consent UI to user during setup. Default is false. */
3535
skipConsent?: boolean
36-
/** Hide SessionKeyWalletPlugin from the wallet picker UI. Default is false. */
37-
disableWalletPlugin?: boolean
3836
}
3937

4038
/**

0 commit comments

Comments
 (0)