diff --git a/internal/captcha/captcha.go b/internal/captcha/captcha.go index 7e9387f..886dbdd 100644 --- a/internal/captcha/captcha.go +++ b/internal/captcha/captcha.go @@ -34,6 +34,23 @@ type Captcha struct { ExpireIn time.Time } +func (c *Captcha) Solve(answer Answer) bool { + c.Solved = c.Answer == answer + return c.Solved +} + +func (c *Captcha) GetAnswer() Answer { + return c.Answer +} + +func (c *Captcha) IsSolved() bool { + return c.Solved +} + +func (c *Captcha) Expiry() time.Time { + return c.ExpireIn +} + func GenerateAnswer() Answer { ans, _ := rand.Int(rand.Reader, big.NewInt(maxAnswer)) return (Answer(ans.String())) diff --git a/internal/captcha/dwelling_captcha.go b/internal/captcha/dwelling_captcha.go index 59055db..e3e8f7d 100644 --- a/internal/captcha/dwelling_captcha.go +++ b/internal/captcha/dwelling_captcha.go @@ -72,20 +72,3 @@ func (c *DwellingCaptcha) GetImage() *image.Image { return &c.Image } - -func (c *DwellingCaptcha) Solve(answer Answer) bool { - c.Solved = c.Answer == answer - return c.Solved -} - -func (c *DwellingCaptcha) GetAnswer() Answer { - return c.Answer -} - -func (c *DwellingCaptcha) IsSolved() bool { - return c.Solved -} - -func (c *DwellingCaptcha) Expiry() time.Time { - return c.ExpireIn -}