Crypto API wrapper
This lib is a wrapper around the Web Crypto API, it offers an API
with sane defaults. The documentation can be found here.
Installation
npm i crypto-api-wrapper
Usage
This lib exports 2 objects : asymmetricCrypto and symmetricCrypto
asymmetricCrypto API
- generateSigningKey()
- generateEncryptionKey()
- exportKey(keypair)
- importKey(keydata)
- sign(plaintext, privateKey)
- verify(plaintext, signature, publicKey)
- encrypt(plaintext, publicKey)
- decrypt(ciphertext, privateKey)
symmetricCrypto API
- generateEncryptionKey()
- exportKey(encryptionKey)
- toB64(keydata)
- fromB64(keydataB64)
- importKey(keydata)
- encrypt(plaintext, encryptionKey)
- decrypt(ciphertext, encryptionKey)
Contributing
Install dependencies
npm i
npm i --no-save node-webcrypto-ossl
Run the tests
Run the test in a browser :
npm run test
Run the test with NodeJS :
npm run test-node
Generate the documentation
npm run doc