@qrcommunication/gigapdf-lib 0.15.0 → 0.17.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/CHANGELOG.md +41 -0
- package/README.md +25 -7
- package/dist/index.cjs +108 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -1
- package/gigapdf.wasm +0 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -184,6 +184,13 @@ interface FontInfo {
|
|
|
184
184
|
google: boolean;
|
|
185
185
|
weights: number[];
|
|
186
186
|
}
|
|
187
|
+
/** A font embedded in a document (from {@link GigaPdfDoc.embeddedFonts}). */
|
|
188
|
+
interface EmbeddedFont {
|
|
189
|
+
/** The `/BaseFont` name (may carry a `ABCDEF+` subset prefix). */
|
|
190
|
+
baseFont: string;
|
|
191
|
+
/** Embedded program format. `truetype` re-embeds directly via `embedFont`. */
|
|
192
|
+
format: "truetype" | "cff" | "type1";
|
|
193
|
+
}
|
|
187
194
|
interface Box {
|
|
188
195
|
x: number;
|
|
189
196
|
y: number;
|
|
@@ -210,6 +217,19 @@ interface TextRunInfo {
|
|
|
210
217
|
operator: string;
|
|
211
218
|
text: string;
|
|
212
219
|
}
|
|
220
|
+
/** Signature-dictionary metadata for {@link GigaPdfDoc.signP12}. */
|
|
221
|
+
interface SignP12Options {
|
|
222
|
+
/** `/Name` — human-readable signer name. */
|
|
223
|
+
name?: string;
|
|
224
|
+
/** `/Reason` — why the document is being signed. */
|
|
225
|
+
reason?: string;
|
|
226
|
+
/** `/M` — signing time as a PDF date string, e.g. `D:20260616120000Z`. */
|
|
227
|
+
date?: string;
|
|
228
|
+
/** `/Location` — physical or logical signing location. */
|
|
229
|
+
location?: string;
|
|
230
|
+
/** `/ContactInfo` — how to reach the signer. */
|
|
231
|
+
contactInfo?: string;
|
|
232
|
+
}
|
|
213
233
|
/** A markup annotation (rect corners in PDF user space). */
|
|
214
234
|
interface AnnotationInfo {
|
|
215
235
|
index: number;
|
|
@@ -358,6 +378,20 @@ declare class GigaPdfDoc {
|
|
|
358
378
|
deletePage(page: number): boolean;
|
|
359
379
|
movePage(from: number, to: number): boolean;
|
|
360
380
|
appendPages(otherPdf: Uint8Array): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Add an invisible (text render mode 3) standard-Helvetica text layer to
|
|
383
|
+
* `page` in a SINGLE content append — for OCR. Each run is `{x, y, size,
|
|
384
|
+
* text, rotation?}` (PDF user space, baseline-anchored, `rotation`° CCW).
|
|
385
|
+
* Runs whose text has any non-WinAnsi glyph are skipped. Returns the number
|
|
386
|
+
* of runs actually written (0 on engine error).
|
|
387
|
+
*/
|
|
388
|
+
addTextLayer(page: number, runs: {
|
|
389
|
+
x: number;
|
|
390
|
+
y: number;
|
|
391
|
+
size: number;
|
|
392
|
+
text: string;
|
|
393
|
+
rotation?: number;
|
|
394
|
+
}[]): number;
|
|
361
395
|
/** Extract the given 1-based page numbers into a NEW standalone PDF. */
|
|
362
396
|
extractPages(pages: number[]): Uint8Array;
|
|
363
397
|
/** Resize a page's MediaBox to `width`×`height` points. */
|
|
@@ -371,6 +405,15 @@ declare class GigaPdfDoc {
|
|
|
371
405
|
renderPage(page: number, scale?: number): Uint8Array;
|
|
372
406
|
embedFont(family: string, ttf: Uint8Array): number;
|
|
373
407
|
addText(page: number, x: number, y: number, size: number, text: string, fontObj: number, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Draw `text` at `(x, y)` in a built-in **base-14 standard font** (`fontName`,
|
|
410
|
+
* e.g. `"Times-Bold"`, `"Courier-Oblique"`, `"Symbol"`) — no embedding needed,
|
|
411
|
+
* every viewer ships these 14. For any other family embed a TrueType with
|
|
412
|
+
* {@link embedFont} (a Google Font fetched by the host, or one pulled out of
|
|
413
|
+
* the document with {@link extractFont}) and use {@link addText}. Returns
|
|
414
|
+
* `false` on an unknown font name or bad page.
|
|
415
|
+
*/
|
|
416
|
+
addStandardText(page: number, x: number, y: number, size: number, text: string, fontName: string, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
|
|
374
417
|
/**
|
|
375
418
|
* Stamp a standard-**Helvetica** watermark (no font embed needed): `text` at
|
|
376
419
|
* `(x, y)`, rotated `rotationDeg`° counter-clockwise, `rgb` packed `0xRRGGBB`,
|
|
@@ -389,6 +432,13 @@ declare class GigaPdfDoc {
|
|
|
389
432
|
format: "truetype" | "cff" | "type1";
|
|
390
433
|
bytes: Uint8Array;
|
|
391
434
|
} | null;
|
|
435
|
+
/**
|
|
436
|
+
* The fonts **embedded** in the document — each `{ baseFont, format }`. Pair
|
|
437
|
+
* with {@link extractFont} to pull a font's bytes out and re-embed them via
|
|
438
|
+
* {@link embedFont}, e.g. to draw new text (with {@link addText}) in a face
|
|
439
|
+
* the document already carries — no external font file needed.
|
|
440
|
+
*/
|
|
441
|
+
embeddedFonts(): EmbeddedFont[];
|
|
392
442
|
toText(): string;
|
|
393
443
|
toHtml(): string;
|
|
394
444
|
toDocx(): Uint8Array;
|
|
@@ -415,6 +465,16 @@ declare class GigaPdfDoc {
|
|
|
415
465
|
}): Uint8Array;
|
|
416
466
|
/** Self-signed digital signature. `random` ≥ 256 bytes from crypto.getRandomValues. */
|
|
417
467
|
sign(fields: string, random: Uint8Array, keyBits?: number): Uint8Array;
|
|
468
|
+
/**
|
|
469
|
+
* Sign with a PKCS#12 (`.p12`/`.pfx`) identity — a CA-issued / eIDAS
|
|
470
|
+
* certificate and its RSA key, imported natively (no external crypto). `opts`
|
|
471
|
+
* populates the signature dictionary: `name` (`/Name`), `reason` (`/Reason`),
|
|
472
|
+
* `date` (`/M`, a PDF date string e.g. `D:20260616120000Z`), and the optional
|
|
473
|
+
* `location` (`/Location`) and `contactInfo` (`/ContactInfo`). Throws a single
|
|
474
|
+
* generic error on a wrong password, malformed file, unsupported cipher, or
|
|
475
|
+
* missing certificate.
|
|
476
|
+
*/
|
|
477
|
+
signP12(p12: Uint8Array, password: string, opts?: SignP12Options): Uint8Array;
|
|
418
478
|
getMetadata(key: string): string;
|
|
419
479
|
/** Set an Info-dictionary entry (e.g. "Title", "Author"). */
|
|
420
480
|
setMetadata(key: string, value: string): boolean;
|
|
@@ -517,4 +577,4 @@ declare class GigaPdfDoc {
|
|
|
517
577
|
}): boolean;
|
|
518
578
|
}
|
|
519
579
|
|
|
520
|
-
export { type AnnotationInfo, type Box, type Element, type FieldInfo, type FieldKind, type FieldStyle, type FontInfo, GigaPdfDoc, GigaPdfEngine, type HtmlFont, type HtmlFontRequest, type HtmlMargins, type HtmlRenderOptions, type LayerInfo, type LinkInfo, type OcrWord, type OutlineEntry, type PageInfo, type RadioOption, type SearchHit, type TextLine, type TextRunInfo };
|
|
580
|
+
export { type AnnotationInfo, type Box, type Element, type EmbeddedFont, type FieldInfo, type FieldKind, type FieldStyle, type FontInfo, GigaPdfDoc, GigaPdfEngine, type HtmlFont, type HtmlFontRequest, type HtmlMargins, type HtmlRenderOptions, type LayerInfo, type LinkInfo, type OcrWord, type OutlineEntry, type PageInfo, type RadioOption, type SearchHit, type SignP12Options, type TextLine, type TextRunInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,13 @@ interface FontInfo {
|
|
|
184
184
|
google: boolean;
|
|
185
185
|
weights: number[];
|
|
186
186
|
}
|
|
187
|
+
/** A font embedded in a document (from {@link GigaPdfDoc.embeddedFonts}). */
|
|
188
|
+
interface EmbeddedFont {
|
|
189
|
+
/** The `/BaseFont` name (may carry a `ABCDEF+` subset prefix). */
|
|
190
|
+
baseFont: string;
|
|
191
|
+
/** Embedded program format. `truetype` re-embeds directly via `embedFont`. */
|
|
192
|
+
format: "truetype" | "cff" | "type1";
|
|
193
|
+
}
|
|
187
194
|
interface Box {
|
|
188
195
|
x: number;
|
|
189
196
|
y: number;
|
|
@@ -210,6 +217,19 @@ interface TextRunInfo {
|
|
|
210
217
|
operator: string;
|
|
211
218
|
text: string;
|
|
212
219
|
}
|
|
220
|
+
/** Signature-dictionary metadata for {@link GigaPdfDoc.signP12}. */
|
|
221
|
+
interface SignP12Options {
|
|
222
|
+
/** `/Name` — human-readable signer name. */
|
|
223
|
+
name?: string;
|
|
224
|
+
/** `/Reason` — why the document is being signed. */
|
|
225
|
+
reason?: string;
|
|
226
|
+
/** `/M` — signing time as a PDF date string, e.g. `D:20260616120000Z`. */
|
|
227
|
+
date?: string;
|
|
228
|
+
/** `/Location` — physical or logical signing location. */
|
|
229
|
+
location?: string;
|
|
230
|
+
/** `/ContactInfo` — how to reach the signer. */
|
|
231
|
+
contactInfo?: string;
|
|
232
|
+
}
|
|
213
233
|
/** A markup annotation (rect corners in PDF user space). */
|
|
214
234
|
interface AnnotationInfo {
|
|
215
235
|
index: number;
|
|
@@ -358,6 +378,20 @@ declare class GigaPdfDoc {
|
|
|
358
378
|
deletePage(page: number): boolean;
|
|
359
379
|
movePage(from: number, to: number): boolean;
|
|
360
380
|
appendPages(otherPdf: Uint8Array): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Add an invisible (text render mode 3) standard-Helvetica text layer to
|
|
383
|
+
* `page` in a SINGLE content append — for OCR. Each run is `{x, y, size,
|
|
384
|
+
* text, rotation?}` (PDF user space, baseline-anchored, `rotation`° CCW).
|
|
385
|
+
* Runs whose text has any non-WinAnsi glyph are skipped. Returns the number
|
|
386
|
+
* of runs actually written (0 on engine error).
|
|
387
|
+
*/
|
|
388
|
+
addTextLayer(page: number, runs: {
|
|
389
|
+
x: number;
|
|
390
|
+
y: number;
|
|
391
|
+
size: number;
|
|
392
|
+
text: string;
|
|
393
|
+
rotation?: number;
|
|
394
|
+
}[]): number;
|
|
361
395
|
/** Extract the given 1-based page numbers into a NEW standalone PDF. */
|
|
362
396
|
extractPages(pages: number[]): Uint8Array;
|
|
363
397
|
/** Resize a page's MediaBox to `width`×`height` points. */
|
|
@@ -371,6 +405,15 @@ declare class GigaPdfDoc {
|
|
|
371
405
|
renderPage(page: number, scale?: number): Uint8Array;
|
|
372
406
|
embedFont(family: string, ttf: Uint8Array): number;
|
|
373
407
|
addText(page: number, x: number, y: number, size: number, text: string, fontObj: number, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Draw `text` at `(x, y)` in a built-in **base-14 standard font** (`fontName`,
|
|
410
|
+
* e.g. `"Times-Bold"`, `"Courier-Oblique"`, `"Symbol"`) — no embedding needed,
|
|
411
|
+
* every viewer ships these 14. For any other family embed a TrueType with
|
|
412
|
+
* {@link embedFont} (a Google Font fetched by the host, or one pulled out of
|
|
413
|
+
* the document with {@link extractFont}) and use {@link addText}. Returns
|
|
414
|
+
* `false` on an unknown font name or bad page.
|
|
415
|
+
*/
|
|
416
|
+
addStandardText(page: number, x: number, y: number, size: number, text: string, fontName: string, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
|
|
374
417
|
/**
|
|
375
418
|
* Stamp a standard-**Helvetica** watermark (no font embed needed): `text` at
|
|
376
419
|
* `(x, y)`, rotated `rotationDeg`° counter-clockwise, `rgb` packed `0xRRGGBB`,
|
|
@@ -389,6 +432,13 @@ declare class GigaPdfDoc {
|
|
|
389
432
|
format: "truetype" | "cff" | "type1";
|
|
390
433
|
bytes: Uint8Array;
|
|
391
434
|
} | null;
|
|
435
|
+
/**
|
|
436
|
+
* The fonts **embedded** in the document — each `{ baseFont, format }`. Pair
|
|
437
|
+
* with {@link extractFont} to pull a font's bytes out and re-embed them via
|
|
438
|
+
* {@link embedFont}, e.g. to draw new text (with {@link addText}) in a face
|
|
439
|
+
* the document already carries — no external font file needed.
|
|
440
|
+
*/
|
|
441
|
+
embeddedFonts(): EmbeddedFont[];
|
|
392
442
|
toText(): string;
|
|
393
443
|
toHtml(): string;
|
|
394
444
|
toDocx(): Uint8Array;
|
|
@@ -415,6 +465,16 @@ declare class GigaPdfDoc {
|
|
|
415
465
|
}): Uint8Array;
|
|
416
466
|
/** Self-signed digital signature. `random` ≥ 256 bytes from crypto.getRandomValues. */
|
|
417
467
|
sign(fields: string, random: Uint8Array, keyBits?: number): Uint8Array;
|
|
468
|
+
/**
|
|
469
|
+
* Sign with a PKCS#12 (`.p12`/`.pfx`) identity — a CA-issued / eIDAS
|
|
470
|
+
* certificate and its RSA key, imported natively (no external crypto). `opts`
|
|
471
|
+
* populates the signature dictionary: `name` (`/Name`), `reason` (`/Reason`),
|
|
472
|
+
* `date` (`/M`, a PDF date string e.g. `D:20260616120000Z`), and the optional
|
|
473
|
+
* `location` (`/Location`) and `contactInfo` (`/ContactInfo`). Throws a single
|
|
474
|
+
* generic error on a wrong password, malformed file, unsupported cipher, or
|
|
475
|
+
* missing certificate.
|
|
476
|
+
*/
|
|
477
|
+
signP12(p12: Uint8Array, password: string, opts?: SignP12Options): Uint8Array;
|
|
418
478
|
getMetadata(key: string): string;
|
|
419
479
|
/** Set an Info-dictionary entry (e.g. "Title", "Author"). */
|
|
420
480
|
setMetadata(key: string, value: string): boolean;
|
|
@@ -517,4 +577,4 @@ declare class GigaPdfDoc {
|
|
|
517
577
|
}): boolean;
|
|
518
578
|
}
|
|
519
579
|
|
|
520
|
-
export { type AnnotationInfo, type Box, type Element, type FieldInfo, type FieldKind, type FieldStyle, type FontInfo, GigaPdfDoc, GigaPdfEngine, type HtmlFont, type HtmlFontRequest, type HtmlMargins, type HtmlRenderOptions, type LayerInfo, type LinkInfo, type OcrWord, type OutlineEntry, type PageInfo, type RadioOption, type SearchHit, type TextLine, type TextRunInfo };
|
|
580
|
+
export { type AnnotationInfo, type Box, type Element, type EmbeddedFont, type FieldInfo, type FieldKind, type FieldStyle, type FontInfo, GigaPdfDoc, GigaPdfEngine, type HtmlFont, type HtmlFontRequest, type HtmlMargins, type HtmlRenderOptions, type LayerInfo, type LinkInfo, type OcrWord, type OutlineEntry, type PageInfo, type RadioOption, type SearchHit, type SignP12Options, type TextLine, type TextRunInfo };
|
package/dist/index.js
CHANGED
|
@@ -564,6 +564,40 @@ var GigaPdfDoc = class {
|
|
|
564
564
|
appendPages(otherPdf) {
|
|
565
565
|
return this.g._withBytes(otherPdf, (p, l) => this.ex().gp_append_pages(this.h, p, l)) === 0;
|
|
566
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* Add an invisible (text render mode 3) standard-Helvetica text layer to
|
|
569
|
+
* `page` in a SINGLE content append — for OCR. Each run is `{x, y, size,
|
|
570
|
+
* text, rotation?}` (PDF user space, baseline-anchored, `rotation`° CCW).
|
|
571
|
+
* Runs whose text has any non-WinAnsi glyph are skipped. Returns the number
|
|
572
|
+
* of runs actually written (0 on engine error).
|
|
573
|
+
*/
|
|
574
|
+
addTextLayer(page, runs) {
|
|
575
|
+
const parts = [];
|
|
576
|
+
let total = 0;
|
|
577
|
+
for (const r of runs) {
|
|
578
|
+
const t = enc.encode(r.text);
|
|
579
|
+
const head = new Uint8Array(36);
|
|
580
|
+
const dv = new DataView(head.buffer);
|
|
581
|
+
dv.setFloat64(0, r.x, true);
|
|
582
|
+
dv.setFloat64(8, r.y, true);
|
|
583
|
+
dv.setFloat64(16, r.size, true);
|
|
584
|
+
dv.setFloat64(24, r.rotation ?? 0, true);
|
|
585
|
+
dv.setUint32(32, t.length, true);
|
|
586
|
+
parts.push(head, t);
|
|
587
|
+
total += 36 + t.length;
|
|
588
|
+
}
|
|
589
|
+
const buf = new Uint8Array(total);
|
|
590
|
+
let off = 0;
|
|
591
|
+
for (const p of parts) {
|
|
592
|
+
buf.set(p, off);
|
|
593
|
+
off += p.length;
|
|
594
|
+
}
|
|
595
|
+
const written = this.g._withBytes(
|
|
596
|
+
buf,
|
|
597
|
+
(p, l) => this.ex().gp_add_text_layer(this.h, page, p, l)
|
|
598
|
+
);
|
|
599
|
+
return written < 0 ? 0 : written;
|
|
600
|
+
}
|
|
567
601
|
/** Extract the given 1-based page numbers into a NEW standalone PDF. */
|
|
568
602
|
extractPages(pages) {
|
|
569
603
|
return this.g._withU32(
|
|
@@ -620,6 +654,36 @@ var GigaPdfDoc = class {
|
|
|
620
654
|
)
|
|
621
655
|
) === 0;
|
|
622
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Draw `text` at `(x, y)` in a built-in **base-14 standard font** (`fontName`,
|
|
659
|
+
* e.g. `"Times-Bold"`, `"Courier-Oblique"`, `"Symbol"`) — no embedding needed,
|
|
660
|
+
* every viewer ships these 14. For any other family embed a TrueType with
|
|
661
|
+
* {@link embedFont} (a Google Font fetched by the host, or one pulled out of
|
|
662
|
+
* the document with {@link extractFont}) and use {@link addText}. Returns
|
|
663
|
+
* `false` on an unknown font name or bad page.
|
|
664
|
+
*/
|
|
665
|
+
addStandardText(page, x, y, size, text, fontName, rgb = 0, opacity = 1, rotationDeg = 0) {
|
|
666
|
+
return this.g._withStr(
|
|
667
|
+
text,
|
|
668
|
+
(tp, tl) => this.g._withStr(
|
|
669
|
+
fontName,
|
|
670
|
+
(fp, fl) => this.ex().gp_add_text_standard(
|
|
671
|
+
this.h,
|
|
672
|
+
page,
|
|
673
|
+
x,
|
|
674
|
+
y,
|
|
675
|
+
size,
|
|
676
|
+
tp,
|
|
677
|
+
tl,
|
|
678
|
+
fp,
|
|
679
|
+
fl,
|
|
680
|
+
RGB(rgb),
|
|
681
|
+
opacity,
|
|
682
|
+
rotationDeg
|
|
683
|
+
)
|
|
684
|
+
)
|
|
685
|
+
) === 0;
|
|
686
|
+
}
|
|
623
687
|
/**
|
|
624
688
|
* Stamp a standard-**Helvetica** watermark (no font embed needed): `text` at
|
|
625
689
|
* `(x, y)`, rotated `rotationDeg`° counter-clockwise, `rgb` packed `0xRRGGBB`,
|
|
@@ -650,6 +714,15 @@ var GigaPdfDoc = class {
|
|
|
650
714
|
const format = buf[0] === 1 ? "truetype" : buf[0] === 2 ? "cff" : "type1";
|
|
651
715
|
return { format, bytes: buf.subarray(1) };
|
|
652
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* The fonts **embedded** in the document — each `{ baseFont, format }`. Pair
|
|
719
|
+
* with {@link extractFont} to pull a font's bytes out and re-embed them via
|
|
720
|
+
* {@link embedFont}, e.g. to draw new text (with {@link addText}) in a face
|
|
721
|
+
* the document already carries — no external font file needed.
|
|
722
|
+
*/
|
|
723
|
+
embeddedFonts() {
|
|
724
|
+
return this.g._json((o) => this.ex().gp_embedded_fonts_json(this.h, o));
|
|
725
|
+
}
|
|
653
726
|
// convert PDF → X
|
|
654
727
|
toText() {
|
|
655
728
|
return this.g._str((o) => this.ex().gp_to_text(this.h, o));
|
|
@@ -745,6 +818,41 @@ var GigaPdfDoc = class {
|
|
|
745
818
|
this.g._free(rPtr, random.length);
|
|
746
819
|
return out;
|
|
747
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* Sign with a PKCS#12 (`.p12`/`.pfx`) identity — a CA-issued / eIDAS
|
|
823
|
+
* certificate and its RSA key, imported natively (no external crypto). `opts`
|
|
824
|
+
* populates the signature dictionary: `name` (`/Name`), `reason` (`/Reason`),
|
|
825
|
+
* `date` (`/M`, a PDF date string e.g. `D:20260616120000Z`), and the optional
|
|
826
|
+
* `location` (`/Location`) and `contactInfo` (`/ContactInfo`). Throws a single
|
|
827
|
+
* generic error on a wrong password, malformed file, unsupported cipher, or
|
|
828
|
+
* missing certificate.
|
|
829
|
+
*/
|
|
830
|
+
signP12(p12, password, opts = {}) {
|
|
831
|
+
const fields = [
|
|
832
|
+
opts.name ?? "",
|
|
833
|
+
opts.reason ?? "",
|
|
834
|
+
opts.date ?? "",
|
|
835
|
+
opts.location ?? "",
|
|
836
|
+
opts.contactInfo ?? ""
|
|
837
|
+
].join(" ");
|
|
838
|
+
const p12Ptr = this.g._toWasm(p12);
|
|
839
|
+
const out = this.g._withStr(
|
|
840
|
+
password,
|
|
841
|
+
(pwP, pwL) => this.g._withStr(
|
|
842
|
+
fields,
|
|
843
|
+
(fP, fL) => this.g._buffer(
|
|
844
|
+
(o) => this.ex().gp_sign_p12(this.h, p12Ptr, p12.length, pwP, pwL, fP, fL, o)
|
|
845
|
+
)
|
|
846
|
+
)
|
|
847
|
+
);
|
|
848
|
+
this.g._free(p12Ptr, p12.length);
|
|
849
|
+
if (out.length === 0) {
|
|
850
|
+
throw new Error(
|
|
851
|
+
"PKCS#12 signing failed: invalid certificate, password, or unsupported file"
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
return out;
|
|
855
|
+
}
|
|
748
856
|
// metadata
|
|
749
857
|
getMetadata(key) {
|
|
750
858
|
return this.g._withStr(
|