sipher/src/lib/plugins/server/helpers/social/endpoints/posts.ts
Nixyan ea172050a6 feat: implement server discovery and key rotation functionality
- Added new routes for server discovery and key rotation, including challenge issuance and confirmation processes.
- Introduced database schema for managing server registrations and rotation challenges.
- Implemented encryption and decryption utilities for secure communication between servers.
- Updated package dependencies and added new client and server plugins for social features.
- Enhanced user management with additional fields and relations in the database schema.
2026-03-09 21:37:59 -03:00

25 lines
No EOL
682 B
TypeScript

import { createAuthEndpoint, getSessionFromCtx } from "better-auth/api";
import { z } from "zod";
import { postContentSchema } from "../social";
export const createPost = createAuthEndpoint("/social/posts", {
method: "POST",
body: postContentSchema,
}, async (context) => {
const content = context.body;
const user = getSessionFromCtx(context)
if (!user) {
return context.json({ error: "Unauthorized" }, { status: 401 });
}
console.log(content);
return context.json({ message: "Hello, world!" }, { status: 200 });
});
export const getPost = createAuthEndpoint("/social/posts/:id", {
method: "GET",
params: z.object({
id: z.string(),
}),
}, async (context) => { })