@bsb/config-vault 0.0.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.
Files changed (43) hide show
  1. package/README.md +49 -0
  2. package/bsb-plugin.json +40 -0
  3. package/lib/index.d.ts +2 -0
  4. package/lib/index.d.ts.map +1 -0
  5. package/lib/index.js +2 -0
  6. package/lib/index.js.map +1 -0
  7. package/lib/plugins/config-vault/index.d.ts +39 -0
  8. package/lib/plugins/config-vault/index.d.ts.map +1 -0
  9. package/lib/plugins/config-vault/index.js +175 -0
  10. package/lib/plugins/config-vault/index.js.map +1 -0
  11. package/lib/plugins/service-config-vault/crypto.d.ts +17 -0
  12. package/lib/plugins/service-config-vault/crypto.d.ts.map +1 -0
  13. package/lib/plugins/service-config-vault/crypto.js +76 -0
  14. package/lib/plugins/service-config-vault/crypto.js.map +1 -0
  15. package/lib/plugins/service-config-vault/http-server.d.ts +20 -0
  16. package/lib/plugins/service-config-vault/http-server.d.ts.map +1 -0
  17. package/lib/plugins/service-config-vault/http-server.js +272 -0
  18. package/lib/plugins/service-config-vault/http-server.js.map +1 -0
  19. package/lib/plugins/service-config-vault/index.d.ts +82 -0
  20. package/lib/plugins/service-config-vault/index.d.ts.map +1 -0
  21. package/lib/plugins/service-config-vault/index.js +95 -0
  22. package/lib/plugins/service-config-vault/index.js.map +1 -0
  23. package/lib/plugins/service-config-vault/passkeys.d.ts +9 -0
  24. package/lib/plugins/service-config-vault/passkeys.d.ts.map +1 -0
  25. package/lib/plugins/service-config-vault/passkeys.js +12 -0
  26. package/lib/plugins/service-config-vault/passkeys.js.map +1 -0
  27. package/lib/plugins/service-config-vault/store.d.ts +42 -0
  28. package/lib/plugins/service-config-vault/store.d.ts.map +1 -0
  29. package/lib/plugins/service-config-vault/store.js +396 -0
  30. package/lib/plugins/service-config-vault/store.js.map +1 -0
  31. package/lib/plugins/service-config-vault/types.d.ts +127 -0
  32. package/lib/plugins/service-config-vault/types.d.ts.map +1 -0
  33. package/lib/plugins/service-config-vault/types.js +2 -0
  34. package/lib/plugins/service-config-vault/types.js.map +1 -0
  35. package/lib/plugins/service-config-vault/vault.d.ts +52 -0
  36. package/lib/plugins/service-config-vault/vault.d.ts.map +1 -0
  37. package/lib/plugins/service-config-vault/vault.js +243 -0
  38. package/lib/plugins/service-config-vault/vault.js.map +1 -0
  39. package/lib/schemas/config-vault.json +73 -0
  40. package/lib/schemas/config-vault.plugin.json +82 -0
  41. package/lib/schemas/service-config-vault.json +146 -0
  42. package/lib/schemas/service-config-vault.plugin.json +93 -0
  43. package/package.json +52 -0
