fix(oidb): set envelope reserved=1 on OIDB 0xFE1_2 (user / stranger)

Follow-up to c62f517. Dropping the obsolete field 2 from the body was
necessary but insufficient: newer QQ NT still rejects the request with

    [oidb] one of uid/openid is invaild

The actual trigger is the OIDB envelope-level `reserved` flag.
Lagrange.Core's FetchStrangerByUin sets `Reserved = 1`, our call sent
`Reserved = 0`. The server uses that bit to pick its validation path:

  - reserved=1 → UIN-form variant: server translates body.uin to the
    internal uid itself
  - reserved=0 → UID-form variant: server expects a uid/openid string
    in the body and rejects when it can't find one

Our request body has only `uin` + `keys`, so the UID-form path was
always going to fail. Setting `isUid: true` (which is the existing
flag that flips envelope `reserved` to 1; the parameter name is
historical and misleading) puts the call onto the correct branch.

Applied to both call sites that target OidbSvcTrpcTcp.0xfe1_2:

  - fetchUserProfile (bridge-contacts.ts) — fixes the
    "failed to load self profile for UIN N" warmup warning.
  - getStrangerStatus (actions/extras.ts) — same OIDB cmd; would
    have failed identically if exercised against newer QQ NT.

Also updated the `isUid` JSDoc on OidbCall to spell out the actual
semantic (UIN-form variant marker, not "this call uses UID-keyed
data") since the name will keep tripping people otherwise.
This commit is contained in:
DrSmoothl committed 2026-05-18 14:58:58 +08:00
1 parent ba899782fe
commit 562fd4f7f9
3 files changed
+20 -5

No files matched your search

@@ -66,6 +66,9 @@ export async function getStrangerStatus(bridge: Bridge, uin: number): Promise<St
request: {
schema: OidbStrangerStatusReqSchema,
value: { uin, key: [{ key: 27372 }] },
// Same UIN-form flag fetchUserProfile sets — without it newer
// QQ NT rejects with `[oidb] one of uid/openid is invaild`.
isUid: true,
},
response: { schema: OidbStrangerStatusRespSchema },
});
+7 -1
View File
@@ -228,10 +228,16 @@ export async function fetchUserProfile(bridge: Bridge, uin: number): Promise<Use
keys: keys.map(k => ({ key: k })),
};
// Set OIDB envelope `reserved = 1` (the `isUid: true` flag — the
// name is historical, the wire semantic is "this is the UIN-form
// variant of the call"). Without it newer QQ NT versions take the
// UID-form validation path, find neither uid nor openid in the body
// and bounce the request with `[oidb] one of uid/openid is invaild`.
// Matches Lagrange.Core's FetchStrangerByUin (Reserved = 1).
const resp = await runOidb<any>(bridge, {
cmd: 'OidbSvcTrpcTcp.0xfe1_2',
oidbCmd: 0xFE1, subCmd: 2,
request: { schema: OidbUserInfoRequestSchema, value: body },
request: { schema: OidbUserInfoRequestSchema, value: body, isUid: true },
response: { schema: OidbUserInfoResponseSchema },
});
+10 -4
View File
@@ -20,10 +20,16 @@ export interface OidbCall<TResp = void> {
schema: ProtoSchema;
value: any;
/**
* Sets the OIDB envelope `reserved` field to 1 when true. A handful
* of commands (group/friend list, rkey download) operate on
* UID-keyed data and require this flag — the wire format is
* otherwise identical.
* Sets the OIDB envelope `reserved` field to 1 when true.
*
* The name is historical and misleading: empirically (see Lagrange
* FetchStrangerByUin vs FetchStrangerByUid, fetchGroupList, our own
* highway uploads) the `reserved = 1` flag indicates the UIN-form
* variant of an OIDB call — it tells newer QQ NT to translate the
* UIN in the body to an internal UID rather than running the
* UID-form validator that expects a uid/openid string in the body.
*
* Omit (default false) for genuinely UID-keyed calls.
*/
isUid?: boolean;
};