@fgv/ts-extras 5.1.0-5 → 5.1.0-50

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 (488) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +90 -0
  3. package/dist/index.browser.js +6 -2
  4. package/dist/index.browser.js.map +1 -0
  5. package/dist/index.js +2 -1
  6. package/dist/index.js.map +1 -0
  7. package/dist/packlets/ai-assist/chatRequestBuilders.js +282 -0
  8. package/dist/packlets/ai-assist/chatRequestBuilders.js.map +1 -0
  9. package/dist/packlets/ai-assist/{apiClient.js → completionClient.js} +165 -214
  10. package/dist/packlets/ai-assist/completionClient.js.map +1 -0
  11. package/dist/packlets/ai-assist/converters.js +47 -3
  12. package/dist/packlets/ai-assist/converters.js.map +1 -0
  13. package/dist/packlets/ai-assist/embeddingClient.js +345 -0
  14. package/dist/packlets/ai-assist/embeddingClient.js.map +1 -0
  15. package/dist/packlets/ai-assist/endpoint.js +107 -0
  16. package/dist/packlets/ai-assist/endpoint.js.map +1 -0
  17. package/dist/packlets/ai-assist/http.js +104 -0
  18. package/dist/packlets/ai-assist/http.js.map +1 -0
  19. package/dist/packlets/ai-assist/imageGenerationClient.js +454 -0
  20. package/dist/packlets/ai-assist/imageGenerationClient.js.map +1 -0
  21. package/dist/packlets/ai-assist/imageOptionsResolver.js +193 -0
  22. package/dist/packlets/ai-assist/imageOptionsResolver.js.map +1 -0
  23. package/dist/packlets/ai-assist/index.js +12 -4
  24. package/dist/packlets/ai-assist/index.js.map +1 -0
  25. package/dist/packlets/ai-assist/jsonCompletion.js +93 -0
  26. package/dist/packlets/ai-assist/jsonCompletion.js.map +1 -0
  27. package/dist/packlets/ai-assist/jsonResponse.js +423 -0
  28. package/dist/packlets/ai-assist/jsonResponse.js.map +1 -0
  29. package/dist/packlets/ai-assist/listModelsClient.js +294 -0
  30. package/dist/packlets/ai-assist/listModelsClient.js.map +1 -0
  31. package/dist/packlets/ai-assist/model.js +301 -9
  32. package/dist/packlets/ai-assist/model.js.map +1 -0
  33. package/dist/packlets/ai-assist/registry.js +376 -12
  34. package/dist/packlets/ai-assist/registry.js.map +1 -0
  35. package/dist/packlets/ai-assist/sseParser.js +123 -0
  36. package/dist/packlets/ai-assist/sseParser.js.map +1 -0
  37. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +376 -0
  38. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -0
  39. package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +687 -0
  40. package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -0
  41. package/dist/packlets/ai-assist/streamingAdapters/common.js +187 -0
  42. package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -0
  43. package/dist/packlets/ai-assist/streamingAdapters/gemini.js +208 -0
  44. package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -0
  45. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +175 -0
  46. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -0
  47. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +390 -0
  48. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -0
  49. package/dist/packlets/ai-assist/streamingAdapters/proxy.js +178 -0
  50. package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -0
  51. package/dist/packlets/ai-assist/streamingClient.js +140 -0
  52. package/dist/packlets/ai-assist/streamingClient.js.map +1 -0
  53. package/dist/packlets/ai-assist/thinkingOptionsResolver.js +288 -0
  54. package/dist/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
  55. package/dist/packlets/ai-assist/toolFormats.js +106 -10
  56. package/dist/packlets/ai-assist/toolFormats.js.map +1 -0
  57. package/dist/packlets/conversion/converters.js +35 -1
  58. package/dist/packlets/conversion/converters.js.map +1 -0
  59. package/dist/packlets/conversion/index.js.map +1 -0
  60. package/dist/packlets/crypto-utils/constants.js.map +1 -0
  61. package/dist/packlets/crypto-utils/converters.js +42 -4
  62. package/dist/packlets/crypto-utils/converters.js.map +1 -0
  63. package/dist/packlets/crypto-utils/directEncryptionProvider.js.map +1 -0
  64. package/dist/packlets/crypto-utils/encryptedFile.js +37 -0
  65. package/dist/packlets/crypto-utils/encryptedFile.js.map +1 -0
  66. package/dist/packlets/crypto-utils/hpkeProvider.js +355 -0
  67. package/dist/packlets/crypto-utils/hpkeProvider.js.map +1 -0
  68. package/dist/packlets/crypto-utils/index.browser.js +13 -2
  69. package/dist/packlets/crypto-utils/index.browser.js.map +1 -0
  70. package/dist/packlets/crypto-utils/index.js +9 -1
  71. package/dist/packlets/crypto-utils/index.js.map +1 -0
  72. package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js +71 -0
  73. package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js.map +1 -0
  74. package/dist/packlets/crypto-utils/keystore/converters.js +111 -16
  75. package/dist/packlets/crypto-utils/keystore/converters.js.map +1 -0
  76. package/dist/packlets/crypto-utils/keystore/encryptedFilePrivateKeyStorage.js +287 -0
  77. package/dist/packlets/crypto-utils/keystore/encryptedFilePrivateKeyStorage.js.map +1 -0
  78. package/dist/packlets/crypto-utils/keystore/index.browser.js +36 -0
  79. package/dist/packlets/crypto-utils/keystore/index.browser.js.map +1 -0
  80. package/dist/packlets/crypto-utils/keystore/index.js +3 -0
  81. package/dist/packlets/crypto-utils/keystore/index.js.map +1 -0
  82. package/dist/packlets/crypto-utils/keystore/keyStore.js +872 -119
  83. package/dist/packlets/crypto-utils/keystore/keyStore.js.map +1 -0
  84. package/dist/packlets/crypto-utils/keystore/model.js +35 -4
  85. package/dist/packlets/crypto-utils/keystore/model.js.map +1 -0
  86. package/dist/packlets/crypto-utils/keystore/privateKeyStorage.js +21 -0
  87. package/dist/packlets/crypto-utils/keystore/privateKeyStorage.js.map +1 -0
  88. package/dist/packlets/crypto-utils/model.js +32 -0
  89. package/dist/packlets/crypto-utils/model.js.map +1 -0
  90. package/dist/packlets/crypto-utils/nodeCryptoProvider.js +347 -1
  91. package/dist/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -0
  92. package/dist/packlets/crypto-utils/seedDerivedKeyPair.js +120 -0
  93. package/dist/packlets/crypto-utils/seedDerivedKeyPair.js.map +1 -0
  94. package/dist/packlets/crypto-utils/spkiHelpers.js +284 -0
  95. package/dist/packlets/crypto-utils/spkiHelpers.js.map +1 -0
  96. package/dist/packlets/csv/csvFileHelpers.js +0 -14
  97. package/dist/packlets/csv/csvFileHelpers.js.map +1 -0
  98. package/dist/packlets/csv/csvHelpers.js +14 -0
  99. package/dist/packlets/csv/csvHelpers.js.map +1 -0
  100. package/dist/packlets/csv/index.browser.js +1 -3
  101. package/dist/packlets/csv/index.browser.js.map +1 -0
  102. package/dist/packlets/csv/index.js.map +1 -0
  103. package/dist/packlets/experimental/extendedArray.js.map +1 -0
  104. package/dist/packlets/experimental/formatter.js.map +1 -0
  105. package/dist/packlets/experimental/index.js.map +1 -0
  106. package/dist/packlets/experimental/rangeOf.js.map +1 -0
  107. package/dist/packlets/hash/index.browser.js.map +1 -0
  108. package/dist/packlets/hash/index.js.map +1 -0
  109. package/dist/packlets/hash/index.node.js.map +1 -0
  110. package/dist/packlets/hash/md5Normalizer.browser.js.map +1 -0
  111. package/dist/packlets/hash/md5Normalizer.js.map +1 -0
  112. package/dist/packlets/mustache/index.js.map +1 -0
  113. package/dist/packlets/mustache/interfaces.js.map +1 -0
  114. package/dist/packlets/mustache/mustacheTemplate.js +42 -4
  115. package/dist/packlets/mustache/mustacheTemplate.js.map +1 -0
  116. package/dist/packlets/record-jar/index.browser.js +1 -3
  117. package/dist/packlets/record-jar/index.browser.js.map +1 -0
  118. package/dist/packlets/record-jar/index.js.map +1 -0
  119. package/dist/packlets/record-jar/recordJarFileHelpers.js +0 -18
  120. package/dist/packlets/record-jar/recordJarFileHelpers.js.map +1 -0
  121. package/dist/packlets/record-jar/recordJarHelpers.js +18 -0
  122. package/dist/packlets/record-jar/recordJarHelpers.js.map +1 -0
  123. package/dist/packlets/safer-fetch/addressClassification.js +438 -0
  124. package/dist/packlets/safer-fetch/addressClassification.js.map +1 -0
  125. package/dist/packlets/safer-fetch/addressPolicy.js +119 -0
  126. package/dist/packlets/safer-fetch/addressPolicy.js.map +1 -0
  127. package/dist/packlets/safer-fetch/contentType.js +120 -0
  128. package/dist/packlets/safer-fetch/contentType.js.map +1 -0
  129. package/dist/packlets/safer-fetch/deadline.js +254 -0
  130. package/dist/packlets/safer-fetch/deadline.js.map +1 -0
  131. package/dist/packlets/safer-fetch/defaults.js +131 -0
  132. package/dist/packlets/safer-fetch/defaults.js.map +1 -0
  133. package/dist/packlets/safer-fetch/failureReason.js +21 -0
  134. package/dist/packlets/safer-fetch/failureReason.js.map +1 -0
  135. package/dist/packlets/safer-fetch/guards.js +148 -0
  136. package/dist/packlets/safer-fetch/guards.js.map +1 -0
  137. package/dist/packlets/safer-fetch/index.browser.js +58 -0
  138. package/dist/packlets/safer-fetch/index.browser.js.map +1 -0
  139. package/dist/packlets/safer-fetch/index.js +52 -0
  140. package/dist/packlets/safer-fetch/index.js.map +1 -0
  141. package/dist/packlets/safer-fetch/model.js +21 -0
  142. package/dist/packlets/safer-fetch/model.js.map +1 -0
  143. package/dist/packlets/safer-fetch/nodeAddressGuard.js +191 -0
  144. package/dist/packlets/safer-fetch/nodeAddressGuard.js.map +1 -0
  145. package/dist/packlets/safer-fetch/redirect.js +93 -0
  146. package/dist/packlets/safer-fetch/redirect.js.map +1 -0
  147. package/dist/packlets/safer-fetch/retry.js +188 -0
  148. package/dist/packlets/safer-fetch/retry.js.map +1 -0
  149. package/dist/packlets/safer-fetch/saferFetch.js +755 -0
  150. package/dist/packlets/safer-fetch/saferFetch.js.map +1 -0
  151. package/dist/packlets/safer-fetch/transport.js +50 -0
  152. package/dist/packlets/safer-fetch/transport.js.map +1 -0
  153. package/dist/packlets/yaml/converters.js.map +1 -0
  154. package/dist/packlets/yaml/index.js +1 -0
  155. package/dist/packlets/yaml/index.js.map +1 -0
  156. package/dist/packlets/yaml/serializers.js +48 -0
  157. package/dist/packlets/yaml/serializers.js.map +1 -0
  158. package/dist/packlets/zip-file-tree/index.js.map +1 -0
  159. package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js +99 -9
  160. package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -0
  161. package/dist/packlets/zip-file-tree/zipFileTreeWriter.js +16 -1
  162. package/dist/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -0
  163. package/dist/ts-extras.d.ts +6648 -553
  164. package/dist/tsdoc-metadata.json +1 -1
  165. package/lib/index.browser.d.ts +5 -2
  166. package/lib/index.browser.d.ts.map +1 -0
  167. package/lib/index.browser.js +11 -3
  168. package/lib/index.browser.js.map +1 -0
  169. package/lib/index.d.ts +2 -1
  170. package/lib/index.d.ts.map +1 -0
  171. package/lib/index.js +3 -1
  172. package/lib/index.js.map +1 -0
  173. package/lib/packlets/ai-assist/chatRequestBuilders.d.ts +149 -0
  174. package/lib/packlets/ai-assist/chatRequestBuilders.d.ts.map +1 -0
  175. package/lib/packlets/ai-assist/chatRequestBuilders.js +293 -0
  176. package/lib/packlets/ai-assist/chatRequestBuilders.js.map +1 -0
  177. package/lib/packlets/ai-assist/completionClient.d.ts +74 -0
  178. package/lib/packlets/ai-assist/completionClient.d.ts.map +1 -0
  179. package/lib/packlets/ai-assist/{apiClient.js → completionClient.js} +164 -213
  180. package/lib/packlets/ai-assist/completionClient.js.map +1 -0
  181. package/lib/packlets/ai-assist/converters.d.ts +15 -1
  182. package/lib/packlets/ai-assist/converters.d.ts.map +1 -0
  183. package/lib/packlets/ai-assist/converters.js +47 -3
  184. package/lib/packlets/ai-assist/converters.js.map +1 -0
  185. package/lib/packlets/ai-assist/embeddingClient.d.ts +69 -0
  186. package/lib/packlets/ai-assist/embeddingClient.d.ts.map +1 -0
  187. package/lib/packlets/ai-assist/embeddingClient.js +349 -0
  188. package/lib/packlets/ai-assist/embeddingClient.js.map +1 -0
  189. package/lib/packlets/ai-assist/endpoint.d.ts +49 -0
  190. package/lib/packlets/ai-assist/endpoint.d.ts.map +1 -0
  191. package/lib/packlets/ai-assist/endpoint.js +113 -0
  192. package/lib/packlets/ai-assist/endpoint.js.map +1 -0
  193. package/lib/packlets/ai-assist/http.d.ts +34 -0
  194. package/lib/packlets/ai-assist/http.d.ts.map +1 -0
  195. package/lib/packlets/ai-assist/http.js +109 -0
  196. package/lib/packlets/ai-assist/http.js.map +1 -0
  197. package/lib/packlets/ai-assist/imageGenerationClient.d.ts +46 -0
  198. package/lib/packlets/ai-assist/imageGenerationClient.d.ts.map +1 -0
  199. package/lib/packlets/ai-assist/imageGenerationClient.js +458 -0
  200. package/lib/packlets/ai-assist/imageGenerationClient.js.map +1 -0
  201. package/lib/packlets/ai-assist/imageOptionsResolver.d.ts +66 -0
  202. package/lib/packlets/ai-assist/imageOptionsResolver.d.ts.map +1 -0
  203. package/lib/packlets/ai-assist/imageOptionsResolver.js +197 -0
  204. package/lib/packlets/ai-assist/imageOptionsResolver.js.map +1 -0
  205. package/lib/packlets/ai-assist/index.d.ts +12 -4
  206. package/lib/packlets/ai-assist/index.d.ts.map +1 -0
  207. package/lib/packlets/ai-assist/index.js +47 -4
  208. package/lib/packlets/ai-assist/index.js.map +1 -0
  209. package/lib/packlets/ai-assist/jsonCompletion.d.ts +93 -0
  210. package/lib/packlets/ai-assist/jsonCompletion.d.ts.map +1 -0
  211. package/lib/packlets/ai-assist/jsonCompletion.js +97 -0
  212. package/lib/packlets/ai-assist/jsonCompletion.js.map +1 -0
  213. package/lib/packlets/ai-assist/jsonResponse.d.ts +194 -0
  214. package/lib/packlets/ai-assist/jsonResponse.d.ts.map +1 -0
  215. package/lib/packlets/ai-assist/jsonResponse.js +429 -0
  216. package/lib/packlets/ai-assist/jsonResponse.js.map +1 -0
  217. package/lib/packlets/ai-assist/listModelsClient.d.ts +46 -0
  218. package/lib/packlets/ai-assist/listModelsClient.d.ts.map +1 -0
  219. package/lib/packlets/ai-assist/listModelsClient.js +298 -0
  220. package/lib/packlets/ai-assist/listModelsClient.js.map +1 -0
  221. package/lib/packlets/ai-assist/model.d.ts +1346 -12
  222. package/lib/packlets/ai-assist/model.d.ts.map +1 -0
  223. package/lib/packlets/ai-assist/model.js +309 -10
  224. package/lib/packlets/ai-assist/model.js.map +1 -0
  225. package/lib/packlets/ai-assist/registry.d.ts +76 -1
  226. package/lib/packlets/ai-assist/registry.d.ts.map +1 -0
  227. package/lib/packlets/ai-assist/registry.js +381 -13
  228. package/lib/packlets/ai-assist/registry.js.map +1 -0
  229. package/lib/packlets/ai-assist/sseParser.d.ts +45 -0
  230. package/lib/packlets/ai-assist/sseParser.d.ts.map +1 -0
  231. package/lib/packlets/ai-assist/sseParser.js +128 -0
  232. package/lib/packlets/ai-assist/sseParser.js.map +1 -0
  233. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +72 -0
  234. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -0
  235. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +379 -0
  236. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -0
  237. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts +269 -0
  238. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts.map +1 -0
  239. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +694 -0
  240. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -0
  241. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +163 -0
  242. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -0
  243. package/lib/packlets/ai-assist/streamingAdapters/common.js +193 -0
  244. package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -0
  245. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +43 -0
  246. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -0
  247. package/lib/packlets/ai-assist/streamingAdapters/gemini.js +211 -0
  248. package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -0
  249. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +19 -0
  250. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -0
  251. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +178 -0
  252. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -0
  253. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +33 -0
  254. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -0
  255. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +393 -0
  256. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -0
  257. package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts +34 -0
  258. package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -0
  259. package/lib/packlets/ai-assist/streamingAdapters/proxy.js +181 -0
  260. package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -0
  261. package/lib/packlets/ai-assist/streamingClient.d.ts +50 -0
  262. package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -0
  263. package/lib/packlets/ai-assist/streamingClient.js +146 -0
  264. package/lib/packlets/ai-assist/streamingClient.js.map +1 -0
  265. package/lib/packlets/ai-assist/thinkingOptionsResolver.d.ts +87 -0
  266. package/lib/packlets/ai-assist/thinkingOptionsResolver.d.ts.map +1 -0
  267. package/lib/packlets/ai-assist/thinkingOptionsResolver.js +294 -0
  268. package/lib/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
  269. package/lib/packlets/ai-assist/toolFormats.d.ts +40 -9
  270. package/lib/packlets/ai-assist/toolFormats.d.ts.map +1 -0
  271. package/lib/packlets/ai-assist/toolFormats.js +107 -10
  272. package/lib/packlets/ai-assist/toolFormats.js.map +1 -0
  273. package/lib/packlets/conversion/converters.d.ts +8 -1
  274. package/lib/packlets/conversion/converters.d.ts.map +1 -0
  275. package/lib/packlets/conversion/converters.js +36 -2
  276. package/lib/packlets/conversion/converters.js.map +1 -0
  277. package/lib/packlets/conversion/index.d.ts.map +1 -0
  278. package/lib/packlets/conversion/index.js.map +1 -0
  279. package/lib/packlets/crypto-utils/constants.d.ts.map +1 -0
  280. package/lib/packlets/crypto-utils/constants.js.map +1 -0
  281. package/lib/packlets/crypto-utils/converters.d.ts +20 -1
  282. package/lib/packlets/crypto-utils/converters.d.ts.map +1 -0
  283. package/lib/packlets/crypto-utils/converters.js +43 -5
  284. package/lib/packlets/crypto-utils/converters.js.map +1 -0
  285. package/lib/packlets/crypto-utils/directEncryptionProvider.d.ts.map +1 -0
  286. package/lib/packlets/crypto-utils/directEncryptionProvider.js.map +1 -0
  287. package/lib/packlets/crypto-utils/encryptedFile.d.ts +25 -0
  288. package/lib/packlets/crypto-utils/encryptedFile.d.ts.map +1 -0
  289. package/lib/packlets/crypto-utils/encryptedFile.js +38 -0
  290. package/lib/packlets/crypto-utils/encryptedFile.js.map +1 -0
  291. package/lib/packlets/crypto-utils/hpkeProvider.d.ts +150 -0
  292. package/lib/packlets/crypto-utils/hpkeProvider.d.ts.map +1 -0
  293. package/lib/packlets/crypto-utils/hpkeProvider.js +359 -0
  294. package/lib/packlets/crypto-utils/hpkeProvider.js.map +1 -0
  295. package/lib/packlets/crypto-utils/index.browser.d.ts +5 -1
  296. package/lib/packlets/crypto-utils/index.browser.d.ts.map +1 -0
  297. package/lib/packlets/crypto-utils/index.browser.js +28 -3
  298. package/lib/packlets/crypto-utils/index.browser.js.map +1 -0
  299. package/lib/packlets/crypto-utils/index.d.ts +5 -1
  300. package/lib/packlets/crypto-utils/index.d.ts.map +1 -0
  301. package/lib/packlets/crypto-utils/index.js +24 -1
  302. package/lib/packlets/crypto-utils/index.js.map +1 -0
  303. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts +54 -0
  304. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts.map +1 -0
  305. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js +74 -0
  306. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js.map +1 -0
  307. package/lib/packlets/crypto-utils/keystore/converters.d.ts +68 -6
  308. package/lib/packlets/crypto-utils/keystore/converters.d.ts.map +1 -0
  309. package/lib/packlets/crypto-utils/keystore/converters.js +109 -14
  310. package/lib/packlets/crypto-utils/keystore/converters.js.map +1 -0
  311. package/lib/packlets/crypto-utils/keystore/encryptedFilePrivateKeyStorage.d.ts +148 -0
  312. package/lib/packlets/crypto-utils/keystore/encryptedFilePrivateKeyStorage.d.ts.map +1 -0
  313. package/lib/packlets/crypto-utils/keystore/encryptedFilePrivateKeyStorage.js +324 -0
  314. package/lib/packlets/crypto-utils/keystore/encryptedFilePrivateKeyStorage.js.map +1 -0
  315. package/lib/packlets/crypto-utils/keystore/index.browser.d.ts +10 -0
  316. package/lib/packlets/crypto-utils/keystore/index.browser.d.ts.map +1 -0
  317. package/lib/packlets/crypto-utils/keystore/index.browser.js +76 -0
  318. package/lib/packlets/crypto-utils/keystore/index.browser.js.map +1 -0
  319. package/lib/packlets/crypto-utils/keystore/index.d.ts +2 -0
  320. package/lib/packlets/crypto-utils/keystore/index.d.ts.map +1 -0
  321. package/lib/packlets/crypto-utils/keystore/index.js +5 -1
  322. package/lib/packlets/crypto-utils/keystore/index.js.map +1 -0
  323. package/lib/packlets/crypto-utils/keystore/keyStore.d.ts +314 -13
  324. package/lib/packlets/crypto-utils/keystore/keyStore.d.ts.map +1 -0
  325. package/lib/packlets/crypto-utils/keystore/keyStore.js +877 -124
  326. package/lib/packlets/crypto-utils/keystore/keyStore.js.map +1 -0
  327. package/lib/packlets/crypto-utils/keystore/model.d.ts +404 -21
  328. package/lib/packlets/crypto-utils/keystore/model.d.ts.map +1 -0
  329. package/lib/packlets/crypto-utils/keystore/model.js +37 -5
  330. package/lib/packlets/crypto-utils/keystore/model.js.map +1 -0
  331. package/lib/packlets/crypto-utils/keystore/privateKeyStorage.d.ts +53 -0
  332. package/lib/packlets/crypto-utils/keystore/privateKeyStorage.d.ts.map +1 -0
  333. package/lib/packlets/crypto-utils/keystore/privateKeyStorage.js +22 -0
  334. package/lib/packlets/crypto-utils/keystore/privateKeyStorage.js.map +1 -0
  335. package/lib/packlets/crypto-utils/model.d.ts +518 -10
  336. package/lib/packlets/crypto-utils/model.d.ts.map +1 -0
  337. package/lib/packlets/crypto-utils/model.js +33 -1
  338. package/lib/packlets/crypto-utils/model.js.map +1 -0
  339. package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts +142 -2
  340. package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts.map +1 -0
  341. package/lib/packlets/crypto-utils/nodeCryptoProvider.js +346 -0
  342. package/lib/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -0
  343. package/lib/packlets/crypto-utils/seedDerivedKeyPair.d.ts +42 -0
  344. package/lib/packlets/crypto-utils/seedDerivedKeyPair.d.ts.map +1 -0
  345. package/lib/packlets/crypto-utils/seedDerivedKeyPair.js +123 -0
  346. package/lib/packlets/crypto-utils/seedDerivedKeyPair.js.map +1 -0
  347. package/lib/packlets/crypto-utils/spkiHelpers.d.ts +151 -0
  348. package/lib/packlets/crypto-utils/spkiHelpers.d.ts.map +1 -0
  349. package/lib/packlets/crypto-utils/spkiHelpers.js +297 -0
  350. package/lib/packlets/crypto-utils/spkiHelpers.js.map +1 -0
  351. package/lib/packlets/csv/csvFileHelpers.d.ts +0 -10
  352. package/lib/packlets/csv/csvFileHelpers.d.ts.map +1 -0
  353. package/lib/packlets/csv/csvFileHelpers.js +0 -15
  354. package/lib/packlets/csv/csvFileHelpers.js.map +1 -0
  355. package/lib/packlets/csv/csvHelpers.d.ts +10 -0
  356. package/lib/packlets/csv/csvHelpers.d.ts.map +1 -0
  357. package/lib/packlets/csv/csvHelpers.js +15 -0
  358. package/lib/packlets/csv/csvHelpers.js.map +1 -0
  359. package/lib/packlets/csv/index.browser.d.ts +0 -1
  360. package/lib/packlets/csv/index.browser.d.ts.map +1 -0
  361. package/lib/packlets/csv/index.browser.js +1 -5
  362. package/lib/packlets/csv/index.browser.js.map +1 -0
  363. package/lib/packlets/csv/index.d.ts.map +1 -0
  364. package/lib/packlets/csv/index.js.map +1 -0
  365. package/lib/packlets/experimental/extendedArray.d.ts.map +1 -0
  366. package/lib/packlets/experimental/extendedArray.js.map +1 -0
  367. package/lib/packlets/experimental/formatter.d.ts.map +1 -0
  368. package/lib/packlets/experimental/formatter.js.map +1 -0
  369. package/lib/packlets/experimental/index.d.ts.map +1 -0
  370. package/lib/packlets/experimental/index.js.map +1 -0
  371. package/lib/packlets/experimental/rangeOf.d.ts.map +1 -0
  372. package/lib/packlets/experimental/rangeOf.js.map +1 -0
  373. package/lib/packlets/hash/index.browser.d.ts.map +1 -0
  374. package/lib/packlets/hash/index.browser.js.map +1 -0
  375. package/lib/packlets/hash/index.d.ts.map +1 -0
  376. package/lib/packlets/hash/index.js.map +1 -0
  377. package/lib/packlets/hash/index.node.d.ts.map +1 -0
  378. package/lib/packlets/hash/index.node.js.map +1 -0
  379. package/lib/packlets/hash/md5Normalizer.browser.d.ts.map +1 -0
  380. package/lib/packlets/hash/md5Normalizer.browser.js.map +1 -0
  381. package/lib/packlets/hash/md5Normalizer.d.ts.map +1 -0
  382. package/lib/packlets/hash/md5Normalizer.js.map +1 -0
  383. package/lib/packlets/mustache/index.d.ts +1 -1
  384. package/lib/packlets/mustache/index.d.ts.map +1 -0
  385. package/lib/packlets/mustache/index.js.map +1 -0
  386. package/lib/packlets/mustache/interfaces.d.ts +34 -0
  387. package/lib/packlets/mustache/interfaces.d.ts.map +1 -0
  388. package/lib/packlets/mustache/interfaces.js.map +1 -0
  389. package/lib/packlets/mustache/mustacheTemplate.d.ts +2 -0
  390. package/lib/packlets/mustache/mustacheTemplate.d.ts.map +1 -0
  391. package/lib/packlets/mustache/mustacheTemplate.js +42 -4
  392. package/lib/packlets/mustache/mustacheTemplate.js.map +1 -0
  393. package/lib/packlets/record-jar/index.browser.d.ts +0 -1
  394. package/lib/packlets/record-jar/index.browser.d.ts.map +1 -0
  395. package/lib/packlets/record-jar/index.browser.js +1 -5
  396. package/lib/packlets/record-jar/index.browser.js.map +1 -0
  397. package/lib/packlets/record-jar/index.d.ts.map +1 -0
  398. package/lib/packlets/record-jar/index.js.map +1 -0
  399. package/lib/packlets/record-jar/recordJarFileHelpers.d.ts +0 -11
  400. package/lib/packlets/record-jar/recordJarFileHelpers.d.ts.map +1 -0
  401. package/lib/packlets/record-jar/recordJarFileHelpers.js +0 -19
  402. package/lib/packlets/record-jar/recordJarFileHelpers.js.map +1 -0
  403. package/lib/packlets/record-jar/recordJarHelpers.d.ts +11 -0
  404. package/lib/packlets/record-jar/recordJarHelpers.d.ts.map +1 -0
  405. package/lib/packlets/record-jar/recordJarHelpers.js +19 -0
  406. package/lib/packlets/record-jar/recordJarHelpers.js.map +1 -0
  407. package/lib/packlets/safer-fetch/addressClassification.d.ts +144 -0
  408. package/lib/packlets/safer-fetch/addressClassification.d.ts.map +1 -0
  409. package/lib/packlets/safer-fetch/addressClassification.js +441 -0
  410. package/lib/packlets/safer-fetch/addressClassification.js.map +1 -0
  411. package/lib/packlets/safer-fetch/addressPolicy.d.ts +113 -0
  412. package/lib/packlets/safer-fetch/addressPolicy.d.ts.map +1 -0
  413. package/lib/packlets/safer-fetch/addressPolicy.js +123 -0
  414. package/lib/packlets/safer-fetch/addressPolicy.js.map +1 -0
  415. package/lib/packlets/safer-fetch/contentType.d.ts +51 -0
  416. package/lib/packlets/safer-fetch/contentType.d.ts.map +1 -0
  417. package/lib/packlets/safer-fetch/contentType.js +127 -0
  418. package/lib/packlets/safer-fetch/contentType.js.map +1 -0
  419. package/lib/packlets/safer-fetch/deadline.d.ts +138 -0
  420. package/lib/packlets/safer-fetch/deadline.d.ts.map +1 -0
  421. package/lib/packlets/safer-fetch/deadline.js +258 -0
  422. package/lib/packlets/safer-fetch/deadline.js.map +1 -0
  423. package/lib/packlets/safer-fetch/defaults.d.ts +108 -0
  424. package/lib/packlets/safer-fetch/defaults.d.ts.map +1 -0
  425. package/lib/packlets/safer-fetch/defaults.js +134 -0
  426. package/lib/packlets/safer-fetch/defaults.js.map +1 -0
  427. package/lib/packlets/safer-fetch/failureReason.d.ts +148 -0
  428. package/lib/packlets/safer-fetch/failureReason.d.ts.map +1 -0
  429. package/lib/packlets/safer-fetch/failureReason.js +22 -0
  430. package/lib/packlets/safer-fetch/failureReason.js.map +1 -0
  431. package/lib/packlets/safer-fetch/guards.d.ts +62 -0
  432. package/lib/packlets/safer-fetch/guards.d.ts.map +1 -0
  433. package/lib/packlets/safer-fetch/guards.js +153 -0
  434. package/lib/packlets/safer-fetch/guards.js.map +1 -0
  435. package/lib/packlets/safer-fetch/index.browser.d.ts +33 -0
  436. package/lib/packlets/safer-fetch/index.browser.d.ts.map +1 -0
  437. package/lib/packlets/safer-fetch/index.browser.js +82 -0
  438. package/lib/packlets/safer-fetch/index.browser.js.map +1 -0
  439. package/lib/packlets/safer-fetch/index.d.ts +27 -0
  440. package/lib/packlets/safer-fetch/index.d.ts.map +1 -0
  441. package/lib/packlets/safer-fetch/index.js +78 -0
  442. package/lib/packlets/safer-fetch/index.js.map +1 -0
  443. package/lib/packlets/safer-fetch/model.d.ts +373 -0
  444. package/lib/packlets/safer-fetch/model.d.ts.map +1 -0
  445. package/lib/packlets/safer-fetch/model.js +22 -0
  446. package/lib/packlets/safer-fetch/model.js.map +1 -0
  447. package/lib/packlets/safer-fetch/nodeAddressGuard.d.ts +129 -0
  448. package/lib/packlets/safer-fetch/nodeAddressGuard.d.ts.map +1 -0
  449. package/lib/packlets/safer-fetch/nodeAddressGuard.js +196 -0
  450. package/lib/packlets/safer-fetch/nodeAddressGuard.js.map +1 -0
  451. package/lib/packlets/safer-fetch/redirect.d.ts +62 -0
  452. package/lib/packlets/safer-fetch/redirect.d.ts.map +1 -0
  453. package/lib/packlets/safer-fetch/redirect.js +98 -0
  454. package/lib/packlets/safer-fetch/redirect.js.map +1 -0
  455. package/lib/packlets/safer-fetch/retry.d.ts +162 -0
  456. package/lib/packlets/safer-fetch/retry.d.ts.map +1 -0
  457. package/lib/packlets/safer-fetch/retry.js +197 -0
  458. package/lib/packlets/safer-fetch/retry.js.map +1 -0
  459. package/lib/packlets/safer-fetch/saferFetch.d.ts +108 -0
  460. package/lib/packlets/safer-fetch/saferFetch.d.ts.map +1 -0
  461. package/lib/packlets/safer-fetch/saferFetch.js +760 -0
  462. package/lib/packlets/safer-fetch/saferFetch.js.map +1 -0
  463. package/lib/packlets/safer-fetch/transport.d.ts +18 -0
  464. package/lib/packlets/safer-fetch/transport.d.ts.map +1 -0
  465. package/lib/packlets/safer-fetch/transport.js +53 -0
  466. package/lib/packlets/safer-fetch/transport.js.map +1 -0
  467. package/lib/packlets/yaml/converters.d.ts.map +1 -0
  468. package/lib/packlets/yaml/converters.js.map +1 -0
  469. package/lib/packlets/yaml/index.d.ts +1 -0
  470. package/lib/packlets/yaml/index.d.ts.map +1 -0
  471. package/lib/packlets/yaml/index.js +1 -0
  472. package/lib/packlets/yaml/index.js.map +1 -0
  473. package/lib/packlets/yaml/serializers.d.ts +45 -0
  474. package/lib/packlets/yaml/serializers.d.ts.map +1 -0
  475. package/lib/packlets/yaml/serializers.js +84 -0
  476. package/lib/packlets/yaml/serializers.js.map +1 -0
  477. package/lib/packlets/zip-file-tree/index.d.ts.map +1 -0
  478. package/lib/packlets/zip-file-tree/index.js.map +1 -0
  479. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts +84 -8
  480. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts.map +1 -0
  481. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js +99 -9
  482. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -0
  483. package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts +26 -1
  484. package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts.map +1 -0
  485. package/lib/packlets/zip-file-tree/zipFileTreeWriter.js +17 -1
  486. package/lib/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -0
  487. package/package.json +30 -15
  488. package/lib/packlets/ai-assist/apiClient.d.ts +0 -60
