@bigio/better-auth-electron 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,93 @@
1
+ import * as better_auth from 'better-auth';
2
+ import { z } from 'zod';
3
+ import { ElectronServerPluginOptions } from './options.js';
4
+ import 'electron';
5
+
6
+ declare const electronServerPlugin: (options: ElectronServerPluginOptions) => {
7
+ id: "bigio-electron-server-plugin";
8
+ hooks: {
9
+ after: ({
10
+ matcher: (ctx: better_auth.HookEndpointContext) => boolean;
11
+ handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
12
+ status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
13
+ body: ({
14
+ message?: string;
15
+ code?: string;
16
+ cause?: unknown;
17
+ } & Record<string, any>) | undefined;
18
+ headers: HeadersInit;
19
+ statusCode: number;
20
+ name: string;
21
+ message: string;
22
+ stack?: string;
23
+ cause?: unknown;
24
+ } | undefined>;
25
+ } | {
26
+ matcher: (ctx: better_auth.HookEndpointContext) => boolean;
27
+ handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<void>;
28
+ })[];
29
+ };
30
+ endpoints: {
31
+ exchangeTicket: better_auth.StrictEndpoint<`/${string}`, {
32
+ method: "POST";
33
+ body: z.ZodObject<{
34
+ ticket: z.ZodString;
35
+ verifier: z.ZodString;
36
+ }, z.core.$strip>;
37
+ }, {
38
+ session: {
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ expiresAt: Date;
42
+ };
43
+ user: {
44
+ id: string;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ email: string;
48
+ emailVerified: boolean;
49
+ name: string;
50
+ image?: string | null | undefined;
51
+ };
52
+ }>;
53
+ fastTicket: better_auth.StrictEndpoint<`/${string}`, {
54
+ method: "POST";
55
+ body: z.ZodObject<{
56
+ scheme: z.ZodString;
57
+ provider: z.ZodEnum<{
58
+ [x: string]: string;
59
+ }>;
60
+ challenge: z.ZodString;
61
+ userid: z.ZodString;
62
+ }, z.core.$strip>;
63
+ requireHeaders: true;
64
+ use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
65
+ session: {
66
+ session: Record<string, any> & {
67
+ id: string;
68
+ createdAt: Date;
69
+ updatedAt: Date;
70
+ userId: string;
71
+ expiresAt: Date;
72
+ token: string;
73
+ ipAddress?: string | null | undefined;
74
+ userAgent?: string | null | undefined;
75
+ };
76
+ user: Record<string, any> & {
77
+ id: string;
78
+ createdAt: Date;
79
+ updatedAt: Date;
80
+ email: string;
81
+ emailVerified: boolean;
82
+ name: string;
83
+ image?: string | null | undefined;
84
+ };
85
+ };
86
+ }>)[];
87
+ }, {
88
+ redirect: string;
89
+ }>;
90
+ };
91
+ };
92
+
93
+ export { electronServerPlugin };