sentri 1.1.2 → 2.0.0

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.
Files changed (60) hide show
  1. package/README.md +325 -181
  2. package/dist/cli.d.ts +0 -2
  3. package/dist/cli.js +10 -103
  4. package/dist/index.d.ts +1046 -11
  5. package/dist/index.js +1 -5
  6. package/package.json +13 -6
  7. package/templates/drizzle/auth.ts +47 -4
  8. package/templates/prisma/auth.ts +47 -4
  9. package/dist/cli.d.ts.map +0 -1
  10. package/dist/cli.js.map +0 -1
  11. package/dist/client.d.ts +0 -160
  12. package/dist/client.d.ts.map +0 -1
  13. package/dist/client.js +0 -45
  14. package/dist/client.js.map +0 -1
  15. package/dist/errors/AuthError.d.ts +0 -99
  16. package/dist/errors/AuthError.d.ts.map +0 -1
  17. package/dist/errors/AuthError.js +0 -97
  18. package/dist/errors/AuthError.js.map +0 -1
  19. package/dist/index.d.ts.map +0 -1
  20. package/dist/index.js.map +0 -1
  21. package/dist/libs/config.d.ts +0 -62
  22. package/dist/libs/config.d.ts.map +0 -1
  23. package/dist/libs/config.js +0 -97
  24. package/dist/libs/config.js.map +0 -1
  25. package/dist/libs/hash.d.ts +0 -17
  26. package/dist/libs/hash.d.ts.map +0 -1
  27. package/dist/libs/hash.js +0 -22
  28. package/dist/libs/hash.js.map +0 -1
  29. package/dist/libs/token.d.ts +0 -46
  30. package/dist/libs/token.d.ts.map +0 -1
  31. package/dist/libs/token.js +0 -118
  32. package/dist/libs/token.js.map +0 -1
  33. package/dist/middleware/authorize.d.ts +0 -18
  34. package/dist/middleware/authorize.d.ts.map +0 -1
  35. package/dist/middleware/authorize.js +0 -30
  36. package/dist/middleware/authorize.js.map +0 -1
  37. package/dist/middleware/errorHandler.d.ts +0 -71
  38. package/dist/middleware/errorHandler.d.ts.map +0 -1
  39. package/dist/middleware/errorHandler.js +0 -74
  40. package/dist/middleware/errorHandler.js.map +0 -1
  41. package/dist/middleware/permit.d.ts +0 -62
  42. package/dist/middleware/permit.d.ts.map +0 -1
  43. package/dist/middleware/permit.js +0 -61
  44. package/dist/middleware/permit.js.map +0 -1
  45. package/dist/middleware/protect.d.ts +0 -31
  46. package/dist/middleware/protect.d.ts.map +0 -1
  47. package/dist/middleware/protect.js +0 -54
  48. package/dist/middleware/protect.js.map +0 -1
  49. package/dist/middleware/router.d.ts +0 -34
  50. package/dist/middleware/router.d.ts.map +0 -1
  51. package/dist/middleware/router.js +0 -264
  52. package/dist/middleware/router.js.map +0 -1
  53. package/dist/services/auth.d.ts +0 -85
  54. package/dist/services/auth.d.ts.map +0 -1
  55. package/dist/services/auth.js +0 -173
  56. package/dist/services/auth.js.map +0 -1
  57. package/dist/types/auth.d.ts +0 -450
  58. package/dist/types/auth.d.ts.map +0 -1
  59. package/dist/types/auth.js +0 -21
  60. package/dist/types/auth.js.map +0 -1
