@naylence/advanced-security 0.3.7-test.112 → 0.3.7-test.114

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 (421) hide show
  1. package/package.json +1 -1
  2. package/dist/browser/index.cjs +0 -9864
  3. package/dist/browser/index.mjs +0 -9811
  4. package/dist/cjs/advanced-security-isomorphic.js +0 -82
  5. package/dist/cjs/advanced-security-isomorphic.js.map +0 -1
  6. package/dist/cjs/browser.js +0 -25
  7. package/dist/cjs/browser.js.map +0 -1
  8. package/dist/cjs/index.js +0 -2
  9. package/dist/cjs/index.js.map +0 -1
  10. package/dist/cjs/install-env.js +0 -2
  11. package/dist/cjs/install-env.js.map +0 -1
  12. package/dist/cjs/naylence/fame/factory-manifest.js +0 -39
  13. package/dist/cjs/naylence/fame/factory-manifest.js.map +0 -1
  14. package/dist/cjs/naylence/fame/security/cert/browser-csr.js +0 -103
  15. package/dist/cjs/naylence/fame/security/cert/browser-csr.js.map +0 -1
  16. package/dist/cjs/naylence/fame/security/cert/ca-server-cli.js +0 -30
  17. package/dist/cjs/naylence/fame/security/cert/ca-server-cli.js.map +0 -1
  18. package/dist/cjs/naylence/fame/security/cert/ca-server.js +0 -223
  19. package/dist/cjs/naylence/fame/security/cert/ca-server.js.map +0 -1
  20. package/dist/cjs/naylence/fame/security/cert/ca-service-client.js +0 -585
  21. package/dist/cjs/naylence/fame/security/cert/ca-service-client.js.map +0 -1
  22. package/dist/cjs/naylence/fame/security/cert/ca-service-factory.js +0 -61
  23. package/dist/cjs/naylence/fame/security/cert/ca-service-factory.js.map +0 -1
  24. package/dist/cjs/naylence/fame/security/cert/ca-types.js +0 -39
  25. package/dist/cjs/naylence/fame/security/cert/ca-types.js.map +0 -1
  26. package/dist/cjs/naylence/fame/security/cert/csr-types.js +0 -2
  27. package/dist/cjs/naylence/fame/security/cert/csr-types.js.map +0 -1
  28. package/dist/cjs/naylence/fame/security/cert/default-ca-service-factory.js +0 -66
  29. package/dist/cjs/naylence/fame/security/cert/default-ca-service-factory.js.map +0 -1
  30. package/dist/cjs/naylence/fame/security/cert/default-ca-service.js +0 -364
  31. package/dist/cjs/naylence/fame/security/cert/default-ca-service.js.map +0 -1
  32. package/dist/cjs/naylence/fame/security/cert/default-certificate-manager-factory.js +0 -73
  33. package/dist/cjs/naylence/fame/security/cert/default-certificate-manager-factory.js.map +0 -1
  34. package/dist/cjs/naylence/fame/security/cert/default-certificate-manager.js +0 -815
  35. package/dist/cjs/naylence/fame/security/cert/default-certificate-manager.js.map +0 -1
  36. package/dist/cjs/naylence/fame/security/cert/grants.js +0 -2
  37. package/dist/cjs/naylence/fame/security/cert/grants.js.map +0 -1
  38. package/dist/cjs/naylence/fame/security/cert/index.js +0 -18
  39. package/dist/cjs/naylence/fame/security/cert/index.js.map +0 -1
  40. package/dist/cjs/naylence/fame/security/cert/internal-ca-service.js +0 -741
  41. package/dist/cjs/naylence/fame/security/cert/internal-ca-service.js.map +0 -1
  42. package/dist/cjs/naylence/fame/security/cert/node-ed25519-csr.js +0 -156
  43. package/dist/cjs/naylence/fame/security/cert/node-ed25519-csr.js.map +0 -1
  44. package/dist/cjs/naylence/fame/security/cert/oid-constants.js +0 -7
  45. package/dist/cjs/naylence/fame/security/cert/oid-constants.js.map +0 -1
  46. package/dist/cjs/naylence/fame/security/cert/trust-store/anchor-utils.js +0 -119
  47. package/dist/cjs/naylence/fame/security/cert/trust-store/anchor-utils.js.map +0 -1
  48. package/dist/cjs/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js +0 -82
  49. package/dist/cjs/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js.map +0 -1
  50. package/dist/cjs/naylence/fame/security/cert/trust-store/env-provider.js +0 -168
  51. package/dist/cjs/naylence/fame/security/cert/trust-store/env-provider.js.map +0 -1
  52. package/dist/cjs/naylence/fame/security/cert/trust-store/fame-ca-certs-parser.js +0 -257
  53. package/dist/cjs/naylence/fame/security/cert/trust-store/fame-ca-certs-parser.js.map +0 -1
  54. package/dist/cjs/naylence/fame/security/cert/trust-store/http-bundle-provider.js +0 -497
  55. package/dist/cjs/naylence/fame/security/cert/trust-store/http-bundle-provider.js.map +0 -1
  56. package/dist/cjs/naylence/fame/security/cert/trust-store/http-signed-bundle-provider.js +0 -2
  57. package/dist/cjs/naylence/fame/security/cert/trust-store/http-signed-bundle-provider.js.map +0 -1
  58. package/dist/cjs/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js +0 -61
  59. package/dist/cjs/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js.map +0 -1
  60. package/dist/cjs/naylence/fame/security/cert/trust-store/static-bundle-provider.js +0 -44
  61. package/dist/cjs/naylence/fame/security/cert/trust-store/static-bundle-provider.js.map +0 -1
  62. package/dist/cjs/naylence/fame/security/cert/trust-store/trust-store-provider-factory.js +0 -40
  63. package/dist/cjs/naylence/fame/security/cert/trust-store/trust-store-provider-factory.js.map +0 -1
  64. package/dist/cjs/naylence/fame/security/cert/trust-store/trust-store-provider.js +0 -2
  65. package/dist/cjs/naylence/fame/security/cert/trust-store/trust-store-provider.js.map +0 -1
  66. package/dist/cjs/naylence/fame/security/cert/util.js +0 -515
  67. package/dist/cjs/naylence/fame/security/cert/util.js.map +0 -1
  68. package/dist/cjs/naylence/fame/security/encryption/channel/channel-encryption-manager-factory.js +0 -85
  69. package/dist/cjs/naylence/fame/security/encryption/channel/channel-encryption-manager-factory.js.map +0 -1
  70. package/dist/cjs/naylence/fame/security/encryption/channel/channel-encryption-manager.js +0 -743
  71. package/dist/cjs/naylence/fame/security/encryption/channel/channel-encryption-manager.js.map +0 -1
  72. package/dist/cjs/naylence/fame/security/encryption/channel/index.js +0 -3
  73. package/dist/cjs/naylence/fame/security/encryption/channel/index.js.map +0 -1
  74. package/dist/cjs/naylence/fame/security/encryption/composite-encryption-manager-factory.js +0 -113
  75. package/dist/cjs/naylence/fame/security/encryption/composite-encryption-manager-factory.js.map +0 -1
  76. package/dist/cjs/naylence/fame/security/encryption/composite-encryption-manager.js +0 -321
  77. package/dist/cjs/naylence/fame/security/encryption/composite-encryption-manager.js.map +0 -1
  78. package/dist/cjs/naylence/fame/security/encryption/default-secure-channel-manager-factory.js +0 -53
  79. package/dist/cjs/naylence/fame/security/encryption/default-secure-channel-manager-factory.js.map +0 -1
  80. package/dist/cjs/naylence/fame/security/encryption/default-secure-channel-manager.js +0 -278
  81. package/dist/cjs/naylence/fame/security/encryption/default-secure-channel-manager.js.map +0 -1
  82. package/dist/cjs/naylence/fame/security/encryption/encryption-manager-registry.js +0 -167
  83. package/dist/cjs/naylence/fame/security/encryption/encryption-manager-registry.js.map +0 -1
  84. package/dist/cjs/naylence/fame/security/encryption/index.js +0 -7
  85. package/dist/cjs/naylence/fame/security/encryption/index.js.map +0 -1
  86. package/dist/cjs/naylence/fame/security/encryption/sealed/index.js +0 -3
  87. package/dist/cjs/naylence/fame/security/encryption/sealed/index.js.map +0 -1
  88. package/dist/cjs/naylence/fame/security/encryption/sealed/x25519-encryption-manager-factory.js +0 -82
  89. package/dist/cjs/naylence/fame/security/encryption/sealed/x25519-encryption-manager-factory.js.map +0 -1
  90. package/dist/cjs/naylence/fame/security/encryption/sealed/x25519-encryption-manager.js +0 -542
  91. package/dist/cjs/naylence/fame/security/encryption/sealed/x25519-encryption-manager.js.map +0 -1
  92. package/dist/cjs/naylence/fame/security/index.js +0 -6
  93. package/dist/cjs/naylence/fame/security/index.js.map +0 -1
  94. package/dist/cjs/naylence/fame/security/keys/index.js +0 -3
  95. package/dist/cjs/naylence/fame/security/keys/index.js.map +0 -1
  96. package/dist/cjs/naylence/fame/security/keys/x5c-key-manager-factory.js +0 -36
  97. package/dist/cjs/naylence/fame/security/keys/x5c-key-manager-factory.js.map +0 -1
  98. package/dist/cjs/naylence/fame/security/keys/x5c-key-manager.js +0 -405
  99. package/dist/cjs/naylence/fame/security/keys/x5c-key-manager.js.map +0 -1
  100. package/dist/cjs/naylence/fame/security/register-advanced-security-factories.js +0 -283
  101. package/dist/cjs/naylence/fame/security/register-advanced-security-factories.js.map +0 -1
  102. package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-signer-factory.js +0 -34
  103. package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-signer-factory.js.map +0 -1
  104. package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js +0 -33
  105. package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js.map +0 -1
  106. package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-verifier.js +0 -189
  107. package/dist/cjs/naylence/fame/security/signing/eddsa-envelope-verifier.js.map +0 -1
  108. package/dist/cjs/naylence/fame/stickiness/aft-helper.js +0 -72
  109. package/dist/cjs/naylence/fame/stickiness/aft-helper.js.map +0 -1
  110. package/dist/cjs/naylence/fame/stickiness/aft-load-balancer-stickiness-manager-factory.js +0 -65
  111. package/dist/cjs/naylence/fame/stickiness/aft-load-balancer-stickiness-manager-factory.js.map +0 -1
  112. package/dist/cjs/naylence/fame/stickiness/aft-load-balancer-stickiness-manager.js +0 -447
  113. package/dist/cjs/naylence/fame/stickiness/aft-load-balancer-stickiness-manager.js.map +0 -1
  114. package/dist/cjs/naylence/fame/stickiness/aft-model.js +0 -54
  115. package/dist/cjs/naylence/fame/stickiness/aft-model.js.map +0 -1
  116. package/dist/cjs/naylence/fame/stickiness/aft-replica-stickiness-manager-factory.js +0 -50
  117. package/dist/cjs/naylence/fame/stickiness/aft-replica-stickiness-manager-factory.js.map +0 -1
  118. package/dist/cjs/naylence/fame/stickiness/aft-replica-stickiness-manager.js +0 -203
  119. package/dist/cjs/naylence/fame/stickiness/aft-replica-stickiness-manager.js.map +0 -1
  120. package/dist/cjs/naylence/fame/stickiness/aft-signer.js +0 -147
  121. package/dist/cjs/naylence/fame/stickiness/aft-signer.js.map +0 -1
  122. package/dist/cjs/naylence/fame/stickiness/aft-utils.js +0 -90
  123. package/dist/cjs/naylence/fame/stickiness/aft-utils.js.map +0 -1
  124. package/dist/cjs/naylence/fame/stickiness/aft-verifier.js +0 -290
  125. package/dist/cjs/naylence/fame/stickiness/aft-verifier.js.map +0 -1
  126. package/dist/cjs/naylence/fame/stickiness/index.js +0 -11
  127. package/dist/cjs/naylence/fame/stickiness/index.js.map +0 -1
  128. package/dist/cjs/naylence/fame/stickiness/stickiness-mode.js +0 -24
  129. package/dist/cjs/naylence/fame/stickiness/stickiness-mode.js.map +0 -1
  130. package/dist/cjs/naylence/fame/welcome/advanced-welcome-service-factory.js +0 -93
  131. package/dist/cjs/naylence/fame/welcome/advanced-welcome-service-factory.js.map +0 -1
  132. package/dist/cjs/naylence/fame/welcome/advanced-welcome-service.js +0 -212
  133. package/dist/cjs/naylence/fame/welcome/advanced-welcome-service.js.map +0 -1
  134. package/dist/cjs/naylence/fame/welcome/index.js +0 -3
  135. package/dist/cjs/naylence/fame/welcome/index.js.map +0 -1
  136. package/dist/cjs/node.js +0 -11
  137. package/dist/cjs/node.js.map +0 -1
  138. package/dist/cjs/plugin.js +0 -39
  139. package/dist/cjs/plugin.js.map +0 -1
  140. package/dist/cjs/version.js +0 -8
  141. package/dist/cjs/version.js.map +0 -1
  142. package/dist/esm/advanced-security-isomorphic.js +0 -82
  143. package/dist/esm/advanced-security-isomorphic.js.map +0 -1
  144. package/dist/esm/browser.js +0 -25
  145. package/dist/esm/browser.js.map +0 -1
  146. package/dist/esm/index.js +0 -2
  147. package/dist/esm/index.js.map +0 -1
  148. package/dist/esm/install-env.js +0 -2
  149. package/dist/esm/install-env.js.map +0 -1
  150. package/dist/esm/naylence/fame/factory-manifest.js +0 -39
  151. package/dist/esm/naylence/fame/factory-manifest.js.map +0 -1
  152. package/dist/esm/naylence/fame/security/cert/browser-csr.js +0 -103
  153. package/dist/esm/naylence/fame/security/cert/browser-csr.js.map +0 -1
  154. package/dist/esm/naylence/fame/security/cert/ca-server-cli.js +0 -30
  155. package/dist/esm/naylence/fame/security/cert/ca-server-cli.js.map +0 -1
  156. package/dist/esm/naylence/fame/security/cert/ca-server.js +0 -223
  157. package/dist/esm/naylence/fame/security/cert/ca-server.js.map +0 -1
  158. package/dist/esm/naylence/fame/security/cert/ca-service-client.js +0 -585
  159. package/dist/esm/naylence/fame/security/cert/ca-service-client.js.map +0 -1
  160. package/dist/esm/naylence/fame/security/cert/ca-service-factory.js +0 -61
  161. package/dist/esm/naylence/fame/security/cert/ca-service-factory.js.map +0 -1
  162. package/dist/esm/naylence/fame/security/cert/ca-types.js +0 -39
  163. package/dist/esm/naylence/fame/security/cert/ca-types.js.map +0 -1
  164. package/dist/esm/naylence/fame/security/cert/csr-types.js +0 -2
  165. package/dist/esm/naylence/fame/security/cert/csr-types.js.map +0 -1
  166. package/dist/esm/naylence/fame/security/cert/default-ca-service-factory.js +0 -66
  167. package/dist/esm/naylence/fame/security/cert/default-ca-service-factory.js.map +0 -1
  168. package/dist/esm/naylence/fame/security/cert/default-ca-service.js +0 -364
  169. package/dist/esm/naylence/fame/security/cert/default-ca-service.js.map +0 -1
  170. package/dist/esm/naylence/fame/security/cert/default-certificate-manager-factory.js +0 -73
  171. package/dist/esm/naylence/fame/security/cert/default-certificate-manager-factory.js.map +0 -1
  172. package/dist/esm/naylence/fame/security/cert/default-certificate-manager.js +0 -815
  173. package/dist/esm/naylence/fame/security/cert/default-certificate-manager.js.map +0 -1
  174. package/dist/esm/naylence/fame/security/cert/grants.js +0 -2
  175. package/dist/esm/naylence/fame/security/cert/grants.js.map +0 -1
  176. package/dist/esm/naylence/fame/security/cert/index.js +0 -18
  177. package/dist/esm/naylence/fame/security/cert/index.js.map +0 -1
  178. package/dist/esm/naylence/fame/security/cert/internal-ca-service.js +0 -741
  179. package/dist/esm/naylence/fame/security/cert/internal-ca-service.js.map +0 -1
  180. package/dist/esm/naylence/fame/security/cert/node-ed25519-csr.js +0 -156
  181. package/dist/esm/naylence/fame/security/cert/node-ed25519-csr.js.map +0 -1
  182. package/dist/esm/naylence/fame/security/cert/oid-constants.js +0 -7
  183. package/dist/esm/naylence/fame/security/cert/oid-constants.js.map +0 -1
  184. package/dist/esm/naylence/fame/security/cert/trust-store/anchor-utils.js +0 -119
  185. package/dist/esm/naylence/fame/security/cert/trust-store/anchor-utils.js.map +0 -1
  186. package/dist/esm/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js +0 -82
  187. package/dist/esm/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.js.map +0 -1
  188. package/dist/esm/naylence/fame/security/cert/trust-store/env-provider.js +0 -168
  189. package/dist/esm/naylence/fame/security/cert/trust-store/env-provider.js.map +0 -1
  190. package/dist/esm/naylence/fame/security/cert/trust-store/fame-ca-certs-parser.js +0 -257
  191. package/dist/esm/naylence/fame/security/cert/trust-store/fame-ca-certs-parser.js.map +0 -1
  192. package/dist/esm/naylence/fame/security/cert/trust-store/http-bundle-provider.js +0 -497
  193. package/dist/esm/naylence/fame/security/cert/trust-store/http-bundle-provider.js.map +0 -1
  194. package/dist/esm/naylence/fame/security/cert/trust-store/http-signed-bundle-provider.js +0 -2
  195. package/dist/esm/naylence/fame/security/cert/trust-store/http-signed-bundle-provider.js.map +0 -1
  196. package/dist/esm/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js +0 -61
  197. package/dist/esm/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.js.map +0 -1
  198. package/dist/esm/naylence/fame/security/cert/trust-store/static-bundle-provider.js +0 -44
  199. package/dist/esm/naylence/fame/security/cert/trust-store/static-bundle-provider.js.map +0 -1
  200. package/dist/esm/naylence/fame/security/cert/trust-store/trust-store-provider-factory.js +0 -40
  201. package/dist/esm/naylence/fame/security/cert/trust-store/trust-store-provider-factory.js.map +0 -1
  202. package/dist/esm/naylence/fame/security/cert/trust-store/trust-store-provider.js +0 -2
  203. package/dist/esm/naylence/fame/security/cert/trust-store/trust-store-provider.js.map +0 -1
  204. package/dist/esm/naylence/fame/security/cert/util.js +0 -515
  205. package/dist/esm/naylence/fame/security/cert/util.js.map +0 -1
  206. package/dist/esm/naylence/fame/security/encryption/channel/channel-encryption-manager-factory.js +0 -85
  207. package/dist/esm/naylence/fame/security/encryption/channel/channel-encryption-manager-factory.js.map +0 -1
  208. package/dist/esm/naylence/fame/security/encryption/channel/channel-encryption-manager.js +0 -743
  209. package/dist/esm/naylence/fame/security/encryption/channel/channel-encryption-manager.js.map +0 -1
  210. package/dist/esm/naylence/fame/security/encryption/channel/index.js +0 -3
  211. package/dist/esm/naylence/fame/security/encryption/channel/index.js.map +0 -1
  212. package/dist/esm/naylence/fame/security/encryption/composite-encryption-manager-factory.js +0 -113
  213. package/dist/esm/naylence/fame/security/encryption/composite-encryption-manager-factory.js.map +0 -1
  214. package/dist/esm/naylence/fame/security/encryption/composite-encryption-manager.js +0 -321
  215. package/dist/esm/naylence/fame/security/encryption/composite-encryption-manager.js.map +0 -1
  216. package/dist/esm/naylence/fame/security/encryption/default-secure-channel-manager-factory.js +0 -53
  217. package/dist/esm/naylence/fame/security/encryption/default-secure-channel-manager-factory.js.map +0 -1
  218. package/dist/esm/naylence/fame/security/encryption/default-secure-channel-manager.js +0 -278
  219. package/dist/esm/naylence/fame/security/encryption/default-secure-channel-manager.js.map +0 -1
  220. package/dist/esm/naylence/fame/security/encryption/encryption-manager-registry.js +0 -167
  221. package/dist/esm/naylence/fame/security/encryption/encryption-manager-registry.js.map +0 -1
  222. package/dist/esm/naylence/fame/security/encryption/index.js +0 -7
  223. package/dist/esm/naylence/fame/security/encryption/index.js.map +0 -1
  224. package/dist/esm/naylence/fame/security/encryption/sealed/index.js +0 -3
  225. package/dist/esm/naylence/fame/security/encryption/sealed/index.js.map +0 -1
  226. package/dist/esm/naylence/fame/security/encryption/sealed/x25519-encryption-manager-factory.js +0 -82
  227. package/dist/esm/naylence/fame/security/encryption/sealed/x25519-encryption-manager-factory.js.map +0 -1
  228. package/dist/esm/naylence/fame/security/encryption/sealed/x25519-encryption-manager.js +0 -542
  229. package/dist/esm/naylence/fame/security/encryption/sealed/x25519-encryption-manager.js.map +0 -1
  230. package/dist/esm/naylence/fame/security/index.js +0 -6
  231. package/dist/esm/naylence/fame/security/index.js.map +0 -1
  232. package/dist/esm/naylence/fame/security/keys/index.js +0 -3
  233. package/dist/esm/naylence/fame/security/keys/index.js.map +0 -1
  234. package/dist/esm/naylence/fame/security/keys/x5c-key-manager-factory.js +0 -36
  235. package/dist/esm/naylence/fame/security/keys/x5c-key-manager-factory.js.map +0 -1
  236. package/dist/esm/naylence/fame/security/keys/x5c-key-manager.js +0 -405
  237. package/dist/esm/naylence/fame/security/keys/x5c-key-manager.js.map +0 -1
  238. package/dist/esm/naylence/fame/security/register-advanced-security-factories.js +0 -283
  239. package/dist/esm/naylence/fame/security/register-advanced-security-factories.js.map +0 -1
  240. package/dist/esm/naylence/fame/security/signing/eddsa-envelope-signer-factory.js +0 -34
  241. package/dist/esm/naylence/fame/security/signing/eddsa-envelope-signer-factory.js.map +0 -1
  242. package/dist/esm/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js +0 -33
  243. package/dist/esm/naylence/fame/security/signing/eddsa-envelope-verifier-factory.js.map +0 -1
  244. package/dist/esm/naylence/fame/security/signing/eddsa-envelope-verifier.js +0 -189
  245. package/dist/esm/naylence/fame/security/signing/eddsa-envelope-verifier.js.map +0 -1
  246. package/dist/esm/naylence/fame/stickiness/aft-helper.js +0 -72
  247. package/dist/esm/naylence/fame/stickiness/aft-helper.js.map +0 -1
  248. package/dist/esm/naylence/fame/stickiness/aft-load-balancer-stickiness-manager-factory.js +0 -65
  249. package/dist/esm/naylence/fame/stickiness/aft-load-balancer-stickiness-manager-factory.js.map +0 -1
  250. package/dist/esm/naylence/fame/stickiness/aft-load-balancer-stickiness-manager.js +0 -447
  251. package/dist/esm/naylence/fame/stickiness/aft-load-balancer-stickiness-manager.js.map +0 -1
  252. package/dist/esm/naylence/fame/stickiness/aft-model.js +0 -54
  253. package/dist/esm/naylence/fame/stickiness/aft-model.js.map +0 -1
  254. package/dist/esm/naylence/fame/stickiness/aft-replica-stickiness-manager-factory.js +0 -50
  255. package/dist/esm/naylence/fame/stickiness/aft-replica-stickiness-manager-factory.js.map +0 -1
  256. package/dist/esm/naylence/fame/stickiness/aft-replica-stickiness-manager.js +0 -203
  257. package/dist/esm/naylence/fame/stickiness/aft-replica-stickiness-manager.js.map +0 -1
  258. package/dist/esm/naylence/fame/stickiness/aft-signer.js +0 -147
  259. package/dist/esm/naylence/fame/stickiness/aft-signer.js.map +0 -1
  260. package/dist/esm/naylence/fame/stickiness/aft-utils.js +0 -90
  261. package/dist/esm/naylence/fame/stickiness/aft-utils.js.map +0 -1
  262. package/dist/esm/naylence/fame/stickiness/aft-verifier.js +0 -290
  263. package/dist/esm/naylence/fame/stickiness/aft-verifier.js.map +0 -1
  264. package/dist/esm/naylence/fame/stickiness/index.js +0 -11
  265. package/dist/esm/naylence/fame/stickiness/index.js.map +0 -1
  266. package/dist/esm/naylence/fame/stickiness/stickiness-mode.js +0 -24
  267. package/dist/esm/naylence/fame/stickiness/stickiness-mode.js.map +0 -1
  268. package/dist/esm/naylence/fame/welcome/advanced-welcome-service-factory.js +0 -93
  269. package/dist/esm/naylence/fame/welcome/advanced-welcome-service-factory.js.map +0 -1
  270. package/dist/esm/naylence/fame/welcome/advanced-welcome-service.js +0 -212
  271. package/dist/esm/naylence/fame/welcome/advanced-welcome-service.js.map +0 -1
  272. package/dist/esm/naylence/fame/welcome/index.js +0 -3
  273. package/dist/esm/naylence/fame/welcome/index.js.map +0 -1
  274. package/dist/esm/node.js +0 -11
  275. package/dist/esm/node.js.map +0 -1
  276. package/dist/esm/plugin.js +0 -39
  277. package/dist/esm/plugin.js.map +0 -1
  278. package/dist/esm/version.js +0 -8
  279. package/dist/esm/version.js.map +0 -1
  280. package/dist/node/index.cjs +0 -9855
  281. package/dist/node/index.mjs +0 -9800
  282. package/dist/node/node.cjs +0 -10139
  283. package/dist/node/node.mjs +0 -10046
  284. package/dist/types/advanced-security-isomorphic.d.ts +0 -24
  285. package/dist/types/advanced-security-isomorphic.d.ts.map +0 -1
  286. package/dist/types/browser.d.ts +0 -19
  287. package/dist/types/browser.d.ts.map +0 -1
  288. package/dist/types/index.d.ts +0 -2
  289. package/dist/types/index.d.ts.map +0 -1
  290. package/dist/types/install-env.d.ts +0 -3
  291. package/dist/types/install-env.d.ts.map +0 -1
  292. package/dist/types/naylence/fame/factory-manifest.d.ts +0 -11
  293. package/dist/types/naylence/fame/factory-manifest.d.ts.map +0 -1
  294. package/dist/types/naylence/fame/security/cert/browser-csr.d.ts +0 -9
  295. package/dist/types/naylence/fame/security/cert/browser-csr.d.ts.map +0 -1
  296. package/dist/types/naylence/fame/security/cert/ca-server-cli.d.ts +0 -3
  297. package/dist/types/naylence/fame/security/cert/ca-server-cli.d.ts.map +0 -1
  298. package/dist/types/naylence/fame/security/cert/ca-server.d.ts +0 -19
  299. package/dist/types/naylence/fame/security/cert/ca-server.d.ts.map +0 -1
  300. package/dist/types/naylence/fame/security/cert/ca-service-client.d.ts +0 -75
  301. package/dist/types/naylence/fame/security/cert/ca-service-client.d.ts.map +0 -1
  302. package/dist/types/naylence/fame/security/cert/ca-service-factory.d.ts +0 -43
  303. package/dist/types/naylence/fame/security/cert/ca-service-factory.d.ts.map +0 -1
  304. package/dist/types/naylence/fame/security/cert/ca-types.d.ts +0 -129
  305. package/dist/types/naylence/fame/security/cert/ca-types.d.ts.map +0 -1
  306. package/dist/types/naylence/fame/security/cert/csr-types.d.ts +0 -5
  307. package/dist/types/naylence/fame/security/cert/csr-types.d.ts.map +0 -1
  308. package/dist/types/naylence/fame/security/cert/default-ca-service-factory.d.ts +0 -55
  309. package/dist/types/naylence/fame/security/cert/default-ca-service-factory.d.ts.map +0 -1
  310. package/dist/types/naylence/fame/security/cert/default-ca-service.d.ts +0 -85
  311. package/dist/types/naylence/fame/security/cert/default-ca-service.d.ts.map +0 -1
  312. package/dist/types/naylence/fame/security/cert/default-certificate-manager-factory.d.ts +0 -25
  313. package/dist/types/naylence/fame/security/cert/default-certificate-manager-factory.d.ts.map +0 -1
  314. package/dist/types/naylence/fame/security/cert/default-certificate-manager.d.ts +0 -70
  315. package/dist/types/naylence/fame/security/cert/default-certificate-manager.d.ts.map +0 -1
  316. package/dist/types/naylence/fame/security/cert/grants.d.ts +0 -2
  317. package/dist/types/naylence/fame/security/cert/grants.d.ts.map +0 -1
  318. package/dist/types/naylence/fame/security/cert/index.d.ts +0 -19
  319. package/dist/types/naylence/fame/security/cert/index.d.ts.map +0 -1
  320. package/dist/types/naylence/fame/security/cert/internal-ca-service.d.ts +0 -129
  321. package/dist/types/naylence/fame/security/cert/internal-ca-service.d.ts.map +0 -1
  322. package/dist/types/naylence/fame/security/cert/node-ed25519-csr.d.ts +0 -9
  323. package/dist/types/naylence/fame/security/cert/node-ed25519-csr.d.ts.map +0 -1
  324. package/dist/types/naylence/fame/security/cert/oid-constants.d.ts +0 -7
  325. package/dist/types/naylence/fame/security/cert/oid-constants.d.ts.map +0 -1
  326. package/dist/types/naylence/fame/security/cert/trust-store/anchor-utils.d.ts +0 -12
  327. package/dist/types/naylence/fame/security/cert/trust-store/anchor-utils.d.ts.map +0 -1
  328. package/dist/types/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.d.ts +0 -29
  329. package/dist/types/naylence/fame/security/cert/trust-store/browser-trust-store-provider-factory.d.ts.map +0 -1
  330. package/dist/types/naylence/fame/security/cert/trust-store/env-provider.d.ts +0 -7
  331. package/dist/types/naylence/fame/security/cert/trust-store/env-provider.d.ts.map +0 -1
  332. package/dist/types/naylence/fame/security/cert/trust-store/fame-ca-certs-parser.d.ts +0 -9
  333. package/dist/types/naylence/fame/security/cert/trust-store/fame-ca-certs-parser.d.ts.map +0 -1
  334. package/dist/types/naylence/fame/security/cert/trust-store/http-bundle-provider.d.ts +0 -35
  335. package/dist/types/naylence/fame/security/cert/trust-store/http-bundle-provider.d.ts.map +0 -1
  336. package/dist/types/naylence/fame/security/cert/trust-store/http-signed-bundle-provider.d.ts +0 -2
  337. package/dist/types/naylence/fame/security/cert/trust-store/http-signed-bundle-provider.d.ts.map +0 -1
  338. package/dist/types/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.d.ts +0 -23
  339. package/dist/types/naylence/fame/security/cert/trust-store/node-trust-store-provider-factory.d.ts.map +0 -1
  340. package/dist/types/naylence/fame/security/cert/trust-store/static-bundle-provider.d.ts +0 -15
  341. package/dist/types/naylence/fame/security/cert/trust-store/static-bundle-provider.d.ts.map +0 -1
  342. package/dist/types/naylence/fame/security/cert/trust-store/trust-store-provider-factory.d.ts +0 -28
  343. package/dist/types/naylence/fame/security/cert/trust-store/trust-store-provider-factory.d.ts.map +0 -1
  344. package/dist/types/naylence/fame/security/cert/trust-store/trust-store-provider.d.ts +0 -43
  345. package/dist/types/naylence/fame/security/cert/trust-store/trust-store-provider.d.ts.map +0 -1
  346. package/dist/types/naylence/fame/security/cert/util.d.ts +0 -25
  347. package/dist/types/naylence/fame/security/cert/util.d.ts.map +0 -1
  348. package/dist/types/naylence/fame/security/encryption/channel/channel-encryption-manager-factory.d.ts +0 -29
  349. package/dist/types/naylence/fame/security/encryption/channel/channel-encryption-manager-factory.d.ts.map +0 -1
  350. package/dist/types/naylence/fame/security/encryption/channel/channel-encryption-manager.d.ts +0 -51
  351. package/dist/types/naylence/fame/security/encryption/channel/channel-encryption-manager.d.ts.map +0 -1
  352. package/dist/types/naylence/fame/security/encryption/channel/index.d.ts +0 -3
  353. package/dist/types/naylence/fame/security/encryption/channel/index.d.ts.map +0 -1
  354. package/dist/types/naylence/fame/security/encryption/composite-encryption-manager-factory.d.ts +0 -32
  355. package/dist/types/naylence/fame/security/encryption/composite-encryption-manager-factory.d.ts.map +0 -1
  356. package/dist/types/naylence/fame/security/encryption/composite-encryption-manager.d.ts +0 -52
  357. package/dist/types/naylence/fame/security/encryption/composite-encryption-manager.d.ts.map +0 -1
  358. package/dist/types/naylence/fame/security/encryption/default-secure-channel-manager-factory.d.ts +0 -23
  359. package/dist/types/naylence/fame/security/encryption/default-secure-channel-manager-factory.d.ts.map +0 -1
  360. package/dist/types/naylence/fame/security/encryption/default-secure-channel-manager.d.ts +0 -37
  361. package/dist/types/naylence/fame/security/encryption/default-secure-channel-manager.d.ts.map +0 -1
  362. package/dist/types/naylence/fame/security/encryption/encryption-manager-registry.d.ts +0 -34
  363. package/dist/types/naylence/fame/security/encryption/encryption-manager-registry.d.ts.map +0 -1
  364. package/dist/types/naylence/fame/security/encryption/index.d.ts +0 -7
  365. package/dist/types/naylence/fame/security/encryption/index.d.ts.map +0 -1
  366. package/dist/types/naylence/fame/security/encryption/sealed/index.d.ts +0 -3
  367. package/dist/types/naylence/fame/security/encryption/sealed/index.d.ts.map +0 -1
  368. package/dist/types/naylence/fame/security/encryption/sealed/x25519-encryption-manager-factory.d.ts +0 -28
  369. package/dist/types/naylence/fame/security/encryption/sealed/x25519-encryption-manager-factory.d.ts.map +0 -1
  370. package/dist/types/naylence/fame/security/encryption/sealed/x25519-encryption-manager.d.ts +0 -43
  371. package/dist/types/naylence/fame/security/encryption/sealed/x25519-encryption-manager.d.ts.map +0 -1
  372. package/dist/types/naylence/fame/security/index.d.ts +0 -6
  373. package/dist/types/naylence/fame/security/index.d.ts.map +0 -1
  374. package/dist/types/naylence/fame/security/keys/index.d.ts +0 -3
  375. package/dist/types/naylence/fame/security/keys/index.d.ts.map +0 -1
  376. package/dist/types/naylence/fame/security/keys/x5c-key-manager-factory.d.ts +0 -19
  377. package/dist/types/naylence/fame/security/keys/x5c-key-manager-factory.d.ts.map +0 -1
  378. package/dist/types/naylence/fame/security/keys/x5c-key-manager.d.ts +0 -39
  379. package/dist/types/naylence/fame/security/keys/x5c-key-manager.d.ts.map +0 -1
  380. package/dist/types/naylence/fame/security/register-advanced-security-factories.d.ts +0 -8
  381. package/dist/types/naylence/fame/security/register-advanced-security-factories.d.ts.map +0 -1
  382. package/dist/types/naylence/fame/security/signing/eddsa-envelope-signer-factory.d.ts +0 -20
  383. package/dist/types/naylence/fame/security/signing/eddsa-envelope-signer-factory.d.ts.map +0 -1
  384. package/dist/types/naylence/fame/security/signing/eddsa-envelope-verifier-factory.d.ts +0 -21
  385. package/dist/types/naylence/fame/security/signing/eddsa-envelope-verifier-factory.d.ts.map +0 -1
  386. package/dist/types/naylence/fame/security/signing/eddsa-envelope-verifier.d.ts +0 -22
  387. package/dist/types/naylence/fame/security/signing/eddsa-envelope-verifier.d.ts.map +0 -1
  388. package/dist/types/naylence/fame/stickiness/aft-helper.d.ts +0 -29
  389. package/dist/types/naylence/fame/stickiness/aft-helper.d.ts.map +0 -1
  390. package/dist/types/naylence/fame/stickiness/aft-load-balancer-stickiness-manager-factory.d.ts +0 -25
  391. package/dist/types/naylence/fame/stickiness/aft-load-balancer-stickiness-manager-factory.d.ts.map +0 -1
  392. package/dist/types/naylence/fame/stickiness/aft-load-balancer-stickiness-manager.d.ts +0 -33
  393. package/dist/types/naylence/fame/stickiness/aft-load-balancer-stickiness-manager.d.ts.map +0 -1
  394. package/dist/types/naylence/fame/stickiness/aft-model.d.ts +0 -33
  395. package/dist/types/naylence/fame/stickiness/aft-model.d.ts.map +0 -1
  396. package/dist/types/naylence/fame/stickiness/aft-replica-stickiness-manager-factory.d.ts +0 -23
  397. package/dist/types/naylence/fame/stickiness/aft-replica-stickiness-manager-factory.d.ts.map +0 -1
  398. package/dist/types/naylence/fame/stickiness/aft-replica-stickiness-manager.d.ts +0 -31
  399. package/dist/types/naylence/fame/stickiness/aft-replica-stickiness-manager.d.ts.map +0 -1
  400. package/dist/types/naylence/fame/stickiness/aft-signer.d.ts +0 -55
  401. package/dist/types/naylence/fame/stickiness/aft-signer.d.ts.map +0 -1
  402. package/dist/types/naylence/fame/stickiness/aft-utils.d.ts +0 -4
  403. package/dist/types/naylence/fame/stickiness/aft-utils.d.ts.map +0 -1
  404. package/dist/types/naylence/fame/stickiness/aft-verifier.d.ts +0 -50
  405. package/dist/types/naylence/fame/stickiness/aft-verifier.d.ts.map +0 -1
  406. package/dist/types/naylence/fame/stickiness/index.d.ts +0 -15
  407. package/dist/types/naylence/fame/stickiness/index.d.ts.map +0 -1
  408. package/dist/types/naylence/fame/stickiness/stickiness-mode.d.ts +0 -7
  409. package/dist/types/naylence/fame/stickiness/stickiness-mode.d.ts.map +0 -1
  410. package/dist/types/naylence/fame/welcome/advanced-welcome-service-factory.d.ts +0 -21
  411. package/dist/types/naylence/fame/welcome/advanced-welcome-service-factory.d.ts.map +0 -1
  412. package/dist/types/naylence/fame/welcome/advanced-welcome-service.d.ts +0 -21
  413. package/dist/types/naylence/fame/welcome/advanced-welcome-service.d.ts.map +0 -1
  414. package/dist/types/naylence/fame/welcome/index.d.ts +0 -3
  415. package/dist/types/naylence/fame/welcome/index.d.ts.map +0 -1
  416. package/dist/types/node.d.ts +0 -11
  417. package/dist/types/node.d.ts.map +0 -1
  418. package/dist/types/plugin.d.ts +0 -11
  419. package/dist/types/plugin.d.ts.map +0 -1
  420. package/dist/types/version.d.ts +0 -6
  421. package/dist/types/version.d.ts.map +0 -1
