pdf-oxide-wasm 0.3.48 → 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.
@@ -85,6 +85,213 @@ export class ArtifactStyle {
85
85
  }
86
86
  if (Symbol.dispose) ArtifactStyle.prototype[Symbol.dispose] = ArtifactStyle.prototype.free;
87
87
 
88
+ /**
89
+ * A parsed Document Security Store (`/DSS`, ISO 32000-2 §12.8.4.3).
90
+ * Count + index accessors mirror `WasmCertificate`'s flat shape
91
+ * (wasm-bindgen cannot return `Uint8Array[]` directly).
92
+ */
93
+ export class Dss {
94
+ static __wrap(ptr) {
95
+ const obj = Object.create(Dss.prototype);
96
+ obj.__wbg_ptr = ptr;
97
+ DssFinalization.register(obj, obj.__wbg_ptr, obj);
98
+ return obj;
99
+ }
100
+ __destroy_into_raw() {
101
+ const ptr = this.__wbg_ptr;
102
+ this.__wbg_ptr = 0;
103
+ DssFinalization.unregister(this);
104
+ return ptr;
105
+ }
106
+ free() {
107
+ const ptr = this.__destroy_into_raw();
108
+ wasm.__wbg_dss_free(ptr, 0);
109
+ }
110
+ /**
111
+ * Number of DER X.509 certificates in the DSS.
112
+ * @returns {number}
113
+ */
114
+ get certCount() {
115
+ const ret = wasm.wasmdss_certCount(this.__wbg_ptr);
116
+ return ret >>> 0;
117
+ }
118
+ /**
119
+ * Number of DER CRLs in the DSS.
120
+ * @returns {number}
121
+ */
122
+ get crlCount() {
123
+ const ret = wasm.wasmdss_crlCount(this.__wbg_ptr);
124
+ return ret >>> 0;
125
+ }
126
+ /**
127
+ * The `i`-th DER certificate, or `undefined` if out of range.
128
+ * @param {number} i
129
+ * @returns {Uint8Array | undefined}
130
+ */
131
+ getCert(i) {
132
+ try {
133
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
134
+ wasm.wasmdss_getCert(retptr, this.__wbg_ptr, i);
135
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
136
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
137
+ let v1;
138
+ if (r0 !== 0) {
139
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
140
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
141
+ }
142
+ return v1;
143
+ } finally {
144
+ wasm.__wbindgen_add_to_stack_pointer(16);
145
+ }
146
+ }
147
+ /**
148
+ * The `i`-th DER CRL, or `undefined` if out of range.
149
+ * @param {number} i
150
+ * @returns {Uint8Array | undefined}
151
+ */
152
+ getCrl(i) {
153
+ try {
154
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
155
+ wasm.wasmdss_getCrl(retptr, this.__wbg_ptr, i);
156
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
157
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
158
+ let v1;
159
+ if (r0 !== 0) {
160
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
161
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
162
+ }
163
+ return v1;
164
+ } finally {
165
+ wasm.__wbindgen_add_to_stack_pointer(16);
166
+ }
167
+ }
168
+ /**
169
+ * The `i`-th DER OCSP response, or `undefined` if out of range.
170
+ * @param {number} i
171
+ * @returns {Uint8Array | undefined}
172
+ */
173
+ getOcsp(i) {
174
+ try {
175
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
176
+ wasm.wasmdss_getOcsp(retptr, this.__wbg_ptr, i);
177
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
178
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
179
+ let v1;
180
+ if (r0 !== 0) {
181
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
182
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
183
+ }
184
+ return v1;
185
+ } finally {
186
+ wasm.__wbindgen_add_to_stack_pointer(16);
187
+ }
188
+ }
189
+ /**
190
+ * Number of DER OCSP responses in the DSS.
191
+ * @returns {number}
192
+ */
193
+ get ocspCount() {
194
+ const ret = wasm.wasmdss_ocspCount(this.__wbg_ptr);
195
+ return ret >>> 0;
196
+ }
197
+ /**
198
+ * Per-signature VRI keys (uppercase-hex SHA-1 of `/Contents`).
199
+ * @returns {string[]}
200
+ */
201
+ get vri() {
202
+ try {
203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
+ wasm.wasmdss_vri(retptr, this.__wbg_ptr);
205
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
206
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
207
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
208
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
209
+ return v1;
210
+ } finally {
211
+ wasm.__wbindgen_add_to_stack_pointer(16);
212
+ }
213
+ }
214
+ }
215
+ if (Symbol.dispose) Dss.prototype[Symbol.dispose] = Dss.prototype.free;
216
+
217
+ /**
218
+ * PAdES baseline level. Frozen integer mapping (BB=0, BT=1, BLt=2,
219
+ * BLta=3) shared with the C ABI and every binding — never renumber.
220
+ * @enum {0 | 1 | 2 | 3}
221
+ */
222
+ export const PadesLevel = Object.freeze({
223
+ /**
224
+ * B-B: signed attrs incl. the ESS signing-certificate-v2.
225
+ */
226
+ BB: 0, "0": "BB",
227
+ /**
228
+ * B-T: B-B + an RFC 3161 signature-time-stamp unsigned attr.
229
+ */
230
+ BT: 1, "1": "BT",
231
+ /**
232
+ * B-LT: B-T + a Document Security Store (DSS/VRI).
233
+ */
234
+ BLt: 2, "2": "BLt",
235
+ /**
236
+ * B-LTA: B-LT + a document-scoped `/DocTimeStamp`.
237
+ */
238
+ BLta: 3, "3": "BLta",
239
+ });
240
+
241
+ /**
242
+ * Offline B-LT validation material (DER certs / CRLs / OCSP
243
+ * responses). Build with `new()` then `addCert`/`addCrl`/`addOcsp`.
244
+ */
245
+ export class RevocationMaterial {
246
+ __destroy_into_raw() {
247
+ const ptr = this.__wbg_ptr;
248
+ this.__wbg_ptr = 0;
249
+ RevocationMaterialFinalization.unregister(this);
250
+ return ptr;
251
+ }
252
+ free() {
253
+ const ptr = this.__destroy_into_raw();
254
+ wasm.__wbg_revocationmaterial_free(ptr, 0);
255
+ }
256
+ /**
257
+ * Add a DER X.509 certificate.
258
+ * @param {Uint8Array} der
259
+ */
260
+ addCert(der) {
261
+ const ptr0 = passArray8ToWasm0(der, wasm.__wbindgen_export);
262
+ const len0 = WASM_VECTOR_LEN;
263
+ wasm.wasmrevocationmaterial_addCert(this.__wbg_ptr, ptr0, len0);
264
+ }
265
+ /**
266
+ * Add a DER CRL.
267
+ * @param {Uint8Array} der
268
+ */
269
+ addCrl(der) {
270
+ const ptr0 = passArray8ToWasm0(der, wasm.__wbindgen_export);
271
+ const len0 = WASM_VECTOR_LEN;
272
+ wasm.wasmrevocationmaterial_addCrl(this.__wbg_ptr, ptr0, len0);
273
+ }
274
+ /**
275
+ * Add a DER OCSP response.
276
+ * @param {Uint8Array} der
277
+ */
278
+ addOcsp(der) {
279
+ const ptr0 = passArray8ToWasm0(der, wasm.__wbindgen_export);
280
+ const len0 = WASM_VECTOR_LEN;
281
+ wasm.wasmrevocationmaterial_addOcsp(this.__wbg_ptr, ptr0, len0);
282
+ }
283
+ /**
284
+ * Create an empty revocation-material set.
285
+ */
286
+ constructor() {
287
+ const ret = wasm.wasmrevocationmaterial_new();
288
+ this.__wbg_ptr = ret;
289
+ RevocationMaterialFinalization.register(this, this.__wbg_ptr, this);
290
+ return this;
291
+ }
292
+ }
293
+ if (Symbol.dispose) RevocationMaterial.prototype[Symbol.dispose] = RevocationMaterial.prototype.free;
294
+
88
295
  /**
89
296
  * WASM handle to a streaming-table building session. Created by
90
297
  * `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
@@ -2814,6 +3021,31 @@ export class WasmPdfDocument {
2814
3021
  const ptr = this.__destroy_into_raw();
2815
3022
  wasm.__wbg_wasmpdfdocument_free(ptr, 0);
2816
3023
  }
3024
+ /**
3025
+ * Queue an explicit destructive redaction rectangle on a page
3026
+ * (page user space; `fill` is an optional DeviceRGB `[r,g,b]`).
3027
+ * @param {number} page
3028
+ * @param {number} x0
3029
+ * @param {number} y0
3030
+ * @param {number} x1
3031
+ * @param {number} y1
3032
+ * @param {Float32Array | null} [fill]
3033
+ */
3034
+ addRedaction(page, x0, y0, x1, y1, fill) {
3035
+ try {
3036
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3037
+ var ptr0 = isLikeNone(fill) ? 0 : passArrayF32ToWasm0(fill, wasm.__wbindgen_export);
3038
+ var len0 = WASM_VECTOR_LEN;
3039
+ wasm.wasmpdfdocument_addRedaction(retptr, this.__wbg_ptr, page, x0, y0, x1, y1, ptr0, len0);
3040
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3041
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3042
+ if (r1) {
3043
+ throw takeObject(r0);
3044
+ }
3045
+ } finally {
3046
+ wasm.__wbindgen_add_to_stack_pointer(16);
3047
+ }
3048
+ }
2817
3049
  /**
2818
3050
  * Apply all redactions in the document.
2819
3051
  */
