(key codersdk.CryptoKey, sequence int32, now time.Time)
| 285 | } |
| 286 | |
| 287 | func checkKey(key codersdk.CryptoKey, sequence int32, now time.Time) (string, []byte, error) { |
| 288 | if sequence == latestSequence { |
| 289 | if !key.CanSign(now) { |
| 290 | return "", nil, ErrKeyInvalid |
| 291 | } |
| 292 | return idSecret(key) |
| 293 | } |
| 294 | |
| 295 | if !key.CanVerify(now) { |
| 296 | return "", nil, ErrKeyInvalid |
| 297 | } |
| 298 | |
| 299 | return idSecret(key) |
| 300 | } |
| 301 | |
| 302 | // refresh fetches the keys and updates the cache. |
| 303 | func (c *cache) refresh() { |