@@ -1,743 +0,0 @@
1
- import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
2
- import { FameAddress, formatAddress, localDeliveryContext, } from "@naylence/core";
3
- import { EncryptionResult, } from "@naylence/runtime";
4
- import { requireCryptoSupport } from "@naylence/runtime";
5
- import { getLogger } from "@naylence/runtime";
6
- import { generateId } from "@naylence/core";
7
- import { urlsafeBase64Decode } from "@naylence/runtime";
8
- const logger = getLogger("naylence.fame.security.encryption.channel.channel_encryption_manager");
9
- const SUPPORTED_CHANNEL_ALGORITHMS = ["chacha20-poly1305-channel"];
10
- const CHANNEL_ENCRYPTION_ALGORITHM = "chacha20-poly1305-channel";
11
- const HANDSHAKE_ALGORITHM = "CHACHA20P1305";
12
- const SYSTEM_INBOX = "__sys__";
13
- const NONCE_LENGTH = 12;
14
- function isTaskSpawnerLike(value) {
15
- return Boolean(value && typeof value.spawn === "function");
16
- }
17
- function toUint8Array(value) {
18
- if (value instanceof Uint8Array) {
19
- return value;
20
- }
21
- if (typeof ArrayBuffer !== "undefined") {
22
- if (value instanceof ArrayBuffer) {
23
- return new Uint8Array(value);
24
- }
25
- if (ArrayBuffer.isView(value)) {
26
- const view = value;
27
- return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
28
- }
29
- }
30
- if (Array.isArray(value)) {
31
- return Uint8Array.from(value);
32
- }
33
- return null;
34
- }
35
- function encodeBase64(data) {
36
- if (typeof Buffer !== "undefined") {
37
- return Buffer.from(data).toString("base64");
38
- }
39
- let binary = "";
40
- for (const byte of data) {
41
- binary += String.fromCharCode(byte);
42
- }
43
- if (typeof btoa === "function") {
44
- return btoa(binary);
45
- }
46
- throw new Error("Base64 encoding not supported in this environment");
47
- }
48
- function decodeBase64(encoded) {
49
- if (typeof Buffer !== "undefined") {
50
- return Uint8Array.from(Buffer.from(encoded, "base64"));
51
- }
52
- if (typeof atob === "function") {
53
- const binary = atob(encoded);
54
- const bytes = new Uint8Array(binary.length);
55
- for (let i = 0; i < binary.length; i += 1) {
56
- bytes[i] = binary.charCodeAt(i);
57
- }
58
- return bytes;
59
- }
60
- throw new Error("Base64 decoding not supported in this environment");
61
- }
62
- let cachedCrypto;
63
- function resolveCrypto() {
64
- if (cachedCrypto !== undefined) {
65
- return cachedCrypto;
66
- }
67
- cachedCrypto = null;
68
- if (typeof globalThis !== "undefined") {
69
- const scoped = globalThis;
70
- const nativeCrypto = scoped.crypto;
71
- if (nativeCrypto && typeof nativeCrypto.getRandomValues === "function") {
72
- cachedCrypto = nativeCrypto;
73
- return cachedCrypto;
74
- }
75
- const webcrypto = scoped.webcrypto;
76
- if (webcrypto && typeof webcrypto.getRandomValues === "function") {
77
- cachedCrypto = webcrypto;
78
- return cachedCrypto;
79
- }
80
- }
81
- return cachedCrypto;
82
- }
83
- function randomBytes(length) {
84
- const cryptoApi = resolveCrypto();
85
- if (!cryptoApi) {
86
- throw new Error("Secure random source is not available in this environment");
87
- }
88
- const buffer = new Uint8Array(length);
89
- cryptoApi.getRandomValues(buffer);
90
- return buffer;
91
- }
92
- function toFameAddress(value) {
93
- if (!value) {
94
- return null;
95
- }
96
- if (value instanceof FameAddress) {
97
- return value;
98
- }
99
- return new FameAddress(String(value));
100
- }
101
- function toDestinationString(value) {
102
- if (!value) {
103
- return null;
104
- }
105
- if (value instanceof FameAddress) {
106
- return value.toString();
107
- }
108
- if (typeof value === "string") {
109
- return value;
110
- }
111
- return null;
112
- }
113
- function makeJsonSerializable(value) {
114
- if (value === null || value === undefined) {
115
- return null;
116
- }
117
- if (Array.isArray(value)) {
118
- return value.map((item) => makeJsonSerializable(item));
119
- }
120
- if (value instanceof Uint8Array) {
121
- return Array.from(value);
122
- }
123
- if (typeof value === "object") {
124
- const candidate = value;
125
- if (typeof candidate.toJSON === "function") {
126
- return candidate.toJSON();
127
- }
128
- if (typeof candidate.model_dump === "function") {
129
- return candidate.model_dump();
130
- }
131
- if (typeof candidate.dict === "function") {
132
- return candidate.dict();
133
- }
134
- return { ...candidate };
135
- }
136
- return value;
137
- }
138
- export class ChannelEncryptionManager {
139
- constructor({ secureChannelManager = null, nodeLike = null, taskSpawner = null, } = {}) {
140
- this.pendingEnvelopes = new Map();
141
- this.handshakeInProgress = new Set();
142
- this.addrChannelMap = new Map();
143
- this.secureChannelManager = secureChannelManager ?? null;
144
- this.nodeLike = nodeLike ?? null;
145
- this.taskSpawner =
146
- taskSpawner ?? (isTaskSpawnerLike(nodeLike) ? nodeLike : taskSpawner);
147
- }
148
- async encryptEnvelope(envelope, opts = null) {
149
- const frame = envelope.frame;
150
- if (!this.isDataFrame(frame)) {
151
- return EncryptionResult.skipped(envelope);
152
- }
153
- if (frame.payload === null || typeof frame.payload === "undefined") {
154
- return EncryptionResult.skipped(envelope);
155
- }
156
- const destination = opts?.destination ?? envelope.to ?? null;
157
- const destinationStr = toDestinationString(destination);
158
- if (!destinationStr) {
159
- logger.warning("no_destination_for_channel_encryption", {
160
- envelope_id: envelope.id,
161
- });
162
- return EncryptionResult.skipped(envelope);
163
- }
164
- if (!this.secureChannelManager) {
165
- logger.warning("no_secure_channel_manager_available", {
166
- envelope_id: envelope.id,
167
- });
168
- return EncryptionResult.skipped(envelope);
169
- }
170
- const existingChannelId = this.findExistingChannel(destinationStr);
171
- if (existingChannelId) {
172
- try {
173
- return this.encryptWithChannel(envelope, existingChannelId);
174
- }
175
- catch (error) {
176
- logger.error("channel_encryption_failed", {
177
- error: error instanceof Error ? error.message : String(error),
178
- channel_id: existingChannelId,
179
- });
180
- return EncryptionResult.skipped(envelope);
181
- }
182
- }
183
- await this.queueAndInitiateHandshake(envelope, destination, destinationStr, opts ?? null);
184
- return EncryptionResult.queued();
185
- }
186
- async decryptEnvelope(envelope, opts = null) {
187
- void opts;
188
- requireCryptoSupport();
189
- const frame = envelope.frame;
190
- if (!this.isDataFrame(frame) ||
191
- frame.payload === null ||
192
- typeof frame.payload === "undefined") {
193
- return envelope;
194
- }
195
- if (!envelope.sec || !envelope.sec.enc) {
196
- return envelope;
197
- }
198
- const encHeader = envelope.sec.enc;
199
- if (!encHeader.alg || !this.isChannelAlgorithm(encHeader.alg)) {
200
- return envelope;
201
- }
202
- const channelId = encHeader.kid;
203
- if (!channelId) {
204
- logger.error("missing_channel_id_in_encryption_header", {
205
- envelope_id: envelope.id,
206
- });
207
- return envelope;
208
- }
209
- const nonce = this.decodeNonceValue(encHeader.val ?? "");
210
- if (!nonce) {
211
- logger.error("invalid_nonce_in_encryption_header", {
212
- envelope_id: envelope.id,
213
- value_present: Boolean(encHeader.val),
214
- });
215
- return envelope;
216
- }
217
- if (!this.secureChannelManager) {
218
- logger.warning("no_secure_channel_manager_for_decryption", {
219
- envelope_id: envelope.id,
220
- });
221
- return envelope;
222
- }
223
- const channelState = this.getChannelState(channelId);
224
- if (!channelState) {
225
- logger.error("channel_not_available_for_decryption", {
226
- channel_id: channelId,
227
- });
228
- return envelope;
229
- }
230
- const ciphertext = this.extractCiphertext(frame.payload);
231
- if (!ciphertext) {
232
- logger.error("invalid_ciphertext_payload", { envelope_id: envelope.id });
233
- return envelope;
234
- }
235
- try {
236
- const aad = new TextEncoder().encode(channelId);
237
- const aead = chacha20poly1305(channelState.key, nonce, aad);
238
- const plaintextBytes = aead.decrypt(ciphertext);
239
- const decodedPayload = this.deserializePayload(plaintextBytes);
240
- frame.payload = decodedPayload;
241
- frame.codec = "json";
242
- if (envelope.sec) {
243
- delete envelope.sec.enc;
244
- if (!envelope.sec.sig) {
245
- envelope.sec = undefined;
246
- }
247
- }
248
- if (envelope.replyTo) {
249
- this.addrChannelMap.set(String(envelope.replyTo), channelId);
250
- }
251
- if (envelope.sid) {
252
- this.addrChannelMap.set(envelope.sid, channelId);
253
- }
254
- return envelope;
255
- }
256
- catch (error) {
257
- logger.error("channel_decryption_failed", {
258
- channel_id: channelId,
259
- error: error instanceof Error ? error.message : String(error),
260
- });
261
- return envelope;
262
- }
263
- }
264
- async notifyChannelEstablished(channelId) {
265
- logger.debug("channel_encryption_manager_notified", {
266
- channel_id: channelId,
267
- manager_type: "channel",
268
- });
269
- if (!channelId.startsWith("auto-")) {
270
- logger.warning("unexpected_channel_id_format", { channel_id: channelId });
271
- return;
272
- }
273
- const destinationStr = this.extractDestinationFromChannelId(channelId);
274
- if (!destinationStr) {
275
- logger.warning("cannot_parse_destination_from_channel_id", {
276
- channel_id: channelId,
277
- });
278
- return;
279
- }
280
- this.handshakeInProgress.delete(destinationStr);
281
- if (!this.pendingEnvelopes.has(destinationStr)) {
282
- logger.debug("no_pending_queue_for_destination", {
283
- destination: destinationStr,
284
- });
285
- return;
286
- }
287
- const queuedEnvelopes = this.pendingEnvelopes.get(destinationStr) ?? [];
288
- this.pendingEnvelopes.delete(destinationStr);
289
- if (!this.secureChannelManager) {
290
- logger.error("no_secure_channel_manager_for_queue_drain", {
291
- channel_id: channelId,
292
- });
293
- return;
294
- }
295
- for (const envelope of queuedEnvelopes) {
296
- try {
297
- const result = this.encryptWithChannel(envelope, channelId);
298
- if (!result.envelope) {
299
- logger.warning("failed_to_encrypt_queued_envelope", {
300
- envelope_id: envelope.id,
301
- channel_id: channelId,
302
- });
303
- continue;
304
- }
305
- const encryptedEnvelope = result.envelope;
306
- this.runAsyncTask(() => this.deliverEnvelope(encryptedEnvelope), `deliver-queued-${envelope.id}`);
307
- }
308
- catch (error) {
309
- logger.error("failed_to_encrypt_queued_envelope", {
310
- envelope_id: envelope.id,
311
- error: error instanceof Error ? error.message : String(error),
312
- });
313
- }
314
- }
315
- }
316
- async notifyChannelFailed(channelId, reason = "handshake_failed") {
317
- logger.debug("channel_encryption_manager_notified_failure", {
318
- channel_id: channelId,
319
- reason,
320
- });
321
- if (!channelId.startsWith("auto-")) {
322
- logger.warning("unexpected_channel_id_format_on_failure", {
323
- channel_id: channelId,
324
- });
325
- return;
326
- }
327
- const destinationStr = this.extractDestinationFromChannelId(channelId);
328
- if (!destinationStr) {
329
- logger.warning("cannot_parse_destination_from_channel_id_on_failure", {
330
- channel_id: channelId,
331
- });
332
- return;
333
- }
334
- this.handshakeInProgress.delete(destinationStr);
335
- // Clear any cached channel mapping for this destination since the channel failed
336
- const cachedChannelId = this.addrChannelMap.get(destinationStr);
337
- if (cachedChannelId === channelId) {
338
- this.addrChannelMap.delete(destinationStr);
339
- logger.debug("cleared_channel_cache_for_failed_channel", {
340
- destination: destinationStr,
341
- channel_id: channelId,
342
- });
343
- }
344
- const queuedEnvelopes = this.pendingEnvelopes.get(destinationStr);
345
- if (!queuedEnvelopes || queuedEnvelopes.length === 0) {
346
- logger.debug("no_pending_queue_for_failed_destination", {
347
- destination: destinationStr,
348
- });
349
- return;
350
- }
351
- this.pendingEnvelopes.delete(destinationStr);
352
- for (const envelope of queuedEnvelopes) {
353
- await this.handleFailedEnvelope(envelope, destinationStr, channelId, reason);
354
- }
355
- }
356
- /**
357
- * Clear cached channel mappings for a destination.
358
- * This should be called when routes are removed or channels are closed
359
- * to prevent using stale channel references.
360
- */
361
- clearChannelCacheForDestination(destination) {
362
- const cached = this.addrChannelMap.get(destination);
363
- if (cached) {
364
- this.addrChannelMap.delete(destination);
365
- logger.debug("cleared_channel_cache_for_destination", {
366
- destination,
367
- cached_channel_id: cached,
368
- });
369
- }
370
- }
371
- isChannelAlgorithm(algorithm) {
372
- return SUPPORTED_CHANNEL_ALGORITHMS.includes(algorithm);
373
- }
374
- isDataFrame(frame) {
375
- return Boolean(frame && frame.type === "Data");
376
- }
377
- findExistingChannel(destination) {
378
- if (!this.secureChannelManager) {
379
- return null;
380
- }
381
- const cached = this.addrChannelMap.get(destination);
382
- if (cached && this.getChannelState(cached)) {
383
- logger.debug("using_cached_channel", { destination, channel_id: cached });
384
- return cached;
385
- }
386
- const channels = this.secureChannelManager.channels;
387
- for (const channelId of Object.keys(channels)) {
388
- if (channelId.startsWith(`auto-${destination}-`)) {
389
- this.addrChannelMap.set(destination, channelId);
390
- logger.debug("using_existing_channel", {
391
- destination,
392
- channel_id: channelId,
393
- });
394
- return channelId;
395
- }
396
- }
397
- return null;
398
- }
399
- async queueAndInitiateHandshake(envelope, destination, destinationStr, opts) {
400
- const queue = this.pendingEnvelopes.get(destinationStr) ?? [];
401
- queue.push(envelope);
402
- this.pendingEnvelopes.set(destinationStr, queue);
403
- logger.debug("queued_envelope_for_channel_handshake", {
404
- envelope_id: envelope.id,
405
- destination: destinationStr,
406
- });
407
- if (this.handshakeInProgress.has(destinationStr)) {
408
- logger.debug("handshake_already_in_progress", {
409
- destination: destinationStr,
410
- });
411
- return;
412
- }
413
- this.handshakeInProgress.add(destinationStr);
414
- const taskName = `handshake-${destinationStr}`;
415
- this.runAsyncTask(async () => {
416
- try {
417
- await this.initiateChannelHandshakeAsync(destination ?? destinationStr, destinationStr, opts);
418
- }
419
- finally {
420
- this.handshakeInProgress.delete(destinationStr);
421
- }
422
- }, taskName);
423
- }
424
- async initiateChannelHandshakeAsync(destination, destinationStr, opts) {
425
- void opts;
426
- if (!this.secureChannelManager) {
427
- logger.error("no_secure_channel_manager_for_async_handshake_initiation");
428
- return;
429
- }
430
- const channelId = this.generateChannelId(destinationStr);
431
- try {
432
- const openFrame = this.secureChannelManager.generateOpenFrame(channelId, HANDSHAKE_ALGORITHM);
433
- const success = await this.sendSecureOpenFrameAsync(openFrame, destination);
434
- if (success) {
435
- logger.debug("sent_secure_open_frame_async", {
436
- channel_id: channelId,
437
- destination: destinationStr,
438
- });
439
- }
440
- else {
441
- logger.warning("failed_to_send_secure_open_frame_async", {
442
- channel_id: channelId,
443
- });
444
- }
445
- }
446
- catch (error) {
447
- logger.error("async_channel_handshake_initiation_failed", {
448
- destination: destinationStr,
449
- error: error instanceof Error ? error.message : String(error),
450
- });
451
- }
452
- }
453
- async sendSecureOpenFrameAsync(openFrame, destination) {
454
- const node = this.nodeLike;
455
- if (!node) {
456
- logger.error("no_node_available_for_sending_secure_open_async");
457
- return false;
458
- }
459
- const envelopeFactory = node.envelopeFactory;
460
- if (!envelopeFactory) {
461
- logger.error("no_envelope_factory_available_for_secure_open_async");
462
- return false;
463
- }
464
- const replyTo = this.buildSystemReplyTo();
465
- if (!replyTo) {
466
- logger.error("no_physical_path_available_for_reply_to_async");
467
- return false;
468
- }
469
- const toAddress = toFameAddress(destination);
470
- if (!toAddress) {
471
- logger.error("invalid_destination_for_secure_open", {
472
- destination: String(destination),
473
- });
474
- return false;
475
- }
476
- const envelope = envelopeFactory.createEnvelope({
477
- to: toAddress,
478
- frame: openFrame,
479
- replyTo,
480
- corrId: generateId(),
481
- });
482
- await this.deliverEnvelope(envelope);
483
- logger.debug("delivered_secure_open_frame_async", {
484
- channel_id: openFrame.cid,
485
- });
486
- return true;
487
- }
488
- async deliverEnvelope(envelope) {
489
- const node = this.nodeLike;
490
- if (!node) {
491
- logger.error("no_node_available_for_delivery", {
492
- envelope_id: envelope.id,
493
- });
494
- return;
495
- }
496
- const context = localDeliveryContext(node.sid ?? undefined);
497
- await node.deliver(envelope, context);
498
- }
499
- encryptWithChannel(envelope, channelId) {
500
- if (!this.secureChannelManager) {
501
- logger.error("no_secure_channel_manager_for_encryption");
502
- return EncryptionResult.skipped(envelope);
503
- }
504
- const frame = envelope.frame;
505
- if (!this.isDataFrame(frame)) {
506
- logger.error("attempted_to_encrypt_non_dataframe", {
507
- frame_type: frame.type ?? typeof frame,
508
- });
509
- return EncryptionResult.skipped(envelope);
510
- }
511
- const channelState = this.getChannelState(channelId);
512
- if (!channelState) {
513
- logger.error("channel_not_in_channels", { channel_id: channelId });
514
- return EncryptionResult.skipped(envelope);
515
- }
516
- const payloadBytes = this.serializePayload(frame.payload);
517
- if (!payloadBytes) {
518
- return EncryptionResult.skipped(envelope);
519
- }
520
- const nonce = randomBytes(NONCE_LENGTH);
521
- const aad = new TextEncoder().encode(channelId);
522
- const aead = chacha20poly1305(channelState.key, nonce, aad);
523
- const ciphertext = aead.encrypt(payloadBytes);
524
- const encryptionHeader = {
525
- alg: CHANNEL_ENCRYPTION_ALGORITHM,
526
- val: Array.from(nonce)
527
- .map((byte) => byte.toString(16).padStart(2, "0"))
528
- .join(""), // Hex encoding (Python reference)
529
- kid: channelId,
530
- };
531
- const encodedCiphertext = encodeBase64(ciphertext);
532
- frame.payload = encodedCiphertext;
533
- frame.codec = "b64";
534
- if (envelope.sec) {
535
- envelope.sec.enc = encryptionHeader;
536
- }
537
- else {
538
- envelope.sec = { enc: encryptionHeader };
539
- }
540
- return EncryptionResult.ok(envelope);
541
- }
542
- serializePayload(payload) {
543
- if (payload === null || typeof payload === "undefined") {
544
- return null;
545
- }
546
- if (payload instanceof Uint8Array) {
547
- return payload;
548
- }
549
- if (typeof ArrayBuffer !== "undefined") {
550
- if (payload instanceof ArrayBuffer || ArrayBuffer.isView(payload)) {
551
- return toUint8Array(payload);
552
- }
553
- }
554
- if (typeof payload === "string") {
555
- return new TextEncoder().encode(payload);
556
- }
557
- if (typeof payload === "number" || typeof payload === "boolean") {
558
- return new TextEncoder().encode(JSON.stringify(payload));
559
- }
560
- const serializable = makeJsonSerializable(payload);
561
- return new TextEncoder().encode(JSON.stringify(serializable));
562
- }
563
- extractCiphertext(payload) {
564
- if (payload instanceof Uint8Array) {
565
- return payload;
566
- }
567
- if (typeof payload === "string") {
568
- try {
569
- return decodeBase64(payload);
570
- }
571
- catch (error) {
572
- logger.error("failed_to_decode_base64_ciphertext", {
573
- error: error instanceof Error ? error.message : String(error),
574
- });
575
- return null;
576
- }
577
- }
578
- if (payload instanceof ArrayBuffer ||
579
- ArrayBuffer.isView(payload)) {
580
- return toUint8Array(payload);
581
- }
582
- return null;
583
- }
584
- deserializePayload(bytes) {
585
- const decoder = new TextDecoder();
586
- const decoded = decoder.decode(bytes);
587
- try {
588
- return JSON.parse(decoded);
589
- }
590
- catch {
591
- return decoded;
592
- }
593
- }
594
- extractDestinationFromChannelId(channelId) {
595
- const parts = channelId.split("-");
596
- if (parts.length < 3) {
597
- return null;
598
- }
599
- return parts.slice(1, -1).join("-");
600
- }
601
- async handleFailedEnvelope(envelope, destinationStr, channelId, reason) {
602
- logger.warning("envelope_failed_due_to_channel_handshake_failure", {
603
- envelope_id: envelope.id,
604
- destination: destinationStr,
605
- channel_id: channelId,
606
- reason,
607
- });
608
- const frame = envelope.frame;
609
- if (!this.isDataFrame(frame)) {
610
- logger.debug("skipping_nack_for_non_dataframe", {
611
- envelope_id: envelope.id,
612
- frame_type: frame.type ?? typeof frame,
613
- });
614
- return;
615
- }
616
- if (!envelope.replyTo) {
617
- logger.debug("skipping_nack_no_reply_to", { envelope_id: envelope.id });
618
- return;
619
- }
620
- await this.sendDeliveryNack(envelope, `channel_handshake_failed: ${reason}`);
621
- }
622
- async sendDeliveryNack(envelope, failureReason) {
623
- const node = this.nodeLike;
624
- if (!node) {
625
- logger.error("no_node_available_for_sending_delivery_nack");
626
- return;
627
- }
628
- const envelopeFactory = node.envelopeFactory;
629
- if (!envelopeFactory) {
630
- logger.error("no_envelope_factory_available_for_delivery_nack");
631
- return;
632
- }
633
- const replyTo = toFameAddress(envelope.replyTo ?? null);
634
- if (!replyTo) {
635
- logger.error("invalid_reply_to_for_delivery_nack", {
636
- reply_to: envelope.replyTo,
637
- });
638
- return;
639
- }
640
- const nackFrame = {
641
- type: "DeliveryAck",
642
- ok: false,
643
- code: "channel_handshake_failed",
644
- reason: failureReason,
645
- };
646
- const nackEnvelope = envelopeFactory.createEnvelope({
647
- to: replyTo,
648
- frame: nackFrame,
649
- corrId: envelope.corrId ?? generateId(),
650
- });
651
- await this.deliverEnvelope(nackEnvelope);
652
- logger.debug("delivered_delivery_nack", {
653
- original_envelope_id: envelope.id,
654
- nack_envelope_id: nackEnvelope.id,
655
- });
656
- }
657
- getChannelState(channelId) {
658
- if (!this.secureChannelManager) {
659
- return null;
660
- }
661
- const channelState = this.secureChannelManager.channels[channelId];
662
- return channelState ?? null;
663
- }
664
- buildSystemReplyTo() {
665
- const node = this.nodeLike;
666
- if (!node) {
667
- return null;
668
- }
669
- const physicalPath = node.physicalPath ?? "";
670
- if (!physicalPath) {
671
- return null;
672
- }
673
- return formatAddress(SYSTEM_INBOX, physicalPath);
674
- }
675
- generateChannelId(destinationStr) {
676
- return `auto-${destinationStr}-${generateId()}`;
677
- }
678
- runAsyncTask(task, name) {
679
- if (this.taskSpawner) {
680
- this.taskSpawner.spawn(async () => {
681
- await task();
682
- }, { name });
683
- return;
684
- }
685
- (async () => {
686
- try {
687
- await task();
688
- }
689
- catch (error) {
690
- logger.error("async_task_failed", {
691
- task_name: name,
692
- error: error instanceof Error ? error.message : String(error),
693
- });
694
- }
695
- })().catch(() => {
696
- // Swallow to avoid unhandled rejection; error already logged above.
697
- });
698
- }
699
- decodeNonceValue(value) {
700
- if (!value) {
701
- return null;
702
- }
703
- const hexCandidate = value.trim();
704
- if (hexCandidate.length % 2 === 0 && /^[0-9a-fA-F]+$/.test(hexCandidate)) {
705
- const bytes = new Uint8Array(hexCandidate.length / 2);
706
- for (let i = 0; i < hexCandidate.length; i += 2) {
707
- bytes[i / 2] = parseInt(hexCandidate.slice(i, i + 2), 16);
708
- }
709
- if (bytes.length > 0) {
710
- return bytes;
711
- }
712
- }
713
- const base64Candidates = [
714
- value,
715
- value.replace(/-/g, "+").replace(/_/g, "/"),
716
- ];
717
- for (const candidate of base64Candidates) {
718
- try {
719
- // Standard base64 decode first (Buffer), then urlsafe fallback
720
- if (typeof Buffer !== "undefined") {
721
- const decoded = Uint8Array.from(Buffer.from(candidate, "base64"));
722
- if (decoded.length > 0) {
723
- return decoded;
724
- }
725
- }
726
- }
727
- catch {
728
- // ignore and try next
729
- }
730
- try {
731
- const decoded = urlsafeBase64Decode(candidate);
732
- if (decoded.length > 0) {
733
- return decoded;
734
- }
735
- }
736
- catch {
737
- // ignore and continue
738
- }
739
- }
740
- return null;
741
- }
742
- }
743
- //# sourceMappingURL=channel-encryption-manager.js.map