@moqtap/codec 0.4.1 → 0.4.3
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/dist/{chunk-UJU63EFY.cjs → chunk-BAG6YWCP.cjs} +2 -3
- package/dist/{chunk-2UTVXWFF.js → chunk-COWGGUL4.js} +2 -3
- package/dist/{chunk-4IVZZOY3.js → chunk-CXFAQKL3.js} +2 -3
- package/dist/{chunk-SDWRXXOO.cjs → chunk-HO44OANK.cjs} +2 -3
- package/dist/{chunk-Q46ZURKX.js → chunk-HYI6LFMD.js} +2 -3
- package/dist/{chunk-4BDEU3D4.cjs → chunk-JB5VDJ2V.cjs} +27 -4
- package/dist/{chunk-XHDPQHYR.cjs → chunk-JTRU76JN.cjs} +33 -2
- package/dist/{chunk-GCBFHZW6.js → chunk-NZ7GYEMT.js} +27 -4
- package/dist/{chunk-5O764MBD.cjs → chunk-OGZTQA24.cjs} +6 -6
- package/dist/{chunk-BLEFTWEB.js → chunk-Q5D6OW6Q.js} +33 -2
- package/dist/{chunk-XS77RBY7.js → chunk-RZ3UML47.js} +2 -4
- package/dist/{chunk-3XKO6PCR.cjs → chunk-SIYYMFCC.cjs} +2 -3
- package/dist/{chunk-Z6U26IRI.js → chunk-UP4XPH4J.js} +6 -6
- package/dist/{chunk-OKG2HT25.cjs → chunk-WMJVSBBE.cjs} +2 -4
- package/dist/{codec-BHHfBTnV.d.ts → codec-B2lYE0YA.d.ts} +1 -1
- package/dist/{codec-C-Yk2RNa.d.ts → codec-BFg5xnrJ.d.ts} +1 -1
- package/dist/{codec-BB0U8MF2.d.cts → codec-BWQ5Jlap.d.cts} +1 -1
- package/dist/{codec-z6_2PSzi.d.cts → codec-B_QST4y1.d.cts} +1 -1
- package/dist/{codec-COy4uuPO.d.cts → codec-BbbLDSKA.d.cts} +1 -1
- package/dist/{codec-BO5Go0Lm.d.cts → codec-C7UzTYSS.d.cts} +1 -1
- package/dist/{codec-BN6jk0Td.d.cts → codec-C8aSvE41.d.cts} +1 -1
- package/dist/{codec-w8z2j_uo.d.cts → codec-CAbm9d_n.d.cts} +1 -1
- package/dist/{codec-D2QVSH9D.d.ts → codec-CpZrZ3ok.d.ts} +1 -1
- package/dist/{codec-J7ekOSMc.d.ts → codec-DFU-6Rax.d.ts} +1 -1
- package/dist/{codec-iMEwV1UO.d.ts → codec-Db-0pk38.d.ts} +1 -1
- package/dist/{codec-BU0gaSZm.d.ts → codec-DftaRuVz.d.ts} +1 -1
- package/dist/{codec-DNfml-se.d.ts → codec-Va_wZCF_.d.ts} +1 -1
- package/dist/{codec-DoOGjjDq.d.cts → codec-lqDowbyT.d.cts} +1 -1
- package/dist/draft11-session.d.cts +1 -1
- package/dist/draft11-session.d.ts +1 -1
- package/dist/draft11.cjs +2 -2
- package/dist/draft11.d.cts +3 -3
- package/dist/draft11.d.ts +3 -3
- package/dist/draft11.js +1 -1
- package/dist/draft12-session.d.cts +1 -1
- package/dist/draft12-session.d.ts +1 -1
- package/dist/draft12.cjs +2 -2
- package/dist/draft12.d.cts +3 -3
- package/dist/draft12.d.ts +3 -3
- package/dist/draft12.js +1 -1
- package/dist/draft13-session.d.cts +1 -1
- package/dist/draft13-session.d.ts +1 -1
- package/dist/draft13.cjs +2 -2
- package/dist/draft13.d.cts +3 -3
- package/dist/draft13.d.ts +3 -3
- package/dist/draft13.js +1 -1
- package/dist/draft14-session.d.cts +1 -1
- package/dist/draft14-session.d.ts +1 -1
- package/dist/draft14.cjs +2 -2
- package/dist/draft14.d.cts +3 -3
- package/dist/draft14.d.ts +3 -3
- package/dist/draft14.js +1 -1
- package/dist/draft15-session.d.cts +1 -1
- package/dist/draft15-session.d.ts +1 -1
- package/dist/draft15.cjs +2 -2
- package/dist/draft15.d.cts +3 -3
- package/dist/draft15.d.ts +3 -3
- package/dist/draft15.js +1 -1
- package/dist/draft16-session.d.cts +1 -1
- package/dist/draft16-session.d.ts +1 -1
- package/dist/draft16.cjs +2 -2
- package/dist/draft16.d.cts +3 -3
- package/dist/draft16.d.ts +3 -3
- package/dist/draft16.js +1 -1
- package/dist/draft17-session.d.cts +1 -1
- package/dist/draft17-session.d.ts +1 -1
- package/dist/draft17.cjs +2 -2
- package/dist/draft17.d.cts +3 -3
- package/dist/draft17.d.ts +3 -3
- package/dist/draft17.js +1 -1
- package/dist/index.cjs +14 -14
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +7 -7
- package/dist/session.d.cts +7 -7
- package/dist/session.d.ts +7 -7
- package/dist/{types-C2qKTRR_.d.cts → types-Bio-91Rt.d.cts} +2 -1
- package/dist/{types-C2qKTRR_.d.ts → types-Bio-91Rt.d.ts} +2 -1
- package/dist/{types-DuxfOYiO.d.cts → types-CPaYBsMG.d.cts} +1 -1
- package/dist/{types-DuxfOYiO.d.ts → types-CPaYBsMG.d.ts} +1 -1
- package/dist/{types-DrQpTW1G.d.cts → types-CXlSn0I9.d.cts} +1 -1
- package/dist/{types-DrQpTW1G.d.ts → types-CXlSn0I9.d.ts} +1 -1
- package/dist/{types--Q7_DcvP.d.cts → types-Ck45Ex5S.d.cts} +1 -1
- package/dist/{types--Q7_DcvP.d.ts → types-Ck45Ex5S.d.ts} +1 -1
- package/dist/{types-BFpFNM_m.d.cts → types-Cm9fjeYC.d.cts} +1 -1
- package/dist/{types-BFpFNM_m.d.ts → types-Cm9fjeYC.d.ts} +1 -1
- package/dist/{types-Br7fm2mf.d.cts → types-D9eiB_9A.d.cts} +2 -2
- package/dist/{types-Br7fm2mf.d.ts → types-D9eiB_9A.d.ts} +2 -2
- package/dist/{types--FGt0sAp.d.cts → types-DjmrHp_s.d.cts} +1 -1
- package/dist/{types--FGt0sAp.d.ts → types-DjmrHp_s.d.ts} +1 -1
- package/package.json +2 -2
- package/src/drafts/draft11/codec.ts +2 -3
- package/src/drafts/draft11/types.ts +1 -1
- package/src/drafts/draft12/codec.ts +27 -4
- package/src/drafts/draft12/types.ts +2 -1
- package/src/drafts/draft13/codec.ts +2 -3
- package/src/drafts/draft13/types.ts +1 -1
- package/src/drafts/draft14/codec.ts +33 -2
- package/src/drafts/draft14/types.ts +1 -1
- package/src/drafts/draft15/codec.ts +2 -4
- package/src/drafts/draft15/types.ts +1 -1
- package/src/drafts/draft16/codec.ts +2 -3
- package/src/drafts/draft16/types.ts +1 -1
- package/src/drafts/draft17/codec.ts +6 -6
- package/src/drafts/draft17/types.ts +2 -2
|
@@ -78,6 +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
|
+
if (params.authorization_token !== undefined) count++
|
|
81
82
|
if (params.authority !== undefined) count++
|
|
82
83
|
if (params.max_auth_token_cache_size !== undefined) count++
|
|
83
84
|
if (params.moqt_implementation !== undefined) count++
|
|
@@ -99,6 +100,24 @@ function encodeSetupParams(params: Draft14Params, writer: BufferWriter): void {
|
|
|
99
100
|
writer.writeVarInt(PARAM_MAX_REQUEST_ID)
|
|
100
101
|
writer.writeVarInt(params.max_request_id)
|
|
101
102
|
}
|
|
103
|
+
if (params.authorization_token !== undefined) {
|
|
104
|
+
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN)
|
|
105
|
+
const tok = params.authorization_token
|
|
106
|
+
const tmpWriter = new BufferWriter(64)
|
|
107
|
+
tmpWriter.writeVarInt(tok.alias_type)
|
|
108
|
+
if (tok.token_type !== undefined) {
|
|
109
|
+
tmpWriter.writeVarInt(tok.token_type)
|
|
110
|
+
}
|
|
111
|
+
if (tok.token_value !== undefined) {
|
|
112
|
+
tmpWriter.writeBytes(tok.token_value)
|
|
113
|
+
}
|
|
114
|
+
if (tok.token_alias !== undefined) {
|
|
115
|
+
tmpWriter.writeVarInt(tok.token_alias)
|
|
116
|
+
}
|
|
117
|
+
const tokenBytes = tmpWriter.finish()
|
|
118
|
+
writer.writeVarInt(tokenBytes.byteLength)
|
|
119
|
+
writer.writeBytes(tokenBytes)
|
|
120
|
+
}
|
|
102
121
|
if (params.max_auth_token_cache_size !== undefined) {
|
|
103
122
|
writer.writeVarInt(PARAM_MAX_AUTH_TOKEN_CACHE_SIZE)
|
|
104
123
|
writer.writeVarInt(params.max_auth_token_cache_size)
|
|
@@ -157,6 +176,18 @@ function decodeSetupParams(reader: BufferReader): Draft14Params {
|
|
|
157
176
|
const bytes = reader.readBytes(length)
|
|
158
177
|
if (paramType === PARAM_PATH) {
|
|
159
178
|
result.path = textDecoder.decode(bytes)
|
|
179
|
+
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
180
|
+
const tokenReader = new BufferReader(bytes)
|
|
181
|
+
const alias_type = tokenReader.readVarInt()
|
|
182
|
+
const tok: Record<string, unknown> = { alias_type }
|
|
183
|
+
if (tokenReader.remaining > 0) {
|
|
184
|
+
tok.token_type = tokenReader.readVarInt()
|
|
185
|
+
if (tokenReader.remaining > 0) {
|
|
186
|
+
const tokenValue = tokenReader.readBytesView(tokenReader.remaining)
|
|
187
|
+
tok.token_value = new Uint8Array(tokenValue)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
result.authorization_token = tok as unknown as AuthorizationToken
|
|
160
191
|
} else if (paramType === PARAM_AUTHORITY) {
|
|
161
192
|
result.authority = textDecoder.decode(bytes)
|
|
162
193
|
} else if (paramType === PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -197,7 +228,7 @@ function encodeMessageParams(params: Draft14Params, writer: BufferWriter): void
|
|
|
197
228
|
tmpWriter.writeVarInt(tok.token_type)
|
|
198
229
|
}
|
|
199
230
|
if (tok.token_value !== undefined) {
|
|
200
|
-
tmpWriter.writeBytes(
|
|
231
|
+
tmpWriter.writeBytes(tok.token_value)
|
|
201
232
|
}
|
|
202
233
|
if (tok.token_alias !== undefined) {
|
|
203
234
|
tmpWriter.writeVarInt(tok.token_alias)
|
|
@@ -256,7 +287,7 @@ function decodeMessageParams(reader: BufferReader): Draft14Params {
|
|
|
256
287
|
tok.token_type = tokenReader.readVarInt()
|
|
257
288
|
if (tokenReader.remaining > 0) {
|
|
258
289
|
const tokenValue = tokenReader.readBytesView(tokenReader.remaining)
|
|
259
|
-
tok.token_value =
|
|
290
|
+
tok.token_value = new Uint8Array(tokenValue)
|
|
260
291
|
}
|
|
261
292
|
}
|
|
262
293
|
result.authorization_token = tok as unknown as AuthorizationToken
|
|
@@ -203,8 +203,7 @@ function encodeAuthorizationToken(token: AuthorizationToken, w: BufferWriter): v
|
|
|
203
203
|
if (aliasType === 1 || aliasType === 3) {
|
|
204
204
|
w.writeVarInt(token.token_type!)
|
|
205
205
|
// token_value is the remaining bytes (no inner length prefix)
|
|
206
|
-
|
|
207
|
-
w.writeBytes(tokenBytes)
|
|
206
|
+
w.writeBytes(token.token_value!)
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
|
|
@@ -218,8 +217,7 @@ function decodeAuthorizationToken(r: BufferReader): AuthorizationToken {
|
|
|
218
217
|
if (aliasType === 1 || aliasType === 3) {
|
|
219
218
|
result.token_type = r.readVarInt()
|
|
220
219
|
// token_value is the remaining bytes in the length-prefixed block
|
|
221
|
-
|
|
222
|
-
result.token_value_hex = bytesToHex(tokenBytes)
|
|
220
|
+
result.token_value = r.readBytes(r.remaining)
|
|
223
221
|
}
|
|
224
222
|
return result as unknown as AuthorizationToken
|
|
225
223
|
}
|
|
@@ -13,7 +13,7 @@ export interface AuthorizationToken {
|
|
|
13
13
|
readonly alias_type: bigint
|
|
14
14
|
readonly token_alias?: bigint // present when alias_type = 0 or 1
|
|
15
15
|
readonly token_type?: bigint // present when alias_type = 1 or 3
|
|
16
|
-
readonly
|
|
16
|
+
readonly token_value?: Uint8Array // present when alias_type = 1 or 3
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Setup parameters (constant namespace across versions)
|
|
@@ -200,8 +200,7 @@ function encodeAuthorizationToken(token: AuthorizationToken, w: BufferWriter): v
|
|
|
200
200
|
}
|
|
201
201
|
if (aliasType === 1 || aliasType === 3) {
|
|
202
202
|
w.writeVarInt(token.token_type!)
|
|
203
|
-
|
|
204
|
-
w.writeBytes(tokenBytes)
|
|
203
|
+
w.writeBytes(token.token_value!)
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
206
|
|
|
@@ -215,7 +214,7 @@ function decodeAuthorizationToken(r: BufferReader): AuthorizationToken {
|
|
|
215
214
|
if (aliasType === 1 || aliasType === 3) {
|
|
216
215
|
result.token_type = r.readVarInt()
|
|
217
216
|
const tokenBytes = r.readBytesView(r.remaining)
|
|
218
|
-
result.
|
|
217
|
+
result.token_value = new Uint8Array(tokenBytes)
|
|
219
218
|
}
|
|
220
219
|
return result as unknown as AuthorizationToken
|
|
221
220
|
}
|
|
@@ -13,7 +13,7 @@ export interface AuthorizationToken {
|
|
|
13
13
|
readonly alias_type: bigint
|
|
14
14
|
readonly token_alias?: bigint
|
|
15
15
|
readonly token_type?: bigint
|
|
16
|
-
readonly
|
|
16
|
+
readonly token_value?: Uint8Array
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Setup parameters (constant namespace across versions)
|
|
@@ -199,9 +199,9 @@ function encodeAuthorizationToken(token: AuthorizationToken, w: BufferWriter): v
|
|
|
199
199
|
if (aliasType === 1 || aliasType === 3) {
|
|
200
200
|
// REGISTER, USE_VALUE: token_type + token_value present
|
|
201
201
|
w.writeVarInt(token.token_type ?? 0n)
|
|
202
|
-
const
|
|
203
|
-
w.writeVarInt(BigInt(
|
|
204
|
-
w.writeBytes(
|
|
202
|
+
const tv = token.token_value ?? new Uint8Array(0)
|
|
203
|
+
w.writeVarInt(BigInt(tv.byteLength))
|
|
204
|
+
w.writeBytes(tv)
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -217,7 +217,7 @@ function decodeAuthorizationToken(r: BufferReader): AuthorizationToken {
|
|
|
217
217
|
;(result as { token_type: bigint }).token_type = r.readVarInt()
|
|
218
218
|
const len = Number(r.readVarInt())
|
|
219
219
|
const bytes = r.readBytes(len)
|
|
220
|
-
;(result as { token_value:
|
|
220
|
+
;(result as { token_value: Uint8Array }).token_value = bytes
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
return result
|
|
@@ -464,7 +464,7 @@ function encodeTrackProperties(props: Draft17TrackProperties, writer: BufferWrit
|
|
|
464
464
|
entries.push({
|
|
465
465
|
type: TPROP_IMMUTABLE_PROPERTIES,
|
|
466
466
|
encode: (w) => {
|
|
467
|
-
const raw =
|
|
467
|
+
const raw = props.immutable_properties!
|
|
468
468
|
w.writeVarInt(BigInt(raw.byteLength))
|
|
469
469
|
w.writeBytes(raw)
|
|
470
470
|
},
|
|
@@ -557,7 +557,7 @@ function decodeTrackProperties(reader: BufferReader, payloadEnd: number): Draft1
|
|
|
557
557
|
const length = Number(reader.readVarInt())
|
|
558
558
|
const bytes = reader.readBytes(length)
|
|
559
559
|
if (propType === TPROP_IMMUTABLE_PROPERTIES) {
|
|
560
|
-
result.immutable_properties =
|
|
560
|
+
result.immutable_properties = bytes
|
|
561
561
|
} else {
|
|
562
562
|
unknown.push({
|
|
563
563
|
id: `0x${propType.toString(16)}`,
|
|
@@ -12,7 +12,7 @@ export interface AuthorizationToken {
|
|
|
12
12
|
readonly alias_type: bigint // 0=DELETE, 1=REGISTER, 2=USE_ALIAS, 3=USE_VALUE
|
|
13
13
|
readonly token_alias?: bigint // present for DELETE(0), REGISTER(1), USE_ALIAS(2)
|
|
14
14
|
readonly token_type?: bigint // present for REGISTER(1), USE_VALUE(3)
|
|
15
|
-
readonly token_value?:
|
|
15
|
+
readonly token_value?: Uint8Array // present for REGISTER(1), USE_VALUE(3)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// Setup options (KVP encoding, no count prefix)
|
|
@@ -58,7 +58,7 @@ export interface Draft17Params {
|
|
|
58
58
|
export interface Draft17TrackProperties {
|
|
59
59
|
delivery_timeout?: bigint // 0x02 even varint
|
|
60
60
|
max_cache_duration?: bigint // 0x04 even varint
|
|
61
|
-
immutable_properties?:
|
|
61
|
+
immutable_properties?: Uint8Array // 0x0b odd length-prefixed
|
|
62
62
|
default_publisher_priority?: bigint // 0x0c even varint
|
|
63
63
|
default_publisher_group_order?: bigint // 0x22 even varint
|
|
64
64
|
dynamic_groups?: bigint // 0x30 even varint
|