@@ -0,0 +1,396 @@
1
+ import { Pool } from 'pg';
2
+ export class VaultStore {
3
+ pool;
4
+ constructor(databaseUrl) {
5
+ this.pool = new Pool({ connectionString: databaseUrl });
6
+ }
7
+ async close() {
8
+ await this.pool.end();
9
+ }
10
+ async init() {
11
+ await this.pool.query(`
12
+ create table if not exists vault_users (
13
+ id text primary key,
14
+ email text not null unique,
15
+ password_hash text not null,
16
+ totp_secret text not null,
17
+ passkey_required boolean not null default true,
18
+ created_at timestamptz not null,
19
+ updated_at timestamptz not null
20
+ );
21
+ create table if not exists vault_passkeys (
22
+ id text primary key,
23
+ user_id text not null references vault_users(id) on delete cascade,
24
+ credential_id text not null unique,
25
+ public_key jsonb not null,
26
+ sign_count integer not null default 0,
27
+ created_at timestamptz not null
28
+ );
29
+ create table if not exists vault_sessions (
30
+ id text primary key,
31
+ user_id text not null references vault_users(id) on delete cascade,
32
+ csrf_token text not null,
33
+ expires_at timestamptz not null
34
+ );
35
+ create table if not exists vault_applications (
36
+ id text primary key,
37
+ name text not null unique,
38
+ description text,
39
+ created_at timestamptz not null
40
+ );
41
+ create table if not exists vault_groups (
42
+ id text primary key,
43
+ application_id text not null references vault_applications(id) on delete cascade,
44
+ name text not null,
45
+ created_at timestamptz not null,
46
+ unique(application_id, name)
47
+ );
48
+ create table if not exists vault_profiles (
49
+ id text primary key,
50
+ group_id text not null references vault_groups(id) on delete cascade,
51
+ name text not null,
52
+ active_version_id text,
53
+ created_at timestamptz not null,
54
+ unique(group_id, name)
55
+ );
56
+ create table if not exists vault_plugin_catalog (
57
+ id text primary key,
58
+ org text not null,
59
+ name text not null,
60
+ plugin_id text not null,
61
+ package_name text,
62
+ version text not null,
63
+ kind text not null,
64
+ source text not null,
65
+ config_schema jsonb,
66
+ event_schema jsonb,
67
+ created_at timestamptz not null,
68
+ unique(plugin_id, version)
69
+ );
70
+ create table if not exists vault_config_drafts (
71
+ id text primary key,
72
+ profile_id text not null references vault_profiles(id) on delete cascade,
73
+ encrypted_payload text not null,
74
+ iv text not null,
75
+ auth_tag text not null,
76
+ key_version text not null,
77
+ updated_at timestamptz not null,
78
+ unique(profile_id)
79
+ );
80
+ create table if not exists vault_config_versions (
81
+ id text primary key,
82
+ profile_id text not null references vault_profiles(id) on delete cascade,
83
+ version integer not null,
84
+ encrypted_payload text not null,
85
+ iv text not null,
86
+ auth_tag text not null,
87
+ key_version text not null,
88
+ published_at timestamptz not null,
89
+ published_by text not null,
90
+ unique(profile_id, version)
91
+ );
92
+ create table if not exists vault_runtime_keys (
93
+ id text primary key,
94
+ name text not null,
95
+ secret_hash text not null,
96
+ application_id text not null references vault_applications(id) on delete cascade,
97
+ group_id text not null references vault_groups(id) on delete cascade,
98
+ profile_id text not null references vault_profiles(id) on delete cascade,
99
+ container_name text,
100
+ config_plugin_id text not null,
101
+ revoked_at timestamptz,
102
+ created_at timestamptz not null
103
+ );
104
+ create table if not exists vault_audit_log (
105
+ id text primary key,
106
+ actor text not null,
107
+ action text not null,
108
+ target text not null,
109
+ details jsonb not null,
110
+ created_at timestamptz not null
111
+ );
112
+ `);
113
+ }
114
+ async countAdmins() {
115
+ const result = await this.pool.query('select count(*)::text as count from vault_users');
116
+ return Number(result.rows[0]?.count ?? '0');
117
+ }
118
+ async createUser(user) {
119
+ await this.pool.query(`insert into vault_users (id, email, password_hash, totp_secret, passkey_required, created_at, updated_at)
120
+ values ($1, $2, $3, $4, $5, $6, $7)`, [user.id, user.email, user.passwordHash, user.totpSecret, user.passkeyRequired, user.createdAt, user.updatedAt]);
121
+ }
122
+ async getUserByEmail(email) {
123
+ const result = await this.pool.query('select * from vault_users where email = $1', [email]);
124
+ return result.rows[0] ? mapUser(result.rows[0]) : null;
125
+ }
126
+ async getUser(id) {
127
+ const result = await this.pool.query('select * from vault_users where id = $1', [id]);
128
+ return result.rows[0] ? mapUser(result.rows[0]) : null;
129
+ }
130
+ async createPasskey(passkey) {
131
+ await this.pool.query(`insert into vault_passkeys (id, user_id, credential_id, public_key, sign_count, created_at)
132
+ values ($1, $2, $3, $4, $5, $6)`, [passkey.id, passkey.userId, passkey.credentialId, passkey.publicKey, passkey.signCount, passkey.createdAt]);
133
+ }
134
+ async listPasskeys(userId) {
135
+ const result = await this.pool.query('select * from vault_passkeys where user_id = $1 order by created_at', [userId]);
136
+ return result.rows.map((row) => mapPasskey(row));
137
+ }
138
+ async createSession(session) {
139
+ await this.pool.query(`insert into vault_sessions (id, user_id, csrf_token, expires_at) values ($1, $2, $3, $4)`, [session.id, session.userId, session.csrfToken, session.expiresAt]);
140
+ }
141
+ async getSession(id) {
142
+ const result = await this.pool.query('select * from vault_sessions where id = $1 and expires_at > now()', [id]);
143
+ return result.rows[0] ? mapSession(result.rows[0]) : null;
144
+ }
145
+ async deleteSession(id) {
146
+ await this.pool.query('delete from vault_sessions where id = $1', [id]);
147
+ }
148
+ async createApplication(record) {
149
+ await this.pool.query('insert into vault_applications (id, name, description, created_at) values ($1, $2, $3, $4)', [record.id, record.name, record.description, record.createdAt]);
150
+ }
151
+ async listApplications() {
152
+ const result = await this.pool.query('select * from vault_applications order by name');
153
+ return result.rows.map((row) => mapApplication(row));
154
+ }
155
+ async createGroup(record) {
156
+ await this.pool.query('insert into vault_groups (id, application_id, name, created_at) values ($1, $2, $3, $4)', [record.id, record.applicationId, record.name, record.createdAt]);
157
+ }
158
+ async listGroups(applicationId) {
159
+ const result = await this.pool.query('select * from vault_groups where application_id = $1 order by name', [applicationId]);
160
+ return result.rows.map((row) => mapGroup(row));
161
+ }
162
+ async createProfile(record) {
163
+ await this.pool.query('insert into vault_profiles (id, group_id, name, active_version_id, created_at) values ($1, $2, $3, $4, $5)', [record.id, record.groupId, record.name, record.activeVersionId, record.createdAt]);
164
+ }
165
+ async getProfile(id) {
166
+ const result = await this.pool.query('select * from vault_profiles where id = $1', [id]);
167
+ return result.rows[0] ? mapProfile(result.rows[0]) : null;
168
+ }
169
+ async listProfiles(groupId) {
170
+ const result = await this.pool.query('select * from vault_profiles where group_id = $1 order by name', [groupId]);
171
+ return result.rows.map((row) => mapProfile(row));
172
+ }
173
+ async createPlugin(record) {
174
+ await this.pool.query(`insert into vault_plugin_catalog
175
+ (id, org, name, plugin_id, package_name, version, kind, source, config_schema, event_schema, created_at)
176
+ values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`, [
177
+ record.id,
178
+ record.org,
179
+ record.name,
180
+ record.pluginId,
181
+ record.packageName,
182
+ record.version,
183
+ record.kind,
184
+ record.source,
185
+ record.configSchema,
186
+ record.eventSchema,
187
+ record.createdAt,
188
+ ]);
189
+ }
190
+ async listPlugins() {
191
+ const result = await this.pool.query('select * from vault_plugin_catalog order by org, name, version');
192
+ return result.rows.map((row) => mapPlugin(row));
193
+ }
194
+ async upsertDraft(record) {
195
+ await this.pool.query(`insert into vault_config_drafts (id, profile_id, encrypted_payload, iv, auth_tag, key_version, updated_at)
196
+ values ($1, $2, $3, $4, $5, $6, $7)
197
+ on conflict (profile_id) do update set
198
+ encrypted_payload = excluded.encrypted_payload,
199
+ iv = excluded.iv,
200
+ auth_tag = excluded.auth_tag,
201
+ key_version = excluded.key_version,
202
+ updated_at = excluded.updated_at`, [record.id, record.profileId, record.encryptedPayload, record.iv, record.authTag, record.keyVersion, record.updatedAt]);
203
+ }
204
+ async getDraft(profileId) {
205
+ const result = await this.pool.query('select * from vault_config_drafts where profile_id = $1', [profileId]);
206
+ return result.rows[0] ? mapDraft(result.rows[0]) : null;
207
+ }
208
+ async createVersion(record) {
209
+ await this.pool.query(`insert into vault_config_versions
210
+ (id, profile_id, version, encrypted_payload, iv, auth_tag, key_version, published_at, published_by)
211
+ values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`, [
212
+ record.id,
213
+ record.profileId,
214
+ record.version,
215
+ record.encryptedPayload,
216
+ record.iv,
217
+ record.authTag,
218
+ record.keyVersion,
219
+ record.publishedAt,
220
+ record.publishedBy,
221
+ ]);
222
+ await this.pool.query('update vault_profiles set active_version_id = $1 where id = $2', [record.id, record.profileId]);
223
+ }
224
+ async nextVersion(profileId) {
225
+ const result = await this.pool.query('select (coalesce(max(version), 0) + 1)::text as next from vault_config_versions where profile_id = $1', [profileId]);
226
+ return Number(result.rows[0]?.next ?? '1');
227
+ }
228
+ async getVersion(id) {
229
+ const result = await this.pool.query('select * from vault_config_versions where id = $1', [id]);
230
+ return result.rows[0] ? mapVersion(result.rows[0]) : null;
231
+ }
232
+ async createRuntimeKey(record) {
233
+ await this.pool.query(`insert into vault_runtime_keys
234
+ (id, name, secret_hash, application_id, group_id, profile_id, container_name, config_plugin_id, revoked_at, created_at)
235
+ values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`, [
236
+ record.id,
237
+ record.name,
238
+ record.secretHash,
239
+ record.applicationId,
240
+ record.groupId,
241
+ record.profileId,
242
+ record.containerName,
243
+ record.configPluginId,
244
+ record.revokedAt,
245
+ record.createdAt,
246
+ ]);
247
+ }
248
+ async getRuntimeKey(id) {
249
+ const result = await this.pool.query('select * from vault_runtime_keys where id = $1 and revoked_at is null', [id]);
250
+ return result.rows[0] ? mapRuntimeKey(result.rows[0]) : null;
251
+ }
252
+ async listRuntimeKeys(profileId) {
253
+ const result = profileId
254
+ ? await this.pool.query('select * from vault_runtime_keys where profile_id = $1 order by created_at desc', [profileId])
255
+ : await this.pool.query('select * from vault_runtime_keys order by created_at desc');
256
+ return result.rows.map((row) => mapRuntimeKey(row));
257
+ }
258
+ async revokeRuntimeKey(id) {
259
+ await this.pool.query('update vault_runtime_keys set revoked_at = now() where id = $1', [id]);
260
+ }
261
+ async resolveRuntimeBinding(keyId) {
262
+ const result = await this.pool.query(`select
263
+ rk.*,
264
+ row_to_json(a.*) as application,
265
+ row_to_json(g.*) as service_group,
266
+ row_to_json(p.*) as profile
267
+ from vault_runtime_keys rk
268
+ join vault_applications a on a.id = rk.application_id
269
+ join vault_groups g on g.id = rk.group_id
270
+ join vault_profiles p on p.id = rk.profile_id
271
+ where rk.id = $1 and rk.revoked_at is null`, [keyId]);
272
+ const row = result.rows[0];
273
+ if (!row)
274
+ return null;
275
+ return {
276
+ key: mapRuntimeKey(row),
277
+ application: mapApplication(row.application),
278
+ group: mapGroup(row.service_group),
279
+ profile: mapProfile(row.profile),
280
+ };
281
+ }
282
+ async audit(record) {
283
+ await this.pool.query('insert into vault_audit_log (id, actor, action, target, details, created_at) values ($1, $2, $3, $4, $5, $6)', [record.id, record.actor, record.action, record.target, record.details, record.createdAt]);
284
+ }
285
+ }
286
+ function iso(value) {
287
+ return value instanceof Date ? value.toISOString() : String(value);
288
+ }
289
+ function mapUser(row) {
290
+ return {
291
+ id: String(row.id),
292
+ email: String(row.email),
293
+ passwordHash: String(row.password_hash),
294
+ totpSecret: String(row.totp_secret),
295
+ passkeyRequired: Boolean(row.passkey_required),
296
+ createdAt: iso(row.created_at),
297
+ updatedAt: iso(row.updated_at),
298
+ };
299
+ }
300
+ function mapPasskey(row) {
301
+ return {
302
+ id: String(row.id),
303
+ userId: String(row.user_id),
304
+ credentialId: String(row.credential_id),
305
+ publicKey: row.public_key,
306
+ signCount: Number(row.sign_count),
307
+ createdAt: iso(row.created_at),
308
+ };
309
+ }
310
+ function mapSession(row) {
311
+ return {
312
+ id: String(row.id),
313
+ userId: String(row.user_id),
314
+ csrfToken: String(row.csrf_token),
315
+ expiresAt: iso(row.expires_at),
316
+ };
317
+ }
318
+ function mapApplication(row) {
319
+ return {
320
+ id: String(row.id),
321
+ name: String(row.name),
322
+ description: row.description === null ? null : String(row.description),
323
+ createdAt: iso(row.created_at),
324
+ };
325
+ }
326
+ function mapGroup(row) {
327
+ return {
328
+ id: String(row.id),
329
+ applicationId: String(row.application_id),
330
+ name: String(row.name),
331
+ createdAt: iso(row.created_at),
332
+ };
333
+ }
334
+ function mapProfile(row) {
335
+ return {
336
+ id: String(row.id),
337
+ groupId: String(row.group_id),
338
+ name: String(row.name),
339
+ activeVersionId: row.active_version_id === null ? null : String(row.active_version_id),
340
+ createdAt: iso(row.created_at),
341
+ };
342
+ }
343
+ function mapPlugin(row) {
344
+ return {
345
+ id: String(row.id),
346
+ org: String(row.org),
347
+ name: String(row.name),
348
+ pluginId: String(row.plugin_id),
349
+ packageName: row.package_name === null ? null : String(row.package_name),
350
+ version: String(row.version),
351
+ kind: row.kind,
352
+ source: row.source,
353
+ configSchema: row.config_schema === null ? null : row.config_schema,
354
+ eventSchema: row.event_schema === null ? null : row.event_schema,
355
+ createdAt: iso(row.created_at),
356
+ };
357
+ }
358
+ function mapDraft(row) {
359
+ return {
360
+ id: String(row.id),
361
+ profileId: String(row.profile_id),
362
+ encryptedPayload: String(row.encrypted_payload),
363
+ iv: String(row.iv),
364
+ authTag: String(row.auth_tag),
365
+ keyVersion: String(row.key_version),
366
+ updatedAt: iso(row.updated_at),
367
+ };
368
+ }
369
+ function mapVersion(row) {
370
+ return {
371
+ id: String(row.id),
372
+ profileId: String(row.profile_id),
373
+ version: Number(row.version),
374
+ encryptedPayload: String(row.encrypted_payload),
375
+ iv: String(row.iv),
376
+ authTag: String(row.auth_tag),
377
+ keyVersion: String(row.key_version),
378
+ publishedAt: iso(row.published_at),
379
+ publishedBy: String(row.published_by),
380
+ };
381
+ }
382
+ function mapRuntimeKey(row) {
383
+ return {
384
+ id: String(row.id),
385
+ name: String(row.name),
386
+ secretHash: String(row.secret_hash),
387
+ applicationId: String(row.application_id),
388
+ groupId: String(row.group_id),
389
+ profileId: String(row.profile_id),
390
+ containerName: row.container_name === null ? null : String(row.container_name),
391
+ configPluginId: String(row.config_plugin_id),
392
+ revokedAt: row.revoked_at === null ? null : iso(row.revoked_at),
393
+ createdAt: iso(row.created_at),
394
+ };
395
+ }
396
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/plugins/service-config-vault/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAe1B,MAAM,OAAO,UAAU;IACJ,IAAI,CAAO;IAE5B,YAAY,WAAmB;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqGrB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAoB,iDAAiD,CAAC,CAAC;QAC3G,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAgB;QAC/B,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CACnB;2CACqC,EACrC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS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WAAW,CAAC;QACnC,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC;QACzC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;QACjC,aAAa,EAAE,GAAG,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC;QAC9E,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAC5C,SAAS,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;QAC/D,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;KAC/B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,127 @@
1
+ export type PluginKind = 'service' | 'events' | 'observable' | 'config';
2
+ export type PluginSource = 'registry' | 'manual' | 'upload';
3
+ export interface RuntimeConfigDefinition {
4
+ observable?: Record<string, RuntimePluginDefinition>;
5
+ events?: Record<string, RuntimePluginDefinition>;
6
+ services?: Record<string, RuntimePluginDefinition>;
7
+ }
8
+ export interface RuntimePluginDefinition {
9
+ plugin: string;
10
+ package?: string;
11
+ version?: string;
12
+ enabled: boolean;
13
+ filter?: string[];
14
+ config?: Record<string, unknown>;
15
+ }
16
+ export type VaultRuntimeConfig = Record<string, RuntimeConfigDefinition>;
17
+ export interface UserRecord {
18
+ id: string;
19
+ email: string;
20
+ passwordHash: string;
21
+ totpSecret: string;
22
+ passkeyRequired: boolean;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }
26
+ export interface SessionRecord {
27
+ id: string;
28
+ userId: string;
29
+ csrfToken: string;
30
+ expiresAt: string;
31
+ }
32
+ export interface PasskeyRecord {
33
+ id: string;
34
+ userId: string;
35
+ credentialId: string;
36
+ publicKey: Record<string, unknown>;
37
+ signCount: number;
38
+ createdAt: string;
39
+ }
40
+ export interface ApplicationRecord {
41
+ id: string;
42
+ name: string;
43
+ description: string | null;
44
+ createdAt: string;
45
+ }
46
+ export interface GroupRecord {
47
+ id: string;
48
+ applicationId: string;
49
+ name: string;
50
+ createdAt: string;
51
+ }
52
+ export interface ProfileRecord {
53
+ id: string;
54
+ groupId: string;
55
+ name: string;
56
+ activeVersionId: string | null;
57
+ createdAt: string;
58
+ }
59
+ export interface PluginCatalogRecord {
60
+ id: string;
61
+ org: string;
62
+ name: string;
63
+ pluginId: string;
64
+ packageName: string | null;
65
+ version: string;
66
+ kind: PluginKind;
67
+ source: PluginSource;
68
+ configSchema: Record<string, unknown> | null;
69
+ eventSchema: Record<string, unknown> | null;
70
+ createdAt: string;
71
+ }
72
+ export interface ConfigDraftRecord {
73
+ id: string;
74
+ profileId: string;
75
+ encryptedPayload: string;
76
+ iv: string;
77
+ authTag: string;
78
+ keyVersion: string;
79
+ updatedAt: string;
80
+ }
81
+ export interface ConfigVersionRecord {
82
+ id: string;
83
+ profileId: string;
84
+ version: number;
85
+ encryptedPayload: string;
86
+ iv: string;
87
+ authTag: string;
88
+ keyVersion: string;
89
+ publishedAt: string;
90
+ publishedBy: string;
91
+ }
92
+ export interface RuntimeKeyRecord {
93
+ id: string;
94
+ name: string;
95
+ secretHash: string;
96
+ applicationId: string;
97
+ groupId: string;
98
+ profileId: string;
99
+ containerName: string | null;
100
+ configPluginId: string;
101
+ revokedAt: string | null;
102
+ createdAt: string;
103
+ }
104
+ export interface AuditRecord {
105
+ id: string;
106
+ actor: string;
107
+ action: string;
108
+ target: string;
109
+ details: Record<string, unknown>;
110
+ createdAt: string;
111
+ }
112
+ export interface ResolvedRuntimeConfig {
113
+ application: string;
114
+ group: string;
115
+ profile: string;
116
+ version: number;
117
+ config: VaultRuntimeConfig;
118
+ }
119
+ export interface FirstAdminInput {
120
+ setupCode: string;
121
+ email: string;
122
+ password: string;
123
+ totpCode: string;
124
+ passkeyName?: string;
125
+ passkeyCredential?: Record<string, unknown>;
126
+ }
127
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/service-config-vault/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,M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AC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/service-config-vault/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,52 @@
1
+ import type { Observable } from '@bsb/base';
2
+ import { type PasskeyVerifier } from './passkeys.js';
3
+ import { VaultStore } from './store.js';
4
+ import type { ApplicationRecord, FirstAdminInput, GroupRecord, PluginCatalogRecord, ProfileRecord, ResolvedRuntimeConfig, RuntimeKeyRecord, VaultRuntimeConfig } from './types.js';
5
+ export interface VaultServiceOptions {
6
+ store: VaultStore;
7
+ masterKey: Buffer;
8
+ setupCode: string;
9
+ passkeys?: PasskeyVerifier;
10
+ }
11
+ export declare class VaultService {
12
+ private readonly store;
13
+ private readonly masterKey;
14
+ private readonly setupCode;
15
+ private readonly passkeys;
16
+ constructor(options: VaultServiceOptions);
17
+ setupRequired(): Promise<boolean>;
18
+ createFirstAdmin(input: FirstAdminInput): Promise<void>;
19
+ login(email: string, password: string, totpCode: string, passkeyCredential?: Record<string, unknown>): Promise<{
20
+ sessionId: string;
21
+ csrfToken: string;
22
+ }>;
23
+ logout(sessionId: string): Promise<void>;
24
+ requireSession(sessionId?: string): Promise<{
25
+ userId: string;
26
+ csrfToken: string;
27
+ }>;
28
+ createApplication(userId: string, name: string, description?: string): Promise<ApplicationRecord>;
29
+ createGroup(userId: string, applicationId: string, name: string): Promise<GroupRecord>;
30
+ createProfile(userId: string, groupId: string, name: string): Promise<ProfileRecord>;
31
+ createPlugin(userId: string, input: Omit<PluginCatalogRecord, 'id' | 'createdAt'>): Promise<PluginCatalogRecord>;
32
+ saveDraft(userId: string, profileId: string, config: VaultRuntimeConfig): Promise<void>;
33
+ publishDraft(userId: string, profileId: string): Promise<{
34
+ versionId: string;
35
+ version: number;
36
+ }>;
37
+ createRuntimeKey(userId: string, input: Pick<RuntimeKeyRecord, 'name' | 'applicationId' | 'groupId' | 'profileId' | 'containerName' | 'configPluginId'>): Promise<{
38
+ keyId: string;
39
+ secret: string;
40
+ }>;
41
+ resolveRuntimeConfig(keyId: string, secret: string, obs?: Observable): Promise<ResolvedRuntimeConfig>;
42
+ dashboard(): Promise<{
43
+ setupRequired: boolean;
44
+ applications: ApplicationRecord[];
45
+ plugins: PluginCatalogRecord[];
46
+ runtimeKeys: RuntimeKeyRecord[];
47
+ }>;
48
+ groups(applicationId: string): Promise<GroupRecord[]>;
49
+ profiles(groupId: string): Promise<ProfileRecord[]>;
50
+ private audit;
51
+ }
52
+ //# sourceMappingURL=vault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../../src/plugins/service-config-vault/vault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,UAAU,CAAC;IAClB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