@happyvertical/smrt-secrets 0.40.44 → 0.40.45

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.
@@ -1,2 +1,2 @@
1
- import { i as createAuditEntry, n as Secret, r as SecretAuditLog, t as TenantKey } from "../chunks/TenantKey-MaMd5UjL.js";
1
+ import { i as createAuditEntry, n as Secret, r as SecretAuditLog, t as TenantKey } from "../chunks/TenantKey-8LpB6kJK.js";
2
2
  export { Secret, SecretAuditLog, TenantKey, createAuditEntry };
@@ -1,2 +1,2 @@
1
- import { n as SecretService, t as SecretKeyDriftError } from "../chunks/SecretService-JIYAbuK2.js";
1
+ import { n as SecretService, t as SecretKeyDriftError } from "../chunks/SecretService-CGsSpiqQ.js";
2
2
  export { SecretKeyDriftError, SecretService };
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-08-02T02:43:26.178Z",
3
+ "generatedAt": "2026-08-02T06:04:51.226Z",
4
4
  "packageName": "@happyvertical/smrt-secrets",
5
- "packageVersion": "0.40.44",
5
+ "packageVersion": "0.40.45",
6
6
  "sourceManifestPath": "dist/manifest.json",
7
7
  "agentDocPath": "AGENTS.md",
8
8
  "sourceHashes": {
9
- "manifest": "afa75884b76c2c874c9421b83c1a7f6a0820bf6eee73d70c0d7b72cfbce300bc",
10
- "packageJson": "d85e2b0e583c7fe45c33a56c6869b4f8bc787a34e002b5e1e001e0125f339ae4",
9
+ "manifest": "d26d528f5d569f5946d08f586c3b2f9e7d7173d5fce5695291a71bc8a0e5cc4b",
10
+ "packageJson": "d3d1bb358db9994ec004f06b7866ba88a1660419e76672507f8d0066e8039bdb",
11
11
  "agents": "c2be546ffbe79a0df95401c10a60e23f4f31cb8232cb1349fcdb7e5682852d4a"
12
12
  },
