You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

win32crypt

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

win32crypt

Windows DPAPI in Node.js.

0.1.0
npmnpm
Version published
Weekly downloads
13
225%
Maintainers
1
Weekly downloads
 
Created
Source

win32crypt

Windows Data Protection API in Node.js. Based on original work from bradhugh/node-dpapi.

API:

function protectData(
    userData: Uint8Array,
    optionalEntropy: Uint8Array,
    scope: "CurrentUser" | "LocalMachine"
): Uint8Array;

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

Example:

import win32crypt from 'win32crypt';

const context = 'CurrentUser'

const encryptedBuffer = win32crypt.protectData(
    decryptedBuffer,
    null,
    context
)
const encryptedBufferWithEntropy = win32crypt.protectData(
    decryptedBuffer,
    entropyBuffer,
    context
)

console.log(
    `(${context}) Decrypted: ${win32crypt.unprotectData(
        encryptedBuffer,
        null,
        context
    )}`
)
console.log(
    `(${context}) Decrypted with entropy: ${win32crypt.unprotectData(
        encryptedBufferWithEntropy,
        entropyBuffer,
        context
    )}`
)

Keywords

dpapi

FAQs

Package last updated on 19 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts