@equinor/fusion-framework-module-msal-node 2.0.4-msal-v5.0 → 3.0.1

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.md CHANGED
@@ -1,13 +1,21 @@
1
1
  # @equinor/fusion-framework-module-msal-node
2
2
 
3
- ## 2.0.4-msal-v5.0
3
+ ## 3.0.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [#3944](https://github.com/equinor/fusion-framework/pull/3944) [`312755f`](https://github.com/equinor/fusion-framework/commit/312755f01c7592329aec847ee4956fe9bf58458f) Thanks [@dependabot](https://github.com/apps/dependabot)! - pre-release msal v5
7
+ - [#4157](https://github.com/equinor/fusion-framework/pull/4157) [`6aa8e1f`](https://github.com/equinor/fusion-framework/commit/6aa8e1f5c9d852b25e97aa7d98a63008c64d4581) Thanks [@Noggling](https://github.com/Noggling)! - Internal: patch release to align TypeScript types across packages for consistent type compatibility.
8
8
 
9
- - Updated dependencies [[`312755f`](https://github.com/equinor/fusion-framework/commit/312755f01c7592329aec847ee4956fe9bf58458f)]:
10
- - @equinor/fusion-framework-module@5.0.6-msal-v5.0
9
+ - Updated dependencies [[`6aa8e1f`](https://github.com/equinor/fusion-framework/commit/6aa8e1f5c9d852b25e97aa7d98a63008c64d4581)]:
10
+ - @equinor/fusion-framework-module@5.0.6
11
+
12
+ ## 3.0.0
13
+
14
+ ### Major Changes
15
+
16
+ - [#3929](https://github.com/equinor/fusion-framework/pull/3929) [`46a1c71`](https://github.com/equinor/fusion-framework/commit/46a1c710d9cd2ed20946932ceab2a5e8c0fb8a2b) Thanks [@dependabot](https://github.com/apps/dependabot)! - Require Node.js >= 20 for `@equinor/fusion-framework-module-msal-node` due to upgrading `@azure/msal-node` and `@azure/msal-node-extensions` to v5.
17
+
18
+ Migration: upgrade runtimes to Node.js 20+.
11
19
 
12
20
  ## 2.0.3
13
21
 
@@ -1,7 +1,29 @@
1
- import { CryptoProvider, } from '@azure/msal-node';
1
+ import { createHash, randomBytes } from 'node:crypto';
2
2
  import openBrowser from 'open';
3
3
  import { createAuthServer } from './create-auth-server.js';
4
4
  import { AuthProvider } from './AuthProvider.js';
5
+ /**
6
+ * Encodes a byte buffer to Base64 URL encoding (RFC 4648 §5) without padding.
7
+ *
8
+ * Used for PKCE code verifier/challenge values (RFC 7636).
9
+ *
10
+ * @param buffer - Bytes to encode.
11
+ * @returns Base64url-encoded string without trailing `=` padding.
12
+ */
13
+ const base64UrlEncode = (buffer) => buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
14
+ /**
15
+ * Generates PKCE verifier and challenge for the authorization code flow.
16
+ *
17
+ * Uses a 32-octet cryptographically random verifier (recommended by RFC 7636)
18
+ * and derives the S256 challenge as `BASE64URL-ENCODE(SHA256(ASCII(verifier)))`.
19
+ *
20
+ * @returns PKCE verifier and S256 challenge.
21
+ */
22
+ const generatePkceCodes = () => {
23
+ const verifier = base64UrlEncode(randomBytes(32));
24
+ const challenge = base64UrlEncode(createHash('sha256').update(verifier).digest());
25
+ return { verifier, challenge };
26
+ };
5
27
  /**
6
28
  * Implementation of an interactive authentication provider for the Fusion MSAL Node module.
7
29
  *
@@ -43,8 +65,7 @@ export class AuthProviderInteractive extends AuthProvider {
43
65
  // Generate a new PKCE code verifier and challenge
44
66
  // This is used to enhance security in the authorization code flow
45
67
  // by preventing authorization code interception attacks.
46
- const cryptoProvider = new CryptoProvider();
47
- const { verifier, challenge } = await cryptoProvider.generatePkceCodes();
68
+ const { verifier, challenge } = generatePkceCodes();
48
69
  const authCodeUrl = await this._client.getAuthCodeUrl({
49
70
  scopes,
50
71
  redirectUri: `http://localhost:${port}`,
@@ -1 +1 @@
1
- {"version":3,"file":"AuthProviderInteractive.js","sourceRoot":"","sources":["../../src/AuthProviderInteractive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,WAAW,MAAM,MAAM,C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MAAM,EAAE,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '2.0.4-msal-v5.0';
2
+ export const version = '3.0.1';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}