{"_id":"@biu-biz/mysql-baileys","_rev":"2-31d733ee1b0e773fd91ce7d3b80b3e2b","name":"@biu-biz/mysql-baileys","dist-tags":{"latest":"1.6.4"},"versions":{"1.6.2":{"name":"@biu-biz/mysql-baileys","version":"1.6.2","author":{"name":"putrodwi31"},"license":"MIT","_id":"@biu-biz/mysql-baileys@1.6.2","maintainers":[{"name":"biu-biz","email":"putrodwi31@gmail.com"}],"homepage":"https://github.com/putrodwi31/mysql-baileys","bugs":{"url":"https://github.com/putrodwi31/mysql-baileys/issues"},"dist":{"shasum":"898f517f93f9c2b329f3b8d8b09d6a2ce061c75d","tarball":"https://registry.npmjs.org/@biu-biz/mysql-baileys/-/mysql-baileys-1.6.2.tgz","fileCount":11,"integrity":"sha512-eRCwOeXh/J//INVt7oZ88oxUqLpQ6KwSzE8jpLNjJE+ntyo0RHeOWf9cBPERIODxZ1AJNN+9GoJUWulZ9EZNRg==","signatures":[{"sig":"MEYCIQD3m0QdzyBacblADljZHkQj9aQ4bfV/7f1K83b5ecR3QQIhAJfP+izipAKt920LMiwm/bZZDZgRnzIoTw3sAEHzBXru","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31016},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"f08f71150d9821a47782ce63d2e96956337a10f0","scripts":{"lint":"eslint src --ext .ts","build":"tsc","prepack":"tsc","prepare":"tsc","release":"release-it","lint:fix":"eslint src --fix --ext .ts","build:all":"tsc && typedoc","build:tsc":"tsc","build:docs":"typedoc"},"_npmUser":{"name":"biu-biz","email":"putrodwi31@gmail.com"},"repository":{"url":"git+https://github.com/putrodwi31/mysql-baileys.git","type":"git"},"_npmVersion":"10.8.2","description":"Implementation of MySQL in Baileys.","directories":{},"_nodeVersion":"20.20.2","dependencies":{"mysql2":"^3.10.1","curve25519-js":"^0.0.4"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.0.0","ts-node":"^10.8.1","typedoc":"^0.24.7","release-it":"^15.10.3","typescript":"^5.1.6","@types/long":"^4.0.2","@types/node":"^16.18.69","@typescript-eslint/parser":"^8.59.0","@adiwajshing/eslint-config":"git+https://github.com/adiwajshing/eslint-config.git","@typescript-eslint/eslint-plugin":"^8.59.0"},"_npmOperationalInternal":{"tmp":"tmp/mysql-baileys_1.6.2_1776823510615_0.5070692939973693","host":"s3://npm-registry-packages-npm-production"}},"1.6.4":{"author":{"name":"putrodwi31"},"name":"@biu-biz/mysql-baileys","version":"1.6.4","main":"lib/index.js","types":"lib/index.d.ts","description":"Implementation of MySQL in Baileys.","homepage":"https://github.com/putrodwi31/mysql-baileys","license":"MIT","scripts":{"release":"release-it","changelog:update":"echo \"No changelog update step configured; skipping.\"","build":"tsc","prepack":"tsc","prepare":"tsc","build:tsc":"tsc","build:docs":"typedoc","build:all":"tsc && typedoc","lint":"eslint src --ext .ts","lint:fix":"eslint src --fix --ext .ts"},"repository":{"type":"git","url":"git+https://github.com/putrodwi31/mysql-baileys.git"},"dependencies":{"curve25519-js":"^0.0.4","mysql2":"^3.10.1"},"devDependencies":{"@adiwajshing/eslint-config":"git+https://github.com/adiwajshing/eslint-config.git","@types/node":"^16.18.69","@types/long":"^4.0.2","@typescript-eslint/eslint-plugin":"^8.59.0","@typescript-eslint/parser":"^8.59.0","eslint":"^9.0.0","release-it":"^15.10.3","typedoc":"^0.24.7","ts-node":"^10.8.1","typescript":"^5.1.6"},"_id":"@biu-biz/mysql-baileys@1.6.4","gitHead":"19ef677dbe7584d31ddc90010879ed0c25702fdc","bugs":{"url":"https://github.com/putrodwi31/mysql-baileys/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-TvYnX8ktgfqKjBagCfv/fBbkunZo541Bzcu0Pc+ngTcnX0yIkt1vFs0rQZBwdpsM5gOeeI4Gz7bdPN7snxQ0rw==","shasum":"3942f4079338d342368d6a0044170e6192e4b97f","tarball":"https://registry.npmjs.org/@biu-biz/mysql-baileys/-/mysql-baileys-1.6.4.tgz","fileCount":11,"unpackedSize":30991,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAQNgmE1lud/TJkPRtZ281dYESCN2AVFEReiSsx1uQmkAiEA/GUkxatZ5qHWNZaVvsi5qtGQMwNiAUokpZpI6MYEDzA="}]},"_npmUser":{"name":"biu-biz","email":"putrodwi31@gmail.com"},"directories":{},"maintainers":[{"name":"biu-biz","email":"putrodwi31@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mysql-baileys_1.6.4_1778118434716_0.017228237060110674"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-22T02:05:10.538Z","modified":"2026-05-07T01:47:14.998Z","1.6.2":"2026-04-22T02:05:10.759Z","1.6.4":"2026-05-07T01:47:14.873Z"},"bugs":{"url":"https://github.com/putrodwi31/mysql-baileys/issues"},"author":{"name":"putrodwi31"},"license":"MIT","homepage":"https://github.com/putrodwi31/mysql-baileys","repository":{"type":"git","url":"git+https://github.com/putrodwi31/mysql-baileys.git"},"description":"Implementation of MySQL in Baileys.","maintainers":[{"name":"biu-biz","email":"putrodwi31@gmail.com"}],"readme":"# Authentication with MySQL for Baileys\n\n[![npm](https://img.shields.io/npm/v/@biu-biz/mysql-baileys?logo=npm&logoColor=red&label=npm&color=red)](https://www.npmjs.com/package/@biu-biz/mysql-baileys)\n[![github](https://img.shields.io/github/package-json/v/putrodwi31/mysql-baileys?logo=github&logoColor=blue&color=blue)](https://github.com/putrodwi31/mysql-baileys)\n[![baileys](<https://img.shields.io/npm/v/baileys?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfoBRQUFQLjzPBjAAAIe0lEQVRIx22Wb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DMJKboSs5SXs8wmfTMS5nU2QsE0WAWmiFUoIlYIcvzLe91Xw4PvbBoQtftVeEF6OV6Spb1tabfxuZ+t0il776sWBtc9zMc3x6oujRdc4SdlXW8vl0jLapMU4mxrmUTTFjGcVzky6UIswe+pJN7iBPBZdxOjF94oPo6G821C7PRc0s4tbWbjaUe8hZksF0btWe6yoOrCpzrH9rfJBD8Sg5y2KR04Vf0+nPpEhbxuxhAilmj2azvzZMEbC9NMRPA9fTl8r0vjFyZe9Kj7uruaKcF/ovoI6+tx/rgb3846W/c/93bx77JJo4Va7rN34/UNlQ53JxNZ9hKDdDJJfFEtI+isxW9+xcKMwGBNQ63PwkVM8ufx1nEqnOg6PDT3ynItj9StdnnJGSy0075ibZuk//zZnX2mj55ff4PJ6qua/K/+yWgHePW5fl/0pNcGw6Rn82zbRpYBSOmwi7UDyqyhJHCXf6AjR6gmQNET8yOfn+X6KRl5v8/qGDvV3U19UzcGfz/BlWALd1s6ncw9lkhrYvL2v3r6lv2lzubbnJV7Kt3KGEkzInRvIZYkaOjLRwKIIK1UG17qJUOORU3oz2JJMdHVNTBz4+f/7o5oa6/O5QDa8MD3Dxzm1FzgIowG1t3ahCkDBM7qjw8GbfkHNHfeWtq7wldy8pcTaGHNoKj6oEVSF0U8p8yjJj0Vz+6/5M5kRvMnm4/crVrn3LGmZaJycoUzVy0uTcli0LGP8F7DHAgNsp7ioAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjQtMDUtMjBUMjA6MjA6NTkrMDA6MDDe8d5UAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI0LTA1LTIwVDIwOjIwOjU5KzAwOjAwr6xm6AAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyNC0wNS0yMFQyMDoyMTowMiswMDowMF2cdpcAAAAASUVORK5CYII=&label=baileys&color=rgb(0,165,135)>)](https://github.com/WhiskeySockets/Baileys)\n[![license](<https://img.shields.io/npm/l/mysql-baileys?logo=data:image/svg+xml;base64,PHN2ZyB4b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S0uNjg2LjQ1QzQuNTU2IDEwLjc4IDMuODggMTEgMyAxMWE0LjUgNC41IDAgMCAxLTIuMDIzLS40NTRhMy41IDMuNSAwIDAgMS0uNjg2LS40NWwtLjA0NS0uMDRsLS4wMTYtLjAxNWwtLjAwNi0uMDA2bC0uMDA0LS4wMDR2LS4wMDFhLjc1Ljc1IDAgMCAxLS4xNTQtLjgzOEwyLjE3OCA0LjVIMS43NWEuNzUuNzUgMCAwIDEgMC0xLjVoMi4yMzRhLjI1LjI1IDAgMCAwIC4xMjUtLjAzM2wxLjI4OC0uNzM3Yy4yNjUtLjE1LjU2NC0uMjMuODY5LS4yM2guOTg0Vi43NWEuNzUuNzUgMCAwIDEgMS41IDBtMi45NDUgOC40NzdjLjI4NS4xMzUuNzE4LjI3MyAxLjMwNS4yNzNzMS4wMi0uMTM4IDEuMzA1LS4yNzNMMTMgNi4zMjdabS0xMCAwYy4yODUuMTM1LjcxOC4yNzMgMS4zMDUuMjczczEuMDItLjEzOCAxLjMwNS0uMjczTDMgNi4zMjdaIi8+PC9zdmc+&color=rgb(210,210,0)>)](./LICENSE)\n[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-raw/putrodwi31/mysql-baileys?logo=circle&logoColor=white)](https://github.com/putrodwi31/mysql-baileys/issues)\n\n## Usage\n\n### 1. Create table in MySQL (optional)\n\nIf you want with your specifications, if you don't create it, the code will automatically create\n\n```sql\nCREATE TABLE `auth` (\n\t`session` varchar(50) NOT NULL,\n\t`id` varchar(100) NOT NULL,\n\t`value` LONGTEXT DEFAULT NULL,\n\tUNIQUE KEY `idxunique` (`session`,`id`),\n\tKEY `idxsession` (`session`),\n\tKEY `idxid` (`id`)\n) ENGINE=MyISAM\n```\n\n### 2. Install mysql-baileys\n\nEdge Version:\n\n```\nnpm i github:putrodwi31/mysql-baileys\n```\n\nStable Version:\n\n```\nnpm i mysql-baileys\n```\n\n### 3. Import code\n\n```ts\nconst { useMySQLAuthState } = require(\"mysql-baileys\");\n```\n\n### 4. Implement code\n\n```ts\nconst { state, saveCreds, removeCreds } = await useMySQLAuthState({\n    session: sessionName, // required\n    password: \"Password123#\", // required\n    database: \"baileys\", // required\n});\n```\n\n### 5. All parameters for useMySQLAuthState()\n\n```ts\ntype MySQLConfig = {\n    /* The hostname of the database you are connecting to. (Default: localhost) */\n    host?: string;\n    /* The port number to connect to. (Default: 3306) */\n    port?: number;\n    /* The MySQL user to authenticate as. (Default: root) */\n    user?: string;\n    /* The password of that MySQL user */\n    password: string;\n    /* Alias for the MySQL user password. Makes a bit more sense in a multifactor authentication setup (see \"password2\" and \"password3\") */\n    password1?: string;\n    /* 2nd factor authentication password. Mandatory when the authentication policy for the MySQL user account requires an additional authentication method that needs a password. */\n    password2?: string;\n    /* 3rd factor authentication password. Mandatory when the authentication policy for the MySQL user account requires two additional authentication methods and the last one needs a password. */\n    password3?: string;\n    /* Name of the database to use for this connection. (Default: base) */\n    database: string;\n    /* MySql table name. (Default: auth) */\n    tableName?: string;\n    /* Retry the query at each interval if it fails. (Default: 200ms) */\n    retryRequestDelayMs: number;\n    /* Maximum attempts if the query fails. (Default: 10) */\n    maxtRetries?: number;\n    /* Session name to identify the connection, allowing multisessions with mysql. */\n    session: string;\n    /* The source IP address to use for TCP connection. */\n    localAddress?: string;\n    /* The path to a unix domain socket to connect to. When used host and port are ignored. */\n    socketPath?: string;\n    /* Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false) */\n    insecureAuth?: boolean;\n    /* If your connection is a server. (Default: false) */\n    isServer?: boolean;\n    /* Use the config SSL. (Default: disabled) */\n    ssl?: string | SslOptions;\n};\n```\n\n# Complete code for use\n\n```ts\nimport { makeWASocket, makeCacheableSignalKeyStore, fetchLatestBaileysVersion } from \"baileys\";\nimport { useMySQLAuthState } from \"mysql-baileys\";\n\nasync function startSock(sessionName) {\n    const { error, version } = await fetchLatestBaileysVersion();\n\n    if (error) {\n        console.log(`Session: ${sessionName} | No connection, check your internet.`);\n        return startSock(sessionName);\n    }\n\n    const { state, saveCreds, removeCreds } = await useMySQLAuthState({\n        session: sessionName,\n        host: \"localhost\",\n        port: 3306,\n        user: \"bob\",\n        password: \"Password123#\",\n        database: \"baileys\",\n        tableName: \"auth\",\n    });\n\n    const sock = makeWASocket({\n        auth: {\n            creds: state.creds,\n            keys: makeCacheableSignalKeyStore(state.keys, logger),\n        },\n        version: version,\n        defaultQueryTimeoutMs: undefined,\n    });\n\n    sock.ev.on(\"creds.update\", saveCreds);\n\n    sock.ev.on(\"connection.update\", async ({ connection, lastDisconnect }) => {\n        // your code here\n    });\n\n    sock.ev.on(\"messages.upsert\", async ({ messages, type }) => {\n        // your code here\n    });\n}\n\nstartSock(\"session1\");\n```\n\n### If you want to start other sessions in the same code, use this:\n\n```ts\nstartSock(\"session1\");\nstartSock(\"session2\");\nstartSock(\"session3\");\nstartSock(\"session4\");\n```\n","readmeFilename":"README.md"}