@libpdf/core 0.2.12 → 0.3.1

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/dist/index.d.mts CHANGED
@@ -1659,6 +1659,143 @@ declare class Operator {
1659
1659
  byteLength(): number;
1660
1660
  }
1661
1661
  //#endregion
1662
+ //#region src/fonts/font-descriptor.d.ts
1663
+ interface FontDescriptorData {
1664
+ fontName: string;
1665
+ flags: number;
1666
+ fontBBox: [number, number, number, number];
1667
+ italicAngle: number;
1668
+ ascent: number;
1669
+ descent: number;
1670
+ leading: number;
1671
+ capHeight: number;
1672
+ xHeight: number;
1673
+ stemV: number;
1674
+ stemH: number;
1675
+ avgWidth: number;
1676
+ maxWidth: number;
1677
+ missingWidth: number;
1678
+ }
1679
+ /**
1680
+ * FontDescriptor contains font metrics and flags.
1681
+ */
1682
+ declare class FontDescriptor {
1683
+ readonly fontName: string;
1684
+ readonly flags: number;
1685
+ readonly fontBBox: [number, number, number, number];
1686
+ readonly italicAngle: number;
1687
+ readonly ascent: number;
1688
+ readonly descent: number;
1689
+ readonly leading: number;
1690
+ readonly capHeight: number;
1691
+ readonly xHeight: number;
1692
+ readonly stemV: number;
1693
+ readonly stemH: number;
1694
+ readonly avgWidth: number;
1695
+ readonly maxWidth: number;
1696
+ readonly missingWidth: number;
1697
+ constructor(data: FontDescriptorData);
1698
+ /** Check if font is fixed-pitch (monospace) */
1699
+ get isFixedPitch(): boolean;
1700
+ /** Check if font is serif */
1701
+ get isSerif(): boolean;
1702
+ /** Check if font is symbolic (uses custom encoding) */
1703
+ get isSymbolic(): boolean;
1704
+ /** Check if font is script (cursive) */
1705
+ get isScript(): boolean;
1706
+ /** Check if font is non-symbolic (uses standard encoding) */
1707
+ get isNonSymbolic(): boolean;
1708
+ /** Check if font is italic */
1709
+ get isItalic(): boolean;
1710
+ /** Check if font is all caps */
1711
+ get isAllCap(): boolean;
1712
+ /** Check if font is small caps */
1713
+ get isSmallCap(): boolean;
1714
+ /** Check if font should be bold */
1715
+ get isForceBold(): boolean;
1716
+ /**
1717
+ * Parse FontDescriptor from a PDF dictionary.
1718
+ */
1719
+ static parse(dict: PdfDict): FontDescriptor;
1720
+ }
1721
+ //#endregion
1722
+ //#region src/fonts/font-program/base.d.ts
1723
+ /**
1724
+ * FontProgram - Interface bridging PDF fonts to fontbox font parsers.
1725
+ *
1726
+ * This provides a unified interface for accessing font data regardless
1727
+ * of the underlying font format (TrueType, CFF, Type1).
1728
+ */
1729
+ /**
1730
+ * Font program types that can be embedded in PDFs.
1731
+ */
1732
+ type FontProgramType = "truetype" | "cff" | "cff-cid" | "type1";
1733
+ /**
1734
+ * Common interface for all font program types.
1735
+ *
1736
+ * Provides access to metrics and glyph mapping without needing
1737
+ * to know the underlying font format.
1738
+ */
1739
+ interface FontProgram {
1740
+ /** Type of font program */
1741
+ readonly type: FontProgramType;
1742
+ /** Number of glyphs in the font */
1743
+ readonly numGlyphs: number;
1744
+ /** Units per em (typically 1000 for PostScript, 2048 for TrueType) */
1745
+ readonly unitsPerEm: number;
1746
+ /** Font bounding box [xMin, yMin, xMax, yMax] */
1747
+ readonly bbox: readonly [number, number, number, number];
1748
+ /** PostScript name of the font */
1749
+ readonly postScriptName: string | undefined;
1750
+ /** Family name */
1751
+ readonly familyName: string | undefined;
1752
+ /** Whether font is fixed-pitch (monospace) */
1753
+ readonly isFixedPitch: boolean;
1754
+ /** Italic angle in degrees */
1755
+ readonly italicAngle: number;
1756
+ /** Ascent in font units */
1757
+ readonly ascent: number;
1758
+ /** Descent in font units (typically negative) */
1759
+ readonly descent: number;
1760
+ /** Cap height in font units */
1761
+ readonly capHeight: number;
1762
+ /** x-height in font units */
1763
+ readonly xHeight: number;
1764
+ /** Stem vertical width (for hinting) */
1765
+ readonly stemV: number;
1766
+ /**
1767
+ * Get glyph ID for a Unicode code point.
1768
+ * Returns 0 (.notdef) if the character is not in the font.
1769
+ */
1770
+ getGlyphId(codePoint: number): number;
1771
+ /**
1772
+ * Get advance width for a glyph ID in font units.
1773
+ */
1774
+ getAdvanceWidth(glyphId: number): number;
1775
+ /**
1776
+ * Check if the font has a glyph for the given code point.
1777
+ */
1778
+ hasGlyph(codePoint: number): boolean;
1779
+ /**
1780
+ * Check if the font has renderable glyph outlines.
1781
+ *
1782
+ * Some PDF subsetted fonts are "crippled" — they contain glyph metrics
1783
+ * and cmap data but no actual outline data (0 contours for all glyphs).
1784
+ * These fonts are used only for text extraction and cannot render text.
1785
+ *
1786
+ * Returns true if at least some common glyphs have actual outline data.
1787
+ */
1788
+ hasRenderableGlyphs(): boolean;
1789
+ /**
1790
+ * Check if a specific glyph has renderable outlines or charstring data.
1791
+ */
1792
+ hasRenderableGlyph(glyphId: number): boolean;
1793
+ /**
1794
+ * Get the raw font data.
1795
+ */
1796
+ getData(): Uint8Array;
1797
+ }
1798
+ //#endregion
1662
1799
  //#region src/io/binary-scanner.d.ts
