windcrypt

1.4.3 • Public • Published

WindCrypt

⚠️ Windows Only

WindCrypt is built in C++ and uses the native windows api's wincrypt

Example

const windcrypt = require("windcrypt");

const text = Buffer.from("test");
const pass = Buffer.from("123");

const encrypted = windcrypt.protectData(text, pass);

console.log(windcrypt.unprotectData(encrypted, pass).toString()); // Prints "test"

Types

export const enum Flags {
  CurrentUser = "CurrentUser",
  LocalMachine = "LocalMachine"
}

export function protectData(
  data: Buffer,
  optionalEntropy?: Buffer | undefined | null,
  flags?: Flags | undefined | null
): Buffer;

export function unprotectData(
  data: Buffer,
  optionalEntropy?: Buffer | undefined | null,
  flags?: Flags | undefined | null
): Buffer;

Usage

Without password

windcrypt.protectData(Buffer.from("test"));

With custom flag (only CRYPTPROTECT_LOCAL_MACHINE supported)

INFO: Default flag is 0 ("CurrentUser")

windcrypt.protectData(Buffer.from("test"), null, windcrypt.Flags.LocalMachine);
// or
windcrypt.protectData(Buffer.from("test"), null, "LocalMachine");

The usage for unprotectData method is the same as protectData

© (C) Angelo II Apache-2.0 license, all right reserved

Readme

Keywords

none

Package Sidebar

Install

npm i windcrypt

Weekly Downloads

20

Version

1.4.3

License

MIT

Unpacked Size

6.63 MB

Total Files

23

Last publish

Collaborators

  • disturbedleboss