@@ -1,11 +1,30 @@
1
- import { EncryptionAlgorithm, ICryptoProvider, IKeyDerivationParams } from '../model';
1
+ import { JsonValue } from '@fgv/ts-json-base';
2
+ import { EncryptionAlgorithm, ICryptoProvider, IArgon2idParams, IKeyDerivationParams, IPbkdf2KeyDerivationParams, KeyPairAlgorithm } from '../model';
3
+ import { IPrivateKeyStorage } from './privateKeyStorage';
4
+ export { allKeyPairAlgorithms, KeyPairAlgorithm } from '../model';
2
5
  /**
3
6
  * Format version for key store files.
7
+ *
8
+ * - `'keystore-v1'`: the original format (no private-key escrow).
9
+ * - `'keystore-v2'`: adds the optional `escrowedPrivateKeyJwk` field on
10
+ * asymmetric-keypair entries. A strict superset of v1 — the field is
11
+ * optional, so a v2 reader opens a v1 vault with no special-casing, and a
12
+ * v1 vault opened and re-saved is silently upgraded to v2.
13
+ * - `'keystore-v3'`: adds the `'opaque'` symmetric secret type and the optional
14
+ * `metadata` / `updatedAt` fields on symmetric entries. A strict superset of
15
+ * v1/v2 — the additions are optional (and `'opaque'` is simply a new enum
16
+ * value), so a v3 reader opens a v1/v2 vault with no special-casing, and a
17
+ * v1/v2 vault opened and re-saved is silently upgraded to v3.
4
18
  * @public
5
19
  */
