Skip to content

replace Math.random() nonce with crypto.randomUUID() in Wagmi integration example#1391

Open
weirdDevelop wants to merge 2 commits intobase:masterfrom
weirdDevelop:fix/secure-nonce-wagmi-example
Open

replace Math.random() nonce with crypto.randomUUID() in Wagmi integration example#1391
weirdDevelop wants to merge 2 commits intobase:masterfrom
weirdDevelop:fix/secure-nonce-wagmi-example

Conversation

@weirdDevelop
Copy link
Copy Markdown

Fixes #1390

The Wagmi integration setup guide uses Math.random() to generate a SIWE nonce. This is not cryptographically secure — Math.random() values can be predicted and should never be used for security-sensitive parameters.

This replaces it with window.crypto.randomUUID().replace(/-/g, ''), which is already the recommended approach in the authenticate-users guide — this brings the Wagmi integration into alignment.

سجاد موحدي added 2 commits May 4, 2026 14:26
…builder-codes

Fixes base#1313 - The JSON response example had a trailing comma which is invalid JSON syntax.
  Math.random() is not cryptographically secure and should not
  be used for SIWE nonces. Replaces with window.crypto.randomUUID()
  to match the approach already used in the authenticate-users guide.

  Fixes base#1390
@cb-heimdall
Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/2
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(docs): replace Math.random() nonce with crypto.randomUUID() in Wagmi integration example

2 participants