@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.
Files changed (105) hide show
  1. package/dist/{chunk-UJU63EFY.cjs → chunk-BAG6YWCP.cjs} +2 -3
  2. package/dist/{chunk-2UTVXWFF.js → chunk-COWGGUL4.js} +2 -3
  3. package/dist/{chunk-4IVZZOY3.js → chunk-CXFAQKL3.js} +2 -3
  4. package/dist/{chunk-SDWRXXOO.cjs → chunk-HO44OANK.cjs} +2 -3
  5. package/dist/{chunk-Q46ZURKX.js → chunk-HYI6LFMD.js} +2 -3
  6. package/dist/{chunk-4BDEU3D4.cjs → chunk-JB5VDJ2V.cjs} +27 -4
  7. package/dist/{chunk-XHDPQHYR.cjs → chunk-JTRU76JN.cjs} +33 -2
  8. package/dist/{chunk-GCBFHZW6.js → chunk-NZ7GYEMT.js} +27 -4
  9. package/dist/{chunk-5O764MBD.cjs → chunk-OGZTQA24.cjs} +6 -6
  10. package/dist/{chunk-BLEFTWEB.js → chunk-Q5D6OW6Q.js} +33 -2
  11. package/dist/{chunk-XS77RBY7.js → chunk-RZ3UML47.js} +2 -4
  12. package/dist/{chunk-3XKO6PCR.cjs → chunk-SIYYMFCC.cjs} +2 -3
  13. package/dist/{chunk-Z6U26IRI.js → chunk-UP4XPH4J.js} +6 -6
  14. package/dist/{chunk-OKG2HT25.cjs → chunk-WMJVSBBE.cjs} +2 -4
  15. package/dist/{codec-BHHfBTnV.d.ts → codec-B2lYE0YA.d.ts} +1 -1
  16. package/dist/{codec-C-Yk2RNa.d.ts → codec-BFg5xnrJ.d.ts} +1 -1
  17. package/dist/{codec-BB0U8MF2.d.cts → codec-BWQ5Jlap.d.cts} +1 -1
  18. package/dist/{codec-z6_2PSzi.d.cts → codec-B_QST4y1.d.cts} +1 -1
  19. package/dist/{codec-COy4uuPO.d.cts → codec-BbbLDSKA.d.cts} +1 -1
  20. package/dist/{codec-BO5Go0Lm.d.cts → codec-C7UzTYSS.d.cts} +1 -1
  21. package/dist/{codec-BN6jk0Td.d.cts → codec-C8aSvE41.d.cts} +1 -1
  22. package/dist/{codec-w8z2j_uo.d.cts → codec-CAbm9d_n.d.cts} +1 -1
  23. package/dist/{codec-D2QVSH9D.d.ts → codec-CpZrZ3ok.d.ts} +1 -1
  24. package/dist/{codec-J7ekOSMc.d.ts → codec-DFU-6Rax.d.ts} +1 -1
  25. package/dist/{codec-iMEwV1UO.d.ts → codec-Db-0pk38.d.ts} +1 -1
  26. package/dist/{codec-BU0gaSZm.d.ts → codec-DftaRuVz.d.ts} +1 -1
  27. package/dist/{codec-DNfml-se.d.ts → codec-Va_wZCF_.d.ts} +1 -1
  28. package/dist/{codec-DoOGjjDq.d.cts → codec-lqDowbyT.d.cts} +1 -1
  29. package/dist/draft11-session.d.cts +1 -1
  30. package/dist/draft11-session.d.ts +1 -1
  31. package/dist/draft11.cjs +2 -2
  32. package/dist/draft11.d.cts +3 -3
  33. package/dist/draft11.d.ts +3 -3
  34. package/dist/draft11.js +1 -1
  35. package/dist/draft12-session.d.cts +1 -1
  36. package/dist/draft12-session.d.ts +1 -1
  37. package/dist/draft12.cjs +2 -2
  38. package/dist/draft12.d.cts +3 -3
  39. package/dist/draft12.d.ts +3 -3
  40. package/dist/draft12.js +1 -1
  41. package/dist/draft13-session.d.cts +1 -1
  42. package/dist/draft13-session.d.ts +1 -1
  43. package/dist/draft13.cjs +2 -2
  44. package/dist/draft13.d.cts +3 -3
  45. package/dist/draft13.d.ts +3 -3
  46. package/dist/draft13.js +1 -1
  47. package/dist/draft14-session.d.cts +1 -1
  48. package/dist/draft14-session.d.ts +1 -1
  49. package/dist/draft14.cjs +2 -2
  50. package/dist/draft14.d.cts +3 -3
  51. package/dist/draft14.d.ts +3 -3
  52. package/dist/draft14.js +1 -1
  53. package/dist/draft15-session.d.cts +1 -1
  54. package/dist/draft15-session.d.ts +1 -1
  55. package/dist/draft15.cjs +2 -2
  56. package/dist/draft15.d.cts +3 -3
  57. package/dist/draft15.d.ts +3 -3
  58. package/dist/draft15.js +1 -1
  59. package/dist/draft16-session.d.cts +1 -1
  60. package/dist/draft16-session.d.ts +1 -1
  61. package/dist/draft16.cjs +2 -2
  62. package/dist/draft16.d.cts +3 -3
  63. package/dist/draft16.d.ts +3 -3
  64. package/dist/draft16.js +1 -1
  65. package/dist/draft17-session.d.cts +1 -1
  66. package/dist/draft17-session.d.ts +1 -1
  67. package/dist/draft17.cjs +2 -2
  68. package/dist/draft17.d.cts +3 -3
  69. package/dist/draft17.d.ts +3 -3
  70. package/dist/draft17.js +1 -1
  71. package/dist/index.cjs +14 -14
  72. package/dist/index.d.cts +14 -14
  73. package/dist/index.d.ts +14 -14
  74. package/dist/index.js +7 -7
  75. package/dist/session.d.cts +7 -7
  76. package/dist/session.d.ts +7 -7
  77. package/dist/{types-C2qKTRR_.d.cts → types-Bio-91Rt.d.cts} +2 -1
  78. package/dist/{types-C2qKTRR_.d.ts → types-Bio-91Rt.d.ts} +2 -1
  79. package/dist/{types-DuxfOYiO.d.cts → types-CPaYBsMG.d.cts} +1 -1
  80. package/dist/{types-DuxfOYiO.d.ts → types-CPaYBsMG.d.ts} +1 -1
  81. package/dist/{types-DrQpTW1G.d.cts → types-CXlSn0I9.d.cts} +1 -1
  82. package/dist/{types-DrQpTW1G.d.ts → types-CXlSn0I9.d.ts} +1 -1
  83. package/dist/{types--Q7_DcvP.d.cts → types-Ck45Ex5S.d.cts} +1 -1
  84. package/dist/{types--Q7_DcvP.d.ts → types-Ck45Ex5S.d.ts} +1 -1
  85. package/dist/{types-BFpFNM_m.d.cts → types-Cm9fjeYC.d.cts} +1 -1
  86. package/dist/{types-BFpFNM_m.d.ts → types-Cm9fjeYC.d.ts} +1 -1
  87. package/dist/{types-Br7fm2mf.d.cts → types-D9eiB_9A.d.cts} +2 -2
  88. package/dist/{types-Br7fm2mf.d.ts → types-D9eiB_9A.d.ts} +2 -2
  89. package/dist/{types--FGt0sAp.d.cts → types-DjmrHp_s.d.cts} +1 -1
  90. package/dist/{types--FGt0sAp.d.ts → types-DjmrHp_s.d.ts} +1 -1
  91. package/package.json +2 -2
  92. package/src/drafts/draft11/codec.ts +2 -3
  93. package/src/drafts/draft11/types.ts +1 -1
  94. package/src/drafts/draft12/codec.ts +27 -4
  95. package/src/drafts/draft12/types.ts +2 -1
  96. package/src/drafts/draft13/codec.ts +2 -3
  97. package/src/drafts/draft13/types.ts +1 -1
  98. package/src/drafts/draft14/codec.ts +33 -2
  99. package/src/drafts/draft14/types.ts +1 -1
  100. package/src/drafts/draft15/codec.ts +2 -4
  101. package/src/drafts/draft15/types.ts +1 -1
  102. package/src/drafts/draft16/codec.ts +2 -3
  103. package/src/drafts/draft16/types.ts +1 -1
  104. package/src/drafts/draft17/codec.ts +6 -6
  105. package/src/drafts/draft17/types.ts +2 -2
