def main(): # 获取登录令牌码 one_time_authentication_code = generate_one_time_code(shared_secret) print(one_time_authentication_code) # 获取交易确认码 confirmation_key = generate_confirmation_key(identity_secret, 'conf') print(confirmation_key)
def _create_confirmation_params(self, tag_string: str) -> dict: timestamp = int(time.time()) confirmation_key = guard.generate_confirmation_key( self._identity_secret, tag_string, timestamp) android_id = guard.generate_device_id(self._my_steam_id) return { 'p': android_id, 'a': self._my_steam_id, 'k': confirmation_key, 't': timestamp, 'm': 'android', 'tag': tag_string }
def _create_confirmation_params(self, tag_string: str) -> dict: timestamp = int(time.time()) # 生成当前时间的交易确认码 confirmation_key = guard.generate_confirmation_key( self._identity_secret, tag_string, timestamp) # 生成设备 ID android_id = guard.generate_device_id(self._my_steam_id) return { "p": android_id, "a": self._my_steam_id, "k": confirmation_key, "t": timestamp, "m": "android", "tag": tag_string }
# Example of generating authenticating codes using guard module # To use is you have to obtain 'shared_secret' and 'identity_secret' # From your Steamguard file from steampy.guard import generate_confirmation_key, generate_one_time_code shared_secret = '' identity_secret = '' one_time_authentication_code = generate_one_time_code(shared_secret) print(one_time_authentication_code) confirmation_key = generate_confirmation_key(identity_secret, 'conf') print(confirmation_key)
def test_confirmation_key(self): timestamp = 1470838334 confirmation_key = guard.generate_confirmation_key(self.identity_secret, Tag.CONF.value, timestamp) self.assertEquals(confirmation_key, b'pWqjnkcwqni+t/n+5xXaEa0SGeA=')