Skip to content

Commit

Permalink
fix: update the rest of sign in functionality to use Siwe message object
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-may committed Jan 11, 2023
1 parent 14d23c7 commit dda202c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/useSignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type MessageArgs = {
nonce: string,
};
type VerifyArgs = {
message: string,
message: SiweMessage,
signature: string,
};

Expand Down Expand Up @@ -52,9 +52,9 @@ export const useSignIn = ({ onSuccess, onError }: UseSignInOptions = {}) => {

const { mutate, mutateAsync, ...rest } = useMutation(
async () => {
const rawMessage = createMessage({ address, chainId: chain.id, nonce });
const message = getMessageBody({ message: rawMessage });
const signature = await signMessageAsync({ message });
const message = createMessage({ address, chainId: chain.id, nonce });
const messageBody = getMessageBody({ message: message });
const signature = await signMessageAsync({ message: messageBody });
const result = await verify({ message, signature }, options);
if (!result) throw new Error("Verification Failed");
},
Expand Down

0 comments on commit dda202c

Please sign in to comment.