@azure/msal-node-extensions 1.0.0-alpha.14 → 1.0.0-alpha.15

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.
@@ -1,5 +1,5 @@
1
1
  import { IPersistence } from "./IPersistence";
2
- import { IPersistenceConfiguration } from "../persistence/IPersistenceConfiguration";
2
+ import { IPersistenceConfiguration } from "./IPersistenceConfiguration";
3
3
  export declare class PersistenceCreator {
4
4
  static createPersistence(config: IPersistenceConfiguration): Promise<IPersistence>;
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/msal-node-extensions",
3
- "version": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
@@ -30,6 +30,7 @@
30
30
  "build:common": "cd ../../lib/msal-common && npm run build",
31
31
  "build:all": "npm run build:common && npm run build",
32
32
  "test": "tsdx test",
33
+ "test:coverage": "tsdx test --coverage",
33
34
  "lint": "cd ../../ && npm run lint:node:extensions",
34
35
  "lint:fix": "npm run lint -- -- --fix",
35
36
  "link:localDeps": "npx lerna bootstrap --scope @azure/msal-common --scope @azure/msal-node-extensions",
@@ -49,9 +50,9 @@
49
50
  ]
50
51
  },
51
52
  "dependencies": {
52
- "@azure/msal-common": "^6.0.0",
53
+ "@azure/msal-common": "^6.1.0",
53
54
  "bindings": "git+https://github.com/samuelkubai/node-bindings.git#v1.6.0",
54
- "keytar": "^7.6.0",
55
+ "keytar": "^7.8.0",
55
56
  "nan": "^2.13.2"
56
57
  },
