Skip to content

fix: SIWE nonce passthrough from SDK config#43

Merged
skgbafa merged 1 commit into
mainfrom
fix/siwe-nonce-passthrough
Apr 9, 2026
Merged

fix: SIWE nonce passthrough from SDK config#43
skgbafa merged 1 commit into
mainfrom
fix/siwe-nonce-passthrough

Conversation

@skgbafa
Copy link
Copy Markdown
Contributor

@skgbafa skgbafa commented Apr 9, 2026

Summary

  • Bug: When the web SDK passes a nonce via siweConfig: { nonce }, the Rust WASM layer silently drops it because SessionConfig has no nonce field (serde discards unknown fields) and into_message() hardcodes nonce: generate_nonce() — always creating a random one.
  • Fix: Added an optional nonce field to SessionConfig and changed the SIWE message construction to use self.nonce.unwrap_or_else(generate_nonce), so a caller-provided nonce is respected while falling back to random generation when none is provided.

Test plan

  • cargo check -p tinycloud-sdk-wasm passes with no errors
  • Existing tests continue to pass (no nonce provided = random nonce, same behavior as before)
  • Web SDK can pass siweConfig: { nonce: "server-issued-nonce" } and verify it appears in the SIWE message

@skgbafa skgbafa merged commit e044968 into main Apr 9, 2026
13 of 14 checks passed
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.

1 participant