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