Skip to content

Add basic SIWE message construction helper #419

Description

@Lakes41

Difficulty: Intermediate
Type: Feature
Recommended labels (if available in this repo): enhancement, auth, sdk

Background

The roadmap notes a planned 'SIWE (Sign-In with Ethereum) signature helper.' guildpass-integrations already implements SIWE (EIP-4361) admin authentication client-side, but duplicates message construction logic locally instead of using a shared SDK helper.

Problem

There is no shared, tested SIWE message-building utility in the SDK, so each consumer (dashboard, mobile) has to hand-roll EIP-4361 message formatting, risking inconsistent or malformed messages across apps.

Expected Outcome

A createSiweMessage(params) helper in the SDK that builds a spec-compliant EIP-4361 message string given domain, address, statement, uri, version, chainId, and nonce.

Suggested Implementation

Add a new src/auth/siwe.ts module (or extend src/eip712/ if preferred, though SIWE is a plain-text message spec, not EIP-712 typed data) implementing message construction per EIP-4361's field ordering and formatting rules. Keep signature verification out of scope for this issue — this is message construction only.

Acceptance Criteria

  • createSiweMessage() produces output matching the EIP-4361 message format exactly (field order and formatting)
  • Function is fully typed with a SiweMessageParams interface
  • Unit tests cover required fields, optional fields (statement, resources), and nonce inclusion
  • pnpm test:run and pnpm typecheck pass

Likely Affected Files/Directories

  • src/auth/siwe.ts
  • src/eip712/eip712.types.ts

Metadata

Metadata

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewards

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions