@matter/protocol 0.15.0-alpha.0-20250616-4b3754906 → 0.15.0-alpha.0-20250619-df2264f15

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 (207) hide show
  1. package/dist/cjs/certificate/AttestationCertificateManager.d.ts.map +1 -1
  2. package/dist/cjs/certificate/AttestationCertificateManager.js +26 -22
  3. package/dist/cjs/certificate/AttestationCertificateManager.js.map +1 -1
  4. package/dist/cjs/certificate/CertificateAuthority.d.ts +1 -2
  5. package/dist/cjs/certificate/CertificateAuthority.d.ts.map +1 -1
  6. package/dist/cjs/certificate/CertificateAuthority.js +22 -29
  7. package/dist/cjs/certificate/CertificateAuthority.js.map +1 -1
  8. package/dist/cjs/certificate/DeviceCertification.d.ts.map +1 -1
  9. package/dist/cjs/certificate/DeviceCertification.js +2 -6
  10. package/dist/cjs/certificate/DeviceCertification.js.map +1 -1
  11. package/dist/cjs/certificate/index.d.ts +7 -2
  12. package/dist/cjs/certificate/index.d.ts.map +1 -1
  13. package/dist/cjs/certificate/index.js +14 -2
  14. package/dist/cjs/certificate/index.js.map +1 -1
  15. package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts +34 -0
  16. package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts.map +1 -0
  17. package/dist/cjs/certificate/kinds/AttestationCertificates.js +64 -0
  18. package/dist/cjs/certificate/kinds/AttestationCertificates.js.map +6 -0
  19. package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts +23 -0
  20. package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts.map +1 -0
  21. package/dist/cjs/certificate/kinds/CertificationDeclaration.js +86 -0
  22. package/dist/cjs/certificate/kinds/CertificationDeclaration.js.map +6 -0
  23. package/dist/cjs/certificate/kinds/Icac.d.ts +29 -0
  24. package/dist/cjs/certificate/kinds/Icac.d.ts.map +1 -0
  25. package/dist/cjs/certificate/kinds/Icac.js +138 -0
  26. package/dist/cjs/certificate/kinds/Icac.js.map +6 -0
  27. package/dist/cjs/certificate/kinds/Noc.d.ts +27 -0
  28. package/dist/cjs/certificate/kinds/Noc.d.ts.map +1 -0
  29. package/dist/cjs/certificate/kinds/Noc.js +148 -0
  30. package/dist/cjs/certificate/kinds/Noc.js.map +6 -0
  31. package/dist/cjs/certificate/kinds/OperationalBase.d.ts +24 -0
  32. package/dist/cjs/certificate/kinds/OperationalBase.d.ts.map +1 -0
  33. package/dist/cjs/certificate/kinds/OperationalBase.js +68 -0
  34. package/dist/cjs/certificate/kinds/OperationalBase.js.map +6 -0
  35. package/dist/cjs/certificate/kinds/Rcac.d.ts +25 -0
  36. package/dist/cjs/certificate/kinds/Rcac.d.ts.map +1 -0
  37. package/dist/cjs/certificate/kinds/Rcac.js +119 -0
  38. package/dist/cjs/certificate/kinds/Rcac.js.map +6 -0
  39. package/dist/cjs/certificate/kinds/X509Base.d.ts +92 -0
  40. package/dist/cjs/certificate/kinds/X509Base.d.ts.map +1 -0
  41. package/dist/cjs/certificate/kinds/X509Base.js +344 -0
  42. package/dist/cjs/certificate/kinds/X509Base.js.map +6 -0
  43. package/dist/cjs/certificate/kinds/common.d.ts +18 -0
  44. package/dist/cjs/certificate/kinds/common.d.ts.map +1 -0
  45. package/dist/cjs/certificate/kinds/common.js +42 -0
  46. package/dist/cjs/certificate/kinds/common.js.map +6 -0
  47. package/dist/cjs/certificate/kinds/definitions/asn.d.ts +25 -0
  48. package/dist/cjs/certificate/kinds/definitions/asn.d.ts.map +1 -0
  49. package/dist/cjs/certificate/kinds/definitions/asn.js +83 -0
  50. package/dist/cjs/certificate/kinds/definitions/asn.js.map +6 -0
  51. package/dist/cjs/certificate/kinds/definitions/attestation.d.ts +44 -0
  52. package/dist/cjs/certificate/kinds/definitions/attestation.d.ts.map +1 -0
  53. package/dist/cjs/certificate/kinds/definitions/attestation.js +22 -0
  54. package/dist/cjs/certificate/kinds/definitions/attestation.js.map +6 -0
  55. package/dist/cjs/certificate/kinds/definitions/base.d.ts +52 -0
  56. package/dist/cjs/certificate/kinds/definitions/base.d.ts.map +1 -0
  57. package/dist/cjs/certificate/kinds/definitions/base.js +43 -0
  58. package/dist/cjs/certificate/kinds/definitions/base.js.map +6 -0
  59. package/dist/cjs/certificate/kinds/definitions/certification-declaration.d.ts +18 -0
  60. package/dist/cjs/certificate/kinds/definitions/certification-declaration.d.ts.map +1 -0
  61. package/dist/cjs/certificate/kinds/definitions/certification-declaration.js +50 -0
  62. package/dist/cjs/certificate/kinds/definitions/certification-declaration.js.map +6 -0
  63. package/dist/cjs/certificate/kinds/definitions/operational.d.ts +368 -0
  64. package/dist/cjs/certificate/kinds/definitions/operational.d.ts.map +1 -0
  65. package/dist/cjs/certificate/kinds/definitions/operational.js +149 -0
  66. package/dist/cjs/certificate/kinds/definitions/operational.js.map +6 -0
  67. package/dist/cjs/certificate/kinds/index.d.ts +12 -0
  68. package/dist/cjs/certificate/kinds/index.d.ts.map +1 -0
  69. package/dist/cjs/certificate/kinds/index.js +29 -0
  70. package/dist/cjs/certificate/kinds/index.js.map +6 -0
  71. package/dist/cjs/fabric/Fabric.d.ts +1 -2
  72. package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
  73. package/dist/cjs/fabric/Fabric.js +28 -31
  74. package/dist/cjs/fabric/Fabric.js.map +1 -1
  75. package/dist/cjs/peer/ControllerCommissioningFlow.d.ts.map +1 -1
  76. package/dist/cjs/peer/ControllerCommissioningFlow.js +2 -1
  77. package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
  78. package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
  79. package/dist/cjs/session/case/CaseClient.js +3 -3
  80. package/dist/cjs/session/case/CaseClient.js.map +1 -1
  81. package/dist/cjs/session/case/CaseServer.d.ts.map +1 -1
  82. package/dist/cjs/session/case/CaseServer.js +2 -2
  83. package/dist/cjs/session/case/CaseServer.js.map +1 -1
  84. package/dist/esm/certificate/AttestationCertificateManager.d.ts.map +1 -1
  85. package/dist/esm/certificate/AttestationCertificateManager.js +20 -16
  86. package/dist/esm/certificate/AttestationCertificateManager.js.map +1 -1
  87. package/dist/esm/certificate/CertificateAuthority.d.ts +1 -2
  88. package/dist/esm/certificate/CertificateAuthority.d.ts.map +1 -1
  89. package/dist/esm/certificate/CertificateAuthority.js +18 -30
  90. package/dist/esm/certificate/CertificateAuthority.js.map +1 -1
  91. package/dist/esm/certificate/DeviceCertification.d.ts.map +1 -1
  92. package/dist/esm/certificate/DeviceCertification.js +2 -6
  93. package/dist/esm/certificate/DeviceCertification.js.map +1 -1
  94. package/dist/esm/certificate/index.d.ts +7 -2
  95. package/dist/esm/certificate/index.d.ts.map +1 -1
  96. package/dist/esm/certificate/index.js +10 -2
  97. package/dist/esm/certificate/index.js.map +1 -1
  98. package/dist/esm/certificate/kinds/AttestationCertificates.d.ts +34 -0
  99. package/dist/esm/certificate/kinds/AttestationCertificates.d.ts.map +1 -0
  100. package/dist/esm/certificate/kinds/AttestationCertificates.js +44 -0
  101. package/dist/esm/certificate/kinds/AttestationCertificates.js.map +6 -0
  102. package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts +23 -0
  103. package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts.map +1 -0
  104. package/dist/esm/certificate/kinds/CertificationDeclaration.js +66 -0
  105. package/dist/esm/certificate/kinds/CertificationDeclaration.js.map +6 -0
  106. package/dist/esm/certificate/kinds/Icac.d.ts +29 -0
  107. package/dist/esm/certificate/kinds/Icac.d.ts.map +1 -0
  108. package/dist/esm/certificate/kinds/Icac.js +118 -0
  109. package/dist/esm/certificate/kinds/Icac.js.map +6 -0
  110. package/dist/esm/certificate/kinds/Noc.d.ts +27 -0
  111. package/dist/esm/certificate/kinds/Noc.d.ts.map +1 -0
  112. package/dist/esm/certificate/kinds/Noc.js +128 -0
  113. package/dist/esm/certificate/kinds/Noc.js.map +6 -0
  114. package/dist/esm/certificate/kinds/OperationalBase.d.ts +24 -0
  115. package/dist/esm/certificate/kinds/OperationalBase.d.ts.map +1 -0
  116. package/dist/esm/certificate/kinds/OperationalBase.js +48 -0
  117. package/dist/esm/certificate/kinds/OperationalBase.js.map +6 -0
  118. package/dist/esm/certificate/kinds/Rcac.d.ts +25 -0
  119. package/dist/esm/certificate/kinds/Rcac.d.ts.map +1 -0
  120. package/dist/esm/certificate/kinds/Rcac.js +99 -0
  121. package/dist/esm/certificate/kinds/Rcac.js.map +6 -0
  122. package/dist/esm/certificate/kinds/X509Base.d.ts +92 -0
  123. package/dist/esm/certificate/kinds/X509Base.d.ts.map +1 -0
  124. package/dist/esm/certificate/kinds/X509Base.js +347 -0
  125. package/dist/esm/certificate/kinds/X509Base.js.map +6 -0
  126. package/dist/esm/certificate/kinds/common.d.ts +18 -0
  127. package/dist/esm/certificate/kinds/common.d.ts.map +1 -0
  128. package/dist/esm/certificate/kinds/common.js +22 -0
  129. package/dist/esm/certificate/kinds/common.js.map +6 -0
  130. package/dist/esm/certificate/kinds/definitions/asn.d.ts +25 -0
  131. package/dist/esm/certificate/kinds/definitions/asn.d.ts.map +1 -0
  132. package/dist/esm/certificate/kinds/definitions/asn.js +63 -0
  133. package/dist/esm/certificate/kinds/definitions/asn.js.map +6 -0
  134. package/dist/esm/certificate/kinds/definitions/attestation.d.ts +44 -0
  135. package/dist/esm/certificate/kinds/definitions/attestation.d.ts.map +1 -0
  136. package/dist/esm/certificate/kinds/definitions/attestation.js +6 -0
  137. package/dist/esm/certificate/kinds/definitions/attestation.js.map +6 -0
  138. package/dist/esm/certificate/kinds/definitions/base.d.ts +52 -0
  139. package/dist/esm/certificate/kinds/definitions/base.d.ts.map +1 -0
  140. package/dist/esm/certificate/kinds/definitions/base.js +23 -0
  141. package/dist/esm/certificate/kinds/definitions/base.js.map +6 -0
  142. package/dist/esm/certificate/kinds/definitions/certification-declaration.d.ts +18 -0
  143. package/dist/esm/certificate/kinds/definitions/certification-declaration.d.ts.map +1 -0
  144. package/dist/esm/certificate/kinds/definitions/certification-declaration.js +41 -0
  145. package/dist/esm/certificate/kinds/definitions/certification-declaration.js.map +6 -0
  146. package/dist/esm/certificate/kinds/definitions/operational.d.ts +368 -0
  147. package/dist/esm/certificate/kinds/definitions/operational.d.ts.map +1 -0
  148. package/dist/esm/certificate/kinds/definitions/operational.js +148 -0
  149. package/dist/esm/certificate/kinds/definitions/operational.js.map +6 -0
  150. package/dist/esm/certificate/kinds/index.d.ts +12 -0
  151. package/dist/esm/certificate/kinds/index.d.ts.map +1 -0
  152. package/dist/esm/certificate/kinds/index.js +12 -0
  153. package/dist/esm/certificate/kinds/index.js.map +6 -0
  154. package/dist/esm/fabric/Fabric.d.ts +1 -2
  155. package/dist/esm/fabric/Fabric.d.ts.map +1 -1
  156. package/dist/esm/fabric/Fabric.js +28 -36
  157. package/dist/esm/fabric/Fabric.js.map +1 -1
  158. package/dist/esm/peer/ControllerCommissioningFlow.d.ts.map +1 -1
  159. package/dist/esm/peer/ControllerCommissioningFlow.js +2 -1
  160. package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
  161. package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
  162. package/dist/esm/session/case/CaseClient.js +3 -3
  163. package/dist/esm/session/case/CaseClient.js.map +1 -1
  164. package/dist/esm/session/case/CaseServer.d.ts.map +1 -1
  165. package/dist/esm/session/case/CaseServer.js +2 -2
  166. package/dist/esm/session/case/CaseServer.js.map +1 -1
  167. package/package.json +6 -6
  168. package/src/certificate/AttestationCertificateManager.ts +20 -16
  169. package/src/certificate/CertificateAuthority.ts +18 -35
  170. package/src/certificate/DeviceCertification.ts +2 -6
  171. package/src/certificate/index.ts +7 -2
  172. package/src/certificate/kinds/AttestationCertificates.ts +48 -0
  173. package/src/certificate/kinds/CertificationDeclaration.ts +91 -0
  174. package/src/certificate/kinds/Icac.ts +156 -0
  175. package/src/certificate/kinds/Noc.ts +164 -0
  176. package/src/certificate/kinds/OperationalBase.ts +72 -0
  177. package/src/certificate/kinds/Rcac.ts +126 -0
  178. package/src/certificate/kinds/X509Base.ts +380 -0
  179. package/src/certificate/kinds/common.ts +24 -0
  180. package/src/certificate/kinds/definitions/asn.ts +97 -0
  181. package/src/certificate/kinds/definitions/attestation.ts +46 -0
  182. package/src/certificate/kinds/definitions/base.ts +43 -0
  183. package/src/certificate/kinds/definitions/certification-declaration.ts +38 -0
  184. package/src/certificate/kinds/definitions/operational.ts +179 -0
  185. package/src/certificate/kinds/index.ts +12 -0
  186. package/src/fabric/Fabric.ts +28 -40
  187. package/src/peer/ControllerCommissioningFlow.ts +2 -1
  188. package/src/session/case/CaseClient.ts +3 -3
  189. package/src/session/case/CaseServer.ts +2 -2
  190. package/dist/cjs/certificate/CertificateManager.d.ts +0 -578
  191. package/dist/cjs/certificate/CertificateManager.d.ts.map +0 -1
  192. package/dist/cjs/certificate/CertificateManager.js +0 -843
  193. package/dist/cjs/certificate/CertificateManager.js.map +0 -6
  194. package/dist/cjs/certificate/CertificationDeclarationManager.d.ts +0 -11
  195. package/dist/cjs/certificate/CertificationDeclarationManager.d.ts.map +0 -1
  196. package/dist/cjs/certificate/CertificationDeclarationManager.js +0 -54
  197. package/dist/cjs/certificate/CertificationDeclarationManager.js.map +0 -6
  198. package/dist/esm/certificate/CertificateManager.d.ts +0 -578
  199. package/dist/esm/certificate/CertificateManager.d.ts.map +0 -1
  200. package/dist/esm/certificate/CertificateManager.js +0 -870
  201. package/dist/esm/certificate/CertificateManager.js.map +0 -6
  202. package/dist/esm/certificate/CertificationDeclarationManager.d.ts +0 -11
  203. package/dist/esm/certificate/CertificationDeclarationManager.d.ts.map +0 -1
  204. package/dist/esm/certificate/CertificationDeclarationManager.js +0 -34
  205. package/dist/esm/certificate/CertificationDeclarationManager.js.map +0 -6
  206. package/src/certificate/CertificateManager.ts +0 -1176
  207. package/src/certificate/CertificationDeclarationManager.ts +0 -52
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var CertificationDeclaration_exports = {};
20
+ __export(CertificationDeclaration_exports, {
21
+ CertificationDeclaration: () => CertificationDeclaration
22
+ });
23
+ module.exports = __toCommonJS(CertificationDeclaration_exports);
24
+ var import_general = require("#general");
25
+ var import_common = require("./common.js");
26
+ var import_certification_declaration = require("./definitions/certification-declaration.js");
27
+ /**
28
+ * @license
29
+ * Copyright 2022-2025 Matter.js Authors
30
+ * SPDX-License-Identifier: Apache-2.0
31
+ */
32
+ const TestCMS_SignerPrivateKey = import_general.Bytes.fromHex("AEF3484116E9481EC57BE0472DF41BF499064E5024AD869ECA5E889802D48075");
33
+ const TestCMS_SignerSubjectKeyIdentifier = import_general.Bytes.fromHex("62FA823359ACFAA9963E1CFA140ADDF504F37160");
34
+ class CertificationDeclaration {
35
+ #eContent;
36
+ #subjectKeyIdentifier;
37
+ /**
38
+ * Generator which is the main usage for the class from outside.
39
+ * It constructs the class with the relevant details and returns a signed ASN.1 DER version of the CD.
40
+ */
41
+ static generate(crypto, vendorId, productId, provisional = false) {
42
+ const cd = new CertificationDeclaration(
43
+ {
44
+ formatVersion: 1,
45
+ vendorId,
46
+ produceIdArray: [productId],
47
+ deviceTypeId: 22,
48
+ certificateId: "CSA00000SWC00000-00",
49
+ securityLevel: 0,
50
+ securityInformation: 0,
51
+ versionNumber: 1,
52
+ certificationType: provisional ? 1 : 0
53
+ // 0 = Test, 1 = Provisional/In certification, 2 = official
54
+ },
55
+ TestCMS_SignerSubjectKeyIdentifier
56
+ );
57
+ return cd.asSignedAsn1(crypto, (0, import_general.PrivateKey)(TestCMS_SignerPrivateKey));
58
+ }
59
+ constructor(content, subjectKeyIdentifier) {
60
+ this.#eContent = import_certification_declaration.CertificationDeclaration.TlvDc.encode(content);
61
+ this.#subjectKeyIdentifier = subjectKeyIdentifier;
62
+ }
63
+ /**
64
+ * Returns the signed certificate in ASN.1 DER format.
65
+ */
66
+ async asSignedAsn1(crypto, privateKey) {
67
+ const cert = {
68
+ version: 3,
69
+ digestAlgorithm: [import_general.SHA256_CMS],
70
+ encapContentInfo: import_general.Pkcs7.Data(this.#eContent),
71
+ signerInfo: [
72
+ {
73
+ version: 3,
74
+ subjectKeyIdentifier: (0, import_general.ContextTaggedBytes)(0, this.#subjectKeyIdentifier),
75
+ digestAlgorithm: import_general.SHA256_CMS,
76
+ signatureAlgorithm: import_general.X962.EcdsaWithSHA256,
77
+ signature: await crypto.signEcdsa(privateKey, this.#eContent, "der")
78
+ }
79
+ ]
80
+ };
81
+ const certBytes = import_general.DerCodec.encode(import_general.Pkcs7.SignedData(cert));
82
+ (0, import_common.assertCertificateDerSize)(certBytes);
83
+ return certBytes;
84
+ }
85
+ }
86
+ //# sourceMappingURL=CertificationDeclaration.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/certificate/kinds/CertificationDeclaration.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAAiG;AAEjG,oBAAyC;AACzC,uCAAwE;AARxE;AAAA;AAAA;AAAA;AAAA;AAsBA,MAAM,2BAA2B,qBAAM,QAAQ,kEAAkE;AAQjH,MAAM,qCAAqC,qBAAM,QAAQ,0CAA0C;AAG5F,MAAM,yBAAyB;AAAA,EAClC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,SAAS,QAAgB,UAAoB,WAAmB,cAAc,OAAO;AACxF,UAAM,KAAK,IAAI;AAAA,MACX;AAAA,QACI,eAAe;AAAA,QACf;AAAA,QACA,gBAAgB,CAAC,SAAS;AAAA,QAC1B,cAAc;AAAA,QACd,eAAe;AAAA,QACf,eAAe;AAAA,QACf,qBAAqB;AAAA,QACrB,eAAe;AAAA,QACf,mBAAmB,cAAc,IAAI;AAAA;AAAA,MACzC;AAAA,MACA;AAAA,IACJ;AAEA,WAAO,GAAG,aAAa,YAAQ,2BAAW,wBAAwB,CAAC;AAAA,EACvE;AAAA,EAEA,YACI,SACA,sBACF;AACE,SAAK,YAAY,iCAAAA,yBAA4B,MAAM,OAAO,OAAO;AACjE,SAAK,wBAAwB;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,QAAgB,YAAwB;AACvD,UAAM,OAAO;AAAA,MACT,SAAS;AAAA,MACT,iBAAiB,CAAC,yBAAU;AAAA,MAC5B,kBAAkB,qBAAM,KAAK,KAAK,SAAS;AAAA,MAC3C,YAAY;AAAA,QACR;AAAA,UACI,SAAS;AAAA,UACT,0BAAsB,mCAAmB,GAAG,KAAK,qBAAqB;AAAA,UACtE,iBAAiB;AAAA,UACjB,oBAAoB,oBAAK;AAAA,UACzB,WAAW,MAAM,OAAO,UAAU,YAAY,KAAK,WAAW,KAAK;AAAA,QACvE;AAAA,MACJ;AAAA,IACJ;AACA,UAAM,YAAY,wBAAS,OAAO,qBAAM,WAAW,IAAI,CAAC;AACxD,gDAAyB,SAAS;AAClC,WAAO;AAAA,EACX;AACJ;",
5
+ "names": ["CertificationDeclarationDef"]
6
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Crypto } from "#general";
7
+ import { OperationalCertificate } from "./definitions/operational.js";
8
+ import { OperationalBase } from "./OperationalBase.js";
9
+ import { Rcac } from "./Rcac.js";
10
+ /**
11
+ * Represents an Intermediate Certificate
12
+ */
13
+ export declare class Icac extends OperationalBase<OperationalCertificate.Icac> {
14
+ /** Construct the class from a Tlv version of the certificate */
15
+ static fromTlv(tlv: Uint8Array): Icac;
16
+ /** Validates all basic certificate fields on construction. */
17
+ protected validateFields(): void;
18
+ /**
19
+ * Encodes the certificate with the signature as Matter Tlv.
20
+ * If the certificate is not signed, it throws a CertificateError.
21
+ */
22
+ asSignedTlv(): Uint8Array<ArrayBufferLike>;
23
+ /**
24
+ * Verify requirements a Matter Intermediate CA certificate must fulfill.
25
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
26
+ */
27
+ verify(crypto: Crypto, root: Rcac): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=Icac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icac.d.ts","sourceRoot":"","sources":["../../../../src/certificate/kinds/Icac.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAS,MAAM,EAAyB,MAAM,UAAU,CAAC;AAIhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,IAAK,SAAQ,eAAe,CAAC,sBAAsB,CAAC,IAAI,CAAC;IAClE,gEAAgE;IAChE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAIrC,8DAA8D;IAC9D,SAAS,CAAC,cAAc;IAWxB;;;OAGG;IACH,WAAW;IAIX;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;CA4G1C"}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var Icac_exports = {};
20
+ __export(Icac_exports, {
21
+ Icac: () => Icac
22
+ });
23
+ module.exports = __toCommonJS(Icac_exports);
24
+ var import_general = require("#general");
25
+ var import_types = require("#types");
26
+ var import_common = require("./common.js");
27
+ var import_base = require("./definitions/base.js");
28
+ var import_operational = require("./definitions/operational.js");
29
+ var import_OperationalBase = require("./OperationalBase.js");
30
+ /**
31
+ * @license
32
+ * Copyright 2022-2025 Matter.js Authors
33
+ * SPDX-License-Identifier: Apache-2.0
34
+ */
35
+ class Icac extends import_OperationalBase.OperationalBase {
36
+ /** Construct the class from a Tlv version of the certificate */
37
+ static fromTlv(tlv) {
38
+ return new Icac(import_operational.OperationalCertificate.TlvIcac.decode(tlv));
39
+ }
40
+ /** Validates all basic certificate fields on construction. */
41
+ validateFields() {
42
+ const {
43
+ extensions: {
44
+ basicConstraints: { isCa }
45
+ }
46
+ } = this.cert;
47
+ if (!isCa) {
48
+ throw new import_common.CertificateError("Intermediate certificate must be a CA.");
49
+ }
50
+ }
51
+ /**
52
+ * Encodes the certificate with the signature as Matter Tlv.
53
+ * If the certificate is not signed, it throws a CertificateError.
54
+ */
55
+ asSignedTlv() {
56
+ return import_operational.OperationalCertificate.TlvIcac.encode({ ...this.cert, signature: this.signature });
57
+ }
58
+ /**
59
+ * Verify requirements a Matter Intermediate CA certificate must fulfill.
60
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
61
+ */
62
+ async verify(crypto, root) {
63
+ this.generalVerify();
64
+ const {
65
+ subject,
66
+ issuer: { rcacId },
67
+ extensions
68
+ } = this.cert;
69
+ const { fabricId, icacId } = subject;
70
+ const { basicConstraints, extendedKeyUsage, subjectKeyIdentifier, authorityKeyIdentifier } = extensions;
71
+ const { fabricId: rootFabricId } = root.cert.subject;
72
+ if ("nodeId" in subject) {
73
+ throw new import_common.CertificateError(`Ica certificate must not contain a nodeId.`);
74
+ }
75
+ if (fabricId !== void 0) {
76
+ if (Array.isArray(fabricId)) {
77
+ throw new import_common.CertificateError(`Invalid fabricId in NoC certificate: ${import_general.Diagnostic.json(fabricId)}`);
78
+ }
79
+ if (fabricId === (0, import_types.FabricId)(0)) {
80
+ throw new import_common.CertificateError(`Invalid fabricId in NoC certificate: ${import_general.Diagnostic.json(fabricId)}`);
81
+ }
82
+ }
83
+ if (icacId === void 0 || Array.isArray(icacId)) {
84
+ throw new import_common.CertificateError(`Invalid icacId in Ica certificate: ${import_general.Diagnostic.json(icacId)}`);
85
+ }
86
+ if ("rcacId" in subject) {
87
+ throw new import_common.CertificateError(`Ica certificate must not contain an rcacId.`);
88
+ }
89
+ if ("caseAuthenticatedTags" in subject) {
90
+ throw new import_common.CertificateError(`Ica certificate must not contain a caseAuthenticatedTags.`);
91
+ }
92
+ if (rootFabricId !== void 0 && fabricId !== void 0 && rootFabricId !== fabricId) {
93
+ throw new import_common.CertificateError(
94
+ `FabricId in Ica certificate does not match the fabricId in the parent certificate. ${import_general.Diagnostic.json(
95
+ rootFabricId
96
+ )} !== ${import_general.Diagnostic.json(fabricId)}`
97
+ );
98
+ }
99
+ if (root.cert.subject.rcacId !== rcacId) {
100
+ throw new import_common.CertificateError(
101
+ `RcacId in Ica certificate does not match the rcacId in the parent certificate. ${import_general.Diagnostic.json(
102
+ root.cert.subject.rcacId
103
+ )} !== ${import_general.Diagnostic.json(rcacId)}`
104
+ );
105
+ }
106
+ if (!basicConstraints.isCa) {
107
+ throw new import_common.CertificateError(`Ica certificate must have isCa set to true.`);
108
+ }
109
+ const keyUsage = import_base.ExtensionKeyUsageSchema.encode(extensions.keyUsage);
110
+ if (keyUsage !== 96 && keyUsage !== 97) {
111
+ throw new import_common.CertificateError(
112
+ `Ica certificate keyUsage must have keyCertSign and CRLSign and optionally digitalSignature set.`
113
+ );
114
+ }
115
+ if (extendedKeyUsage !== void 0) {
116
+ throw new import_common.CertificateError(`Ica certificate must not have extendedKeyUsage set.`);
117
+ }
118
+ if (subjectKeyIdentifier === void 0) {
119
+ throw new import_common.CertificateError(`Ica certificate must have subjectKeyIdentifier set.`);
120
+ }
121
+ if (subjectKeyIdentifier.length !== 20) {
122
+ throw new import_common.CertificateError(`Ica certificate subjectKeyIdentifier must be 160 bit.`);
123
+ }
124
+ if (authorityKeyIdentifier === void 0) {
125
+ throw new import_common.CertificateError(`Ica certificate must have authorityKeyIdentifier set.`);
126
+ }
127
+ if (authorityKeyIdentifier.length !== 20) {
128
+ throw new import_common.CertificateError(`Ica certificate authorityKeyIdentifier must be 160 bit.`);
129
+ }
130
+ if (!import_general.Bytes.areEqual(authorityKeyIdentifier, root.cert.extensions.subjectKeyIdentifier)) {
131
+ throw new import_common.CertificateError(
132
+ `Ica certificate authorityKeyIdentifier must be equal to root cert subjectKeyIdentifier.`
133
+ );
134
+ }
135
+ await crypto.verifyEcdsa((0, import_general.PublicKey)(root.cert.ellipticCurvePublicKey), this.asUnsignedAsn1(), this.signature);
136
+ }
137
+ }
138
+ //# sourceMappingURL=Icac.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/certificate/kinds/Icac.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAAqD;AACrD,mBAAyB;AACzB,oBAAiC;AACjC,kBAAwC;AACxC,yBAAuC;AACvC,6BAAgC;AAXhC;AA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WAAW,oBAAoB,GAAG;AACpF,YAAM,IAAI;AAAA,QACN;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,OAAO,gBAAY,0BAAU,KAAK,KAAK,sBAAsB,GAAG,KAAK,eAAe,GAAG,KAAK,SAAS;AAAA,EAC/G;AACJ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Crypto } from "#general";
7
+ import { OperationalCertificate } from "./definitions/operational.js";
8
+ import { Icac } from "./Icac.js";
9
+ import { OperationalBase } from "./OperationalBase.js";
10
+ import { Rcac } from "./Rcac.js";
11
+ export declare class Noc extends OperationalBase<OperationalCertificate.Noc> {
12
+ /** Construct the class from a Tlv version of the certificate */
13
+ static fromTlv(tlv: Uint8Array): Noc;
14
+ /** Validates all basic certificate fields on construction. */
15
+ protected validateFields(): void;
16
+ /**
17
+ * Encodes the certificate with the signature as Matter Tlv.
18
+ * If the certificate is not signed, it throws a CertificateError.
19
+ */
20
+ asSignedTlv(): Uint8Array<ArrayBufferLike>;
21
+ /**
22
+ * Verify requirements a Matter Node Operational certificate must fulfill.
23
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
24
+ */
25
+ verify(crypto: Crypto, root: Rcac, ica?: Icac): Promise<void>;
26
+ }
27
+ //# sourceMappingURL=Noc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Noc.d.ts","sourceRoot":"","sources":["../../../../src/certificate/kinds/Noc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAS,MAAM,EAAyB,MAAM,UAAU,CAAC;AAGhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,GAAI,SAAQ,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC;IAChE,gEAAgE;IAChE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU;IAI9B,8DAA8D;IAC9D,SAAS,CAAC,cAAc;IAexB;;;OAGG;IACH,WAAW;IAIX;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI;CAmHtD"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var Noc_exports = {};
20
+ __export(Noc_exports, {
21
+ Noc: () => Noc
22
+ });
23
+ module.exports = __toCommonJS(Noc_exports);
24
+ var import_general = require("#general");
25
+ var import_types = require("#types");
26
+ var import_common = require("./common.js");
27
+ var import_operational = require("./definitions/operational.js");
28
+ var import_OperationalBase = require("./OperationalBase.js");
29
+ /**
30
+ * @license
31
+ * Copyright 2022-2025 Matter.js Authors
32
+ * SPDX-License-Identifier: Apache-2.0
33
+ */
34
+ class Noc extends import_OperationalBase.OperationalBase {
35
+ /** Construct the class from a Tlv version of the certificate */
36
+ static fromTlv(tlv) {
37
+ return new Noc(import_operational.OperationalCertificate.TlvNoc.decode(tlv));
38
+ }
39
+ /** Validates all basic certificate fields on construction. */
40
+ validateFields() {
41
+ const {
42
+ issuer: { icacId, rcacId },
43
+ extensions: {
44
+ basicConstraints: { isCa }
45
+ }
46
+ } = this.cert;
47
+ if (icacId === void 0 && rcacId === void 0) {
48
+ throw new import_common.CertificateError("Issuer RCAC or ICAC ID must be defined for an operational certificate.");
49
+ }
50
+ if (isCa) {
51
+ throw new import_common.CertificateError("Node operational certificate must not be a CA.");
52
+ }
53
+ }
54
+ /**
55
+ * Encodes the certificate with the signature as Matter Tlv.
56
+ * If the certificate is not signed, it throws a CertificateError.
57
+ */
58
+ asSignedTlv() {
59
+ return import_operational.OperationalCertificate.TlvNoc.encode({ ...this.cert, signature: this.signature });
60
+ }
61
+ /**
62
+ * Verify requirements a Matter Node Operational certificate must fulfill.
63
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
64
+ */
65
+ async verify(crypto, root, ica) {
66
+ this.generalVerify();
67
+ const {
68
+ subject,
69
+ extensions: { extendedKeyUsage, subjectKeyIdentifier, authorityKeyIdentifier }
70
+ } = this.cert;
71
+ const { nodeId, fabricId, caseAuthenticatedTags } = subject;
72
+ const {
73
+ subject: { fabricId: rootFabricId }
74
+ } = root.cert;
75
+ const {
76
+ subject: { fabricId: icaFabricId }
77
+ } = ica?.cert ?? { subject: {} };
78
+ if (nodeId === void 0 || Array.isArray(nodeId)) {
79
+ throw new import_common.CertificateError(`Invalid nodeId in NoC certificate: ${import_general.Diagnostic.json(nodeId)}`);
80
+ }
81
+ if (!import_types.NodeId.isOperationalNodeId(nodeId)) {
82
+ throw new import_common.CertificateError(`Invalid nodeId in NoC certificate: ${import_general.Diagnostic.json(nodeId)}`);
83
+ }
84
+ if (fabricId === void 0 || Array.isArray(fabricId)) {
85
+ throw new import_common.CertificateError(`Invalid fabricId in NoC certificate: ${import_general.Diagnostic.json(fabricId)}`);
86
+ }
87
+ if (fabricId === (0, import_types.FabricId)(0)) {
88
+ throw new import_common.CertificateError(`Invalid fabricId in NoC certificate: ${import_general.Diagnostic.json(fabricId)}`);
89
+ }
90
+ if ("icacId" in subject) {
91
+ throw new import_common.CertificateError(`Noc certificate must not contain an icacId.`);
92
+ }
93
+ if ("rcacId" in subject) {
94
+ throw new import_common.CertificateError(`Noc certificate must not contain an rcacId.`);
95
+ }
96
+ if (caseAuthenticatedTags !== void 0) {
97
+ import_types.CaseAuthenticatedTag.validateNocTagList(caseAuthenticatedTags);
98
+ }
99
+ if (rootFabricId !== void 0 && rootFabricId !== fabricId) {
100
+ throw new import_common.CertificateError(
101
+ `FabricId in NoC certificate does not match the fabricId in the parent certificate. ${import_general.Diagnostic.json(
102
+ rootFabricId
103
+ )} !== ${import_general.Diagnostic.json(fabricId)}`
104
+ );
105
+ }
106
+ if (icaFabricId !== void 0 && icaFabricId !== fabricId) {
107
+ throw new import_common.CertificateError(
108
+ `FabricId in NoC certificate does not match the fabricId in the parent certificate. ${import_general.Diagnostic.json(
109
+ icaFabricId
110
+ )} !== ${import_general.Diagnostic.json(fabricId)}`
111
+ );
112
+ }
113
+ if (this.cert.extensions.basicConstraints.isCa) {
114
+ throw new import_common.CertificateError(`Noc certificate must not have isCa set to true.`);
115
+ }
116
+ if (!this.cert.extensions.keyUsage.digitalSignature) {
117
+ throw new import_common.CertificateError(`Noc certificate must have keyUsage set to digitalSignature.`);
118
+ }
119
+ if (extendedKeyUsage === void 0 || !extendedKeyUsage.includes(1) && !extendedKeyUsage.includes(2)) {
120
+ throw new import_common.CertificateError(
121
+ `Noc certificate must have extendedKeyUsage with serverAuth and clientAuth: ${import_general.Diagnostic.json(extendedKeyUsage)}`
122
+ );
123
+ }
124
+ if (subjectKeyIdentifier === void 0) {
125
+ throw new import_common.CertificateError(`Noc certificate must have subjectKeyIdentifier set.`);
126
+ }
127
+ if (subjectKeyIdentifier.length !== 20) {
128
+ throw new import_common.CertificateError(`Noc certificate subjectKeyIdentifier must be 160 bit.`);
129
+ }
130
+ if (authorityKeyIdentifier === void 0) {
131
+ throw new import_common.CertificateError(`Noc certificate must have authorityKeyIdentifier set.`);
132
+ }
133
+ if (authorityKeyIdentifier.length !== 20) {
134
+ throw new import_common.CertificateError(`Noc certificate authorityKeyIdentifier must be 160 bit.`);
135
+ }
136
+ if (!import_general.Bytes.areEqual(authorityKeyIdentifier, (ica?.cert ?? root.cert).extensions.subjectKeyIdentifier)) {
137
+ throw new import_common.CertificateError(
138
+ `Noc certificate authorityKeyIdentifier must be equal to Root/Ica subjectKeyIdentifier.`
139
+ );
140
+ }
141
+ await crypto.verifyEcdsa(
142
+ (0, import_general.PublicKey)((ica?.cert ?? root.cert).ellipticCurvePublicKey),
143
+ this.asUnsignedAsn1(),
144
+ this.signature
145
+ );
146
+ }
147
+ }
148
+ //# sourceMappingURL=Noc.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/certificate/kinds/Noc.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAAqD;AACrD,mBAAuD;AACvD,oBAAiC;AACjC,yBAAuC;AAEvC,6BAAgC;AAXhC;AAAA;AAAA;AAAA;AAAA;AAcO,MAAM,YAAY,uCAA4C;AAAA;AAAA,EAEjE,OAAO,QAAQ,KAAiB;AAC5B,WAAO,IAAI,IAAI,0CAAuB,OAAO,OAAO,GAAG,CAAC;AAAA,EAC5D;AAAA;AAAA,EAGU,iBAAiB;AACvB,UAAM;AAAA,MACF,QAAQ,EAAE,QAAQ,OAAO;AAAA,MACzB,YAAY;AAAA,QACR,kBAAkB,EAAE,KAAK;AAAA,MAC7B;AAAA,IACJ,IAAI,KAAK;AACT,QAAI,WAAW,UAAa,WAAW,QAAW;AAC9C,YAAM,IAAI,+BAAiB,wEAAwE;AAAA,IACvG;AACA,QAAI,MAAM;AACN,YAAM,IAAI,+BAAiB,gDAAgD;AAAA,IAC/E;AAAA,E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Q,KAAK,MAAM,sBAAsB;AAAA,MACzD,KAAK,eAAe;AAAA,MACpB,KAAK;AAAA,IACT;AAAA,EACJ;AACJ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { X509Base } from "./X509Base.js";
7
+ import { Unsigned } from "./common.js";
8
+ import { X509Certificate } from "./definitions/base.js";
9
+ /**
10
+ * Base class for all operational certificates (RCAC, ICAC, NOC)
11
+ */
12
+ export declare abstract class OperationalBase<CT extends X509Certificate> extends X509Base<CT> {
13
+ constructor(cert: CT | Unsigned<CT>);
14
+ /** Validates all basic certificate fields on construction. */
15
+ protected abstract validateFields(): void;
16
+ /** Encodes the signed certificate into the Matter TLV format. */
17
+ abstract asSignedTlv(signature: Uint8Array<ArrayBufferLike>): Uint8Array;
18
+ /**
19
+ * Verifies general requirements a Matter certificate fields must fulfill.
20
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
21
+ */
22
+ generalVerify(): void;
23
+ }
24
+ //# sourceMappingURL=OperationalBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationalBase.d.ts","sourceRoot":"","sources":["../../../../src/certificate/kinds/OperationalBase.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAoB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD;;GAEG;AACH,8BAAsB,eAAe,CAAC,EAAE,SAAS,eAAe,CAAE,SAAQ,QAAQ,CAAC,EAAE,CAAC;gBACtE,IAAI,EAAE,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC;IAKnC,8DAA8D;IAC9D,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;IAEzC,iEAAiE;IACjE,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,UAAU;IAExE;;;OAGG;IACH,aAAa;CAuChB"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var OperationalBase_exports = {};
20
+ __export(OperationalBase_exports, {
21
+ OperationalBase: () => OperationalBase
22
+ });
23
+ module.exports = __toCommonJS(OperationalBase_exports);
24
+ var import_general = require("#general");
25
+ var import_X509Base = require("./X509Base.js");
26
+ var import_common = require("./common.js");
27
+ /**
28
+ * @license
29
+ * Copyright 2022-2025 Matter.js Authors
30
+ * SPDX-License-Identifier: Apache-2.0
31
+ */
32
+ const logger = import_general.Logger.get("OperationalBaseCertificate");
33
+ class OperationalBase extends import_X509Base.X509Base {
34
+ constructor(cert) {
35
+ super(cert);
36
+ this.validateFields();
37
+ }
38
+ /**
39
+ * Verifies general requirements a Matter certificate fields must fulfill.
40
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
41
+ */
42
+ generalVerify() {
43
+ const cert = this.cert;
44
+ if (cert.serialNumber.length > 20)
45
+ throw new import_common.CertificateError(
46
+ `Serial number must not be longer then 20 octets. Current serial number has ${cert.serialNumber.length} octets.`
47
+ );
48
+ if (cert.signatureAlgorithm !== 1) {
49
+ throw new import_common.CertificateError(`Unsupported signature algorithm: ${cert.signatureAlgorithm}`);
50
+ }
51
+ if (cert.publicKeyAlgorithm !== 1) {
52
+ throw new import_common.CertificateError(`Unsupported public key algorithm: ${cert.publicKeyAlgorithm}`);
53
+ }
54
+ if (cert.ellipticCurveIdentifier !== 1) {
55
+ throw new import_common.CertificateError(`Unsupported elliptic curve identifier: ${cert.ellipticCurveIdentifier}`);
56
+ }
57
+ if (Object.keys(cert.subject).length > 5) {
58
+ throw new import_common.CertificateError(`Certificate subject must not contain more than 5 RDNs.`);
59
+ }
60
+ if (Object.keys(cert.issuer).length > 5) {
61
+ throw new import_common.CertificateError(`Certificate issuer must not contain more than 5 RDNs.`);
62
+ }
63
+ if (cert.notBefore * 1e3 > import_general.Time.nowMs()) {
64
+ logger.warn(`Certificate notBefore date is in the future: ${cert.notBefore * 1e3} vs ${import_general.Time.nowMs()}`);
65
+ }
66
+ }
67
+ }
68
+ //# sourceMappingURL=OperationalBase.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/certificate/kinds/OperationalBase.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAA6B;AAC7B,sBAAyB;AACzB,oBAA2C;AAR3C;AAAA;AAAA;AAAA;AAAA;AAWA,MAAM,SAAS,sBAAO,IAAI,4BAA4B;AAK/C,MAAe,wBAAoD,yBAAa;AAAA,EACnF,YAAY,MAAyB;AACjC,UAAM,IAAI;AACV,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,gBAAgB;AACZ,UAAM,OAAO,KAAK;AAClB,QAAI,KAAK,aAAa,SAAS;AAC3B,YAAM,IAAI;AAAA,QACN,8EAA8E,KAAK,aAAa,MAAM;AAAA,MAC1G;AAEJ,QAAI,KAAK,uBAAuB,GAAG;AAE/B,YAAM,IAAI,+BAAiB,oCAAoC,KAAK,kBAAkB,EAAE;AAAA,IAC5F;AAEA,QAAI,KAAK,uBAAuB,GAAG;AAE/B,YAAM,IAAI,+BAAiB,qCAAqC,KAAK,kBAAkB,EAAE;AAAA,IAC7F;AAEA,QAAI,KAAK,4BAA4B,GAAG;AAEpC,YAAM,IAAI,+BAAiB,0CAA0C,KAAK,uBAAuB,EAAE;AAAA,IACvG;AAGA,QAAI,OAAO,KAAK,KAAK,OAAO,EAAE,SAAS,GAAG;AACtC,YAAM,IAAI,+BAAiB,wDAAwD;AAAA,IACvF;AACA,QAAI,OAAO,KAAK,KAAK,MAAM,EAAE,SAAS,GAAG;AACrC,YAAM,IAAI,+BAAiB,uDAAuD;AAAA,IACtF;AAIA,QAAI,KAAK,YAAY,MAAO,oBAAK,MAAM,GAAG;AACtC,aAAO,KAAK,gDAAgD,KAAK,YAAY,GAAI,OAAO,oBAAK,MAAM,CAAC,EAAE;AAAA,IAI1G;AAAA,EACJ;AACJ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Crypto } from "#general";
7
+ import { OperationalCertificate } from "./definitions/operational.js";
8
+ import { OperationalBase } from "./OperationalBase.js";
9
+ export declare class Rcac extends OperationalBase<OperationalCertificate.Rcac> {
10
+ /** Construct the class from a Tlv version of the certificate */
11
+ static fromTlv(tlv: Uint8Array): Rcac;
12
+ /** Validates all basic certificate fields on construction. */
13
+ protected validateFields(): void;
14
+ /**
15
+ * Encodes the certificate with the signature as Matter Tlv.
16
+ * If the certificate is not signed, it throws a CertificateError.
17
+ */
18
+ asSignedTlv(): Uint8Array<ArrayBufferLike>;
19
+ /**
20
+ * Verify requirements a Matter Root certificate must fulfill.
21
+ * Rules for this are listed in @see {@link MatterSpecification.v12.Core} §6.5.x
22
+ */
23
+ verify(crypto: Crypto): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=Rcac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rcac.d.ts","sourceRoot":"","sources":["../../../../src/certificate/kinds/Rcac.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAS,MAAM,EAAyB,MAAM,UAAU,CAAC;AAIhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBAAa,IAAK,SAAQ,eAAe,CAAC,sBAAsB,CAAC,IAAI,CAAC;IAClE,gEAAgE;IAChE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAIrC,8DAA8D;IAC9D,SAAS,CAAC,cAAc;IAWxB;;;OAGG;IACH,WAAW;IAIX;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM;CAkF9B"}