@happyvertical/smrt-secrets 0.30.0

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.
Files changed (39) hide show
  1. package/AGENTS.md +66 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +144 -0
  5. package/dist/__smrt-register__.d.ts +2 -0
  6. package/dist/__smrt-register__.d.ts.map +1 -0
  7. package/dist/chunks/SecretService-C91H6WJK.js +1275 -0
  8. package/dist/chunks/SecretService-C91H6WJK.js.map +1 -0
  9. package/dist/chunks/TenantKey-DzglnpAV.js +377 -0
  10. package/dist/chunks/TenantKey-DzglnpAV.js.map +1 -0
  11. package/dist/collections/SecretAuditLogCollection.d.ts +71 -0
  12. package/dist/collections/SecretAuditLogCollection.d.ts.map +1 -0
  13. package/dist/collections/SecretCollection.d.ts +63 -0
  14. package/dist/collections/SecretCollection.d.ts.map +1 -0
  15. package/dist/collections/TenantKeyCollection.d.ts +42 -0
  16. package/dist/collections/TenantKeyCollection.d.ts.map +1 -0
  17. package/dist/collections/index.d.ts +8 -0
  18. package/dist/collections/index.d.ts.map +1 -0
  19. package/dist/index.d.ts +12 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +26 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/manifest.json +1272 -0
  24. package/dist/models/Secret.d.ts +104 -0
  25. package/dist/models/Secret.d.ts.map +1 -0
  26. package/dist/models/SecretAuditLog.d.ts +123 -0
  27. package/dist/models/SecretAuditLog.d.ts.map +1 -0
  28. package/dist/models/TenantKey.d.ts +101 -0
  29. package/dist/models/TenantKey.d.ts.map +1 -0
  30. package/dist/models/index.d.ts +4 -0
  31. package/dist/models/index.d.ts.map +1 -0
  32. package/dist/models/index.js +8 -0
  33. package/dist/models/index.js.map +1 -0
  34. package/dist/services/SecretService.d.ts +266 -0
  35. package/dist/services/SecretService.d.ts.map +1 -0
  36. package/dist/services/SecretService.js +9 -0
  37. package/dist/services/SecretService.js.map +1 -0
  38. package/dist/smrt-knowledge.json +447 -0
  39. package/package.json +71 -0