@@ -888,8 +888,7 @@ function encodeAuthorizationToken(token, w) {
888
888
  }
889
889
  if (aliasType === 1 || aliasType === 3) {
890
890
  w.writeVarInt(token.token_type);
891
- const tokenBytes = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, token.token_value_hex);
892
- w.writeBytes(tokenBytes);
891
+ w.writeBytes(token.token_value);
893
892
  }
894
893
  }
895
894
  function decodeAuthorizationToken(r) {
@@ -902,7 +901,7 @@ function decodeAuthorizationToken(r) {
902
901
  if (aliasType === 1 || aliasType === 3) {
903
902
  result.token_type = r.readVarInt();
904
903
  const tokenBytes = r.readBytesView(r.remaining);
905
- result.token_value_hex = _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, tokenBytes);
904
+ result.token_value = new Uint8Array(tokenBytes);
906
905
  }
907
906
  return result;
908
907
  }
@@ -438,8 +438,7 @@ function encodeParams(params, w) {
438
438
  const tmpW = new BufferWriter(64);
439
439
  tmpW.writeVarInt(at.alias_type);
440
440
  tmpW.writeVarInt(at.token_type);
441
- const tokenBytes = textEncoder.encode(at.token_value);
442
- tmpW.writeBytes(tokenBytes);
441
+ tmpW.writeBytes(at.token_value);
443
442
  const raw = tmpW.finish();
444
443
  w.writeVarInt(raw.byteLength);
445
444
  w.writeBytes(raw);
@@ -501,7 +500,7 @@ function decodeParams(r) {
501
500
  result.authorization_token = {
502
501
  alias_type,
503
502
  token_type,
504
- token_value: textDecoder.decode(tokenBytes)
503
+ token_value: tokenBytes
505
504
  };
506
505
  } else {
507
506
  const bytes = r.readBytes(length);
@@ -385,8 +385,7 @@ function encodeAuthorizationToken(at, w) {
385
385
  }
386
386
  if (aliasType === 1 || aliasType === 3) {
387
387
  tmpW.writeVarInt(at.token_type ?? 0n);
388
- const tokenBytes = textEncoder.encode(at.token_value ?? "");
389
- tmpW.writeBytes(tokenBytes);
388
+ tmpW.writeBytes(at.token_value ?? new Uint8Array(0));
390
389
  }
391
390
  const raw = tmpW.finish();
392
391
  w.writeVarInt(raw.byteLength);
@@ -404,7 +403,7 @@ function decodeAuthorizationToken(r, length) {
404
403
  result.token_type = r.readVarInt();
405
404
  const tokenBytesLen = length - (r.offset - startOff);
406
405
  const tokenBytes = r.readBytes(tokenBytesLen);
407
- result.token_value = textDecoder.decode(tokenBytes);
406
+ result.token_value = tokenBytes;
408
407
  }
409
408
  return result;
410
409
  }
@@ -438,8 +438,7 @@ function encodeParams(params, w) {
438
438
  const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
439
439
  tmpW.writeVarInt(at.alias_type);
440
440
  tmpW.writeVarInt(at.token_type);
441
- const tokenBytes = textEncoder.encode(at.token_value);
442
- tmpW.writeBytes(tokenBytes);
441
+ tmpW.writeBytes(at.token_value);
443
442
  const raw = tmpW.finish();
444
443
  w.writeVarInt(raw.byteLength);
445
444
  w.writeBytes(raw);
@@ -501,7 +500,7 @@ function decodeParams(r) {
501
500
  result.authorization_token = {
502
501
  alias_type,
503
502
  token_type,
504
- token_value: textDecoder.decode(tokenBytes)
503
+ token_value: tokenBytes
505
504
  };
506
505
  } else {
507
506
  const bytes = r.readBytes(length);
@@ -888,8 +888,7 @@ function encodeAuthorizationToken(token, w) {
888
888
  }
889
889
  if (aliasType === 1 || aliasType === 3) {
890
890
  w.writeVarInt(token.token_type);
891
- const tokenBytes = hexToBytes(token.token_value_hex);
892
- w.writeBytes(tokenBytes);
891
+ w.writeBytes(token.token_value);
893
892
  }
894
893
  }
895
894
  function decodeAuthorizationToken(r) {
@@ -902,7 +901,7 @@ function decodeAuthorizationToken(r) {
902
901
  if (aliasType === 1 || aliasType === 3) {
903
902
  result.token_type = r.readVarInt();
904
903
  const tokenBytes = r.readBytesView(r.remaining);
905
- result.token_value_hex = bytesToHex(tokenBytes);
904
+ result.token_value = new Uint8Array(tokenBytes);
906
905
  }
907
906
  return result;
908
907
  }
@@ -374,6 +374,7 @@ function encodeSetupParams(params, w) {
374
374
  let count = 0;
375
375
  if (params.path !== void 0) count++;
376
376
  if (params.max_request_id !== void 0) count++;
377
+ if (params.authorization_token !== void 0) count++;
377
378
  if (params.unknown) count += params.unknown.length;
378
379
  w.writeVarInt(count);
379
380
  if (params.path !== void 0) {
@@ -386,6 +387,17 @@ function encodeSetupParams(params, w) {
386
387
  w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
387
388
  w.writeVarInt(params.max_request_id);
388
389
  }
390
+ if (params.authorization_token !== void 0) {
391
+ w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
392
+ const at = params.authorization_token;
393
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
394
+ tmpW.writeVarInt(at.alias_type);
395
+ tmpW.writeVarInt(at.token_type);
396
+ tmpW.writeBytes(at.token_value);
397
+ const raw = tmpW.finish();
398
+ w.writeVarInt(raw.byteLength);
399
+ w.writeBytes(raw);
400
+ }
389
401
  if (params.unknown) {
390
402
  for (const u of params.unknown) {
391
403
  const id = BigInt(u.id);
@@ -424,10 +436,22 @@ function decodeSetupParams(r) {
424
436
  }
425
437
  } else {
426
438
  const length = Number(r.readVarInt());
427
- const bytes = r.readBytes(length);
439
+ const startOff = r.offset;
428
440
  if (paramType === SETUP_PARAM_PATH) {
441
+ const bytes = r.readBytes(length);
429
442
  result.path = textDecoder.decode(bytes);
443
+ } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
444
+ const alias_type = r.readVarInt();
445
+ const token_type = r.readVarInt();
446
+ const tokenBytesLen = length - (r.offset - startOff);
447
+ const tokenBytes = r.readBytes(tokenBytesLen);
448
+ result.authorization_token = {
449
+ alias_type,
450
+ token_type,
451
+ token_value: tokenBytes
452
+ };
430
453
  } else {
454
+ const bytes = r.readBytes(length);
431
455
  unknown.push({
432
456
  id: `0x${paramType.toString(16)}`,
433
457
  length,
@@ -455,8 +479,7 @@ function encodeParams(params, w) {
455
479
  const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
456
480
  tmpW.writeVarInt(at.alias_type);
457
481
  tmpW.writeVarInt(at.token_type);
458
- const tokenBytes = textEncoder.encode(at.token_value);
459
- tmpW.writeBytes(tokenBytes);
482
+ tmpW.writeBytes(at.token_value);
460
483
  const raw = tmpW.finish();
461
484
  w.writeVarInt(raw.byteLength);
462
485
  w.writeBytes(raw);
@@ -514,7 +537,7 @@ function decodeParams(r) {
514
537
  result.authorization_token = {
515
538
  alias_type,
516
539
  token_type,
517
- token_value: textDecoder.decode(tokenBytes)
540
+ token_value: tokenBytes
518
541
  };
519
542
  } else {
520
543
  const bytes = r.readBytes(length);
@@ -801,6 +801,7 @@ function encodeSetupParams(params, writer) {
801
801
  if (params.role !== void 0) count++;
802
802
  if (params.path !== void 0) count++;
803
803
  if (params.max_request_id !== void 0) count++;
804
+ if (params.authorization_token !== void 0) count++;
804
805
  if (params.authority !== void 0) count++;
805
806
  if (params.max_auth_token_cache_size !== void 0) count++;
806
807
  if (params.moqt_implementation !== void 0) count++;
@@ -820,6 +821,24 @@ function encodeSetupParams(params, writer) {
820
821
  writer.writeVarInt(PARAM_MAX_REQUEST_ID);
821
822
  writer.writeVarInt(params.max_request_id);
822
823
  }
824
+ if (params.authorization_token !== void 0) {
825
+ writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
826
+ const tok = params.authorization_token;
827
+ const tmpWriter = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
828
+ tmpWriter.writeVarInt(tok.alias_type);
829
+ if (tok.token_type !== void 0) {
830
+ tmpWriter.writeVarInt(tok.token_type);
831
+ }
832
+ if (tok.token_value !== void 0) {
833
+ tmpWriter.writeBytes(tok.token_value);
834
+ }
835
+ if (tok.token_alias !== void 0) {
836
+ tmpWriter.writeVarInt(tok.token_alias);
837
+ }
838
+ const tokenBytes = tmpWriter.finish();
839
+ writer.writeVarInt(tokenBytes.byteLength);
840
+ writer.writeBytes(tokenBytes);
841
+ }
823
842
  if (params.max_auth_token_cache_size !== void 0) {
824
843
  writer.writeVarInt(PARAM_MAX_AUTH_TOKEN_CACHE_SIZE);
825
844
  writer.writeVarInt(params.max_auth_token_cache_size);
@@ -875,6 +894,18 @@ function decodeSetupParams(reader) {
875
894
  const bytes = reader.readBytes(length);
876
895
  if (paramType === PARAM_PATH) {
877
896
  result.path = textDecoder.decode(bytes);
897
+ } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
898
+ const tokenReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
899
+ const alias_type = tokenReader.readVarInt();
900
+ const tok = { alias_type };
901
+ if (tokenReader.remaining > 0) {
902
+ tok.token_type = tokenReader.readVarInt();
903
+ if (tokenReader.remaining > 0) {
904
+ const tokenValue = tokenReader.readBytesView(tokenReader.remaining);
905
+ tok.token_value = new Uint8Array(tokenValue);
906
+ }
907
+ }
908
+ result.authorization_token = tok;
878
909
  } else if (paramType === PARAM_AUTHORITY) {
879
910
  result.authority = textDecoder.decode(bytes);
880
911
  } else if (paramType === PARAM_MOQT_IMPLEMENTATION) {
@@ -911,7 +942,7 @@ function encodeMessageParams(params, writer) {
911
942
  tmpWriter.writeVarInt(tok.token_type);
912
943
  }
913
944
  if (tok.token_value !== void 0) {
914
- tmpWriter.writeBytes(_chunkJL3NEW3Ocjs.hexToBytes.call(void 0, tok.token_value));
945
+ tmpWriter.writeBytes(tok.token_value);
915
946
  }
916
947
  if (tok.token_alias !== void 0) {
917
948
  tmpWriter.writeVarInt(tok.token_alias);
@@ -967,7 +998,7 @@ function decodeMessageParams(reader) {
967
998
  tok.token_type = tokenReader.readVarInt();
968
999
  if (tokenReader.remaining > 0) {
969
1000
  const tokenValue = tokenReader.readBytesView(tokenReader.remaining);
970
- tok.token_value = _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, tokenValue);
1001
+ tok.token_value = new Uint8Array(tokenValue);
971
1002
  }
972
1003
  }
973
1004
  result.authorization_token = tok;
@@ -374,6 +374,7 @@ function encodeSetupParams(params, w) {
374
374
  let count = 0;
375
375
  if (params.path !== void 0) count++;
376
376
  if (params.max_request_id !== void 0) count++;
377
+ if (params.authorization_token !== void 0) count++;
377
378
  if (params.unknown) count += params.unknown.length;
378
379
  w.writeVarInt(count);
379
380
  if (params.path !== void 0) {
@@ -386,6 +387,17 @@ function encodeSetupParams(params, w) {
386
387
  w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
387
388
  w.writeVarInt(params.max_request_id);
388
389
  }
390
+ if (params.authorization_token !== void 0) {
391
+ w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
392
+ const at = params.authorization_token;
393
+ const tmpW = new BufferWriter(64);
394
+ tmpW.writeVarInt(at.alias_type);
395
+ tmpW.writeVarInt(at.token_type);
396
+ tmpW.writeBytes(at.token_value);
397
+ const raw = tmpW.finish();
398
+ w.writeVarInt(raw.byteLength);
399
+ w.writeBytes(raw);
400
+ }
389
401
  if (params.unknown) {
390
402
  for (const u of params.unknown) {
391
403
  const id = BigInt(u.id);
@@ -424,10 +436,22 @@ function decodeSetupParams(r) {
424
436
  }
425
437
  } else {
426
438
  const length = Number(r.readVarInt());
427
- const bytes = r.readBytes(length);
439
+ const startOff = r.offset;
428
440
  if (paramType === SETUP_PARAM_PATH) {
441
+ const bytes = r.readBytes(length);
429
442
  result.path = textDecoder.decode(bytes);
443
+ } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
444
+ const alias_type = r.readVarInt();
445
+ const token_type = r.readVarInt();
446
+ const tokenBytesLen = length - (r.offset - startOff);
447
+ const tokenBytes = r.readBytes(tokenBytesLen);
448
+ result.authorization_token = {
449
+ alias_type,
450
+ token_type,
451
+ token_value: tokenBytes
452
+ };
430
453
  } else {
454
+ const bytes = r.readBytes(length);
431
455
  unknown.push({
432
456
  id: `0x${paramType.toString(16)}`,
433
457
  length,
@@ -455,8 +479,7 @@ function encodeParams(params, w) {
455
479
  const tmpW = new BufferWriter(64);
456
480
  tmpW.writeVarInt(at.alias_type);
457
481
  tmpW.writeVarInt(at.token_type);
458
- const tokenBytes = textEncoder.encode(at.token_value);
459
- tmpW.writeBytes(tokenBytes);
482
+ tmpW.writeBytes(at.token_value);
460
483
  const raw = tmpW.finish();
461
484
  w.writeVarInt(raw.byteLength);
462
485
  w.writeBytes(raw);
@@ -514,7 +537,7 @@ function decodeParams(r) {
514
537
  result.authorization_token = {
515
538
  alias_type,
516
539
  token_type,
517
- token_value: textDecoder.decode(tokenBytes)
540
+ token_value: tokenBytes
518
541
  };
519
542
  } else {
520
543
  const bytes = r.readBytes(length);
@@ -1028,9 +1028,9 @@ function encodeAuthorizationToken(token, w) {
1028
1028
  }
1029
1029
  if (aliasType === 1 || aliasType === 3) {
1030
1030
  w.writeVarInt(_nullishCoalesce(token.token_type, () => ( 0n)));
1031
- const encoded = textEncoder.encode(_nullishCoalesce(token.token_value, () => ( "")));
1032
- w.writeVarInt(BigInt(encoded.byteLength));
1033
- w.writeBytes(encoded);
1031
+ const tv = _nullishCoalesce(token.token_value, () => ( new Uint8Array(0)));
1032
+ w.writeVarInt(BigInt(tv.byteLength));
1033
+ w.writeBytes(tv);
1034
1034
  }
1035
1035
  }
1036
1036
  function decodeAuthorizationToken(r) {
@@ -1046,7 +1046,7 @@ function decodeAuthorizationToken(r) {
1046
1046
  result.token_type = r.readVarInt();
1047
1047
  const len = Number(r.readVarInt());
1048
1048
  const bytes = r.readBytes(len);
1049
- result.token_value = textDecoder.decode(bytes);
1049
+ result.token_value = bytes;
1050
1050
  }
1051
1051
  return result;
1052
1052
  }
@@ -1261,7 +1261,7 @@ function encodeTrackProperties(props, writer) {
1261
1261
  entries.push({
1262
1262
  type: TPROP_IMMUTABLE_PROPERTIES,
1263
1263
  encode: (w) => {
1264
- const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, props.immutable_properties);
1264
+ const raw = props.immutable_properties;
1265
1265
  w.writeVarInt(BigInt(raw.byteLength));
1266
1266
  w.writeBytes(raw);
1267
1267
  }
@@ -1346,7 +1346,7 @@ function decodeTrackProperties(reader, payloadEnd) {
1346
1346
  const length = Number(reader.readVarInt());
1347
1347
  const bytes = reader.readBytes(length);
1348
1348
  if (propType === TPROP_IMMUTABLE_PROPERTIES) {
1349
- result.immutable_properties = _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes);
1349
+ result.immutable_properties = bytes;
1350
1350
  } else {
1351
1351
  unknown.push({
1352
1352
  id: `0x${propType.toString(16)}`,
@@ -801,6 +801,7 @@ function encodeSetupParams(params, writer) {
801
801
  if (params.role !== void 0) count++;
802
802
  if (params.path !== void 0) count++;
803
803
  if (params.max_request_id !== void 0) count++;
804
+ if (params.authorization_token !== void 0) count++;
804
805
  if (params.authority !== void 0) count++;
805
806
  if (params.max_auth_token_cache_size !== void 0) count++;
806
807
  if (params.moqt_implementation !== void 0) count++;
@@ -820,6 +821,24 @@ function encodeSetupParams(params, writer) {
820
821
  writer.writeVarInt(PARAM_MAX_REQUEST_ID);
821
822
  writer.writeVarInt(params.max_request_id);
822
823
  }
824
+ if (params.authorization_token !== void 0) {
825
+ writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
826
+ const tok = params.authorization_token;
827
+ const tmpWriter = new BufferWriter(64);
828
+ tmpWriter.writeVarInt(tok.alias_type);
829
+ if (tok.token_type !== void 0) {
830
+ tmpWriter.writeVarInt(tok.token_type);
831
+ }
832
+ if (tok.token_value !== void 0) {
833
+ tmpWriter.writeBytes(tok.token_value);
834
+ }
835
+ if (tok.token_alias !== void 0) {
836
+ tmpWriter.writeVarInt(tok.token_alias);
837
+ }
838
+ const tokenBytes = tmpWriter.finish();
839
+ writer.writeVarInt(tokenBytes.byteLength);
840
+ writer.writeBytes(tokenBytes);
841
+ }
823
842
  if (params.max_auth_token_cache_size !== void 0) {
824
843
  writer.writeVarInt(PARAM_MAX_AUTH_TOKEN_CACHE_SIZE);
825
844
  writer.writeVarInt(params.max_auth_token_cache_size);
@@ -875,6 +894,18 @@ function decodeSetupParams(reader) {
875
894
  const bytes = reader.readBytes(length);
876
895
  if (paramType === PARAM_PATH) {
877
896
  result.path = textDecoder.decode(bytes);
897
+ } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
898
+ const tokenReader = new BufferReader(bytes);
899
+ const alias_type = tokenReader.readVarInt();
900
+ const tok = { alias_type };
901
+ if (tokenReader.remaining > 0) {
902
+ tok.token_type = tokenReader.readVarInt();
903
+ if (tokenReader.remaining > 0) {
904
+ const tokenValue = tokenReader.readBytesView(tokenReader.remaining);
905
+ tok.token_value = new Uint8Array(tokenValue);
906
+ }
907
+ }
908
+ result.authorization_token = tok;
878
909
  } else if (paramType === PARAM_AUTHORITY) {
879
910
  result.authority = textDecoder.decode(bytes);
880
911
  } else if (paramType === PARAM_MOQT_IMPLEMENTATION) {
@@ -911,7 +942,7 @@ function encodeMessageParams(params, writer) {
911
942
  tmpWriter.writeVarInt(tok.token_type);
912
943
  }
913
944
  if (tok.token_value !== void 0) {
914
- tmpWriter.writeBytes(hexToBytes(tok.token_value));
945
+ tmpWriter.writeBytes(tok.token_value);
915
946
  }
916
947
  if (tok.token_alias !== void 0) {
917
948
  tmpWriter.writeVarInt(tok.token_alias);
@@ -967,7 +998,7 @@ function decodeMessageParams(reader) {
967
998
  tok.token_type = tokenReader.readVarInt();
968
999
  if (tokenReader.remaining > 0) {
969
1000
  const tokenValue = tokenReader.readBytesView(tokenReader.remaining);
970
- tok.token_value = bytesToHex(tokenValue);
1001
+ tok.token_value = new Uint8Array(tokenValue);
971
1002
  }
972
1003
  }
973
1004
  result.authorization_token = tok;
@@ -852,8 +852,7 @@ function encodeAuthorizationToken(token, w) {
852
852
  }
853
853
  if (aliasType === 1 || aliasType === 3) {
854
854
  w.writeVarInt(token.token_type);
855
- const tokenBytes = hexToBytes(token.token_value_hex);
856
- w.writeBytes(tokenBytes);
855
+ w.writeBytes(token.token_value);
857
856
  }
858
857
  }
859
858
  function decodeAuthorizationToken(r) {
@@ -865,8 +864,7 @@ function decodeAuthorizationToken(r) {
865
864
  }
866
865
  if (aliasType === 1 || aliasType === 3) {
867
866
  result.token_type = r.readVarInt();
868
- const tokenBytes = r.readBytesView(r.remaining);
869
- result.token_value_hex = bytesToHex(tokenBytes);
867
+ result.token_value = r.readBytes(r.remaining);
870
868
  }
871
869
  return result;
872
870
  }
@@ -385,8 +385,7 @@ function encodeAuthorizationToken(at, w) {
385
385
  }
386
386
  if (aliasType === 1 || aliasType === 3) {
387
387
  tmpW.writeVarInt(_nullishCoalesce(at.token_type, () => ( 0n)));
388
- const tokenBytes = textEncoder.encode(_nullishCoalesce(at.token_value, () => ( "")));
389
- tmpW.writeBytes(tokenBytes);
388
+ tmpW.writeBytes(_nullishCoalesce(at.token_value, () => ( new Uint8Array(0))));
390
389
  }
391
390
  const raw = tmpW.finish();
392
391
  w.writeVarInt(raw.byteLength);
@@ -404,7 +403,7 @@ function decodeAuthorizationToken(r, length) {
404
403
  result.token_type = r.readVarInt();
405
404
  const tokenBytesLen = length - (r.offset - startOff);
406
405
  const tokenBytes = r.readBytes(tokenBytesLen);
407
- result.token_value = textDecoder.decode(tokenBytes);
406
+ result.token_value = tokenBytes;
408
407
  }
409
408
  return result;
410
409
  }
@@ -1028,9 +1028,9 @@ function encodeAuthorizationToken(token, w) {
1028
1028
  }
1029
1029
  if (aliasType === 1 || aliasType === 3) {
1030
1030
  w.writeVarInt(token.token_type ?? 0n);
1031
- const encoded = textEncoder.encode(token.token_value ?? "");
1032
- w.writeVarInt(BigInt(encoded.byteLength));
1033
- w.writeBytes(encoded);
1031
+ const tv = token.token_value ?? new Uint8Array(0);
1032
+ w.writeVarInt(BigInt(tv.byteLength));
1033
+ w.writeBytes(tv);
1034
1034
  }
1035
1035
  }
1036
1036
  function decodeAuthorizationToken(r) {
@@ -1046,7 +1046,7 @@ function decodeAuthorizationToken(r) {
1046
1046
  result.token_type = r.readVarInt();
1047
1047
  const len = Number(r.readVarInt());
1048
1048
  const bytes = r.readBytes(len);
1049
- result.token_value = textDecoder.decode(bytes);
1049
+ result.token_value = bytes;
1050
1050
  }
1051
1051
  return result;
1052
1052
  }
@@ -1261,7 +1261,7 @@ function encodeTrackProperties(props, writer) {
1261
1261
  entries.push({
1262
1262
  type: TPROP_IMMUTABLE_PROPERTIES,
1263
1263
  encode: (w) => {
1264
- const raw = hexToBytes(props.immutable_properties);
1264
+ const raw = props.immutable_properties;
1265
1265
  w.writeVarInt(BigInt(raw.byteLength));
1266
1266
  w.writeBytes(raw);
1267
1267
  }
@@ -1346,7 +1346,7 @@ function decodeTrackProperties(reader, payloadEnd) {
1346
1346
  const length = Number(reader.readVarInt());
1347
1347
  const bytes = reader.readBytes(length);
1348
1348
  if (propType === TPROP_IMMUTABLE_PROPERTIES) {
1349
- result.immutable_properties = bytesToHex(bytes);
1349
+ result.immutable_properties = bytes;
1350
1350
  } else {
1351
1351
  unknown.push({
1352
1352
  id: `0x${propType.toString(16)}`,
@@ -852,8 +852,7 @@ function encodeAuthorizationToken(token, w) {
852
852
  }
853
853
  if (aliasType === 1 || aliasType === 3) {
854
854
  w.writeVarInt(token.token_type);
855
- const tokenBytes = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, token.token_value_hex);
856
- w.writeBytes(tokenBytes);
855
+ w.writeBytes(token.token_value);
857
856
  }
858
857
  }
859
858
  function decodeAuthorizationToken(r) {
@@ -865,8 +864,7 @@ function decodeAuthorizationToken(r) {
865
864
  }
866
865
  if (aliasType === 1 || aliasType === 3) {
867
866
  result.token_type = r.readVarInt();
868
- const tokenBytes = r.readBytesView(r.remaining);
869
- result.token_value_hex = _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, tokenBytes);
867
+ result.token_value = r.readBytes(r.remaining);
870
868
  }
871
869
  return result;
872
870
  }
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft15Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft15DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-DuxfOYiO.js';
2
+ import { D as Draft15Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft15DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-CPaYBsMG.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-15 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft16Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft16DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-BFpFNM_m.js';
2
+ import { D as Draft16Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft16DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-Cm9fjeYC.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-16 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft15Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft15DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-DuxfOYiO.cjs';
2
+ import { D as Draft15Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft15DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-CPaYBsMG.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-15 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft16Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft16DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-BFpFNM_m.cjs';
2
+ import { D as Draft16Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft16DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-Cm9fjeYC.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-16 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft12Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft12DataStream } from './types-C2qKTRR_.cjs';
2
+ import { D as Draft12Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft12DataStream } from './types-Bio-91Rt.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-12 control message.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft14Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft14DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types--FGt0sAp.cjs';
2
+ import { D as Draft14Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft14DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-DjmrHp_s.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-14 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft17Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft17DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-Br7fm2mf.cjs';
2
+ import { D as Draft17Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft17DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-D9eiB_9A.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-17 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft11Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft11DataStream } from './types--Q7_DcvP.cjs';
2
+ import { D as Draft11Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft11DataStream } from './types-Ck45Ex5S.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-11 control message with type(varint) + length(varint) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft17Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft17DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-Br7fm2mf.js';
2
+ import { D as Draft17Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft17DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-D9eiB_9A.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-17 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft12Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft12DataStream } from './types-C2qKTRR_.js';
2
+ import { D as Draft12Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft12DataStream } from './types-Bio-91Rt.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-12 control message.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft14Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft14DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types--FGt0sAp.js';
2
+ import { D as Draft14Message, f as SubgroupStream, d as DatagramObject, e as FetchStream, c as Draft14DataStream, S as SubgroupStreamHeader, O as ObjectPayload, F as FetchStreamHeader, b as DataStreamEvent } from './types-DjmrHp_s.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-14 control message with type(varint) + length(uint16 BE) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft13Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft13DataStream } from './types-DrQpTW1G.js';
2
+ import { D as Draft13Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft13DataStream } from './types-CXlSn0I9.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-13 control message.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.js';
2
- import { D as Draft11Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft11DataStream } from './types--Q7_DcvP.js';
2
+ import { D as Draft11Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft11DataStream } from './types-Ck45Ex5S.js';
3
3
 
4
4
  /**
5
5
  * Encode a draft-11 control message with type(varint) + length(varint) + payload.
@@ -1,5 +1,5 @@
1
1
  import { B as BaseCodec, b as DecodeResult } from './types-DuIO7cWK.cjs';
2
- import { D as Draft13Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft13DataStream } from './types-DrQpTW1G.cjs';
2
+ import { D as Draft13Message, S as SubgroupStream, c as DatagramObject, F as FetchStream, b as Draft13DataStream } from './types-CXlSn0I9.cjs';
3
3
 
4
4
  /**
5
5
  * Encode a draft-13 control message.
@@ -1,6 +1,6 @@
1
1
  import { k as SessionStateOptionsRole, a as SessionState } from './session-types-C7UONex5.cjs';
2
2
  export { A as AnnouncePhase, b as AnnounceState, F as FetchPhase, c as FetchState, P as ProtocolViolation, d as ProtocolViolationCode, g as SessionPhase, h as SideEffect, i as SubscriptionPhase, j as SubscriptionState, T as TransitionResult, V as ValidationResult } from './session-types-C7UONex5.cjs';
3
- import { D as Draft11Message, a as Draft11MessageType } from './types--Q7_DcvP.cjs';
3
+ import { D as Draft11Message, a as Draft11MessageType } from './types-Ck45Ex5S.cjs';
4
4
  import './types-DuIO7cWK.cjs';
5
5
 
6
6
  declare function createDraft11SessionState(role: SessionStateOptionsRole): SessionState<Draft11Message, Draft11MessageType>;
@@ -1,6 +1,6 @@
1
1
  import { k as SessionStateOptionsRole, a as SessionState } from './session-types-X-IYEGoG.js';
2
2
  export { A as AnnouncePhase, b as AnnounceState, F as FetchPhase, c as FetchState, P as ProtocolViolation, d as ProtocolViolationCode, g as SessionPhase, h as SideEffect, i as SubscriptionPhase, j as SubscriptionState, T as TransitionResult, V as ValidationResult } from './session-types-X-IYEGoG.js';
3
- import { D as Draft11Message, a as Draft11MessageType } from './types--Q7_DcvP.js';
3
+ import { D as Draft11Message, a as Draft11MessageType } from './types-Ck45Ex5S.js';
4
4
  import './types-DuIO7cWK.js';
5
5
 
6
6
  declare function createDraft11SessionState(role: SessionStateOptionsRole): SessionState<Draft11Message, Draft11MessageType>;