(currentSessionId: string | null)
| 558 | } |
| 559 | |
| 560 | async revokeOtherSessions(currentSessionId: string | null): Promise<number> { |
| 561 | if (!currentSessionId) { |
| 562 | return 0; |
| 563 | } |
| 564 | |
| 565 | await using _lock = await this.sessionsMutex.acquire(); |
| 566 | const data = await this.loadPersistedSessionsLocked(); |
| 567 | |
| 568 | const currentSessionExists = data.sessions.some((session) => session.id === currentSessionId); |
| 569 | if (!currentSessionExists) { |
| 570 | return 0; |
| 571 | } |
| 572 | |
| 573 | const previousLength = data.sessions.length; |
| 574 | data.sessions = data.sessions.filter((session) => session.id === currentSessionId); |
| 575 | const removedCount = previousLength - data.sessions.length; |
| 576 | |
| 577 | if (removedCount > 0) { |
| 578 | await this.savePersistedSessionsLocked(data); |
| 579 | } |
| 580 | |
| 581 | return removedCount; |
| 582 | } |
| 583 | |
| 584 | dispose(): void { |
| 585 | for (const flow of this.githubDeviceFlows.values()) { |
no test coverage detected