@@ -2847,6 +3079,27 @@ export class WasmPdfDocument {
2847
3079
  wasm.__wbindgen_add_to_stack_pointer(16);
2848
3080
  }
2849
3081
  }
3082
+ /**
3083
+ * Destructively apply all queued redactions (true content removal,
3084
+ * ISO 32000-1:2008 §12.5.6.23). Returns a `RedactionReport` object.
3085
+ * @param {boolean | null} [scrub_metadata]
3086
+ * @returns {any}
3087
+ */
3088
+ applyRedactionsDestructive(scrub_metadata) {
3089
+ try {
3090
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3091
+ wasm.wasmpdfdocument_applyRedactionsDestructive(retptr, this.__wbg_ptr, isLikeNone(scrub_metadata) ? 0xFFFFFF : scrub_metadata ? 1 : 0);
3092
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3093
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3094
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3095
+ if (r2) {
3096
+ throw takeObject(r1);
3097
+ }
3098
+ return takeObject(r0);
3099
+ } finally {
3100
+ wasm.__wbindgen_add_to_stack_pointer(16);
3101
+ }
3102
+ }
2850
3103
  /**
2851
3104
  * Authenticate with a password to decrypt an encrypted PDF.
2852
3105
  *
@@ -2951,6 +3204,26 @@ export class WasmPdfDocument {
2951
3204
  wasm.__wbindgen_add_to_stack_pointer(16);
2952
3205
  }
2953
3206
  }
3207
+ /**
3208
+ * The document's Document Security Store (`/DSS`) as a `Dss`, or
3209
+ * `undefined` if absent. Mirrors Rust `signatures::read_dss`.
3210
+ * @returns {Dss | undefined}
3211
+ */
3212
+ dss() {
3213
+ try {
3214
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3215
+ wasm.wasmpdfdocument_dss(retptr, this.__wbg_ptr);
3216
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3217
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3218
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3219
+ if (r2) {
3220
+ throw takeObject(r1);
3221
+ }
3222
+ return r0 === 0 ? undefined : Dss.__wrap(r0);
3223
+ } finally {
3224
+ wasm.__wbindgen_add_to_stack_pointer(16);
3225
+ }
3226
+ }
2954
3227
  /**
2955
3228
  * Deprecated: Use eraseFooter instead.
2956
3229
  * @param {number} page_index
@@ -4094,6 +4367,26 @@ export class WasmPdfDocument {
4094
4367
  wasm.__wbindgen_add_to_stack_pointer(16);
4095
4368
  }
4096
4369
  }
4370
+ /**
4371
+ * Number of redaction regions queued for `page`.
4372
+ * @param {number} page
4373
+ * @returns {number}
4374
+ */
4375
+ redactionCount(page) {
4376
+ try {
4377
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4378
+ wasm.wasmpdfdocument_redactionCount(retptr, this.__wbg_ptr, page);
4379
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4380
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4381
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4382
+ if (r2) {
4383
+ throw takeObject(r1);
4384
+ }
4385
+ return r0 >>> 0;
4386
+ } finally {
4387
+ wasm.__wbindgen_add_to_stack_pointer(16);
4388
+ }
4389
+ }
4097
4390
  /**
4098
4391
  * Identify and remove both headers and footers.
4099
4392
  *
@@ -4278,6 +4571,30 @@ export class WasmPdfDocument {
4278
4571
  wasm.__wbindgen_add_to_stack_pointer(16);
4279
4572
  }
4280
4573
  }
4574
+ /**
4575
+ * Standalone document sanitization (#231 T10): strip `/Info`,
4576
+ * catalog XMP `/Metadata`, document JavaScript and embedded files
4577
+ * without geometric redaction. Returns a `RedactionReport` object.
4578
+ * @param {boolean | null} [scrub_metadata]
4579
+ * @param {boolean | null} [remove_javascript]
4580
+ * @param {boolean | null} [remove_embedded_files]
4581
+ * @returns {any}
4582
+ */
4583
+ sanitizeDocument(scrub_metadata, remove_javascript, remove_embedded_files) {
4584
+ try {
4585
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4586
+ wasm.wasmpdfdocument_sanitizeDocument(retptr, this.__wbg_ptr, isLikeNone(scrub_metadata) ? 0xFFFFFF : scrub_metadata ? 1 : 0, isLikeNone(remove_javascript) ? 0xFFFFFF : remove_javascript ? 1 : 0, isLikeNone(remove_embedded_files) ? 0xFFFFFF : remove_embedded_files ? 1 : 0);
4587
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4588
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4589
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4590
+ if (r2) {
4591
+ throw takeObject(r1);
4592
+ }
4593
+ return takeObject(r0);
4594
+ } finally {
4595
+ wasm.__wbindgen_add_to_stack_pointer(16);
4596
+ }
4597
+ }
4281
4598
  /**
4282
4599
  * Save all edits and return the resulting PDF as bytes.
4283
4600
  *
@@ -5382,6 +5699,16 @@ export class WasmSignature {
5382
5699
  wasm.__wbindgen_add_to_stack_pointer(16);
5383
5700
  }
5384
5701
  }
5702
+ /**
5703
+ * PAdES baseline level from this signature's CMS attributes alone
5704
+ * (`BB` vs `BT`). `BLt` additionally needs the document `/DSS` —
5705
+ * read it via `WasmPdfDocument.dss()` and re-classify there.
5706
+ * @returns {PadesLevel}
5707
+ */
5708
+ get padesLevel() {
5709
+ const ret = wasm.wasmsignature_padesLevel(this.__wbg_ptr);
5710
+ return ret;
5711
+ }
5385
5712
  /**
5386
5713
  * `/Reason` entry from the signature dictionary, if present.
5387
5714
  * @returns {string | undefined}
@@ -5668,6 +5995,70 @@ export class WasmTimestamp {
5668
5995
  }
5669
5996
  if (Symbol.dispose) WasmTimestamp.prototype[Symbol.dispose] = WasmTimestamp.prototype.free;
5670
5997
 
5998
+ /**
5999
+ * A CycloneDX 1.6 Cryptographic Bill of Materials (JSON string) of the
6000
+ * algorithms exercised so far this process (#230 Phase F).
6001
+ * @returns {string}
6002
+ */
6003
+ export function cryptoCbom() {
6004
+ let deferred1_0;
6005
+ let deferred1_1;
6006
+ try {
6007
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6008
+ wasm.cryptoCbom(retptr);
6009
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6010
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6011
+ deferred1_0 = r0;
6012
+ deferred1_1 = r1;
6013
+ return getStringFromWasm0(r0, r1);
6014
+ } finally {
6015
+ wasm.__wbindgen_add_to_stack_pointer(16);
6016
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
6017
+ }
6018
+ }
6019
+
6020
+ /**
6021
+ * The cryptographic algorithm tokens exercised so far this process
6022
+ * (governance report), as a JSON string array.
6023
+ * @returns {any}
6024
+ */
6025
+ export function cryptoInventory() {
6026
+ try {
6027
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6028
+ wasm.cryptoInventory(retptr);
6029
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6030
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6031
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6032
+ if (r2) {
6033
+ throw takeObject(r1);
6034
+ }
6035
+ return takeObject(r0);
6036
+ } finally {
6037
+ wasm.__wbindgen_add_to_stack_pointer(16);
6038
+ }
6039
+ }
6040
+
6041
+ /**
6042
+ * The active crypto policy as its canonical grammar string.
6043
+ * @returns {string}
6044
+ */
6045
+ export function cryptoPolicy() {
6046
+ let deferred1_0;
6047
+ let deferred1_1;
6048
+ try {
6049
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6050
+ wasm.cryptoPolicy(retptr);
6051
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6052
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6053
+ deferred1_0 = r0;
6054
+ deferred1_1 = r1;
6055
+ return getStringFromWasm0(r0, r1);
6056
+ } finally {
6057
+ wasm.__wbindgen_add_to_stack_pointer(16);
6058
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
6059
+ }
6060
+ }
6061
+
5671
6062
  /**
5672
6063
  * Disable all pdf_oxide log output — convenience wrapper for
5673
6064
  * `setLogLevel("off")`.
@@ -5747,6 +6138,75 @@ export function generateQrSvg(data, error_correction, size) {
5747
6138
  }
5748
6139
  }
5749
6140
 
6141
+ /**
6142
+ * Whether `pdf_data` carries a document-scoped RFC 3161
6143
+ * `/DocTimeStamp` archival timestamp (PAdES-B-LTA). This is the
6144
+ * document-level reader signal; a `WasmSignature`'s `padesLevel`
6145
+ * getter is signature-scoped and tops out at B-LT by design.
6146
+ * @param {Uint8Array} pdf_data
6147
+ * @returns {boolean}
6148
+ */
6149
+ export function hasDocumentTimestamp(pdf_data) {
6150
+ const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
6151
+ const len0 = WASM_VECTOR_LEN;
6152
+ const ret = wasm.hasDocumentTimestamp(ptr0, len0);
6153
+ return ret !== 0;
6154
+ }
6155
+
6156
+ /**
6157
+ * Plan a bookmark split without producing PDFs. Returns a JSON array
6158
+ * of segment objects (`index, startPage…` shape from
6159
+ * `BookmarkSegment`). `level`: 0 = all depths, 1 = top-level.
6160
+ * @param {Uint8Array} src_bytes
6161
+ * @param {string | null | undefined} title_prefix
6162
+ * @param {boolean} ignore_case
6163
+ * @param {number} level
6164
+ * @param {boolean} include_front_matter
6165
+ * @returns {any}
6166
+ */
6167
+ export function planSplitByBookmarks(src_bytes, title_prefix, ignore_case, level, include_front_matter) {
6168
+ try {
6169
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6170
+ const ptr0 = passArray8ToWasm0(src_bytes, wasm.__wbindgen_export);
6171
+ const len0 = WASM_VECTOR_LEN;
6172
+ var ptr1 = isLikeNone(title_prefix) ? 0 : passStringToWasm0(title_prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6173
+ var len1 = WASM_VECTOR_LEN;
6174
+ wasm.planSplitByBookmarks(retptr, ptr0, len0, ptr1, len1, ignore_case, level, include_front_matter);
6175
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6176
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6177
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6178
+ if (r2) {
6179
+ throw takeObject(r1);
6180
+ }
6181
+ return takeObject(r0);
6182
+ } finally {
6183
+ wasm.__wbindgen_add_to_stack_pointer(16);
6184
+ }
6185
+ }
6186
+
6187
+ /**
6188
+ * Install the process-wide runtime crypto policy from its grammar
6189
+ * string (`"compat"|"strict"|"fips-strict"[;…]`). Fail-closed:
6190
+ * throws on an unparseable spec (policy NOT installed) or if a
6191
+ * policy is already set. Default (never set) is `compat`.
6192
+ * @param {string} spec
6193
+ */
6194
+ export function setCryptoPolicy(spec) {
6195
+ try {
6196
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6197
+ const ptr0 = passStringToWasm0(spec, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6198
+ const len0 = WASM_VECTOR_LEN;
6199
+ wasm.setCryptoPolicy(retptr, ptr0, len0);
6200
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6201
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6202
+ if (r1) {
6203
+ throw takeObject(r0);
6204
+ }
6205
+ } finally {
6206
+ wasm.__wbindgen_add_to_stack_pointer(16);
6207
+ }
6208
+ }
6209
+
5750
6210
  /**
5751
6211
  * Set the maximum log level for pdf_oxide messages.
5752
6212
  *
@@ -5817,6 +6277,88 @@ export function signPdfBytes(pdf_data, cert, reason, location) {
5817
6277
  wasm.__wbindgen_add_to_stack_pointer(16);
5818
6278
  }
5819
6279
  }
6280
+
6281
+ /**
6282
+ * Sign raw PDF bytes at a PAdES baseline level and return the signed
6283
+ * PDF as a `Uint8Array`.
6284
+ *
6285
+ * `level` `BLTA` is reserved (→ error). For `BT`/`BLt` pass a
6286
+ * pre-fetched RFC 3161 `timestampToken` (DER): WASM intentionally
6287
+ * omits the online TSA client (same `ureq`-incompat carve-out as
6288
+ * v0.3.38) — without a token the core fail-closes with `Unsupported`.
6289
+ * `revocation` supplies the B-LT DSS material.
6290
+ * @param {Uint8Array} pdf_data
6291
+ * @param {WasmCertificate} cert
6292
+ * @param {PadesLevel} level
6293
+ * @param {Uint8Array | null} [timestamp_token]
6294
+ * @param {RevocationMaterial | null} [revocation]
6295
+ * @param {string | null} [reason]
6296
+ * @param {string | null} [location]
6297
+ * @returns {Uint8Array}
6298
+ */
6299
+ export function signPdfBytesPades(pdf_data, cert, level, timestamp_token, revocation, reason, location) {
6300
+ try {
6301
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6302
+ const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
6303
+ const len0 = WASM_VECTOR_LEN;
6304
+ _assertClass(cert, WasmCertificate);
6305
+ var ptr1 = isLikeNone(timestamp_token) ? 0 : passArray8ToWasm0(timestamp_token, wasm.__wbindgen_export);
6306
+ var len1 = WASM_VECTOR_LEN;
6307
+ let ptr2 = 0;
6308
+ if (!isLikeNone(revocation)) {
6309
+ _assertClass(revocation, RevocationMaterial);
6310
+ ptr2 = revocation.__destroy_into_raw();
6311
+ }
6312
+ var ptr3 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6313
+ var len3 = WASM_VECTOR_LEN;
6314
+ var ptr4 = isLikeNone(location) ? 0 : passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6315
+ var len4 = WASM_VECTOR_LEN;
6316
+ wasm.signPdfBytesPades(retptr, ptr0, len0, cert.__wbg_ptr, level, ptr1, len1, ptr2, ptr3, len3, ptr4, len4);
6317
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6318
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6319
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6320
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6321
+ if (r3) {
6322
+ throw takeObject(r2);
6323
+ }
6324
+ var v6 = getArrayU8FromWasm0(r0, r1).slice();
6325
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6326
+ return v6;
6327
+ } finally {
6328
+ wasm.__wbindgen_add_to_stack_pointer(16);
6329
+ }
6330
+ }
6331
+
6332
+ /**
6333
+ * Split at bookmark boundaries. Returns a JSON array of
6334
+ * `[segment, bytes]` pairs (bytes as a number array; source
6335
+ * unmodified).
6336
+ * @param {Uint8Array} src_bytes
6337
+ * @param {string | null | undefined} title_prefix
6338
+ * @param {boolean} ignore_case
6339
+ * @param {number} level
6340
+ * @param {boolean} include_front_matter
6341
+ * @returns {any}
6342
+ */
6343
+ export function splitByBookmarks(src_bytes, title_prefix, ignore_case, level, include_front_matter) {
6344
+ try {
6345
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6346
+ const ptr0 = passArray8ToWasm0(src_bytes, wasm.__wbindgen_export);
6347
+ const len0 = WASM_VECTOR_LEN;
6348
+ var ptr1 = isLikeNone(title_prefix) ? 0 : passStringToWasm0(title_prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6349
+ var len1 = WASM_VECTOR_LEN;
6350
+ wasm.splitByBookmarks(retptr, ptr0, len0, ptr1, len1, ignore_case, level, include_front_matter);
6351
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6352
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6353
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6354
+ if (r2) {
6355
+ throw takeObject(r1);
6356
+ }
6357
+ return takeObject(r0);
6358
+ } finally {
6359
+ wasm.__wbindgen_add_to_stack_pointer(16);
6360
+ }
6361
+ }
5820
6362
  export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
5821
6363
  const ret = Error(getStringFromWasm0(arg0, arg1));
5822
6364
  return addHeapObject(ret);
@@ -6131,6 +6673,9 @@ const WasmCertificateFinalization = (typeof FinalizationRegistry === 'undefined'
6131
6673
  const WasmDocumentBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
6132
6674
  ? { register: () => {}, unregister: () => {} }
6133
6675
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmdocumentbuilder_free(ptr, 1));
6676
+ const DssFinalization = (typeof FinalizationRegistry === 'undefined')
6677
+ ? { register: () => {}, unregister: () => {} }
6678
+ : new FinalizationRegistry(ptr => wasm.__wbg_dss_free(ptr, 1));
6134
6679
  const WasmEmbeddedFontFinalization = (typeof FinalizationRegistry === 'undefined')
6135
6680
  ? { register: () => {}, unregister: () => {} }
6136
6681
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmembeddedfont_free(ptr, 1));
@@ -6161,6 +6706,9 @@ const WasmPdfDocumentFinalization = (typeof FinalizationRegistry === 'undefined'
6161
6706
  const WasmPdfPageRegionFinalization = (typeof FinalizationRegistry === 'undefined')
6162
6707
  ? { register: () => {}, unregister: () => {} }
6163
6708
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmpdfpageregion_free(ptr, 1));
6709
+ const RevocationMaterialFinalization = (typeof FinalizationRegistry === 'undefined')
6710
+ ? { register: () => {}, unregister: () => {} }
6711
+ : new FinalizationRegistry(ptr => wasm.__wbg_revocationmaterial_free(ptr, 1));
6164
6712
  const WasmSignatureFinalization = (typeof FinalizationRegistry === 'undefined')
6165
6713
  ? { register: () => {}, unregister: () => {} }
6166
6714
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmsignature_free(ptr, 1));
Binary file