From d05a4169981114a017e26a5ae0145a1e2db65a89 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Aug 2019 11:57:27 +0100 Subject: [PATCH] quieten some debug --- epicyon.py | 20 ++++++++------------ httpsig.py | 20 ++++++++++---------- posts.py | 4 ++-- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/epicyon.py b/epicyon.py index 3f40d7811..dbe3679e6 100644 --- a/epicyon.py +++ b/epicyon.py @@ -821,22 +821,18 @@ if args.actor: domain,__version__) else: wfRequest={ - "aliases": [ - httpPrefix+'://'+domain+'/users/inbox' - ], - "links": [ - { - "href": httpPrefix+'://'+domain+'/users/inbox', - "rel": "self", - "type": "application/activity+json" - } - ], - "subject": 'acct:inbox@'+domain - } + 'aliases': [httpPrefix+'://'+domain+'/@inbox', + httpPrefix+'://'+domain+'/users/inbox'], + 'links': [{'href': httpPrefix+'://'+domain+'/users/inbox', + 'rel': 'self', + 'type': 'application/activity+json'}], + 'subject': 'acct:inbox@'+domain + } if not wfRequest: print('Unable to webfinger '+nickname+'@'+domain) sys.exit() + asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'} personUrl = getUserUrl(wfRequest) personJson = getJson(session,personUrl,asHeader,None,__version__,httpPrefix,domain) diff --git a/httpsig.py b/httpsig.py index 7e7f4e11d..48c364131 100644 --- a/httpsig.py +++ b/httpsig.py @@ -142,8 +142,8 @@ def verifyPostHeaders(httpPrefix: str,publicKeyPem: str,headers: dict, \ k: v[1:-1] for k, v in [i.split('=', 1) for i in signatureHeader.split(',')] } - print('********************signatureHeader: '+str(signatureHeader)) - print('********************signatureDict: '+str(signatureDict)) + #print('********************signatureHeader: '+str(signatureHeader)) + #print('********************signatureDict: '+str(signatureDict)) # Unpack the signed headers and set values based on current headers and # body (if a digest was included) @@ -152,32 +152,32 @@ def verifyPostHeaders(httpPrefix: str,publicKeyPem: str,headers: dict, \ if signedHeader == '(request-target)': signedHeaderList.append( f'(request-target): {method.lower()} {path}') - print('***************************Verify (request-target): '+method.lower()+' '+path) + #print('***************************Verify (request-target): '+method.lower()+' '+path) elif signedHeader == 'digest': if messageBodyDigest: bodyDigest=messageBodyDigest else: bodyDigest = messageContentDigest(messageBodyJsonStr) signedHeaderList.append(f'digest: SHA-256={bodyDigest}') - print('***************************Verify digest: SHA-256='+bodyDigest) - print('***************************Verify messageBodyJsonStr: '+messageBodyJsonStr) + #print('***************************Verify digest: SHA-256='+bodyDigest) + #print('***************************Verify messageBodyJsonStr: '+messageBodyJsonStr) else: if headers.get(signedHeader): - print('***************************Verify '+signedHeader+': '+headers[signedHeader]) + #print('***************************Verify '+signedHeader+': '+headers[signedHeader]) signedHeaderList.append( f'{signedHeader}: {headers[signedHeader]}') else: signedHeaderCap=signedHeader.capitalize() - print('***************************Verify '+signedHeaderCap+': '+headers[signedHeaderCap]) + #print('***************************Verify '+signedHeaderCap+': '+headers[signedHeaderCap]) if headers.get(signedHeaderCap): signedHeaderList.append( f'{signedHeader}: {headers[signedHeaderCap]}') - print('***********************signedHeaderList: ') - pprint(signedHeaderList) + #print('***********************signedHeaderList: ') + #pprint(signedHeaderList) # Now we have our header data digest signedHeaderText = '\n'.join(signedHeaderList) - print('***********************Verify: signedHeaderText: '+signedHeaderText) + #print('***********************Verify: signedHeaderText: '+signedHeaderText) headerDigest = SHA256.new(signedHeaderText.encode('ascii')) # Get the signature, verify with public key, return result diff --git a/posts.py b/posts.py index 7877b6ed5..7bf51f38e 100644 --- a/posts.py +++ b/posts.py @@ -1194,11 +1194,11 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \ else: wfRequest={ "aliases": [ - httpPrefix+'://'+toDomain+'/inbox' + httpPrefix+'://'+toDomain+'/users/inbox' ], "links": [ { - "href": httpPrefix+'://'+toDomain+'/inbox', + "href": httpPrefix+'://'+toDomain+'/users/inbox', "rel": "self", "type": "application/activity+json" }