Remove double base64 decode when importing key from environment

pull/67/head
Chirstophe Mehay 3 years ago committed by Christophe Mehay
parent 7ab49bfde4
commit cf419a7d48

@ -35,8 +35,8 @@ services:
FOO_TOR_SERVICE_VERSION: '3'
# tor v3 address private key base 64 encoded
FOO_TOR_SERVICE_KEY: |
PT0gZWQyNTUxOXYxLXNlY3JldDogdHlwZTAgPT0AAACArobDQYyZAWXei4QZwr++
j96H1X/gq14NwLRZ2O5DXuL0EzYKkdhZSILY85q+kfwZH8z4ceqe7u1F+0pQi/sM
PT0gZWQyNTUxOXYxLXNlY3JldDogdHlwZTAgPT0AAABYZRzL3zScTEqA8/5wfvHw
yLIzmih73lhgPGPh7SuOS6GTou4tXgNlTYSNb/Fvk1ajTTUno4tIQn/jMENO/20G
# Keep keys in volumes
volumes:

@ -1,6 +1,4 @@
'This class define a service link'
import base64
import binascii
import logging
import os
import pathlib
@ -77,12 +75,6 @@ class ServicesGroup(object):
def add_key(self, key):
if self.imported_key:
logging.warning('Secret key already set, overriding')
# Try to decode key from base64 encoding
# import the raw data if the input cannot be decoded as base64
try:
key = base64.b64decode(key)
except binascii.Error:
pass
if isinstance(key, str):
key = key.encode('ascii')
self._onion.set_private_key(key)

Loading…
Cancel
Save