@mce-bt/microagents-vault 0.1.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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Encrypt plaintext using AES-256-GCM.
3
+ * Output format: base64(IV[16] + AuthTag[16] + Ciphertext)
4
+ */
5
+ export declare function encrypt(plaintext: string, keyHex: string): string;
6
+ /**
7
+ * Decrypt AES-256-GCM ciphertext.
8
+ * Input format: base64(IV[16] + AuthTag[16] + Ciphertext)
9
+ */
10
+ export declare function decrypt(encoded: string, keyHex: string): string;
11
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAS/D"}
package/dist/crypto.js ADDED
@@ -0,0 +1,31 @@
1
+ import crypto from 'node:crypto';
2
+ const ALGORITHM = 'aes-256-gcm';
3
+ const IV_LENGTH = 16;
4
+ const AUTH_TAG_LENGTH = 16;
5
+ /**
6
+ * Encrypt plaintext using AES-256-GCM.
7
+ * Output format: base64(IV[16] + AuthTag[16] + Ciphertext)
8
+ */
9
+ export function encrypt(plaintext, keyHex) {
10
+ const key = Buffer.from(keyHex, 'hex');
11
+ const iv = crypto.randomBytes(IV_LENGTH);
12
+ const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
13
+ const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
14
+ const authTag = cipher.getAuthTag();
15
+ return Buffer.concat([iv, authTag, encrypted]).toString('base64');
16
+ }
17
+ /**
18
+ * Decrypt AES-256-GCM ciphertext.
19
+ * Input format: base64(IV[16] + AuthTag[16] + Ciphertext)
20
+ */
21
+ export function decrypt(encoded, keyHex) {
22
+ const key = Buffer.from(keyHex, 'hex');
23
+ const buf = Buffer.from(encoded, 'base64');
24
+ const iv = buf.subarray(0, IV_LENGTH);
25
+ const authTag = buf.subarray(IV_LENGTH, IV_LENGTH + AUTH_TAG_LENGTH);
26
+ const ciphertext = buf.subarray(IV_LENGTH + AUTH_TAG_LENGTH);
27
+ const decipher = crypto.createDecipheriv(ALGORITHM, key, iv);
28
+ decipher.setAuthTag(authTag);
29
+ return decipher.update(ciphertext) + decipher.final('utf8');
30
+ }
31
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,SAAS,GAAG,aAAa,CAAC;AAChC,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,SAAiB,EAAE,MAAc;IACvD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,MAAc;IACrD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,SAAS,GAAG,eAAe,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7D,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { encrypt, decrypt } from './crypto.js';
2
+ export { CredentialVault } from './vault.js';
3
+ export type { VaultConfig, VaultAuditEntry, Credential, CredentialInput, DecryptedCredential, CredentialSummary, } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { encrypt, decrypt } from './crypto.js';
2
+ export { CredentialVault } from './vault.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,52 @@
1
+ export interface VaultConfig {
2
+ pool: import('pg').Pool;
3
+ encryptionKeyHex: string;
4
+ /** Identifier recorded in the audit trail (e.g. agent id). */
5
+ actor?: string;
6
+ }
7
+ export interface VaultAuditEntry {
8
+ action: string;
9
+ platform: string;
10
+ label: string;
11
+ actor: string | null;
12
+ success: boolean;
13
+ created_at: Date;
14
+ }
15
+ export interface Credential {
16
+ id: string;
17
+ platform: string;
18
+ label: string;
19
+ username: string;
20
+ password_encrypted: string;
21
+ totp_secret_encrypted: string | null;
22
+ metadata: Record<string, unknown>;
23
+ created_at: Date;
24
+ updated_at: Date;
25
+ }
26
+ export interface CredentialInput {
27
+ platform: string;
28
+ label?: string;
29
+ username: string;
30
+ password: string;
31
+ totpSecret?: string;
32
+ metadata?: Record<string, unknown>;
33
+ }
34
+ export interface DecryptedCredential {
35
+ id: string;
36
+ platform: string;
37
+ label: string;
38
+ username: string;
39
+ password: string;
40
+ totpCode?: string;
41
+ metadata: Record<string, unknown>;
42
+ }
43
+ export interface CredentialSummary {
44
+ id: string;
45
+ platform: string;
46
+ label: string;
47
+ username: string;
48
+ has_totp: boolean;
49
+ created_at: Date;
50
+ updated_at: Date;
51
+ }
52
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,IA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AAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import type { VaultConfig, CredentialInput, DecryptedCredential, CredentialSummary, VaultAuditEntry } from './types.js';
2
+ export declare class CredentialVault {
3
+ private readonly pool;
4
+ private readonly keyHex;
5
+ private readonly actor?;
6
+ constructor(config: VaultConfig);
7
+ /**
8
+ * Create the vault tables if they don't exist. Idempotent — safe to call
9
+ * on every boot.
10
+ */
11
+ ensureSchema(): Promise<void>;
12
+ store(input: CredentialInput): Promise<string>;
13
+ retrieve(platform: string, label?: string): Promise<DecryptedCredential | null>;
14
+ list(): Promise<CredentialSummary[]>;
15
+ remove(platform: string, label?: string): Promise<boolean>;
16
+ /**
17
+ * Read the access audit trail (most recent first).
18
+ */
19
+ auditLog(limit?: number): Promise<VaultAuditEntry[]>;
20
+ /**
21
+ * Record an access event. Audit failures are swallowed deliberately —
22
+ * a broken audit table must not block credential operations — but the
23
+ * audit table is created by ensureSchema(), so in practice this only
24
+ * fires when ensureSchema() was skipped.
25
+ */
26
+ private audit;
27
+ }
28
+ //# sourceMappingURL=vault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EAEX,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EAChB,MAAM,YAAY,CAAC;AA2BpB,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;gBAEpB,MAAM,EAAE,WAAW;IAS/B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAkC/E,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAiBpC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUhE;;OAEG;IACG,QAAQ,CAAC,KAAK,SAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IASvD;;;;;OAKG;YACW,KAAK;CAWpB"}
package/dist/vault.js ADDED
@@ -0,0 +1,131 @@
1
+ import * as OTPAuth from 'otpauth';
2
+ import { encrypt, decrypt } from './crypto.js';
3
+ const SCHEMA_SQL = `
4
+ CREATE TABLE IF NOT EXISTS public.credential_vault (
5
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
6
+ platform TEXT NOT NULL,
7
+ label TEXT NOT NULL DEFAULT 'default',
8
+ username TEXT NOT NULL,
9
+ password_encrypted TEXT NOT NULL,
10
+ totp_secret_encrypted TEXT,
11
+ metadata JSONB NOT NULL DEFAULT '{}',
12
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
13
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
14
+ UNIQUE (platform, label)
15
+ );
16
+
17
+ CREATE TABLE IF NOT EXISTS public.credential_vault_audit (
18
+ id BIGSERIAL PRIMARY KEY,
19
+ action TEXT NOT NULL,
20
+ platform TEXT NOT NULL,
21
+ label TEXT NOT NULL,
22
+ actor TEXT,
23
+ success BOOLEAN NOT NULL,
24
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
25
+ );
26
+ `;
27
+ export class CredentialVault {
28
+ pool;
29
+ keyHex;
30
+ actor;
31
+ constructor(config) {
32
+ if (!config.encryptionKeyHex || config.encryptionKeyHex.length !== 64) {
33
+ throw new Error('CREDENTIAL_VAULT_KEY must be a 64-char hex string (256 bits)');
34
+ }
35
+ this.pool = config.pool;
36
+ this.keyHex = config.encryptionKeyHex;
37
+ this.actor = config.actor;
38
+ }
39
+ /**
40
+ * Create the vault tables if they don't exist. Idempotent — safe to call
41
+ * on every boot.
42
+ */
43
+ async ensureSchema() {
44
+ await this.pool.query(SCHEMA_SQL);
45
+ }
46
+ async store(input) {
47
+ const label = input.label || 'default';
48
+ const passwordEnc = encrypt(input.password, this.keyHex);
49
+ const totpEnc = input.totpSecret ? encrypt(input.totpSecret, this.keyHex) : null;
50
+ const metadata = input.metadata || {};
51
+ const result = await this.pool.query(`INSERT INTO public.credential_vault (platform, label, username, password_encrypted, totp_secret_encrypted, metadata)
52
+ VALUES ($1, $2, $3, $4, $5, $6)
53
+ ON CONFLICT (platform, label) DO UPDATE SET
54
+ username = EXCLUDED.username,
55
+ password_encrypted = EXCLUDED.password_encrypted,
56
+ totp_secret_encrypted = EXCLUDED.totp_secret_encrypted,
57
+ metadata = EXCLUDED.metadata,
58
+ updated_at = NOW()
59
+ RETURNING id`, [input.platform, label, input.username, passwordEnc, totpEnc, JSON.stringify(metadata)]);
60
+ await this.audit('store', input.platform, label, true);
61
+ return result.rows[0].id;
62
+ }
63
+ async retrieve(platform, label) {
64
+ const row = await this.pool.query(`SELECT * FROM public.credential_vault WHERE platform = $1 AND label = $2`, [platform, label || 'default']);
65
+ if (row.rows.length === 0) {
66
+ await this.audit('retrieve', platform, label || 'default', false);
67
+ return null;
68
+ }
69
+ const cred = row.rows[0];
70
+ const password = decrypt(cred.password_encrypted, this.keyHex);
71
+ let totpCode;
72
+ if (cred.totp_secret_encrypted) {
73
+ const totpSecret = decrypt(cred.totp_secret_encrypted, this.keyHex);
74
+ const totp = new OTPAuth.TOTP({ secret: totpSecret, digits: 6, period: 30 });
75
+ totpCode = totp.generate();
76
+ }
77
+ await this.audit('retrieve', platform, cred.label, true);
78
+ return {
79
+ id: cred.id,
80
+ platform: cred.platform,
81
+ label: cred.label,
82
+ username: cred.username,
83
+ password,
84
+ totpCode,
85
+ metadata: cred.metadata,
86
+ };
87
+ }
88
+ async list() {
89
+ const result = await this.pool.query(`SELECT id, platform, label, username, totp_secret_encrypted, created_at, updated_at
90
+ FROM public.credential_vault ORDER BY platform, label`);
91
+ return result.rows.map((r) => ({
92
+ id: r.id,
93
+ platform: r.platform,
94
+ label: r.label,
95
+ username: r.username,
96
+ has_totp: r.totp_secret_encrypted !== null,
97
+ created_at: r.created_at,
98
+ updated_at: r.updated_at,
99
+ }));
100
+ }
101
+ async remove(platform, label) {
102
+ const result = await this.pool.query(`DELETE FROM public.credential_vault WHERE platform = $1 AND label = $2`, [platform, label || 'default']);
103
+ const removed = (result.rowCount ?? 0) > 0;
104
+ await this.audit('remove', platform, label || 'default', removed);
105
+ return removed;
106
+ }
107
+ /**
108
+ * Read the access audit trail (most recent first).
109
+ */
110
+ async auditLog(limit = 100) {
111
+ const result = await this.pool.query(`SELECT action, platform, label, actor, success, created_at
112
+ FROM public.credential_vault_audit ORDER BY created_at DESC LIMIT $1`, [limit]);
113
+ return result.rows;
114
+ }
115
+ /**
116
+ * Record an access event. Audit failures are swallowed deliberately —
117
+ * a broken audit table must not block credential operations — but the
118
+ * audit table is created by ensureSchema(), so in practice this only
119
+ * fires when ensureSchema() was skipped.
120
+ */
121
+ async audit(action, platform, label, success) {
122
+ try {
123
+ await this.pool.query(`INSERT INTO public.credential_vault_audit (action, platform, label, actor, success)
124
+ VALUES ($1, $2, $3, $4, $5)`, [action, platform, label, this.actor ?? null, success]);
125
+ }
126
+ catch {
127
+ // see docstring
128
+ }
129
+ }
130
+ }
131
+ //# sourceMappingURL=vault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAU/C,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBlB,CAAC;AAEF,MAAM,OAAO,eAAe;IACT,IAAI,CAAoB;IACxB,MAAM,CAAS;IACf,KAAK,CAAU;IAEhC,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,gBAAgB,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAClF,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAsB;QAChC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC;QACvC,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CA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,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAE,OAAO,CAAC,CAAC;QAClE,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,GAAG;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAClC;4EACsE,EACtE,CAAC,KAAK,CAAC,CACR,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAa,EAAE,OAAgB;QACnF,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CACnB;qCAC6B,EAC7B,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,OAAO,CAAC,CACvD,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;IACH,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@mce-bt/microagents-vault",
3
+ "version": "0.1.0",
4
+ "description": "Encrypted credential vault — AES-256-GCM storage with TOTP support",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsc --build",
16
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
17
+ "test": "vitest run"
18
+ },
19
+ "dependencies": {
20
+ "otpauth": "^9.3.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/pg": "^8.11.0"
24
+ },
25
+ "peerDependencies": {
26
+ "pg": "^8.0.0"
27
+ },
28
+ "license": "MIT",
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/cavillo/microagents.git",
38
+ "directory": "packages/vault"
39
+ },
40
+ "homepage": "https://github.com/cavillo/microagents#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/cavillo/microagents/issues"
43
+ },
44
+ "engines": {
45
+ "node": ">=20.0.0"
46
+ }
47
+ }