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

core-signature

v0.0.4

Published

This package contains the nestjs modules required by the Signature Core Service

Readme

core-signature

A NestJS core module for handling signatures and feature flags.

Installation

npm install core-signature

Usage Backend

// app.module.ts
import { Module } from '@nestjs/common';
import { SignatureModule } from 'core-signature';

@Module({
  imports: [SignatureModule]
})
export class AppModule {}


// app.controller.ts
import { Controller, Get, Req } from '@nestjs/common';
import { SignatureService } from 'core-signature';
import { Request } from 'express';

@Controller()
export class AppController {
    constructor(private readonly signatureService: SignatureService) {}
    
    @Get('hello')
    async hello(@Req() req: Request): Promise<string> {
      if (this.signatureService.useSignature(req)) {
        await this.signatureService.verifySignature(req);
      }
      return 'hello world';
    }
}

Usage Frontend

// app.component.ts
import { encryptSignature } from 'core-signature';
import process = require('node:process');

const query = { name: 'John' };
const body = { age: 30 };
const publicKey = process.env.PUBLIC_KEY;
const signature = encryptSignature(JSON.stringify(query), JSON.stringify(body), publicKey);

fetch('http://localhost:3000/hello', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': publicKey,
    'x-api-signature': signature
  }
});

Feature Flag

Usage Backend NestJS

// app.module.ts
import { Module } from '@nestjs/common';
import { FeatureFlagModule } from 'core-signature';

@Module({
  imports: [
    FeatureFlagModule.forRoot({
      ttl: 30 * 60 * 1000,
      host: 'localhost',
      port: 6379,
      coreUrl: 'http://localhost:3000/v1/feature-flag'
    })
  ]
})
export class AppModule {}


// app.controller.ts
import { Controller, Get, Req } from '@nestjs/common';
import { FeatureFlagService, IContextFeatureFlag } from 'core-signature';

@Controller()
export class AppController {
  constructor(private readonly featureFlagService: FeatureFlagService) {}

  @Get('hello')
  async hello(): Promise<string> {
    const ctx: IContextFeatureFlag = { 
      userID: 'user123', 
      organization_id: 456
    }
    const isMyFeatureFlag: boolean = await this.featureFlagService.getStatusFlag(ctx, 'my-feature-flag');
    if (isMyFeatureFlag) return 'used feature flag';
    return 'not used feature flag';
  }
}

Usage Backend

import Redis from 'ioredis';
import { IConfigFeatureFlag } from 'core-signature';

(async () => {
  const connection: Redis = RedisFacade.connection();
  const option: IConfigFeatureFlag = {
    ttl: 30 * 60 * 1000,
    coreUrl: 'http://localhost:3000/v1/feature-flag'
  }
  const featureFlag: FeatureFlag = new FeatureFlag(connection, option);
  
  const ctx: IContextFeatureFlag = {
    userID: 'user123',
    organization_id: 456
  }
  const isMyFeatureFlag: boolean = await featureFlag.getStatusFlag(ctx, 'my-feature-flag');
  if (isMyFeatureFlag) console.log('used feature flag');
  else console.log('not used feature flag');
  
  const cb: (status: boolean) => void = (status: boolean) => {
    if (status) console.log('used feature flag');
    else console.log('not used feature flag');
  }
  await featureFlag.cbStatusFlag(cb, ctx, 'my-feature-flag');
})();