6
- export type KeyStoreFormat = 'keystore-v1';
20
+ export type KeyStoreFormat = 'keystore-v1' | 'keystore-v2' | 'keystore-v3';
7
21
  /**
8
- * Current format version constant.
22
+ * All recognized key store format versions (readable by the current library).
23
+ * @public
24
+ */
25
+ export declare const allKeyStoreFormats: ReadonlyArray<KeyStoreFormat>;
26
+ /**
27
+ * Current format version constant. New vaults are written as `'keystore-v3'`.
9
28
  * @public
10
29
  */
11
30
  export declare const KEYSTORE_FORMAT: KeyStoreFormat;
@@ -21,60 +40,187 @@ export declare const DEFAULT_KEYSTORE_ITERATIONS: number;
21
40
  */
22
41
  export declare const MIN_SALT_LENGTH: number;
23
42
  /**
24
- * Discriminator for secret types stored in the vault.
43
+ * Discriminator for symmetric secret types stored in the vault.
25
44
  * - `'encryption-key'`: A 32-byte AES-256 encryption key.
26
45
  * - `'api-key'`: An arbitrary-length API key string (UTF-8 encoded).
46
+ * - `'opaque'`: Arbitrary raw bytes with no encoding contract — stored and
47
+ * returned verbatim (never UTF-8 decoded). Use for byte blobs that are
48
+ * neither a fixed-size AES key nor a UTF-8 string (e.g. a serialized
49
+ * credential bundle), so they are not mistyped as `'api-key'`.
50
+ * @public
51
+ */
52
+ export type KeyStoreSymmetricSecretType = 'encryption-key' | 'api-key' | 'opaque';
53
+ /**
54
+ * All valid symmetric secret types.
55
+ * @public
56
+ */
57
+ export declare const allKeyStoreSymmetricSecretTypes: ReadonlyArray<KeyStoreSymmetricSecretType>;
58
+ /**
59
+ * Discriminator for asymmetric secret types stored in the vault.
60
+ * - `'asymmetric-keypair'`: A public/private key pair. The public key is held in
61
+ * the vault as a JWK; the private key lives in the supplied
62
+ * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider.
63
+ * @public
64
+ */
65
+ export type KeyStoreAsymmetricSecretType = 'asymmetric-keypair';
66
+ /**
67
+ * All valid asymmetric secret types.
68
+ * @public
69
+ */
70
+ export declare const allKeyStoreAsymmetricSecretTypes: ReadonlyArray<KeyStoreAsymmetricSecretType>;
71
+ /**
72
+ * Discriminator for any secret type stored in the vault.
27
73
  * @public
28
74
  */
