Registry / security / bdt105connexion

bdt105connexion

JSON →
library3.0.1jsnpmunverified

JWT authentication and MySQL connection library. Current version 3.0.1. Provides simple functions to authenticate users against a MySQL database using bcryptjs for password hashing and jsonwebtoken for token generation. Offers configurable table/field names and optional JWT validation. Lightweight but limited in flexibility and error handling. Suitable for small projects needing basic auth with MySQL.

npm install bdt105connexion
INSTALL
IMPORT
SIG · BDT105CONNEXION
B
bdt105connexion
securityjavascriptv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Connexion
import { Connexion } from 'bdt105connexion'
const Connexion = require('bdt105connexion')
ESM module; use named import.
MySqlConfiguration
import { MySqlConfiguration } from 'bdt105connexion'
Direct named import.
JwtConfiguration
import { JwtConfiguration } from 'bdt105connexion'
import JwtConfiguration from 'bdt105connexion'
Not default export, must use named import.

Initialize Connexion with MySQL and JWT config, then execute a raw SQL query.

import { Connexion, MySqlConfiguration, JwtConfiguration } from 'bdt105connexion'; const mySqlConfig = new MySqlConfiguration('localhost', 3306, 'root', 'root', 'connexion', 'user', 'login', 'password'); const jwtConfig = new JwtConfiguration('secret', '$2a$10$abcdefabcdefabcdefabcd', 'admin@example.com', 'adminToken'); const c = new Connexion(mySqlConfig, jwtConfig); c.querySql((err, rows) => { if (err) console.error(err); else console.log(rows); }, 'SELECT * FROM user');
Debug
Known issues
gotchaSalt must start with '$2a$10$' and total length >= 29 characters.
fix
Ensure salt matches bcryptjs format exactly.
affects: >=3.0.0
gotchaIf MySqlConfiguration is omitted, MySQL queries are disabled; if JwtConfiguration omitted, JWT functions disabled.
fix
Provide both configs if you need full auth functionality.
affects: >=3.0.0
gotchaThe error-first callback pattern for querySql: first argument is error, second is data.
fix
Use (err, data) => {...}.
affects: >=3.0.0
deprecatedPackage uses mysql driver which is deprecated in favor of mysql2.
fix
Consider switching to mysql2 for better performance and features.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'bdt105connexion'
Missing dependency or incorrect import path
fix
Run: npm install bdt105connexion --save
Salt must start with '$2a$10$' and be at least 29 characters
Invalid salt format in JwtConfiguration
fix
Use a bcryptjs-compatible salt, e.g., '$2a$10$abcdefghijklmnopqrstuv' (22 chars after prefix).
Cannot read properties of undefined (reading 'host')
MySqlConfiguration or JwtConfiguration not instantiated properly
fix
Ensure both configs are created with new keyword and passed to Connexion constructor.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
bcryptjsrequiredPassword hashing
bdt105toolboxrequiredInternal utilities
jsonwebtokenrequiredJWT signing and verification
mysqlrequiredMySQL database driver
Agent activity
16 hits · last 30 days
node
16
Resources
bdt105connexion — npm install bdt105connexion · libregistry