13
13
  "exports": [
@@ -44,6 +44,84 @@
44
44
  "tags": [],
45
45
  "risks": [],
46
46
  "objects": [
47
+ {
48
+ "name": "SecretAuditLogCollection",
49
+ "qualifiedName": "@happyvertical/smrt-secrets:SecretAuditLogCollection",
50
+ "collection": "secretauditlogs",
51
+ "tableName": "secret_audit_log_collections",
52
+ "packageName": "@happyvertical/smrt-secrets",
53
+ "extends": "SmrtCollection",
54
+ "fields": [],
55
+ "relationships": [],
56
+ "methods": [
57
+ "cleanup",
58
+ "countByAction",
59
+ "countByResult",
60
+ "getRecentDenials",
61
+ "getRecentFailures",
62
+ "getSecretHistory",
63
+ "getUserActivity",
64
+ "listLogs"
65
+ ],
66
+ "surfaces": [],
67
+ "relationshipFeatures": [
68
+ "uuidColumns"
69
+ ],
70
+ "tags": [],
71
+ "risks": []
72
+ },
73
+ {
74
+ "name": "SecretCollection",
75
+ "qualifiedName": "@happyvertical/smrt-secrets:SecretCollection",
76
+ "collection": "secrets",
77
+ "tableName": "secret_collections",
78
+ "packageName": "@happyvertical/smrt-secrets",
79
+ "extends": "SmrtCollection",
80
+ "fields": [],
81
+ "relationships": [],
82
+ "methods": [
83
+ "countByStatus",
84
+ "deleteByName",
85
+ "findByName",
86
+ "getCategories",
87
+ "listActive",
88
+ "listByCategory",
89
+ "listExpiring",
90
+ "listSecrets"
91
+ ],
92
+ "surfaces": [],
93
+ "relationshipFeatures": [
94
+ "uuidColumns"
95
+ ],
96
+ "tags": [],
97
+ "risks": []
98
+ },
99
+ {
100
+ "name": "TenantKeyCollection",
101
+ "qualifiedName": "@happyvertical/smrt-secrets:TenantKeyCollection",
102
+ "collection": "tenantkeys",
103
+ "tableName": "tenant_key_collections",
104
+ "packageName": "@happyvertical/smrt-secrets",
105
+ "extends": "SmrtCollection",
106
+ "fields": [],
107
+ "relationships": [],
108
+ "methods": [
109
+ "cleanupRetiredKeys",
110
+ "countByStatus",
111
+ "findKeysNeedingRotation",
112
+ "getActiveKey",
113
+ "getKeyVersion",
114
+ "listAllActiveKeys",
115
+ "listKeyVersions",
116
+ "markCompromised"
117
+ ],
118
+ "surfaces": [],
119
+ "relationshipFeatures": [
120
+ "uuidColumns"
121
+ ],
122
+ "tags": [],
123
+ "risks": []
124
+ },
47
125
  {
48
126
  "name": "Secret",
49
127
  "qualifiedName": "@happyvertical/smrt-secrets:Secret",
@@ -328,84 +406,6 @@
328
406
  ],
329
407
  "tags": [],
330
408
  "risks": []
331
- },
332
- {
333
- "name": "SecretAuditLogCollection",
334
- "qualifiedName": "@happyvertical/smrt-secrets:SecretAuditLogCollection",
335
- "collection": "secretauditlogs",
336
- "tableName": "secret_audit_log_collections",
337
- "packageName": "@happyvertical/smrt-secrets",
338
- "extends": "SmrtCollection",
339
- "fields": [],
340
- "relationships": [],
341
- "methods": [
342
- "cleanup",
343
- "countByAction",
344
- "countByResult",
345
- "getRecentDenials",
346
- "getRecentFailures",
347
- "getSecretHistory",
348
- "getUserActivity",
349
- "listLogs"
350
- ],
351
- "surfaces": [],
352
- "relationshipFeatures": [
353
- "uuidColumns"
354
- ],
355
- "tags": [],
356
- "risks": []
357
- },
358
- {
359
- "name": "SecretCollection",
360
- "qualifiedName": "@happyvertical/smrt-secrets:SecretCollection",
361
- "collection": "secrets",
362
- "tableName": "secret_collections",
363
- "packageName": "@happyvertical/smrt-secrets",
364
- "extends": "SmrtCollection",
365
- "fields": [],
366
- "relationships": [],
367
- "methods": [
368
- "countByStatus",
369
- "deleteByName",
370
- "findByName",
371
- "getCategories",
372
- "listActive",
373
- "listByCategory",
374
- "listExpiring",
375
- "listSecrets"
376
- ],
377
- "surfaces": [],
378
- "relationshipFeatures": [
379
- "uuidColumns"
380
- ],
381
- "tags": [],
382
- "risks": []
383
- },
384
- {
385
- "name": "TenantKeyCollection",
386
- "qualifiedName": "@happyvertical/smrt-secrets:TenantKeyCollection",
387
- "collection": "tenantkeys",
388
- "tableName": "tenant_key_collections",
389
- "packageName": "@happyvertical/smrt-secrets",
390
- "extends": "SmrtCollection",
391
- "fields": [],
392
- "relationships": [],
393
- "methods": [
394
- "cleanupRetiredKeys",
395
- "countByStatus",
396
- "findKeysNeedingRotation",
397
- "getActiveKey",
398
- "getKeyVersion",
399
- "listAllActiveKeys",
400
- "listKeyVersions",
401
- "markCompromised"
402
- ],
403
- "surfaces": [],
404
- "relationshipFeatures": [
405
- "uuidColumns"
406
- ],
407
- "tags": [],
408
- "risks": []
409
409
  }
410
410
  ],
411
411
  "surfaces": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-secrets",
3
- "version": "0.40.44",
3
+ "version": "0.40.45",
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.84.0",
32
32
  "@happyvertical/sql": "^0.84.0",
