@file-viewer/renderer-signature 3.0.0
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/LICENSE +160 -0
- package/README.en.md +87 -0
- package/README.md +89 -0
- package/THIRD_PARTY_LICENSES.json +3867 -0
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/dist/container.worker.d.ts +1 -0
- package/dist/container.worker.js +39 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +53 -0
- package/dist/inspect.d.ts +7 -0
- package/dist/inspect.js +4 -0
- package/dist/openpgp/client.d.ts +16 -0
- package/dist/openpgp/client.js +148 -0
- package/dist/openpgp/formatDetection.d.ts +3 -0
- package/dist/openpgp/formatDetection.js +45 -0
- package/dist/openpgp/types.d.ts +72 -0
- package/dist/openpgp/types.js +1 -0
- package/dist/rpgp-wasm/rpgp_wrapper.d.ts +43 -0
- package/dist/rpgp-wasm/rpgp_wrapper.js +578 -0
- package/dist/rpgp-wasm/rpgp_wrapper_bg.wasm +0 -0
- package/dist/rpgp-wasm/rpgp_wrapper_bg.wasm.d.ts +10 -0
- package/dist/signature.d.ts +24 -0
- package/dist/signature.js +1040 -0
- package/dist/signature.worker.d.ts +1 -0
- package/dist/signature.worker.js +108 -0
- package/dist/signatureAsn1.d.ts +150 -0
- package/dist/signatureAsn1.js +1486 -0
- package/dist/structured/asic.d.ts +3 -0
- package/dist/structured/asic.js +188 -0
- package/dist/structured/containerClient.d.ts +12 -0
- package/dist/structured/containerClient.js +71 -0
- package/dist/structured/containerProtocol.d.ts +20 -0
- package/dist/structured/containerProtocol.js +1 -0
- package/dist/structured/jws.d.ts +3 -0
- package/dist/structured/jws.js +382 -0
- package/dist/structured/limits.d.ts +20 -0
- package/dist/structured/limits.js +41 -0
- package/dist/structured/types.d.ts +53 -0
- package/dist/structured/types.js +1 -0
- package/dist/structured/zipPreflight.d.ts +14 -0
- package/dist/structured/zipPreflight.js +173 -0
- package/dist/workerProtocol.d.ts +40 -0
- package/dist/workerProtocol.js +1 -0
- package/file-viewer.capability.json +56 -0
- package/package.json +106 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
/* @ts-self-types="./rpgp_wrapper.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {Uint8Array} input
|
|
5
|
+
* @param {any} limits
|
|
6
|
+
* @returns {any}
|
|
7
|
+
*/
|
|
8
|
+
export function classify_openpgp(input, limits) {
|
|
9
|
+
try {
|
|
10
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
11
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
12
|
+
const len0 = WASM_VECTOR_LEN;
|
|
13
|
+
wasm.classify_openpgp(retptr, ptr0, len0, addHeapObject(limits));
|
|
14
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
15
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
16
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
17
|
+
if (r2) {
|
|
18
|
+
throw takeObject(r1);
|
|
19
|
+
}
|
|
20
|
+
return takeObject(r0);
|
|
21
|
+
} finally {
|
|
22
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {Uint8Array} input
|
|
28
|
+
* @param {any} public_keys
|
|
29
|
+
* @param {any} limits
|
|
30
|
+
* @returns {any}
|
|
31
|
+
*/
|
|
32
|
+
export function inspect_openpgp(input, public_keys, limits) {
|
|
33
|
+
try {
|
|
34
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
35
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
36
|
+
const len0 = WASM_VECTOR_LEN;
|
|
37
|
+
wasm.inspect_openpgp(retptr, ptr0, len0, addHeapObject(public_keys), addHeapObject(limits));
|
|
38
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
39
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
40
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
41
|
+
if (r2) {
|
|
42
|
+
throw takeObject(r1);
|
|
43
|
+
}
|
|
44
|
+
return takeObject(r0);
|
|
45
|
+
} finally {
|
|
46
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {Uint8Array} content
|
|
52
|
+
* @param {Uint8Array} signature
|
|
53
|
+
* @param {any} public_keys
|
|
54
|
+
* @param {any} limits
|
|
55
|
+
* @returns {any}
|
|
56
|
+
*/
|
|
57
|
+
export function verify_detached_signature(content, signature, public_keys, limits) {
|
|
58
|
+
try {
|
|
59
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
60
|
+
const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
|
|
61
|
+
const len0 = WASM_VECTOR_LEN;
|
|
62
|
+
const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_export);
|
|
63
|
+
const len1 = WASM_VECTOR_LEN;
|
|
64
|
+
wasm.verify_detached_signature(retptr, ptr0, len0, ptr1, len1, addHeapObject(public_keys), addHeapObject(limits));
|
|
65
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
66
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
67
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
68
|
+
if (r2) {
|
|
69
|
+
throw takeObject(r1);
|
|
70
|
+
}
|
|
71
|
+
return takeObject(r0);
|
|
72
|
+
} finally {
|
|
73
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function __wbg_get_imports() {
|
|
77
|
+
const import0 = {
|
|
78
|
+
__proto__: null,
|
|
79
|
+
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
80
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
81
|
+
return addHeapObject(ret);
|
|
82
|
+
},
|
|
83
|
+
__wbg_Number_3890faa6d3ff057d: function(arg0) {
|
|
84
|
+
const ret = Number(getObject(arg0));
|
|
85
|
+
return ret;
|
|
86
|
+
},
|
|
87
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
88
|
+
const ret = String(getObject(arg1));
|
|
89
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
90
|
+
const len1 = WASM_VECTOR_LEN;
|
|
91
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
92
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
93
|
+
},
|
|
94
|
+
__wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
|
|
95
|
+
const v = getObject(arg1);
|
|
96
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
97
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
98
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
99
|
+
},
|
|
100
|
+
__wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
|
|
101
|
+
const v = getObject(arg0);
|
|
102
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
103
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
104
|
+
},
|
|
105
|
+
__wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
|
|
106
|
+
const ret = debugString(getObject(arg1));
|
|
107
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
108
|
+
const len1 = WASM_VECTOR_LEN;
|
|
109
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
110
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
111
|
+
},
|
|
112
|
+
__wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
|
|
113
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
114
|
+
return ret;
|
|
115
|
+
},
|
|
116
|
+
__wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
|
|
117
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
118
|
+
return ret;
|
|
119
|
+
},
|
|
120
|
+
__wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
|
|
121
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
122
|
+
return ret;
|
|
123
|
+
},
|
|
124
|
+
__wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
|
|
125
|
+
const val = getObject(arg0);
|
|
126
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
127
|
+
return ret;
|
|
128
|
+
},
|
|
129
|
+
__wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
|
|
130
|
+
const ret = getObject(arg0) === undefined;
|
|
131
|
+
return ret;
|
|
132
|
+
},
|
|
133
|
+
__wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
|
|
134
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
|
|
138
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
139
|
+
return ret;
|
|
140
|
+
},
|
|
141
|
+
__wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
|
|
142
|
+
const obj = getObject(arg1);
|
|
143
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
144
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
145
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
146
|
+
},
|
|
147
|
+
__wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
|
|
148
|
+
const obj = getObject(arg1);
|
|
149
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
150
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
151
|
+
var len1 = WASM_VECTOR_LEN;
|
|
152
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
153
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
154
|
+
},
|
|
155
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
156
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
157
|
+
},
|
|
158
|
+
__wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
|
|
159
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
160
|
+
return addHeapObject(ret);
|
|
161
|
+
}, arguments); },
|
|
162
|
+
__wbg_done_669171204c3dcae2: function(arg0) {
|
|
163
|
+
const ret = getObject(arg0).done;
|
|
164
|
+
return ret;
|
|
165
|
+
},
|
|
166
|
+
__wbg_get_d173c0308df22d37: function() { return handleError(function (arg0, arg1) {
|
|
167
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
168
|
+
return addHeapObject(ret);
|
|
169
|
+
}, arguments); },
|
|
170
|
+
__wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
|
|
171
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
172
|
+
return addHeapObject(ret);
|
|
173
|
+
},
|
|
174
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
175
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
176
|
+
return addHeapObject(ret);
|
|
177
|
+
},
|
|
178
|
+
__wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
|
|
179
|
+
let result;
|
|
180
|
+
try {
|
|
181
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
182
|
+
} catch (_) {
|
|
183
|
+
result = false;
|
|
184
|
+
}
|
|
185
|
+
const ret = result;
|
|
186
|
+
return ret;
|
|
187
|
+
},
|
|
188
|
+
__wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
|
|
189
|
+
let result;
|
|
190
|
+
try {
|
|
191
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
192
|
+
} catch (_) {
|
|
193
|
+
result = false;
|
|
194
|
+
}
|
|
195
|
+
const ret = result;
|
|
196
|
+
return ret;
|
|
197
|
+
},
|
|
198
|
+
__wbg_isArray_6339f732981044bf: function(arg0) {
|
|
199
|
+
const ret = Array.isArray(getObject(arg0));
|
|
200
|
+
return ret;
|
|
201
|
+
},
|
|
202
|
+
__wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
|
|
203
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
204
|
+
return ret;
|
|
205
|
+
},
|
|
206
|
+
__wbg_iterator_5cebbb86e33c6dd6: function() {
|
|
207
|
+
const ret = Symbol.iterator;
|
|
208
|
+
return addHeapObject(ret);
|
|
209
|
+
},
|
|
210
|
+
__wbg_length_36bd29c6848c2144: function(arg0) {
|
|
211
|
+
const ret = getObject(arg0).length;
|
|
212
|
+
return ret;
|
|
213
|
+
},
|
|
214
|
+
__wbg_length_ecfa2c63d3d0d82c: function(arg0) {
|
|
215
|
+
const ret = getObject(arg0).length;
|
|
216
|
+
return ret;
|
|
217
|
+
},
|
|
218
|
+
__wbg_new_116be93542d39019: function() {
|
|
219
|
+
const ret = new Array();
|
|
220
|
+
return addHeapObject(ret);
|
|
221
|
+
},
|
|
222
|
+
__wbg_new_77cc4f4f472aeb81: function(arg0) {
|
|
223
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
224
|
+
return addHeapObject(ret);
|
|
225
|
+
},
|
|
226
|
+
__wbg_new_ebe3e0f6837f0879: function() {
|
|
227
|
+
const ret = new Object();
|
|
228
|
+
return addHeapObject(ret);
|
|
229
|
+
},
|
|
230
|
+
__wbg_next_42cf16ee0dafc9e2: function() { return handleError(function (arg0) {
|
|
231
|
+
const ret = getObject(arg0).next();
|
|
232
|
+
return addHeapObject(ret);
|
|
233
|
+
}, arguments); },
|
|
234
|
+
__wbg_next_8f26b64fa5e9f64b: function(arg0) {
|
|
235
|
+
const ret = getObject(arg0).next;
|
|
236
|
+
return addHeapObject(ret);
|
|
237
|
+
},
|
|
238
|
+
__wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
|
|
239
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
240
|
+
},
|
|
241
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
242
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
243
|
+
},
|
|
244
|
+
__wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
|
|
245
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
246
|
+
},
|
|
247
|
+
__wbg_value_1e2369fab29b420e: function(arg0) {
|
|
248
|
+
const ret = getObject(arg0).value;
|
|
249
|
+
return addHeapObject(ret);
|
|
250
|
+
},
|
|
251
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
252
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
253
|
+
const ret = arg0;
|
|
254
|
+
return addHeapObject(ret);
|
|
255
|
+
},
|
|
256
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
257
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
258
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
259
|
+
return addHeapObject(ret);
|
|
260
|
+
},
|
|
261
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
262
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
263
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
264
|
+
return addHeapObject(ret);
|
|
265
|
+
},
|
|
266
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
267
|
+
const ret = getObject(arg0);
|
|
268
|
+
return addHeapObject(ret);
|
|
269
|
+
},
|
|
270
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
271
|
+
takeObject(arg0);
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
return {
|
|
275
|
+
__proto__: null,
|
|
276
|
+
"./rpgp_wrapper_bg.js": import0,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function addHeapObject(obj) {
|
|
281
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
282
|
+
const idx = heap_next;
|
|
283
|
+
heap_next = heap[idx];
|
|
284
|
+
|
|
285
|
+
heap[idx] = obj;
|
|
286
|
+
return idx;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function debugString(val) {
|
|
290
|
+
// primitive types
|
|
291
|
+
const type = typeof val;
|
|
292
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
293
|
+
return `${val}`;
|
|
294
|
+
}
|
|
295
|
+
if (type == 'string') {
|
|
296
|
+
return `"${val}"`;
|
|
297
|
+
}
|
|
298
|
+
if (type == 'symbol') {
|
|
299
|
+
const description = val.description;
|
|
300
|
+
if (description == null) {
|
|
301
|
+
return 'Symbol';
|
|
302
|
+
} else {
|
|
303
|
+
return `Symbol(${description})`;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (type == 'function') {
|
|
307
|
+
const name = val.name;
|
|
308
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
309
|
+
return `Function(${name})`;
|
|
310
|
+
} else {
|
|
311
|
+
return 'Function';
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// objects
|
|
315
|
+
if (Array.isArray(val)) {
|
|
316
|
+
const length = val.length;
|
|
317
|
+
let debug = '[';
|
|
318
|
+
if (length > 0) {
|
|
319
|
+
debug += debugString(val[0]);
|
|
320
|
+
}
|
|
321
|
+
for(let i = 1; i < length; i++) {
|
|
322
|
+
debug += ', ' + debugString(val[i]);
|
|
323
|
+
}
|
|
324
|
+
debug += ']';
|
|
325
|
+
return debug;
|
|
326
|
+
}
|
|
327
|
+
// Test for built-in
|
|
328
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
329
|
+
let className;
|
|
330
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
331
|
+
className = builtInMatches[1];
|
|
332
|
+
} else {
|
|
333
|
+
// Failed to match the standard '[object ClassName]'
|
|
334
|
+
return toString.call(val);
|
|
335
|
+
}
|
|
336
|
+
if (className == 'Object') {
|
|
337
|
+
// we're a user defined class or Object
|
|
338
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
339
|
+
// easier than looping through ownProperties of `val`.
|
|
340
|
+
try {
|
|
341
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
342
|
+
} catch (_) {
|
|
343
|
+
return 'Object';
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// errors
|
|
347
|
+
if (val instanceof Error) {
|
|
348
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
349
|
+
}
|
|
350
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
351
|
+
return className;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function dropObject(idx) {
|
|
355
|
+
if (idx < 1028) return;
|
|
356
|
+
heap[idx] = heap_next;
|
|
357
|
+
heap_next = idx;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
361
|
+
ptr = ptr >>> 0;
|
|
362
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
let cachedDataViewMemory0 = null;
|
|
366
|
+
function getDataViewMemory0() {
|
|
367
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
368
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
369
|
+
}
|
|
370
|
+
return cachedDataViewMemory0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function getStringFromWasm0(ptr, len) {
|
|
374
|
+
return decodeText(ptr >>> 0, len);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
let cachedUint8ArrayMemory0 = null;
|
|
378
|
+
function getUint8ArrayMemory0() {
|
|
379
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
380
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
381
|
+
}
|
|
382
|
+
return cachedUint8ArrayMemory0;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function getObject(idx) { return heap[idx]; }
|
|
386
|
+
|
|
387
|
+
function handleError(f, args) {
|
|
388
|
+
try {
|
|
389
|
+
return f.apply(this, args);
|
|
390
|
+
} catch (e) {
|
|
391
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
let heap = new Array(1024).fill(undefined);
|
|
396
|
+
heap.push(undefined, null, true, false);
|
|
397
|
+
|
|
398
|
+
let heap_next = heap.length;
|
|
399
|
+
|
|
400
|
+
function isLikeNone(x) {
|
|
401
|
+
return x === undefined || x === null;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
405
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
406
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
407
|
+
WASM_VECTOR_LEN = arg.length;
|
|
408
|
+
return ptr;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
412
|
+
if (realloc === undefined) {
|
|
413
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
414
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
415
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
416
|
+
WASM_VECTOR_LEN = buf.length;
|
|
417
|
+
return ptr;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
let len = arg.length;
|
|
421
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
422
|
+
|
|
423
|
+
const mem = getUint8ArrayMemory0();
|
|
424
|
+
|
|
425
|
+
let offset = 0;
|
|
426
|
+
|
|
427
|
+
for (; offset < len; offset++) {
|
|
428
|
+
const code = arg.charCodeAt(offset);
|
|
429
|
+
if (code > 0x7F) break;
|
|
430
|
+
mem[ptr + offset] = code;
|
|
431
|
+
}
|
|
432
|
+
if (offset !== len) {
|
|
433
|
+
if (offset !== 0) {
|
|
434
|
+
arg = arg.slice(offset);
|
|
435
|
+
}
|
|
436
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
437
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
438
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
439
|
+
|
|
440
|
+
offset += ret.written;
|
|
441
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
WASM_VECTOR_LEN = offset;
|
|
445
|
+
return ptr;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function takeObject(idx) {
|
|
449
|
+
const ret = getObject(idx);
|
|
450
|
+
dropObject(idx);
|
|
451
|
+
return ret;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
455
|
+
cachedTextDecoder.decode();
|
|
456
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
457
|
+
let numBytesDecoded = 0;
|
|
458
|
+
function decodeText(ptr, len) {
|
|
459
|
+
numBytesDecoded += len;
|
|
460
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
461
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
462
|
+
cachedTextDecoder.decode();
|
|
463
|
+
numBytesDecoded = len;
|
|
464
|
+
}
|
|
465
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
const cachedTextEncoder = new TextEncoder();
|
|
469
|
+
|
|
470
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
471
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
472
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
473
|
+
view.set(buf);
|
|
474
|
+
return {
|
|
475
|
+
read: arg.length,
|
|
476
|
+
written: buf.length
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
let WASM_VECTOR_LEN = 0;
|
|
482
|
+
|
|
483
|
+
let wasmModule, wasmInstance, wasm;
|
|
484
|
+
function __wbg_finalize_init(instance, module) {
|
|
485
|
+
wasmInstance = instance;
|
|
486
|
+
wasm = instance.exports;
|
|
487
|
+
wasmModule = module;
|
|
488
|
+
cachedDataViewMemory0 = null;
|
|
489
|
+
cachedUint8ArrayMemory0 = null;
|
|
490
|
+
return wasm;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
async function __wbg_load(module, imports) {
|
|
494
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
495
|
+
if (!module.ok) {
|
|
496
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
500
|
+
try {
|
|
501
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
502
|
+
} catch (e) {
|
|
503
|
+
const validResponse = expectedResponseType(module.type);
|
|
504
|
+
|
|
505
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
506
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
507
|
+
|
|
508
|
+
} else { throw e; }
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
const bytes = await module.arrayBuffer();
|
|
513
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
514
|
+
} else {
|
|
515
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
516
|
+
|
|
517
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
518
|
+
return { instance, module };
|
|
519
|
+
} else {
|
|
520
|
+
return instance;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function expectedResponseType(type) {
|
|
525
|
+
switch (type) {
|
|
526
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
527
|
+
}
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function initSync(module) {
|
|
533
|
+
if (wasm !== undefined) return wasm;
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
if (module !== undefined) {
|
|
537
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
538
|
+
({module} = module)
|
|
539
|
+
} else {
|
|
540
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
const imports = __wbg_get_imports();
|
|
545
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
546
|
+
module = new WebAssembly.Module(module);
|
|
547
|
+
}
|
|
548
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
549
|
+
return __wbg_finalize_init(instance, module);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
async function __wbg_init(module_or_path) {
|
|
553
|
+
if (wasm !== undefined) return wasm;
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
if (module_or_path !== undefined) {
|
|
557
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
558
|
+
({module_or_path} = module_or_path)
|
|
559
|
+
} else {
|
|
560
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (module_or_path === undefined) {
|
|
565
|
+
module_or_path = new URL('rpgp_wrapper_bg.wasm', import.meta.url);
|
|
566
|
+
}
|
|
567
|
+
const imports = __wbg_get_imports();
|
|
568
|
+
|
|
569
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
570
|
+
module_or_path = fetch(module_or_path);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
574
|
+
|
|
575
|
+
return __wbg_finalize_init(instance, module);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const classify_openpgp: (a: number, b: number, c: number, d: number) => void;
|
|
5
|
+
export const inspect_openpgp: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
|
+
export const verify_detached_signature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
7
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
8
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
10
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type FileRenderContext, type FileViewerRenderedInstance } from '@file-viewer/core';
|
|
2
|
+
import type { SignatureParseLimits } from './openpgp/types.js';
|
|
3
|
+
import { type SignatureContainerLimits } from './structured/limits.js';
|
|
4
|
+
import type { JwsVerificationKey } from './structured/types.js';
|
|
5
|
+
export interface FileViewerSignatureOptions {
|
|
6
|
+
/** Original content used for detached CMS signatures and RFC 3161 imprint comparison. */
|
|
7
|
+
originalContent?: ArrayBuffer | Blob;
|
|
8
|
+
originalFilename?: string;
|
|
9
|
+
/** Maximum cryptographic container size parsed in memory. Defaults to 64 MiB. */
|
|
10
|
+
maxContainerSize?: number;
|
|
11
|
+
/** Maximum extracted or supplied original size sent to a nested renderer. Defaults to 32 MiB. */
|
|
12
|
+
maxNestedPreviewSize?: number;
|
|
13
|
+
/** Public keys for detached, cleartext, and unencrypted embedded OpenPGP verification. Secret keys are not accepted. */
|
|
14
|
+
openPgpPublicKeys?: Array<ArrayBuffer | Blob>;
|
|
15
|
+
/** Conservative parser/resource limits forwarded to the rPGP WebAssembly wrapper. */
|
|
16
|
+
openPgpLimits?: Partial<SignatureParseLimits>;
|
|
17
|
+
/** Bounded ASiC/JWS resource limits. Absolute hostile-input ceilings cannot be disabled. */
|
|
18
|
+
containerLimits?: Partial<SignatureContainerLimits>;
|
|
19
|
+
/** Host-provided public verification keys for JWS. Private and symmetric JWKs are rejected. */
|
|
20
|
+
jwsVerificationKeys?: JwsVerificationKey[];
|
|
21
|
+
/** Trusted-Types/CSP-aware Worker factory for the optional parser Workers. */
|
|
22
|
+
workerFactory?: (kind: 'openpgp' | 'container') => Worker;
|
|
23
|
+
}
|
|
24
|
+
export default function renderSignature(buffer: ArrayBuffer, target: HTMLDivElement, type?: string, context?: FileRenderContext): Promise<FileViewerRenderedInstance>;
|