mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
sync
This commit is contained in:
parent
df756b9f89
commit
29098d7d74
1 changed files with 19 additions and 0 deletions
19
packages/enterprise/src/core/share.ts
Normal file
19
packages/enterprise/src/core/share.ts
Normal file
|
|
@ -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<typeof Info>
|
||||
|
||||
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)
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue