@oxhq/oxpki-wasm 0.1.0-alpha

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.
@@ -0,0 +1,56 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class CertificateInfo {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ readonly algorithm: string;
9
+ readonly fingerprint: string;
10
+ readonly issuer: string;
11
+ readonly rfc: string;
12
+ readonly serial: string;
13
+ readonly subject: string;
14
+ readonly validFrom: string;
15
+ readonly validTo: string;
16
+ }
17
+
18
+ export class CsdOutput {
19
+ private constructor();
20
+ free(): void;
21
+ [Symbol.dispose](): void;
22
+ readonly encryptedKeyDer: Uint8Array;
23
+ readonly folder: string;
24
+ readonly keyName: string;
25
+ readonly requestEntry: string;
26
+ readonly sdgDer: Uint8Array;
27
+ readonly sdgName: string;
28
+ }
29
+
30
+ export class PairValidation {
31
+ private constructor();
32
+ free(): void;
33
+ [Symbol.dispose](): void;
34
+ readonly certificate: CertificateInfo;
35
+ readonly keyModulusSha256: string;
36
+ readonly matches: boolean;
37
+ }
38
+
39
+ export class RenewFielOutput {
40
+ private constructor();
41
+ free(): void;
42
+ [Symbol.dispose](): void;
43
+ readonly encryptedKeyDer: Uint8Array;
44
+ readonly folder: string;
45
+ readonly keyName: string;
46
+ readonly renewalDer: Uint8Array;
47
+ readonly renewalName: string;
48
+ }
49
+
50
+ export function generateCsd(rfc: string, serial_number: string, legal_name: string, unit: string, new_password: string, signer_certificate_der: Uint8Array, signer_encrypted_key_der: Uint8Array, signer_password: string, date: string, time: string, challenge: string): CsdOutput;
51
+
52
+ export function inspectCertificate(certificate_der: Uint8Array): CertificateInfo;
53
+
54
+ export function pairCheck(certificate_der: Uint8Array, encrypted_key_der: Uint8Array, password: string): PairValidation;
55
+
56
+ export function renewFiel(rfc: string, serial_number: string, email: string, new_password: string, signer_certificate_der: Uint8Array, signer_encrypted_key_der: Uint8Array, signer_password: string, date: string, time: string, challenge: string): RenewFielOutput;
package/oxpki_wasm.js ADDED
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./oxpki_wasm.d.ts" */
2
+ import * as wasm from "./oxpki_wasm_bg.wasm";
3
+ import { __wbg_set_wasm } from "./oxpki_wasm_bg.js";
4
+
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ CertificateInfo, CsdOutput, PairValidation, RenewFielOutput, generateCsd, inspectCertificate, pairCheck, renewFiel
9
+ } from "./oxpki_wasm_bg.js";
@@ -0,0 +1,725 @@
1
+ export class CertificateInfo {
2
+ static __wrap(ptr) {
3
+ const obj = Object.create(CertificateInfo.prototype);
4
+ obj.__wbg_ptr = ptr;
5
+ CertificateInfoFinalization.register(obj, obj.__wbg_ptr, obj);
6
+ return obj;
7
+ }
8
+ __destroy_into_raw() {
9
+ const ptr = this.__wbg_ptr;
10
+ this.__wbg_ptr = 0;
11
+ CertificateInfoFinalization.unregister(this);
12
+ return ptr;
13
+ }
14
+ free() {
15
+ const ptr = this.__destroy_into_raw();
16
+ wasm.__wbg_certificateinfo_free(ptr, 0);
17
+ }
18
+ /**
19
+ * @returns {string}
20
+ */
21
+ get algorithm() {
22
+ let deferred1_0;
23
+ let deferred1_1;
24
+ try {
25
+ const ret = wasm.certificateinfo_algorithm(this.__wbg_ptr);
26
+ deferred1_0 = ret[0];
27
+ deferred1_1 = ret[1];
28
+ return getStringFromWasm0(ret[0], ret[1]);
29
+ } finally {
30
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
31
+ }
32
+ }
33
+ /**
34
+ * @returns {string}
35
+ */
36
+ get fingerprint() {
37
+ let deferred1_0;
38
+ let deferred1_1;
39
+ try {
40
+ const ret = wasm.certificateinfo_fingerprint(this.__wbg_ptr);
41
+ deferred1_0 = ret[0];
42
+ deferred1_1 = ret[1];
43
+ return getStringFromWasm0(ret[0], ret[1]);
44
+ } finally {
45
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
46
+ }
47
+ }
48
+ /**
49
+ * @returns {string}
50
+ */
51
+ get issuer() {
52
+ let deferred1_0;
53
+ let deferred1_1;
54
+ try {
55
+ const ret = wasm.certificateinfo_issuer(this.__wbg_ptr);
56
+ deferred1_0 = ret[0];
57
+ deferred1_1 = ret[1];
58
+ return getStringFromWasm0(ret[0], ret[1]);
59
+ } finally {
60
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
61
+ }
62
+ }
63
+ /**
64
+ * @returns {string}
65
+ */
66
+ get rfc() {
67
+ let deferred1_0;
68
+ let deferred1_1;
69
+ try {
70
+ const ret = wasm.certificateinfo_rfc(this.__wbg_ptr);
71
+ deferred1_0 = ret[0];
72
+ deferred1_1 = ret[1];
73
+ return getStringFromWasm0(ret[0], ret[1]);
74
+ } finally {
75
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
76
+ }
77
+ }
78
+ /**
79
+ * @returns {string}
80
+ */
81
+ get serial() {
82
+ let deferred1_0;
83
+ let deferred1_1;
84
+ try {
85
+ const ret = wasm.certificateinfo_serial(this.__wbg_ptr);
86
+ deferred1_0 = ret[0];
87
+ deferred1_1 = ret[1];
88
+ return getStringFromWasm0(ret[0], ret[1]);
89
+ } finally {
90
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
91
+ }
92
+ }
93
+ /**
94
+ * @returns {string}
95
+ */
96
+ get subject() {
97
+ let deferred1_0;
98
+ let deferred1_1;
99
+ try {
100
+ const ret = wasm.certificateinfo_subject(this.__wbg_ptr);
101
+ deferred1_0 = ret[0];
102
+ deferred1_1 = ret[1];
103
+ return getStringFromWasm0(ret[0], ret[1]);
104
+ } finally {
105
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
106
+ }
107
+ }
108
+ /**
109
+ * @returns {string}
110
+ */
111
+ get validFrom() {
112
+ let deferred1_0;
113
+ let deferred1_1;
114
+ try {
115
+ const ret = wasm.certificateinfo_validFrom(this.__wbg_ptr);
116
+ deferred1_0 = ret[0];
117
+ deferred1_1 = ret[1];
118
+ return getStringFromWasm0(ret[0], ret[1]);
119
+ } finally {
120
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
121
+ }
122
+ }
123
+ /**
124
+ * @returns {string}
125
+ */
126
+ get validTo() {
127
+ let deferred1_0;
128
+ let deferred1_1;
129
+ try {
130
+ const ret = wasm.certificateinfo_validTo(this.__wbg_ptr);
131
+ deferred1_0 = ret[0];
132
+ deferred1_1 = ret[1];
133
+ return getStringFromWasm0(ret[0], ret[1]);
134
+ } finally {
135
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
136
+ }
137
+ }
138
+ }
139
+ if (Symbol.dispose) CertificateInfo.prototype[Symbol.dispose] = CertificateInfo.prototype.free;
140
+
141
+ export class CsdOutput {
142
+ static __wrap(ptr) {
143
+ const obj = Object.create(CsdOutput.prototype);
144
+ obj.__wbg_ptr = ptr;
145
+ CsdOutputFinalization.register(obj, obj.__wbg_ptr, obj);
146
+ return obj;
147
+ }
148
+ __destroy_into_raw() {
149
+ const ptr = this.__wbg_ptr;
150
+ this.__wbg_ptr = 0;
151
+ CsdOutputFinalization.unregister(this);
152
+ return ptr;
153
+ }
154
+ free() {
155
+ const ptr = this.__destroy_into_raw();
156
+ wasm.__wbg_csdoutput_free(ptr, 0);
157
+ }
158
+ /**
159
+ * @returns {Uint8Array}
160
+ */
161
+ get encryptedKeyDer() {
162
+ const ret = wasm.csdoutput_encryptedKeyDer(this.__wbg_ptr);
163
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
164
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
165
+ return v1;
166
+ }
167
+ /**
168
+ * @returns {string}
169
+ */
170
+ get folder() {
171
+ let deferred1_0;
172
+ let deferred1_1;
173
+ try {
174
+ const ret = wasm.csdoutput_folder(this.__wbg_ptr);
175
+ deferred1_0 = ret[0];
176
+ deferred1_1 = ret[1];
177
+ return getStringFromWasm0(ret[0], ret[1]);
178
+ } finally {
179
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
180
+ }
181
+ }
182
+ /**
183
+ * @returns {string}
184
+ */
185
+ get keyName() {
186
+ let deferred1_0;
187
+ let deferred1_1;
188
+ try {
189
+ const ret = wasm.csdoutput_keyName(this.__wbg_ptr);
190
+ deferred1_0 = ret[0];
191
+ deferred1_1 = ret[1];
192
+ return getStringFromWasm0(ret[0], ret[1]);
193
+ } finally {
194
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
195
+ }
196
+ }
197
+ /**
198
+ * @returns {string}
199
+ */
200
+ get requestEntry() {
201
+ let deferred1_0;
202
+ let deferred1_1;
203
+ try {
204
+ const ret = wasm.csdoutput_requestEntry(this.__wbg_ptr);
205
+ deferred1_0 = ret[0];
206
+ deferred1_1 = ret[1];
207
+ return getStringFromWasm0(ret[0], ret[1]);
208
+ } finally {
209
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
210
+ }
211
+ }
212
+ /**
213
+ * @returns {Uint8Array}
214
+ */
215
+ get sdgDer() {
216
+ const ret = wasm.csdoutput_sdgDer(this.__wbg_ptr);
217
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
218
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
219
+ return v1;
220
+ }
221
+ /**
222
+ * @returns {string}
223
+ */
224
+ get sdgName() {
225
+ let deferred1_0;
226
+ let deferred1_1;
227
+ try {
228
+ const ret = wasm.csdoutput_sdgName(this.__wbg_ptr);
229
+ deferred1_0 = ret[0];
230
+ deferred1_1 = ret[1];
231
+ return getStringFromWasm0(ret[0], ret[1]);
232
+ } finally {
233
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
234
+ }
235
+ }
236
+ }
237
+ if (Symbol.dispose) CsdOutput.prototype[Symbol.dispose] = CsdOutput.prototype.free;
238
+
239
+ export class PairValidation {
240
+ static __wrap(ptr) {
241
+ const obj = Object.create(PairValidation.prototype);
242
+ obj.__wbg_ptr = ptr;
243
+ PairValidationFinalization.register(obj, obj.__wbg_ptr, obj);
244
+ return obj;
245
+ }
246
+ __destroy_into_raw() {
247
+ const ptr = this.__wbg_ptr;
248
+ this.__wbg_ptr = 0;
249
+ PairValidationFinalization.unregister(this);
250
+ return ptr;
251
+ }
252
+ free() {
253
+ const ptr = this.__destroy_into_raw();
254
+ wasm.__wbg_pairvalidation_free(ptr, 0);
255
+ }
256
+ /**
257
+ * @returns {CertificateInfo}
258
+ */
259
+ get certificate() {
260
+ const ret = wasm.pairvalidation_certificate(this.__wbg_ptr);
261
+ return CertificateInfo.__wrap(ret);
262
+ }
263
+ /**
264
+ * @returns {string}
265
+ */
266
+ get keyModulusSha256() {
267
+ let deferred1_0;
268
+ let deferred1_1;
269
+ try {
270
+ const ret = wasm.pairvalidation_keyModulusSha256(this.__wbg_ptr);
271
+ deferred1_0 = ret[0];
272
+ deferred1_1 = ret[1];
273
+ return getStringFromWasm0(ret[0], ret[1]);
274
+ } finally {
275
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
276
+ }
277
+ }
278
+ /**
279
+ * @returns {boolean}
280
+ */
281
+ get matches() {
282
+ const ret = wasm.pairvalidation_matches(this.__wbg_ptr);
283
+ return ret !== 0;
284
+ }
285
+ }
286
+ if (Symbol.dispose) PairValidation.prototype[Symbol.dispose] = PairValidation.prototype.free;
287
+
288
+ export class RenewFielOutput {
289
+ static __wrap(ptr) {
290
+ const obj = Object.create(RenewFielOutput.prototype);
291
+ obj.__wbg_ptr = ptr;
292
+ RenewFielOutputFinalization.register(obj, obj.__wbg_ptr, obj);
293
+ return obj;
294
+ }
295
+ __destroy_into_raw() {
296
+ const ptr = this.__wbg_ptr;
297
+ this.__wbg_ptr = 0;
298
+ RenewFielOutputFinalization.unregister(this);
299
+ return ptr;
300
+ }
301
+ free() {
302
+ const ptr = this.__destroy_into_raw();
303
+ wasm.__wbg_renewfieloutput_free(ptr, 0);
304
+ }
305
+ /**
306
+ * @returns {Uint8Array}
307
+ */
308
+ get encryptedKeyDer() {
309
+ const ret = wasm.renewfieloutput_encryptedKeyDer(this.__wbg_ptr);
310
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
311
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
312
+ return v1;
313
+ }
314
+ /**
315
+ * @returns {string}
316
+ */
317
+ get folder() {
318
+ let deferred1_0;
319
+ let deferred1_1;
320
+ try {
321
+ const ret = wasm.renewfieloutput_folder(this.__wbg_ptr);
322
+ deferred1_0 = ret[0];
323
+ deferred1_1 = ret[1];
324
+ return getStringFromWasm0(ret[0], ret[1]);
325
+ } finally {
326
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
327
+ }
328
+ }
329
+ /**
330
+ * @returns {string}
331
+ */
332
+ get keyName() {
333
+ let deferred1_0;
334
+ let deferred1_1;
335
+ try {
336
+ const ret = wasm.renewfieloutput_keyName(this.__wbg_ptr);
337
+ deferred1_0 = ret[0];
338
+ deferred1_1 = ret[1];
339
+ return getStringFromWasm0(ret[0], ret[1]);
340
+ } finally {
341
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
342
+ }
343
+ }
344
+ /**
345
+ * @returns {Uint8Array}
346
+ */
347
+ get renewalDer() {
348
+ const ret = wasm.renewfieloutput_renewalDer(this.__wbg_ptr);
349
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
350
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
351
+ return v1;
352
+ }
353
+ /**
354
+ * @returns {string}
355
+ */
356
+ get renewalName() {
357
+ let deferred1_0;
358
+ let deferred1_1;
359
+ try {
360
+ const ret = wasm.renewfieloutput_renewalName(this.__wbg_ptr);
361
+ deferred1_0 = ret[0];
362
+ deferred1_1 = ret[1];
363
+ return getStringFromWasm0(ret[0], ret[1]);
364
+ } finally {
365
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
366
+ }
367
+ }
368
+ }
369
+ if (Symbol.dispose) RenewFielOutput.prototype[Symbol.dispose] = RenewFielOutput.prototype.free;
370
+
371
+ /**
372
+ * @param {string} rfc
373
+ * @param {string} serial_number
374
+ * @param {string} legal_name
375
+ * @param {string} unit
376
+ * @param {string} new_password
377
+ * @param {Uint8Array} signer_certificate_der
378
+ * @param {Uint8Array} signer_encrypted_key_der
379
+ * @param {string} signer_password
380
+ * @param {string} date
381
+ * @param {string} time
382
+ * @param {string} challenge
383
+ * @returns {CsdOutput}
384
+ */
385
+ export function generateCsd(rfc, serial_number, legal_name, unit, new_password, signer_certificate_der, signer_encrypted_key_der, signer_password, date, time, challenge) {
386
+ const ptr0 = passStringToWasm0(rfc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
387
+ const len0 = WASM_VECTOR_LEN;
388
+ const ptr1 = passStringToWasm0(serial_number, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
389
+ const len1 = WASM_VECTOR_LEN;
390
+ const ptr2 = passStringToWasm0(legal_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
391
+ const len2 = WASM_VECTOR_LEN;
392
+ const ptr3 = passStringToWasm0(unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
393
+ const len3 = WASM_VECTOR_LEN;
394
+ const ptr4 = passStringToWasm0(new_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
395
+ const len4 = WASM_VECTOR_LEN;
396
+ const ptr5 = passArray8ToWasm0(signer_certificate_der, wasm.__wbindgen_malloc);
397
+ const len5 = WASM_VECTOR_LEN;
398
+ const ptr6 = passArray8ToWasm0(signer_encrypted_key_der, wasm.__wbindgen_malloc);
399
+ const len6 = WASM_VECTOR_LEN;
400
+ const ptr7 = passStringToWasm0(signer_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
401
+ const len7 = WASM_VECTOR_LEN;
402
+ const ptr8 = passStringToWasm0(date, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
+ const len8 = WASM_VECTOR_LEN;
404
+ const ptr9 = passStringToWasm0(time, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
405
+ const len9 = WASM_VECTOR_LEN;
406
+ const ptr10 = passStringToWasm0(challenge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
407
+ const len10 = WASM_VECTOR_LEN;
408
+ const ret = wasm.generateCsd(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10);
409
+ if (ret[2]) {
410
+ throw takeFromExternrefTable0(ret[1]);
411
+ }
412
+ return CsdOutput.__wrap(ret[0]);
413
+ }
414
+
415
+ /**
416
+ * @param {Uint8Array} certificate_der
417
+ * @returns {CertificateInfo}
418
+ */
419
+ export function inspectCertificate(certificate_der) {
420
+ const ptr0 = passArray8ToWasm0(certificate_der, wasm.__wbindgen_malloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ret = wasm.inspectCertificate(ptr0, len0);
423
+ if (ret[2]) {
424
+ throw takeFromExternrefTable0(ret[1]);
425
+ }
426
+ return CertificateInfo.__wrap(ret[0]);
427
+ }
428
+
429
+ /**
430
+ * @param {Uint8Array} certificate_der
431
+ * @param {Uint8Array} encrypted_key_der
432
+ * @param {string} password
433
+ * @returns {PairValidation}
434
+ */
435
+ export function pairCheck(certificate_der, encrypted_key_der, password) {
436
+ const ptr0 = passArray8ToWasm0(certificate_der, wasm.__wbindgen_malloc);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ const ptr1 = passArray8ToWasm0(encrypted_key_der, wasm.__wbindgen_malloc);
439
+ const len1 = WASM_VECTOR_LEN;
440
+ const ptr2 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
441
+ const len2 = WASM_VECTOR_LEN;
442
+ const ret = wasm.pairCheck(ptr0, len0, ptr1, len1, ptr2, len2);
443
+ if (ret[2]) {
444
+ throw takeFromExternrefTable0(ret[1]);
445
+ }
446
+ return PairValidation.__wrap(ret[0]);
447
+ }
448
+
449
+ /**
450
+ * @param {string} rfc
451
+ * @param {string} serial_number
452
+ * @param {string} email
453
+ * @param {string} new_password
454
+ * @param {Uint8Array} signer_certificate_der
455
+ * @param {Uint8Array} signer_encrypted_key_der
456
+ * @param {string} signer_password
457
+ * @param {string} date
458
+ * @param {string} time
459
+ * @param {string} challenge
460
+ * @returns {RenewFielOutput}
461
+ */
462
+ export function renewFiel(rfc, serial_number, email, new_password, signer_certificate_der, signer_encrypted_key_der, signer_password, date, time, challenge) {
463
+ const ptr0 = passStringToWasm0(rfc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
464
+ const len0 = WASM_VECTOR_LEN;
465
+ const ptr1 = passStringToWasm0(serial_number, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
466
+ const len1 = WASM_VECTOR_LEN;
467
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
+ const len2 = WASM_VECTOR_LEN;
469
+ const ptr3 = passStringToWasm0(new_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
470
+ const len3 = WASM_VECTOR_LEN;
471
+ const ptr4 = passArray8ToWasm0(signer_certificate_der, wasm.__wbindgen_malloc);
472
+ const len4 = WASM_VECTOR_LEN;
473
+ const ptr5 = passArray8ToWasm0(signer_encrypted_key_der, wasm.__wbindgen_malloc);
474
+ const len5 = WASM_VECTOR_LEN;
475
+ const ptr6 = passStringToWasm0(signer_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len6 = WASM_VECTOR_LEN;
477
+ const ptr7 = passStringToWasm0(date, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
478
+ const len7 = WASM_VECTOR_LEN;
479
+ const ptr8 = passStringToWasm0(time, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
480
+ const len8 = WASM_VECTOR_LEN;
481
+ const ptr9 = passStringToWasm0(challenge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
482
+ const len9 = WASM_VECTOR_LEN;
483
+ const ret = wasm.renewFiel(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9);
484
+ if (ret[2]) {
485
+ throw takeFromExternrefTable0(ret[1]);
486
+ }
487
+ return RenewFielOutput.__wrap(ret[0]);
488
+ }
489
+ export function __wbg___wbindgen_is_function_2f0fd7ceb86e64c5(arg0) {
490
+ const ret = typeof(arg0) === 'function';
491
+ return ret;
492
+ }
493
+ export function __wbg___wbindgen_is_object_5b22ff2418063a9c(arg0) {
494
+ const val = arg0;
495
+ const ret = typeof(val) === 'object' && val !== null;
496
+ return ret;
497
+ }
498
+ export function __wbg___wbindgen_is_string_eddc07a3efad52e6(arg0) {
499
+ const ret = typeof(arg0) === 'string';
500
+ return ret;
501
+ }
502
+ export function __wbg___wbindgen_is_undefined_244a92c34d3b6ec0(arg0) {
503
+ const ret = arg0 === undefined;
504
+ return ret;
505
+ }
506
+ export function __wbg___wbindgen_throw_9c75d47bf9e7731e(arg0, arg1) {
507
+ throw new Error(getStringFromWasm0(arg0, arg1));
508
+ }
509
+ export function __wbg_call_a41d6421b30a32c5() { return handleError(function (arg0, arg1, arg2) {
510
+ const ret = arg0.call(arg1, arg2);
511
+ return ret;
512
+ }, arguments); }
513
+ export function __wbg_crypto_38df2bab126b63dc(arg0) {
514
+ const ret = arg0.crypto;
515
+ return ret;
516
+ }
517
+ export function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {
518
+ arg0.getRandomValues(arg1);
519
+ }, arguments); }
520
+ export function __wbg_length_ba3c032602efe310(arg0) {
521
+ const ret = arg0.length;
522
+ return ret;
523
+ }
524
+ export function __wbg_msCrypto_bd5a034af96bcba6(arg0) {
525
+ const ret = arg0.msCrypto;
526
+ return ret;
527
+ }
528
+ export function __wbg_new_with_length_9011f5da794bf5d9(arg0) {
529
+ const ret = new Uint8Array(arg0 >>> 0);
530
+ return ret;
531
+ }
532
+ export function __wbg_node_84ea875411254db1(arg0) {
533
+ const ret = arg0.node;
534
+ return ret;
535
+ }
536
+ export function __wbg_process_44c7a14e11e9f69e(arg0) {
537
+ const ret = arg0.process;
538
+ return ret;
539
+ }
540
+ export function __wbg_prototypesetcall_fd4050e806e1d519(arg0, arg1, arg2) {
541
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
542
+ }
543
+ export function __wbg_randomFillSync_6c25eac9869eb53c() { return handleError(function (arg0, arg1) {
544
+ arg0.randomFillSync(arg1);
545
+ }, arguments); }
546
+ export function __wbg_require_b4edbdcf3e2a1ef0() { return handleError(function () {
547
+ const ret = module.require;
548
+ return ret;
549
+ }, arguments); }
550
+ export function __wbg_static_accessor_GLOBAL_THIS_1c7f1bd6c6941fdb() {
551
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
552
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
553
+ }
554
+ export function __wbg_static_accessor_GLOBAL_e039bc914f83e74e() {
555
+ const ret = typeof global === 'undefined' ? null : global;
556
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
557
+ }
558
+ export function __wbg_static_accessor_SELF_8bf8c48c28420ad5() {
559
+ const ret = typeof self === 'undefined' ? null : self;
560
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
561
+ }
562
+ export function __wbg_static_accessor_WINDOW_6aeee9b51652ee0f() {
563
+ const ret = typeof window === 'undefined' ? null : window;
564
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
565
+ }
566
+ export function __wbg_subarray_fbe3cef290e1fa43(arg0, arg1, arg2) {
567
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
568
+ return ret;
569
+ }
570
+ export function __wbg_versions_276b2795b1c6a219(arg0) {
571
+ const ret = arg0.versions;
572
+ return ret;
573
+ }
574
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
575
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
576
+ const ret = getArrayU8FromWasm0(arg0, arg1);
577
+ return ret;
578
+ }
579
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
580
+ // Cast intrinsic for `Ref(String) -> Externref`.
581
+ const ret = getStringFromWasm0(arg0, arg1);
582
+ return ret;
583
+ }
584
+ export function __wbindgen_init_externref_table() {
585
+ const table = wasm.__wbindgen_externrefs;
586
+ const offset = table.grow(4);
587
+ table.set(0, undefined);
588
+ table.set(offset + 0, undefined);
589
+ table.set(offset + 1, null);
590
+ table.set(offset + 2, true);
591
+ table.set(offset + 3, false);
592
+ }
593
+ const CertificateInfoFinalization = (typeof FinalizationRegistry === 'undefined')
594
+ ? { register: () => {}, unregister: () => {} }
595
+ : new FinalizationRegistry(ptr => wasm.__wbg_certificateinfo_free(ptr, 1));
596
+ const CsdOutputFinalization = (typeof FinalizationRegistry === 'undefined')
597
+ ? { register: () => {}, unregister: () => {} }
598
+ : new FinalizationRegistry(ptr => wasm.__wbg_csdoutput_free(ptr, 1));
599
+ const PairValidationFinalization = (typeof FinalizationRegistry === 'undefined')
600
+ ? { register: () => {}, unregister: () => {} }
601
+ : new FinalizationRegistry(ptr => wasm.__wbg_pairvalidation_free(ptr, 1));
602
+ const RenewFielOutputFinalization = (typeof FinalizationRegistry === 'undefined')
603
+ ? { register: () => {}, unregister: () => {} }
604
+ : new FinalizationRegistry(ptr => wasm.__wbg_renewfieloutput_free(ptr, 1));
605
+
606
+ function addToExternrefTable0(obj) {
607
+ const idx = wasm.__externref_table_alloc();
608
+ wasm.__wbindgen_externrefs.set(idx, obj);
609
+ return idx;
610
+ }
611
+
612
+ function getArrayU8FromWasm0(ptr, len) {
613
+ ptr = ptr >>> 0;
614
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
615
+ }
616
+
617
+ function getStringFromWasm0(ptr, len) {
618
+ return decodeText(ptr >>> 0, len);
619
+ }
620
+
621
+ let cachedUint8ArrayMemory0 = null;
622
+ function getUint8ArrayMemory0() {
623
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
624
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
625
+ }
626
+ return cachedUint8ArrayMemory0;
627
+ }
628
+
629
+ function handleError(f, args) {
630
+ try {
631
+ return f.apply(this, args);
632
+ } catch (e) {
633
+ const idx = addToExternrefTable0(e);
634
+ wasm.__wbindgen_exn_store(idx);
635
+ }
636
+ }
637
+
638
+ function isLikeNone(x) {
639
+ return x === undefined || x === null;
640
+ }
641
+
642
+ function passArray8ToWasm0(arg, malloc) {
643
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
644
+ getUint8ArrayMemory0().set(arg, ptr / 1);
645
+ WASM_VECTOR_LEN = arg.length;
646
+ return ptr;
647
+ }
648
+
649
+ function passStringToWasm0(arg, malloc, realloc) {
650
+ if (realloc === undefined) {
651
+ const buf = cachedTextEncoder.encode(arg);
652
+ const ptr = malloc(buf.length, 1) >>> 0;
653
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
654
+ WASM_VECTOR_LEN = buf.length;
655
+ return ptr;
656
+ }
657
+
658
+ let len = arg.length;
659
+ let ptr = malloc(len, 1) >>> 0;
660
+
661
+ const mem = getUint8ArrayMemory0();
662
+
663
+ let offset = 0;
664
+
665
+ for (; offset < len; offset++) {
666
+ const code = arg.charCodeAt(offset);
667
+ if (code > 0x7F) break;
668
+ mem[ptr + offset] = code;
669
+ }
670
+ if (offset !== len) {
671
+ if (offset !== 0) {
672
+ arg = arg.slice(offset);
673
+ }
674
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
675
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
676
+ const ret = cachedTextEncoder.encodeInto(arg, view);
677
+
678
+ offset += ret.written;
679
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
680
+ }
681
+
682
+ WASM_VECTOR_LEN = offset;
683
+ return ptr;
684
+ }
685
+
686
+ function takeFromExternrefTable0(idx) {
687
+ const value = wasm.__wbindgen_externrefs.get(idx);
688
+ wasm.__externref_table_dealloc(idx);
689
+ return value;
690
+ }
691
+
692
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
693
+ cachedTextDecoder.decode();
694
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
695
+ let numBytesDecoded = 0;
696
+ function decodeText(ptr, len) {
697
+ numBytesDecoded += len;
698
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
699
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
700
+ cachedTextDecoder.decode();
701
+ numBytesDecoded = len;
702
+ }
703
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
704
+ }
705
+
706
+ const cachedTextEncoder = new TextEncoder();
707
+
708
+ if (!('encodeInto' in cachedTextEncoder)) {
709
+ cachedTextEncoder.encodeInto = function (arg, view) {
710
+ const buf = cachedTextEncoder.encode(arg);
711
+ view.set(buf);
712
+ return {
713
+ read: arg.length,
714
+ written: buf.length
715
+ };
716
+ };
717
+ }
718
+
719
+ let WASM_VECTOR_LEN = 0;
720
+
721
+
722
+ let wasm;
723
+ export function __wbg_set_wasm(val) {
724
+ wasm = val;
725
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@oxhq/oxpki-wasm",
3
+ "type": "module",
4
+ "version": "0.1.0-alpha",
5
+ "license": "MIT OR Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/oxhq/oxpki"
9
+ },
10
+ "files": [
11
+ "oxpki_wasm_bg.wasm",
12
+ "oxpki_wasm.js",
13
+ "oxpki_wasm_bg.js",
14
+ "oxpki_wasm.d.ts"
15
+ ],
16
+ "main": "oxpki_wasm.js",
17
+ "types": "oxpki_wasm.d.ts",
18
+ "sideEffects": [
19
+ "./oxpki_wasm.js",
20
+ "./snippets/*"
21
+ ]
22
+ }