@@ -0,0 +1,71 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { SecretAuditAction, SecretAuditLog, SecretAuditResult } from '../models/SecretAuditLog.js';
3
+ /**
4
+ * Options for listing audit logs
5
+ */
6
+ export interface ListAuditLogsOptions {
7
+ /**
8
+ * Scope results to a single tenant's audit trail. Tenant-facing callers
9
+ * (e.g. SecretService.getAuditLogs) must always set this — audit rows
10
+ * reference secret names and must not leak across tenants (issue #1501).
11
+ * Omit only for cross-tenant compliance tooling running under
12
+ * withSuperAdminBypass().
13
+ */
14
+ tenantId?: string;
15
+ /** Filter by secret name */
16
+ secretName?: string;
17
+ /** Filter by user ID */
18
+ userId?: string;
19
+ /** Filter by action type */
20
+ action?: SecretAuditAction;
21
+ /** Filter by result */
22
+ result?: SecretAuditResult;
23
+ /** Filter by date range start */
24
+ since?: Date;
25
+ /** Filter by date range end */
26
+ until?: Date;
27
+ /** Maximum number of results */
28
+ limit?: number;
29
+ /** Offset for pagination */
30
+ offset?: number;
31
+ }
32
+ /**
33
+ * Collection for managing SecretAuditLog objects
34
+ */
35
+ export declare class SecretAuditLogCollection extends SmrtCollection<SecretAuditLog> {
36
+ static readonly _itemClass: typeof SecretAuditLog;
37
+ /**
38
+ * List audit logs with filtering options
39
+ */
40
+ listLogs(options?: ListAuditLogsOptions): Promise<SecretAuditLog[]>;
41
+ /**
42
+ * Get audit logs for a specific secret
43
+ */
44
+ getSecretHistory(secretName: string, limit?: number): Promise<SecretAuditLog[]>;
45
+ /**
46
+ * Get audit logs for a specific user
47
+ */
48
+ getUserActivity(userId: string, limit?: number): Promise<SecretAuditLog[]>;
49
+ /**
50
+ * Get recent failures
51
+ */
52
+ getRecentFailures(limit?: number): Promise<SecretAuditLog[]>;
53
+ /**
54
+ * Get recent denied access attempts
55
+ */
56
+ getRecentDenials(limit?: number): Promise<SecretAuditLog[]>;
57
+ /**
58
+ * Count operations by action type
59
+ */
60
+ countByAction(since?: Date): Promise<Record<SecretAuditAction, number>>;
61
+ /**
62
+ * Count operations by result
63
+ */
64
+ countByResult(since?: Date): Promise<Record<SecretAuditResult, number>>;
65
+ /**
66
+ * Delete old audit logs
67
+ * @param olderThanDays Delete logs older than this many days
68
+ */
69
+ cleanup(olderThanDays?: number): Promise<number>;
70
+ }
71
+ //# sourceMappingURL=SecretAuditLogCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecretAuditLogCollection.d.ts","sourceRoot":"","sources":["../../src/collections/SecretAuditLogCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,KAAK,iBAAiB,EACtB,cAAc,EACd,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,uBAAuB;IACvB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,iCAAiC;IACjC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,+BAA+B;IAC/B,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC1E,MAAM,CAAC,QAAQ,CAAC,UAAU,wBAAkB;IAE5C;;OAEG;IACG,QAAQ,CACZ,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,cAAc,EAAE,CAAC;IAuC5B;;OAEG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,cAAc,EAAE,CAAC;IAI5B;;OAEG;IACG,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,cAAc,EAAE,CAAC;IAI5B;;OAEG;IACG,iBAAiB,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAItE;;OAEG;IACG,gBAAgB,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIrE;;OAEG;IACG,aAAa,CACjB,KAAK,CAAC,EAAE,IAAI,GACX,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAqB7C;;OAEG;IACG,aAAa,CACjB,KAAK,CAAC,EAAE,IAAI,GACX,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAgB7C;;;OAGG;IACG,OAAO,CAAC,aAAa,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;CAkB5D"}
@@ -0,0 +1,63 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { Secret, SecretStatus } from '../models/Secret.js';
3
+ /**
4
+ * Options for listing secrets
5
+ */
6
+ export interface ListSecretsOptions {
7
+ /** Filter by category */
8
+ category?: string;
9
+ /** Filter by status */
10
+ status?: SecretStatus;
11
+ /** Include expired secrets */
12
+ includeExpired?: boolean;
13
+ /** Maximum number of results */
14
+ limit?: number;
15
+ /** Offset for pagination */
16
+ offset?: number;
17
+ }
18
+ /**
19
+ * Collection for managing Secret objects
20
+ *
21
+ * All lookups take an explicit `tenantId` and scope on the authoritative
22
+ * `tenant_id` column. Scoping must NOT rely on the tenancy interceptor
23
+ * (which may be disabled in the host application) and must NOT use the
24
+ * `context` column: `context = tenantId` is only a convention applied on
25
+ * the create path, so pre-convention rows may have a divergent `context`.
26
+ * See https://github.com/happyvertical/smrt/issues/1501
27
+ */
28
+ export declare class SecretCollection extends SmrtCollection<Secret> {
29
+ static readonly _itemClass: typeof Secret;
30
+ /**
31
+ * Find a secret by name within the given tenant
32
+ */
33
+ findByName(tenantId: string, name: string): Promise<Secret | null>;
34
+ /**
35
+ * List secrets for a tenant with filtering options
36
+ */
37
+ listSecrets(tenantId: string, options?: ListSecretsOptions): Promise<Secret[]>;
38
+ /**
39
+ * List all active secrets for a tenant
40
+ */
41
+ listActive(tenantId: string): Promise<Secret[]>;
42
+ /**
43
+ * List a tenant's secrets by category
44
+ */
45
+ listByCategory(tenantId: string, category: string): Promise<Secret[]>;
46
+ /**
47
+ * List a tenant's secrets that need attention (expired or about to expire)
48
+ */
49
+ listExpiring(tenantId: string, daysAhead?: number): Promise<Secret[]>;
50
+ /**
51
+ * Get categories used in a tenant's secrets
52
+ */
53
+ getCategories(tenantId: string): Promise<string[]>;
54
+ /**
55
+ * Count a tenant's secrets by status
56
+ */
57
+ countByStatus(tenantId: string): Promise<Record<SecretStatus, number>>;
58
+ /**
59
+ * Delete a tenant's secret by name
60
+ */
61
+ deleteByName(tenantId: string, name: string): Promise<boolean>;
62
+ }
63
+ //# sourceMappingURL=SecretCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecretCollection.d.ts","sourceRoot":"","sources":["../../src/collections/SecretCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAC1D,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAU;IAEpC;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxE;;OAEG;IACG,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC;IA0BpB;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIrD;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI3E;;OAEG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAAW,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC;IAiBpB;;OAEG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAMxD;;OAEG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAoB5E;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAOrE"}
@@ -0,0 +1,42 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { TenantKey, TenantKeyStatus } from '../models/TenantKey.js';
3
+ /**
4
+ * Collection for managing TenantKey objects
5
+ */
6
+ export declare class TenantKeyCollection extends SmrtCollection<TenantKey> {
7
+ static readonly _itemClass: typeof TenantKey;
8
+ /**
9
+ * Get the active key for a tenant
10
+ */
11
+ getActiveKey(tenantId: string): Promise<TenantKey | null>;
12
+ /**
13
+ * List all key versions for a tenant
14
+ */
15
+ listKeyVersions(tenantId: string): Promise<TenantKey[]>;
16
+ /**
17
+ * Get a specific key version for a tenant
18
+ */
19
+ getKeyVersion(tenantId: string, version: number): Promise<TenantKey | null>;
20
+ /**
21
+ * Find keys that need rotation
22
+ */
23
+ findKeysNeedingRotation(): Promise<TenantKey[]>;
24
+ /**
25
+ * List all active keys across all tenants
26
+ */
27
+ listAllActiveKeys(): Promise<TenantKey[]>;
28
+ /**
29
+ * Count keys by status
30
+ */
31
+ countByStatus(): Promise<Record<TenantKeyStatus, number>>;
32
+ /**
33
+ * Mark a key as compromised (should trigger re-encryption)
34
+ */
35
+ markCompromised(tenantId: string, keyId: string): Promise<boolean>;
36
+ /**
37
+ * Delete old retired keys that are no longer needed
38
+ * @param olderThanDays Delete keys retired more than this many days ago
39
+ */
40
+ cleanupRetiredKeys(olderThanDays?: number): Promise<number>;
41
+ }
42
+ //# sourceMappingURL=TenantKeyCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TenantKeyCollection.d.ts","sourceRoot":"","sources":["../../src/collections/TenantKeyCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,SAAS,CAAC;IAChE,MAAM,CAAC,QAAQ,CAAC,UAAU,mBAAa;IAEvC;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAO/D;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAO7D;;OAEG;IACG,aAAa,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAO5B;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAarD;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAO/C;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAiB/D;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAaxE;;;OAGG;IACG,kBAAkB,CAAC,aAAa,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CAmBtE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Secret management collections
3
+ * @packageDocumentation
4
+ */
5
+ export { type ListAuditLogsOptions, SecretAuditLogCollection, } from './SecretAuditLogCollection.js';
6
+ export { type ListSecretsOptions, SecretCollection, } from './SecretCollection.js';
7
+ export { TenantKeyCollection } from './TenantKeyCollection.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,oBAAoB,EACzB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,kBAAkB,EACvB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type { ApplicationMasterKey, EncryptedEnvelope, SecretStore, TenantDataEncryptionKey, } from '@happyvertical/secrets';
2
+ export { AMKUnavailableError, DecryptionError, EncryptionError, InvalidKeyFormatError, KeyNotFoundError, KeyRotationError, SecretError, StoreNotInitializedError, TenantKeyMissingError, } from '@happyvertical/secrets';
3
+ export { type ListAuditLogsOptions, SecretAuditLogCollection, } from './collections/SecretAuditLogCollection.js';
4
+ export { type ListSecretsOptions, SecretCollection, } from './collections/SecretCollection.js';
5
+ export { TenantKeyCollection } from './collections/TenantKeyCollection.js';
6
+ export { Secret, type SecretStatus, } from './models/Secret.js';
7
+ export { createAuditEntry, type SecretAuditAction, SecretAuditLog, type SecretAuditResult, } from './models/SecretAuditLog.js';
8
+ export { TenantKey, type TenantKeyStatus, } from './models/TenantKey.js';
9
+ export { type DiagnoseTenantSecretKeyDriftOptions, type RepairTenantSecretKeyDriftOptions, type RetrievedSecret, SecretKeyDriftError, type SecretKeyDriftIssue, type SecretKeyDriftIssueCode, type SecretKeyDriftIssueSeverity, type SecretKeyDriftRepairAction, type SecretKeyDriftRepairResult, type SecretKeyDriftReport, SecretService, type SecretServiceOptions, type StoreSecretOptions, } from './services/SecretService.js';
10
+ /** @internal */
11
+ export declare const PACKAGE_VERSION_INITIALIZED = true;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,KAAK,oBAAoB,EACzB,wBAAwB,GACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,KAAK,kBAAkB,EACvB,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E,OAAO,EACL,MAAM,EACN,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,cAAc,EACd,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,SAAS,EACT,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,EACtC,KAAK,eAAe,EACpB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,6BAA6B,CAAC;AAErC,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,OAAO,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ import { S, a, T, c } from "./chunks/TenantKey-DzglnpAV.js";
2
+ import { AMKUnavailableError, DecryptionError, EncryptionError, InvalidKeyFormatError, KeyNotFoundError, KeyRotationError, SecretError, StoreNotInitializedError, TenantKeyMissingError } from "@happyvertical/secrets";
3
+ import { S as S2, a as a2, b, c as c2, T as T2 } from "./chunks/SecretService-C91H6WJK.js";
4
+ const PACKAGE_VERSION_INITIALIZED = true;
5
+ export {
6
+ AMKUnavailableError,
7
+ DecryptionError,
8
+ EncryptionError,
9
+ InvalidKeyFormatError,
10
+ KeyNotFoundError,
11
+ KeyRotationError,
12
+ PACKAGE_VERSION_INITIALIZED,
13
+ S as Secret,
14
+ a as SecretAuditLog,
15
+ S2 as SecretAuditLogCollection,
16
+ a2 as SecretCollection,
17
+ SecretError,
18
+ b as SecretKeyDriftError,
19
+ c2 as SecretService,
20
+ StoreNotInitializedError,
21
+ T as TenantKey,
22
+ T2 as TenantKeyCollection,
23
+ TenantKeyMissingError,
24
+ c as createAuditEntry
25
+ };
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * @happyvertical/smrt-secrets\n *\n * Per-tenant secret management with envelope encryption for SMRT.\n *\n * @example\n * ```typescript\n * import { SecretService } from '@happyvertical/smrt-secrets';\n * import { withTenant } from '@happyvertical/smrt-tenancy';\n * import { getDatabase } from '@happyvertical/sql';\n *\n * // Create database connection\n * const db = await getDatabase({ type: 'sqlite', url: 'app.db' });\n *\n * // Create secret service\n * const service = await SecretService.create({ db });\n *\n * // Use within tenant context\n * await withTenant({ tenantId: 'tenant-123' }, async () => {\n * // Store a secret\n * await service.store('api-key', 'sk_live_xxx', {\n * category: 'stripe',\n * description: 'Production API key'\n * });\n *\n * // Retrieve the secret\n * const { value } = await service.retrieve('api-key');\n * console.log(value); // 'sk_live_xxx'\n *\n * // List secrets (names only)\n * const secrets = await service.list();\n *\n * // Rotate encryption key\n * await service.rotateKey();\n *\n * // Delete a secret\n * await service.delete('api-key');\n * });\n * ```\n *\n * @packageDocumentation\n */\n\n// Self-register this package's manifest before any @smrt() decorator fires\n// downstream. Must come first so the side effect runs ahead of the class\n// module loads below. See __smrt-register__.ts for issue #1132 context.\nimport './__smrt-register__.js';\n\n// Re-export SDK types for convenience\nexport type {\n ApplicationMasterKey,\n EncryptedEnvelope,\n SecretStore,\n TenantDataEncryptionKey,\n} from '@happyvertical/secrets';\n// Re-export SDK errors\nexport {\n AMKUnavailableError,\n DecryptionError,\n EncryptionError,\n InvalidKeyFormatError,\n KeyNotFoundError,\n KeyRotationError,\n SecretError,\n StoreNotInitializedError,\n TenantKeyMissingError,\n} from '@happyvertical/secrets';\n// Collections\nexport {\n type ListAuditLogsOptions,\n SecretAuditLogCollection,\n} from './collections/SecretAuditLogCollection.js';\nexport {\n type ListSecretsOptions,\n SecretCollection,\n} from './collections/SecretCollection.js';\nexport { TenantKeyCollection } from './collections/TenantKeyCollection.js';\n\n// Models\nexport {\n Secret,\n type SecretStatus,\n} from './models/Secret.js';\nexport {\n createAuditEntry,\n type SecretAuditAction,\n SecretAuditLog,\n type SecretAuditResult,\n} from './models/SecretAuditLog.js';\nexport {\n TenantKey,\n type TenantKeyStatus,\n} from './models/TenantKey.js';\n// Service\nexport {\n type DiagnoseTenantSecretKeyDriftOptions,\n type RepairTenantSecretKeyDriftOptions,\n type RetrievedSecret,\n SecretKeyDriftError,\n type SecretKeyDriftIssue,\n type SecretKeyDriftIssueCode,\n type SecretKeyDriftIssueSeverity,\n type SecretKeyDriftRepairAction,\n type SecretKeyDriftRepairResult,\n type SecretKeyDriftReport,\n SecretService,\n type SecretServiceOptions,\n type StoreSecretOptions,\n} from './services/SecretService.js';\n\n/** @internal */\nexport const PACKAGE_VERSION_INITIALIZED = true;\n"],"names":[],"mappings":";;;AA+GO,MAAM,8BAA8B;"}