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

@visiion/dci-registry-core

v1.0.5

Published

NestJS library implementing DCI Registry Core API v1.0.0

Readme

@visiion/dci-registry-core

Librería NestJS que implementa la DCI Registry Core API v1.0.0.

Instalación

npm install @visiion/dci-registry-core

Uso en una app NestJS

1. Registrar el módulo

import { Module } from '@nestjs/common';
import { DciRegistryCoreModule } from '@visiion/dci-registry-core';
import { MySearchHandler } from './handlers/my-search.handler';

@Module({
  imports: [
    DciRegistryCoreModule.register({
      version: '1.0.0',
      strictHeaderValidation: true,
      strictMessageValidation: true,
      crypto: {
        enableSignatureVerification: true,
        algorithm: 'ed25519',
        clockSkewSeconds: 60,
        publicKeyResolver: async (senderId: string, kidId?: string) => {
          // Resolver la clave pública del sender (ej: desde BD, JWKS, etc.)
          return fetchPublicKey(senderId, kidId);
        },
      },
      encryption: {
        enableEncryptionSupport: false,
        decrypt: async () => ({}),
        encrypt: async (p) => p,
      },
      observability: {
        logger: console,
      },
      handlers: {
        search: MySearchHandler,
        onSearch: MyOnSearchHandler,
        syncSearch: MySyncSearchHandler,
        // ... resto de handlers
      },
    }),
  ],
})
export class AppModule {}

2. Implementar handlers

Cada API consumidora debe implementar los handlers que use:

// my-search.handler.ts
import { Injectable } from '@nestjs/common';
import type { SearchHandler } from '@visiion/dci-registry-core';
import type { SearchRequestDto } from '@visiion/dci-registry-core';

@Injectable()
export class MySearchHandler implements SearchHandler {
  async handleSearch(request, header, rawEnvelope) {
    // Lógica de negocio: validar, buscar en BD, etc.
    // Para async: devolver ACK (o void para ACK por defecto)
    return { status: 'ACK', message_id: header.message_id };
  }
}

3. Ejemplo de controller funcionando

Tras registrar el módulo, los endpoints quedan expuestos automáticamente:

  • Async: POST /registry/search, POST /registry/on-search, POST /registry/subscribe, etc.
  • Sync: POST /registry/sync/search, POST /registry/sync/txn/status
// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();

Checklist: qué debe implementar cada API

| Rol | Endpoints a implementar | Handlers requeridos | |-------|-------------------------|--------------------------| | SR | /registry/search, /registry/txn/status, /registry/sync/search, /registry/sync/txn/status | search, txnStatus, syncSearch, syncTxnStatus | | SPMIS | /registry/on-search, /registry/on-subscribe, /registry/on-unsubscribe, /registry/txn/on-status | onSearch, onSubscribe, onUnsubscribe, txnOnStatus | | Ambos | subscribe, unsubscribe, notify | subscribe, unsubscribe, notify |

Assumptions

  1. Digest del body: Se asume que el digest se calcula sobre JSON.stringify({ header, message }). El spec no especifica orden de claves; se usa el orden nativo de JSON.stringify.
  2. Signature en body: La firma viaja en envelope.signature, no en header HTTP Signature.
  3. ACK por defecto: Si el handler devuelve void, se responde con { status: 'ACK', message_id }.
  4. Namespace: Soporte configurable vía options.namespace; paths con namespace no están implementados en los controllers (TODO).
  5. EncryptedMessage: Cuando is_msg_encrypted=true, message es un EncryptedMessage; el pipe de decrypt lo desencripta antes de pasar al handler.

Security Notes

  • Verificación de firma: Activar enableSignatureVerification: true en producción.
  • Public key resolver: Implementar resolución segura (JWKS, BD, etc.).
  • Clock skew: Ajustar clockSkewSeconds según la precisión de relojes entre sistemas.
  • Logging: No loguear PII ni payload completo; usar correlation_id y message_id para trazabilidad.

Estructura del paquete

src/
  module/          # DynamicModule, tipos, tokens
  controllers/     # registry-async.controller, registry-sync.controller
  dtos/            # envelope, header, signature, message DTOs
  crypto/          # signature parser, digest, ed25519, verifier
  interfaces/      # handlers, public-key-resolver, encryption
  pipes/           # validate-action, decrypt-message
  interceptors/    # correlation, logging
  errors/          # exception filter, error catalog

Scripts

npm run build   # Compila a dist/
npm test        # Ejecuta tests

Licencia

MIT