{"id":16742102,"url":"https://github.com/cedoor/zuauth","last_synced_at":"2025-04-10T13:32:41.587Z","repository":{"id":205104037,"uuid":"712546697","full_name":"cedoor/zuauth","owner":"cedoor","description":"A simple package designed to streamline the development of a zero-knowledge authentication system with Zupass tickets.","archived":false,"fork":false,"pushed_at":"2024-02-28T09:30:24.000Z","size":1336,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T12:11:30.535Z","etag":null,"topics":["authentication","pcd","zuauth","zupass","zuzalu"],"latest_commit_sha":null,"homepage":"https://zuauth.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedoor.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-31T17:22:58.000Z","updated_at":"2025-03-14T19:16:43.000Z","dependencies_parsed_at":"2024-02-28T10:49:12.228Z","dependency_job_id":null,"html_url":"https://github.com/cedoor/zuauth","commit_stats":null,"previous_names":["cedoor/zuauth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedoor%2Fzuauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedoor%2Fzuauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedoor%2Fzuauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedoor%2Fzuauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedoor","download_url":"https://codeload.github.com/cedoor/zuauth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225708,"owners_count":21068078,"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":["authentication","pcd","zuauth","zupass","zuzalu"],"created_at":"2024-10-13T01:22:38.206Z","updated_at":"2025-04-10T13:32:41.537Z","avatar_url":"https://github.com/cedoor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ch1 align=\"center\"\u003e\n        \u003cpicture\u003e\n            \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/cedoor/zuauth/blob/main/example/public/light-icon.png\"\u003e\n            \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/cedoor/zuauth/blob/main/example/public/icon.png\"\u003e\n            \u003cimg width=\"50\" alt=\"ZuAuth Icon\" src=\"https://github.com/cedoor/zuauth/blob/main/example/public/icon.png\"\u003e\n        \u003c/picture\u003e\n        Zuauth\n    \u003c/h1\u003e\n    \u003cp align=\"center\"\u003eA simple package designed to streamline the development of a zero-knowledge authentication system with Zupass tickets.\u003c/p\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/proofcarryingdata\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/project-PCD-blue.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/cedoor/zuauth/blob/main/LICENSE\"\u003e\n        \u003cimg alt=\"Github license\" src=\"https://img.shields.io/github/license/cedoor/zuauth.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/zuauth\"\u003e\n        \u003cimg alt=\"NPM version\" src=\"https://img.shields.io/npm/v/zuauth?style=flat-square\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n|  The repository includes the `zuauth` package along with a documented [example](https://github.com/cedoor/zuauth/blob/main/example/README.md) demonstrating how to create an authentication system using NextJS and IronSession. Use the [demo](https://zuauth.vercel.app/) and refer to the [tutorial](/#-tutorial) section below to understand how to integrate `zuauth` into your app. |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n\n## 🛠 Install\n\nInstall the `zuauth` package with npm:\n\n```bash\nnpm i zuauth\n```\n\nor yarn:\n\n```bash\nyarn add zuauth\n```\n\n## 📜 Tutorial\n\u003e [!NOTE]  \n\u003e The [example](https://github.com/cedoor/zuauth/blob/main/example/README.md) in the repository uses [`iron-session`](https://github.com/vvo/iron-session) to manage sessions, but you are of course free to integrate your preferred solution.\n\n### Server\n\nFirst, you need to create the server-side logic to generate a session nonce and perform the authentication. The example in this repository includes four functions: [login](example/src/pages/api/login.ts), [logout](example/src/pages/api/logout.ts), [nonce](example/src/pages/api/nonce.ts), and [user](example/src/pages/api/user.ts). Remember to add all necessary checks in your login function, particularly ensuring that the ticket has been issued by Zupass and that it is among the supported tickets.\n\n### Client\nNext, you can proceed with the client side.\n\n1. Create a page for the Zupass popup:\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/popup.tsx#L1-L10\n\n2. Create another page and define the default set of ticket fields to reveal.\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/index.tsx#L11-L23\n\n3. Check if the user is logged-in.\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/index.tsx#L26-L45\n\n4. Create a function to login, which generates a nonce and user's PCD:\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/index.tsx#L58-L70\n\n5. Check when the PCD is generated and returned by the Zupass popup to call the login API:\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/index.tsx#L47-L56\n\n\u003e [!IMPORTANT]  \n\u003e When the user interacts with the Zupass popup, the output, which is the generated PCD, is not returned by any function but can be found in the `pcd` state variable within the `useZuAuth` hook. It's important to check if the value is defined.\n\n6. Create a function to allow users to log out:\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/index.tsx#L72-L82\n\n7. Create your UI:\n\nhttps://github.com/cedoor/zuauth/blob/c7c052a0a0b27cee9c3be7bae5dea634d7fc6954/example/src/pages/index.tsx#L161-L194\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedoor%2Fzuauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedoor%2Fzuauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedoor%2Fzuauth/lists"}