@factiii/auth 0.2.0 → 0.4.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.
- package/README.md +5 -1
- package/dist/{chunk-PYVDWODF.mjs → chunk-EHI4P63M.mjs} +0 -21
- package/dist/{hooks-B41uikq7.d.mts → hooks-BXNxNK4S.d.mts} +1 -55
- package/dist/{hooks-B41uikq7.d.ts → hooks-BXNxNK4S.d.ts} +1 -55
- package/dist/index.d.mts +30 -51
- package/dist/index.d.ts +30 -51
- package/dist/index.js +115 -191
- package/dist/index.mjs +111 -171
- package/dist/validators.d.mts +1 -1
- package/dist/validators.d.ts +1 -1
- package/dist/validators.js +0 -26
- package/dist/validators.mjs +1 -11
- package/package.json +1 -1
- package/prisma/schema.prisma +17 -19
package/dist/validators.js
CHANGED
|
@@ -29,18 +29,13 @@ __export(validators_exports, {
|
|
|
29
29
|
endAllSessionsSchema: () => endAllSessionsSchema,
|
|
30
30
|
getTwofaSecretSchema: () => getTwofaSecretSchema,
|
|
31
31
|
loginSchema: () => loginSchema,
|
|
32
|
-
logoutSchema: () => logoutSchema,
|
|
33
32
|
oAuthLoginSchema: () => oAuthLoginSchema,
|
|
34
|
-
otpLoginRequestSchema: () => otpLoginRequestSchema,
|
|
35
|
-
otpLoginVerifySchema: () => otpLoginVerifySchema,
|
|
36
33
|
registerPushTokenSchema: () => registerPushTokenSchema,
|
|
37
34
|
requestPasswordResetSchema: () => requestPasswordResetSchema,
|
|
38
|
-
resendVerificationSchema: () => resendVerificationSchema,
|
|
39
35
|
resetPasswordSchema: () => resetPasswordSchema,
|
|
40
36
|
signupSchema: () => signupSchema,
|
|
41
37
|
twoFaResetSchema: () => twoFaResetSchema,
|
|
42
38
|
twoFaResetVerifySchema: () => twoFaResetVerifySchema,
|
|
43
|
-
twoFaSetupSchema: () => twoFaSetupSchema,
|
|
44
39
|
twoFaVerifySchema: () => twoFaVerifySchema,
|
|
45
40
|
verifyEmailSchema: () => verifyEmailSchema
|
|
46
41
|
});
|
|
@@ -87,9 +82,6 @@ var twoFaVerifySchema = import_zod.z.object({
|
|
|
87
82
|
code: import_zod.z.string().min(6, { message: "Verification code is required" }),
|
|
88
83
|
sessionId: import_zod.z.number().optional()
|
|
89
84
|
});
|
|
90
|
-
var twoFaSetupSchema = import_zod.z.object({
|
|
91
|
-
code: import_zod.z.string().min(6, { message: "Verification code is required" })
|
|
92
|
-
});
|
|
93
85
|
var twoFaResetSchema = import_zod.z.object({
|
|
94
86
|
username: import_zod.z.string().min(1),
|
|
95
87
|
password: import_zod.z.string().min(1)
|
|
@@ -101,9 +93,6 @@ var twoFaResetVerifySchema = import_zod.z.object({
|
|
|
101
93
|
var verifyEmailSchema = import_zod.z.object({
|
|
102
94
|
code: import_zod.z.string().min(1, { message: "Verification code is required" })
|
|
103
95
|
});
|
|
104
|
-
var resendVerificationSchema = import_zod.z.object({
|
|
105
|
-
email: import_zod.z.string().email().optional()
|
|
106
|
-
});
|
|
107
96
|
var biometricVerifySchema = import_zod.z.object({});
|
|
108
97
|
var registerPushTokenSchema = import_zod.z.object({
|
|
109
98
|
pushToken: import_zod.z.string().min(1, { message: "Push token is required" })
|
|
@@ -117,19 +106,9 @@ var getTwofaSecretSchema = import_zod.z.object({
|
|
|
117
106
|
var disableTwofaSchema = import_zod.z.object({
|
|
118
107
|
password: import_zod.z.string().min(1, { message: "Password is required" })
|
|
119
108
|
});
|
|
120
|
-
var logoutSchema = import_zod.z.object({
|
|
121
|
-
allDevices: import_zod.z.boolean().optional().default(false)
|
|
122
|
-
});
|
|
123
109
|
var endAllSessionsSchema = import_zod.z.object({
|
|
124
110
|
skipCurrentSession: import_zod.z.boolean().optional().default(true)
|
|
125
111
|
});
|
|
126
|
-
var otpLoginRequestSchema = import_zod.z.object({
|
|
127
|
-
email: import_zod.z.string().email({ message: "Invalid email address" })
|
|
128
|
-
});
|
|
129
|
-
var otpLoginVerifySchema = import_zod.z.object({
|
|
130
|
-
email: import_zod.z.string().email(),
|
|
131
|
-
code: import_zod.z.number().min(1e5).max(999999)
|
|
132
|
-
});
|
|
133
112
|
function createSchemas(extensions) {
|
|
134
113
|
return {
|
|
135
114
|
signup: extensions?.signup ? signupSchema.merge(extensions.signup) : signupSchema,
|
|
@@ -148,18 +127,13 @@ function createSchemas(extensions) {
|
|
|
148
127
|
endAllSessionsSchema,
|
|
149
128
|
getTwofaSecretSchema,
|
|
150
129
|
loginSchema,
|
|
151
|
-
logoutSchema,
|
|
152
130
|
oAuthLoginSchema,
|
|
153
|
-
otpLoginRequestSchema,
|
|
154
|
-
otpLoginVerifySchema,
|
|
155
131
|
registerPushTokenSchema,
|
|
156
132
|
requestPasswordResetSchema,
|
|
157
|
-
resendVerificationSchema,
|
|
158
133
|
resetPasswordSchema,
|
|
159
134
|
signupSchema,
|
|
160
135
|
twoFaResetSchema,
|
|
161
136
|
twoFaResetVerifySchema,
|
|
162
|
-
twoFaSetupSchema,
|
|
163
137
|
twoFaVerifySchema,
|
|
164
138
|
verifyEmailSchema
|
|
165
139
|
});
|
package/dist/validators.mjs
CHANGED
|
@@ -8,21 +8,16 @@ import {
|
|
|
8
8
|
endAllSessionsSchema,
|
|
9
9
|
getTwofaSecretSchema,
|
|
10
10
|
loginSchema,
|
|
11
|
-
logoutSchema,
|
|
12
11
|
oAuthLoginSchema,
|
|
13
|
-
otpLoginRequestSchema,
|
|
14
|
-
otpLoginVerifySchema,
|
|
15
12
|
registerPushTokenSchema,
|
|
16
13
|
requestPasswordResetSchema,
|
|
17
|
-
resendVerificationSchema,
|
|
18
14
|
resetPasswordSchema,
|
|
19
15
|
signupSchema,
|
|
20
16
|
twoFaResetSchema,
|
|
21
17
|
twoFaResetVerifySchema,
|
|
22
|
-
twoFaSetupSchema,
|
|
23
18
|
twoFaVerifySchema,
|
|
24
19
|
verifyEmailSchema
|
|
25
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-EHI4P63M.mjs";
|
|
26
21
|
export {
|
|
27
22
|
biometricVerifySchema,
|
|
28
23
|
changePasswordSchema,
|
|
@@ -33,18 +28,13 @@ export {
|
|
|
33
28
|
endAllSessionsSchema,
|
|
34
29
|
getTwofaSecretSchema,
|
|
35
30
|
loginSchema,
|
|
36
|
-
logoutSchema,
|
|
37
31
|
oAuthLoginSchema,
|
|
38
|
-
otpLoginRequestSchema,
|
|
39
|
-
otpLoginVerifySchema,
|
|
40
32
|
registerPushTokenSchema,
|
|
41
33
|
requestPasswordResetSchema,
|
|
42
|
-
resendVerificationSchema,
|
|
43
34
|
resetPasswordSchema,
|
|
44
35
|
signupSchema,
|
|
45
36
|
twoFaResetSchema,
|
|
46
37
|
twoFaResetVerifySchema,
|
|
47
|
-
twoFaSetupSchema,
|
|
48
38
|
twoFaVerifySchema,
|
|
49
39
|
verifyEmailSchema
|
|
50
40
|
};
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -59,7 +59,7 @@ model User {
|
|
|
59
59
|
// Relations
|
|
60
60
|
sessions Session[]
|
|
61
61
|
passwordReset PasswordReset[]
|
|
62
|
-
|
|
62
|
+
otps OTP[]
|
|
63
63
|
devices Device[] @relation("devices")
|
|
64
64
|
admin Admin?
|
|
65
65
|
}
|
|
@@ -69,18 +69,17 @@ model User {
|
|
|
69
69
|
// ==============================================================================
|
|
70
70
|
|
|
71
71
|
model Session {
|
|
72
|
-
id
|
|
73
|
-
socketId
|
|
74
|
-
twoFaSecret
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
userId
|
|
82
|
-
|
|
83
|
-
revokedAt DateTime?
|
|
72
|
+
id Int @id @default(autoincrement())
|
|
73
|
+
socketId String? @unique
|
|
74
|
+
twoFaSecret String? @unique
|
|
75
|
+
issuedAt DateTime @default(now())
|
|
76
|
+
browserName String @default("Unknown")
|
|
77
|
+
lastUsed DateTime @default(now()) @updatedAt
|
|
78
|
+
device Device? @relation(fields: [deviceId], references: [id])
|
|
79
|
+
deviceId Int?
|
|
80
|
+
userId Int
|
|
81
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
82
|
+
revokedAt DateTime?
|
|
84
83
|
|
|
85
84
|
@@index([userId])
|
|
86
85
|
@@index([deviceId])
|
|
@@ -113,16 +112,15 @@ model PasswordReset {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
// ==============================================================================
|
|
116
|
-
//
|
|
115
|
+
// OTP Model
|
|
117
116
|
// ==============================================================================
|
|
118
117
|
|
|
119
|
-
model
|
|
120
|
-
id Int @id @default(autoincrement())
|
|
118
|
+
model OTP {
|
|
121
119
|
code Int
|
|
122
|
-
|
|
120
|
+
expiredAt DateTime
|
|
121
|
+
userId Int @unique
|
|
123
122
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
124
|
-
|
|
125
|
-
disabled Boolean @default(false)
|
|
123
|
+
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
// ==============================================================================
|