-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from storyprotocol/add-wallet-tos-sign-message
add SIWE and ToS
- Loading branch information
Showing
6 changed files
with
81 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export async function getSignMessageRequest(walletAddress: `0x${string}`): Promise<{ signingMessage: string }> { | ||
try { | ||
const res = await fetch( | ||
`${process.env.NEXT_PUBLIC_API_BASE_URL}/platform/web3-sign/request?walletAddress=${walletAddress}`, | ||
); | ||
const data = await res.json(); | ||
console.log({ data }); | ||
return data; | ||
} catch (e) { | ||
throw new Error('Failed to get sign message request'); | ||
} | ||
} | ||
|
||
export async function verifySignature(signature: string, walletAddress: `0x${string}`) { | ||
try { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/platform/web3-sign/verify`, { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
signature, | ||
walletAddress, | ||
}), | ||
}); | ||
const response = await res.json(); | ||
return response; | ||
} catch (e) { | ||
throw new Error('Failed to verify signature'); | ||
} | ||
} |
Binary file not shown.