@adobe/helix-html-pipeline 3.0.1 → 3.0.2

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,3 +1,10 @@
1
+ ## [3.0.2](https://github.com/adobe/helix-html-pipeline/compare/v3.0.1...v3.0.2) (2022-06-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * make crypto.randomUUID() portable ([d40ba5a](https://github.com/adobe/helix-html-pipeline/commit/d40ba5ab67c764726d923061d4844e5adb162c86))
7
+
1
8
  ## [3.0.1](https://github.com/adobe/helix-html-pipeline/compare/v3.0.0...v3.0.1) (2022-06-14)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/utils/auth.js CHANGED
@@ -10,7 +10,6 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  // eslint-disable-next-line max-classes-per-file
13
- import crypto from 'crypto';
14
13
  import {
15
14
  createLocalJWKSet, createRemoteJWKSet, decodeJwt, jwtVerify, UnsecuredJWT,
16
15
  } from 'jose';
@@ -18,6 +17,17 @@ import { clearAuthCookie, getAuthCookie, setAuthCookie } from './auth-cookie.js'
18
17
 
19
18
  import idpMicrosoft from './idp-configs/microsoft.js';
20
19
 
20
+ let cryptoImpl;
21
+ import('crypto')
22
+ .then((crypto) => {
23
+ cryptoImpl = crypto;
24
+ })
25
+ /* c8 ignore next 3 */
26
+ .catch(() => {
27
+ // eslint-disable-next-line no-undef
28
+ cryptoImpl = crypto;
29
+ });
30
+
21
31
  export const IDPS = [
22
32
  idpMicrosoft,
23
33
  ];
@@ -179,7 +189,7 @@ export class AuthInfo {
179
189
  url.searchParams.append('client_id', clientId);
180
190
  url.searchParams.append('response_type', 'code');
181
191
  url.searchParams.append('scope', idp.scope);
182
- url.searchParams.append('nonce', crypto.randomUUID());
192
+ url.searchParams.append('nonce', cryptoImpl.randomUUID());
183
193
  url.searchParams.append('state', tokenState);
184
194
  url.searchParams.append('redirect_uri', state.createExternalLocation(AUTH_REDIRECT_URL));
185
195
  url.searchParams.append('prompt', 'select_account');