-
Notifications
You must be signed in to change notification settings - Fork 178
Closed
Description
Background
现在登录之后,往往会接着一次签名。是否可以做成一个配置项,在 connected 之后可以自动签名。
Proposal
目前想法可以参考 ConnectKit,它是设置了一个新的 Provider,然后在外面套了这一层内容
type SIWEConfig = {
// Required
getNonce: () => Promise<string>;
createMessage: (args: { nonce: string; address: string; chainId: number }) => string;
verifyMessage: (args: { message: string; signature: string }) => Promise<boolean>;
getSession: () => Promise<SIWESession | null>;
signOut: () => Promise<boolean>;
// Optional
enabled?: boolean; // defaults true
nonceRefetchInterval?: number; // in milliseconds, defaults to 5 minutes
sessionRefetchInterval?: number; // in milliseconds, defaults to 5 minutes
signOutOnDisconnect?: boolean; // defaults true
signOutOnAccountChange?: boolean; // defaults true
signOutOnNetworkChange?: boolean; // defaults true
onSignIn?: (session?: SIWESession) => void;
onSignOut?: () => void;
};
需要考虑的是:1. 需要支持哪些;2. 执行的时机
Additional context
https://docs.family.co/connectkit/auth-with-custom-backend#siwe-custom-implementation
Metadata
Metadata
Assignees
Labels
No labels