@countinghouse/ch-local 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +361 -2
  3. package/bin/ch-local.js +472 -0
  4. package/clients/claude-code/.claude-plugin/plugin.json +6 -0
  5. package/clients/claude-code/.mcp.json +11 -0
  6. package/clients/claude-code/bin/launch.js +235 -0
  7. package/clients/claude-code/bin/win-acl.js +420 -0
  8. package/clients/claude-code/skills/ci-failure-triage/SKILL.md +21 -0
  9. package/clients/claude-code/skills/countinghouse-module/SKILL.md +177 -0
  10. package/clients/claude-code/skills/countinghouse-setup/SKILL.md +74 -0
  11. package/lib/allowlist.js +65 -0
  12. package/lib/aside.js +16 -0
  13. package/lib/atomic.js +45 -0
  14. package/lib/auto-apply.js +245 -0
  15. package/lib/auto-upgrade.js +98 -0
  16. package/lib/availability.js +307 -0
  17. package/lib/ceiling.js +280 -0
  18. package/lib/clean-text.js +20 -0
  19. package/lib/cli-change.js +38 -0
  20. package/lib/client-conditions-fixtures.js +143 -0
  21. package/lib/client-conditions.js +656 -0
  22. package/lib/clients.js +179 -0
  23. package/lib/command-line.js +202 -0
  24. package/lib/conditions-command.js +116 -0
  25. package/lib/control.js +134 -0
  26. package/lib/credential-store.js +414 -0
  27. package/lib/credentials-command.js +344 -0
  28. package/lib/daemon-requests.js +137 -0
  29. package/lib/daemon.js +888 -0
  30. package/lib/describe-module.js +137 -0
  31. package/lib/description-check.js +175 -0
  32. package/lib/failed-json.js +43 -0
  33. package/lib/gc.js +274 -0
  34. package/lib/github-token.js +57 -0
  35. package/lib/handoff-io.js +73 -0
  36. package/lib/held-back.js +116 -0
  37. package/lib/hidden-input.js +64 -0
  38. package/lib/history.js +49 -0
  39. package/lib/home.js +372 -0
  40. package/lib/in-place.js +1036 -0
  41. package/lib/install-plan.js +142 -0
  42. package/lib/install.js +846 -0
  43. package/lib/installed-description.js +153 -0
  44. package/lib/integrity.js +7 -0
  45. package/lib/lock.js +456 -0
  46. package/lib/lockfile-rules.js +98 -0
  47. package/lib/machine.js +20 -0
  48. package/lib/module-credentials.js +403 -0
  49. package/lib/module-record.js +298 -0
  50. package/lib/module-roles.js +44 -0
  51. package/lib/module-seams.js +26 -0
  52. package/lib/module-store.js +202 -0
  53. package/lib/module-values.js +334 -0
  54. package/lib/names.js +31 -0
  55. package/lib/next-steps.js +8 -0
  56. package/lib/node-check.js +56 -0
  57. package/lib/npm-fetch.js +123 -0
  58. package/lib/npm-release.js +99 -0
  59. package/lib/npm-upgrade.js +146 -0
  60. package/lib/npm.js +41 -0
  61. package/lib/outside-edits.js +162 -0
  62. package/lib/own-applied.js +175 -0
  63. package/lib/own-command.js +380 -0
  64. package/lib/own-file.js +120 -0
  65. package/lib/own-record.js +96 -0
  66. package/lib/own-tree.js +336 -0
  67. package/lib/pack-table.js +290 -0
  68. package/lib/packs-command.js +570 -0
  69. package/lib/packs.js +219 -0
  70. package/lib/pins.js +64 -0
  71. package/lib/pipe-probe.js +82 -0
  72. package/lib/plain-read.js +63 -0
  73. package/lib/private-file.js +90 -0
  74. package/lib/private-write.js +33 -0
  75. package/lib/provenance.js +234 -0
  76. package/lib/record.js +82 -0
  77. package/lib/registry.js +22 -0
  78. package/lib/release-pins.js +350 -0
  79. package/lib/release-pins.json +4225 -0
  80. package/lib/release-tags.js +12 -0
  81. package/lib/release.js +36 -0
  82. package/lib/restart-command.js +161 -0
  83. package/lib/rollback.js +227 -0
  84. package/lib/run-liveness.js +15 -0
  85. package/lib/runtime-log.js +287 -0
  86. package/lib/sandbox-support.js +17 -0
  87. package/lib/semver-order.js +40 -0
  88. package/lib/session-socket.js +69 -0
  89. package/lib/session-table.js +238 -0
  90. package/lib/session.js +281 -0
  91. package/lib/settings-command.js +82 -0
  92. package/lib/settings.js +564 -0
  93. package/lib/shim-binary.js +152 -0
  94. package/lib/shim-config.js +159 -0
  95. package/lib/shim-install.js +365 -0
  96. package/lib/sigstore/README.md +44 -0
  97. package/lib/sigstore/npm-keys.json +18 -0
  98. package/lib/sigstore/trusted-root.json +126 -0
  99. package/lib/snippets.js +76 -0
  100. package/lib/start.js +721 -0
  101. package/lib/store-files.js +48 -0
  102. package/lib/store-paths.js +33 -0
  103. package/lib/swap-preload.js +38 -0
  104. package/lib/tar.js +220 -0
  105. package/lib/uninstall.js +314 -0
  106. package/lib/unpack.js +41 -0
  107. package/lib/upgrade-stamp.js +63 -0
  108. package/lib/upgrade.js +281 -0
  109. package/lib/watch.js +40 -0
  110. package/lib/win-acl.js +420 -0
  111. package/node_modules/@sigstore/bundle/LICENSE +202 -0
  112. package/node_modules/@sigstore/bundle/README.md +19 -0
  113. package/node_modules/@sigstore/bundle/dist/build.d.ts +18 -0
  114. package/node_modules/@sigstore/bundle/dist/build.js +100 -0
  115. package/node_modules/@sigstore/bundle/dist/bundle.d.ts +74 -0
  116. package/node_modules/@sigstore/bundle/dist/bundle.js +24 -0
  117. package/node_modules/@sigstore/bundle/dist/error.d.ts +4 -0
  118. package/node_modules/@sigstore/bundle/dist/error.js +25 -0
  119. package/node_modules/@sigstore/bundle/dist/index.d.ts +8 -0
  120. package/node_modules/@sigstore/bundle/dist/index.js +43 -0
  121. package/node_modules/@sigstore/bundle/dist/serialized.d.ts +74 -0
  122. package/node_modules/@sigstore/bundle/dist/serialized.js +49 -0
  123. package/node_modules/@sigstore/bundle/dist/utility.d.ts +14 -0
  124. package/node_modules/@sigstore/bundle/dist/utility.js +2 -0
  125. package/node_modules/@sigstore/bundle/dist/validate.d.ts +7 -0
  126. package/node_modules/@sigstore/bundle/dist/validate.js +199 -0
  127. package/node_modules/@sigstore/bundle/package.json +35 -0
  128. package/node_modules/@sigstore/core/LICENSE +202 -0
  129. package/node_modules/@sigstore/core/README.md +10 -0
  130. package/node_modules/@sigstore/core/dist/asn1/error.d.ts +4 -0
  131. package/node_modules/@sigstore/core/dist/asn1/error.js +24 -0
  132. package/node_modules/@sigstore/core/dist/asn1/index.d.ts +1 -0
  133. package/node_modules/@sigstore/core/dist/asn1/index.js +20 -0
  134. package/node_modules/@sigstore/core/dist/asn1/length.d.ts +3 -0
  135. package/node_modules/@sigstore/core/dist/asn1/length.js +62 -0
  136. package/node_modules/@sigstore/core/dist/asn1/obj.d.ts +14 -0
  137. package/node_modules/@sigstore/core/dist/asn1/obj.js +155 -0
  138. package/node_modules/@sigstore/core/dist/asn1/parse.d.ts +6 -0
  139. package/node_modules/@sigstore/core/dist/asn1/parse.js +124 -0
  140. package/node_modules/@sigstore/core/dist/asn1/tag.d.ts +16 -0
  141. package/node_modules/@sigstore/core/dist/asn1/tag.js +89 -0
  142. package/node_modules/@sigstore/core/dist/crypto.d.ts +6 -0
  143. package/node_modules/@sigstore/core/dist/crypto.js +69 -0
  144. package/node_modules/@sigstore/core/dist/dsse.d.ts +1 -0
  145. package/node_modules/@sigstore/core/dist/dsse.js +29 -0
  146. package/node_modules/@sigstore/core/dist/encoding.d.ts +2 -0
  147. package/node_modules/@sigstore/core/dist/encoding.js +27 -0
  148. package/node_modules/@sigstore/core/dist/index.d.ts +9 -0
  149. package/node_modules/@sigstore/core/dist/index.js +66 -0
  150. package/node_modules/@sigstore/core/dist/json.d.ts +1 -0
  151. package/node_modules/@sigstore/core/dist/json.js +60 -0
  152. package/node_modules/@sigstore/core/dist/oid.d.ts +3 -0
  153. package/node_modules/@sigstore/core/dist/oid.js +20 -0
  154. package/node_modules/@sigstore/core/dist/pem.d.ts +2 -0
  155. package/node_modules/@sigstore/core/dist/pem.js +43 -0
  156. package/node_modules/@sigstore/core/dist/rfc3161/error.d.ts +2 -0
  157. package/node_modules/@sigstore/core/dist/rfc3161/error.js +21 -0
  158. package/node_modules/@sigstore/core/dist/rfc3161/index.d.ts +1 -0
  159. package/node_modules/@sigstore/core/dist/rfc3161/index.js +20 -0
  160. package/node_modules/@sigstore/core/dist/rfc3161/timestamp.d.ts +36 -0
  161. package/node_modules/@sigstore/core/dist/rfc3161/timestamp.js +212 -0
  162. package/node_modules/@sigstore/core/dist/rfc3161/tstinfo.d.ts +12 -0
  163. package/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js +72 -0
  164. package/node_modules/@sigstore/core/dist/stream.d.ts +21 -0
  165. package/node_modules/@sigstore/core/dist/stream.js +117 -0
  166. package/node_modules/@sigstore/core/dist/x509/cert.d.ts +43 -0
  167. package/node_modules/@sigstore/core/dist/x509/cert.js +245 -0
  168. package/node_modules/@sigstore/core/dist/x509/ext.d.ts +41 -0
  169. package/node_modules/@sigstore/core/dist/x509/ext.js +146 -0
  170. package/node_modules/@sigstore/core/dist/x509/index.d.ts +2 -0
  171. package/node_modules/@sigstore/core/dist/x509/index.js +23 -0
  172. package/node_modules/@sigstore/core/dist/x509/sct.d.ts +25 -0
  173. package/node_modules/@sigstore/core/dist/x509/sct.js +158 -0
  174. package/node_modules/@sigstore/core/package.json +31 -0
  175. package/node_modules/@sigstore/protobuf-specs/LICENSE +202 -0
  176. package/node_modules/@sigstore/protobuf-specs/README.md +5 -0
  177. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.d.ts +44 -0
  178. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js +59 -0
  179. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.d.ts +64 -0
  180. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js +174 -0
  181. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.d.ts +74 -0
  182. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js +141 -0
  183. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.d.ts +74 -0
  184. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js +35 -0
  185. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.d.ts +1309 -0
  186. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js +2191 -0
  187. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.d.ts +113 -0
  188. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js +29 -0
  189. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.d.ts +23 -0
  190. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.js +55 -0
  191. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.d.ts +43 -0
  192. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.js +81 -0
  193. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.d.ts +22 -0
  194. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.js +56 -0
  195. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.d.ts +35 -0
  196. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.js +74 -0
  197. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.d.ts +146 -0
  198. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js +103 -0
  199. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.d.ts +304 -0
  200. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js +612 -0
  201. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_monitor.d.ts +33 -0
  202. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_monitor.js +55 -0
  203. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.d.ts +144 -0
  204. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js +137 -0
  205. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.d.ts +386 -0
  206. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js +284 -0
  207. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.d.ts +191 -0
  208. package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js +281 -0
  209. package/node_modules/@sigstore/protobuf-specs/dist/index.d.ts +6 -0
  210. package/node_modules/@sigstore/protobuf-specs/dist/index.js +37 -0
  211. package/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.d.ts +4 -0
  212. package/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.js +35 -0
  213. package/node_modules/@sigstore/protobuf-specs/package.json +35 -0
  214. package/node_modules/@sigstore/verify/README.md +9 -0
  215. package/node_modules/@sigstore/verify/dist/bundle/dsse.d.ts +12 -0
  216. package/node_modules/@sigstore/verify/dist/bundle/dsse.js +44 -0
  217. package/node_modules/@sigstore/verify/dist/bundle/index.d.ts +4 -0
  218. package/node_modules/@sigstore/verify/dist/bundle/index.js +59 -0
  219. package/node_modules/@sigstore/verify/dist/bundle/message.d.ts +13 -0
  220. package/node_modules/@sigstore/verify/dist/bundle/message.js +54 -0
  221. package/node_modules/@sigstore/verify/dist/error.d.ts +16 -0
  222. package/node_modules/@sigstore/verify/dist/error.js +34 -0
  223. package/node_modules/@sigstore/verify/dist/index.d.ts +6 -0
  224. package/node_modules/@sigstore/verify/dist/index.js +28 -0
  225. package/node_modules/@sigstore/verify/dist/key/certificate.d.ts +21 -0
  226. package/node_modules/@sigstore/verify/dist/key/certificate.js +216 -0
  227. package/node_modules/@sigstore/verify/dist/key/index.d.ts +10 -0
  228. package/node_modules/@sigstore/verify/dist/key/index.js +75 -0
  229. package/node_modules/@sigstore/verify/dist/key/sct.d.ts +4 -0
  230. package/node_modules/@sigstore/verify/dist/key/sct.js +78 -0
  231. package/node_modules/@sigstore/verify/dist/policy.d.ts +5 -0
  232. package/node_modules/@sigstore/verify/dist/policy.js +50 -0
  233. package/node_modules/@sigstore/verify/dist/shared.types.d.ts +50 -0
  234. package/node_modules/@sigstore/verify/dist/shared.types.js +2 -0
  235. package/node_modules/@sigstore/verify/dist/timestamp/index.d.ts +11 -0
  236. package/node_modules/@sigstore/verify/dist/timestamp/index.js +24 -0
  237. package/node_modules/@sigstore/verify/dist/timestamp/tsa.d.ts +3 -0
  238. package/node_modules/@sigstore/verify/dist/timestamp/tsa.js +63 -0
  239. package/node_modules/@sigstore/verify/dist/tlog/checkpoint.d.ts +11 -0
  240. package/node_modules/@sigstore/verify/dist/tlog/checkpoint.js +154 -0
  241. package/node_modules/@sigstore/verify/dist/tlog/dsse.d.ts +6 -0
  242. package/node_modules/@sigstore/verify/dist/tlog/dsse.js +106 -0
  243. package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.d.ts +6 -0
  244. package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js +94 -0
  245. package/node_modules/@sigstore/verify/dist/tlog/index.d.ts +5 -0
  246. package/node_modules/@sigstore/verify/dist/tlog/index.js +92 -0
  247. package/node_modules/@sigstore/verify/dist/tlog/intoto.d.ts +3 -0
  248. package/node_modules/@sigstore/verify/dist/tlog/intoto.js +62 -0
  249. package/node_modules/@sigstore/verify/dist/tlog/merkle.d.ts +3 -0
  250. package/node_modules/@sigstore/verify/dist/tlog/merkle.js +104 -0
  251. package/node_modules/@sigstore/verify/dist/tlog/set.d.ts +3 -0
  252. package/node_modules/@sigstore/verify/dist/tlog/set.js +60 -0
  253. package/node_modules/@sigstore/verify/dist/trust/filter.d.ts +8 -0
  254. package/node_modules/@sigstore/verify/dist/trust/filter.js +23 -0
  255. package/node_modules/@sigstore/verify/dist/trust/index.d.ts +5 -0
  256. package/node_modules/@sigstore/verify/dist/trust/index.js +90 -0
  257. package/node_modules/@sigstore/verify/dist/trust/trust.types.d.ts +29 -0
  258. package/node_modules/@sigstore/verify/dist/trust/trust.types.js +2 -0
  259. package/node_modules/@sigstore/verify/dist/verifier.d.ts +31 -0
  260. package/node_modules/@sigstore/verify/dist/verifier.js +160 -0
  261. package/node_modules/@sigstore/verify/package.json +36 -0
  262. package/package.json +37 -4
