justcaptcha

A simple CAPTCHA implementation.

An example using built-in "dwelling" implementation.

Create a new CAPTCHA:

c := dwcaptcha.NewDwellingCaptcha(expiry)
_, id := inmemdb.New(someAdditionalDataUsedInIDGenerationUsuallyIPAddr, c)

Get an image for a CAPTCHA:

i := inmemdb.Image(captchaID, captchaStyle)
if i == nil {
    ... // do something if there was no image returned
}

jpeg.Encode(w, *i, &jpeg.Options{Quality: 20})

Solve a CAPTCHA:

if ok := inmemdb.Solve(captchaID, answer); !ok {
    ... // not solved
}
// solved
...

Check is CAPTCHA was solved:

if ok := inmemdb.IsSolved(captchaID); !ok {
    ... // not solved
}
// solved
...
Description
A simple CAPTCHA service implementation.
Readme 212 KiB
2023-08-12 22:40:57 +04:00
Languages
Go 100%