Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Variables

Const lstatAsync

lstatAsync: __promisify__ = promisify(lstat)

Const nonSudoExec

nonSudoExec: __promisify__ = promisify(exec)

Functions

generateTrust

Const getCertCommonName

  • getCertCommonName(certPath: string): Promise<string>
  • Parameters

    • certPath: string

    Returns Promise<string>

Const isDirectory

  • isDirectory(source: any): Promise<boolean>

Const isFile

  • isFile(source: any): Promise<boolean>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc