@starklabs/backend-core 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/cjs/index.cjs +1 -1
- package/dist/js/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ npm install @starklabs/backend-core
|
|
|
23
23
|
The following environment variables are required:
|
|
24
24
|
|
|
25
25
|
```env
|
|
26
|
-
|
|
26
|
+
MONGODB_URI=mongodb://localhost:27017
|
|
27
27
|
DB_NAME=your_database_name
|
|
28
28
|
MASTER_KEY=your_base64_encoded_32_byte_key
|
|
29
29
|
JWT_SECRET=your_jwt_secret_string
|
|
@@ -62,7 +62,7 @@ import starkAuth, { crypto, AppError, AppLog, asyncHandler } from '@starklabs/ba
|
|
|
62
62
|
|
|
63
63
|
// Initialize
|
|
64
64
|
const auth = await starkAuth.create({
|
|
65
|
-
|
|
65
|
+
MONGODB_URI: process.env.MONGODB_URI,
|
|
66
66
|
DB_NAME: process.env.DB_NAME,
|
|
67
67
|
MASTER_KEY: process.env.MASTER_KEY,
|
|
68
68
|
JWT_SECRET: process.env.JWT_SECRET,
|
|
@@ -97,7 +97,7 @@ const starkAuth = require('@starklabs/backend-core');
|
|
|
97
97
|
|
|
98
98
|
// Initialize
|
|
99
99
|
const auth = await starkAuth.create({
|
|
100
|
-
|
|
100
|
+
MONGODB_URI: process.env.MONGODB_URI,
|
|
101
101
|
DB_NAME: process.env.DB_NAME,
|
|
102
102
|
MASTER_KEY: process.env.MASTER_KEY,
|
|
103
103
|
JWT_SECRET: process.env.JWT_SECRET,
|
|
@@ -118,7 +118,7 @@ const payload = auth.verifyJWT(token);
|
|
|
118
118
|
Initializes database connection and returns a new StarkAuth instance.
|
|
119
119
|
|
|
120
120
|
**Parameters:**
|
|
121
|
-
- `config.
|
|
121
|
+
- `config.MONGODB_URI` (string): MongoDB connection URI
|
|
122
122
|
- `config.DB_NAME` (string): Database name
|
|
123
123
|
- `config.MASTER_KEY` (string): Base64-encoded 32-byte encryption key
|
|
124
124
|
- `config.JWT_SECRET` (string): Secret for JWT signing
|
|
@@ -128,7 +128,7 @@ Initializes database connection and returns a new StarkAuth instance.
|
|
|
128
128
|
|
|
129
129
|
```javascript
|
|
130
130
|
const auth = await starkAuth.create({
|
|
131
|
-
|
|
131
|
+
MONGODB_URI: 'mongodb://localhost:27017',
|
|
132
132
|
DB_NAME: 'myapp',
|
|
133
133
|
MASTER_KEY: 'eZkZDoy2s+DvGe44QGa7AdU41nKhglEaIjFsxfQCKao=',
|
|
134
134
|
JWT_SECRET: 'your-secret-key',
|
|
@@ -335,7 +335,7 @@ let auth;
|
|
|
335
335
|
app.use(async (req, res, next) => {
|
|
336
336
|
if (!auth) {
|
|
337
337
|
auth = await starkAuth.create({
|
|
338
|
-
|
|
338
|
+
MONGODB_URI: process.env.MONGODB_URI,
|
|
339
339
|
DB_NAME: process.env.DB_NAME,
|
|
340
340
|
MASTER_KEY: process.env.MASTER_KEY,
|
|
341
341
|
JWT_SECRET: process.env.JWT_SECRET,
|
|
@@ -456,7 +456,7 @@ Ensure `JWT_EXPIRY` is one of the supported values: `"2m"`, `"10m"`, `"1h"`, `"6
|
|
|
456
456
|
### "Error while connecting!"
|
|
457
457
|
Check that:
|
|
458
458
|
- MongoDB is running and accessible
|
|
459
|
-
- `
|
|
459
|
+
- `MONGODB_URI` is correct
|
|
460
460
|
- Network/firewall allows connection
|
|
461
461
|
|
|
462
462
|
### "Invalid or expired token"
|
package/dist/cjs/index.cjs
CHANGED
package/dist/js/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starklabs/backend-core",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "A comprehensive backend authentication library featuring MongoDB integration, JWT-based authentication, encryption/decryption using libsodium, and utilities for error handling and logging. Supports both ES modules and CommonJS. Requires
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "A comprehensive backend authentication library featuring MongoDB integration, JWT-based authentication, encryption/decryption using libsodium, and utilities for error handling and logging. Supports both ES modules and CommonJS. Requires MONGODB_URI, DB_NAME, MASTER_KEY, and JWT_SECRET environment variables.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth-mongo",
|
|
7
7
|
"backend-core"
|