@@ -1,85 +0,0 @@
1
- import type { AssignRolesResult, AuthConfig, AuthResult, LoginInput, RefreshResult, RegisterInput, RegisterResult } from '../types/auth.js';
2
- /**
3
- * Register a new user.
4
- *
5
- * Validates that every requested role is in `validRoles`, rejects duplicate
6
- * identifiers, hashes the password with bcrypt, creates the user record via
7
- * the adapter, and returns the created user.
8
- *
9
- * No tokens are issued — the caller should invoke `login` after registration
10
- * if immediate authentication is desired.
11
- *
12
- * @param input - Registration data: identifier, plain-text password, and optional roles.
13
- * @param config - Auth configuration containing the adapter and role definitions.
14
- * @returns `{ success: true, user }` on success, or `{ success: false, error }` with
15
- * code `INVALID_ROLE` or `USER_ALREADY_EXISTS` on failure.
16
- */
17
- export declare function register(input: RegisterInput, config: AuthConfig): Promise<RegisterResult>;
18
- /**
19
- * Authenticate an existing user by identifier and plain-text password.
20
- *
21
- * Looks up the user, verifies the password with bcrypt, creates a new session,
22
- * and issues a JWT access token + refresh token pair. The access token embeds
23
- * the session ID so that `protect()` can reject it immediately after logout
24
- * without waiting for the token to expire.
25
- *
26
- * The failure response always uses code `INVALID_CREDENTIALS` regardless of
27
- * whether the identifier or the password was wrong, preventing user enumeration.
28
- *
29
- * @param input - Login data: identifier and plain-text password.
30
- * @param config - Auth configuration containing the adapter and JWT settings.
31
- * @returns `{ success: true, accessToken, refreshToken, user }` on success, or
32
- * `{ success: false, error }` with code `INVALID_CREDENTIALS` on failure.
33
- */
34
- export declare function login(input: LoginInput, config: AuthConfig): Promise<AuthResult>;
35
- /**
36
- * Exchange a valid refresh token for a new access + refresh token pair.
37
- *
38
- * Implements **session rotation**: the old session is deleted and a fresh
39
- * session is created, so each refresh token is single-use. An attacker
40
- * replaying a stolen refresh token after it has already been rotated will
41
- * find the session gone.
42
- *
43
- * @param refreshToken - The JWT refresh token (typically from an httpOnly cookie).
44
- * @param config - Auth configuration containing the adapter and JWT settings.
45
- * @returns `{ success: true, accessToken, refreshToken, user }` on success, or
46
- * `{ success: false, error }` with code `UNAUTHORIZED`, `TOKEN_EXPIRED`, or
47
- * `TOKEN_INVALID` on failure.
48
- */
49
- export declare function refresh(refreshToken: string, config: AuthConfig): Promise<RefreshResult>;
50
- /**
51
- * Invalidate a single session identified by a refresh token.
52
- *
53
- * Safe to call even when the token is already expired or invalid — the JWT
54
- * parse failure is silently swallowed and the function resolves normally.
55
- * This makes logout idempotent from the client's perspective.
56
- *
57
- * @param refreshToken - The JWT refresh token bound to the session to revoke.
58
- * @param config - Auth configuration containing the adapter and JWT settings.
59
- */
60
- export declare function logout(refreshToken: string, config: AuthConfig): Promise<void>;
61
- /**
62
- * Delete all sessions for a user, effectively logging them out of every device.
63
- *
64
- * Delegates to `adapter.session.deleteAllForUser`. No token is required — the
65
- * router route that calls this function is already guarded by `protect()`.
66
- *
67
- * @param userId - The user's primary key as stored in the database.
68
- * @param config - Auth configuration containing the adapter.
69
- */
70
- export declare function logoutAll(userId: string, config: AuthConfig): Promise<void>;
71
- /**
72
- * Add roles to a user account, merging them with any existing roles.
73
- *
74
- * Validates that every role in `rolesToAdd` is listed in `config.validRoles`.
75
- * The resulting role set is deduplicated before being persisted via
76
- * `adapter.user.updateRoles`.
77
- *
78
- * @param userId - The primary key of the user to update.
79
- * @param rolesToAdd - Role names to assign. Must all be present in `validRoles`.
80
- * @param config - Auth configuration containing the adapter and role definitions.
81
- * @returns `{ success: true, user }` on success, or `{ success: false, error }` with
82
- * code `INVALID_ROLE` or `USER_NOT_FOUND` on failure.
83
- */
84
- export declare function assignRoles(userId: string, rolesToAdd: string[], config: AuthConfig): Promise<AssignRolesResult>;
85
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/services/auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE5I;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,cAAc,CAAC,CAoBzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,KAAK,CACzB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAqBrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,OAAO,CAC3B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,aAAa,CAAC,CA+BxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,MAAM,CAC1B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAAE,EACpB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,iBAAiB,CAAC,CAiB5B"}
@@ -1,173 +0,0 @@
1
- import { SentriError } from '../errors/AuthError.js';
2
- import { hashPassword, verifyPassword } from '../libs/hash.js';
3
- import { signAccessToken, signRefreshToken, verifyRefreshToken } from '../libs/token.js';
4
- import { resolveConfig, parseExpiry } from '../libs/config.js';
5
- /**
6
- * Register a new user.
7
- *
8
- * Validates that every requested role is in `validRoles`, rejects duplicate
9
- * identifiers, hashes the password with bcrypt, creates the user record via
10
- * the adapter, and returns the created user.
11
- *
12
- * No tokens are issued — the caller should invoke `login` after registration
13
- * if immediate authentication is desired.
14
- *
15
- * @param input - Registration data: identifier, plain-text password, and optional roles.
16
- * @param config - Auth configuration containing the adapter and role definitions.
17
- * @returns `{ success: true, user }` on success, or `{ success: false, error }` with
18
- * code `INVALID_ROLE` or `USER_ALREADY_EXISTS` on failure.
19
- */
20
- export async function register(input, config) {
21
- const resolved = resolveConfig(config);
22
- const requestedRoles = input.roles ?? [];
23
- const invalidRoles = requestedRoles.filter((r) => !resolved.validRoles.includes(r));
24
- if (invalidRoles.length > 0) {
25
- return { success: false, error: new SentriError('INVALID_ROLE', `Invalid roles: ${invalidRoles.join(', ')}`) };
26
- }
27
- const identifier = input.identifier.trim();
28
- const existing = await resolved.adapter.user.findByIdentifier(identifier);
29
- if (existing) {
30
- return { success: false, error: new SentriError('USER_ALREADY_EXISTS', 'User already exists') };
31
- }
32
- const passwordHash = await hashPassword(input.password, resolved.saltRounds);
33
- const created = await resolved.adapter.user.create({ identifier, passwordHash, roles: requestedRoles });
34
- const user = { id: created.id, identifier, roles: requestedRoles };
35
- return { success: true, user };
36
- }
37
- /**
38
- * Authenticate an existing user by identifier and plain-text password.
39
- *
40
- * Looks up the user, verifies the password with bcrypt, creates a new session,
41
- * and issues a JWT access token + refresh token pair. The access token embeds
42
- * the session ID so that `protect()` can reject it immediately after logout
43
- * without waiting for the token to expire.
44
- *
45
- * The failure response always uses code `INVALID_CREDENTIALS` regardless of
46
- * whether the identifier or the password was wrong, preventing user enumeration.
47
- *
48
- * @param input - Login data: identifier and plain-text password.
49
- * @param config - Auth configuration containing the adapter and JWT settings.
50
- * @returns `{ success: true, accessToken, refreshToken, user }` on success, or
51
- * `{ success: false, error }` with code `INVALID_CREDENTIALS` on failure.
52
- */
53
- export async function login(input, config) {
54
- const resolved = resolveConfig(config);
55
- const found = await resolved.adapter.user.findByIdentifier(input.identifier.trim());
56
- if (!found) {
57
- return { success: false, error: new SentriError('INVALID_CREDENTIALS', 'Invalid credentials') };
58
- }
59
- const valid = await verifyPassword(input.password, found.passwordHash);
60
- if (!valid) {
61
- return { success: false, error: new SentriError('INVALID_CREDENTIALS', 'Invalid credentials') };
62
- }
63
- const expiresAt = new Date(Date.now() + parseExpiry(resolved.refreshExpiresIn));
64
- const session = await resolved.adapter.session.create({ userId: found.id, expiresAt });
65
- const user = { id: found.id, identifier: found.identifier, roles: found.roles };
66
- // Embed sessionId in the access token so protect() can invalidate it on logout.
67
- const accessToken = signAccessToken({ ...user, sessionId: session.id }, config);
68
- const refreshToken = signRefreshToken(session.id, config);
69
- return { success: true, accessToken, refreshToken, user };
70
- }
71
- /**
72
- * Exchange a valid refresh token for a new access + refresh token pair.
73
- *
74
- * Implements **session rotation**: the old session is deleted and a fresh
75
- * session is created, so each refresh token is single-use. An attacker
76
- * replaying a stolen refresh token after it has already been rotated will
77
- * find the session gone.
78
- *
79
- * @param refreshToken - The JWT refresh token (typically from an httpOnly cookie).
80
- * @param config - Auth configuration containing the adapter and JWT settings.
81
- * @returns `{ success: true, accessToken, refreshToken, user }` on success, or
82
- * `{ success: false, error }` with code `UNAUTHORIZED`, `TOKEN_EXPIRED`, or
83
- * `TOKEN_INVALID` on failure.
84
- */
85
- export async function refresh(refreshToken, config) {
86
- const resolved = resolveConfig(config);
87
- let sessionId;
88
- try {
89
- ({ sessionId } = verifyRefreshToken(refreshToken, config));
90
- }
91
- catch (err) {
92
- if (err instanceof SentriError)
93
- return { success: false, error: err };
94
- return { success: false, error: new SentriError('TOKEN_INVALID', 'Invalid refresh token') };
95
- }
96
- const session = await resolved.adapter.session.findById(sessionId);
97
- if (!session) {
98
- return { success: false, error: new SentriError('UNAUTHORIZED', 'Session not found or revoked') };
99
- }
100
- if (session.expiresAt < new Date()) {
101
- await resolved.adapter.session.delete(sessionId);
102
- return { success: false, error: new SentriError('TOKEN_EXPIRED', 'Session has expired') };
103
- }
104
- // rotate: delete old session, create new one
105
- await resolved.adapter.session.delete(sessionId);
106
- const expiresAt = new Date(Date.now() + parseExpiry(resolved.refreshExpiresIn));
107
- const newSession = await resolved.adapter.session.create({ userId: session.userId, expiresAt });
108
- const user = { id: session.user.id, identifier: session.user.identifier, roles: session.user.roles };
109
- // Embed new sessionId in the rotated access token.
110
- const newAccessToken = signAccessToken({ ...user, sessionId: newSession.id }, config);
111
- const newRefreshToken = signRefreshToken(newSession.id, config);
112
- return { success: true, accessToken: newAccessToken, refreshToken: newRefreshToken, user };
113
- }
114
- /**
115
- * Invalidate a single session identified by a refresh token.
116
- *
117
- * Safe to call even when the token is already expired or invalid — the JWT
118
- * parse failure is silently swallowed and the function resolves normally.
119
- * This makes logout idempotent from the client's perspective.
120
- *
121
- * @param refreshToken - The JWT refresh token bound to the session to revoke.
122
- * @param config - Auth configuration containing the adapter and JWT settings.
123
- */
124
- export async function logout(refreshToken, config) {
125
- let sessionId;
126
- try {
127
- ({ sessionId } = verifyRefreshToken(refreshToken, config));
128
- }
129
- catch {
130
- return; // already invalid, nothing to revoke
131
- }
132
- await resolveConfig(config).adapter.session.delete(sessionId);
133
- }
134
- /**
135
- * Delete all sessions for a user, effectively logging them out of every device.
136
- *
137
- * Delegates to `adapter.session.deleteAllForUser`. No token is required — the
138
- * router route that calls this function is already guarded by `protect()`.
139
- *
140
- * @param userId - The user's primary key as stored in the database.
141
- * @param config - Auth configuration containing the adapter.
142
- */
143
- export async function logoutAll(userId, config) {
144
- await resolveConfig(config).adapter.session.deleteAllForUser(userId);
145
- }
146
- /**
147
- * Add roles to a user account, merging them with any existing roles.
148
- *
149
- * Validates that every role in `rolesToAdd` is listed in `config.validRoles`.
150
- * The resulting role set is deduplicated before being persisted via
151
- * `adapter.user.updateRoles`.
152
- *
153
- * @param userId - The primary key of the user to update.
154
- * @param rolesToAdd - Role names to assign. Must all be present in `validRoles`.
155
- * @param config - Auth configuration containing the adapter and role definitions.
156
- * @returns `{ success: true, user }` on success, or `{ success: false, error }` with
157
- * code `INVALID_ROLE` or `USER_NOT_FOUND` on failure.
158
- */
159
- export async function assignRoles(userId, rolesToAdd, config) {
160
- const resolved = resolveConfig(config);
161
- const invalidRoles = rolesToAdd.filter((role) => !resolved.validRoles.includes(role));
162
- if (invalidRoles.length > 0) {
163
- return { success: false, error: new SentriError('INVALID_ROLE', `Invalid roles: ${invalidRoles.join(', ')}`) };
164
- }
165
- const found = await resolved.adapter.user.findById(userId);
166
- if (!found) {
167
- return { success: false, error: new SentriError('USER_NOT_FOUND', 'User not found') };
168
- }
169
- const mergedRoles = Array.from(new Set([...found.roles, ...rolesToAdd]));
170
- await resolved.adapter.user.updateRoles(userId, mergedRoles);
171
- return { success: true, user: { id: found.id, identifier: found.identifier, roles: mergedRoles } };
172
- }
173
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/services/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAA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