1212import json
1313import sys
1414from Hologram .CustomCloud import CustomCloud
15- from HologramAuth import TOTPAuthentication , SIMOTPAuthentication
1615from Hologram .Authentication import CSRPSKAuthentication
1716from Exceptions .HologramError import HologramError
1817
4039class HologramCloud (CustomCloud ):
4140
4241 _authentication_handlers = {
43- 'csrpsk' : CSRPSKAuthentication .CSRPSKAuthentication ,
44- 'totp' : TOTPAuthentication .TOTPAuthentication ,
45- 'sim-otp' : SIMOTPAuthentication .SIMOTPAuthentication ,
42+ 'csrpsk' : CSRPSKAuthentication .CSRPSKAuthentication
4643 }
4744
4845 _errorCodeDescription = {
@@ -60,7 +57,7 @@ class HologramCloud(CustomCloud):
6057 }
6158
6259 def __init__ (self , credentials , enable_inbound = False , network = '' ,
63- authentication_type = 'totp ' ):
60+ authentication_type = 'csrpsk ' ):
6461 super ().__init__ (credentials ,
6562 send_host = HOLOGRAM_HOST_SEND ,
6663 send_port = HOLOGRAM_PORT_SEND ,
@@ -71,9 +68,6 @@ def __init__(self, credentials, enable_inbound=False, network='',
7168
7269 self .setAuthenticationType (credentials , authentication_type = authentication_type )
7370
74- if self .authenticationType == 'totp' :
75- self .__populate_totp_credentials ()
76-
7771 # EFFECTS: Authentication Configuration
7872 def setAuthenticationType (self , credentials , authentication_type = 'csrpsk' ):
7973
@@ -91,10 +85,6 @@ def sendMessage(self, message, topics=None, timeout=DEFAULT_SEND_MESSAGE_TIMEOUT
9185 self .addPayloadToBuffer (message )
9286 return ''
9387
94- # Set the appropriate credentials required for sim otp authentication.
95- if self .authenticationType == 'sim-otp' :
96- self .__populate_sim_otp_credentials ()
97-
9888 modem_type = None
9989 modem_id = None
10090 if self .network is not None :
@@ -119,21 +109,6 @@ def __parse_result(self, result):
119109
120110 return resultList [0 ]
121111
122- def __populate_totp_credentials (self ):
123- try :
124- self .authentication .credentials ['device_id' ] = self .network .iccid
125- self .authentication .credentials ['private_key' ] = self .network .imsi
126- except Exception as e :
127- self .logger .error ('Unable to fetch device id or private key' )
128-
129- def __populate_sim_otp_credentials (self ):
130- nonce = self .request_hex_nonce ()
131- command = self .authentication .generate_sim_otp_command (imsi = self .network .imsi ,
132- iccid = self .network .iccid ,
133- nonce = nonce )
134- modem_response = self .network .get_sim_otp_response (command )
135- self .authentication .generate_sim_otp_token (modem_response )
136-
137112 def sendSMS (self , destination_number , message ):
138113
139114 self .__enforce_authentication_type_supported_for_sms ()
0 commit comments