@@ -0,0 +1,18 @@
1
+ import type { BundleWithDsseEnvelope, BundleWithMessageSignature } from './bundle';
2
+ type VerificationMaterialOptions = {
3
+ certificate?: Buffer;
4
+ keyHint?: string;
5
+ certificateChain?: boolean;
6
+ };
7
+ type MessageSignatureBundleOptions = {
8
+ digest: Buffer;
9
+ signature: Buffer;
10
+ } & VerificationMaterialOptions;
11
+ type DSSEBundleOptions = {
12
+ artifact: Buffer;
13
+ artifactType: string;
14
+ signature: Buffer;
15
+ } & VerificationMaterialOptions;
16
+ export declare function toMessageSignatureBundle(options: MessageSignatureBundleOptions): BundleWithMessageSignature;
17
+ export declare function toDSSEBundle(options: DSSEBundleOptions): BundleWithDsseEnvelope;
18
+ export {};
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toMessageSignatureBundle = toMessageSignatureBundle;
4
+ exports.toDSSEBundle = toDSSEBundle;
5
+ /*
6
+ Copyright 2023 The Sigstore Authors.
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+ */
20
+ const protobuf_specs_1 = require("@sigstore/protobuf-specs");
21
+ const bundle_1 = require("./bundle");
22
+ // Message signature bundle - $case: 'messageSignature'
23
+ function toMessageSignatureBundle(options) {
24
+ return {
25
+ mediaType: options.certificateChain
26
+ ? bundle_1.BUNDLE_V02_MEDIA_TYPE
27
+ : bundle_1.BUNDLE_V03_MEDIA_TYPE,
28
+ content: {
29
+ $case: 'messageSignature',
30
+ messageSignature: {
31
+ messageDigest: {
32
+ algorithm: protobuf_specs_1.HashAlgorithm.SHA2_256,
33
+ digest: options.digest,
34
+ },
35
+ signature: options.signature,
36
+ },
37
+ },
38
+ verificationMaterial: toVerificationMaterial(options),
39
+ };
40
+ }
41
+ // DSSE envelope bundle - $case: 'dsseEnvelope'
42
+ function toDSSEBundle(options) {
43
+ return {
44
+ mediaType: options.certificateChain
45
+ ? bundle_1.BUNDLE_V02_MEDIA_TYPE
46
+ : bundle_1.BUNDLE_V03_MEDIA_TYPE,
47
+ content: {
48
+ $case: 'dsseEnvelope',
49
+ dsseEnvelope: toEnvelope(options),
50
+ },
51
+ verificationMaterial: toVerificationMaterial(options),
52
+ };
53
+ }
54
+ function toEnvelope(options) {
55
+ return {
56
+ payloadType: options.artifactType,
57
+ payload: options.artifact,
58
+ signatures: [toSignature(options)],
59
+ };
60
+ }
61
+ function toSignature(options) {
62
+ return {
63
+ keyid: options.keyHint || '',
64
+ sig: options.signature,
65
+ };
66
+ }
67
+ // Verification material
68
+ function toVerificationMaterial(options) {
69
+ return {
70
+ content: toKeyContent(options),
71
+ tlogEntries: [],
72
+ timestampVerificationData: { rfc3161Timestamps: [] },
73
+ };
74
+ }
75
+ function toKeyContent(options) {
76
+ if (options.certificate) {
77
+ if (options.certificateChain) {
78
+ return {
79
+ $case: 'x509CertificateChain',
80
+ x509CertificateChain: {
81
+ certificates: [{ rawBytes: options.certificate }],
82
+ },
83
+ };
84
+ }
85
+ else {
86
+ return {
87
+ $case: 'certificate',
88
+ certificate: { rawBytes: options.certificate },
89
+ };
90
+ }
91
+ }
92
+ else {
93
+ return {
94
+ $case: 'publicKey',
95
+ publicKey: {
96
+ hint: options.keyHint || '',
97
+ },
98
+ };
99
+ }
100
+ }
@@ -0,0 +1,74 @@
1
+ import type { Bundle as ProtoBundle, InclusionProof as ProtoInclusionProof, MessageSignature as ProtoMessageSignature, TransparencyLogEntry as ProtoTransparencyLogEntry, VerificationMaterial as ProtoVerificationMaterial } from '@sigstore/protobuf-specs';
2
+ import type { WithRequired } from './utility';
3
+ export declare const BUNDLE_V01_MEDIA_TYPE = "application/vnd.dev.sigstore.bundle+json;version=0.1";
4
+ export declare const BUNDLE_V02_MEDIA_TYPE = "application/vnd.dev.sigstore.bundle+json;version=0.2";
5
+ export declare const BUNDLE_V03_LEGACY_MEDIA_TYPE = "application/vnd.dev.sigstore.bundle+json;version=0.3";
6
+ export declare const BUNDLE_V03_MEDIA_TYPE = "application/vnd.dev.sigstore.bundle.v0.3+json";
7
+ type DsseEnvelopeContent = Extract<ProtoBundle['content'], {
8
+ $case: 'dsseEnvelope';
9
+ }>;
10
+ type MessageSignatureContent = Extract<ProtoBundle['content'], {
11
+ $case: 'messageSignature';
12
+ }>;
13
+ export type MessageSignature = WithRequired<ProtoMessageSignature, 'messageDigest'>;
14
+ export type VerificationMaterial = WithRequired<ProtoVerificationMaterial, 'content'>;
15
+ export type TransparencyLogEntry = WithRequired<ProtoTransparencyLogEntry, 'logId' | 'kindVersion'>;
16
+ export type InclusionProof = WithRequired<ProtoInclusionProof, 'checkpoint'>;
17
+ export type TLogEntryWithInclusionPromise = WithRequired<TransparencyLogEntry, 'inclusionPromise'>;
18
+ export type TLogEntryWithInclusionProof = TransparencyLogEntry & {
19
+ inclusionProof: InclusionProof;
20
+ };
21
+ export type Bundle = ProtoBundle & {
22
+ verificationMaterial: VerificationMaterial & {
23
+ tlogEntries: TransparencyLogEntry[];
24
+ };
25
+ content: (MessageSignatureContent & {
26
+ messageSignature: MessageSignature;
27
+ }) | DsseEnvelopeContent;
28
+ };
29
+ export type BundleV01 = Bundle & {
30
+ verificationMaterial: Bundle['verificationMaterial'] & {
31
+ tlogEntries: TLogEntryWithInclusionPromise[];
32
+ };
33
+ };
34
+ export type BundleLatest = Bundle & {
35
+ verificationMaterial: Bundle['verificationMaterial'] & {
36
+ tlogEntries: TLogEntryWithInclusionProof[];
37
+ };
38
+ };
39
+ export type BundleWithCertificateChain = Bundle & {
40
+ verificationMaterial: Bundle['verificationMaterial'] & {
41
+ content: Extract<VerificationMaterial['content'], {
42
+ $case: 'x509CertificateChain';
43
+ }>;
44
+ };
45
+ };
46
+ export type BundleWithSingleCertificate = Bundle & {
47
+ verificationMaterial: Bundle['verificationMaterial'] & {
48
+ content: Extract<VerificationMaterial['content'], {
49
+ $case: 'certificate';
50
+ }>;
51
+ };
52
+ };
53
+ export type BundleWithPublicKey = Bundle & {
54
+ verificationMaterial: Bundle['verificationMaterial'] & {
55
+ content: Extract<VerificationMaterial['content'], {
56
+ $case: 'publicKey';
57
+ }>;
58
+ };
59
+ };
60
+ export type BundleWithMessageSignature = Bundle & {
61
+ content: Extract<Bundle['content'], {
62
+ $case: 'messageSignature';
63
+ }>;
64
+ };
65
+ export type BundleWithDsseEnvelope = Bundle & {
66
+ content: Extract<Bundle['content'], {
67
+ $case: 'dsseEnvelope';
68
+ }>;
69
+ };
70
+ export declare function isBundleWithCertificateChain(b: Bundle): b is BundleWithCertificateChain;
71
+ export declare function isBundleWithPublicKey(b: Bundle): b is BundleWithPublicKey;
72
+ export declare function isBundleWithMessageSignature(b: Bundle): b is BundleWithMessageSignature;
73
+ export declare function isBundleWithDsseEnvelope(b: Bundle): b is BundleWithDsseEnvelope;
74
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = void 0;
4
+ exports.isBundleWithCertificateChain = isBundleWithCertificateChain;
5
+ exports.isBundleWithPublicKey = isBundleWithPublicKey;
6
+ exports.isBundleWithMessageSignature = isBundleWithMessageSignature;
7
+ exports.isBundleWithDsseEnvelope = isBundleWithDsseEnvelope;
8
+ exports.BUNDLE_V01_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.1';
9
+ exports.BUNDLE_V02_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.2';
10
+ exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.3';
11
+ exports.BUNDLE_V03_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle.v0.3+json';
12
+ // Type guards for bundle variants.
13
+ function isBundleWithCertificateChain(b) {
14
+ return b.verificationMaterial.content.$case === 'x509CertificateChain';
15
+ }
16
+ function isBundleWithPublicKey(b) {
17
+ return b.verificationMaterial.content.$case === 'publicKey';
18
+ }
19
+ function isBundleWithMessageSignature(b) {
20
+ return b.content.$case === 'messageSignature';
21
+ }
22
+ function isBundleWithDsseEnvelope(b) {
23
+ return b.content.$case === 'dsseEnvelope';
24
+ }
@@ -0,0 +1,4 @@
1
+ export declare class ValidationError extends Error {
2
+ fields: string[];
3
+ constructor(message: string, fields: string[]);
4
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationError = void 0;
4
+ /*
5
+ Copyright 2023 The Sigstore Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ */
19
+ class ValidationError extends Error {
20
+ constructor(message, fields) {
21
+ super(message);
22
+ this.fields = fields;
23
+ }
24
+ }
25
+ exports.ValidationError = ValidationError;
@@ -0,0 +1,8 @@
1
+ export { toDSSEBundle, toMessageSignatureBundle } from './build';
2
+ export { BUNDLE_V01_MEDIA_TYPE, BUNDLE_V02_MEDIA_TYPE, BUNDLE_V03_LEGACY_MEDIA_TYPE, BUNDLE_V03_MEDIA_TYPE, isBundleWithCertificateChain, isBundleWithDsseEnvelope, isBundleWithMessageSignature, isBundleWithPublicKey, } from './bundle';
3
+ export { ValidationError } from './error';
4
+ export { bundleFromJSON, bundleToJSON, envelopeFromJSON, envelopeToJSON, } from './serialized';
5
+ export { assertBundle, assertBundleLatest, assertBundleV01, assertBundleV02, isBundleV01, } from './validate';
6
+ export type { Envelope, PublicKeyIdentifier, RFC3161SignedTimestamp, Signature, TimestampVerificationData, X509Certificate, X509CertificateChain, } from '@sigstore/protobuf-specs';
7
+ export type { Bundle, BundleLatest, BundleV01, BundleWithCertificateChain, BundleWithDsseEnvelope, BundleWithMessageSignature, BundleWithPublicKey, BundleWithSingleCertificate, InclusionProof, MessageSignature, TLogEntryWithInclusionPromise, TLogEntryWithInclusionProof, TransparencyLogEntry, VerificationMaterial, } from './bundle';
8
+ export type { SerializedBundle, SerializedEnvelope } from './serialized';
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBundleV01 = exports.assertBundleV02 = exports.assertBundleV01 = exports.assertBundleLatest = exports.assertBundle = exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = exports.ValidationError = exports.isBundleWithPublicKey = exports.isBundleWithMessageSignature = exports.isBundleWithDsseEnvelope = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = exports.toMessageSignatureBundle = exports.toDSSEBundle = void 0;
4
+ /*
5
+ Copyright 2023 The Sigstore Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ */
19
+ var build_1 = require("./build");
20
+ Object.defineProperty(exports, "toDSSEBundle", { enumerable: true, get: function () { return build_1.toDSSEBundle; } });
21
+ Object.defineProperty(exports, "toMessageSignatureBundle", { enumerable: true, get: function () { return build_1.toMessageSignatureBundle; } });
22
+ var bundle_1 = require("./bundle");
23
+ Object.defineProperty(exports, "BUNDLE_V01_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V01_MEDIA_TYPE; } });
24
+ Object.defineProperty(exports, "BUNDLE_V02_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V02_MEDIA_TYPE; } });
25
+ Object.defineProperty(exports, "BUNDLE_V03_LEGACY_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V03_LEGACY_MEDIA_TYPE; } });
26
+ Object.defineProperty(exports, "BUNDLE_V03_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V03_MEDIA_TYPE; } });
27
+ Object.defineProperty(exports, "isBundleWithCertificateChain", { enumerable: true, get: function () { return bundle_1.isBundleWithCertificateChain; } });
28
+ Object.defineProperty(exports, "isBundleWithDsseEnvelope", { enumerable: true, get: function () { return bundle_1.isBundleWithDsseEnvelope; } });
29
+ Object.defineProperty(exports, "isBundleWithMessageSignature", { enumerable: true, get: function () { return bundle_1.isBundleWithMessageSignature; } });
30
+ Object.defineProperty(exports, "isBundleWithPublicKey", { enumerable: true, get: function () { return bundle_1.isBundleWithPublicKey; } });
31
+ var error_1 = require("./error");
32
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return error_1.ValidationError; } });
33
+ var serialized_1 = require("./serialized");
34
+ Object.defineProperty(exports, "bundleFromJSON", { enumerable: true, get: function () { return serialized_1.bundleFromJSON; } });
35
+ Object.defineProperty(exports, "bundleToJSON", { enumerable: true, get: function () { return serialized_1.bundleToJSON; } });
36
+ Object.defineProperty(exports, "envelopeFromJSON", { enumerable: true, get: function () { return serialized_1.envelopeFromJSON; } });
37
+ Object.defineProperty(exports, "envelopeToJSON", { enumerable: true, get: function () { return serialized_1.envelopeToJSON; } });
38
+ var validate_1 = require("./validate");
39
+ Object.defineProperty(exports, "assertBundle", { enumerable: true, get: function () { return validate_1.assertBundle; } });
40
+ Object.defineProperty(exports, "assertBundleLatest", { enumerable: true, get: function () { return validate_1.assertBundleLatest; } });
41
+ Object.defineProperty(exports, "assertBundleV01", { enumerable: true, get: function () { return validate_1.assertBundleV01; } });
42
+ Object.defineProperty(exports, "assertBundleV02", { enumerable: true, get: function () { return validate_1.assertBundleV02; } });
43
+ Object.defineProperty(exports, "isBundleV01", { enumerable: true, get: function () { return validate_1.isBundleV01; } });
@@ -0,0 +1,74 @@
1
+ import { Envelope } from '@sigstore/protobuf-specs';
2
+ import { Bundle } from './bundle';
3
+ import type { OneOf } from './utility';
4
+ export declare const bundleFromJSON: (obj: unknown) => Bundle;
5
+ export declare const bundleToJSON: (bundle: Bundle) => SerializedBundle;
6
+ export declare const envelopeFromJSON: (obj: unknown) => Envelope;
7
+ export declare const envelopeToJSON: (envelope: Envelope) => SerializedEnvelope;
8
+ type SerializedTLogEntry = {
9
+ logIndex: string;
10
+ logId: {
11
+ keyId: string;
12
+ };
13
+ kindVersion: {
14
+ kind: string;
15
+ version: string;
16
+ } | undefined;
17
+ integratedTime: string;
18
+ inclusionPromise: {
19
+ signedEntryTimestamp: string;
20
+ } | undefined;
21
+ inclusionProof: {
22
+ logIndex: string;
23
+ rootHash: string;
24
+ treeSize: string;
25
+ hashes: string[];
26
+ checkpoint: {
27
+ envelope: string;
28
+ };
29
+ } | undefined;
30
+ canonicalizedBody: string;
31
+ };
32
+ type SerializedTimestampVerificationData = {
33
+ rfc3161Timestamps: {
34
+ signedTimestamp: string;
35
+ }[];
36
+ };
37
+ type SerializedMessageSignature = {
38
+ messageDigest: {
39
+ algorithm: string;
40
+ digest: string;
41
+ } | undefined;
42
+ signature: string;
43
+ };
44
+ export type SerializedEnvelope = {
45
+ payload: string;
46
+ payloadType: string;
47
+ signatures: {
48
+ sig: string;
49
+ keyid: string;
50
+ }[];
51
+ };
52
+ export type SerializedBundle = {
53
+ mediaType: string;
54
+ verificationMaterial: (OneOf<{
55
+ x509CertificateChain: {
56
+ certificates: {
57
+ rawBytes: string;
58
+ }[];
59
+ };
60
+ publicKey: {
61
+ hint: string;
62
+ };
63
+ certificate: {
64
+ rawBytes: string;
65
+ };
66
+ }> | undefined) & {
67
+ tlogEntries: SerializedTLogEntry[];
68
+ timestampVerificationData: SerializedTimestampVerificationData | undefined;
69
+ };
70
+ } & OneOf<{
71
+ dsseEnvelope: SerializedEnvelope;
72
+ messageSignature: SerializedMessageSignature;
73
+ }>;
74
+ export {};
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = void 0;
4
+ /*
5
+ Copyright 2023 The Sigstore Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ */
19
+ const protobuf_specs_1 = require("@sigstore/protobuf-specs");
20
+ const bundle_1 = require("./bundle");
21
+ const validate_1 = require("./validate");
22
+ const bundleFromJSON = (obj) => {
23
+ const bundle = protobuf_specs_1.Bundle.fromJSON(obj);
24
+ switch (bundle.mediaType) {
25
+ case bundle_1.BUNDLE_V01_MEDIA_TYPE:
26
+ (0, validate_1.assertBundleV01)(bundle);
27
+ break;
28
+ case bundle_1.BUNDLE_V02_MEDIA_TYPE:
29
+ (0, validate_1.assertBundleV02)(bundle);
30
+ break;
31
+ default:
32
+ (0, validate_1.assertBundleLatest)(bundle);
33
+ break;
34
+ }
35
+ return bundle;
36
+ };
37
+ exports.bundleFromJSON = bundleFromJSON;
38
+ const bundleToJSON = (bundle) => {
39
+ return protobuf_specs_1.Bundle.toJSON(bundle);
40
+ };
41
+ exports.bundleToJSON = bundleToJSON;
42
+ const envelopeFromJSON = (obj) => {
43
+ return protobuf_specs_1.Envelope.fromJSON(obj);
44
+ };
45
+ exports.envelopeFromJSON = envelopeFromJSON;
46
+ const envelopeToJSON = (envelope) => {
47
+ return protobuf_specs_1.Envelope.toJSON(envelope);
48
+ };
49
+ exports.envelopeToJSON = envelopeToJSON;
@@ -0,0 +1,14 @@
1
+ type ValueOf<Obj> = Obj[keyof Obj];
2
+ type OneOnly<Obj, K extends keyof Obj> = {
3
+ [key in Exclude<keyof Obj, K>]: undefined;
4
+ } & {
5
+ [key in K]: Obj[K];
6
+ };
7
+ type OneOfByKey<Obj> = {
8
+ [key in keyof Obj]: OneOnly<Obj, key>;
9
+ };
10
+ export type OneOf<T> = ValueOf<OneOfByKey<T>>;
11
+ export type WithRequired<T, K extends keyof T> = T & {
12
+ [P in K]-?: NonNullable<T[P]>;
13
+ };
14
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import type { Bundle as ProtoBundle } from '@sigstore/protobuf-specs';
2
+ import type { Bundle, BundleLatest, BundleV01 } from './bundle';
3
+ export declare function assertBundle(b: ProtoBundle): asserts b is Bundle;
4
+ export declare function assertBundleV01(b: ProtoBundle): asserts b is BundleV01;
5
+ export declare function isBundleV01(b: Bundle): b is BundleV01;
6
+ export declare function assertBundleV02(b: ProtoBundle): asserts b is BundleLatest;
7
+ export declare function assertBundleLatest(b: ProtoBundle): asserts b is BundleLatest;
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertBundle = assertBundle;
4
+ exports.assertBundleV01 = assertBundleV01;
5
+ exports.isBundleV01 = isBundleV01;
6
+ exports.assertBundleV02 = assertBundleV02;
7
+ exports.assertBundleLatest = assertBundleLatest;
8
+ /*
9
+ Copyright 2023 The Sigstore Authors.
10
+
11
+ Licensed under the Apache License, Version 2.0 (the "License");
12
+ you may not use this file except in compliance with the License.
13
+ You may obtain a copy of the License at
14
+
15
+ http://www.apache.org/licenses/LICENSE-2.0
16
+
17
+ Unless required by applicable law or agreed to in writing, software
18
+ distributed under the License is distributed on an "AS IS" BASIS,
19
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ See the License for the specific language governing permissions and
21
+ limitations under the License.
22
+ */
23
+ const error_1 = require("./error");
24
+ // Performs basic validation of a Sigstore bundle to ensure that all required
25
+ // fields are populated. This is not a complete validation of the bundle, but
26
+ // rather a check that the bundle is in a valid state to be processed by the
27
+ // rest of the code.
28
+ function assertBundle(b) {
29
+ const invalidValues = validateBundleBase(b);
30
+ if (invalidValues.length > 0) {
31
+ throw new error_1.ValidationError('invalid bundle', invalidValues);
32
+ }
33
+ }
34
+ // Asserts that the given bundle conforms to the v0.1 bundle format.
35
+ function assertBundleV01(b) {
36
+ const invalidValues = [];
37
+ invalidValues.push(...validateBundleBase(b));
38
+ invalidValues.push(...validateInclusionPromise(b));
39
+ if (invalidValues.length > 0) {
40
+ throw new error_1.ValidationError('invalid v0.1 bundle', invalidValues);
41
+ }
42
+ }
43
+ // Type guard to determine if Bundle is a v0.1 bundle.
44
+ function isBundleV01(b) {
45
+ try {
46
+ assertBundleV01(b);
47
+ return true;
48
+ }
49
+ catch (e) {
50
+ return false;
51
+ }
52
+ }
53
+ // Asserts that the given bundle conforms to the v0.2 bundle format.
54
+ function assertBundleV02(b) {
55
+ const invalidValues = [];
56
+ invalidValues.push(...validateBundleBase(b));
57
+ invalidValues.push(...validateInclusionProof(b));
58
+ if (invalidValues.length > 0) {
59
+ throw new error_1.ValidationError('invalid v0.2 bundle', invalidValues);
60
+ }
61
+ }
62
+ // Asserts that the given bundle conforms to the newest (0.3) bundle format.
63
+ function assertBundleLatest(b) {
64
+ const invalidValues = [];
65
+ invalidValues.push(...validateBundleBase(b));
66
+ invalidValues.push(...validateInclusionProof(b));
67
+ invalidValues.push(...validateNoCertificateChain(b));
68
+ if (invalidValues.length > 0) {
69
+ throw new error_1.ValidationError('invalid bundle', invalidValues);
70
+ }
71
+ }
72
+ function validateBundleBase(b) {
73
+ const invalidValues = [];
74
+ // Media type validation
75
+ if (b.mediaType === undefined ||
76
+ (!b.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\+json;version=\d\.\d/) &&
77
+ !b.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\.v\d\.\d\+json/))) {
78
+ invalidValues.push('mediaType');
79
+ }
80
+ // Content-related validation
81
+ if (b.content === undefined) {
82
+ invalidValues.push('content');
83
+ }
84
+ else {
85
+ switch (b.content.$case) {
86
+ case 'messageSignature':
87
+ if (b.content.messageSignature.messageDigest === undefined) {
88
+ invalidValues.push('content.messageSignature.messageDigest');
89
+ }
90
+ else {
91
+ if (b.content.messageSignature.messageDigest.digest.length === 0) {
92
+ invalidValues.push('content.messageSignature.messageDigest.digest');
93
+ }
94
+ }
95
+ if (b.content.messageSignature.signature.length === 0) {
96
+ invalidValues.push('content.messageSignature.signature');
97
+ }
98
+ break;
99
+ case 'dsseEnvelope':
100
+ if (b.content.dsseEnvelope.payload.length === 0) {
101
+ invalidValues.push('content.dsseEnvelope.payload');
102
+ }
103
+ if (b.content.dsseEnvelope.signatures.length !== 1) {
104
+ invalidValues.push('content.dsseEnvelope.signatures');
105
+ }
106
+ else {
107
+ if (b.content.dsseEnvelope.signatures[0].sig.length === 0) {
108
+ invalidValues.push('content.dsseEnvelope.signatures[0].sig');
109
+ }
110
+ }
111
+ break;
112
+ }
113
+ }
114
+ // Verification material-related validation
115
+ if (b.verificationMaterial === undefined) {
116
+ invalidValues.push('verificationMaterial');
117
+ }
118
+ else {
119
+ if (b.verificationMaterial.content === undefined) {
120
+ invalidValues.push('verificationMaterial.content');
121
+ }
122
+ else {
123
+ switch (b.verificationMaterial.content.$case) {
124
+ case 'x509CertificateChain':
125
+ if (b.verificationMaterial.content.x509CertificateChain.certificates
126
+ .length === 0) {
127
+ invalidValues.push('verificationMaterial.content.x509CertificateChain.certificates');
128
+ }
129
+ b.verificationMaterial.content.x509CertificateChain.certificates.forEach((cert, i) => {
130
+ if (cert.rawBytes.length === 0) {
131
+ invalidValues.push(`verificationMaterial.content.x509CertificateChain.certificates[${i}].rawBytes`);
132
+ }
133
+ });
134
+ break;
135
+ case 'certificate':
136
+ if (b.verificationMaterial.content.certificate.rawBytes.length === 0) {
137
+ invalidValues.push('verificationMaterial.content.certificate.rawBytes');
138
+ }
139
+ break;
140
+ }
141
+ }
142
+ if (b.verificationMaterial.tlogEntries === undefined) {
143
+ invalidValues.push('verificationMaterial.tlogEntries');
144
+ }
145
+ else {
146
+ if (b.verificationMaterial.tlogEntries.length > 0) {
147
+ b.verificationMaterial.tlogEntries.forEach((entry, i) => {
148
+ if (entry.logId === undefined) {
149
+ invalidValues.push(`verificationMaterial.tlogEntries[${i}].logId`);
150
+ }
151
+ if (entry.kindVersion === undefined) {
152
+ invalidValues.push(`verificationMaterial.tlogEntries[${i}].kindVersion`);
153
+ }
154
+ });
155
+ }
156
+ }
157
+ }
158
+ return invalidValues;
159
+ }
160
+ // Necessary for V01 bundles
161
+ function validateInclusionPromise(b) {
162
+ const invalidValues = [];
163
+ if (b.verificationMaterial &&
164
+ b.verificationMaterial.tlogEntries?.length > 0) {
165
+ b.verificationMaterial.tlogEntries.forEach((entry, i) => {
166
+ if (entry.inclusionPromise === undefined) {
167
+ invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionPromise`);
168
+ }
169
+ });
170
+ }
171
+ return invalidValues;
172
+ }
173
+ // Necessary for V02 and later bundles
174
+ function validateInclusionProof(b) {
175
+ const invalidValues = [];
176
+ if (b.verificationMaterial &&
177
+ b.verificationMaterial.tlogEntries?.length > 0) {
178
+ b.verificationMaterial.tlogEntries.forEach((entry, i) => {
179
+ if (entry.inclusionProof === undefined) {
180
+ invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof`);
181
+ }
182
+ else {
183
+ if (entry.inclusionProof.checkpoint === undefined) {
184
+ invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof.checkpoint`);
185
+ }
186
+ }
187
+ });
188
+ }
189
+ return invalidValues;
190
+ }
191
+ // Necessary for V03 and later bundles
192
+ function validateNoCertificateChain(b) {
193
+ const invalidValues = [];
194
+ /* istanbul ignore next */
195
+ if (b.verificationMaterial?.content?.$case === 'x509CertificateChain') {
196
+ invalidValues.push('verificationMaterial.content.$case');
197
+ }
198
+ return invalidValues;
199
+ }