hopefully working again, hopefully less block validation issues
parent
c807056ef2
commit
583480629a
|
@ -147,7 +147,7 @@ class API:
|
||||||
response = 'not found'
|
response = 'not found'
|
||||||
if siteData != '' and siteData != False:
|
if siteData != '' and siteData != False:
|
||||||
self.mimeType = 'text/html'
|
self.mimeType = 'text/html'
|
||||||
response = siteData.split('-', 2)[-1]
|
response = siteData.split(b'-', 2)[-1]
|
||||||
resp = Response(response)
|
resp = Response(response)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -239,6 +239,7 @@ class OnionrCommunicate:
|
||||||
for i in peerList:
|
for i in peerList:
|
||||||
hasher = hashlib.sha3_256()
|
hasher = hashlib.sha3_256()
|
||||||
data = self.performGet('getData', i, hash)
|
data = self.performGet('getData', i, hash)
|
||||||
|
print('b64 data', data)
|
||||||
if data == False or len(data) > 10000000:
|
if data == False or len(data) > 10000000:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
|
@ -255,7 +256,7 @@ class OnionrCommunicate:
|
||||||
if data.startswith(b'-txt-'):
|
if data.startswith(b'-txt-'):
|
||||||
self._core.setBlockType(hash, 'txt')
|
self._core.setBlockType(hash, 'txt')
|
||||||
if len(data) < 120:
|
if len(data) < 120:
|
||||||
logger.debug('Block text:\n' + data)
|
logger.debug('Block text:\n' + data.decode())
|
||||||
else:
|
else:
|
||||||
logger.warn("Failed to validate " + hash + " " + " hash calculated was " + digest)
|
logger.warn("Failed to validate " + hash + " " + " hash calculated was " + digest)
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ class OnionrCrypto:
|
||||||
return binascii.hexlify(nacl.utils.random(nacl.secret.SecretBox.KEY_SIZE))
|
return binascii.hexlify(nacl.utils.random(nacl.secret.SecretBox.KEY_SIZE))
|
||||||
|
|
||||||
def generatePubKey(self):
|
def generatePubKey(self):
|
||||||
'''Generate a Ed25519 public key pair, return tuple of base64encoded pubkey, privkey'''
|
'''Generate a Ed25519 public key pair, return tuple of base32encoded pubkey, privkey'''
|
||||||
private_key = nacl.signing.SigningKey.generate()
|
private_key = nacl.signing.SigningKey.generate()
|
||||||
public_key = private_key.verify_key.encode(encoder=nacl.encoding.Base32Encoder())
|
public_key = private_key.verify_key.encode(encoder=nacl.encoding.Base32Encoder())
|
||||||
return (public_key.decode(), private_key.encode(encoder=nacl.encoding.Base32Encoder()).decode())
|
return (public_key.decode(), private_key.encode(encoder=nacl.encoding.Base32Encoder()).decode())
|
Loading…
Reference in New Issue