pptx-viewer-core 1.6.2 → 1.6.4

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.
@@ -1,220 +0,0 @@
1
- /**
2
- * Constants for OOXML digital signature processing.
3
- *
4
- * OPC URIs, algorithm URIs, digest mappings, and enterprise
5
- * environment variable names used across both platform-agnostic
6
- * and Node-only signature modules.
7
- */
8
- /** The OOXML relationship type for the digital signature origin part. */
9
- declare const DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
10
- /** The OOXML relationship type for individual signature parts. */
11
- declare const DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
12
- /** Custom pptx-viewer manifest namespace for extended signature references. */
13
- declare const PPTX_VIEWER_MANIFEST_NS = "urn:pptx-viewer:ooxml-signature:v1";
14
- /** W3C XML Digital Signature namespace. */
15
- declare const XMLDSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
16
- /** OPC relationship transform algorithm URI. */
17
- declare const OPC_RELATIONSHIP_TRANSFORM = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
18
- /** Enveloped signature transform algorithm URI. */
19
- declare const XML_TRANSFORM_ENVELOPED_SIGNATURE = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
20
- /** Set of supported XML canonicalization transform algorithm URIs. */
21
- declare const SUPPORTED_XML_CANON_TRANSFORMS: Set<string>;
22
- /** Environment variable: path to file containing enterprise trust root PEM certificates. */
23
- declare const ENTERPRISE_TRUST_ROOTS_FILE_ENV = "PPTX_VIEWER_TRUST_ROOTS_FILE";
24
- /** Environment variable: inline PEM trust roots. */
25
- declare const ENTERPRISE_TRUST_ROOTS_PEM_ENV = "PPTX_VIEWER_TRUST_ROOTS_PEM";
26
- /** Environment variable: require revocation check. */
27
- declare const ENTERPRISE_REQUIRE_REVOCATION_ENV = "PPTX_VIEWER_REQUIRE_REVOCATION_CHECK";
28
- /** Environment variable: fail on unknown revocation status. */
29
- declare const ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = "PPTX_VIEWER_FAIL_ON_REVOCATION_UNKNOWN";
30
- /** Environment variable: require timestamp authority. */
31
- declare const ENTERPRISE_REQUIRE_TIMESTAMP_ENV = "PPTX_VIEWER_REQUIRE_TIMESTAMP";
32
- /**
33
- * Mapping from XML Digital Signature digest algorithm URIs to hash function names.
34
- * Used by Node-only code with `node:crypto` (lowercase names).
35
- */
36
- declare const DIGEST_ALGORITHM_TO_HASH: Record<string, string>;
37
- /**
38
- * Mapping from XML Digital Signature digest algorithm URIs to Web Crypto algorithm names.
39
- * Used by platform-agnostic code with `crypto.subtle.digest`.
40
- */
41
- declare const DIGEST_ALGORITHM_TO_WEB_CRYPTO: Record<string, string>;
42
-
43
- /**
44
- * Rich types for digital signature inspection, signing, and PKI validation.
45
- *
46
- * These are platform-agnostic — used by both browser-level detection
47
- * and Node-only full verification modules.
48
- */
49
- type CertificateRevocationStatus = 'good' | 'revoked' | 'unknown' | 'not-checked' | 'error';
50
- type TimestampAuthorityStatus = 'valid' | 'invalid' | 'not-present' | 'not-checked' | 'error' | 'untrusted';
51
- interface SignatureReferenceCheck {
52
- uri: string;
53
- resolvedPartPath?: string;
54
- existsInPackage: boolean;
55
- digestAlgorithm?: string;
56
- digestExpectedBase64?: string;
57
- digestActualBase64?: string;
58
- digestStatus: 'verified' | 'mismatch' | 'missing-part' | 'unsupported-transform' | 'unsupported-algorithm' | 'insufficient-data';
59
- transformAlgorithms: string[];
60
- }
61
- interface SignatureCertificateInfo {
62
- subject?: string;
63
- issuer?: string;
64
- serialNumber?: string;
65
- validFrom?: string;
66
- validTo?: string;
67
- }
68
- type SignatureDetailStatus = 'verified' | 'digest-mismatch' | 'reference-missing' | 'signature-invalid' | 'certificate-untrusted' | 'certificate-revoked' | 'timestamp-invalid' | 'timestamp-untrusted' | 'structural-only';
69
- interface SignatureDetail {
70
- path: string;
71
- signatureMethod?: string;
72
- canonicalizationMethod?: string;
73
- signingTime?: string;
74
- referenceCount: number;
75
- missingPartReferences: string[];
76
- unsupportedTransforms: string[];
77
- referenceChecks: SignatureReferenceCheck[];
78
- certificate?: SignatureCertificateInfo;
79
- signatureValueStatus: 'verified' | 'invalid' | 'not-checked';
80
- certificateTrustStatus: 'trusted' | 'untrusted' | 'not-checked';
81
- certificateTrustError?: string;
82
- certificateRevocationStatus: CertificateRevocationStatus;
83
- certificateRevocationError?: string;
84
- timestampAuthorityStatus: TimestampAuthorityStatus;
85
- timestampAuthorityError?: string;
86
- certificateFingerprintSha256?: string;
87
- status: SignatureDetailStatus;
88
- }
89
- type DigitalSignatureVerificationStatus = 'unsigned' | 'verified-trusted' | 'verified-untrusted' | 'certificate-revoked' | 'digest-mismatch' | 'reference-missing' | 'signature-invalid' | 'timestamp-invalid' | 'timestamp-untrusted' | 'present-not-verified' | 'invalid-package' | 'error';
90
- interface DigitalSignatureReport {
91
- supported: boolean;
92
- hasSignature: boolean;
93
- signatureCount: number;
94
- signaturePaths: string[];
95
- verificationStatus: DigitalSignatureVerificationStatus;
96
- error?: string;
97
- details?: SignatureDetail[];
98
- hasOriginRelationship?: boolean;
99
- }
100
- interface SignOptions {
101
- certificatePath: string;
102
- certificatePassword?: string;
103
- }
104
- interface SignResult {
105
- success: boolean;
106
- signedData?: Uint8Array;
107
- report: DigitalSignatureReport;
108
- error?: string;
109
- }
110
- interface LoadedSigningMaterial {
111
- privateKeyPem: string;
112
- certificatePem: string;
113
- }
114
- interface ParsedReferenceTransform {
115
- algorithm: string;
116
- relationshipReferenceIds: string[];
117
- }
118
- interface ReferenceTransformResult {
119
- data: Uint8Array;
120
- unsupportedAlgorithms: string[];
121
- }
122
- interface SignatureValidationPolicy {
123
- requireRevocationCheck: boolean;
124
- failOnRevocationUnknown: boolean;
125
- requireTimestamp: boolean;
126
- }
127
- interface OfficeSignatureReference {
128
- uri: string;
129
- digestMethod: string;
130
- digestValue: string;
131
- }
132
-
133
- /**
134
- * Pure regex-based XML extraction utilities for digital signature processing.
135
- *
136
- * These functions operate on raw XML strings without requiring a DOM parser,
137
- * making them platform-agnostic (browser + Node).
138
- */
139
- /**
140
- * Escape special characters in an XML attribute value.
141
- * Handles `&`, `<`, `>`, `"`, and `'` so the result is safe inside both
142
- * double- and single-quoted attributes.
143
- */
144
- declare function escapeXmlAttr(value: string): string;
145
- /**
146
- * Escape special characters in XML text content.
147
- * Only `&`, `<`, and `>` need escaping outside of attribute values.
148
- */
149
- declare function escapeXmlText(value: string): string;
150
- /** Validate that `value` only contains characters from the standard base64 alphabet. */
151
- declare function isValidBase64(value: string): boolean;
152
- /**
153
- * Extract an attribute value from the first matching XML tag via regex.
154
- * Namespace prefixes on the tag name are supported via the pattern.
155
- */
156
- declare function extractTagAttribute(xml: string, tagName: string, attributeName: string): string | undefined;
157
- /**
158
- * Extract the text content of the first matching tag, ignoring namespace prefixes.
159
- * Whitespace within the content is collapsed.
160
- */
161
- declare function extractFirstTagText(xml: string, localName: string): string | undefined;
162
- /**
163
- * Extract the text content of all matching tags, ignoring namespace prefixes.
164
- * Whitespace within each match is collapsed.
165
- */
166
- declare function extractAllTagText(xml: string, localName: string): string[];
167
-
168
- /**
169
- * Pure string utilities for resolving digital signature reference URIs
170
- * to ZIP part paths. Platform-agnostic (no Node dependencies).
171
- */
172
- /** Normalize a ZIP part path: convert backslashes to forward slashes and strip leading slashes. */
173
- declare function normalizePartPath(partPath: string): string;
174
- /**
175
- * Resolve a signature reference URI to a ZIP part path.
176
- * Returns `undefined` for empty URIs, fragment-only URIs (#...), or invalid input.
177
- */
178
- declare function resolveReferenceUriToPart(uri: string): string | undefined;
179
-
180
- /**
181
- * Platform-agnostic digest computation using the Web Crypto API.
182
- *
183
- * Works in both browser and Node.js (18+) environments via `crypto.subtle`.
184
- */
185
- /**
186
- * Compute a Base64-encoded digest of the given content using Web Crypto.
187
- *
188
- * @param content - The binary data to hash.
189
- * @param digestAlgorithmUri - An XML Digital Signature digest algorithm URI
190
- * (e.g. `http://www.w3.org/2001/04/xmlenc#sha256`).
191
- * @returns The Base64-encoded digest, or `undefined` if the algorithm is unsupported
192
- * or `crypto.subtle` is unavailable.
193
- */
194
- declare function computeDigestBase64(content: Uint8Array, digestAlgorithmUri: string): Promise<string | undefined>;
195
-
196
- /**
197
- * Pure status-computation logic for digital signature inspection.
198
- *
199
- * These functions are platform-agnostic — they accept data and policy
200
- * as parameters instead of reading from the environment.
201
- */
202
-
203
- /**
204
- * Compute the overall status for an individual signature detail
205
- * based on its reference checks, trust, revocation, and timestamp statuses.
206
- *
207
- * @param detail - A partial `SignatureDetail` with the fields needed for status computation.
208
- * @param policy - The validation policy controlling revocation/timestamp strictness.
209
- * @returns The computed status for this signature detail.
210
- */
211
- declare function computeDetailStatus(detail: Pick<SignatureDetail, 'signatureValueStatus' | 'missingPartReferences' | 'referenceChecks' | 'certificateTrustStatus' | 'certificateRevocationStatus' | 'timestampAuthorityStatus'>, policy: SignatureValidationPolicy): SignatureDetailStatus;
212
- /**
213
- * Compute the overall verification status from all signature details.
214
- *
215
- * @param details - Array of signature details from all signatures in the package.
216
- * @returns The overall verification status for the report.
217
- */
218
- declare function computeVerificationStatus(details: SignatureDetail[]): DigitalSignatureReport['verificationStatus'];
219
-
220
- export { extractTagAttribute as A, isValidBase64 as B, type CertificateRevocationStatus as C, DIGEST_ALGORITHM_TO_HASH as D, ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV as E, normalizePartPath as F, resolveReferenceUriToPart as G, type LoadedSigningMaterial as L, OPC_RELATIONSHIP_TRANSFORM as O, PPTX_VIEWER_MANIFEST_NS as P, type ReferenceTransformResult as R, SUPPORTED_XML_CANON_TRANSFORMS as S, type TimestampAuthorityStatus as T, XMLDSIG_NS as X, DIGEST_ALGORITHM_TO_WEB_CRYPTO as a, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE as b, DIGITAL_SIGNATURE_REL_TYPE as c, type DigitalSignatureReport as d, type DigitalSignatureVerificationStatus as e, ENTERPRISE_REQUIRE_REVOCATION_ENV as f, ENTERPRISE_REQUIRE_TIMESTAMP_ENV as g, ENTERPRISE_TRUST_ROOTS_FILE_ENV as h, ENTERPRISE_TRUST_ROOTS_PEM_ENV as i, type OfficeSignatureReference as j, type ParsedReferenceTransform as k, type SignOptions as l, type SignResult as m, type SignatureDetail as n, type SignatureDetailStatus as o, type SignatureCertificateInfo as p, type SignatureReferenceCheck as q, type SignatureValidationPolicy as r, XML_TRANSFORM_ENVELOPED_SIGNATURE as s, computeDetailStatus as t, computeDigestBase64 as u, computeVerificationStatus as v, escapeXmlAttr as w, escapeXmlText as x, extractAllTagText as y, extractFirstTagText as z };
@@ -1,222 +0,0 @@
1
- import { p as SignatureCertificateInfo, L as LoadedSigningMaterial, T as TimestampAuthorityStatus, C as CertificateRevocationStatus, r as SignatureValidationPolicy, k as ParsedReferenceTransform, R as ReferenceTransformResult, q as SignatureReferenceCheck, l as SignOptions, m as SignResult, d as DigitalSignatureReport } from '../signature-inspection-status-BCUpfCQh.mjs';
2
- export { D as DIGEST_ALGORITHM_TO_HASH, a as DIGEST_ALGORITHM_TO_WEB_CRYPTO, b as DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, c as DIGITAL_SIGNATURE_REL_TYPE, e as DigitalSignatureVerificationStatus, E as ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV, f as ENTERPRISE_REQUIRE_REVOCATION_ENV, g as ENTERPRISE_REQUIRE_TIMESTAMP_ENV, h as ENTERPRISE_TRUST_ROOTS_FILE_ENV, i as ENTERPRISE_TRUST_ROOTS_PEM_ENV, O as OPC_RELATIONSHIP_TRANSFORM, j as OfficeSignatureReference, P as PPTX_VIEWER_MANIFEST_NS, S as SUPPORTED_XML_CANON_TRANSFORMS, n as SignatureDetail, o as SignatureDetailStatus, X as XMLDSIG_NS, s as XML_TRANSFORM_ENVELOPED_SIGNATURE, t as computeDetailStatus, u as computeDigestBase64WebCrypto, v as computeVerificationStatus, w as escapeXmlAttr, x as escapeXmlText, y as extractAllTagText, z as extractFirstTagText, A as extractTagAttribute, B as isValidBase64, F as normalizePartPath, G as resolveReferenceUriToPart } from '../signature-inspection-status-BCUpfCQh.mjs';
3
- import JSZip from 'jszip';
4
-
5
- /**
6
- * XML canonicalization and DOM navigation utilities for digital signatures.
7
- *
8
- * Node-only — depends on `@xmldom/xmldom` and `xml-crypto`.
9
- *
10
- * All public functions use minimal structural (duck-typed) interfaces instead
11
- * of the standard lib.dom.d.ts types. @xmldom/xmldom's Document/Element/Node
12
- * types do not extend the standard DOM interfaces in TypeScript 6 (the old DOM
13
- * lib baked into @xmldom/xmldom's .d.ts predates properties like
14
- * activeViewTransition), so using the standard types causes TS2345 errors in
15
- * the DTS build. These structural interfaces are satisfied by both xmldom and
16
- * standard DOM objects at runtime.
17
- */
18
- /** A DOM element-like collection returned by getElementsByTagName. */
19
- interface XmlElementCollection {
20
- readonly length: number;
21
- item(index: number): XmlElement | null;
22
- [index: number]: XmlElement;
23
- [Symbol.iterator](): Iterator<XmlElement>;
24
- }
25
- /** Structural interface covering the @xmldom/xmldom Element operations used here. */
26
- interface XmlElement {
27
- readonly nodeName: string;
28
- readonly localName?: string | null;
29
- readonly textContent: string | null;
30
- readonly parentNode: {
31
- removeChild(child: XmlElement): XmlElement;
32
- } | null;
33
- getAttribute(name: string): string | null;
34
- getElementsByTagName(localName: string): XmlElementCollection;
35
- getElementsByTagNameNS(namespaceURI: string | null, localName: string): XmlElementCollection;
36
- }
37
- /** Structural interface covering @xmldom/xmldom Document operations used here. */
38
- interface XmlDocument {
39
- readonly documentElement: XmlElement | null;
40
- getElementsByTagName(localName: string): XmlElementCollection;
41
- getElementsByTagNameNS(namespaceURI: string | null, localName: string): XmlElementCollection;
42
- }
43
- /** Get the local name of a DOM node, stripping any namespace prefix. */
44
- declare function getNodeLocalName(node: XmlElement): string;
45
- /**
46
- * Find the first descendant element matching a local name,
47
- * ignoring namespace prefixes.
48
- */
49
- declare function getFirstDescendantElementByLocalName(parent: XmlDocument | XmlElement, localName: string): XmlElement | undefined;
50
- /**
51
- * Canonicalize a DOM node using the specified canonicalization algorithm.
52
- * Delegates to xml-crypto's C14N implementation.
53
- * Accepts `any` because @xmldom/xmldom nodes are not assignable to
54
- * lib.dom.d.ts Node in TypeScript 6.
55
- */
56
- declare function canonicalizeNode(node: any, algorithm: string): string;
57
- /**
58
- * Canonicalize a `<SignedInfo>` XML fragment for signature verification.
59
- * Uses Exclusive XML Canonicalization (exc-c14n#).
60
- */
61
- declare function canonicalizeSignedInfoXml(signedInfoXml: string): string;
62
-
63
- /**
64
- * Certificate handling utilities for digital signature processing.
65
- *
66
- * Node-only — depends on `node:crypto`, `node:tls`, `node-forge`, `@xmldom/xmldom`.
67
- */
68
-
69
- /** Extract certificate metadata from a Base64-encoded DER certificate. */
70
- declare function certificateInfoFromBase64(certBase64: string): SignatureCertificateInfo | undefined;
71
- /**
72
- * Validate a certificate chain against system trust roots and optional additional roots.
73
- */
74
- declare function validateCertificateChain(certBase64List: string[], additionalRootsPem: string[]): {
75
- status: 'trusted' | 'untrusted' | 'not-checked';
76
- error?: string;
77
- };
78
- /**
79
- * Cryptographically verify the SignatureValue in an XML signature
80
- * using the embedded certificate.
81
- */
82
- declare function verifySignatureValue(signatureXml: string, certBase64List: string[]): 'verified' | 'invalid' | 'not-checked';
83
- /**
84
- * Load a private key and certificate from a PKCS#12 (.pfx/.p12) or PEM buffer.
85
- */
86
- declare function loadSigningMaterialFromBuffer(certificateBuffer: Uint8Array, certificatePath: string, certificatePassword?: string): LoadedSigningMaterial;
87
- /** Convert a PEM certificate to Base64-encoded DER (strip armour + whitespace). */
88
- declare function pemCertificateToBase64(pem: string): string;
89
-
90
- /**
91
- * PKI validation utilities — PEM/fingerprint certificate helpers and
92
- * timestamp-authority evaluation for OOXML digital signatures.
93
- *
94
- * OCSP revocation checking lives in `./ocsp.ts`.
95
- *
96
- * Node-only — depends on `node:crypto` and `node-forge`.
97
- */
98
-
99
- /** Wrap a Base64-encoded DER certificate in PEM armour. */
100
- declare function certPemFromBase64(certBase64: string): string | undefined;
101
- /** SHA-256 fingerprint of a PEM certificate (lowercase hex, no colons). */
102
- declare function certFingerprintSha256(certPem: string): string | undefined;
103
- declare function evaluateTimestampAuthority(signatureXml: string): Promise<{
104
- status: TimestampAuthorityStatus;
105
- error?: string;
106
- }>;
107
-
108
- /**
109
- * OCSP (Online Certificate Status Protocol) revocation checking for OOXML
110
- * digital signature certificates.
111
- *
112
- * Node-only — depends on `node:crypto`, `node:http`, `node:https`, and `node-forge`.
113
- */
114
-
115
- declare function extractOcspUrls(certPem: string): string[];
116
- declare function buildOcspRequestDer(leafPem: string, issuerPem: string): Buffer | undefined;
117
- declare function parseOcspResponseStatus(data: Buffer): CertificateRevocationStatus;
118
- declare function evaluateCertificateRevocation(leafCertPem: string, issuerCertPem: string | undefined): Promise<{
119
- status: CertificateRevocationStatus;
120
- error?: string;
121
- checkedOcspUrls: string[];
122
- checkedCrlUrls: string[];
123
- }>;
124
-
125
- /**
126
- * Environment-based configuration for digital signature validation.
127
- *
128
- * Node-only — reads trust roots from the file system and validation
129
- * policy from environment variables.
130
- */
131
-
132
- /** Extract individual PEM certificates from a text block. */
133
- declare function extractPemCertificatesFromText(text: string): string[];
134
- /**
135
- * Load enterprise trust root certificates from environment-configured sources.
136
- *
137
- * Checks `PPTX_VIEWER_TRUST_ROOTS_PEM` for inline PEM data and
138
- * `PPTX_VIEWER_TRUST_ROOTS_FILE` for file paths (semicolon/comma-separated).
139
- */
140
- declare function loadEnterpriseTrustRoots(): Promise<string[]>;
141
- /**
142
- * Read the signature validation policy from environment variables.
143
- */
144
- declare function getSignatureValidationPolicy(): SignatureValidationPolicy;
145
-
146
- /**
147
- * XML reference transform processing for digital signature verification.
148
- *
149
- * Node-only — depends on `@xmldom/xmldom` for DOM parsing and
150
- * `xml-crypto` (via xml-canonicalization) for C14N transforms.
151
- */
152
-
153
- /**
154
- * Parse `<ds:Transform>` elements from a `<ds:Reference>` node.
155
- */
156
- declare function extractReferenceTransforms(referenceNode: XmlElement): ParsedReferenceTransform[];
157
- /**
158
- * Apply a chain of transforms to binary part data.
159
- * Supports OPC Relationship Transform and XML canonicalization algorithms.
160
- */
161
- declare function applyReferenceTransforms(partBytes: Uint8Array, transforms: ParsedReferenceTransform[]): ReferenceTransformResult;
162
-
163
- /**
164
- * Full reference digest verification for digital signatures.
165
- *
166
- * Node-only — uses `node:crypto` for synchronous hashing,
167
- * `jszip` for ZIP access, and `@xmldom/xmldom` for DOM parsing.
168
- */
169
-
170
- /**
171
- * Compute a Base64-encoded digest using Node.js `crypto` (synchronous).
172
- */
173
- declare function computeDigestBase64(content: Uint8Array, digestAlgorithmUri: string): string | undefined;
174
- /**
175
- * Verify all `<ds:Reference>` digests in an XML signature.
176
- */
177
- declare function buildReferenceChecksFromSignatureXml(zip: JSZip, signatureXml: string): Promise<SignatureReferenceCheck[]>;
178
- /**
179
- * Verify references from a PptxViewer manifest extension in the signature XML.
180
- */
181
- declare function buildReferenceChecksFromPptxViewerManifest(zip: JSZip, signatureXml: string): Promise<SignatureReferenceCheck[]>;
182
-
183
- /**
184
- * PPTX digital signature creation.
185
- *
186
- * Node-only — signs all content in a PPTX package with a certificate
187
- * and returns the signed data along with a verification report.
188
- */
189
-
190
- /**
191
- * Sign all content in a PPTX package with a certificate.
192
- *
193
- * Removes any existing signatures, creates a new XML-DSig signature
194
- * covering all non-signature parts, and returns the signed data
195
- * along with a post-sign verification report.
196
- */
197
- declare function signPptxWithCertificate(data: Uint8Array, certificateBuffer: Uint8Array, options: SignOptions): Promise<SignResult>;
198
-
199
- /**
200
- * Full PPTX digital signature inspection (Node-only).
201
- *
202
- * Orchestrates all sub-modules to analyze every signature in a PPTX package:
203
- * reference digest checks, certificate chain validation, OCSP revocation,
204
- * and timestamp authority evaluation.
205
- */
206
-
207
- /**
208
- * Inspect all digital signatures in a PPTX package.
209
- *
210
- * Performs full cryptographic verification including:
211
- * - Reference digest checks (standard XML-DSig + PptxViewer manifest)
212
- * - Signature value verification (RSA-SHA256/384/512)
213
- * - Certificate chain validation against system + enterprise trust roots
214
- * - OCSP revocation checking
215
- * - Timestamp authority evaluation
216
- *
217
- * @param data - The raw PPTX file bytes.
218
- * @returns A comprehensive digital signature report.
219
- */
220
- declare function inspectPptxDigitalSignatures(data: Uint8Array): Promise<DigitalSignatureReport>;
221
-
222
- export { CertificateRevocationStatus, DigitalSignatureReport, LoadedSigningMaterial, ParsedReferenceTransform, ReferenceTransformResult, SignOptions, SignResult, SignatureCertificateInfo, SignatureReferenceCheck, SignatureValidationPolicy, TimestampAuthorityStatus, applyReferenceTransforms, buildOcspRequestDer, buildReferenceChecksFromPptxViewerManifest, buildReferenceChecksFromSignatureXml, canonicalizeNode, canonicalizeSignedInfoXml, certFingerprintSha256, certPemFromBase64, certificateInfoFromBase64, computeDigestBase64, evaluateCertificateRevocation, evaluateTimestampAuthority, extractOcspUrls, extractPemCertificatesFromText, extractReferenceTransforms, getFirstDescendantElementByLocalName, getNodeLocalName, getSignatureValidationPolicy, inspectPptxDigitalSignatures, loadEnterpriseTrustRoots, loadSigningMaterialFromBuffer, parseOcspResponseStatus, pemCertificateToBase64, signPptxWithCertificate, validateCertificateChain, verifySignatureValue };
@@ -1,134 +0,0 @@
1
- import { r as PptxData, P as PptxSlide } from './presentation-BLbjWKxK.js';
2
-
3
- /**
4
- * Presentation merge operations for the headless PPTX SDK.
5
- *
6
- * Merges slides from a source presentation into a target at the
7
- * {@link PptxData} level. Media embedded as data URLs (imageData,
8
- * mediaData, backgroundImage, posterFrameData) travel with elements
9
- * automatically — no ZIP-level copying is needed.
10
- *
11
- * @module sdk/merge-operations
12
- */
13
-
14
- /**
15
- * Options controlling how slides are merged from source into target.
16
- */
17
- interface MergeOptions {
18
- /** Which slides to take from source (0-based indices). Default: all */
19
- slideIndices?: number[];
20
- /** Where to insert in target (0-based). Default: end */
21
- insertAt?: number;
22
- /** Whether to keep source theme (false = use target theme). Default: false */
23
- keepSourceTheme?: boolean;
24
- }
25
- /**
26
- * Merge slides from a source presentation into a target.
27
- *
28
- * This is a data-level merge that operates on {@link PptxData} objects.
29
- * Slides are deep-cloned from the source, re-numbered to avoid ID
30
- * conflicts, and inserted into the target's slides array.
31
- *
32
- * Media embedded as data URLs (imageData, mediaData, backgroundImage,
33
- * posterFrameData) travel with the cloned elements automatically.
34
- *
35
- * @param targetData - The target presentation data (will be modified in place).
36
- * @param sourceData - The source presentation data (read-only — slides are cloned).
37
- * @param options - Merge configuration.
38
- * @returns Number of slides merged.
39
- *
40
- * @example
41
- * ```ts
42
- * const target = await handler.load(targetBuffer);
43
- * const source = await handler.load(sourceBuffer);
44
- *
45
- * const count = mergePresentation(target, source, {
46
- * slideIndices: [0, 2],
47
- * insertAt: 1,
48
- * });
49
- * console.log(`Merged ${count} slides`);
50
- * ```
51
- */
52
- declare function mergePresentation(targetData: PptxData, sourceData: PptxData, options?: MergeOptions): number;
53
-
54
- /**
55
- * Batch text find and replace operations for the headless PPTX SDK.
56
- *
57
- * Provides framework-agnostic pure functions for searching and
58
- * replacing text across all slides in a presentation, including
59
- * text in group children (recursively).
60
- *
61
- * @module sdk/text-operations
62
- */
63
-
64
- /**
65
- * A single text match result returned by {@link findText}.
66
- */
67
- interface FindResult {
68
- /** 0-based slide index. */
69
- slideIndex: number;
70
- /** ID of the element containing the match. */
71
- elementId: string;
72
- /** Index of the text segment within the element. */
73
- segmentIndex: number;
74
- /** The matched text. */
75
- text: string;
76
- /** Character offset within the segment where the match starts. */
77
- matchIndex: number;
78
- }
79
- /**
80
- * Search for text across all slides in the presentation.
81
- *
82
- * Searches through all text segments in all elements (including
83
- * group children recursively). Supports both plain string and
84
- * RegExp patterns.
85
- *
86
- * @param slides - Array of slides to search.
87
- * @param search - Plain string or RegExp to search for.
88
- * @returns Array of match results with location information.
89
- *
90
- * @example
91
- * ```ts
92
- * const results = findText(data.slides, /Q[1-4] \d{4}/);
93
- * console.log(`Found ${results.length} date references`);
94
- * ```
95
- */
96
- declare function findText(slides: PptxSlide[], search: string | RegExp): FindResult[];
97
- /**
98
- * Replace all occurrences of a search pattern in a single slide's elements.
99
- *
100
- * Mutates the slide's elements in place. Searches through all
101
- * text segments including group children recursively.
102
- *
103
- * @param slide - The slide to perform replacements on.
104
- * @param search - Plain string or RegExp to search for.
105
- * @param replacement - The replacement string (supports `$1`, `$&` etc. for RegExp).
106
- * @returns The number of replacements made.
107
- *
108
- * @example
109
- * ```ts
110
- * const count = replaceTextInSlide(data.slides[0], "2025", "2026");
111
- * console.log(`Updated ${count} occurrences on slide 1`);
112
- * ```
113
- */
114
- declare function replaceTextInSlide(slide: PptxSlide, search: string | RegExp, replacement: string): number;
115
- /**
116
- * Replace all occurrences of a search pattern across all slides.
117
- *
118
- * Mutates slides' elements in place. Searches through all text
119
- * segments including group children recursively.
120
- *
121
- * @param slides - Array of slides to perform replacements on.
122
- * @param search - Plain string or RegExp to search for.
123
- * @param replacement - The replacement string.
124
- * @returns The total number of replacements made across all slides.
125
- *
126
- * @example
127
- * ```ts
128
- * const count = replaceText(data.slides, "Acme Corp", "NewCo Inc");
129
- * console.log(`Rebranded ${count} occurrences`);
130
- * ```
131
- */
132
- declare function replaceText(slides: PptxSlide[], search: string | RegExp, replacement: string): number;
133
-
134
- export { type FindResult as F, type MergeOptions as M, replaceTextInSlide as a, findText as f, mergePresentation as m, replaceText as r };