Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/base-account/framework-integrations/wagmi/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ export function SignInWithBase({ connector }: SignInWithBaseProps) {
if (provider) {
try {
// Generate a fresh nonce (this will be overwritten with the backend nonce)
const clientNonce =
Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15);
const clientNonce = crypto.randomUUID();
console.log("clientNonce", clientNonce);
// Connect with SIWE to get signature, message, and address
const accounts = await (provider as any).request({
Expand Down
3 changes: 2 additions & 1 deletion docs/base-account/guides/sign-and-verify-typed-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export async function verifyTypedData(req, res) {
## Example Express Server

```ts title="server/typed-data.ts"
import crypto from 'crypto';
import express from 'express';
import { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';
Expand All @@ -190,7 +191,7 @@ const usedNonces = new Set<string>();
app.get('/typed-data/prepare', (req, res) => {
const { userAddress, action, resource } = req.query;

const nonce = Math.floor(Math.random() * 1000000);
const nonce = crypto.randomInt(1_000_000);
const expiry = Math.floor(Date.now() / 1000) + 3600; // 1 hour

const typedData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ const handleSignInWithSIWE = async () => {
address: account,
chainId: base.id,
domain: window.location.host,
nonce: Math.random().toString(36).substring(7),
nonce: crypto.randomUUID(),
uri: window.location.origin,
version: '1',
statement: 'Sign in to MyApp with your Base Account'
Expand Down