{"id":21487205,"url":"https://github.com/dtinth/warp","last_synced_at":"2026-05-15T20:04:53.656Z","repository":{"id":139905234,"uuid":"324319212","full_name":"dtinth/warp","owner":"dtinth","description":"Signed URL redirection thing","archived":false,"fork":false,"pushed_at":"2020-12-29T18:31:55.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-23T04:43:02.984Z","etag":null,"topics":["tweetnacl-js","vercel"],"latest_commit_sha":null,"homepage":"https://warp.spacet.me","language":"TypeScript","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/dtinth.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-12-25T08:12:12.000Z","updated_at":"2021-09-14T17:37:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e3c059c-84b6-4e0b-94b9-d8e7d12f8196","html_url":"https://github.com/dtinth/warp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dtinth/warp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtinth%2Fwarp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtinth%2Fwarp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtinth%2Fwarp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtinth%2Fwarp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtinth","download_url":"https://codeload.github.com/dtinth/warp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtinth%2Fwarp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["tweetnacl-js","vercel"],"created_at":"2024-11-23T13:27:22.442Z","updated_at":"2026-05-15T20:04:53.651Z","avatar_url":"https://github.com/dtinth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# warp\n\nSigned URL redirection service.\n\n## Why?\n\n[Firebase Dynamic Links](https://firebase.google.com/docs/dynamic-links) is a useful service that allows me to generate [sharable social links](https://firebase.google.com/docs/dynamic-links/link-previews#social_sharing_previews).\nThe generated links can be shared to social networks with specified `title`, `description` and `image`.\n\n```js\nfunction getDynamicLink(pageUrl, imageUrl, title, description) {\n  const dynamicLink = 'https://dtinth.page.link/?' + [\n    `link=${encodeURIComponent(pageUrl)}`,\n    `st=${encodeURIComponent(title)}`,\n    `sd=${encodeURIComponent(description)}`,\n    `si=${encodeURIComponent(imageUrl)}`,\n  ].join('\u0026')\n  return dynamicLink\n}\n```\n\nHowever, for security, [it is a best practice to restrict the usage of Dynamic Page Link to only domains that I own](https://support.google.com/firebase/answer/9021429).\nThis poses a problem when I want to link to 3rd party domains; I would have to edit the allowlist pattern for each new domain that I link to.\n\nInstead of doing that I decided to create a signed URL redirection service. A redirect is authorized if it is properly cryptographically signed.\n\n## Generating signed URLs\n\n1. Get the URL to sign.\n\n    ```\n    https://github.com/dtinth\n    ```\n\n2. Use [TweetNaCl](https://tweetnacl.js.org/#/sign) to sign the URL with my own private key. This generates a signature. Encode the signature as [base64url](https://en.wikipedia.org/wiki/Base64#RFC_4648).\n\n    ```\n    k-4eL27uaLEgfSvL_KW9NeE2LxW_4gocHxerjOSBno7aR7MHUgGhj5CmHLW2LBgt6rxR_0zrZskZm66RwDtUCA\n    ```\n\n3. Construct a signed URL which lives on my personal domain `spacet.me`.\n\n    ```\n    https://warp.spacet.me/api/go\n        ?u=https://github.com/dtinth\n        \u0026i=automatron\n        \u0026s=k-4eL27uaLEgfSvL_KW9NeE2LxW_4gocHxerjOSBno7aR7MHUgGhj5CmHLW2LBgt6rxR_0zrZskZm66RwDtUCA\n    ```\n\n4. Use that signed URL to generare a Firebase Dynamic Link.\n\n## Parameters\n\n| Query Parameter | Description |\n| --------------- | ----------- |\n| `u` | URL to redirect to |\n| `i` | Issuer of the signed URL, which is registered [in the API's source code](https://github.com/dtinth/warp/blob/fed1374a536b096ef28daa6deb393fa755289eb8/api/go.ts#L5) |\n| `s` | The signature, base64url-encoded |\n| `p` | Prefix length for delegation (see below) |\n\n## Delegation\n\nIn the above example, every individual URLs must be personally signed by me.\nBut sometimes I want to allow others to use this service, but with restrictions.\nA common restriction is by using URL prefixes.\nInstead of signing the whole URL, a URL prefix can be signed instead.\n\n1. Get the URL prefix to sign, and append `*` to it to get a URL pattern.\n\n    ```\n    https://wonderful.software/*\n    ```\n\n    Also count the prefix length (excluding the `*`), here it is 27 characters.\n\n2. Sign the pattern to generate a signature:\n\n    ```\n    QKrnwHJLl7kHMPllMozh38viYGLYvOWH9CRwrtUhMlnEa6Ill3nBEtvasGf1ygFp-tINQj_uyzCni1EsbqWYBw\n    ```\n\n3. Construct a signed URL:\n\n    ```\n    https://warp.spacet.me/api/go\n        ?u=https://wonderful.software/elect-live/pdd/\n        \u0026p=27\n        \u0026i=automatron\n        \u0026s=QKrnwHJLl7kHMPllMozh38viYGLYvOWH9CRwrtUhMlnEa6Ill3nBEtvasGf1ygFp-tINQj_uyzCni1EsbqWYBw\n    ```\n\n4. Use the signed URL.\n\n## How I am using this\n\nI sign URLs through my personal chat bot [automatron](https://dt.in.th/automatron.html). It [takes care of constructing the signed URL and holds the private key](https://github.com/dtinth/automatron-prelude/blob/8e8cf05ff030492882290527c3a1ed861caa4660/prelude.js#L76-L88) [encrypted](https://github.com/dtinth/encrypted).\n\n![Screenshot](https://user-images.githubusercontent.com/193136/103305807-b29d1980-4a3e-11eb-9443-46871875fa86.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtinth%2Fwarp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtinth%2Fwarp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtinth%2Fwarp/lists"}