@azure/msal-node-extensions 1.0.0-alpha.8 → 1.0.0-beta.0
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/LICENSE +21 -21
- package/README.md +208 -42
- package/bin/arm64/dpapi.node +0 -0
- package/bin/ia32/dpapi.node +0 -0
- package/bin/x64/dpapi.node +0 -0
- package/dist/{dpapi-addon/Dpapi.d.ts → Dpapi.d.ts} +4 -4
- package/dist/Dpapi.esm.js +24 -0
- package/dist/Dpapi.esm.js.map +1 -0
- package/dist/Dpapi.js +24 -0
- package/dist/Dpapi.js.map +1 -0
- package/dist/broker/NativeBrokerPlugin.d.ts +20 -0
- package/dist/broker/NativeBrokerPlugin.esm.js +408 -0
- package/dist/broker/NativeBrokerPlugin.esm.js.map +1 -0
- package/dist/broker/NativeBrokerPlugin.js +410 -0
- package/dist/broker/NativeBrokerPlugin.js.map +1 -0
- package/dist/error/NativeAuthError.d.ts +6 -0
- package/dist/error/NativeAuthError.esm.js +20 -0
- package/dist/error/NativeAuthError.esm.js.map +1 -0
- package/dist/error/NativeAuthError.js +22 -0
- package/dist/error/NativeAuthError.js.map +1 -0
- package/dist/error/PersistenceError.d.ts +21 -0
- package/{src/error/PersistenceError.ts → dist/error/PersistenceError.esm.js} +88 -70
- package/dist/error/PersistenceError.esm.js.map +1 -0
- package/dist/error/PersistenceError.js +91 -0
- package/dist/error/PersistenceError.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +12 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -0
- package/dist/lock/CrossPlatformLock.esm.js +94 -0
- package/dist/lock/CrossPlatformLock.esm.js.map +1 -0
- package/dist/lock/CrossPlatformLock.js +96 -0
- package/dist/lock/CrossPlatformLock.js.map +1 -0
- package/dist/lock/CrossPlatformLockOptions.d.ts +1 -1
- package/dist/packageMetadata.d.ts +2 -0
- package/dist/packageMetadata.esm.js +8 -0
- package/dist/packageMetadata.esm.js.map +1 -0
- package/dist/packageMetadata.js +11 -0
- package/dist/packageMetadata.js.map +1 -0
- package/{src/persistence/BasePersistence.ts → dist/persistence/BasePersistence.esm.js} +35 -40
- package/dist/persistence/BasePersistence.esm.js.map +1 -0
- package/dist/persistence/BasePersistence.js +38 -0
- package/dist/persistence/BasePersistence.js.map +1 -0
- package/dist/persistence/DataProtectionScope.d.ts +5 -4
- package/{src/persistence/DataProtectionScope.ts → dist/persistence/DataProtectionScope.esm.js} +23 -19
- package/dist/persistence/DataProtectionScope.esm.js.map +1 -0
- package/dist/persistence/DataProtectionScope.js +26 -0
- package/dist/persistence/DataProtectionScope.js.map +1 -0
- package/dist/persistence/FilePersistence.d.ts +1 -0
- package/dist/persistence/FilePersistence.esm.js +173 -0
- package/dist/persistence/FilePersistence.esm.js.map +1 -0
- package/dist/persistence/FilePersistence.js +175 -0
- package/dist/persistence/FilePersistence.js.map +1 -0
- package/dist/persistence/FilePersistenceWithDataProtection.esm.js +84 -0
- package/dist/persistence/FilePersistenceWithDataProtection.esm.js.map +1 -0
- package/dist/persistence/FilePersistenceWithDataProtection.js +86 -0
- package/dist/persistence/FilePersistenceWithDataProtection.js.map +1 -0
- package/dist/persistence/IPersistenceConfiguration.d.ts +10 -0
- package/dist/persistence/KeychainPersistence.d.ts +2 -2
- package/dist/persistence/KeychainPersistence.esm.js +90 -0
- package/dist/persistence/KeychainPersistence.esm.js.map +1 -0
- package/dist/persistence/KeychainPersistence.js +92 -0
- package/dist/persistence/KeychainPersistence.js.map +1 -0
- package/dist/persistence/LibSecretPersistence.d.ts +2 -2
- package/dist/persistence/LibSecretPersistence.esm.js +91 -0
- package/dist/persistence/LibSecretPersistence.esm.js.map +1 -0
- package/dist/persistence/LibSecretPersistence.js +93 -0
- package/dist/persistence/LibSecretPersistence.js.map +1 -0
- package/dist/persistence/PersistenceCachePlugin.d.ts +1 -1
- package/{src/persistence/PersistenceCachePlugin.ts → dist/persistence/PersistenceCachePlugin.esm.js} +97 -104
- package/dist/persistence/PersistenceCachePlugin.esm.js.map +1 -0
- package/dist/persistence/PersistenceCachePlugin.js +101 -0
- package/dist/persistence/PersistenceCachePlugin.js.map +1 -0
- package/dist/persistence/PersistenceCreator.d.ts +5 -0
- package/dist/persistence/PersistenceCreator.esm.js +63 -0
- package/dist/persistence/PersistenceCreator.esm.js.map +1 -0
- package/dist/persistence/PersistenceCreator.js +65 -0
- package/dist/persistence/PersistenceCreator.js.map +1 -0
- package/dist/utils/Constants.d.ts +29 -0
- package/dist/utils/Constants.esm.js +62 -0
- package/dist/utils/Constants.esm.js.map +1 -0
- package/dist/utils/Constants.js +66 -0
- package/dist/utils/Constants.js.map +1 -0
- package/dist/utils/Environment.d.ts +16 -0
- package/dist/utils/Environment.esm.js +94 -0
- package/dist/utils/Environment.esm.js.map +1 -0
- package/dist/utils/Environment.js +96 -0
- package/dist/utils/Environment.js.map +1 -0
- package/dist/utils/TypeGuards.d.ts +5 -0
- package/dist/utils/TypeGuards.esm.js +16 -0
- package/dist/utils/TypeGuards.esm.js.map +1 -0
- package/dist/utils/TypeGuards.js +18 -0
- package/dist/utils/TypeGuards.js.map +1 -0
- package/package.json +70 -52
- package/CHANGELOG.json +0 -146
- package/binding.gyp +0 -29
- package/changelog.md +0 -68
- package/dist/msal-node-extensions.cjs.development.js +0 -687
- package/dist/msal-node-extensions.cjs.development.js.map +0 -1
- package/dist/msal-node-extensions.cjs.production.min.js +0 -2
- package/dist/msal-node-extensions.cjs.production.min.js.map +0 -1
- package/dist/msal-node-extensions.esm.js +0 -692
- package/dist/msal-node-extensions.esm.js.map +0 -1
- package/src/dpapi-addon/Dpapi.ts +0 -12
- package/src/dpapi-addon/dpapi_addon.h +0 -6
- package/src/dpapi-addon/dpapi_not_supported.cpp +0 -19
- package/src/dpapi-addon/dpapi_win.cpp +0 -114
- package/src/dpapi-addon/main.cpp +0 -32
- package/src/index.ts +0 -13
- package/src/lock/CrossPlatformLock.ts +0 -89
- package/src/lock/CrossPlatformLockOptions.ts +0 -15
- package/src/persistence/FilePersistence.ts +0 -140
- package/src/persistence/FilePersistenceWithDataProtection.ts +0 -92
- package/src/persistence/IPersistence.ts +0 -17
- package/src/persistence/KeychainPersistence.ts +0 -86
- package/src/persistence/LibSecretPersistence.ts +0 -87
- package/src/utils/Constants.ts +0 -35
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Logger } from "@azure/msal-common";
|
|
7
|
-
|
|
8
|
-
export interface IPersistence {
|
|
9
|
-
save(contents: string): Promise<void>;
|
|
10
|
-
load(): Promise<string | null>;
|
|
11
|
-
delete(): Promise<boolean>;
|
|
12
|
-
reloadNecessary(lastSync: number): Promise<boolean>;
|
|
13
|
-
getFilePath(): string;
|
|
14
|
-
getLogger(): Logger;
|
|
15
|
-
verifyPersistence(): Promise<boolean>;
|
|
16
|
-
createForPersistenceValidation(): Promise<IPersistence>;
|
|
17
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { setPassword, getPassword, deletePassword } from "keytar";
|
|
7
|
-
import { FilePersistence } from "./FilePersistence";
|
|
8
|
-
import { IPersistence } from "./IPersistence";
|
|
9
|
-
import { PersistenceError } from "../error/PersistenceError";
|
|
10
|
-
import { Logger, LoggerOptions } from "@azure/msal-common";
|
|
11
|
-
import { dirname } from "path";
|
|
12
|
-
import { BasePersistence } from "./BasePersistence";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Uses reads and writes passwords to macOS keychain
|
|
16
|
-
*
|
|
17
|
-
* serviceName: Identifier used as key for whatever value is stored
|
|
18
|
-
* accountName: Account under which password should be stored
|
|
19
|
-
*/
|
|
20
|
-
export class KeychainPersistence extends BasePersistence implements IPersistence {
|
|
21
|
-
|
|
22
|
-
protected readonly serviceName;
|
|
23
|
-
protected readonly accountName;
|
|
24
|
-
private filePersistence: FilePersistence;
|
|
25
|
-
|
|
26
|
-
private constructor(serviceName: string, accountName: string) {
|
|
27
|
-
super();
|
|
28
|
-
this.serviceName = serviceName;
|
|
29
|
-
this.accountName = accountName;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public static async create(
|
|
33
|
-
fileLocation: string,
|
|
34
|
-
serviceName: string,
|
|
35
|
-
accountName: string,
|
|
36
|
-
loggerOptions?: LoggerOptions): Promise<KeychainPersistence> {
|
|
37
|
-
|
|
38
|
-
const persistence = new KeychainPersistence(serviceName, accountName);
|
|
39
|
-
persistence.filePersistence = await FilePersistence.create(fileLocation, loggerOptions);
|
|
40
|
-
return persistence;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public async save(contents: string): Promise<void> {
|
|
44
|
-
try {
|
|
45
|
-
await setPassword(this.serviceName, this.accountName, contents);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
throw PersistenceError.createKeychainPersistenceError(err.message);
|
|
48
|
-
}
|
|
49
|
-
// Write dummy data to update file mtime
|
|
50
|
-
await this.filePersistence.save("{}");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public async load(): Promise<string | null> {
|
|
54
|
-
try{
|
|
55
|
-
return await getPassword(this.serviceName, this.accountName);
|
|
56
|
-
} catch(err){
|
|
57
|
-
throw PersistenceError.createKeychainPersistenceError(err.message);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public async delete(): Promise<boolean> {
|
|
62
|
-
try {
|
|
63
|
-
await this.filePersistence.delete();
|
|
64
|
-
return await deletePassword(this.serviceName, this.accountName);
|
|
65
|
-
} catch (err) {
|
|
66
|
-
throw PersistenceError.createKeychainPersistenceError(err.message);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public async reloadNecessary(lastSync: number): Promise<boolean> {
|
|
71
|
-
return this.filePersistence.reloadNecessary(lastSync);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public getFilePath(): string {
|
|
75
|
-
return this.filePersistence.getFilePath();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public getLogger(): Logger {
|
|
79
|
-
return this.filePersistence.getLogger();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public createForPersistenceValidation(): Promise<KeychainPersistence> {
|
|
83
|
-
const testCacheFileLocation = `${dirname(this.filePersistence.getFilePath())}/test.cache`;
|
|
84
|
-
return KeychainPersistence.create(testCacheFileLocation, "persistenceValidationServiceName", "persistencValidationAccountName");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { setPassword, getPassword, deletePassword } from "keytar";
|
|
7
|
-
import { FilePersistence } from "./FilePersistence";
|
|
8
|
-
import { IPersistence } from "./IPersistence";
|
|
9
|
-
import { PersistenceError } from "../error/PersistenceError";
|
|
10
|
-
import { Logger, LoggerOptions } from "@azure/msal-common";
|
|
11
|
-
import { dirname } from "path";
|
|
12
|
-
import { BasePersistence } from "./BasePersistence";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Uses reads and writes passwords to Secret Service API/libsecret. Requires libsecret
|
|
16
|
-
* to be installed.
|
|
17
|
-
*
|
|
18
|
-
* serviceName: Identifier used as key for whatever value is stored
|
|
19
|
-
* accountName: Account under which password should be stored
|
|
20
|
-
*/
|
|
21
|
-
export class LibSecretPersistence extends BasePersistence implements IPersistence {
|
|
22
|
-
|
|
23
|
-
protected readonly serviceName;
|
|
24
|
-
protected readonly accountName;
|
|
25
|
-
private filePersistence: FilePersistence;
|
|
26
|
-
|
|
27
|
-
private constructor(serviceName: string, accountName: string) {
|
|
28
|
-
super();
|
|
29
|
-
this.serviceName = serviceName;
|
|
30
|
-
this.accountName = accountName;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public static async create(
|
|
34
|
-
fileLocation: string,
|
|
35
|
-
serviceName: string,
|
|
36
|
-
accountName: string,
|
|
37
|
-
loggerOptions?: LoggerOptions): Promise<LibSecretPersistence> {
|
|
38
|
-
|
|
39
|
-
const persistence = new LibSecretPersistence(serviceName, accountName);
|
|
40
|
-
persistence.filePersistence = await FilePersistence.create(fileLocation, loggerOptions);
|
|
41
|
-
return persistence;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public async save(contents: string): Promise<void> {
|
|
45
|
-
try {
|
|
46
|
-
await setPassword(this.serviceName, this.accountName, contents);
|
|
47
|
-
} catch (err) {
|
|
48
|
-
throw PersistenceError.createLibSecretError(err.message);
|
|
49
|
-
}
|
|
50
|
-
// Write dummy data to update file mtime
|
|
51
|
-
await this.filePersistence.save("{}");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public async load(): Promise<string | null> {
|
|
55
|
-
try {
|
|
56
|
-
return await getPassword(this.serviceName, this.accountName);
|
|
57
|
-
} catch (err) {
|
|
58
|
-
throw PersistenceError.createLibSecretError(err.message);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public async delete(): Promise<boolean> {
|
|
63
|
-
try {
|
|
64
|
-
await this.filePersistence.delete();
|
|
65
|
-
return await deletePassword(this.serviceName, this.accountName);
|
|
66
|
-
} catch (err) {
|
|
67
|
-
throw PersistenceError.createLibSecretError(err.message);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public async reloadNecessary(lastSync: number): Promise<boolean> {
|
|
72
|
-
return this.filePersistence.reloadNecessary(lastSync);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public getFilePath(): string {
|
|
76
|
-
return this.filePersistence.getFilePath();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public getLogger(): Logger {
|
|
80
|
-
return this.filePersistence.getLogger();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public createForPersistenceValidation(): Promise<LibSecretPersistence> {
|
|
84
|
-
const testCacheFileLocation = `${dirname(this.filePersistence.getFilePath())}/test.cache`;
|
|
85
|
-
return LibSecretPersistence.create(testCacheFileLocation, "persistenceValidationServiceName", "persistencValidationAccountName");
|
|
86
|
-
}
|
|
87
|
-
}
|
package/src/utils/Constants.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export const Constants = {
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* An existing file was the target of an operation that required that the target not exist
|
|
10
|
-
*/
|
|
11
|
-
EEXIST_ERROR: "EEXIST",
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* No such file or directory: Commonly raised by fs operations to indicate that a component
|
|
15
|
-
* of the specified pathname does not exist. No entity (file or directory) could be found
|
|
16
|
-
* by the given path
|
|
17
|
-
*/
|
|
18
|
-
ENOENT_ERROR: "ENOENT",
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Operation not permitted. An attempt was made to perform an operation that requires
|
|
22
|
-
* elevated privileges.
|
|
23
|
-
*/
|
|
24
|
-
EPERM_ERROR: "EPERM",
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Default service name for using MSAL Keytar
|
|
28
|
-
*/
|
|
29
|
-
DEFAULT_SERVICE_NAME: "msal-node-extensions",
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Test data used to verify underlying persistence mechanism
|
|
33
|
-
*/
|
|
34
|
-
PERSISTENCE_TEST_DATA: "Dummy data to verify underlying persistence mechanism"
|
|
35
|
-
};
|