diff --git a/packages/enterprise/src/core/share.ts b/packages/enterprise/src/core/share.ts new file mode 100644 index 000000000..80e1d2678 --- /dev/null +++ b/packages/enterprise/src/core/share.ts @@ -0,0 +1,19 @@ +import { fn } from "@opencode-ai/util/fn" +import z from "zod" +import { Storage } from "./storage" + +export namespace Share { + export const Info = z.object({ + id: z.string(), + secret: z.string(), + }) + export type Info = z.infer + + export const create = fn(Info.pick({ id: true }), async (body) => { + const info: Info = { + id: body.id, + secret: crypto.randomUUID(), + } + await Storage.write(["share", info.id], info) + }) +}