@moqtap/codec 0.9.0 → 0.11.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 +173 -0
- package/dist/auth-redaction-DsdLq4Qs.d.cts +102 -0
- package/dist/auth-redaction-DsdLq4Qs.d.ts +102 -0
- package/dist/{chunk-PU2KV7VP.cjs → chunk-27K5BUAG.cjs} +485 -515
- package/dist/{chunk-BV6MITLO.js → chunk-3RNQMGKA.js} +365 -390
- package/dist/{chunk-2XH6PHXR.js → chunk-5AWIXOLB.js} +442 -467
- package/dist/{chunk-4XLYCT5Q.cjs → chunk-5IMHJIAZ.cjs} +52 -2
- package/dist/{chunk-TVSFDQYE.cjs → chunk-5JGZCKJO.cjs} +513 -531
- package/dist/{chunk-IADVBKEJ.cjs → chunk-73K4OSAN.cjs} +407 -432
- package/dist/{chunk-N2V7Z37J.js → chunk-7VQKRGRD.js} +19 -3
- package/dist/{chunk-UZO5Z2XT.cjs → chunk-A3UCQOIB.cjs} +490 -515
- package/dist/{chunk-JKMYAUGY.js → chunk-A7PDMVXM.js} +35 -11
- package/dist/{chunk-VZHL2U2N.cjs → chunk-A7VQO6YC.cjs} +54 -38
- package/dist/{chunk-KCH4BQXK.cjs → chunk-ACQHZLRZ.cjs} +73 -47
- package/dist/{chunk-H6DTAIWM.js → chunk-BBICOMW6.js} +47 -19
- package/dist/{chunk-MAXEHYVB.cjs → chunk-BNIUVOCJ.cjs} +554 -612
- package/dist/{chunk-QGIHC6BA.cjs → chunk-CNC6ANS4.cjs} +70 -46
- package/dist/{chunk-NH4L6NIY.js → chunk-FDLQSWHK.js} +437 -467
- package/dist/{chunk-IJAF6PAY.js → chunk-FFNOE4UR.js} +19 -3
- package/dist/{chunk-CZNW3R5E.cjs → chunk-GMENT63T.cjs} +54 -38
- package/dist/{chunk-7ENEWAMZ.cjs → chunk-HM7BLRVP.cjs} +305 -305
- package/dist/{chunk-XHAP2YST.js → chunk-HZONHFNO.js} +19 -3
- package/dist/{chunk-EVCPBFSR.cjs → chunk-ILYABWDK.cjs} +83 -55
- package/dist/{chunk-IDV2JYJ6.cjs → chunk-KRSFTZVO.cjs} +56 -40
- package/dist/{chunk-RIIA4ALQ.cjs → chunk-KSPH6KMH.cjs} +54 -38
- package/dist/{chunk-UA5XFP4O.cjs → chunk-KTY4LAUV.cjs} +485 -494
- package/dist/{chunk-RZTLQAKF.js → chunk-OJNLJT5D.js} +0 -1
- package/dist/{chunk-YJGOD3Y4.js → chunk-PJK2ZS3I.js} +492 -550
- package/dist/{chunk-TMXRYOBS.js → chunk-PSMZKHOC.js} +444 -453
- package/dist/{chunk-7RE6KSIY.cjs → chunk-Q5JQGHWY.cjs} +0 -1
- package/dist/{chunk-23KRITJ6.js → chunk-SQTUQY5E.js} +37 -11
- package/dist/{chunk-XQGEOFGE.js → chunk-WCRLAKDW.js} +253 -253
- package/dist/{chunk-KYVTM5VI.js → chunk-WL2YUEXH.js} +19 -3
- package/dist/{chunk-Q7NSUXXB.js → chunk-YCNIVZS7.js} +464 -482
- package/dist/{chunk-KLPWJU6W.js → chunk-YRZQVNZO.js} +50 -0
- package/dist/{codec-Bym-K2q2.d.cts → codec-76xzrLTL.d.cts} +21 -2
- package/dist/{codec-BKsVu3Fr.d.ts → codec-8p40WdLg.d.ts} +21 -2
- package/dist/{codec-Dl_QIXMz.d.ts → codec-BN2Bu0KI.d.ts} +20 -1
- package/dist/{codec-D4RvFQmu.d.ts → codec-Bb6GKTrv.d.ts} +21 -2
- package/dist/{codec-DAyiF5sq.d.cts → codec-BgpfHoAd.d.cts} +21 -2
- package/dist/{codec-CA6nbbEk.d.ts → codec-BkheTXO7.d.ts} +21 -2
- package/dist/{codec-DchsPfr3.d.cts → codec-BwVDkokh.d.cts} +21 -2
- package/dist/{codec-CgZdadPt.d.cts → codec-C5s1eBJX.d.cts} +21 -2
- package/dist/codec-CM5yd6n3.d.ts +38 -0
- package/dist/{codec-DJmqoIsp.d.cts → codec-Cb8HC3XV.d.cts} +21 -2
- package/dist/codec-Clu_skx8.d.cts +38 -0
- package/dist/{codec-DzkdW4kO.d.cts → codec-CpOpemR8.d.cts} +20 -1
- package/dist/{codec-CXCjya_G.d.cts → codec-Cshdl9Tt.d.cts} +20 -1
- package/dist/{codec-CSBFdPgP.d.cts → codec-DELe00w_.d.cts} +21 -2
- package/dist/{codec-C_xxsbKy.d.cts → codec-DHzKAUCa.d.cts} +21 -2
- package/dist/{codec--CVeqGQv.d.ts → codec-DdVBtvx7.d.ts} +20 -1
- package/dist/{codec-CviAa4lp.d.ts → codec-DlxGuYMv.d.ts} +21 -2
- package/dist/{codec-BNy5syCU.d.ts → codec-DxtgPxJS.d.ts} +20 -1
- package/dist/{codec-CtvFK4aV.d.cts → codec-GAY4lybi.d.cts} +21 -2
- package/dist/{codec-Cfo_z5ET.d.cts → codec-I8u2pfS4.d.cts} +20 -1
- package/dist/{codec-vddqy0KY.d.cts → codec-XLrnreeu.d.cts} +21 -2
- package/dist/{codec-O-1Js7h4.d.ts → codec-c0YEwwWn.d.ts} +21 -2
- package/dist/{codec-Cl73EfRW.d.ts → codec-ejDu-va6.d.ts} +21 -2
- package/dist/{codec-C006F75E.d.ts → codec-kaBUzdpV.d.ts} +21 -2
- package/dist/{codec-C5evFHL-.d.ts → codec-mVYqkIUF.d.ts} +21 -2
- package/dist/{codec-BMwgZIgG.d.ts → codec-qSbO5nOa.d.ts} +21 -2
- package/dist/{codec-BQa6Qsav.d.ts → codec-yYKGOipj.d.ts} +21 -2
- package/dist/{codec-DzLvG8Wb.d.cts → codec-zfzg9uiy.d.cts} +21 -2
- package/dist/draft07.cjs +48 -4
- package/dist/draft07.d.cts +42 -2
- package/dist/draft07.d.ts +42 -2
- package/dist/draft07.js +49 -5
- package/dist/draft08.cjs +76 -3
- package/dist/draft08.d.cts +70 -2
- package/dist/draft08.d.ts +70 -2
- package/dist/draft08.js +77 -4
- package/dist/draft09.cjs +76 -3
- package/dist/draft09.d.cts +70 -2
- package/dist/draft09.d.ts +70 -2
- package/dist/draft09.js +77 -4
- package/dist/draft10.cjs +76 -3
- package/dist/draft10.d.cts +70 -2
- package/dist/draft10.d.ts +70 -2
- package/dist/draft10.js +77 -4
- package/dist/draft11-session.d.cts +1 -1
- package/dist/draft11-session.d.ts +1 -1
- package/dist/draft11.cjs +104 -3
- package/dist/draft11.d.cts +100 -4
- package/dist/draft11.d.ts +100 -4
- package/dist/draft11.js +105 -4
- package/dist/draft12-session.d.cts +1 -1
- package/dist/draft12-session.d.ts +1 -1
- package/dist/draft12.cjs +113 -3
- package/dist/draft12.d.cts +109 -4
- package/dist/draft12.d.ts +109 -4
- package/dist/draft12.js +114 -4
- package/dist/draft13-session.d.cts +1 -1
- package/dist/draft13-session.d.ts +1 -1
- package/dist/draft13.cjs +105 -3
- package/dist/draft13.d.cts +101 -4
- package/dist/draft13.d.ts +101 -4
- package/dist/draft13.js +106 -4
- package/dist/draft14-session.d.cts +1 -1
- package/dist/draft14-session.d.ts +1 -1
- package/dist/draft14.cjs +107 -3
- package/dist/draft14.d.cts +103 -30
- package/dist/draft14.d.ts +103 -30
- package/dist/draft14.js +108 -4
- package/dist/draft15-session.d.cts +1 -1
- package/dist/draft15-session.d.ts +1 -1
- package/dist/draft15.cjs +69 -3
- package/dist/draft15.d.cts +65 -22
- package/dist/draft15.d.ts +65 -22
- package/dist/draft15.js +70 -4
- package/dist/draft16-session.cjs +2 -2
- package/dist/draft16-session.d.cts +1 -1
- package/dist/draft16-session.d.ts +1 -1
- package/dist/draft16-session.js +1 -1
- package/dist/draft16.cjs +76 -8
- package/dist/draft16.d.cts +67 -13
- package/dist/draft16.d.ts +67 -13
- package/dist/draft16.js +73 -5
- package/dist/draft17-session.d.cts +1 -1
- package/dist/draft17-session.d.ts +1 -1
- package/dist/draft17.cjs +77 -3
- package/dist/draft17.d.cts +73 -4
- package/dist/draft17.d.ts +73 -4
- package/dist/draft17.js +78 -4
- package/dist/draft18-session.d.cts +1 -1
- package/dist/draft18-session.d.ts +1 -1
- package/dist/draft18.cjs +8 -3
- package/dist/draft18.d.cts +4 -3
- package/dist/draft18.d.ts +4 -3
- package/dist/draft18.js +9 -4
- package/dist/draft19-session.d.cts +1 -1
- package/dist/draft19-session.d.ts +1 -1
- package/dist/draft19.cjs +11 -4
- package/dist/draft19.d.cts +4 -3
- package/dist/draft19.d.ts +4 -3
- package/dist/draft19.js +12 -5
- package/dist/draft20-session.d.cts +1 -1
- package/dist/draft20-session.d.ts +1 -1
- package/dist/draft20.cjs +8 -3
- package/dist/draft20.d.cts +4 -3
- package/dist/draft20.d.ts +4 -3
- package/dist/draft20.js +9 -4
- package/dist/index.cjs +30 -30
- package/dist/index.d.cts +25 -24
- package/dist/index.d.ts +25 -24
- package/dist/index.js +15 -15
- package/dist/session.cjs +2 -2
- package/dist/session.d.cts +10 -10
- package/dist/session.d.ts +10 -10
- package/dist/session.js +1 -1
- package/dist/{types-zHgCS6o5.d.cts → types-Btp416jt.d.cts} +15 -7
- package/dist/{types-zHgCS6o5.d.ts → types-Btp416jt.d.ts} +15 -7
- package/dist/{types-Cm9fjeYC.d.cts → types-BxTL1NXw.d.cts} +9 -2
- package/dist/{types-Cm9fjeYC.d.ts → types-BxTL1NXw.d.ts} +9 -2
- 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-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-CPaYBsMG.d.cts → types-CuibHYcf.d.cts} +9 -2
- package/dist/{types-CPaYBsMG.d.ts → types-CuibHYcf.d.ts} +9 -2
- package/dist/{types-CWCQwuvy.d.cts → types-CwN7AEoL.d.cts} +24 -12
- package/dist/{types-CWCQwuvy.d.ts → types-CwN7AEoL.d.ts} +24 -12
- 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-DAnalt5K.d.cts} +9 -2
- package/dist/{types-D9eiB_9A.d.ts → types-DAnalt5K.d.ts} +9 -2
- 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-Cqp10JtB.d.cts → types-DxXNP32l.d.cts} +10 -2
- package/dist/{types-Cqp10JtB.d.ts → types-DxXNP32l.d.ts} +10 -2
- package/package.json +3 -3
- package/src/core/auth-redaction.ts +192 -0
- package/src/drafts/draft07/codec.ts +40 -0
- package/src/drafts/draft07/error-codes.ts +44 -0
- package/src/drafts/draft07/index.ts +15 -0
- package/src/drafts/draft08/codec.ts +40 -0
- package/src/drafts/draft08/error-codes.ts +76 -0
- package/src/drafts/draft08/index.ts +21 -0
- package/src/drafts/draft09/codec.ts +40 -0
- package/src/drafts/draft09/error-codes.ts +76 -0
- package/src/drafts/draft09/index.ts +21 -0
- package/src/drafts/draft10/codec.ts +40 -0
- package/src/drafts/draft10/error-codes.ts +76 -0
- package/src/drafts/draft10/index.ts +21 -0
- package/src/drafts/draft11/codec.ts +71 -8
- package/src/drafts/draft11/error-codes.ts +106 -0
- package/src/drafts/draft11/index.ts +23 -0
- package/src/drafts/draft11/types.ts +1 -1
- package/src/drafts/draft12/codec.ts +83 -16
- package/src/drafts/draft12/error-codes.ts +116 -0
- package/src/drafts/draft12/index.ts +25 -0
- package/src/drafts/draft12/types.ts +2 -2
- package/src/drafts/draft13/codec.ts +75 -11
- package/src/drafts/draft13/error-codes.ts +107 -0
- package/src/drafts/draft13/index.ts +23 -0
- package/src/drafts/draft13/types.ts +3 -3
- package/src/drafts/draft14/codec.ts +79 -12
- package/src/drafts/draft14/data-streams.ts +331 -259
- package/src/drafts/draft14/error-codes.ts +109 -0
- package/src/drafts/draft14/index.ts +23 -0
- package/src/drafts/draft14/types.ts +1 -1
- package/src/drafts/draft15/codec.ts +71 -8
- package/src/drafts/draft15/data-streams.ts +489 -444
- package/src/drafts/draft15/error-codes.ts +66 -0
- package/src/drafts/draft15/index.ts +15 -0
- package/src/drafts/draft15/types.ts +9 -2
- package/src/drafts/draft16/codec.ts +149 -49
- package/src/drafts/draft16/data-streams.ts +513 -442
- package/src/drafts/draft16/error-codes.ts +68 -0
- package/src/drafts/draft16/index.ts +15 -0
- package/src/drafts/draft16/messages.ts +4 -4
- package/src/drafts/draft16/session-fsm.ts +0 -1
- package/src/drafts/draft16/types.ts +24 -10
- package/src/drafts/draft17/codec.ts +77 -10
- package/src/drafts/draft17/data-streams.ts +567 -488
- package/src/drafts/draft17/index.ts +15 -0
- package/src/drafts/draft17/types.ts +9 -2
- package/src/drafts/draft18/codec.ts +70 -7
- package/src/drafts/draft18/data-streams.ts +570 -482
- package/src/drafts/draft18/index.ts +3 -0
- package/src/drafts/draft18/types.ts +18 -10
- package/src/drafts/draft19/codec.ts +95 -23
- package/src/drafts/draft19/data-streams.ts +570 -482
- package/src/drafts/draft19/error-codes.ts +3 -1
- package/src/drafts/draft19/index.ts +3 -0
- package/src/drafts/draft19/messages.ts +3 -1
- package/src/drafts/draft19/types.ts +32 -18
- package/src/drafts/draft20/codec.ts +115 -36
- package/src/drafts/draft20/data-streams.ts +610 -563
- package/src/drafts/draft20/index.ts +3 -0
- package/src/drafts/draft20/types.ts +31 -13
- package/dist/codec-BJ7BHuiZ.d.ts +0 -18
- package/dist/codec-C6Mx4bwz.d.cts +0 -18
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Draft-14 error, status and termination code registries.
|
|
2
|
+
|
|
3
|
+
export const SessionErrorCode = {
|
|
4
|
+
NoError: 0x0n,
|
|
5
|
+
InternalError: 0x1n,
|
|
6
|
+
Unauthorized: 0x2n,
|
|
7
|
+
ProtocolViolation: 0x3n,
|
|
8
|
+
InvalidRequestId: 0x4n,
|
|
9
|
+
DuplicateTrackAlias: 0x5n,
|
|
10
|
+
KeyValueFormattingError: 0x6n,
|
|
11
|
+
TooManyRequests: 0x7n,
|
|
12
|
+
InvalidPath: 0x8n,
|
|
13
|
+
MalformedPath: 0x9n,
|
|
14
|
+
GoawayTimeout: 0x10n,
|
|
15
|
+
ControlMessageTimeout: 0x11n,
|
|
16
|
+
DataStreamTimeout: 0x12n,
|
|
17
|
+
AuthTokenCacheOverflow: 0x13n,
|
|
18
|
+
DuplicateAuthTokenAlias: 0x14n,
|
|
19
|
+
VersionNegotiationFailed: 0x15n,
|
|
20
|
+
MalformedAuthToken: 0x16n,
|
|
21
|
+
UnknownAuthTokenAlias: 0x17n,
|
|
22
|
+
ExpiredAuthToken: 0x18n,
|
|
23
|
+
InvalidAuthority: 0x19n,
|
|
24
|
+
MalformedAuthority: 0x1an,
|
|
25
|
+
} as const
|
|
26
|
+
export type SessionErrorCodeValue = (typeof SessionErrorCode)[keyof typeof SessionErrorCode]
|
|
27
|
+
|
|
28
|
+
export const SubscribeErrorCode = {
|
|
29
|
+
InternalError: 0x0n,
|
|
30
|
+
Unauthorized: 0x1n,
|
|
31
|
+
Timeout: 0x2n,
|
|
32
|
+
NotSupported: 0x3n,
|
|
33
|
+
TrackDoesNotExist: 0x4n,
|
|
34
|
+
InvalidRange: 0x5n,
|
|
35
|
+
MalformedAuthToken: 0x10n,
|
|
36
|
+
ExpiredAuthToken: 0x12n,
|
|
37
|
+
} as const
|
|
38
|
+
export type SubscribeErrorCodeValue = (typeof SubscribeErrorCode)[keyof typeof SubscribeErrorCode]
|
|
39
|
+
|
|
40
|
+
export const PublishDoneStatusCode = {
|
|
41
|
+
InternalError: 0x0n,
|
|
42
|
+
Unauthorized: 0x1n,
|
|
43
|
+
TrackEnded: 0x2n,
|
|
44
|
+
SubscriptionEnded: 0x3n,
|
|
45
|
+
GoingAway: 0x4n,
|
|
46
|
+
Expired: 0x5n,
|
|
47
|
+
TooFarBehind: 0x6n,
|
|
48
|
+
MalformedTrack: 0x7n,
|
|
49
|
+
} as const
|
|
50
|
+
export type PublishDoneStatusCodeValue =
|
|
51
|
+
(typeof PublishDoneStatusCode)[keyof typeof PublishDoneStatusCode]
|
|
52
|
+
|
|
53
|
+
export const PublishErrorCode = {
|
|
54
|
+
InternalError: 0x0n,
|
|
55
|
+
Unauthorized: 0x1n,
|
|
56
|
+
Timeout: 0x2n,
|
|
57
|
+
NotSupported: 0x3n,
|
|
58
|
+
Uninterested: 0x4n,
|
|
59
|
+
} as const
|
|
60
|
+
export type PublishErrorCodeValue = (typeof PublishErrorCode)[keyof typeof PublishErrorCode]
|
|
61
|
+
|
|
62
|
+
export const FetchErrorCode = {
|
|
63
|
+
InternalError: 0x0n,
|
|
64
|
+
Unauthorized: 0x1n,
|
|
65
|
+
Timeout: 0x2n,
|
|
66
|
+
NotSupported: 0x3n,
|
|
67
|
+
TrackDoesNotExist: 0x4n,
|
|
68
|
+
InvalidRange: 0x5n,
|
|
69
|
+
NoObjects: 0x6n,
|
|
70
|
+
InvalidJoiningRequestId: 0x7n,
|
|
71
|
+
UnknownStatusInRange: 0x8n,
|
|
72
|
+
MalformedTrack: 0x9n,
|
|
73
|
+
MalformedAuthToken: 0x10n,
|
|
74
|
+
ExpiredAuthToken: 0x12n,
|
|
75
|
+
} as const
|
|
76
|
+
export type FetchErrorCodeValue = (typeof FetchErrorCode)[keyof typeof FetchErrorCode]
|
|
77
|
+
|
|
78
|
+
export const AnnounceErrorCode = {
|
|
79
|
+
InternalError: 0x0n,
|
|
80
|
+
Unauthorized: 0x1n,
|
|
81
|
+
Timeout: 0x2n,
|
|
82
|
+
NotSupported: 0x3n,
|
|
83
|
+
Uninterested: 0x4n,
|
|
84
|
+
MalformedAuthToken: 0x10n,
|
|
85
|
+
ExpiredAuthToken: 0x12n,
|
|
86
|
+
} as const
|
|
87
|
+
export type AnnounceErrorCodeValue = (typeof AnnounceErrorCode)[keyof typeof AnnounceErrorCode]
|
|
88
|
+
|
|
89
|
+
export const SubscribeNamespaceErrorCode = {
|
|
90
|
+
InternalError: 0x0n,
|
|
91
|
+
Unauthorized: 0x1n,
|
|
92
|
+
Timeout: 0x2n,
|
|
93
|
+
NotSupported: 0x3n,
|
|
94
|
+
NamespacePrefixUnknown: 0x4n,
|
|
95
|
+
NamespacePrefixOverlap: 0x5n,
|
|
96
|
+
MalformedAuthToken: 0x10n,
|
|
97
|
+
ExpiredAuthToken: 0x12n,
|
|
98
|
+
} as const
|
|
99
|
+
export type SubscribeNamespaceErrorCodeValue =
|
|
100
|
+
(typeof SubscribeNamespaceErrorCode)[keyof typeof SubscribeNamespaceErrorCode]
|
|
101
|
+
|
|
102
|
+
export const DataStreamResetErrorCode = {
|
|
103
|
+
InternalError: 0x0n,
|
|
104
|
+
Cancelled: 0x1n,
|
|
105
|
+
DeliveryTimeout: 0x2n,
|
|
106
|
+
SessionClosed: 0x3n,
|
|
107
|
+
} as const
|
|
108
|
+
export type DataStreamResetErrorCodeValue =
|
|
109
|
+
(typeof DataStreamResetErrorCode)[keyof typeof DataStreamResetErrorCode]
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export const DRAFT_VERSION = 0xff00000en
|
|
2
2
|
|
|
3
|
+
export type { AuthRedaction } from '../../core/auth-redaction.js'
|
|
4
|
+
export { REDACTION_FILL } from '../../core/auth-redaction.js'
|
|
3
5
|
export type { Draft14Codec } from './codec.js'
|
|
4
6
|
export {
|
|
5
7
|
createDataStreamDecoder,
|
|
@@ -16,7 +18,28 @@ export {
|
|
|
16
18
|
encodeFetchStream,
|
|
17
19
|
encodeMessage,
|
|
18
20
|
encodeSubgroupStream,
|
|
21
|
+
redactAuthTokens,
|
|
19
22
|
} from './codec.js'
|
|
23
|
+
export type {
|
|
24
|
+
AnnounceErrorCodeValue,
|
|
25
|
+
DataStreamResetErrorCodeValue,
|
|
26
|
+
FetchErrorCodeValue,
|
|
27
|
+
PublishDoneStatusCodeValue,
|
|
28
|
+
PublishErrorCodeValue,
|
|
29
|
+
SessionErrorCodeValue,
|
|
30
|
+
SubscribeErrorCodeValue,
|
|
31
|
+
SubscribeNamespaceErrorCodeValue,
|
|
32
|
+
} from './error-codes.js'
|
|
33
|
+
export {
|
|
34
|
+
AnnounceErrorCode,
|
|
35
|
+
DataStreamResetErrorCode,
|
|
36
|
+
FetchErrorCode,
|
|
37
|
+
PublishDoneStatusCode,
|
|
38
|
+
PublishErrorCode,
|
|
39
|
+
SessionErrorCode,
|
|
40
|
+
SubscribeErrorCode,
|
|
41
|
+
SubscribeNamespaceErrorCode,
|
|
42
|
+
} from './error-codes.js'
|
|
20
43
|
export {
|
|
21
44
|
MESSAGE_ID_MAP,
|
|
22
45
|
MESSAGE_TYPE_MAP,
|
|
@@ -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[]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AuthRedaction, recordAuthValueSpan, redactWith } from '../../core/auth-redaction.js'
|
|
1
2
|
import { BufferReader } from '../../core/buffer-reader.js'
|
|
2
3
|
import { BufferWriter } from '../../core/buffer-writer.js'
|
|
3
4
|
import { bytesToHex, hexToBytes } from '../../core/hex.js'
|
|
@@ -63,7 +64,7 @@ function encodeSetupParams(params: Draft15SetupParams, writer: BufferWriter): vo
|
|
|
63
64
|
let count = 0
|
|
64
65
|
if (params.path !== undefined) count++
|
|
65
66
|
if (params.max_request_id !== undefined) count++
|
|
66
|
-
|
|
67
|
+
count += params.authorization_token?.length ?? 0
|
|
67
68
|
if (params.max_auth_token_cache_size !== undefined) count++
|
|
68
69
|
if (params.authority !== undefined) count++
|
|
69
70
|
if (params.moqt_implementation !== undefined) count++
|
|
@@ -86,10 +87,10 @@ function encodeSetupParams(params: Draft15SetupParams, writer: BufferWriter): vo
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
// AUTHORIZATION_TOKEN (0x03) - odd, length-prefixed with nested structure
|
|
89
|
-
|
|
90
|
+
for (const token of params.authorization_token ?? []) {
|
|
90
91
|
writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN)
|
|
91
92
|
const tmpW = new BufferWriter(64)
|
|
92
|
-
encodeAuthorizationToken(
|
|
93
|
+
encodeAuthorizationToken(token, tmpW)
|
|
93
94
|
const raw = tmpW.finish()
|
|
94
95
|
writer.writeVarInt(raw.byteLength)
|
|
95
96
|
writer.writeBytes(raw)
|
|
@@ -170,7 +171,9 @@ function decodeSetupParams(reader: BufferReader): Draft15SetupParams {
|
|
|
170
171
|
if (paramType === SETUP_PARAM_PATH) {
|
|
171
172
|
result.path = textDecoder.decode(bytes)
|
|
172
173
|
} else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
|
|
173
|
-
|
|
174
|
+
const token = decodeAuthorizationToken(new BufferReader(bytes))
|
|
175
|
+
noteAuthTokenValue(reader.offset - length, length, token.token_value)
|
|
176
|
+
result.authorization_token = [...(result.authorization_token ?? []), token]
|
|
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,9 @@ 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
|
-
|
|
364
|
+
const token = decodeAuthorizationToken(new BufferReader(tokenBytes))
|
|
365
|
+
noteAuthTokenValue(reader.offset - length, length, token.token_value)
|
|
366
|
+
result.authorization_token = [...(result.authorization_token ?? []), token]
|
|
362
367
|
} else if (paramType === PARAM_MAX_CACHE_DURATION) {
|
|
363
368
|
result.max_cache_duration = reader.readVarInt()
|
|
364
369
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -1134,3 +1139,61 @@ export function createDraft15Codec(): Draft15Codec {
|
|
|
1134
1139
|
createDataStreamDecoder,
|
|
1135
1140
|
}
|
|
1136
1141
|
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Record where a Token Value sits, so it can be overwritten before the frame
|
|
1145
|
+
* reaches anything that keeps it.
|
|
1146
|
+
*
|
|
1147
|
+
* The span falls out of the decode with no second walk. The Token Value is the
|
|
1148
|
+
* last field of the Token structure, so its start is the parameter value's end
|
|
1149
|
+
* minus the value's own length. The fields before it are left alone
|
|
1150
|
+
* deliberately: Alias Type, Token Alias and Token Type are structure rather
|
|
1151
|
+
* than secret, and they are what distinguishes a session that failed to
|
|
1152
|
+
* authenticate from one that never tried.
|
|
1153
|
+
*
|
|
1154
|
+
* A token carrying no value at all -- DELETE and USE_ALIAS -- records nothing,
|
|
1155
|
+
* and its frame passes through untouched.
|
|
1156
|
+
*/
|
|
1157
|
+
function noteAuthTokenValue(
|
|
1158
|
+
valueStart: number,
|
|
1159
|
+
valueLength: number,
|
|
1160
|
+
value: Uint8Array | undefined,
|
|
1161
|
+
): void {
|
|
1162
|
+
if (value === undefined || value.byteLength === 0) return
|
|
1163
|
+
recordAuthValueSpan(valueStart + valueLength - value.byteLength, value.byteLength)
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Overwrite every Authorization Token value in a draft-15 control frame.
|
|
1168
|
+
*
|
|
1169
|
+
* One decode, whose *output is discarded*: the point is not to read the
|
|
1170
|
+
* message, it is to learn where the credentials were so the caller never has to
|
|
1171
|
+
* hold a frame that contains one. A caller that also wants the message should
|
|
1172
|
+
* decode the **redacted** frame with {@link decodeMessage}, which then cannot
|
|
1173
|
+
* produce a value because there is no longer one in the bytes.
|
|
1174
|
+
*
|
|
1175
|
+
* A frame that fails to decode is still redacted as far as the decode got. That
|
|
1176
|
+
* is the useful direction to fail in: a value that was read is a value that was
|
|
1177
|
+
* exposed, whatever went wrong after it.
|
|
1178
|
+
*
|
|
1179
|
+
* See {@link AuthRedaction.incomplete} for the one result a caller must not
|
|
1180
|
+
* treat as clean, and {@link AuthRedaction.decoded} for the residual it cannot
|
|
1181
|
+
* close.
|
|
1182
|
+
*/
|
|
1183
|
+
export function redactAuthTokens(bytes: Uint8Array): AuthRedaction {
|
|
1184
|
+
let payloadStart: number
|
|
1185
|
+
try {
|
|
1186
|
+
const probe = new BufferReader(bytes)
|
|
1187
|
+
probe.readVarInt()
|
|
1188
|
+
probe.readUint8()
|
|
1189
|
+
probe.readUint8()
|
|
1190
|
+
payloadStart = probe.offset
|
|
1191
|
+
} catch {
|
|
1192
|
+
// Too short to carry a message header, and so too short for the parameters
|
|
1193
|
+
// that carry a credential. Reported as not decoded rather than as clean: a
|
|
1194
|
+
// framer only ever emits complete frames, so a caller that gets here is
|
|
1195
|
+
// holding something this function did not check.
|
|
1196
|
+
return { bytes, redacted: 0, incomplete: false, decoded: false }
|
|
1197
|
+
}
|
|
1198
|
+
return redactWith(bytes, payloadStart, () => decodeMessage(bytes).ok)
|
|
1199
|
+
}
|