thesadru / genshin.py

Modern API wrapper for Genshin Impact & Honkai Impact 3rd built on asyncio and pydantic. 原神 崩坏3
https://thesadru.github.io/genshin.py
MIT License
387 stars 72 forks source link

DS algorithm and salt value upgrade #91

Closed BachelorForever closed 2 months ago

BachelorForever commented 1 year ago

Currently we're using version 2.11.1, way lower behind the live production ds version 2.40.

Some related code:

https://github.com/y1ndan/genshinhelper2/blob/5402ffbe76885432d387e3cf04bb9d1dcefb9075/genshinhelper/utils.py#L163-L202 https://github.com/Le-niao/Yunzai-Bot/blob/07f39c89bd2603b447ba924aea43e55c2b6d6549/plugins/genshin/model/mys/mysApi.js#L230-L307

Looks like we also need to send full headers to daily reward endpoint, but there's some problem:

  1. x-rpc-device_id value only obtainable in daily reward requests made by official client, kinda hard to get it unless everyone know how to use mitm proxy.
  2. Also x-rpc-device_model/x-rpc-device_name, I don't expect that many user know their correct device modal/name string.
  3. It isn't really user-friendly if some value aren't obtainable unless u install a mitm proxy.
  4. Does the daily reward requires separate ds salt value?
luoshuijs commented 1 year ago

We cannot expect each user to install the mitm proxy and can only generate random x-rpc-device_id values for the user to use. https://github.com/Le-niao/Yunzai-Bot/blob/07f39c89bd2603b447ba924aea43e55c2b6d6549/plugins/genshin/model/mys/mysApi.js#L301-L307 https://github.com/y1ndan/genshinhelper2/blob/5402ffbe76885432d387e3cf04bb9d1dcefb9075/genshinhelper/core.py#L14-L29 Daily rewards require a separate DS salt value. https://github.com/Le-niao/Yunzai-Bot/blob/07f39c89bd2603b447ba924aea43e55c2b6d6549/plugins/genshin/model/mys/mysApi.js#L292-L299 https://github.com/y1ndan/genshinhelper2/blob/5402ffbe76885432d387e3cf04bb9d1dcefb9075/genshinhelper/mihoyo.py#L233

BachelorForever commented 1 year ago

I doubt random device id would avoid geetest

thesadru commented 1 year ago

Yeah, I honestly don't understand how the flow would function at all 😭. I'd appreciate it if someone could add all of the functionality to the base library, but I don't see myself doing it any time soon.