@brud/kernel 0.0.0-stage → 0.0.2

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 (286) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +63 -2
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.js +13 -0
  5. package/dist/serviceModules/events.d.ts +1 -0
  6. package/dist/serviceModules/events.js +1 -0
  7. package/dist/serviceModules/exposedApiRegistry.d.ts +1 -0
  8. package/dist/serviceModules/exposedApiRegistry.js +1 -0
  9. package/dist/serviceModules/identityRegistry.d.ts +1 -0
  10. package/dist/serviceModules/identityRegistry.js +1 -0
  11. package/dist/serviceModules/interception.d.ts +1 -0
  12. package/dist/serviceModules/interception.js +1 -0
  13. package/dist/serviceModules/parser.d.ts +1 -0
  14. package/dist/serviceModules/parser.js +1 -0
  15. package/dist/serviceModules/router.d.ts +1 -0
  16. package/dist/serviceModules/router.js +1 -0
  17. package/dist/serviceModules/wasmCage.d.ts +1 -0
  18. package/dist/serviceModules/wasmCage.js +1 -0
  19. package/dist/services/Events/contracts/IEventsService.d.ts +64 -0
  20. package/dist/services/Events/contracts/IEventsService.js +1 -0
  21. package/dist/services/Events/contracts/errors.d.ts +31 -0
  22. package/dist/services/Events/contracts/errors.js +40 -0
  23. package/dist/services/Events/contracts/index.d.ts +3 -0
  24. package/dist/services/Events/contracts/index.js +3 -0
  25. package/dist/services/Events/contracts/tokens.d.ts +2 -0
  26. package/dist/services/Events/contracts/tokens.js +2 -0
  27. package/dist/services/Events/descriptor/EventsDescriptor.d.ts +9 -0
  28. package/dist/services/Events/descriptor/EventsDescriptor.js +56 -0
  29. package/dist/services/Events/descriptor/tokens.d.ts +1 -0
  30. package/dist/services/Events/descriptor/tokens.js +1 -0
  31. package/dist/services/Events/index.d.ts +4 -0
  32. package/dist/services/Events/index.js +4 -0
  33. package/dist/services/Events/orchestrator/EventsService.d.ts +51 -0
  34. package/dist/services/Events/orchestrator/EventsService.js +339 -0
  35. package/dist/services/Events/orchestrator/index.d.ts +2 -0
  36. package/dist/services/Events/orchestrator/index.js +2 -0
  37. package/dist/services/Events/orchestrator/limits.d.ts +22 -0
  38. package/dist/services/Events/orchestrator/limits.js +33 -0
  39. package/dist/services/Events/serviceModule.d.ts +2 -0
  40. package/dist/services/Events/serviceModule.js +5 -0
  41. package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.d.ts +56 -0
  42. package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.js +1 -0
  43. package/dist/services/ExposedApiRegistry/contracts/errors.d.ts +132 -0
  44. package/dist/services/ExposedApiRegistry/contracts/errors.js +195 -0
  45. package/dist/services/ExposedApiRegistry/contracts/index.d.ts +9 -0
  46. package/dist/services/ExposedApiRegistry/contracts/index.js +4 -0
  47. package/dist/services/ExposedApiRegistry/contracts/policy.d.ts +90 -0
  48. package/dist/services/ExposedApiRegistry/contracts/policy.js +169 -0
  49. package/dist/services/ExposedApiRegistry/contracts/registrant.d.ts +37 -0
  50. package/dist/services/ExposedApiRegistry/contracts/registrant.js +36 -0
  51. package/dist/services/ExposedApiRegistry/contracts/types.d.ts +133 -0
  52. package/dist/services/ExposedApiRegistry/contracts/types.js +73 -0
  53. package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.d.ts +44 -0
  54. package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.js +58 -0
  55. package/dist/services/ExposedApiRegistry/descriptor/tokens.d.ts +8 -0
  56. package/dist/services/ExposedApiRegistry/descriptor/tokens.js +8 -0
  57. package/dist/services/ExposedApiRegistry/index.d.ts +6 -0
  58. package/dist/services/ExposedApiRegistry/index.js +5 -0
  59. package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.d.ts +68 -0
  60. package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.js +452 -0
  61. package/dist/services/ExposedApiRegistry/orchestrator/index.d.ts +2 -0
  62. package/dist/services/ExposedApiRegistry/orchestrator/index.js +1 -0
  63. package/dist/services/ExposedApiRegistry/serviceModule.d.ts +10 -0
  64. package/dist/services/ExposedApiRegistry/serviceModule.js +20 -0
  65. package/dist/services/ExposedApiRegistry/storage/protection.d.ts +21 -0
  66. package/dist/services/ExposedApiRegistry/storage/protection.js +35 -0
  67. package/dist/services/ExposedApiRegistry/storage/scopeRecord.d.ts +45 -0
  68. package/dist/services/ExposedApiRegistry/storage/scopeRecord.js +178 -0
  69. package/dist/services/IdentityRegistry/contracts/errors.d.ts +88 -0
  70. package/dist/services/IdentityRegistry/contracts/errors.js +128 -0
  71. package/dist/services/IdentityRegistry/contracts/index.d.ts +5 -0
  72. package/dist/services/IdentityRegistry/contracts/index.js +3 -0
  73. package/dist/services/IdentityRegistry/contracts/types.d.ts +77 -0
  74. package/dist/services/IdentityRegistry/contracts/types.js +18 -0
  75. package/dist/services/IdentityRegistry/descriptor/descriptor.d.ts +36 -0
  76. package/dist/services/IdentityRegistry/descriptor/descriptor.js +44 -0
  77. package/dist/services/IdentityRegistry/descriptor/tokens.d.ts +8 -0
  78. package/dist/services/IdentityRegistry/descriptor/tokens.js +8 -0
  79. package/dist/services/IdentityRegistry/index.d.ts +11 -0
  80. package/dist/services/IdentityRegistry/index.js +6 -0
  81. package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.d.ts +47 -0
  82. package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.js +240 -0
  83. package/dist/services/IdentityRegistry/serviceModule.d.ts +10 -0
  84. package/dist/services/IdentityRegistry/serviceModule.js +24 -0
  85. package/dist/services/IdentityRegistry/storage/registryDocument.d.ts +55 -0
  86. package/dist/services/IdentityRegistry/storage/registryDocument.js +235 -0
  87. package/dist/services/Interception/contracts/IInterceptionService.d.ts +155 -0
  88. package/dist/services/Interception/contracts/IInterceptionService.js +12 -0
  89. package/dist/services/Interception/contracts/errors.d.ts +26 -0
  90. package/dist/services/Interception/contracts/errors.js +35 -0
  91. package/dist/services/Interception/contracts/index.d.ts +3 -0
  92. package/dist/services/Interception/contracts/index.js +3 -0
  93. package/dist/services/Interception/contracts/tokens.d.ts +2 -0
  94. package/dist/services/Interception/contracts/tokens.js +2 -0
  95. package/dist/services/Interception/descriptor/InterceptionDescriptor.d.ts +9 -0
  96. package/dist/services/Interception/descriptor/InterceptionDescriptor.js +50 -0
  97. package/dist/services/Interception/descriptor/tokens.d.ts +1 -0
  98. package/dist/services/Interception/descriptor/tokens.js +1 -0
  99. package/dist/services/Interception/index.d.ts +4 -0
  100. package/dist/services/Interception/index.js +4 -0
  101. package/dist/services/Interception/orchestrator/InterceptionService.d.ts +40 -0
  102. package/dist/services/Interception/orchestrator/InterceptionService.js +343 -0
  103. package/dist/services/Interception/orchestrator/index.d.ts +1 -0
  104. package/dist/services/Interception/orchestrator/index.js +1 -0
  105. package/dist/services/Interception/serviceModule.d.ts +2 -0
  106. package/dist/services/Interception/serviceModule.js +5 -0
  107. package/dist/services/Parser/contracts/IParserService.d.ts +21 -0
  108. package/dist/services/Parser/contracts/IParserService.js +1 -0
  109. package/dist/services/Parser/contracts/errors.d.ts +25 -0
  110. package/dist/services/Parser/contracts/errors.js +33 -0
  111. package/dist/services/Parser/contracts/index.d.ts +4 -0
  112. package/dist/services/Parser/contracts/index.js +1 -0
  113. package/dist/services/Parser/contracts/types.d.ts +42 -0
  114. package/dist/services/Parser/contracts/types.js +1 -0
  115. package/dist/services/Parser/descriptor/ParserDescriptor.d.ts +23 -0
  116. package/dist/services/Parser/descriptor/ParserDescriptor.js +50 -0
  117. package/dist/services/Parser/descriptor/tokens.d.ts +8 -0
  118. package/dist/services/Parser/descriptor/tokens.js +8 -0
  119. package/dist/services/Parser/index.d.ts +8 -0
  120. package/dist/services/Parser/index.js +8 -0
  121. package/dist/services/Parser/orchestrator/ParserService.d.ts +20 -0
  122. package/dist/services/Parser/orchestrator/ParserService.js +105 -0
  123. package/dist/services/Parser/orchestrator/index.d.ts +1 -0
  124. package/dist/services/Parser/orchestrator/index.js +1 -0
  125. package/dist/services/Parser/parser/indexSynthesis.d.ts +11 -0
  126. package/dist/services/Parser/parser/indexSynthesis.js +13 -0
  127. package/dist/services/Parser/parser/parameters.d.ts +14 -0
  128. package/dist/services/Parser/parser/parameters.js +89 -0
  129. package/dist/services/Parser/parser/scanner.d.ts +48 -0
  130. package/dist/services/Parser/parser/scanner.js +156 -0
  131. package/dist/services/Parser/parser/syntax.d.ts +30 -0
  132. package/dist/services/Parser/parser/syntax.js +34 -0
  133. package/dist/services/Parser/serviceModule.d.ts +2 -0
  134. package/dist/services/Parser/serviceModule.js +5 -0
  135. package/dist/services/Router/bootOptions.d.ts +2 -0
  136. package/dist/services/Router/bootOptions.js +2 -0
  137. package/dist/services/Router/contracts/IRouterService.d.ts +43 -0
  138. package/dist/services/Router/contracts/IRouterService.js +1 -0
  139. package/dist/services/Router/contracts/caller.d.ts +6 -0
  140. package/dist/services/Router/contracts/caller.js +6 -0
  141. package/dist/services/Router/contracts/errors.d.ts +67 -0
  142. package/dist/services/Router/contracts/errors.js +90 -0
  143. package/dist/services/Router/contracts/index.d.ts +8 -0
  144. package/dist/services/Router/contracts/index.js +4 -0
  145. package/dist/services/Router/contracts/kind.d.ts +7 -0
  146. package/dist/services/Router/contracts/kind.js +10 -0
  147. package/dist/services/Router/contracts/registrant.d.ts +23 -0
  148. package/dist/services/Router/contracts/registrant.js +13 -0
  149. package/dist/services/Router/contracts/types.d.ts +110 -0
  150. package/dist/services/Router/contracts/types.js +1 -0
  151. package/dist/services/Router/descriptor/RouterDescriptor.d.ts +32 -0
  152. package/dist/services/Router/descriptor/RouterDescriptor.js +92 -0
  153. package/dist/services/Router/descriptor/tokens.d.ts +9 -0
  154. package/dist/services/Router/descriptor/tokens.js +9 -0
  155. package/dist/services/Router/index.d.ts +4 -0
  156. package/dist/services/Router/index.js +4 -0
  157. package/dist/services/Router/orchestrator/RouterService.d.ts +93 -0
  158. package/dist/services/Router/orchestrator/RouterService.js +457 -0
  159. package/dist/services/Router/orchestrator/index.d.ts +2 -0
  160. package/dist/services/Router/orchestrator/index.js +1 -0
  161. package/dist/services/Router/serviceModule.d.ts +4 -0
  162. package/dist/services/Router/serviceModule.js +22 -0
  163. package/dist/services/WasmCage/index.d.ts +7 -0
  164. package/dist/services/WasmCage/index.js +4 -0
  165. package/dist/services/WasmCage/scripts/prepin.d.ts +1 -0
  166. package/dist/services/WasmCage/scripts/prepin.js +38 -0
  167. package/dist/services/WasmCage/serviceModule.d.ts +12 -0
  168. package/dist/services/WasmCage/serviceModule.js +18 -0
  169. package/dist/services/WasmCage/src/caged.d.ts +121 -0
  170. package/dist/services/WasmCage/src/caged.js +460 -0
  171. package/dist/services/WasmCage/src/descriptor.d.ts +47 -0
  172. package/dist/services/WasmCage/src/descriptor.js +56 -0
  173. package/dist/services/WasmCage/src/native.d.ts +29 -0
  174. package/dist/services/WasmCage/src/native.js +66 -0
  175. package/dist/services/WasmCage/src/nativeDigests.d.ts +9 -0
  176. package/dist/services/WasmCage/src/nativeDigests.js +15 -0
  177. package/dist/services/WasmCage/src/package.d.ts +36 -0
  178. package/dist/services/WasmCage/src/package.js +122 -0
  179. package/dist/services/shared/canonicalJson.d.ts +29 -0
  180. package/dist/services/shared/canonicalJson.js +93 -0
  181. package/dist/services/shared/documentStore.d.ts +16 -0
  182. package/dist/services/shared/documentStore.js +98 -0
  183. package/dist/src/bootstrap/bootKernelInternal.d.ts +19 -0
  184. package/dist/src/bootstrap/bootKernelInternal.js +633 -0
  185. package/dist/src/bootstrap/bootTypes.d.ts +113 -0
  186. package/dist/src/bootstrap/bootTypes.js +1 -0
  187. package/dist/src/bootstrap/config/index.d.ts +3 -0
  188. package/dist/src/bootstrap/config/index.js +2 -0
  189. package/dist/src/bootstrap/config/integrity.d.ts +45 -0
  190. package/dist/src/bootstrap/config/integrity.js +92 -0
  191. package/dist/src/bootstrap/config/parse.d.ts +15 -0
  192. package/dist/src/bootstrap/config/parse.js +81 -0
  193. package/dist/src/bootstrap/config/pathWriteGuard.d.ts +20 -0
  194. package/dist/src/bootstrap/config/pathWriteGuard.js +349 -0
  195. package/dist/src/bootstrap/config/types.d.ts +41 -0
  196. package/dist/src/bootstrap/config/types.js +15 -0
  197. package/dist/src/bootstrap/hardcore.d.ts +212 -0
  198. package/dist/src/bootstrap/hardcore.js +312 -0
  199. package/dist/src/bootstrap/hardcoreServices.d.ts +10 -0
  200. package/dist/src/bootstrap/hardcoreServices.js +258 -0
  201. package/dist/src/bootstrap/index.d.ts +13 -0
  202. package/dist/src/bootstrap/index.js +7 -0
  203. package/dist/src/bootstrap/loaded.d.ts +30 -0
  204. package/dist/src/bootstrap/loaded.js +45 -0
  205. package/dist/src/bootstrap/packageRequirements.d.ts +26 -0
  206. package/dist/src/bootstrap/packageRequirements.js +52 -0
  207. package/dist/src/bootstrap/reload.d.ts +44 -0
  208. package/dist/src/bootstrap/reload.js +45 -0
  209. package/dist/src/bootstrap/seal.d.ts +32 -0
  210. package/dist/src/bootstrap/seal.js +101 -0
  211. package/dist/src/contracts/accessBroker.d.ts +53 -0
  212. package/dist/src/contracts/accessBroker.js +1 -0
  213. package/dist/src/contracts/brudOperation.d.ts +20 -0
  214. package/dist/src/contracts/brudOperation.js +20 -0
  215. package/dist/src/contracts/callChain.d.ts +161 -0
  216. package/dist/src/contracts/callChain.js +19 -0
  217. package/dist/src/contracts/capability.d.ts +26 -0
  218. package/dist/src/contracts/capability.js +26 -0
  219. package/dist/src/contracts/capabilitySet.d.ts +23 -0
  220. package/dist/src/contracts/capabilitySet.js +72 -0
  221. package/dist/src/contracts/container.d.ts +17 -0
  222. package/dist/src/contracts/container.js +8 -0
  223. package/dist/src/contracts/context.d.ts +19 -0
  224. package/dist/src/contracts/context.js +1 -0
  225. package/dist/src/contracts/contextContract.d.ts +132 -0
  226. package/dist/src/contracts/contextContract.js +274 -0
  227. package/dist/src/contracts/dispatchView.d.ts +21 -0
  228. package/dist/src/contracts/dispatchView.js +1 -0
  229. package/dist/src/contracts/handler.d.ts +21 -0
  230. package/dist/src/contracts/handler.js +1 -0
  231. package/dist/src/contracts/index.d.ts +26 -0
  232. package/dist/src/contracts/index.js +9 -0
  233. package/dist/src/contracts/kernel.d.ts +60 -0
  234. package/dist/src/contracts/kernel.js +1 -0
  235. package/dist/src/contracts/lifecycle.d.ts +59 -0
  236. package/dist/src/contracts/lifecycle.js +1 -0
  237. package/dist/src/contracts/manifest.d.ts +180 -0
  238. package/dist/src/contracts/manifest.js +334 -0
  239. package/dist/src/contracts/pipeline.d.ts +8 -0
  240. package/dist/src/contracts/pipeline.js +1 -0
  241. package/dist/src/contracts/policy.d.ts +75 -0
  242. package/dist/src/contracts/policy.js +77 -0
  243. package/dist/src/contracts/registry.d.ts +7 -0
  244. package/dist/src/contracts/registry.js +1 -0
  245. package/dist/src/contracts/serviceDescriptor.d.ts +67 -0
  246. package/dist/src/contracts/serviceDescriptor.js +1 -0
  247. package/dist/src/contracts/serviceToken.d.ts +36 -0
  248. package/dist/src/contracts/serviceToken.js +16 -0
  249. package/dist/src/engine/BrudKernel.d.ts +120 -0
  250. package/dist/src/engine/BrudKernel.js +395 -0
  251. package/dist/src/engine/ExecutionPipeline.d.ts +13 -0
  252. package/dist/src/engine/ExecutionPipeline.js +62 -0
  253. package/dist/src/engine/KernelAccessBroker.d.ts +47 -0
  254. package/dist/src/engine/KernelAccessBroker.js +107 -0
  255. package/dist/src/engine/KernelRegistry.d.ts +14 -0
  256. package/dist/src/engine/KernelRegistry.js +33 -0
  257. package/dist/src/engine/OperationRegistry.d.ts +9 -0
  258. package/dist/src/engine/OperationRegistry.js +18 -0
  259. package/dist/src/engine/ServiceContainer.d.ts +13 -0
  260. package/dist/src/engine/ServiceContainer.js +53 -0
  261. package/dist/src/engine/callChain.d.ts +68 -0
  262. package/dist/src/engine/callChain.js +175 -0
  263. package/dist/src/engine/dag.d.ts +2 -0
  264. package/dist/src/engine/dag.js +34 -0
  265. package/dist/src/engine/errors.d.ts +26 -0
  266. package/dist/src/engine/errors.js +52 -0
  267. package/dist/src/engine/index.d.ts +11 -0
  268. package/dist/src/engine/index.js +8 -0
  269. package/dist/src/engine/state.d.ts +1 -0
  270. package/dist/src/engine/state.js +1 -0
  271. package/dist/src/validation/jsonSchema/compile.d.ts +8 -0
  272. package/dist/src/validation/jsonSchema/compile.js +386 -0
  273. package/dist/src/validation/jsonSchema/index.d.ts +3 -0
  274. package/dist/src/validation/jsonSchema/index.js +2 -0
  275. package/dist/src/validation/jsonSchema/jsonValue.d.ts +29 -0
  276. package/dist/src/validation/jsonSchema/jsonValue.js +190 -0
  277. package/dist/src/validation/jsonSchema/pattern.d.ts +28 -0
  278. package/dist/src/validation/jsonSchema/pattern.js +155 -0
  279. package/dist/src/validation/jsonSchema/types.d.ts +71 -0
  280. package/dist/src/validation/jsonSchema/types.js +15 -0
  281. package/package.json +59 -4
  282. package/services/WasmCage/native/brud-wasm-cage.darwin-arm64.node +0 -0
  283. package/services/WasmCage/native/brud-wasm-cage.darwin-x64.node +0 -0
  284. package/services/WasmCage/native/brud-wasm-cage.linux-arm64-gnu.node +0 -0
  285. package/services/WasmCage/native/brud-wasm-cage.linux-x64-gnu.node +0 -0
  286. package/services/WasmCage/native/brud-wasm-cage.win32-x64-msvc.node +0 -0
