0.2.1 • Published 2 years ago

win32crypt v0.2.1

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 years ago

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
    )}`
)
0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago