{"_id":"@1001-digital/adonis-siwe","name":"@1001-digital/adonis-siwe","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@1001-digital/adonis-siwe","version":"0.1.0","description":"Lazy Sign-In with Ethereum sessions for AdonisJS","type":"module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/1001-digital/adonis-siwe.git"},"engines":{"node":">=24.0.0"},"main":"build/index.js","types":"build/index.d.ts","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./types":{"types":"./build/src/types.d.ts","default":"./build/src/types.js"},"./siwe_provider":{"types":"./build/providers/siwe_provider.d.ts","default":"./build/providers/siwe_provider.js"},"./services/main":{"types":"./build/services/main.d.ts","default":"./build/services/main.js"}},"dependencies":{"@signinwithethereum/siwe":"^4.2.0","viem":"^2.47.5"},"peerDependencies":{"@adonisjs/assembler":"^8.0.0","@adonisjs/core":"^7.0.0","@adonisjs/session":"^8.0.0"},"peerDependenciesMeta":{"@adonisjs/assembler":{"optional":true}},"devDependencies":{"@adonisjs/assembler":"^8.0.0","@adonisjs/core":"^7.0.0","@adonisjs/eslint-config":"^3.0.0","@adonisjs/prettier-config":"^1.4.5","@adonisjs/session":"^8.0.0","@adonisjs/tsconfig":"^2.0.0","@changesets/changelog-github":"^0.6.0","@changesets/cli":"^2.31.0","@japa/assert":"^4.2.0","@japa/runner":"^5.3.0","@poppinss/ts-exec":"^1.4.4","@types/node":"~24.11.0","copyfiles":"^2.4.1","del-cli":"^7.0.0","eslint":"^10.0.2","prettier":"^3.8.1","tsdown":"^0.20.3","typescript":"~5.9.3"},"tsdown":{"entry":["./index.ts","./src/types.ts","./providers/siwe_provider.ts","./services/main.ts"],"outDir":"./build","clean":true,"format":"esm","minify":"dce-only","fixedExtension":false,"dts":false,"treeshake":false,"sourcemaps":false,"target":"esnext"},"prettier":"@adonisjs/prettier-config","keywords":["adonisjs","siwe","ethereum","wallet","auth"],"scripts":{"build":"npm run clean && npm run compile","clean":"del-cli build","compile":"tsdown && tsc --emitDeclarationOnly --declaration && npm run copy:stubs","copy:stubs":"copyfiles \"stubs/**/*.stub\" --up=\"1\" build","test":"node --experimental-transform-types --enable-source-maps tests/siwe_manager.spec.ts","typecheck":"tsc --noEmit","lint":"eslint .","changeset":"changeset","format":"prettier --write ."},"_id":"@1001-digital/adonis-siwe@0.1.0","bugs":{"url":"https://github.com/1001-digital/adonis-siwe/issues"},"homepage":"https://github.com/1001-digital/adonis-siwe#readme","_integrity":"sha512-/9UjkYm99+ITetmME4/SXwx1E7iaRTDjO3IKS2QTY3DG8dityD0zUZ5aYSPsCUUH3Mli0bisfCISoijX+ZNuog==","_resolved":"/tmp/48b453a2fddcc3129c97957a72b45c0f/1001-digital-adonis-siwe-0.1.0.tgz","_from":"file:1001-digital-adonis-siwe-0.1.0.tgz","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-/9UjkYm99+ITetmME4/SXwx1E7iaRTDjO3IKS2QTY3DG8dityD0zUZ5aYSPsCUUH3Mli0bisfCISoijX+ZNuog==","shasum":"f4764b1b872b6a1ddaeedef08355dbc44b11f5f3","tarball":"https://registry.npmjs.org/@1001-digital/adonis-siwe/-/adonis-siwe-0.1.0.tgz","fileCount":20,"unpackedSize":23383,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDUIN3vpntPgnyCcdeFfg/jbTfLim3z7KUWXITbcJnbWQIgRZ/+r5dUkoWN2f9PgvNYd9fHCJWiZlIs0s2J5M+EN0c="}]},"_npmUser":{"name":"jwahdatehagh","email":"jalil@1001.digital"},"directories":{},"maintainers":[{"name":"jwahdatehagh","email":"jalil@1001.digital"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adonis-siwe_0.1.0_1776901824558_0.31326315555059114"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-22T23:50:24.413Z","0.1.0":"2026-04-22T23:50:24.691Z","modified":"2026-04-22T23:50:25.001Z"},"maintainers":[{"name":"jwahdatehagh","email":"jalil@1001.digital"}],"description":"Lazy Sign-In with Ethereum sessions for AdonisJS","homepage":"https://github.com/1001-digital/adonis-siwe#readme","keywords":["adonisjs","siwe","ethereum","wallet","auth"],"repository":{"type":"git","url":"git+https://github.com/1001-digital/adonis-siwe.git"},"bugs":{"url":"https://github.com/1001-digital/adonis-siwe/issues"},"license":"MIT","readme":"# @1001-digital/adonis-siwe\n\nLazy Sign-In with Ethereum sessions for AdonisJS.\n\nThe package handles SIWE message creation, nonce storage, signature verification,\nand a short-lived wallet session stored in the Adonis session. EIP-4361 parsing\nand verification are delegated to `@signinwithethereum/siwe`. It deliberately\ndoes not create users or issue app tokens. Applications can use hooks when they\nwant to link wallets to users or return custom data after verification.\n\n## Install\n\nRequires Node.js 24 or newer, matching AdonisJS 7.\n\n```sh\nnpm install @1001-digital/adonis-siwe\nnode ace configure @1001-digital/adonis-siwe\n```\n\nThe configure hook creates `config/siwe.ts`, registers the provider, and adds\nbasic environment variables.\n\n## Routes\n\nBy default the provider registers:\n\n```txt\nPOST /auth/siwe/message\nPOST /auth/siwe/verify\nGET  /auth/siwe/session\nPOST /auth/siwe/logout\n```\n\nThe package expects `@adonisjs/session` middleware to be enabled.\n\n## Lazy auth\n\nDo not call SIWE during normal wallet connect. Call it only when a user starts\nan action that needs server-trusted wallet ownership.\n\n```ts\nconst { message } = await api.post('/auth/siwe/message', {\n  address,\n  chainId: 1,\n})\n\nconst signature = await signMessage({ message })\nawait api.post('/auth/siwe/verify', { message, signature })\n```\n\nAfter verification, protected controllers can read the wallet session through\nthe service:\n\n```ts\nimport siwe from '@1001-digital/adonis-siwe/services/main'\n\nconst wallet = await siwe.requireSession(ctx)\n```\n\n## Config\n\n```ts\nimport env from '#start/env'\nimport { defineConfig } from '@1001-digital/adonis-siwe'\n\nexport default defineConfig({\n  routes: {\n    enabled: true,\n    prefix: '/auth/siwe',\n  },\n  message: {\n    domain: env.get('SIWE_DOMAIN'),\n    uri: env.get('SIWE_URI'),\n    statement: 'Sign in to EVM.NOW',\n    chainId: 1,\n  },\n  verification: {\n    allowedChainIds: [1],\n    rpcUrls: {\n      1: env.get('SIWE_RPC_URL'),\n    },\n  },\n})\n```\n\nWhen an RPC URL is configured and contract wallets are enabled, verification\nuses `@signinwithethereum/siwe`'s `createConfig(rpcUrl)` path, which supports\nEOA, ERC-1271 smart contract wallets, and EIP-6492 pre-deployed wallets through\nviem or ethers. Without an RPC URL, the package uses the same SIWE verifier with\na local viem adapter for EOA signatures.\n\n## Hooks\n\n```ts\nexport default defineConfig({\n  hooks: {\n    async onVerified(ctx, wallet) {\n      // Link wallet to a user, issue an app token, refresh profile data, etc.\n      return { linked: true }\n    },\n    async serializeSession(ctx, wallet) {\n      return {\n        address: wallet.address,\n        chainId: wallet.chainId,\n        authenticatedAt: wallet.authenticatedAt,\n        expiresAt: wallet.expiresAt,\n      }\n    },\n  },\n})\n```\n\n`onVerified` data is returned from `POST /auth/siwe/verify` as `data`.\n","readmeFilename":"README.md","_rev":"1-8adca8d52c4b49915cdbbe43c33d9283"}