Skip to content

reu98/go-svg-captcha

Repository files navigation

Go SVG Captcha

Package captcha provides an easy to use

PkgGoDev Build Status codecov Go Report Card

Why did I create another SVG captcha package?

I want a simple package. It should be flexible and not rely on rendering images but rather return HTML SVG code.

Install

    go get -u github.com/reu98/go-svg-captcha

Usage

    import captcha "github.com/reu98/go-svg-captcha"

    func main() {
        option := captcha.OptionText
        result, err := captcha.CreateByText(option)
        if err != nil {
            log.Fatalln(err)
        }

        // Text
        fmt.Printf("Text: %v", (*result).Text)

        // HTML SVG
        fmt.Printf("SVG: %v", (*result).Data)
    }

Documentation | Example Basic

Sample image

image image

Compatibility

This package uses embedding from Go 1.21. If you're using a version before 1.21, please upgrade to 1.21 to utilize this package.

Changelog

Changelog

Contributing

If your found a bug, please contribute! see contributing.md for more detail.

License

MIT

Roadmap

  • Finish Documentation
  • Generate multiple captchas
  • Write image
  • Upload the image to the cloud
  • Create a captcha storage to use with the API