@ibgib/core-gib 0.1.43 → 0.1.44

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 (74) hide show
  1. package/dist/keystone/kdf/kdf-constants.d.mts +25 -0
  2. package/dist/keystone/kdf/kdf-constants.d.mts.map +1 -0
  3. package/dist/keystone/kdf/kdf-constants.mjs +28 -0
  4. package/dist/keystone/kdf/kdf-constants.mjs.map +1 -0
  5. package/dist/keystone/kdf/kdf-helpers.d.mts +45 -0
  6. package/dist/keystone/kdf/kdf-helpers.d.mts.map +1 -0
  7. package/dist/keystone/kdf/kdf-helpers.mjs +94 -0
  8. package/dist/keystone/kdf/kdf-helpers.mjs.map +1 -0
  9. package/dist/keystone/kdf/kdf-types.d.mts +49 -0
  10. package/dist/keystone/kdf/kdf-types.d.mts.map +1 -0
  11. package/dist/keystone/kdf/kdf-types.mjs +2 -0
  12. package/dist/keystone/kdf/kdf-types.mjs.map +1 -0
  13. package/dist/keystone/keystone-config-builder.d.mts +65 -12
  14. package/dist/keystone/keystone-config-builder.d.mts.map +1 -1
  15. package/dist/keystone/keystone-config-builder.mjs +138 -46
  16. package/dist/keystone/keystone-config-builder.mjs.map +1 -1
  17. package/dist/keystone/keystone-config-builder.respec.mjs +21 -13
  18. package/dist/keystone/keystone-config-builder.respec.mjs.map +1 -1
  19. package/dist/keystone/keystone-constants.d.mts +15 -0
  20. package/dist/keystone/keystone-constants.d.mts.map +1 -1
  21. package/dist/keystone/keystone-constants.mjs +16 -0
  22. package/dist/keystone/keystone-constants.mjs.map +1 -1
  23. package/dist/keystone/keystone-helpers.d.mts +4 -4
  24. package/dist/keystone/keystone-helpers.d.mts.map +1 -1
  25. package/dist/keystone/keystone-helpers.mjs +8 -5
  26. package/dist/keystone/keystone-helpers.mjs.map +1 -1
  27. package/dist/keystone/keystone-service-v1.d.mts +1 -1
  28. package/dist/keystone/keystone-service-v1.d.mts.map +1 -1
  29. package/dist/keystone/keystone-service-v1.mjs +6 -5
  30. package/dist/keystone/keystone-service-v1.mjs.map +1 -1
  31. package/dist/keystone/keystone-service-v1.respec.mjs +72 -45
  32. package/dist/keystone/keystone-service-v1.respec.mjs.map +1 -1
  33. package/dist/keystone/keystone-types.d.mts +28 -18
  34. package/dist/keystone/keystone-types.d.mts.map +1 -1
  35. package/dist/keystone/keystone-types.mjs +26 -15
  36. package/dist/keystone/keystone-types.mjs.map +1 -1
  37. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.d.mts.map +1 -1
  38. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs +7 -10
  39. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs.map +1 -1
  40. package/dist/sync/sync-constants.d.mts +9 -0
  41. package/dist/sync/sync-constants.d.mts.map +1 -1
  42. package/dist/sync/sync-constants.mjs +10 -0
  43. package/dist/sync/sync-constants.mjs.map +1 -1
  44. package/dist/sync/sync-innerspace-dest-ahead-withid.respec.mjs +49 -19
  45. package/dist/sync/sync-innerspace-dest-ahead-withid.respec.mjs.map +1 -1
  46. package/dist/sync/sync-saga-coordinator.d.mts +22 -11
  47. package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
  48. package/dist/sync/sync-saga-coordinator.mjs +120 -27
  49. package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
  50. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +1 -7
  51. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
  52. package/dist/sync/sync-types.d.mts +11 -0
  53. package/dist/sync/sync-types.d.mts.map +1 -1
  54. package/dist/sync/sync-types.mjs.map +1 -1
  55. package/package.json +1 -1
  56. package/src/keystone/README.md +4 -3
  57. package/src/keystone/docs/architecture.md +3 -1
  58. package/src/keystone/kdf/kdf-constants.mts +34 -0
  59. package/src/keystone/kdf/kdf-helpers.mts +105 -0
  60. package/src/keystone/kdf/kdf-types.mts +58 -0
  61. package/src/keystone/keystone-config-builder.mts +170 -47
  62. package/src/keystone/keystone-config-builder.respec.mts +21 -14
  63. package/src/keystone/keystone-constants.mts +21 -2
  64. package/src/keystone/keystone-helpers.mts +19 -14
  65. package/src/keystone/keystone-service-v1.mts +23 -22
  66. package/src/keystone/keystone-service-v1.respec.mts +71 -44
  67. package/src/keystone/keystone-types.mts +37 -23
  68. package/src/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mts +9 -13
  69. package/src/sync/sync-constants.mts +12 -0
  70. package/src/sync/sync-innerspace-dest-ahead-withid.respec.mts +53 -20
  71. package/src/sync/sync-saga-coordinator.mts +156 -31
  72. package/src/sync/sync-saga-message/sync-saga-message-types.mts +1 -7
  73. package/src/sync/sync-types.mts +12 -0
  74. package/tmp.md +0 -274
