libtrust

1.0.0 • Public • Published

js-libtrust

Javascript implementation of docker's libtrust fingerprint, used for the key id header in the jwt used for dockr authentication. The implementation follows the spec outlined in docker's token authentication implementation:

The “kid” field has to be in a libtrust fingerprint compatible format. Such a format can be generated by following steps:
1. Take the DER encoded public key which the JWT token was signed against.
2. Create a SHA256 hash out of it and truncate to 240bits.
3. Split the result into 12 base32 encoded groups with : as delimiter.

Usage

const fs = require('fs')
const libtrust = require('libtrust')
const publicKey = fs.readFileSync('certificate.crt', 'utf-8')
 
const keyId = libtrust.fingerprint(publicKey)

Shout out

Big shout out to @kyleburnett who cracked a few pieces to enable this javascript implementation.

Readme

Keywords

Package Sidebar

Install

npm i libtrust

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

6.61 kB

Total Files

7

Last publish

Collaborators

  • tswayne