Skip to content

Commit 8f17d1c

Browse files
committed
feat(client): add get_marketface_key
1 parent c61fbb1 commit 8f17d1c

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

lagrange/client/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
GetCookieRsp,
2323
SendGrpBotHD,
2424
SendNudge,
25+
TabOpReq,
26+
TabOpRsp,
2527
)
2628
from lagrange.pb.service.friend import (
2729
GetFriendListRsp,
@@ -613,3 +615,10 @@ async def get_rkey(self) -> tuple[str, str]:
613615
rsp = await self.send_oidb_svc(0x9067, 202, proto_encode(body), True)
614616
temp = proto_decode(rsp.data).into((4, 1), dict[int, list[bytes]])
615617
return temp[0][1].decode(), temp[1][1].decode()
618+
619+
async def get_marketface_key(self, face_id: int, face_md5: list[str]) -> list[str]:
620+
rsp = await self.send_uni_packet(
621+
"BQMallSvc.TabOpReq",
622+
TabOpReq.build(face_id, face_md5).encode()
623+
)
624+
return TabOpRsp.decode(rsp.data).keys()

lagrange/pb/service/comm.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,43 @@ class GetClientKeyRsp(ProtoStruct):
3636
f2: int = proto_field(2)
3737
client_key: str = proto_field(3)
3838
expiration: int = proto_field(4)
39+
40+
# BQMallSvc.TabOpReq
41+
class _TabOpHeader(ProtoStruct):
42+
f1: int = proto_field(1)
43+
f2: int = proto_field(2, default=0)
44+
f20: int = proto_field(20, default=0)
45+
46+
47+
class _TabOpReq(ProtoStruct):
48+
face_id: int = proto_field(1)
49+
face_md5: list[str] = proto_field(3)
50+
f6: int = proto_field(6, default=1)
51+
52+
53+
class _TabOpRsp(ProtoStruct):
54+
enc_keys: list[str] = proto_field(1)
55+
56+
57+
class TabOpReq(_TabOpHeader):
58+
body: _TabOpReq = proto_field(5)
59+
f6: int = proto_field(6, default=1)
60+
version: str = proto_field(7, default="")
61+
62+
@classmethod
63+
def build(cls, face_id: int, face_md5: list[str]) -> "TabOpReq":
64+
return cls(
65+
f1=3,
66+
f2=3127124559,
67+
version="10.0.22631",
68+
body=_TabOpReq(face_id=face_id, face_md5=face_md5)
69+
)
70+
71+
72+
class TabOpRsp(_TabOpHeader):
73+
body: Optional[_TabOpRsp] = proto_field(5, default=None)
74+
75+
def keys(self) -> list[str]:
76+
if not self.body:
77+
raise ValueError("invalid arguments")
78+
return self.body.enc_keys

0 commit comments

Comments
 (0)