{"_id":"@coddletech/medusa-admin-2fa","_rev":"6-6dd46162e4afd48b3e1ac5f274bcb50b","name":"@coddletech/medusa-admin-2fa","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.1":{"name":"@coddletech/medusa-admin-2fa","version":"1.0.1","keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"author":{"name":"Coddle Technologies"},"license":"MIT","_id":"@coddletech/medusa-admin-2fa@1.0.1","maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"dist":{"shasum":"253ff025af265e6cdf2885539579c95ecac51bba","tarball":"https://registry.npmjs.org/@coddletech/medusa-admin-2fa/-/medusa-admin-2fa-1.0.1.tgz","fileCount":24,"integrity":"sha512-MaVfZpeKYOUhrfaRnbnCD7ueflT0XBafIEP6KcC882yXiZCLAvJurMiFna1CePpC1qpMUCNa+n8Dm4b4PhY8LA==","signatures":[{"sig":"MEQCIBqVVAebBXy4BiJe2f5g4HfPHknXmTC7o0cTlcnH5ydXAiB39H52sDVnJcvKTxqg0GmMGlupyNZGdLNyJ2hLAi6MwA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25402},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"2345a549cfa11bd19fe8f7ce80c9298016365970","scripts":{"build":"tsc","postinstall":"node scripts/postinstall.js"},"_npmUser":{"name":"coddletech","actor":{"name":"coddletech","type":"user","email":"info@coddletech.com"},"email":"info@coddletech.com"},"repository":{"url":"git+https://github.com/coddletech/medusa-admin-2fa.git","type":"git"},"_npmVersion":"10.9.2","description":"A `Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+, powered by TOTP with QR code support.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"qrcode":"^1.5.4","speakeasy":"^2.0.0","@medusajs/medusa":"^2.8.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^24.0.3","@types/qrcode":"^1.5.5","@types/speakeasy":"^2.0.10","@types/express-session":"^1.18.2"},"_npmOperationalInternal":{"tmp":"tmp/medusa-admin-2fa_1.0.1_1750766992669_0.3944542143568106","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@coddletech/medusa-admin-2fa","version":"1.0.2","keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"author":{"name":"Coddle Technologies"},"license":"MIT","_id":"@coddletech/medusa-admin-2fa@1.0.2","maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"dist":{"shasum":"32791a58ec81ec561972d5f5be4f4056ef38fa60","tarball":"https://registry.npmjs.org/@coddletech/medusa-admin-2fa/-/medusa-admin-2fa-1.0.2.tgz","fileCount":24,"integrity":"sha512-xZR/EVEa+MNYodrxzx0SOwZ+otrB55jxoG3i3gkscume6a7eNgtKf71rY8/EcjNnQ76k1gY2tUWiacB88yEIRA==","signatures":[{"sig":"MEUCIBmSk6ircVEwxiC3nV7J+sQCwqHH7tB9rX2pD3BLXpWTAiEA2gV5td56k1TIpY1W7Mbt71EqOFWcktQZmQsUm9c342M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25402},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"16aaa188ae4b8fa5ea43b05a836d5af5941880a9","scripts":{"build":"tsc","postinstall":"node scripts/postinstall.js"},"_npmUser":{"name":"coddletech","actor":{"name":"coddletech","type":"user","email":"info@coddletech.com"},"email":"info@coddletech.com"},"repository":{"url":"git+https://github.com/coddletech/medusa-admin-2fa.git","type":"git"},"_npmVersion":"10.9.2","description":"A `Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+, powered by TOTP with QR code support.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"qrcode":"^1.5.4","speakeasy":"^2.0.0","@medusajs/medusa":"^2.8.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^24.0.3","@types/qrcode":"^1.5.5","@types/speakeasy":"^2.0.10","@types/express-session":"^1.18.2"},"_npmOperationalInternal":{"tmp":"tmp/medusa-admin-2fa_1.0.2_1750768716411_0.9411637336530412","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@coddletech/medusa-admin-2fa","version":"1.0.3","keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"author":{"name":"Coddle Technologies"},"license":"MIT","_id":"@coddletech/medusa-admin-2fa@1.0.3","maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"dist":{"shasum":"dac45fc9e4fb188555c24879c2a474b03fed7933","tarball":"https://registry.npmjs.org/@coddletech/medusa-admin-2fa/-/medusa-admin-2fa-1.0.3.tgz","fileCount":24,"integrity":"sha512-U9cNZ5gABL3SA70juZqFrtenFfprxxw76gVcPh4xLqcedOD6P5+DeFFyhgYduHmqfEnaZ56Ah6sq5UVEpnL6Qg==","signatures":[{"sig":"MEYCIQCGIjAOE81R9D7tpifjMhASDQWh2kGQee2OwWzsRF9G7QIhANkXzK2VKJdOtvks4L5wlw+5p5XmJwoaGgWXOUIELQqu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25801},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"c8c265ffd43f7f3f1115f12993632cc1da25838b","scripts":{"build":"tsc","postinstall":"node scripts/postinstall.js"},"_npmUser":{"name":"coddletech","actor":{"name":"coddletech","type":"user","email":"info@coddletech.com"},"email":"info@coddletech.com"},"repository":{"url":"git+https://github.com/coddletech/medusa-admin-2fa.git","type":"git"},"_npmVersion":"10.9.2","description":"A Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+ Admin, powered by TOTP with QR code support.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"qrcode":"^1.5.4","speakeasy":"^2.0.0","@medusajs/medusa":"^2.8.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^24.0.3","@types/qrcode":"^1.5.5","@types/speakeasy":"^2.0.10","@types/express-session":"^1.18.2"},"_npmOperationalInternal":{"tmp":"tmp/medusa-admin-2fa_1.0.3_1750827681873_0.3022783712810744","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@coddletech/medusa-admin-2fa","version":"1.0.4","keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"author":{"name":"Coddle Technologies"},"license":"MIT","_id":"@coddletech/medusa-admin-2fa@1.0.4","maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"dist":{"shasum":"0f42fd317e40cd8db0b1f838babb84139b6a9c8e","tarball":"https://registry.npmjs.org/@coddletech/medusa-admin-2fa/-/medusa-admin-2fa-1.0.4.tgz","fileCount":24,"integrity":"sha512-dypU7iYwaCCUzmVovKZer3rrt/E4NZRg3dMC4CI6L38vJf0aOp3Px83rbVJ2I7NT3ma841davE4eX9diNDtncQ==","signatures":[{"sig":"MEUCID85ybrEK5S4XFRjzvk/kSK4p8P9vVUwagrSOr3WIOrKAiEAuV++iBVcUpAd4jezX3tLZSTCp3eOVWvRpgf31YoNqH8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26828},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"e5b62e5a9ec1e5aaf583b2c2c34bd18d10b554c5","scripts":{"build":"tsc","postinstall":"node scripts/postinstall.js"},"_npmUser":{"name":"coddletech","actor":{"name":"coddletech","type":"user","email":"info@coddletech.com"},"email":"info@coddletech.com"},"repository":{"url":"git+https://github.com/coddletech/medusa-admin-2fa.git","type":"git"},"_npmVersion":"10.9.2","description":"A Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+ Admin, powered by TOTP with QR code support.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"qrcode":"^1.5.4","speakeasy":"^2.0.0","@medusajs/medusa":"^2.8.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^24.0.3","@types/qrcode":"^1.5.5","@types/speakeasy":"^2.0.10","@types/express-session":"^1.18.2"},"_npmOperationalInternal":{"tmp":"tmp/medusa-admin-2fa_1.0.4_1750830329800_0.006687523240932247","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@coddletech/medusa-admin-2fa","version":"1.0.5","keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"author":{"name":"Coddle Technologies"},"license":"MIT","_id":"@coddletech/medusa-admin-2fa@1.0.5","maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"dist":{"shasum":"263faea99fd58de82fc1cd4126c16c6164bb76de","tarball":"https://registry.npmjs.org/@coddletech/medusa-admin-2fa/-/medusa-admin-2fa-1.0.5.tgz","fileCount":24,"integrity":"sha512-jLZ75Da5gjG0LGB//U+jEYB2YbOvUOWO0KPVwUyJ8TfUbVUeGMOrzXG09eEaRhTqqzZbowPfeXNVMx7+zK+36g==","signatures":[{"sig":"MEUCIQDf3V51osrjW11+emMg5ZBrm9u9wmlwGjrsat4pI5SRoQIgWQrP8Q+tRvOPBRKGZZN2RaqEuoiK1XtbTW7xGgfnI6M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26802},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"fef620c74e616d27519b1f44f4ea2ef912be291f","scripts":{"build":"tsc","postinstall":"node scripts/postinstall.js"},"_npmUser":{"name":"coddletech","actor":{"name":"coddletech","type":"user","email":"info@coddletech.com"},"email":"info@coddletech.com"},"repository":{"url":"git+https://github.com/coddletech/medusa-admin-2fa.git","type":"git"},"_npmVersion":"10.9.2","description":"A Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+ Admin, powered by TOTP with QR code support.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"qrcode":"^1.5.4","speakeasy":"^2.0.0","@medusajs/medusa":"^2.8.4"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^24.0.3","@types/qrcode":"^1.5.5","@types/speakeasy":"^2.0.10","@types/express-session":"^1.18.2"},"_npmOperationalInternal":{"tmp":"tmp/medusa-admin-2fa_1.0.5_1751261748527_0.5386289100122481","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@coddletech/medusa-admin-2fa","version":"1.0.6","description":"A Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+ Admin, powered by TOTP with QR code support.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"postinstall":"node scripts/postinstall.js","build":"tsc"},"keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"author":{"name":"Coddle Technologies"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/coddletech/medusa-admin-2fa.git"},"devDependencies":{"@types/express-session":"^1.18.2","@types/node":"^24.0.3","@types/qrcode":"^1.5.5","@types/speakeasy":"^2.0.10","typescript":"^5.8.3"},"dependencies":{"@medusajs/medusa":"^2.8.4","qrcode":"^1.5.4","speakeasy":"^2.0.0"},"_id":"@coddletech/medusa-admin-2fa@1.0.6","gitHead":"73caa8f85f80798d28479423ec04eec16e96a024","bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-OeCZS2Un9y2jospWrZwti+eSKRlp3Iu99ItmWirwoP/n46ZD5VfDu2Y/zod5s1mV/IwHPQOydO50b3nTsNnQ9w==","shasum":"25a719388ca5c7f3b69c97b14e214445136ae6c5","tarball":"https://registry.npmjs.org/@coddletech/medusa-admin-2fa/-/medusa-admin-2fa-1.0.6.tgz","fileCount":22,"unpackedSize":24436,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFkj6qCK3azR25pgUUePsVVYMgivcb7Q/WoIgOyfQkrwAiEAkqDl5XZ5mGgU6xdONBBc2yKKpkjawxxMS2AxWogfvlc="}]},"_npmUser":{"name":"coddletech","email":"info@coddletech.com"},"directories":{},"maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/medusa-admin-2fa_1.0.6_1755062657119_0.4387093607630175"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-24T12:09:52.537Z","modified":"2025-08-13T05:24:17.493Z","1.0.1":"2025-06-24T12:09:52.839Z","1.0.2":"2025-06-24T12:38:36.615Z","1.0.3":"2025-06-25T05:01:22.022Z","1.0.4":"2025-06-25T05:45:29.948Z","1.0.5":"2025-06-30T05:35:48.708Z","1.0.6":"2025-08-13T05:24:17.321Z"},"bugs":{"url":"https://github.com/coddletech/medusa-admin-2fa/issues"},"author":{"name":"Coddle Technologies"},"license":"MIT","homepage":"https://github.com/coddletech/medusa-admin-2fa#readme","keywords":["medusa","two-factor authentication","qrcode","speakeasy"],"repository":{"type":"git","url":"git+https://github.com/coddletech/medusa-admin-2fa.git"},"description":"A Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+ Admin, powered by TOTP with QR code support.","maintainers":[{"name":"coddletech","email":"info@coddletech.com"}],"readme":"## @coddletech/medusa-admin-2fa\n\nA Two-Factor Authentication (2FA) plugin for Medusa.js v2.8+ Admin, powered by TOTP with QR code support.\n\nThis plugin is built specifically for enhancing the Medusa Admin panel with secure multi-factor authentication (MFA). It simplifies the integration of QR code-based 2FA using speakeasy and qrcode, and includes:\n\nSecure session-based secret handling\n\nOTP verification via time-based tokens\n\nAuto-scaffolded authex module structure via a post-install script\n\n## Installation\n```bash\nnpm install @coddletech/medusa-admin-2fa\n```\nUpon installation, a postinstall script will automatically generate the following folder structure:\n```bash\nsrc/ |---─ api/\n|    └---middlewares.ts\n|---- modules/ \n     └---authex/ \n        |--- models/ \n        | |--- info.ts\n        | |---user.ts\n        |----index.ts\n        |─-- service.ts\n```\n## Configuration\n\n## Register the Module\nIn your medusa-config.ts:\n\n```bash\nexport default { modules: \n    [ { resolve: \"./src/modules/authex\", },\n // ...other modules ], }\n```\n## Run Migrations\nAfter scaffolding is complete, run the following commands to generate and apply your database schema:\n```bash\nnpx medusa db:generate authex \n\nnpx medusa db:migrate\n```\n## Usage\n\n## Generate MFA QR Code\n```bash\n/src/api/admin/generate-qr/route.ts\n\nimport { MedusaRequest, MedusaResponse } from \"@medusajs/framework/http\" \nimport { handleMfaSetup } from \"@coddletech/medusa-admin-2fa\" \nimport AuthexModuleService from \"../../../modules/authex/service\"\n\nexport const GET = async (req: MedusaRequest, res: MedusaResponse) => { const authexService = req.scope.resolve(\"authex\") as AuthexModuleService await handleMfaSetup(req, res, authexService) }\n```\nThis route:\n\nGenerates a new TOTP secret (if not already set)\n\nStores the secret in the session\n\nReturns a QR code as a Data URL to be scanned by an authenticator app\n\n## Verify MFA Code\n```bash\n/src/api/admin/verify-mfa/route.ts\n\nimport { MedusaRequest, MedusaResponse } from \"@medusajs/framework/http\" \nimport { handleMfaVerification } from \"@coddletech/medusa-admin-2fa\"\n import AuthexModuleService from \"../../../modules/authex/service\"\n\nexport const POST = async (req: MedusaRequest, res: MedusaResponse) => { const \nauthexService = req.scope.resolve(\"authex\") as AuthexModuleService await handleMfaVerification(req, res, authexService) }\n```\nThis route:\n\nVerifies the 6-digit passcode sent by the user\n\nIf valid, saves the TOTP secret in your DB\n\nCleans up the session and grants access\n\n## Features\n\nTOTP (Google Authenticator-style) 2FA\n\nAutomatic module scaffolding\n\nSession-based secret storage\n\nOptional middleware protection\n\nBuilt on MedusaJS v2 module system\n\n## Requirements\n\nNode.js v18+\n\nMedusaJS v2.8+\n\nPostgreSQL (recommended)\n\n## Built With\n\nMedusaJS\n\nSpeakeasy\n\nQRCode\n\nExpress session for secure server-side secret handling\n","readmeFilename":"README.md"}