{"id":17596122,"url":"https://github.com/fyko/cf-turnstile","last_synced_at":"2025-04-30T04:49:42.748Z","repository":{"id":198101667,"uuid":"700208003","full_name":"Fyko/cf-turnstile","owner":"Fyko","description":"A Rust client for Cloudflare Turnstile","archived":false,"fork":false,"pushed_at":"2024-09-09T23:38:49.000Z","size":10,"stargazers_count":10,"open_issues_count":3,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-30T04:49:34.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Fyko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-04T06:47:22.000Z","updated_at":"2025-04-01T20:33:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"710607ae-f85a-4c3d-98b9-6c36a7a59f18","html_url":"https://github.com/Fyko/cf-turnstile","commit_stats":null,"previous_names":["sycertech/cf-turnstile"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fyko%2Fcf-turnstile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fyko%2Fcf-turnstile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fyko%2Fcf-turnstile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fyko%2Fcf-turnstile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fyko","download_url":"https://codeload.github.com/Fyko/cf-turnstile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644827,"owners_count":21620630,"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":[],"created_at":"2024-10-22T08:08:01.563Z","updated_at":"2025-04-30T04:49:42.725Z","avatar_url":"https://github.com/Fyko.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cf-turnstile\n\nA Rust client for [Cloudflare Turnstile].\n\n\n# Example\n```rust,no_run\nuse cf_turnstile::{SiteVerifyRequest, TurnstileClient};\n\nlet client = TurnstileClient::new(\"my-secret\".to_string().into());\n\nlet validated = client.siteverify(SiteVerifyRequest {\n   response: \"myresponse\".to_string(),\n  ..Default::default()\n}).await?;\n\nassert!(validated.success);\n```\n\n## Features\n\n### Idempotency\n\nTo utilize Turnstile's [`indempotency_key`](https://developers.cloudflare.com/turnstile/get-started/server-side-validation/#:~:text=A%20response%20may,for%20that%20response.) feature, you can enable the `idempotency` feature flag.  \n\nThis will enable the `idempotency_key` field on the [`SiteVerifyRequest`](struct.SiteVerifyRequest.html) struct and the [`generate_indepotency_key`](fn.generate_indepotency_key.html) function.\n\n### TLS\n\n**Note**: not enabling any TLS feature is supported for use behind a proxy;\nTurnstile's API is HTTPS only.\n\n**Note**: this TLS code was taken from [twilight-http](https://github.com/twilight-rs/twilight/tree/main/twilight-http) in accodance with its license.\n\n`cf-turnstile` has features to enable HTTPS connectivity with [`hyper`]. These\nfeatures are mutually exclusive. `rustls-native-roots` is enabled by default.\n\n#### `native`\n\nThe `native` feature uses a HTTPS connector provided by [`hyper-tls`].\n\nTo enable `native`, do something like this in your `Cargo.toml`:\n\n```toml\n[dependencies]\ncf-turnstile = { default-features = false, features = [\"native\"], version = \"0.1\" }\n```\n\n#### `rustls-native-roots`\n\nThe `rustls-native-roots` feature uses a HTTPS connector provided by [`hyper-rustls`], which uses\n[`rustls`] as the TLS backend, and enables its `native-tokio` feature, which uses [`rustls-native-certs`]\nfor root certificates.\n\nThis is enabled by default.\n\n#### `rustls-webpki-roots`\n\nThe `rustls-webpki-roots` feature uses a HTTPS connector provided by [`hyper-rustls`], which uses\n[`rustls`] as the TLS backend, and enables its `webpki-tokio` feature, which uses [`webpki-roots`]\nfor root certificates.\n\nThis should be preferred over `rustls-native-roots` in Docker containers based on `scratch`.\n\n### Trust-DNS\n\nThe `trust-dns` enables [`hyper-trust-dns`], which replaces the default\n`GaiResolver` in [`hyper`]. [`hyper-trust-dns`] instead provides a fully\nasync DNS resolver on the application level.\n\n[Cloudflare Turnstile]: https://developers.cloudflare.com/turnstile/\n[`hyper`]: https://crates.io/crates/hyper\n[`hyper-rustls`]: https://crates.io/crates/hyper-rustls\n[`hyper-tls`]: https://crates.io/crates/hyper-tls\n[`rustls`]: https://crates.io/crates/rustls\n[`rustls-native-certs`]: https://crates.io/crates/rustls-native-certs\n[`hyper-trust-dns`]: https://crates.io/crates/hyper-trust-dns\n[`webpki-roots`]: https://crates.io/crates/webpki-roots\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyko%2Fcf-turnstile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffyko%2Fcf-turnstile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyko%2Fcf-turnstile/lists"}