Sign JWTs from your Functions without managing private keys

Vercel KMS lets you sign JWTs and arbitrary messages from your Vercel Functions using managed asymmetric signing keys, so private keys never live in your code or environment variables. Your function authenticates with its Vercel OIDC token, and the private key stays inside Vercel's key management service while verifiers use only the public key.

With Vercel KMS you can:

  • Create and rotate issuers and signing keys (RSA, ECDSA, and EdDSA) from the CLI and dashboard.
  • Sign JWTs with custom claims and a configurable TTL, or sign raw bytes, using the @vercel/kms package.
  • Grant a project signing access per environment, including production, preview, development, and custom environments.
  • Constrain the claims a project can request per grant, and validate token claims against a JSON Schema.
  • Verify signed tokens anywhere. Each issuer publishes a public OpenID Connect Discovery document at https://kms.vercel.com//.well-known/openid-configuration and a JWK set at https://kms.vercel.com//jwks.json, so any standard OIDC or JOSE library can validate tokens without Vercel-specific code.

Sign a token inside a function:

Verify a token anywhere with a standard JOSE library, using the issuer's public JWKS:

Set up an issuer and grant a project access from the CLI:

As a best practice, create a separate issuer per project and environment. Isolating issuers keeps each token audience distinct, scopes signing access to exactly one project and environment, and lets you rotate or revoke keys for one without affecting the others.

To get started, read the docs or open Key Management in your team's dashboard.

Read more

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论