openapi-explorer 0.8.284 → 0.8.287

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.8.284",
3
+ "version": "0.8.287",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Rhosys Developers <developers@rhosys.ch>",
6
6
  "repository": {
@@ -53,7 +53,6 @@
53
53
  "openapi-data-validator": "^2.0.40",
54
54
  "path-browserify": "^1.0.1",
55
55
  "prismjs": "^1.23.0",
56
- "randombytes": "^2.1.0",
57
56
  "regex-to-strings": "^2.0.3",
58
57
  "swagger-client": "^3.13"
59
58
  },
@@ -1035,6 +1035,12 @@ export default class ApiRequest extends LitElement {
1035
1035
  let respText;
1036
1036
  tryBtnEl.disabled = true;
1037
1037
  const fetchStart = new Date();
1038
+
1039
+ this.responseMessage = '';
1040
+ this.responseUrl = '';
1041
+ this.responseHeaders = '';
1042
+ this.responseText = '';
1043
+
1038
1044
  fetchResponse = await fetch(fetchRequestObject);
1039
1045
  this.responseElapsedMs = new Date() - fetchStart;
1040
1046
  tryBtnEl.disabled = false;
@@ -1111,9 +1117,8 @@ export default class ApiRequest extends LitElement {
1111
1117
  this.dispatchEvent(new CustomEvent('response', responseEvent));
1112
1118
  } catch (error) {
1113
1119
  tryBtnEl.disabled = false;
1114
- this.responseMessage = `${error.message} (CORS or Network Issue)`;
1115
- this.responseUrl = '';
1116
- this.responseHeaders = '';
1120
+ this.responseMessage = `${error.message} (Check the browser network tab for more information.)`;
1121
+ this.responseStatus = 'error';
1117
1122
  const responseEvent = {
1118
1123
  bubbles: true,
1119
1124
  composed: true,
@@ -2,7 +2,6 @@ import { html } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
3
3
  import { marked } from 'marked';
4
4
  import base64url from 'base64url';
5
- import randomBytes from 'randombytes';
6
5
 
7
6
  function onApiKeyChange(apiKeyId, e) {
8
7
  let apiKeyValue = '';
@@ -181,11 +180,13 @@ async function onInvokeOAuthFlow(apiKeyId, flowType, authUrl, tokenUrl, e) {
181
180
  const authUrlObj = new URL(authUrl);
182
181
  const authCodeParams = new URLSearchParams(authUrlObj.search);
183
182
  if (flowType === 'authorizationCode') {
184
- authCodeParams.set('nonce', randomBytes(64).toString('hex'));
183
+ const randomBytes = new Uint32Array(3);
184
+ (window.crypto || window.msCrypto).getRandomValues(randomBytes);
185
+ authCodeParams.set('nonce', randomBytes.toString('hex').split(',').join(''));
185
186
  grantType = 'authorization_code';
186
187
  responseType = 'code';
187
- const codeVerifier = randomBytes(64).toString('hex');
188
- const hash = await window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
188
+ const codeVerifier = randomBytes.toString('hex').split(',').join('');
189
+ const hash = await (window.crypto || window.msCrypto).subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
189
190
  const codeChallenge = base64url(hash);
190
191
 
191
192
  authCodeParams.set('code_challenge', codeChallenge);