Local decrypt dummy function

main
Bob Mottram 2020-08-05 13:47:15 +01:00
parent 021ce1355c
commit 0c90cde8f3
2 changed files with 35 additions and 0 deletions

View File

@ -37,3 +37,32 @@ def devicesCollection(baseDir: str, nickname: str, domain: str,
'items': deviceList 'items': deviceList
} }
return devicesDict return devicesDict
def decryptMessageFromDevice(messageJson: {}) -> str:
"""Locally decrypts a message on the device.
This should probably be a link to a local script
or native app, such that what the user sees isn't
something which the server could get access to.
"""
# TODO
# {
# "type": "EncryptedMessage",
# "messageType": 0,
# "cipherText": "...",
# "digest": {
# "type": "Digest",
# "digestAlgorithm": "http://www.w3.org/2000/09/xmldsig#hmac-sha256",
# "digestValue": "5f6ad31acd64995483d75c7..."
# },
# "messageFranking": "...",
# "attributedTo": {
# "type": "Device",
# "deviceId": "11119"
# },
# "to": {
# "type": "Device",
# "deviceId": "11876"
# }
# }
return ''

View File

@ -78,6 +78,7 @@ from git import isGitPatch
from theme import getThemesList from theme import getThemesList
from petnames import getPetName from petnames import getPetName
from followingCalendar import receivingCalendarEvents from followingCalendar import receivingCalendarEvents
from devices import decryptMessageFromDevice
def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str: def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str:
@ -4248,8 +4249,13 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
if not postJsonObject['object'].get('summary'): if not postJsonObject['object'].get('summary'):
postJsonObject['object']['summary'] = '' postJsonObject['object']['summary'] = ''
if postJsonObject['object'].get('cipherText'):
postJsonObject['object']['content'] = \
decryptMessageFromDevice(postJsonObject['object'])
if not postJsonObject['object'].get('content'): if not postJsonObject['object'].get('content'):
return '' return ''
isPatch = isGitPatch(baseDir, nickname, domain, isPatch = isGitPatch(baseDir, nickname, domain,
postJsonObject['object']['type'], postJsonObject['object']['type'],
postJsonObject['object']['summary'], postJsonObject['object']['summary'],