12
12
import json
13
13
import sys
14
14
from Hologram .CustomCloud import CustomCloud
15
- from HologramAuth import TOTPAuthentication , SIMOTPAuthentication
16
15
from Hologram .Authentication import CSRPSKAuthentication
17
16
from Exceptions .HologramError import HologramError
18
17
40
39
class HologramCloud (CustomCloud ):
41
40
42
41
_authentication_handlers = {
43
- 'csrpsk' : CSRPSKAuthentication .CSRPSKAuthentication ,
44
- 'totp' : TOTPAuthentication .TOTPAuthentication ,
45
- 'sim-otp' : SIMOTPAuthentication .SIMOTPAuthentication ,
42
+ 'csrpsk' : CSRPSKAuthentication .CSRPSKAuthentication
46
43
}
47
44
48
45
_errorCodeDescription = {
@@ -60,7 +57,7 @@ class HologramCloud(CustomCloud):
60
57
}
61
58
62
59
def __init__ (self , credentials , enable_inbound = False , network = '' ,
63
- authentication_type = 'totp ' ):
60
+ authentication_type = 'csrpsk ' ):
64
61
super ().__init__ (credentials ,
65
62
send_host = HOLOGRAM_HOST_SEND ,
66
63
send_port = HOLOGRAM_PORT_SEND ,
@@ -71,9 +68,6 @@ def __init__(self, credentials, enable_inbound=False, network='',
71
68
72
69
self .setAuthenticationType (credentials , authentication_type = authentication_type )
73
70
74
- if self .authenticationType == 'totp' :
75
- self .__populate_totp_credentials ()
76
-
77
71
# EFFECTS: Authentication Configuration
78
72
def setAuthenticationType (self , credentials , authentication_type = 'csrpsk' ):
79
73
@@ -91,10 +85,6 @@ def sendMessage(self, message, topics=None, timeout=DEFAULT_SEND_MESSAGE_TIMEOUT
91
85
self .addPayloadToBuffer (message )
92
86
return ''
93
87
94
- # Set the appropriate credentials required for sim otp authentication.
95
- if self .authenticationType == 'sim-otp' :
96
- self .__populate_sim_otp_credentials ()
97
-
98
88
modem_type = None
99
89
modem_id = None
100
90
if self .network is not None :
@@ -119,21 +109,6 @@ def __parse_result(self, result):
119
109
120
110
return resultList [0 ]
121
111
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
-
137
112
def sendSMS (self , destination_number , message ):
138
113
139
114
self .__enforce_authentication_type_supported_for_sms ()
0 commit comments