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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@simion.robert.george/csc-server

v1.0.0

Published

CSC Framework RSSP in Node.js

Downloads

21

Readme

CSC - Cloud Signature Consortium

Build Status Dependency Status

A CSC RSSP, cloud signature consortium remote signature service provider, made in Node.js, using SoftHSMv2 as HSM.

Prerequistes

What things are needed to install the software and how to install them.

  1. Install Mongodb from mongodb.com
  2. Install OpenSC for interacting with the SoftHSMv2 module.
  • Download and install OpenSC, which is used for pkcs11-tool exe.
  1. Install SoftHSMv2 pkcs11 token module.
  • Use this projects's binaries or install it from SoftHSMv2
  • Set environment variabile SOFTHSM2_CONF=path\to\softhsm2.conf
  • In the file path\to\softhsm2.conf, set key directories.tokendir=path\to\tokens
  • Use softhsm2-util.exe to initialize a new softhsm2 token. You you don't want this, just use the provided one in the binaries.
softhsm2-util --init-token --slot 0 --label "mytoken"
  1. Download OpenSSL binaries or install it from OpenSSL. To generate a new certificate and private key for your https/SSL/TLS service, call this command, and put them in the resources folder:
openssl req -x509 -newkey rsa:4096 -keyout keySSL.pem -out certSSL.pem -days 365

In the release version you will find the following binaries:

  • OpenSSL 1.1.1.d x86 (used by the app)
  • SoftHSMv2 (used by the app)
  • PKCS11Admin - 0.5.0 (GUI used to see the token objects)

Don't forget to configure the location of these in the config/config.json ("softhsm2_driver_path, "openSSL_path", "openSC_path") If you don't want to do this, by default, the config file is set to search in /utils (/ = root) folder.

Usage

Installing globally via npm:

npm install -g csc-server

Create your own user:

csc-server --user "username" --pass "password"

Start CSC Server:

csc-server

Now you have a fully functional CSC server and you should be able to run the tests provided in Running the tests

Example Usage

csc-server [options]

Options:
  --port, -p       Set port                                         [8080]
  --host, -H       Set host                                         [0.0.0.0]
  --db, -d         Database URL                                     [mongodb://localhost:27017/csc]
  --user           User to add once to the db. Used it with --pass  [string]
  --pass           Password of the user. Used it with --user        [string]
  --cert, -c       Path to ssl cert file                            [default: cert.pem]
  --key, -k        Path to ssl key file                             [default: key.pem]
  --passphrase     Path to ssl key file                             [default: 0000]
  --silent, -s     Suppress log messages from output                [boolean]
  --help, -h       Print this list and exit.                        [boolean]

Examples
    csc-server --user "username" --pass "password"
    csc-server

Configuration

You can also set default options in the %userprofile%/AppData/Roaming/npm/node_modules/csc-server/config/config.json configuration file.

{
"https": {
        "host": "0.0.0.0",
        "port": "8080",
        "cert_SSL": "certSSL.pem",
        "key_SSL": "keySSL.pem",
        "SSL_key_passphrase": "0000"
    },
    "resources_path": "./resources",
    "softhsm2_driver_path": "utils/SoftHSMv2/lib/softhsm2.dll",
    "openSSL_path": "utils/openssl-1.1.1-x86/openssl.exe",
    "openSC_path":"C:/Program Files (x86)/OpenSC Project/OpenSC/tools/pkcs11-tool.exe",
    "token": {
        "slot": "189467408",
        "pin": "0000"
    },
    "database_url": "mongodb://localhost:27017/csc",
    "csc": {
        "access_token_expiring_time": 3600,
        "refresh_token_expiring_time": 7200,
        "sad_expiring_time": 1800,
        "otp_expiring_time":1800,
        "max_results": 10
    }
}

You can also set the /csc/v1/info results in the %userprofile%/AppData/Roaming/npm/node_modules/csc-server/config/info.json configuration file.

{
    "specs": "1.0.3.0",
    "name": "CSC Provider",
    "logo": "https://service.domain.org/images/logo.png",
    "region": "RO",
    "lang": "en-US",
    "description": "An efficient remote signature service",
    "authType": [
            "basic",
            "oauth2code"
    ],
    "oauth2": "https://www.domain.org/",
    "methods": [
            "auth/login",
            "auth/revoke",
            "credentials/list",
            "credentials/info",
            "credentials/authorize",
            "credentials/sendOTP",
            "signatures/signHash"
    ]
}

Running the tests

You can run the commands for testing using Postman.

In Postman, set certificate SSL validation to false, under Settings.

You will need to define the following Postman environment variabiles. The last two will be automatically updated after you post auth/login

Useful website for base64 and base64 url safe encoding: http://www.base64url.com/

url = https://localhost:3000/csc/v1
access_token = ""
refresh_token = ""

Authors

See also the list of contributors who participated in this project.

I really appreciate all kinds of feedback and contributions.

Aditional notes: If you have some issues referring parts of code in the master branch add them in the issues section.

License

This project is licensed under the MIT License - see the LICENSE file for details