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

@dbeauyat/sessions

v1.0.4

Published

Gestion de sessions authentifiées stockées dans Redis, avec expiration automatique à 30 minutes via JSON documents et un TTL configuré par clé.

Readme

@dbeauyat/sessions

Gestion de sessions authentifiées stockées dans Redis, avec expiration automatique à 30 minutes via JSON documents et un TTL configuré par clé.

npm version

Install

npm install @dbeauyat/sessions

API

createSession(username)

Crée une nouvelle session avec un identifiant aléatoire, enregistre la date de début et rafraîchit le TTL à 30 minutes.

Paramètres :

  • username (string) — nom d'utilisateur associé à la session

Retourne : Promise<{ success: true, sessionId: string }>

retrieveSession(sessionId)

Récupère les données complètes d'une session depuis Redis.

Paramètres :

  • sessionId (string) — identifiant unique de la session

Retourne : Promise<{ startDate: string, lastAccess: string, contenuValide: Record<string, any> } | null>

verifySession(sessionId)

Vérifie l'existence d'une session dans Redis.

Paramètres :

  • sessionId (string) — identifiant unique de la session

Retourne : Promise<{ valid: boolean, reason?: string }>

updateSession(sessionId, updates)

Met à jour un ou plusieurs champs de l'objet contenuValide d'une session et rafraîchit le TTL.

Paramètres :

  • sessionId (string) — identifiant unique de la session
  • updates (object) — objet contenant les champs et valeurs à mettre à jour dans contenuValide

Retourne : Promise<{ success: true }>

refreshSession(sessionId)

Met à jour le timestamp lastAccess et réinitialise le TTL de la session à 30 minutes.

Paramètres :

  • sessionId (string) — identifiant unique de la session

Retourne : Promise<{ success: true, lastAccess: string }>

deleteSession(sessionId)

Supprime une session de Redis en utilisant JSON.DEL.

Paramètres :

  • sessionId (string) — identifiant unique de la session à supprimer

Retourne : Promise<{ success: true }>

Configuration

Le fichier de configuration config.json5 définit les paramètres du serveur :

{
  "brokerUrl": "mqtt://127.0.0.1:1883",
  "listenTopic": "auth/nouvelle-demande",
  "qos": 1,
  "clientId": "SIGSDID-AUTH-SERVER",
  "DBs": {
    "redis": {
      "host": "127.0.0.1",
      "port": 6379,
      "username": "default",
      "password": ""
    }
  }
}

Architecture

Les sessions sont stockées sous forme de documents JSON dans Redis avec le pattern de clé sigsdid:ba:sessions:{sessionId}. Chaque session dispose d'un TTL de 30 minutes (1800 secondes) géré via la commande JSON.SET et EXPIRE.

Technologies utilisées

  • argon2 — hachage sécurisé des mots de passe
  • ioredis — client Redis asynchrone pour Node.js
  • moment — gestion des dates (locale française configurée par défaut)
  • nanoid — génération d'identifiants uniques cryptographiquement sécurisés
  • require-json5 — chargement de fichiers de configuration JSONC/JSON5

Scripts npm

| Commande | Description | |----------|-------------| | npm test | Lance les tests (à implémenter) | | npm run release:local | Crée une nouvelle version mineure et publie localement | | npm run release:public | Crée une nouvelle version mineure et publie sur npmjs.org |

Licence

ISC — © 2026 Daniel Beauyat