# win-dpapi

> Node native module to encrypt/decrypt data. On Windows, it uses DPAPI

Latest version **1.1.0** (published 2020-06-13) · MIT license · 872 weekly downloads

## Install

```sh
npm install win-dpapi
pnpm add win-dpapi
yarn add win-dpapi
bun add win-dpapi
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-06-13 |
| First published | 2019-12-10 |
| Weekly downloads | 872 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 8 |
| Author | Brad Hughes |
| Maintainers | daguej |
| Keywords | dpapi, encrypt |

## Links

- npm: https://www.npmjs.com/package/win-dpapi
- Repository: https://github.com/daguej/node-dpapi
- Homepage: https://github.com/daguej/node-dpapi#readme
- Issues: https://github.com/daguej/node-dpapi/issues
- npm.io page: https://npm.io/package/win-dpapi

## Dependencies (2)

- [nan](https://npm.io/package/nan.md) ^2.14.1
- [bindings](https://npm.io/package/bindings.md) ^1.5.0

## 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.1.0 (latest) — 2020-06-13
- 0.1.1 — 2020-06-25
- 0.1.0 — 2019-12-10

## README

# node-dpapi
Node native module to encrypt/decrypt data. On Windows, it uses DPAPI

## API:
```typescript
function protectData(
    userData: Uint8Array,
    optionalEntropy: Uint8Array,
    scope: "CurrentUser" | "LocalMachine"
): Uint8Array;

function unprotectData(
    encryptedData: Uint8Array,
    optionalEntropy: Uint8Array,
    scope: "CurrentUser" | "LocalMachine"
): Uint8Array;
```

## Example:
```javascript
import * as dpapi from "node-dpapi";

const buffer = Buffer.from("Hello world", "utf-8");

const encrypted = dpapi.protectData(buffer, null, "CurrentUser");
const decrypted = dpapi.unprotectData(encrypted, null, "CurrentUser");
```

## FAQ:
Q: Does this work on all platforms?

A: Currently it just works on Windows

## Publish note
This package originates from [bradhugh/node-dpapi](https://github.com/bradhugh/node-dpapi), but he [did not publish it to npm](https://github.com/bradhugh/node-dpapi/issues/1).  [I](https://github.com/daguej) have taken the liberty of publishing this package so it may be used as a dependency.

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