33
33
  "@happyvertical/utils": "^0.84.0",
34
- "@happyvertical/smrt-core": "0.40.44",
35
- "@happyvertical/smrt-tenancy": "0.40.44"
34
+ "@happyvertical/smrt-core": "0.40.45",
35
+ "@happyvertical/smrt-tenancy": "0.40.45"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "24.13.2",
39
39
  "typescript": "5.9.3",
40
40
  "vite": "8.1.4",
41
41
  "vitest": "4.1.10",
42
- "@happyvertical/smrt-vitest": "0.40.44"
42
+ "@happyvertical/smrt-vitest": "0.40.45"
43
43
  },
44
44
  "keywords": [
45
45
  "smrt",
@@ -1,350 +0,0 @@
1
- import { ObjectRegistry, SmrtObject, crossPackageRef, foreignKey, smrt } from "@happyvertical/smrt-core";
2
- //#region src/__smrt-register__.ts
3
- ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":1785638595771,\"packageName\":\"@happyvertical/smrt-secrets\",\"packageVersion\":\"0.40.44\",\"objects\":{\"@happyvertical/smrt-secrets:Secret\":{\"name\":\"secret\",\"className\":\"Secret\",\"qualifiedName\":\"@happyvertical/smrt-secrets:Secret\",\"collection\":\"secrets\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/secrets/src/models/Secret.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"default\":\"\",\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"mode\":\"required\",\"field\":\"tenantId\",\"autoFilter\":true,\"autoPopulate\":true,\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"category\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"encryptedValue\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"keyVersion\":{\"type\":\"integer\",\"required\":false,\"default\":1},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"active\"},\"expiresAt\":{\"type\":\"datetime\",\"required\":false},\"lastAccessedAt\":{\"type\":\"datetime\",\"required\":false},\"accessCount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"metadata\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isExpired\":{\"name\":\"isExpired\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isUsable\":{\"name\":\"isUsable\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"recordAccess\":{\"name\":\"recordAccess\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"disable\":{\"name\":\"disable\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"enable\":{\"name\":\"enable\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tenantScoped\":true,\"api\":{\"include\":[]},\"mcp\":{\"include\":[]},\"cli\":{\"include\":[\"list\"],\"skipApiCheck\":true}},\"extends\":\"SmrtObject\",\"exportName\":\"Secret\",\"collectionExportName\":\"SecretCollection\",\"schema\":{\"tableName\":\"secrets\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"secrets\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"category\\\" TEXT DEFAULT '',\\n \\\"encrypted_value\\\" TEXT DEFAULT '',\\n \\\"key_version\\\" INTEGER DEFAULT 1,\\n \\\"status\\\" TEXT DEFAULT 'active',\\n \\\"expires_at\\\" TIMESTAMP,\\n \\\"last_accessed_at\\\" TIMESTAMP,\\n \\\"access_count\\\" INTEGER DEFAULT 0,\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"category\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"encrypted_value\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"key_version\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":1},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"last_accessed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"access_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"secrets_id_idx\",\"columns\":[\"id\"]},{\"name\":\"secrets_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"6298a980\"}},\"@happyvertical/smrt-secrets:SecretAuditLog\":{\"name\":\"secretauditlog\",\"className\":\"SecretAuditLog\",\"qualifiedName\":\"@happyvertical/smrt-secrets:SecretAuditLog\",\"collection\":\"secretauditlogs\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/secrets/src/models/SecretAuditLog.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"mode\":\"required\",\"field\":\"tenantId\",\"autoFilter\":true,\"autoPopulate\":true,\"allowSuperAdminBypass\":false}}},\"secretId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Secret\"},\"secretName\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"userId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:User\"},\"action\":{\"type\":\"text\",\"required\":false,\"default\":\"read\"},\"result\":{\"type\":\"text\",\"required\":false,\"default\":\"success\"},\"ipAddress\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"userAgent\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"details\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"isSuccess\":{\"name\":\"isSuccess\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isFailure\":{\"name\":\"isFailure\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isDenied\":{\"name\":\"isDenied\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isReadAction\":{\"name\":\"isReadAction\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isWriteAction\":{\"name\":\"isWriteAction\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isKeyOperation\":{\"name\":\"isKeyOperation\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tenantScoped\":true,\"api\":{\"include\":[]},\"mcp\":{\"include\":[]},\"cli\":{\"include\":[\"list\"],\"skipApiCheck\":true}},\"extends\":\"SmrtObject\",\"exportName\":\"SecretAuditLog\",\"collectionExportName\":\"SecretAuditLogCollection\",\"schema\":{\"tableName\":\"secret_audit_logs\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"secret_audit_logs\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"secret_id\\\" UUID,\\n \\\"secret_name\\\" TEXT DEFAULT '',\\n \\\"user_id\\\" UUID,\\n \\\"action\\\" TEXT DEFAULT 'read',\\n \\\"result\\\" TEXT DEFAULT 'success',\\n \\\"ip_address\\\" TEXT DEFAULT '',\\n \\\"user_agent\\\" TEXT DEFAULT '',\\n \\\"details\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"secret_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"secret_name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"action\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"read\"},\"result\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"success\"},\"ip_address\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"user_agent\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"details\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"secret_audit_logs_id_idx\",\"columns\":[\"id\"]},{\"name\":\"secret_audit_logs_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"af0d679d\"}},\"@happyvertical/smrt-secrets:TenantKey\":{\"name\":\"tenantkey\",\"className\":\"TenantKey\",\"qualifiedName\":\"@happyvertical/smrt-secrets:TenantKey\",\"collection\":\"tenantkeys\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/secrets/src/models/TenantKey.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"wrappedKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"amkKeyId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"active\"},\"version\":{\"type\":\"integer\",\"required\":false,\"default\":1},\"rotateAfter\":{\"type\":\"datetime\",\"required\":false},\"retiredAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"needsRotation\":{\"name\":\"needsRotation\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isRetired\":{\"name\":\"isRetired\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isCompromised\":{\"name\":\"isCompromised\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"canDecrypt\":{\"name\":\"canDecrypt\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"canEncrypt\":{\"name\":\"canEncrypt\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"retire\":{\"name\":\"retire\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"markCompromised\":{\"name\":\"markCompromised\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"api\":{\"include\":[]},\"mcp\":{\"include\":[]},\"cli\":{\"include\":[\"list\",\"get\"],\"skipApiCheck\":true}},\"extends\":\"SmrtObject\",\"exportName\":\"TenantKey\",\"collectionExportName\":\"TenantKeyCollection\",\"schema\":{\"tableName\":\"tenant_keys\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"tenant_keys\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" TEXT DEFAULT '',\\n \\\"wrapped_key\\\" TEXT DEFAULT '',\\n \\\"amk_key_id\\\" TEXT DEFAULT '',\\n \\\"status\\\" TEXT DEFAULT 'active',\\n \\\"version\\\" INTEGER DEFAULT 1,\\n \\\"rotate_after\\\" TIMESTAMP,\\n \\\"retired_at\\\" TIMESTAMP\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"wrapped_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"amk_key_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"version\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":1},\"rotate_after\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"retired_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"tenant_keys_id_idx\",\"columns\":[\"id\"]},{\"name\":\"tenant_keys_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"79fd7e46\"}},\"@happyvertical/smrt-secrets:SecretAuditLogCollection\":{\"name\":\"secretauditlogcollection\",\"className\":\"SecretAuditLogCollection\",\"qualifiedName\":\"@happyvertical/smrt-secrets:SecretAuditLogCollection\",\"collection\":\"secretauditlogs\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/secrets/src/collections/SecretAuditLogCollection.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{},\"methods\":{\"listLogs\":{\"name\":\"listLogs\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"ListAuditLogsOptions\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getSecretHistory\":{\"name\":\"getSecretHistory\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"secretName\",\"type\":\"string\",\"optional\":false},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getUserActivity\":{\"name\":\"getUserActivity\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"userId\",\"type\":\"string\",\"optional\":false},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getRecentFailures\":{\"name\":\"getRecentFailures\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getRecentDenials\":{\"name\":\"getRecentDenials\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"countByAction\":{\"name\":\"countByAction\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"since\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<Record<SecretAuditAction, number>>\",\"isStatic\":false,\"isPublic\":true},\"countByResult\":{\"name\":\"countByResult\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false},{\"name\":\"since\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<Record<SecretAuditResult, number>>\",\"isStatic\":false,\"isPublic\":true},\"cleanup\":{\"name\":\"cleanup\",\"async\":true,\"parameters\":[{\"name\":\"olderThanDays\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"SecretAuditLog\",\"exportName\":\"SecretAuditLogCollection\",\"collectionExportName\":\"SecretAuditLogCollectionCollection\",\"schema\":{\"tableName\":\"secret_audit_log_collections\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"secret_audit_log_collections\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"secret_audit_log_collections_id_idx\",\"columns\":[\"id\"]},{\"name\":\"secret_audit_log_collections_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"7bb61130\"}},\"@happyvertical/smrt-secrets:SecretCollection\":{\"name\":\"secretcollection\",\"className\":\"SecretCollection\",\"qualifiedName\":\"@happyvertical/smrt-secrets:SecretCollection\",\"collection\":\"secrets\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/secrets/src/collections/SecretCollection.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{},\"methods\":{\"findByName\":{\"name\":\"findByName\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"name\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Secret | null>\",\"isStatic\":false,\"isPublic\":true},\"listSecrets\":{\"name\":\"listSecrets\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"ListSecretsOptions\",\"optional\":true}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"listActive\":{\"name\":\"listActive\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"listByCategory\":{\"name\":\"listByCategory\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"category\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"listExpiring\":{\"name\":\"listExpiring\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"daysAhead\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"getCategories\":{\"name\":\"getCategories\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<string[]>\",\"isStatic\":false,\"isPublic\":true},\"countByStatus\":{\"name\":\"countByStatus\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Record<SecretStatus, number>>\",\"isStatic\":false,\"isPublic\":true},\"deleteByName\":{\"name\":\"deleteByName\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"name\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Secret\",\"exportName\":\"SecretCollection\",\"collectionExportName\":\"SecretCollectionCollection\",\"schema\":{\"tableName\":\"secret_collections\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"secret_collections\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"secret_collections_id_idx\",\"columns\":[\"id\"]},{\"name\":\"secret_collections_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"5f18a721\"}},\"@happyvertical/smrt-secrets:TenantKeyCollection\":{\"name\":\"tenantkeycollection\",\"className\":\"TenantKeyCollection\",\"qualifiedName\":\"@happyvertical/smrt-secrets:TenantKeyCollection\",\"collection\":\"tenantkeys\",\"filePath\":\"/home/runner/_work/smrt/smrt/packages/secrets/src/collections/TenantKeyCollection.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{},\"methods\":{\"getActiveKey\":{\"name\":\"getActiveKey\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantKey | null>\",\"isStatic\":false,\"isPublic\":true},\"listKeyVersions\":{\"name\":\"listKeyVersions\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantKey[]>\",\"isStatic\":false,\"isPublic\":true},\"getKeyVersion\":{\"name\":\"getKeyVersion\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"version\",\"type\":\"number\",\"optional\":false}],\"returnType\":\"Promise<TenantKey | null>\",\"isStatic\":false,\"isPublic\":true},\"findKeysNeedingRotation\":{\"name\":\"findKeysNeedingRotation\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<TenantKey[]>\",\"isStatic\":false,\"isPublic\":true},\"listAllActiveKeys\":{\"name\":\"listAllActiveKeys\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<TenantKey[]>\",\"isStatic\":false,\"isPublic\":true},\"countByStatus\":{\"name\":\"countByStatus\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Record<TenantKeyStatus, number>>\",\"isStatic\":false,\"isPublic\":true},\"markCompromised\":{\"name\":\"markCompromised\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"keyId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true},\"cleanupRetiredKeys\":{\"name\":\"cleanupRetiredKeys\",\"async\":true,\"parameters\":[{\"name\":\"olderThanDays\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"TenantKey\",\"exportName\":\"TenantKeyCollection\",\"collectionExportName\":\"TenantKeyCollectionCollection\",\"schema\":{\"tableName\":\"tenant_key_collections\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"tenant_key_collections\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"}},\"indexes\":[{\"name\":\"tenant_key_collections_id_idx\",\"columns\":[\"id\"]},{\"name\":\"tenant_key_collections_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true}],\"version\":\"26616d13\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-tenancy\"]}"));
4
- //#endregion
5
- //#region \0@oxc-project+runtime@0.138.0/helpers/esm/decorate.js
6
- function __decorate(decorators, target, key, desc) {
7
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
- return c > 3 && r && Object.defineProperty(target, key, r), r;
11
- }
12
- //#endregion
13
- //#region src/models/SecretAuditLog.ts
14
- var SecretAuditLog = class SecretAuditLog extends SmrtObject {
15
- /**
16
- * Tenant associated with the audited secret operation.
17
- */
18
- tenantId = null;
19
- /**
20
- * ID of the secret (may be null for deleted secrets)
21
- */
22
- secretId = null;
23
- /**
24
- * Name of the secret at the time of the operation
25
- */
26
- secretName = "";
27
- /**
28
- * ID of the user who performed the action, or `null` for system-initiated
29
- * operations with no authenticated user. Stored as a native `uuid` column on
30
- * Postgres, so a non-UUID actor sentinel must never reach it —
31
- * {@link createAuditEntry} normalizes the `'system'` sentinel to null (#1444).
32
- */
33
- userId = null;
34
- /**
35
- * The action that was performed
36
- */
37
- action = "read";
38
- /**
39
- * Result of the operation
40
- */
41
- result = "success";
42
- /**
43
- * IP address of the client (if available)
44
- */
45
- ipAddress = "";
46
- /**
47
- * User agent string (if available)
48
- */
49
- userAgent = "";
50
- /**
51
- * Additional context about the operation
52
- */
53
- details = {};
54
- constructor(options = {}) {
55
- super(options);
56
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
57
- if (options.secretId !== void 0) this.secretId = options.secretId;
58
- if (options.secretName !== void 0) this.secretName = options.secretName;
59
- if (options.userId !== void 0) this.userId = options.userId;
60
- if (options.action !== void 0) this.action = options.action;
61
- if (options.result !== void 0) this.result = options.result;
62
- if (options.ipAddress !== void 0) this.ipAddress = options.ipAddress;
63
- if (options.userAgent !== void 0) this.userAgent = options.userAgent;
64
- if (options.details !== void 0) this.details = options.details;
65
- }
66
- /**
67
- * Check if this was a successful operation
68
- */
69
- isSuccess() {
70
- return this.result === "success";
71
- }
72
- /**
73
- * Check if this was a failed operation
74
- */
75
- isFailure() {
76
- return this.result === "failure";
77
- }
78
- /**
79
- * Check if this was a denied operation (permission denied)
80
- */
81
- isDenied() {
82
- return this.result === "denied";
83
- }
84
- /**
85
- * Check if this is a read operation
86
- */
87
- isReadAction() {
88
- return this.action === "read";
89
- }
90
- /**
91
- * Check if this is a write operation (create, update, delete)
92
- */
93
- isWriteAction() {
94
- return [
95
- "create",
96
- "update",
97
- "delete"
98
- ].includes(this.action);
99
- }
100
- /**
101
- * Check if this is a key operation
102
- */
103
- isKeyOperation() {
104
- return this.action === "rotate_key";
105
- }
106
- };
107
- __decorate([foreignKey("Secret")], SecretAuditLog.prototype, "secretId", void 0);
108
- __decorate([crossPackageRef("@happyvertical/smrt-users:User")], SecretAuditLog.prototype, "userId", void 0);
109
- SecretAuditLog = __decorate([smrt({
110
- tenantScoped: true,
111
- api: { include: [] },
112
- mcp: { include: [] },
113
- cli: {
114
- include: ["list"],
115
- skipApiCheck: true
116
- }
117
- })], SecretAuditLog);
118
- /**
119
- * Create an audit log entry for a secret operation
120
- */
121
- function createAuditEntry(params) {
122
- const tenantId = params.tenantId === void 0 || params.tenantId === "system" ? null : params.tenantId;
123
- const userId = params.userId == null || params.userId === "system" || params.userId === "" ? null : params.userId;
124
- return {
125
- secretId: params.secretId ?? null,
126
- secretName: params.secretName,
127
- userId,
128
- action: params.action,
129
- result: params.result,
130
- ipAddress: params.ipAddress ?? "",
131
- userAgent: params.userAgent ?? "",
132
- details: params.details ?? {},
133
- tenantId
134
- };
135
- }
136
- //#endregion
137
- //#region src/models/Secret.ts
138
- var Secret = class Secret extends SmrtObject {
139
- /**
140
- * Tenant that owns this secret. Also stored in context for per-tenant name uniqueness.
141
- */
142
- tenantId = "";
143
- /**
144
- * Unique name for the secret within the tenant
145
- */
146
- name = "";
147
- /**
148
- * Human-readable description
149
- */
150
- description = "";
151
- /**
152
- * Category for organization (e.g., 'database', 'api-key', 'oauth')
153
- */
154
- category = "";
155
- /**
156
- * JSON-encoded EncryptedEnvelope from @happyvertical/secrets
157
- */
158
- encryptedValue = "";
159
- /**
160
- * Version of the tenant key used to encrypt this secret
161
- */
162
- keyVersion = 1;
163
- /**
164
- * Current status of the secret
165
- */
166
- status = "active";
167
- /**
168
- * Optional expiration date
169
- */
170
- expiresAt = null;
171
- /**
172
- * Last time this secret was accessed (decrypted)
173
- */
174
- lastAccessedAt = null;
175
- /**
176
- * Number of times this secret has been accessed
177
- */
178
- accessCount = 0;
179
- /**
180
- * Additional metadata stored with the secret
181
- */
182
- metadata = {};
183
- constructor(options = {}) {
184
- super(options);
185
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
186
- if (options.name !== void 0) this.name = options.name;
187
- if (options.description !== void 0) this.description = options.description;
188
- if (options.category !== void 0) this.category = options.category;
189
- if (options.encryptedValue !== void 0) this.encryptedValue = options.encryptedValue;
190
- if (options.keyVersion !== void 0) this.keyVersion = options.keyVersion;
191
- if (options.status !== void 0) this.status = options.status;
192
- if (options.expiresAt !== void 0) this.expiresAt = options.expiresAt instanceof Date ? options.expiresAt : options.expiresAt ? new Date(options.expiresAt) : null;
193
- if (options.lastAccessedAt !== void 0) this.lastAccessedAt = options.lastAccessedAt instanceof Date ? options.lastAccessedAt : options.lastAccessedAt ? new Date(options.lastAccessedAt) : null;
194
- if (options.accessCount !== void 0) this.accessCount = options.accessCount;
195
- if (options.metadata !== void 0) this.metadata = options.metadata;
196
- }
197
- /**
198
- * Check if the secret is currently active
199
- */
200
- isActive() {
201
- return this.status === "active";
202
- }
203
- /**
204
- * Check if the secret has expired
205
- */
206
- isExpired() {
207
- if (!this.expiresAt) return false;
208
- return /* @__PURE__ */ new Date() >= this.expiresAt;
209
- }
210
- /**
211
- * Check if the secret can be used (active and not expired)
212
- */
213
- isUsable() {
214
- return this.isActive() && !this.isExpired();
215
- }
216
- /**
217
- * Record an access to this secret
218
- */
219
- recordAccess() {
220
- this.lastAccessedAt = /* @__PURE__ */ new Date();
221
- this.accessCount += 1;
222
- }
223
- /**
224
- * Disable the secret
225
- */
226
- disable() {
227
- this.status = "disabled";
228
- }
229
- /**
230
- * Enable the secret
231
- */
232
- enable() {
233
- this.status = "active";
234
- }
235
- };
236
- Secret = __decorate([smrt({
237
- tenantScoped: true,
238
- api: { include: [] },
239
- mcp: { include: [] },
240
- cli: {
241
- include: ["list"],
242
- skipApiCheck: true
243
- }
244
- })], Secret);
245
- //#endregion
246
- //#region src/models/TenantKey.ts
247
- var TenantKey = class TenantKey extends SmrtObject {
248
- /**
249
- * Tenant ID this key belongs to
250
- */
251
- tenantId = "";
252
- /**
253
- * Wrapped key data (format: wrappedKey:iv:authTag)
254
- */
255
- wrappedKey = "";
256
- /**
257
- * ID of the AMK used to wrap this key
258
- */
259
- amkKeyId = "";
260
- /**
261
- * Current status of the key
262
- */
263
- status = "active";
264
- /**
265
- * Version number (increments on rotation)
266
- */
267
- version = 1;
268
- /**
269
- * Recommended rotation date
270
- */
271
- rotateAfter = null;
272
- /**
273
- * When the key was retired (if applicable)
274
- */
275
- retiredAt = null;
276
- constructor(options = {}) {
277
- super(options);
278
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
279
- if (options.wrappedKey !== void 0) this.wrappedKey = options.wrappedKey;
280
- if (options.amkKeyId !== void 0) this.amkKeyId = options.amkKeyId;
281
- if (options.status !== void 0) this.status = options.status;
282
- if (options.version !== void 0) this.version = options.version;
283
- if (options.rotateAfter !== void 0) this.rotateAfter = options.rotateAfter instanceof Date ? options.rotateAfter : options.rotateAfter ? new Date(options.rotateAfter) : null;
284
- if (options.retiredAt !== void 0) this.retiredAt = options.retiredAt instanceof Date ? options.retiredAt : options.retiredAt ? new Date(options.retiredAt) : null;
285
- }
286
- /**
287
- * Check if this key is currently active
288
- */
289
- isActive() {
290
- return this.status === "active";
291
- }
292
- /**
293
- * Check if this key needs rotation
294
- */
295
- needsRotation() {
296
- if (!this.rotateAfter) return false;
297
- return /* @__PURE__ */ new Date() >= this.rotateAfter;
298
- }
299
- /**
300
- * Check if this key is retired
301
- */
302
- isRetired() {
303
- return this.status === "retired";
304
- }
305
- /**
306
- * Check if this key is compromised
307
- */
308
- isCompromised() {
309
- return this.status === "compromised";
310
- }
311
- /**
312
- * Check if this key can be used for decryption
313
- * (active or retired keys can decrypt)
314
- */
315
- canDecrypt() {
316
- return this.status === "active" || this.status === "retired";
317
- }
318
- /**
319
- * Check if this key can be used for encryption
320
- * (only active keys should encrypt)
321
- */
322
- canEncrypt() {
323
- return this.status === "active";
324
- }
325
- /**
326
- * Mark this key as retired
327
- */
328
- retire() {
329
- this.status = "retired";
330
- this.retiredAt = /* @__PURE__ */ new Date();
331
- }
332
- /**
333
- * Mark this key as compromised
334
- */
335
- markCompromised() {
336
- this.status = "compromised";
337
- }
338
- };
339
- TenantKey = __decorate([smrt({
340
- api: { include: [] },
341
- mcp: { include: [] },
342
- cli: {
343
- include: ["list", "get"],
344
- skipApiCheck: true
345
- }
346
- })], TenantKey);
347
- //#endregion
348
- export { createAuditEntry as i, Secret as n, SecretAuditLog as r, TenantKey as t };
349
-
350
- //# sourceMappingURL=TenantKey-MaMd5UjL.js.map