Skip to content

Commit f73f1e0

Browse files
committed
include VIP access icon in otpauth:// URI
1 parent a646f29 commit f73f1e0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_generate_totp_uri():
8686
'timeskew': 0,
8787
}
8888
test_secret = b'ZqeD\xd9wg]"\x12\x1f7\xc7v6"\xf0\x13\\i'
89-
expected_uri = urlparse.urlparse('otpauth://totp/VIP%20Access:SYMC26070843?secret=LJYWKRGZO5TV2IQSD434O5RWELYBGXDJ&issuer=Symantec&digits=6&algorithm=SHA1&period=30')
89+
expected_uri = urlparse.urlparse('otpauth://totp/VIP%20Access:SYMC26070843?secret=LJYWKRGZO5TV2IQSD434O5RWELYBGXDJ&issuer=Symantec&digits=6&algorithm=SHA1&period=30&image=https://vip.symantec.com/favicon.ico')
9090
generated_uri = urlparse.urlparse(generate_otp_uri(test_token, test_secret))
9191
assert generated_uri.scheme == expected_uri.scheme
9292
assert generated_uri.netloc == expected_uri.netloc
@@ -110,7 +110,7 @@ def test_generate_hotp_uri():
110110
'timeskew': 0,
111111
}
112112
test_secret = b'\x9a\x13\xcd2!\xad\xbd\x97R\xfcEE\xb6\x92e\xb4\x14\xb0\xfem'
113-
expected_uri = urlparse.urlparse('otpauth://hotp/VIP%20Access:UBHE57586348?digits=6&algorithm=SHA1&counter=1&issuer=Symantec&secret=TIJ42MRBVW6ZOUX4IVC3NETFWQKLB7TN')
113+
expected_uri = urlparse.urlparse('otpauth://hotp/VIP%20Access:UBHE57586348?digits=6&algorithm=SHA1&counter=1&issuer=Symantec&secret=TIJ42MRBVW6ZOUX4IVC3NETFWQKLB7TN&image=https://vip.symantec.com/favicon.ico')
114114
generated_uri = urlparse.urlparse(generate_otp_uri(test_token, test_secret))
115115
assert generated_uri.scheme == expected_uri.scheme
116116
assert generated_uri.netloc == expected_uri.netloc

vipaccess/provision.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def decrypt_key(token_iv, token_cipher):
174174

175175
return otp_key
176176

177-
def generate_otp_uri(token, secret, issuer='Symantec'):
177+
def generate_otp_uri(token, secret, issuer='Symantec', image='https://vip.symantec.com/favicon.ico'):
178178
'''Generate the OTP URI.'''
179179
token_parameters = {}
180180
token_parameters['app_name'] = urllib.quote('VIP Access')
@@ -185,6 +185,7 @@ def generate_otp_uri(token, secret, issuer='Symantec'):
185185
digits=token.get('digits', 6),
186186
algorithm=token.get('algorithm', 'SHA1').upper(),
187187
issuer=issuer,
188+
image=image,
188189
)
189190
if token.get('counter') is not None: # HOTP
190191
data['counter'] = token['counter']

0 commit comments

Comments
 (0)