WinCrypt is built in rust and uses the native windows api's CryptProtectData and CryptUnprotectData functions
constwincrypt=require("wincrypt");consttext=Buffer.from("test");constpass=Buffer.from("123");constencrypted=wincrypt.protectData(text,pass);console.log(wincrypt.unprotectData(encrypted,pass).toString());// Prints "test"exportconstenumFlags{CurrentUser="CurrentUser",LocalMachine="LocalMachine"}exportfunctionprotectData(data: Buffer,optionalEntropy?: Buffer|undefined|null,flags?: Flags|undefined|null): Buffer;exportfunctionunprotectData(data: Buffer,optionalEntropy?: Buffer|undefined|null,flags?: Flags|undefined|null): Buffer;wincrypt.protectData(Buffer.from("test"));INFO: Default flag is
0("CurrentUser")
wincrypt.protectData(Buffer.from("test"),null,wincrypt.Flags.LocalMachine);// orwincrypt.protectData(Buffer.from("test"),null,"LocalMachine");The usage for
unprotectDatamethod is the same asprotectData
© (C) Angelo II Apache-2.0 license, all right reserved