trust-cert
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

trust-cert Build Status

Trust Root Certificates in MacOs, Linux, Windows and Firefox (nss)

Docs

Installation

NPM

npm i trust-cert

Yarn

yarn add trust-cert

Install Certificate

import { generateTrust } from 'trust-cert'
import { join } from 'path'
 
const certPath = join(__dirname, 'certs/eos_root_ca.crt')
const trust = generateTrust()
 
(async () => {
    await trust.installFromFile(certPath, 'EOS Root CA')
})

Uninstall Certificate

import { generateTrust } from 'trust-cert'
import { join } from 'path'
 
const certPath = join(__dirname, 'certs/eos_root_ca.crt')
const trust = generateTrust()
 
(async () => {
    await trust.uninstall(certPath, 'EOS Root CA')
})

NSS (Firefox) Certificate Install

Firefox does not use system store, so we package cross-platform nss binaries.

import { NssTrust } from 'trust-cert'
import { join } from 'path'
 
const certPath = join(__dirname, 'certs/eos_root_ca.crt')
const trust = new NssTrust()
 
(async () => {
    await trust.installFromFile(certPath, 'EOS Root CA')
})

NSS (Firefox) Certificate Uninstall

Firefox does not use system store, so we package cross-platform nss binaries.

import { NssTrust } from 'trust-cert'
import { join } from 'path'
 
const certPath = join(__dirname, 'certs/eos_root_ca.crt')
const trust = new NssTrust()
 
(async () => {
    await trust.uninstall(certPath, 'EOS Root CA')
})

Note: The tests install the root CA in the certs folder into your store, modify the certs folder if you wish to test with your own cert.

Credits: mkcert

Package Sidebar

Install

npm i trust-cert

Weekly Downloads

46

Version

1.3.2

License

BSD-3-Clause

Unpacked Size

65.8 MB

Total Files

81

Last publish

Collaborators

  • jafri