forked from coolaj86/bluecrypt-keypairs.js
error print
This commit is contained in:
parent
0e802df186
commit
13be5d8eb6
57
app.js
57
app.js
|
@ -127,32 +127,47 @@
|
||||||
$$('input').map(function ($el) { $el.disabled = true; });
|
$$('input').map(function ($el) { $el.disabled = true; });
|
||||||
$$('button').map(function ($el) { $el.disabled = true; });
|
$$('button').map(function ($el) { $el.disabled = true; });
|
||||||
|
|
||||||
var opts = {
|
try {
|
||||||
jwk: JSON.parse($('textarea[name="jwk"]').value),
|
|
||||||
claims: {
|
|
||||||
exp: "1h",
|
|
||||||
iss: document.getElementById(`-acmeDomains`).value
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Keypairs.signJwt(opts).then(function (msg) {
|
|
||||||
$('.js-jwt').innerText = msg;
|
var opts = {
|
||||||
$('.js-toc-jwt').hidden = false;
|
jwk: JSON.parse($('textarea[name="jwk"]').value),
|
||||||
var msgArr = msg.split(".")
|
claims: {
|
||||||
var protected64 = msgArr[0]
|
exp: "1h",
|
||||||
var payload64 = msgArr[1]
|
iss: document.getElementById(`-acmeDomains`).value
|
||||||
var signature = msgArr[2]
|
}
|
||||||
var signedMsg = {
|
|
||||||
protected: protected64
|
|
||||||
, payload: payload64
|
|
||||||
, signature
|
|
||||||
};
|
};
|
||||||
$('.js-jws').innerText = JSON.stringify(signedMsg, null, 2);
|
|
||||||
$('.js-toc-jws').hidden = false;
|
Keypairs.signJwt(opts).then(function (msg) {
|
||||||
|
document.getElementById(`sign-error`).innerText = null;
|
||||||
|
$('.js-jwt').innerText = msg;
|
||||||
|
$('.js-toc-jwt').hidden = false;
|
||||||
|
var msgArr = msg.split(".")
|
||||||
|
var protected64 = msgArr[0]
|
||||||
|
var payload64 = msgArr[1]
|
||||||
|
var signature = msgArr[2]
|
||||||
|
var signedMsg = {
|
||||||
|
protected: protected64
|
||||||
|
, payload: payload64
|
||||||
|
, signature
|
||||||
|
};
|
||||||
|
$('.js-jws').innerText = JSON.stringify(signedMsg, null, 2);
|
||||||
|
$('.js-toc-jws').hidden = false;
|
||||||
|
$('.js-pem-loading').hidden = true;
|
||||||
|
$$('input').map(function ($el) { $el.disabled = false; });
|
||||||
|
$$('button').map(function ($el) { $el.disabled = false; });
|
||||||
|
}).catch(function (error) {
|
||||||
|
document.getElementById(`sign-error`).innerText = error.message
|
||||||
|
$('.js-pem-loading').hidden = true;
|
||||||
|
$$('input').map(function ($el) { $el.disabled = false; });
|
||||||
|
$$('button').map(function ($el) { $el.disabled = false; });
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
document.getElementById(`sign-error`).innerText = error.message
|
||||||
$('.js-pem-loading').hidden = true;
|
$('.js-pem-loading').hidden = true;
|
||||||
$$('input').map(function ($el) { $el.disabled = false; });
|
$$('input').map(function ($el) { $el.disabled = false; });
|
||||||
$$('button').map(function ($el) { $el.disabled = false; });
|
$$('button').map(function ($el) { $el.disabled = false; });
|
||||||
})
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
19
index.html
19
index.html
|
@ -7,14 +7,17 @@
|
||||||
width: 42em;
|
width: 42em;
|
||||||
height: 10em;
|
height: 10em;
|
||||||
}
|
}
|
||||||
/* need to word wrap the binary no space der */
|
/* need to word wrap the binary no space der */
|
||||||
.js-der-public, .js-der-private, .js-jwt{
|
.js-der-public, .js-der-private, .js-jwt{
|
||||||
white-space: pre-wrap; /* CSS3 */
|
white-space: pre-wrap; /* CSS3 */
|
||||||
white-space: -moz-pre-wrap; /* Firefox */
|
white-space: -moz-pre-wrap; /* Firefox */
|
||||||
white-space: -pre-wrap; /* Opera <7 */
|
white-space: -pre-wrap; /* Opera <7 */
|
||||||
white-space: -o-pre-wrap; /* Opera 7 */
|
white-space: -o-pre-wrap; /* Opera 7 */
|
||||||
word-wrap: break-word; /* IE */
|
word-wrap: break-word; /* IE */
|
||||||
}
|
}
|
||||||
|
.errors {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue