{"id":15096026,"url":"https://github.com/joeig/gin-nonce","last_synced_at":"2025-04-06T12:23:40.707Z","repository":{"id":204520367,"uuid":"712052634","full_name":"joeig/gin-nonce","owner":"joeig","description":"Nonce middleware for Gin","archived":false,"fork":false,"pushed_at":"2024-04-29T14:23:51.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T12:44:31.216Z","etag":null,"topics":["csp","gin","go","nonce"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/go.eigsys.de/gin-nonce","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/joeig.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-30T17:39:23.000Z","updated_at":"2024-04-29T14:23:55.000Z","dependencies_parsed_at":"2023-12-28T13:06:17.140Z","dependency_job_id":"db8b6b95-bad9-4438-ac59-02e0c08979b0","html_url":"https://github.com/joeig/gin-nonce","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":0.2222222222222222,"last_synced_commit":"bd9ca7678f44f72b6fc2b465b38756834d0c6a71"},"previous_names":["joeig/gin-nonce"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-nonce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-nonce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-nonce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-nonce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeig","download_url":"https://codeload.github.com/joeig/gin-nonce/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247479739,"owners_count":20945512,"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":["csp","gin","go","nonce"],"created_at":"2024-09-25T15:44:58.929Z","updated_at":"2025-04-06T12:23:40.683Z","avatar_url":"https://github.com/joeig.png","language":"Go","readme":"# Nonce middleware for Gin\n\nThis Gin middleware generates a nonce for each request.\n\n[![Test coverage](https://img.shields.io/badge/coverage-100%25-success)](https://github.com/joeig/gin-nonce/tree/main/.github/testcoverage.yml)\n[![Go Report Card](https://goreportcard.com/badge/go.eigsys.de/gin-nonce)](https://goreportcard.com/report/go.eigsys.de/gin-nonce)\n[![PkgGoDev](https://pkg.go.dev/badge/go.eigsys.de/gin-nonce)](https://pkg.go.dev/go.eigsys.de/gin-nonce)\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"go.eigsys.de/gin-nonce\"\n)\n\nfunc main() {\n\trouter := gin.Default()\n\n\thandler := nonce.New()\n\trouter.Use(handler.Middleware())\n\n\trouter.GET(\"/\", func(ginCtx *gin.Context) {\n\t\tcurrentNonce, _ := handler.GetNonce(ginCtx)\n\t\tginCtx.Header(\"Content-Security-Policy\", fmt.Sprintf(\"style-src 'nonce-%s';\", currentNonce))\n\n\t\tginCtx.String(http.StatusOK, \"Hello, Gopher!\")\n\t})\n\n\t_ = router.Run()\n}\n```\n\n## Documentation\n\nSee [Go reference](https://pkg.go.dev/go.eigsys.de/gin-nonce).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeig%2Fgin-nonce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeig%2Fgin-nonce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeig%2Fgin-nonce/lists"}