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.
- 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/nodejs/pdf_oxide.js
CHANGED
|
@@ -89,6 +89,216 @@ class ArtifactStyle {
|
|
|
89
89
|
if (Symbol.dispose) ArtifactStyle.prototype[Symbol.dispose] = ArtifactStyle.prototype.free;
|
|
90
90
|
exports.ArtifactStyle = ArtifactStyle;
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* A parsed Document Security Store (`/DSS`, ISO 32000-2 §12.8.4.3).
|
|
94
|
+
* Count + index accessors mirror `WasmCertificate`'s flat shape
|
|
95
|
+
* (wasm-bindgen cannot return `Uint8Array[]` directly).
|
|
96
|
+
*/
|
|
97
|
+
class Dss {
|
|
98
|
+
static __wrap(ptr) {
|
|
99
|
+
const obj = Object.create(Dss.prototype);
|
|
100
|
+
obj.__wbg_ptr = ptr;
|
|
101
|
+
DssFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
102
|
+
return obj;
|
|
103
|
+
}
|
|
104
|
+
__destroy_into_raw() {
|
|
105
|
+
const ptr = this.__wbg_ptr;
|
|
106
|
+
this.__wbg_ptr = 0;
|
|
107
|
+
DssFinalization.unregister(this);
|
|
108
|
+
return ptr;
|
|
109
|
+
}
|
|
110
|
+
free() {
|
|
111
|
+
const ptr = this.__destroy_into_raw();
|
|
112
|
+
wasm.__wbg_dss_free(ptr, 0);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Number of DER X.509 certificates in the DSS.
|
|
116
|
+
* @returns {number}
|
|
117
|
+
*/
|
|
118
|
+
get certCount() {
|
|
119
|
+
const ret = wasm.wasmdss_certCount(this.__wbg_ptr);
|
|
120
|
+
return ret >>> 0;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Number of DER CRLs in the DSS.
|
|
124
|
+
* @returns {number}
|
|
125
|
+
*/
|
|
126
|
+
get crlCount() {
|
|
127
|
+
const ret = wasm.wasmdss_crlCount(this.__wbg_ptr);
|
|
128
|
+
return ret >>> 0;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The `i`-th DER certificate, or `undefined` if out of range.
|
|
132
|
+
* @param {number} i
|
|
133
|
+
* @returns {Uint8Array | undefined}
|
|
134
|
+
*/
|
|
135
|
+
getCert(i) {
|
|
136
|
+
try {
|
|
137
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
138
|
+
wasm.wasmdss_getCert(retptr, this.__wbg_ptr, i);
|
|
139
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
140
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
141
|
+
let v1;
|
|
142
|
+
if (r0 !== 0) {
|
|
143
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
144
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
145
|
+
}
|
|
146
|
+
return v1;
|
|
147
|
+
} finally {
|
|
148
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The `i`-th DER CRL, or `undefined` if out of range.
|
|
153
|
+
* @param {number} i
|
|
154
|
+
* @returns {Uint8Array | undefined}
|
|
155
|
+
*/
|
|
156
|
+
getCrl(i) {
|
|
157
|
+
try {
|
|
158
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
159
|
+
wasm.wasmdss_getCrl(retptr, this.__wbg_ptr, i);
|
|
160
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
161
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
162
|
+
let v1;
|
|
163
|
+
if (r0 !== 0) {
|
|
164
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
165
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
166
|
+
}
|
|
167
|
+
return v1;
|
|
168
|
+
} finally {
|
|
169
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The `i`-th DER OCSP response, or `undefined` if out of range.
|
|
174
|
+
* @param {number} i
|
|
175
|
+
* @returns {Uint8Array | undefined}
|
|
176
|
+
*/
|
|
177
|
+
getOcsp(i) {
|
|
178
|
+
try {
|
|
179
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
180
|
+
wasm.wasmdss_getOcsp(retptr, this.__wbg_ptr, i);
|
|
181
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
182
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
183
|
+
let v1;
|
|
184
|
+
if (r0 !== 0) {
|
|
185
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
186
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
187
|
+
}
|
|
188
|
+
return v1;
|
|
189
|
+
} finally {
|
|
190
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Number of DER OCSP responses in the DSS.
|
|
195
|
+
* @returns {number}
|
|
196
|
+
*/
|
|
197
|
+
get ocspCount() {
|
|
198
|
+
const ret = wasm.wasmdss_ocspCount(this.__wbg_ptr);
|
|
199
|
+
return ret >>> 0;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Per-signature VRI keys (uppercase-hex SHA-1 of `/Contents`).
|
|
203
|
+
* @returns {string[]}
|
|
204
|
+
*/
|
|
205
|
+
get vri() {
|
|
206
|
+
try {
|
|
207
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
208
|
+
wasm.wasmdss_vri(retptr, this.__wbg_ptr);
|
|
209
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
210
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
211
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
212
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
213
|
+
return v1;
|
|
214
|
+
} finally {
|
|
215
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (Symbol.dispose) Dss.prototype[Symbol.dispose] = Dss.prototype.free;
|
|
220
|
+
exports.Dss = Dss;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* PAdES baseline level. Frozen integer mapping (BB=0, BT=1, BLt=2,
|
|
224
|
+
* BLta=3) shared with the C ABI and every binding — never renumber.
|
|
225
|
+
* @enum {0 | 1 | 2 | 3}
|
|
226
|
+
*/
|
|
227
|
+
const PadesLevel = Object.freeze({
|
|
228
|
+
/**
|
|
229
|
+
* B-B: signed attrs incl. the ESS signing-certificate-v2.
|
|
230
|
+
*/
|
|
231
|
+
BB: 0, "0": "BB",
|
|
232
|
+
/**
|
|
233
|
+
* B-T: B-B + an RFC 3161 signature-time-stamp unsigned attr.
|
|
234
|
+
*/
|
|
235
|
+
BT: 1, "1": "BT",
|
|
236
|
+
/**
|
|
237
|
+
* B-LT: B-T + a Document Security Store (DSS/VRI).
|
|
238
|
+
*/
|
|
239
|
+
BLt: 2, "2": "BLt",
|
|
240
|
+
/**
|
|
241
|
+
* B-LTA: B-LT + a document-scoped `/DocTimeStamp`.
|
|
242
|
+
*/
|
|
243
|
+
BLta: 3, "3": "BLta",
|
|
244
|
+
});
|
|
245
|
+
exports.PadesLevel = PadesLevel;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Offline B-LT validation material (DER certs / CRLs / OCSP
|
|
249
|
+
* responses). Build with `new()` then `addCert`/`addCrl`/`addOcsp`.
|
|
250
|
+
*/
|
|
251
|
+
class RevocationMaterial {
|
|
252
|
+
__destroy_into_raw() {
|
|
253
|
+
const ptr = this.__wbg_ptr;
|
|
254
|
+
this.__wbg_ptr = 0;
|
|
255
|
+
RevocationMaterialFinalization.unregister(this);
|
|
256
|
+
return ptr;
|
|
257
|
+
}
|
|
258
|
+
free() {
|
|
259
|
+
const ptr = this.__destroy_into_raw();
|
|
260
|
+
wasm.__wbg_revocationmaterial_free(ptr, 0);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Add a DER X.509 certificate.
|
|
264
|
+
* @param {Uint8Array} der
|
|
265
|
+
*/
|
|
266
|
+
addCert(der) {
|
|
267
|
+
const ptr0 = passArray8ToWasm0(der, wasm.__wbindgen_export);
|
|
268
|
+
const len0 = WASM_VECTOR_LEN;
|
|
269
|
+
wasm.wasmrevocationmaterial_addCert(this.__wbg_ptr, ptr0, len0);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Add a DER CRL.
|
|
273
|
+
* @param {Uint8Array} der
|
|
274
|
+
*/
|
|
275
|
+
addCrl(der) {
|
|
276
|
+
const ptr0 = passArray8ToWasm0(der, wasm.__wbindgen_export);
|
|
277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
278
|
+
wasm.wasmrevocationmaterial_addCrl(this.__wbg_ptr, ptr0, len0);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Add a DER OCSP response.
|
|
282
|
+
* @param {Uint8Array} der
|
|
283
|
+
*/
|
|
284
|
+
addOcsp(der) {
|
|
285
|
+
const ptr0 = passArray8ToWasm0(der, wasm.__wbindgen_export);
|
|
286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
287
|
+
wasm.wasmrevocationmaterial_addOcsp(this.__wbg_ptr, ptr0, len0);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Create an empty revocation-material set.
|
|
291
|
+
*/
|
|
292
|
+
constructor() {
|
|
293
|
+
const ret = wasm.wasmrevocationmaterial_new();
|
|
294
|
+
this.__wbg_ptr = ret;
|
|
295
|
+
RevocationMaterialFinalization.register(this, this.__wbg_ptr, this);
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (Symbol.dispose) RevocationMaterial.prototype[Symbol.dispose] = RevocationMaterial.prototype.free;
|
|
300
|
+
exports.RevocationMaterial = RevocationMaterial;
|
|
301
|
+
|
|
92
302
|
/**
|
|
93
303
|
* WASM handle to a streaming-table building session. Created by
|
|
94
304
|
* `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
|
|
@@ -2830,6 +3040,31 @@ class WasmPdfDocument {
|
|
|
2830
3040
|
const ptr = this.__destroy_into_raw();
|
|
2831
3041
|
wasm.__wbg_wasmpdfdocument_free(ptr, 0);
|
|
2832
3042
|
}
|
|
3043
|
+
/**
|
|
3044
|
+
* Queue an explicit destructive redaction rectangle on a page
|
|
3045
|
+
* (page user space; `fill` is an optional DeviceRGB `[r,g,b]`).
|
|
3046
|
+
* @param {number} page
|
|
3047
|
+
* @param {number} x0
|
|
3048
|
+
* @param {number} y0
|
|
3049
|
+
* @param {number} x1
|
|
3050
|
+
* @param {number} y1
|
|
3051
|
+
* @param {Float32Array | null} [fill]
|
|
3052
|
+
*/
|
|
3053
|
+
addRedaction(page, x0, y0, x1, y1, fill) {
|
|
3054
|
+
try {
|
|
3055
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3056
|
+
var ptr0 = isLikeNone(fill) ? 0 : passArrayF32ToWasm0(fill, wasm.__wbindgen_export);
|
|
3057
|
+
var len0 = WASM_VECTOR_LEN;
|
|
3058
|
+
wasm.wasmpdfdocument_addRedaction(retptr, this.__wbg_ptr, page, x0, y0, x1, y1, ptr0, len0);
|
|
3059
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3060
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3061
|
+
if (r1) {
|
|
3062
|
+
throw takeObject(r0);
|
|
3063
|
+
}
|
|
3064
|
+
} finally {
|
|
3065
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
2833
3068
|
/**
|
|
2834
3069
|
* Apply all redactions in the document.
|
|
2835
3070
|
*/
|
|
@@ -2863,6 +3098,27 @@ class WasmPdfDocument {
|
|
|
2863
3098
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2864
3099
|
}
|
|
2865
3100
|
}
|
|
3101
|
+
/**
|
|
3102
|
+
* Destructively apply all queued redactions (true content removal,
|
|
3103
|
+
* ISO 32000-1:2008 §12.5.6.23). Returns a `RedactionReport` object.
|
|
3104
|
+
* @param {boolean | null} [scrub_metadata]
|
|
3105
|
+
* @returns {any}
|
|
3106
|
+
*/
|
|
3107
|
+
applyRedactionsDestructive(scrub_metadata) {
|
|
3108
|
+
try {
|
|
3109
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3110
|
+
wasm.wasmpdfdocument_applyRedactionsDestructive(retptr, this.__wbg_ptr, isLikeNone(scrub_metadata) ? 0xFFFFFF : scrub_metadata ? 1 : 0);
|
|
3111
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3112
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3113
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3114
|
+
if (r2) {
|
|
3115
|
+
throw takeObject(r1);
|
|
3116
|
+
}
|
|
3117
|
+
return takeObject(r0);
|
|
3118
|
+
} finally {
|
|
3119
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
2866
3122
|
/**
|
|
2867
3123
|
* Authenticate with a password to decrypt an encrypted PDF.
|
|
2868
3124
|
*
|
|
@@ -2967,6 +3223,26 @@ class WasmPdfDocument {
|
|
|
2967
3223
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2968
3224
|
}
|
|
2969
3225
|
}
|
|
3226
|
+
/**
|
|
3227
|
+
* The document's Document Security Store (`/DSS`) as a `Dss`, or
|
|
3228
|
+
* `undefined` if absent. Mirrors Rust `signatures::read_dss`.
|
|
3229
|
+
* @returns {Dss | undefined}
|
|
3230
|
+
*/
|
|
3231
|
+
dss() {
|
|
3232
|
+
try {
|
|
3233
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3234
|
+
wasm.wasmpdfdocument_dss(retptr, this.__wbg_ptr);
|
|
3235
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3236
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3237
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3238
|
+
if (r2) {
|
|
3239
|
+
throw takeObject(r1);
|
|
3240
|
+
}
|
|
3241
|
+
return r0 === 0 ? undefined : Dss.__wrap(r0);
|
|
3242
|
+
} finally {
|
|
3243
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
2970
3246
|
/**
|
|
2971
3247
|
* Deprecated: Use eraseFooter instead.
|
|
2972
3248
|
* @param {number} page_index
|
|
@@ -4110,6 +4386,26 @@ class WasmPdfDocument {
|
|
|
4110
4386
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4111
4387
|
}
|
|
4112
4388
|
}
|
|
4389
|
+
/**
|
|
4390
|
+
* Number of redaction regions queued for `page`.
|
|
4391
|
+
* @param {number} page
|
|
4392
|
+
* @returns {number}
|
|
4393
|
+
*/
|
|
4394
|
+
redactionCount(page) {
|
|
4395
|
+
try {
|
|
4396
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4397
|
+
wasm.wasmpdfdocument_redactionCount(retptr, this.__wbg_ptr, page);
|
|
4398
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4399
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4400
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4401
|
+
if (r2) {
|
|
4402
|
+
throw takeObject(r1);
|
|
4403
|
+
}
|
|
4404
|
+
return r0 >>> 0;
|
|
4405
|
+
} finally {
|
|
4406
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4113
4409
|
/**
|
|
4114
4410
|
* Identify and remove both headers and footers.
|
|
4115
4411
|
*
|
|
@@ -4294,6 +4590,30 @@ class WasmPdfDocument {
|
|
|
4294
4590
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4295
4591
|
}
|
|
4296
4592
|
}
|
|
4593
|
+
/**
|
|
4594
|
+
* Standalone document sanitization (#231 T10): strip `/Info`,
|
|
4595
|
+
* catalog XMP `/Metadata`, document JavaScript and embedded files
|
|
4596
|
+
* without geometric redaction. Returns a `RedactionReport` object.
|
|
4597
|
+
* @param {boolean | null} [scrub_metadata]
|
|
4598
|
+
* @param {boolean | null} [remove_javascript]
|
|
4599
|
+
* @param {boolean | null} [remove_embedded_files]
|
|
4600
|
+
* @returns {any}
|
|
4601
|
+
*/
|
|
4602
|
+
sanitizeDocument(scrub_metadata, remove_javascript, remove_embedded_files) {
|
|
4603
|
+
try {
|
|
4604
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4605
|
+
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);
|
|
4606
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4607
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4608
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4609
|
+
if (r2) {
|
|
4610
|
+
throw takeObject(r1);
|
|
4611
|
+
}
|
|
4612
|
+
return takeObject(r0);
|
|
4613
|
+
} finally {
|
|
4614
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4297
4617
|
/**
|
|
4298
4618
|
* Save all edits and return the resulting PDF as bytes.
|
|
4299
4619
|
*
|
|
@@ -5400,6 +5720,16 @@ class WasmSignature {
|
|
|
5400
5720
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5401
5721
|
}
|
|
5402
5722
|
}
|
|
5723
|
+
/**
|
|
5724
|
+
* PAdES baseline level from this signature's CMS attributes alone
|
|
5725
|
+
* (`BB` vs `BT`). `BLt` additionally needs the document `/DSS` —
|
|
5726
|
+
* read it via `WasmPdfDocument.dss()` and re-classify there.
|
|
5727
|
+
* @returns {PadesLevel}
|
|
5728
|
+
*/
|
|
5729
|
+
get padesLevel() {
|
|
5730
|
+
const ret = wasm.wasmsignature_padesLevel(this.__wbg_ptr);
|
|
5731
|
+
return ret;
|
|
5732
|
+
}
|
|
5403
5733
|
/**
|
|
5404
5734
|
* `/Reason` entry from the signature dictionary, if present.
|
|
5405
5735
|
* @returns {string | undefined}
|
|
@@ -5688,6 +6018,73 @@ class WasmTimestamp {
|
|
|
5688
6018
|
if (Symbol.dispose) WasmTimestamp.prototype[Symbol.dispose] = WasmTimestamp.prototype.free;
|
|
5689
6019
|
exports.WasmTimestamp = WasmTimestamp;
|
|
5690
6020
|
|
|
6021
|
+
/**
|
|
6022
|
+
* A CycloneDX 1.6 Cryptographic Bill of Materials (JSON string) of the
|
|
6023
|
+
* algorithms exercised so far this process (#230 Phase F).
|
|
6024
|
+
* @returns {string}
|
|
6025
|
+
*/
|
|
6026
|
+
function cryptoCbom() {
|
|
6027
|
+
let deferred1_0;
|
|
6028
|
+
let deferred1_1;
|
|
6029
|
+
try {
|
|
6030
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6031
|
+
wasm.cryptoCbom(retptr);
|
|
6032
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6033
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6034
|
+
deferred1_0 = r0;
|
|
6035
|
+
deferred1_1 = r1;
|
|
6036
|
+
return getStringFromWasm0(r0, r1);
|
|
6037
|
+
} finally {
|
|
6038
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6039
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
6040
|
+
}
|
|
6041
|
+
}
|
|
6042
|
+
exports.cryptoCbom = cryptoCbom;
|
|
6043
|
+
|
|
6044
|
+
/**
|
|
6045
|
+
* The cryptographic algorithm tokens exercised so far this process
|
|
6046
|
+
* (governance report), as a JSON string array.
|
|
6047
|
+
* @returns {any}
|
|
6048
|
+
*/
|
|
6049
|
+
function cryptoInventory() {
|
|
6050
|
+
try {
|
|
6051
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6052
|
+
wasm.cryptoInventory(retptr);
|
|
6053
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6054
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6055
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6056
|
+
if (r2) {
|
|
6057
|
+
throw takeObject(r1);
|
|
6058
|
+
}
|
|
6059
|
+
return takeObject(r0);
|
|
6060
|
+
} finally {
|
|
6061
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6064
|
+
exports.cryptoInventory = cryptoInventory;
|
|
6065
|
+
|
|
6066
|
+
/**
|
|
6067
|
+
* The active crypto policy as its canonical grammar string.
|
|
6068
|
+
* @returns {string}
|
|
6069
|
+
*/
|
|
6070
|
+
function cryptoPolicy() {
|
|
6071
|
+
let deferred1_0;
|
|
6072
|
+
let deferred1_1;
|
|
6073
|
+
try {
|
|
6074
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6075
|
+
wasm.cryptoPolicy(retptr);
|
|
6076
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6077
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6078
|
+
deferred1_0 = r0;
|
|
6079
|
+
deferred1_1 = r1;
|
|
6080
|
+
return getStringFromWasm0(r0, r1);
|
|
6081
|
+
} finally {
|
|
6082
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6083
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
6084
|
+
}
|
|
6085
|
+
}
|
|
6086
|
+
exports.cryptoPolicy = cryptoPolicy;
|
|
6087
|
+
|
|
5691
6088
|
/**
|
|
5692
6089
|
* Disable all pdf_oxide log output — convenience wrapper for
|
|
5693
6090
|
* `setLogLevel("off")`.
|
|
@@ -5770,6 +6167,78 @@ function generateQrSvg(data, error_correction, size) {
|
|
|
5770
6167
|
}
|
|
5771
6168
|
exports.generateQrSvg = generateQrSvg;
|
|
5772
6169
|
|
|
6170
|
+
/**
|
|
6171
|
+
* Whether `pdf_data` carries a document-scoped RFC 3161
|
|
6172
|
+
* `/DocTimeStamp` archival timestamp (PAdES-B-LTA). This is the
|
|
6173
|
+
* document-level reader signal; a `WasmSignature`'s `padesLevel`
|
|
6174
|
+
* getter is signature-scoped and tops out at B-LT by design.
|
|
6175
|
+
* @param {Uint8Array} pdf_data
|
|
6176
|
+
* @returns {boolean}
|
|
6177
|
+
*/
|
|
6178
|
+
function hasDocumentTimestamp(pdf_data) {
|
|
6179
|
+
const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
|
|
6180
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6181
|
+
const ret = wasm.hasDocumentTimestamp(ptr0, len0);
|
|
6182
|
+
return ret !== 0;
|
|
6183
|
+
}
|
|
6184
|
+
exports.hasDocumentTimestamp = hasDocumentTimestamp;
|
|
6185
|
+
|
|
6186
|
+
/**
|
|
6187
|
+
* Plan a bookmark split without producing PDFs. Returns a JSON array
|
|
6188
|
+
* of segment objects (`index, startPage…` shape from
|
|
6189
|
+
* `BookmarkSegment`). `level`: 0 = all depths, 1 = top-level.
|
|
6190
|
+
* @param {Uint8Array} src_bytes
|
|
6191
|
+
* @param {string | null | undefined} title_prefix
|
|
6192
|
+
* @param {boolean} ignore_case
|
|
6193
|
+
* @param {number} level
|
|
6194
|
+
* @param {boolean} include_front_matter
|
|
6195
|
+
* @returns {any}
|
|
6196
|
+
*/
|
|
6197
|
+
function planSplitByBookmarks(src_bytes, title_prefix, ignore_case, level, include_front_matter) {
|
|
6198
|
+
try {
|
|
6199
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6200
|
+
const ptr0 = passArray8ToWasm0(src_bytes, wasm.__wbindgen_export);
|
|
6201
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6202
|
+
var ptr1 = isLikeNone(title_prefix) ? 0 : passStringToWasm0(title_prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6203
|
+
var len1 = WASM_VECTOR_LEN;
|
|
6204
|
+
wasm.planSplitByBookmarks(retptr, ptr0, len0, ptr1, len1, ignore_case, level, include_front_matter);
|
|
6205
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6206
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6207
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6208
|
+
if (r2) {
|
|
6209
|
+
throw takeObject(r1);
|
|
6210
|
+
}
|
|
6211
|
+
return takeObject(r0);
|
|
6212
|
+
} finally {
|
|
6213
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
exports.planSplitByBookmarks = planSplitByBookmarks;
|
|
6217
|
+
|
|
6218
|
+
/**
|
|
6219
|
+
* Install the process-wide runtime crypto policy from its grammar
|
|
6220
|
+
* string (`"compat"|"strict"|"fips-strict"[;…]`). Fail-closed:
|
|
6221
|
+
* throws on an unparseable spec (policy NOT installed) or if a
|
|
6222
|
+
* policy is already set. Default (never set) is `compat`.
|
|
6223
|
+
* @param {string} spec
|
|
6224
|
+
*/
|
|
6225
|
+
function setCryptoPolicy(spec) {
|
|
6226
|
+
try {
|
|
6227
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6228
|
+
const ptr0 = passStringToWasm0(spec, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6230
|
+
wasm.setCryptoPolicy(retptr, ptr0, len0);
|
|
6231
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6232
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6233
|
+
if (r1) {
|
|
6234
|
+
throw takeObject(r0);
|
|
6235
|
+
}
|
|
6236
|
+
} finally {
|
|
6237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6238
|
+
}
|
|
6239
|
+
}
|
|
6240
|
+
exports.setCryptoPolicy = setCryptoPolicy;
|
|
6241
|
+
|
|
5773
6242
|
/**
|
|
5774
6243
|
* Set the maximum log level for pdf_oxide messages.
|
|
5775
6244
|
*
|
|
@@ -5842,6 +6311,90 @@ function signPdfBytes(pdf_data, cert, reason, location) {
|
|
|
5842
6311
|
}
|
|
5843
6312
|
}
|
|
5844
6313
|
exports.signPdfBytes = signPdfBytes;
|
|
6314
|
+
|
|
6315
|
+
/**
|
|
6316
|
+
* Sign raw PDF bytes at a PAdES baseline level and return the signed
|
|
6317
|
+
* PDF as a `Uint8Array`.
|
|
6318
|
+
*
|
|
6319
|
+
* `level` `BLTA` is reserved (→ error). For `BT`/`BLt` pass a
|
|
6320
|
+
* pre-fetched RFC 3161 `timestampToken` (DER): WASM intentionally
|
|
6321
|
+
* omits the online TSA client (same `ureq`-incompat carve-out as
|
|
6322
|
+
* v0.3.38) — without a token the core fail-closes with `Unsupported`.
|
|
6323
|
+
* `revocation` supplies the B-LT DSS material.
|
|
6324
|
+
* @param {Uint8Array} pdf_data
|
|
6325
|
+
* @param {WasmCertificate} cert
|
|
6326
|
+
* @param {PadesLevel} level
|
|
6327
|
+
* @param {Uint8Array | null} [timestamp_token]
|
|
6328
|
+
* @param {RevocationMaterial | null} [revocation]
|
|
6329
|
+
* @param {string | null} [reason]
|
|
6330
|
+
* @param {string | null} [location]
|
|
6331
|
+
* @returns {Uint8Array}
|
|
6332
|
+
*/
|
|
6333
|
+
function signPdfBytesPades(pdf_data, cert, level, timestamp_token, revocation, reason, location) {
|
|
6334
|
+
try {
|
|
6335
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6336
|
+
const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
|
|
6337
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6338
|
+
_assertClass(cert, WasmCertificate);
|
|
6339
|
+
var ptr1 = isLikeNone(timestamp_token) ? 0 : passArray8ToWasm0(timestamp_token, wasm.__wbindgen_export);
|
|
6340
|
+
var len1 = WASM_VECTOR_LEN;
|
|
6341
|
+
let ptr2 = 0;
|
|
6342
|
+
if (!isLikeNone(revocation)) {
|
|
6343
|
+
_assertClass(revocation, RevocationMaterial);
|
|
6344
|
+
ptr2 = revocation.__destroy_into_raw();
|
|
6345
|
+
}
|
|
6346
|
+
var ptr3 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6347
|
+
var len3 = WASM_VECTOR_LEN;
|
|
6348
|
+
var ptr4 = isLikeNone(location) ? 0 : passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6349
|
+
var len4 = WASM_VECTOR_LEN;
|
|
6350
|
+
wasm.signPdfBytesPades(retptr, ptr0, len0, cert.__wbg_ptr, level, ptr1, len1, ptr2, ptr3, len3, ptr4, len4);
|
|
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
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6355
|
+
if (r3) {
|
|
6356
|
+
throw takeObject(r2);
|
|
6357
|
+
}
|
|
6358
|
+
var v6 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6359
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6360
|
+
return v6;
|
|
6361
|
+
} finally {
|
|
6362
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
exports.signPdfBytesPades = signPdfBytesPades;
|
|
6366
|
+
|
|
6367
|
+
/**
|
|
6368
|
+
* Split at bookmark boundaries. Returns a JSON array of
|
|
6369
|
+
* `[segment, bytes]` pairs (bytes as a number array; source
|
|
6370
|
+
* unmodified).
|
|
6371
|
+
* @param {Uint8Array} src_bytes
|
|
6372
|
+
* @param {string | null | undefined} title_prefix
|
|
6373
|
+
* @param {boolean} ignore_case
|
|
6374
|
+
* @param {number} level
|
|
6375
|
+
* @param {boolean} include_front_matter
|
|
6376
|
+
* @returns {any}
|
|
6377
|
+
*/
|
|
6378
|
+
function splitByBookmarks(src_bytes, title_prefix, ignore_case, level, include_front_matter) {
|
|
6379
|
+
try {
|
|
6380
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6381
|
+
const ptr0 = passArray8ToWasm0(src_bytes, wasm.__wbindgen_export);
|
|
6382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6383
|
+
var ptr1 = isLikeNone(title_prefix) ? 0 : passStringToWasm0(title_prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6384
|
+
var len1 = WASM_VECTOR_LEN;
|
|
6385
|
+
wasm.splitByBookmarks(retptr, ptr0, len0, ptr1, len1, ignore_case, level, include_front_matter);
|
|
6386
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6387
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6388
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6389
|
+
if (r2) {
|
|
6390
|
+
throw takeObject(r1);
|
|
6391
|
+
}
|
|
6392
|
+
return takeObject(r0);
|
|
6393
|
+
} finally {
|
|
6394
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6395
|
+
}
|
|
6396
|
+
}
|
|
6397
|
+
exports.splitByBookmarks = splitByBookmarks;
|
|
5845
6398
|
function __wbg_get_imports() {
|
|
5846
6399
|
const import0 = {
|
|
5847
6400
|
__proto__: null,
|
|
@@ -6166,6 +6719,9 @@ const WasmCertificateFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
6166
6719
|
const WasmDocumentBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6167
6720
|
? { register: () => {}, unregister: () => {} }
|
|
6168
6721
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdocumentbuilder_free(ptr, 1));
|
|
6722
|
+
const DssFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6723
|
+
? { register: () => {}, unregister: () => {} }
|
|
6724
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_dss_free(ptr, 1));
|
|
6169
6725
|
const WasmEmbeddedFontFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6170
6726
|
? { register: () => {}, unregister: () => {} }
|
|
6171
6727
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmembeddedfont_free(ptr, 1));
|
|
@@ -6196,6 +6752,9 @@ const WasmPdfDocumentFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
6196
6752
|
const WasmPdfPageRegionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6197
6753
|
? { register: () => {}, unregister: () => {} }
|
|
6198
6754
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpdfpageregion_free(ptr, 1));
|
|
6755
|
+
const RevocationMaterialFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6756
|
+
? { register: () => {}, unregister: () => {} }
|
|
6757
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_revocationmaterial_free(ptr, 1));
|
|
6199
6758
|
const WasmSignatureFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6200
6759
|
? { register: () => {}, unregister: () => {} }
|
|
6201
6760
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsignature_free(ptr, 1));
|
package/nodejs/pdf_oxide_bg.wasm
CHANGED
|
Binary file
|