@equinor/fusion-framework-module-msal-node 1.0.1 → 1.0.3

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 +1 @@
1
- export declare const version = "1.0.1";
1
+ export declare const version = "1.0.3";
@@ -0,0 +1,140 @@
1
+ This CLI enables secure authentication and persistent token caching by storing credentials in your system's keychain. It uses [`@azure/msal-node`](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node) for authentication, which relies on the [`keytar`](https://github.com/atom/node-keytar) module for secure credential storage.
2
+
3
+ > **What is `libsecret`?**
4
+ > [`libsecret`](https://wiki.gnome.org/Projects/Libsecret) is a library for storing and retrieving passwords and secrets. On Linux, `keytar` depends on `libsecret` to access the system keyring.
5
+
6
+ > **Common Issue: `Cannot find module '../build/Release/keytar.node'`**
7
+ > This error occurs when the `keytar` native module isn't properly built or installed. It can happen on any platform (Windows, macOS, Linux) and usually indicates missing build tools or failed native compilation.
8
+
9
+ ## Platform Requirements
10
+
11
+ - **Windows:** No additional dependencies. `keytar` uses the Windows Credential Manager.
12
+ - **macOS:** No additional dependencies. `keytar` uses the macOS Keychain. If you encounter unusual issues (rare), you can optionally try installing `libsecret`:
13
+ ```bash
14
+ brew install libsecret
15
+ ```
16
+ - **Linux:** You must install `libsecret` for secure credential storage. See below for instructions.
17
+
18
+ > [!CAUTION]
19
+ > "Linux is supported for cache persistence, but not yet for native brokering."
20
+ > https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/8035
21
+
22
+ ## Windows Installation
23
+
24
+ While Windows doesn't require `libsecret`, you may encounter `keytar` native module issues. Ensure you have the necessary build tools:
25
+
26
+ ### Prerequisites
27
+ - **Visual Studio Build Tools** or **Visual Studio Community** with C++ workload
28
+ - **Python** (for node-gyp)
29
+ - **Node.js** with npm/yarn
30
+
31
+ ### Installation Steps
32
+ 1. Install Visual Studio Build Tools:
33
+ - Download from [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/)
34
+ - Select "C++ build tools" workload
35
+ - Or install via command line:
36
+ ```bash
37
+ # Using winget
38
+ winget install Microsoft.VisualStudio.2022.BuildTools
39
+ ```
40
+
41
+ 2. Install Python (if not already installed):
42
+ ```bash
43
+ # Using winget
44
+ winget install Python.Python.3.11
45
+ ```
46
+
47
+ 3. Rebuild keytar:
48
+ ```bash
49
+ npm rebuild keytar
50
+ # or
51
+ yarn rebuild keytar
52
+ ```
53
+
54
+ ## Linux Installation
55
+ Install the `libsecret` library based on your distribution:
56
+
57
+ - **Ubuntu/Debian**:
58
+ ```bash
59
+ sudo apt-get update
60
+ sudo apt-get install -y libsecret-1-0 libsecret-1-dev
61
+ ```
62
+ > Both runtime and development packages are required for building native modules.
63
+ - **Fedora**:
64
+ ```bash
65
+ sudo dnf install -y libsecret libsecret-devel
66
+ ```
67
+ > Install both runtime and development packages if you plan to build native modules.
68
+ - **Arch Linux**:
69
+ ```bash
70
+ sudo pacman -S --noconfirm libsecret
71
+ ```
72
+
73
+ ## Verifying Installation
74
+ After installing `libsecret`, rebuild `keytar` to ensure it links correctly:
75
+
76
+ ```bash
77
+ npm rebuild keytar
78
+ ```
79
+
80
+ You can verify that `keytar` is working by running your CLI and checking for credential storage warnings. Alternatively, you can test with a simple script:
81
+
82
+ ```js
83
+ const keytar = require('keytar');
84
+ keytar.setPassword('test-service', 'test-account', 'test-password')
85
+ .then(() => keytar.getPassword('test-service', 'test-account'))
86
+ .then(console.log)
87
+ .catch(console.error);
88
+ ```
89
+ If you see errors related to `keytar` or `libsecret`, see troubleshooting below.
90
+
91
+ ## Troubleshooting
92
+
93
+ ### Common Issues
94
+
95
+ #### `Cannot find module '../build/Release/keytar.node'`
96
+ This error occurs on all platforms when the `keytar` native module isn't properly built.
97
+
98
+ **Windows:**
99
+ - Ensure Visual Studio Build Tools are installed with C++ workload
100
+ - Install Python for node-gyp
101
+ - Rebuild keytar: `npm rebuild keytar` or `yarn rebuild keytar`
102
+
103
+ **macOS:**
104
+ - Ensure Xcode Command Line Tools are installed: `xcode-select --install`
105
+ - Rebuild keytar: `npm rebuild keytar`
106
+
107
+ **Linux:**
108
+ - Install libsecret development packages (see Linux Installation section)
109
+ - Rebuild keytar: `npm rebuild keytar`
110
+
111
+ #### Missing `libsecret` errors (Linux only)
112
+ - Ensure you have installed both the runtime and development packages (e.g., `libsecret-1-0` and `libsecret-1-dev` on Ubuntu/Debian).
113
+
114
+ #### General Solutions
115
+ - **Rebuild keytar:**
116
+ ```bash
117
+ npm rebuild keytar
118
+ # or
119
+ yarn rebuild keytar
120
+ ```
121
+ - **Clean install:**
122
+ ```bash
123
+ rm -rf node_modules package-lock.json
124
+ npm install
125
+ # or
126
+ rm -rf node_modules yarn.lock
127
+ yarn install
128
+ ```
129
+
130
+ #### Still having issues?
131
+ - **Windows:** Check that Visual Studio Build Tools are properly installed and Python is in your PATH
132
+ - **macOS:** Verify Xcode Command Line Tools are installed and up to date
133
+ - **Linux:** Ensure your system keyring (e.g., GNOME Keyring or KWallet) is running and unlocked. On some headless or minimal Linux environments, you may need to start or configure the keyring daemon manually.
134
+ - See the [`keytar` troubleshooting guide](https://github.com/atom/node-keytar#troubleshooting).
135
+ - Consult your distribution's documentation for keyring setup.
136
+
137
+ ## Resources
138
+ - [`keytar` documentation](https://github.com/atom/node-keytar)
139
+ - [`libsecret` project page](https://wiki.gnome.org/Projects/Libsecret)
140
+ - [@azure/msal-node](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-module-msal-node",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Fusion Framework module for secure Azure AD authentication in Node.js using MSAL. Supports interactive, silent, and token-only authentication modes with encrypted token storage.",
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '1.0.1';
2
+ export const version = '1.0.3';