@happyvertical/smrt-secrets 0.35.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/TenantKey-DzglnpAV.js.map +1 -1
- package/dist/manifest.json +2 -2
- package/dist/models/Secret.d.ts +20 -2
- package/dist/models/Secret.d.ts.map +1 -1
- package/dist/models/SecretAuditLog.d.ts +17 -2
- package/dist/models/SecretAuditLog.d.ts.map +1 -1
- package/dist/models/TenantKey.d.ts +16 -2
- package/dist/models/TenantKey.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +4 -4
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TenantKey-DzglnpAV.js","sources":["../../src/__smrt-register__.ts","../../src/models/SecretAuditLog.ts","../../src/models/Secret.ts","../../src/models/TenantKey.ts"],"sourcesContent":["/**\n * Self-registers this package's build-time manifest before any @smrt() decorator\n * in the package fires. Fixes issue #1132: in consumer runtimes (tsx, SvelteKit\n * SSR, plain `vite dev`) the decorator's synchronous manifest lookup previously\n * missed because no step populated the global manifest cache — classes got\n * registered with zero fields and `save()` / `toJSON()` silently dropped every\n * declared property.\n *\n * Import this module as the first statement in `src/index.ts` so its top-level\n * side effect runs ahead of any class module's @smrt() decorator.\n *\n * Silent no-op in dev/test, where the vitest plugin already populates manifests\n * via a different path. Only needs to succeed in the published dist output.\n *\n * @see https://github.com/happyvertical/smrt/issues/1132\n */\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\n// `new URL('./manifest.json', import.meta.url)` resolves at runtime to the\n// manifest sitting next to this module's compiled output. Vite warns at build\n// time that it cannot pre-resolve the URL; that is the intended behavior —\n// the URL must resolve to dist/manifest.json at runtime, not be inlined.\nObjectRegistry.registerPackageManifest(\n new URL('./manifest.json', import.meta.url),\n);\n","/**\n * SecretAuditLog model - Audit trail for secret operations\n * @packageDocumentation\n */\n\nimport type { SmrtCreateInput } from '@happyvertical/smrt-core';\nimport {\n crossPackageRef,\n foreignKey,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\n\n/**\n * Secret audit action types\n */\nexport type SecretAuditAction =\n | 'create'\n | 'read'\n | 'update'\n | 'delete'\n | 'rotate_key'\n | 'disable'\n | 'enable'\n | 'expire';\n\n/**\n * Audit result types\n */\nexport type SecretAuditResult = 'success' | 'failure' | 'denied';\n\n/**\n * SecretAuditLog records all operations on secrets for compliance\n * and security monitoring.\n *\n * Every secret operation (create, read, update, delete, key rotation)\n * is logged with the user, action, result, and relevant details.\n *\n * **Retention**: Audit logs should be retained according to your\n * compliance requirements (typically 1-7 years).\n *\n * @example\n * ```typescript\n * // Query recent audit logs\n * const logs = await auditLogs.list({\n * where: { tenantId: 'tenant-123' },\n * orderBy: 'created_at DESC',\n * limit: 100\n * });\n *\n * // Filter by action\n * const reads = await auditLogs.list({\n * where: {\n * tenantId: 'tenant-123',\n * action: 'read'\n * }\n * });\n *\n * // Filter by secret name\n * const apiKeyLogs = await auditLogs.list({\n * where: {\n * tenantId: 'tenant-123',\n * secretName: 'stripe-api-key'\n * }\n * });\n * ```\n */\n// Intentional exception to standards.md §7 (`@TenantScoped({ mode: 'optional' })`):\n// `SecretAuditLog` uses the inline `tenantScoped: true` form on `@smrt()` rather than\n// the dedicated `@TenantScoped` decorator. Audit-trail queries are read-mostly and run\n// in mixed contexts — under a tenant for tenant-scoped reports, and (prospectively)\n// under super-admin bypass for compliance review. Cross-tenant audit queries should\n// be wrapped in `withSuperAdminBypass()` from `@happyvertical/smrt-tenancy` at the\n// call site; this package has no such call sites today, so the pattern is\n// prescriptive guidance for compliance tooling rather than current practice. See\n// `packages/secrets/CLAUDE.md` \"Known exceptions to monorepo standards\" for context.\n@smrt({\n tenantScoped: true,\n api: { include: [] }, // No API exposure\n mcp: { include: [] }, // No MCP exposure\n // CLI runs in-process for compliance review; HTTP exposure is intentionally\n // excluded, so skipApiCheck acknowledges the cli.include / api.include divergence.\n cli: { include: ['list'], skipApiCheck: true },\n})\nexport class SecretAuditLog extends SmrtObject {\n /**\n * Tenant associated with the audited secret operation.\n */\n tenantId: string | null = null;\n\n /**\n * ID of the secret (may be null for deleted secrets)\n */\n @foreignKey('Secret')\n secretId: string | null = null;\n\n /**\n * Name of the secret at the time of the operation\n */\n secretName: string = '';\n\n /**\n * ID of the user who performed the action\n */\n @crossPackageRef('@happyvertical/smrt-users:User')\n userId: string = '';\n\n /**\n * The action that was performed\n */\n action: SecretAuditAction = 'read';\n\n /**\n * Result of the operation\n */\n result: SecretAuditResult = 'success';\n\n /**\n * IP address of the client (if available)\n */\n ipAddress: string = '';\n\n /**\n * User agent string (if available)\n */\n userAgent: string = '';\n\n /**\n * Additional context about the operation\n */\n details: Record<string, unknown> = {};\n\n constructor(options: any = {}) {\n super(options);\n if (options.tenantId !== undefined) {\n this.tenantId = options.tenantId;\n }\n if (options.secretId !== undefined) this.secretId = options.secretId;\n if (options.secretName !== undefined) this.secretName = options.secretName;\n if (options.userId !== undefined) this.userId = options.userId;\n if (options.action !== undefined) this.action = options.action;\n if (options.result !== undefined) this.result = options.result;\n if (options.ipAddress !== undefined) this.ipAddress = options.ipAddress;\n if (options.userAgent !== undefined) this.userAgent = options.userAgent;\n if (options.details !== undefined) this.details = options.details;\n }\n\n /**\n * Check if this was a successful operation\n */\n isSuccess(): boolean {\n return this.result === 'success';\n }\n\n /**\n * Check if this was a failed operation\n */\n isFailure(): boolean {\n return this.result === 'failure';\n }\n\n /**\n * Check if this was a denied operation (permission denied)\n */\n isDenied(): boolean {\n return this.result === 'denied';\n }\n\n /**\n * Check if this is a read operation\n */\n isReadAction(): boolean {\n return this.action === 'read';\n }\n\n /**\n * Check if this is a write operation (create, update, delete)\n */\n isWriteAction(): boolean {\n return ['create', 'update', 'delete'].includes(this.action);\n }\n\n /**\n * Check if this is a key operation\n */\n isKeyOperation(): boolean {\n return this.action === 'rotate_key';\n }\n}\n\n/**\n * Create an audit log entry for a secret operation\n */\nexport function createAuditEntry(params: {\n secretId?: string | null;\n secretName: string;\n tenantId?: string | null;\n userId: string;\n action: SecretAuditAction;\n result: SecretAuditResult;\n ipAddress?: string;\n userAgent?: string;\n details?: Record<string, unknown>;\n}): SmrtCreateInput<SecretAuditLog> {\n const tenantId =\n params.tenantId === undefined || params.tenantId === 'system'\n ? null\n : params.tenantId;\n\n const entry: SmrtCreateInput<SecretAuditLog> = {\n secretId: params.secretId ?? null,\n secretName: params.secretName,\n userId: params.userId,\n action: params.action,\n result: params.result,\n ipAddress: params.ipAddress ?? '',\n userAgent: params.userAgent ?? '',\n details: params.details ?? {},\n tenantId,\n };\n return entry;\n}\n","/**\n * Secret model - Tenant-scoped encrypted secrets storage\n * @packageDocumentation\n */\n\nimport { SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/**\n * Secret status values\n */\nexport type SecretStatus = 'active' | 'disabled' | 'expired';\n\n/**\n * Secret represents an encrypted value stored per-tenant.\n *\n * Secrets are tenant-scoped and use envelope encryption:\n * - Each tenant has their own Data Encryption Key (TDEK)\n * - The TDEK is wrapped by the Application Master Key (AMK)\n * - Secret values are encrypted by the unwrapped TDEK\n *\n * **Security**: This model deliberately excludes API and MCP exposure\n * to prevent accidental secret leakage. Secrets are only accessible\n * via CLI commands or direct service calls.\n *\n * @example\n * ```typescript\n * import { SecretService } from '@happyvertical/smrt-secrets';\n *\n * const service = await SecretService.create({ db });\n *\n * await withTenant({ tenantId: 'tenant-123' }, async () => {\n * // Store a secret\n * await service.store('api-key', 'sk_live_xxx', { category: 'stripe' });\n *\n * // Retrieve (auto-decrypts)\n * const apiKey = await service.retrieve('api-key');\n * });\n * ```\n */\n// Intentional exception to standards.md §7 (`@TenantScoped({ mode: 'optional' })`):\n// `Secret` uses the inline `tenantScoped: true` form on `@smrt()` rather than the\n// dedicated `@TenantScoped` decorator from `@happyvertical/smrt-tenancy`. The boolean\n// form gives us required-mode tenant scoping without depending on the tenancy package\n// at the model layer, while `SecretService` performs manual scoping by setting\n// `context = tenantId` on each row. The `(slug, context)` upsert key derived from the\n// base `SmrtObject` fields is what gives different tenants isolated namespaces for\n// secret names — switching to the decorator without changing the upsert key would\n// surface false-positive name collisions across tenants. See\n// `packages/secrets/CLAUDE.md` \"Known exceptions to monorepo standards\" for context.\n@smrt({\n tenantScoped: true,\n // NO API or MCP exposure for security\n api: { include: [] },\n mcp: { include: [] },\n // CLI runs in-process; secrets must never be reachable over HTTP, so\n // skipApiCheck acknowledges the cli.include / api.include divergence.\n cli: { include: ['list'], skipApiCheck: true }, // Only list names, not values\n})\nexport class Secret extends SmrtObject {\n /**\n * Tenant that owns this secret. Also stored in context for per-tenant name uniqueness.\n */\n tenantId: string = '';\n\n /**\n * Unique name for the secret within the tenant\n */\n name: string = '';\n\n /**\n * Human-readable description\n */\n description: string = '';\n\n /**\n * Category for organization (e.g., 'database', 'api-key', 'oauth')\n */\n category: string = '';\n\n /**\n * JSON-encoded EncryptedEnvelope from @happyvertical/secrets\n */\n encryptedValue: string = '';\n\n /**\n * Version of the tenant key used to encrypt this secret\n */\n keyVersion: number = 1;\n\n /**\n * Current status of the secret\n */\n status: SecretStatus = 'active';\n\n /**\n * Optional expiration date\n */\n expiresAt: Date | null = null;\n\n /**\n * Last time this secret was accessed (decrypted)\n */\n lastAccessedAt: Date | null = null;\n\n /**\n * Number of times this secret has been accessed\n */\n accessCount: number = 0;\n\n /**\n * Additional metadata stored with the secret\n */\n metadata: Record<string, unknown> = {};\n\n constructor(options: any = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.name !== undefined) this.name = options.name;\n if (options.description !== undefined)\n this.description = options.description;\n if (options.category !== undefined) this.category = options.category;\n if (options.encryptedValue !== undefined)\n this.encryptedValue = options.encryptedValue;\n if (options.keyVersion !== undefined) this.keyVersion = options.keyVersion;\n if (options.status !== undefined) this.status = options.status;\n if (options.expiresAt !== undefined) {\n this.expiresAt =\n options.expiresAt instanceof Date\n ? options.expiresAt\n : options.expiresAt\n ? new Date(options.expiresAt)\n : null;\n }\n if (options.lastAccessedAt !== undefined) {\n this.lastAccessedAt =\n options.lastAccessedAt instanceof Date\n ? options.lastAccessedAt\n : options.lastAccessedAt\n ? new Date(options.lastAccessedAt)\n : null;\n }\n if (options.accessCount !== undefined)\n this.accessCount = options.accessCount;\n if (options.metadata !== undefined) this.metadata = options.metadata;\n }\n\n /**\n * Check if the secret is currently active\n */\n isActive(): boolean {\n return this.status === 'active';\n }\n\n /**\n * Check if the secret has expired\n */\n isExpired(): boolean {\n if (!this.expiresAt) return false;\n return new Date() >= this.expiresAt;\n }\n\n /**\n * Check if the secret can be used (active and not expired)\n */\n isUsable(): boolean {\n return this.isActive() && !this.isExpired();\n }\n\n /**\n * Record an access to this secret\n */\n recordAccess(): void {\n this.lastAccessedAt = new Date();\n this.accessCount += 1;\n }\n\n /**\n * Disable the secret\n */\n disable(): void {\n this.status = 'disabled';\n }\n\n /**\n * Enable the secret\n */\n enable(): void {\n this.status = 'active';\n }\n}\n","/**\n * TenantKey model - Tracks per-tenant Data Encryption Keys (TDEKs)\n * @packageDocumentation\n */\n\nimport { SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/**\n * Key status values\n */\nexport type TenantKeyStatus = 'active' | 'rotating' | 'retired' | 'compromised';\n\n/**\n * TenantKey tracks the per-tenant Data Encryption Keys (TDEKs).\n *\n * Each tenant has one or more TDEKs stored in wrapped form. The wrapped key\n * can only be decrypted using the Application Master Key (AMK).\n *\n * **Key Lifecycle**:\n * 1. `active` - Current key used for encryption\n * 2. `rotating` - Transitional state during rotation\n * 3. `retired` - Old key kept for decryption of existing secrets\n * 4. `compromised` - Key marked as compromised, should not be used\n *\n * **Note**: This model is NOT tenant-scoped itself because it tracks\n * keys FOR tenants, not secrets owned BY tenants.\n *\n * @example\n * ```typescript\n * // Get active key for a tenant\n * const key = await tenantKeys.get({\n * tenantId: 'tenant-123',\n * status: 'active'\n * });\n *\n * // List all key versions for a tenant\n * const versions = await tenantKeys.list({\n * where: { tenantId: 'tenant-123' },\n * orderBy: 'version DESC'\n * });\n * ```\n */\n// Intentional exception to standards.md §7 (`@TenantScoped({ mode: 'optional' })`):\n// `TenantKey` is deliberately NOT tenant-scoped — neither via the decorator nor via\n// `tenantScoped: true` on `@smrt()`. The row carries a `tenantId` column because each\n// TDEK belongs to a tenant, but the model itself must remain queryable across tenants\n// (e.g. cross-tenant key-rotation tooling, AMK rewrap jobs, super-admin auditing).\n// Adding the tenancy interceptor here would silently filter out keys the rotation\n// service needs to inspect. See `packages/secrets/CLAUDE.md` \"Known exceptions to\n// monorepo standards\" for the full rationale.\n@smrt({\n // NOT tenant-scoped - this model tracks keys FOR tenants\n api: { include: [] }, // No API exposure\n mcp: { include: [] }, // No MCP exposure\n // CLI runs in-process for key-rotation tooling and audit; HTTP exposure is\n // intentionally excluded, so skipApiCheck acknowledges the divergence.\n cli: { include: ['list', 'get'], skipApiCheck: true },\n})\nexport class TenantKey extends SmrtObject {\n /**\n * Tenant ID this key belongs to\n */\n tenantId: string = '';\n\n /**\n * Wrapped key data (format: wrappedKey:iv:authTag)\n */\n wrappedKey: string = '';\n\n /**\n * ID of the AMK used to wrap this key\n */\n amkKeyId: string = '';\n\n /**\n * Current status of the key\n */\n status: TenantKeyStatus = 'active';\n\n /**\n * Version number (increments on rotation)\n */\n version: number = 1;\n\n /**\n * Recommended rotation date\n */\n rotateAfter: Date | null = null;\n\n /**\n * When the key was retired (if applicable)\n */\n retiredAt: Date | null = null;\n\n constructor(options: any = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.wrappedKey !== undefined) this.wrappedKey = options.wrappedKey;\n if (options.amkKeyId !== undefined) this.amkKeyId = options.amkKeyId;\n if (options.status !== undefined) this.status = options.status;\n if (options.version !== undefined) this.version = options.version;\n if (options.rotateAfter !== undefined) {\n this.rotateAfter =\n options.rotateAfter instanceof Date\n ? options.rotateAfter\n : options.rotateAfter\n ? new Date(options.rotateAfter)\n : null;\n }\n if (options.retiredAt !== undefined) {\n this.retiredAt =\n options.retiredAt instanceof Date\n ? options.retiredAt\n : options.retiredAt\n ? new Date(options.retiredAt)\n : null;\n }\n }\n\n /**\n * Check if this key is currently active\n */\n isActive(): boolean {\n return this.status === 'active';\n }\n\n /**\n * Check if this key needs rotation\n */\n needsRotation(): boolean {\n if (!this.rotateAfter) return false;\n return new Date() >= this.rotateAfter;\n }\n\n /**\n * Check if this key is retired\n */\n isRetired(): boolean {\n return this.status === 'retired';\n }\n\n /**\n * Check if this key is compromised\n */\n isCompromised(): boolean {\n return this.status === 'compromised';\n }\n\n /**\n * Check if this key can be used for decryption\n * (active or retired keys can decrypt)\n */\n canDecrypt(): boolean {\n return this.status === 'active' || this.status === 'retired';\n }\n\n /**\n * Check if this key can be used for encryption\n * (only active keys should encrypt)\n */\n canEncrypt(): boolean {\n return this.status === 'active';\n }\n\n /**\n * Mark this key as retired\n */\n retire(): void {\n this.status = 'retired';\n this.retiredAt = new Date();\n }\n\n /**\n * Mark this key as compromised\n */\n markCompromised(): void {\n this.status = 'compromised';\n }\n}\n"],"names":["__decorateClass"],"mappings":";AAsBA,eAAe;AAAA,EACb,IAAA,IAAA,mBAAA,YAAA,GAAA;AACF;;;;;;;;;;;AC4DO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA;AAAA;AAAA,EAI7C,WAA0B;AAAA,EAM1B,WAA0B;AAAA;AAAA;AAAA;AAAA,EAK1B,aAAqB;AAAA,EAMrB,SAAiB;AAAA;AAAA;AAAA;AAAA,EAKjB,SAA4B;AAAA;AAAA;AAAA;AAAA,EAK5B,SAA4B;AAAA;AAAA;AAAA;AAAA,EAK5B,YAAoB;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAoB;AAAA;AAAA;AAAA;AAAA,EAKpB,UAAmC,CAAA;AAAA,EAEnC,YAAY,UAAe,IAAI;AAC7B,UAAM,OAAO;AACb,QAAI,QAAQ,aAAa,QAAW;AAClC,WAAK,WAAW,QAAQ;AAAA,IAC1B;AACA,QAAI,QAAQ,aAA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AAyB;AACvB,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAsB;AACpB,WAAO,KAAK,WAAW,YAAY,KAAK,WAAW;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAsB;AACpB,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,SAAe;AACb,SAAK,SAAS;AACd,SAAK,gCAAgB,KAAA;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAwB;AACtB,SAAK,SAAS;AAAA,EAChB;AACF;AAxHa,YAAN,gBAAA;AAAA,EARN,KAAK;AAAA;AAAA,IAEJ,KAAK,EAAE,SAAS,GAAC;AAAA;AAAA,IACjB,KAAK,EAAE,SAAS,GAAC;AAAA;AAAA;AAAA;AAAA,IAGjB,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,GAAG,cAAc,KAAA;AAAA,EAAK,CACrD;AAAA,GACY,SAAA;"}
|
|
1
|
+
{"version":3,"file":"TenantKey-DzglnpAV.js","sources":["../../src/__smrt-register__.ts","../../src/models/SecretAuditLog.ts","../../src/models/Secret.ts","../../src/models/TenantKey.ts"],"sourcesContent":["/**\n * Self-registers this package's build-time manifest before any @smrt() decorator\n * in the package fires. Fixes issue #1132: in consumer runtimes (tsx, SvelteKit\n * SSR, plain `vite dev`) the decorator's synchronous manifest lookup previously\n * missed because no step populated the global manifest cache — classes got\n * registered with zero fields and `save()` / `toJSON()` silently dropped every\n * declared property.\n *\n * Import this module as the first statement in `src/index.ts` so its top-level\n * side effect runs ahead of any class module's @smrt() decorator.\n *\n * Silent no-op in dev/test, where the vitest plugin already populates manifests\n * via a different path. Only needs to succeed in the published dist output.\n *\n * @see https://github.com/happyvertical/smrt/issues/1132\n */\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\n// `new URL('./manifest.json', import.meta.url)` resolves at runtime to the\n// manifest sitting next to this module's compiled output. Vite warns at build\n// time that it cannot pre-resolve the URL; that is the intended behavior —\n// the URL must resolve to dist/manifest.json at runtime, not be inlined.\nObjectRegistry.registerPackageManifest(\n new URL('./manifest.json', import.meta.url),\n);\n","/**\n * SecretAuditLog model - Audit trail for secret operations\n * @packageDocumentation\n */\n\nimport type {\n SmrtCreateInput,\n SmrtObjectOptions,\n} from '@happyvertical/smrt-core';\nimport {\n crossPackageRef,\n foreignKey,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\n\n/**\n * Secret audit action types\n */\nexport type SecretAuditAction =\n | 'create'\n | 'read'\n | 'update'\n | 'delete'\n | 'rotate_key'\n | 'disable'\n | 'enable'\n | 'expire';\n\n/**\n * Audit result types\n */\nexport type SecretAuditResult = 'success' | 'failure' | 'denied';\n\n/**\n * Constructor options for {@link SecretAuditLog}. Each field is optional and\n * mirrors a persisted column.\n */\nexport interface SecretAuditLogOptions extends SmrtObjectOptions {\n tenantId?: string | null;\n secretId?: string | null;\n secretName?: string;\n userId?: string;\n action?: SecretAuditAction;\n result?: SecretAuditResult;\n ipAddress?: string;\n userAgent?: string;\n details?: Record<string, unknown>;\n}\n\n/**\n * SecretAuditLog records all operations on secrets for compliance\n * and security monitoring.\n *\n * Every secret operation (create, read, update, delete, key rotation)\n * is logged with the user, action, result, and relevant details.\n *\n * **Retention**: Audit logs should be retained according to your\n * compliance requirements (typically 1-7 years).\n *\n * @example\n * ```typescript\n * // Query recent audit logs\n * const logs = await auditLogs.list({\n * where: { tenantId: 'tenant-123' },\n * orderBy: 'created_at DESC',\n * limit: 100\n * });\n *\n * // Filter by action\n * const reads = await auditLogs.list({\n * where: {\n * tenantId: 'tenant-123',\n * action: 'read'\n * }\n * });\n *\n * // Filter by secret name\n * const apiKeyLogs = await auditLogs.list({\n * where: {\n * tenantId: 'tenant-123',\n * secretName: 'stripe-api-key'\n * }\n * });\n * ```\n */\n// Intentional exception to standards.md §7 (`@TenantScoped({ mode: 'optional' })`):\n// `SecretAuditLog` uses the inline `tenantScoped: true` form on `@smrt()` rather than\n// the dedicated `@TenantScoped` decorator. Audit-trail queries are read-mostly and run\n// in mixed contexts — under a tenant for tenant-scoped reports, and (prospectively)\n// under super-admin bypass for compliance review. Cross-tenant audit queries should\n// be wrapped in `withSuperAdminBypass()` from `@happyvertical/smrt-tenancy` at the\n// call site; this package has no such call sites today, so the pattern is\n// prescriptive guidance for compliance tooling rather than current practice. See\n// `packages/secrets/CLAUDE.md` \"Known exceptions to monorepo standards\" for context.\n@smrt({\n tenantScoped: true,\n api: { include: [] }, // No API exposure\n mcp: { include: [] }, // No MCP exposure\n // CLI runs in-process for compliance review; HTTP exposure is intentionally\n // excluded, so skipApiCheck acknowledges the cli.include / api.include divergence.\n cli: { include: ['list'], skipApiCheck: true },\n})\nexport class SecretAuditLog extends SmrtObject {\n /**\n * Tenant associated with the audited secret operation.\n */\n tenantId: string | null = null;\n\n /**\n * ID of the secret (may be null for deleted secrets)\n */\n @foreignKey('Secret')\n secretId: string | null = null;\n\n /**\n * Name of the secret at the time of the operation\n */\n secretName: string = '';\n\n /**\n * ID of the user who performed the action\n */\n @crossPackageRef('@happyvertical/smrt-users:User')\n userId: string = '';\n\n /**\n * The action that was performed\n */\n action: SecretAuditAction = 'read';\n\n /**\n * Result of the operation\n */\n result: SecretAuditResult = 'success';\n\n /**\n * IP address of the client (if available)\n */\n ipAddress: string = '';\n\n /**\n * User agent string (if available)\n */\n userAgent: string = '';\n\n /**\n * Additional context about the operation\n */\n details: Record<string, unknown> = {};\n\n constructor(options: SecretAuditLogOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) {\n this.tenantId = options.tenantId;\n }\n if (options.secretId !== undefined) this.secretId = options.secretId;\n if (options.secretName !== undefined) this.secretName = options.secretName;\n if (options.userId !== undefined) this.userId = options.userId;\n if (options.action !== undefined) this.action = options.action;\n if (options.result !== undefined) this.result = options.result;\n if (options.ipAddress !== undefined) this.ipAddress = options.ipAddress;\n if (options.userAgent !== undefined) this.userAgent = options.userAgent;\n if (options.details !== undefined) this.details = options.details;\n }\n\n /**\n * Check if this was a successful operation\n */\n isSuccess(): boolean {\n return this.result === 'success';\n }\n\n /**\n * Check if this was a failed operation\n */\n isFailure(): boolean {\n return this.result === 'failure';\n }\n\n /**\n * Check if this was a denied operation (permission denied)\n */\n isDenied(): boolean {\n return this.result === 'denied';\n }\n\n /**\n * Check if this is a read operation\n */\n isReadAction(): boolean {\n return this.action === 'read';\n }\n\n /**\n * Check if this is a write operation (create, update, delete)\n */\n isWriteAction(): boolean {\n return ['create', 'update', 'delete'].includes(this.action);\n }\n\n /**\n * Check if this is a key operation\n */\n isKeyOperation(): boolean {\n return this.action === 'rotate_key';\n }\n}\n\n/**\n * Create an audit log entry for a secret operation\n */\nexport function createAuditEntry(params: {\n secretId?: string | null;\n secretName: string;\n tenantId?: string | null;\n userId: string;\n action: SecretAuditAction;\n result: SecretAuditResult;\n ipAddress?: string;\n userAgent?: string;\n details?: Record<string, unknown>;\n}): SmrtCreateInput<SecretAuditLog> {\n const tenantId =\n params.tenantId === undefined || params.tenantId === 'system'\n ? null\n : params.tenantId;\n\n const entry: SmrtCreateInput<SecretAuditLog> = {\n secretId: params.secretId ?? null,\n secretName: params.secretName,\n userId: params.userId,\n action: params.action,\n result: params.result,\n ipAddress: params.ipAddress ?? '',\n userAgent: params.userAgent ?? '',\n details: params.details ?? {},\n tenantId,\n };\n return entry;\n}\n","/**\n * Secret model - Tenant-scoped encrypted secrets storage\n * @packageDocumentation\n */\n\nimport type { SmrtObjectOptions } from '@happyvertical/smrt-core';\nimport { SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/**\n * Secret status values\n */\nexport type SecretStatus = 'active' | 'disabled' | 'expired';\n\n/**\n * Constructor options for {@link Secret}. Each field is optional and mirrors a\n * persisted column; date fields also accept the serialized forms accepted by\n * `new Date()` so hydrated rows coerce cleanly.\n */\nexport interface SecretOptions extends SmrtObjectOptions {\n tenantId?: string;\n name?: string;\n description?: string;\n category?: string;\n encryptedValue?: string;\n keyVersion?: number;\n status?: SecretStatus;\n expiresAt?: Date | string | number | null;\n lastAccessedAt?: Date | string | number | null;\n accessCount?: number;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Secret represents an encrypted value stored per-tenant.\n *\n * Secrets are tenant-scoped and use envelope encryption:\n * - Each tenant has their own Data Encryption Key (TDEK)\n * - The TDEK is wrapped by the Application Master Key (AMK)\n * - Secret values are encrypted by the unwrapped TDEK\n *\n * **Security**: This model deliberately excludes API and MCP exposure\n * to prevent accidental secret leakage. Secrets are only accessible\n * via CLI commands or direct service calls.\n *\n * @example\n * ```typescript\n * import { SecretService } from '@happyvertical/smrt-secrets';\n *\n * const service = await SecretService.create({ db });\n *\n * await withTenant({ tenantId: 'tenant-123' }, async () => {\n * // Store a secret\n * await service.store('api-key', 'sk_live_xxx', { category: 'stripe' });\n *\n * // Retrieve (auto-decrypts)\n * const apiKey = await service.retrieve('api-key');\n * });\n * ```\n */\n// Intentional exception to standards.md §7 (`@TenantScoped({ mode: 'optional' })`):\n// `Secret` uses the inline `tenantScoped: true` form on `@smrt()` rather than the\n// dedicated `@TenantScoped` decorator from `@happyvertical/smrt-tenancy`. The boolean\n// form gives us required-mode tenant scoping without depending on the tenancy package\n// at the model layer, while `SecretService` performs manual scoping by setting\n// `context = tenantId` on each row. The `(slug, context)` upsert key derived from the\n// base `SmrtObject` fields is what gives different tenants isolated namespaces for\n// secret names — switching to the decorator without changing the upsert key would\n// surface false-positive name collisions across tenants. See\n// `packages/secrets/CLAUDE.md` \"Known exceptions to monorepo standards\" for context.\n@smrt({\n tenantScoped: true,\n // NO API or MCP exposure for security\n api: { include: [] },\n mcp: { include: [] },\n // CLI runs in-process; secrets must never be reachable over HTTP, so\n // skipApiCheck acknowledges the cli.include / api.include divergence.\n cli: { include: ['list'], skipApiCheck: true }, // Only list names, not values\n})\nexport class Secret extends SmrtObject {\n /**\n * Tenant that owns this secret. Also stored in context for per-tenant name uniqueness.\n */\n tenantId: string = '';\n\n /**\n * Unique name for the secret within the tenant\n */\n name: string = '';\n\n /**\n * Human-readable description\n */\n description: string = '';\n\n /**\n * Category for organization (e.g., 'database', 'api-key', 'oauth')\n */\n category: string = '';\n\n /**\n * JSON-encoded EncryptedEnvelope from @happyvertical/secrets\n */\n encryptedValue: string = '';\n\n /**\n * Version of the tenant key used to encrypt this secret\n */\n keyVersion: number = 1;\n\n /**\n * Current status of the secret\n */\n status: SecretStatus = 'active';\n\n /**\n * Optional expiration date\n */\n expiresAt: Date | null = null;\n\n /**\n * Last time this secret was accessed (decrypted)\n */\n lastAccessedAt: Date | null = null;\n\n /**\n * Number of times this secret has been accessed\n */\n accessCount: number = 0;\n\n /**\n * Additional metadata stored with the secret\n */\n metadata: Record<string, unknown> = {};\n\n constructor(options: SecretOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.name !== undefined) this.name = options.name;\n if (options.description !== undefined)\n this.description = options.description;\n if (options.category !== undefined) this.category = options.category;\n if (options.encryptedValue !== undefined)\n this.encryptedValue = options.encryptedValue;\n if (options.keyVersion !== undefined) this.keyVersion = options.keyVersion;\n if (options.status !== undefined) this.status = options.status;\n if (options.expiresAt !== undefined) {\n this.expiresAt =\n options.expiresAt instanceof Date\n ? options.expiresAt\n : options.expiresAt\n ? new Date(options.expiresAt)\n : null;\n }\n if (options.lastAccessedAt !== undefined) {\n this.lastAccessedAt =\n options.lastAccessedAt instanceof Date\n ? options.lastAccessedAt\n : options.lastAccessedAt\n ? new Date(options.lastAccessedAt)\n : null;\n }\n if (options.accessCount !== undefined)\n this.accessCount = options.accessCount;\n if (options.metadata !== undefined) this.metadata = options.metadata;\n }\n\n /**\n * Check if the secret is currently active\n */\n isActive(): boolean {\n return this.status === 'active';\n }\n\n /**\n * Check if the secret has expired\n */\n isExpired(): boolean {\n if (!this.expiresAt) return false;\n return new Date() >= this.expiresAt;\n }\n\n /**\n * Check if the secret can be used (active and not expired)\n */\n isUsable(): boolean {\n return this.isActive() && !this.isExpired();\n }\n\n /**\n * Record an access to this secret\n */\n recordAccess(): void {\n this.lastAccessedAt = new Date();\n this.accessCount += 1;\n }\n\n /**\n * Disable the secret\n */\n disable(): void {\n this.status = 'disabled';\n }\n\n /**\n * Enable the secret\n */\n enable(): void {\n this.status = 'active';\n }\n}\n","/**\n * TenantKey model - Tracks per-tenant Data Encryption Keys (TDEKs)\n * @packageDocumentation\n */\n\nimport type { SmrtObjectOptions } from '@happyvertical/smrt-core';\nimport { SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/**\n * Key status values\n */\nexport type TenantKeyStatus = 'active' | 'rotating' | 'retired' | 'compromised';\n\n/**\n * Constructor options for {@link TenantKey}. Each field is optional and mirrors\n * a persisted column; date fields also accept the serialized forms accepted by\n * `new Date()` so hydrated rows coerce cleanly.\n */\nexport interface TenantKeyOptions extends SmrtObjectOptions {\n tenantId?: string;\n wrappedKey?: string;\n amkKeyId?: string;\n status?: TenantKeyStatus;\n version?: number;\n rotateAfter?: Date | string | number | null;\n retiredAt?: Date | string | number | null;\n}\n\n/**\n * TenantKey tracks the per-tenant Data Encryption Keys (TDEKs).\n *\n * Each tenant has one or more TDEKs stored in wrapped form. The wrapped key\n * can only be decrypted using the Application Master Key (AMK).\n *\n * **Key Lifecycle**:\n * 1. `active` - Current key used for encryption\n * 2. `rotating` - Transitional state during rotation\n * 3. `retired` - Old key kept for decryption of existing secrets\n * 4. `compromised` - Key marked as compromised, should not be used\n *\n * **Note**: This model is NOT tenant-scoped itself because it tracks\n * keys FOR tenants, not secrets owned BY tenants.\n *\n * @example\n * ```typescript\n * // Get active key for a tenant\n * const key = await tenantKeys.get({\n * tenantId: 'tenant-123',\n * status: 'active'\n * });\n *\n * // List all key versions for a tenant\n * const versions = await tenantKeys.list({\n * where: { tenantId: 'tenant-123' },\n * orderBy: 'version DESC'\n * });\n * ```\n */\n// Intentional exception to standards.md §7 (`@TenantScoped({ mode: 'optional' })`):\n// `TenantKey` is deliberately NOT tenant-scoped — neither via the decorator nor via\n// `tenantScoped: true` on `@smrt()`. The row carries a `tenantId` column because each\n// TDEK belongs to a tenant, but the model itself must remain queryable across tenants\n// (e.g. cross-tenant key-rotation tooling, AMK rewrap jobs, super-admin auditing).\n// Adding the tenancy interceptor here would silently filter out keys the rotation\n// service needs to inspect. See `packages/secrets/CLAUDE.md` \"Known exceptions to\n// monorepo standards\" for the full rationale.\n@smrt({\n // NOT tenant-scoped - this model tracks keys FOR tenants\n api: { include: [] }, // No API exposure\n mcp: { include: [] }, // No MCP exposure\n // CLI runs in-process for key-rotation tooling and audit; HTTP exposure is\n // intentionally excluded, so skipApiCheck acknowledges the divergence.\n cli: { include: ['list', 'get'], skipApiCheck: true },\n})\nexport class TenantKey extends SmrtObject {\n /**\n * Tenant ID this key belongs to\n */\n tenantId: string = '';\n\n /**\n * Wrapped key data (format: wrappedKey:iv:authTag)\n */\n wrappedKey: string = '';\n\n /**\n * ID of the AMK used to wrap this key\n */\n amkKeyId: string = '';\n\n /**\n * Current status of the key\n */\n status: TenantKeyStatus = 'active';\n\n /**\n * Version number (increments on rotation)\n */\n version: number = 1;\n\n /**\n * Recommended rotation date\n */\n rotateAfter: Date | null = null;\n\n /**\n * When the key was retired (if applicable)\n */\n retiredAt: Date | null = null;\n\n constructor(options: TenantKeyOptions = {}) {\n super(options);\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n if (options.wrappedKey !== undefined) this.wrappedKey = options.wrappedKey;\n if (options.amkKeyId !== undefined) this.amkKeyId = options.amkKeyId;\n if (options.status !== undefined) this.status = options.status;\n if (options.version !== undefined) this.version = options.version;\n if (options.rotateAfter !== undefined) {\n this.rotateAfter =\n options.rotateAfter instanceof Date\n ? options.rotateAfter\n : options.rotateAfter\n ? new Date(options.rotateAfter)\n : null;\n }\n if (options.retiredAt !== undefined) {\n this.retiredAt =\n options.retiredAt instanceof Date\n ? options.retiredAt\n : options.retiredAt\n ? new Date(options.retiredAt)\n : null;\n }\n }\n\n /**\n * Check if this key is currently active\n */\n isActive(): boolean {\n return this.status === 'active';\n }\n\n /**\n * Check if this key needs rotation\n */\n needsRotation(): boolean {\n if (!this.rotateAfter) return false;\n return new Date() >= this.rotateAfter;\n }\n\n /**\n * Check if this key is retired\n */\n isRetired(): boolean {\n return this.status === 'retired';\n }\n\n /**\n * Check if this key is compromised\n */\n isCompromised(): boolean {\n return this.status === 'compromised';\n }\n\n /**\n * Check if this key can be used for decryption\n * (active or retired keys can decrypt)\n */\n canDecrypt(): boolean {\n return this.status === 'active' || this.status === 'retired';\n }\n\n /**\n * Check if this key can be used for encryption\n * (only active keys should encrypt)\n */\n canEncrypt(): boolean {\n return this.status === 'active';\n }\n\n /**\n * Mark this key as retired\n */\n retire(): void {\n this.status = 'retired';\n this.retiredAt = new Date();\n }\n\n /**\n * Mark this key as compromised\n */\n markCompromised(): void {\n this.status = 'compromised';\n }\n}\n"],"names":["__decorateClass"],"mappings":";AAsBA,eAAe;AAAA,EACb,IAAA,IAAA,mBAAA,YAAA,GAAA;AACF;;;;;;;;;;;AC+EO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA;AAAA;AAAA,EAI7C,WAA0B;AAAA,EAM1B,WAA0B;AAAA;AAAA;AAAA;AAAA,EAK1B,aAAqB;AAAA,EAMrB,SAAiB;AAAA;AAAA;AAAA;AAAA,EAKjB,SAA4B;AAAA;AAAA;AAAA;AAAA,EAK5B,SAA4B;AAAA;AAAA;AAAA;AAAA,EAK5B,YAAoB;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAoB;AAAA;AAAA;AAAA;AAAA,EAKpB,UAAmC,CAAA;AAAA,EAEnC,YAAY,UAAiC,IAAI;AAC/C,UAAM,OAAO;AACb,QAAI,QAAQ,aAAa,QAAW;AAClC,WAAK,WAAW,QAAQ;AAAA,IAC1B;AACA,QAAI,QAAQ,aAAa,OAAW,MAAK,WAAW,QAAQ;AAC5D,QAAI,QAAQ,eAAe,OAAW,MAAK,aAAa,QAAQ;AAChE,QAAI,QAAQ,WAAW,OAAW,MAAK,S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AK,WAAW;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAsB;AACpB,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,SAAe;AACb,SAAK,SAAS;AACd,SAAK,gCAAgB,KAAA;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAwB;AACtB,SAAK,SAAS;AAAA,EAChB;AACF;AAxHa,YAAN,gBAAA;AAAA,EARN,KAAK;AAAA;AAAA,IAEJ,KAAK,EAAE,SAAS,GAAC;AAAA;AAAA,IACjB,KAAK,EAAE,SAAS,GAAC;AAAA;AAAA;AAAA;AAAA,IAGjB,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,GAAG,cAAc,KAAA;AAAA,EAAK,CACrD;AAAA,GACY,SAAA;"}
|
package/dist/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0.0",
|
|
3
|
-
"timestamp":
|
|
3
|
+
"timestamp": 1782335238161,
|
|
4
4
|
"packageName": "@happyvertical/smrt-secrets",
|
|
5
|
-
"packageVersion": "0.35.
|
|
5
|
+
"packageVersion": "0.35.1",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-secrets:SecretAuditLogCollection": {
|
|
8
8
|
"name": "secretauditlogcollection",
|
package/dist/models/Secret.d.ts
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
1
|
+
import { SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core';
|
|
2
2
|
/**
|
|
3
3
|
* Secret status values
|
|
4
4
|
*/
|
|
5
5
|
export type SecretStatus = 'active' | 'disabled' | 'expired';
|
|
6
|
+
/**
|
|
7
|
+
* Constructor options for {@link Secret}. Each field is optional and mirrors a
|
|
8
|
+
* persisted column; date fields also accept the serialized forms accepted by
|
|
9
|
+
* `new Date()` so hydrated rows coerce cleanly.
|
|
10
|
+
*/
|
|
11
|
+
export interface SecretOptions extends SmrtObjectOptions {
|
|
12
|
+
tenantId?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
category?: string;
|
|
16
|
+
encryptedValue?: string;
|
|
17
|
+
keyVersion?: number;
|
|
18
|
+
status?: SecretStatus;
|
|
19
|
+
expiresAt?: Date | string | number | null;
|
|
20
|
+
lastAccessedAt?: Date | string | number | null;
|
|
21
|
+
accessCount?: number;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Secret represents an encrypted value stored per-tenant.
|
|
8
26
|
*
|
|
@@ -75,7 +93,7 @@ export declare class Secret extends SmrtObject {
|
|
|
75
93
|
* Additional metadata stored with the secret
|
|
76
94
|
*/
|
|
77
95
|
metadata: Record<string, unknown>;
|
|
78
|
-
constructor(options?:
|
|
96
|
+
constructor(options?: SecretOptions);
|
|
79
97
|
/**
|
|
80
98
|
* Check if the secret is currently active
|
|
81
99
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Secret.d.ts","sourceRoot":"","sources":["../../src/models/Secret.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAWH,qBASa,MAAO,SAAQ,UAAU;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAM;IAEtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAM;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAM;IAEzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAM;IAEtB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAM;IAE5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAK;IAE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H,QAAQ,EAAE,MAAM,CAAM;IAEtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAM;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAM;IAEzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAM;IAEtB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAM;IAE5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAK;IAEvB;;OAEG;IACH,MAAM,EAAE,YAAY,CAAY;IAEhC;;OAEG;IACH,SAAS,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE9B;;OAEG;IACH,cAAc,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAK;IAExB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;gBAE3B,OAAO,GAAE,aAAkB;IAgCvC;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,SAAS,IAAI,OAAO;IAKpB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,YAAY,IAAI,IAAI;IAKpB;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;OAEG;IACH,MAAM,IAAI,IAAI;CAGf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SmrtCreateInput, SmrtObject } from '@happyvertical/smrt-core';
|
|
1
|
+
import { SmrtCreateInput, SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core';
|
|
2
2
|
/**
|
|
3
3
|
* Secret audit action types
|
|
4
4
|
*/
|
|
@@ -7,6 +7,21 @@ export type SecretAuditAction = 'create' | 'read' | 'update' | 'delete' | 'rotat
|
|
|
7
7
|
* Audit result types
|
|
8
8
|
*/
|
|
9
9
|
export type SecretAuditResult = 'success' | 'failure' | 'denied';
|
|
10
|
+
/**
|
|
11
|
+
* Constructor options for {@link SecretAuditLog}. Each field is optional and
|
|
12
|
+
* mirrors a persisted column.
|
|
13
|
+
*/
|
|
14
|
+
export interface SecretAuditLogOptions extends SmrtObjectOptions {
|
|
15
|
+
tenantId?: string | null;
|
|
16
|
+
secretId?: string | null;
|
|
17
|
+
secretName?: string;
|
|
18
|
+
userId?: string;
|
|
19
|
+
action?: SecretAuditAction;
|
|
20
|
+
result?: SecretAuditResult;
|
|
21
|
+
ipAddress?: string;
|
|
22
|
+
userAgent?: string;
|
|
23
|
+
details?: Record<string, unknown>;
|
|
24
|
+
}
|
|
10
25
|
/**
|
|
11
26
|
* SecretAuditLog records all operations on secrets for compliance
|
|
12
27
|
* and security monitoring.
|
|
@@ -80,7 +95,7 @@ export declare class SecretAuditLog extends SmrtObject {
|
|
|
80
95
|
* Additional context about the operation
|
|
81
96
|
*/
|
|
82
97
|
details: Record<string, unknown>;
|
|
83
|
-
constructor(options?:
|
|
98
|
+
constructor(options?: SecretAuditLogOptions);
|
|
84
99
|
/**
|
|
85
100
|
* Check if this was a successful operation
|
|
86
101
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretAuditLog.d.ts","sourceRoot":"","sources":["../../src/models/SecretAuditLog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SecretAuditLog.d.ts","sourceRoot":"","sources":["../../src/models/SecretAuditLog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,qBA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,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GAAG,eAAe,CAAC,cAAc,CAAC,CAkBlC"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
1
|
+
import { SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core';
|
|
2
2
|
/**
|
|
3
3
|
* Key status values
|
|
4
4
|
*/
|
|
5
5
|
export type TenantKeyStatus = 'active' | 'rotating' | 'retired' | 'compromised';
|
|
6
|
+
/**
|
|
7
|
+
* Constructor options for {@link TenantKey}. Each field is optional and mirrors
|
|
8
|
+
* a persisted column; date fields also accept the serialized forms accepted by
|
|
9
|
+
* `new Date()` so hydrated rows coerce cleanly.
|
|
10
|
+
*/
|
|
11
|
+
export interface TenantKeyOptions extends SmrtObjectOptions {
|
|
12
|
+
tenantId?: string;
|
|
13
|
+
wrappedKey?: string;
|
|
14
|
+
amkKeyId?: string;
|
|
15
|
+
status?: TenantKeyStatus;
|
|
16
|
+
version?: number;
|
|
17
|
+
rotateAfter?: Date | string | number | null;
|
|
18
|
+
retiredAt?: Date | string | number | null;
|
|
19
|
+
}
|
|
6
20
|
/**
|
|
7
21
|
* TenantKey tracks the per-tenant Data Encryption Keys (TDEKs).
|
|
8
22
|
*
|
|
@@ -62,7 +76,7 @@ export declare class TenantKey extends SmrtObject {
|
|
|
62
76
|
* When the key was retired (if applicable)
|
|
63
77
|
*/
|
|
64
78
|
retiredAt: Date | null;
|
|
65
|
-
constructor(options?:
|
|
79
|
+
constructor(options?: TenantKeyOptions);
|
|
66
80
|
/**
|
|
67
81
|
* Check if this key is currently active
|
|
68
82
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TenantKey.d.ts","sourceRoot":"","sources":["../../src/models/TenantKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AASH,qBAQa,SAAU,SAAQ,UAAU;IACvC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAM;IAEtB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAM;IAExB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAM;IAEtB;;OAEG;IACH,MAAM,EAAE,eAAe,CAAY;IAEnC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAK;IAEpB;;OAEG;IACH,WAAW,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEhC;;OAEG;IACH,SAAS,EAAE,IAAI,GAAG,IAAI,CAAQ;gBAElB,OAAO,GAAE,
|
|
1
|
+
{"version":3,"file":"TenantKey.d.ts","sourceRoot":"","sources":["../../src/models/TenantKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,QAAQ,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
|
|
4
4
|
"packageName": "@happyvertical/smrt-secrets",
|
|
5
|
-
"packageVersion": "0.35.
|
|
5
|
+
"packageVersion": "0.35.1",
|
|
6
6
|
"sourceManifestPath": "dist/manifest.json",
|
|
7
7
|
"agentDocPath": "AGENTS.md",
|
|
8
8
|
"sourceHashes": {
|
|
9
|
-
"manifest": "
|
|
10
|
-
"packageJson": "
|
|
9
|
+
"manifest": "f8fc7e22940e9fa0bdf71485744da7a178e18f2003cfededcb70e6bb6cf04c46",
|
|
10
|
+
"packageJson": "fb1c7bd7b1b9595dc9946c4c9f59df5ac9185efd90b18947efb0d371a5f0253f",
|
|
11
11
|
"agents": "c2be546ffbe79a0df95401c10a60e23f4f31cb8232cb1349fcdb7e5682852d4a"
|
|
12
12
|
},
|
|
13
13
|
"exports": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-secrets",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "Per-tenant secret management with envelope encryption for SMRT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"@happyvertical/secrets": "^0.74.7",
|
|
32
32
|
"@happyvertical/sql": "^0.74.7",
|
|
33
33
|
"@happyvertical/utils": "^0.74.7",
|
|
34
|
-
"@happyvertical/smrt-core": "0.35.
|
|
35
|
-
"@happyvertical/smrt-tenancy": "0.35.
|
|
34
|
+
"@happyvertical/smrt-core": "0.35.1",
|
|
35
|
+
"@happyvertical/smrt-tenancy": "0.35.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "25.0.9",
|
|
39
39
|
"typescript": "^5.9.3",
|
|
40
40
|
"vite": "^7.3.1",
|
|
41
41
|
"vitest": "^4.0.17",
|
|
42
|
-
"@happyvertical/smrt-vitest": "0.35.
|
|
42
|
+
"@happyvertical/smrt-vitest": "0.35.1"
|
|
43
43
|
},
|
|
44
44
|
"keywords": [
|
|
45
45
|
"smrt",
|