29
- export type KeyStoreSecretType = 'encryption-key' | 'api-key';
75
+ export type KeyStoreSecretType = KeyStoreSymmetricSecretType | KeyStoreAsymmetricSecretType;
30
76
  /**
31
77
  * All valid key store secret types.
32
78
  * @public
33
79
  */
34
80
  export declare const allKeyStoreSecretTypes: ReadonlyArray<KeyStoreSecretType>;
35
81
  /**
36
- * A secret entry stored in the vault (in-memory representation).
82
+ * A symmetric secret entry stored in the vault (in-memory representation).
83
+ * Holds the raw key material directly — for `'encryption-key'` it is a 32-byte
84
+ * AES-256 key; for `'api-key'` it is the UTF-8 encoded API key string.
37
85
  * @public
38
86
  */
39
- export interface IKeyStoreSecretEntry {
87
+ export interface IKeyStoreSymmetricEntry {
40
88
  /**
41
89
  * Unique name for this secret (used as lookup key).
42
90
  */
43
91
  readonly name: string;
44
92
  /**
45
- * Secret type discriminator.
46
- * Defaults to `'encryption-key'` for backwards compatibility.
93
+ * Symmetric secret type discriminator.
47
94
  */
48
- readonly type: KeyStoreSecretType;
95
+ readonly type: KeyStoreSymmetricSecretType;
49
96
  /**
50
97
  * The secret data.
51
98
  * - For `'encryption-key'`: 32-byte AES-256 key.
52
99
  * - For `'api-key'`: UTF-8 encoded API key string (arbitrary length).
100
+ * - For `'opaque'`: arbitrary raw bytes, stored and returned verbatim.
53
101
  */
54
102
  readonly key: Uint8Array;
55
103
  /**
56
104
  * Optional description for this secret.
57
105
  */
58
106
  readonly description?: string;
107
+ /**
108
+ * Optional mutable, non-secret-by-contract metadata for this entry. Set via
109
+ * {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata} without touching the
110
+ * secret `key` bytes.
111
+ *
112
+ * "Non-secret by contract" means the field is intended for lifecycle metadata
113
+ * (rotation timestamps, labels, provenance) rather than secret material.
114
+ * PHYSICALLY it lives inside the vault's AES-GCM ciphertext alongside the key
115
+ * bytes — the vault has no plaintext index — so it is protected at rest by the
116
+ * master password; the "non-secret" designation is a usage contract, not a
117
+ * weaker custody class.
118
+ */
119
+ readonly metadata?: JsonValue;
59
120
  /**
60
121
  * When this secret was added (ISO 8601).
61
122
  */
62
123
  readonly createdAt: string;
124
+ /**
125
+ * When this entry was last mutated (ISO 8601). Stamped on any metadata
126
+ * mutation (see {@link CryptoUtils.KeyStore.KeyStore.setSecretMetadata}).
127
+ * Absent on entries that have never been mutated since creation.
128
+ */
129
+ readonly updatedAt?: string;
130
+ }
131
+ /**
132
+ * An asymmetric keypair entry stored in the vault (in-memory representation).
133
+ * Holds only the public key (as a JWK) and a stable handle (`id`) the
134
+ * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider uses to fetch the private key.
135
+ * @public
136
+ */
137
+ export interface IKeyStoreAsymmetricEntry {
138
+ /**
139
+ * Unique name for this entry (used as vault lookup key, renameable).
140
+ */
141
+ readonly name: string;
142
+ /**
143
+ * Asymmetric secret type discriminator.
144
+ */
145
+ readonly type: KeyStoreAsymmetricSecretType;
146
+ /**
147
+ * Immutable handle used by {@link CryptoUtils.KeyStore.IPrivateKeyStorage} to address the
148
+ * private key. Independent of `name`; survives renames.
149
+ */
150
+ readonly id: string;
151
+ /**
152
+ * Algorithm used to generate this keypair.
153
+ */
154
+ readonly algorithm: KeyPairAlgorithm;
155
+ /**
156
+ * The public key as a JSON Web Key.
157
+ */
158
+ readonly publicKeyJwk: JsonWebKey;
159
+ /**
160
+ * Optional escrowed copy of the private key, as a JSON Web Key. Present only
161
+ * when the entry was created with `addKeyPair(name, { escrow: true })`.
162
+ *
163
+ * This is an opt-in cross-device recovery affordance: the private key is
164
+ * carried inside the vault's AES-GCM ciphertext (same custody class as
165
+ * `publicKeyJwk`), so a recovered vault plus the master password can
166
+ * reconstitute the signing/decryption identity on a fresh device via
167
+ * `getKeyPair(name, { rehydrate: true })`.
168
+ *
169
+ * SECURITY: when present, the master password becomes the sole gate
170
+ * protecting this private key. Use a strong KDF for escrow-bearing stores.
171
+ * See the {@link CryptoUtils.KeyStore.KeyStore} class docs.
172
+ */
173
+ readonly escrowedPrivateKeyJwk?: JsonWebKey;
174
+ /**
175
+ * Optional description for this entry.
176
+ */
177
+ readonly description?: string;
178
+ /**
179
+ * When this entry was added (ISO 8601).
180
+ */
181
+ readonly createdAt: string;
63
182
  }
64
183
  /**
65
- * JSON-serializable version of secret entry (for storage).
184
+ * Any vault entry, discriminated by `type`.
185
+ * @public
186
+ */
187
+ export type IKeyStoreEntry = IKeyStoreSymmetricEntry | IKeyStoreAsymmetricEntry;
188
+ /**
189
+ * Backwards-compatible alias for {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry}.
190
+ * @deprecated Use {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntry} for symmetric
191
+ * entries or {@link CryptoUtils.KeyStore.IKeyStoreEntry} for the discriminated union.
66
192
  * @public
67
193
  */
68
- export interface IKeyStoreSecretEntryJson {
194
+ export type IKeyStoreSecretEntry = IKeyStoreSymmetricEntry;
195
+ /**
196
+ * JSON-serializable representation of a symmetric secret entry.
197
+ *
198
+ * @remarks
199
+ * Describes the *normalized* shape after parsing. `type` is required here
200
+ * because the converter (see
201
+ * {@link CryptoUtils.KeyStore.Converters.keystoreSymmetricEntryJson | keystoreSymmetricEntryJson})
202
+ * injects the default `'encryption-key'` when reading vaults written before
203
+ * asymmetric-keypair support added the discriminator. Raw on-wire bytes from
204
+ * a legacy vault may therefore omit `type`; downstream code only ever sees
205
+ * the post-conversion shape declared here.
206
+ *
207
+ * @public
208
+ */
209
+ export interface IKeyStoreSymmetricEntryJson {
69
210
  /**
70
211
  * Unique name for this secret.
71
212
  */
72
213
  readonly name: string;
73
214
  /**
74
- * Secret type discriminator.
75
- * Optional for backwards compatibility — missing means `'encryption-key'`.
215
+ * Symmetric secret type discriminator.
216
+ *
217
+ * Required on this normalized model type. Vaults written prior to the
218
+ * asymmetric-keypair support may omit this field on the wire; the
219
+ * converter injects `'encryption-key'` when missing for backwards
220
+ * compatibility, so by the time a value of this type is observed the
221
+ * discriminator is always present.
76
222
  */
77
- readonly type?: KeyStoreSecretType;
223
+ readonly type: KeyStoreSymmetricSecretType;
78
224
  /**
79
225
  * Base64-encoded secret data.
80
226
  */
@@ -83,13 +229,81 @@ export interface IKeyStoreSecretEntryJson {
83
229
  * Optional description.
84
230
  */
85
231
  readonly description?: string;
232
+ /**
233
+ * Optional mutable, non-secret-by-contract metadata for this entry. Present
234
+ * only on `'keystore-v3'` vaults whose entry carried metadata; a v1/v2 vault
235
+ * omits the field. Physically carried inside the vault ciphertext (the vault
236
+ * has no plaintext index).
237
+ */
238
+ readonly metadata?: JsonValue;
86
239
  /**
87
240
  * When this secret was added (ISO 8601).
88
241
  */
89
242
  readonly createdAt: string;
243
+ /**
244
+ * When this entry was last mutated (ISO 8601). Present only on `'keystore-v3'`
245
+ * vaults whose entry has been mutated since creation.
246
+ */
247
+ readonly updatedAt?: string;
90
248
  }
91
249
  /**
92
- * The decrypted vault contents - a versioned map of secrets.
250
+ * JSON-serializable representation of an asymmetric keypair entry.
251
+ * The private key is not present here — it lives in the
252
+ * {@link CryptoUtils.KeyStore.IPrivateKeyStorage} provider, addressed by `id`.
253
+ * @public
254
+ */
255
+ export interface IKeyStoreAsymmetricEntryJson {
256
+ /**
257
+ * Unique name for this entry.
258
+ */
259
+ readonly name: string;
260
+ /**
261
+ * Asymmetric secret type discriminator.
262
+ */
263
+ readonly type: KeyStoreAsymmetricSecretType;
264
+ /**
265
+ * Immutable handle used by {@link CryptoUtils.KeyStore.IPrivateKeyStorage} to address the
266
+ * private key.
267
+ */
268
+ readonly id: string;
269
+ /**
270
+ * Algorithm used to generate this keypair.
271
+ */
272
+ readonly algorithm: KeyPairAlgorithm;
273
+ /**
274
+ * The public key as a JSON Web Key.
275
+ */
276
+ readonly publicKeyJwk: JsonWebKey;
277
+ /**
278
+ * Optional escrowed copy of the private key, as a JSON Web Key. Present only
279
+ * on `'keystore-v2'` vaults whose entry was created with escrow enabled. A
280
+ * v1 vault omits the field; a v2 reader treats its absence as "no escrow".
281
+ */
282
+ readonly escrowedPrivateKeyJwk?: JsonWebKey;
283
+ /**
284
+ * Optional description.
285
+ */
286
+ readonly description?: string;
287
+ /**
288
+ * When this entry was added (ISO 8601).
289
+ */
290
+ readonly createdAt: string;
291
+ }
292
+ /**
293
+ * Any JSON vault entry, discriminated by `type`.
294
+ * @public
295
+ */
296
+ export type IKeyStoreEntryJson = IKeyStoreSymmetricEntryJson | IKeyStoreAsymmetricEntryJson;
297
+ /**
298
+ * Backwards-compatible alias for {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntryJson}.
299
+ * @deprecated Use {@link CryptoUtils.KeyStore.IKeyStoreSymmetricEntryJson} for
300
+ * symmetric entries or {@link CryptoUtils.KeyStore.IKeyStoreEntryJson} for the
301
+ * discriminated union.
302
+ * @public
303
+ */
304
+ export type IKeyStoreSecretEntryJson = IKeyStoreSymmetricEntryJson;
305
+ /**
306
+ * The decrypted vault contents - a versioned map of entries.
93
307
  * @public
94
308
  */
95
309
  export interface IKeyStoreVaultContents {
@@ -98,9 +312,9 @@ export interface IKeyStoreVaultContents {
98
312
  */
99
313
  readonly version: KeyStoreFormat;
100
314
  /**
101
- * Map of secret name to secret entry.
315
+ * Map of entry name to entry (symmetric or asymmetric).
102
316
  */
103
- readonly secrets: Record<string, IKeyStoreSecretEntryJson>;
317
+ readonly secrets: Record<string, IKeyStoreEntryJson>;
104
318
  }
105
319
  /**
106
320
  * The encrypted key store file format.
@@ -128,9 +342,9 @@ export interface IKeyStoreFile {
128
342
  */
129
343
  readonly encryptedData: string;
130
344
  /**
131
- * Key derivation parameters (required for key store - always password-derived).
345
+ * Key derivation parameters for the vault master key (always PBKDF2).
132
346
  */
133
- readonly keyDerivation: IKeyDerivationParams;
347
+ readonly keyDerivation: IPbkdf2KeyDerivationParams;
134
348
  }
135
349
  /**
136
350
  * Key store lock state.
@@ -150,6 +364,12 @@ export interface IKeyStoreCreateParams {
150
364
  * PBKDF2 iterations (defaults to DEFAULT_KEYSTORE_ITERATIONS).
151
365
  */
152
366
  readonly iterations?: number;
367
+ /**
368
+ * Optional private-key storage backend. Required to use `addKeyPair` /
369
+ * `getKeyPair`; absent backends still permit opening, listing, and reading
370
+ * public-key metadata for asymmetric entries.
371
+ */
372
+ readonly privateKeyStorage?: IPrivateKeyStorage;
153
373
  }
154
374
  /**
155
375
  * Parameters for opening an existing key store.
@@ -164,6 +384,12 @@ export interface IKeyStoreOpenParams {
164
384
  * The encrypted key store file content.
165
385
  */
166
386
  readonly keystoreFile: IKeyStoreFile;
387
+ /**
388
+ * Optional private-key storage backend. Required to use `addKeyPair` /
389
+ * `getKeyPair`; absent backends still permit opening, listing, and reading
390
+ * public-key metadata for asymmetric entries.
391
+ */
392
+ readonly privateKeyStorage?: IPrivateKeyStorage;
167
393
  }
168
394
  /**
169
395
  * Result of adding a secret to the key store.
@@ -173,11 +399,19 @@ export interface IAddSecretResult {
173
399
  /**
174
400
  * The secret entry that was added.
175
401
  */
176
- readonly entry: IKeyStoreSecretEntry;
402
+ readonly entry: IKeyStoreSymmetricEntry;
177
403
  /**
178
404
  * Whether this replaced an existing secret.
179
405
  */
180
406
  readonly replaced: boolean;
407
+ /**
408
+ * Best-effort warning from displaced-resource cleanup. Set when this call
409
+ * replaced an asymmetric-keypair entry but the corresponding
410
+ * {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete failed; the new
411
+ * entry is still committed and the orphaned blob is left for consumer-side
412
+ * GC to reconcile.
413
+ */
414
+ readonly warning?: string;
181
415
  }
