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

finpro-crypto

v0.0.14

Published

FinPro NBFC Data Security

Downloads

18

Readme

Installation

    const encNdesc = require('finpro-crypto');

Usage

FI DATA ENC N DESC

FIP Encryption

    let encryptedData=encNdesc.FIPEncryption(id, Data, ECDHPubKey, nonce, opts);
    /**
     * id= fip ID
     * Data= FI Data
     * ECDHPubKey= his publickey
     * nonce = his random 32-byte BASE64 string
     * opts = optional parameters Object 
    */

    Note :  we can use all Encryption functions calling by encNdesc.enc 

FIU Decryption

let decryptedFIUData=encNdesc.dataDecrypt(cipher,iv,hisPubKey, fipNonce,myScrtKey,fiuNonce, opts);
    /**
     * cipher= encrypted Data 
     * iv= iv 
     * hisPubKey= his ECDH publickey
     * fipNonce = his random 32-byte BASE64 string
     * myScrtKey= my ECDH privateKey
     * fiuNonce = my random 32-byte BASE64 string
     * opts = optional parameters Object 
    */
    

Digital Signature

Configuration/Intiallization and Method calling

    /**
     * API Signature
     */
    // Sample public key from CR
    let pub_jwk={
      kty: 'RSA',
      n: 'q3jotq3fX9nY9G89hdQCGPPZspzPpjjr5MO3qJRRhhPR7GDN1pgVAWoPHJlzx9Uvu43jgMKDU-f_05hbM-cIcs8JjEtbhsus6iJ5WbZUN7o9SwroDpCMTHaEf14CKzsk1088_Ub9ITX8769da2NLWvtiP6jmt0gauf60hY9iwY3BRnE91aL_Wd_CIXuS9pouCHeUP9CyNYWt8sdAoycuiv9utaRSTdLRrjcOmo-kWu4LtQnnZPD9SIlsGZi-t_ifbyLNPxz1CK2mY9oko2GE-aFkfHUI-1TACids1Y8fv1NACRGjMU4HsvuFjoNrYgxwTE8TDzwDNDnhJ-4tzULUBw',
      e: 'AQAB',
      alg: 'RS256',
      kid: '90441819-9044-4856-b0ee-8c88035f4856',
      use: 'sig'
    };
    //Initializing Digital Signature 
    let digiSignConfig = digiSign.config({
      "prikeyFilePath": "./sample_certs/om_private_key.pem", //<file,buffer>
      "pubkeyFileObj": pub_jwk, //<Object> From CR
    });

    // Generate digital signature
    let token_payload = {
      "ver" : "1.0",
      "txnid" : "0b811819-9044-4856-b0ee-8c88035f8858",
      "consentId" : "XXXX-XXXX-XXXX-XXXX",
      "status" : "ACTIVE",
      "createTimestamp" : "2018-12-06T11:39:57.153Z"
    };
    let apiSignedToken = digiSignConfig.generateAPISign({ payload: JSON.stringify(token_payload)});//pass payload as string
    console.log(`API signatured token is `, apiSignedToken);

    //Validate
    let digiSignTokenValidity = encNdesc.digiSign.verifyAPISign({
      "pubkeyFileObj": pub_jwk, //JSON object
      "encStr": apiSignedToken.token,
      "payload": JSON.stringify(token_payload) //string
    });
    console.log(`API signatured validation status `, digiSignTokenValidity);


    /**
     * Consent Signature
     */

    // Generate digital signature
    let consent_payload = {
      "ver": "1.0",
      "txnid": "0b811819-9044-4856-b0ee-8c88035f8858",
      "consentId": "XXXX-XXXX-XXXX-XXXX",
      "status": "ACTIVE",
      "createTimestamp": "2018-12-06T11:39:57.153Z"
    };
    let encryptedConsent = digiSignConfig.encryptConsent({ payload: consent_payload});//pass consent_payload as JSON Object
    console.log(`Consent signature is `, encryptedConsent.signedConsent);

    //Validate
    let decryptedConsent = encNdesc.digiSign.decryptConsent({
      "pubkeyFileObj": pub_jwk, //JSON object
      "encStr": encryptedConsent.signedConsent,
    });
    console.log(`decrypted Consent is as string is `, decryptedConsent);

    /**
     * Get kid from signature
     */
    let extractedKid=digiSign.getKidFromSign({sign:apiSignedToken.token});
    console.log(`extractedKid is `,extractedKid);    
  

working with typescript

prepare config file "digi_certs.ts". config private .pem file and then export it to use any where in the application.

    const fs = require('fs')
    const digiSign = require('finpro-crypto').digitalSignature;

    //Initializing Digital Signature 
    const DigitalSignatureConfig=  digiSign.config({
      "prikeyFilePath": process.cwd()+"/app/assets/digi-sign/digiSign_private_key.pem", // required
      "pubkeyFileObj": pub_jwk, //<Object> From CR
    });
    export {DigitalSignatureConfig, digiSign}

Version release summary

  1. 0.0.9
    1. digital signature library added.
  2. 0.0.10
    1. urlPath now accepts both URL and Buffer also.
  3. 0.0.11
    1. sharedkey generation in finshare bug fixed.
  4. 0.0.12
    1. digital signature for API and Consent functionality implemented as per Rebit API v1.1.2
  5. 0.0.13
    1. algorithm changed from RSA512 to RSA256.
  6. 0.0.14
    1. header is same for both API,Consent. so sign method returns payload as plain text.
    2. pubkeyFileObj[JWK from CR] need to pass as param while initilazing digiSign.
    3. new method for get kid from digisign.signature.