From 57c4a3be98b3688c7911260b5255323c2ea188fa Mon Sep 17 00:00:00 2001 From: zboris12 Date: Tue, 11 Aug 2026 17:05:24 +0900 Subject: [PATCH] Resolve Google Closure Compiler warnings --- closure/forge-ext.js | 7 +++++++ lib/zgapdfsigner.js | 8 ++++---- package.json | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/closure/forge-ext.js b/closure/forge-ext.js index cb16390..8cd7dae 100644 --- a/closure/forge-ext.js +++ b/closure/forge-ext.js @@ -169,6 +169,8 @@ const forge_BigInteger = function(){}; * @return {number} */ forge_BigInteger.prototype.compareTo = function(a){}; +/** @return {number} */ +forge_BigInteger.prototype.bitLength = function(){}; /** @constructor */ const forge_cert = function(){}; /** @type {forge_key} */ @@ -195,6 +197,11 @@ const forge_key = function(){}; forge_key.prototype.n; /** @type {forge_BigInteger} */ forge_key.prototype.e; +/** + * @param {forge.md.digest} md + * @return {string} + */ +forge_key.prototype.sign = function(md){}; /** @constructor */ const forge_cert_issuer = function(){}; /** @type {Array} */ diff --git a/lib/zgapdfsigner.js b/lib/zgapdfsigner.js index f79e61b..59bf627 100644 --- a/lib/zgapdfsigner.js +++ b/lib/zgapdfsigner.js @@ -223,11 +223,11 @@ z.newRefs = new z.NewRefMap(); */ z.RsaSigner = class{ /** - * @param {forge.pki.rsa.PrivateKey} privateKey + * @param {forge_key} privateKey * @param {forge_cert} certificate */ constructor(privateKey, certificate){ - /** @type {forge.pki.rsa.PrivateKey} */ + /** @type {forge_key} */ this.privateKey = privateKey; /** @type {forge_cert} */ this.certificate = certificate; @@ -264,7 +264,7 @@ z.RsaSigner = class{ * supported; this factory is the single place to extend the seam with ECDSA * or post-quantum signers without touching the PDF assembly. * - * @param {forge.pki.rsa.PrivateKey} privateKey + * @param {forge_key} privateKey * @param {forge_cert} certificate * @return {z.RsaSigner} */ @@ -756,7 +756,7 @@ z.PdfSigner = class{ var hasMinRsaKeyBits = typeof _this.opt.minRsaKeyBits === "number"; if(strictCrypto || hasMinRsaKeyBits){ /** @type {number} */ - var minRsaKeyBits = hasMinRsaKeyBits ? _this.opt.minRsaKeyBits : 3000; + var minRsaKeyBits = hasMinRsaKeyBits ? /** @type {number} */(_this.opt.minRsaKeyBits) : 3000; /** @type {number} */ var rsaKeyBits = _this.privateKey.n.bitLength(); if(rsaKeyBits < minRsaKeyBits){ diff --git a/package.json b/package.json index 8a7d644..1854825 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "server": "node test4node.js webserver", "test": "node --test", "test:fixtures": "node testutil/make-demo.js", - "test:manual": "node test4node.js", + "test:manual": "node test4node.js ${pfxpwd}", "test:fetch": "node test4node.js fetch" }, "dependencies": {