From 49985eb400eaecd60b1dae985657af03797bc9ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 08:16:43 +0000 Subject: [PATCH] Version Packages --- .changeset/big-lands-read.md | 5 --- .changeset/unified-error-handling.md | 44 ------------------------ packages/siwe-parser/CHANGELOG.md | 43 ++++++++++++++++++++++++ packages/siwe-parser/package.json | 2 +- packages/siwe/CHANGELOG.md | 50 ++++++++++++++++++++++++++++ packages/siwe/package.json | 2 +- 6 files changed, 95 insertions(+), 51 deletions(-) delete mode 100644 .changeset/big-lands-read.md delete mode 100644 .changeset/unified-error-handling.md diff --git a/.changeset/big-lands-read.md b/.changeset/big-lands-read.md deleted file mode 100644 index b73d3c9..0000000 --- a/.changeset/big-lands-read.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@signinwithethereum/siwe': patch ---- - -Cleanup: Lazy imports, improve error messages and logs diff --git a/.changeset/unified-error-handling.md b/.changeset/unified-error-handling.md deleted file mode 100644 index 461a9e9..0000000 --- a/.changeset/unified-error-handling.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -'@signinwithethereum/siwe': minor -'@signinwithethereum/siwe-parser': minor ---- - -Harden and unify error handling across the library - -**`SiweError` now extends `Error`** — Provides stack traces, works with `instanceof Error`, and integrates with error reporting tools (Sentry, etc.). The `type`, `expected`, and `received` fields are now `readonly`. - -**`SiweError.type` narrowed from `SiweErrorType | string` to `SiweErrorType`** — Enables exhaustive `switch`/`case` on error types without a default fallback. - -**`SiweResponse.error` narrowed from `SiweError | Error` to `SiweError`** — No more type narrowing needed when handling verification results. - -**`verify()` now throws `SiweError` directly** when `suppressExceptions` is `false` (the default). Previously it threw the entire `SiweResponse` object. Update catch blocks: - -```ts -// Before (v4.0): -try { - await msg.verify(params) -} catch (e) { - console.log(e.error.type) -} // e was SiweResponse - -// After (v4.1): -try { - await msg.verify(params) -} catch (e) { - if (e instanceof SiweError) { - console.log(e.type) // e is SiweError directly - } -} -``` - -**All error paths now throw `SiweError`** — Configuration errors (`createConfig`, `createEthersConfig`, `createViemConfig`), nonce generation, invalid verify params, and message preparation failures all throw typed `SiweError` instances instead of bare `Error`. - -**New `SiweErrorType` entries:** - -- `MISSING_CONFIG` — no verification config found -- `MISSING_PROVIDER_LIBRARY` — required provider library (viem/ethers) not installed -- `NONCE_GENERATION_FAILED` — nonce creation failed -- `INVALID_PARAMS` — invalid keys passed to `verify()` -- `MALFORMED_MESSAGE` — message could not be prepared for signing - -**`SiweParseError`** — New structured error class in `@signinwithethereum/siwe-parser` (and re-exported from `@signinwithethereum/siwe`) for parse failures, with an `errors: string[]` field containing individual validation errors. diff --git a/packages/siwe-parser/CHANGELOG.md b/packages/siwe-parser/CHANGELOG.md index dc02d2b..3a482b7 100644 --- a/packages/siwe-parser/CHANGELOG.md +++ b/packages/siwe-parser/CHANGELOG.md @@ -1,5 +1,48 @@ # @signinwithethereum/siwe-parser +## 4.1.0 + +### Minor Changes + +- [`f537bdb`](https://github.com/signinwithethereum/siwe/commit/f537bdb290effcfc2206a963009db4ebc911ea3c) Thanks [@jwahdatehagh](https://github.com/jwahdatehagh)! - Harden and unify error handling across the library + + **`SiweError` now extends `Error`** — Provides stack traces, works with `instanceof Error`, and integrates with error reporting tools (Sentry, etc.). The `type`, `expected`, and `received` fields are now `readonly`. + + **`SiweError.type` narrowed from `SiweErrorType | string` to `SiweErrorType`** — Enables exhaustive `switch`/`case` on error types without a default fallback. + + **`SiweResponse.error` narrowed from `SiweError | Error` to `SiweError`** — No more type narrowing needed when handling verification results. + + **`verify()` now throws `SiweError` directly** when `suppressExceptions` is `false` (the default). Previously it threw the entire `SiweResponse` object. Update catch blocks: + + ```ts + // Before (v4.0): + try { + await msg.verify(params) + } catch (e) { + console.log(e.error.type) + } // e was SiweResponse + + // After (v4.1): + try { + await msg.verify(params) + } catch (e) { + if (e instanceof SiweError) { + console.log(e.type) // e is SiweError directly + } + } + ``` + + **All error paths now throw `SiweError`** — Configuration errors (`createConfig`, `createEthersConfig`, `createViemConfig`), nonce generation, invalid verify params, and message preparation failures all throw typed `SiweError` instances instead of bare `Error`. + + **New `SiweErrorType` entries:** + - `MISSING_CONFIG` — no verification config found + - `MISSING_PROVIDER_LIBRARY` — required provider library (viem/ethers) not installed + - `NONCE_GENERATION_FAILED` — nonce creation failed + - `INVALID_PARAMS` — invalid keys passed to `verify()` + - `MALFORMED_MESSAGE` — message could not be prepared for signing + + **`SiweParseError`** — New structured error class in `@signinwithethereum/siwe-parser` (and re-exported from `@signinwithethereum/siwe`) for parse failures, with an `errors: string[]` field containing individual validation errors. + ## 4.0.2 ### Patch Changes diff --git a/packages/siwe-parser/package.json b/packages/siwe-parser/package.json index db8b153..869acea 100644 --- a/packages/siwe-parser/package.json +++ b/packages/siwe-parser/package.json @@ -1,6 +1,6 @@ { "name": "@signinwithethereum/siwe-parser", - "version": "4.0.2", + "version": "4.1.0", "type": "module", "description": "Parse Messages that conform to EIP-4361: Sign in with Ethereum (SIWE)", "main": "dist/parsers.cjs", diff --git a/packages/siwe/CHANGELOG.md b/packages/siwe/CHANGELOG.md index fc18bae..a1b0f06 100644 --- a/packages/siwe/CHANGELOG.md +++ b/packages/siwe/CHANGELOG.md @@ -1,5 +1,55 @@ # @signinwithethereum/siwe +## 4.1.0 + +### Minor Changes + +- [`f537bdb`](https://github.com/signinwithethereum/siwe/commit/f537bdb290effcfc2206a963009db4ebc911ea3c) Thanks [@jwahdatehagh](https://github.com/jwahdatehagh)! - Harden and unify error handling across the library + + **`SiweError` now extends `Error`** — Provides stack traces, works with `instanceof Error`, and integrates with error reporting tools (Sentry, etc.). The `type`, `expected`, and `received` fields are now `readonly`. + + **`SiweError.type` narrowed from `SiweErrorType | string` to `SiweErrorType`** — Enables exhaustive `switch`/`case` on error types without a default fallback. + + **`SiweResponse.error` narrowed from `SiweError | Error` to `SiweError`** — No more type narrowing needed when handling verification results. + + **`verify()` now throws `SiweError` directly** when `suppressExceptions` is `false` (the default). Previously it threw the entire `SiweResponse` object. Update catch blocks: + + ```ts + // Before (v4.0): + try { + await msg.verify(params) + } catch (e) { + console.log(e.error.type) + } // e was SiweResponse + + // After (v4.1): + try { + await msg.verify(params) + } catch (e) { + if (e instanceof SiweError) { + console.log(e.type) // e is SiweError directly + } + } + ``` + + **All error paths now throw `SiweError`** — Configuration errors (`createConfig`, `createEthersConfig`, `createViemConfig`), nonce generation, invalid verify params, and message preparation failures all throw typed `SiweError` instances instead of bare `Error`. + + **New `SiweErrorType` entries:** + - `MISSING_CONFIG` — no verification config found + - `MISSING_PROVIDER_LIBRARY` — required provider library (viem/ethers) not installed + - `NONCE_GENERATION_FAILED` — nonce creation failed + - `INVALID_PARAMS` — invalid keys passed to `verify()` + - `MALFORMED_MESSAGE` — message could not be prepared for signing + + **`SiweParseError`** — New structured error class in `@signinwithethereum/siwe-parser` (and re-exported from `@signinwithethereum/siwe`) for parse failures, with an `errors: string[]` field containing individual validation errors. + +### Patch Changes + +- [`60ada57`](https://github.com/signinwithethereum/siwe/commit/60ada5780b50e2b8a4cb9f422cc55bf456b62b99) Thanks [@jwahdatehagh](https://github.com/jwahdatehagh)! - Cleanup: Lazy imports, improve error messages and logs + +- Updated dependencies [[`f537bdb`](https://github.com/signinwithethereum/siwe/commit/f537bdb290effcfc2206a963009db4ebc911ea3c)]: + - @signinwithethereum/siwe-parser@4.1.0 + ## 4.0.3 ### Patch Changes diff --git a/packages/siwe/package.json b/packages/siwe/package.json index d55a783..3c38927 100644 --- a/packages/siwe/package.json +++ b/packages/siwe/package.json @@ -1,6 +1,6 @@ { "name": "@signinwithethereum/siwe", - "version": "4.0.3", + "version": "4.1.0", "type": "module", "description": "Sign in with Ethereum (SIWE)", "main": "dist/siwe.cjs",