// AuthFunc spies on cfg.AuthFunc calls, sending passed AuthRequest // to the returned channel. // // If cfg.AuthFunc is non-nil, it is called after the value is sent. func (d *Driver) AuthFunc(cfg *keygen.Config) <-chan *keygen.AuthRequest { ch := make(chan *keygen.AuthRequest, d.ChanCap) fn := cfg.AuthFunc cfg.AuthFunc = func(req *keygen.AuthRequest) error { ch <- req if fn != nil { return fn(req) } return nil } return ch }