{"id":13801664,"url":"https://github.com/omar2205/squishy_cookies","last_synced_at":"2025-08-20T18:57:56.819Z","repository":{"id":56872221,"uuid":"526822256","full_name":"omar2205/squishy_cookies","owner":"omar2205","description":"Easily sign and verify cookies","archived":false,"fork":false,"pushed_at":"2023-03-23T01:11:10.000Z","size":23,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T17:55:36.047Z","etag":null,"topics":["cookie","cookies","deno","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/squishy_cookies","language":"TypeScript","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/omar2205.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-08-20T04:15:08.000Z","updated_at":"2024-05-04T20:26:53.000Z","dependencies_parsed_at":"2024-06-21T16:56:35.203Z","dependency_job_id":null,"html_url":"https://github.com/omar2205/squishy_cookies","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"37eea8479fa00d0d153bfc4d8e076d2c73d4f7cd"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar2205%2Fsquishy_cookies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar2205%2Fsquishy_cookies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar2205%2Fsquishy_cookies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar2205%2Fsquishy_cookies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omar2205","download_url":"https://codeload.github.com/omar2205/squishy_cookies/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248529990,"owners_count":21119582,"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":["cookie","cookies","deno","typescript"],"created_at":"2024-08-04T00:01:25.579Z","updated_at":"2025-04-12T06:32:50.456Z","avatar_url":"https://github.com/omar2205.png","language":"TypeScript","funding_links":[],"categories":["Modules"],"sub_categories":["Web utils"],"readme":"# Squishy Cookies 🍪\n\n\u003cdiv align=\"center\"\u003e\n\nEasily sign and verify cookies.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/1373867/185759251-6b3a9237-8e79-468a-b0e3-e235927f0267.png\" /\u003e\n\n\u003c/div\u003e\n\n## Usage\n\n```ts\nimport {\n  createSignedCookie, verifySignedCookie,\n} from 'https://deno.land/x/squishy_cookies/mod.ts'\n\nconst COOKIE_SECRET = Deno.env.get('COOKIE_SECRET') || 'super_secret'\n\n// 1. Create a signed cookie\n\n// Optional, headers or cookie string (to be used in Set-cookie header)\nconst { headers, cookie } = await createSignedCookie(\n    'id', '1', COOKIE_SECRET,\n    { httpOnly: true, path: '/' }\n)\nreturn new Response(page, { headers })\n\n// or\n\nconst headers = new Headers()\nheaders.append('set-cookie', cookie)\n\n\n// 2. Verifying a cookie\n\nheaders.append('cookie', cookie) // verifySignedCookie will search for 'cookie' header\nconst userId = await verifySignedCookie(headers, 'id', COOKIE_SECRET)\n// userId is false if the verification failed or the cookie value\nif (userId) {\n  const user = await getUserById(userId.split('.')[0])\n}\n\n```\n\n\n### Tip to add multiple cookies\n```ts\nconst { cookie: cookie1 } = await createSignedCookie(/* ... */)\nconst { cookie: cookie2 } = await createSignedCookie(/* ... */)\n\nconst response = new Response(someHTML, {\n  // using headers as an array of arrays let you use\n  // multiple headers with the same name\n  headers: [\n    ['Set-cookie', cookie1],\n    ['Set-cookie', cookie2],\n  ]\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomar2205%2Fsquishy_cookies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomar2205%2Fsquishy_cookies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomar2205%2Fsquishy_cookies/lists"}