{"id":16560626,"url":"https://github.com/bgalek/url-signer","last_synced_at":"2025-06-20T02:38:11.946Z","repository":{"id":36956694,"uuid":"283013754","full_name":"bgalek/url-signer","owner":"bgalek","description":"Easy way to ensure that link was not tempered with","archived":false,"fork":false,"pushed_at":"2025-05-26T00:52:46.000Z","size":337,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-26T01:41:31.556Z","etag":null,"topics":["expiring","java","library","one-time","signing","url"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bgalek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2020-07-27T20:52:09.000Z","updated_at":"2025-05-26T00:52:48.000Z","dependencies_parsed_at":"2023-11-06T02:23:32.709Z","dependency_job_id":"c5951d25-c02f-4322-a29d-d1e9d1002704","html_url":"https://github.com/bgalek/url-signer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bgalek/url-signer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Furl-signer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Furl-signer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Furl-signer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Furl-signer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgalek","download_url":"https://codeload.github.com/bgalek/url-signer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgalek%2Furl-signer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260867907,"owners_count":23074915,"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":["expiring","java","library","one-time","signing","url"],"created_at":"2024-10-11T20:29:38.213Z","updated_at":"2025-06-20T02:38:06.931Z","avatar_url":"https://github.com/bgalek.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java solution for url signing\n\u003e Easy way to ensure that link was not tempered with\n\n[![Build](https://github.com/bgalek/url-signer/actions/workflows/ci.yml/badge.svg?style=flat-square)](https://github.com/bgalek/url-signer/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/github/bgalek/url-signer/graph/badge.svg?token=VDUL4P2CLF)](https://codecov.io/github/bgalek/url-signer)\n![GitHub Release Date](https://img.shields.io/github/release-date/bgalek/url-signer.svg?style=flat-square)\n![Maven Central](https://img.shields.io/maven-central/v/com.github.bgalek.utils/url-signer?style=flat-square)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bgalek_url-signer\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=bgalek_url-signer)\n\n## Why?\nI can think about several use cases: \n\n- a disposable link, that stops working after user clicks it\n- a link containing parameters that should not be tempered with\n- a signed link, that can be checked if it was issued by the author\n- time expiring links that cannot be extended simply by editng link\n\n## Usage\nAdd library dependency:\n```groovy\ncompile \"com.github.bgalek.utils:url-signer:1.0.1\"\n```\n\nAdd checksum to url using SHA256 signature:\n```java\nUrlSigner signer = new SHA256ChecksumUrlSigner().sign(URI.create(\"https://github.com\"))\nsigner.verify(\"https://github.com?checksum=996e1f714b08e971ec79e3bea686287e66441f043177999a13dbc546d8fe402a\")\n```\n\nSign url using:\n```java\nUrlSigner signer = new HMACChecksumUrlSigner(HmacAlgorithms.HMAC_MD5, \"secret\").sign(URI.create(\"https://github.com\"))\nsigner.verify(\"https://github.com?checksum=996e1f714b08e971ec79e3bea686287e66441f043177999a13dbc546d8fe402a\")\n```\n\nExpiring url: \n```java\nUrlSigner signer = new TimeExpirationUrlSigner(Duration.ofMinutes(15), clock)\nurlSigner.verify(\"https://github.com?checksum=8d7bdc5fe9dd7791a9dda4c78621bfea\")\n```\n\n## Extending/Customization\n\nSimply implement UrlSigner interface to create \nYour own signature/verification algorithm:\n\nTo generate url signed\nusing 3 stars like `https://github.com?signature=★★★` you can use:\n\n```java\nUrlSigner urlSigner = new UrlSigner() {\n    @Override\n    public URI sign(URI uri) {\n        return UriComponentsBuilder.fromUri(uri)\n                .replaceQueryParam(signatureParameterName(), Collections.emptyList())\n                .replaceQueryParam(signatureParameterName(), \"★★★\")\n                .build()\n                .toUri();\n    }\n\n    @Override\n    public boolean verify(URI uri) {\n        return uri.toString().contains(\"★★★\");\n    }\n\n    @Override\n    public String signatureParameterName() {\n        return \"signature\";\n    }\n};\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgalek%2Furl-signer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgalek%2Furl-signer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgalek%2Furl-signer/lists"}