better-auth
Version:
The most comprehensive authentication framework for TypeScript.
71 lines • 2.29 kB
text/typescript
import { InferOptionSchema } from "../../types/plugins.mjs";
import "../../types/index.mjs";
import { WalletAddressSchema, schema } from "./schema.mjs";
import { ENSLookupArgs, ENSLookupResult, SIWEVerifyMessageArgs } from "./types.mjs";
import * as z from "zod";
//#region src/plugins/siwe/index.d.ts
declare module "@better-auth/core" {
interface BetterAuthPluginRegistry<AuthOptions, Options> {
siwe: {
creator: typeof siwe;
};
}
}
interface SIWEPluginOptions {
domain: string;
emailDomainName?: string | undefined;
anonymous?: boolean | undefined;
getNonce: () => Promise<string>;
verifyMessage: (args: SIWEVerifyMessageArgs) => Promise<boolean>;
ensLookup?: ((args: ENSLookupArgs) => Promise<ENSLookupResult>) | undefined;
schema?: InferOptionSchema<typeof schema> | undefined;
}
declare const siwe: (options: SIWEPluginOptions) => {
id: "siwe";
version: string;
schema: WalletAddressSchema;
endpoints: {
getSiweNonce: import("better-call").StrictEndpoint<"/siwe/nonce" | "/siwe/get-nonce", {
method: "POST";
body: z.ZodObject<{
walletAddress: z.ZodOptional<z.ZodString>;
address: z.ZodOptional<z.ZodString>;
chainId: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
}, z.core.$strip>;
}, {
nonce: string;
}>;
getNonce: import("better-call").StrictEndpoint<"/siwe/nonce" | "/siwe/get-nonce", {
method: "POST";
body: z.ZodObject<{
walletAddress: z.ZodOptional<z.ZodString>;
address: z.ZodOptional<z.ZodString>;
chainId: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
}, z.core.$strip>;
}, {
nonce: string;
}>;
verifySiweMessage: import("better-call").StrictEndpoint<"/siwe/verify", {
method: "POST";
body: z.ZodObject<{
message: z.ZodString;
signature: z.ZodString;
walletAddress: z.ZodString;
chainId: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
email: z.ZodOptional<z.ZodEmail>;
}, z.core.$strip>;
requireRequest: true;
}, {
token: string;
success: boolean;
user: {
id: string;
walletAddress: string;
chainId: number;
};
}>;
};
options: SIWEPluginOptions;
};
//#endregion
export { SIWEPluginOptions, siwe };