forked from Mirrors/keyoxide-web
Fixing signature verification
This commit is contained in:
parent
5c98e3e395
commit
7fb3784ef6
1 changed files with 5 additions and 4 deletions
|
@ -138,13 +138,13 @@ const runVerificationForm = () => {
|
||||||
// Try two different methods of signature reading
|
// Try two different methods of signature reading
|
||||||
let signature = null, verified = null, readError = null;
|
let signature = null, verified = null, readError = null;
|
||||||
try {
|
try {
|
||||||
signature = await openpgp.createMessage({
|
signature = await openpgp.readMessage({
|
||||||
armoredMessage: elFormVerify.querySelector('.input').value
|
armoredMessage: elFormVerify.querySelector('.input').value
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
try {
|
try {
|
||||||
signature = await openpgp.createCleartextMessage({
|
signature = await openpgp.readCleartextMessage({
|
||||||
armoredMessage: elFormVerify.querySelector('.input').value
|
cleartextMessage: elFormVerify.querySelector('.input').value
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
readError = e;
|
readError = e;
|
||||||
|
@ -158,7 +158,8 @@ const runVerificationForm = () => {
|
||||||
verificationKeys: window.kx.key.object
|
verificationKeys: window.kx.key.object
|
||||||
});
|
});
|
||||||
|
|
||||||
if (verified.signatures[0].valid) {
|
console.log(verified);
|
||||||
|
if (await verified.signatures[0].verified) {
|
||||||
elFormVerify.querySelector('.output').value = `The message was signed by the profile's key.`;
|
elFormVerify.querySelector('.output').value = `The message was signed by the profile's key.`;
|
||||||
} else {
|
} else {
|
||||||
elFormVerify.querySelector('.output').value = `The message was NOT signed by the profile's key.`;
|
elFormVerify.querySelector('.output').value = `The message was NOT signed by the profile's key.`;
|
||||||
|
|
Loading…
Reference in a new issue