@@ -159,6 +159,17 @@ export interface SyncRel8ns_V1 extends IbGibRel8ns_V1 {
159
159
  * This MUST point to the specific Keystone Frame that authorizes this sync frame.
160
160
  */
161
161
  identity?: string[];
162
+ /**
163
+ * Session keystones used for signing saga frames.
164
+ *
165
+ * Array contains addresses of keystone evolution chain:
166
+ * - Index 0: Genesis keystone (dual-pool architecture)
167
+ * - Index N: Latest evolved keystone after signing operations
168
+ *
169
+ * Each sync endpoint retrieves the session keystone from this rel8n
170
+ * rather than searching spaces. Keystones are stored in durable spaces.
171
+ */
172
+ sessionKeystones?: IbGibAddr[];
162
173
  /**
163
174
  * The message stone that contains the information about the particular
164
175
  * stage of the sync process we are in.
@@ -1 +1 @@
1
- {"version":3,"file":"sync-types.d.mts","sourceRoot":"","sources":["../../src/sync/sync-types.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,E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"version":3,"file":"sync-types.mjs","sourceRoot":"","sources":["../../src/sync/sync-types.mts"],"names":[],"mappings":"AAMA,OAAO,EAAa,mBAAmB,GAAyB,MAAM,sBAAsB,CAAC;AAQ7F,mBAAmB;AACnB,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAKrC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;CACmB,CAAC;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC9D,MAAM,UAAU,eAAe,CAAC,IAAY;IACxC,OAAO,sBAAsB,CAAC,QAAQ,CAAC,IAAgB,CAAC,CAAC;AAC7D,CAAC;AACD,sBAAsB;AAEtB,8BAA8B;AAC9B,MAAM,CAAC,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AACtD,MAAM,CAAC,MAAM,+BAA+B,GAAG,UAAU,CAAC;AAK1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B;;OAEG;IACH,MAAM,EAAE,6BAA6B;IACrC;;;;OAIG;IACH,QAAQ,EAAE,+BAA+B;CACoB,CAAC;AAClE,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACtF,MAAM,UAAU,0BAA0B,CAAC,eAAuB;IAC9D,OAAO,mCAAmC,CAAC,QAAQ,CAAC,eAAsC,CAAC,CAAC;AAChG,CAAC;AA6JD,0CAA0C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibgib/core-gib",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "ibgib core functionality, including base architecture for witnesses, spaces, apps, robbots, etc., as well as shared utility functions. Node v19+ needed for heavily-used isomorphic webcrypto hashing consumed in both node and browsers.",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -28,7 +28,8 @@ Keystones organize challenges into **pools** with specific purposes:
28
28
  Each pool configuration specifies:
29
29
  * **`poolId`**: Unique identifier within the keystone
30
30
  * **`verb`**: Auto-routes operations (e.g., `revoke`, `manage`, `login`)
31
- * **`replenishStrategy`**: `'top-up'` (reusable) or `'scorched-earth'` (burn after use)
31
+ * **`replenishStrategy`**: What to do after using challenges in a pool, e.g.
32
+ `'top-up'`, `'replace-all'`, `'delete-all'`, etc.
32
33
  * **`challengeCount`**: Number of hash challenges in the pool
33
34
 
34
35
  ## Basic Usage
@@ -39,8 +40,8 @@ Each pool configuration specifies:
39
40
  const keystone = await keystoneService.genesis({
40
41
  masterSecret: "user-password",
41
42
  configs: [
42
- { poolId: 'default', challengeCount: 100, replenishStrategy: 'top-up' },
43
- { poolId: 'revoke', verb: 'revoke', challengeCount: 10, replenishStrategy: 'scorched-earth' }
43
+ { poolId: 'default', challengeCount: 100, replenishStrategy: KeystoneReplenishStrategy.topUp },
44
+ { poolId: 'revoke', verb: 'revoke', challengeCount: 10, replenishStrategy: KeystoneReplenishStrategy.deleteAll }
44
45
  ],
45
46
  metaspace,
46
47
  space
@@ -74,7 +74,9 @@ Inputs: `LatestKeystone`, `Claim`, `MasterSecret`.
74
74
  3. **Solving**: Generates solutions.
75
75
  4. **Replenishment**: Adds new challenges based on pool's `replenishStrategy`:
76
76
  * **`'top-up'`**: Refills consumed challenges (default, reusable identity)
77
- * **`'scorched-earth'`**: Burns challenges permanently (revocation, one-time operations)
77
+ * **`'replace-all'`**: Establishes completely new challenges (mitigate long-term pre-image attacks)
78
+ * **`'consume'`**: Do not re-add any challenges (limited number of uses)
79
+ * **`'delete-all'`**: Removes all challenges permanently (revocation, one-time operations)
78
80
 
79
81
  ### 5.3 Validate
80
82
  Inputs: `PreviousFrame`, `CurrentFrame`.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * KDF Strategy Constants
3
+ *
4
+ * Defines available key derivation function strategies.
5
+ */
6
+
7
+ // #region KdfStrategy
8
+ export const KDF_STRATEGY_RECURSIVE_SALT_WRAP = 'recursive-salt-wrap';
9
+ export type KdfStrategy =
10
+ | typeof KDF_STRATEGY_RECURSIVE_SALT_WRAP
11
+ ;
12
+
13
+ /**
14
+ * Available KDF strategies for deriving keys from master secrets.
15
+ *
16
+ * - `recursive-salt-wrap`: Hash(salt + current + salt) ^ rounds
17
+ * Used by KeystoneStrategy_HashRevealV1 for pool secret derivation
18
+ */
19
+ export const KdfStrategy = {
20
+ /**
21
+ * Recursive salt wrap strategy: Hash(salt + current + salt) ^ rounds
22
+ *
23
+ * This is the primary strategy used by keystones for deriving pool secrets
24
+ * from master secrets with configurable rounds for key stretching.
25
+ */
26
+ recursive_salt_wrap: KDF_STRATEGY_RECURSIVE_SALT_WRAP,
27
+ } satisfies { [key: string]: KdfStrategy };
28
+
29
+ export const KDF_STRATEGY_VALID_VALUES = Object.values(KdfStrategy);
30
+
31
+ export function isValidKdfStrategy(strategy: string): strategy is KdfStrategy {
32
+ return KDF_STRATEGY_VALID_VALUES.includes(strategy as KdfStrategy);
33
+ }
34
+ // #endregion KdfStrategy
@@ -0,0 +1,105 @@
1
+ import { extractErrorMsg, hash, HashAlgorithm } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
2
+
3
+ import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
4
+ import { KDF_STRATEGY_RECURSIVE_SALT_WRAP, KDF_STRATEGY_VALID_VALUES, KdfStrategy } from './kdf-constants.mjs';
5
+ import { DeriveKeyParams, KdfOptions_RecursiveSaltWrap } from './kdf-types.mjs';
6
+
7
+ const logalot = GLOBAL_LOG_A_LOT;
8
+
9
+ /**
10
+ * Derive a key from a master secret using the specified KDF strategy
11
+ *
12
+ * This is the main dispatch function for all KDF operations. It routes to the
13
+ * appropriate strategy implementation based on `kdfOpts.strategy`.
14
+ *
15
+ * @param params - Derivation parameters including master secret and KDF options
16
+ * @returns Derived key
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const derivedKey = await deriveKey({
21
+ * masterSecret: 'my-strong-password',
22
+ * kdfOpts: {
23
+ * strategy: KdfStrategy.recursiveSaltWrap,
24
+ * salt: 'pool-identifier',
25
+ * rounds: 10000,
26
+ * algorithm: 'SHA-256'
27
+ * }
28
+ * });
29
+ * ```
30
+ */
31
+ export async function deriveKey({
32
+ masterSecret,
33
+ kdfOpts
34
+ }: DeriveKeyParams): Promise<string> {
35
+ const lc = `[${deriveKey.name}]`;
36
+ try {
37
+ if (logalot) { console.log(`${lc} starting... (I: 268e87ec311874ee6822bf459c5a5426)`); }
38
+
39
+ const strategy = kdfOpts.strategy;
40
+
41
+ switch (strategy) {
42
+ case KdfStrategy['recursive-salt-wrap']:
43
+ return await kdf_recursiveSaltWrap({
44
+ masterSecret,
45
+ salt: kdfOpts.salt,
46
+ rounds: kdfOpts.rounds,
47
+ algorithm: kdfOpts.algorithm
48
+ });
49
+ default:
50
+ throw new Error(`Unknown KDF strategy: ${strategy}. valid values: ${KDF_STRATEGY_VALID_VALUES.join(', ')} (E: a1b2c3d4e5f6g7h8i9j0)`);
51
+ }
52
+
53
+ } catch (error) {
54
+ console.error(`${lc} ${extractErrorMsg(error)}`);
55
+ throw error;
56
+ } finally {
57
+ if (logalot) { console.log(`${lc} complete.`); }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Recursive Salt Wrap KDF Strategy
63
+ *
64
+ * Derives a key by recursively applying: Hash(salt + current + salt) for N rounds
65
+ *
66
+ * This is the strategy used by KeystoneStrategy_HashRevealV1 for deriving pool secrets.
67
+ *
68
+ * @param masterSecret - The initial secret/password to derive from
69
+ * @param salt - Salt value to wrap around the secret
70
+ * @param rounds - Number of hash iterations (key stretching)
71
+ * @param algorithm - Hash algorithm to use (default: SHA-256)
72
+ * @returns Derived key
73
+ */
74
+ export async function kdf_recursiveSaltWrap({
75
+ masterSecret,
76
+ salt,
77
+ rounds,
78
+ algorithm = HashAlgorithm.sha_256,
79
+ }: {
80
+ masterSecret: string;
81
+ salt: string;
82
+ rounds: number;
83
+ algorithm?: HashAlgorithm;
84
+ }): Promise<string> {
85
+ const lc = `[${kdf_recursiveSaltWrap.name}]`;
86
+ try {
87
+ if (logalot) { console.log(`${lc} starting... (I: 850868e50aba82ff28c77da8169e4c26)`); }
88
+
89
+ let current = masterSecret;
90
+
91
+ for (let i = 0; i < rounds; i++) {
92
+ current = await hash({
93
+ s: `${salt}${current}${salt}`,
94
+ algorithm
95
+ });
96
+ }
97
+
98
+ return current;
99
+ } catch (error) {
100
+ console.error(`${lc} ${extractErrorMsg(error)}`);
101
+ throw error;
102
+ } finally {
103
+ if (logalot) { console.log(`${lc} complete.`); }
104
+ }
105
+ }
@@ -0,0 +1,58 @@
1
+ import { HashAlgorithm } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
2
+ import { KdfStrategy } from './kdf-constants.mjs';
3
+
4
+ /**
5
+ * Base options for all KDF strategies
6
+ */
7
+ export interface KdfOptionsBase {
8
+ /**
9
+ * Name of the KDF strategy to use
10
+ */
11
+ strategy: KdfStrategy;
12
+ }
13
+
14
+ /**
15
+ * Options for recursive-salt-wrap KDF strategy
16
+ *
17
+ * Derives key by recursively applying: Hash(salt + current + salt) for N rounds
18
+ */
19
+ export interface KdfOptions_RecursiveSaltWrap extends KdfOptionsBase {
20
+ strategy: typeof import('./kdf-constants.mjs').KDF_STRATEGY_RECURSIVE_SALT_WRAP;
21
+
22
+ /**
23
+ * Salt value to wrap around the secret during each iteration
24
+ */
25
+ salt: string;
26
+
27
+ /**
28
+ * Number of hash iterations for key stretching
29
+ */
30
+ rounds: number;
31
+
32
+ /**
33
+ * Hash algorithm to use (default: SHA-256)
34
+ */
35
+ algorithm?: HashAlgorithm;
36
+ }
37
+
38
+ /**
39
+ * Union of all KDF option types
40
+ */
41
+ export type KdfOptions =
42
+ | KdfOptions_RecursiveSaltWrap
43
+ ;
44
+
45
+ /**
46
+ * Parameters for deriving a key using KDF
47
+ */
48
+ export interface DeriveKeyParams {
49
+ /**
50
+ * The initial secret/password to derive from
51
+ */
52
+ masterSecret: string;
53
+
54
+ /**
55
+ * KDF options specifying strategy and strategy-specific parameters
56
+ */
57
+ kdfOpts: KdfOptions;
58
+ }
@@ -1,11 +1,13 @@
1
+ import { extractErrorMsg, HashAlgorithm } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
2
+
3
+ import { GLOBAL_LOG_A_LOT } from '../core-constants.mjs';
1
4
  import {
2
- KeystonePoolConfig,
3
- KeystonePoolConfig_HashV1,
4
- KeystonePoolBehavior,
5
- KeystoneReplenishStrategy,
6
- KeystonePoolConfigBase
5
+ KeystonePoolConfig, KeystonePoolConfig_HashV1, KeystonePoolBehavior,
6
+ KeystoneReplenishStrategy, KeystonePoolConfigBase, KeystoneChallengeType,
7
7
  } from './keystone-types.mjs';
8
- import { POOL_ID_DEFAULT, POOL_ID_REVOKE, KEYSTONE_VERB_REVOKE } from './keystone-constants.mjs';
8
+ import { POOL_ID_REVOKE, KEYSTONE_VERB_REVOKE, KEYSTONE_CONFIG_DEFAULT_SIZE, KEYSTONE_CONFIG_DEFAULT_BINDING, KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY, KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL, KEYSTONE_CONFIG_DEFAULT_RANDOM, KEYSTONE_CONFIG_DEFAULT_SIZE_HIGHSECURITY, KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL_HIGHSECURITY, KEYSTONE_CONFIG_DEFAULT_RANDOM_HIGHSECURITY, KEYSTONE_CONFIG_DEFAULT_BINDING_HIGHSECURITY, KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY_HIGHSECURITY, KeystoneVerb, KEYSTONE_CONFIG_DEFAULT_HASH_ALGORITHM, KEYSTONE_CONFIG_DEFAULT_HASH_ROUNDS, KEYSTONE_CONFIG_DEFAULT_HASH_ALGORITHM_HIGHSECURITY, KEYSTONE_CONFIG_DEFAULT_HASH_ROUNDS_HIGHSECURITY } from './keystone-constants.mjs';
9
+
10
+ const logalot = GLOBAL_LOG_A_LOT;
9
11
 
10
12
  /**
11
13
  * Abstract Base Builder.
@@ -14,17 +16,25 @@ import { POOL_ID_DEFAULT, POOL_ID_REVOKE, KEYSTONE_VERB_REVOKE } from './keyston
14
16
  * @template TConfig The concrete config type being built.
15
17
  */
16
18
  export abstract class KeystoneConfigBuilderBase<TConfig extends KeystonePoolConfigBase> {
17
- protected _salt: string = 'default';
18
- protected _size: number = 100;
19
- protected _replenish: KeystoneReplenishStrategy = 'top-up';
20
- protected _seq: number = 0;
21
- protected _rand: number = 0;
19
+ protected _id: string | undefined;
20
+ protected _salt: string | undefined;
21
+ protected _size: number | undefined;
22
+ protected _replenish: KeystoneReplenishStrategy | undefined;
23
+ protected _seq: number | undefined;
24
+ protected _rand: number | undefined;
22
25
  protected _verbs: string[] = [];
23
- protected _targetBinding: number = 0; // Default 0
26
+ protected _targetBinding: number | undefined;
24
27
 
28
+ /**
29
+ * Sets the unique id for this pool.
30
+ */
31
+ withId(id: string): this {
32
+ this._id = id;
33
+ return this;
34
+ }
25
35
 
26
36
  /**
27
- * Sets the unique salt/ID for this pool.
37
+ * Sets the unique salt for this pool.
28
38
  */
29
39
  withSalt(salt: string): this {
30
40
  this._salt = salt;
@@ -71,7 +81,7 @@ export abstract class KeystoneConfigBuilderBase<TConfig extends KeystonePoolConf
71
81
  /**
72
82
  * Configures the pool to use Hybrid (Both FIFO and Random) selection.
73
83
  */
74
- withHybrid(seqCount: number, randCount: number): this {
84
+ withHybrid({ seqCount, randCount }: { seqCount: number, randCount: number }): this {
75
85
  this._seq = seqCount;
76
86
  this._rand = randCount;
77
87
  return this;
@@ -90,6 +100,11 @@ export abstract class KeystoneConfigBuilderBase<TConfig extends KeystonePoolConf
90
100
  * Helper for subclasses.
91
101
  */
92
102
  protected buildBehavior(): KeystonePoolBehavior {
103
+ if (this._size === undefined) { throw new Error(`size required (E: 68320865d9adb8477836485b20b08826)`); }
104
+ if (this._replenish === undefined) { throw new Error(`replenish strategy required (E: 9f8798d1a568763a282e53c89185b826)`); }
105
+ if (this._seq === undefined) { throw new Error(`sequential required (E: e0da08a24e9790d0a8c1a9322f8eb826)`); }
106
+ if (this._rand === undefined) { throw new Error(`selectRandomly required (E: 7721d84d1a8b7d020d0ab33c3f811426)`); }
107
+ if (this._targetBinding === undefined) { throw new Error(`targetBinding required (E: 9add64d7e8e8cba01d901727a8e9b826)`); }
93
108
  return {
94
109
  size: this._size,
95
110
  replenish: this._replenish,
@@ -108,14 +123,14 @@ export abstract class KeystoneConfigBuilderBase<TConfig extends KeystonePoolConf
108
123
  return this;
109
124
  }
110
125
 
111
- protected buildBase(): KeystonePoolConfigBase {
112
- // Helper to keep the concrete build() clean
113
- return {
114
- type: 'hash-reveal-v1', // This is overridden by concrete/interface usually, but needed for base shape
115
- salt: this._salt,
116
- allowedVerbs: this._verbs
117
- } as any;
118
- }
126
+ // protected buildBase(): KeystonePoolConfigBase {
127
+ // // Helper to keep the concrete build() clean
128
+ // return {
129
+ // type: KeystoneChallengeType.hash_reveal_v1, // This is overridden by concrete/interface usually, but needed for base shape
130
+ // salt: this._salt,
131
+ // allowedVerbs: this._verbs
132
+ // } as any;
133
+ // }
119
134
 
120
135
  abstract build(): TConfig;
121
136
  }
@@ -124,28 +139,56 @@ export abstract class KeystoneConfigBuilderBase<TConfig extends KeystonePoolConf
124
139
  * Concrete Builder for Hash-Reveal V1 Strategy.
125
140
  */
126
141
  export class KeystoneConfigBuilder_HashV1 extends KeystoneConfigBuilderBase<KeystonePoolConfig_HashV1> {
127
- private _algo: 'SHA-256' | 'SHA-512' = 'SHA-256';
128
- private _rounds: number = 1;
142
+ protected lc: string = `[${KeystoneConfigBuilder_HashV1}]`;
143
+ private _algo: HashAlgorithm | undefined;
144
+ private _rounds: number | undefined;
129
145
 
130
146
  /**
131
147
  * Sets the hashing strength.
132
148
  */
133
- withHash(algo: 'SHA-256' | 'SHA-512', rounds: number = 1): this {
134
- this._algo = algo;
135
- this._rounds = rounds;
136
- return this;
149
+ withHash({ algo, rounds }: { algo: HashAlgorithm, rounds: number }): this {
150
+ const lc = `${this.lc}[${this.withHash.name}]`;
151
+ try {
152
+ if (logalot) { console.log(`${lc} starting... (I: 15d1b3bd2e98bba33fc6c78228755826)`); }
153
+
154
+ this._algo = algo;
155
+ this._rounds = rounds;
156
+ return this;
157
+ } catch (error) {
158
+ console.error(`${lc} ${extractErrorMsg(error)}`);
159
+ throw error;
160
+ } finally {
161
+ if (logalot) { console.log(`${lc} complete.`); }
162
+ }
137
163
  }
138
164
 
139
165
  build(): KeystonePoolConfig_HashV1 {
140
- return {
141
- id: this._salt, // Using salt as the unique ID for the pool config
142
- type: 'hash-reveal-v1',
143
- salt: this._salt,
144
- allowedVerbs: this._verbs, // <--- Mapped here
145
- behavior: this.buildBehavior(),
146
- algo: this._algo,
147
- rounds: this._rounds,
148
- };
166
+ const lc = `${this.lc}[${this.build.name}]`;
167
+ try {
168
+ if (logalot) { console.log(`${lc} starting... (I: 5df568c63c4993bb98df0a319ee16826)`); }
169
+
170
+ if (!this._id) { throw new Error(`id required (E: b50d082adf38bcbf463552f80d2c3226)`); }
171
+ if (!this._salt) { throw new Error(`salt required (E: b0f1926657b8d7d3a88fb9385ead5826)`); }
172
+ if (!this._algo) { throw new Error(`algorithm required (E: cff228f9898fd6383ef752088dae6826)`); }
173
+ if (this._rounds === undefined) { throw new Error(`rounds required (E: eb72580f3b014cda18cba3e399683c26)`); }
174
+
175
+ const result: KeystonePoolConfig_HashV1 = {
176
+ id: this._id,
177
+ type: KeystoneChallengeType.hash_reveal_v1,
178
+ salt: this._salt,
179
+ allowedVerbs: this._verbs,
180
+ behavior: this.buildBehavior(),
181
+ algo: this._algo,
182
+ rounds: this._rounds,
183
+ };
184
+
185
+ return result;
186
+ } catch (error) {
187
+ console.error(`${lc} ${extractErrorMsg(error)}`);
188
+ throw error;
189
+ } finally {
190
+ if (logalot) { console.log(`${lc} complete.`); }
191
+ }
149
192
  }
150
193
  }
151
194
 
@@ -166,22 +209,102 @@ export class KeystoneConfig {
166
209
  // FACTORY FUNCTIONS (Presets)
167
210
  // ===========================================================================
168
211
 
169
- export function createStandardPoolConfig(salt: string = POOL_ID_DEFAULT): KeystonePoolConfig {
212
+ interface KeystoneConfigFactoryOptions_Standard {
213
+ /**
214
+ * id for pool that this config pertains to
215
+ */
216
+ id: string;
217
+ /**
218
+ * should be a unique string
219
+ */
220
+ salt: string;
221
+ /**
222
+ * number of challenges in the pool
223
+ * @see {@link KeystonePoolConfig}
224
+ */
225
+ size?: number;
226
+ /**
227
+ * number of sequential challenges required for solution per action
228
+ */
229
+ sequential?: number;
230
+ /**
231
+ * number of random challenges required for solution per action
232
+ */
233
+ random?: number;
234
+ /**
235
+ * number of target binding characters required for solution per action
236
+ * @see {@link KeystonePoolBehavior.targetBindingChars}
237
+ */
238
+ targetBinding?: number;
239
+ /**
240
+ * @see {@link KeystonePoolBehavior.replenish}
241
+ */
242
+ replenishStrategy?: KeystoneReplenishStrategy;
243
+ /**
244
+ * verbs for the pool
245
+ */
246
+ verbs?: string[];
247
+ hashAlgorithm?: HashAlgorithm;
248
+ hashRounds?: number;
249
+ }
250
+
251
+ export function createStandardPoolConfig(opts: KeystoneConfigFactoryOptions_Standard): KeystonePoolConfig {
252
+ let {
253
+ salt, id, size, sequential, random, targetBinding, replenishStrategy,
254
+ verbs, hashAlgorithm, hashRounds,
255
+ } = opts;
170
256
  return KeystoneConfig.hash()
257
+ .withId(id)
171
258
  .withSalt(salt)
172
- .withSize(100)
173
- .withHybrid(2, 2)
174
- .withReplenishStrategy('top-up')
259
+ .withSize(size ?? KEYSTONE_CONFIG_DEFAULT_SIZE)
260
+ .withHybrid({
261
+ seqCount: sequential ?? KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL,
262
+ randCount: random ?? KEYSTONE_CONFIG_DEFAULT_RANDOM,
263
+ })
264
+ .withTargetBinding(targetBinding ?? KEYSTONE_CONFIG_DEFAULT_BINDING)
265
+ .withReplenishStrategy(replenishStrategy ?? KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY)
266
+ .withHash({
267
+ algo: hashAlgorithm ?? KEYSTONE_CONFIG_DEFAULT_HASH_ALGORITHM,
268
+ rounds: hashRounds ?? KEYSTONE_CONFIG_DEFAULT_HASH_ROUNDS
269
+ })
270
+ .forVerbs(verbs ?? [])
175
271
  .build();
176
272
  }
177
273
 
178
- export function createRevocationPoolConfig(salt: string = POOL_ID_REVOKE): KeystonePoolConfig {
274
+ export function createHighSecurityPoolConfig(opts: KeystoneConfigFactoryOptions_Standard): KeystonePoolConfig {
275
+ let {
276
+ salt, id, size, sequential, random, targetBinding, replenishStrategy,
277
+ verbs, hashAlgorithm, hashRounds,
278
+ } = opts;
179
279
  return KeystoneConfig.hash()
280
+ .withId(id)
180
281
  .withSalt(salt)
181
- .withHash('SHA-256', 10)
182
- .withSize(500)
183
- .withHybrid(10, 10)
184
- .withReplenishStrategy(KeystoneReplenishStrategy.scorchedEarth)
185
- .forVerbs([KEYSTONE_VERB_REVOKE])
282
+ .withSize(size ?? KEYSTONE_CONFIG_DEFAULT_SIZE_HIGHSECURITY)
283
+ .withHybrid({
284
+ seqCount: sequential ?? KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL_HIGHSECURITY,
285
+ randCount: random ?? KEYSTONE_CONFIG_DEFAULT_RANDOM_HIGHSECURITY,
286
+ })
287
+ .withTargetBinding(targetBinding ?? KEYSTONE_CONFIG_DEFAULT_BINDING_HIGHSECURITY)
288
+ .withReplenishStrategy(replenishStrategy ?? KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY_HIGHSECURITY)
289
+ .withHash({
290
+ algo: hashAlgorithm ?? KEYSTONE_CONFIG_DEFAULT_HASH_ALGORITHM_HIGHSECURITY,
291
+ rounds: hashRounds ?? KEYSTONE_CONFIG_DEFAULT_HASH_ROUNDS_HIGHSECURITY
292
+ })
293
+ .forVerbs(verbs ?? [])
186
294
  .build();
187
295
  }
296
+
297
+ export function createManagePoolConfig(opts: KeystoneConfigFactoryOptions_Standard): KeystonePoolConfig {
298
+ return createHighSecurityPoolConfig({
299
+ ...opts,
300
+ verbs: [KeystoneVerb.MANAGE],
301
+ });
302
+ }
303
+
304
+ export function createRevocationPoolConfig(opts: KeystoneConfigFactoryOptions_Standard): KeystonePoolConfig {
305
+ return createHighSecurityPoolConfig({
306
+ ...opts,
307
+ verbs: [KeystoneVerb.REVOKE],
308
+ replenishStrategy: KeystoneReplenishStrategy.deleteAll,
309
+ });
310
+ }
@@ -5,9 +5,9 @@ const maam = `[${import.meta.url}]`, sir = maam;
5
5
  import { } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
6
6
 
7
7
  import { GLOBAL_LOG_A_LOT } from '../core-constants.mjs';
8
- import { KeystonePoolConfig_HashV1 } from './keystone-types.mjs';
8
+ import { KEYSTONE_REPLENISH_STRATEGY_DELETE_ALL, KeystoneChallengeType, KeystonePoolConfig_HashV1, KeystoneReplenishStrategy } from './keystone-types.mjs';
9
9
  import { createRevocationPoolConfig, createStandardPoolConfig } from './keystone-config-builder.mjs';
10
- import { KEYSTONE_VERB_REVOKE, } from './keystone-constants.mjs';
10
+ import { KEYSTONE_CONFIG_DEFAULT_RANDOM, KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY, KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL, KEYSTONE_CONFIG_DEFAULT_SIZE, KEYSTONE_CONFIG_DEFAULT_SIZE_HIGHSECURITY, KEYSTONE_VERB_REVOKE, POOL_ID_REVOKE, } from './keystone-constants.mjs';
11
11
 
12
12
  const logalot = GLOBAL_LOG_A_LOT;
13
13
 
@@ -15,32 +15,39 @@ const logalot = GLOBAL_LOG_A_LOT;
15
15
  await respecfully(sir, 'Config Builders', async () => {
16
16
 
17
17
  await ifWe(sir, 'createStandardPoolConfig defaults are correct', async () => {
18
- const config = createStandardPoolConfig("test_salt") as KeystonePoolConfig_HashV1;
18
+ const id = "test_id";
19
+ const salt = "test_salt";
20
+ const config = createStandardPoolConfig({ id, salt }) as KeystonePoolConfig_HashV1;
19
21
 
20
- iReckon(sir, config.salt).willEqual("test_salt");
21
- iReckon(sir, config.id).willEqual("test_salt");
22
- iReckon(sir, config.type).willEqual("hash-reveal-v1");
22
+ iReckon(sir, config.id).willEqual(id);
23
+ iReckon(sir, config.salt).willEqual(salt);
24
+ iReckon(sir, config.type).willEqual(KeystoneChallengeType.hash_reveal_v1);
23
25
 
24
26
  // Behavior check
25
27
  const b = config.behavior;
26
- iReckon(sir, b.size).willEqual(100);
27
- iReckon(sir, b.selectSequentially).willEqual(2);
28
- iReckon(sir, b.selectRandomly).willEqual(2);
29
- iReckon(sir, b.replenish).willEqual("top-up");
28
+ iReckon(sir, b.size).willEqual(KEYSTONE_CONFIG_DEFAULT_SIZE);
29
+ iReckon(sir, b.selectSequentially).willEqual(KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL);
30
+ iReckon(sir, b.selectRandomly).willEqual(KEYSTONE_CONFIG_DEFAULT_RANDOM);
31
+ iReckon(sir, b.replenish).willEqual(KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY);
30
32
 
31
33
  // Verbs should be empty/undefined (permissive)
32
34
  iReckon(sir, config.allowedVerbs.length).willEqual(0);
33
35
  });
34
36
 
35
37
  await ifWe(sir, 'createRevocationPoolConfig defaults are correct', async () => {
36
- const config = createRevocationPoolConfig("revoke_salt") as KeystonePoolConfig_HashV1;
38
+ const salt = "revoke_salt";
39
+ const config = createRevocationPoolConfig({
40
+ id: POOL_ID_REVOKE,
41
+ salt,
42
+ }) as KeystonePoolConfig_HashV1;
37
43
 
38
- iReckon(sir, config.salt).willEqual("revoke_salt");
44
+ iReckon(sir, config.id).willEqual(POOL_ID_REVOKE);
45
+ iReckon(sir, config.salt).willEqual(salt);
39
46
 
40
47
  // Behavior check
41
48
  const b = config.behavior;
42
- iReckon(sir, b.size).willEqual(500); // Higher security
43
- iReckon(sir, b.replenish).willEqual("scorched-earth");
49
+ iReckon(sir, b.size).willEqual(KEYSTONE_CONFIG_DEFAULT_SIZE_HIGHSECURITY); // Higher security
50
+ iReckon(sir, b.replenish).willEqual(KeystoneReplenishStrategy.deleteAll);
44
51
 
45
52
  // Verbs should be restricted
46
53
  iReckon(sir, config.allowedVerbs).includes(KEYSTONE_VERB_REVOKE);