@@ -0,0 +1,47 @@
1
+ import type { IServiceLifecycle } from '../../../src/contracts/lifecycle.js';
2
+ import type { IdentityBinding, IdentityRecord, IdentityToken, IIdentityRegistry } from '../contracts/types.js';
3
+ /** Construction options for {@link IdentityRegistryService}. */
4
+ export interface IdentityRegistryServiceOptions {
5
+ /** Absolute path to the operator-provisioned registry file. */
6
+ readonly storagePath: string;
7
+ }
8
+ /**
9
+ * Kernel-owned identity registry service.
10
+ *
11
+ * The registry records opaque bindings, issues one stable token per binding,
12
+ * and is writable only during boot. `initialize` loads and integrity-checks
13
+ * the operator-provisioned document and protects it with the same guard class
14
+ * as the root config. `onRunning` freezes the service first, then persists the
15
+ * final document atomically and re-protects it.
16
+ */
17
+ export declare class IdentityRegistryService implements IIdentityRegistry, IServiceLifecycle {
18
+ #private;
19
+ constructor(options: IdentityRegistryServiceOptions);
20
+ /**
21
+ * Loads and integrity-checks the registry, then protects the file.
22
+ *
23
+ * A missing or corrupt document fails here; the registry never regenerates
24
+ * an existing storage location.
25
+ */
26
+ initialize(): void;
27
+ /** {@inheritDoc IIdentityRegistry.issue} */
28
+ issue(binding: IdentityBinding): IdentityRecord;
29
+ /** {@inheritDoc IIdentityRegistry.resolve} */
30
+ resolve(token: IdentityToken): IdentityRecord | null;
31
+ /** {@inheritDoc IIdentityRegistry.retire} */
32
+ retire(token: IdentityToken): IdentityRecord;
33
+ /** {@inheritDoc IIdentityRegistry.revoke} */
34
+ revoke(token: IdentityToken): IdentityRecord;
35
+ /**
36
+ * Freezes the registry and persists the final document.
37
+ *
38
+ * Freezing happens first so no mutation can occur while the write is in
39
+ * flight. The write releases the protected-path guard only for a synchronous
40
+ * atomic write/verify/re-protect block.
41
+ */
42
+ onRunning(): void;
43
+ /** Releases the protected-path claim held for this kernel. */
44
+ dispose(): void;
45
+ /** Returns the protected storage path. */
46
+ get storagePath(): string;
47
+ }
@@ -0,0 +1,240 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { resolve as resolvePath } from 'node:path';
3
+ import { protectConfigFile, releaseConfigProtection, } from '../../../src/bootstrap/config/integrity.js';
4
+ import { IdentityRegistryFrozenError, IdentityRegistryInputError, IdentityRegistryNotReadyError, IdentityRegistryRevokedError, IdentityRegistryUnknownTokenError, } from '../contracts/errors.js';
5
+ import { JsonValueError, canonicalJson, cloneJsonRecord, isPlainRecord, } from '../../shared/canonicalJson.js';
6
+ import { IDENTITY_REGISTRY_MAX_METADATA_BYTES, IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH, identityBindingKey, loadIdentityRegistryStorage, persistIdentityRegistryStorage, } from '../storage/registryDocument.js';
7
+ /** Validates an opaque string without interpreting it. */
8
+ function requireOpaqueString(value, field) {
9
+ if (typeof value !== 'string' || value.length === 0) {
10
+ throw new IdentityRegistryInputError(field, 'must be a non-empty string');
11
+ }
12
+ if (value.length > IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH) {
13
+ throw new IdentityRegistryInputError(field, `must be at most ${String(IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH)} characters`);
14
+ }
15
+ return value;
16
+ }
17
+ /** Validates and clones opaque JSON metadata. */
18
+ function requireMetadata(value) {
19
+ try {
20
+ const metadata = cloneJsonRecord(value);
21
+ if (Buffer.byteLength(canonicalJson(metadata), 'utf8')
22
+ > IDENTITY_REGISTRY_MAX_METADATA_BYTES) {
23
+ throw new IdentityRegistryInputError('metadata', `must be at most ${String(IDENTITY_REGISTRY_MAX_METADATA_BYTES)} canonical bytes`);
24
+ }
25
+ return metadata;
26
+ }
27
+ catch (error) {
28
+ if (error instanceof IdentityRegistryInputError) {
29
+ throw error;
30
+ }
31
+ const reason = error instanceof JsonValueError
32
+ ? error.message
33
+ : 'must be a JSON object';
34
+ throw new IdentityRegistryInputError('metadata', reason);
35
+ }
36
+ }
37
+ /** Returns an immutable copy of one record. */
38
+ function snapshot(record) {
39
+ return Object.freeze({
40
+ token: record.token,
41
+ publisher: record.publisher,
42
+ contentHash: record.contentHash,
43
+ metadata: record.metadata,
44
+ state: record.state,
45
+ });
46
+ }
47
+ /**
48
+ * Kernel-owned identity registry service.
49
+ *
50
+ * The registry records opaque bindings, issues one stable token per binding,
51
+ * and is writable only during boot. `initialize` loads and integrity-checks
52
+ * the operator-provisioned document and protects it with the same guard class
53
+ * as the root config. `onRunning` freezes the service first, then persists the
54
+ * final document atomically and re-protects it.
55
+ */
56
+ export class IdentityRegistryService {
57
+ #storagePath;
58
+ #byToken = new Map();
59
+ #byBinding = new Map();
60
+ #registryId = '';
61
+ #initialized = false;
62
+ #frozen = false;
63
+ #dirty = false;
64
+ #protected = false;
65
+ constructor(options) {
66
+ this.#storagePath = resolvePath(options.storagePath);
67
+ }
68
+ /**
69
+ * Loads and integrity-checks the registry, then protects the file.
70
+ *
71
+ * A missing or corrupt document fails here; the registry never regenerates
72
+ * an existing storage location.
73
+ */
74
+ initialize() {
75
+ if (this.#initialized) {
76
+ return;
77
+ }
78
+ const loaded = loadIdentityRegistryStorage(this.#storagePath);
79
+ for (const record of loaded.records) {
80
+ const mutable = {
81
+ token: record.token,
82
+ publisher: record.publisher,
83
+ contentHash: record.contentHash,
84
+ metadata: record.metadata,
85
+ state: record.state,
86
+ };
87
+ this.#byToken.set(record.token, mutable);
88
+ this.#byBinding.set(identityBindingKey(record.publisher, record.contentHash), mutable);
89
+ }
90
+ this.#registryId = loaded.registryId;
91
+ protectConfigFile(this.#storagePath);
92
+ this.#protected = true;
93
+ this.#initialized = true;
94
+ }
95
+ /** {@inheritDoc IIdentityRegistry.issue} */
96
+ issue(binding) {
97
+ this.#assertMutable('issue');
98
+ const candidate = binding;
99
+ if (!isPlainRecord(candidate)) {
100
+ throw new IdentityRegistryInputError('binding', 'must be an object');
101
+ }
102
+ const publisher = requireOpaqueString(candidate.publisher, 'publisher');
103
+ const contentHash = requireOpaqueString(candidate.contentHash, 'contentHash');
104
+ const metadata = requireMetadata(candidate.metadata);
105
+ const key = identityBindingKey(publisher, contentHash);
106
+ const existing = this.#byBinding.get(key);
107
+ if (existing !== undefined) {
108
+ if (existing.state === 'revoked') {
109
+ throw new IdentityRegistryRevokedError(existing.token);
110
+ }
111
+ existing.metadata = metadata;
112
+ existing.state = 'active';
113
+ this.#dirty = true;
114
+ return snapshot(existing);
115
+ }
116
+ const record = this.#createRecord(publisher, contentHash, metadata);
117
+ this.#byToken.set(record.token, record);
118
+ this.#byBinding.set(key, record);
119
+ this.#dirty = true;
120
+ return snapshot(record);
121
+ }
122
+ /** {@inheritDoc IIdentityRegistry.resolve} */
123
+ resolve(token) {
124
+ if (typeof token !== 'string') {
125
+ return null;
126
+ }
127
+ const record = this.#byToken.get(token);
128
+ return record === undefined ? null : snapshot(record);
129
+ }
130
+ /** {@inheritDoc IIdentityRegistry.retire} */
131
+ retire(token) {
132
+ this.#assertMutable('retire');
133
+ const record = this.#requireRecord(token);
134
+ if (record.state === 'revoked') {
135
+ throw new IdentityRegistryRevokedError(token);
136
+ }
137
+ if (record.state === 'retired') {
138
+ return snapshot(record);
139
+ }
140
+ record.state = 'retired';
141
+ this.#dirty = true;
142
+ return snapshot(record);
143
+ }
144
+ /** {@inheritDoc IIdentityRegistry.revoke} */
145
+ revoke(token) {
146
+ this.#assertMutable('revoke');
147
+ const record = this.#requireRecord(token);
148
+ if (record.state === 'revoked') {
149
+ return snapshot(record);
150
+ }
151
+ record.state = 'revoked';
152
+ this.#dirty = true;
153
+ return snapshot(record);
154
+ }
155
+ /**
156
+ * Freezes the registry and persists the final document.
157
+ *
158
+ * Freezing happens first so no mutation can occur while the write is in
159
+ * flight. The write releases the protected-path guard only for a synchronous
160
+ * atomic write/verify/re-protect block.
161
+ */
162
+ onRunning() {
163
+ if (!this.#initialized) {
164
+ throw new IdentityRegistryNotReadyError('freeze');
165
+ }
166
+ this.#frozen = true;
167
+ if (!this.#dirty) {
168
+ return;
169
+ }
170
+ this.#persist();
171
+ this.#dirty = false;
172
+ }
173
+ /** Releases the protected-path claim held for this kernel. */
174
+ dispose() {
175
+ if (this.#protected) {
176
+ releaseConfigProtection(this.#storagePath);
177
+ this.#protected = false;
178
+ }
179
+ }
180
+ /** Returns the protected storage path. */
181
+ get storagePath() {
182
+ return this.#storagePath;
183
+ }
184
+ /** Creates a new opaque token that is not already recorded. */
185
+ #createRecord(publisher, contentHash, metadata) {
186
+ for (;;) {
187
+ const token = `idt_${randomBytes(32).toString('base64url')}`;
188
+ if (!this.#byToken.has(token)) {
189
+ return {
190
+ token,
191
+ publisher,
192
+ contentHash,
193
+ metadata,
194
+ state: 'active',
195
+ };
196
+ }
197
+ }
198
+ }
199
+ /** Persists the exact in-memory state and verifies the written file. */
200
+ #persist() {
201
+ const records = [...this.#byToken.values()].map(snapshot);
202
+ const wasProtected = this.#protected;
203
+ if (wasProtected) {
204
+ releaseConfigProtection(this.#storagePath);
205
+ this.#protected = false;
206
+ }
207
+ try {
208
+ persistIdentityRegistryStorage(this.#storagePath, this.#registryId, records);
209
+ // Read the document back so the file that will be trusted on the next
210
+ // boot is the file that was integrity-checked in this one.
211
+ loadIdentityRegistryStorage(this.#storagePath);
212
+ }
213
+ finally {
214
+ if (wasProtected) {
215
+ protectConfigFile(this.#storagePath);
216
+ this.#protected = true;
217
+ }
218
+ }
219
+ }
220
+ /** Refuses mutation before load and after freeze. */
221
+ #assertMutable(operation) {
222
+ if (!this.#initialized) {
223
+ throw new IdentityRegistryNotReadyError(operation);
224
+ }
225
+ if (this.#frozen) {
226
+ throw new IdentityRegistryFrozenError(operation);
227
+ }
228
+ }
229
+ /** Resolves a required record for a mutating operation. */
230
+ #requireRecord(token) {
231
+ if (typeof token !== 'string' || token.length === 0) {
232
+ throw new IdentityRegistryUnknownTokenError(String(token));
233
+ }
234
+ const record = this.#byToken.get(token);
235
+ if (record === undefined) {
236
+ throw new IdentityRegistryUnknownTokenError(token);
237
+ }
238
+ return record;
239
+ }
240
+ }
@@ -0,0 +1,10 @@
1
+ import type { KernelServiceModuleContext } from '../../src/bootstrap/bootTypes.js';
2
+ /** Shared-bag slot where the identity registry publishes its instance. */
3
+ export declare const IDENTITY_REGISTRY_SLOT = "brud.core.identityRegistry.instance";
4
+ /**
5
+ * Composes the identity registry through the standard service-module contract.
6
+ *
7
+ * The module declares its own namespaced storage field and publishes the
8
+ * instance for boot-time issuers. It does not read the kernel config.
9
+ */
10
+ export declare function createService(context: KernelServiceModuleContext): import("../../index.js").ServiceDescriptor<import("./index.js").IIdentityRegistry, import("./index.js").IdentityRegistryService>;
@@ -0,0 +1,24 @@
1
+ import { IDENTITY_REGISTRY_CONTEXT_SCOPE, IDENTITY_REGISTRY_PATH_CONTEXT_FIELD, createIdentityRegistryDescriptor, } from './descriptor/descriptor.js';
2
+ /** Shared-bag slot where the identity registry publishes its instance. */
3
+ export const IDENTITY_REGISTRY_SLOT = 'brud.core.identityRegistry.instance';
4
+ /**
5
+ * Composes the identity registry through the standard service-module contract.
6
+ *
7
+ * The module declares its own namespaced storage field and publishes the
8
+ * instance for boot-time issuers. It does not read the kernel config.
9
+ */
10
+ export function createService(context) {
11
+ context.declareContextFields(IDENTITY_REGISTRY_CONTEXT_SCOPE, [
12
+ {
13
+ name: IDENTITY_REGISTRY_PATH_CONTEXT_FIELD,
14
+ type: 'string',
15
+ required: true,
16
+ description: 'Absolute path to the operator-provisioned identity registry file.',
17
+ },
18
+ ]);
19
+ return createIdentityRegistryDescriptor({
20
+ onConstruct: (service) => {
21
+ context.shared[IDENTITY_REGISTRY_SLOT] = service;
22
+ },
23
+ });
24
+ }
@@ -0,0 +1,55 @@
1
+ import { type IdentityRecord } from '../contracts/types.js';
2
+ /** Stable format marker for the registry document. */
3
+ export declare const IDENTITY_REGISTRY_FORMAT = "brud.identity-registry";
4
+ /** Format version the service understands. */
5
+ export declare const IDENTITY_REGISTRY_VERSION = 1;
6
+ /** Maximum accepted length for an opaque publisher or content hash. */
7
+ export declare const IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH = 8192;
8
+ /** Maximum accepted canonical metadata size in bytes. */
9
+ export declare const IDENTITY_REGISTRY_MAX_METADATA_BYTES = 65536;
10
+ /** Result of loading and validating a registry document. */
11
+ export interface LoadedIdentityRegistry {
12
+ /** Registry instance identifier recorded at provisioning. */
13
+ readonly registryId: string;
14
+ /** Validated records in document order. */
15
+ readonly records: readonly IdentityRecord[];
16
+ }
17
+ /** Rejects a storage path that is not an absolute file path. */
18
+ export declare function assertIdentityRegistryStoragePath(storagePath: string): string;
19
+ /** Builds the deterministic lookup key for one binding. */
20
+ export declare function identityBindingKey(publisher: string, contentHash: string): string;
21
+ /**
22
+ * Parses and integrity-checks a registry document.
23
+ *
24
+ * @param raw - Exact file contents.
25
+ * @param storagePath - Absolute path used in diagnostics.
26
+ */
27
+ export declare function parseIdentityRegistryDocument(raw: string, storagePath: string): LoadedIdentityRegistry;
28
+ /**
29
+ * Serializes a registry document with a fresh integrity digest.
30
+ *
31
+ * @param registryId - Registry instance identifier.
32
+ * @param records - Current records.
33
+ */
34
+ export declare function serializeIdentityRegistryDocument(registryId: string, records: readonly IdentityRecord[]): string;
35
+ /**
36
+ * Loads and validates a registry file.
37
+ *
38
+ * @param storagePath - Absolute registry file path.
39
+ */
40
+ export declare function loadIdentityRegistryStorage(storagePath: string): LoadedIdentityRegistry;
41
+ /**
42
+ * Persists a registry file atomically.
43
+ *
44
+ * @param storagePath - Absolute registry file path.
45
+ * @param registryId - Registry instance identifier.
46
+ * @param records - Current records.
47
+ */
48
+ export declare function persistIdentityRegistryStorage(storagePath: string, registryId: string, records: readonly IdentityRecord[]): void;
49
+ /**
50
+ * Operator provisioning: creates a valid empty registry while the kernel is
51
+ * stopped. Refuses to overwrite an existing registry.
52
+ *
53
+ * @param storagePath - Absolute registry file path.
54
+ */
55
+ export declare function provisionIdentityRegistryStorage(storagePath: string): void;
@@ -0,0 +1,235 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { IdentityRegistryCorruptError, IdentityRegistryMissingError, IdentityRegistryPathError, IdentityRegistryStorageExistsError, IdentityRegistryWriteError, } from '../contracts/errors.js';
4
+ import { isIdentityState, } from '../contracts/types.js';
5
+ import { JsonValueError, canonicalJson, cloneJsonRecord, isPlainRecord, } from '../../shared/canonicalJson.js';
6
+ import { assertExactKeys, canonicalDigest, digestsEqual, resolveAbsoluteStoragePath, writeAtomically, } from '../../shared/documentStore.js';
7
+ /** Stable format marker for the registry document. */
8
+ export const IDENTITY_REGISTRY_FORMAT = 'brud.identity-registry';
9
+ /** Format version the service understands. */
10
+ export const IDENTITY_REGISTRY_VERSION = 1;
11
+ /** Maximum accepted length for an opaque publisher or content hash. */
12
+ export const IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH = 8_192;
13
+ /** Maximum accepted canonical metadata size in bytes. */
14
+ export const IDENTITY_REGISTRY_MAX_METADATA_BYTES = 65_536;
15
+ const DIGEST_ALGORITHM = 'sha256';
16
+ const TOKEN_PATTERN = /^idt_[A-Za-z0-9_-]{43}$/u;
17
+ const DIGEST_PATTERN = /^[0-9a-f]{64}$/u;
18
+ const ROOT_KEYS = new Set(['format', 'version', 'registryId', 'records', 'integrity']);
19
+ const INTEGRITY_KEYS = new Set(['algorithm', 'digest']);
20
+ const RECORD_KEYS = new Set(['token', 'publisher', 'contentHash', 'metadata', 'state']);
21
+ /** Reports whether a value is a non-empty string. */
22
+ function isNonEmptyString(value) {
23
+ return typeof value === 'string' && value.length > 0;
24
+ }
25
+ /** Raises a corrupt-storage failure. */
26
+ function corrupt(storagePath, reason) {
27
+ throw new IdentityRegistryCorruptError(storagePath, reason);
28
+ }
29
+ /** Rejects a storage path that is not an absolute file path. */
30
+ export function assertIdentityRegistryStoragePath(storagePath) {
31
+ return resolveAbsoluteStoragePath(storagePath, (path) => {
32
+ throw new IdentityRegistryPathError(path);
33
+ });
34
+ }
35
+ /** Builds the deterministic lookup key for one binding. */
36
+ export function identityBindingKey(publisher, contentHash) {
37
+ return canonicalJson([publisher, contentHash]);
38
+ }
39
+ /** Validates one record and returns a frozen copy. */
40
+ function parseRecord(value, index, storagePath) {
41
+ if (!isPlainRecord(value)) {
42
+ corrupt(storagePath, `records[${String(index)}] is not an object`);
43
+ }
44
+ assertExactKeys(value, RECORD_KEYS, storagePath, `records[${String(index)}]`, corrupt);
45
+ const token = value.token;
46
+ if (!isNonEmptyString(token) || !TOKEN_PATTERN.test(token)) {
47
+ corrupt(storagePath, `records[${String(index)}].token is not a registry token`);
48
+ }
49
+ const publisher = value.publisher;
50
+ if (!isNonEmptyString(publisher)
51
+ || publisher.length > IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH) {
52
+ corrupt(storagePath, `records[${String(index)}].publisher is invalid`);
53
+ }
54
+ const contentHash = value.contentHash;
55
+ if (!isNonEmptyString(contentHash)
56
+ || contentHash.length > IDENTITY_REGISTRY_MAX_OPAQUE_LENGTH) {
57
+ corrupt(storagePath, `records[${String(index)}].contentHash is invalid`);
58
+ }
59
+ const state = value.state;
60
+ if (!isIdentityState(state)) {
61
+ corrupt(storagePath, `records[${String(index)}].state is not a supported state`);
62
+ }
63
+ let metadata;
64
+ try {
65
+ metadata = cloneJsonRecord(value.metadata);
66
+ if (Buffer.byteLength(canonicalJson(metadata), 'utf8') > IDENTITY_REGISTRY_MAX_METADATA_BYTES) {
67
+ corrupt(storagePath, `records[${String(index)}].metadata exceeds the size limit`);
68
+ }
69
+ }
70
+ catch (error) {
71
+ if (error instanceof IdentityRegistryCorruptError) {
72
+ throw error;
73
+ }
74
+ const reason = error instanceof JsonValueError
75
+ ? error.message
76
+ : 'metadata is not JSON';
77
+ corrupt(storagePath, `records[${String(index)}].metadata is invalid: ${reason}`);
78
+ }
79
+ return Object.freeze({
80
+ token,
81
+ publisher,
82
+ contentHash,
83
+ metadata,
84
+ state: state,
85
+ });
86
+ }
87
+ /**
88
+ * Parses and integrity-checks a registry document.
89
+ *
90
+ * @param raw - Exact file contents.
91
+ * @param storagePath - Absolute path used in diagnostics.
92
+ */
93
+ export function parseIdentityRegistryDocument(raw, storagePath) {
94
+ let document;
95
+ try {
96
+ document = JSON.parse(raw);
97
+ }
98
+ catch {
99
+ corrupt(storagePath, 'document is not valid JSON');
100
+ }
101
+ if (!isPlainRecord(document)) {
102
+ corrupt(storagePath, 'document root is not an object');
103
+ }
104
+ assertExactKeys(document, ROOT_KEYS, storagePath, 'document', corrupt);
105
+ if (document.format !== IDENTITY_REGISTRY_FORMAT) {
106
+ corrupt(storagePath, 'document format marker is not supported');
107
+ }
108
+ if (document.version !== IDENTITY_REGISTRY_VERSION) {
109
+ corrupt(storagePath, 'document version is not supported');
110
+ }
111
+ const registryId = document.registryId;
112
+ if (!isNonEmptyString(registryId)) {
113
+ corrupt(storagePath, 'registryId is invalid');
114
+ }
115
+ if (!Array.isArray(document.records)) {
116
+ corrupt(storagePath, 'records is not an array');
117
+ }
118
+ const records = [];
119
+ const tokens = new Set();
120
+ const bindings = new Set();
121
+ for (let index = 0; index < document.records.length; index += 1) {
122
+ const record = parseRecord(document.records[index], index, storagePath);
123
+ if (tokens.has(record.token)) {
124
+ corrupt(storagePath, `duplicate token at records[${String(index)}]`);
125
+ }
126
+ const bindingKey = identityBindingKey(record.publisher, record.contentHash);
127
+ if (bindings.has(bindingKey)) {
128
+ corrupt(storagePath, `duplicate binding at records[${String(index)}]`);
129
+ }
130
+ tokens.add(record.token);
131
+ bindings.add(bindingKey);
132
+ records.push(record);
133
+ }
134
+ const integrity = document.integrity;
135
+ if (!isPlainRecord(integrity)) {
136
+ corrupt(storagePath, 'integrity is not an object');
137
+ }
138
+ assertExactKeys(integrity, INTEGRITY_KEYS, storagePath, 'integrity', corrupt);
139
+ if (integrity.algorithm !== DIGEST_ALGORITHM) {
140
+ corrupt(storagePath, 'integrity algorithm is not supported');
141
+ }
142
+ const digest = integrity.digest;
143
+ if (!isNonEmptyString(digest) || !DIGEST_PATTERN.test(digest)) {
144
+ corrupt(storagePath, 'integrity digest is invalid');
145
+ }
146
+ const body = {
147
+ format: IDENTITY_REGISTRY_FORMAT,
148
+ version: IDENTITY_REGISTRY_VERSION,
149
+ registryId,
150
+ records,
151
+ };
152
+ if (!digestsEqual(canonicalDigest(body), digest)) {
153
+ corrupt(storagePath, 'integrity digest mismatch');
154
+ }
155
+ return Object.freeze({
156
+ registryId,
157
+ records: Object.freeze(records),
158
+ });
159
+ }
160
+ /**
161
+ * Serializes a registry document with a fresh integrity digest.
162
+ *
163
+ * @param registryId - Registry instance identifier.
164
+ * @param records - Current records.
165
+ */
166
+ export function serializeIdentityRegistryDocument(registryId, records) {
167
+ const ordered = [...records].sort((left, right) => left.token.localeCompare(right.token));
168
+ const body = {
169
+ format: IDENTITY_REGISTRY_FORMAT,
170
+ version: IDENTITY_REGISTRY_VERSION,
171
+ registryId,
172
+ records: ordered,
173
+ };
174
+ const document = {
175
+ ...body,
176
+ integrity: {
177
+ algorithm: DIGEST_ALGORITHM,
178
+ digest: canonicalDigest(body),
179
+ },
180
+ };
181
+ return `${JSON.stringify(document, null, 2)}\n`;
182
+ }
183
+ /** Writes a registry document through the shared atomic writer. */
184
+ function writeRegistryAtomically(storagePath, raw) {
185
+ writeAtomically(storagePath, raw, (path, reason) => new IdentityRegistryWriteError(path, reason));
186
+ }
187
+ /**
188
+ * Loads and validates a registry file.
189
+ *
190
+ * @param storagePath - Absolute registry file path.
191
+ */
192
+ export function loadIdentityRegistryStorage(storagePath) {
193
+ const resolvedPath = assertIdentityRegistryStoragePath(storagePath);
194
+ let raw;
195
+ try {
196
+ raw = readFileSync(resolvedPath, 'utf8');
197
+ }
198
+ catch (error) {
199
+ const code = error.code;
200
+ if (code === 'ENOENT') {
201
+ throw new IdentityRegistryMissingError(resolvedPath);
202
+ }
203
+ throw new IdentityRegistryCorruptError(resolvedPath, `storage cannot be read${code === undefined ? '' : ` (${code})`}`);
204
+ }
205
+ return parseIdentityRegistryDocument(raw, resolvedPath);
206
+ }
207
+ /**
208
+ * Persists a registry file atomically.
209
+ *
210
+ * @param storagePath - Absolute registry file path.
211
+ * @param registryId - Registry instance identifier.
212
+ * @param records - Current records.
213
+ */
214
+ export function persistIdentityRegistryStorage(storagePath, registryId, records) {
215
+ const resolvedPath = assertIdentityRegistryStoragePath(storagePath);
216
+ const raw = serializeIdentityRegistryDocument(registryId, records);
217
+ writeRegistryAtomically(resolvedPath, raw);
218
+ }
219
+ /**
220
+ * Operator provisioning: creates a valid empty registry while the kernel is
221
+ * stopped. Refuses to overwrite an existing registry.
222
+ *
223
+ * @param storagePath - Absolute registry file path.
224
+ */
225
+ export function provisionIdentityRegistryStorage(storagePath) {
226
+ const resolvedPath = assertIdentityRegistryStoragePath(storagePath);
227
+ if (existsSync(resolvedPath)) {
228
+ throw new IdentityRegistryStorageExistsError(resolvedPath);
229
+ }
230
+ const raw = serializeIdentityRegistryDocument(randomUUID(), []);
231
+ writeRegistryAtomically(resolvedPath, raw);
232
+ // Read the file back so a provisioning write that produced an unreadable
233
+ // document fails here, while the operator is still present.
234
+ loadIdentityRegistryStorage(resolvedPath);
235
+ }