ooxml-core 1.13.0 → 1.14.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 (635) hide show
  1. package/dist/PptxHandler-5YP75BPO.cjs +12 -0
  2. package/dist/PptxHandler-GT5Q66TG.mjs +3 -0
  3. package/dist/{PptxHandler-FIN6XDTI.mjs → PptxHandler-KNBFECUE.mjs} +3 -3
  4. package/dist/PresentationBuilder-5DCCFHWJ.mjs +7 -0
  5. package/dist/PresentationBuilder-CVM6LJ7L.mjs +3 -0
  6. package/dist/PresentationBuilder-II7C4A3R.cjs +20 -0
  7. package/dist/automation/docx.d.ts +18 -0
  8. package/dist/automation/docx.d.ts.map +1 -1
  9. package/dist/automation/index.cjs +21278 -8022
  10. package/dist/automation/index.d.ts +1 -0
  11. package/dist/automation/index.d.ts.map +1 -1
  12. package/dist/automation/index.mjs +21275 -8023
  13. package/dist/automation/node.cjs +66 -6
  14. package/dist/automation/node.d.ts +10 -0
  15. package/dist/automation/node.d.ts.map +1 -1
  16. package/dist/automation/node.mjs +67 -7
  17. package/dist/automation/outline.d.ts +29 -0
  18. package/dist/automation/outline.d.ts.map +1 -0
  19. package/dist/automation/xlsx.d.ts +21 -0
  20. package/dist/automation/xlsx.d.ts.map +1 -1
  21. package/dist/chart/auto-title.d.ts +31 -0
  22. package/dist/chart/auto-title.d.ts.map +1 -0
  23. package/dist/chart/axis-format.d.ts +13 -0
  24. package/dist/chart/axis-format.d.ts.map +1 -0
  25. package/dist/chart/bubble-radius.d.ts +30 -0
  26. package/dist/chart/bubble-radius.d.ts.map +1 -0
  27. package/dist/chart/error-bar-amount.d.ts +22 -0
  28. package/dist/chart/error-bar-amount.d.ts.map +1 -0
  29. package/dist/chart/hierarchy.d.ts +69 -0
  30. package/dist/chart/hierarchy.d.ts.map +1 -0
  31. package/dist/chart/index.cjs +2377 -527
  32. package/dist/chart/index.d.ts +12 -0
  33. package/dist/chart/index.d.ts.map +1 -1
  34. package/dist/chart/index.mjs +2338 -528
  35. package/dist/chart/model-analysis.d.ts +66 -0
  36. package/dist/chart/model-analysis.d.ts.map +1 -0
  37. package/dist/chart/model-series.d.ts +5 -0
  38. package/dist/chart/model-series.d.ts.map +1 -1
  39. package/dist/chart/number-format-pattern.d.ts +35 -0
  40. package/dist/chart/number-format-pattern.d.ts.map +1 -0
  41. package/dist/chart/number-format.d.ts +21 -0
  42. package/dist/chart/number-format.d.ts.map +1 -0
  43. package/dist/chart/parse-analysis.d.ts +13 -0
  44. package/dist/chart/parse-analysis.d.ts.map +1 -0
  45. package/dist/chart/parse-series.d.ts +1 -1
  46. package/dist/chart/parse-series.d.ts.map +1 -1
  47. package/dist/chart/parse-util.d.ts +2 -0
  48. package/dist/chart/parse-util.d.ts.map +1 -1
  49. package/dist/chart/render/chart-svg-analysis.d.ts +7 -0
  50. package/dist/chart/render/chart-svg-analysis.d.ts.map +1 -0
  51. package/dist/chart/render/chart-svg-bars.d.ts +5 -0
  52. package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
  53. package/dist/chart/render/chart-svg-cartesian.d.ts +7 -2
  54. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  55. package/dist/chart/render/chart-svg-hierarchy.d.ts +5 -0
  56. package/dist/chart/render/chart-svg-hierarchy.d.ts.map +1 -0
  57. package/dist/chart/render/chart-svg-plots.d.ts +5 -0
  58. package/dist/chart/render/chart-svg-plots.d.ts.map +1 -0
  59. package/dist/chart/render/chart-svg-stock.d.ts +4 -0
  60. package/dist/chart/render/chart-svg-stock.d.ts.map +1 -0
  61. package/dist/chart/render/chart-svg-waterfall.d.ts +4 -0
  62. package/dist/chart/render/chart-svg-waterfall.d.ts.map +1 -0
  63. package/dist/chart/render/chart-svg-xy.d.ts +4 -0
  64. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -0
  65. package/dist/chart/render/chart-svg.d.ts +1 -1
  66. package/dist/chart/render/chart-svg.d.ts.map +1 -1
  67. package/dist/chart/render/chart-value-axis.d.ts +6 -1
  68. package/dist/chart/render/chart-value-axis.d.ts.map +1 -1
  69. package/dist/chart/render/chart-view-analysis.d.ts +30 -0
  70. package/dist/chart/render/chart-view-analysis.d.ts.map +1 -0
  71. package/dist/chart/render/chart-view-ex.d.ts +24 -0
  72. package/dist/chart/render/chart-view-ex.d.ts.map +1 -0
  73. package/dist/chart/render/chart-view-families.d.ts +10 -0
  74. package/dist/chart/render/chart-view-families.d.ts.map +1 -0
  75. package/dist/chart/render/chart-view-series.d.ts +36 -0
  76. package/dist/chart/render/chart-view-series.d.ts.map +1 -0
  77. package/dist/chart/render/chart-view-stock.d.ts +23 -0
  78. package/dist/chart/render/chart-view-stock.d.ts.map +1 -0
  79. package/dist/chart/render/chart-view.d.ts +49 -18
  80. package/dist/chart/render/chart-view.d.ts.map +1 -1
  81. package/dist/chart/render/index.d.ts +2 -0
  82. package/dist/chart/render/index.d.ts.map +1 -1
  83. package/dist/chart/render/render-space.d.ts +6 -1
  84. package/dist/chart/render/render-space.d.ts.map +1 -1
  85. package/dist/chart/render/summary-analysis.d.ts +11 -0
  86. package/dist/chart/render/summary-analysis.d.ts.map +1 -0
  87. package/dist/chart/render/summary-from-chartex.d.ts +11 -0
  88. package/dist/chart/render/summary-from-chartex.d.ts.map +1 -0
  89. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  90. package/dist/chart/render/summary.d.ts +86 -3
  91. package/dist/chart/render/summary.d.ts.map +1 -1
  92. package/dist/chart/stock-candles.d.ts +72 -0
  93. package/dist/chart/stock-candles.d.ts.map +1 -0
  94. package/dist/chart/style-palette.d.ts +29 -0
  95. package/dist/chart/style-palette.d.ts.map +1 -0
  96. package/dist/chart/sunburst-arcs.d.ts +41 -0
  97. package/dist/chart/sunburst-arcs.d.ts.map +1 -0
  98. package/dist/chart/trendline-fit.d.ts +39 -0
  99. package/dist/chart/trendline-fit.d.ts.map +1 -0
  100. package/dist/chart/waterfall.d.ts +31 -0
  101. package/dist/chart/waterfall.d.ts.map +1 -0
  102. package/dist/chart/write-analysis.d.ts +12 -0
  103. package/dist/chart/write-analysis.d.ts.map +1 -0
  104. package/dist/chart/write-series.d.ts.map +1 -1
  105. package/dist/{chunk-G5PQKHCG.mjs → chunk-2D4IFQ5M.mjs} +1 -1
  106. package/dist/{chunk-UAY26XOI.mjs → chunk-2EBMHIGJ.mjs} +1303 -994
  107. package/dist/{chunk-TVE6UIJF.mjs → chunk-4WZLFUUA.mjs} +54 -13
  108. package/dist/{chunk-H2FRDUNV.mjs → chunk-54ASP65T.mjs} +868 -585
  109. package/dist/chunk-M4XLF4R7.mjs +387 -0
  110. package/dist/{chunk-O6NIA4NG.mjs → chunk-ORH32TO3.mjs} +5798 -5742
  111. package/dist/{chunk-B2JBBAEQ.mjs → chunk-TNNXOW2O.mjs} +1 -1
  112. package/dist/{chunk-IT3U6QD6.cjs → chunk-TQE7FFNT.cjs} +6754 -6695
  113. package/dist/{chunk-7QZGRB3T.cjs → chunk-X7MGZQ6C.cjs} +1321 -995
  114. package/dist/{chunk-6DELVMYB.mjs → chunk-XGXIS4PN.mjs} +12316 -12260
  115. package/dist/crypto/decrypt.d.ts +17 -3
  116. package/dist/crypto/decrypt.d.ts.map +1 -1
  117. package/dist/crypto/encryption-info.d.ts.map +1 -1
  118. package/dist/crypto/index.cjs +252 -78
  119. package/dist/crypto/index.d.ts +19 -4
  120. package/dist/crypto/index.d.ts.map +1 -1
  121. package/dist/crypto/index.mjs +252 -79
  122. package/dist/crypto/key-derivation.d.ts +2 -3
  123. package/dist/crypto/key-derivation.d.ts.map +1 -1
  124. package/dist/crypto/validate.d.ts +22 -0
  125. package/dist/crypto/validate.d.ts.map +1 -0
  126. package/dist/diagram/engine/layout-def-parse.d.ts.map +1 -1
  127. package/dist/diagram/engine/pres-tree.d.ts.map +1 -1
  128. package/dist/diagram/index.cjs +102 -52
  129. package/dist/diagram/index.mjs +102 -52
  130. package/dist/digest/index.cjs +23 -11
  131. package/dist/digest/index.d.ts +2 -1
  132. package/dist/digest/index.d.ts.map +1 -1
  133. package/dist/digest/index.mjs +21 -12
  134. package/dist/digest/password-hash.d.ts +19 -5
  135. package/dist/digest/password-hash.d.ts.map +1 -1
  136. package/dist/digest/timing-safe.d.ts +7 -0
  137. package/dist/digest/timing-safe.d.ts.map +1 -0
  138. package/dist/docx/block-parser.d.ts.map +1 -1
  139. package/dist/docx/chart-paint.d.ts.map +1 -1
  140. package/dist/docx/chart.d.ts +10 -2
  141. package/dist/docx/chart.d.ts.map +1 -1
  142. package/dist/docx/content-control-edit.d.ts +26 -0
  143. package/dist/docx/content-control-edit.d.ts.map +1 -0
  144. package/dist/docx/content-control-model.d.ts +51 -0
  145. package/dist/docx/content-control-model.d.ts.map +1 -0
  146. package/dist/docx/content-control.d.ts +9 -0
  147. package/dist/docx/content-control.d.ts.map +1 -0
  148. package/dist/docx/default-styles.d.ts.map +1 -1
  149. package/dist/docx/drawing.d.ts.map +1 -1
  150. package/dist/docx/embedded.cjs +9932 -935
  151. package/dist/docx/embedded.mjs +9932 -935
  152. package/dist/docx/equation.d.ts +7 -3
  153. package/dist/docx/equation.d.ts.map +1 -1
  154. package/dist/docx/index.cjs +14117 -1513
  155. package/dist/docx/index.d.ts +6 -0
  156. package/dist/docx/index.d.ts.map +1 -1
  157. package/dist/docx/index.mjs +14093 -1514
  158. package/dist/docx/inline-model.d.ts +3 -0
  159. package/dist/docx/inline-model.d.ts.map +1 -1
  160. package/dist/docx/layout/adapt-floats.d.ts +3 -3
  161. package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
  162. package/dist/docx/layout/adapter.d.ts.map +1 -1
  163. package/dist/docx/layout/equation-object.d.ts +7 -0
  164. package/dist/docx/layout/equation-object.d.ts.map +1 -0
  165. package/dist/docx/layout/floats.d.ts +8 -0
  166. package/dist/docx/layout/floats.d.ts.map +1 -1
  167. package/dist/docx/layout/incremental-layout.d.ts +39 -0
  168. package/dist/docx/layout/incremental-layout.d.ts.map +1 -0
  169. package/dist/docx/layout/index.cjs +14177 -1707
  170. package/dist/docx/layout/index.d.ts +2 -2
  171. package/dist/docx/layout/index.d.ts.map +1 -1
  172. package/dist/docx/layout/index.mjs +14176 -1708
  173. package/dist/docx/layout/input.d.ts +4 -0
  174. package/dist/docx/layout/input.d.ts.map +1 -1
  175. package/dist/docx/layout/layout-session.d.ts +13 -2
  176. package/dist/docx/layout/layout-session.d.ts.map +1 -1
  177. package/dist/docx/layout/layout.d.ts +1 -1
  178. package/dist/docx/layout/layout.d.ts.map +1 -1
  179. package/dist/docx/layout/line-metrics.d.ts.map +1 -1
  180. package/dist/docx/layout/page-cursor.d.ts +1 -1
  181. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  182. package/dist/docx/layout/page-fields.d.ts +3 -1
  183. package/dist/docx/layout/page-fields.d.ts.map +1 -1
  184. package/dist/docx/layout/result.d.ts +14 -1
  185. package/dist/docx/layout/result.d.ts.map +1 -1
  186. package/dist/docx/layout/section-flow.d.ts +11 -1
  187. package/dist/docx/layout/section-flow.d.ts.map +1 -1
  188. package/dist/docx/ligatures.d.ts +2 -0
  189. package/dist/docx/ligatures.d.ts.map +1 -1
  190. package/dist/docx/load/index.cjs +12709 -3590
  191. package/dist/docx/load/index.mjs +12709 -3590
  192. package/dist/docx/model-paragraph.d.ts +3 -0
  193. package/dist/docx/model-paragraph.d.ts.map +1 -1
  194. package/dist/docx/model-run.d.ts +3 -0
  195. package/dist/docx/model-run.d.ts.map +1 -1
  196. package/dist/docx/model.d.ts +3 -0
  197. package/dist/docx/model.d.ts.map +1 -1
  198. package/dist/docx/numbering-parse.d.ts.map +1 -1
  199. package/dist/docx/numbering-text.d.ts.map +1 -1
  200. package/dist/docx/package-limits.d.ts +6 -0
  201. package/dist/docx/package-limits.d.ts.map +1 -0
  202. package/dist/docx/parse-content-control.d.ts +28 -0
  203. package/dist/docx/parse-content-control.d.ts.map +1 -0
  204. package/dist/docx/parse-table.d.ts.map +1 -1
  205. package/dist/docx/parse.d.ts.map +1 -1
  206. package/dist/docx/save.d.ts.map +1 -1
  207. package/dist/docx/shape-model.d.ts +31 -0
  208. package/dist/docx/shape-model.d.ts.map +1 -0
  209. package/dist/docx/shape-palette.d.ts +19 -0
  210. package/dist/docx/shape-palette.d.ts.map +1 -0
  211. package/dist/docx/shape-parse.d.ts +16 -0
  212. package/dist/docx/shape-parse.d.ts.map +1 -0
  213. package/dist/docx/shape-svg.d.ts +20 -0
  214. package/dist/docx/shape-svg.d.ts.map +1 -0
  215. package/dist/docx/table-model.d.ts +4 -0
  216. package/dist/docx/table-model.d.ts.map +1 -1
  217. package/dist/docx/ui/content-control-commands.d.ts +37 -0
  218. package/dist/docx/ui/content-control-commands.d.ts.map +1 -0
  219. package/dist/docx/ui/content-control-guard.d.ts +8 -0
  220. package/dist/docx/ui/content-control-guard.d.ts.map +1 -0
  221. package/dist/docx/ui/content-control-spans.d.ts +19 -0
  222. package/dist/docx/ui/content-control-spans.d.ts.map +1 -0
  223. package/dist/docx/ui/index.cjs +3132 -506
  224. package/dist/docx/ui/index.d.ts +3 -0
  225. package/dist/docx/ui/index.d.ts.map +1 -1
  226. package/dist/docx/ui/index.mjs +3117 -507
  227. package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
  228. package/dist/docx/ui/paragraph-attributes.d.ts.map +1 -1
  229. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  230. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  231. package/dist/docx/ui/run-adapter.d.ts.map +1 -1
  232. package/dist/docx/ui/run-compare.d.ts.map +1 -1
  233. package/dist/docx/ui/run-mark-properties.d.ts.map +1 -1
  234. package/dist/docx/ui/run-marks.d.ts.map +1 -1
  235. package/dist/docx/ui/schema-marks.d.ts +16 -1
  236. package/dist/docx/ui/schema-marks.d.ts.map +1 -1
  237. package/dist/docx/ui/table-structure-guard.d.ts.map +1 -1
  238. package/dist/docx/write-block-placement.d.ts +9 -0
  239. package/dist/docx/write-block-placement.d.ts.map +1 -0
  240. package/dist/docx/write-content-control.d.ts +12 -0
  241. package/dist/docx/write-content-control.d.ts.map +1 -0
  242. package/dist/docx/write-drawing.d.ts +2 -0
  243. package/dist/docx/write-drawing.d.ts.map +1 -1
  244. package/dist/docx/write-inline.d.ts.map +1 -1
  245. package/dist/docx/write-paragraph.d.ts.map +1 -1
  246. package/dist/docx/write-shape.d.ts +16 -0
  247. package/dist/docx/write-shape.d.ts.map +1 -0
  248. package/dist/docx/write-table.d.ts.map +1 -1
  249. package/dist/docx/write.d.ts.map +1 -1
  250. package/dist/drawingml/index.cjs +24 -0
  251. package/dist/drawingml/index.mjs +24 -0
  252. package/dist/geometry/index.cjs +63 -48
  253. package/dist/geometry/index.mjs +63 -48
  254. package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
  255. package/dist/index.cjs +4291 -1578
  256. package/dist/index.mjs +4291 -1578
  257. package/dist/math/equation-gallery.d.ts +10 -0
  258. package/dist/math/equation-gallery.d.ts.map +1 -0
  259. package/dist/math/index.cjs +777 -139
  260. package/dist/math/index.d.ts +3 -0
  261. package/dist/math/index.d.ts.map +1 -1
  262. package/dist/math/index.mjs +772 -140
  263. package/dist/math/latex-omml-siblings.d.ts.map +1 -1
  264. package/dist/math/latex-to-omml.d.ts.map +1 -1
  265. package/dist/math/omml-box-grouped.d.ts +9 -0
  266. package/dist/math/omml-box-grouped.d.ts.map +1 -0
  267. package/dist/math/omml-box-layout.d.ts +15 -0
  268. package/dist/math/omml-box-layout.d.ts.map +1 -0
  269. package/dist/math/omml-box-structures.d.ts +7 -0
  270. package/dist/math/omml-box-structures.d.ts.map +1 -0
  271. package/dist/math/omml-box.d.ts +85 -0
  272. package/dist/math/omml-box.d.ts.map +1 -0
  273. package/dist/math/omml-dom.d.ts.map +1 -1
  274. package/dist/math/omml-mathml-converters.d.ts.map +1 -1
  275. package/dist/math/omml-svg.d.ts +14 -0
  276. package/dist/math/omml-svg.d.ts.map +1 -0
  277. package/dist/math/omml-to-xml.d.ts +10 -0
  278. package/dist/math/omml-to-xml.d.ts.map +1 -0
  279. package/dist/opc/embedded-packages.d.ts.map +1 -1
  280. package/dist/opc/index.cjs +257 -22
  281. package/dist/opc/index.d.ts +1 -0
  282. package/dist/opc/index.d.ts.map +1 -1
  283. package/dist/opc/index.mjs +251 -23
  284. package/dist/opc/package.d.ts.map +1 -1
  285. package/dist/opc/signature/detection.d.ts +22 -6
  286. package/dist/opc/signature/detection.d.ts.map +1 -1
  287. package/dist/opc/signature/index.d.ts +1 -1
  288. package/dist/opc/signature/index.d.ts.map +1 -1
  289. package/dist/opc/signature/xml-utils.d.ts.map +1 -1
  290. package/dist/opc/zip-limits.d.ts +52 -0
  291. package/dist/opc/zip-limits.d.ts.map +1 -0
  292. package/dist/pptx/automation/index.cjs +1848 -1320
  293. package/dist/pptx/automation/index.d.ts +4 -4
  294. package/dist/pptx/automation/index.mjs +6 -6
  295. package/dist/pptx/chunks/{elements-DmbzOhFu.d.ts → elements-tK7xnWeS.d.ts} +20 -9
  296. package/dist/pptx/chunks/elements-tK7xnWeS.d.ts.map +1 -0
  297. package/dist/pptx/chunks/{index-Cija6Dih.d.ts → index-BSpNQuvz.d.ts} +30 -5
  298. package/dist/pptx/chunks/{index-Cija6Dih.d.ts.map → index-BSpNQuvz.d.ts.map} +1 -1
  299. package/dist/pptx/chunks/{index-BmvOxbsh.d.ts → index-DS9Y4Ne3.d.ts} +25 -9
  300. package/dist/pptx/chunks/index-DS9Y4Ne3.d.ts.map +1 -0
  301. package/dist/pptx/chunks/inspection-status-DjiWd_Aa.d.ts.map +1 -1
  302. package/dist/pptx/chunks/{text-operations-sXxhsKDd.d.ts → text-operations-BdD_UQ11.d.ts} +2 -2
  303. package/dist/pptx/chunks/{text-operations-sXxhsKDd.d.ts.map → text-operations-BdD_UQ11.d.ts.map} +1 -1
  304. package/dist/pptx/cli/index.cjs +1795 -1275
  305. package/dist/pptx/cli/index.d.ts +1 -1
  306. package/dist/pptx/cli/index.mjs +5 -5
  307. package/dist/pptx/converter/index.cjs +80 -54
  308. package/dist/pptx/converter/index.d.ts +1 -1
  309. package/dist/pptx/converter/index.mjs +3 -3
  310. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  311. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  312. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  313. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  314. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  315. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  316. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  317. package/dist/pptx/index.cjs +1117 -351
  318. package/dist/pptx/index.d.ts +5 -5
  319. package/dist/pptx/index.mjs +6 -6
  320. package/dist/pptx/signature-node/index.cjs +342 -65
  321. package/dist/pptx/signature-node/index.d.ts +12 -1
  322. package/dist/pptx/signature-node/index.d.ts.map +1 -1
  323. package/dist/pptx/signature-node/index.mjs +112 -52
  324. package/dist/teams/activity-feed.d.ts +19 -0
  325. package/dist/teams/activity-feed.d.ts.map +1 -0
  326. package/dist/teams/activity-state.d.ts +12 -0
  327. package/dist/teams/activity-state.d.ts.map +1 -0
  328. package/dist/teams/activity.d.ts +52 -0
  329. package/dist/teams/activity.d.ts.map +1 -0
  330. package/dist/teams/calendar.d.ts +57 -0
  331. package/dist/teams/calendar.d.ts.map +1 -0
  332. package/dist/teams/chat-actions.d.ts +20 -0
  333. package/dist/teams/chat-actions.d.ts.map +1 -0
  334. package/dist/teams/chat-rooms.d.ts +42 -0
  335. package/dist/teams/chat-rooms.d.ts.map +1 -0
  336. package/dist/teams/chat-view.d.ts +56 -0
  337. package/dist/teams/chat-view.d.ts.map +1 -0
  338. package/dist/teams/chat.d.ts +19 -3
  339. package/dist/teams/chat.d.ts.map +1 -1
  340. package/dist/teams/chats.d.ts +52 -0
  341. package/dist/teams/chats.d.ts.map +1 -0
  342. package/dist/teams/ics-timezone.d.ts +17 -0
  343. package/dist/teams/ics-timezone.d.ts.map +1 -0
  344. package/dist/teams/ics.d.ts +20 -0
  345. package/dist/teams/ics.d.ts.map +1 -0
  346. package/dist/teams/index.cjs +7252 -2926
  347. package/dist/teams/index.d.ts +22 -0
  348. package/dist/teams/index.d.ts.map +1 -1
  349. package/dist/teams/index.mjs +7162 -2927
  350. package/dist/teams/meeting-actions.d.ts +31 -0
  351. package/dist/teams/meeting-actions.d.ts.map +1 -0
  352. package/dist/teams/meeting-exceptions.d.ts +28 -0
  353. package/dist/teams/meeting-exceptions.d.ts.map +1 -0
  354. package/dist/teams/meeting-reminders.d.ts +13 -0
  355. package/dist/teams/meeting-reminders.d.ts.map +1 -0
  356. package/dist/teams/meetings.d.ts +71 -0
  357. package/dist/teams/meetings.d.ts.map +1 -0
  358. package/dist/teams/mention-text.d.ts +11 -0
  359. package/dist/teams/mention-text.d.ts.map +1 -0
  360. package/dist/teams/mentions.d.ts +68 -0
  361. package/dist/teams/mentions.d.ts.map +1 -0
  362. package/dist/teams/model.d.ts +7 -0
  363. package/dist/teams/model.d.ts.map +1 -1
  364. package/dist/teams/notifications.d.ts +21 -0
  365. package/dist/teams/notifications.d.ts.map +1 -0
  366. package/dist/teams/recurrence.d.ts +18 -0
  367. package/dist/teams/recurrence.d.ts.map +1 -0
  368. package/dist/teams/roster.d.ts +12 -0
  369. package/dist/teams/roster.d.ts.map +1 -0
  370. package/dist/teams/server-config.d.ts +23 -2
  371. package/dist/teams/server-config.d.ts.map +1 -1
  372. package/dist/teams/server-session.d.ts +19 -0
  373. package/dist/teams/server-session.d.ts.map +1 -0
  374. package/dist/teams/shared-chat.d.ts +83 -0
  375. package/dist/teams/shared-chat.d.ts.map +1 -0
  376. package/dist/teams/store.d.ts +58 -4
  377. package/dist/teams/store.d.ts.map +1 -1
  378. package/dist/teams/sync-transport.d.ts +12 -0
  379. package/dist/teams/sync-transport.d.ts.map +1 -0
  380. package/dist/teams/time-zone.d.ts +32 -0
  381. package/dist/teams/time-zone.d.ts.map +1 -0
  382. package/dist/teams/view.d.ts +3 -0
  383. package/dist/teams/view.d.ts.map +1 -1
  384. package/dist/teams/workspace.d.ts +13 -2
  385. package/dist/teams/workspace.d.ts.map +1 -1
  386. package/dist/visio/edit-connector-follow.d.ts +15 -0
  387. package/dist/visio/edit-connector-follow.d.ts.map +1 -0
  388. package/dist/visio/edit-connector-obstacles.d.ts +9 -3
  389. package/dist/visio/edit-connector-obstacles.d.ts.map +1 -1
  390. package/dist/visio/edit-connector-reroute.d.ts.map +1 -1
  391. package/dist/visio/edit-connector.d.ts.map +1 -1
  392. package/dist/visio/edit-master-add.d.ts +37 -0
  393. package/dist/visio/edit-master-add.d.ts.map +1 -0
  394. package/dist/visio/edit-master-drop.d.ts +6 -0
  395. package/dist/visio/edit-master-drop.d.ts.map +1 -1
  396. package/dist/visio/edit-recalculate-index.d.ts +5 -0
  397. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  398. package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
  399. package/dist/visio/edit-stencil-connector-layout.d.ts +2 -0
  400. package/dist/visio/edit-stencil-connector-layout.d.ts.map +1 -1
  401. package/dist/visio/edit-stencil-connector.d.ts +1 -0
  402. package/dist/visio/edit-stencil-connector.d.ts.map +1 -1
  403. package/dist/visio/edit-stencil-import.d.ts +10 -0
  404. package/dist/visio/edit-stencil-import.d.ts.map +1 -0
  405. package/dist/visio/edit-stencil-line.d.ts +29 -0
  406. package/dist/visio/edit-stencil-line.d.ts.map +1 -0
  407. package/dist/visio/edit-stencil-master.d.ts +3 -8
  408. package/dist/visio/edit-stencil-master.d.ts.map +1 -1
  409. package/dist/visio/edit.d.ts.map +1 -1
  410. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  411. package/dist/visio/formula-math-functions.d.ts +11 -0
  412. package/dist/visio/formula-math-functions.d.ts.map +1 -0
  413. package/dist/visio/formula-text-functions.d.ts +23 -0
  414. package/dist/visio/formula-text-functions.d.ts.map +1 -0
  415. package/dist/visio/formula.d.ts.map +1 -1
  416. package/dist/visio/index.cjs +2552 -1833
  417. package/dist/visio/index.d.ts +1 -0
  418. package/dist/visio/index.d.ts.map +1 -1
  419. package/dist/visio/index.mjs +2552 -1834
  420. package/dist/visio/parser.d.ts +6 -0
  421. package/dist/visio/parser.d.ts.map +1 -1
  422. package/dist/visio/stencil-file.d.ts +14 -0
  423. package/dist/visio/stencil-file.d.ts.map +1 -0
  424. package/dist/visio/ui/index.cjs +2398 -1679
  425. package/dist/visio/ui/index.mjs +2398 -1680
  426. package/dist/visio/ui/master-drop.d.ts +10 -0
  427. package/dist/visio/ui/master-drop.d.ts.map +1 -1
  428. package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
  429. package/dist/xlsx/edit/clipboard-html-parse.d.ts +4 -0
  430. package/dist/xlsx/edit/clipboard-html-parse.d.ts.map +1 -1
  431. package/dist/xlsx/edit/data-table.d.ts +38 -0
  432. package/dist/xlsx/edit/data-table.d.ts.map +1 -0
  433. package/dist/xlsx/edit/drawings.d.ts.map +1 -1
  434. package/dist/xlsx/edit/goal-seek.d.ts +30 -0
  435. package/dist/xlsx/edit/goal-seek.d.ts.map +1 -0
  436. package/dist/xlsx/edit/goal-solver.d.ts +20 -0
  437. package/dist/xlsx/edit/goal-solver.d.ts.map +1 -0
  438. package/dist/xlsx/edit/history.d.ts +1 -1
  439. package/dist/xlsx/edit/history.d.ts.map +1 -1
  440. package/dist/xlsx/edit/index.d.ts +5 -0
  441. package/dist/xlsx/edit/index.d.ts.map +1 -1
  442. package/dist/xlsx/edit/input-text.d.ts.map +1 -1
  443. package/dist/xlsx/edit/pivots.d.ts +2 -1
  444. package/dist/xlsx/edit/pivots.d.ts.map +1 -1
  445. package/dist/xlsx/edit/scenarios.d.ts +41 -0
  446. package/dist/xlsx/edit/scenarios.d.ts.map +1 -0
  447. package/dist/xlsx/edit/session.d.ts.map +1 -1
  448. package/dist/xlsx/edit/slicers.d.ts +34 -0
  449. package/dist/xlsx/edit/slicers.d.ts.map +1 -0
  450. package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
  451. package/dist/xlsx/edit/timelines.d.ts +26 -0
  452. package/dist/xlsx/edit/timelines.d.ts.map +1 -0
  453. package/dist/xlsx/edit/types.d.ts +39 -0
  454. package/dist/xlsx/edit/types.d.ts.map +1 -1
  455. package/dist/xlsx/formula/context.d.ts +13 -0
  456. package/dist/xlsx/formula/context.d.ts.map +1 -1
  457. package/dist/xlsx/formula/engine.d.ts.map +1 -1
  458. package/dist/xlsx/formula/evaluator.d.ts.map +1 -1
  459. package/dist/xlsx/formula/functions/helpers.d.ts +3 -2
  460. package/dist/xlsx/formula/functions/helpers.d.ts.map +1 -1
  461. package/dist/xlsx/formula/functions/text-regex.d.ts +8 -0
  462. package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
  463. package/dist/xlsx/formula/functions/text.d.ts.map +1 -1
  464. package/dist/xlsx/formula/functions/wildcard.d.ts +8 -0
  465. package/dist/xlsx/formula/functions/wildcard.d.ts.map +1 -0
  466. package/dist/xlsx/formula/values.d.ts +9 -0
  467. package/dist/xlsx/formula/values.d.ts.map +1 -1
  468. package/dist/xlsx/index.cjs +9230 -3233
  469. package/dist/xlsx/index.d.ts +1 -0
  470. package/dist/xlsx/index.d.ts.map +1 -1
  471. package/dist/xlsx/index.mjs +9146 -3233
  472. package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
  473. package/dist/xlsx/layout/header-footer-edit.d.ts +16 -0
  474. package/dist/xlsx/layout/header-footer-edit.d.ts.map +1 -0
  475. package/dist/xlsx/layout/index.d.ts +3 -0
  476. package/dist/xlsx/layout/index.d.ts.map +1 -1
  477. package/dist/xlsx/layout/page-break-view.d.ts +39 -0
  478. package/dist/xlsx/layout/page-break-view.d.ts.map +1 -0
  479. package/dist/xlsx/layout/page-view.d.ts +69 -0
  480. package/dist/xlsx/layout/page-view.d.ts.map +1 -0
  481. package/dist/xlsx/layout/ref-evaluator.d.ts.map +1 -1
  482. package/dist/xlsx/load/index.cjs +4528 -1707
  483. package/dist/xlsx/load/index.mjs +4527 -1706
  484. package/dist/xlsx/model-pivots.d.ts +88 -2
  485. package/dist/xlsx/model-pivots.d.ts.map +1 -1
  486. package/dist/xlsx/model-slicers.d.ts +146 -0
  487. package/dist/xlsx/model-slicers.d.ts.map +1 -0
  488. package/dist/xlsx/model-whatif.d.ts +51 -0
  489. package/dist/xlsx/model-whatif.d.ts.map +1 -0
  490. package/dist/xlsx/model.d.ts +26 -1
  491. package/dist/xlsx/model.d.ts.map +1 -1
  492. package/dist/xlsx/pivot/admission.d.ts.map +1 -1
  493. package/dist/xlsx/pivot/aggregate.d.ts +15 -6
  494. package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
  495. package/dist/xlsx/pivot/axes.d.ts +6 -0
  496. package/dist/xlsx/pivot/axes.d.ts.map +1 -0
  497. package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -1
  498. package/dist/xlsx/pivot/columns.d.ts +48 -0
  499. package/dist/xlsx/pivot/columns.d.ts.map +1 -0
  500. package/dist/xlsx/pivot/data.d.ts +9 -3
  501. package/dist/xlsx/pivot/data.d.ts.map +1 -1
  502. package/dist/xlsx/pivot/date-axes.d.ts +12 -0
  503. package/dist/xlsx/pivot/date-axes.d.ts.map +1 -0
  504. package/dist/xlsx/pivot/date-group-read.d.ts +11 -0
  505. package/dist/xlsx/pivot/date-group-read.d.ts.map +1 -0
  506. package/dist/xlsx/pivot/date-groups.d.ts +60 -0
  507. package/dist/xlsx/pivot/date-groups.d.ts.map +1 -0
  508. package/dist/xlsx/pivot/date-read.d.ts +10 -0
  509. package/dist/xlsx/pivot/date-read.d.ts.map +1 -0
  510. package/dist/xlsx/pivot/dates.d.ts +17 -0
  511. package/dist/xlsx/pivot/dates.d.ts.map +1 -0
  512. package/dist/xlsx/pivot/group-read.d.ts +9 -0
  513. package/dist/xlsx/pivot/group-read.d.ts.map +1 -0
  514. package/dist/xlsx/pivot/groups.d.ts +31 -0
  515. package/dist/xlsx/pivot/groups.d.ts.map +1 -0
  516. package/dist/xlsx/pivot/hierarchy.d.ts +4 -1
  517. package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -1
  518. package/dist/xlsx/pivot/index.d.ts +7 -0
  519. package/dist/xlsx/pivot/index.d.ts.map +1 -1
  520. package/dist/xlsx/pivot/item-filters-read.d.ts +7 -0
  521. package/dist/xlsx/pivot/item-filters-read.d.ts.map +1 -0
  522. package/dist/xlsx/pivot/item-filters.d.ts +23 -0
  523. package/dist/xlsx/pivot/item-filters.d.ts.map +1 -0
  524. package/dist/xlsx/pivot/measures.d.ts +6 -4
  525. package/dist/xlsx/pivot/measures.d.ts.map +1 -1
  526. package/dist/xlsx/pivot/nested.d.ts +8 -0
  527. package/dist/xlsx/pivot/nested.d.ts.map +1 -0
  528. package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -1
  529. package/dist/xlsx/pivot/page-filter.d.ts.map +1 -1
  530. package/dist/xlsx/pivot/read.d.ts +2 -1
  531. package/dist/xlsx/pivot/read.d.ts.map +1 -1
  532. package/dist/xlsx/pivot/subtotal-read.d.ts +9 -0
  533. package/dist/xlsx/pivot/subtotal-read.d.ts.map +1 -0
  534. package/dist/xlsx/pivot/subtotals.d.ts +23 -0
  535. package/dist/xlsx/pivot/subtotals.d.ts.map +1 -0
  536. package/dist/xlsx/pivot/table-xml.d.ts +1 -1
  537. package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
  538. package/dist/xlsx/pivot/values-axis.d.ts +2 -2
  539. package/dist/xlsx/pivot/values-axis.d.ts.map +1 -1
  540. package/dist/xlsx/read/chart-ex.d.ts +9 -0
  541. package/dist/xlsx/read/chart-ex.d.ts.map +1 -0
  542. package/dist/xlsx/read/chart.d.ts.map +1 -1
  543. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  544. package/dist/xlsx/read/load.d.ts.map +1 -1
  545. package/dist/xlsx/read/package.d.ts +2 -1
  546. package/dist/xlsx/read/package.d.ts.map +1 -1
  547. package/dist/xlsx/read/scenarios.d.ts +4 -0
  548. package/dist/xlsx/read/scenarios.d.ts.map +1 -0
  549. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  550. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  551. package/dist/xlsx/read/tables.d.ts +3 -0
  552. package/dist/xlsx/read/tables.d.ts.map +1 -1
  553. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  554. package/dist/xlsx/slicer/book.d.ts +16 -0
  555. package/dist/xlsx/slicer/book.d.ts.map +1 -0
  556. package/dist/xlsx/slicer/frame.d.ts +14 -0
  557. package/dist/xlsx/slicer/frame.d.ts.map +1 -0
  558. package/dist/xlsx/slicer/index.d.ts +10 -0
  559. package/dist/xlsx/slicer/index.d.ts.map +1 -0
  560. package/dist/xlsx/slicer/items.d.ts +30 -0
  561. package/dist/xlsx/slicer/items.d.ts.map +1 -0
  562. package/dist/xlsx/slicer/layout.d.ts +67 -0
  563. package/dist/xlsx/slicer/layout.d.ts.map +1 -0
  564. package/dist/xlsx/slicer/read-slicers.d.ts +11 -0
  565. package/dist/xlsx/slicer/read-slicers.d.ts.map +1 -0
  566. package/dist/xlsx/slicer/read-timelines.d.ts +5 -0
  567. package/dist/xlsx/slicer/read-timelines.d.ts.map +1 -0
  568. package/dist/xlsx/slicer/read.d.ts +26 -0
  569. package/dist/xlsx/slicer/read.d.ts.map +1 -0
  570. package/dist/xlsx/slicer/select.d.ts +10 -0
  571. package/dist/xlsx/slicer/select.d.ts.map +1 -0
  572. package/dist/xlsx/slicer/styles.d.ts +36 -0
  573. package/dist/xlsx/slicer/styles.d.ts.map +1 -0
  574. package/dist/xlsx/slicer/table-filter.d.ts +28 -0
  575. package/dist/xlsx/slicer/table-filter.d.ts.map +1 -0
  576. package/dist/xlsx/slicer/timeline-periods.d.ts +35 -0
  577. package/dist/xlsx/slicer/timeline-periods.d.ts.map +1 -0
  578. package/dist/xlsx/slicer/timeline-view.d.ts +60 -0
  579. package/dist/xlsx/slicer/timeline-view.d.ts.map +1 -0
  580. package/dist/xlsx/slicer/write-plan.d.ts +31 -0
  581. package/dist/xlsx/slicer/write-plan.d.ts.map +1 -0
  582. package/dist/xlsx/slicer/write-timeline.d.ts +7 -0
  583. package/dist/xlsx/slicer/write-timeline.d.ts.map +1 -0
  584. package/dist/xlsx/slicer/write-xml.d.ts +17 -0
  585. package/dist/xlsx/slicer/write-xml.d.ts.map +1 -0
  586. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  587. package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
  588. package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -1
  589. package/dist/xlsx/ui/commands/i18n/slicers.d.ts +3 -0
  590. package/dist/xlsx/ui/commands/i18n/slicers.d.ts.map +1 -0
  591. package/dist/xlsx/ui/commands/i18n/what-if.d.ts +3 -0
  592. package/dist/xlsx/ui/commands/i18n/what-if.d.ts.map +1 -0
  593. package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
  594. package/dist/xlsx/ui/commands/slicers.d.ts +37 -0
  595. package/dist/xlsx/ui/commands/slicers.d.ts.map +1 -0
  596. package/dist/xlsx/ui/commands/what-if.d.ts +4 -0
  597. package/dist/xlsx/ui/commands/what-if.d.ts.map +1 -0
  598. package/dist/xlsx/ui/commands.d.ts +2 -0
  599. package/dist/xlsx/ui/commands.d.ts.map +1 -1
  600. package/dist/xlsx/ui/index.cjs +4201 -1316
  601. package/dist/xlsx/ui/index.d.ts +2 -0
  602. package/dist/xlsx/ui/index.d.ts.map +1 -1
  603. package/dist/xlsx/ui/index.mjs +4196 -1317
  604. package/dist/xlsx/ui/locales/de/shell.d.ts.map +1 -1
  605. package/dist/xlsx/ui/locales/en/shell.d.ts.map +1 -1
  606. package/dist/xlsx/ui/locales/es/shell.d.ts.map +1 -1
  607. package/dist/xlsx/ui/locales/fr/shell.d.ts.map +1 -1
  608. package/dist/xlsx/ui/locales/zh-CN/shell.d.ts.map +1 -1
  609. package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts.map +1 -1
  610. package/dist/xlsx/write/carried-refs.d.ts.map +1 -1
  611. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  612. package/dist/xlsx/write/package-writer.d.ts +2 -0
  613. package/dist/xlsx/write/package-writer.d.ts.map +1 -1
  614. package/dist/xlsx/write/save.d.ts.map +1 -1
  615. package/dist/xlsx/write/scenarios.d.ts +4 -0
  616. package/dist/xlsx/write/scenarios.d.ts.map +1 -0
  617. package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
  618. package/dist/xlsx/write/sheet-parts.d.ts +1 -0
  619. package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
  620. package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
  621. package/dist/xlsx/write/table-patch.d.ts.map +1 -1
  622. package/dist/xlsx/write/tables.d.ts.map +1 -1
  623. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  624. package/dist/xml/index.cjs +28 -0
  625. package/dist/xml/index.mjs +27 -1
  626. package/dist/xml/namespaces.d.ts +2 -0
  627. package/dist/xml/namespaces.d.ts.map +1 -1
  628. package/dist/xml/xml.d.ts +15 -0
  629. package/dist/xml/xml.d.ts.map +1 -1
  630. package/package.json +1 -1
  631. package/dist/PptxHandler-RWTOUCLC.mjs +0 -3
  632. package/dist/PptxHandler-UU4ZCT6H.cjs +0 -12
  633. package/dist/chunk-KBIJI6P5.mjs +0 -166
  634. package/dist/pptx/chunks/elements-DmbzOhFu.d.ts.map +0 -1
  635. package/dist/pptx/chunks/index-BmvOxbsh.d.ts.map +0 -1
