added signature validity display to web ui mail

master
Kevin Froman 2019-02-05 17:20:36 -06:00
parent bec8ecdc12
commit 06048fe442
3 changed files with 22 additions and 1 deletions

View File

@ -498,6 +498,12 @@ class API:
except AttributeError: except AttributeError:
pass pass
else: else:
validSig = False
signer = self._core._utils.bytesToStr(bl.signer)
print(signer, bl.isSigned(), self._core._utils.validatePubKey(signer), bl.isSigner(signer))
if bl.isSigned() and self._core._utils.validatePubKey(signer) and bl.isSigner(signer):
validSig = True
bl.bheader['validSig'] = validSig
bl.bheader['meta'] = '' bl.bheader['meta'] = ''
retData = {'meta': bl.bheader, 'metadata': bl.bmetadata} retData = {'meta': bl.bheader, 'metadata': bl.bmetadata}
return json.dumps(retData) return json.dumps(retData)

View File

@ -27,8 +27,10 @@
<div id='messageDisplay' class='overlay'> <div id='messageDisplay' class='overlay'>
<div class='overlayContent'> <div class='overlayContent'>
<span class='closeOverlay' overlay='messageDisplay'></span> <span class='closeOverlay' overlay='messageDisplay'></span>
<div>From: <input type='text' id='fromUser' readonly> <div>
From: <input type='text' id='fromUser' readonly>
</div> </div>
<div id='signatureValidity'></div>
<div id='threadDisplay'> <div id='threadDisplay'>
</div> </div>
</div> </div>

View File

@ -63,10 +63,22 @@ function loadInboxEntrys(bHash){
var senderInput = document.createElement('input') var senderInput = document.createElement('input')
var subjectLine = document.createElement('span') var subjectLine = document.createElement('span')
var dateStr = document.createElement('span') var dateStr = document.createElement('span')
var validSig = document.createElement('span')
var humanDate = new Date(0) var humanDate = new Date(0)
var metadata = resp['metadata'] var metadata = resp['metadata']
humanDate.setUTCSeconds(resp['meta']['time']) humanDate.setUTCSeconds(resp['meta']['time'])
senderInput.value = httpGet('/getHumanReadable/' + resp['meta']['signer']) senderInput.value = httpGet('/getHumanReadable/' + resp['meta']['signer'])
alert(resp['meta']['validSig'])
if (resp['meta']['validSig']){
validSig.innerText = 'Signature Validity: Good'
}
else{
validSig.innerText = 'Signature Validity: Bad'
validSig.style.color = 'red';
}
if (senderInput.value == ''){
senderInput.value = 'Anonymous'
}
bHashDisplay.innerText = bHash.substring(0, 10) bHashDisplay.innerText = bHash.substring(0, 10)
entry.setAttribute('hash', bHash); entry.setAttribute('hash', bHash);
senderInput.readOnly = true senderInput.readOnly = true
@ -81,6 +93,7 @@ function loadInboxEntrys(bHash){
threadPart.appendChild(entry) threadPart.appendChild(entry)
entry.appendChild(bHashDisplay) entry.appendChild(bHashDisplay)
entry.appendChild(senderInput) entry.appendChild(senderInput)
entry.appendChild(validSig)
entry.appendChild(subjectLine) entry.appendChild(subjectLine)
entry.appendChild(dateStr) entry.appendChild(dateStr)
entry.classList.add('threadEntry') entry.classList.add('threadEntry')