New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

convex-secret-manager

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convex-secret-manager

Convex component for encrypted secret vaults and issued API key lifecycle

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

convex-secret-manager

Convex component for encrypted secret vaults and issued API key lifecycle.

Combines the roles of gaganref/convex-secret-store and gaganref/convex-api-keys into one package with per-ownerId tenancy. Any Convex app can use it (SaaS orgs, agents, multi-tenant backends).

Two modules

ModuleUse
VaultStore user-supplied credentials (OpenAI, Venice, webhooks) encrypted at rest
Issued keysIssue sm_ machine tokens with hash-only storage, refresh, revoke, and audit

vs gaganref

gaganref (2 packages)convex-secret-manager
Path modelnamespace + nameownerId + namespace + name
Use caseGeneric appsMulti-tenant backends that issue keys too
InstallTwo componentsOne component
Vault cryptoEnvelope + KEK rotationEnvelope (defineKeys) + legacy single-key
Issued validateQuery (side-effect free)Query
SweepsHourly cronsHourly crons (built-in)

Use gaganref when you need only one concern. Use this package when one owner should hold both third-party credentials and issued machine tokens.

Install

npm install convex-secret-manager
// convex/convex.config.ts
import { defineApp } from "convex/server";
import { v } from "convex/values";
import { defineKeys } from "convex-secret-manager";
import secretManager from "convex-secret-manager/convex.config.js";

const app = defineApp({
  env: {
    MY_APP_KEK_V1: v.string(),
  },
});

app.use(secretManager, {
  env: {
    SECRET_MANAGER_KEYS: defineKeys({
      1: process.env.MY_APP_KEK_V1!,
    }),
  },
});

export default app;
// convex/secrets.ts
import { SecretManager } from "convex-secret-manager";
import { components } from "./_generated/api.js";

export const secretManager = new SecretManager(components.secretManager);

Set on the Convex deployment:

SECRET_MANAGER_KEYS=1:<kek-material>
# or legacy single key:
SECRET_MANAGER_ENCRYPTION_KEY=...

Vault paths

ownerId   = orgId | userId | deployment
namespace = providers | integrations | webhooks
name      = openai.apiKey

Issued keys API (parity highlights)

  • issued.create / validate (query) / touch / revoke / revokeAll
  • issued.refresh — rotate with grace period
  • issued.update / getKey / list (paginated + effectiveStatus)
  • Hourly sweep crons for expired and idle keys
  • cleanupKeys / cleanupEvents internal jobs

Vault API (parity highlights)

  • vault.putPlaintext — component-side envelope encryption with AAD
  • vault.getResult — { ok, value } | { ok: false, reason }
  • vault.update — metadata/TTL without re-encrypt
  • vault.list — paginated with effectiveState
  • auditEvents.listEvents — paginated audit trail
  • vaultRotate.rotate / isRotationComplete — KEK rotation drain
  • vaultCleanup.cleanupSecrets — expired secret cleanup

Example

See example/ for a minimal Convex + Vite dashboard.

License

MIT

Keywords

convex

FAQs

Package last updated on 11 Sep 2026

Related posts