pdf-oxide-wasm 0.3.49 → 0.3.50

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.
@@ -2,6 +2,8 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_artifactstyle_free: (a: number, b: number) => void;
5
+ export const __wbg_dss_free: (a: number, b: number) => void;
6
+ export const __wbg_revocationmaterial_free: (a: number, b: number) => void;
5
7
  export const __wbg_streamingtable_free: (a: number, b: number) => void;
6
8
  export const __wbg_wasmartifact_free: (a: number, b: number) => void;
7
9
  export const __wbg_wasmcertificate_free: (a: number, b: number) => void;
@@ -15,10 +17,18 @@ export const __wbg_wasmpdfdocument_free: (a: number, b: number) => void;
15
17
  export const __wbg_wasmpdfpageregion_free: (a: number, b: number) => void;
16
18
  export const __wbg_wasmsignature_free: (a: number, b: number) => void;
17
19
  export const __wbg_wasmtimestamp_free: (a: number, b: number) => void;
20
+ export const cryptoCbom: (a: number) => void;
21
+ export const cryptoInventory: (a: number) => void;
22
+ export const cryptoPolicy: (a: number) => void;
18
23
  export const generateBarcodeSvg: (a: number, b: number, c: number, d: number) => void;
19
24
  export const generateQrSvg: (a: number, b: number, c: number, d: number, e: number) => void;
25
+ export const hasDocumentTimestamp: (a: number, b: number) => number;
26
+ export const planSplitByBookmarks: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
27
+ export const setCryptoPolicy: (a: number, b: number, c: number) => void;
20
28
  export const setLogLevel: (a: number, b: number, c: number) => void;
21
29
  export const signPdfBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
30
+ export const signPdfBytesPades: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
31
+ export const splitByBookmarks: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
22
32
  export const streamingtable_batchCount: (a: number) => number;
23
33
  export const streamingtable_columnCount: (a: number) => number;
24
34
  export const streamingtable_finish: (a: number, b: number) => void;
