forked from indymedia/epicyon
Add jsonld signatures to posts
parent
e5200139db
commit
8af75436b6
15
posts.py
15
posts.py
|
@ -53,6 +53,7 @@ from blocking import isBlocked
|
|||
from filters import isFiltered
|
||||
from git import convertPostToPatch
|
||||
from semantic import labelAccusatoryPost
|
||||
from jsonldsig import jsonldSign
|
||||
# try:
|
||||
# from BeautifulSoup import BeautifulSoup
|
||||
# except ImportError:
|
||||
|
@ -1418,6 +1419,13 @@ def sendPost(projectVersion: str,
|
|||
return 7
|
||||
postPath = inboxUrl.split(toDomain, 1)[1]
|
||||
|
||||
try:
|
||||
signedPostJsonObject = jsonldSign(postJsonObject, privateKeyPem)
|
||||
postJsonObject = signedPostJsonObject
|
||||
except BaseException:
|
||||
print('WARN: failed to JSON-LD sign post')
|
||||
pass
|
||||
|
||||
# convert json to string so that there are no
|
||||
# subsequent conversions after creating message body digest
|
||||
postJsonStr = json.dumps(postJsonObject)
|
||||
|
@ -1741,6 +1749,13 @@ def sendSignedJson(postJsonObject: {}, session, baseDir: str,
|
|||
|
||||
addFollowersToPublicPost(postJsonObject)
|
||||
|
||||
try:
|
||||
signedPostJsonObject = jsonldSign(postJsonObject, privateKeyPem)
|
||||
postJsonObject = signedPostJsonObject
|
||||
except BaseException:
|
||||
print('WARN: failed to JSON-LD sign post')
|
||||
pass
|
||||
|
||||
# convert json to string so that there are no
|
||||
# subsequent conversions after creating message body digest
|
||||
postJsonStr = json.dumps(postJsonObject)
|
||||
|
|
Loading…
Reference in New Issue