Skip to content

Commit

Permalink
refactor: adapt the rest of the code
Browse files Browse the repository at this point in the history
  • Loading branch information
dalechyn committed Sep 25, 2024
1 parent a8aef0a commit 74d7213
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion examples/frontend-only/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const config = {
function App() {
return (
<main style={{ fontFamily: 'Inter, "Inter Placeholder", sans-serif' }}>
{/* @ts-expect-error ethers version type incompat */}
<AuthKitProvider config={config}>
<div style={{ position: "fixed", top: "12px", right: "12px" }}>
<SignInButton />
Expand Down
10 changes: 5 additions & 5 deletions examples/with-next-auth/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ export default (req: NextApiRequest, res: NextApiResponse) =>
ethereum: viemConnector(),
});

try {
const verifyResponse = await appClient.verifySignInMessage({
message: credentials?.message as string,
signature: credentials?.signature as `0x${string}`,
domain: "example.com",
nonce: csrfToken,
});
const { success, fid } = verifyResponse;

if (!success) {
return null;
}
const { fid } = verifyResponse;

return {
id: fid.toString(),
name: credentials?.name,
image: credentials?.pfp,
};
} catch {
return null;
}
},
}),
],
Expand Down
3 changes: 1 addition & 2 deletions packages/auth-kit/src/hooks/useVerifySignInMessage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useCallback, useEffect, useState } from "react";
import { AuthClientError } from "@farcaster/auth-client";
import useAppClient from "./useAppClient";
import { parseSiweMessage, type SiweMessage } from "viem/siwe";

export interface UseVerifySignInMessageArgs {
nonce?: string;
Expand Down Expand Up @@ -46,7 +45,7 @@ export function useVerifySignInMessage({
await appClient.verifySignInMessage({
nonce,
domain,
message: parseSiweMessage(message) as SiweMessage,
message,
signature,
});
setValidSignature(true);
Expand Down

0 comments on commit 74d7213

Please sign in to comment.