@ibgib/space-gib 0.0.16 → 0.0.17

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.
@@ -14497,7 +14497,6 @@ var MetaspaceBase = class _MetaspaceBase {
14497
14497
  console.timeLog(timerName);
14498
14498
  }
14499
14499
  await this.initializeSpecialIbGibs_required({ timerName });
14500
- await this.initializeSpecialIbGibs_outerspaces({ timerName });
14501
14500
  await this.initializeSpecialIbGibs_other({ timerName });
14502
14501
  if (logalot33) {
14503
14502
  console.timeEnd(timerName);
@@ -14531,26 +14530,10 @@ var MetaspaceBase = class _MetaspaceBase {
14531
14530
  if (logalot33) {
14532
14531
  console.timeLog(timerName);
14533
14532
  }
14534
- await this.getSpecialIbGib({ type: SpecialIbGibType.aliases, initialize: true });
14535
- if (logalot33) {
14536
- console.timeLog(timerName);
14537
- }
14538
- await this.getSpecialIbGib({ type: "robbots", initialize: true });
14539
- if (logalot33) {
14540
- console.timeLog(timerName);
14541
- }
14542
14533
  await this.getSpecialIbGib({ type: "apps", initialize: true });
14543
14534
  if (logalot33) {
14544
14535
  console.timeLog(timerName);
14545
14536
  }
14546
- await this.getSpecialIbGib({ type: "secrets", initialize: true });
14547
- if (logalot33) {
14548
- console.timeLog(timerName);
14549
- }
14550
- await this.getSpecialIbGib({ type: "encryptions", initialize: true });
14551
- if (logalot33) {
14552
- console.timeLog(timerName);
14553
- }
14554
14537
  } catch (error) {
14555
14538
  console.error(`${lc2} ${error.message}`);
14556
14539
  throw error;
@@ -20888,12 +20871,21 @@ async function savePendingCodeRecord({ pendingDir, code, maxAttempts = 5, ttlMs
20888
20871
  await fs2.writeFile(codeFilePath, JSON.stringify(record, null, 2), "utf-8");
20889
20872
  }
20890
20873
  function createDefaultEmailSender() {
20874
+ const rawMode = process.env.EMAIL_MODE;
20875
+ if (!rawMode || !rawMode.trim()) {
20876
+ throw new Error('EMAIL_MODE environment variable is missing. Expected "aws" or "mock". (E: 7a8b9c0d1e2f3456789abcdef0123456)');
20877
+ }
20878
+ const mode = rawMode.trim().toLowerCase();
20891
20879
  const isProd = true;
20892
- const mode = (process.env.EMAIL_MODE || (isProd ? "aws" : "mock")).toLowerCase();
20893
20880
  if (mode === "aws") {
20881
+ const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
20882
+ const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
20883
+ if (!accessKeyId || !secretAccessKey) {
20884
+ throw new Error("EMAIL_MODE=aws requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. (E: 5e6f7890123456789abcdef5a6b7c8d9)");
20885
+ }
20894
20886
  return new EmailSenderAws({
20895
- accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
20896
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
20887
+ accessKeyId,
20888
+ secretAccessKey,
20897
20889
  region: process.env.AWS_REGION || "us-east-1"
20898
20890
  });
20899
20891
  } else if (mode === "mock") {
@@ -22792,57 +22784,124 @@ function createPoolConfigFromJson({ template, salt }) {
22792
22784
  }).forVerbs(template.allowedVerbs).build();
22793
22785
  }
22794
22786
 
22795
- // ../../libs/core-gib/dist/keystone/policy/profiles/profile-high.json
22796
- var profile_high_default = {
22797
- $schema: "../schemas/keystone.high.schema.json",
22787
+ // ../../libs/core-gib/dist/keystone/policy/profiles/primary/primary-profile.dev.json
22788
+ var primary_profile_dev_default = {
22789
+ $schema: "../../schemas/primary/primary-keystone.schema.json",
22798
22790
  metadata: {
22799
- name: "High Security Profile",
22800
- securityLevel: "high"
22791
+ name: "Primary Identity Profile (Dev)",
22792
+ securityLevel: "low"
22801
22793
  },
22802
22794
  pools: {
22803
- sync: {
22804
- id: "sync",
22795
+ manage: {
22796
+ id: "manage",
22805
22797
  allowedVerbs: [
22806
- "sync"
22798
+ "manage",
22799
+ "revoke"
22800
+ ],
22801
+ algo: "SHA-256",
22802
+ rounds: 1,
22803
+ behavior: {
22804
+ size: 10,
22805
+ replenish: "replace-all",
22806
+ selectSequentially: 1,
22807
+ selectRandomly: 1,
22808
+ targetBindingCount: 2
22809
+ }
22810
+ }
22811
+ }
22812
+ };
22813
+
22814
+ // ../../libs/core-gib/dist/keystone/policy/profiles/primary/primary-profile.staging.json
22815
+ var primary_profile_staging_default = {
22816
+ $schema: "../../schemas/primary/primary-keystone.schema.json",
22817
+ metadata: {
22818
+ name: "Primary Identity Profile (Staging)",
22819
+ securityLevel: "medium"
22820
+ },
22821
+ pools: {
22822
+ manage: {
22823
+ id: "manage",
22824
+ allowedVerbs: [
22825
+ "manage",
22826
+ "revoke"
22807
22827
  ],
22808
22828
  algo: "SHA-512",
22809
- rounds: 4,
22829
+ rounds: 3,
22810
22830
  behavior: {
22811
- size: 2e3,
22812
- replenish: "top-up",
22813
- selectSequentially: 10,
22814
- selectRandomly: 10,
22815
- targetBindingCount: 16
22831
+ size: 500,
22832
+ replenish: "replace-all",
22833
+ selectSequentially: 4,
22834
+ selectRandomly: 4,
22835
+ targetBindingCount: 6
22816
22836
  }
22817
- },
22837
+ }
22838
+ }
22839
+ };
22840
+
22841
+ // ../../libs/core-gib/dist/keystone/policy/profiles/primary/primary-profile.prod.json
22842
+ var primary_profile_prod_default = {
22843
+ $schema: "../../schemas/primary/primary-keystone.schema.json",
22844
+ metadata: {
22845
+ name: "Primary Identity Profile (Prod)",
22846
+ securityLevel: "high"
22847
+ },
22848
+ pools: {
22818
22849
  manage: {
22819
22850
  id: "manage",
22820
22851
  allowedVerbs: [
22821
- "manage"
22852
+ "manage",
22853
+ "revoke"
22822
22854
  ],
22823
22855
  algo: "SHA-512",
22824
- rounds: 4,
22856
+ rounds: 6,
22825
22857
  behavior: {
22826
22858
  size: 2e3,
22827
22859
  replenish: "replace-all",
22828
- selectSequentially: 10,
22829
- selectRandomly: 10,
22860
+ selectSequentially: 12,
22861
+ selectRandomly: 12,
22830
22862
  targetBindingCount: 16
22831
22863
  }
22864
+ }
22865
+ }
22866
+ };
22867
+
22868
+ // ../../libs/core-gib/dist/keystone/policy/profiles/sync/sync-profile.dev.json
22869
+ var sync_profile_dev_default = {
22870
+ $schema: "../../schemas/sync/sync-keystone.schema.json",
22871
+ metadata: {
22872
+ name: "Sync Delegate Profile (Dev)",
22873
+ securityLevel: "low"
22874
+ },
22875
+ pools: {
22876
+ sync: {
22877
+ id: "sync",
22878
+ allowedVerbs: [
22879
+ "sync"
22880
+ ],
22881
+ algo: "SHA-256",
22882
+ rounds: 1,
22883
+ behavior: {
22884
+ size: 10,
22885
+ replenish: "top-up",
22886
+ selectSequentially: 1,
22887
+ selectRandomly: 1,
22888
+ targetBindingCount: 2
22889
+ }
22832
22890
  },
22833
- revoke: {
22834
- id: "revoke",
22891
+ manage: {
22892
+ id: "manage",
22835
22893
  allowedVerbs: [
22894
+ "manage",
22836
22895
  "revoke"
22837
22896
  ],
22838
- algo: "SHA-512",
22839
- rounds: 20,
22897
+ algo: "SHA-256",
22898
+ rounds: 2,
22840
22899
  behavior: {
22841
- size: 2e3,
22842
- replenish: "delete-all",
22843
- selectSequentially: 50,
22844
- selectRandomly: 50,
22845
- targetBindingCount: 0
22900
+ size: 10,
22901
+ replenish: "replace-all",
22902
+ selectSequentially: 1,
22903
+ selectRandomly: 1,
22904
+ targetBindingCount: 2
22846
22905
  }
22847
22906
  },
22848
22907
  connect: {
@@ -22850,14 +22909,14 @@ var profile_high_default = {
22850
22909
  allowedVerbs: [
22851
22910
  "connect"
22852
22911
  ],
22853
- algo: "SHA-512",
22854
- rounds: 4,
22912
+ algo: "SHA-256",
22913
+ rounds: 1,
22855
22914
  behavior: {
22856
- size: 2e3,
22915
+ size: 10,
22857
22916
  replenish: "top-up",
22858
- selectSequentially: 10,
22859
- selectRandomly: 10,
22860
- targetBindingCount: 16
22917
+ selectSequentially: 1,
22918
+ selectRandomly: 1,
22919
+ targetBindingCount: 2
22861
22920
  }
22862
22921
  },
22863
22922
  sign: {
@@ -22865,24 +22924,24 @@ var profile_high_default = {
22865
22924
  allowedVerbs: [
22866
22925
  "sign"
22867
22926
  ],
22868
- algo: "SHA-512",
22869
- rounds: 4,
22927
+ algo: "SHA-256",
22928
+ rounds: 2,
22870
22929
  behavior: {
22871
- size: 2e3,
22930
+ size: 10,
22872
22931
  replenish: "top-up",
22873
- selectSequentially: 10,
22874
- selectRandomly: 10,
22875
- targetBindingCount: 16
22932
+ selectSequentially: 1,
22933
+ selectRandomly: 1,
22934
+ targetBindingCount: 2
22876
22935
  }
22877
22936
  }
22878
22937
  }
22879
22938
  };
22880
22939
 
22881
- // ../../libs/core-gib/dist/keystone/policy/profiles/profile-medium.json
22882
- var profile_medium_default = {
22883
- $schema: "../schemas/keystone.medium.schema.json",
22940
+ // ../../libs/core-gib/dist/keystone/policy/profiles/sync/sync-profile.staging.json
22941
+ var sync_profile_staging_default = {
22942
+ $schema: "../../schemas/sync/sync-keystone.schema.json",
22884
22943
  metadata: {
22885
- name: "Medium Security Profile",
22944
+ name: "Sync Delegate Profile (Staging)",
22886
22945
  securityLevel: "medium"
22887
22946
  },
22888
22947
  pools: {
@@ -22894,41 +22953,27 @@ var profile_medium_default = {
22894
22953
  algo: "SHA-256",
22895
22954
  rounds: 2,
22896
22955
  behavior: {
22897
- size: 500,
22956
+ size: 100,
22898
22957
  replenish: "top-up",
22899
- selectSequentially: 5,
22900
- selectRandomly: 5,
22901
- targetBindingCount: 10
22958
+ selectSequentially: 2,
22959
+ selectRandomly: 2,
22960
+ targetBindingCount: 4
22902
22961
  }
22903
22962
  },
22904
22963
  manage: {
22905
22964
  id: "manage",
22906
22965
  allowedVerbs: [
22907
- "manage"
22908
- ],
22909
- algo: "SHA-256",
22910
- rounds: 2,
22911
- behavior: {
22912
- size: 500,
22913
- replenish: "replace-all",
22914
- selectSequentially: 5,
22915
- selectRandomly: 5,
22916
- targetBindingCount: 10
22917
- }
22918
- },
22919
- revoke: {
22920
- id: "revoke",
22921
- allowedVerbs: [
22966
+ "manage",
22922
22967
  "revoke"
22923
22968
  ],
22924
- algo: "SHA-256",
22925
- rounds: 10,
22969
+ algo: "SHA-512",
22970
+ rounds: 3,
22926
22971
  behavior: {
22927
- size: 500,
22928
- replenish: "delete-all",
22929
- selectSequentially: 20,
22930
- selectRandomly: 20,
22931
- targetBindingCount: 0
22972
+ size: 250,
22973
+ replenish: "replace-all",
22974
+ selectSequentially: 4,
22975
+ selectRandomly: 4,
22976
+ targetBindingCount: 6
22932
22977
  }
22933
22978
  },
22934
22979
  connect: {
@@ -22939,11 +22984,11 @@ var profile_medium_default = {
22939
22984
  algo: "SHA-256",
22940
22985
  rounds: 2,
22941
22986
  behavior: {
22942
- size: 500,
22987
+ size: 100,
22943
22988
  replenish: "top-up",
22944
- selectSequentially: 5,
22945
- selectRandomly: 5,
22946
- targetBindingCount: 10
22989
+ selectSequentially: 2,
22990
+ selectRandomly: 2,
22991
+ targetBindingCount: 4
22947
22992
  }
22948
22993
  },
22949
22994
  sign: {
@@ -22954,22 +22999,22 @@ var profile_medium_default = {
22954
22999
  algo: "SHA-256",
22955
23000
  rounds: 2,
22956
23001
  behavior: {
22957
- size: 500,
23002
+ size: 100,
22958
23003
  replenish: "top-up",
22959
- selectSequentially: 5,
22960
- selectRandomly: 5,
22961
- targetBindingCount: 10
23004
+ selectSequentially: 2,
23005
+ selectRandomly: 2,
23006
+ targetBindingCount: 4
22962
23007
  }
22963
23008
  }
22964
23009
  }
22965
23010
  };
22966
23011
 
22967
- // ../../libs/core-gib/dist/keystone/policy/profiles/profile-low.json
22968
- var profile_low_default = {
22969
- $schema: "../schemas/keystone.low.schema.json",
23012
+ // ../../libs/core-gib/dist/keystone/policy/profiles/sync/sync-profile.prod.json
23013
+ var sync_profile_prod_default = {
23014
+ $schema: "../../schemas/sync/sync-keystone.schema.json",
22970
23015
  metadata: {
22971
- name: "Low Security Profile",
22972
- securityLevel: "low"
23016
+ name: "Sync Delegate Profile (Prod)",
23017
+ securityLevel: "high"
22973
23018
  },
22974
23019
  pools: {
22975
23020
  sync: {
@@ -22977,44 +23022,30 @@ var profile_low_default = {
22977
23022
  allowedVerbs: [
22978
23023
  "sync"
22979
23024
  ],
22980
- algo: "SHA-256",
22981
- rounds: 1,
23025
+ algo: "SHA-512",
23026
+ rounds: 4,
22982
23027
  behavior: {
22983
- size: 100,
23028
+ size: 500,
22984
23029
  replenish: "top-up",
22985
- selectSequentially: 3,
22986
- selectRandomly: 3,
22987
- targetBindingCount: 8
23030
+ selectSequentially: 4,
23031
+ selectRandomly: 4,
23032
+ targetBindingCount: 6
22988
23033
  }
22989
23034
  },
22990
23035
  manage: {
22991
23036
  id: "manage",
22992
23037
  allowedVerbs: [
22993
- "manage"
22994
- ],
22995
- algo: "SHA-256",
22996
- rounds: 2,
22997
- behavior: {
22998
- size: 100,
22999
- replenish: "replace-all",
23000
- selectSequentially: 3,
23001
- selectRandomly: 3,
23002
- targetBindingCount: 8
23003
- }
23004
- },
23005
- revoke: {
23006
- id: "revoke",
23007
- allowedVerbs: [
23038
+ "manage",
23008
23039
  "revoke"
23009
23040
  ],
23010
- algo: "SHA-256",
23011
- rounds: 5,
23041
+ algo: "SHA-512",
23042
+ rounds: 6,
23012
23043
  behavior: {
23013
- size: 100,
23014
- replenish: "delete-all",
23015
- selectSequentially: 3,
23016
- selectRandomly: 3,
23017
- targetBindingCount: 0
23044
+ size: 1e3,
23045
+ replenish: "replace-all",
23046
+ selectSequentially: 8,
23047
+ selectRandomly: 8,
23048
+ targetBindingCount: 10
23018
23049
  }
23019
23050
  },
23020
23051
  connect: {
@@ -23022,14 +23053,14 @@ var profile_low_default = {
23022
23053
  allowedVerbs: [
23023
23054
  "connect"
23024
23055
  ],
23025
- algo: "SHA-256",
23026
- rounds: 1,
23056
+ algo: "SHA-512",
23057
+ rounds: 4,
23027
23058
  behavior: {
23028
- size: 100,
23059
+ size: 500,
23029
23060
  replenish: "top-up",
23030
- selectSequentially: 3,
23031
- selectRandomly: 3,
23032
- targetBindingCount: 8
23061
+ selectSequentially: 4,
23062
+ selectRandomly: 4,
23063
+ targetBindingCount: 6
23033
23064
  }
23034
23065
  },
23035
23066
  sign: {
@@ -23037,14 +23068,14 @@ var profile_low_default = {
23037
23068
  allowedVerbs: [
23038
23069
  "sign"
23039
23070
  ],
23040
- algo: "SHA-256",
23041
- rounds: 2,
23071
+ algo: "SHA-512",
23072
+ rounds: 4,
23042
23073
  behavior: {
23043
- size: 100,
23074
+ size: 500,
23044
23075
  replenish: "top-up",
23045
- selectSequentially: 3,
23046
- selectRandomly: 3,
23047
- targetBindingCount: 8
23076
+ selectSequentially: 4,
23077
+ selectRandomly: 4,
23078
+ targetBindingCount: 6
23048
23079
  }
23049
23080
  }
23050
23081
  }
@@ -23136,132 +23167,6 @@ var profile_session_default = {
23136
23167
  }
23137
23168
  };
23138
23169
 
23139
- // ../../libs/core-gib/dist/keystone/policy/profiles/profile-test.json
23140
- var profile_test_default = {
23141
- $schema: "../schemas/keystone.low.schema.json",
23142
- metadata: {
23143
- name: "Domain Identity Profile",
23144
- securityLevel: "low"
23145
- },
23146
- pools: {
23147
- manage: {
23148
- id: "manage",
23149
- allowedVerbs: [
23150
- "manage",
23151
- "revoke"
23152
- ],
23153
- algo: "SHA-256",
23154
- rounds: 1,
23155
- behavior: {
23156
- size: 10,
23157
- replenish: "replace-all",
23158
- selectSequentially: 1,
23159
- selectRandomly: 1,
23160
- targetBindingCount: 2
23161
- }
23162
- }
23163
- }
23164
- };
23165
-
23166
- // ../../libs/core-gib/dist/keystone/policy/profiles/profile-domain.json
23167
- var profile_domain_default = {
23168
- $schema: "../schemas/keystone.high.schema.json",
23169
- metadata: {
23170
- name: "Domain Identity Profile",
23171
- securityLevel: "high"
23172
- },
23173
- pools: {
23174
- manage: {
23175
- id: "manage",
23176
- allowedVerbs: [
23177
- "manage",
23178
- "revoke"
23179
- ],
23180
- algo: "SHA-512",
23181
- rounds: 6,
23182
- behavior: {
23183
- size: 2e3,
23184
- replenish: "replace-all",
23185
- selectSequentially: 12,
23186
- selectRandomly: 12,
23187
- targetBindingCount: 16
23188
- }
23189
- }
23190
- }
23191
- };
23192
-
23193
- // ../../libs/core-gib/dist/keystone/policy/profiles/profile-sync.json
23194
- var profile_sync_default = {
23195
- $schema: "../schemas/keystone.low.schema.json",
23196
- metadata: {
23197
- name: "Sync Delegate Profile",
23198
- securityLevel: "low"
23199
- },
23200
- pools: {
23201
- sync: {
23202
- id: "sync",
23203
- allowedVerbs: [
23204
- "sync"
23205
- ],
23206
- algo: "SHA-256",
23207
- rounds: 1,
23208
- behavior: {
23209
- size: 10,
23210
- replenish: "top-up",
23211
- selectSequentially: 1,
23212
- selectRandomly: 1,
23213
- targetBindingCount: 2
23214
- }
23215
- },
23216
- manage: {
23217
- id: "manage",
23218
- allowedVerbs: [
23219
- "manage",
23220
- "revoke"
23221
- ],
23222
- algo: "SHA-256",
23223
- rounds: 2,
23224
- behavior: {
23225
- size: 10,
23226
- replenish: "replace-all",
23227
- selectSequentially: 1,
23228
- selectRandomly: 1,
23229
- targetBindingCount: 2
23230
- }
23231
- },
23232
- connect: {
23233
- id: "connect",
23234
- allowedVerbs: [
23235
- "connect"
23236
- ],
23237
- algo: "SHA-256",
23238
- rounds: 1,
23239
- behavior: {
23240
- size: 10,
23241
- replenish: "top-up",
23242
- selectSequentially: 1,
23243
- selectRandomly: 1,
23244
- targetBindingCount: 2
23245
- }
23246
- },
23247
- sign: {
23248
- id: "default",
23249
- allowedVerbs: [
23250
- "sign"
23251
- ],
23252
- algo: "SHA-256",
23253
- rounds: 2,
23254
- behavior: {
23255
- size: 10,
23256
- replenish: "top-up",
23257
- selectSequentially: 1,
23258
- selectRandomly: 1,
23259
- targetBindingCount: 2
23260
- }
23261
- }
23262
- }
23263
- };
23264
-
23265
23170
  // ../../libs/core-gib/dist/keystone/policy/keystone-profile-builder.mjs
23266
23171
  var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
23267
23172
  _template;
@@ -23274,34 +23179,38 @@ var KeystoneProfileBuilder = class _KeystoneProfileBuilder {
23274
23179
  this._template = JSON.parse(JSON.stringify(template));
23275
23180
  }
23276
23181
  static buildKeystone(profileName) {
23277
- if (profileName === "test") {
23278
- throw new Error(`Security Violation: Keystone profile 'test' is prohibited when NODE_ENV=production. (E: 8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d)`);
23182
+ if (!profileName || typeof profileName !== "string") {
23183
+ throw new Error(`Profile name is required for KeystoneProfileBuilder. (E: 9a8b7c6d5e4f3210987654321fedcba0)`);
23184
+ }
23185
+ const isDevProfile = profileName.endsWith(".dev") || profileName.startsWith("test");
23186
+ if (isDevProfile) {
23187
+ throw new Error(`Security Violation: Development keystone profile '${profileName}' is prohibited when NODE_ENV=production. (E: 8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d)`);
23279
23188
  }
23280
23189
  let selected;
23281
23190
  switch (profileName) {
23282
- case "high":
23283
- selected = profile_high_default;
23191
+ case "primary-profile.dev":
23192
+ selected = primary_profile_dev_default;
23284
23193
  break;
23285
- case "medium":
23286
- selected = profile_medium_default;
23194
+ case "primary-profile.staging":
23195
+ selected = primary_profile_staging_default;
23287
23196
  break;
23288
- case "low":
23289
- selected = profile_low_default;
23197
+ case "primary-profile.prod":
23198
+ selected = primary_profile_prod_default;
23290
23199
  break;
23291
- case "session":
23292
- selected = profile_session_default;
23200
+ case "sync-profile.dev":
23201
+ selected = sync_profile_dev_default;
23293
23202
  break;
23294
- case "test":
23295
- selected = profile_test_default;
23203
+ case "sync-profile.staging":
23204
+ selected = sync_profile_staging_default;
23296
23205
  break;
23297
- case "domain":
23298
- selected = profile_domain_default;
23206
+ case "sync-profile.prod":
23207
+ selected = sync_profile_prod_default;
23299
23208
  break;
23300
- case "sync":
23301
- selected = profile_sync_default;
23209
+ case "session":
23210
+ selected = profile_session_default;
23302
23211
  break;
23303
23212
  default:
23304
- throw new Error(`Unknown profile name: ${profileName} (E: fc10a8ad482ef2bda871ac567d268d26)`);
23213
+ throw new Error(`Unknown keystone profile name: '${profileName}' (E: fc10a8ad482ef2bda871ac567d268d26)`);
23305
23214
  }
23306
23215
  return new _KeystoneProfileBuilder(selected);
23307
23216
  }
@@ -23534,7 +23443,11 @@ var SsoLoginHandler = class _SsoLoginHandler extends ServeGibHandlerBase {
23534
23443
  const tempId = await getUUID();
23535
23444
  const tempDomainMetaspace = await bootstrapDomainMetaspace(`temp^${tempId}`, reqCtx.dataDir);
23536
23445
  const tempSpace = await tempDomainMetaspace.getLocalUserSpace({ lock: false });
23537
- const primaryBuilder = KeystoneProfileBuilder.buildKeystone("domain").withUsername(username).withEmails([email]).withDetails({
23446
+ const primaryProfileName = "primary-profile.dev";
23447
+ if (!primaryProfileName || !primaryProfileName.trim()) {
23448
+ throw new Error('KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing. Expected valid profile name like "primary-profile.dev" or "primary-profile.prod". (E: 2b3c4d5e6f7890123456789abcdef2)');
23449
+ }
23450
+ const primaryBuilder = KeystoneProfileBuilder.buildKeystone(primaryProfileName.trim()).withUsername(username).withEmails([email]).withDetails({
23538
23451
  client: "space-gib-server",
23539
23452
  role: "custodian-primary",
23540
23453
  custodianProvider: providerId
@@ -23655,7 +23568,11 @@ var KeystoneCustodianGenesisHandler = class _KeystoneCustodianGenesisHandler ext
23655
23568
  isNewIdentity = true;
23656
23569
  console.log(`${lc2} Creating new custodian primary identity for ${normEmail} (I: f123456789abcdef0123456789b0006)`);
23657
23570
  const defaultUsername = username || normEmail.split("@")[0];
23658
- const primaryBuilder = KeystoneProfileBuilder.buildKeystone("sync").withUsername(defaultUsername).withDescription(`Full Custodian Primary Identity for ${normEmail}`).withDetails({
23571
+ const primaryProfileName = "primary-profile.dev";
23572
+ if (!primaryProfileName || !primaryProfileName.trim()) {
23573
+ throw new Error('KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing. Expected valid profile name like "primary-profile.dev" or "primary-profile.prod". (E: 1a2b3c4d5e6f7890123456789abcdef1)');
23574
+ }
23575
+ const primaryBuilder = KeystoneProfileBuilder.buildKeystone(primaryProfileName.trim()).withUsername(defaultUsername).withDescription(`Full Custodian Primary Identity for ${normEmail}`).withDetails({
23659
23576
  emails: [normEmail],
23660
23577
  custodyMode: "full"
23661
23578
  });
@@ -24010,26 +23927,7 @@ var EmailOutboundHandler = class _EmailOutboundHandler extends ServeGibHandlerBa
24010
23927
  sender;
24011
23928
  constructor(options = {}) {
24012
23929
  super();
24013
- if (options.sender) {
24014
- this.sender = options.sender;
24015
- } else {
24016
- const isProd = true;
24017
- const mode = (process.env.EMAIL_MODE || (isProd ? "aws" : "mock")).toLowerCase();
24018
- if (mode === "aws") {
24019
- this.sender = new EmailSenderAws({
24020
- accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
24021
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
24022
- region: process.env.AWS_REGION || "us-east-1"
24023
- });
24024
- } else if (mode === "mock") {
24025
- if (isProd) {
24026
- throw new Error("EMAIL_MODE=mock is prohibited when NODE_ENV=production. (E: 897a6b5c4d3e2f10987654321fedcba0)");
24027
- }
24028
- this.sender = new EmailSenderMock();
24029
- } else {
24030
- throw new Error(`Unsupported EMAIL_MODE '${mode}'. Must be 'aws' or 'mock'. (E: 987a6b5c4d3e2f10987654321fedcba1)`);
24031
- }
24032
- }
23930
+ this.sender = options.sender || createDefaultEmailSender();
24033
23931
  }
24034
23932
  async handleRouteImpl(reqCtx) {
24035
23933
  const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
@@ -24071,26 +23969,7 @@ var EmailVerificationCodeHandler = class _EmailVerificationCodeHandler extends S
24071
23969
  sender;
24072
23970
  constructor(options = {}) {
24073
23971
  super();
24074
- if (options.sender) {
24075
- this.sender = options.sender;
24076
- } else {
24077
- const isProd = true;
24078
- const mode = (process.env.EMAIL_MODE || (isProd ? "aws" : "mock")).toLowerCase();
24079
- if (mode === "aws") {
24080
- this.sender = new EmailSenderAws({
24081
- accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
24082
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
24083
- region: process.env.AWS_REGION || "us-east-1"
24084
- });
24085
- } else if (mode === "mock") {
24086
- if (isProd) {
24087
- throw new Error("EMAIL_MODE=mock is prohibited when NODE_ENV=production. (E: 897a6b5c4d3e2f10987654321fedcba0)");
24088
- }
24089
- this.sender = new EmailSenderMock();
24090
- } else {
24091
- throw new Error(`Unsupported EMAIL_MODE '${mode}'. Must be 'aws' or 'mock'. (E: 987a6b5c4d3e2f10987654321fedcba1)`);
24092
- }
24093
- }
23972
+ this.sender = options.sender || createDefaultEmailSender();
24094
23973
  }
24095
23974
  async handleRouteImpl(reqCtx) {
24096
23975
  const lc2 = `${this.lc}[${this.handleRouteImpl.name}]`;
@@ -29566,16 +29445,25 @@ async function main() {
29566
29445
  try {
29567
29446
  console.log(`${lc2} starting...`);
29568
29447
  console.log(`${lc2} dataDir: ${DATA_DIR}`);
29569
- if ("domain".toLowerCase() === "test") {
29448
+ const custodianPrimaryProfile = "primary-profile.dev".trim();
29449
+ if (!custodianPrimaryProfile) {
29450
+ throw new Error(`${lc2} Fatal Error: KEYSTONE_PROFILE_CUSTODIAN_PRIMARY environment variable is missing or blank. (E: 8a9b0c1d2e3f4567890123456789abcd)`);
29451
+ }
29452
+ const isProdEnv = true;
29453
+ if (isProdEnv && !custodianPrimaryProfile.endsWith(".prod")) {
29454
+ throw new Error(`${lc2} Security Violation: Non-production keystone profile '${custodianPrimaryProfile}' is prohibited when NODE_ENV=production. (E: 9b0c1d2e3f4567890123456789abcdef)`);
29455
+ }
29456
+ console.log(`${lc2} KEYSTONE_PROFILE_CUSTODIAN_PRIMARY: ${custodianPrimaryProfile} (I: 961014e2dd082293b83b917835c97e26)`);
29457
+ if (custodianPrimaryProfile.endsWith(".dev")) {
29570
29458
  console.warn(`
29571
29459
  ==========================================================
29572
- \u26A0\uFE0F WARNING: KEYSTONE_PROFILE IS SET TO 'test'!
29573
- ALL GENERATED KEYSTONES USE LOW-SECURITY TEST PARAMETERS (12 CHALLENGES).
29460
+ \u26A0\uFE0F WARNING: CUSTODIAN KEYSTONE PROFILE IS SET TO DEVELOPMENT ('${custodianPrimaryProfile}')!
29461
+ CUSTODIAL KEYSTONES WILL USE LOW-SECURITY DEV PARAMETERS.
29574
29462
  FOR LOCAL TESTING ONLY \u2014 DO NOT USE FOR REAL SECRETS OR PRODUCTION DATA!
29575
29463
  ==========================================================
29576
29464
  (W: 890123456789abcdef0123456789a123)`);
29577
- } else {
29578
- console.log(`process.env.KEYSTONE_PROFILE: ${"domain"} (I: 961014e2dd082293b83b917835c97e26)`);
29465
+ } else if (custodianPrimaryProfile.endsWith(".staging")) {
29466
+ console.info(`${lc2} \u2139\uFE0F STAGING CUSTODIAN KEYSTONE PROFILE ACTIVE ('${custodianPrimaryProfile}')`);
29579
29467
  }
29580
29468
  const syncUpgradeHandler = new SyncUpgradeHandler();
29581
29469
  const serveGib = new ServeGib_V1({
@@ -29606,4 +29494,3 @@ FOR LOCAL TESTING ONLY \u2014 DO NOT USE FOR REAL SECRETS OR PRODUCTION DATA!
29606
29494
  }
29607
29495
  }
29608
29496
  main();
29609
- //# sourceMappingURL=server.mjs.map