Socket
Socket
Sign inDemoInstall

split-ca

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    split-ca

Simple module to split a single certificate authority chain file (aka: bundle, ca-bundle, ca-chain, etc.) into an array, as expected by the node.js tls api.


Version published
Weekly downloads
587K
decreased by-1.02%
Maintainers
1
Install size
10.1 kB
Created
Weekly downloads
 

Readme

Source

split-ca

Simple node.js module to split a single certificate authority chain file (bundle, ca-bundle, ca-chain, etc.) into an array, as expected by the node.js tls api

Installation

npm install split-ca

Usage

Usage will depend on your server module of choice, but most https modules require an options hash with ca, key, and cert. Simply give split-ca the filepath of your bundle file.

var https = require('https');
var fs = require('fs');

var splitca = require('split-ca');

var options = {
  ca: splitca("path/to/ca_bundle_file"),
  key:fs.readFileSync("path/to/server_key_file"),
  cert:fs.readFileSync("path/to/server_cert_file"),
  requestCert: true,
  rejectUnauthorized: true
};

https.createServer(options, function (req, res) {
  res.writeHead(200);
  res.end("hello world\n");
}).listen(8000);

Args

split-ca('filepath','split-string','encoding')

filepath

A standard node path to your object. An error is thrown if the file cannot be parsed, is not formatted properly.

split-string

Optional. Defaults to "\n", can be replaced with anything.

encoding

Optional. Defaults to "utf-8", can be replaced with anything accepted by node's fs module.

Credits

Thanks to Benjie Gillam for the blog post and sample code that was unashamedly ripped for this module.

Keywords

FAQs

Last updated on 01 Mar 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc