# @signinwithethereum/siwe-parser

> Parse Messages that conform to EIP-4361: Sign in with Ethereum (SIWE)

Latest version **4.2.1** (published 2026-09-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @signinwithethereum/siwe-parser
pnpm add @signinwithethereum/siwe-parser
yarn add @signinwithethereum/siwe-parser
bun add @signinwithethereum/siwe-parser
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.2.1 |
| Published | 2026-09-01 |
| First published | 2026-03-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 128.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Ethereum Identity Foundation |
| Maintainers | brantlyefp, jwahdatehagh |
| Keywords | ethereum, sign-in, sign-in-with-ethereum, siwe, siwe-parser, sign-in-with-ethereum-parser |

## Links

- npm: https://www.npmjs.com/package/@signinwithethereum/siwe-parser
- Repository: https://github.com/signinwithethereum/siwe
- Issues: https://github.com/signinwithethereum/siwe/issues
- npm.io page: https://npm.io/package/@signinwithethereum/siwe-parser

## Dependencies (2)

- [apg-js](https://npm.io/package/apg-js.md) ^4.4.0
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^1.7.0

## Recent versions

- 4.2.1 (latest) — 2026-09-01
- 4.2.0 — 2026-04-13
- 4.1.0 — 2026-03-24
- 4.0.2 — 2026-03-24
- 4.0.1 — 2026-03-23
- 4.0.0 — 2026-03-23

## README

# @signinwithethereum/siwe-parser

A parser for [EIP-4361: Sign in with Ethereum](https://eips.ethereum.org/EIPS/eip-4361) messages, using an ABNF grammar for strict specification compliance.

## Installation

```bash
npm install @signinwithethereum/siwe-parser
```

## Usage

### Parsing a SIWE message

```typescript
import { ParsedMessage } from '@signinwithethereum/siwe-parser'

const message = new ParsedMessage(rawMessage)

console.log(message.domain)
console.log(message.address)
console.log(message.uri)
console.log(message.version)
console.log(message.chainId)
console.log(message.nonce)
console.log(message.issuedAt)
```

The constructor throws if the message does not conform to EIP-4361.

### Validating a URI

```typescript
import { isUri } from '@signinwithethereum/siwe-parser'

isUri('https://example.com') // true
```

### Utilities

```typescript
import {
  isEIP55Address,
  isValidISO8601Date,
} from '@signinwithethereum/siwe-parser'

isEIP55Address('0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B') // true
isValidISO8601Date('2024-01-01T00:00:00Z') // true
```

## Parsed Fields

| Field            | Type       | Required |
| ---------------- | ---------- | -------- |
| `domain`         | `string`   | Yes      |
| `address`        | `string`   | Yes      |
| `uri`            | `string`   | Yes      |
| `version`        | `string`   | Yes      |
| `chainId`        | `number`   | Yes      |
| `nonce`          | `string`   | Yes      |
| `issuedAt`       | `string`   | Yes      |
| `scheme`         | `string`   | No       |
| `statement`      | `string`   | No       |
| `expirationTime` | `string`   | No       |
| `notBefore`      | `string`   | No       |
| `requestId`      | `string`   | No       |
| `resources`      | `string[]` | No       |

## Related

For full SIWE message creation, signing, and verification (including ERC-1271 and EIP-6492 support), use [`@signinwithethereum/siwe`](https://www.npmjs.com/package/@signinwithethereum/siwe) which includes this parser.

## Disclaimer

Our TypeScript library for Sign In with Ethereum has not yet undergone a formal security
audit. We welcome continued feedback on the usability, architecture, and security
of this implementation.

---
_Source: https://npm.io/package/@signinwithethereum/siwe-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
