# @peculiar/webcrypto

> A WebCrypto Polyfill for NodeJS

Latest version **1.7.1** (published 2026-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @peculiar/webcrypto
pnpm add @peculiar/webcrypto
yarn add @peculiar/webcrypto
bun add @peculiar/webcrypto
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.7.1 |
| Published | 2026-05-01 |
| First published | 2019-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.18.0 |
| Dependencies | 5 |
| Unpacked size | 203.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 201 |
| Author | PeculiarVentures |
| Maintainers | rmhrisk, microshine, yury.strozhevsky, peculiarventures, apilguk, donskov, worldthirteen |
| Keywords | webcrypto, crypto, sha, rsa, ec, aes, des, hmac, pbkdf2, eddsa, x25519, ed25519, x448, ed448, shake128, shake256 |

## Links

- npm: https://www.npmjs.com/package/@peculiar/webcrypto
- Repository: https://github.com/PeculiarVentures/webcrypto
- Homepage: https://github.com/PeculiarVentures/webcrypto#readme
- Issues: https://github.com/PeculiarVentures/webcrypto/issues
- npm.io page: https://npm.io/package/@peculiar/webcrypto

## Dependencies (5)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [webcrypto-core](https://npm.io/package/webcrypto-core.md) ^1.9.2
- [@peculiar/utils](https://npm.io/package/@peculiar/utils.md) ^2.0.2
- [@peculiar/asn1-schema](https://npm.io/package/@peculiar/asn1-schema.md) ^2.7.0
- [@peculiar/json-schema](https://npm.io/package/@peculiar/json-schema.md) ^1.1.12

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.7.1 (latest) — 2026-05-01
- 1.7.0 — 2026-04-30
- 1.6.0 — 2026-04-29
- 1.5.0 — 2024-05-28
- 1.4.6 — 2024-03-29
- 1.4.5 — 2024-01-22
- 1.4.4 — 2024-01-16
- 1.4.3 — 2023-03-24
- 1.4.2 — 2023-03-21
- 1.4.1 — 2022-11-02
- 1.4.0 — 2022-05-12
- 1.3.3 — 2022-03-25
- 1.3.2 — 2022-03-07
- 1.3.1 — 2022-03-02
- 1.3.0 — 2022-02-24
- … 41 more at https://npm.io/package/@peculiar/webcrypto/versions

## README

<h1 align="center">
  @peculiar/webcrypto
</h1>

<div align="center">

![NPM License](https://img.shields.io/npm/l/@peculiar/webcrypto)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/PeculiarVentures/webcrypto/test.yml?label=test)
[![npm version](https://img.shields.io/npm/v/@peculiar/webcrypto.svg)](https://www.npmjs.com/package/@peculiar/webcrypto)
![Coveralls](https://img.shields.io/coverallsCoverage/github/PeculiarVentures/webcrypto)
[![npm downloads](https://img.shields.io/npm/dm/@peculiar/webcrypto.svg)](https://www.npmjs.com/package/@peculiar/webcrypto)

</div>

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](http://caniuse.com/#search=cryptography), this resulted in us creating a `@peculiar/webcrypto`.

## Table Of Contents

* [WARNING](#warning)
* [Installing](#installing)
* [Using](#using)
* [Examples](#examples)
* [Bug Reporting](#bug-reporting)
* [Related](#related)

## 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.**

**Module is based on the Node.js crypto API. It requires Node v14.18.0 or higher.**

## 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      |                 |                   |         |
| RSAES-PKCS1-v1_5<sup>2</sup>| X |         |       X       |             |        X        |         X         |         |
| RSA-PSS           |      X      |         |       X       |      X      |                 |                   |         |
| RSA-OAEP          |      X      |         |       X       |             |        X        |         X         |         |
| AES-CMAC          |      X      |         |       X       |      X      |                 |                   |         |
| AES-CBC           |      X      |         |       X       |             |        X        |         X         |         |
| AES-CTR           |      X      |         |       X       |             |        X        |         X         |         |
| AES-ECB           |      X      |         |       X       |             |        X        |         X         |         |
| AES-GCM           |      X      |         |       X       |             |        X        |         X         |         |
| AES-KW            |      X      |         |       X       |             |                 |         X         |         |
| ECDSA<sup>1</sup> |      X      |         |       X       |      X      |                 |                   |         |
| ECDH<sup>1</sup>  |      X      |         |       X       |             |                 |                   |    X    |
| EdDSA<sup>2,3</sup> |      X      |         |       X       |      X      |                 |                   |         |
| ECDH-ES<sup>2,4</sup>  |      X      |         |       X       |             |                 |                   |    X    |
| HKDF              |             |         |       X       |             |                 |                   |    X    |
| PBKDF2            |             |         |       X       |             |                 |                   |    X    |
| DES-CBC<sup>2</sup>|      X      |         |       X       |             |        X        |         X         |         |
| DES-EDE3-CBC<sup>2</sup>|      X      |         |       X       |             |        X        |         X         |         |
| shake128<sup>2</sup>|             |    X    |               |             |                 |                   |         |
| shake256<sup>2</sup>|             |    X    |               |             |                 |                   |         |

<sup>1</sup> Mechanism supports extended list of named curves `P-256`, `P-384`, `P-521`, `K-256`,
`brainpoolP160r1`, `brainpoolP160t1`, `brainpoolP192r1`, `brainpoolP192t1`, `brainpoolP224r1`, `brainpoolP224t1`, `brainpoolP256r1`, `brainpoolP256t1`, `brainpoolP320r1`, `brainpoolP320t1`, `brainpoolP384r1`, `brainpoolP384t1`, `brainpoolP512r1`, and `brainpoolP512t1`

<sup>2</sup> 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.

<sup>3</sup> Mechanism supports extended list of named curves `Ed25519`, and `Ed448`

<sup>4</sup> Mechanism supports extended list of named curves `X25519`, and `X448`

## Using

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

const crypto = new Crypto();
```

## Examples

See [WebCrypto Docs](https://github.com/PeculiarVentures/webcrypto-docs/blob/master/README.md) 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.

## Related

* [node-webcrypto-ossl](https://github.com/PeculiarVentures/node-webcrypto-ossl)
* [node-webcrypto-p11](https://github.com/PeculiarVentures/node-webcrypto-p11)
* [webcrypto-liner](https://github.com/PeculiarVentures/webcrypto-liner)

---
_Source: https://npm.io/package/@peculiar/webcrypto · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