57
58
  "devDependencies": {
@@ -7,11 +7,11 @@ export interface DpapiBindings{
7
7
  protectData(dataToEncrypt: Uint8Array, optionalEntropy: Uint8Array, scope: string): Uint8Array
8
8
  unprotectData(encryptData: Uint8Array, optionalEntropy: Uint8Array, scope: string): Uint8Array
9
9
  }
10
- /* eslint-disable-next-line @typescript-eslint/no-var-requires, no-var */
10
+ /* eslint-disable-next-line @typescript-eslint/no-var-requires, no-var, import/no-commonjs */
11
11
  export var Dpapi: DpapiBindings = require("bindings")({
12
12
  bindings: "dpapi",
13
13
  userDefinedTries: [
14
- ['module_root', 'node_modules', '@azure', 'msal-node-extensions', 'build', 'Release', 'bindings'],
14
+ ["module_root", "node_modules", "@azure", "msal-node-extensions", "build", "Release", "bindings"],
15
15
  ]
16
16
  });
17
17
  export default Dpapi;
@@ -3,15 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { FilePersistenceWithDataProtection } from "../persistence/FilePersistenceWithDataProtection";
7
- import { LibSecretPersistence } from "../persistence/LibSecretPersistence";
8
- import { KeychainPersistence } from "../persistence/KeychainPersistence";
9
- import { DataProtectionScope } from "../persistence/DataProtectionScope";
6
+ import { FilePersistenceWithDataProtection } from "./FilePersistenceWithDataProtection";
7
+ import { LibSecretPersistence } from "./LibSecretPersistence";
8
+ import { KeychainPersistence } from "./KeychainPersistence";
9
+ import { DataProtectionScope } from "./DataProtectionScope";
10
10
  import { Environment } from "../utils/Environment";
11
11
  import { IPersistence } from "./IPersistence";
12
12
  import { FilePersistence } from "./FilePersistence";
13
13
  import { PersistenceError } from "../error/PersistenceError";
14
- import { IPersistenceConfiguration } from "../persistence/IPersistenceConfiguration";
14
+ import { IPersistenceConfiguration } from "./IPersistenceConfiguration";
15
15
 
16
16
  export class PersistenceCreator {
17
17
  static async createPersistence(config: IPersistenceConfiguration): Promise<IPersistence> {
@@ -20,7 +20,7 @@ export class PersistenceCreator {
20
20
  // On Windows, uses a DPAPI encrypted file
21
21
  if (Environment.isWindowsPlatform()) {
22
22
  if (!config.cachePath || !config.dataProtectionScope) {
23
- throw PersistenceError.createPersistenceNotValidatedError(`Cache path and/or data protection scope not provided for the FilePersistenceWithDataProtection cache plugin`);
23
+ throw PersistenceError.createPersistenceNotValidatedError("Cache path and/or data protection scope not provided for the FilePersistenceWithDataProtection cache plugin");
24
24
  }
25
25
 
26
26
  peristence = await FilePersistenceWithDataProtection.create(config.cachePath, DataProtectionScope.CurrentUser);
@@ -29,7 +29,7 @@ export class PersistenceCreator {
29
29
  // On Mac, uses keychain.
30
30
  else if (Environment.isMacPlatform()) {
31
31
  if (!config.cachePath || !config.serviceName || !config.accountName) {
32
- throw PersistenceError.createPersistenceNotValidatedError(`Cache path, service name and/or account name not provided for the KeychainPersistence cache plugin`);
32
+ throw PersistenceError.createPersistenceNotValidatedError("Cache path, service name and/or account name not provided for the KeychainPersistence cache plugin");
33
33
  }
34
34
 
35
35
  peristence = await KeychainPersistence.create(config.cachePath, config.serviceName, config.accountName);
@@ -38,7 +38,7 @@ export class PersistenceCreator {
38
38
  // On Linux, uses libsecret to store to secret service. Libsecret has to be installed.
39
39
  else if (Environment.isLinuxPlatform()) {
40
40
  if (!config.cachePath || !config.serviceName || !config.accountName) {
41
- throw PersistenceError.createPersistenceNotValidatedError(`Cache path, service name and/or account name not provided for the LibSecretPersistence cache plugin`);
41
+ throw PersistenceError.createPersistenceNotValidatedError("Cache path, service name and/or account name not provided for the LibSecretPersistence cache plugin");
42
42
  }
43
43
 
44
44
  peristence = await LibSecretPersistence.create(config.cachePath, config.serviceName, config.accountName);
@@ -54,7 +54,7 @@ export class PersistenceCreator {
54
54
  if (!isPersistenceVerified) {
55
55
  if (Environment.isLinuxPlatform() && config.usePlaintextFileOnLinux) {
56
56
  if (!config.cachePath) {
57
- throw PersistenceError.createPersistenceNotValidatedError(`Cache path not provided for the FilePersistence cache plugin`);
57
+ throw PersistenceError.createPersistenceNotValidatedError("Cache path not provided for the FilePersistence cache plugin");
58
58
  }
59
59
 
60
60
  peristence = await FilePersistence.create(config.cachePath);
@@ -59,4 +59,4 @@ export enum Platform {
59
59
  WINDOWS = "win32",
60
60
  LINUX = "linux",
61
61
  MACOS = "darwin"
62
- };
62
+ }
@@ -9,23 +9,23 @@ import { PersistenceError } from "../error/PersistenceError";
9
9
  import { StringUtils } from "@azure/msal-common";
10
10
 
11
11
  export class Environment {
12
- static get homeEnvVar() {
12
+ static get homeEnvVar(): string {
13
13
  return this.getEnvironmentVariable(Constants.ENVIRONMENT.HOME);
14
14
  }
15
15
 
16
- static get lognameEnvVar() {
16
+ static get lognameEnvVar(): string {
17
17
  return this.getEnvironmentVariable(Constants.ENVIRONMENT.LOGNAME);
18
18
  }
19
19
 
20
- static get userEnvVar() {
20
+ static get userEnvVar(): string {
21
21
  return this.getEnvironmentVariable(Constants.ENVIRONMENT.USER);
22
22
  }
23
23
 
24
- static get lnameEnvVar() {
24
+ static get lnameEnvVar(): string {
25
25
  return this.getEnvironmentVariable(Constants.ENVIRONMENT.LNAME);
26
26
  }
27
27
 
28
- static get usernameEnvVar() {
28
+ static get usernameEnvVar(): string {
29
29
  return this.getEnvironmentVariable(Constants.ENVIRONMENT.USERNAME);
30
30
  }
31
31
 
@@ -50,13 +50,13 @@ export class Environment {
50
50
  }
51
51
 
52
52
  static isLinuxRootUser(): boolean {
53
- return process.getuid() == Constants.LINUX_ROOT_USER_GUID;
53
+ return process.getuid() === Constants.LINUX_ROOT_USER_GUID;
54
54
  }
55
55
 
56
56
  static getUserRootDirectory(): string {
57
57
  return !this.isWindowsPlatform ?
58
58
  this.getUserHomeDirOnUnix() :
59
- this.getUserHomeDirOnWindows()
59
+ this.getUserHomeDirOnWindows();
60
60
  }
61
61
 
62
62
  static getUserHomeDirOnWindows(): string {
@@ -65,7 +65,7 @@ export class Environment {
65
65
 
66
66
  static getUserHomeDirOnUnix(): string | null {
67
67
  if (this.isWindowsPlatform()) {
68
- throw PersistenceError.createNotSupportedError("Getting the user home directory for unix is not supported in windows")
68
+ throw PersistenceError.createNotSupportedError("Getting the user home directory for unix is not supported in windows");
69
69
  }
70
70
 
71
71
  if (!StringUtils.isEmpty(this.homeEnvVar)) {
@@ -92,7 +92,7 @@ export class Environment {
92
92
  return !StringUtils.isEmpty(username) ? path.join("/home", username) : null;
93
93
  }
94
94
  } else {
95
- throw PersistenceError.createNotSupportedError("Getting the user home directory for unix is not supported in windows")
95
+ throw PersistenceError.createNotSupportedError("Getting the user home directory for unix is not supported in windows");
96
96
  }
97
97
 
98
98
  }