Change function names

main
Bob Mottram 2020-08-06 21:16:42 +01:00
parent 63712d6dca
commit e6ded5c795
3 changed files with 19 additions and 18 deletions

View File

@ -193,7 +193,7 @@ from bookmarks import undoBookmark
from petnames import setPetName
from followingCalendar import addPersonToCalendar
from followingCalendar import removePersonFromCalendar
from devices import devicesCollection
from devices import E2EEdevicesCollection
import os
@ -1545,10 +1545,11 @@ class PubServer(BaseHTTPRequestHandler):
nickname = self.path.split('/users/')
if '/' in nickname:
nickname = nickname.split('/')[0]
devJson = devicesCollection(self.server.baseDir,
nickname, self.server.domain,
self.server.domainFull,
self.server.httpPrefix)
devJson = E2EEdevicesCollection(self.server.baseDir,
nickname,
self.server.domain,
self.server.domainFull,
self.server.httpPrefix)
msg = json.dumps(devJson,
ensure_ascii=False).encode('utf-8')
self._set_headers('application/json',

View File

@ -34,8 +34,8 @@ from utils import loadJson
from utils import saveJson
def removeDevice(baseDir: str, nickname: str, domain: str,
deviceId: str) -> bool:
def E2EEremoveDevice(baseDir: str, nickname: str, domain: str,
deviceId: str) -> bool:
"""Unregisters a device for e2ee
"""
personDir = baseDir + '/accounts/' + nickname + '@' + domain
@ -46,12 +46,12 @@ def removeDevice(baseDir: str, nickname: str, domain: str,
return False
def addDevice(baseDir: str, nickname: str, domain: str,
deviceId: str, name: str, claimUrl: str,
fingerprintPublicKey: str,
identityPublicKey: str,
fingerprintKeyType="Ed25519Key",
identityKeyType="Curve25519Key") -> bool:
def E2EEaddDevice(baseDir: str, nickname: str, domain: str,
deviceId: str, name: str, claimUrl: str,
fingerprintPublicKey: str,
identityPublicKey: str,
fingerprintKeyType="Ed25519Key",
identityKeyType="Curve25519Key") -> bool:
"""Registers a device for e2ee
claimUrl could be something like:
http://localhost:3000/users/admin/claim?id=11119
@ -83,8 +83,8 @@ def addDevice(baseDir: str, nickname: str, domain: str,
return saveJson(deviceDict, deviceFilename)
def devicesCollection(baseDir: str, nickname: str, domain: str,
domainFull: str, httpPrefix: str) -> {}:
def E2EEdevicesCollection(baseDir: str, nickname: str, domain: str,
domainFull: str, httpPrefix: str) -> {}:
"""Returns a list of registered devices
"""
personDir = baseDir + '/accounts/' + nickname + '@' + domain
@ -112,7 +112,7 @@ def devicesCollection(baseDir: str, nickname: str, domain: str,
return devicesDict
def decryptMessageFromDevice(messageJson: {}) -> str:
def E2EEdecryptMessageFromDevice(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

View File

@ -78,7 +78,7 @@ from git import isGitPatch
from theme import getThemesList
from petnames import getPetName
from followingCalendar import receivingCalendarEvents
from devices import decryptMessageFromDevice
from devices import E2EEdecryptMessageFromDevice
def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str:
@ -4255,7 +4255,7 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
if postJsonObject['object'].get('cipherText'):
postJsonObject['object']['content'] = \
decryptMessageFromDevice(postJsonObject['object'])
E2EEdecryptMessageFromDevice(postJsonObject['object'])
if not postJsonObject['object'].get('content'):
return ''