182
416
  /**
183
417
  * Options for adding a secret.
@@ -199,6 +433,30 @@ export interface IImportSecretOptions extends IAddSecretOptions {
199
433
  */
200
434
  readonly replace?: boolean;
201
435
  }
436
+ /**
437
+ * Options for importing raw key material via {@link KeyStore.importSecret}.
438
+ * Extends {@link IImportSecretOptions} with a type classification.
439
+ * @public
440
+ */
441
+ export interface IImportKeyOptions extends IImportSecretOptions {
442
+ /**
443
+ * Symmetric secret type classification for the imported key material.
444
+ * @defaultValue 'encryption-key'
445
+ */
446
+ readonly type?: KeyStoreSymmetricSecretType;
447
+ }
448
+ /**
449
+ * Options for importing raw opaque bytes via {@link KeyStore.importSecretBytes}.
450
+ * Extends {@link IImportSecretOptions} with optional initial metadata.
451
+ * @public
452
+ */
453
+ export interface IImportSecretBytesOptions extends IImportSecretOptions {
454
+ /**
455
+ * Optional initial mutable metadata to store with the entry. Can also be set
456
+ * or replaced later via {@link KeyStore.setSecretMetadata}.
457
+ */
458
+ readonly metadata?: JsonValue;
459
+ }
202
460
  /**
203
461
  * Options for adding a secret derived from a password.
204
462
  * @public
@@ -234,6 +492,131 @@ export interface IAddSecretFromPasswordResult extends IAddSecretResult {
234
492
  */
