@warlock.js/auth 4.0.31 → 4.0.39
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/cjs/index.js +8 -1
- package/cjs/index.js.map +1 -1
- package/esm/index.js +8 -1
- package/esm/index.js.map +1 -1
- package/package.json +48 -34
- package/cjs/commands/auth-cleanup-command.d.ts +0 -10
- package/cjs/commands/auth-cleanup-command.d.ts.map +0 -1
- package/cjs/commands/auth-cleanup-command.js +0 -29
- package/cjs/commands/auth-cleanup-command.js.map +0 -1
- package/cjs/commands/jwt-secret-generator-command.d.ts +0 -2
- package/cjs/commands/jwt-secret-generator-command.d.ts.map +0 -1
- package/cjs/commands/jwt-secret-generator-command.js +0 -7
- package/cjs/commands/jwt-secret-generator-command.js.map +0 -1
- package/cjs/contracts/auth-contract.d.ts +0 -23
- package/cjs/contracts/auth-contract.d.ts.map +0 -1
- package/cjs/contracts/index.d.ts +0 -3
- package/cjs/contracts/index.d.ts.map +0 -1
- package/cjs/contracts/types.d.ts +0 -134
- package/cjs/contracts/types.d.ts.map +0 -1
- package/cjs/contracts/types.js +0 -20
- package/cjs/contracts/types.js.map +0 -1
- package/cjs/index.d.ts +0 -8
- package/cjs/index.d.ts.map +0 -1
- package/cjs/middleware/auth.middleware.d.ts +0 -2
- package/cjs/middleware/auth.middleware.d.ts.map +0 -1
- package/cjs/middleware/auth.middleware.js +0 -73
- package/cjs/middleware/auth.middleware.js.map +0 -1
- package/cjs/middleware/index.d.ts +0 -2
- package/cjs/middleware/index.d.ts.map +0 -1
- package/cjs/models/access-token/access-token.d.ts +0 -12
- package/cjs/models/access-token/access-token.d.ts.map +0 -1
- package/cjs/models/access-token/access-token.js +0 -16
- package/cjs/models/access-token/access-token.js.map +0 -1
- package/cjs/models/access-token/index.d.ts +0 -3
- package/cjs/models/access-token/index.d.ts.map +0 -1
- package/cjs/models/access-token/migration.d.ts +0 -3
- package/cjs/models/access-token/migration.d.ts.map +0 -1
- package/cjs/models/access-token/migration.js +0 -10
- package/cjs/models/access-token/migration.js.map +0 -1
- package/cjs/models/auth.d.ts +0 -47
- package/cjs/models/auth.d.ts.map +0 -1
- package/cjs/models/auth.js +0 -58
- package/cjs/models/auth.js.map +0 -1
- package/cjs/models/casts/cast-password.d.ts +0 -7
- package/cjs/models/casts/cast-password.d.ts.map +0 -1
- package/cjs/models/casts/cast-password.js +0 -9
- package/cjs/models/casts/cast-password.js.map +0 -1
- package/cjs/models/casts/index.d.ts +0 -2
- package/cjs/models/casts/index.d.ts.map +0 -1
- package/cjs/models/index.d.ts +0 -5
- package/cjs/models/index.d.ts.map +0 -1
- package/cjs/models/refresh-token/index.d.ts +0 -2
- package/cjs/models/refresh-token/index.d.ts.map +0 -1
- package/cjs/models/refresh-token/migration.d.ts +0 -3
- package/cjs/models/refresh-token/migration.d.ts.map +0 -1
- package/cjs/models/refresh-token/refresh-token.d.ts +0 -32
- package/cjs/models/refresh-token/refresh-token.d.ts.map +0 -1
- package/cjs/models/refresh-token/refresh-token.js +0 -52
- package/cjs/models/refresh-token/refresh-token.js.map +0 -1
- package/cjs/services/auth-events.d.ts +0 -84
- package/cjs/services/auth-events.d.ts.map +0 -1
- package/cjs/services/auth-events.js +0 -65
- package/cjs/services/auth-events.js.map +0 -1
- package/cjs/services/auth.service.d.ts +0 -78
- package/cjs/services/auth.service.d.ts.map +0 -1
- package/cjs/services/auth.service.js +0 -265
- package/cjs/services/auth.service.js.map +0 -1
- package/cjs/services/generate-jwt-secret.d.ts +0 -2
- package/cjs/services/generate-jwt-secret.d.ts.map +0 -1
- package/cjs/services/generate-jwt-secret.js +0 -26
- package/cjs/services/generate-jwt-secret.js.map +0 -1
- package/cjs/services/index.d.ts +0 -5
- package/cjs/services/index.d.ts.map +0 -1
- package/cjs/services/jwt.d.ts +0 -23
- package/cjs/services/jwt.d.ts.map +0 -1
- package/cjs/services/jwt.js +0 -39
- package/cjs/services/jwt.js.map +0 -1
- package/cjs/utils/auth-error-codes.d.ts +0 -18
- package/cjs/utils/auth-error-codes.d.ts.map +0 -1
- package/cjs/utils/auth-error-codes.js +0 -18
- package/cjs/utils/auth-error-codes.js.map +0 -1
- package/cjs/utils/duration.d.ts +0 -45
- package/cjs/utils/duration.d.ts.map +0 -1
- package/cjs/utils/duration.js +0 -93
- package/cjs/utils/duration.js.map +0 -1
- package/cjs/utils/index.d.ts +0 -3
- package/cjs/utils/index.d.ts.map +0 -1
- package/esm/commands/auth-cleanup-command.d.ts +0 -10
- package/esm/commands/auth-cleanup-command.d.ts.map +0 -1
- package/esm/commands/auth-cleanup-command.js +0 -29
- package/esm/commands/auth-cleanup-command.js.map +0 -1
- package/esm/commands/jwt-secret-generator-command.d.ts +0 -2
- package/esm/commands/jwt-secret-generator-command.d.ts.map +0 -1
- package/esm/commands/jwt-secret-generator-command.js +0 -7
- package/esm/commands/jwt-secret-generator-command.js.map +0 -1
- package/esm/contracts/auth-contract.d.ts +0 -23
- package/esm/contracts/auth-contract.d.ts.map +0 -1
- package/esm/contracts/index.d.ts +0 -3
- package/esm/contracts/index.d.ts.map +0 -1
- package/esm/contracts/types.d.ts +0 -134
- package/esm/contracts/types.d.ts.map +0 -1
- package/esm/contracts/types.js +0 -20
- package/esm/contracts/types.js.map +0 -1
- package/esm/index.d.ts +0 -8
- package/esm/index.d.ts.map +0 -1
- package/esm/middleware/auth.middleware.d.ts +0 -2
- package/esm/middleware/auth.middleware.d.ts.map +0 -1
- package/esm/middleware/auth.middleware.js +0 -73
- package/esm/middleware/auth.middleware.js.map +0 -1
- package/esm/middleware/index.d.ts +0 -2
- package/esm/middleware/index.d.ts.map +0 -1
- package/esm/models/access-token/access-token.d.ts +0 -12
- package/esm/models/access-token/access-token.d.ts.map +0 -1
- package/esm/models/access-token/access-token.js +0 -16
- package/esm/models/access-token/access-token.js.map +0 -1
- package/esm/models/access-token/index.d.ts +0 -3
- package/esm/models/access-token/index.d.ts.map +0 -1
- package/esm/models/access-token/migration.d.ts +0 -3
- package/esm/models/access-token/migration.d.ts.map +0 -1
- package/esm/models/access-token/migration.js +0 -10
- package/esm/models/access-token/migration.js.map +0 -1
- package/esm/models/auth.d.ts +0 -47
- package/esm/models/auth.d.ts.map +0 -1
- package/esm/models/auth.js +0 -58
- package/esm/models/auth.js.map +0 -1
- package/esm/models/casts/cast-password.d.ts +0 -7
- package/esm/models/casts/cast-password.d.ts.map +0 -1
- package/esm/models/casts/cast-password.js +0 -9
- package/esm/models/casts/cast-password.js.map +0 -1
- package/esm/models/casts/index.d.ts +0 -2
- package/esm/models/casts/index.d.ts.map +0 -1
- package/esm/models/index.d.ts +0 -5
- package/esm/models/index.d.ts.map +0 -1
- package/esm/models/refresh-token/index.d.ts +0 -2
- package/esm/models/refresh-token/index.d.ts.map +0 -1
- package/esm/models/refresh-token/migration.d.ts +0 -3
- package/esm/models/refresh-token/migration.d.ts.map +0 -1
- package/esm/models/refresh-token/refresh-token.d.ts +0 -32
- package/esm/models/refresh-token/refresh-token.d.ts.map +0 -1
- package/esm/models/refresh-token/refresh-token.js +0 -52
- package/esm/models/refresh-token/refresh-token.js.map +0 -1
- package/esm/services/auth-events.d.ts +0 -84
- package/esm/services/auth-events.d.ts.map +0 -1
- package/esm/services/auth-events.js +0 -65
- package/esm/services/auth-events.js.map +0 -1
- package/esm/services/auth.service.d.ts +0 -78
- package/esm/services/auth.service.d.ts.map +0 -1
- package/esm/services/auth.service.js +0 -265
- package/esm/services/auth.service.js.map +0 -1
- package/esm/services/generate-jwt-secret.d.ts +0 -2
- package/esm/services/generate-jwt-secret.d.ts.map +0 -1
- package/esm/services/generate-jwt-secret.js +0 -26
- package/esm/services/generate-jwt-secret.js.map +0 -1
- package/esm/services/index.d.ts +0 -5
- package/esm/services/index.d.ts.map +0 -1
- package/esm/services/jwt.d.ts +0 -23
- package/esm/services/jwt.d.ts.map +0 -1
- package/esm/services/jwt.js +0 -39
- package/esm/services/jwt.js.map +0 -1
- package/esm/utils/auth-error-codes.d.ts +0 -18
- package/esm/utils/auth-error-codes.d.ts.map +0 -1
- package/esm/utils/auth-error-codes.js +0 -18
- package/esm/utils/auth-error-codes.js.map +0 -1
- package/esm/utils/duration.d.ts +0 -45
- package/esm/utils/duration.d.ts.map +0 -1
- package/esm/utils/duration.js +0 -93
- package/esm/utils/duration.js.map +0 -1
- package/esm/utils/index.d.ts +0 -3
- package/esm/utils/index.d.ts.map +0 -1
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import {verify}from'@mongez/password';import {Random}from'@mongez/reinforcements';import {config}from'@warlock.js/core';import {AccessToken}from'../models/access-token/access-token.js';import'../models/access-token/migration.js';import {RefreshToken}from'../models/refresh-token/refresh-token.js';import {toJwtExpiresIn,parseExpirationToMs}from'../utils/duration.js';import {authEvents}from'./auth-events.js';import {jwt}from'./jwt.js';class AuthService {
|
|
2
|
-
/**
|
|
3
|
-
* Build access token payload from user
|
|
4
|
-
*/
|
|
5
|
-
buildAccessTokenPayload(user) {
|
|
6
|
-
return {
|
|
7
|
-
id: user.id,
|
|
8
|
-
_id: user._id,
|
|
9
|
-
userType: user.userType,
|
|
10
|
-
createdAt: Date.now(),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Generate access token for user
|
|
15
|
-
*/
|
|
16
|
-
async generateAccessToken(user, payload) {
|
|
17
|
-
const data = payload || this.buildAccessTokenPayload(user);
|
|
18
|
-
const expiresInConfig = config.key("auth.jwt.expiresIn");
|
|
19
|
-
const expiresIn = toJwtExpiresIn(expiresInConfig, 3600000); // default 1 hour
|
|
20
|
-
// If expiresIn is undefined, token never expires
|
|
21
|
-
const token = expiresIn ? await jwt.generate(data, { expiresIn }) : await jwt.generate(data);
|
|
22
|
-
// Store in database (fire and forget)
|
|
23
|
-
AccessToken.create({
|
|
24
|
-
token,
|
|
25
|
-
user: data,
|
|
26
|
-
});
|
|
27
|
-
return token;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Create refresh token for user
|
|
31
|
-
*/
|
|
32
|
-
async createRefreshToken(user, deviceInfo) {
|
|
33
|
-
const familyId = deviceInfo?.familyId || Random.string(32);
|
|
34
|
-
const expiresInConfig = config.key("auth.jwt.refresh.expiresIn");
|
|
35
|
-
const expiresInMs = parseExpirationToMs(expiresInConfig, 7 * 24 * 60 * 60 * 1000); // default 7 days
|
|
36
|
-
const payload = {
|
|
37
|
-
userId: user.id,
|
|
38
|
-
userType: user.userType,
|
|
39
|
-
familyId,
|
|
40
|
-
};
|
|
41
|
-
const token = await jwt.generateRefreshToken(payload);
|
|
42
|
-
// Enforce max tokens per user
|
|
43
|
-
await this.enforceMaxRefreshTokens(user);
|
|
44
|
-
// Calculate expiration date (undefined means never expires, but we still set a far future date)
|
|
45
|
-
const expiresAt = expiresInMs
|
|
46
|
-
? new Date(Date.now() + expiresInMs)
|
|
47
|
-
: new Date(Date.now() + 100 * 365 * 24 * 60 * 60 * 1000);
|
|
48
|
-
// Store in database
|
|
49
|
-
return RefreshToken.create({
|
|
50
|
-
token,
|
|
51
|
-
userId: user.id,
|
|
52
|
-
userType: user.userType,
|
|
53
|
-
familyId,
|
|
54
|
-
expiresAt,
|
|
55
|
-
deviceInfo: deviceInfo
|
|
56
|
-
? {
|
|
57
|
-
userAgent: deviceInfo.userAgent,
|
|
58
|
-
ip: deviceInfo.ip,
|
|
59
|
-
deviceId: deviceInfo.deviceId,
|
|
60
|
-
}
|
|
61
|
-
: undefined,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Create both access and refresh tokens
|
|
66
|
-
*/
|
|
67
|
-
async createTokenPair(user, deviceInfo) {
|
|
68
|
-
const accessToken = await this.generateAccessToken(user);
|
|
69
|
-
const refreshToken = await this.createRefreshToken(user, deviceInfo);
|
|
70
|
-
const tokenPair = {
|
|
71
|
-
accessToken,
|
|
72
|
-
refreshToken: refreshToken.get("token"),
|
|
73
|
-
expiresIn: config.key("auth.jwt.expiresIn", "1h"),
|
|
74
|
-
};
|
|
75
|
-
// Emit events
|
|
76
|
-
authEvents.emit("token.created", user, tokenPair);
|
|
77
|
-
authEvents.emit("session.created", user, refreshToken, deviceInfo);
|
|
78
|
-
return tokenPair;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Refresh tokens using a refresh token
|
|
82
|
-
*/
|
|
83
|
-
async refreshTokens(refreshTokenString, deviceInfo) {
|
|
84
|
-
try {
|
|
85
|
-
// 1. Verify JWT signature
|
|
86
|
-
const decoded = await jwt.verifyRefreshToken(refreshTokenString);
|
|
87
|
-
if (!decoded)
|
|
88
|
-
return null;
|
|
89
|
-
// 2. Find token in database
|
|
90
|
-
const refreshToken = await RefreshToken.first({ token: refreshTokenString });
|
|
91
|
-
if (!refreshToken?.isValid) {
|
|
92
|
-
// If token was already used (rotation detection), revoke entire family
|
|
93
|
-
if (refreshToken) {
|
|
94
|
-
await this.revokeTokenFamily(refreshToken.get("familyId"));
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
// 3. Get user model and find user
|
|
99
|
-
const UserModel = config.key(`auth.userType.${decoded.userType}`);
|
|
100
|
-
if (!UserModel)
|
|
101
|
-
return null;
|
|
102
|
-
const user = (await UserModel.find(decoded.userId));
|
|
103
|
-
if (!user)
|
|
104
|
-
return null;
|
|
105
|
-
// 4. Rotate token if enabled (revoke old token)
|
|
106
|
-
const rotationEnabled = config.key("auth.jwt.refresh.rotation", true);
|
|
107
|
-
if (rotationEnabled) {
|
|
108
|
-
await refreshToken.revoke();
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
await refreshToken.markAsUsed();
|
|
112
|
-
}
|
|
113
|
-
// 5. Generate new token pair (keep same family)
|
|
114
|
-
const newTokenPair = await this.createTokenPair(user, {
|
|
115
|
-
...deviceInfo,
|
|
116
|
-
familyId: refreshToken.get("familyId"),
|
|
117
|
-
});
|
|
118
|
-
// Emit token refreshed event
|
|
119
|
-
authEvents.emit("token.refreshed", user, newTokenPair, refreshToken);
|
|
120
|
-
return newTokenPair;
|
|
121
|
-
}
|
|
122
|
-
catch {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Verify password
|
|
128
|
-
*/
|
|
129
|
-
verifyPassword(hashedPassword, plainPassword) {
|
|
130
|
-
return verify(String(hashedPassword), String(plainPassword));
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Attempt to login user with given credentials
|
|
134
|
-
*/
|
|
135
|
-
async attemptLogin(Model, data) {
|
|
136
|
-
const { password, ...otherData } = data;
|
|
137
|
-
// Emit login attempt event
|
|
138
|
-
authEvents.emit("login.attempt", otherData);
|
|
139
|
-
const user = (await Model.first(otherData));
|
|
140
|
-
if (!user) {
|
|
141
|
-
authEvents.emit("login.failed", otherData, "User not found");
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
if (!this.verifyPassword(user.get("password"), password)) {
|
|
145
|
-
authEvents.emit("login.failed", otherData, "Invalid password");
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
return user;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Full login flow: validate credentials, create tokens, emit events
|
|
152
|
-
* Returns token pair on success, null on failure
|
|
153
|
-
*/
|
|
154
|
-
async login(Model, credentials, deviceInfo) {
|
|
155
|
-
const user = await this.attemptLogin(Model, credentials);
|
|
156
|
-
if (!user) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
const tokens = await this.createTokenPair(user, deviceInfo);
|
|
160
|
-
// Emit login success event
|
|
161
|
-
authEvents.emit("login.success", user, tokens, deviceInfo);
|
|
162
|
-
return { user, tokens };
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Logout user (revoke specific refresh token)
|
|
166
|
-
*/
|
|
167
|
-
async logout(user, refreshToken) {
|
|
168
|
-
if (refreshToken) {
|
|
169
|
-
await refreshToken.revoke();
|
|
170
|
-
authEvents.emit("session.destroyed", user, refreshToken);
|
|
171
|
-
}
|
|
172
|
-
// Emit logout event
|
|
173
|
-
authEvents.emit("logout", user);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Remove specific access token
|
|
177
|
-
*/
|
|
178
|
-
async removeAccessToken(user, token) {
|
|
179
|
-
AccessToken.delete({
|
|
180
|
-
token,
|
|
181
|
-
"user.id": user.id,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Revoke all tokens for a user
|
|
186
|
-
*/
|
|
187
|
-
async revokeAllTokens(user) {
|
|
188
|
-
// Revoke all refresh tokens
|
|
189
|
-
const refreshTokens = await RefreshToken.aggregate()
|
|
190
|
-
.where("userId", user.id)
|
|
191
|
-
.where("userType", user.userType)
|
|
192
|
-
.where("revokedAt", null)
|
|
193
|
-
.get();
|
|
194
|
-
for (const token of refreshTokens) {
|
|
195
|
-
await token.revoke();
|
|
196
|
-
authEvents.emit("token.revoked", user, token);
|
|
197
|
-
}
|
|
198
|
-
// Delete all access tokens
|
|
199
|
-
await AccessToken.delete({
|
|
200
|
-
"user.id": user.id,
|
|
201
|
-
"user.userType": user.userType,
|
|
202
|
-
});
|
|
203
|
-
// Emit logout all event
|
|
204
|
-
authEvents.emit("logout.all", user);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Revoke entire token family (for rotation breach detection)
|
|
208
|
-
*/
|
|
209
|
-
async revokeTokenFamily(familyId) {
|
|
210
|
-
const tokens = await RefreshToken.aggregate()
|
|
211
|
-
.where("familyId", familyId)
|
|
212
|
-
.where("revokedAt", null)
|
|
213
|
-
.get();
|
|
214
|
-
for (const token of tokens) {
|
|
215
|
-
await token.revoke();
|
|
216
|
-
}
|
|
217
|
-
// Emit family revoked event
|
|
218
|
-
authEvents.emit("token.familyRevoked", familyId, tokens);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Cleanup expired tokens
|
|
222
|
-
*/
|
|
223
|
-
async cleanupExpiredTokens() {
|
|
224
|
-
const expiredTokens = await RefreshToken.aggregate().where("expiresAt", "<", new Date()).get();
|
|
225
|
-
for (const token of expiredTokens) {
|
|
226
|
-
authEvents.emit("token.expired", token);
|
|
227
|
-
await token.destroy();
|
|
228
|
-
}
|
|
229
|
-
// Emit cleanup completed event
|
|
230
|
-
authEvents.emit("cleanup.completed", expiredTokens.length);
|
|
231
|
-
return expiredTokens.length;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Enforce max refresh tokens per user
|
|
235
|
-
*/
|
|
236
|
-
async enforceMaxRefreshTokens(user) {
|
|
237
|
-
const maxPerUser = config.key("auth.jwt.refresh.maxPerUser", 5);
|
|
238
|
-
const activeTokens = await RefreshToken.aggregate()
|
|
239
|
-
.where("userId", user.id)
|
|
240
|
-
.where("userType", user.userType)
|
|
241
|
-
.where("revokedAt", null)
|
|
242
|
-
.sort("createdAt", "asc")
|
|
243
|
-
.get();
|
|
244
|
-
// Revoke oldest tokens if exceeding limit
|
|
245
|
-
if (activeTokens.length >= maxPerUser) {
|
|
246
|
-
const tokensToRevoke = activeTokens.slice(0, activeTokens.length - maxPerUser + 1);
|
|
247
|
-
for (const token of tokensToRevoke) {
|
|
248
|
-
await token.revoke();
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Get active sessions for user
|
|
254
|
-
*/
|
|
255
|
-
async getActiveSessions(user) {
|
|
256
|
-
return RefreshToken.aggregate()
|
|
257
|
-
.where("userId", user.id)
|
|
258
|
-
.where("userType", user.userType)
|
|
259
|
-
.where("revokedAt", null)
|
|
260
|
-
.where("expiresAt", ">", new Date())
|
|
261
|
-
.sort("createdAt", "desc")
|
|
262
|
-
.get();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const authService = new AuthService();export{authService};//# sourceMappingURL=auth.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sources":["../../src/services/auth.service.ts"],"sourcesContent":[null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C,WAAW,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC;AACnC,aAAA,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;AACzB,aAAA,GAAG,EAAE,CAAC;KACV;AACF,CAAA;AAEY,MAAA,WAAW,GAAG,IAAI,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-jwt-secret.d.ts","sourceRoot":"","sources":["../../src/services/generate-jwt-secret.ts"],"names":[],"mappings":"AAKA,wBAAsB,iBAAiB,kBAmCtC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {fileExistsAsync,getFileAsync,putFileAsync}from'@mongez/fs';import {Random}from'@mongez/reinforcements';import {rootPath,environment}from'@warlock.js/core';import {log}from'@warlock.js/logger';async function generateJWTSecret() {
|
|
2
|
-
let envFile = rootPath(".env");
|
|
3
|
-
log.info("jwt", "generating", "Generating jwt secret");
|
|
4
|
-
const environmentMode = environment();
|
|
5
|
-
if (!(await fileExistsAsync(envFile))) {
|
|
6
|
-
const envFileType = environmentMode === "production" ? ".env.production" : ".env.development";
|
|
7
|
-
envFile = rootPath(envFileType);
|
|
8
|
-
}
|
|
9
|
-
if (!(await fileExistsAsync(envFile))) {
|
|
10
|
-
log.error("jwt", "error", ".env file not found");
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
let contents = await getFileAsync(envFile);
|
|
14
|
-
if (contents.includes("JWT_SECRET")) {
|
|
15
|
-
log.warn("jwt", "exists", "JWT secret already exists in the .env file.");
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const key = Random.string(32);
|
|
19
|
-
contents += `
|
|
20
|
-
|
|
21
|
-
# JWT Secret
|
|
22
|
-
JWT_SECRET=${key}
|
|
23
|
-
`;
|
|
24
|
-
await putFileAsync(envFile, contents);
|
|
25
|
-
log.success("jwt", "generated", `JWT secret key generated and added to the .env file.`);
|
|
26
|
-
}export{generateJWTSecret};//# sourceMappingURL=generate-jwt-secret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-jwt-secret.js","sources":["../../src/services/generate-jwt-secret.ts"],"sourcesContent":[null],"names":[],"mappings":"wMAKO,eAAe,iBAAiB,GAAA;AACrC,IAAA,IAAI,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE/B,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAC;AAEvD,IAAA,MAAM,eAAe,GAAG,WAAW,EAAE,CAAC;IAEtC,IAAI,EAAE,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE;AACrC,QAAA,MAAM,WAAW,GAAG,eAAe,KAAK,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAC9F,QAAA,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AACjC,KAAA;IAED,IAAI,EAAE,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE;QACrC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC;QACjD,OAAO;AACR,KAAA;AAED,IAAA,IAAI,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;AAE3C,IAAA,IAAI,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;QACnC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,6CAA6C,CAAC,CAAC;QACzE,OAAO;AACR,KAAA;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE9B,IAAA,QAAQ,IAAI,CAAA;;;aAGD,GAAG,CAAA;CACf,CAAC;AAEA,IAAA,MAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEtC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,CAAsD,oDAAA,CAAA,CAAC,CAAC;AAC1F"}
|
package/esm/services/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,OAAO,CAAC"}
|
package/esm/services/jwt.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type SignerOptions, type VerifierOptions } from "fast-jwt";
|
|
2
|
-
export declare const jwt: {
|
|
3
|
-
/**
|
|
4
|
-
* Generate a new JWT token for the user.
|
|
5
|
-
* @param payload The payload to encode in the JWT token.
|
|
6
|
-
*/
|
|
7
|
-
generate(payload: any, { key, algorithm, ...options }?: any): Promise<string>;
|
|
8
|
-
/**
|
|
9
|
-
* Verify the given token.
|
|
10
|
-
* @param token The JWT token to verify.
|
|
11
|
-
* @returns The decoded token payload if verification is successful.
|
|
12
|
-
*/
|
|
13
|
-
verify<T = any>(token: string, { key, algorithms, ...options }?: any): Promise<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Generate a new refresh token for the user.
|
|
16
|
-
*/
|
|
17
|
-
generateRefreshToken(payload: any, { key, expiresIn, algorithm, ...options }?: any): Promise<string>;
|
|
18
|
-
/**
|
|
19
|
-
* Verify the given refresh token.
|
|
20
|
-
*/
|
|
21
|
-
verifyRefreshToken<T_1 = any>(token: string, { key, algorithms, ...options }?: any): Promise<T_1>;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=jwt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/services/jwt.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AASlB,eAAO,MAAM,GAAG;IACd;;;OAGG;sBAEQ,GAAG,yCAMX,QAAQ,MAAM,CAAC;IAOlB;;;;OAIG;2BAEM,MAAM;IAYf;;OAEG;kCAEQ,GAAG,oDAOX,QAAQ,MAAM,CAAC;IAKlB;;OAEG;yCAEM,MAAM;CAUhB,CAAC"}
|
package/esm/services/jwt.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {config}from'@warlock.js/core';import {createSigner,createVerifier}from'fast-jwt';const getSecretKey = () => config.key("auth.jwt.secret");
|
|
2
|
-
const getAlgorithm = () => config.key("auth.jwt.algorithm");
|
|
3
|
-
const getRefreshSecretKey = () => config.key("auth.jwt.refresh.secret");
|
|
4
|
-
// Assuming there's a separate config for refresh token validity, for example, '7d' for 7 days
|
|
5
|
-
const getRefreshTokenValidity = () => config.key("auth.jwt.refresh.expiresIn");
|
|
6
|
-
const jwt = {
|
|
7
|
-
/**
|
|
8
|
-
* Generate a new JWT token for the user.
|
|
9
|
-
* @param payload The payload to encode in the JWT token.
|
|
10
|
-
*/
|
|
11
|
-
async generate(payload, { key = getSecretKey(), algorithm = getAlgorithm(), ...options } = {}) {
|
|
12
|
-
// Create a signer function with predefined options
|
|
13
|
-
const sign = createSigner({ key, ...options, algorithm });
|
|
14
|
-
return sign({ ...payload });
|
|
15
|
-
},
|
|
16
|
-
/**
|
|
17
|
-
* Verify the given token.
|
|
18
|
-
* @param token The JWT token to verify.
|
|
19
|
-
* @returns The decoded token payload if verification is successful.
|
|
20
|
-
*/
|
|
21
|
-
async verify(token, { key = getSecretKey(), algorithms = getAlgorithm() ? [getAlgorithm()] : undefined, ...options } = {}) {
|
|
22
|
-
const verify = createVerifier({ key, ...options, algorithms });
|
|
23
|
-
return await verify(token);
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* Generate a new refresh token for the user.
|
|
27
|
-
*/
|
|
28
|
-
async generateRefreshToken(payload, { key = getRefreshSecretKey(), expiresIn = getRefreshTokenValidity(), algorithm = getAlgorithm(), ...options } = {}) {
|
|
29
|
-
const sign = createSigner({ key, expiresIn, algorithm, ...options });
|
|
30
|
-
return sign({ ...payload });
|
|
31
|
-
},
|
|
32
|
-
/**
|
|
33
|
-
* Verify the given refresh token.
|
|
34
|
-
*/
|
|
35
|
-
async verifyRefreshToken(token, { key = getRefreshSecretKey(), algorithms = [getAlgorithm()], ...options } = {}) {
|
|
36
|
-
const verify = createVerifier({ key, algorithms, ...options });
|
|
37
|
-
return await verify(token);
|
|
38
|
-
},
|
|
39
|
-
};export{jwt};//# sourceMappingURL=jwt.js.map
|
package/esm/services/jwt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.js","sources":["../../src/services/jwt.ts"],"sourcesContent":[null],"names":[],"mappings":"yFASA,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAW,CAAC;AACnE,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAc,CAAC;AAEzE,MAAM,mBAAmB,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAW,CAAC;AAClF;AACA,MAAM,uBAAuB,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAoB,CAAC;AAErF,MAAA,GAAG,GAAG;AACjB;;;AAGG;AACH,IAAA,MAAM,QAAQ,CACZ,OAAY,EACZ,EACE,GAAG,GAAG,YAAY,EAAE,EACpB,SAAS,GAAG,YAAY,EAAE,EAC1B,GAAG,OAAO,KAC0B,EAAE,EAAA;;AAGxC,QAAA,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAE1D,QAAA,OAAO,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;KAC7B;AAED;;;;AAIG;AACH,IAAA,MAAM,MAAM,CACV,KAAa,EACb,EACE,GAAG,GAAG,YAAY,EAAE,EACpB,UAAU,GAAG,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC,GAAG,SAAS,EAC1D,GAAG,OAAO,KAC4B,EAAE,EAAA;AAE1C,QAAA,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;AAE/D,QAAA,OAAO,MAAM,MAAM,CAAC,KAAe,CAAC,CAAC;KACtC;AAED;;AAEG;IACH,MAAM,oBAAoB,CACxB,OAAY,EACZ,EACE,GAAG,GAAG,mBAAmB,EAAE,EAC3B,SAAS,GAAG,uBAAuB,EAAE,EACrC,SAAS,GAAG,YAAY,EAAE,EAC1B,GAAG,OAAO,EAAA,GAC0B,EAAE,EAAA;AAExC,QAAA,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACrE,QAAA,OAAO,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;KAC7B;AAED;;AAEG;IACH,MAAM,kBAAkB,CACtB,KAAa,EACb,EACE,GAAG,GAAG,mBAAmB,EAAE,EAC3B,UAAU,GAAG,CAAC,YAAY,EAAE,CAAC,EAC7B,GAAG,OAAO,EAAA,GAC4B,EAAE,EAAA;AAE1C,QAAA,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAC/D,QAAA,OAAO,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;KAC5B;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare enum AuthErrorCodes {
|
|
2
|
-
/**
|
|
3
|
-
* Missing Access Token Error Code EC001
|
|
4
|
-
* EC001 = Missing Access Token
|
|
5
|
-
*/
|
|
6
|
-
MissingAccessToken = "EC001",
|
|
7
|
-
/**
|
|
8
|
-
* Invalid Access Token Error Code EC002
|
|
9
|
-
* EC002 = Invalid Access Token
|
|
10
|
-
*/
|
|
11
|
-
InvalidAccessToken = "EC002",
|
|
12
|
-
/**
|
|
13
|
-
* Unauthorized Error Code EC003
|
|
14
|
-
* EC003 = Unauthorized
|
|
15
|
-
*/
|
|
16
|
-
Unauthorized = "EC003"
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=auth-error-codes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-error-codes.d.ts","sourceRoot":"","sources":["../../src/utils/auth-error-codes.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB;;;OAGG;IACH,kBAAkB,UAAU;IAC5B;;;OAGG;IACH,kBAAkB,UAAU;IAC5B;;;OAGG;IACH,YAAY,UAAU;CACvB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var AuthErrorCodes;
|
|
2
|
-
(function (AuthErrorCodes) {
|
|
3
|
-
/**
|
|
4
|
-
* Missing Access Token Error Code EC001
|
|
5
|
-
* EC001 = Missing Access Token
|
|
6
|
-
*/
|
|
7
|
-
AuthErrorCodes["MissingAccessToken"] = "EC001";
|
|
8
|
-
/**
|
|
9
|
-
* Invalid Access Token Error Code EC002
|
|
10
|
-
* EC002 = Invalid Access Token
|
|
11
|
-
*/
|
|
12
|
-
AuthErrorCodes["InvalidAccessToken"] = "EC002";
|
|
13
|
-
/**
|
|
14
|
-
* Unauthorized Error Code EC003
|
|
15
|
-
* EC003 = Unauthorized
|
|
16
|
-
*/
|
|
17
|
-
AuthErrorCodes["Unauthorized"] = "EC003";
|
|
18
|
-
})(AuthErrorCodes || (AuthErrorCodes = {}));export{AuthErrorCodes};//# sourceMappingURL=auth-error-codes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-error-codes.js","sources":["../../src/utils/auth-error-codes.ts"],"sourcesContent":[null],"names":[],"mappings":"IAAY,eAgBX;AAhBD,CAAA,UAAY,cAAc,EAAA;AACxB;;;AAGG;AACH,IAAA,cAAA,CAAA,oBAAA,CAAA,GAAA,OAA4B,CAAA;AAC5B;;;AAGG;AACH,IAAA,cAAA,CAAA,oBAAA,CAAA,GAAA,OAA4B,CAAA;AAC5B;;;AAGG;AACH,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,OAAsB,CAAA;AACxB,CAAC,EAhBW,cAAc,KAAd,cAAc,GAgBzB,EAAA,CAAA,CAAA"}
|
package/esm/utils/duration.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { NO_EXPIRATION } from "../contracts/types";
|
|
2
|
-
/**
|
|
3
|
-
* Duration object for specifying time periods
|
|
4
|
-
* All units are additive (e.g., { days: 1, hours: 6 } = 30 hours)
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* { hours: 1 } // 1 hour
|
|
9
|
-
* { days: 7, hours: 12 } // 7.5 days
|
|
10
|
-
* { minutes: 30 } // 30 minutes
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export type Duration = {
|
|
14
|
-
milliseconds?: number;
|
|
15
|
-
seconds?: number;
|
|
16
|
-
minutes?: number;
|
|
17
|
-
hours?: number;
|
|
18
|
-
days?: number;
|
|
19
|
-
weeks?: number;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Expiration value type - can be a Duration object, string format, or NO_EXPIRATION
|
|
23
|
-
*/
|
|
24
|
-
export type ExpiresIn = Duration | typeof NO_EXPIRATION | string | number;
|
|
25
|
-
/**
|
|
26
|
-
* Parse duration to milliseconds
|
|
27
|
-
* Supports Duration object, string format ("1d 2h 30m"), or number (raw ms)
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* parseExpirationToMs({ hours: 1 }) // 3600000
|
|
32
|
-
* parseExpirationToMs({ days: 1 }) // 86400000
|
|
33
|
-
* parseExpirationToMs("1h") // 3600000
|
|
34
|
-
* parseExpirationToMs("1d 2h 30m") // 95400000
|
|
35
|
-
* parseExpirationToMs(3600000) // 3600000
|
|
36
|
-
* parseExpirationToMs(NO_EXPIRATION) // undefined
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function parseExpirationToMs(expiration: ExpiresIn | undefined, defaultMs?: number): number | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Convert ExpiresIn to a value suitable for jwt.generate (string or number)
|
|
42
|
-
* Returns undefined if NO_EXPIRATION
|
|
43
|
-
*/
|
|
44
|
-
export declare function toJwtExpiresIn(expiration: ExpiresIn | undefined, defaultMs?: number): string | undefined;
|
|
45
|
-
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/utils/duration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,SAAS,GAAE,MAAgB,GAC1B,MAAM,GAAG,SAAS,CAmBpB;AAuDD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,SAAS,GAAE,MAAgB,GAC1B,MAAM,GAAG,SAAS,CAMpB"}
|
package/esm/utils/duration.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {NO_EXPIRATION}from'../contracts/types.js';/**
|
|
2
|
-
* Parse duration to milliseconds
|
|
3
|
-
* Supports Duration object, string format ("1d 2h 30m"), or number (raw ms)
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* parseExpirationToMs({ hours: 1 }) // 3600000
|
|
8
|
-
* parseExpirationToMs({ days: 1 }) // 86400000
|
|
9
|
-
* parseExpirationToMs("1h") // 3600000
|
|
10
|
-
* parseExpirationToMs("1d 2h 30m") // 95400000
|
|
11
|
-
* parseExpirationToMs(3600000) // 3600000
|
|
12
|
-
* parseExpirationToMs(NO_EXPIRATION) // undefined
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
function parseExpirationToMs(expiration, defaultMs = 3600000) {
|
|
16
|
-
if (expiration === undefined) {
|
|
17
|
-
return defaultMs;
|
|
18
|
-
}
|
|
19
|
-
if (expiration === NO_EXPIRATION) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
if (typeof expiration === "number") {
|
|
23
|
-
return expiration;
|
|
24
|
-
}
|
|
25
|
-
if (typeof expiration === "string") {
|
|
26
|
-
return parseStringDuration(expiration);
|
|
27
|
-
}
|
|
28
|
-
// It's a Duration object
|
|
29
|
-
return parseDurationObject(expiration);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Parse a Duration object to milliseconds
|
|
33
|
-
*/
|
|
34
|
-
function parseDurationObject(duration) {
|
|
35
|
-
let ms = 0;
|
|
36
|
-
if (duration.milliseconds)
|
|
37
|
-
ms += duration.milliseconds;
|
|
38
|
-
if (duration.seconds)
|
|
39
|
-
ms += duration.seconds * 1000;
|
|
40
|
-
if (duration.minutes)
|
|
41
|
-
ms += duration.minutes * 60 * 1000;
|
|
42
|
-
if (duration.hours)
|
|
43
|
-
ms += duration.hours * 60 * 60 * 1000;
|
|
44
|
-
if (duration.days)
|
|
45
|
-
ms += duration.days * 24 * 60 * 60 * 1000;
|
|
46
|
-
if (duration.weeks)
|
|
47
|
-
ms += duration.weeks * 7 * 24 * 60 * 60 * 1000;
|
|
48
|
-
return ms;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Parse a string duration to milliseconds
|
|
52
|
-
* Supports formats: "1h", "7d", "30m", "90s", "1d 2h 30m"
|
|
53
|
-
*/
|
|
54
|
-
function parseStringDuration(str) {
|
|
55
|
-
let totalMs = 0;
|
|
56
|
-
const parts = str.trim().split(/\s+/);
|
|
57
|
-
for (const part of parts) {
|
|
58
|
-
const match = part.match(/^(\d+(?:\.\d+)?)([smhdw])$/i);
|
|
59
|
-
if (!match)
|
|
60
|
-
continue;
|
|
61
|
-
const value = parseFloat(match[1]);
|
|
62
|
-
const unit = match[2].toLowerCase();
|
|
63
|
-
switch (unit) {
|
|
64
|
-
case "s":
|
|
65
|
-
totalMs += value * 1000;
|
|
66
|
-
break;
|
|
67
|
-
case "m":
|
|
68
|
-
totalMs += value * 60 * 1000;
|
|
69
|
-
break;
|
|
70
|
-
case "h":
|
|
71
|
-
totalMs += value * 60 * 60 * 1000;
|
|
72
|
-
break;
|
|
73
|
-
case "d":
|
|
74
|
-
totalMs += value * 24 * 60 * 60 * 1000;
|
|
75
|
-
break;
|
|
76
|
-
case "w":
|
|
77
|
-
totalMs += value * 7 * 24 * 60 * 60 * 1000;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return totalMs || 3600000; // Default to 1 hour if nothing parsed
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Convert ExpiresIn to a value suitable for jwt.generate (string or number)
|
|
85
|
-
* Returns undefined if NO_EXPIRATION
|
|
86
|
-
*/
|
|
87
|
-
function toJwtExpiresIn(expiration, defaultMs = 3600000) {
|
|
88
|
-
const ms = parseExpirationToMs(expiration, defaultMs);
|
|
89
|
-
if (ms === undefined)
|
|
90
|
-
return undefined;
|
|
91
|
-
// Convert ms to seconds for JWT (more common format)
|
|
92
|
-
return Math.floor(ms / 1000) + "s";
|
|
93
|
-
}export{parseExpirationToMs,toJwtExpiresIn};//# sourceMappingURL=duration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duration.js","sources":["../../src/utils/duration.ts"],"sourcesContent":[null],"names":[],"mappings":"kDA2BA;;;;;;;;;;;;;AAaG;SACa,mBAAmB,CACjC,UAAiC,EACjC,YAAoB,OAAO,EAAA;IAE3B,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IAED,IAAI,UAAU,KAAK,aAAa,EAAE;AAChC,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AAED,IAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;AAClC,QAAA,OAAO,UAAU,CAAC;AACnB,KAAA;AAED,IAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;AAClC,QAAA,OAAO,mBAAmB,CAAC,UAAU,CAAC,CAAC;AACxC,KAAA;;AAGD,IAAA,OAAO,mBAAmB,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED;;AAEG;AACH,SAAS,mBAAmB,CAAC,QAAkB,EAAA;IAC7C,IAAI,EAAE,GAAG,CAAC,CAAC;IAEX,IAAI,QAAQ,CAAC,YAAY;AAAE,QAAA,EAAE,IAAI,QAAQ,CAAC,YAAY,CAAC;IACvD,IAAI,QAAQ,CAAC,OAAO;AAAE,QAAA,EAAE,IAAI,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;IACpD,IAAI,QAAQ,CAAC,OAAO;QAAE,EAAE,IAAI,QAAQ,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;IACzD,IAAI,QAAQ,CAAC,KAAK;QAAE,EAAE,IAAI,QAAQ,CAAC,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC1D,IAAI,QAAQ,CAAC,IAAI;AAAE,QAAA,EAAE,IAAI,QAAQ,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,E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3C,MAAM;AACT,SAAA;AACF,KAAA;AAED,IAAA,OAAO,OAAO,IAAI,OAAO,CAAC;AAC5B,CAAC;AAED;;;AAGG;SACa,cAAc,CAC5B,UAAiC,EACjC,YAAoB,OAAO,EAAA;IAE3B,MAAM,EAAE,GAAG,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACtD,IAAI,EAAE,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS,CAAC;;IAGvC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;AACrC"}
|
package/esm/utils/index.d.ts
DELETED
package/esm/utils/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|