mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 06:35:21 +00:00
25 lines
698 B
TypeScript
25 lines
698 B
TypeScript
import { z } from "zod";
|
|
|
|
import { UserEncryptionKeysSchema, UsersSchema } from "@app/db/schemas";
|
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|
import { AuthMode } from "@app/services/auth/auth-type";
|
|
|
|
export const registerUserRouter = async (server: FastifyZodProvider) => {
|
|
server.route({
|
|
method: "GET",
|
|
url: "/",
|
|
schema: {
|
|
response: {
|
|
200: z.object({
|
|
user: UsersSchema.merge(UserEncryptionKeysSchema.omit({ verifier: true }))
|
|
})
|
|
}
|
|
},
|
|
onRequest: verifyAuth([AuthMode.JWT]),
|
|
handler: async (req) => {
|
|
const user = await server.services.user.getMe(req.permission.id);
|
|
return { user };
|
|
}
|
|
});
|
|
};
|