Skip to content

Commit a4c3e7b

Browse files
committed
Initialization fixes.
1 parent aed1490 commit a4c3e7b

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export function httpGet(url, cache = true) {
2828
});
2929
}
3030

31-
export function downloadPublicKeyIfPossible() {
32-
return '';
31+
export function downloadPublicKeyIfPossible(decodedToken) {
32+
return Promise.reject();
3333
}
3434

3535
export function isValidBase64String(s, urlOnly) {

src/website/editor/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { copyTextToClipboard } from '../utils.js';
2+
import { downloadPublicKeyIfPossible } from '../../utils.js';
23
import { tooltipHandler } from './tooltip.js';
34
import { tokenEditor, headerEditor, payloadEditor } from './instances.js';
45
import {
@@ -273,12 +274,12 @@ function setupEvents() {
273274
eventManager.addCodeMirrorEvent(payloadEditor, 'change', encodeToken);
274275

275276
// HMAC secret, when changed the encoded token must be updated.
276-
eventManager.addDomEvent(secretInput, 'change', encodeToken);
277+
eventManager.addDomEvent(secretInput, 'input', encodeToken);
277278
// Private key, when changed the encoded token must be updated.
278-
eventManager.addDomEvent(privateKeyTextArea, 'change', encodeToken);
279+
eventManager.addDomEvent(privateKeyTextArea, 'input', encodeToken);
279280
// Public key, when changed the encoded token must NOT be updated
280281
// (only verified).
281-
eventManager.addDomEvent(publicKeyTextArea, 'change', verifyToken);
282+
eventManager.addDomEvent(publicKeyTextArea, 'input', verifyToken);
282283

283284
// The following event are never disabled, so it is not necessary to go
284285
// through the event manager for them.
@@ -296,5 +297,6 @@ export function setTokenEditorValue(value) {
296297
export function setupTokenEditor() {
297298
setupEvents();
298299
selectAlgorithm('HS256');
300+
useDefaultToken('HS256');
299301
fixEditorHeight();
300302
}

src/website/editor/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ export function fixEditorHeight() {
3434
}
3535

3636
export function stringify(object) {
37-
return JSON.stringify(object, 2);
37+
return JSON.stringify(object, null, 2);
3838
}

0 commit comments

Comments
 (0)