@hashgraphonline/standards-sdk 0.1.141 → 0.1.143-feat-adapter-registry.canary.2e9e1c4.55
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.
- package/README.md +24 -1
- package/dist/cjs/hcs-11/client.d.ts.map +1 -1
- package/dist/cjs/hcs-11/types.d.ts +1 -0
- package/dist/cjs/hcs-11/types.d.ts.map +1 -1
- package/dist/cjs/hcs-12/validation/schemas.d.ts +8 -8
- package/dist/cjs/hcs-16/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-17/types.d.ts.map +1 -1
- package/dist/cjs/hcs-20/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-20/types.d.ts +9 -8
- package/dist/cjs/hcs-20/types.d.ts.map +1 -1
- package/dist/cjs/hcs-21/base-client.d.ts +14 -12
- package/dist/cjs/hcs-21/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-21/browser.d.ts +17 -7
- package/dist/cjs/hcs-21/browser.d.ts.map +1 -1
- package/dist/cjs/hcs-21/index.d.ts +1 -0
- package/dist/cjs/hcs-21/index.d.ts.map +1 -1
- package/dist/cjs/hcs-21/sdk.d.ts +70 -6
- package/dist/cjs/hcs-21/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-21/tx.d.ts +6 -2
- package/dist/cjs/hcs-21/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-21/types.d.ts +751 -66
- package/dist/cjs/hcs-21/types.d.ts.map +1 -1
- package/dist/cjs/hcs-21/verify.d.ts +6 -0
- package/dist/cjs/hcs-21/verify.d.ts.map +1 -0
- package/dist/cjs/inscribe/inscriber.d.ts +3 -1
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/inscribe/quote-cache.d.ts.map +1 -1
- package/dist/cjs/inscribe/types.d.ts +7 -0
- package/dist/cjs/inscribe/types.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/adapters.d.ts +20 -0
- package/dist/cjs/services/registry-broker/client/adapters.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/agents.d.ts +16 -0
- package/dist/cjs/services/registry-broker/client/agents.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/base-client.d.ts +57 -0
- package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/chat-history.d.ts +23 -0
- package/dist/cjs/services/registry-broker/client/chat-history.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/chat.d.ts +33 -0
- package/dist/cjs/services/registry-broker/client/chat.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/credits.d.ts +40 -0
- package/dist/cjs/services/registry-broker/client/credits.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts +35 -0
- package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/encryption.d.ts +33 -0
- package/dist/cjs/services/registry-broker/client/encryption.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/errors.d.ts +19 -0
- package/dist/cjs/services/registry-broker/client/errors.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts +10 -0
- package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/search.d.ts +19 -0
- package/dist/cjs/services/registry-broker/client/search.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client/utils.d.ts +21 -0
- package/dist/cjs/services/registry-broker/client/utils.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/client.d.ts +2 -204
- package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +1473 -177
- package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/types.d.ts +45 -3
- package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
- package/dist/cjs/services/types.d.ts +1 -0
- package/dist/cjs/services/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/cjs/utils/dynamic-import.d.ts +1 -0
- package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
- package/dist/es/hcs-11/client.d.ts.map +1 -1
- package/dist/es/hcs-11/types.d.ts +1 -0
- package/dist/es/hcs-11/types.d.ts.map +1 -1
- package/dist/es/hcs-12/validation/schemas.d.ts +8 -8
- package/dist/es/hcs-16/base-client.d.ts.map +1 -1
- package/dist/es/hcs-17/types.d.ts.map +1 -1
- package/dist/es/hcs-20/sdk.d.ts.map +1 -1
- package/dist/es/hcs-20/types.d.ts +9 -8
- package/dist/es/hcs-20/types.d.ts.map +1 -1
- package/dist/es/hcs-21/base-client.d.ts +14 -12
- package/dist/es/hcs-21/base-client.d.ts.map +1 -1
- package/dist/es/hcs-21/browser.d.ts +17 -7
- package/dist/es/hcs-21/browser.d.ts.map +1 -1
- package/dist/es/hcs-21/index.d.ts +1 -0
- package/dist/es/hcs-21/index.d.ts.map +1 -1
- package/dist/es/hcs-21/sdk.d.ts +70 -6
- package/dist/es/hcs-21/sdk.d.ts.map +1 -1
- package/dist/es/hcs-21/tx.d.ts +6 -2
- package/dist/es/hcs-21/tx.d.ts.map +1 -1
- package/dist/es/hcs-21/types.d.ts +751 -66
- package/dist/es/hcs-21/types.d.ts.map +1 -1
- package/dist/es/hcs-21/verify.d.ts +6 -0
- package/dist/es/hcs-21/verify.d.ts.map +1 -0
- package/dist/es/inscribe/inscriber.d.ts +3 -1
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/inscribe/quote-cache.d.ts.map +1 -1
- package/dist/es/inscribe/types.d.ts +7 -0
- package/dist/es/inscribe/types.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/adapters.d.ts +20 -0
- package/dist/es/services/registry-broker/client/adapters.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/agents.d.ts +16 -0
- package/dist/es/services/registry-broker/client/agents.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/base-client.d.ts +57 -0
- package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/chat-history.d.ts +23 -0
- package/dist/es/services/registry-broker/client/chat-history.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/chat.d.ts +33 -0
- package/dist/es/services/registry-broker/client/chat.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/credits.d.ts +40 -0
- package/dist/es/services/registry-broker/client/credits.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts +35 -0
- package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/encryption.d.ts +33 -0
- package/dist/es/services/registry-broker/client/encryption.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/errors.d.ts +19 -0
- package/dist/es/services/registry-broker/client/errors.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/ledger-auth.d.ts +10 -0
- package/dist/es/services/registry-broker/client/ledger-auth.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/search.d.ts +19 -0
- package/dist/es/services/registry-broker/client/search.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client/utils.d.ts +21 -0
- package/dist/es/services/registry-broker/client/utils.d.ts.map +1 -0
- package/dist/es/services/registry-broker/client.d.ts +2 -204
- package/dist/es/services/registry-broker/client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +1473 -177
- package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/es/services/registry-broker/types.d.ts +45 -3
- package/dist/es/services/registry-broker/types.d.ts.map +1 -1
- package/dist/es/services/types.d.ts +1 -0
- package/dist/es/services/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +73 -51
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es10.js +2 -2
- package/dist/es/standards-sdk.es100.js +26 -229
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +228 -109
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +94 -15
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +30 -80
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +80 -27
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +25 -136
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +140 -27
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +27 -20
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +18 -156
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +148 -196
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +167 -747
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +786 -9
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +13 -567
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +541 -576
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +601 -12
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +13 -2
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +2 -83
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +80 -36
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +39 -2
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +2 -223
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +193 -1110
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +1059 -225
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +303 -419
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +418 -351
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +348 -754
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +854 -178
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +153 -1512
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +1373 -1977
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +176 -51
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +196 -76
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es130.js +98 -153
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +122 -8
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +234 -73
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +171 -56
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +123 -29
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +313 -125
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +358 -34
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +17 -732
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +65 -12264
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +86 -16
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +152 -49
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +7 -64
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +71 -157
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +49 -306
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +28 -346
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +112 -427
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +40 -329
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +15 -74
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +175 -0
- package/dist/es/standards-sdk.es148.js.map +1 -0
- package/dist/es/standards-sdk.es149.js +325 -0
- package/dist/es/standards-sdk.es149.js.map +1 -0
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es150.js +349 -0
- package/dist/es/standards-sdk.es150.js.map +1 -0
- package/dist/es/standards-sdk.es151.js +456 -0
- package/dist/es/standards-sdk.es151.js.map +1 -0
- package/dist/es/standards-sdk.es152.js +334 -0
- package/dist/es/standards-sdk.es152.js.map +1 -0
- package/dist/es/standards-sdk.es153.js +79 -0
- package/dist/es/standards-sdk.es153.js.map +1 -0
- package/dist/es/standards-sdk.es154.js +12290 -0
- package/dist/es/standards-sdk.es154.js.map +1 -0
- package/dist/es/standards-sdk.es155.js +59 -0
- package/dist/es/standards-sdk.es155.js.map +1 -0
- package/dist/es/standards-sdk.es156.js +85 -0
- package/dist/es/standards-sdk.es156.js.map +1 -0
- package/dist/es/standards-sdk.es157.js +874 -0
- package/dist/es/standards-sdk.es157.js.map +1 -0
- package/dist/es/standards-sdk.es158.js +242 -0
- package/dist/es/standards-sdk.es158.js.map +1 -0
- package/dist/es/standards-sdk.es159.js +247 -0
- package/dist/es/standards-sdk.es159.js.map +1 -0
- package/dist/es/standards-sdk.es16.js +1 -1
- package/dist/es/standards-sdk.es17.js +13 -11
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +20 -17
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es20.js +17 -14
- package/dist/es/standards-sdk.es20.js.map +1 -1
- package/dist/es/standards-sdk.es21.js +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es26.js +1 -1
- package/dist/es/standards-sdk.es27.js +1 -1
- package/dist/es/standards-sdk.es28.js +24 -19
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js.map +1 -1
- package/dist/es/standards-sdk.es3.js +2 -2
- package/dist/es/standards-sdk.es31.js +2 -2
- package/dist/es/standards-sdk.es32.js +4 -4
- package/dist/es/standards-sdk.es33.js +1 -1
- package/dist/es/standards-sdk.es36.js +16 -13
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +4 -4
- package/dist/es/standards-sdk.es38.js +2 -2
- package/dist/es/standards-sdk.es39.js +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +1 -1
- package/dist/es/standards-sdk.es42.js +2 -2
- package/dist/es/standards-sdk.es47.js +1 -1
- package/dist/es/standards-sdk.es5.js +2 -2
- package/dist/es/standards-sdk.es52.js +1 -1
- package/dist/es/standards-sdk.es54.js +1 -1
- package/dist/es/standards-sdk.es57.js +2 -2
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es61.js +15 -12
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +1 -1
- package/dist/es/standards-sdk.es65.js +2 -2
- package/dist/es/standards-sdk.es66.js +3 -3
- package/dist/es/standards-sdk.es69.js +2 -2
- package/dist/es/standards-sdk.es7.js +2 -2
- package/dist/es/standards-sdk.es70.js +3 -3
- package/dist/es/standards-sdk.es71.js +2 -2
- package/dist/es/standards-sdk.es72.js +1 -1
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +2 -2
- package/dist/es/standards-sdk.es77.js +5 -3
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +12 -11
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +1 -1
- package/dist/es/standards-sdk.es8.js +1 -1
- package/dist/es/standards-sdk.es80.js +113 -29
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +23 -4
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +39 -14
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +198 -17
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +256 -9
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +55 -21
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +22 -75
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +45 -30
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +57 -22
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +28 -23
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +23 -167
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +158 -119
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +68 -95
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +136 -119
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +139 -39
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +42 -257
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +243 -80
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +47 -48
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +100 -28
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/es/utils/dynamic-import.d.ts +1 -0
- package/dist/es/utils/dynamic-import.d.ts.map +1 -1
- package/package.json +8 -10
|
@@ -1,31 +1,125 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { chatHistorySnapshotResponseSchema } from "./standards-sdk.es157.js";
|
|
3
|
+
import { RegistryBrokerClient } from "./standards-sdk.es136.js";
|
|
4
|
+
const conversationContexts = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function getConversationContextMap(client) {
|
|
6
|
+
const existing = conversationContexts.get(client);
|
|
7
|
+
if (existing) {
|
|
8
|
+
return existing;
|
|
9
|
+
}
|
|
10
|
+
const created = /* @__PURE__ */ new Map();
|
|
11
|
+
conversationContexts.set(client, created);
|
|
12
|
+
return created;
|
|
13
|
+
}
|
|
14
|
+
function identitiesMatch(a, b) {
|
|
15
|
+
if (!a && !b) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (!a || !b) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (a.uaid && b.uaid && a.uaid.toLowerCase() === b.uaid.toLowerCase()) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (a.ledgerAccountId && b.ledgerAccountId && a.ledgerAccountId.toLowerCase() === b.ledgerAccountId.toLowerCase()) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (a.userId && b.userId && a.userId === b.userId) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (a.email && b.email && a.email.toLowerCase() === b.email.toLowerCase()) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
RegistryBrokerClient.prototype.fetchHistorySnapshot = async function(sessionId, options) {
|
|
36
|
+
if (!sessionId || sessionId.trim().length === 0) {
|
|
37
|
+
throw new Error("sessionId is required to fetch chat history");
|
|
38
|
+
}
|
|
39
|
+
const raw = await this.requestJson(
|
|
40
|
+
`/chat/session/${encodeURIComponent(sessionId)}/history`,
|
|
41
|
+
{
|
|
42
|
+
method: "GET"
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const snapshot = this.parseWithSchema(
|
|
46
|
+
raw,
|
|
47
|
+
chatHistorySnapshotResponseSchema,
|
|
48
|
+
"chat history snapshot response"
|
|
49
|
+
);
|
|
50
|
+
return this.attachDecryptedHistory(sessionId, snapshot, options);
|
|
51
|
+
};
|
|
52
|
+
RegistryBrokerClient.prototype.attachDecryptedHistory = function(sessionId, snapshot, options) {
|
|
53
|
+
const shouldDecrypt = options?.decrypt !== void 0 ? options.decrypt : this.encryptionOptions?.autoDecryptHistory === true;
|
|
54
|
+
if (!shouldDecrypt) {
|
|
55
|
+
return snapshot;
|
|
56
|
+
}
|
|
57
|
+
const context = this.resolveDecryptionContext(sessionId, options);
|
|
58
|
+
if (!context) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
"Unable to decrypt chat history: encryption context unavailable"
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const decryptedHistory = snapshot.history.map((entry) => ({
|
|
64
|
+
entry,
|
|
65
|
+
plaintext: this.decryptHistoryEntryFromContext(sessionId, entry, context)
|
|
66
|
+
}));
|
|
67
|
+
return { ...snapshot, decryptedHistory };
|
|
68
|
+
};
|
|
69
|
+
RegistryBrokerClient.prototype.registerConversationContextForEncryption = function(context) {
|
|
70
|
+
const normalized = {
|
|
71
|
+
sessionId: context.sessionId,
|
|
72
|
+
sharedSecret: Buffer.from(context.sharedSecret),
|
|
73
|
+
identity: context.identity ? { ...context.identity } : void 0
|
|
74
|
+
};
|
|
75
|
+
const map = getConversationContextMap(this);
|
|
76
|
+
const entries = map.get(context.sessionId) ?? [];
|
|
77
|
+
const existingIndex = entries.findIndex(
|
|
78
|
+
(existing) => identitiesMatch(existing.identity, normalized.identity)
|
|
79
|
+
);
|
|
80
|
+
if (existingIndex >= 0) {
|
|
81
|
+
entries[existingIndex] = normalized;
|
|
82
|
+
} else {
|
|
83
|
+
entries.push(normalized);
|
|
84
|
+
}
|
|
85
|
+
map.set(context.sessionId, entries);
|
|
86
|
+
};
|
|
87
|
+
RegistryBrokerClient.prototype.resolveDecryptionContext = function(sessionId, options) {
|
|
88
|
+
if (options?.sharedSecret) {
|
|
89
|
+
return {
|
|
90
|
+
sessionId,
|
|
91
|
+
sharedSecret: this.normalizeSharedSecret(options.sharedSecret),
|
|
92
|
+
identity: options.identity
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const map = getConversationContextMap(this);
|
|
96
|
+
const contexts = map.get(sessionId);
|
|
97
|
+
if (!contexts || contexts.length === 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (options?.identity) {
|
|
101
|
+
const match = contexts.find(
|
|
102
|
+
(context) => identitiesMatch(context.identity, options.identity)
|
|
103
|
+
);
|
|
104
|
+
if (match) {
|
|
105
|
+
return match;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return contexts[0];
|
|
109
|
+
};
|
|
110
|
+
RegistryBrokerClient.prototype.decryptHistoryEntryFromContext = function(sessionId, entry, context) {
|
|
111
|
+
const envelope = entry.cipherEnvelope;
|
|
112
|
+
if (!envelope) {
|
|
113
|
+
return entry.content;
|
|
114
|
+
}
|
|
115
|
+
const secret = Buffer.from(context.sharedSecret);
|
|
116
|
+
try {
|
|
117
|
+
return this.encryption.decryptCipherEnvelope({
|
|
118
|
+
envelope,
|
|
119
|
+
sharedSecret: secret
|
|
120
|
+
});
|
|
121
|
+
} catch (_error) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
30
124
|
};
|
|
31
125
|
//# sourceMappingURL=standards-sdk.es134.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es134.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standards-sdk.es134.js","sources":["../../src/services/registry-broker/client/chat-history.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport type {\n ChatHistoryEntry,\n ChatHistoryFetchOptions,\n ChatHistorySnapshotResponse,\n ChatHistorySnapshotWithDecryptedEntries,\n JsonValue,\n RecipientIdentity,\n} from '../types';\nimport { chatHistorySnapshotResponseSchema } from '../schemas';\nimport { RegistryBrokerClient } from './base-client';\n\ninterface ConversationContextInput {\n sessionId: string;\n sharedSecret: Uint8Array | Buffer;\n identity?: RecipientIdentity;\n}\n\ninterface ConversationContextState {\n sessionId: string;\n sharedSecret: Buffer;\n identity?: RecipientIdentity;\n}\n\nconst conversationContexts = new WeakMap<\n RegistryBrokerClient,\n Map<string, ConversationContextState[]>\n>();\n\nfunction getConversationContextMap(\n client: RegistryBrokerClient,\n): Map<string, ConversationContextState[]> {\n const existing = conversationContexts.get(client);\n if (existing) {\n return existing;\n }\n const created = new Map<string, ConversationContextState[]>();\n conversationContexts.set(client, created);\n return created;\n}\n\nfunction identitiesMatch(\n a?: RecipientIdentity,\n b?: RecipientIdentity,\n): boolean {\n if (!a && !b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n if (a.uaid && b.uaid && a.uaid.toLowerCase() === b.uaid.toLowerCase()) {\n return true;\n }\n if (\n a.ledgerAccountId &&\n b.ledgerAccountId &&\n a.ledgerAccountId.toLowerCase() === b.ledgerAccountId.toLowerCase()\n ) {\n return true;\n }\n if (a.userId && b.userId && a.userId === b.userId) {\n return true;\n }\n if (a.email && b.email && a.email.toLowerCase() === b.email.toLowerCase()) {\n return true;\n }\n return false;\n}\n\ndeclare module './base-client' {\n interface RegistryBrokerClient {\n fetchHistorySnapshot(\n sessionId: string,\n options?: ChatHistoryFetchOptions,\n ): Promise<ChatHistorySnapshotWithDecryptedEntries>;\n attachDecryptedHistory(\n sessionId: string,\n snapshot: ChatHistorySnapshotResponse,\n options?: ChatHistoryFetchOptions,\n ): ChatHistorySnapshotWithDecryptedEntries;\n registerConversationContextForEncryption(\n context: ConversationContextInput,\n ): void;\n resolveDecryptionContext(\n sessionId: string,\n options?: ChatHistoryFetchOptions,\n ): ConversationContextState | null;\n decryptHistoryEntryFromContext(\n sessionId: string,\n entry: ChatHistoryEntry,\n context: ConversationContextState,\n ): string | null;\n }\n}\n\nRegistryBrokerClient.prototype.fetchHistorySnapshot = async function (\n this: RegistryBrokerClient,\n sessionId: string,\n options?: ChatHistoryFetchOptions,\n): Promise<ChatHistorySnapshotWithDecryptedEntries> {\n if (!sessionId || sessionId.trim().length === 0) {\n throw new Error('sessionId is required to fetch chat history');\n }\n const raw = await this.requestJson<JsonValue>(\n `/chat/session/${encodeURIComponent(sessionId)}/history`,\n {\n method: 'GET',\n },\n );\n const snapshot = this.parseWithSchema(\n raw,\n chatHistorySnapshotResponseSchema,\n 'chat history snapshot response',\n );\n return this.attachDecryptedHistory(sessionId, snapshot, options);\n};\n\nRegistryBrokerClient.prototype.attachDecryptedHistory = function (\n this: RegistryBrokerClient,\n sessionId: string,\n snapshot: ChatHistorySnapshotResponse,\n options?: ChatHistoryFetchOptions,\n): ChatHistorySnapshotWithDecryptedEntries {\n const shouldDecrypt =\n options?.decrypt !== undefined\n ? options.decrypt\n : this.encryptionOptions?.autoDecryptHistory === true;\n if (!shouldDecrypt) {\n return snapshot;\n }\n const context = this.resolveDecryptionContext(sessionId, options);\n if (!context) {\n throw new Error(\n 'Unable to decrypt chat history: encryption context unavailable',\n );\n }\n const decryptedHistory = snapshot.history.map(entry => ({\n entry,\n plaintext: this.decryptHistoryEntryFromContext(sessionId, entry, context),\n }));\n return { ...snapshot, decryptedHistory };\n};\n\nRegistryBrokerClient.prototype.registerConversationContextForEncryption =\n function (\n this: RegistryBrokerClient,\n context: ConversationContextInput,\n ): void {\n const normalized: ConversationContextState = {\n sessionId: context.sessionId,\n sharedSecret: Buffer.from(context.sharedSecret),\n identity: context.identity ? { ...context.identity } : undefined,\n };\n const map = getConversationContextMap(this);\n const entries = map.get(context.sessionId) ?? [];\n const existingIndex = entries.findIndex(existing =>\n identitiesMatch(existing.identity, normalized.identity),\n );\n if (existingIndex >= 0) {\n entries[existingIndex] = normalized;\n } else {\n entries.push(normalized);\n }\n map.set(context.sessionId, entries);\n };\n\nRegistryBrokerClient.prototype.resolveDecryptionContext = function (\n this: RegistryBrokerClient,\n sessionId: string,\n options?: ChatHistoryFetchOptions,\n): ConversationContextState | null {\n if (options?.sharedSecret) {\n return {\n sessionId,\n sharedSecret: this.normalizeSharedSecret(options.sharedSecret),\n identity: options.identity,\n };\n }\n const map = getConversationContextMap(this);\n const contexts = map.get(sessionId);\n if (!contexts || contexts.length === 0) {\n return null;\n }\n if (options?.identity) {\n const match = contexts.find(context =>\n identitiesMatch(context.identity, options.identity),\n );\n if (match) {\n return match;\n }\n }\n return contexts[0];\n};\n\nRegistryBrokerClient.prototype.decryptHistoryEntryFromContext = function (\n this: RegistryBrokerClient,\n sessionId: string,\n entry: ChatHistoryEntry,\n context: ConversationContextState,\n): string | null {\n const envelope = entry.cipherEnvelope;\n if (!envelope) {\n return entry.content;\n }\n const secret = Buffer.from(context.sharedSecret);\n try {\n return this.encryption.decryptCipherEnvelope({\n envelope,\n sharedSecret: secret,\n });\n } catch (_error) {\n return null;\n }\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -1,141 +1,329 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const detected = detectKeyTypeFromString(operatorKeyInput);
|
|
24
|
-
return {
|
|
25
|
-
keyType: detected.detectedType,
|
|
26
|
-
privateKey: detected.privateKey
|
|
27
|
-
};
|
|
28
|
-
} catch {
|
|
29
|
-
return {
|
|
30
|
-
keyType: "ecdsa",
|
|
31
|
-
privateKey: PrivateKey.fromStringECDSA(operatorKeyInput)
|
|
32
|
-
};
|
|
1
|
+
import { createSessionResponseSchema, chatHistoryCompactionResponseSchema, sessionEncryptionStatusResponseSchema, encryptionHandshakeResponseSchema, sendMessageResponseSchema } from "./standards-sdk.es157.js";
|
|
2
|
+
import { RegistryBrokerClient } from "./standards-sdk.es136.js";
|
|
3
|
+
import { serialiseAuthConfig, toJsonObject } from "./standards-sdk.es158.js";
|
|
4
|
+
import { EncryptionUnavailableError, EncryptedChatManager } from "./standards-sdk.es159.js";
|
|
5
|
+
const encryptedManagers = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
const chatApis = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function getEncryptedChatManager(client) {
|
|
8
|
+
const existing = encryptedManagers.get(client);
|
|
9
|
+
if (existing) {
|
|
10
|
+
return existing;
|
|
11
|
+
}
|
|
12
|
+
const created = new EncryptedChatManager(client);
|
|
13
|
+
encryptedManagers.set(client, created);
|
|
14
|
+
return created;
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(RegistryBrokerClient.prototype, "chat", {
|
|
17
|
+
get() {
|
|
18
|
+
const existing = chatApis.get(this);
|
|
19
|
+
if (existing) {
|
|
20
|
+
return existing;
|
|
33
21
|
}
|
|
22
|
+
const encryptedManager = getEncryptedChatManager(this);
|
|
23
|
+
const api = {
|
|
24
|
+
start: (options) => this.startChat(options),
|
|
25
|
+
createSession: (payload) => this.createSession(payload),
|
|
26
|
+
sendMessage: (payload) => this.sendMessage(payload),
|
|
27
|
+
endSession: (sessionId) => this.endSession(sessionId),
|
|
28
|
+
getHistory: (sessionId, options) => this.fetchHistorySnapshot(sessionId, options),
|
|
29
|
+
compactHistory: (payload) => this.compactHistory(payload),
|
|
30
|
+
getEncryptionStatus: (sessionId) => this.fetchEncryptionStatus(sessionId),
|
|
31
|
+
submitEncryptionHandshake: (sessionId, payload) => this.postEncryptionHandshake(sessionId, payload),
|
|
32
|
+
startConversation: (options) => this.startConversation(options),
|
|
33
|
+
acceptConversation: (options) => this.acceptConversation(options),
|
|
34
|
+
createEncryptedSession: (options) => encryptedManager.startSession(options),
|
|
35
|
+
acceptEncryptedSession: (options) => encryptedManager.acceptSession(options)
|
|
36
|
+
};
|
|
37
|
+
chatApis.set(this, api);
|
|
38
|
+
return api;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
RegistryBrokerClient.prototype.createSession = async function(payload, allowHistoryAutoTopUp = true) {
|
|
42
|
+
const body = {};
|
|
43
|
+
if ("uaid" in payload && payload.uaid) {
|
|
44
|
+
body.uaid = payload.uaid;
|
|
45
|
+
}
|
|
46
|
+
if ("agentUrl" in payload && payload.agentUrl) {
|
|
47
|
+
body.agentUrl = payload.agentUrl;
|
|
48
|
+
}
|
|
49
|
+
if (payload.auth) {
|
|
50
|
+
body.auth = serialiseAuthConfig(payload.auth);
|
|
51
|
+
}
|
|
52
|
+
if (payload.historyTtlSeconds !== void 0) {
|
|
53
|
+
body.historyTtlSeconds = payload.historyTtlSeconds;
|
|
34
54
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
if (payload.encryptionRequested !== void 0) {
|
|
56
|
+
body.encryptionRequested = payload.encryptionRequested;
|
|
57
|
+
}
|
|
58
|
+
if (payload.senderUaid) {
|
|
59
|
+
body.senderUaid = payload.senderUaid;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const raw = await this.requestJson("/chat/session", {
|
|
63
|
+
method: "POST",
|
|
64
|
+
body,
|
|
65
|
+
headers: { "content-type": "application/json" }
|
|
66
|
+
});
|
|
67
|
+
return this.parseWithSchema(
|
|
68
|
+
raw,
|
|
69
|
+
createSessionResponseSchema,
|
|
70
|
+
"chat session response"
|
|
71
|
+
);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
const maybeError = error instanceof Error ? error : null;
|
|
74
|
+
if (allowHistoryAutoTopUp && this.shouldAutoTopUpHistory(payload, maybeError)) {
|
|
75
|
+
await this.executeHistoryAutoTopUp("chat.session");
|
|
76
|
+
return this.createSession(payload, false);
|
|
44
77
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
RegistryBrokerClient.prototype.startChat = async function(options) {
|
|
82
|
+
if ("uaid" in options && options.uaid) {
|
|
83
|
+
return this.startConversation({
|
|
84
|
+
uaid: options.uaid,
|
|
85
|
+
senderUaid: options.senderUaid,
|
|
86
|
+
historyTtlSeconds: options.historyTtlSeconds,
|
|
87
|
+
auth: options.auth,
|
|
88
|
+
encryption: options.encryption,
|
|
89
|
+
onSessionCreated: options.onSessionCreated
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if ("agentUrl" in options && options.agentUrl) {
|
|
93
|
+
const session = await this.createSession({
|
|
94
|
+
agentUrl: options.agentUrl,
|
|
95
|
+
auth: options.auth,
|
|
96
|
+
historyTtlSeconds: options.historyTtlSeconds,
|
|
97
|
+
senderUaid: options.senderUaid
|
|
98
|
+
});
|
|
99
|
+
options.onSessionCreated?.(session.sessionId);
|
|
100
|
+
return this.createPlaintextConversationHandle(
|
|
101
|
+
session.sessionId,
|
|
102
|
+
session.encryption ?? null,
|
|
103
|
+
options.auth,
|
|
104
|
+
{ agentUrl: options.agentUrl, uaid: options.uaid }
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
throw new Error("startChat requires either uaid or agentUrl");
|
|
108
|
+
};
|
|
109
|
+
RegistryBrokerClient.prototype.startConversation = async function(options) {
|
|
110
|
+
const preference = options.encryption?.preference ?? "preferred";
|
|
111
|
+
const requestEncryption = preference !== "disabled";
|
|
112
|
+
if (!requestEncryption) {
|
|
113
|
+
const session = await this.createSession({
|
|
114
|
+
uaid: options.uaid,
|
|
115
|
+
auth: options.auth,
|
|
116
|
+
historyTtlSeconds: options.historyTtlSeconds,
|
|
117
|
+
senderUaid: options.senderUaid,
|
|
118
|
+
encryptionRequested: false
|
|
119
|
+
});
|
|
120
|
+
options.onSessionCreated?.(session.sessionId);
|
|
121
|
+
return this.createPlaintextConversationHandle(
|
|
122
|
+
session.sessionId,
|
|
123
|
+
session.encryption ?? null,
|
|
124
|
+
options.auth,
|
|
125
|
+
{ uaid: options.uaid }
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const encryptedManager = getEncryptedChatManager(this);
|
|
130
|
+
const handle = await encryptedManager.startSession({
|
|
131
|
+
uaid: options.uaid,
|
|
132
|
+
senderUaid: options.senderUaid,
|
|
133
|
+
historyTtlSeconds: options.historyTtlSeconds,
|
|
134
|
+
handshakeTimeoutMs: options.encryption?.handshakeTimeoutMs,
|
|
135
|
+
pollIntervalMs: options.encryption?.pollIntervalMs,
|
|
136
|
+
onSessionCreated: (sessionId) => {
|
|
137
|
+
options.onSessionCreated?.(sessionId);
|
|
138
|
+
},
|
|
139
|
+
auth: options.auth
|
|
140
|
+
});
|
|
141
|
+
return handle;
|
|
142
|
+
} catch (error) {
|
|
143
|
+
if (error instanceof EncryptionUnavailableError) {
|
|
144
|
+
if (preference === "required") {
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
return this.createPlaintextConversationHandle(
|
|
148
|
+
error.sessionId,
|
|
149
|
+
error.summary ?? null,
|
|
150
|
+
options.auth,
|
|
151
|
+
{ uaid: options.uaid }
|
|
152
|
+
);
|
|
48
153
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
RegistryBrokerClient.prototype.acceptConversation = async function(options) {
|
|
158
|
+
const preference = options.encryption?.preference ?? "preferred";
|
|
159
|
+
if (preference === "disabled") {
|
|
160
|
+
return this.createPlaintextConversationHandle(options.sessionId, null);
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const encryptedManager = getEncryptedChatManager(this);
|
|
164
|
+
const handle = await encryptedManager.acceptSession({
|
|
165
|
+
sessionId: options.sessionId,
|
|
166
|
+
responderUaid: options.responderUaid,
|
|
167
|
+
handshakeTimeoutMs: options.encryption?.handshakeTimeoutMs,
|
|
168
|
+
pollIntervalMs: options.encryption?.pollIntervalMs
|
|
169
|
+
});
|
|
170
|
+
return handle;
|
|
171
|
+
} catch (error) {
|
|
172
|
+
if (error instanceof EncryptionUnavailableError && preference !== "required") {
|
|
173
|
+
return this.createPlaintextConversationHandle(
|
|
174
|
+
options.sessionId,
|
|
175
|
+
null,
|
|
176
|
+
void 0,
|
|
177
|
+
{ uaid: options.responderUaid }
|
|
59
178
|
);
|
|
60
|
-
return this.bestGuessOperatorKey(operatorKeyInput);
|
|
61
179
|
}
|
|
180
|
+
throw error;
|
|
62
181
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
if (t.includes("ED25519")) {
|
|
77
|
-
return PrivateKey.fromStringED25519(keyInput);
|
|
78
|
-
}
|
|
79
|
-
if (t.includes("ECDSA")) {
|
|
80
|
-
return PrivateKey.fromStringECDSA(keyInput);
|
|
81
|
-
}
|
|
82
|
-
return fallbackType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
|
|
83
|
-
} catch {
|
|
84
|
-
if (typeof keyInput !== "string") {
|
|
85
|
-
return keyInput;
|
|
86
|
-
}
|
|
87
|
-
if (explicitType) {
|
|
88
|
-
return explicitType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
|
|
182
|
+
};
|
|
183
|
+
RegistryBrokerClient.prototype.createPlaintextConversationHandle = function(sessionId, summary, defaultAuth, context) {
|
|
184
|
+
const uaid = context?.uaid?.trim();
|
|
185
|
+
const agentUrl = context?.agentUrl?.trim();
|
|
186
|
+
return {
|
|
187
|
+
sessionId,
|
|
188
|
+
mode: "plaintext",
|
|
189
|
+
summary: summary ?? null,
|
|
190
|
+
send: async (options) => {
|
|
191
|
+
const plaintext = options.plaintext;
|
|
192
|
+
if (!plaintext || plaintext.trim().length === 0) {
|
|
193
|
+
throw new Error("plaintext is required for chat messages");
|
|
89
194
|
}
|
|
90
|
-
|
|
195
|
+
const message = options.message ?? plaintext;
|
|
196
|
+
return this.sendMessage({
|
|
197
|
+
sessionId,
|
|
198
|
+
message,
|
|
199
|
+
streaming: options.streaming,
|
|
200
|
+
auth: options.auth ?? defaultAuth,
|
|
201
|
+
uaid,
|
|
202
|
+
agentUrl
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
decryptHistoryEntry: (entry) => entry.content
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
RegistryBrokerClient.prototype.compactHistory = async function(payload) {
|
|
209
|
+
if (!payload.sessionId || payload.sessionId.trim().length === 0) {
|
|
210
|
+
throw new Error("sessionId is required to compact chat history");
|
|
211
|
+
}
|
|
212
|
+
const body = {};
|
|
213
|
+
if (typeof payload.preserveEntries === "number" && Number.isFinite(payload.preserveEntries) && payload.preserveEntries >= 0) {
|
|
214
|
+
body.preserveEntries = Math.floor(payload.preserveEntries);
|
|
215
|
+
}
|
|
216
|
+
const raw = await this.requestJson(
|
|
217
|
+
`/chat/session/${encodeURIComponent(payload.sessionId)}/compact`,
|
|
218
|
+
{
|
|
219
|
+
method: "POST",
|
|
220
|
+
headers: { "content-type": "application/json" },
|
|
221
|
+
body
|
|
91
222
|
}
|
|
223
|
+
);
|
|
224
|
+
return this.parseWithSchema(
|
|
225
|
+
raw,
|
|
226
|
+
chatHistoryCompactionResponseSchema,
|
|
227
|
+
"chat history compaction response"
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
RegistryBrokerClient.prototype.fetchEncryptionStatus = async function(sessionId) {
|
|
231
|
+
if (!sessionId || sessionId.trim().length === 0) {
|
|
232
|
+
throw new Error("sessionId is required for encryption status");
|
|
92
233
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const guess = resolver.bestGuessOperatorKey(
|
|
104
|
-
params.operatorKey,
|
|
105
|
-
params.keyType
|
|
234
|
+
const raw = await this.requestJson(
|
|
235
|
+
`/chat/session/${encodeURIComponent(sessionId)}/encryption`,
|
|
236
|
+
{
|
|
237
|
+
method: "GET"
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
return this.parseWithSchema(
|
|
241
|
+
raw,
|
|
242
|
+
sessionEncryptionStatusResponseSchema,
|
|
243
|
+
"session encryption status response"
|
|
106
244
|
);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
245
|
+
};
|
|
246
|
+
RegistryBrokerClient.prototype.postEncryptionHandshake = async function(sessionId, payload) {
|
|
247
|
+
if (!sessionId || sessionId.trim().length === 0) {
|
|
248
|
+
throw new Error("sessionId is required for encryption handshake");
|
|
249
|
+
}
|
|
250
|
+
const raw = await this.requestJson(
|
|
251
|
+
`/chat/session/${encodeURIComponent(sessionId)}/encryption-handshake`,
|
|
252
|
+
{
|
|
253
|
+
method: "POST",
|
|
254
|
+
headers: { "content-type": "application/json" },
|
|
255
|
+
body: {
|
|
256
|
+
role: payload.role,
|
|
257
|
+
keyType: payload.keyType,
|
|
258
|
+
ephemeralPublicKey: payload.ephemeralPublicKey,
|
|
259
|
+
longTermPublicKey: payload.longTermPublicKey,
|
|
260
|
+
signature: payload.signature,
|
|
261
|
+
uaid: payload.uaid,
|
|
262
|
+
userId: payload.userId,
|
|
263
|
+
ledgerAccountId: payload.ledgerAccountId,
|
|
264
|
+
metadata: payload.metadata
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
const response = this.parseWithSchema(
|
|
269
|
+
raw,
|
|
270
|
+
encryptionHandshakeResponseSchema,
|
|
271
|
+
"encryption handshake response"
|
|
272
|
+
);
|
|
273
|
+
return response.handshake;
|
|
274
|
+
};
|
|
275
|
+
RegistryBrokerClient.prototype.sendMessage = async function(payload) {
|
|
276
|
+
const body = {
|
|
277
|
+
message: payload.message
|
|
278
|
+
};
|
|
279
|
+
if (payload.streaming !== void 0) {
|
|
280
|
+
body.streaming = payload.streaming;
|
|
281
|
+
}
|
|
282
|
+
if (payload.auth) {
|
|
283
|
+
body.auth = serialiseAuthConfig(payload.auth);
|
|
284
|
+
}
|
|
285
|
+
if ("uaid" in payload) {
|
|
286
|
+
body.uaid = payload.uaid;
|
|
287
|
+
}
|
|
288
|
+
if ("sessionId" in payload && payload.sessionId) {
|
|
289
|
+
body.sessionId = payload.sessionId;
|
|
290
|
+
}
|
|
291
|
+
if ("agentUrl" in payload && payload.agentUrl) {
|
|
292
|
+
body.agentUrl = payload.agentUrl;
|
|
293
|
+
}
|
|
294
|
+
let cipherEnvelope = payload.cipherEnvelope ?? null;
|
|
295
|
+
if (payload.encryption) {
|
|
296
|
+
const sessionIdForEncryption = payload.encryption.sessionId ?? (typeof body.sessionId === "string" ? body.sessionId : void 0);
|
|
297
|
+
if (!sessionIdForEncryption) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
"sessionId is required when using encrypted chat payloads"
|
|
116
300
|
);
|
|
117
|
-
currentKeyType = resolved.keyType;
|
|
118
|
-
currentPrivateKey = resolved.privateKey;
|
|
119
|
-
client.setOperator(operatorId.toString(), currentPrivateKey);
|
|
120
|
-
} catch {
|
|
121
301
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
client,
|
|
125
|
-
operatorId,
|
|
126
|
-
get operatorKey() {
|
|
127
|
-
return currentPrivateKey;
|
|
128
|
-
},
|
|
129
|
-
get keyType() {
|
|
130
|
-
return currentKeyType;
|
|
131
|
-
},
|
|
132
|
-
ensureInitialized: async () => {
|
|
133
|
-
await initPromise;
|
|
302
|
+
if (!payload.encryption.recipients?.length) {
|
|
303
|
+
throw new Error("recipients are required for encrypted chat payloads");
|
|
134
304
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
305
|
+
cipherEnvelope = this.encryption.encryptCipherEnvelope({
|
|
306
|
+
...payload.encryption,
|
|
307
|
+
sessionId: sessionIdForEncryption
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
if (cipherEnvelope) {
|
|
311
|
+
body.cipherEnvelope = toJsonObject(cipherEnvelope);
|
|
312
|
+
}
|
|
313
|
+
const raw = await this.requestJson("/chat/message", {
|
|
314
|
+
method: "POST",
|
|
315
|
+
body,
|
|
316
|
+
headers: { "content-type": "application/json" }
|
|
317
|
+
});
|
|
318
|
+
return this.parseWithSchema(
|
|
319
|
+
raw,
|
|
320
|
+
sendMessageResponseSchema,
|
|
321
|
+
"chat message response"
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
RegistryBrokerClient.prototype.endSession = async function(sessionId) {
|
|
325
|
+
await this.request(`/chat/session/${encodeURIComponent(sessionId)}`, {
|
|
326
|
+
method: "DELETE"
|
|
327
|
+
});
|
|
140
328
|
};
|
|
141
329
|
//# sourceMappingURL=standards-sdk.es135.js.map
|