Method
isTokenValid
(credentials: QwenOAuthCredentials)
Source from the content-addressed store, hash-verified
| 164 | } |
| 165 | |
| 166 | private isTokenValid(credentials: QwenOAuthCredentials): boolean { |
| 167 | const TOKEN_REFRESH_BUFFER_MS = 30 * 1000 // 30s buffer |
| 168 | if (!credentials.expiry_date) { |
| 169 | return false |
| 170 | } |
| 171 | return Date.now() < credentials.expiry_date - TOKEN_REFRESH_BUFFER_MS |
| 172 | } |
| 173 | |
| 174 | private async ensureAuthenticated(): Promise<void> { |
| 175 | if (!this.credentials) { |
Tested by
no test coverage detected