node-auth-kit 1.0.2 β 1.0.4
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 +25 -25
- package/package.json +18 -10
package/README.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
# node-auth-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
node-auth-kit is a **Devise-inspired authentication and authorization library for Node.js**.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
It provides **JWT authentication**, **role-based authorization**, and an **adapter-based architecture** so you can plug in MongoDB (Mongoose), Prisma, or other databases without rewriting auth logic.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Plug-and-play Express routes** via `createAuthRouter`
|
|
9
|
-
- **JWT-based security** with `authenticate` middleware
|
|
10
|
-
- **Role-based authorization** with `authorize`
|
|
11
|
-
- **Database-agnostic adapter system** (`mongooseAdapter`, future Prisma, etc.)
|
|
12
|
-
- **Lifecycle hooks** (before/after register/login) for side effects
|
|
13
|
-
|
|
14
|
-
You bring your framework (Express) and database (Mongo, Prisma, SQL). Device Auth handles the rest.
|
|
7
|
+
If youβre tired of rebuilding authentication for every Express app, **node-auth-kit gives you clean defaults with full control**.
|
|
15
8
|
|
|
16
9
|
---
|
|
17
10
|
|
|
18
|
-
##
|
|
11
|
+
## Why node-auth-kit?
|
|
12
|
+
|
|
13
|
+
Most Node.js authentication libraries are either:
|
|
14
|
+
- too low-level, or
|
|
15
|
+
- tightly coupled to a specific ORM
|
|
16
|
+
|
|
17
|
+
node-auth-kit is inspired by Ruby on Rails **Devise** and focuses on:
|
|
19
18
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
19
|
+
- π JWT-based authentication for Express
|
|
20
|
+
- π§© Adapter-based database support (DB-agnostic core)
|
|
21
|
+
- π Role-based authorization
|
|
22
|
+
- βοΈ Config-driven setup with sensible defaults
|
|
23
|
+
- π§ Extensible hooks for real-world needs
|
|
24
|
+
|
|
25
|
+
You bring **Express** and your **database**.
|
|
26
|
+
node-auth-kit handles authentication, authorization, and security patterns.
|
|
28
27
|
|
|
29
28
|
---
|
|
30
29
|
|
|
30
|
+
|
|
31
31
|
## π¦ Installation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm
|
|
34
|
+
npm i node-auth-kit
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
or
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
yarn add
|
|
40
|
+
yarn add node-auth-kit
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
`
|
|
43
|
+
`node-auth-kit` itself is DB-agnostic. Database drivers / ORMs are **optional** and only required if you use the corresponding adapter:
|
|
44
44
|
|
|
45
45
|
- For Mongoose adapter: `mongoose`
|
|
46
46
|
- For Prisma adapter (V2): `@prisma/client`
|
|
@@ -221,7 +221,7 @@ The public exports you can use:
|
|
|
221
221
|
The central entry point is `deviceAuth`:
|
|
222
222
|
|
|
223
223
|
```ts
|
|
224
|
-
import { deviceAuth, defaultConfig } from '
|
|
224
|
+
import { deviceAuth, defaultConfig } from 'node-auth-kit';
|
|
225
225
|
|
|
226
226
|
deviceAuth.init({
|
|
227
227
|
...defaultConfig,
|
|
@@ -267,7 +267,7 @@ Supported hook names:
|
|
|
267
267
|
Register hooks on `deviceAuth`:
|
|
268
268
|
|
|
269
269
|
```ts
|
|
270
|
-
import { deviceAuth } from '
|
|
270
|
+
import { deviceAuth } from 'node-auth-kit';
|
|
271
271
|
|
|
272
272
|
deviceAuth
|
|
273
273
|
.registerHook('beforeRegister', async (createData) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-auth-kit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Devise-inspired JWT authentication and authorization for Node.js and Express with adapter-based support for MongoDB (Mongoose) and Prisma",
|
|
5
5
|
"author": "Yogendra Prajapati",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -17,29 +17,37 @@
|
|
|
17
17
|
"prepublishOnly": "npm run build"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
|
+
"node-auth-kit",
|
|
21
|
+
"node auth",
|
|
22
|
+
"node authentication",
|
|
20
23
|
"authentication",
|
|
21
24
|
"authorization",
|
|
22
|
-
"
|
|
25
|
+
"jwt authentication",
|
|
23
26
|
"jwt",
|
|
24
|
-
"
|
|
25
|
-
"express",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
27
|
+
"express auth",
|
|
28
|
+
"express authentication",
|
|
29
|
+
"device authentication",
|
|
30
|
+
"devise",
|
|
31
|
+
"devise-like",
|
|
32
|
+
"security",
|
|
33
|
+
"mongoose auth",
|
|
34
|
+
"prisma auth"
|
|
28
35
|
],
|
|
29
36
|
"repository": {
|
|
30
37
|
"type": "git",
|
|
31
|
-
"url": "
|
|
38
|
+
"url": "https://github.com/learningyogendra-netizen/device_auth.git"
|
|
32
39
|
},
|
|
40
|
+
"homepage": "https://github.com/learningyogendra-netizen/device_auth#readme",
|
|
33
41
|
"bugs": {
|
|
34
42
|
"url": "https://github.com/learningyogendra-netizen/device_auth/issues"
|
|
35
43
|
},
|
|
36
44
|
"dependencies": {
|
|
37
45
|
"bcrypt": "^6.0.0",
|
|
38
46
|
"express": "^4.19.2",
|
|
39
|
-
"jsonwebtoken": "^9.0.3"
|
|
40
|
-
"mongoose": "^9.0.2"
|
|
47
|
+
"jsonwebtoken": "^9.0.3"
|
|
41
48
|
},
|
|
42
49
|
"peerDependencies": {
|
|
50
|
+
"mongoose": "^7 || ^8 || ^9",
|
|
43
51
|
"@prisma/client": "^4.7.1 || ^5.0.0"
|
|
44
52
|
},
|
|
45
53
|
"devDependencies": {
|