Browse Source

Correct TOTP URI

Steam requires a 5-digit code, but most TOTP software has 6 digits
as the default when a length is not specified.
pull/313/head
James Edington 5 years ago
parent
commit
cb78871ffa
  1. 7
      steam/guard.py

7
steam/guard.py

@ -49,6 +49,7 @@ import json
import subprocess
import struct
import requests
import re
from base64 import b64decode, b64encode
from binascii import hexlify
from time import time
@ -179,6 +180,12 @@ class SteamAuthenticator(object):
if resp['status'] != EResult.OK:
raise SteamAuthenticatorError("Failed to add authenticator. Error: %s" % repr(EResult(resp['status'])))
try:
if not re.search('[&\?].*digits', resp['uri']):
resp['uri'] += '&digits=5'
except KeyError, AttributeError:
pass
self.secrets = resp
self.steam_time_offset = int(resp['server_time']) - time()

Loading…
Cancel
Save