235
493
  readonly keyDerivation: IKeyDerivationParams;
236
494
  }
495
+ /**
496
+ * Options for adding an Argon2id password-derived secret.
497
+ * @public
498
+ */
499
+ export interface IAddSecretFromPasswordArgon2idOptions {
500
+ /**
501
+ * Argon2id parameters. Defaults to {@link CryptoUtils.ARGON2ID_OWASP_MIN}.
502
+ */
503
+ readonly params?: IArgon2idParams;
504
+ /**
505
+ * Optional description for the secret.
506
+ */
507
+ readonly description?: string;
508
+ /**
509
+ * Whether to replace an existing secret with the same name.
510
+ */
511
+ readonly replace?: boolean;
512
+ }
513
+ /**
514
+ * Options for adding an asymmetric keypair to the key store.
515
+ * @public
516
+ */
517
+ export interface IAddKeyPairOptions {
518
+ /**
519
+ * Algorithm to use for the new keypair.
520
+ */
521
+ readonly algorithm: KeyPairAlgorithm;
522
+ /**
523
+ * Optional description for the entry.
524
+ */
525
+ readonly description?: string;
526
+ /**
527
+ * Whether to replace an existing entry with the same name.
528
+ * Replacement mints a fresh storage `id` and best-effort deletes the
529
+ * displaced storage blob; see the keystore design doc for details.
530
+ */
531
+ readonly replace?: boolean;
532
+ /**
533
+ * Overrides the storage-backend-derived extractability for this key only.
534
+ * Omit to keep the default (`!privateKeyStorage.supportsNonExtractable`).
535
+ * A value the backend cannot honor fails loudly rather than silently
536
+ * downgrading.
537
+ */
538
+ readonly extractable?: boolean;
539
+ /**
540
+ * Opt in to private-key escrow. When `true`, an encrypted copy of the
541
+ * private key (as a JWK) is carried inside the vault entry
542
+ * (`escrowedPrivateKeyJwk`), enabling cross-device recovery from the vault
543
+ * file plus the master password alone via
544
+ * `getKeyPair(name, { rehydrate: true })`.
545
+ *
546
+ * Orthogonal to `extractable`: the escrow copy is always captured (the
547
+ * transient keypair is generated extractable so it can be exported to JWK),
548
+ * while the LIVE stored key's extractability still follows the normal rule
549
+ * (`extractable` override, else the backend default). So escrow does not
550
+ * change how extractable the day-to-day key is — only whether a recovery
551
+ * copy is retained in the vault.
552
+ *
553
+ * @defaultValue false — no escrow copy is written (today's behavior).
554
+ *
555
+ * SECURITY: escrow makes the master password the sole gate protecting a
556
+ * private key that would otherwise be unrecoverable from the vault. Use a
557
+ * strong KDF (Argon2id-derived or high-iteration PBKDF2) for escrow-bearing
558
+ * stores. See the {@link CryptoUtils.KeyStore.KeyStore} class docs.
559
+ */
560
+ readonly escrow?: boolean;
561
+ }
562
+ /**
563
+ * Options for retrieving an asymmetric keypair via {@link CryptoUtils.KeyStore.KeyStore.getKeyPair}.
564
+ * @public
565
+ */
566
+ export interface IGetKeyPairOptions {
567
+ /**
568
+ * Opt in to escrow rehydration. When `true` AND no private-key blob exists
569
+ * under the entry's storage `id` AND the entry carries an
570
+ * `escrowedPrivateKeyJwk`, the escrowed JWK is imported (non-extractable
571
+ * where the backend supports it) and stored under the entry's `id` before
572
+ * being returned — filling a gap on a fresh device from the recovered vault.
573
+ *
574
+ * Fill-a-gap only: an existing storage blob is never overwritten. When a
575
+ * blob is present it is loaded as usual and the escrow copy is ignored.
576
+ *
577
+ * @defaultValue false — today's behavior: load from storage or fail.
578
+ */
579
+ readonly rehydrate?: boolean;
580
+ }
581
+ /**
582
+ * Result of adding an asymmetric keypair to the key store.
583
+ * @public
584
+ */
585
+ export interface IAddKeyPairResult {
586
+ /**
587
+ * The asymmetric entry that was added.
588
+ */
589
+ readonly entry: IKeyStoreAsymmetricEntry;
590
+ /**
591
+ * Whether this replaced an existing entry.
592
+ */
593
+ readonly replaced: boolean;
594
+ /**
595
+ * Best-effort warning from displaced-resource cleanup. Set when this call
596
+ * replaced a prior entry but the corresponding
597
+ * {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete failed; the new
598
+ * keypair is still committed and the orphaned blob is left for consumer-side
599
+ * GC to reconcile.
600
+ */
601
+ readonly warning?: string;
602
+ }
603
+ /**
604
+ * Result of removing a secret from the key store.
605
+ * @public
606
+ */
607
+ export interface IRemoveSecretResult {
608
+ /**
609
+ * The secret entry that was removed from the vault.
610
+ */
611
+ readonly entry: IKeyStoreEntry;
612
+ /**
613
+ * Best-effort warning from {@link CryptoUtils.KeyStore.IPrivateKeyStorage}.delete
614
+ * for asymmetric entries when the storage call failed. The vault entry is
615
+ * still considered removed and the orphaned blob is left for consumer-side
616
+ * GC to reconcile.
617
+ */
618
+ readonly warning?: string;
619
+ }
237
620
  /**
238
621
  * Checks if a JSON object appears to be a key store file.
239
622
  * Uses the format field as a discriminator.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/packlets/crypto-utils/keystore/model.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,cAAc,CAI5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAA8B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAe,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAW,CAAC;AAM1C;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,aAAa,CAAC,2BAA2B,CAItF,CAA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AC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAE/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAMrD"}
@@ -19,13 +19,26 @@
19
19
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
20
  // SOFTWARE.
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.DEFAULT_SECRET_ITERATIONS = exports.allKeyStoreSecretTypes = exports.MIN_SALT_LENGTH = exports.DEFAULT_KEYSTORE_ITERATIONS = exports.KEYSTORE_FORMAT = void 0;
22
+ exports.DEFAULT_SECRET_ITERATIONS = exports.allKeyStoreSecretTypes = exports.allKeyStoreAsymmetricSecretTypes = exports.allKeyStoreSymmetricSecretTypes = exports.MIN_SALT_LENGTH = exports.DEFAULT_KEYSTORE_ITERATIONS = exports.KEYSTORE_FORMAT = exports.allKeyStoreFormats = exports.allKeyPairAlgorithms = void 0;
23
23
  exports.isKeyStoreFile = isKeyStoreFile;
24
+ // Re-export so consumers can continue to access the algorithm enum via the
25
+ // CryptoUtils.KeyStore namespace alongside the rest of the keystore types.
26
+ var model_1 = require("../model");
27
+ Object.defineProperty(exports, "allKeyPairAlgorithms", { enumerable: true, get: function () { return model_1.allKeyPairAlgorithms; } });
24
28
  /**
25
- * Current format version constant.
29
+ * All recognized key store format versions (readable by the current library).
26
30
  * @public
27
31
  */