1663
1800
  /**
1664
1801
  * Scanner extended with big-endian binary reading methods.
@@ -2461,127 +2598,181 @@ declare class TrueTypeFont implements TrueTypeFontAccess {
2461
2598
  private parseTable;
2462
2599
  }
2463
2600
  //#endregion
2464
- //#region src/fonts/font-descriptor.d.ts
2465
- interface FontDescriptorData {
2466
- fontName: string;
2467
- flags: number;
2468
- fontBBox: [number, number, number, number];
2469
- italicAngle: number;
2470
- ascent: number;
2471
- descent: number;
2472
- leading: number;
2473
- capHeight: number;
2474
- xHeight: number;
2475
- stemV: number;
2476
- stemH: number;
2477
- avgWidth: number;
2478
- maxWidth: number;
2479
- missingWidth: number;
2480
- }
2601
+ //#region src/fonts/to-unicode.d.ts
2481
2602
  /**
2482
- * FontDescriptor contains font metrics and flags.
2603
+ * ToUnicode CMap parser for text extraction.
2604
+ *
2605
+ * ToUnicode CMaps map character codes to Unicode strings, enabling
2606
+ * text extraction from PDF content streams.
2607
+ *
2608
+ * Format (from PDF spec):
2609
+ * - beginbfchar/endbfchar: Individual character mappings
2610
+ * <srcCode> <dstString>
2611
+ *
2612
+ * - beginbfrange/endbfrange: Range mappings
2613
+ * <srcCodeLo> <srcCodeHi> <dstString> - incrementing range
2614
+ * <srcCodeLo> <srcCodeHi> [<dst1> <dst2> ...] - array of destinations
2483
2615
  */
