@documenso/pdf-sign

中文文档
0.1.0发布于 2024/03/15AGPL-3.0TypeScriptCommonJS零依赖近 30 天下载 4543

这个软件包提供了使用各种签名方法签名PDF文件的功能,包括私人密钥,P12容器和Google Cloud. 其设计与多克门索站台相通.

中文使用文档
文档目录10 节
  1. 安装
  2. 使用量
  3. 用私人密钥签名
  4. 用P12集装箱签字
  5. 与 Google 云签名
  6. API 密码
  7. signWithPrivateKey(options)
  8. signWithP12(options)
  9. signWithGCloud(options)
  10. 许可证

@ documenso/pdf- sign(签名)

这个软件包提供了使用各种签名方法签名PDF文件的功能,包括私人密钥,P12容器和Google Cloud. 其设计与多克门索站台相通.

安装

要安装软件包, 请运行 :

npm install @documenso/pdf-sign

使用量

用私人密钥签名

const { signWithPrivateKey } = require('@documenso/pdf-sign');

const content = Buffer.from('...'); // PDF content
const cert = Buffer.from('...'); // Certificate in PEM format
const privateKey = Buffer.from('...'); // Private key in PEM format

const signedPdf = await signWithPrivateKey({
  content,
  cert,
  privateKey,
  // Optional fields
  signingTime: '2023-03-15T12:00:00Z', // ISO 8601 format
  timestampServer: 'http://timestamp.server',
});

用P12集装箱签字

const { signWithP12 } = require('@documenso/pdf-sign');

const content = Buffer.from('...'); // PDF content
const p12 = Buffer.from('...'); // P12 container

const signedPdf = await signWithP12({
  content,
  cert: p12,
  // Optional fields
  password: 'p12password',
  signingTime: '2023-03-15T12:00:00Z', // ISO 8601 format
  timestampServer: 'http://timestamp.server',
});

与 Google 云签名

const { signWithGCloud } = require('@documenso/pdf-sign');

const content = Buffer.from('...'); // PDF content
const cert = Buffer.from('...'); // Certificate in PEM format
const keyPath = 'projects/project-id/locations/global/keyRings/keyring-name/cryptoKeys/key-name';

const signedPdf = await signWithGCloud({
  content,
  cert,
  keyPath,
  // Optional fields
  signingTime: '2023-03-15T12:00:00Z', // ISO 8601 format
  timestampServer: 'http://timestamp.server',
});

API 密码

signWithPrivateKey(options)

  • options.content (Buffer):PDF内容待签名.
  • options.cert (Buffer):PEM格式的证书.
  • options.privateKey (Buffer):PEM格式的私钥.
  • options.signingTime (弦,可选): ISO 8601格式的签名时间.
  • options.timestampServer (弦,可选): 时间戳服务器的 URL .

返回一个包含 PDF 签名的缓冲器解答的保证 .

signWithP12(options)

  • options.content (Buffer):PDF内容待签名.
  • options.cert P12集装箱.
  • options.password (弦,可选): P12容器的密码.
  • options.signingTime (弦,可选): ISO 8601格式的签名时间.
  • options.timestampServer (弦,可选): 时间戳服务器的 URL .

返回一个包含 PDF 签名的缓冲器解答的保证 .

signWithGCloud(options)

  • options.content (Buffer):PDF内容待签名.
  • options.cert (Buffer):PEM格式的证书.
  • options.keyPath (字符串):谷歌云密钥路径.
  • options.signingTime (弦,可选): ISO 8601格式的签名时间.
  • options.timestampServer (弦,可选): 时间戳服务器的 URL .

返回一个包含 PDF 签名的缓冲器解答的保证 .

许可证

此软件包根据 AGPL-3.0 许可证。 。 。 .

版本与发布记录

@documenso/pdf-sign 共发布 1 个版本,首次发布于 2024/03/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.0latest2024/03/152 年前

关于 @documenso/pdf-sign 的常见问题

@documenso/pdf-sign 是什么?

这个软件包提供了使用各种签名方法签名PDF文件的功能,包括私人密钥,P12容器和Google Cloud. 其设计与多克门索站台相通.

如何安装 @documenso/pdf-sign?

在项目目录运行 npm install @documenso/pdf-sign,或使用 pnpm add / yarn add / bun add。

@documenso/pdf-sign 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@documenso/pdf-sign 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@documenso/pdf-sign 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 10。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@documenso/pdf-sign 可以商用吗?

@documenso/pdf-sign 使用 AGPL-3.0 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@documenso/pdf-sign 的下载量有多少?

根据 npm 官方下载统计,@documenso/pdf-sign 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,543 次,日均约 151 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@documenso/pdf-sign 还在维护吗?

最新版本 0.1.0 发布于 2024/03/15(2 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/03/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。