npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@valve-tech/siwe-store-redis

v0.24.1

Published

Redis-backed SIWE nonce + session stores implementing @valve-tech/siwe-store's async contracts (AsyncNonceStore / AsyncSessionStore). Single-use nonce consume is atomic (Redis DEL), TTLs are enforced server-side by Redis expiry, and sessions are opaque CS

Readme

@valve-tech/siwe-store-redis

Redis-backed SIWE nonce + session stores — the production counterpart to @valve-tech/siwe-store's in-memory defaults, implementing its AsyncNonceStore / AsyncSessionStore contracts.

Why this exists

@valve-tech/siwe-store's in-memory stores reset on restart and don't share state across processes. The moment you run two server replicas — or just restart one — nonces issued by one process must be consumable by another, and sessions must survive a deploy. That's Redis's job:

  • Nonces are single-use by Redis DEL atomicity — exactly one of two concurrent consume calls wins, the same delete-before-TTL-check guarantee as the in-memory store, enforced by the server instead of process memory.
  • Sessions are opaque CSPRNG tokens keying a JSON payload bound to an address. TTLs are Redis expiry (SET … PX) — nothing re-checks clocks client-side.

Install

yarn add @valve-tech/siwe-store-redis @valve-tech/siwe-store
# plus your Redis client of choice, e.g.
yarn add redis      # or: yarn add ioredis

Quick start

import { createClient } from 'redis'
import {
  createRedisNonceStore,
  createRedisSessionStore,
  fromNodeRedisV5,
} from '@valve-tech/siwe-store-redis'

const redis = createClient({ url: process.env.REDIS_URL })
await redis.connect()

const client = fromNodeRedisV5(redis)
const nonces = createRedisNonceStore({ client })
const sessions = createRedisSessionStore({ client })

// SIWE flow — same shape as the in-memory stores, just awaited:
const nonce = await nonces.issue()
// … client signs the SIWE message carrying `nonce` …
if (!(await nonces.consume(nonce))) throw new Error('replay or expired')
const token = await sessions.issue(address, { role: 'member' })
// … later, per request:
const session = await sessions.validate(token) // Session | null
await sessions.revoke(token) // sign-out

Bring your own client

The stores type against a three-command structural surface, RedisClientLike (set with PX, get, del) — this package imports no Redis library and has zero runtime dependencies.

| Client | How to pass it | |---|---| | node-redis v4 | Pass the client directly — it matches RedisClientLike | | node-redis v5 | fromNodeRedisV5(client) (v5 moved TTL under expiration) | | ioredis | fromIoRedis(client) (positional 'PX', ms args) | | anything else | Implement the three methods of RedisClientLike |

The one behavioral requirement: set must apply options.PX as a server-side TTL. The stores treat Redis expiry as the single source of truth.

API

createRedisNonceStore({ client, ttlSeconds?, keyPrefix? }): AsyncNonceStore

ttlSeconds defaults to 300 (5 minutes), keyPrefix to 'siwe:nonce:'. issue() generates a viem/siwe nonce; consume() resolves true exactly once per issued, unexpired nonce.

createRedisSessionStore({ client, ttlMs?, keyPrefix? }): AsyncSessionStore

ttlMs defaults to 1_800_000 (30 minutes), keyPrefix to 'siwe:session:'. Claims must be JSON-serializable — they cross the Redis boundary as JSON.stringify output, so hex-encode any bigint chain values first. A corrupt or non-session payload validates to null, never a crash.

Relationship to @valve-tech/siwe-store

The interfaces (AsyncNonceStore, AsyncSessionStore, Session) live in @valve-tech/siwe-store — it stays the single contract both in-memory and Redis implementations satisfy. Handler code that only ever awaits store results can accept either backend via its AnyNonceStore / AnySessionStore unions.

For AI agents

This package ships an integration skill at skills/siwe-store-redis-integration/SKILL.md (installable via npx @valve-tech/agent-skills), plus an AGENTS.md quick reference.

License

MIT