Skip to content

Remove dependency on auth package #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions Hologram/HologramCloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import json
import sys
from Hologram.CustomCloud import CustomCloud
from HologramAuth import TOTPAuthentication, SIMOTPAuthentication
from Hologram.Authentication import CSRPSKAuthentication
from Exceptions.HologramError import HologramError

Expand Down Expand Up @@ -40,9 +39,7 @@
class HologramCloud(CustomCloud):

_authentication_handlers = {
'csrpsk' : CSRPSKAuthentication.CSRPSKAuthentication,
'totp' : TOTPAuthentication.TOTPAuthentication,
'sim-otp' : SIMOTPAuthentication.SIMOTPAuthentication,
'csrpsk' : CSRPSKAuthentication.CSRPSKAuthentication
}

_errorCodeDescription = {
Expand All @@ -60,7 +57,7 @@ class HologramCloud(CustomCloud):
}

def __init__(self, credentials, enable_inbound=False, network='',
authentication_type='totp'):
authentication_type='csrpsk'):
super().__init__(credentials,
send_host=HOLOGRAM_HOST_SEND,
send_port=HOLOGRAM_PORT_SEND,
Expand All @@ -71,9 +68,6 @@ def __init__(self, credentials, enable_inbound=False, network='',

self.setAuthenticationType(credentials, authentication_type=authentication_type)

if self.authenticationType == 'totp':
self.__populate_totp_credentials()

# EFFECTS: Authentication Configuration
def setAuthenticationType(self, credentials, authentication_type='csrpsk'):

Expand All @@ -91,10 +85,6 @@ def sendMessage(self, message, topics=None, timeout=DEFAULT_SEND_MESSAGE_TIMEOUT
self.addPayloadToBuffer(message)
return ''

# Set the appropriate credentials required for sim otp authentication.
if self.authenticationType == 'sim-otp':
self.__populate_sim_otp_credentials()

modem_type = None
modem_id = None
if self.network is not None:
Expand All @@ -119,21 +109,6 @@ def __parse_result(self, result):

return resultList[0]

def __populate_totp_credentials(self):
try:
self.authentication.credentials['device_id'] = self.network.iccid
self.authentication.credentials['private_key'] = self.network.imsi
except Exception as e:
self.logger.error('Unable to fetch device id or private key')

def __populate_sim_otp_credentials(self):
nonce = self.request_hex_nonce()
command = self.authentication.generate_sim_otp_command(imsi=self.network.imsi,
iccid=self.network.iccid,
nonce=nonce)
modem_response = self.network.get_sim_otp_response(command)
self.authentication.generate_sim_otp_token(modem_response)

def sendSMS(self, destination_number, message):

self.__enforce_authentication_type_supported_for_sms()
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ mock~=3.0.5
pyroute2==0.5.*
pyserial~=3.4.0
python-pppd==1.0.3
python-sdk-auth~=0.3.0
pyudev~=0.21.0
pyusb~=1.0.2
psutil~=5.6.3
Expand Down