@@ -4,16 +4,28 @@
4
4
  *
5
5
  * Moved from `src/core/pptx/core/utils/ooxml-crypto-decrypt.ts` (see PROVENANCE.md).
6
6
  */
7
+ import type { SpinLimits } from '../digest/password-hash.js';
7
8
  import type { EncryptionInfo, StandardEncryptionInfo } from './types.js';
9
+ /** Options of agile password verification and package decryption. */
10
+ export interface DecryptOptions extends SpinLimits {
11
+ /**
12
+ * Accept an agile package that has no `<dataIntegrity>` element (default false). The HMAC is
13
+ * the only protection of the ciphertext against tampering, so a missing element is treated as
14
+ * a downgrade attack unless the caller opts out (for example for a legacy writer).
15
+ */
16
+ allowMissingIntegrity?: boolean;
17
+ }
8
18
  /**
9
19
  * Verify the password against agile encryption info and return the
10
20
  * decryption key if valid.
11
21
  *
12
22
  * @param info - Parsed agile encryption info.
13
23
  * @param password - The password to verify.
24
+ * @param limits - The spin-count limit (default 1,000,000; the spec ceiling is 10,000,000).
14
25
  * @returns The document encryption key, or null if the password is wrong.
26
+ * @throws Error when the EncryptionInfo parameters are invalid or the spin count is too large.
15
27
  */
