Open
Conversation
Adds an `AwsKmsSigner` alongside `GoogleKmsSigner` for signing PDFs with
keys stored in AWS Key Management Service, including HSM-backed keys.
The private key never leaves KMS — only the digest is sent for signing.
Mirrors the GoogleKmsSigner shape:
- `AwsKmsSigner.create({ keyId, region?, certificate, ... })`
- `AwsKmsSigner.getCertificateFromSecretsManager(secretId, options?)`
- Same `Signer` interface, same cert/SPKI validation, same AIA chain
building, same internal error mapping (adapted from gRPC → AWS SDK
service exception names).
Differences from Google's API:
- AWS KMS keys can support multiple signing algorithms per key
(RSA_2048 → PKCS1_V1_5_SHA_{256,384,512} + PSS_SHA_{256,384,512}).
`AwsKmsSigner.create()` reads `SigningAlgorithms` from GetPublicKey
and picks the first one unless the caller passes
`signingAlgorithm` explicitly.
- AWS SDK credentials resolve via the default chain (IAM role, env
vars, instance profile) — no equivalent of
`GOOGLE_APPLICATION_CREDENTIALS` handling is needed.
Adds `@aws-sdk/client-kms` and `@aws-sdk/client-secrets-manager` as
optional peer dependencies (mirrors the `@google-cloud/*` peer-dep
pattern). Unit tests cover algorithm mapping and the RSA-PSS predicate.
Validated end-to-end in a downstream consumer (Documenso): generated a
self-signed cert against an AWS KMS key, signed a PDF, verified the
embedded PKCS#7 CMS signature against the KMS public key via
`openssl cms -verify -binary`.
Contributor
|
@JKapostins is attempting to deploy a commit to the mythie's projects Team on Vercel. A member of the Team first needs to authorize it. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
AwsKmsSigneralongside the existingGoogleKmsSignerfor signing PDFs with asymmetric keys stored in AWS Key Management Service, including FIPS 140-2-validated HSM-backed keys. The private key never leaves KMS — only the digest is sent for signing.Why
Downstream consumers that run on AWS have been forced to stand up a separate GCP project just for signing-key storage. Since the CA/Browser Forum's June 2023 rules, AATL CAs require FIPS-HSM-backed keys — so
P12Signeralone isn't enough for AATL-trusted signatures in production. This unblocks the AWS-native path.Scope
Mirrors
GoogleKmsSignerexactly:AwsKmsSigner.create({ keyId, region?, certificate, certificateChain?, buildChain?, chainTimeout?, client?, signingAlgorithm? })AwsKmsSigner.getCertificateFromSecretsManager(secretId, options?)Signerinterface, same cert/SPKI validation (pkijs+asn1js, via the existing#src/helpers/*)buildCertificateChain(opt-inbuildChain)ERR_MODULE_NOT_FOUND→KmsSignerErrorguidanceNotFoundException,AccessDeniedException,DisabledException,KMSInvalidStateException,ResourceNotFoundException)Differences from GoogleKmsSigner
RSA_2048→RSASSA_PKCS1_V1_5_SHA_{256,384,512}+RSASSA_PSS_SHA_{256,384,512}).create()readsSigningAlgorithmsfromGetPublicKeyand picks the first one unless the caller passessigningAlgorithmexplicitly. GCP's per-key-version algorithm is single-valued so this nuance doesn't apply there.AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/role metadata from the default chain directly — noGOOGLE_APPLICATION_CREDENTIALS_CONTENTS-style base64 tempfile writing is needed.Files
src/signatures/signers/aws-kms.ts(class + helpers)src/signatures/signers/aws-kms.test.ts(16 unit tests — algorithm mapping +isRsaPsspredicate, matches thegoogle-kms.test.tspattern)content/docs/guides/signatures/aws-kms.mdx(setup guide mirroringgoogle-kms.mdx)src/signatures/signers/index.ts,src/signatures/index.ts,src/index.ts— add theAwsKmsSignerexportpackage.json—@aws-sdk/client-kms+@aws-sdk/client-secrets-manageradded as optional peer dependencies (same pattern as the@google-cloud/*peers)content/docs/guides/signatures/index.mdx,meta.json— link the new pageTesting
bun run typecheck— cleanbun run lint— clean (the 4 pre-existing warnings are unchanged)bun run test:run src/signatures/signers/— 65 tests pass (16 new, 37 google-kms, 12 crypto-key)bun run build— produces a valid dist bundle@libpdf/core+ this class. Created an RSA 2048 asymmetric KMS key, generated a self-signed cert against it (signing the CSR via KMS), signed a PDF end-to-end. Verified the embedded PKCS#7 CMS signature against the KMS public key withopenssl cms -verify -binary→ "CMS Verification successful".Happy to split into smaller PRs or iterate on the API shape if preferred.