{"id":29574741,"url":"https://github.com/pyropy/web3-cardano-token","last_synced_at":"2025-07-19T08:39:36.007Z","repository":{"id":44865070,"uuid":"430660653","full_name":"pyropy/web3-cardano-token","owner":"pyropy","description":"Web3 Token is a new way to authenticate users in a hybrid dApps using signed messages.","archived":false,"fork":false,"pushed_at":"2023-01-11T09:13:25.000Z","size":4366,"stargazers_count":28,"open_issues_count":5,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-01T08:03:24.376Z","etag":null,"topics":["authentication","cardano","cardano-community","web-token","web3","web3-dapp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/pyropy.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}},"created_at":"2021-11-22T10:26:13.000Z","updated_at":"2024-04-12T08:01:11.000Z","dependencies_parsed_at":"2023-02-09T02:31:15.382Z","dependency_job_id":null,"html_url":"https://github.com/pyropy/web3-cardano-token","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pyropy/web3-cardano-token","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyropy%2Fweb3-cardano-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyropy%2Fweb3-cardano-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyropy%2Fweb3-cardano-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyropy%2Fweb3-cardano-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyropy","download_url":"https://codeload.github.com/pyropy/web3-cardano-token/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyropy%2Fweb3-cardano-token/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265905116,"owners_count":23846696,"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","cardano","cardano-community","web-token","web3","web3-dapp"],"created_at":"2025-07-19T08:39:35.171Z","updated_at":"2025-07-19T08:39:35.991Z","avatar_url":"https://github.com/pyropy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web3 Cardano Token\n\nWeb3 Cardano Token is a new way to authenticate users. A replacement for JWT in hybrid dApps.\n---\n\n## Install\n\n```bash\n$ npm i web3-cardano-token\n```\n---\n\n## Example usage (Client side)\n\nUsing [Nami Wallet](https://namiwallet.io/) extension:\n\n```js\nimport Web3Token from 'web3-cardano-token/dist/browser';\n\n// Connection to Nami wallet\nconst cardano = window.cardano;\nawait cardano.nami.enable();\n\n// getting address from which we will sign message\nconst address = (await cardano.getUsedAddresses())[0];\n\n// generating a token with 1 day of expiration time\nconst token = await Web3Token.sign(msg =\u003e cardano.signData(your_address, toHex(msg)), '1d');\n\n// attaching token to authorization header ... for example\n```\n---\n\n## Example usage (Server side)\n```js\nconst Web3Token = require('web3-cardano-token/dist/node');\n\n// getting token from authorization header ... for example\nconst token = req.headers['Authorization']\n\nconst { address, body } = await Web3Token.verify(token);\n\n// now you can find that user by his address\n// (better to do it case insensitive)\nreq.user = await User.findOne({ address });\n```\n\n---\n## API\n\nArgument | Name | Description | Required | Example\n--- | --- | --- | --- | ---\n1 | `signer` | A function that returns a promise with signature string eg: await namiWallet.signData(`address`, `data`) | `required` | `(body) =\u003e await namiWallet.signData(addr1e2..0c, body)`\n2 | `expire_in` | A string that represents a time span ([see ms module](https://github.com/vercel/ms)) or a number of milliseconds | `optional` (default: `1d`) | `1 day`\n3 | `body` | An object that will be appended to a signature's body. Can only contain string values. Can be used for some custom data. | `optional` | `{ 'Custom-data': 'some custom data' }`\n\n---\n## License\nWeb3 Cardano Token is released under the MIT license. © 2021 Srdjan Stankovic\n\n\n## Note:\n\nThis package is based upon [web3-token](https://github.com/bytesbay/web3-token) package and uses the same API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyropy%2Fweb3-cardano-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyropy%2Fweb3-cardano-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyropy%2Fweb3-cardano-token/lists"}