openapi-explorer 0.8.285 → 0.8.286
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/dist/openapi-explorer.min.js +4 -4
- package/dist/openapi-explorer.min.js.LICENSE.txt +1 -3
- package/dist/openapi-explorer.min.js.LICENSE.txt.gz +0 -0
- package/dist/openapi-explorer.min.js.gz +0 -0
- package/dist/report.html +2 -2
- package/package.json +1 -2
- package/src/openapi-explorer.js +0 -5
- package/src/templates/security-scheme-template.js +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.286",
|
|
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
|
},
|
package/src/openapi-explorer.js
CHANGED
|
@@ -31,11 +31,6 @@ import responsiveViewMainBodyTemplate from './templates/responsiveViewMainBodyTe
|
|
|
31
31
|
import apiRequestStyles from './styles/api-request-styles';
|
|
32
32
|
import { checkForAuthToken } from './templates/security-scheme-template';
|
|
33
33
|
|
|
34
|
-
if (typeof global === undefined) {
|
|
35
|
-
// eslint-disable-next-line no-global-assign
|
|
36
|
-
global = {};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
export default class OpenApiExplorer extends LitElement {
|
|
40
35
|
constructor() {
|
|
41
36
|
super();
|
|
@@ -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
|
-
|
|
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
|
|
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);
|