@@ -61,6 +71,11 @@ export const wasmdocumentbuilder_subject: (a: number, b: number, c: number, d: n
61
71
  export const wasmdocumentbuilder_taggedPdfUa1: (a: number, b: number) => void;
62
72
  export const wasmdocumentbuilder_title: (a: number, b: number, c: number, d: number) => void;
63
73
  export const wasmdocumentbuilder_toBytesEncrypted: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
74
+ export const wasmdss_certCount: (a: number) => number;
75
+ export const wasmdss_getCert: (a: number, b: number, c: number) => void;
76
+ export const wasmdss_getCrl: (a: number, b: number, c: number) => void;
77
+ export const wasmdss_getOcsp: (a: number, b: number, c: number) => void;
78
+ export const wasmdss_vri: (a: number, b: number) => void;
64
79
  export const wasmembeddedfont_fromBytes: (a: number, b: number, c: number, d: number, e: number) => void;
65
80
  export const wasmembeddedfont_name: (a: number, b: number) => void;
66
81
  export const wasmfluentpagebuilder_at: (a: number, b: number, c: number, d: number) => void;
@@ -138,13 +153,16 @@ export const wasmpdf_fromText: (a: number, b: number, c: number, d: number, e: n
138
153
  export const wasmpdf_merge: (a: number, b: number, c: number) => void;
139
154
  export const wasmpdf_size: (a: number) => number;
140
155
  export const wasmpdf_toBytes: (a: number, b: number) => void;
156
+ export const wasmpdfdocument_addRedaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
141
157
  export const wasmpdfdocument_applyAllRedactions: (a: number, b: number) => void;
142
158
  export const wasmpdfdocument_applyPageRedactions: (a: number, b: number, c: number) => void;
159
+ export const wasmpdfdocument_applyRedactionsDestructive: (a: number, b: number, c: number) => void;
143
160
  export const wasmpdfdocument_authenticate: (a: number, b: number, c: number, d: number) => void;
144
161
  export const wasmpdfdocument_clearEraseRegions: (a: number, b: number, c: number) => void;
145
162
  export const wasmpdfdocument_convertToPdfA: (a: number, b: number, c: number, d: number) => void;
146
163
  export const wasmpdfdocument_cropMargins: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
147
164
  export const wasmpdfdocument_deletePage: (a: number, b: number, c: number) => void;
165
+ export const wasmpdfdocument_dss: (a: number, b: number) => void;
148
166
  export const wasmpdfdocument_editFooter: (a: number, b: number, c: number) => void;
149
167
  export const wasmpdfdocument_editHeader: (a: number, b: number, c: number) => void;
150
168
  export const wasmpdfdocument_embedFile: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -193,6 +211,7 @@ export const wasmpdfdocument_pageImages: (a: number, b: number, c: number) => vo
193
211
  export const wasmpdfdocument_pageLabels: (a: number, b: number) => void;
194
212
  export const wasmpdfdocument_pageMediaBox: (a: number, b: number, c: number) => void;
195
213
  export const wasmpdfdocument_pageRotation: (a: number, b: number, c: number) => void;
214
+ export const wasmpdfdocument_redactionCount: (a: number, b: number, c: number) => void;
196
215
  export const wasmpdfdocument_removeArtifacts: (a: number, b: number, c: number) => void;
197
216
  export const wasmpdfdocument_removeFooters: (a: number, b: number, c: number) => void;
198
217
  export const wasmpdfdocument_removeHeaders: (a: number, b: number, c: number) => void;
@@ -201,6 +220,7 @@ export const wasmpdfdocument_repositionImage: (a: number, b: number, c: number,
201
220
  export const wasmpdfdocument_resizeImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
202
221
  export const wasmpdfdocument_rotateAllPages: (a: number, b: number, c: number) => void;
203
222
  export const wasmpdfdocument_rotatePage: (a: number, b: number, c: number, d: number) => void;
223
+ export const wasmpdfdocument_sanitizeDocument: (a: number, b: number, c: number, d: number, e: number) => void;
204
224
  export const wasmpdfdocument_save: (a: number, b: number) => void;
205
225
  export const wasmpdfdocument_saveEncryptedToBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
206
226
  export const wasmpdfdocument_saveWithOptions: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -242,9 +262,14 @@ export const wasmpdfpageregion_extractText: (a: number, b: number) => void;
242
262
  export const wasmpdfpageregion_extractTextLines: (a: number, b: number) => void;
243
263
  export const wasmpdfpageregion_extractTextOcr: (a: number, b: number, c: number) => void;
244
264
  export const wasmpdfpageregion_extractWords: (a: number, b: number) => void;
265
+ export const wasmrevocationmaterial_addCert: (a: number, b: number, c: number) => void;
266
+ export const wasmrevocationmaterial_addCrl: (a: number, b: number, c: number) => void;
267
+ export const wasmrevocationmaterial_addOcsp: (a: number, b: number, c: number) => void;
268
+ export const wasmrevocationmaterial_new: () => number;
245
269
  export const wasmsignature_contactInfo: (a: number, b: number) => void;
246
270
  export const wasmsignature_coversWholeDocument: (a: number) => number;
247
271
  export const wasmsignature_location: (a: number, b: number) => void;
272
+ export const wasmsignature_padesLevel: (a: number) => number;
248
273
  export const wasmsignature_reason: (a: number, b: number) => void;
249
274
  export const wasmsignature_signerName: (a: number, b: number) => void;
250
275
  export const wasmsignature_signingTime: (a: number, b: number) => void;
@@ -258,6 +283,8 @@ export const wasmtimestamp_serial: (a: number, b: number) => void;
258
283
  export const wasmtimestamp_time: (a: number) => bigint;
259
284
  export const wasmtimestamp_tsaName: (a: number, b: number) => void;
260
285
  export const wasmtimestamp_verify: (a: number, b: number) => void;
286
+ export const wasmdss_crlCount: (a: number) => number;
287
+ export const wasmdss_ocspCount: (a: number) => number;
261
288
  export const wasmocrconfig_new: () => number;
262
289
  export const wasmpdfdocument_saveToBytes: (a: number, b: number) => void;
263
290
  export const wasmfooter_center: (a: number, b: number) => number;
@@ -270,8 +297,8 @@ export const wasmfooter_new: () => number;
270
297
  export const wasmheader_new: () => number;
271
298
  export const __wbg_wasmocrengine_free: (a: number, b: number) => void;
272
299
  export const disableLogging: () => void;
273
- export const __wbg_wasmfooter_free: (a: number, b: number) => void;
274
300
  export const __wbg_wasmheader_free: (a: number, b: number) => void;
301
+ export const __wbg_wasmfooter_free: (a: number, b: number) => void;
275
302
  export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
276
303
  export const qcms_profile_precache_output_transform: (a: number) => void;
277
304
  export const lut_interp_linear16: (a: number, b: number, c: number) => number;
@@ -45,6 +45,93 @@ export class ArtifactStyle {
45
45
  constructor();
46
46
  }
47
47
 
48
+ /**
49
+ * A parsed Document Security Store (`/DSS`, ISO 32000-2 §12.8.4.3).
50
+ * Count + index accessors mirror `WasmCertificate`'s flat shape
51
+ * (wasm-bindgen cannot return `Uint8Array[]` directly).
52
+ */
53
+ export class Dss {
54
+ private constructor();
55
+ free(): void;
56
+ [Symbol.dispose](): void;
57
+ /**
58
+ * The `i`-th DER certificate, or `undefined` if out of range.
59
+ */
60
+ getCert(i: number): Uint8Array | undefined;
61
+ /**
62
+ * The `i`-th DER CRL, or `undefined` if out of range.
63
+ */
64
+ getCrl(i: number): Uint8Array | undefined;
65
+ /**
66
+ * The `i`-th DER OCSP response, or `undefined` if out of range.
67
+ */
68
+ getOcsp(i: number): Uint8Array | undefined;
69
+ /**
70
+ * Number of DER X.509 certificates in the DSS.
71
+ */
72
+ readonly certCount: number;
73
+ /**
74
+ * Number of DER CRLs in the DSS.
75
+ */
76
+ readonly crlCount: number;
77
+ /**
78
+ * Number of DER OCSP responses in the DSS.
79
+ */
80
+ readonly ocspCount: number;
81
+ /**
82
+ * Per-signature VRI keys (uppercase-hex SHA-1 of `/Contents`).
83
+ */
84
+ readonly vri: string[];
85
+ }
86
+
87
+ /**
88
+ * PAdES baseline level. Frozen integer mapping (BB=0, BT=1, BLt=2,
89
+ * BLta=3) shared with the C ABI and every binding — never renumber.
90
+ */
91
+ export enum PadesLevel {
92
+ /**
93
+ * B-B: signed attrs incl. the ESS signing-certificate-v2.
94
+ */
95
+ BB = 0,
96
+ /**
97
+ * B-T: B-B + an RFC 3161 signature-time-stamp unsigned attr.
98
+ */
99
+ BT = 1,
100
+ /**
101
+ * B-LT: B-T + a Document Security Store (DSS/VRI).
102
+ */
103
+ BLt = 2,
104
+ /**
105
+ * B-LTA: B-LT + a document-scoped `/DocTimeStamp`.
106
+ */
107
+ BLta = 3,
108
+ }
109
+
110
+ /**
111
+ * Offline B-LT validation material (DER certs / CRLs / OCSP
112
+ * responses). Build with `new()` then `addCert`/`addCrl`/`addOcsp`.
113
+ */
114
+ export class RevocationMaterial {
115
+ free(): void;
116
+ [Symbol.dispose](): void;
117
+ /**
118
+ * Add a DER X.509 certificate.
119
+ */
120
+ addCert(der: Uint8Array): void;
121
+ /**
122
+ * Add a DER CRL.
123
+ */
124
+ addCrl(der: Uint8Array): void;
125
+ /**
126
+ * Add a DER OCSP response.
127
+ */
128
+ addOcsp(der: Uint8Array): void;
129
+ /**
130
+ * Create an empty revocation-material set.
131
+ */
132
+ constructor();
133
+ }
134
+
48
135
  /**
49
136
  * WASM handle to a streaming-table building session. Created by
50
137
  * `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
@@ -703,6 +790,11 @@ export class WasmPdf {
703
790
  export class WasmPdfDocument {
704
791
  free(): void;
705
792
  [Symbol.dispose](): void;
793
+ /**
794
+ * Queue an explicit destructive redaction rectangle on a page
795
+ * (page user space; `fill` is an optional DeviceRGB `[r,g,b]`).
796
+ */
797
+ addRedaction(page: number, x0: number, y0: number, x1: number, y1: number, fill?: Float32Array | null): void;
706
798
  /**
707
799
  * Apply all redactions in the document.
708
800
  */
@@ -711,6 +803,11 @@ export class WasmPdfDocument {
711
803
  * Apply redactions on a page (removes redacted content permanently).
712
804
  */
713
805
  applyPageRedactions(page_index: number): void;
806
+ /**
807
+ * Destructively apply all queued redactions (true content removal,
808
+ * ISO 32000-1:2008 §12.5.6.23). Returns a `RedactionReport` object.
809
+ */
810
+ applyRedactionsDestructive(scrub_metadata?: boolean | null): any;
714
811
  /**
715
812
  * Authenticate with a password to decrypt an encrypted PDF.
716
813
  *
@@ -737,6 +834,11 @@ export class WasmPdfDocument {
737
834
  * Delete a page by index (0-based).
738
835
  */
739
836
  deletePage(index: number): void;
837
+ /**
838
+ * The document's Document Security Store (`/DSS`) as a `Dss`, or
839
+ * `undefined` if absent. Mirrors Rust `signatures::read_dss`.
840
+ */
841
+ dss(): Dss | undefined;
740
842
  /**
741
843
  * Deprecated: Use eraseFooter instead.
742
844
  */
@@ -1051,6 +1153,10 @@ export class WasmPdfDocument {
1051
1153
  * Get the rotation of a page in degrees (0, 90, 180, 270).
1052
1154
  */
1053
1155
  pageRotation(page_index: number): number;
1156
+ /**
1157
+ * Number of redaction regions queued for `page`.
1158
+ */
1159
+ redactionCount(page: number): number;
1054
1160
  /**
1055
1161
  * Identify and remove both headers and footers.
1056
1162
  *
@@ -1104,6 +1210,12 @@ export class WasmPdfDocument {
1104
1210
  * Rotate a page by the given degrees (adds to current rotation).
1105
1211
  */
1106
1212
  rotatePage(page_index: number, degrees: number): void;
1213
+ /**
1214
+ * Standalone document sanitization (#231 T10): strip `/Info`,
1215
+ * catalog XMP `/Metadata`, document JavaScript and embedded files
1216
+ * without geometric redaction. Returns a `RedactionReport` object.
1217
+ */
1218
+ sanitizeDocument(scrub_metadata?: boolean | null, remove_javascript?: boolean | null, remove_embedded_files?: boolean | null): any;
1107
1219
  /**
1108
1220
  * Save all edits and return the resulting PDF as bytes.
1109
1221
  *
@@ -1374,6 +1486,12 @@ export class WasmSignature {
1374
1486
  * `/Location` entry from the signature dictionary, if present.
1375
1487
  */
1376
1488
  readonly location: string | undefined;
1489
+ /**
1490
+ * PAdES baseline level from this signature's CMS attributes alone
1491
+ * (`BB` vs `BT`). `BLt` additionally needs the document `/DSS` —
1492
+ * read it via `WasmPdfDocument.dss()` and re-classify there.
1493
+ */
1494
+ readonly padesLevel: PadesLevel;
1377
1495
  /**
1378
1496
  * `/Reason` entry from the signature dictionary, if present.
1379
1497
  */
@@ -1437,6 +1555,23 @@ export class WasmTimestamp {
1437
1555
  readonly tsaName: string;
1438
1556
  }
1439
1557
 
1558
+ /**
1559
+ * A CycloneDX 1.6 Cryptographic Bill of Materials (JSON string) of the
1560
+ * algorithms exercised so far this process (#230 Phase F).
1561
+ */
1562
+ export function cryptoCbom(): string;
1563
+
1564
+ /**
1565
+ * The cryptographic algorithm tokens exercised so far this process
1566
+ * (governance report), as a JSON string array.
1567
+ */
1568
+ export function cryptoInventory(): any;
1569
+
1570
+ /**
1571
+ * The active crypto policy as its canonical grammar string.
1572
+ */
1573
+ export function cryptoPolicy(): string;
1574
+
1440
1575
  /**
1441
1576
  * Disable all pdf_oxide log output — convenience wrapper for
1442
1577
  * `setLogLevel("off")`.
@@ -1457,6 +1592,29 @@ export function generateBarcodeSvg(barcode_type: number, data: string): string;
1457
1592
  */
1458
1593
  export function generateQrSvg(data: string, error_correction: number, size: number): string;
1459
1594
 
1595
+ /**
1596
+ * Whether `pdf_data` carries a document-scoped RFC 3161
1597
+ * `/DocTimeStamp` archival timestamp (PAdES-B-LTA). This is the
1598
+ * document-level reader signal; a `WasmSignature`'s `padesLevel`
1599
+ * getter is signature-scoped and tops out at B-LT by design.
1600
+ */
1601
+ export function hasDocumentTimestamp(pdf_data: Uint8Array): boolean;
1602
+
1603
+ /**
1604
+ * Plan a bookmark split without producing PDFs. Returns a JSON array
1605
+ * of segment objects (`index, startPage…` shape from
1606
+ * `BookmarkSegment`). `level`: 0 = all depths, 1 = top-level.
1607
+ */
1608
+ export function planSplitByBookmarks(src_bytes: Uint8Array, title_prefix: string | null | undefined, ignore_case: boolean, level: number, include_front_matter: boolean): any;
1609
+
1610
+ /**
1611
+ * Install the process-wide runtime crypto policy from its grammar
1612
+ * string (`"compat"|"strict"|"fips-strict"[;…]`). Fail-closed:
1613
+ * throws on an unparseable spec (policy NOT installed) or if a
1614
+ * policy is already set. Default (never set) is `compat`.
1615
+ */
1616
+ export function setCryptoPolicy(spec: string): void;
1617
+
1460
1618
  /**
1461
1619
  * Set the maximum log level for pdf_oxide messages.
1462
1620
  *
@@ -1483,3 +1641,22 @@ export function setLogLevel(level: string): void;
1483
1641
  * `Certificate.loadPkcs12`).
1484
1642
  */
1485
1643
  export function signPdfBytes(pdf_data: Uint8Array, cert: WasmCertificate, reason?: string | null, location?: string | null): Uint8Array;
1644
+
1645
+ /**
1646
+ * Sign raw PDF bytes at a PAdES baseline level and return the signed
1647
+ * PDF as a `Uint8Array`.
1648
+ *
1649
+ * `level` `BLTA` is reserved (→ error). For `BT`/`BLt` pass a
1650
+ * pre-fetched RFC 3161 `timestampToken` (DER): WASM intentionally
1651
+ * omits the online TSA client (same `ureq`-incompat carve-out as
1652
+ * v0.3.38) — without a token the core fail-closes with `Unsupported`.
1653
+ * `revocation` supplies the B-LT DSS material.
1654
+ */
1655
+ export function signPdfBytesPades(pdf_data: Uint8Array, cert: WasmCertificate, level: PadesLevel, timestamp_token?: Uint8Array | null, revocation?: RevocationMaterial | null, reason?: string | null, location?: string | null): Uint8Array;
1656
+
1657
+ /**
1658
+ * Split at bookmark boundaries. Returns a JSON array of
1659
+ * `[segment, bytes]` pairs (bytes as a number array; source
1660
+ * unmodified).
1661
+ */
1662
+ export function splitByBookmarks(src_bytes: Uint8Array, title_prefix: string | null | undefined, ignore_case: boolean, level: number, include_front_matter: boolean): any;