{"id":18482845,"url":"https://github.com/spaze/nonce-generator","last_synced_at":"2025-04-08T18:31:54.282Z","repository":{"id":56088319,"uuid":"69874095","full_name":"spaze/nonce-generator","owner":"spaze","description":"Content Security Policy Nonce Generator","archived":false,"fork":false,"pushed_at":"2024-10-26T00:16:54.000Z","size":37,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-23T16:51:22.640Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/spaze.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}},"created_at":"2016-10-03T13:40:37.000Z","updated_at":"2024-11-22T23:36:55.000Z","dependencies_parsed_at":"2023-01-22T15:16:08.308Z","dependency_job_id":"37f57ec5-1a17-4324-a430-c36e788bdb78","html_url":"https://github.com/spaze/nonce-generator","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.03703703703703709,"last_synced_commit":"5dfedc9314a10ddab2aa9d15abfc93009db45cb1"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fnonce-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fnonce-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fnonce-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fnonce-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spaze","download_url":"https://codeload.github.com/spaze/nonce-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902287,"owners_count":21015420,"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-11-06T12:31:14.241Z","updated_at":"2025-04-08T18:31:51.711Z","avatar_url":"https://github.com/spaze.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nonce Generator\n\n[![PHP Tests](https://github.com/spaze/nonce-generator/workflows/PHP%20Tests/badge.svg)](https://github.com/spaze/nonce-generator/actions?query=workflow%3A%22PHP+Tests%22)\n\nThis generates random nonces for Content Security Policy *nonce* attributes. These nonces work with CSP3 [`strict-dynamic`](https://w3c.github.io/webappsec-csp/#strict-dynamic-usage) which aims to make Content Security Policy simpler to deploy for existing applications. This package is intended to be used with Nette Framework, [`spaze/csp-config`](https://github.com/spaze/csp-config) and [`spaze/sri-macros`](https://github.com/spaze/sri-macros).\n\n## Usage\n\nThis is a *plug and play* generator.\n\nIf installed, `\\Spaze\\ContentSecurityPolicy\\Config::addDirective()` from `spaze/csp-config` will automatically add `nonce-...` attribute to configured directives, and [Latte](https://latte.nette.org/) macros `{script ...}` and `{stylesheet ...}` from `spaze/sri-macros` will add `nonce=\"...\"` attribute to `script` and `style` attributes respectively. Also `n:nonce` [shortcut](https://doc.nette.org/en/http/configuration#toc-content-security-policy) will use the same generated  value.\n\n## Installation\n\nWith [Composer](https://getcomposer.org):\n\n```\ncomposer require spaze/nonce-generator\n```\n\nAdd the extension to your configuration:\n\n```neon\nextensions:\n\tnonceGenerator: Spaze\\NonceGenerator\\Bridges\\Nette\\GeneratorExtension\n```\n\n## Requirements\n\n- PHP 8.2 or newer\n- Latte 3.0 or newer\n- Nette Application 3.1 or newer\n- Nette DI 3.0 or newer\n\n## API\n\n```\ncreateNonce(): Nonce\n```\nGenerates and returns a `Nonce` object. Use `Nonce::getValue()` to get the generated nonce.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaze%2Fnonce-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspaze%2Fnonce-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaze%2Fnonce-generator/lists"}