better-auth
Version:
The most comprehensive authentication framework for TypeScript.
64 lines (63 loc) • 1.07 kB
JavaScript
import * as z from "zod";
//#region src/plugins/device-authorization/schema.ts
const schema = { deviceCode: {
fields: {
deviceCode: {
type: "string",
required: true
},
userCode: {
type: "string",
required: true
},
userId: {
type: "string",
required: false
},
expiresAt: {
type: "date",
required: true
},
status: {
type: "string",
required: true
},
lastPolledAt: {
type: "date",
required: false
},
pollingInterval: {
type: "number",
required: false
},
clientId: {
type: "string",
required: false
},
scope: {
type: "string",
required: false
}
},
indexes: [{
fields: ["deviceCode"],
unique: true
}, {
fields: ["userCode"],
unique: true
}]
} };
z.object({
id: z.string(),
deviceCode: z.string(),
userCode: z.string(),
userId: z.string().optional(),
expiresAt: z.date(),
status: z.string(),
lastPolledAt: z.date().optional(),
pollingInterval: z.number().optional(),
clientId: z.string().optional(),
scope: z.string().optional()
});
//#endregion
export { schema };