• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Toilal / auth-toolbox / #184

pending completion
#184

push

Toilal
chore(release): add missing shelljs dependency for release

290 of 314 branches covered (92.36%)

Branch coverage included in aggregate %.

519 of 524 relevant lines covered (99.05%)

28.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/token-decoder/default-token-decoder.ts
1
import { Token, TokenDecoder } from '../auth-toolbox'
2

3
/**
4
 * Default implementation of {@link TokenDecoder}. It doesn't support decoding {@link Token} and checks the
5
 * expiration date from the server response.
6
 *
7
 * It's the default value on {@link Auth} constructor for {@link AuthOptions.accessTokenDecoder}.
8
 */
9
export class DefaultTokenDecoder implements TokenDecoder {
8✔
10
  protected offset: number
11

12
  constructor (offsetSeconds: number = 0) {
34✔
13
    this.offset = offsetSeconds * 1000
22✔
14
  }
15

16
  isExpired (token: Token): boolean {
8✔
17
    if (token.expiresAt) {
16✔
18
      const now = Date.now() - this.offset
4✔
19
      if (now >= token.expiresAt.getTime()) {
4✔
20
        return true
2✔
21
      }
22
    }
23
    return false
14✔
24
  }
25
}
8✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc