@moqtap/codec 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/README.md +16 -4
- package/dist/{chunk-KCH4BQXK.cjs → chunk-AQ445VV7.cjs} +15 -9
- package/dist/{chunk-UZO5Z2XT.cjs → chunk-BIBMDTU5.cjs} +12 -6
- package/dist/chunk-BMJMY6FX.cjs +868 -0
- package/dist/{chunk-23KRITJ6.js → chunk-BX2N7TZM.js} +14 -8
- package/dist/{chunk-XQGEOFGE.js → chunk-CF5DDD3Q.js} +14 -8
- package/dist/chunk-FT3HDNIB.js +2374 -0
- package/dist/{chunk-TMXRYOBS.js → chunk-G53WYUXL.js} +13 -7
- package/dist/{chunk-JKMYAUGY.js → chunk-K2B3OVFK.js} +11 -8
- package/dist/{chunk-3YAR3I3S.js → chunk-KGDVC4O6.js} +36 -22
- package/dist/{chunk-VWXUT5R2.cjs → chunk-KTNERCTZ.cjs} +36 -22
- package/dist/{chunk-H6DTAIWM.js → chunk-L5DRACXS.js} +22 -16
- package/dist/{chunk-UA5XFP4O.cjs → chunk-OUNN4IQB.cjs} +14 -8
- package/dist/{chunk-NH4L6NIY.js → chunk-OZRK73NQ.js} +12 -6
- package/dist/{chunk-PU2KV7VP.cjs → chunk-RYKQXBG6.cjs} +12 -6
- package/dist/{chunk-EVCPBFSR.cjs → chunk-SDJTSMOW.cjs} +23 -17
- package/dist/chunk-T4VWPKDG.cjs +2374 -0
- package/dist/{chunk-2XH6PHXR.js → chunk-TSUZ6GJV.js} +12 -6
- package/dist/{chunk-QGIHC6BA.cjs → chunk-UKKDOOUO.cjs} +12 -9
- package/dist/{chunk-BV6MITLO.js → chunk-WCPENYNE.js} +14 -8
- package/dist/{chunk-IADVBKEJ.cjs → chunk-WCTMPDUX.cjs} +15 -9
- package/dist/chunk-WX5PU7HF.js +868 -0
- package/dist/{chunk-7ENEWAMZ.cjs → chunk-XCRCAUGI.cjs} +15 -9
- package/dist/{codec-BLYAy2OP.d.ts → codec--CVeqGQv.d.ts} +1 -1
- package/dist/{codec-BNS3gS77.d.ts → codec-08ZOr5wI.d.ts} +2 -2
- package/dist/{codec-DujHf55Z.d.ts → codec-BJ7BHuiZ.d.ts} +1 -1
- package/dist/{codec-CI0BjmHc.d.ts → codec-BNy5syCU.d.ts} +1 -1
- package/dist/{codec-N3g1lxQQ.d.cts → codec-Bd60SGKH.d.cts} +2 -2
- package/dist/{codec-xeuGZY77.d.cts → codec-BrTi4K7r.d.cts} +3 -3
- package/dist/{codec-DJmV04i0.d.ts → codec-Bux_Q40X.d.ts} +2 -2
- package/dist/{codec-BqqoYdh_.d.cts → codec-BxQTybUX.d.cts} +2 -2
- package/dist/{codec-D2JbI2tp.d.ts → codec-C3mdsGx3.d.ts} +2 -2
- package/dist/{codec-DQWQSam3.d.cts → codec-C6Mx4bwz.d.cts} +1 -1
- package/dist/{codec-DAePx2NL.d.ts → codec-CBdOIfMY.d.ts} +3 -3
- package/dist/codec-CFWu5KVT.d.cts +49 -0
- package/dist/{codec-CyApDKwf.d.cts → codec-CWnf8mn_.d.cts} +2 -2
- package/dist/{codec-DvcJgYKq.d.cts → codec-CXCjya_G.d.cts} +1 -1
- package/dist/{codec-BOyrk_C9.d.cts → codec-Cfo_z5ET.d.cts} +1 -1
- package/dist/{codec-v6Vloc7H.d.ts → codec-Cm3D261p.d.ts} +2 -2
- package/dist/codec-CwZ6OCPP.d.ts +49 -0
- package/dist/{codec-NMsTK0GX.d.cts → codec-Czejcmxr.d.cts} +2 -2
- package/dist/{codec-hvkJfCF5.d.cts → codec-DNmiG2e0.d.cts} +2 -2
- package/dist/{codec-CWj5iTxA.d.ts → codec-DOmAmFkI.d.ts} +2 -2
- package/dist/{codec-WwwUipaU.d.ts → codec-DaXjRrOV.d.ts} +2 -2
- package/dist/{codec-DplRgIKq.d.ts → codec-Dl_QIXMz.d.ts} +1 -1
- package/dist/{codec-D95gT98n.d.cts → codec-DzkdW4kO.d.cts} +1 -1
- package/dist/{codec-cou9XBMF.d.cts → codec-EvybrBuY.d.cts} +2 -2
- package/dist/{codec-DL0njGkL.d.ts → codec-alVA27Uc.d.ts} +2 -2
- package/dist/{codec-D89DWXbv.d.cts → codec-f7vxeVIS.d.cts} +2 -2
- package/dist/{codec-D47r_-Rl.d.ts → codec-gl4_QEva.d.ts} +2 -2
- package/dist/{codec-BOtv3R5j.d.cts → codec-guzqtfMk.d.cts} +2 -2
- package/dist/draft07-session.d.cts +3 -3
- package/dist/draft07-session.d.ts +3 -3
- package/dist/draft07.d.cts +3 -3
- package/dist/draft07.d.ts +3 -3
- package/dist/draft08-session.d.cts +3 -3
- package/dist/draft08-session.d.ts +3 -3
- package/dist/draft08.d.cts +4 -4
- package/dist/draft08.d.ts +4 -4
- package/dist/draft09-session.d.cts +3 -3
- package/dist/draft09-session.d.ts +3 -3
- package/dist/draft09.d.cts +4 -4
- package/dist/draft09.d.ts +4 -4
- package/dist/draft10-session.d.cts +3 -3
- package/dist/draft10-session.d.ts +3 -3
- package/dist/draft10.d.cts +4 -4
- package/dist/draft10.d.ts +4 -4
- package/dist/draft11-session.d.cts +4 -4
- package/dist/draft11-session.d.ts +4 -4
- package/dist/draft11.cjs +2 -2
- package/dist/draft11.d.cts +6 -6
- package/dist/draft11.d.ts +6 -6
- package/dist/draft11.js +1 -1
- package/dist/draft12-session.d.cts +4 -4
- package/dist/draft12-session.d.ts +4 -4
- package/dist/draft12.cjs +2 -2
- package/dist/draft12.d.cts +6 -6
- package/dist/draft12.d.ts +6 -6
- package/dist/draft12.js +1 -1
- package/dist/draft13-session.d.cts +4 -4
- package/dist/draft13-session.d.ts +4 -4
- package/dist/draft13.cjs +2 -2
- package/dist/draft13.d.cts +6 -6
- package/dist/draft13.d.ts +6 -6
- package/dist/draft13.js +1 -1
- package/dist/draft14-session.d.cts +4 -4
- package/dist/draft14-session.d.ts +4 -4
- package/dist/draft14.cjs +2 -2
- package/dist/draft14.d.cts +6 -6
- package/dist/draft14.d.ts +6 -6
- package/dist/draft14.js +1 -1
- package/dist/draft15-session.d.cts +4 -4
- package/dist/draft15-session.d.ts +4 -4
- package/dist/draft15.cjs +2 -2
- package/dist/draft15.d.cts +6 -6
- package/dist/draft15.d.ts +6 -6
- package/dist/draft15.js +1 -1
- package/dist/draft16-session.d.cts +4 -4
- package/dist/draft16-session.d.ts +4 -4
- package/dist/draft16.cjs +2 -2
- package/dist/draft16.d.cts +6 -6
- package/dist/draft16.d.ts +6 -6
- package/dist/draft16.js +1 -1
- package/dist/draft17-session.d.cts +4 -4
- package/dist/draft17-session.d.ts +4 -4
- package/dist/draft17.cjs +2 -2
- package/dist/draft17.d.cts +5 -5
- package/dist/draft17.d.ts +5 -5
- package/dist/draft17.js +1 -1
- package/dist/draft18-session.d.cts +4 -4
- package/dist/draft18-session.d.ts +4 -4
- package/dist/draft18.cjs +2 -2
- package/dist/draft18.d.cts +5 -5
- package/dist/draft18.d.ts +5 -5
- package/dist/draft18.js +1 -1
- package/dist/draft19-session.d.cts +4 -4
- package/dist/draft19-session.d.ts +4 -4
- package/dist/draft19.cjs +2 -2
- package/dist/draft19.d.cts +5 -5
- package/dist/draft19.d.ts +5 -5
- package/dist/draft19.js +1 -1
- package/dist/draft20-session.cjs +8 -0
- package/dist/draft20-session.d.cts +195 -0
- package/dist/draft20-session.d.ts +195 -0
- package/dist/draft20-session.js +8 -0
- package/dist/draft20.cjs +217 -0
- package/dist/draft20.d.cts +175 -0
- package/dist/draft20.d.ts +175 -0
- package/dist/draft20.js +217 -0
- package/dist/index.cjs +25 -19
- package/dist/index.d.cts +41 -26
- package/dist/index.d.ts +41 -26
- package/dist/index.js +16 -10
- package/dist/{session-types-KsqyVp6y.d.cts → session-types-B9idsih-.d.cts} +13 -1
- package/dist/{session-types-C0l_-Ups.d.ts → session-types-Dn7b3RZM.d.ts} +13 -1
- package/dist/session.cjs +5 -1
- package/dist/session.d.cts +14 -12
- package/dist/session.d.ts +14 -12
- package/dist/session.js +5 -1
- package/dist/{types-Cqp10JtB.d.cts → types-Bg86GGVZ.d.cts} +2 -2
- package/dist/{types-Cqp10JtB.d.ts → types-Bg86GGVZ.d.ts} +2 -2
- package/dist/{types-zHgCS6o5.d.cts → types-C1rxh-id.d.cts} +7 -7
- package/dist/{types-zHgCS6o5.d.ts → types-C1rxh-id.d.ts} +7 -7
- package/dist/{types-Bio-91Rt.d.cts → types-CI_SX4Xe.d.cts} +2 -2
- package/dist/{types-Bio-91Rt.d.ts → types-CI_SX4Xe.d.ts} +2 -2
- package/dist/types-CY-QWxd-.d.cts +359 -0
- package/dist/types-CY-QWxd-.d.ts +359 -0
- package/dist/{types-Cm9fjeYC.d.cts → types-CZTzbIzQ.d.cts} +2 -2
- package/dist/{types-Cm9fjeYC.d.ts → types-CZTzbIzQ.d.ts} +2 -2
- package/dist/{types-HI_bbXka.d.cts → types-CmqT0jUf.d.cts} +1 -1
- package/dist/{types-HI_bbXka.d.ts → types-CmqT0jUf.d.ts} +1 -1
- package/dist/{types-Ck45Ex5S.d.cts → types-D0kTgUuL.d.cts} +1 -1
- package/dist/{types-Ck45Ex5S.d.ts → types-D0kTgUuL.d.ts} +1 -1
- package/dist/{types-D9eiB_9A.d.cts → types-D4bmW8rY.d.cts} +2 -2
- package/dist/{types-D9eiB_9A.d.ts → types-D4bmW8rY.d.ts} +2 -2
- package/dist/{types-CdCSIfvI.d.cts → types-DG5_iKuv.d.cts} +1 -1
- package/dist/{types-CdCSIfvI.d.ts → types-DG5_iKuv.d.ts} +1 -1
- package/dist/{types-CXlSn0I9.d.cts → types-DjxexghA.d.cts} +2 -2
- package/dist/{types-CXlSn0I9.d.ts → types-DjxexghA.d.ts} +2 -2
- package/dist/{types-CPaYBsMG.d.cts → types-pShrs3fN.d.cts} +2 -2
- package/dist/{types-CPaYBsMG.d.ts → types-pShrs3fN.d.ts} +2 -2
- package/package.json +16 -3
- package/src/core/session-types.ts +7 -0
- package/src/core/types.ts +1 -0
- package/src/drafts/draft11/codec.ts +11 -8
- package/src/drafts/draft11/types.ts +1 -1
- package/src/drafts/draft12/codec.ts +22 -16
- package/src/drafts/draft12/types.ts +2 -2
- package/src/drafts/draft13/codec.ts +14 -8
- package/src/drafts/draft13/types.ts +2 -2
- package/src/drafts/draft14/codec.ts +14 -8
- package/src/drafts/draft14/types.ts +1 -1
- package/src/drafts/draft15/codec.ts +14 -8
- package/src/drafts/draft15/types.ts +2 -2
- package/src/drafts/draft16/codec.ts +13 -7
- package/src/drafts/draft16/types.ts +2 -2
- package/src/drafts/draft17/codec.ts +12 -6
- package/src/drafts/draft17/types.ts +2 -2
- package/src/drafts/draft18/codec.ts +12 -6
- package/src/drafts/draft18/types.ts +2 -2
- package/src/drafts/draft19/codec.ts +37 -23
- package/src/drafts/draft19/types.ts +10 -7
- package/src/drafts/draft20/codec.ts +1749 -0
- package/src/drafts/draft20/data-streams.ts +1291 -0
- package/src/drafts/draft20/error-codes.ts +135 -0
- package/src/drafts/draft20/index.ts +165 -0
- package/src/drafts/draft20/messages.ts +68 -0
- package/src/drafts/draft20/rules.ts +107 -0
- package/src/drafts/draft20/session-fsm.ts +1063 -0
- package/src/drafts/draft20/session.ts +21 -0
- package/src/drafts/draft20/types.ts +461 -0
- package/src/index.ts +20 -2
- package/src/session.ts +4 -0
|
@@ -24,7 +24,7 @@ export interface Draft11SetupParams {
|
|
|
24
24
|
|
|
25
25
|
// Version-specific parameters — even/odd convention
|
|
26
26
|
export interface Draft11Params {
|
|
27
|
-
authorization_token?: AuthorizationToken // 0x01 odd
|
|
27
|
+
authorization_token?: readonly AuthorizationToken[] // 0x01 odd
|
|
28
28
|
delivery_timeout?: bigint // 0x02 even
|
|
29
29
|
max_cache_duration?: bigint // 0x04 even
|
|
30
30
|
unknown?: UnknownParam[]
|
|
@@ -73,7 +73,7 @@ function encodeSetupParams(params: Draft12SetupParams, w: BufferWriter): void {
|
|
|
73
73
|
let count = 0
|
|
74
74
|
if (params.path !== undefined) count++
|
|
75
75
|
if (params.max_request_id !== undefined) count++
|
|
76
|
-
|
|
76
|
+
count += params.authorization_token?.length ?? 0
|
|
77
77
|
if (params.unknown) count += params.unknown.length
|
|
78
78
|
|
|
79
79
|
w.writeVarInt(count)
|
|
@@ -88,9 +88,9 @@ function encodeSetupParams(params: Draft12SetupParams, w: BufferWriter): void {
|
|
|
88
88
|
w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID)
|
|
89
89
|
w.writeVarInt(params.max_request_id)
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
for (const token of params.authorization_token ?? []) {
|
|
92
92
|
w.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
93
|
-
const at =
|
|
93
|
+
const at = token
|
|
94
94
|
const tmpW = new BufferWriter(64)
|
|
95
95
|
tmpW.writeVarInt(at.alias_type)
|
|
96
96
|
tmpW.writeVarInt(at.token_type)
|
|
@@ -148,11 +148,14 @@ function decodeSetupParams(r: BufferReader): Draft12SetupParams {
|
|
|
148
148
|
const token_type = r.readVarInt()
|
|
149
149
|
const tokenBytesLen = length - (r.offset - startOff)
|
|
150
150
|
const tokenBytes = r.readBytes(tokenBytesLen)
|
|
151
|
-
result.authorization_token =
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
result.authorization_token = [
|
|
152
|
+
...(result.authorization_token ?? []),
|
|
153
|
+
{
|
|
154
|
+
alias_type,
|
|
155
|
+
token_type,
|
|
156
|
+
token_value: tokenBytes,
|
|
157
|
+
},
|
|
158
|
+
]
|
|
156
159
|
} else {
|
|
157
160
|
const bytes = r.readBytes(length)
|
|
158
161
|
unknown.push({
|
|
@@ -174,7 +177,7 @@ function decodeSetupParams(r: BufferReader): Draft12SetupParams {
|
|
|
174
177
|
function encodeParams(params: Draft12Params, w: BufferWriter): void {
|
|
175
178
|
let count = params.unknown ? params.unknown.length : 0
|
|
176
179
|
if (params.delivery_timeout !== undefined) count++
|
|
177
|
-
|
|
180
|
+
count += params.authorization_token?.length ?? 0
|
|
178
181
|
if (params.max_cache_duration !== undefined) count++
|
|
179
182
|
w.writeVarInt(count)
|
|
180
183
|
|
|
@@ -183,10 +186,10 @@ function encodeParams(params: Draft12Params, w: BufferWriter): void {
|
|
|
183
186
|
w.writeVarInt(PARAM_DELIVERY_TIMEOUT)
|
|
184
187
|
w.writeVarInt(params.delivery_timeout)
|
|
185
188
|
}
|
|
186
|
-
|
|
189
|
+
for (const token of params.authorization_token ?? []) {
|
|
187
190
|
// AUTHORIZATION_TOKEN = 0x03 (odd → length-prefixed)
|
|
188
191
|
w.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
189
|
-
const at =
|
|
192
|
+
const at = token
|
|
190
193
|
const tmpW = new BufferWriter(64)
|
|
191
194
|
tmpW.writeVarInt(at.alias_type)
|
|
192
195
|
tmpW.writeVarInt(at.token_type)
|
|
@@ -254,11 +257,14 @@ function decodeParams(r: BufferReader): Draft12Params {
|
|
|
254
257
|
const token_type = r.readVarInt()
|
|
255
258
|
const tokenBytesLen = length - (r.offset - startOff)
|
|
256
259
|
const tokenBytes = r.readBytes(tokenBytesLen)
|
|
257
|
-
result.authorization_token =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
result.authorization_token = [
|
|
261
|
+
...(result.authorization_token ?? []),
|
|
262
|
+
{
|
|
263
|
+
alias_type,
|
|
264
|
+
token_type,
|
|
265
|
+
token_value: tokenBytes,
|
|
266
|
+
},
|
|
267
|
+
]
|
|
262
268
|
} else {
|
|
263
269
|
const bytes = r.readBytes(length)
|
|
264
270
|
unknown.push({
|
|
@@ -19,14 +19,14 @@ export interface AuthorizationToken {
|
|
|
19
19
|
export interface Draft12SetupParams {
|
|
20
20
|
path?: string // 0x01 odd
|
|
21
21
|
max_request_id?: bigint // 0x02 even
|
|
22
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
22
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
23
23
|
unknown?: UnknownParam[]
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Version-specific parameters — even/odd convention
|
|
27
27
|
export interface Draft12Params {
|
|
28
28
|
delivery_timeout?: bigint // 0x02 even
|
|
29
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
29
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
30
30
|
max_cache_duration?: bigint // 0x04 even
|
|
31
31
|
unknown?: UnknownParam[]
|
|
32
32
|
}
|
|
@@ -115,7 +115,7 @@ function encodeSetupParams(params: Draft13SetupParams, w: BufferWriter): void {
|
|
|
115
115
|
let count = 0
|
|
116
116
|
if (params.path !== undefined) count++
|
|
117
117
|
if (params.max_request_id !== undefined) count++
|
|
118
|
-
|
|
118
|
+
count += params.authorization_token?.length ?? 0
|
|
119
119
|
if (params.max_auth_token_cache_size !== undefined) count++
|
|
120
120
|
if (params.unknown) count += params.unknown.length
|
|
121
121
|
|
|
@@ -131,9 +131,9 @@ function encodeSetupParams(params: Draft13SetupParams, w: BufferWriter): void {
|
|
|
131
131
|
w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID)
|
|
132
132
|
w.writeVarInt(params.max_request_id)
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
for (const token of params.authorization_token ?? []) {
|
|
135
135
|
w.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN)
|
|
136
|
-
encodeAuthorizationToken(
|
|
136
|
+
encodeAuthorizationToken(token, w)
|
|
137
137
|
}
|
|
138
138
|
if (params.max_auth_token_cache_size !== undefined) {
|
|
139
139
|
w.writeVarInt(SETUP_PARAM_MAX_AUTH_TOKEN_CACHE_SIZE)
|
|
@@ -185,7 +185,10 @@ function decodeSetupParams(r: BufferReader): Draft13SetupParams {
|
|
|
185
185
|
const bytes = r.readBytes(length)
|
|
186
186
|
result.path = textDecoder.decode(bytes)
|
|
187
187
|
} else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
|
|
188
|
-
result.authorization_token =
|
|
188
|
+
result.authorization_token = [
|
|
189
|
+
...(result.authorization_token ?? []),
|
|
190
|
+
decodeAuthorizationToken(r, length),
|
|
191
|
+
]
|
|
189
192
|
} else {
|
|
190
193
|
const bytes = r.readBytes(length)
|
|
191
194
|
unknown.push({
|
|
@@ -207,7 +210,7 @@ function decodeSetupParams(r: BufferReader): Draft13SetupParams {
|
|
|
207
210
|
function encodeParams(params: Draft13Params, w: BufferWriter): void {
|
|
208
211
|
let count = params.unknown ? params.unknown.length : 0
|
|
209
212
|
if (params.delivery_timeout !== undefined) count++
|
|
210
|
-
|
|
213
|
+
count += params.authorization_token?.length ?? 0
|
|
211
214
|
if (params.max_cache_duration !== undefined) count++
|
|
212
215
|
w.writeVarInt(count)
|
|
213
216
|
|
|
@@ -216,10 +219,10 @@ function encodeParams(params: Draft13Params, w: BufferWriter): void {
|
|
|
216
219
|
w.writeVarInt(PARAM_DELIVERY_TIMEOUT)
|
|
217
220
|
w.writeVarInt(params.delivery_timeout)
|
|
218
221
|
}
|
|
219
|
-
|
|
222
|
+
for (const token of params.authorization_token ?? []) {
|
|
220
223
|
// AUTHORIZATION_TOKEN = 0x03 (odd → length-prefixed)
|
|
221
224
|
w.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
222
|
-
encodeAuthorizationToken(
|
|
225
|
+
encodeAuthorizationToken(token, w)
|
|
223
226
|
}
|
|
224
227
|
if (params.max_cache_duration !== undefined) {
|
|
225
228
|
// MAX_CACHE_DURATION = 0x04 (even → bare varint)
|
|
@@ -275,7 +278,10 @@ function decodeParams(r: BufferReader): Draft13Params {
|
|
|
275
278
|
const length = Number(r.readVarInt())
|
|
276
279
|
|
|
277
280
|
if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
278
|
-
result.authorization_token =
|
|
281
|
+
result.authorization_token = [
|
|
282
|
+
...(result.authorization_token ?? []),
|
|
283
|
+
decodeAuthorizationToken(r, length),
|
|
284
|
+
]
|
|
279
285
|
} else {
|
|
280
286
|
const bytes = r.readBytes(length)
|
|
281
287
|
unknown.push({
|
|
@@ -21,7 +21,7 @@ export interface AuthorizationToken {
|
|
|
21
21
|
export interface Draft13SetupParams {
|
|
22
22
|
path?: string // 0x01 odd
|
|
23
23
|
max_request_id?: bigint // 0x02 even
|
|
24
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
24
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
25
25
|
max_auth_token_cache_size?: bigint // 0x04 even
|
|
26
26
|
unknown?: UnknownParam[]
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ export interface Draft13SetupParams {
|
|
|
29
29
|
// Version-specific parameters — even/odd convention
|
|
30
30
|
export interface Draft13Params {
|
|
31
31
|
delivery_timeout?: bigint // 0x02 even
|
|
32
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
32
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
33
33
|
max_cache_duration?: bigint // 0x04 even
|
|
34
34
|
unknown?: UnknownParam[]
|
|
35
35
|
}
|
|
@@ -78,7 +78,7 @@ function encodeSetupParams(params: Draft14Params, writer: BufferWriter): void {
|
|
|
78
78
|
if (params.role !== undefined) count++
|
|
79
79
|
if (params.path !== undefined) count++
|
|
80
80
|
if (params.max_request_id !== undefined) count++
|
|
81
|
-
|
|
81
|
+
count += params.authorization_token?.length ?? 0
|
|
82
82
|
if (params.authority !== undefined) count++
|
|
83
83
|
if (params.max_auth_token_cache_size !== undefined) count++
|
|
84
84
|
if (params.moqt_implementation !== undefined) count++
|
|
@@ -100,9 +100,9 @@ function encodeSetupParams(params: Draft14Params, writer: BufferWriter): void {
|
|
|
100
100
|
writer.writeVarInt(PARAM_MAX_REQUEST_ID)
|
|
101
101
|
writer.writeVarInt(params.max_request_id)
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
for (const token of params.authorization_token ?? []) {
|
|
104
104
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
105
|
-
const tok =
|
|
105
|
+
const tok = token
|
|
106
106
|
const tmpWriter = new BufferWriter(64)
|
|
107
107
|
tmpWriter.writeVarInt(tok.alias_type)
|
|
108
108
|
if (tok.token_type !== undefined) {
|
|
@@ -187,7 +187,10 @@ function decodeSetupParams(reader: BufferReader): Draft14Params {
|
|
|
187
187
|
tok.token_value = new Uint8Array(tokenValue)
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
result.authorization_token =
|
|
190
|
+
result.authorization_token = [
|
|
191
|
+
...(result.authorization_token ?? []),
|
|
192
|
+
tok as unknown as AuthorizationToken,
|
|
193
|
+
]
|
|
191
194
|
} else if (paramType === PARAM_AUTHORITY) {
|
|
192
195
|
result.authority = textDecoder.decode(bytes)
|
|
193
196
|
} else if (paramType === PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -209,7 +212,7 @@ function decodeSetupParams(reader: BufferReader): Draft14Params {
|
|
|
209
212
|
function encodeMessageParams(params: Draft14Params, writer: BufferWriter): void {
|
|
210
213
|
let count = 0
|
|
211
214
|
if (params.delivery_timeout !== undefined) count++
|
|
212
|
-
|
|
215
|
+
count += params.authorization_token?.length ?? 0
|
|
213
216
|
if (params.max_cache_duration !== undefined) count++
|
|
214
217
|
if (params.unknown) count += params.unknown.length
|
|
215
218
|
|
|
@@ -219,9 +222,9 @@ function encodeMessageParams(params: Draft14Params, writer: BufferWriter): void
|
|
|
219
222
|
writer.writeVarInt(PARAM_DELIVERY_TIMEOUT)
|
|
220
223
|
writer.writeVarInt(params.delivery_timeout)
|
|
221
224
|
}
|
|
222
|
-
|
|
225
|
+
for (const token of params.authorization_token ?? []) {
|
|
223
226
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
224
|
-
const tok =
|
|
227
|
+
const tok = token
|
|
225
228
|
const tmpWriter = new BufferWriter(64)
|
|
226
229
|
tmpWriter.writeVarInt(tok.alias_type)
|
|
227
230
|
if (tok.token_type !== undefined) {
|
|
@@ -290,7 +293,10 @@ function decodeMessageParams(reader: BufferReader): Draft14Params {
|
|
|
290
293
|
tok.token_value = new Uint8Array(tokenValue)
|
|
291
294
|
}
|
|
292
295
|
}
|
|
293
|
-
result.authorization_token =
|
|
296
|
+
result.authorization_token = [
|
|
297
|
+
...(result.authorization_token ?? []),
|
|
298
|
+
tok as unknown as AuthorizationToken,
|
|
299
|
+
]
|
|
294
300
|
} else {
|
|
295
301
|
unknown.push({
|
|
296
302
|
id: `0x${paramType.toString(16)}`,
|
|
@@ -47,7 +47,7 @@ export interface Draft14Params {
|
|
|
47
47
|
moqt_implementation?: string // 0x07 odd, length-prefixed UTF-8
|
|
48
48
|
// Message parameters (SUBSCRIBE, PUBLISH, etc.)
|
|
49
49
|
delivery_timeout?: bigint
|
|
50
|
-
authorization_token?: AuthorizationToken
|
|
50
|
+
authorization_token?: readonly AuthorizationToken[]
|
|
51
51
|
max_cache_duration?: bigint
|
|
52
52
|
// Unknown / extension
|
|
53
53
|
unknown?: UnknownParam[]
|
|
@@ -63,7 +63,7 @@ function encodeSetupParams(params: Draft15SetupParams, writer: BufferWriter): vo
|
|
|
63
63
|
let count = 0
|
|
64
64
|
if (params.path !== undefined) count++
|
|
65
65
|
if (params.max_request_id !== undefined) count++
|
|
66
|
-
|
|
66
|
+
count += params.authorization_token?.length ?? 0
|
|
67
67
|
if (params.max_auth_token_cache_size !== undefined) count++
|
|
68
68
|
if (params.authority !== undefined) count++
|
|
69
69
|
if (params.moqt_implementation !== undefined) count++
|
|
@@ -86,10 +86,10 @@ function encodeSetupParams(params: Draft15SetupParams, writer: BufferWriter): vo
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// AUTHORIZATION_TOKEN (0x03) - odd, length-prefixed with nested structure
|
|
89
|
-
|
|
89
|
+
for (const token of params.authorization_token ?? []) {
|
|
90
90
|
writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN)
|
|
91
91
|
const tmpW = new BufferWriter(64)
|
|
92
|
-
encodeAuthorizationToken(
|
|
92
|
+
encodeAuthorizationToken(token, tmpW)
|
|
93
93
|
const raw = tmpW.finish()
|
|
94
94
|
writer.writeVarInt(raw.byteLength)
|
|
95
95
|
writer.writeBytes(raw)
|
|
@@ -170,7 +170,10 @@ function decodeSetupParams(reader: BufferReader): Draft15SetupParams {
|
|
|
170
170
|
if (paramType === SETUP_PARAM_PATH) {
|
|
171
171
|
result.path = textDecoder.decode(bytes)
|
|
172
172
|
} else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
|
|
173
|
-
result.authorization_token =
|
|
173
|
+
result.authorization_token = [
|
|
174
|
+
...(result.authorization_token ?? []),
|
|
175
|
+
decodeAuthorizationToken(new BufferReader(bytes)),
|
|
176
|
+
]
|
|
174
177
|
} else if (paramType === SETUP_PARAM_AUTHORITY) {
|
|
175
178
|
result.authority = textDecoder.decode(bytes)
|
|
176
179
|
} else if (paramType === SETUP_PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -242,7 +245,7 @@ function encodeParams(params: Draft15Params, writer: BufferWriter): void {
|
|
|
242
245
|
// Count known + unknown params
|
|
243
246
|
let count = params.unknown ? params.unknown.length : 0
|
|
244
247
|
if (params.delivery_timeout !== undefined) count++
|
|
245
|
-
|
|
248
|
+
count += params.authorization_token?.length ?? 0
|
|
246
249
|
if (params.max_cache_duration !== undefined) count++
|
|
247
250
|
if (params.expires !== undefined) count++
|
|
248
251
|
if (params.largest_object !== undefined) count++
|
|
@@ -260,10 +263,10 @@ function encodeParams(params: Draft15Params, writer: BufferWriter): void {
|
|
|
260
263
|
writer.writeVarInt(PARAM_DELIVERY_TIMEOUT)
|
|
261
264
|
writer.writeVarInt(params.delivery_timeout)
|
|
262
265
|
}
|
|
263
|
-
|
|
266
|
+
for (const token of params.authorization_token ?? []) {
|
|
264
267
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
265
268
|
const tmpW = new BufferWriter(64)
|
|
266
|
-
encodeAuthorizationToken(
|
|
269
|
+
encodeAuthorizationToken(token, tmpW)
|
|
267
270
|
const raw = tmpW.finish()
|
|
268
271
|
writer.writeVarInt(raw.byteLength)
|
|
269
272
|
writer.writeBytes(raw)
|
|
@@ -358,7 +361,10 @@ function decodeParams(reader: BufferReader): Draft15Params {
|
|
|
358
361
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
359
362
|
const length = Number(reader.readVarInt())
|
|
360
363
|
const tokenBytes = reader.readBytes(length)
|
|
361
|
-
result.authorization_token =
|
|
364
|
+
result.authorization_token = [
|
|
365
|
+
...(result.authorization_token ?? []),
|
|
366
|
+
decodeAuthorizationToken(new BufferReader(tokenBytes)),
|
|
367
|
+
]
|
|
362
368
|
} else if (paramType === PARAM_MAX_CACHE_DURATION) {
|
|
363
369
|
result.max_cache_duration = reader.readVarInt()
|
|
364
370
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -20,7 +20,7 @@ export interface AuthorizationToken {
|
|
|
20
20
|
export interface Draft15SetupParams {
|
|
21
21
|
path?: string // 0x01 odd
|
|
22
22
|
max_request_id?: bigint // 0x02 even
|
|
23
|
-
authorization_token?: AuthorizationToken // 0x03 odd (length-prefixed, nested)
|
|
23
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd (length-prefixed, nested)
|
|
24
24
|
max_auth_token_cache_size?: bigint // 0x04 even
|
|
25
25
|
authority?: string // 0x05 odd
|
|
26
26
|
moqt_implementation?: string // 0x07 odd
|
|
@@ -44,7 +44,7 @@ export interface LargestObject {
|
|
|
44
44
|
// Version-specific parameters (well-known + unknown)
|
|
45
45
|
export interface Draft15Params {
|
|
46
46
|
delivery_timeout?: bigint // 0x02 even
|
|
47
|
-
authorization_token?: AuthorizationToken // 0x03 odd (length-prefixed, nested)
|
|
47
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd (length-prefixed, nested)
|
|
48
48
|
max_cache_duration?: bigint // 0x04 even
|
|
49
49
|
expires?: bigint // 0x08 even
|
|
50
50
|
largest_object?: LargestObject // 0x09 odd (length-prefixed)
|
|
@@ -65,7 +65,7 @@ function encodeSetupParams(params: Draft16SetupParams, writer: BufferWriter): vo
|
|
|
65
65
|
let count = 0
|
|
66
66
|
if (params.path !== undefined) count++
|
|
67
67
|
if (params.max_request_id !== undefined) count++
|
|
68
|
-
|
|
68
|
+
count += params.authorization_token?.length ?? 0
|
|
69
69
|
if (params.max_auth_token_cache_size !== undefined) count++
|
|
70
70
|
if (params.authority !== undefined) count++
|
|
71
71
|
if (params.moqt_implementation !== undefined) count++
|
|
@@ -88,10 +88,10 @@ function encodeSetupParams(params: Draft16SetupParams, writer: BufferWriter): vo
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// AUTHORIZATION_TOKEN (0x03) - odd, length-prefixed with nested structure
|
|
91
|
-
|
|
91
|
+
for (const token of params.authorization_token ?? []) {
|
|
92
92
|
writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN)
|
|
93
93
|
const tmpW = new BufferWriter(64)
|
|
94
|
-
encodeAuthorizationToken(
|
|
94
|
+
encodeAuthorizationToken(token, tmpW)
|
|
95
95
|
const raw = tmpW.finish()
|
|
96
96
|
writer.writeVarInt(raw.byteLength)
|
|
97
97
|
writer.writeBytes(raw)
|
|
@@ -168,7 +168,10 @@ function decodeSetupParams(reader: BufferReader): Draft16SetupParams {
|
|
|
168
168
|
if (paramType === SETUP_PARAM_PATH) {
|
|
169
169
|
result.path = textDecoder.decode(bytes)
|
|
170
170
|
} else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
|
|
171
|
-
result.authorization_token =
|
|
171
|
+
result.authorization_token = [
|
|
172
|
+
...(result.authorization_token ?? []),
|
|
173
|
+
decodeAuthorizationToken(new BufferReader(bytes)),
|
|
174
|
+
]
|
|
172
175
|
} else if (paramType === SETUP_PARAM_AUTHORITY) {
|
|
173
176
|
result.authority = textDecoder.decode(bytes)
|
|
174
177
|
} else if (paramType === SETUP_PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -324,12 +327,12 @@ function encodeParams(params: Draft16Params, writer: BufferWriter): void {
|
|
|
324
327
|
encode: (w) => w.writeVarInt(params.delivery_timeout!),
|
|
325
328
|
})
|
|
326
329
|
}
|
|
327
|
-
|
|
330
|
+
for (const token of params.authorization_token ?? []) {
|
|
328
331
|
entries.push({
|
|
329
332
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
330
333
|
encode: (w) => {
|
|
331
334
|
const tmpW = new BufferWriter(64)
|
|
332
|
-
encodeAuthorizationToken(
|
|
335
|
+
encodeAuthorizationToken(token, tmpW)
|
|
333
336
|
const raw = tmpW.finish()
|
|
334
337
|
w.writeVarInt(raw.byteLength)
|
|
335
338
|
w.writeBytes(raw)
|
|
@@ -457,7 +460,10 @@ function decodeParams(reader: BufferReader): Draft16Params {
|
|
|
457
460
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
458
461
|
const length = Number(reader.readVarInt())
|
|
459
462
|
const tokenBytes = reader.readBytes(length)
|
|
460
|
-
result.authorization_token =
|
|
463
|
+
result.authorization_token = [
|
|
464
|
+
...(result.authorization_token ?? []),
|
|
465
|
+
decodeAuthorizationToken(new BufferReader(tokenBytes)),
|
|
466
|
+
]
|
|
461
467
|
} else if (paramType === PARAM_MAX_CACHE_DURATION) {
|
|
462
468
|
result.max_cache_duration = reader.readVarInt()
|
|
463
469
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -20,7 +20,7 @@ export interface AuthorizationToken {
|
|
|
20
20
|
export interface Draft16SetupParams {
|
|
21
21
|
path?: string // 0x01 odd
|
|
22
22
|
max_request_id?: bigint // 0x02 even
|
|
23
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
23
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
24
24
|
max_auth_token_cache_size?: bigint // 0x04 even
|
|
25
25
|
authority?: string // 0x05 odd
|
|
26
26
|
moqt_implementation?: string // 0x07 odd
|
|
@@ -52,7 +52,7 @@ export interface Draft16TrackExtensions {
|
|
|
52
52
|
// Version-specific parameters (well-known + unknown)
|
|
53
53
|
export interface Draft16Params {
|
|
54
54
|
delivery_timeout?: bigint // 0x02 even
|
|
55
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
55
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
56
56
|
max_cache_duration?: bigint // 0x04 even
|
|
57
57
|
expires?: bigint // 0x08 even
|
|
58
58
|
largest_object?: LargestObject // 0x09 odd (length-prefixed)
|
|
@@ -68,12 +68,12 @@ function encodeSetupOptions(opts: Draft17SetupOptions, writer: BufferWriter): vo
|
|
|
68
68
|
},
|
|
69
69
|
})
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
for (const token of opts.authorization_token ?? []) {
|
|
72
72
|
entries.push({
|
|
73
73
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
74
74
|
encode: (w) => {
|
|
75
75
|
const tmpW = new BufferWriter(64)
|
|
76
|
-
encodeAuthorizationToken(
|
|
76
|
+
encodeAuthorizationToken(token, tmpW)
|
|
77
77
|
const raw = tmpW.finish()
|
|
78
78
|
w.writeVarInt(BigInt(raw.byteLength))
|
|
79
79
|
w.writeBytes(raw)
|
|
@@ -168,7 +168,10 @@ function decodeSetupOptions(reader: BufferReader, payloadEnd: number): Draft17Se
|
|
|
168
168
|
if (optType === SETUP_OPT_PATH) {
|
|
169
169
|
result.path = textDecoder.decode(bytes)
|
|
170
170
|
} else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
|
|
171
|
-
result.authorization_token =
|
|
171
|
+
result.authorization_token = [
|
|
172
|
+
...(result.authorization_token ?? []),
|
|
173
|
+
decodeAuthorizationToken(new BufferReader(bytes)),
|
|
174
|
+
]
|
|
172
175
|
} else if (optType === SETUP_OPT_AUTHORITY) {
|
|
173
176
|
result.authority = textDecoder.decode(bytes)
|
|
174
177
|
} else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
|
|
@@ -283,12 +286,12 @@ function encodeParams(params: Draft17Params, writer: BufferWriter): void {
|
|
|
283
286
|
encode: (w) => w.writeVarInt(params.delivery_timeout!),
|
|
284
287
|
})
|
|
285
288
|
}
|
|
286
|
-
|
|
289
|
+
for (const token of params.authorization_token ?? []) {
|
|
287
290
|
entries.push({
|
|
288
291
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
289
292
|
encode: (w) => {
|
|
290
293
|
const tmpW = new BufferWriter(64)
|
|
291
|
-
encodeAuthorizationToken(
|
|
294
|
+
encodeAuthorizationToken(token, tmpW)
|
|
292
295
|
const raw = tmpW.finish()
|
|
293
296
|
w.writeVarInt(BigInt(raw.byteLength))
|
|
294
297
|
w.writeBytes(raw)
|
|
@@ -411,7 +414,10 @@ function decodeParams(reader: BufferReader, messageType: string): Draft17Params
|
|
|
411
414
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
412
415
|
const length = Number(reader.readVarInt())
|
|
413
416
|
const bytes = reader.readBytes(length)
|
|
414
|
-
result.authorization_token =
|
|
417
|
+
result.authorization_token = [
|
|
418
|
+
...(result.authorization_token ?? []),
|
|
419
|
+
decodeAuthorizationToken(new BufferReader(bytes)),
|
|
420
|
+
]
|
|
415
421
|
} else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
|
|
416
422
|
result.rendezvous_timeout = reader.readVarInt()
|
|
417
423
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -18,7 +18,7 @@ export interface AuthorizationToken {
|
|
|
18
18
|
// Setup options (KVP encoding, no count prefix)
|
|
19
19
|
export interface Draft17SetupOptions {
|
|
20
20
|
path?: string // 0x01 odd
|
|
21
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
21
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
22
22
|
max_auth_token_cache_size?: bigint // 0x04 even
|
|
23
23
|
authority?: string // 0x05 odd
|
|
24
24
|
moqt_implementation?: string // 0x07 odd
|
|
@@ -42,7 +42,7 @@ export interface LargestObject {
|
|
|
42
42
|
// Version-specific parameters (delta-encoded types, count-prefixed)
|
|
43
43
|
export interface Draft17Params {
|
|
44
44
|
delivery_timeout?: bigint // 0x02 varint
|
|
45
|
-
authorization_token?: AuthorizationToken // 0x03 length-prefixed nested
|
|
45
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 length-prefixed nested
|
|
46
46
|
rendezvous_timeout?: bigint // 0x04 varint
|
|
47
47
|
expires?: bigint // 0x08 varint
|
|
48
48
|
largest_object?: LargestObject // 0x09 Location (2 bare varints)
|
|
@@ -71,12 +71,12 @@ function encodeSetupOptions(opts: Draft18SetupOptions, writer: BufferWriter): vo
|
|
|
71
71
|
},
|
|
72
72
|
})
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
for (const token of opts.authorization_token ?? []) {
|
|
75
75
|
entries.push({
|
|
76
76
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
77
77
|
encode: (w) => {
|
|
78
78
|
const tmpW = new BufferWriter(64)
|
|
79
|
-
encodeAuthorizationToken(
|
|
79
|
+
encodeAuthorizationToken(token, tmpW)
|
|
80
80
|
const raw = tmpW.finish()
|
|
81
81
|
w.writeVarInt(BigInt(raw.byteLength))
|
|
82
82
|
w.writeBytes(raw)
|
|
@@ -171,7 +171,10 @@ function decodeSetupOptions(reader: BufferReader, payloadEnd: number): Draft18Se
|
|
|
171
171
|
if (optType === SETUP_OPT_PATH) {
|
|
172
172
|
result.path = textDecoder.decode(bytes)
|
|
173
173
|
} else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
|
|
174
|
-
result.authorization_token =
|
|
174
|
+
result.authorization_token = [
|
|
175
|
+
...(result.authorization_token ?? []),
|
|
176
|
+
decodeAuthorizationToken(new BufferReader(bytes)),
|
|
177
|
+
]
|
|
175
178
|
} else if (optType === SETUP_OPT_AUTHORITY) {
|
|
176
179
|
result.authority = textDecoder.decode(bytes)
|
|
177
180
|
} else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
|
|
@@ -315,12 +318,12 @@ function encodeParams(params: Draft18Params, writer: BufferWriter): void {
|
|
|
315
318
|
encode: (w) => w.writeVarInt(params.object_delivery_timeout!),
|
|
316
319
|
})
|
|
317
320
|
}
|
|
318
|
-
|
|
321
|
+
for (const token of params.authorization_token ?? []) {
|
|
319
322
|
entries.push({
|
|
320
323
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
321
324
|
encode: (w) => {
|
|
322
325
|
const tmpW = new BufferWriter(64)
|
|
323
|
-
encodeAuthorizationToken(
|
|
326
|
+
encodeAuthorizationToken(token, tmpW)
|
|
324
327
|
const raw = tmpW.finish()
|
|
325
328
|
w.writeVarInt(BigInt(raw.byteLength))
|
|
326
329
|
w.writeBytes(raw)
|
|
@@ -469,7 +472,10 @@ function decodeParams(reader: BufferReader, messageType: string): Draft18Params
|
|
|
469
472
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
470
473
|
const length = Number(reader.readVarInt())
|
|
471
474
|
const bytes = reader.readBytes(length)
|
|
472
|
-
result.authorization_token =
|
|
475
|
+
result.authorization_token = [
|
|
476
|
+
...(result.authorization_token ?? []),
|
|
477
|
+
decodeAuthorizationToken(new BufferReader(bytes)),
|
|
478
|
+
]
|
|
473
479
|
} else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
|
|
474
480
|
result.rendezvous_timeout = reader.readVarInt()
|
|
475
481
|
} else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
|
|
@@ -18,7 +18,7 @@ export interface AuthorizationToken {
|
|
|
18
18
|
// Setup options (KVP encoding, no count prefix)
|
|
19
19
|
export interface Draft18SetupOptions {
|
|
20
20
|
path?: string // 0x01 odd
|
|
21
|
-
authorization_token?: AuthorizationToken // 0x03 odd
|
|
21
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 odd
|
|
22
22
|
max_auth_token_cache_size?: bigint // 0x04 even
|
|
23
23
|
authority?: string // 0x05 odd
|
|
24
24
|
moqt_implementation?: string // 0x07 odd
|
|
@@ -42,7 +42,7 @@ export interface LargestObject {
|
|
|
42
42
|
// Version-specific parameters (delta-encoded types, count-prefixed)
|
|
43
43
|
export interface Draft18Params {
|
|
44
44
|
object_delivery_timeout?: bigint // 0x02 varint (renamed from delivery_timeout in draft-17)
|
|
45
|
-
authorization_token?: AuthorizationToken // 0x03 length-prefixed nested
|
|
45
|
+
authorization_token?: readonly AuthorizationToken[] // 0x03 length-prefixed nested
|
|
46
46
|
rendezvous_timeout?: bigint // 0x04 varint
|
|
47
47
|
subgroup_delivery_timeout?: bigint // 0x06 varint (NEW in draft-18)
|
|
48
48
|
expires?: bigint // 0x08 varint
|