16
- export declare function verifyAgilePassword(info: EncryptionInfo, password: string): Promise<Uint8Array | null>;
28
+ export declare function verifyAgilePassword(info: EncryptionInfo, password: string, limits?: SpinLimits): Promise<Uint8Array | null>;
17
29
  /**
18
30
  * Verify the password against standard encryption info and return the
19
31
  * decryption key if valid.
@@ -35,9 +47,11 @@ export declare function verifyStandardPassword(info: StandardEncryptionInfo, pas
35
47
  * @param info - Parsed agile encryption info.
36
48
  * @param key - The document encryption key.
37
49
  * @param encryptedPackage - Raw bytes of the EncryptedPackage stream.
38
- * @throws DataIntegrityError if the data integrity check fails.
50
+ * @param options - `allowMissingIntegrity` accepts a package without a dataIntegrity element.
51
+ * @throws DataIntegrityError if the data integrity check fails, or the element is missing and
52
+ * `allowMissingIntegrity` is not set (an attacker could strip it to flip ciphertext bits).
39
53
  */
40
- export declare function verifyAgileDataIntegrity(info: EncryptionInfo, key: Uint8Array, encryptedPackage: Uint8Array): Promise<void>;
54
+ export declare function verifyAgileDataIntegrity(info: EncryptionInfo, key: Uint8Array, encryptedPackage: Uint8Array, options?: Pick<DecryptOptions, 'allowMissingIntegrity'>): Promise<void>;
41
55
  /**
42
56
  * Decrypt the EncryptedPackage stream using the agile encryption key.
43
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../crypto/decrypt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAMtE;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAgC5B;AAMD;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,sBAAsB,EAC5B,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA6B5B;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC7C,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,UAAU,EACf,gBAAgB,EAAE,UAAU,GAC1B,OAAO,CAAC,IAAI,CAAC,CA0Df;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACxC,gBAAgB,EAAE,UAAU,EAC5B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,cAAc,GAClB,OAAO,CAAC,WAAW,CAAC,CAqCtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC3C,gBAAgB,EAAE,UAAU,EAC5B,GAAG,EAAE,UAAU,GACb,OAAO,CAAC,WAAW,CAAC,CAatB"}
1
+ {"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../crypto/decrypt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAW1D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtE,qEAAqE;AACrE,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,UAAe,GACrB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAsC5B;AAMD;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,sBAAsB,EAC5B,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAuB5B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,wBAAwB,CAC7C,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,UAAU,EACf,gBAAgB,EAAE,UAAU,EAC5B,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,uBAAuB,CAAM,GACzD,OAAO,CAAC,IAAI,CAAC,CAkDf;AAeD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACxC,gBAAgB,EAAE,UAAU,EAC5B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,cAAc,GAClB,OAAO,CAAC,WAAW,CAAC,CAuCtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC3C,gBAAgB,EAAE,UAAU,EAC5B,GAAG,EAAE,UAAU,GACb,OAAO,CAAC,WAAW,CAAC,CActB"}
@@ -1 +1 @@
1
- {"version":3,"file":"encryption-info.d.ts","sourceRoot":"","sources":["../../crypto/encryption-info.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAS,CAAC;AAEjC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,sBAAsB,CAa7F"}
1
+ {"version":3,"file":"encryption-info.d.ts","sourceRoot":"","sources":["../../crypto/encryption-info.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAS,CAAC;AAEjC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,sBAAsB,CAa7F"}
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var xmldom = require('@xmldom/xmldom');
4
+
3
5
  // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
4
6
  var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
5
7
  var ENDOFCHAIN = 4294967294;
@@ -555,6 +557,14 @@ async function hmac(algorithm, key, data) {
555
557
  return new Uint8Array(result);
556
558
  }
557
559
 
560
+ // digest/timing-safe.ts
561
+ function timingSafeEqual(a, b) {
562
+ if (a.length !== b.length) return false;
563
+ let difference = 0;
564
+ for (let i2 = 0; i2 < a.length; i2++) difference |= a[i2] ^ b[i2];
565
+ return difference === 0;
566
+ }
567
+
558
568
  // crypto/aes-ecb.ts
559
569
  var BLOCK = 16;
560
570
  var BATCH = 4096;
@@ -2338,6 +2348,14 @@ function digestFunction(name) {
2338
2348
  return canonical && DIGESTS[canonical];
2339
2349
  }
2340
2350
 
2351
+ // digest/password-hash.ts
2352
+ var MAX_SPIN_COUNT = 1e7;
2353
+ var DEFAULT_MAX_SPIN_COUNT = 1e6;
2354
+ function isValidSpinCount(spinCount, maxSpinCount = DEFAULT_MAX_SPIN_COUNT) {
2355
+ const limit = Math.min(maxSpinCount, MAX_SPIN_COUNT);
2356
+ return spinCount === void 0 || Number.isInteger(spinCount) && spinCount >= 0 && spinCount <= limit;
2357
+ }
2358
+
2341
2359
  // crypto/key-derivation.ts
2342
2360
  var BLOCK_KEYS = {
2343
2361
  verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
@@ -2346,9 +2364,9 @@ var BLOCK_KEYS = {
2346
2364
  dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
2347
2365
  dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
2348
2366
  };
2349
- var MAX_SPIN_COUNT = 1e7;
2350
- async function spinPassword(password, salt, spinCount, hashAlgorithm) {
2351
- if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
2367
+ var SPIN_CHUNK = 1e5;
2368
+ async function spinPassword(password, salt, spinCount, hashAlgorithm, limits = {}) {
2369
+ if (!isValidSpinCount(spinCount, limits.maxSpinCount)) {
2352
2370
  throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
2353
2371
  }
2354
2372
  const passwordBytes = encodePasswordUtf16LE(password);
@@ -2361,6 +2379,9 @@ async function spinPassword(password, salt, spinCount, hashAlgorithm) {
2361
2379
  view.setUint32(0, i2, true);
2362
2380
  buffer.set(h3, 4);
2363
2381
  h3 = digest(buffer);
2382
+ if (i2 % SPIN_CHUNK === SPIN_CHUNK - 1 && i2 + 1 < spinCount) {
2383
+ await new Promise((resolve) => setTimeout(resolve, 0));
2384
+ }
2364
2385
  }
2365
2386
  return h3;
2366
2387
  }
@@ -2379,8 +2400,8 @@ async function extendKey(h2, hashAlgorithm, keyLength) {
2379
2400
  const x3 = concatArrays(await pad2(54), await pad2(92));
2380
2401
  return x3.subarray(0, keyLength);
2381
2402
  }
2382
- function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
2383
- return spinPassword(password, salt, spinCount, hashAlgorithm);
2403
+ function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm, limits = {}) {
2404
+ return spinPassword(password, salt, spinCount, hashAlgorithm, limits);
2384
2405
  }
2385
2406
  async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
2386
2407
  const h2 = await hash(hashAlgorithm, concatArrays(base, blockKey));
@@ -2411,10 +2432,82 @@ async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
2411
2432
  return padded;
2412
2433
  }
2413
2434
 
2435
+ // crypto/validate.ts
2436
+ var AGILE_DIGEST_LENGTH = {
2437
+ "SHA-1": 20,
2438
+ "SHA-256": 32,
2439
+ "SHA-384": 48,
2440
+ "SHA-512": 64
2441
+ };
2442
+ function agileDigestLength(hashAlgorithm) {
2443
+ const name = normalizeDigestAlgorithmName(hashAlgorithm);
2444
+ return name === void 0 ? void 0 : AGILE_DIGEST_LENGTH[name];
2445
+ }
2446
+ var KEY_BITS = /* @__PURE__ */ new Set([128, 192, 256]);
2447
+ function assertBlock(block, what) {
2448
+ if (block.cipherAlgorithm !== "AES") {
2449
+ throw new Error(`Unsupported ${what} cipherAlgorithm: ${block.cipherAlgorithm}.`);
2450
+ }
2451
+ if (block.cipherChaining !== "ChainingModeCBC") {
2452
+ throw new Error(`Unsupported ${what} cipherChaining: ${block.cipherChaining}.`);
2453
+ }
2454
+ const digestLength = agileDigestLength(block.hashAlgorithm);
2455
+ if (digestLength === void 0) {
2456
+ throw new Error(`Unsupported ${what} hashAlgorithm: ${block.hashAlgorithm}.`);
2457
+ }
2458
+ if (block.hashSize !== digestLength) {
2459
+ throw new Error(
2460
+ `Invalid ${what} hashSize ${block.hashSize}: ${block.hashAlgorithm} produces ${digestLength} bytes.`
2461
+ );
2462
+ }
2463
+ if (!KEY_BITS.has(block.keyBits)) throw new Error(`Invalid ${what} keyBits: ${block.keyBits}.`);
2464
+ if (block.blockSize !== 16) throw new Error(`Invalid ${what} blockSize: ${block.blockSize}.`);
2465
+ if (!Number.isInteger(block.saltSize) || block.saltSize <= 0 || block.saltSize > 64) {
2466
+ throw new Error(`Invalid ${what} saltSize: ${block.saltSize}.`);
2467
+ }
2468
+ if (block.saltValue.length !== block.saltSize) {
2469
+ throw new Error(`The ${what} saltValue does not match its saltSize.`);
2470
+ }
2471
+ }
2472
+ function assertValidAgileEncryptionInfo(info) {
2473
+ assertBlock(info.keyData, "keyData");
2474
+ const pke = info.passwordKeyEncryptor;
2475
+ assertBlock(pke, "password key encryptor");
2476
+ if (!Number.isInteger(pke.spinCount) || pke.spinCount < 0) {
2477
+ throw new Error(`Invalid spinCount: ${pke.spinCount}.`);
2478
+ }
2479
+ if (pke.saltSize > pke.hashSize) {
2480
+ throw new Error(`Invalid password key encryptor saltSize: ${pke.saltSize}.`);
2481
+ }
2482
+ }
2483
+ function assertValidStandardEncryptionInfo(info) {
2484
+ if (!KEY_BITS.has(info.header.keySize)) {
2485
+ throw new Error(`Invalid Standard encryption keySize: ${info.header.keySize}.`);
2486
+ }
2487
+ if (info.verifier.salt.length !== 16 || info.verifier.saltSize !== 16) {
2488
+ throw new Error(`Invalid Standard encryption saltSize: ${info.verifier.saltSize}.`);
2489
+ }
2490
+ if (info.verifier.verifierHashSize !== 20) {
2491
+ throw new Error(
2492
+ `Invalid Standard encryption verifierHashSize: ${info.verifier.verifierHashSize}.`
2493
+ );
2494
+ }
2495
+ if (info.verifier.encryptedVerifier.length !== 16 || info.verifier.encryptedVerifierHash.length < 20) {
2496
+ throw new Error("The Standard encryption verifier is truncated.");
2497
+ }
2498
+ }
2499
+
2414
2500
  // crypto/decrypt.ts
