{"_id":"@0xbutterfield/passport-siwe","name":"@0xbutterfield/passport-siwe","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@0xbutterfield/passport-siwe","version":"2.0.0","description":"Sign in with Ethereum and Passport","author":{"name":"Arseniy Ivanov","email":"ai@sloika.xyz"},"license":"MIT","homepage":"https://github.com/sloikaxyz/passport-siwe#readme","repository":{"type":"git","url":"git+https://github.com/sloikaxyz/passport-siwe.git"},"bugs":{"url":"https://github.com/sloikaxyz/passport-siwe/issues"},"keywords":["passport","siwe","ethereum"],"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.build.json","clean":"rm -rf coverage dist docs","lint:ci:all":"eslint --max-warnings=0 .","lint:ci":"eslint --max-warnings=0","lint:fix:all":"eslint --cache --fix .","lint:fix":"eslint --cache --fix","lint:precommit":"eslint --cache --fix --max-warnings=0","lint":"eslint","test":"jest","test:ci:all":"jest --ci --coverage","test:precommit":"jest --coverage --bail --passWithNoTests --findRelatedTests","test:watch":"jest --watch","typecheck:ci:all":"tsc --noEmit --pretty --project tsconfig.json","typecheck:precommit":"tsc --noEmit --pretty --project tsconfig.json","typedoc":"typedoc --plugin typedoc-plugin-markdown --out ./docs ./src"},"dependencies":{"passport-strategy":"^1.0.0"},"peerDependencies":{"siwe":">=2.0.0 <3.0"},"devDependencies":{"@jest-mock/express":"^2.0.1","@types/express":"^4.16.0","@types/jest":"^28.1.6","@types/passport-strategy":"*","@typescript-eslint/eslint-plugin":"^5.32.0","@typescript-eslint/parser":"^5.32.0","eslint":"^8.21.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-prettier":"^4.2.1","ethers":"^5.6.9","jest":"^28.1.3","keccak":"^3.0.2","prettier":"^2.7.1","siwe":"^2.0.5","ts-invariant":"^0.10.3","ts-jest":"^28.0.7","typedoc":"^0.23.9","typedoc-plugin-markdown":"^3.13.4","typescript":"^4.7.4"},"gitHead":"2742144c1a41e97adf35fd7fd822bd8e2373ebd1","_id":"@0xbutterfield/passport-siwe@2.0.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-5ghC4VmsWWq39DWzIovoCXu7aA0UHyBa79DoHoNs34bO+muWy3TMBYHh1WJRECflkvtAZirNV9E+qDf/0s0IfA==","shasum":"7713b2dc923fb2d4cd6c4cc6d9edd56d0cd9eaa7","tarball":"https://registry.npmjs.org/@0xbutterfield/passport-siwe/-/passport-siwe-2.0.0.tgz","fileCount":45,"unpackedSize":69547,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVBMBiIgD9oGjRymSTvClWTDGL11z/LLP5wIo5XczZkAIgBfm7kMPXh2/3J5VMhb/2RXb1Hht8x9Lqb7nmJWcAtHI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjx+27ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoH9g//bednNCGt+kmf6MPGXyBShtGvi5bwDZSGkKtyPPBcomF9wpkr\r\n8fdckoOP15fCia/kq5MOk4+/Y7xYGNY4JowU+53Ymquqfq9o9yucvA1IGu7G\r\nznpGcv9d9P2iaA6iqCHIWRf/zjwJbfiG7QzeZ8RVN7kG3I63r0RPZ8rQym8q\r\n9zPjVD+QjSoJPkB4s5fc71ly8MpXw6HLxNZa7aYIlyiXkUG9/LAbOLYjyAHz\r\npH2Tf+GTNI211bsiX8avbpqo3YkLm1UYdyvcYF+jkYoUCQw0HiviE2WNDW+K\r\nx98nMXKNbjPGjqqi5G+H3Rwn+6BfkBCecFrbeXOc0xo5DNffLRwuS12QQRdd\r\ne05mXm3RZLWVMY1yOZ7PikF11xbQ6xhkd+ayLuYFquQmAuaE/hNGj6j9tzW3\r\nJNf6dWcfHGmbrb+kWuFFFW+gFNggbtlcwQhdPSxqB4vENBM+17L2RzUuBPYa\r\nshFWSR5Ivf6GgxHJWux5mtcL4gUqPDkEiNNuvQ6yX0Q4IOplDrTGyeI/lW6g\r\nwcQzQJgE0yofCqadmFUstdNpVCxdy6p3eGj/KYIxArkzI3CEJGMhgmiitepb\r\nxi9HuMKncyg4OjgQ9Dt6Kjyv/dKCBuFqV30zoto8fbo4y+aAkH5TF2QewOJY\r\nYZyq4QwnBzpC/dMddWrAWYxwLmHPEWypf0I=\r\n=d3bn\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"0xbutterfield","email":"b.butterfield@aura.finance"},"directories":{},"maintainers":[{"name":"0xbutterfield","email":"b.butterfield@aura.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/passport-siwe_2.0.0_1674046907788_0.4240792766784014"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-18T13:01:47.640Z","2.0.0":"2023-01-18T13:01:47.961Z","modified":"2023-01-18T13:01:48.124Z"},"maintainers":[{"name":"0xbutterfield","email":"b.butterfield@aura.finance"}],"description":"Sign in with Ethereum and Passport","homepage":"https://github.com/sloikaxyz/passport-siwe#readme","keywords":["passport","siwe","ethereum"],"repository":{"type":"git","url":"git+https://github.com/sloikaxyz/passport-siwe.git"},"author":{"name":"Arseniy Ivanov","email":"ai@sloika.xyz"},"bugs":{"url":"https://github.com/sloikaxyz/passport-siwe/issues"},"license":"MIT","readme":"[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs)\n\n# @sloikaxyz/passport-siwe\n\nSign in with Ethereum and Passport\n\n`@sloikaxyz/passport-siwe` provides a [Passport](https://passportjs.org) authentication strategy\nfor [Sign in with Ethereum.](https://login.xyz)\n\nThis module can be used with Express, Nest.js, [Fastify](https://github.com/fastify/fastify)\n(via `@fastify/passport`), or any other framework that supports Connect-style middleware.\n## Usage\n\n### Client-facing API\n\nThe strategy expects the request body to contain an object with keys `message` — a plaintext message conforming to the [EIP-4361 spec](https://eips.ethereum.org/EIPS/eip-4361#specification), and `signature` — the signature over the message, represented as a hex string. For an example of how to generate this on frontend, see [siwe usage examples](https://github.com/spruceid/siwe#quickstart-examples).\n\n### Configuring the strategy\n\n```typescript\nimport Strategy from '@sloikaxyz/passport-siwe';\nimport { SiweMessage } from 'siwe';\n\npassport.use(\n  new Strategy(\n    {\n      domain: 'example.org', // authentication domain, required\n    },\n    function (\n      message: SiweMessage,\n      callback: (\n        err: Error | null,\n        user: unknown,\n        info?: unknown,\n      ) => void,\n    ) {\n      // The callback is invoked if the message is valid, i.e.:\n      // - the authentication domain matches,\n      // - the message is in effect (see \"Expiration Time\" and \"Not Before\"),\n      // - the signature provided in the request is valid.\n      //\n      // NOTE: Nonce is not validated by the strategy — it's up to you to implement that.\n      //\n      // Use `message.address` — an EIP-55 checksummed address — to determine the user.\n      //\n      // Call...\n      // - callback(null, user) to sign the user in\n      // - callback(null, null) to fail this authentication attempt\n      // - callback(err, null) to signal that a server-side error has occurred while processing this request\n    },\n  ),\n);\n```\n\n### Accessing the request object\n\n```typescript\nimport Strategy from '@sloikaxyz/passport-siwe';\nimport express from 'express';\nimport { SiweMessage } from 'siwe';\n\npassport.use(\n  new Strategy(\n    {\n      domain: 'example.org',\n      passReqToCallback: true, // pass the request as the first argument of the callback\n    },\n    function (\n      req: express.Request, // an express-style request object\n      message: SiweMessage,\n      callback: (\n        err: Error | null,\n        user: unknown,\n        info?: unknown,\n      ) => void,\n    ) {\n      // See \"Basic usage\" for discussion of the callback.\n    },\n  ),\n);\n```\n\n\n## Installation\n\nInstall my-project with npm\n\n```bash\n  npm install @sloikaxyz/passport-siwe siwe@^2.0.5 ethers@^5.6.8\n  # or\n  yarn add @sloikaxyz/passport-siwe siwe@^2.0.5 ethers@^5.6.8\n```\n\n## Roadmap\n\n- Nonce verification support\n\n\n## Contributing\n\nContributions are always welcome!\n\nQuick steps:\n1. Fork and clone the repo.\n2. Make changes to the strategy as necessary — you can run `yarn test:watch` while developing.\n3. Commit the changes and run `yarn test:ci` to verify the tests pass.\n4. Send a PR :)\n## Acknowledgements\n\n - [EIP-4361: Sign-In with Ethereum](https://eips.ethereum.org/EIPS/eip-4361), the spec\n - [siwe](https://github.com/spruceid/siwe), the Sign in with Ethereum library that does most of the heavy-lifting here\n - [Passport](https://passportjs.org), the Node.js authentication library\n - [passport-ethereum](https://github.com/jaredhanson/passport-ethereum/), a `siwe@1.x` Passport strategy from the author of Passport\n\n\n## License\n\nMIT License\n\nCopyright (c) 2022 Sloika Industries, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","readmeFilename":"README.md"}