@svta/cml-drm 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,8 +5,7 @@ import { getElementsByName, parseXml } from "@svta/cml-xml";
5
5
  /**
6
6
  * Cipher Block Chaining Sample encryption scheme.
7
7
  *
8
- *
9
- * @beta
8
+ * @public
10
9
  */
11
10
  const CBCS = "cbcs";
12
11
 
@@ -15,8 +14,7 @@ const CBCS = "cbcs";
15
14
  /**
16
15
  * Common Encryption scheme.
17
16
  *
18
- *
19
- * @beta
17
+ * @public
20
18
  */
21
19
  const CENC = "cenc";
22
20
 
@@ -25,7 +23,7 @@ const CENC = "cenc";
25
23
  /**
26
24
  * The DASH MP4 Protection Scheme schemeIdUri.
27
25
  *
28
- * @beta
26
+ * @public
29
27
  */
30
28
  const MP4_PROTECTION_SCHEME = "urn:mpeg:dash:mp4protection:2011";
31
29
 
@@ -37,7 +35,7 @@ const MP4_PROTECTION_SCHEME = "urn:mpeg:dash:mp4protection:2011";
37
35
  * @param cpArray - Array of ContentProtection elements.
38
36
  * @returns The Common Encryption content protection element, or null if not found.
39
37
  *
40
- * @beta
38
+ * @public
41
39
  *
42
40
  * @example
