Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

ITicketFactory

yueyinqiu edited this page Jan 23, 2021 · 4 revisions

ITicketFactory can generate tickets and verify tickets.

Although it's called as ‘factory’ because it can generate something, it is more similar to ICaptchaAnswerSaver<TAnswer> instead of ICaptchaFactory<TCaptchaDisplay, TAnswer> since the tickets should be directly saved by the ITicketFactory.

GenerateNewAsync(CancellationToken) will mostly be invoked by a ICaptchaFactory<TCaptchaDisplay, TAnswer>, while VerifyAsync(string, CancellationToken) will mostly be invoked by a captcha-required action.

We recommend that VerifyAsync(string, CancellationToken) should always make the ticket invalid.