{"id":22833138,"url":"https://github.com/lithdew/recaptcha","last_synced_at":"2025-04-23T22:04:21.470Z","repository":{"id":57523059,"uuid":"253992716","full_name":"lithdew/recaptcha","owner":"lithdew","description":"Quickly verify reCAPTCHA v2/v3 submissions in Go.","archived":false,"fork":false,"pushed_at":"2020-04-09T05:23:10.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T22:04:15.725Z","etag":null,"topics":["client","fasthttp","fastjson","golang","google","recaptcha"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lithdew.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-08T05:21:37.000Z","updated_at":"2020-07-09T16:59:05.000Z","dependencies_parsed_at":"2022-08-28T11:20:41.254Z","dependency_job_id":null,"html_url":"https://github.com/lithdew/recaptcha","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Frecaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Frecaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Frecaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Frecaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lithdew","download_url":"https://codeload.github.com/lithdew/recaptcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522302,"owners_count":21444511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","fasthttp","fastjson","golang","google","recaptcha"],"created_at":"2024-12-12T21:11:58.889Z","updated_at":"2025-04-23T22:04:21.378Z","avatar_url":"https://github.com/lithdew.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# recaptcha\n\n[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](LICENSE)\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/lithdew/recaptcha)\n[![Discord Chat](https://img.shields.io/discord/697002823123992617)](https://discord.gg/HZEbkeQ)\n\n**recaptcha** is a package that handles verifying reCAPTCHA v2/v3 submissions in Go.\n\n- Validating a verification request, sending a verification request, and parsing a verification response are separated into individual functions.\n- Validates and double-checks all outgoing requests and incoming responses for errors.\n- Interoperable and made easy to work with both reCAPTCHA v2 and v3.\n- Uses [valyala/fasthttp](https://github.com/valyala/fasthttp) for sending reCAPTCHA request with an optional timeout.\n- Uses [valyala/fastjson](https://github.com/valyala/fastjson) for parsing responses from the reCAPTCHA API.\n\n## Inspiration\n\nSomeone told me they were looking through reCAPTCHA packages online in Go and couldn't find a simple, idiomatic one.\n\nThis one's a bit overly optimized and uses two popular 3rd party libraries over the standard library, but here you go ¯\\_(ツ)_/.\n\n## Usage\n\n```\ngo get github.com/lithdew/recaptcha\n```\n\n```go\npackage main\n\nimport (\n    \"github.com/lithdew/recaptcha\"\n    \"time\"\n)\n\nfunc main() {\n    req := recaptcha.Request{\n        Secret: \"\", // Your reCAPTCHA secret.\n        Response: \"\", // The reCAPTCHA response sent by the reCAPTCHA API.\n        RemoteIP : \"\", // (optional) The remote IP of the user submitting the reCAPTCHA response.\n    }\n\n    // Verify the reCAPTCHA request.\n    \n    res, err := recaptcha.Do(req) \n    if err != nil {\n    \tpanic(err)\n    }\n\n    if res.Success {\n        println(\"reCAPTCHA attempt successfully verified!\")\n    } else {\n        println(\"reCAPTCHA attempt failed!\")\n    }\n\n    // Verify the reCAPTCHA request, and timeout after 3 seconds.\n\n    res, err = recaptcha.DoTimeout(req, 3 * time.Second) \n    if err != nil {\n    \tpanic(err)\n    }\n\n    if res.Success {\n        println(\"reCAPTCHA attempt successfully verified!\")\n    } else {\n        println(\"reCAPTCHA attempt failed!\")\n    }\n}\n```\n\n## Benchmarks\n\nTake these with a grain of salt; network latency should sum up the majority of the benchmark results.\n\n```\ngo test -bench=. -benchmem -benchtime=10s\n\ngoos: linux\ngoarch: amd64\npkg: github.com/lithdew/recaptcha\nBenchmarkDo-8                        187          55273288 ns/op            1513 B/op         17 allocs/op\nBenchmarkDoTimeout-8                 205          55503923 ns/op            1482 B/op         19 allocs/op\nBenchmarkParallelDo-8               1500           7060534 ns/op            1386 B/op         17 allocs/op\nBenchmarkParallelDoTimeout-8        1740           6752978 ns/op            1405 B/op         18 allocs/op\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithdew%2Frecaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flithdew%2Frecaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithdew%2Frecaptcha/lists"}