2415
- async function verifyAgilePassword(info, password) {
2501
+ async function verifyAgilePassword(info, password, limits = {}) {
2502
+ assertValidAgileEncryptionInfo(info);
2416
2503
  const pke = info.passwordKeyEncryptor;
2417
- const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
2504
+ const base = await computeAgileKeyBase(
2505
+ password,
2506
+ pke.saltValue,
2507
+ pke.spinCount,
2508
+ pke.hashAlgorithm,
2509
+ limits
2510
+ );
2418
2511
  const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
2419
2512
  const verifierHashInput = await aesCbcDecryptRaw(
2420
2513
  await blockKey(BLOCK_KEYS.verifierHashInput),
@@ -2427,10 +2520,8 @@ async function verifyAgilePassword(info, password) {
2427
2520
  pke.encryptedVerifierHashValue
2428
2521
  );
2429
2522
  const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
2430
- if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
2431
- let difference = 0;
2432
- for (let i2 = 0; i2 < pke.hashSize; i2++) difference |= verifierHashValue[i2] ^ computedHash[i2];
2433
- if (difference !== 0) return null;
2523
+ if (computedHash.length !== pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
2524
+ if (!timingSafeEqual(verifierHashValue.subarray(0, pke.hashSize), computedHash)) return null;
2434
2525
  const decryptedKey = await aesCbcDecryptRaw(
2435
2526
  await blockKey(BLOCK_KEYS.encryptedKeyValue),
2436
2527
  pke.saltValue,
@@ -2439,6 +2530,7 @@ async function verifyAgilePassword(info, password) {
2439
2530
  return decryptedKey.subarray(0, info.keyData.keyBits / 8);
2440
2531
  }
2441
2532
  async function verifyStandardPassword(info, password) {
2533
+ assertValidStandardEncryptionInfo(info);
2442
2534
  const key = await deriveStandardKey(
2443
2535
  password,
2444
2536
  info.verifier.salt,
@@ -2448,20 +2540,16 @@ async function verifyStandardPassword(info, password) {
2448
2540
  const decryptedVerifier = await aesEcbDecrypt(key, info.verifier.encryptedVerifier);
2449
2541
  const decryptedHash = await aesEcbDecrypt(key, info.verifier.encryptedVerifierHash);
2450
2542
  const computedHash = await hash("SHA-1", decryptedVerifier);
2451
- const hashSize = info.verifier.verifierHashSize;
2452
- let match = true;
2453
- for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
2454
- if (computedHash[i2] !== decryptedHash[i2]) {
2455
- match = false;
2456
- break;
2457
- }
2458
- }
2543
+ const match = timingSafeEqual(decryptedHash.subarray(0, 20), computedHash);
2459
2544
  return match ? key : null;
2460
2545
  }
2461
- async function verifyAgileDataIntegrity(info, key, encryptedPackage) {
2546
+ async function verifyAgileDataIntegrity(info, key, encryptedPackage, options = {}) {
2462
2547
  const keyData = info.keyData;
2463
2548
  if (!info.dataIntegrity) {
2464
- return;
2549
+ if (options.allowMissingIntegrity) return;
2550
+ throw new DataIntegrityError(
2551
+ "The encrypted package has no data integrity record, so it cannot be checked for tampering."
2552
+ );
2465
2553
  }
2466
2554
  const hmacKeyIV = await generateIV(
2467
2555
  keyData.hashAlgorithm,
@@ -2488,28 +2576,26 @@ async function verifyAgileDataIntegrity(info, key, encryptedPackage) {
2488
2576
  );
2489
2577
  const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
2490
2578
  const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
2491
- let match = true;
2492
- if (computedHmac.length < keyData.hashSize) {
2493
- match = false;
2494
- } else {
2495
- for (let i2 = 0; i2 < keyData.hashSize; i2++) {
2496
- if (computedHmac[i2] !== expectedHmac[i2]) {
2497
- match = false;
2498
- break;
2499
- }
2500
- }
2501
- }
2579
+ const match = timingSafeEqual(computedHmac, expectedHmac);
2502
2580
  if (!match) {
2503
2581
  throw new DataIntegrityError(
2504
2582
  "Data integrity check failed. The encrypted file may be corrupted or tampered with."
2505
2583
  );
2506
2584
  }
2507
2585
  }
2586
+ function readOriginalSize(encryptedPackage, wide) {
2587
+ if (encryptedPackage.length < 8) throw new Error("The EncryptedPackage stream is truncated.");
2588
+ const view = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
2589
+ const high = view.getUint32(4, true);
2590
+ return view.getUint32(0, true) + (wide ? high * 4294967296 : 0);
2591
+ }
2508
2592
  async function decryptAgilePackage(encryptedPackage, key, info) {
2509
2593
  const keyData = info.keyData;
2510
- const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
2511
- const originalSize = sizeView.getUint32(0, true) + sizeView.getUint32(4, true) * 4294967296;
2594
+ const originalSize = readOriginalSize(encryptedPackage, true);
2512
2595
  const encryptedData = encryptedPackage.subarray(8);
2596
+ if (originalSize > encryptedData.length) {
2597
+ throw new Error("The declared package size exceeds the encrypted data.");
2598
+ }
2513
2599
  const segmentSize = 4096;
2514
2600
  const result = new Uint8Array(originalSize);
2515
2601
  let resultOffset = 0;
@@ -2533,9 +2619,11 @@ async function decryptAgilePackage(encryptedPackage, key, info) {
2533
2619
  return result.buffer;
2534
2620
  }
2535
2621
  async function decryptStandardPackage(encryptedPackage, key) {
2536
- const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
2537
- const originalSize = sizeView.getUint32(0, true);
2622
+ const originalSize = readOriginalSize(encryptedPackage, false);
2538
2623
  const encryptedData = encryptedPackage.subarray(8);
2624
+ if (originalSize > encryptedData.length) {
2625
+ throw new Error("The declared package size exceeds the encrypted data.");
2626
+ }
2539
2627
  const decrypted = await aesEcbDecrypt(key, encryptedData);
2540
2628
  return decrypted.slice(0, originalSize).buffer;
2541
2629
  }
@@ -3118,6 +3206,52 @@ async function encryptStandard(packageData, password, options = {}) {
3118
3206
  );
3119
3207
  return container(encryptionInfo, await encryptStandardPackage(packageData, key));
3120
3208
  }
3209
+ var DEFAULT_XML_LIMITS = {
3210
+ maxDepth: 512,
3211
+ maxNodes: 5e6
3212
+ };
3213
+ var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
3214
+ function checkXmlLimits(xml, label, limits = {}) {
3215
+ const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
3216
+ const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
3217
+ let depth = 0;
3218
+ let nodes = 0;
3219
+ for (const match of xml.matchAll(MARKUP_RE)) {
3220
+ const [, closing, name, selfClosing] = match;
3221
+ if (name === void 0) continue;
3222
+ if (closing) {
3223
+ depth--;
3224
+ continue;
3225
+ }
3226
+ nodes++;
3227
+ if (nodes > maxNodes) throw new Error(`${label} XML exceeds the limit of ${maxNodes} elements`);
3228
+ if (!selfClosing && ++depth > maxDepth)
3229
+ throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth}`);
3230
+ }
3231
+ }
3232
+ function parseXml(xml, options = {}) {
3233
+ const label = options.label ?? "OOXML";
3234
+ if (/<!DOCTYPE|<!ENTITY/i.test(xml))
3235
+ throw new Error(`${label} XML with DTD or entity declarations is not supported`);
3236
+ checkXmlLimits(xml, label, options.limits);
3237
+ let parseError = "";
3238
+ let parsed;
3239
+ try {
3240
+ parsed = new xmldom.DOMParser({
3241
+ onError: (level, message) => {
3242
+ if (level !== "warning") parseError = message;
3243
+ }
3244
+ }).parseFromString(xml, "application/xml");
3245
+ } catch (error) {
3246
+ throw new Error(
3247
+ `Invalid ${label} XML: ${error instanceof Error ? error.message : String(error)}`,
3248
+ { cause: error }
3249
+ );
3250
+ }
3251
+ if (parseError || !parsed.documentElement)
3252
+ throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
3253
+ return parsed;
3254
+ }
3121
3255
 
3122
3256
  // crypto/encryption-info.ts
3123
3257
  var RC4_ALG_ID = 26625;
@@ -3180,53 +3314,87 @@ function parseStandardEncryptionInfo(data) {
3180
3314
  }
3181
3315
  };
3182
3316
  }
3183
- function tagAttribute(xml, tag, attr) {
3184
- const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
3185
- if (!tagMatch) return "";
3186
- const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr}="([^"]*)"`, "i"));
3187
- return attrMatch?.[1] ?? "";
3317
+ var PASSWORD_KEY_ENCRYPTOR_URI = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
3318
+ function childrenNamed(parent, localName) {
3319
+ const found = [];
3320
+ for (let node = parent.firstChild; node; node = node.nextSibling) {
3321
+ if (node.nodeType === 1 && node.localName === localName) {
3322
+ found.push(node);
3323
+ }
3324
+ }
3325
+ return found;
3188
3326
  }
3189
- function parseAgileEncryptionInfo(data) {
3190
- const xml = new TextDecoder("utf-8").decode(data.subarray(8));
3191
- const keyData = (attr) => tagAttribute(xml, "keyData", attr);
3192
- const integrity = (attr) => tagAttribute(xml, "dataIntegrity", attr);
3193
- const pke = (attr) => tagAttribute(xml, "encryptedKey", attr);
3194
- const int = (value) => parseInt(value, 10);
3195
- const encryptedHmacKey = integrity("encryptedHmacKey");
3327
+ function singleChild(parent, localName, mustExist) {
3328
+ const matches = childrenNamed(parent, localName);
3329
+ if (matches.length > 1) throw new Error(`The EncryptionInfo has several ${localName} elements.`);
3330
+ if (matches.length === 0 && mustExist) {
3331
+ throw new Error(`The EncryptionInfo has no ${localName} element.`);
3332
+ }
3333
+ return matches[0];
3334
+ }
3335
+ function required(element, attr) {
3336
+ const value = element.getAttribute(attr);
3337
+ if (!value) throw new Error(`The EncryptionInfo ${element.localName} has no ${attr}.`);
3338
+ return value;
3339
+ }
3340
+ function requiredInt(element, attr) {
3341
+ const value = required(element, attr);
3342
+ if (!/^\d{1,10}$/.test(value)) {
3343
+ throw new Error(`The EncryptionInfo ${element.localName} ${attr} is not a number: ${value}.`);
3344
+ }
3345
+ return Number(value);
3346
+ }
3347
+ function parseKeyBlock(element) {
3196
3348
  return {
3349
+ saltSize: requiredInt(element, "saltSize"),
3350
+ blockSize: requiredInt(element, "blockSize"),
3351
+ keyBits: requiredInt(element, "keyBits"),
3352
+ hashSize: requiredInt(element, "hashSize"),
3353
+ cipherAlgorithm: required(element, "cipherAlgorithm"),
3354
+ cipherChaining: required(element, "cipherChaining"),
3355
+ hashAlgorithm: required(element, "hashAlgorithm"),
3356
+ saltValue: base64Decode(required(element, "saltValue"))
3357
+ };
3358
+ }
3359
+ function parseAgileEncryptionInfo(data) {
3360
+ const root = parseXml(new TextDecoder("utf-8").decode(data.subarray(8)), {
3361
+ label: "EncryptionInfo"
3362
+ }).documentElement;
3363
+ if (root.localName !== "encryption") {
3364
+ throw new Error("The EncryptionInfo root element is not <encryption>.");
3365
+ }
3366
+ const keyData = parseKeyBlock(singleChild(root, "keyData", true));
3367
+ const integrity = singleChild(root, "dataIntegrity", false);
3368
+ const encryptors = childrenNamed(singleChild(root, "keyEncryptors", true), "keyEncryptor");
3369
+ const passwordEncryptors = encryptors.filter(
3370
+ (encryptor) => encryptor.getAttribute("uri") === PASSWORD_KEY_ENCRYPTOR_URI
3371
+ );
3372
+ if (passwordEncryptors.length !== 1) {
3373
+ throw new Error(
3374
+ passwordEncryptors.length === 0 ? "The EncryptionInfo has no password key encryptor." : "The EncryptionInfo has several password key encryptors."
3375
+ );
3376
+ }
3377
+ const pke = singleChild(passwordEncryptors[0], "encryptedKey", true);
3378
+ const info = {
3197
3379
  version: { major: 4, minor: 4 },
3198
3380
  isAgile: true,
3199
- keyData: {
3200
- saltSize: int(keyData("saltSize")),
3201
- blockSize: int(keyData("blockSize")),
3202
- keyBits: int(keyData("keyBits")),
3203
- hashSize: int(keyData("hashSize")),
3204
- cipherAlgorithm: keyData("cipherAlgorithm"),
3205
- cipherChaining: keyData("cipherChaining"),
3206
- hashAlgorithm: keyData("hashAlgorithm"),
3207
- saltValue: base64Decode(keyData("saltValue"))
3208
- },
3209
- ...encryptedHmacKey ? {
3381
+ keyData,
3382
+ ...integrity ? {
3210
3383
  dataIntegrity: {
3211
- encryptedHmacKey: base64Decode(encryptedHmacKey),
3212
- encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
3384
+ encryptedHmacKey: base64Decode(required(integrity, "encryptedHmacKey")),
3385
+ encryptedHmacValue: base64Decode(required(integrity, "encryptedHmacValue"))
3213
3386
  }
3214
3387
  } : {},
3215
3388
  passwordKeyEncryptor: {
3216
- saltSize: int(pke("saltSize")),
3217
- blockSize: int(pke("blockSize")),
3218
- keyBits: int(pke("keyBits")),
3219
- hashSize: int(pke("hashSize")),
3220
- cipherAlgorithm: pke("cipherAlgorithm"),
3221
- cipherChaining: pke("cipherChaining"),
3222
- hashAlgorithm: pke("hashAlgorithm"),
3223
- saltValue: base64Decode(pke("saltValue")),
3224
- spinCount: int(pke("spinCount")),
3225
- encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
3226
- encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
3227
- encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
3389
+ ...parseKeyBlock(pke),
3390
+ spinCount: requiredInt(pke, "spinCount"),
3391
+ encryptedVerifierHashInput: base64Decode(required(pke, "encryptedVerifierHashInput")),
3392
+ encryptedVerifierHashValue: base64Decode(required(pke, "encryptedVerifierHashValue")),
3393
+ encryptedKeyValue: base64Decode(required(pke, "encryptedKeyValue"))
3228
3394
  }
3229
3395
  };
3396
+ assertValidAgileEncryptionInfo(info);
3397
+ return info;
3230
3398
  }
3231
3399
 
3232
3400
  // crypto/index.ts
@@ -3242,7 +3410,7 @@ function streams(bytes) {
3242
3410
  }
3243
3411
  throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
3244
3412
  }
3245
- async function decryptOoxmlPackage(input, password) {
3413
+ async function decryptOoxmlPackage(input, password, options = {}) {
3246
3414
  const { info: infoStream, data } = streams(toBytes(input));
3247
3415
  const info = parseEncryptionInfo(infoStream);
3248
3416
  if (isStandard(info)) {
@@ -3250,21 +3418,26 @@ async function decryptOoxmlPackage(input, password) {
3250
3418
  if (!key2) throw new IncorrectPasswordError();
3251
3419
  return new Uint8Array(await decryptStandardPackage(data, key2));
3252
3420
  }
3253
- const key = await verifyAgilePassword(info, password);
3421
+ const key = await verifyAgilePassword(info, password, options);
3254
3422
  if (!key) throw new IncorrectPasswordError();
3255
- await verifyAgileDataIntegrity(info, key, data);
3423
+ await verifyAgileDataIntegrity(info, key, data, options);
3256
3424
  return new Uint8Array(await decryptAgilePackage(data, key, info));
3257
3425
  }
3426
+ function inspectOoxmlEncryption(input) {
3427
+ const info = parseEncryptionInfo(streams(toBytes(input)).info);
3428
+ if (isStandard(info)) return { scheme: "standard", integrityProtected: false };
3429
+ return { scheme: "agile", integrityProtected: info.dataIntegrity !== void 0 };
3430
+ }
3258
3431
  function encryptOoxmlPackage(input, password, options = {}) {
3259
3432
  const bytes = toBytes(input);
3260
3433
  return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
3261
3434
  }
3262
- async function verifyOoxmlPackagePassword(input, password) {
3435
+ async function verifyOoxmlPackagePassword(input, password, options = {}) {
3263
3436
  try {
3264
3437
  const opened = openEncryptedPackage(input);
3265
3438
  if (!opened) return false;
3266
3439
  const info = parseEncryptionInfo(opened.encryptionInfo);
3267
- const key = isStandard(info) ? await verifyStandardPassword(info, password) : await verifyAgilePassword(info, password);
3440
+ const key = isStandard(info) ? await verifyStandardPassword(info, password) : await verifyAgilePassword(info, password, options);
3268
3441
  return key !== null;
3269
3442
  } catch {
3270
3443
  return false;
@@ -3293,6 +3466,7 @@ exports.encryptAgilePackage = encryptAgilePackage;
3293
3466
  exports.encryptOoxmlPackage = encryptOoxmlPackage;
3294
3467
  exports.encryptStandardPackage = encryptStandardPackage;
3295
3468
  exports.generateIV = generateIV;
3469
+ exports.inspectOoxmlEncryption = inspectOoxmlEncryption;
3296
3470
  exports.isCompoundFile = isCompoundFile;
3297
3471
  exports.isEncryptedOoxmlPackage = isEncryptedOoxmlPackage;
3298
3472
  exports.isOoxmlCryptoError = isOoxmlCryptoError;
@@ -1,21 +1,36 @@
1
1
  export { createOfficeGuid } from './uuid.js';
2
+ import { type DecryptOptions } from './decrypt.js';
2
3
  import type { EncryptionOptions } from './types.js';
3
4
  export { DataIntegrityError, IncorrectPasswordError, PasswordRequiredError, isOoxmlCryptoError, type OoxmlCryptoErrorCode, } from './errors.js';
4
5
  export { EncryptedFileError, detectFileFormat, isCompoundFile, isEncryptedOoxmlPackage, openEncryptedPackage, type EncryptedPackageStreams, type FileFormatDetection, } from './detect.js';
5
6
  export type { EncryptionAlgorithm, EncryptionInfo, EncryptionOptions, EncryptionScheme, StandardEncryptionInfo, } from './types.js';
6
7
  export { RC4_ALG_ID, parseEncryptionInfo } from './encryption-info.js';
7
8
  export { BLOCK_KEYS, computeStandardKeyBase, deriveAgileKey, deriveStandardKey, deriveStandardKeyFromBase, generateIV, } from './key-derivation.js';
8
- export { decryptAgilePackage, decryptStandardPackage, verifyAgileDataIntegrity, verifyAgilePassword, verifyStandardPassword, } from './decrypt.js';
9
+ export { decryptAgilePackage, decryptStandardPackage, verifyAgileDataIntegrity, verifyAgilePassword, verifyStandardPassword, type DecryptOptions, } from './decrypt.js';
9
10
  export { encryptAgilePackage, encryptStandardPackage } from './encrypt.js';
10
11
  export { buildAgileEncryptionInfoXml, buildEncryptionInfoStream, buildStandardEncryptionInfoStream, } from './encryption-info-write.js';
11
12
  /**
12
13
  * Decrypts a password-protected OOXML package (agile or Standard encryption) to the plain zip.
13
14
  *
14
15
  * @throws IncorrectPasswordError (`code: 'incorrect-password'`) when the password is wrong.
15
- * @throws DataIntegrityError (`code: 'data-integrity'`) when the agile HMAC does not match.
16
+ * @throws DataIntegrityError (`code: 'data-integrity'`) when the agile HMAC does not match or
17
+ * is absent (pass `allowMissingIntegrity: true` to accept a package without one).
18
+ * Standard encryption has no integrity record at all: see {@link inspectOoxmlEncryption}.
16
19
  * @throws Error when the bytes are not an encrypted package or the scheme is unsupported.
17
20
  */
18
- export declare function decryptOoxmlPackage(input: Uint8Array | ArrayBuffer, password: string): Promise<Uint8Array>;
21
+ export declare function decryptOoxmlPackage(input: Uint8Array | ArrayBuffer, password: string, options?: DecryptOptions): Promise<Uint8Array>;
22
+ /** What an encrypted package offers, from {@link inspectOoxmlEncryption}. */
23
+ export interface OoxmlEncryptionSummary {
24
+ scheme: 'agile' | 'standard';
25
+ /**
26
+ * Whether the ciphertext is authenticated. False for Standard encryption (no HMAC exists in
27
+ * the scheme, so a decrypted package may have been modified) and for an agile package whose
28
+ * `dataIntegrity` was stripped.
29
+ */
30
+ integrityProtected: boolean;
31
+ }
32
+ /** The scheme of an encrypted package and whether it is integrity protected; no password needed. */
33
+ export declare function inspectOoxmlEncryption(input: Uint8Array | ArrayBuffer): OoxmlEncryptionSummary;
19
34
  /**
20
35
  * Encrypts an OOXML package (the zip bytes of a .xlsx, .docx, .pptx, ...) with a password to
21
36
  * open. Writes the agile scheme (AES-256, SHA-512, 100,000 spins: what Office 2010+ writes) by
@@ -23,5 +38,5 @@ export declare function decryptOoxmlPackage(input: Uint8Array | ArrayBuffer, pas
23
38
  */
24
39
  export declare function encryptOoxmlPackage(input: Uint8Array | ArrayBuffer, password: string, options?: EncryptionOptions): Promise<Uint8Array>;
25
40
  /** Whether `password` opens the encrypted package, without decrypting it. Never throws. */
26
- export declare function verifyOoxmlPackagePassword(input: Uint8Array | ArrayBuffer, password: string): Promise<boolean>;
41
+ export declare function verifyOoxmlPackagePassword(input: Uint8Array | ArrayBuffer, password: string, options?: DecryptOptions): Promise<boolean>;
27
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../crypto/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAY1C,OAAO,KAAK,EAAkB,iBAAiB,EAA0B,MAAM,SAAS,CAAC;AAEzF,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,oBAAoB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACxB,MAAM,UAAU,CAAC;AAClB,YAAY,EACX,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACN,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,iCAAiC,GACjC,MAAM,yBAAyB,CAAC;AAoBjC;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC,CAYrB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED,2FAA2F;AAC3F,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAYlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../crypto/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAMN,KAAK,cAAc,EACnB,MAAM,WAAW,CAAC;AAKnB,OAAO,KAAK,EAAkB,iBAAiB,EAA0B,MAAM,SAAS,CAAC;AAEzF,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,oBAAoB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACxB,MAAM,UAAU,CAAC;AAClB,YAAY,EACX,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACN,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,cAAc,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,iCAAiC,GACjC,MAAM,yBAAyB,CAAC;AAoBjC;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAmB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAYrB;AAED,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAC;IAC7B;;;;OAIG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC5B;AAED,oGAAoG;AACpG,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,GAAG,sBAAsB,CAI9F;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED,2FAA2F;AAC3F,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAmB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAYlB"}