Return the live (unexpired) resolution for a bearer, or undefined.
(bearer: string)
| 60 | |
| 61 | /** Return the live (unexpired) resolution for a bearer, or undefined. */ |
| 62 | get(bearer: string): ResolvedPrincipal | undefined { |
| 63 | const key = fingerprintBearer(bearer); |
| 64 | const entry = this.map.get(key); |
| 65 | if (!entry) return undefined; |
| 66 | if (entry.expiresAt <= this.opts.now()) { |
| 67 | this.map.delete(key); |
| 68 | return undefined; |
| 69 | } |
| 70 | return entry.value; |
| 71 | } |
| 72 | |
| 73 | /** Cache a resolution for `ttlMs`. Evicts the oldest entry past the cap. */ |
| 74 | set(bearer: string, value: ResolvedPrincipal): void { |