Skip to content

Commit

Permalink
chore: passing appName on webWallet logout
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Apr 30, 2024
1 parent 749881f commit 71e448d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export interface LoginResult {
session: Session
}

export interface LogoutContext {
session: SerializedSession | Session
appName: string
}

export interface RestoreArgs {
chain: Checksum256Type | ChainDefinition
actor?: NameType
Expand Down Expand Up @@ -487,7 +492,7 @@ export class SessionKit {
)

if (walletPlugin?.logout) {
await walletPlugin.logout(session)
await walletPlugin.logout({session, appName: this.appName})
}

const sessions = await this.getSessions()
Expand Down Expand Up @@ -520,7 +525,10 @@ export class SessionKit {
)

if (walletPlugin?.logout) {
return walletPlugin.logout(s)
return walletPlugin.logout({
session: s,
appName: this.appName,
})
} else {
return Promise.resolve()
}
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {IdentityProof, ResolvedSigningRequest} from '@wharfkit/signing-request'

import {LoginContext} from './login'
import {TransactContext} from './transact'
import {SerializedSession, Session} from './session'
import {LogoutContext} from './kit'

/**
* The static configuration of a [[WalletPlugin]].
Expand Down Expand Up @@ -135,7 +135,7 @@ export interface WalletPlugin {
* @returns A promise that resolves when the wallet plugin logout process is complete.
* @throws An error if the logout could not happen.
*/
logout?(session: Session | SerializedSession): Promise<void>
logout?(LogoutContext: LogoutContext): Promise<void>

/**
* Serialize the [[WalletPlugin]] ID and data into a plain object.
Expand Down

0 comments on commit 71e448d

Please sign in to comment.