{"id":15405151,"url":"https://github.com/fnando/url_signature","last_synced_at":"2025-06-15T01:39:19.975Z","repository":{"id":43046443,"uuid":"309936816","full_name":"fnando/url_signature","owner":"fnando","description":"Create and verify signed urls. Supports expiration time.","archived":false,"fork":false,"pushed_at":"2025-03-22T05:18:34.000Z","size":36,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-17T12:09:24.515Z","etag":null,"topics":["ruby","url-signature","url-signer","url-signing"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/fnando.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null},"funding":{"github":["fnando"],"custom":["https://paypal.me/nandovieira/🍕"]}},"created_at":"2020-11-04T08:15:44.000Z","updated_at":"2025-04-09T10:17:14.000Z","dependencies_parsed_at":"2025-04-17T01:28:05.921Z","dependency_job_id":"c4808b48-04fc-4746-963d-d181f4e65d8e","html_url":"https://github.com/fnando/url_signature","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.4666666666666667,"last_synced_commit":"35c4604e06d7af881e578df1964d584a2d458ac5"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/fnando/url_signature","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Furl_signature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Furl_signature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Furl_signature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Furl_signature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/url_signature/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Furl_signature/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259910015,"owners_count":22930669,"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":["ruby","url-signature","url-signer","url-signing"],"created_at":"2024-10-01T16:15:13.725Z","updated_at":"2025-06-15T01:39:19.951Z","avatar_url":"https://github.com/fnando.png","language":"Ruby","funding_links":["https://github.com/sponsors/fnando","https://paypal.me/nandovieira/🍕"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/fnando/url_signature/\"\u003e\n    \u003cimg width=\"400\" src=\"https://github.com/fnando/url_signature/raw/main/url_signature.svg\" alt=\"URL Signature\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Create and verify signed urls. Supports expiration time.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/fnando/url_signature\"\u003e\u003cimg src=\"https://github.com/fnando/url_signature/workflows/Tests/badge.svg\" alt=\"Tests\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://rubygems.org/gems/url_signature\"\u003e\u003cimg src=\"https://img.shields.io/gem/v/url_signature.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://rubygems.org/gems/url_signature\"\u003e\u003cimg src=\"https://img.shields.io/gem/dt/url_signature.svg\" alt=\"Downloads\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\ngem install url_signature\n```\n\nOr add the following line to your project's Gemfile:\n\n```ruby\ngem \"url_signature\"\n```\n\n## Usage\n\nTo create a signed url, you can use `SignedURL.call(url, **kwargs)`, where\narguments are:\n\n- `key`: The secret key that will be used to generate the HMAC digest.\n- `params`: Any additional params you want to add as query strings.\n- `expires`: Any integer representing an epoch time. Urls won't be verified\n  after this date. By default, urls don't expire.\n- `hmac_proc`: `Proc` that will generate the signature. By default, it generates\n  a `base64url(sha512_hmac(data))` signature (with no padding). The proc will be\n  called with two parameters: `key` and `data`.\n- `signature_param`: The signature's param name. By default it's `signature`.\n- `expires_param`: The expires' param name. By default it's `expires`.\n\n```ruby\nkey = \"secret\"\n\nsigned_url = SignedURL.call(\"https://nandovieira.com\", key: key)\n#=\u003e \"https://nandovieira.com/?signature=87fdf44a5109c54edff2e0258b354e32ba5b...\"\n```\n\nYou can use the method `SignedURL.verified?(url, **kwargs)` to verify if a\nsigned url is valid.\n\n```ruby\nkey = \"secret\"\n\nsigned_url = SignedURL.call(\"https://nandovieira.com\", key: key)\n\nSignedURL.verified?(signed_url, key: key)\n#=\u003e true\n```\n\nAlternatively, you can use `SignedURL.verify!(url, **kwargs)`, which will raise\nexceptions if a url cannot be verified (e.g. has been tampered, it's not fresh,\nor is a plain invalid url).\n\n- `URLSignature::InvalidURL` if url is not valid\n- `URLSignature::ExpiredURL` if url has expired\n- `URLSignature::InvalidSignature` if the signature cannot be verified\n\nTo create a url that's valid for a time window, use `:expires`. The following\nexample create a url that's valid for 2 minutes.\n\n```ruby\nkey = \"secret\"\n\nsigned_url = SignedURL.call(\n  \"https://nandovieira.com\",\n  key: secret,\n  expires: Time.now.to_i + 120\n)\n#=\u003e \"https://nandovieira.com/?expires=1604477596\u0026signature=7ac5eaee20d316...\"\n```\n\n## Maintainer\n\n- [Nando Vieira](https://github.com/fnando)\n\n## Contributors\n\n- https://github.com/fnando/url_signature/contributors\n\n## Contributing\n\nFor more details about how to contribute, please read\nhttps://github.com/fnando/url_signature/blob/main/CONTRIBUTING.md.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be\nfound at https://github.com/fnando/url_signature/blob/main/LICENSE.md.\n\n## Code of Conduct\n\nEveryone interacting in the url_signature project's codebases, issue trackers,\nchat rooms and mailing lists is expected to follow the\n[code of conduct](https://github.com/fnando/url_signature/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Furl_signature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Furl_signature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Furl_signature/lists"}