@blockcast/mmt-container 0.4.0-main.bb90ce9247fa → 0.4.0-main.bbdfdbf39ded
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/README.md +36 -20
- package/dist/align.d.ts +24 -18
- package/dist/align.d.ts.map +1 -1
- package/dist/align.js +23 -4
- package/dist/align.js.map +2 -2
- package/dist/browser-runtime.js +1721 -705
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +72 -34
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +309 -204
- package/dist/carp-catalog.js.map +3 -3
- package/dist/catalog-fec-params.d.ts +15 -4
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +137 -50
- package/dist/catalog-fec-params.js.map +4 -4
- package/dist/catalog-network-source.d.ts +24 -2
- package/dist/catalog-network-source.d.ts.map +1 -1
- package/dist/catalog-network-source.js +24 -1
- package/dist/catalog-network-source.js.map +3 -3
- package/dist/catalog-validator.d.ts +4 -3
- package/dist/catalog-validator.d.ts.map +1 -1
- package/dist/catalog-validator.js +0 -29
- package/dist/catalog-validator.js.map +3 -3
- package/dist/delivery-catalog.js +100 -230
- package/dist/delivery-catalog.js.map +4 -4
- package/dist/fec-manager.d.ts +64 -1
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +275 -62
- package/dist/fec-manager.js.map +4 -4
- package/dist/fec-state.d.ts +5 -3
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +34 -12
- package/dist/fec-state.js.map +4 -4
- package/dist/fec-worker-setup.d.ts +2 -0
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +15 -3
- package/dist/fec-worker-setup.js.map +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.d.ts +29 -0
- package/dist/iso-block-locator.d.ts.map +1 -1
- package/dist/iso-block-locator.js +100 -17
- package/dist/iso-block-locator.js.map +4 -4
- package/dist/manifest-auth-plan.d.ts +26 -25
- package/dist/manifest-auth-plan.d.ts.map +1 -1
- package/dist/manifest-auth-plan.js +331 -1171
- package/dist/manifest-auth-plan.js.map +4 -4
- package/dist/mfu-reassembler.js +24 -13
- package/dist/mfu-reassembler.js.map +3 -3
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +96 -22
- package/dist/mmtp-container-parser.js.map +3 -3
- package/dist/mmtp-container-parser.no-modules.js +1138 -325
- package/dist/mmtp-container-parser.no-modules.js.map +4 -4
- package/dist/mmtp-decode-pipeline.js +96 -22
- package/dist/mmtp-decode-pipeline.js.map +3 -3
- package/dist/mmtp-fec-session.d.ts +159 -0
- package/dist/mmtp-fec-session.d.ts.map +1 -0
- package/dist/mmtp-fec-session.js +531 -0
- package/dist/mmtp-fec-session.js.map +7 -0
- package/dist/mmtp-router.d.ts +31 -5
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +168 -22
- package/dist/mmtp-router.js.map +3 -3
- package/dist/multicast-auth-catalog.d.ts +86 -92
- package/dist/multicast-auth-catalog.d.ts.map +1 -1
- package/dist/multicast-auth-catalog.js +347 -132
- package/dist/multicast-auth-catalog.js.map +4 -4
- package/dist/multicast-input.d.ts +28 -6
- package/dist/multicast-input.d.ts.map +1 -1
- package/dist/multicast-input.js +293 -28
- package/dist/multicast-input.js.map +3 -3
- package/dist/multicast-manager.d.ts +89 -5
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +730 -356
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +12 -2
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +111 -235
- package/dist/multicast-transport.js.map +4 -4
- package/dist/multicast-unwrap.js +24 -13
- package/dist/multicast-unwrap.js.map +3 -3
- package/dist/no-modules.d.ts +4 -1
- package/dist/no-modules.d.ts.map +1 -1
- package/dist/no-modules.js +1087 -309
- package/dist/no-modules.js.map +4 -4
- package/dist/phase14-catalog-override.d.ts +1 -1
- package/dist/phase14-catalog-override.d.ts.map +1 -1
- package/dist/phase14-catalog-override.js +2 -2
- package/dist/phase14-catalog-override.js.map +2 -2
- package/dist/repair-fetch.d.ts +81 -6
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +159 -31
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layers.d.ts +2 -0
- package/dist/repair-layers.d.ts.map +1 -1
- package/dist/repair-layers.js +22 -2
- package/dist/repair-layers.js.map +3 -3
- package/dist/sample-combiner.d.ts +7 -1
- package/dist/sample-combiner.d.ts.map +1 -1
- package/dist/sample-combiner.js +14 -2
- package/dist/sample-combiner.js.map +2 -2
- package/dist/signaling.d.ts +2 -2
- package/dist/signaling.d.ts.map +1 -1
- package/dist/signaling.js +6 -3
- package/dist/signaling.js.map +3 -3
- package/dist/source-auth.js +2710 -7
- package/dist/source-auth.js.map +4 -4
- package/dist/switching-set-alignment.d.ts +1 -1
- package/dist/switching-set-alignment.js.map +1 -1
- package/dist/timestamp-codec.js +24 -13
- package/dist/timestamp-codec.js.map +3 -3
- package/dist/wasm-mfu-reassembler.js +3 -0
- package/dist/wasm-mfu-reassembler.js.map +3 -3
- package/dist/wasm-mmtp-container-parser.js +96 -22
- package/dist/wasm-mmtp-container-parser.js.map +3 -3
- package/package.json +6 -9
- package/schemas/catalog.schema.json +124 -37
- package/src/align.ts +52 -21
- package/src/carp-catalog.ts +163 -61
- package/src/catalog-fec-params.ts +66 -20
- package/src/catalog-network-source.ts +45 -2
- package/src/catalog-validator.ts +4 -11
- package/src/fec-manager.ts +239 -63
- package/src/fec-state.ts +14 -12
- package/src/fec-worker-setup.ts +20 -2
- package/src/index.ts +29 -10
- package/src/iso-block-locator.ts +97 -6
- package/src/manifest-auth-plan.ts +39 -91
- package/src/mmtp-container-parser.ts +75 -7
- package/src/mmtp-fec-session.ts +533 -0
- package/src/mmtp-router.ts +133 -5
- package/src/multicast-auth-catalog.ts +131 -238
- package/src/multicast-input.ts +119 -61
- package/src/multicast-manager.ts +258 -21
- package/src/multicast-transport.ts +17 -3
- package/src/no-modules.ts +7 -1
- package/src/phase14-catalog-override.ts +3 -3
- package/src/repair-fetch.ts +283 -39
- package/src/repair-layers.ts +22 -2
- package/src/sample-combiner.ts +15 -2
- package/src/signaling.ts +2 -2
- package/src/switching-set-alignment.ts +1 -1
- package/test-vectors/align.json +108 -32
- package/test-vectors/bc-provenance-v2.json +1526 -0
- package/test-vectors/catalog/README.md +65 -4
- package/test-vectors/catalog/negative/fec-block-profile-missing.json +1 -1
- package/test-vectors/catalog/negative/fec-block-profile-retired.json +1 -1
- package/test-vectors/catalog/negative/fec-block-profile-unknown.json +1 -1
- package/test-vectors/catalog/negative/fec-iso-symbol-size-below-floor.json +28 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-iso-symbol-size-13.json +28 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-k-plus-p-over-255.json +39 -0
- package/test-vectors/catalog/negative/fec-reed-solomon-overlay-over-255.json +40 -0
- package/test-vectors/catalog/negative/fec-repair-overlay-source-symbols-zero.json +43 -0
- package/test-vectors/catalog/negative/fec-repair-symbols-zero.json +28 -0
- package/test-vectors/catalog/negative/fec-source-symbols-zero.json +28 -0
- package/test-vectors/catalog/negative/fec-symbol-size-zero.json +28 -0
- package/test-vectors/catalog/negative/init-data-inline-without-data.json +22 -0
- package/test-vectors/catalog/negative/mmtp-mode-mpu.json +15 -0
- package/test-vectors/catalog/negative/multicast-amt-dns-without-relay.json +37 -0
- package/test-vectors/catalog/negative/multicast-auth-asm-missing-sender-address.json +77 -0
- package/test-vectors/catalog/negative/multicast-auth-duplicate-first-epoch.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-duplicate-kid.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-auth-without-object-auth.json +38 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-auth.json +49 -0
- package/test-vectors/catalog/negative/multicast-auth-endpoint-missing-bandwidth.json +55 -0
- package/test-vectors/catalog/negative/multicast-auth-manifest-port-equals-port.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-manifest-timer-out-of-range.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-above-max.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-max-auth-delay-below-min.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-root-dotted-key.json +55 -0
- package/test-vectors/catalog/negative/multicast-auth-sender-address-on-ssm.json +57 -0
- package/test-vectors/catalog/negative/multicast-auth-version-1.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-version-3.json +56 -0
- package/test-vectors/catalog/negative/multicast-auth-version-missing.json +55 -0
- package/test-vectors/catalog/negative/multicast-endpoint-foreign-namespace-track.json +44 -0
- package/test-vectors/catalog/negative/multicast-endpoint-protocol-amt.json +38 -0
- package/test-vectors/catalog/negative/multicast-endpoint-protocol-atsc3.json +38 -0
- package/test-vectors/catalog/negative/presentation-anchor-unsafe.json +16 -0
- package/test-vectors/catalog/positive/fec-algorithm-unimplemented.json +29 -0
- package/test-vectors/catalog/positive/fec-iso-ssbg1.json +1 -1
- package/test-vectors/catalog/positive/fec-multicast.json +1 -1
- package/test-vectors/catalog/positive/fec-reed-solomon-layered.json +50 -0
- package/test-vectors/catalog/positive/mmt01-12-1-init-ref-anchor.json +29 -0
- package/test-vectors/catalog/positive/multicast-amt-discovery-omitted.json +37 -0
- package/test-vectors/catalog/positive/multicast-amt-dns-relay.json +38 -0
- package/test-vectors/catalog/positive/multicast-amt-manual-relay.json +2 -2
- package/test-vectors/catalog/{negative/multicast-endpoint-missing-protocol-and-source.json → positive/multicast-asm-unprotected.json} +10 -5
- package/test-vectors/catalog/positive/multicast-auth-asm-sender.json +78 -0
- package/test-vectors/catalog/positive/multicast-auth-rotation.json +39 -38
- package/test-vectors/catalog/positive/multicast-draft01-4-1-example.json +81 -0
- package/test-vectors/catalog/positive/multicast-draft01-7-2-6-example.json +70 -0
- package/test-vectors/catalog/positive/presentation-anchor-negative.json +27 -0
- package/test-vectors/catalog/section-codes.json +30 -1
- package/test-vectors/catalog-multicast-auth-v1.json +38 -20
- package/test-vectors/catalog-validation.json +101 -5
- package/test-vectors/catalog-validator-public-api.mjs +14 -9
- package/test-vectors/generate-bc-provenance-v2.mjs +252 -0
- package/dist/fec-codec.d.ts +0 -32
- package/dist/fec-codec.d.ts.map +0 -1
- package/dist/fec-codec.js +0 -47
- package/dist/fec-codec.js.map +0 -7
- package/src/fec-codec.ts +0 -61
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"streamingFormat": "mmtp",
|
|
4
|
+
"streamingFormatVersion": "draft-ramadan-moq-mmt-01",
|
|
5
|
+
"tracks": [
|
|
6
|
+
{
|
|
7
|
+
"name": "video",
|
|
8
|
+
"packaging": "mmtp",
|
|
9
|
+
"codec": "avc1.640028",
|
|
10
|
+
"framerate": 30,
|
|
11
|
+
"mmtpMode": "mfu",
|
|
12
|
+
"timescale": 90000,
|
|
13
|
+
"presentationAnchorTicks": -180000,
|
|
14
|
+
"groupDurationTicks": 180000
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "audio",
|
|
18
|
+
"packaging": "mmtp",
|
|
19
|
+
"codec": "mp4a.40.2",
|
|
20
|
+
"samplerate": 48000,
|
|
21
|
+
"mmtpMode": "mfu",
|
|
22
|
+
"timescale": 48000,
|
|
23
|
+
"presentationAnchorTicks": -96000,
|
|
24
|
+
"groupDurationTicks": 96000
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -7,23 +7,52 @@
|
|
|
7
7
|
"fec-block-profile-retired.json": { "code": "track_fec_block_profile_unimplemented", "path": "$.tracks[0].fec.blockProfile" },
|
|
8
8
|
"fec-block-profile-unknown.json": { "code": "track_fec_block_profile_unimplemented", "path": "$.tracks[0].fec.blockProfile" },
|
|
9
9
|
"fec-enhancement-repair-removed.json": { "code": "track_fec", "path": "$.tracks[0].fec.enhancementRepair" },
|
|
10
|
+
"fec-iso-symbol-size-below-floor.json": { "code": "track_fec", "path": "$.tracks[0].fec.symbolSize" },
|
|
11
|
+
"fec-reed-solomon-iso-symbol-size-13.json": { "code": "track_fec", "path": "$.tracks[0].fec.symbolSize" },
|
|
12
|
+
"fec-reed-solomon-k-plus-p-over-255.json": { "code": "track_fec_bounds", "path": "$.tracks[0].fec.sourceSymbols" },
|
|
13
|
+
"fec-reed-solomon-overlay-over-255.json": { "code": "track_fec_bounds", "path": "$.tracks[2].repairSymbols" },
|
|
10
14
|
"fec-repair-layer-geometry.json": { "code": "track_repair_geometry", "path": "$.tracks[2].timescale" },
|
|
11
15
|
"fec-repair-layer-missing-symbols.json": { "code": "track_repair_layer", "path": "$.tracks[2].repairSymbols" },
|
|
12
16
|
"fec-repair-multiple-depends.json": { "code": "track_repair_depends", "path": "$.tracks[2].depends" },
|
|
17
|
+
"fec-repair-overlay-source-symbols-zero.json": { "code": "track_fec_bounds", "path": "$.tracks[2].sourceSymbols" },
|
|
13
18
|
"fec-repair-overlay-with-layer.json": { "code": "track_repair_overlay", "path": "$.tracks[2].repairLayer" },
|
|
14
19
|
"fec-repair-priority-out-of-band.json": { "code": "track_repair_priority", "path": "$.tracks[1].priority" },
|
|
15
20
|
"fec-repair-source-symbols-without-scope.json": { "code": "track_repair_overlay", "path": "$.tracks[2].sourceSymbols" },
|
|
21
|
+
"fec-repair-symbols-zero.json": { "code": "track_fec", "path": "$.tracks[0].fec.repairSymbols" },
|
|
22
|
+
"fec-source-symbols-zero.json": { "code": "track_fec", "path": "$.tracks[0].fec.sourceSymbols" },
|
|
23
|
+
"fec-symbol-size-zero.json": { "code": "track_fec", "path": "$.tracks[0].fec.symbolSize" },
|
|
24
|
+
"init-data-inline-without-data.json": { "outOfSection": "root initDataList" },
|
|
16
25
|
"legacy-selection-params.json": { "outOfSection": "common track field selectionParams" },
|
|
17
26
|
"media-track-repair-layer.json": { "code": "track_repair_layer", "path": "$.tracks[0].repairLayer" },
|
|
18
27
|
"missing-mmtp-fields.json": { "code": "track_mmtp_mode", "path": "$.tracks[0].mmtpMode" },
|
|
28
|
+
"mmtp-mode-mpu.json": { "code": "track_mmtp_mode", "path": "$.tracks[0].mmtpMode" },
|
|
29
|
+
"multicast-amt-dns-without-relay.json": { "outOfSection": "multicast" },
|
|
30
|
+
"multicast-auth-asm-missing-sender-address.json": { "outOfSection": "multicast.auth" },
|
|
31
|
+
"multicast-auth-duplicate-first-epoch.json": { "outOfSection": "multicast.auth" },
|
|
32
|
+
"multicast-auth-duplicate-kid.json": { "outOfSection": "multicast.auth" },
|
|
33
|
+
"multicast-auth-endpoint-auth-without-object-auth.json": { "outOfSection": "multicast.auth" },
|
|
34
|
+
"multicast-auth-endpoint-missing-auth.json": { "outOfSection": "multicast.auth" },
|
|
35
|
+
"multicast-auth-endpoint-missing-bandwidth.json": { "outOfSection": "multicast.auth" },
|
|
36
|
+
"multicast-auth-manifest-port-equals-port.json": { "outOfSection": "multicast.auth" },
|
|
37
|
+
"multicast-auth-manifest-timer-out-of-range.json": { "outOfSection": "multicast.auth" },
|
|
38
|
+
"multicast-auth-max-auth-delay-below-min.json": { "outOfSection": "multicast.auth" },
|
|
39
|
+
"multicast-auth-max-auth-delay-above-max.json": { "outOfSection": "multicast.auth" },
|
|
19
40
|
"multicast-auth-padded-key.json": { "outOfSection": "multicast.auth" },
|
|
20
41
|
"multicast-auth-reused-track-format.json": { "outOfSection": "multicast.auth" },
|
|
42
|
+
"multicast-auth-root-dotted-key.json": { "outOfSection": "multicast.auth" },
|
|
43
|
+
"multicast-auth-sender-address-on-ssm.json": { "outOfSection": "multicast.auth" },
|
|
21
44
|
"multicast-auth-trailing-pad-bits.json": { "outOfSection": "multicast.auth" },
|
|
22
|
-
"multicast-
|
|
45
|
+
"multicast-auth-version-1.json": { "outOfSection": "multicast.auth" },
|
|
46
|
+
"multicast-auth-version-3.json": { "outOfSection": "multicast.auth" },
|
|
47
|
+
"multicast-auth-version-missing.json": { "outOfSection": "multicast.auth" },
|
|
48
|
+
"multicast-endpoint-foreign-namespace-track.json": { "outOfSection": "multicast" },
|
|
49
|
+
"multicast-endpoint-protocol-amt.json": { "outOfSection": "multicast" },
|
|
50
|
+
"multicast-endpoint-protocol-atsc3.json": { "outOfSection": "multicast" },
|
|
23
51
|
"multicast-endpoint-relay-address.json": { "outOfSection": "multicast" },
|
|
24
52
|
"multicast-network-source-empty.json": { "outOfSection": "multicast" },
|
|
25
53
|
"multicast-packet-id-signaling.json": { "outOfSection": "multicast" },
|
|
26
54
|
"network-source-object.json": { "outOfSection": "multicast" },
|
|
55
|
+
"presentation-anchor-unsafe.json": { "code": "track_presentation_anchor", "path": "$.tracks[0].presentationAnchorTicks" },
|
|
27
56
|
"raptorq-source-symbols-over-max.json": { "code": "track_fec_bounds", "path": "$.tracks[0].fec.sourceSymbols" },
|
|
28
57
|
"raptorq-unaligned-symbol.json": { "code": "track_fec", "path": "$.tracks[0].fec.symbolSize" },
|
|
29
58
|
"repair-track-legacy-shape.json": { "outOfSection": "the packaging value set (common track field)" },
|
|
@@ -1,25 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "Golden multicast.auth
|
|
3
|
-
"multicast
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"$comment": "Golden multicast.auth catalog block, bc-provenance version 2 (draft-ramadan-moq-multicast-01 7.2.6 at Blockcast/moqcast-draft@fd962fd73d21ed281b60219c11ea61cc9e4e91c4). Two keys rotate at epoch 17: kid 1 signs epochs 1..16, kid 2 signs 17 and later, and minEpoch 17 makes a joiner start at kid 2. The endpoint is a protected SSM flow, so S is its sourceAddress. The draft -00 shape this file used to hold (root \"multicast.auth\" key, hash/publicKey/keyId/previousKey/compaction/enforcement/tracks) is kept as catalog/negative/multicast-auth-root-dotted-key.json.",
|
|
3
|
+
"multicast": {
|
|
4
|
+
"auth": {
|
|
5
|
+
"scheme": "bc-provenance",
|
|
6
|
+
"version": 2,
|
|
7
|
+
"sig": "ed25519",
|
|
8
|
+
"keys": [
|
|
9
|
+
{
|
|
10
|
+
"kid": 1,
|
|
11
|
+
"publicKey": "A6EHv_POEL4dcN0Y50vAmWfk1jCbpQ1fHdyGZBJVMbg",
|
|
12
|
+
"firstEpoch": 1
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"kid": 2,
|
|
16
|
+
"publicKey": "mm4Ae7fTOTrOb2d_zK9mlXVV2YgeBBvBncabOQRh1Z4",
|
|
17
|
+
"firstEpoch": 17
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"minEpoch": 17
|
|
21
|
+
},
|
|
22
|
+
"endpoints": [
|
|
12
23
|
{
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
"sourceAddress": "198.51.100.7",
|
|
25
|
+
"groupAddress": "232.10.20.30",
|
|
26
|
+
"port": 5004,
|
|
27
|
+
"bandwidth": 100000000,
|
|
28
|
+
"tracks": [
|
|
29
|
+
{
|
|
30
|
+
"name": "video",
|
|
31
|
+
"packetId": 1
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"auth": {
|
|
35
|
+
"manifestPort": 5005,
|
|
36
|
+
"streamId": 2864434397,
|
|
37
|
+
"maxAuthDelayMs": 200,
|
|
38
|
+
"manifestTimerMs": 20,
|
|
39
|
+
"manifestTrack": "video/manifest"
|
|
40
|
+
}
|
|
23
41
|
}
|
|
24
42
|
]
|
|
25
43
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "Canonical accept/reject and FEC-
|
|
2
|
+
"$comment": "Canonical accept/reject and FEC block budget (span + reorderToleranceMs, fec-01 §9) vectors. Auth validation is intentionally out of scope.",
|
|
3
3
|
"version": 1,
|
|
4
|
-
"safety_factor": 3,
|
|
5
4
|
"cases": [
|
|
6
5
|
{
|
|
7
6
|
"name": "valid MMTP video",
|
|
8
7
|
"valid": true,
|
|
9
|
-
"
|
|
8
|
+
"expected_fec_budget_ms": 173,
|
|
10
9
|
"catalog": {
|
|
11
10
|
"version": 1,
|
|
12
11
|
"tracks": [
|
|
@@ -26,6 +25,7 @@
|
|
|
26
25
|
"repairSymbols": 8,
|
|
27
26
|
"symbolSize": 1320,
|
|
28
27
|
"interleaveDepthMs": 133,
|
|
28
|
+
"reorderToleranceMs": 40,
|
|
29
29
|
"repairTrack": "video/repair"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
@@ -723,8 +723,9 @@
|
|
|
723
723
|
}
|
|
724
724
|
},
|
|
725
725
|
{
|
|
726
|
-
"name": "auth
|
|
727
|
-
"valid":
|
|
726
|
+
"name": "multicast.auth other than bc-provenance version 2 is rejected (draft -01 7.2.6)",
|
|
727
|
+
"valid": false,
|
|
728
|
+
"error_code": "multicast_auth",
|
|
728
729
|
"catalog": {
|
|
729
730
|
"version": 1,
|
|
730
731
|
"tracks": [
|
|
@@ -762,6 +763,101 @@
|
|
|
762
763
|
}
|
|
763
764
|
]
|
|
764
765
|
}
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"name": "intra-only base with GOP delta in one switching set",
|
|
769
|
+
"valid": true,
|
|
770
|
+
"catalog": {
|
|
771
|
+
"version": 1,
|
|
772
|
+
"tracks": [
|
|
773
|
+
{
|
|
774
|
+
"name": "video/base",
|
|
775
|
+
"packaging": "mmtp",
|
|
776
|
+
"isLive": true,
|
|
777
|
+
"codec": "hvc1.4.10.L120.9F.A",
|
|
778
|
+
"mmtpMode": "mfu",
|
|
779
|
+
"timescale": 90000,
|
|
780
|
+
"groupDurationTicks": 6000,
|
|
781
|
+
"framerate": 15.0,
|
|
782
|
+
"altGroup": 1
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"name": "video/delta",
|
|
786
|
+
"packaging": "mmtp",
|
|
787
|
+
"isLive": true,
|
|
788
|
+
"codec": "hvc1.1.6.L120.90",
|
|
789
|
+
"mmtpMode": "mfu",
|
|
790
|
+
"timescale": 1000000,
|
|
791
|
+
"groupDurationTicks": 1000000,
|
|
792
|
+
"framerate": 15.0,
|
|
793
|
+
"altGroup": 1
|
|
794
|
+
}
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"name": "intra-only member whose frame period does not divide its GOP peer",
|
|
800
|
+
"valid": false,
|
|
801
|
+
"error_code": "track_switching_set",
|
|
802
|
+
"catalog": {
|
|
803
|
+
"version": 1,
|
|
804
|
+
"tracks": [
|
|
805
|
+
{
|
|
806
|
+
"name": "video/base",
|
|
807
|
+
"packaging": "mmtp",
|
|
808
|
+
"isLive": true,
|
|
809
|
+
"codec": "hvc1.4.10.L120.9F.A",
|
|
810
|
+
"mmtpMode": "mfu",
|
|
811
|
+
"timescale": 90000,
|
|
812
|
+
"groupDurationTicks": 6000,
|
|
813
|
+
"framerate": 15.0,
|
|
814
|
+
"altGroup": 1
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"name": "video/delta",
|
|
818
|
+
"packaging": "mmtp",
|
|
819
|
+
"isLive": true,
|
|
820
|
+
"codec": "hvc1.1.6.L120.90",
|
|
821
|
+
"mmtpMode": "mfu",
|
|
822
|
+
"timescale": 1000000,
|
|
823
|
+
"groupDurationTicks": 1050000,
|
|
824
|
+
"framerate": 15.0,
|
|
825
|
+
"altGroup": 1
|
|
826
|
+
}
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
"name": "GOP alternates with nested but unequal durations (coarser first)",
|
|
832
|
+
"valid": false,
|
|
833
|
+
"error_code": "track_switching_set",
|
|
834
|
+
"catalog": {
|
|
835
|
+
"version": 1,
|
|
836
|
+
"tracks": [
|
|
837
|
+
{
|
|
838
|
+
"name": "video/1080p",
|
|
839
|
+
"packaging": "mmtp",
|
|
840
|
+
"isLive": true,
|
|
841
|
+
"codec": "hvc1.1.6.L120.90",
|
|
842
|
+
"mmtpMode": "mfu",
|
|
843
|
+
"timescale": 90000,
|
|
844
|
+
"groupDurationTicks": 180000,
|
|
845
|
+
"framerate": 30.0,
|
|
846
|
+
"altGroup": 1
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"name": "video/720p",
|
|
850
|
+
"packaging": "mmtp",
|
|
851
|
+
"isLive": true,
|
|
852
|
+
"codec": "hvc1.1.6.L120.90",
|
|
853
|
+
"mmtpMode": "mfu",
|
|
854
|
+
"timescale": 90000,
|
|
855
|
+
"groupDurationTicks": 90000,
|
|
856
|
+
"framerate": 30.0,
|
|
857
|
+
"altGroup": 1
|
|
858
|
+
}
|
|
859
|
+
]
|
|
860
|
+
}
|
|
765
861
|
}
|
|
766
862
|
]
|
|
767
863
|
}
|
|
@@ -6,20 +6,25 @@ import { createCatalogSchemaValidator } from '@blockcast/mmt-container/catalog-v
|
|
|
6
6
|
|
|
7
7
|
const require = createRequire(import.meta.url)
|
|
8
8
|
const schema = require('@blockcast/mmt-container/catalog.schema.json')
|
|
9
|
-
const
|
|
10
|
-
await readFile(
|
|
11
|
-
new URL('./catalog/negative/multicast-auth-reused-track-format.json', import.meta.url),
|
|
12
|
-
'utf8',
|
|
13
|
-
),
|
|
14
|
-
)
|
|
9
|
+
const fixture = async path => JSON.parse(await readFile(new URL(path, import.meta.url), 'utf8'))
|
|
15
10
|
const validate = createCatalogSchemaValidator(schema)
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
// draft-ramadan-moq-multicast-01 7.2.6: the published schema accepts the
|
|
13
|
+
// draft's own catalog-signaling example through the public entry point...
|
|
14
|
+
assert.equal(
|
|
15
|
+
validate(await fixture('./catalog/positive/multicast-draft01-7-2-6-example.json')),
|
|
16
|
+
true,
|
|
17
|
+
JSON.stringify(validate.errors),
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
// ...and refuses the retired draft -00 root "multicast.auth" key.
|
|
21
|
+
assert.equal(validate(await fixture('./catalog/negative/multicast-auth-root-dotted-key.json')), false)
|
|
18
22
|
assert.ok(
|
|
19
23
|
validate.errors?.some(
|
|
20
24
|
error =>
|
|
21
|
-
error.keyword === '
|
|
22
|
-
error.instancePath === '
|
|
25
|
+
error.keyword === 'additionalProperties' &&
|
|
26
|
+
error.instancePath === '' &&
|
|
27
|
+
error.params.additionalProperty === 'multicast.auth',
|
|
23
28
|
),
|
|
24
29
|
JSON.stringify(validate.errors),
|
|
25
30
|
)
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// bc-provenance version 2 vectors, draft-ramadan-moq-multicast-01 (7.2.3,
|
|
3
|
+
// 7.2.4, 7.2.7 step 1, 7.2.10, Appendix A). Case "appendix-a" reproduces the
|
|
4
|
+
// draft's Appendix A byte for byte; every other case is labelled beyond-draft.
|
|
5
|
+
// Only node:crypto is used (sha-256, Ed25519), so the output is deterministic.
|
|
6
|
+
// Step 1 is read at join (no record of the flow verified yet), so the
|
|
7
|
+
// previous-epoch deadline of 7.2.7 (the bound of 7.2.5 plus maxAuthDelayMs +
|
|
8
|
+
// 2 x manifestTimerMs after the epoch change) is left to the stateful verifier.
|
|
9
|
+
//
|
|
10
|
+
// node test-vectors/generate-bc-provenance-v2.mjs && git diff --exit-code
|
|
11
|
+
import { createHash, createPrivateKey, createPublicKey, sign } from 'node:crypto';
|
|
12
|
+
import { writeFileSync } from 'node:fs';
|
|
13
|
+
import { dirname, join } from 'node:path';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
|
|
16
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const DRAFT_COMMIT = 'abf183bfb83e616909453872c4d788db4b3acd19';
|
|
18
|
+
|
|
19
|
+
const H = (...parts) => createHash('sha256').update(Buffer.concat(parts)).digest();
|
|
20
|
+
const u8 = (n) => Buffer.from([n]);
|
|
21
|
+
const u16 = (n) => { const b = Buffer.alloc(2); b.writeUInt16BE(n); return b; };
|
|
22
|
+
const u32 = (n) => { const b = Buffer.alloc(4); b.writeUInt32BE(n); return b; };
|
|
23
|
+
const u64 = (n) => { const b = Buffer.alloc(8); b.writeBigUInt64BE(BigInt(n)); return b; };
|
|
24
|
+
const lp16 = (s) => { const x = Buffer.from(s, 'utf8'); return Buffer.concat([u16(x.length), x]); };
|
|
25
|
+
const hex = (b) => b.toString('hex');
|
|
26
|
+
|
|
27
|
+
function ip(s) {
|
|
28
|
+
if (!s.includes(':')) return Buffer.from(s.split('.').map(Number));
|
|
29
|
+
const [head, tail = ''] = s.split('::');
|
|
30
|
+
const h = head ? head.split(':') : [];
|
|
31
|
+
const t = tail ? tail.split(':') : [];
|
|
32
|
+
const groups = [...h, ...Array(8 - h.length - t.length).fill('0'), ...t];
|
|
33
|
+
return Buffer.concat(groups.map((g) => u16(parseInt(g, 16))));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const seed = Buffer.from([...Array(32).keys()]);
|
|
37
|
+
const privateKey = createPrivateKey({
|
|
38
|
+
key: Buffer.concat([Buffer.from('302e020100300506032b657004220420', 'hex'), seed]),
|
|
39
|
+
format: 'der',
|
|
40
|
+
type: 'pkcs8',
|
|
41
|
+
});
|
|
42
|
+
const publicKey = createPublicKey(privateKey).export({ format: 'der', type: 'spki' }).subarray(-32);
|
|
43
|
+
|
|
44
|
+
const pseudoheader = (ep, len) =>
|
|
45
|
+
Buffer.concat([ip(ep.S), ip(ep.G), u8(0), u8(0x11), u16(len), u16(ep.port), u16(ep.port), u32(ep.streamId)]);
|
|
46
|
+
const digest = (ep, payload) => H(pseudoheader(ep, payload.length), payload);
|
|
47
|
+
const signedPrefix = (ep) =>
|
|
48
|
+
Buffer.concat([Buffer.from('mcast-manifest-v2\0'), u32(ep.streamId), ip(ep.S), ip(ep.G), u16(ep.manifestPort)]);
|
|
49
|
+
|
|
50
|
+
function paramsHash(p) {
|
|
51
|
+
const fec = p.fec
|
|
52
|
+
? Buffer.concat([lp16(p.fec.algorithm), u32(p.fec.sourceSymbols), u32(p.fec.repairSymbols),
|
|
53
|
+
u32(p.fec.symbolSize), u32(p.fec.interleaveDepthMs ?? 0)])
|
|
54
|
+
: Buffer.concat([lp16('none'), u32(0), u32(0), u32(0), u32(0)]);
|
|
55
|
+
return H(Buffer.from('BCPV2-params'), lp16(p.codec), u32(p.timescale ?? 0), u32(p.groupDurationTicks ?? 0), fec);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ctxOf(c) {
|
|
59
|
+
if (!c) return Buffer.alloc(32); // flow carried without a MoQ catalog
|
|
60
|
+
const ids = [...c.packetIds].sort((a, b) => a - b);
|
|
61
|
+
return H(Buffer.from('BCPV2-ctx'), u16(c.namespace.length), ...c.namespace.map(lp16),
|
|
62
|
+
u16(ids.length), ...ids.map(u16), paramsHash(c.params));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Raw record from explicit fields; `count` and `hashAlg` may lie, and
|
|
66
|
+
// `digests` may be any length, so the negatives can be built the same way.
|
|
67
|
+
function record(ep, h, digests) {
|
|
68
|
+
const body = Buffer.concat([Buffer.from(h.magic ?? 'MHM2', 'latin1'), u32(h.kid), u32(h.epoch), u64(h.mseq),
|
|
69
|
+
u64(h.firstSeq), u16(h.count ?? digests.length), u8(h.hashAlg ?? 1), u8(h.flags ?? 0), u32(h.sent),
|
|
70
|
+
h.ctx, ...digests]);
|
|
71
|
+
return Buffer.concat([body, sign(null, Buffer.concat([signedPrefix(ep), body]), privateKey)]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const anchorEp = { S: '198.51.100.7', G: '232.10.20.30', port: 5004, manifestPort: 5005, streamId: 0xaabbccdd };
|
|
75
|
+
const anchorCtx = {
|
|
76
|
+
namespace: ['example.arena'],
|
|
77
|
+
packetIds: [1, 2],
|
|
78
|
+
params: {
|
|
79
|
+
codec: 'avc1.640028', timescale: 90000, groupDurationTicks: 3000,
|
|
80
|
+
fec: { algorithm: 'raptorq', sourceSymbols: 32, repairSymbols: 16, symbolSize: 1312, interleaveDepthMs: 133 },
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
const anchorHdr = { kid: 1, epoch: 17, mseq: 1, firstSeq: 1000, flags: 0, sent: 1792972800 };
|
|
84
|
+
|
|
85
|
+
// A synthetic FEC Type 1 source block (ISO/IEC 23008-1 C.5.2), replacing the
|
|
86
|
+
// 2-octet-trailer capture: each MMTP packet is a 12-octet header (V=0,
|
|
87
|
+
// FEC_type=1, type=MPU, packet_id=1, packet_sequence_number=i), a
|
|
88
|
+
// deterministic payload, and the 4-octet trailer u32(SS_ID = 5000 + i).
|
|
89
|
+
const mmtp = [0, 1, 2].map((i) => Buffer.concat([
|
|
90
|
+
Buffer.from([0x08, 0x00]), u16(1), u32(0), u32(i),
|
|
91
|
+
Buffer.from(Array.from({ length: 1274 }, (_, j) => (i * 31 + j) & 0xff)),
|
|
92
|
+
u32(5000 + i),
|
|
93
|
+
]));
|
|
94
|
+
|
|
95
|
+
function positive(id, source, note, { ep = anchorEp, ctx = anchorCtx, hdr = {}, datagrams, extra = {} }) {
|
|
96
|
+
const h = { ...anchorHdr, ...hdr };
|
|
97
|
+
const c = ctxOf(ctx);
|
|
98
|
+
const digests = datagrams.map((d) => digest(ep, d));
|
|
99
|
+
const rec = record(ep, { ...h, ctx: c }, digests);
|
|
100
|
+
return {
|
|
101
|
+
id, source, note, endpoint: ep, ctxInputs: ctx, header: { ...h, hashAlg: 1 },
|
|
102
|
+
datagramsHex: datagrams.map(hex),
|
|
103
|
+
pseudoheadersHex: datagrams.map((d) => hex(pseudoheader(ep, d.length))),
|
|
104
|
+
digestsHex: digests.map(hex),
|
|
105
|
+
paramsHashHex: ctx ? hex(paramsHash(ctx.params)) : null,
|
|
106
|
+
ctxHex: hex(c),
|
|
107
|
+
signedMessagePrefixHex: hex(signedPrefix(ep)),
|
|
108
|
+
signatureHex: hex(rec.subarray(-64)),
|
|
109
|
+
recordLength: rec.length,
|
|
110
|
+
recordHex: hex(rec),
|
|
111
|
+
...extra,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const anchorDatagrams = [Buffer.alloc(1400, 0x11), Buffer.alloc(1400, 0x22)];
|
|
116
|
+
const cases = [
|
|
117
|
+
positive('appendix-a', 'appendix-a', 'draft-ramadan-moq-multicast-01 Appendix A, byte for byte',
|
|
118
|
+
{ datagrams: anchorDatagrams }),
|
|
119
|
+
positive('twin', 'appendix-a', 'the twin of a record is byte-identical to it (7.2.5); equals appendix-a',
|
|
120
|
+
{ datagrams: anchorDatagrams }),
|
|
121
|
+
positive('mmtp-count-1', 'beyond-draft', 'one synthetic MMTP FEC Type 1 source packet, 4-octet Source FEC Payload ID trailer included; 164-octet record',
|
|
122
|
+
{ datagrams: [mmtp[0]], hdr: { firstSeq: 2000 } }),
|
|
123
|
+
positive('mmtp-count-37', 'beyond-draft', '37 datagrams (the three block packets as a carousel, each emission its own sequence); 1316-octet record',
|
|
124
|
+
{ datagrams: Array.from({ length: 37 }, (_, i) => mmtp[i % 3]), hdr: { firstSeq: 3000 } }),
|
|
125
|
+
positive('moq-group-boundary', 'beyond-draft', 'one window spanning MoQ groups 41 and 42; the record carries no group, digests are unchanged',
|
|
126
|
+
{ datagrams: mmtp, hdr: { firstSeq: 4000 }, extra: { moqGroupIds: [41, 41, 42] } }),
|
|
127
|
+
positive('flags-epoch-end', 'beyond-draft', 'flags bit 0 (epoch end)',
|
|
128
|
+
{ datagrams: anchorDatagrams, hdr: { mseq: 2, flags: 1 } }),
|
|
129
|
+
positive('ipv6', 'beyond-draft', 'IPv6 S and G, 44-octet pseudoheader and 50-octet signed_message prefix',
|
|
130
|
+
{ ep: { ...anchorEp, S: '2001:db8::7', G: 'ff3e::8000:1e' }, datagrams: anchorDatagrams }),
|
|
131
|
+
positive('params-no-fec', 'beyond-draft', 'catalog entry with no fec object: lp16("none") then four u32(0)',
|
|
132
|
+
{ ctx: { ...anchorCtx, params: { codec: 'avc1.640028', timescale: 90000, groupDurationTicks: 3000, fec: null } },
|
|
133
|
+
datagrams: anchorDatagrams }),
|
|
134
|
+
positive('params-no-interleave', 'beyond-draft', 'fec object without interleaveDepthMs: u32(0)',
|
|
135
|
+
{ ctx: { ...anchorCtx, params: { ...anchorCtx.params, fec: { ...anchorCtx.params.fec, interleaveDepthMs: undefined } } },
|
|
136
|
+
datagrams: anchorDatagrams }),
|
|
137
|
+
positive('catalog-less', 'beyond-draft', 'flow carried without a MoQ catalog: ctx is 32 zero octets',
|
|
138
|
+
{ ctx: null, datagrams: anchorDatagrams }),
|
|
139
|
+
positive('ctx-unsorted-packet-ids', 'beyond-draft',
|
|
140
|
+
'catalog packet IDs are canonicalized numerically before hashing',
|
|
141
|
+
{ ctx: { ...anchorCtx, packetIds: [7, 3] }, datagrams: anchorDatagrams }),
|
|
142
|
+
positive('ctx-two-field-namespace', 'beyond-draft', 'two-field namespace: u16(f) then each field as lp16, in order',
|
|
143
|
+
{ ctx: { ...anchorCtx, namespace: ['example', 'arena'] }, datagrams: anchorDatagrams }),
|
|
144
|
+
positive('params-no-timescale', 'beyond-draft', 'catalog entry without timescale or groupDurationTicks: each u32(0)',
|
|
145
|
+
{ ctx: { ...anchorCtx, params: { codec: 'avc1.640028', fec: anchorCtx.params.fec } }, datagrams: anchorDatagrams }),
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
// A recovered source packet has no trailer on the wire. Its admission digest
|
|
149
|
+
// appends the SS_ID implied by the repair block (SS_Start + ESI), while the
|
|
150
|
+
// transmitted source packet carries that same ID as an explicit 4-byte trailer.
|
|
151
|
+
const recoveredIndex = 3;
|
|
152
|
+
const ssStart = 0x01020300;
|
|
153
|
+
const recovered = Buffer.from('00112233445566778899aabbccddeeff', 'hex');
|
|
154
|
+
const ssId = ssStart + recoveredIndex;
|
|
155
|
+
const transmitted = Buffer.concat([recovered, u32(ssId)]);
|
|
156
|
+
const transmittedDigest = digest(anchorEp, transmitted);
|
|
157
|
+
const recoveredDigest = digest(anchorEp, Buffer.concat([recovered, u32(ssId)]));
|
|
158
|
+
if (!recoveredDigest.equals(transmittedDigest)) throw new Error('recovered digest mismatch');
|
|
159
|
+
const recoveredCase = {
|
|
160
|
+
id: 'recovered-packet', source: 'beyond-draft',
|
|
161
|
+
note: 'payload recovered by FEC (no trailer); digest over payload || u32(SS_Start + ESI) equals the digest of a conformant source packet with its 4-byte trailer',
|
|
162
|
+
endpoint: anchorEp, recoveredPayloadHex: hex(recovered), transmittedPacketHex: hex(transmitted),
|
|
163
|
+
ssStart, esi: recoveredIndex, ssId,
|
|
164
|
+
transmittedDigestHex: hex(transmittedDigest), digestHex: hex(recoveredDigest),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// 7.2.7 step 1 drops. Each record is validly signed and passes every check
|
|
168
|
+
// but the named one under its `receiver`; a verifier that skipped that one
|
|
169
|
+
// check would accept it. `isolated: false` marks the one that cannot be
|
|
170
|
+
// (a truncated record also breaks its count and its signature; an unknown
|
|
171
|
+
// kid leaves no key to check the signature with).
|
|
172
|
+
const baseReceiver = {
|
|
173
|
+
keys: [{ kid: 1, publicKeyHex: hex(publicKey), firstEpoch: 1 }],
|
|
174
|
+
minEpoch: 17,
|
|
175
|
+
acceptedHashAlgs: [1],
|
|
176
|
+
nowUnixMs: anchorHdr.sent * 1000,
|
|
177
|
+
maxAuthDelayMs: 200,
|
|
178
|
+
catalogCtxHex: cases[0].ctxHex,
|
|
179
|
+
budgetTokens: 64,
|
|
180
|
+
};
|
|
181
|
+
const anchorDigests = anchorDatagrams.map((d) => digest(anchorEp, d));
|
|
182
|
+
const c0 = ctxOf(anchorCtx);
|
|
183
|
+
function negative(id, reason, { hdr = {}, digests = anchorDigests, receiver = {}, mutate, isolated = true }) {
|
|
184
|
+
let rec = record(anchorEp, { ...anchorHdr, ctx: c0, ...hdr }, digests);
|
|
185
|
+
if (mutate) rec = mutate(rec);
|
|
186
|
+
return {
|
|
187
|
+
id, step: '7.2.7 step 1', reason, isolated, endpoint: anchorEp,
|
|
188
|
+
receiver: { ...baseReceiver, ...receiver }, recordHex: hex(rec),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const maxDigests = Array(37).fill(anchorDigests[0]);
|
|
192
|
+
const negatives = [
|
|
193
|
+
negative('magic', 'magic', { hdr: { magic: 'MHM1' } }),
|
|
194
|
+
negative('length-short', 'length', { digests: [] }),
|
|
195
|
+
negative('length-long', 'length', { digests: [...maxDigests, anchorDigests[1]] }),
|
|
196
|
+
negative('length-misaligned', 'length', { mutate: (r) => r.subarray(0, 195), isolated: false }),
|
|
197
|
+
negative('count', 'count', { hdr: { count: 3 } }),
|
|
198
|
+
negative('hash-alg-not-suite-id', 'hash_alg', { hdr: { hashAlg: 64 } }),
|
|
199
|
+
negative('hash-alg-truncated-suite', 'hash_alg', { hdr: { hashAlg: 2 } }),
|
|
200
|
+
negative('kid-unknown', 'kid', { hdr: { kid: 9 }, isolated: false }), // no key to verify with
|
|
201
|
+
negative('epoch-outside-kid-range', 'epoch', {
|
|
202
|
+
receiver: { keys: [...baseReceiver.keys, { kid: 2, publicKeyHex: hex(publicKey), firstEpoch: 17 }], minEpoch: 1 },
|
|
203
|
+
}),
|
|
204
|
+
negative('epoch-below-min-epoch', 'epoch', { receiver: { minEpoch: 18 } }),
|
|
205
|
+
negative('mseq-floor', 'mseq', { hdr: { mseq: 36 }, receiver: { highestMseq: { kid: 1, epoch: 17, mseq: 100 } } }),
|
|
206
|
+
negative('sent-behind', 'sent', { receiver: { nowUnixMs: anchorHdr.sent * 1000 + 7000 + 200 + 1 } }),
|
|
207
|
+
negative('sent-ahead', 'sent', { receiver: { nowUnixMs: anchorHdr.sent * 1000 - 6000 - 1 } }),
|
|
208
|
+
negative('ctx-mismatch', 'ctx', { receiver: { catalogCtxHex: hex(Buffer.alloc(32, 0xff)) } }),
|
|
209
|
+
negative('budget-empty', 'budget', { receiver: { budgetTokens: 0 } }),
|
|
210
|
+
negative('signature', 'signature', { mutate: (r) => { const b = Buffer.from(r); b[b.length - 1] ^= 1; return b; } }),
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
function boundary(id, receiver) {
|
|
214
|
+
return {
|
|
215
|
+
id, endpoint: anchorEp,
|
|
216
|
+
receiver: { ...baseReceiver, ...receiver },
|
|
217
|
+
recordHex: hex(record(anchorEp, { ...anchorHdr, ctx: c0 }, anchorDigests)),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const boundaries = [
|
|
222
|
+
boundary('sent-behind-exact', {
|
|
223
|
+
nowUnixMs: anchorHdr.sent * 1000 + 7000 + baseReceiver.maxAuthDelayMs,
|
|
224
|
+
}),
|
|
225
|
+
boundary('sent-ahead-exact', {
|
|
226
|
+
nowUnixMs: anchorHdr.sent * 1000 - 6000,
|
|
227
|
+
}),
|
|
228
|
+
boundary('mseq-floor-exact', {
|
|
229
|
+
highestMseq: { kid: 1, epoch: 17, mseq: 100 },
|
|
230
|
+
}),
|
|
231
|
+
];
|
|
232
|
+
boundaries[2].recordHex = hex(record(anchorEp,
|
|
233
|
+
{ ...anchorHdr, ctx: c0, mseq: 37 }, anchorDigests));
|
|
234
|
+
// Epoch 16 is the top of kid 1's range [1, 17) once kid 2 starts at 17.
|
|
235
|
+
boundaries.push(boundary('epoch-kid-range-top', {
|
|
236
|
+
keys: [...baseReceiver.keys, { kid: 2, publicKeyHex: hex(publicKey), firstEpoch: 17 }], minEpoch: 16,
|
|
237
|
+
}));
|
|
238
|
+
boundaries[3].recordHex = hex(record(anchorEp, { ...anchorHdr, ctx: c0, epoch: 16 }, anchorDigests));
|
|
239
|
+
|
|
240
|
+
const out = {
|
|
241
|
+
version: 2,
|
|
242
|
+
profile: 'bc-provenance',
|
|
243
|
+
draft: 'draft-ramadan-moq-multicast-01',
|
|
244
|
+
draftCommit: DRAFT_COMMIT,
|
|
245
|
+
hashAlg: 1,
|
|
246
|
+
key: { seedHex: hex(seed), publicKeyHex: hex(publicKey) },
|
|
247
|
+
cases,
|
|
248
|
+
recovered: recoveredCase,
|
|
249
|
+
negatives,
|
|
250
|
+
boundaries,
|
|
251
|
+
};
|
|
252
|
+
writeFileSync(join(here, 'bc-provenance-v2.json'), `${JSON.stringify(out, null, 2)}\n`);
|
package/dist/fec-codec.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic FEC codec interface. Transport-agnostic, algorithm-pluggable.
|
|
3
|
-
* Implementations: NoneCodec (passthrough), RaptorQCodec (wraps WASM),
|
|
4
|
-
* ReedSolomonCodec (placeholder).
|
|
5
|
-
*/
|
|
6
|
-
export interface FecCodec {
|
|
7
|
-
readonly algorithm: 'raptorq' | 'reed-solomon' | 'none';
|
|
8
|
-
addSymbol(blockId: number, symbolId: number, data: Uint8Array, isRepair: boolean): Uint8Array | null;
|
|
9
|
-
configure(params: Uint8Array): void;
|
|
10
|
-
cleanup(now: number): Uint8Array;
|
|
11
|
-
}
|
|
12
|
-
/** Passthrough codec for reliable transports (QUIC streams). Returns data immediately. */
|
|
13
|
-
export declare class NoneCodec implements FecCodec {
|
|
14
|
-
readonly algorithm: "none";
|
|
15
|
-
addSymbol(_blockId: number, _symbolId: number, data: Uint8Array, _isRepair: boolean): Uint8Array | null;
|
|
16
|
-
configure(_params: Uint8Array): void;
|
|
17
|
-
cleanup(_now: number): Uint8Array;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Create a FecCodec from a catalog algorithm name.
|
|
21
|
-
* RaptorQ is not returned here — it requires a WASM module and is injected
|
|
22
|
-
* via FECManager.setFecDecoder(). This factory covers non-WASM codecs.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createFecCodec(algorithm: string): FecCodec;
|
|
25
|
-
/** Placeholder for Reed-Solomon GF(2^8) per RFC 5510. Not yet implemented. */
|
|
26
|
-
export declare class ReedSolomonCodec implements FecCodec {
|
|
27
|
-
readonly algorithm: "reed-solomon";
|
|
28
|
-
addSymbol(_blockId: number, _symbolId: number, _data: Uint8Array, _isRepair: boolean): Uint8Array | null;
|
|
29
|
-
configure(_params: Uint8Array): void;
|
|
30
|
-
cleanup(_now: number): Uint8Array;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=fec-codec.d.ts.map
|
package/dist/fec-codec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fec-codec.d.ts","sourceRoot":"","sources":["../src/fec-codec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,GAAG,MAAM,CAAA;IACvD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAAA;IACpG,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAA;IACnC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CACjC;AAED,0FAA0F;AAC1F,qBAAa,SAAU,YAAW,QAAQ;IACxC,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAS;IAEpC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI;IAIvG,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAEpC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;CAGlC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAa1D;AAED,8EAA8E;AAC9E,qBAAa,gBAAiB,YAAW,QAAQ;IAC/C,QAAQ,CAAC,SAAS,EAAG,cAAc,CAAS;IAE5C,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI;IAIxG,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAEpC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;CAGlC"}
|