2.1.2 • Published 3 years ago

@vanioinformatika/simple-keystore v2.1.2

Weekly downloads
16
License
MIT
Repository
github
Last release
3 years ago

Build Status

Simple filesystem based keystore for Node.js

Simple filesystem keystore implementation

Usage

const {Keystore, KeystoreReaderFs} = require('@vanioinformatika/simple-keystore')

// initializing keystore
const baseDir = '<directory containing key files>'
const refreshIntervalMillis = 30 * 1000 // 30 secs
const signingKeyPassphrases = { // an object containing passphrases for private keys
  'key_id_1': 'passphrase1',
  'key_id_2': 'passphrase2'
}
const keystoreReader = new KeystoreReaderFs(baseDir)
const keystore = new Keystore(signingKeyPassphrases, keystoreReader)

// start reading keystore periodically 
keystore.start(refreshIntervalMillis)

...

// publishing public keys with express.js
router.route('/certs').get((req, res) => {
  const certificateList = keystore.fny.getAllCertificatesAsJWKS()
  res.status(HttpStatus.OK).json({keys: certificateList})
})

The keys directory has to contain the following files:

rootCA.cert.pem
{keyId}.privkey.pem
{keyId}.cert.pem

The rootCA.cert.pem contains the certificate of the CA that issued the certificates. All other files that end with .privkey.pem and .cert.pem are the private keys and certificates for a given key id.

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.2

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.3

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago