* Get token value for a source (convenience method) * Returns null if no credential exists or if expired
(source: LoadedSource)
| 173 | * Returns null if no credential exists or if expired |
| 174 | */ |
| 175 | async getToken(source: LoadedSource): Promise<string | null> { |
| 176 | const cred = await this.load(source); |
| 177 | if (!cred?.value) return null; |
| 178 | |
| 179 | // Check expiry |
| 180 | if (this.isExpired(cred)) { |
| 181 | debug(`[SourceCredentialManager] Token expired for ${source.config.slug}`); |
| 182 | return null; |
| 183 | } |
| 184 | |
| 185 | return cred.value; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Get API credential for a source (handles basic auth JSON parsing) |
no test coverage detected