@azure/msal-node-extensions 1.0.0-alpha.12 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +261 -226
- package/CHANGELOG.md +111 -102
- package/LICENSE +21 -21
- package/README.md +192 -192
- package/binding.gyp +29 -29
- package/dist/msal-node-extensions.cjs.development.js.map +1 -1
- package/dist/msal-node-extensions.cjs.production.min.js.map +1 -1
- package/dist/msal-node-extensions.esm.js.map +1 -1
- package/package.json +64 -59
- package/src/dpapi-addon/Dpapi.ts +17 -17
- package/src/dpapi-addon/dpapi_addon.h +6 -6
- package/src/dpapi-addon/dpapi_not_supported.cpp +19 -19
- package/src/dpapi-addon/dpapi_win.cpp +114 -114
- package/src/dpapi-addon/main.cpp +32 -32
- package/src/error/PersistenceError.ts +101 -101
- package/src/index.ts +16 -16
- package/src/lock/CrossPlatformLock.ts +89 -89
- package/src/lock/CrossPlatformLockOptions.ts +15 -15
- package/src/persistence/BasePersistence.ts +41 -41
- package/src/persistence/DataProtectionScope.ts +20 -20
- package/src/persistence/FilePersistence.ts +140 -140
- package/src/persistence/FilePersistenceWithDataProtection.ts +92 -92
- package/src/persistence/IPersistence.ts +17 -17
- package/src/persistence/IPersistenceConfiguration.ts +14 -14
- package/src/persistence/KeychainPersistence.ts +86 -86
- package/src/persistence/LibSecretPersistence.ts +87 -87
- package/src/persistence/PersistenceCachePlugin.ts +106 -106
- package/src/persistence/PersistenceCreator.ts +73 -73
- package/src/utils/Constants.ts +62 -62
- package/src/utils/Environment.ts +99 -99
package/package.json
CHANGED
|
@@ -1,59 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@azure/msal-node-extensions",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
},
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@azure/msal-node-extensions",
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"typings": "dist/index.d.ts",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"js",
|
|
13
|
+
"ts",
|
|
14
|
+
"node",
|
|
15
|
+
"AAD",
|
|
16
|
+
"msal",
|
|
17
|
+
"extensions"
|
|
18
|
+
],
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"src",
|
|
22
|
+
"binding.gyp"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=10"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"start": "tsdx watch",
|
|
29
|
+
"build": "tsdx build",
|
|
30
|
+
"build:common": "cd ../../lib/msal-common && npm run build",
|
|
31
|
+
"build:all": "npm run build:common && npm run build",
|
|
32
|
+
"test": "tsdx test",
|
|
33
|
+
"lint": "cd ../../ && npm run lint:node:extensions",
|
|
34
|
+
"lint:fix": "npm run lint -- -- --fix",
|
|
35
|
+
"link:localDeps": "npx lerna bootstrap --scope @azure/msal-common --scope @azure/msal-node-extensions",
|
|
36
|
+
"prepack": "npm run build:all"
|
|
37
|
+
},
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Microsoft",
|
|
40
|
+
"email": "nugetaad@microsoft.com",
|
|
41
|
+
"url": "https://www.microsoft.com"
|
|
42
|
+
},
|
|
43
|
+
"module": "dist/test.esm.js",
|
|
44
|
+
"beachball": {
|
|
45
|
+
"disallowedChangeTypes": [
|
|
46
|
+
"patch",
|
|
47
|
+
"minor",
|
|
48
|
+
"major"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@azure/msal-common": "^5.2.0",
|
|
53
|
+
"bindings": "git+https://github.com/samuelkubai/node-bindings.git#v1.6.0",
|
|
54
|
+
"keytar": "^7.6.0",
|
|
55
|
+
"nan": "^2.13.2"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"husky": "^4.2.5",
|
|
59
|
+
"node-gyp": "^7.0.0",
|
|
60
|
+
"tsdx": "^0.14.1",
|
|
61
|
+
"tslib": "^2.0.0",
|
|
62
|
+
"typescript": "^3.9.3"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/dpapi-addon/Dpapi.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface DpapiBindings{
|
|
7
|
-
protectData(dataToEncrypt: Uint8Array, optionalEntropy: Uint8Array, scope: string): Uint8Array
|
|
8
|
-
unprotectData(encryptData: Uint8Array, optionalEntropy: Uint8Array, scope: string): Uint8Array
|
|
9
|
-
}
|
|
10
|
-
/* eslint-disable-next-line @typescript-eslint/no-var-requires, no-var */
|
|
11
|
-
export var Dpapi: DpapiBindings = require("bindings")({
|
|
12
|
-
bindings: "dpapi",
|
|
13
|
-
userDefinedTries: [
|
|
14
|
-
['module_root', 'node_modules', '@azure', 'msal-node-extensions', 'build', 'Release', 'bindings'],
|
|
15
|
-
]
|
|
16
|
-
});
|
|
17
|
-
export default Dpapi;
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface DpapiBindings{
|
|
7
|
+
protectData(dataToEncrypt: Uint8Array, optionalEntropy: Uint8Array, scope: string): Uint8Array
|
|
8
|
+
unprotectData(encryptData: Uint8Array, optionalEntropy: Uint8Array, scope: string): Uint8Array
|
|
9
|
+
}
|
|
10
|
+
/* eslint-disable-next-line @typescript-eslint/no-var-requires, no-var */
|
|
11
|
+
export var Dpapi: DpapiBindings = require("bindings")({
|
|
12
|
+
bindings: "dpapi",
|
|
13
|
+
userDefinedTries: [
|
|
14
|
+
['module_root', 'node_modules', '@azure', 'msal-node-extensions', 'build', 'Release', 'bindings'],
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export default Dpapi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
void ProtectDataCommon(bool protect, Nan::NAN_METHOD_ARGS_TYPE info);
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
void ProtectDataCommon(bool protect, Nan::NAN_METHOD_ARGS_TYPE info);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
#include <node.h>
|
|
7
|
-
|
|
8
|
-
v8::Local<v8::String> CreateUtf8String(v8::Isolate* isolate, char* strData)
|
|
9
|
-
{
|
|
10
|
-
return v8::String::NewFromUtf8(isolate, strData, v8::NewStringType::kNormal).ToLocalChecked();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
void ProtectDataCommon(bool protect, Nan::NAN_METHOD_ARGS_TYPE info)
|
|
14
|
-
{
|
|
15
|
-
v8::Isolate* isolate = info.GetIsolate();
|
|
16
|
-
|
|
17
|
-
isolate->ThrowException(v8::Exception::Error(
|
|
18
|
-
CreateUtf8String(isolate, "Data protection API is not available on macOs or Linux")));
|
|
19
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#include <node.h>
|
|
7
|
+
|
|
8
|
+
v8::Local<v8::String> CreateUtf8String(v8::Isolate* isolate, char* strData)
|
|
9
|
+
{
|
|
10
|
+
return v8::String::NewFromUtf8(isolate, strData, v8::NewStringType::kNormal).ToLocalChecked();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void ProtectDataCommon(bool protect, Nan::NAN_METHOD_ARGS_TYPE info)
|
|
14
|
+
{
|
|
15
|
+
v8::Isolate* isolate = info.GetIsolate();
|
|
16
|
+
|
|
17
|
+
isolate->ThrowException(v8::Exception::Error(
|
|
18
|
+
CreateUtf8String(isolate, "Data protection API is not available on macOs or Linux")));
|
|
19
|
+
}
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
// Implementation referenced from https://github.com/bradhugh/node-dpapi
|
|
6
|
-
|
|
7
|
-
#include <node.h>
|
|
8
|
-
#include <nan.h>
|
|
9
|
-
#include <Windows.h>
|
|
10
|
-
#include <dpapi.h>
|
|
11
|
-
#include <functional>
|
|
12
|
-
#include <iostream>
|
|
13
|
-
#include <string>
|
|
14
|
-
|
|
15
|
-
v8::Local<v8::String> CreateUtf8String(v8::Isolate* isolate, char* strData)
|
|
16
|
-
{
|
|
17
|
-
return v8::String::NewFromUtf8(isolate, strData, v8::NewStringType::kNormal).ToLocalChecked();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
void ProtectDataCommon(bool protect, Nan::NAN_METHOD_ARGS_TYPE info)
|
|
21
|
-
{
|
|
22
|
-
v8::Isolate* isolate = info.GetIsolate();
|
|
23
|
-
|
|
24
|
-
if (info.Length() != 3) {
|
|
25
|
-
isolate->ThrowException(v8::Exception::RangeError(
|
|
26
|
-
CreateUtf8String(isolate, "3 arguments are required")));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (info[0]->IsNullOrUndefined() || !info[0]->IsUint8Array())
|
|
30
|
-
{
|
|
31
|
-
isolate->ThrowException(v8::Exception::TypeError(
|
|
32
|
-
CreateUtf8String(isolate, "First argument, data, must be a valid Uint8Array")));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!info[1]->IsNull() && !info[1]->IsUint8Array())
|
|
36
|
-
{
|
|
37
|
-
isolate->ThrowException(v8::Exception::TypeError(
|
|
38
|
-
CreateUtf8String(isolate, "Second argument, optionalEntropy, must be null or an ArrayBuffer")));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (info[2]->IsNullOrUndefined() || !info[2]->IsString())
|
|
42
|
-
{
|
|
43
|
-
isolate->ThrowException(v8::Exception::TypeError(
|
|
44
|
-
CreateUtf8String(isolate, "Third argument, scope, must be a string")));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
DWORD flags = 0;
|
|
48
|
-
v8::String::Utf8Value strData(isolate, info[2]);
|
|
49
|
-
std::string scope(*strData);
|
|
50
|
-
if (stricmp(scope.c_str(), "LocalMachine") == 0)
|
|
51
|
-
{
|
|
52
|
-
flags = CRYPTPROTECT_LOCAL_MACHINE;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
auto buffer = node::Buffer::Data(info[0]);
|
|
56
|
-
auto len = node::Buffer::Length(info[0]);
|
|
57
|
-
|
|
58
|
-
DATA_BLOB entropyBlob;
|
|
59
|
-
entropyBlob.pbData = nullptr;
|
|
60
|
-
if (!info[1]->IsNull())
|
|
61
|
-
{
|
|
62
|
-
entropyBlob.pbData = reinterpret_cast<BYTE*>(node::Buffer::Data(info[1]));
|
|
63
|
-
entropyBlob.cbData = node::Buffer::Length(info[1]);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
DATA_BLOB dataIn;
|
|
67
|
-
DATA_BLOB dataOut;
|
|
68
|
-
|
|
69
|
-
// initialize input data
|
|
70
|
-
dataIn.pbData = reinterpret_cast<BYTE*>(buffer);
|
|
71
|
-
dataIn.cbData = len;
|
|
72
|
-
|
|
73
|
-
bool success = false;
|
|
74
|
-
|
|
75
|
-
// Call either Protect or Unprotect based on the flag
|
|
76
|
-
if (protect)
|
|
77
|
-
{
|
|
78
|
-
success = CryptProtectData(
|
|
79
|
-
&dataIn,
|
|
80
|
-
nullptr, // Description string
|
|
81
|
-
entropyBlob.pbData ? &entropyBlob : nullptr,
|
|
82
|
-
nullptr, // reserved
|
|
83
|
-
nullptr, // pass null for the prompt structure
|
|
84
|
-
flags, // dwFlags
|
|
85
|
-
&dataOut);
|
|
86
|
-
}
|
|
87
|
-
else
|
|
88
|
-
{
|
|
89
|
-
success = CryptUnprotectData(
|
|
90
|
-
&dataIn,
|
|
91
|
-
nullptr, // Description string
|
|
92
|
-
entropyBlob.pbData ? &entropyBlob : nullptr,
|
|
93
|
-
nullptr, // reserved
|
|
94
|
-
nullptr, // pass null for the prompt structure
|
|
95
|
-
flags, // dwFlags
|
|
96
|
-
&dataOut);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (!success)
|
|
100
|
-
{
|
|
101
|
-
DWORD errorCode = GetLastError();
|
|
102
|
-
std::string errorMessage = std::string("Encryption/Decryption failed. Error code: ") + std::to_string(errorCode);
|
|
103
|
-
isolate->ThrowException(v8::Exception::Error(
|
|
104
|
-
CreateUtf8String(isolate, &errorMessage[0])));
|
|
105
|
-
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Copy and free the buffer
|
|
110
|
-
auto returnBuffer = Nan::CopyBuffer(reinterpret_cast<const char*>(dataOut.pbData), dataOut.cbData).ToLocalChecked();
|
|
111
|
-
LocalFree(dataOut.pbData);
|
|
112
|
-
|
|
113
|
-
info.GetReturnValue().Set(returnBuffer);
|
|
114
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
// Implementation referenced from https://github.com/bradhugh/node-dpapi
|
|
6
|
+
|
|
7
|
+
#include <node.h>
|
|
8
|
+
#include <nan.h>
|
|
9
|
+
#include <Windows.h>
|
|
10
|
+
#include <dpapi.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
#include <iostream>
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
v8::Local<v8::String> CreateUtf8String(v8::Isolate* isolate, char* strData)
|
|
16
|
+
{
|
|
17
|
+
return v8::String::NewFromUtf8(isolate, strData, v8::NewStringType::kNormal).ToLocalChecked();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void ProtectDataCommon(bool protect, Nan::NAN_METHOD_ARGS_TYPE info)
|
|
21
|
+
{
|
|
22
|
+
v8::Isolate* isolate = info.GetIsolate();
|
|
23
|
+
|
|
24
|
+
if (info.Length() != 3) {
|
|
25
|
+
isolate->ThrowException(v8::Exception::RangeError(
|
|
26
|
+
CreateUtf8String(isolate, "3 arguments are required")));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (info[0]->IsNullOrUndefined() || !info[0]->IsUint8Array())
|
|
30
|
+
{
|
|
31
|
+
isolate->ThrowException(v8::Exception::TypeError(
|
|
32
|
+
CreateUtf8String(isolate, "First argument, data, must be a valid Uint8Array")));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!info[1]->IsNull() && !info[1]->IsUint8Array())
|
|
36
|
+
{
|
|
37
|
+
isolate->ThrowException(v8::Exception::TypeError(
|
|
38
|
+
CreateUtf8String(isolate, "Second argument, optionalEntropy, must be null or an ArrayBuffer")));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (info[2]->IsNullOrUndefined() || !info[2]->IsString())
|
|
42
|
+
{
|
|
43
|
+
isolate->ThrowException(v8::Exception::TypeError(
|
|
44
|
+
CreateUtf8String(isolate, "Third argument, scope, must be a string")));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
DWORD flags = 0;
|
|
48
|
+
v8::String::Utf8Value strData(isolate, info[2]);
|
|
49
|
+
std::string scope(*strData);
|
|
50
|
+
if (stricmp(scope.c_str(), "LocalMachine") == 0)
|
|
51
|
+
{
|
|
52
|
+
flags = CRYPTPROTECT_LOCAL_MACHINE;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
auto buffer = node::Buffer::Data(info[0]);
|
|
56
|
+
auto len = node::Buffer::Length(info[0]);
|
|
57
|
+
|
|
58
|
+
DATA_BLOB entropyBlob;
|
|
59
|
+
entropyBlob.pbData = nullptr;
|
|
60
|
+
if (!info[1]->IsNull())
|
|
61
|
+
{
|
|
62
|
+
entropyBlob.pbData = reinterpret_cast<BYTE*>(node::Buffer::Data(info[1]));
|
|
63
|
+
entropyBlob.cbData = node::Buffer::Length(info[1]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
DATA_BLOB dataIn;
|
|
67
|
+
DATA_BLOB dataOut;
|
|
68
|
+
|
|
69
|
+
// initialize input data
|
|
70
|
+
dataIn.pbData = reinterpret_cast<BYTE*>(buffer);
|
|
71
|
+
dataIn.cbData = len;
|
|
72
|
+
|
|
73
|
+
bool success = false;
|
|
74
|
+
|
|
75
|
+
// Call either Protect or Unprotect based on the flag
|
|
76
|
+
if (protect)
|
|
77
|
+
{
|
|
78
|
+
success = CryptProtectData(
|
|
79
|
+
&dataIn,
|
|
80
|
+
nullptr, // Description string
|
|
81
|
+
entropyBlob.pbData ? &entropyBlob : nullptr,
|
|
82
|
+
nullptr, // reserved
|
|
83
|
+
nullptr, // pass null for the prompt structure
|
|
84
|
+
flags, // dwFlags
|
|
85
|
+
&dataOut);
|
|
86
|
+
}
|
|
87
|
+
else
|
|
88
|
+
{
|
|
89
|
+
success = CryptUnprotectData(
|
|
90
|
+
&dataIn,
|
|
91
|
+
nullptr, // Description string
|
|
92
|
+
entropyBlob.pbData ? &entropyBlob : nullptr,
|
|
93
|
+
nullptr, // reserved
|
|
94
|
+
nullptr, // pass null for the prompt structure
|
|
95
|
+
flags, // dwFlags
|
|
96
|
+
&dataOut);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!success)
|
|
100
|
+
{
|
|
101
|
+
DWORD errorCode = GetLastError();
|
|
102
|
+
std::string errorMessage = std::string("Encryption/Decryption failed. Error code: ") + std::to_string(errorCode);
|
|
103
|
+
isolate->ThrowException(v8::Exception::Error(
|
|
104
|
+
CreateUtf8String(isolate, &errorMessage[0])));
|
|
105
|
+
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Copy and free the buffer
|
|
110
|
+
auto returnBuffer = Nan::CopyBuffer(reinterpret_cast<const char*>(dataOut.pbData), dataOut.cbData).ToLocalChecked();
|
|
111
|
+
LocalFree(dataOut.pbData);
|
|
112
|
+
|
|
113
|
+
info.GetReturnValue().Set(returnBuffer);
|
|
114
|
+
}
|
package/src/dpapi-addon/main.cpp
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
#include <nan.h>
|
|
7
|
-
#include "dpapi_addon.h"
|
|
8
|
-
|
|
9
|
-
NAN_METHOD(protectData)
|
|
10
|
-
{
|
|
11
|
-
ProtectDataCommon(true, info);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
NAN_METHOD(unprotectData)
|
|
15
|
-
{
|
|
16
|
-
ProtectDataCommon(false, info);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
NAN_MODULE_INIT(init)
|
|
20
|
-
{
|
|
21
|
-
Nan::Set(
|
|
22
|
-
target,
|
|
23
|
-
Nan::New<v8::String>("protectData").ToLocalChecked(),
|
|
24
|
-
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(protectData)).ToLocalChecked());
|
|
25
|
-
|
|
26
|
-
Nan::Set(
|
|
27
|
-
target,
|
|
28
|
-
Nan::New<v8::String>("unprotectData").ToLocalChecked(),
|
|
29
|
-
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(unprotectData)).ToLocalChecked());
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
NODE_MODULE(binding, init)
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#include <nan.h>
|
|
7
|
+
#include "dpapi_addon.h"
|
|
8
|
+
|
|
9
|
+
NAN_METHOD(protectData)
|
|
10
|
+
{
|
|
11
|
+
ProtectDataCommon(true, info);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
NAN_METHOD(unprotectData)
|
|
15
|
+
{
|
|
16
|
+
ProtectDataCommon(false, info);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
NAN_MODULE_INIT(init)
|
|
20
|
+
{
|
|
21
|
+
Nan::Set(
|
|
22
|
+
target,
|
|
23
|
+
Nan::New<v8::String>("protectData").ToLocalChecked(),
|
|
24
|
+
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(protectData)).ToLocalChecked());
|
|
25
|
+
|
|
26
|
+
Nan::Set(
|
|
27
|
+
target,
|
|
28
|
+
Nan::New<v8::String>("unprotectData").ToLocalChecked(),
|
|
29
|
+
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(unprotectData)).ToLocalChecked());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
NODE_MODULE(binding, init)
|