@factiii/auth 0.5.1 → 0.5.3
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/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +8 -6
- package/dist/index.mjs +8 -6
- package/dist/validators.d.mts +1 -1
- package/dist/validators.d.ts +1 -1
- package/package.json +1 -1
- package/dist/{hooks-yHGJ7C6_.d.mts → hooks-BXNxNK4S.d.mts} +2 -2
- package/dist/{hooks-yHGJ7C6_.d.ts → hooks-BXNxNK4S.d.ts} +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -6,8 +6,8 @@ import { PrismaClient } from '@prisma/client';
|
|
|
6
6
|
import * as _trpc_server from '@trpc/server';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { CreateHTTPContextOptions } from '@trpc/server/adapters/standalone';
|
|
9
|
-
import { S as SchemaExtensions, A as AuthHooks } from './hooks-
|
|
10
|
-
export { C as ChangePasswordInput, L as LoginInput, O as OAuthLoginInput, R as ResetPasswordInput, a as SignupInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, e as endAllSessionsSchema, l as loginSchema, o as oAuthLoginSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-
|
|
9
|
+
import { S as SchemaExtensions, A as AuthHooks } from './hooks-BXNxNK4S.mjs';
|
|
10
|
+
export { C as ChangePasswordInput, L as LoginInput, O as OAuthLoginInput, R as ResetPasswordInput, a as SignupInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, e as endAllSessionsSchema, l as loginSchema, o as oAuthLoginSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-BXNxNK4S.mjs';
|
|
11
11
|
|
|
12
12
|
//# sourceMappingURL=TRPCError.d.ts.map
|
|
13
13
|
//#endregion
|
|
@@ -659,12 +659,12 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
659
659
|
email: zod.ZodString;
|
|
660
660
|
password: zod.ZodEffects<zod.ZodString, string, string>;
|
|
661
661
|
}, "strip", zod.ZodTypeAny, {
|
|
662
|
-
username: string;
|
|
663
662
|
email: string;
|
|
663
|
+
username: string;
|
|
664
664
|
password: string;
|
|
665
665
|
}, {
|
|
666
|
-
username: string;
|
|
667
666
|
email: string;
|
|
667
|
+
username: string;
|
|
668
668
|
password: string;
|
|
669
669
|
}>>["in"] extends infer T_7 ? T_7 extends inferParser<[TExtensions["signup"]] extends [zod.AnyZodObject] ? zod.ZodObject<{
|
|
670
670
|
username: zod.ZodString;
|
|
@@ -683,12 +683,12 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
683
683
|
email: zod.ZodString;
|
|
684
684
|
password: zod.ZodEffects<zod.ZodString, string, string>;
|
|
685
685
|
}, "strip", zod.ZodTypeAny, {
|
|
686
|
-
username: string;
|
|
687
686
|
email: string;
|
|
687
|
+
username: string;
|
|
688
688
|
password: string;
|
|
689
689
|
}, {
|
|
690
|
-
username: string;
|
|
691
690
|
email: string;
|
|
691
|
+
username: string;
|
|
692
692
|
password: string;
|
|
693
693
|
}>>["in"] ? T_7 extends _trpc_server.TRPCUnsetMarker ? void : T_7 : never : never;
|
|
694
694
|
output: {
|
|
@@ -754,6 +754,7 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
754
754
|
output: {
|
|
755
755
|
success: boolean;
|
|
756
756
|
requires2FA: boolean;
|
|
757
|
+
userId: number;
|
|
757
758
|
user?: undefined;
|
|
758
759
|
} | {
|
|
759
760
|
success: boolean;
|
|
@@ -763,6 +764,7 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
763
764
|
username: string;
|
|
764
765
|
};
|
|
765
766
|
requires2FA?: undefined;
|
|
767
|
+
userId?: undefined;
|
|
766
768
|
};
|
|
767
769
|
meta: Meta;
|
|
768
770
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { PrismaClient } from '@prisma/client';
|
|
|
6
6
|
import * as _trpc_server from '@trpc/server';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { CreateHTTPContextOptions } from '@trpc/server/adapters/standalone';
|
|
9
|
-
import { S as SchemaExtensions, A as AuthHooks } from './hooks-
|
|
10
|
-
export { C as ChangePasswordInput, L as LoginInput, O as OAuthLoginInput, R as ResetPasswordInput, a as SignupInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, e as endAllSessionsSchema, l as loginSchema, o as oAuthLoginSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-
|
|
9
|
+
import { S as SchemaExtensions, A as AuthHooks } from './hooks-BXNxNK4S.js';
|
|
10
|
+
export { C as ChangePasswordInput, L as LoginInput, O as OAuthLoginInput, R as ResetPasswordInput, a as SignupInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, e as endAllSessionsSchema, l as loginSchema, o as oAuthLoginSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-BXNxNK4S.js';
|
|
11
11
|
|
|
12
12
|
//# sourceMappingURL=TRPCError.d.ts.map
|
|
13
13
|
//#endregion
|
|
@@ -659,12 +659,12 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
659
659
|
email: zod.ZodString;
|
|
660
660
|
password: zod.ZodEffects<zod.ZodString, string, string>;
|
|
661
661
|
}, "strip", zod.ZodTypeAny, {
|
|
662
|
-
username: string;
|
|
663
662
|
email: string;
|
|
663
|
+
username: string;
|
|
664
664
|
password: string;
|
|
665
665
|
}, {
|
|
666
|
-
username: string;
|
|
667
666
|
email: string;
|
|
667
|
+
username: string;
|
|
668
668
|
password: string;
|
|
669
669
|
}>>["in"] extends infer T_7 ? T_7 extends inferParser<[TExtensions["signup"]] extends [zod.AnyZodObject] ? zod.ZodObject<{
|
|
670
670
|
username: zod.ZodString;
|
|
@@ -683,12 +683,12 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
683
683
|
email: zod.ZodString;
|
|
684
684
|
password: zod.ZodEffects<zod.ZodString, string, string>;
|
|
685
685
|
}, "strip", zod.ZodTypeAny, {
|
|
686
|
-
username: string;
|
|
687
686
|
email: string;
|
|
687
|
+
username: string;
|
|
688
688
|
password: string;
|
|
689
689
|
}, {
|
|
690
|
-
username: string;
|
|
691
690
|
email: string;
|
|
691
|
+
username: string;
|
|
692
692
|
password: string;
|
|
693
693
|
}>>["in"] ? T_7 extends _trpc_server.TRPCUnsetMarker ? void : T_7 : never : never;
|
|
694
694
|
output: {
|
|
@@ -754,6 +754,7 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
754
754
|
output: {
|
|
755
755
|
success: boolean;
|
|
756
756
|
requires2FA: boolean;
|
|
757
|
+
userId: number;
|
|
757
758
|
user?: undefined;
|
|
758
759
|
} | {
|
|
759
760
|
success: boolean;
|
|
@@ -763,6 +764,7 @@ declare function createAuthRouter<TExtensions extends SchemaExtensions = {}>(con
|
|
|
763
764
|
username: string;
|
|
764
765
|
};
|
|
765
766
|
requires2FA?: undefined;
|
|
767
|
+
userId?: undefined;
|
|
766
768
|
};
|
|
767
769
|
meta: Meta;
|
|
768
770
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -890,7 +890,8 @@ var BaseProcedureFactory = class {
|
|
|
890
890
|
if (!code) {
|
|
891
891
|
return {
|
|
892
892
|
success: false,
|
|
893
|
-
requires2FA: true
|
|
893
|
+
requires2FA: true,
|
|
894
|
+
userId: user.id
|
|
894
895
|
};
|
|
895
896
|
}
|
|
896
897
|
let validCode = false;
|
|
@@ -1169,14 +1170,15 @@ var BaseProcedureFactory = class {
|
|
|
1169
1170
|
data: { password: hashedPassword }
|
|
1170
1171
|
});
|
|
1171
1172
|
await this.config.prisma.passwordReset.delete({ where: { id: token } });
|
|
1172
|
-
const
|
|
1173
|
-
where: { userId: passwordReset.userId },
|
|
1173
|
+
const sessionsToRevoke = await this.config.prisma.session.findMany({
|
|
1174
|
+
where: { userId: passwordReset.userId, revokedAt: null },
|
|
1174
1175
|
select: { id: true, socketId: true, userId: true }
|
|
1175
1176
|
});
|
|
1176
|
-
await this.config.prisma.session.
|
|
1177
|
-
where: { userId: passwordReset.userId }
|
|
1177
|
+
await this.config.prisma.session.updateMany({
|
|
1178
|
+
where: { userId: passwordReset.userId, revokedAt: null },
|
|
1179
|
+
data: { revokedAt: /* @__PURE__ */ new Date() }
|
|
1178
1180
|
});
|
|
1179
|
-
for (const session of
|
|
1181
|
+
for (const session of sessionsToRevoke) {
|
|
1180
1182
|
if (this.config.hooks?.onSessionRevoked) {
|
|
1181
1183
|
await this.config.hooks.onSessionRevoked(
|
|
1182
1184
|
session.id,
|
package/dist/index.mjs
CHANGED
|
@@ -756,7 +756,8 @@ var BaseProcedureFactory = class {
|
|
|
756
756
|
if (!code) {
|
|
757
757
|
return {
|
|
758
758
|
success: false,
|
|
759
|
-
requires2FA: true
|
|
759
|
+
requires2FA: true,
|
|
760
|
+
userId: user.id
|
|
760
761
|
};
|
|
761
762
|
}
|
|
762
763
|
let validCode = false;
|
|
@@ -1035,14 +1036,15 @@ var BaseProcedureFactory = class {
|
|
|
1035
1036
|
data: { password: hashedPassword }
|
|
1036
1037
|
});
|
|
1037
1038
|
await this.config.prisma.passwordReset.delete({ where: { id: token } });
|
|
1038
|
-
const
|
|
1039
|
-
where: { userId: passwordReset.userId },
|
|
1039
|
+
const sessionsToRevoke = await this.config.prisma.session.findMany({
|
|
1040
|
+
where: { userId: passwordReset.userId, revokedAt: null },
|
|
1040
1041
|
select: { id: true, socketId: true, userId: true }
|
|
1041
1042
|
});
|
|
1042
|
-
await this.config.prisma.session.
|
|
1043
|
-
where: { userId: passwordReset.userId }
|
|
1043
|
+
await this.config.prisma.session.updateMany({
|
|
1044
|
+
where: { userId: passwordReset.userId, revokedAt: null },
|
|
1045
|
+
data: { revokedAt: /* @__PURE__ */ new Date() }
|
|
1044
1046
|
});
|
|
1045
|
-
for (const session of
|
|
1047
|
+
for (const session of sessionsToRevoke) {
|
|
1046
1048
|
if (this.config.hooks?.onSessionRevoked) {
|
|
1047
1049
|
await this.config.hooks.onSessionRevoked(
|
|
1048
1050
|
session.id,
|
package/dist/validators.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { g as AuthSchemas, C as ChangePasswordInput, h as CreatedSchemas, L as LoginInput, i as LoginSchemaInput, O as OAuthLoginInput, j as OAuthSchemaInput, R as ResetPasswordInput, a as SignupInput, k as SignupSchemaInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, m as checkPasswordResetSchema, n as createSchemas, p as deregisterPushTokenSchema, q as disableTwofaSchema, e as endAllSessionsSchema, u as getTwofaSecretSchema, l as loginSchema, o as oAuthLoginSchema, w as registerPushTokenSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, x as twoFaResetVerifySchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-
|
|
2
|
+
export { g as AuthSchemas, C as ChangePasswordInput, h as CreatedSchemas, L as LoginInput, i as LoginSchemaInput, O as OAuthLoginInput, j as OAuthSchemaInput, R as ResetPasswordInput, a as SignupInput, k as SignupSchemaInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, m as checkPasswordResetSchema, n as createSchemas, p as deregisterPushTokenSchema, q as disableTwofaSchema, e as endAllSessionsSchema, u as getTwofaSecretSchema, l as loginSchema, o as oAuthLoginSchema, w as registerPushTokenSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, x as twoFaResetVerifySchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-BXNxNK4S.mjs';
|
package/dist/validators.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { g as AuthSchemas, C as ChangePasswordInput, h as CreatedSchemas, L as LoginInput, i as LoginSchemaInput, O as OAuthLoginInput, j as OAuthSchemaInput, R as ResetPasswordInput, a as SignupInput, k as SignupSchemaInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, m as checkPasswordResetSchema, n as createSchemas, p as deregisterPushTokenSchema, q as disableTwofaSchema, e as endAllSessionsSchema, u as getTwofaSecretSchema, l as loginSchema, o as oAuthLoginSchema, w as registerPushTokenSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, x as twoFaResetVerifySchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-
|
|
2
|
+
export { g as AuthSchemas, C as ChangePasswordInput, h as CreatedSchemas, L as LoginInput, i as LoginSchemaInput, O as OAuthLoginInput, j as OAuthSchemaInput, R as ResetPasswordInput, a as SignupInput, k as SignupSchemaInput, T as TwoFaVerifyInput, V as VerifyEmailInput, b as biometricVerifySchema, c as changePasswordSchema, m as checkPasswordResetSchema, n as createSchemas, p as deregisterPushTokenSchema, q as disableTwofaSchema, e as endAllSessionsSchema, u as getTwofaSecretSchema, l as loginSchema, o as oAuthLoginSchema, w as registerPushTokenSchema, r as requestPasswordResetSchema, d as resetPasswordSchema, s as signupSchema, t as twoFaResetSchema, x as twoFaResetVerifySchema, f as twoFaVerifySchema, v as verifyEmailSchema } from './hooks-BXNxNK4S.js';
|
package/package.json
CHANGED
|
@@ -8,12 +8,12 @@ declare const signupSchema: z.ZodObject<{
|
|
|
8
8
|
email: z.ZodString;
|
|
9
9
|
password: z.ZodEffects<z.ZodString, string, string>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
username: string;
|
|
12
11
|
email: string;
|
|
12
|
+
username: string;
|
|
13
13
|
password: string;
|
|
14
14
|
}, {
|
|
15
|
-
username: string;
|
|
16
15
|
email: string;
|
|
16
|
+
username: string;
|
|
17
17
|
password: string;
|
|
18
18
|
}>;
|
|
19
19
|
/**
|
|
@@ -8,12 +8,12 @@ declare const signupSchema: z.ZodObject<{
|
|
|
8
8
|
email: z.ZodString;
|
|
9
9
|
password: z.ZodEffects<z.ZodString, string, string>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
username: string;
|
|
12
11
|
email: string;
|
|
12
|
+
username: string;
|
|
13
13
|
password: string;
|
|
14
14
|
}, {
|
|
15
|
-
username: string;
|
|
16
15
|
email: string;
|
|
16
|
+
username: string;
|
|
17
17
|
password: string;
|
|
18
18
|
}>;
|
|
19
19
|
/**
|