A WebCrypto Polyfill for NodeJS
This repository has been archived on 2023-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Liran Nuna e8046378af Improvements to HKDF 2019-03-02 13:14:53 -08:00
.circleci Rename config file 2019-01-25 15:55:44 +03:00
src Improvements to HKDF 2019-03-02 13:14:53 -08:00
test Implement HKDF 2019-03-02 12:28:49 -08:00
.gitignore Updte deps and move output JS to build folder 2019-02-19 12:41:43 +03:00
.npmignore Add files 2019-01-25 13:43:13 +03:00
LICENSE.md Add license 2019-01-25 16:10:53 +03:00
README.md Implement HKDF 2019-03-02 12:28:49 -08:00
index.d.ts Update d.ts 2019-02-14 13:58:38 +03:00
package-lock.json Implement HKDF 2019-03-02 12:28:49 -08:00
package.json Implement HKDF 2019-03-02 12:28:49 -08:00
rollup.config.js Update configs 2019-01-25 15:47:26 +03:00
tsconfig.json Add files 2019-01-25 13:43:13 +03:00
tslint.json Update configs 2019-01-25 15:47:26 +03:00

README.md

@peculiar/webcrypto

License CircleCI Coverage Status npm version

We wanted to be able to write Javascript that used crypto on both the client and the server but we did not want to rely on Javascript implementations of crypto. The only native cryptography available in browser is Web Crypto, this resulted in us creating a @peculiar/webcrypto.

Table Of Contents

WARNING

At this time this solution should be considered suitable for research and experimentation, further code and security review is needed before utilization in a production application.

Installing

npm install @peculiar/webcrypto

Supported algorithms

Algorithm name generateKey digest export/import sign/verify encrypt/decrypt wrapKey/unwrapKey derive
SHA-1 X
SHA-256 X
SHA-384 X
SHA-512 X
HMAC X X X
RSASSA-PKCS1-v1_5 X X X
RSA-PSS X X X
AES-CBC X X X X
AES-CTR X X X X
AES-GCM X X X X
AES-KW X X X
ECDSA1 X X X
ECDH1 X X X
HKDF X X
PBKDF2 X X
DES-CBC2 X X X X
DES-EDE3-CBC2 X X X X

1 Mechanism supports extended list of named curves P-256, P-384, P-521, and K-256

2 Mechanism is not defined by the WebCrypto specifications. Use of mechanism in a safe way is hard, it was added for the purpose of enabling interoperability with an existing system. We recommend against its use unless needed for interoperability.

Using

const { Crypto } = require("@peculiar/webcrypto");

const crypto = new Crypto();

Examples

See WebCrypto Docs for examples

Bug Reporting

Please report bugs either as pull requests or as issues in the issue tracker. @peculiar/webcrypto has a full disclosure vulnerability policy. Please do NOT attempt to report any security vulnerability in this code privately to anybody.