Releases: signinwithethereum/siwe
@signinwithethereum/siwe@4.1.0
Minor Changes
-
f537bdbThanks @jwahdatehagh! - Harden and unify error handling across the librarySiweErrornow extendsError— Provides stack traces, works withinstanceof Error, and integrates with error reporting tools (Sentry, etc.). Thetype,expected, andreceivedfields are nowreadonly.SiweError.typenarrowed fromSiweErrorType | stringtoSiweErrorType— Enables exhaustiveswitch/caseon error types without a default fallback.SiweResponse.errornarrowed fromSiweError | ErrortoSiweError— No more type narrowing needed when handling verification results.verify()now throwsSiweErrordirectly whensuppressExceptionsisfalse(the default). Previously it threw the entireSiweResponseobject. Update catch blocks:// 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 typedSiweErrorinstances instead of bareError.New
SiweErrorTypeentries:MISSING_CONFIG— no verification config foundMISSING_PROVIDER_LIBRARY— required provider library (viem/ethers) not installedNONCE_GENERATION_FAILED— nonce creation failedINVALID_PARAMS— invalid keys passed toverify()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 anerrors: string[]field containing individual validation errors.
Patch Changes
-
60ada57Thanks @jwahdatehagh! - Cleanup: Lazy imports, improve error messages and logs -
Updated dependencies [
f537bdb]:- @signinwithethereum/siwe-parser@4.1.0
@signinwithethereum/siwe@4.0.3
Patch Changes
- Updated dependencies [
8c80434]:- @signinwithethereum/siwe-parser@4.0.2
@signinwithethereum/siwe@4.0.2
Patch Changes
abe85a2Thanks @jwahdatehagh! - Remove hard ethers dependency (dynamically check ethers installation to mirror viem detection)
@signinwithethereum/siwe-parser@4.1.0
Minor Changes
-
f537bdbThanks @jwahdatehagh! - Harden and unify error handling across the librarySiweErrornow extendsError— Provides stack traces, works withinstanceof Error, and integrates with error reporting tools (Sentry, etc.). Thetype,expected, andreceivedfields are nowreadonly.SiweError.typenarrowed fromSiweErrorType | stringtoSiweErrorType— Enables exhaustiveswitch/caseon error types without a default fallback.SiweResponse.errornarrowed fromSiweError | ErrortoSiweError— No more type narrowing needed when handling verification results.verify()now throwsSiweErrordirectly whensuppressExceptionsisfalse(the default). Previously it threw the entireSiweResponseobject. Update catch blocks:// 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 typedSiweErrorinstances instead of bareError.New
SiweErrorTypeentries:MISSING_CONFIG— no verification config foundMISSING_PROVIDER_LIBRARY— required provider library (viem/ethers) not installedNONCE_GENERATION_FAILED— nonce creation failedINVALID_PARAMS— invalid keys passed toverify()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 anerrors: string[]field containing individual validation errors.
@signinwithethereum/siwe-parser@4.0.2
Patch Changes
8c80434Thanks @jwahdatehagh! - Fix esm issue: include apg-js.
@signinwithethereum/siwe@4.0.1
Patch Changes
-
a0d0277Thanks @jwahdatehagh! - Add readme -
Updated dependencies [
a0d0277]:- @signinwithethereum/siwe-parser@4.0.1
@signinwithethereum/siwe@4.0.0
Major Changes
-
8e37765Thanks @jwahdatehagh! - ERC-4361 compliance hardening:domainandnonceare now required inVerifyParams, newstrictmode inVerifyOptsthat additionally requiresuriandchainIdfor full contextual binding. Added new error types:URI_MISMATCH,CHAIN_ID_MISMATCH,REQUEST_ID_MISMATCH,INVALID_SIGNATURE_CHAIN_ID,MISSING_DOMAIN,MISSING_NONCE,MISSING_URI,MISSING_CHAIN_ID -
8e37765Thanks @jwahdatehagh! - Add provider-agnostic verification architecture: newSiweConfiginterface,configure()/getGlobalConfig()global config API,createEthersConfig()adapter for ethers v5/v6, andcreateViemConfig()adapter for viem — decoupling signature verification from any specific Ethereum library
Minor Changes
-
8e37765Thanks @jwahdatehagh! - Ship dual ESM/CJS builds via Vite with properexportsmap — packages are now"type": "module"with.mjsand.cjsentry points -
03b3069Thanks @jwahdatehagh! - Updrage libraries (typescript, eslint, typedoc, vite, vitest, ...). Replace@stablelib/randomwithcrypto.getRandomValues()to eliminate Node.js dependency for nonce generation. -
8e37765Thanks @jwahdatehagh! - Addviemas an optional peer dependency alongsideethers— either library can now be used for signature verification viacreateViemConfig()orcreateEthersConfig()
Patch Changes
-
10bb2f1Thanks @jwahdatehagh! - Fixes for open issues on the upstream spruceid/siwe repository:Verification & validation bugs:
- spruceid/siwe#216: Multisig wallet signatures fail with
invalid raw signature length— fixed by catching malformed signature errors and falling through to EIP-1271 contract wallet verification without logging
Ethers v5/v6 compatibility:
- spruceid/siwe#214: Ethers v5 types shipped while v6 installed — fixed with runtime auto-detection, no compile-time coupling to either version
Bundler & environment compatibility:
- spruceid/siwe#136: Drop native node
BufferAPI dependency — fixed; noBufferusage anywhere in source code - spruceid/siwe#150:
@stablelib/randomintroduces node dependencies (crypto,buffer) — fixed by replacing with nativecrypto.getRandomValues()for nonce generation - spruceid/siwe#167: Can't resolve
neterror withSiweMessage— fixed; ethers is an optional peer dependency, no hard import at the top level - spruceid/siwe#189: Module parse failed with
import/exportin Next.js — fixed with dual ESM/CJS builds and properexportsmap in package.json - spruceid/siwe#176:
isEIP55Addressnot a function due to parser version mismatch — fixed withworkspace:^dependency linking ensuring matching versions
Architecture & extensibility:
- spruceid/siwe#151: Move ethers from peerDependency to dependency — resolved differently: both ethers and viem are optional peer dependencies; the library works with any crypto backend via the
SiweConfiginterface - spruceid/siwe#172:
console.erroron invalid signature breaks custom logging flows — fixed; zeroconsole.error/log/warncalls in source - spruceid/siwe#173: Viem support — fixed with full
viemAdapter.tsprovidingcreateViemConfig()with EIP-1271 and EIP-6492 support - spruceid/siwe#180: Allow simpler configuration via plain RPC URL — fixed with
createConfig(rpcUrl)that auto-detects viem or ethers
Smart contract wallet support:
- spruceid/siwe#148: SIWE doesn't work with ERC-4337 (pre-deployed contracts) — fixed with EIP-6492 support. Viem adapter uses
publicClient.verifyMessagefor native support; ethers adapter uses the UniversalSigValidator bytecode viaeth_call - spruceid/siwe#185:
siwe-parsercrashes on iOS 14 due toArray.prototypepollution from polyfills — fixed by usingObject.create(null)for parser callbacks to prevent prototype pollution breakingfor...initeration in apg-js
- spruceid/siwe#216: Multisig wallet signatures fail with
-
8e37765Thanks @jwahdatehagh! - Fix domain validation in SiweMessage constructor, fix signature verification flow, add EIP-1271 chain ID validation to prevent cross-chain replay, and stop logging errors internally (let consumers handle them) -
Updated dependencies [
8e37765,03b3069,8e37765,10bb2f1]:- @signinwithethereum/siwe-parser@4.0.0
@signinwithethereum/siwe-parser@4.0.1
Patch Changes
a0d0277Thanks @jwahdatehagh! - Add readme
@signinwithethereum/siwe-parser@4.0.0
Major Changes
8e37765Thanks @jwahdatehagh! - Ship dual ESM/CJS builds via Vite with properexportsmap — packages are now"type": "module"with.mjsand.cjsentry points
Minor Changes
03b3069Thanks @jwahdatehagh! - Updrage libraries (typescript, eslint, typedoc, vite, vitest, ...). Replace@stablelib/randomwithcrypto.getRandomValues()to eliminate Node.js dependency for nonce generation.
Patch Changes
-
8e37765Thanks @jwahdatehagh! - Refactor parser internals: inline ABNF module into parsers.ts, consolidate duplicatedisValidISO8601Dateinto utils.ts and re-export it, fix ISO-8601 regex (escape dot in fractional seconds, fix sign character class) -
10bb2f1Thanks @jwahdatehagh! - Fixes for open issues on the upstream spruceid/siwe repository:Verification & validation bugs:
- spruceid/siwe#216: Multisig wallet signatures fail with
invalid raw signature length— fixed by catching malformed signature errors and falling through to EIP-1271 contract wallet verification without logging
Ethers v5/v6 compatibility:
- spruceid/siwe#214: Ethers v5 types shipped while v6 installed — fixed with runtime auto-detection, no compile-time coupling to either version
Bundler & environment compatibility:
- spruceid/siwe#136: Drop native node
BufferAPI dependency — fixed; noBufferusage anywhere in source code - spruceid/siwe#150:
@stablelib/randomintroduces node dependencies (crypto,buffer) — fixed by replacing with nativecrypto.getRandomValues()for nonce generation - spruceid/siwe#167: Can't resolve
neterror withSiweMessage— fixed; ethers is an optional peer dependency, no hard import at the top level - spruceid/siwe#189: Module parse failed with
import/exportin Next.js — fixed with dual ESM/CJS builds and properexportsmap in package.json - spruceid/siwe#176:
isEIP55Addressnot a function due to parser version mismatch — fixed withworkspace:^dependency linking ensuring matching versions
Architecture & extensibility:
- spruceid/siwe#151: Move ethers from peerDependency to dependency — resolved differently: both ethers and viem are optional peer dependencies; the library works with any crypto backend via the
SiweConfiginterface - spruceid/siwe#172:
console.erroron invalid signature breaks custom logging flows — fixed; zeroconsole.error/log/warncalls in source - spruceid/siwe#173: Viem support — fixed with full
viemAdapter.tsprovidingcreateViemConfig()with EIP-1271 and EIP-6492 support - spruceid/siwe#180: Allow simpler configuration via plain RPC URL — fixed with
createConfig(rpcUrl)that auto-detects viem or ethers
Smart contract wallet support:
- spruceid/siwe#148: SIWE doesn't work with ERC-4337 (pre-deployed contracts) — fixed with EIP-6492 support. Viem adapter uses
publicClient.verifyMessagefor native support; ethers adapter uses the UniversalSigValidator bytecode viaeth_call - spruceid/siwe#185:
siwe-parsercrashes on iOS 14 due toArray.prototypepollution from polyfills — fixed by usingObject.create(null)for parser callbacks to prevent prototype pollution breakingfor...initeration in apg-js
- spruceid/siwe#216: Multisig wallet signatures fail with