fix(protocol): ptt-trans md5 must be a hex string, not raw bytes (#165)
fetch_ptt_text failed for every voice with QQ errCode -1079 ("ptt
translate failed"). RE'd the cause in wrapper.linux.node: EncodeTroopPtt /
EncodeC2CPtt (ptt_trans_worker.cc) run the md5 through a bytes→hex helper
(sub_7A02D80, the 000102…ff table) before putting it in the request — so
the md5 field is a 32-char lowercase HEX STRING, but we were sending the
raw 16 bytes (hexToBytes(md5Hex)). Wrong length + encoding → server reject.
All other fields matched QQ NT exactly (verified field-by-field against
the two encoders): group {1=msg,2=sender,3=group,4=fileId,5=md5,6=dur,
7=size,8=format,9=uuid,10=event}, c2c {…,9=md5}, type 1=group/2=c2c.
Fix: md5 field is `string` (the lowercased hex), not `bytes`. Live-
verified on tempserver — errCode -1079 is gone and a real voice now
returns ASR text. (The "Live-verified end to end" claim in the old
comment was wrong; c2c had the same latent bug.)
This commit is contained in:
2 files changed
+12
-14
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { pb, uint_32, uint_64, bytes } from '@snowluma/proton';
|
||||
import type { pb, uint_32, uint_64 } from '@snowluma/proton';
|
||||
|
||||
/**
|
||||
* Voice-to-text (语音转文字) request/response protobufs for the
|
||||
@@ -28,7 +28,11 @@ export interface C2CPttTransItem {
|
||||
size?: pb<6, uint_32>; // element 45405 (bytes)
|
||||
format?: pb<7, uint_32>; // element 45907 (voice codec)
|
||||
eventType?: pb<8, uint_32>; // element 45921
|
||||
md5?: pb<9, bytes>; // element 45406 (raw 16-byte md5)
|
||||
// QQ NT (EncodeC2CPtt) hex-encodes the md5 to a 32-char lowercase string
|
||||
// before sending it (verified in wrapper.linux.node: field 9 = sub_7A02D80
|
||||
// = bytes→hex). Sending the raw 16 bytes makes the server reject with
|
||||
// errCode -1079. So this is a hex STRING, not bytes.
|
||||
md5?: pb<9, string>; // element 45406 (32-char lowercase hex)
|
||||
}
|
||||
|
||||
export interface GroupPttTransItem {
|
||||
@@ -36,7 +40,7 @@ export interface GroupPttTransItem {
|
||||
senderUin?: pb<2, uint_64>;
|
||||
groupUin?: pb<3, uint_64>;
|
||||
fileId?: pb<4, uint_32>; // element 45903 (group ptt numeric file id)
|
||||
md5?: pb<5, bytes>; // element 45406
|
||||
md5?: pb<5, string>; // element 45406 (32-char lowercase hex, see C2C note)
|
||||
duration?: pb<6, uint_32>; // element 45906
|
||||
size?: pb<7, uint_32>; // element 45405
|
||||
format?: pb<8, uint_32>; // element 45907
|
||||
|
||||
Reference in new issue
Block a user