43
41
  * {@includeCode ../../test/cenc/findCencContentProtection.test.ts#example}
@@ -57,7 +55,7 @@ function findCencContentProtection(cpArray) {
57
55
  * @param schemeIdUri - schemeIdUri we are searching for.
58
56
  * @returns The license server URL, and if not found then null.
59
57
  *
60
- * @beta
58
+ * @public
61
59
  *
62
60
  * @example
63
61
  * {@includeCode ../../test/cenc/getLicenseServerUrlFromContentProtection.test.ts#example}
@@ -74,7 +72,7 @@ function getLicenseServerUrlFromContentProtection(contentProtectionElements, sch
74
72
  * @param pssh - The PSSH ArrayBuffer.
75
73
  * @returns The data portion of the PSSH.
76
74
  *
77
- * @beta
75
+ * @public
78
76
  *
79
77
  * @example
80
78
  * {@includeCode ../../test/cenc/getPsshData.test.ts#example}
@@ -103,7 +101,7 @@ function getPsshData(pssh) {
103
101
  * the detected key system UUIDs (e.g. 00000000-0000-0000-0000-0000000000)
104
102
  * and a ArrayBuffer (the entire PSSH box) as the property value
105
103
  *
106
- * @beta
104
+ * @public
107
105
  *
108
106
  * @example
109
107
  * {@includeCode ../../test/cenc/parsePsshList.test.ts#example}
@@ -180,7 +178,7 @@ function parsePsshList(data) {
180
178
  * @param initData - 'cenc' initialization data. Concatenated list of PSSH boxes.
181
179
  * @returns The PSSH box ArrayBuffer corresponding to the given key system, or null if not found.
182
180
  *
183
- * @beta
181
+ * @public
184
182
  *
185
183
  * @example
186
184
  * {@includeCode ../../test/cenc/getPsshForKeySystem.test.ts#example}
@@ -200,7 +198,7 @@ function getPsshForKeySystem(uuid, initData) {
200
198
  * @param BASE64 - The BASE64 reference.
201
199
  * @returns init data as an ArrayBuffer, or null if not found.
202
200
  *
203
- * @beta
201
+ * @public
204
202
  *
205
203
  * @example
206
204
  * {@includeCode ../../test/cenc/parseInitDataFromContentProtection.test.ts#example}
@@ -222,7 +220,7 @@ function parseInitDataFromContentProtection(cpData, BASE64) {
222
220
  * @param supportedVideo - supported video capabilities.
223
221
  * @returns KeySystemConfiguration object.
224
222
  *
225
- * @beta
223
+ * @public
226
224
  *
227
225
  * @example
228
226
  * {@includeCode ../../test/keysystem/createMediaKeySystemConfiguration.test.ts#example}
@@ -245,7 +243,7 @@ function createMediaKeySystemConfiguration(supportedAudio, supportedVideo) {
245
243
  * @param requests - An array of key system access requests.
246
244
  * @returns MediaKeySystemAccess object if successful, or null if no system is supported.
247
245
  *
248
- * @beta
246
+ * @public
249
247
  */
250
248
  async function getKeySystemAccess(requests) {
251
249
  for (const { keySystem, configurations } of requests) try {
@@ -264,7 +262,7 @@ const isTypeSupported = typeof MediaKeys !== "undefined" && typeof MediaKeys.isT
264
262
  * @param configs - An array of key system configurations.
265
263
  * @returns The first supported configuration or null if none are supported.
266
264
  *
267
- * @beta
265
+ * @public
268
266
  */
269
267
  function getSupportedKeySystemConfiguration(keySystem, configs) {
270
268
  if (!configs || typeof isTypeSupported === "undefined") return {
@@ -297,7 +295,7 @@ function getSupportedKeySystemConfiguration(keySystem, configs) {
297
295
  * @param requests - An array of key system access requests.
298
296
  * @returns A KeySystemAccess object if successful, or null if no system is supported.
299
297
  *
300
- * @beta
298
+ * @public
301
299
  */
302
300
  function getLegacyKeySystemAccess(requests) {
303
301
  for (const { keySystem, configurations } of requests) {
@@ -320,7 +318,7 @@ function getLegacyKeySystemAccess(requests) {
320
318
  * @param cert - The application certificate (Uint8Array)
321
319
  * @returns A Uint8Array containing the concatenated data
322
320
  *
323
- * @beta
321
+ * @public
324
322
  *
325
323
  * @example
326
324
  * {@includeCode ../../test/fairplay/concatInitDataIdAndCertificate.test.ts#example}
@@ -350,7 +348,7 @@ function concatInitDataIdAndCertificate(initData, id, cert) {
350
348
  * @param response - The license response, either a base64 string or ArrayBuffer
351
349
  * @returns A Uint8Array containing the decoded license
352
350
  *
353
- * @beta
351
+ * @public
354
352
  *
355
353
  * @example
356
354
  * {@includeCode ../../test/fairplay/decodeFairPlayLicense.test.ts#example}
@@ -367,7 +365,7 @@ function decodeFairPlayLicense(response) {
367
365
  * @param initData - The initialization data (PSSH box)
368
366
  * @returns The extracted content ID
369
367
  *
370
- * @beta
368
+ * @public
371
369
  *
372
370
  * @example
373
371
  * {@includeCode ../../test/fairplay/extractContentId.test.ts#example}
@@ -386,7 +384,7 @@ function extractContentId(initData, encoding = UTF_16) {
386
384
  * @param queryParam - The query parameter key to extract (default: 'ContentId')
387
385
  * @returns The extracted content ID as a string or null if not found
388
386
  *
389
- * @beta
387
+ * @public
390
388
  *
391
389
  * @example
392
390
  * {@includeCode ../../test/fairplay/getId.test.ts#example}
@@ -408,7 +406,7 @@ function getId(licenseServerUrl, initData, queryParam = "ContentId") {
408
406
  * @param initData - The initialization data (PSSH box)
409
407
  * @returns The license server URL as a string
410
408
  *
411
- * @beta
409
+ * @public
412
410
  *
413
411
  * @example
414
412
  * {@includeCode ../../test/fairplay/getLicenseServerUrl.test.ts#example}
@@ -425,8 +423,7 @@ function getLicenseServerUrl(initData) {
425
423
  /**
426
424
  * License Challenge.
427
425
  *
428
- *
429
- * @beta
426
+ * @public
430
427
  */
431
428
  const CHALLENGE = "Challenge";
432
429
 
@@ -435,8 +432,7 @@ const CHALLENGE = "Challenge";
435
432
  /**
436
433
  * Playready Key Message.
437
434
  *
438
- *
439
- * @beta
435
+ * @public
440
436
  */
441
437
  const PLAYREADY_KEY_MESSAGE = "PlayReadyKeyMessage";
442
438
 
@@ -449,7 +445,7 @@ const PLAYREADY_KEY_MESSAGE = "PlayReadyKeyMessage";
449
445
  * @param encoding - The message encoding type. Default is UTF-16.
450
446
  * @returns The license request as an ArrayBuffer.
451
447
  *
452
- * @beta
448
+ * @public
453
449
  *
454
450
  * @example
455
451
  * {@includeCode ../../test/playready/getLicenseRequestFromMessage.test.ts#example}
@@ -468,8 +464,7 @@ function getLicenseRequestFromMessage(message, encoding = UTF_16) {
468
464
  /**
469
465
  * Content-Type header.
470
466
  *
471
- *
472
- * @beta
467
+ * @public
473
468
  */
474
469
  const CONTENT_TYPE = "Content-Type";
475
470
 
@@ -478,8 +473,7 @@ const CONTENT_TYPE = "Content-Type";
478
473
  /**
479
474
  * Playready HTTP Headers.
480
475
  *
481
- *
482
- * @beta
476
+ * @public
483
477
  */
484
478
  const HTTP_HEADERS = "HttpHeaders";
485
479
 
@@ -488,8 +482,7 @@ const HTTP_HEADERS = "HttpHeaders";
488
482
  /**
489
483
  * XML formatted, UTF-8 encoded, text header.
490
484
  *
491
- *
492
- * @beta
485
+ * @public
493
486
  */
494
487
  const TEXT_XML_UTF8 = "text/xml; charset=utf-8";
495
488
 
@@ -502,7 +495,7 @@ const TEXT_XML_UTF8 = "text/xml; charset=utf-8";
502
495
  * @param encoding - The message encoding type. Default is UTF-16.
503
496
  * @returns Request headers.
504
497
  *
505
- * @beta
498
+ * @public
506
499
  *
507
500
  * @example
508
501
  * {@includeCode ../../test/playready/getRequestHeadersFromMessage.test.ts#example}
@@ -536,7 +529,7 @@ function getRequestHeadersFromMessage(message, encoding = UTF_16) {
536
529
  * @param keyId - The little-endian key ID to convert.
537
530
  * @returns The big-endian representation of the key ID.
538
531
  *
539
- * @beta
532
+ * @public
540
533
  *
541
534
  * @example
542
535
  * {@includeCode ../../test/playready/toBigEndianKeyId.test.ts#example}
@@ -556,8 +549,7 @@ function toBigEndianKeyId(keyId) {
556
549
  /**
557
550
  * Clear Key System.
558
551
  *
559
- *
560
- * @beta
552
+ * @public
561
553
  */
562
554
  const CLEAR_KEY_SYSTEM = "org.w3.clearkey";
563
555
 
@@ -566,8 +558,7 @@ const CLEAR_KEY_SYSTEM = "org.w3.clearkey";
566
558
  /**
567
559
  * Clear Key UUID.
568
560
  *
569
- *
570
- * @beta
561
+ * @public
571
562
  */
572
563
  const CLEAR_KEY_UUID = "e2719d58-a985-b3c9-781a-b030af78d30e";
573
564
 
@@ -576,8 +567,7 @@ const CLEAR_KEY_UUID = "e2719d58-a985-b3c9-781a-b030af78d30e";
576
567
  /**
577
568
  * Encryption schemes.
578
569
  *
579
- *
580
- * @beta
570
+ * @public
581
571
  */
582
572
  const EncryptionScheme = {
583
573
  CENC,
@@ -589,8 +579,7 @@ const EncryptionScheme = {
589
579
  /**
590
580
  * Expired Media Key Status.
591
581
  *
592
- *
593
- * @beta
582
+ * @public
594
583
  */
595
584
  const EXPIRED = "expired";
596
585
 
@@ -599,8 +588,7 @@ const EXPIRED = "expired";
599
588
  /**
600
589
  * FairPlay Key System.
601
590
  *
602
- *
603
- * @beta
591
+ * @public
604
592
  */
605
593
  const FAIRPLAY_KEY_SYSTEM = "com.apple.fps.1_0";
606
594
 
@@ -609,8 +597,7 @@ const FAIRPLAY_KEY_SYSTEM = "com.apple.fps.1_0";
609
597
  /**
610
598
  * FairPlay UUID.
611
599
  *
612
- *
613
- * @beta
600
+ * @public
614
601
  */
615
602
  const FAIRPLAY_UUID = "29701fe4-3cc7-4a34-8c5b-ae90c7439a47";
616
603
 
@@ -619,8 +606,7 @@ const FAIRPLAY_UUID = "29701fe4-3cc7-4a34-8c5b-ae90c7439a47";
619
606
  /**
620
607
  * Hardware Secure All Robustness.
621
608
  *
622
- *
623
- * @beta
609
+ * @public
624
610
  */
625
611
  const HW_SECURE_ALL = "HW_SECURE_ALL";
626
612
 
@@ -629,8 +615,7 @@ const HW_SECURE_ALL = "HW_SECURE_ALL";
629
615
  /**
630
616
  * Hardware Secure Crypto Robustness.
631
617
  *
632
- *
633
- * @beta
618
+ * @public
634
619
  */
635
620
  const HW_SECURE_CRYPTO = "HW_SECURE_CRYPTO";
636
621
 
@@ -639,8 +624,7 @@ const HW_SECURE_CRYPTO = "HW_SECURE_CRYPTO";
639
624
  /**
640
625
  * Hardware Secure Decode Robustness.
641
626
  *
642
- *
643
- * @beta
627
+ * @public
644
628
  */
645
629
  const HW_SECURE_DECODE = "HW_SECURE_DECODE";
646
630
 
@@ -649,8 +633,7 @@ const HW_SECURE_DECODE = "HW_SECURE_DECODE";
649
633
  /**
650
634
  * Individualization Request.
651
635
  *
652
- *
653
- * @beta
636
+ * @public
654
637
  */
655
638
  const INDIVIDUALIZATION_REQUEST = "individualization-request";
656
639
 
@@ -659,8 +642,7 @@ const INDIVIDUALIZATION_REQUEST = "individualization-request";
659
642
  /**
660
643
  * Key IDs.
661
644
  *
662
- *
663
- * @beta
645
+ * @public
664
646
  */
665
647
  const KEYIDS = "keyids";
666
648
 
@@ -669,8 +651,7 @@ const KEYIDS = "keyids";
669
651
  /**
670
652
  * WEBM.
671
653
  *
672
- *
673
- * @beta
654
+ * @public
674
655
  */
675
656
  const WEBM = "webm";
676
657
 
@@ -679,8 +660,7 @@ const WEBM = "webm";
679
660
  /**
680
661
  * Initialization Data Type.
681
662
  *
682
- *
683
- * @beta
663
+ * @public
684
664
  */
685
665
  const InitializationDataType = {
686
666
  CENC,
@@ -694,8 +674,7 @@ const InitializationDataType = {
694
674
  /**
695
675
  * Internal Error Media Key Status.
696
676
  *
697
- *
698
- * @beta
677
+ * @public
699
678
  */
700
679
  const INTERNAL_ERROR = "internal-error";
701
680
 
@@ -704,8 +683,7 @@ const INTERNAL_ERROR = "internal-error";
704
683
  /**
705
684
  * License Acquisition.
706
685
  *
707
- *
708
- * @beta
686
+ * @public
709
687
  */
710
688
  const LICENSE_ACQUISITION = "LicenseAcquisition";
711
689
 
@@ -714,8 +692,7 @@ const LICENSE_ACQUISITION = "LicenseAcquisition";
714
692
  /**
715
693
  * License Release.
716
694
  *
717
- *
718
- * @beta
695
+ * @public
719
696
  */
720
697
  const LICENSE_RELEASE = "license-release";
721
698
 
@@ -724,8 +701,7 @@ const LICENSE_RELEASE = "license-release";
724
701
  /**
725
702
  * License Renewal.
726
703
  *
727
- *
728
- * @beta
704
+ * @public
729
705
  */
730
706
  const LICENSE_RENEWAL = "license-renewal";
731
707
 
@@ -734,8 +710,7 @@ const LICENSE_RENEWAL = "license-renewal";
734
710
  /**
735
711
  * License Request.
736
712
  *
737
- *
738
- * @beta
713
+ * @public
739
714
  */
740
715
  const LICENSE_REQUEST = "license-request";
741
716
 
@@ -744,8 +719,7 @@ const LICENSE_REQUEST = "license-request";
744
719
  /**
745
720
  * Media Key Message Types.
746
721
  *
747
- *
748
- * @beta
722
+ * @public
749
723
  */
750
724
  const MediaKeyMessageType = {
751
725
  LICENSE_REQUEST,
@@ -759,8 +733,7 @@ const MediaKeyMessageType = {
759
733
  /**
760
734
  * Output Downscaled Media Key Status.
761
735
  *
762
- *
763
- * @beta
736
+ * @public
764
737
  */
765
738
  const OUTPUT_DOWNSCALED = "output-downscaled";
766
739
 
@@ -769,8 +742,7 @@ const OUTPUT_DOWNSCALED = "output-downscaled";
769
742
  /**
770
743
  * Output Restricted Media Key Status.
771
744
  *
772
- *
773
- * @beta
745
+ * @public
774
746
  */
775
747
  const OUTPUT_RESTRICTED = "output-restricted";
776
748
 
@@ -779,8 +751,7 @@ const OUTPUT_RESTRICTED = "output-restricted";
779
751
  /**
780
752
  * Released Media Key Status.
781
753
  *
782
- *
783
- * @beta
754
+ * @public
784
755
  */
785
756
  const RELEASED = "released";
786
757
 
@@ -789,8 +760,7 @@ const RELEASED = "released";
789
760
  /**
790
761
  * Status Pending Media Key Status.
791
762
  *
792
- *
793
- * @beta
763
+ * @public
794
764
  */
795
765
  const STATUS_PENDING = "status-pending";
796
766
 
@@ -799,8 +769,7 @@ const STATUS_PENDING = "status-pending";
799
769
  /**
800
770
  * Usable Media Key Status.
801
771
  *
802
- *
803
- * @beta
772
+ * @public
804
773
  */
805
774
  const USABLE = "usable";
806
775
 
@@ -809,8 +778,7 @@ const USABLE = "usable";
809
778
  /**
810
779
  * Media Key Statuses.
811
780
  *
812
- *
813
- * @beta
781
+ * @public
814
782
  */
815
783
  const MediaKeyStatus = {
816
784
  USABLE,
@@ -827,8 +795,7 @@ const MediaKeyStatus = {
827
795
  /**
828
796
  * Playready Key System.
829
797
  *
830
- *
831
- * @beta
798
+ * @public
832
799
  */
833
800
  const PLAYREADY_KEY_SYSTEM = "com.microsoft.playready";
834
801
 
@@ -837,8 +804,7 @@ const PLAYREADY_KEY_SYSTEM = "com.microsoft.playready";
837
804
  /**
838
805
  * Playready Recommendation Key System.
839
806
  *
840
- *
841
- * @beta
807
+ * @public
842
808
  */
843
809
  const PLAYREADY_RECOMMENDATION_KEY_SYSTEM = "com.microsoft.playready.recommendation";
844
810
 
@@ -847,8 +813,7 @@ const PLAYREADY_RECOMMENDATION_KEY_SYSTEM = "com.microsoft.playready.recommendat
847
813
  /**
848
814
  * Playready UUID.
849
815
  *
850
- *
851
- * @beta
816
+ * @public
852
817
  */
853
818
  const PLAYREADY_UUID = "9a04f079-9840-4286-ab92-e65be0885f95";
854
819
 
@@ -857,8 +822,7 @@ const PLAYREADY_UUID = "9a04f079-9840-4286-ab92-e65be0885f95";
857
822
  /**
858
823
  * Software Secure Crypto Robustness.
859
824
  *
860
- *
861
- * @beta
825
+ * @public
862
826
  */
863
827
  const SW_SECURE_CRYPTO = "SW_SECURE_CRYPTO";
864
828
 
@@ -867,8 +831,7 @@ const SW_SECURE_CRYPTO = "SW_SECURE_CRYPTO";
867
831
  /**
868
832
  * Software Secure Decode Robustness.
869
833
  *
870
- *
871
- * @beta
834
+ * @public
872
835
  */
873
836
  const SW_SECURE_DECODE = "SW_SECURE_DECODE";
874
837
 
@@ -877,8 +840,7 @@ const SW_SECURE_DECODE = "SW_SECURE_DECODE";
877
840
  /**
878
841
  * W3C Clear Key UUID.
879
842
  *
880
- *
881
- * @beta
843
+ * @public
882
844
  */
883
845
  const W3C_CLEAR_KEY_UUID = "1077efec-c0b2-4d02-ace3-3c1e52e2fb4b";
884
846
 
@@ -887,8 +849,7 @@ const W3C_CLEAR_KEY_UUID = "1077efec-c0b2-4d02-ace3-3c1e52e2fb4b";
887
849
  /**
888
850
  * Widevine Key System.
889
851
  *
890
- *
891
- * @beta
852
+ * @public
892
853
  */
893
854
  const WIDEVINE_KEY_SYSTEM = "com.widevine.alpha";
894
855
 
@@ -897,8 +858,7 @@ const WIDEVINE_KEY_SYSTEM = "com.widevine.alpha";
897
858
  /**
898
859
  * Widevine UUID.
899
860
  *
900
- *
901
- * @beta
861
+ * @public
902
862
  */
903
863
  const WIDEVINE_UUID = "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
904
864
 
@@ -907,8 +867,7 @@ const WIDEVINE_UUID = "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
907
867
  /**
908
868
  * Widevine Robustness.
909
869
  *
910
- *
911
- * @beta
870
+ * @public
912
871
  */
913
872
  const WidevineRobustness = {
914
873
  SW_SECURE_CRYPTO,