2484
- declare class FontDescriptor {
2485
- readonly fontName: string;
2486
- readonly flags: number;
2487
- readonly fontBBox: [number, number, number, number];
2488
- readonly italicAngle: number;
2489
- readonly ascent: number;
2490
- readonly descent: number;
2491
- readonly leading: number;
2492
- readonly capHeight: number;
2493
- readonly xHeight: number;
2494
- readonly stemV: number;
2495
- readonly stemH: number;
2496
- readonly avgWidth: number;
2497
- readonly maxWidth: number;
2498
- readonly missingWidth: number;
2499
- constructor(data: FontDescriptorData);
2500
- /** Check if font is fixed-pitch (monospace) */
2501
- get isFixedPitch(): boolean;
2502
- /** Check if font is serif */
2503
- get isSerif(): boolean;
2504
- /** Check if font is symbolic (uses custom encoding) */
2505
- get isSymbolic(): boolean;
2506
- /** Check if font is script (cursive) */
2507
- get isScript(): boolean;
2508
- /** Check if font is non-symbolic (uses standard encoding) */
2509
- get isNonSymbolic(): boolean;
2510
- /** Check if font is italic */
2511
- get isItalic(): boolean;
2512
- /** Check if font is all caps */
2513
- get isAllCap(): boolean;
2514
- /** Check if font is small caps */
2515
- get isSmallCap(): boolean;
2516
- /** Check if font should be bold */
2517
- get isForceBold(): boolean;
2616
+ /**
2617
+ * ToUnicode map for converting character codes to Unicode strings.
2618
+ */
2619
+ declare class ToUnicodeMap {
2620
+ private readonly map;
2621
+ constructor(map?: Map<number, string>);
2518
2622
  /**
2519
- * Parse FontDescriptor from a PDF dictionary.
2623
+ * Get the Unicode string for a character code.
2520
2624
  */
2521
- static parse(dict: PdfDict): FontDescriptor;
2625
+ get(code: number): string | undefined;
2626
+ /**
2627
+ * Check if a character code has a mapping.
2628
+ */
2629
+ has(code: number): boolean;
2630
+ /**
2631
+ * Set a mapping from character code to Unicode string.
2632
+ */
2633
+ set(code: number, unicode: string): void;
2634
+ /**
2635
+ * Get the number of mappings.
2636
+ */
2637
+ get size(): number;
2638
+ /**
2639
+ * Iterate over all mappings.
2640
+ */
2641
+ forEach(callback: (unicode: string, code: number) => void): void;
2642
+ /**
2643
+ * Get the underlying map (for advanced use).
2644
+ */
2645
+ getMap(): Map<number, string>;
2522
2646
  }
2523
2647
  //#endregion
2524
- //#region src/fonts/font-program/base.d.ts
2648
+ //#region src/fonts/cid-font.d.ts
2649
+ type CIDFontSubtype = "CIDFontType0" | "CIDFontType2";
2525
2650
  /**
2526
- * FontProgram - Interface bridging PDF fonts to fontbox font parsers.
2527
- *
2528
- * This provides a unified interface for accessing font data regardless
2529
- * of the underlying font format (TrueType, CFF, Type1).
2651
+ * CID System Info describes the character collection.
2530
2652
  */
2653
+ interface CIDSystemInfo {
2654
+ registry: string;
2655
+ ordering: string;
2656
+ supplement: number;
2657
+ }
2531
2658
  /**
2532
- * Font program types that can be embedded in PDFs.
2659
+ * CIDFont handles CID-keyed fonts (descendants of Type0).
2533
2660
  */
2534
- type FontProgramType = "truetype" | "cff" | "cff-cid" | "type1";
2661
+ declare class CIDFont {
2662
+ /** Font subtype (CIDFontType0 = CFF, CIDFontType2 = TrueType) */
2663
+ readonly subtype: CIDFontSubtype;
2664
+ /** Base font name */
2665
+ readonly baseFontName: string;
2666
+ /** CID System Info */
2667
+ readonly cidSystemInfo: CIDSystemInfo;
2668
+ /** Font descriptor with metrics */
2669
+ readonly descriptor: FontDescriptor | null;
2670
+ /** Default width for CIDs not in /W array */
2671
+ readonly defaultWidth: number;
2672
+ /** Width map from /W array */
2673
+ private readonly widths;
2674
+ /** CID to GID mapping (null = Identity, Uint16Array = explicit map) */
2675
+ private readonly cidToGidMap;
2676
+ /** Inverse CID to GID map: GID → CID (built lazily for stream-based maps) */
2677
+ private gidToCidMap;
2678
+ /** Embedded font program (if available) */
2679
+ private readonly embeddedProgram;
2680
+ /** ToUnicode map from the parent Type0 font, if available */
2681
+ private readonly toUnicodeMap;
2682
+ /** Reverse ToUnicode map: Unicode code point -> character code */
2683
+ private unicodeToCharCodeMap;
2684
+ constructor(options: {
2685
+ subtype: CIDFontSubtype;
2686
+ baseFontName: string;
2687
+ cidSystemInfo?: CIDSystemInfo;
2688
+ descriptor?: FontDescriptor | null;
2689
+ defaultWidth?: number;
2690
+ widths?: CIDWidthMap;
2691
+ cidToGidMap?: "Identity" | Uint16Array | null;
2692
+ embeddedProgram?: FontProgram | null;
2693
+ toUnicodeMap?: ToUnicodeMap | null;
2694
+ });
2695
+ /**
2696
+ * Check if an embedded font program is available.
2697
+ */
2698
+ get hasEmbeddedProgram(): boolean;
2699
+ /**
2700
+ * Check if the embedded font program has renderable glyph outlines.
2701
+ *
2702
+ * Some PDFs embed fonts with metrics and cmap data but stripped outlines.
2703
+ * These fonts are usable for text extraction but cannot render new text.
2704
+ */
2705
+ get hasRenderableGlyphs(): boolean;
2706
+ /**
2707
+ * Check whether the embedded program can render a glyph for the given CID.
2708
+ */
2709
+ hasRenderableGlyphForCID(cid: number): boolean;
2710
+ /**
2711
+ * Get the embedded font program, if available.
2712
+ */
2713
+ getEmbeddedProgram(): FontProgram | null;
2714
+ /**
2715
+ * Get width for a CID in glyph units (1000 = 1 em).
2716
+ */
2717
+ getWidth(cid: number): number;
2718
+ /**
2719
+ * Get GID (glyph index) for a CID.
2720
+ * Used when accessing embedded font data.
2721
+ */
2722
+ getGid(cid: number): number;
2723
+ /**
2724
+ * Whether the CIDToGIDMap is Identity (or absent, which defaults to Identity).
2725
+ */
2726
+ get isIdentityCidToGid(): boolean;
2727
+ /**
2728
+ * Get the character code (= CID for Identity-H) to write in a PDF string
2729
+ * for a given Unicode code point.
2730
+ *
2731
+ * The encoding pipeline for Identity-H is:
2732
+ * character code (in PDF string) = CID (because Identity-H maps 1:1)
2733
+ * CID → GID (via CIDToGIDMap)
2734
+ * GID → glyph in font file
2735
+ *
2736
+ * We need to find the character code such that after the CIDToGIDMap
2737
+ * transformation, we get the GID corresponding to the desired Unicode
2738
+ * character in the embedded font program.
2739
+ *
2740
+ * For Identity CIDToGIDMap: charCode = CID = GID = fontProgram.getGlyphId(unicode)
2741
+ * For stream CIDToGIDMap: charCode = CID where CIDToGIDMap[CID] = desired GID
2742
+ */
2743
+ getCharCodeForUnicode(unicode: number): number;
2744
+ /**
2745
+ * Try to resolve the character code (= CID for Identity-H) for a Unicode
2746
+ * code point. Returns null when the mapping cannot be proven.
2747
+ */
2748
+ tryGetCharCodeForUnicode(unicode: number): number | null;
2749
+ private getCharCodeForGid;
2750
+ }
2535
2751
  /**
2536
- * Common interface for all font program types.
2537
- *
2538
- * Provides access to metrics and glyph mapping without needing
2539
- * to know the underlying font format.
2752
+ * Efficient storage for CID width mappings.
2753
+ * Handles the complex /W array format from PDF.
2540
2754
  */
2541
- interface FontProgram {
2542
- /** Type of font program */
2543
- readonly type: FontProgramType;
2544
- /** Number of glyphs in the font */
2545
- readonly numGlyphs: number;
2546
- /** Units per em (typically 1000 for PostScript, 2048 for TrueType) */
2547
- readonly unitsPerEm: number;
2548
- /** Font bounding box [xMin, yMin, xMax, yMax] */
2549
- readonly bbox: readonly [number, number, number, number];
2550
- /** PostScript name of the font */
2551
- readonly postScriptName: string | undefined;
2552
- /** Family name */
2553
- readonly familyName: string | undefined;
2554
- /** Whether font is fixed-pitch (monospace) */
2555
- readonly isFixedPitch: boolean;
2556
- /** Italic angle in degrees */
2557
- readonly italicAngle: number;
2558
- /** Ascent in font units */
2559
- readonly ascent: number;
2560
- /** Descent in font units (typically negative) */
2561
- readonly descent: number;
2562
- /** Cap height in font units */
2563
- readonly capHeight: number;
2564
- /** x-height in font units */
2565
- readonly xHeight: number;
2566
- /** Stem vertical width (for hinting) */
2567
- readonly stemV: number;
2755
+ declare class CIDWidthMap {
2756
+ /** Individual CID -> width mappings */
2757
+ private readonly individual;
2758
+ /** Range mappings: all CIDs in range have same width */
2759
+ private readonly ranges;
2568
2760
  /**
2569
- * Get glyph ID for a Unicode code point.
2570
- * Returns 0 (.notdef) if the character is not in the font.
2761
+ * Get width for a CID.
2571
2762
  */
2572
- getGlyphId(codePoint: number): number;
2763
+ get(cid: number): number | undefined;
2573
2764
  /**
2574
- * Get advance width for a glyph ID in font units.
2765
+ * Set width for a single CID.
2575
2766
  */
2576
- getAdvanceWidth(glyphId: number): number;
2767
+ set(cid: number, width: number): void;
2577
2768
  /**
2578
- * Check if the font has a glyph for the given code point.
2769
+ * Add a range where all CIDs have the same width.
2579
2770
  */
2580
- hasGlyph(codePoint: number): boolean;
2771
+ addRange(start: number, end: number, width: number): void;
2581
2772
  /**
2582
- * Get the raw font data.
2773
+ * Get the number of individual mappings.
2583
2774
  */
2584
- getData(): Uint8Array;
2775
+ get size(): number;
2585
2776
  }
2586
2777
  //#endregion
2587
2778
  //#region src/fonts/pdf-font.d.ts
@@ -2922,53 +3113,6 @@ interface FontEncoding {
2922
3113
  getCode(unicode: number): number | undefined;
2923
3114
  }
2924
3115
  //#endregion
2925
- //#region src/fonts/to-unicode.d.ts
2926
- /**
2927
- * ToUnicode CMap parser for text extraction.
2928
- *
2929
- * ToUnicode CMaps map character codes to Unicode strings, enabling
2930
- * text extraction from PDF content streams.
2931
- *
2932
- * Format (from PDF spec):
2933
- * - beginbfchar/endbfchar: Individual character mappings
2934
- * <srcCode> <dstString>
2935
- *
2936
- * - beginbfrange/endbfrange: Range mappings
2937
- * <srcCodeLo> <srcCodeHi> <dstString> - incrementing range
2938
- * <srcCodeLo> <srcCodeHi> [<dst1> <dst2> ...] - array of destinations
2939
- */
2940
- /**
2941
- * ToUnicode map for converting character codes to Unicode strings.
2942
- */
2943
- declare class ToUnicodeMap {
2944
- private readonly map;
2945
- constructor(map?: Map<number, string>);
2946
- /**
2947
- * Get the Unicode string for a character code.
2948
- */
2949
- get(code: number): string | undefined;
2950
- /**
2951
- * Check if a character code has a mapping.
2952
- */
2953
- has(code: number): boolean;
2954
- /**
2955
- * Set a mapping from character code to Unicode string.
2956
- */
2957
- set(code: number, unicode: string): void;
2958
- /**
2959
- * Get the number of mappings.
2960
- */
2961
- get size(): number;
2962
- /**
2963
- * Iterate over all mappings.
2964
- */
2965
- forEach(callback: (unicode: string, code: number) => void): void;
2966
- /**
2967
- * Get the underlying map (for advanced use).
2968
- */
2969
- getMap(): Map<number, string>;
2970
- }
2971
- //#endregion
2972
3116
  //#region src/fonts/simple-font.d.ts
2973
3117
  type SimpleFontSubtype = "TrueType" | "Type1" | "Type3" | "MMType1";
2974
3118
  /**
@@ -3059,31 +3203,60 @@ type FormFont = EmbeddedFont | ExistingFont;
3059
3203
  * This is a lightweight wrapper for fonts already present in the PDF,
3060
3204
  * typically from the AcroForm's /DR (Default Resources) dictionary.
3061
3205
  *
3062
- * Provides limited metrics based on Standard 14 font data for common fonts.
3206
+ * Supports both simple fonts (Type1, TrueType) and CID fonts (Type0).
3207
+ * CID fonts use 2-byte character codes and are commonly used with
3208
+ * Identity-H/Identity-V encoding for CJK and Unicode text.
3063
3209
  */
3064
3210
  declare class ExistingFont {
3065
- /** Font name as it appears in the PDF (e.g., "Helv", "ZaDb") */
3211
+ /** Font name as it appears in the PDF (e.g., "Helv", "ZaDb", "F0") */
3066
3212
  readonly name: string;
3067
3213
  /** Reference to font object in PDF (may be null for inline Standard 14 fonts) */
3068
3214
  readonly ref: PdfRef | null;
3069
- /** Underlying SimpleFont if resolved from PDF */
3215
+ /** Whether this is a CID-keyed font (Type0 with Identity-H/V encoding) */
3216
+ readonly isCIDFont: boolean;
3217
+ /** Underlying SimpleFont if resolved from PDF (for non-CID fonts) */
3070
3218
  private readonly simpleFont;
3219
+ /** Underlying CIDFont if resolved from PDF (for CID fonts) */
3220
+ private readonly cidFont;
3071
3221
  /** Standard 14 font name if this maps to one (e.g., "Helvetica" for "Helv") */
3072
3222
  private readonly standardFontName;
3073
- constructor(name: string, ref: PdfRef | null, simpleFont?: SimpleFont | null);
3223
+ constructor(name: string, ref: PdfRef | null, simpleFont?: SimpleFont | null, isCIDFont?: boolean, cidFont?: CIDFont | null);
3224
+ /**
3225
+ * Check whether this font can be safely used to generate an appearance for
3226
+ * the given text.
3227
+ */
3228
+ canUseForAppearance(text: string): boolean;
3074
3229
  /**
3075
3230
  * Check if font can encode the given text.
3076
3231
  *
3077
- * For existing fonts, this is always true for ASCII text.
3078
- * For non-ASCII, returns false (can't verify without full font data).
3232
+ * CID fonts with Identity-H/V encoding can encode any BMP character.
3233
+ * Simple fonts are limited to their encoding (typically Latin-1).
3079
3234
  */
3080
3235
  canEncode(text: string): boolean;
3081
3236
  /**
3082
3237
  * Encode text to character codes for this font.
3083
3238
  *
3084
- * For existing fonts, uses WinAnsi encoding (0-255).
3239
+ * For CID fonts: returns 2-byte Unicode code points (Identity-H/V encoding).
3240
+ * For simple fonts: uses the font's encoding (WinAnsi, custom, etc.).
3085
3241
  */
3086
3242
  encodeText(text: string): number[];
3243
+ /**
3244
+ * Encode text as bytes for use in a PdfString.
3245
+ *
3246
+ * For CID fonts with Identity-H/V encoding, the character codes in the
3247
+ * PDF string are CIDs. With Identity CIDToGIDMap, CID = GID, so the
3248
+ * character code must equal the glyph ID in the font program.
3249
+ *
3250
+ * The encoding pipeline is:
3251
+ * Unicode code point → GID (via font program cmap)
3252
+ * → character code to write (= CID that maps to that GID)
3253
+ *
3254
+ * For Identity CIDToGIDMap: write GID directly (CID = GID)
3255
+ * For stream CIDToGIDMap: find CID where CIDToGIDMap[CID] = GID
3256
+ *
3257
+ * For simple fonts, produces single-byte codes.
3258
+ */
3259
+ encodeTextToBytes(text: string): Uint8Array;
3087
3260
  /**
3088
3261
  * Get width of text in points at a given font size.
3089
3262
  */
@@ -3100,6 +3273,10 @@ declare class ExistingFont {
3100
3273
  * Get cap height in points at a given font size.
3101
3274
  */
3102
3275
  getCapHeight(fontSize: number): number;
3276
+ /**
3277
+ * Look up a font metric from the descriptor, Standard 14 tables, or a fallback ratio.
3278
+ */
3279
+ private getMetric;
3103
3280
  }
3104
3281
  //#endregion
3105
3282
  //#region src/document/forms/widget-annotation.d.ts
@@ -10178,6 +10355,8 @@ declare class CryptoKeySigner implements Signer {
10178
10355
  //#region src/signatures/signers/google-kms.d.ts
10179
10356
  /** KMS client type - dynamically imported */
10180
10357
  type KeyManagementServiceClient = _google_cloud_kms0.KeyManagementServiceClient;
10358
+ /** Subset of methods actually used for signing */
10359
+ type KmsClient = Pick<KeyManagementServiceClient, "asymmetricSign" | "getCryptoKeyVersion" | "getPublicKey">;
10181
10360
  /** Secret Manager client type - dynamically imported */
10182
10361
  type SecretManagerServiceClient = _google_cloud_secret_manager0.SecretManagerServiceClient;
10183
10362
  /** Base options shared by both key reference styles */
@@ -10191,7 +10370,7 @@ interface GoogleKmsSignerBaseOptions {
10191
10370
  /** Timeout for AIA chain building in ms (default: 15000) */
10192
10371
  chainTimeout?: number;
10193
10372
  /** Pre-configured KMS client (optional, uses ADC if not provided) */
10194
- client?: KeyManagementServiceClient;
10373
+ client?: KmsClient;
10195
10374
  }
10196
10375
  /** Full resource name style */
10197
10376
  interface GoogleKmsSignerFullNameOptions extends GoogleKmsSignerBaseOptions {
@@ -10329,6 +10508,8 @@ declare class GoogleKmsSigner implements Signer {
10329
10508
  /**
10330
10509
  * Hash data using the specified algorithm.
10331
10510
  *
10511
+ * Uses the Web Crypto API for native-speed hashing.
10512
+ *
10332
10513
  * @returns The digest bytes and the KMS digest key name
10333
10514
  */
10334
10515
  private hashData;