Verify is used for token and kiteKey authenticators to verify client's kontrol keys. In order to allow for graceful key updates deleted keys are allowed. If Config.VerifyFunc is nil during Kontrol instantiation with one of New* functions, this is the default verify method used by kontrol kite.
(pub string)
| 203 | // one of New* functions, this is the default verify method |
| 204 | // used by kontrol kite. |
| 205 | func (k *Kontrol) Verify(pub string) error { |
| 206 | switch err := k.keyPair.IsValid(pub); err { |
| 207 | case nil, ErrKeyDeleted: |
| 208 | return nil |
| 209 | default: |
| 210 | return err |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | func (k *Kontrol) AddAuthenticator(keyType string, fn func(*kite.Request) error) { |
| 215 | k.Kite.Authenticators[keyType] = fn |