In-browser key management with IndexedDB and the Web Crypto API.
Securely store and use keys for encryption, decryption, and signatures. IndexedDB and Web Crypto keep keys safe from malicious javascript.
Supports both RSA (RSASSA-PKCS1-v1_5 & RSA-OAEP) and Elliptic Curves (P-256, P-381 & P-521) only EC (P-381 & P-521) keys.
Below is the default config and all possible values Note: these are given as primitives, but in Typescript you can use the included enums
const defaultConfig = {
curve: 'P-384', // 'P-384' | 'P-521'
symmAlg: 'AES-GCM', // AES-GCM only
symmWrappingAlg: 'AES-KW', // AES-KW only
symmKeyLength: 256, // 256 | 384 | 512
saltLength: 128, // 128 | 256
hashAlg: 'SHA-256', // 'SHA-256' | 'SHA-384' | 'SHA-512'
charSize: 16, // 8 | 16
storeName: 'keystore', // any string
exchangeKeyName: 'exchange-key-pair', // any string
writeKeyName: 'write-key-pair', // any string
passKeyName: 'pass-key', // any string
}
Note: the library will check if your browser supports ECC. If so it will use ECC, if not it will use raise an error
import Keystore from 'banyan-keystore'
async function run() {
const ks = await Keystore.init()
const msg = "Incididunt id ullamco et do."
// TODO
await ks.clear()
}
run()
# install dependencies
yarn
# run development server
yarn start
# build
yarn build
# test
# Note use nodeV16 when running tests
yarn test
# test w/ reloading
yarn test:watch
# publish (run this script instead of npm publish!)
./publish.sh