28
- exports.KEYSTORE_FORMAT = 'keystore-v1';
32
+ exports.allKeyStoreFormats = [
33
+ 'keystore-v1',
34
+ 'keystore-v2',
35
+ 'keystore-v3'
36
+ ];
37
+ /**
38
+ * Current format version constant. New vaults are written as `'keystore-v3'`.
39
+ * @public
40
+ */
41
+ exports.KEYSTORE_FORMAT = 'keystore-v3';
29
42
  /**
30
43
  * Default PBKDF2 iterations for key store encryption.
31
44
  * Higher than regular files since this protects the master key vault.
@@ -37,11 +50,30 @@ exports.DEFAULT_KEYSTORE_ITERATIONS = 600000;
37
50
  * @public
38
51
  */
39
52
  exports.MIN_SALT_LENGTH = 16;
53
+ /**
54
+ * All valid symmetric secret types.
55
+ * @public
56
+ */
57
+ exports.allKeyStoreSymmetricSecretTypes = [
58
+ 'encryption-key',
59
+ 'api-key',
60
+ 'opaque'
61
+ ];
62
+ /**
63
+ * All valid asymmetric secret types.
64
+ * @public
65
+ */
66
+ exports.allKeyStoreAsymmetricSecretTypes = [
67
+ 'asymmetric-keypair'
68
+ ];
40
69
  /**
41
70
  * All valid key store secret types.
42
71
  * @public
43
72
  */
44
- exports.allKeyStoreSecretTypes = ['encryption-key', 'api-key'];
73
+ exports.allKeyStoreSecretTypes = [
74
+ ...exports.allKeyStoreAsymmetricSecretTypes,
75
+ ...exports.allKeyStoreSymmetricSecretTypes
76
+ ];
45
77
  /**
46
78
  * Default PBKDF2 iterations for secret-level key derivation.
47
79
  * Lower than keystore encryption since these are used more frequently.
@@ -63,6 +95,6 @@ function isKeyStoreFile(json) {
63
95
  return false;
64
96
  }
65
97
  const obj = json;
66
- return obj.format === exports.KEYSTORE_FORMAT;
98
+ return typeof obj.format === 'string' && exports.allKeyStoreFormats.includes(obj.format);
67
99
  }
68
100
  //# sourceMappingURL=model.js.map