@fairmint/canton-node-sdk 0.0.300 → 0.0.301

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 (98) hide show
  1. package/README.md +108 -22
  2. package/build/src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.d.ts +8 -6
  3. package/build/src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.d.ts.map +1 -1
  4. package/build/src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.js +8 -6
  5. package/build/src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.js.map +1 -1
  6. package/build/src/external-parties/directory.d.ts +22 -10
  7. package/build/src/external-parties/directory.d.ts.map +1 -1
  8. package/build/src/external-parties/directory.js +42 -27
  9. package/build/src/external-parties/directory.js.map +1 -1
  10. package/build/src/external-parties/index.d.ts +9 -16
  11. package/build/src/external-parties/index.d.ts.map +1 -1
  12. package/build/src/external-parties/index.js +9 -35
  13. package/build/src/external-parties/index.js.map +1 -1
  14. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.d.ts +1 -1
  15. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.d.ts.map +1 -1
  16. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.js +16 -5
  17. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.js.map +1 -1
  18. package/build/src/utils/amulet/external-party-transfer-offer.d.ts +5 -3
  19. package/build/src/utils/amulet/external-party-transfer-offer.d.ts.map +1 -1
  20. package/build/src/utils/amulet/external-party-transfer-offer.js +21 -7
  21. package/build/src/utils/amulet/external-party-transfer-offer.js.map +1 -1
  22. package/build/src/utils/amulet/external-party-transfer-preapproval.d.ts +8 -1
  23. package/build/src/utils/amulet/external-party-transfer-preapproval.d.ts.map +1 -1
  24. package/build/src/utils/amulet/external-party-transfer-preapproval.js +30 -7
  25. package/build/src/utils/amulet/external-party-transfer-preapproval.js.map +1 -1
  26. package/build/src/utils/amulet/index.d.ts +0 -1
  27. package/build/src/utils/amulet/index.d.ts.map +1 -1
  28. package/build/src/utils/amulet/index.js +0 -1
  29. package/build/src/utils/amulet/index.js.map +1 -1
  30. package/build/src/utils/external-signing/canton-ed25519-signer.d.ts +7 -1
  31. package/build/src/utils/external-signing/canton-ed25519-signer.d.ts.map +1 -1
  32. package/build/src/utils/external-signing/canton-ed25519-signer.js +15 -7
  33. package/build/src/utils/external-signing/canton-ed25519-signer.js.map +1 -1
  34. package/build/src/utils/external-signing/canton-protocol.d.ts +5 -37
  35. package/build/src/utils/external-signing/canton-protocol.d.ts.map +1 -1
  36. package/build/src/utils/external-signing/canton-protocol.js +10 -217
  37. package/build/src/utils/external-signing/canton-protocol.js.map +1 -1
  38. package/build/src/utils/external-signing/create-external-party.d.ts +27 -6
  39. package/build/src/utils/external-signing/create-external-party.d.ts.map +1 -1
  40. package/build/src/utils/external-signing/create-external-party.js +39 -11
  41. package/build/src/utils/external-signing/create-external-party.js.map +1 -1
  42. package/build/src/utils/external-signing/execute-external-party-signed-transaction.d.ts +7 -3
  43. package/build/src/utils/external-signing/execute-external-party-signed-transaction.d.ts.map +1 -1
  44. package/build/src/utils/external-signing/execute-external-party-signed-transaction.js +17 -7
  45. package/build/src/utils/external-signing/execute-external-party-signed-transaction.js.map +1 -1
  46. package/build/src/utils/external-signing/external-party-lifecycle.js +2 -2
  47. package/build/src/utils/external-signing/external-party-lifecycle.js.map +1 -1
  48. package/build/src/utils/external-signing/external-party-onboarding.d.ts +56 -14
  49. package/build/src/utils/external-signing/external-party-onboarding.d.ts.map +1 -1
  50. package/build/src/utils/external-signing/external-party-onboarding.js +71 -26
  51. package/build/src/utils/external-signing/external-party-onboarding.js.map +1 -1
  52. package/build/src/utils/external-signing/external-party-wallet.d.ts +23 -6
  53. package/build/src/utils/external-signing/external-party-wallet.d.ts.map +1 -1
  54. package/build/src/utils/external-signing/external-party-wallet.js +52 -18
  55. package/build/src/utils/external-signing/external-party-wallet.js.map +1 -1
  56. package/build/src/utils/external-signing/external-signing-client.d.ts.map +1 -1
  57. package/build/src/utils/external-signing/external-signing-client.js +17 -16
  58. package/build/src/utils/external-signing/external-signing-client.js.map +1 -1
  59. package/build/src/utils/external-signing/hash-signature.d.ts +20 -0
  60. package/build/src/utils/external-signing/hash-signature.d.ts.map +1 -0
  61. package/build/src/utils/external-signing/hash-signature.js +63 -0
  62. package/build/src/utils/external-signing/hash-signature.js.map +1 -0
  63. package/build/src/utils/external-signing/onboarding-topology.d.ts +82 -0
  64. package/build/src/utils/external-signing/onboarding-topology.d.ts.map +1 -0
  65. package/build/src/utils/external-signing/onboarding-topology.js +213 -0
  66. package/build/src/utils/external-signing/onboarding-topology.js.map +1 -0
  67. package/build/src/utils/external-signing/party-identity.d.ts +43 -0
  68. package/build/src/utils/external-signing/party-identity.d.ts.map +1 -0
  69. package/build/src/utils/external-signing/party-identity.js +120 -0
  70. package/build/src/utils/external-signing/party-identity.js.map +1 -0
  71. package/build/src/utils/external-signing/prepared-transaction.d.ts +58 -0
  72. package/build/src/utils/external-signing/prepared-transaction.d.ts.map +1 -0
  73. package/build/src/utils/external-signing/prepared-transaction.js +158 -0
  74. package/build/src/utils/external-signing/prepared-transaction.js.map +1 -0
  75. package/build/src/utils/external-signing/wallet-ownership-checks.d.ts.map +1 -1
  76. package/build/src/utils/external-signing/wallet-ownership-checks.js +8 -5
  77. package/build/src/utils/external-signing/wallet-ownership-checks.js.map +1 -1
  78. package/package.json +5 -3
  79. package/build/src/external-parties/discovery.d.ts +0 -72
  80. package/build/src/external-parties/discovery.d.ts.map +0 -1
  81. package/build/src/external-parties/discovery.js +0 -160
  82. package/build/src/external-parties/discovery.js.map +0 -1
  83. package/build/src/external-parties/errors.d.ts +0 -28
  84. package/build/src/external-parties/errors.d.ts.map +0 -1
  85. package/build/src/external-parties/errors.js +0 -33
  86. package/build/src/external-parties/errors.js.map +0 -1
  87. package/build/src/external-parties/hints.d.ts +0 -42
  88. package/build/src/external-parties/hints.d.ts.map +0 -1
  89. package/build/src/external-parties/hints.js +0 -83
  90. package/build/src/external-parties/hints.js.map +0 -1
  91. package/build/src/external-parties/keys.d.ts +0 -34
  92. package/build/src/external-parties/keys.d.ts.map +0 -1
  93. package/build/src/external-parties/keys.js +0 -209
  94. package/build/src/external-parties/keys.js.map +0 -1
  95. package/build/src/utils/amulet/external-party-cc-transfer.d.ts +0 -67
  96. package/build/src/utils/amulet/external-party-cc-transfer.d.ts.map +0 -1
  97. package/build/src/utils/amulet/external-party-cc-transfer.js +0 -148
  98. package/build/src/utils/amulet/external-party-cc-transfer.js.map +0 -1
package/README.md CHANGED
@@ -18,6 +18,19 @@ shapes, and error behavior.
18
18
  npm install @fairmint/canton-node-sdk
19
19
  ```
20
20
 
21
+ It needs Node.js 22.12 or later. The SDK is CommonJS, and its dependency
22
+ [`@fairmint/canton-protocol`](https://www.npmjs.com/package/@fairmint/canton-protocol) is ESM only:
23
+ Node loads it through `require()` of an ES module, which Node 22 supports without a flag from 22.12
24
+ (22.12 prints a one-time `ExperimentalWarning`; 22.13 and later do not).
25
+
26
+ Testing with Jest in CommonJS mode? Jest's module runtime does not load ES modules through
27
+ `require()`, so it must compile `@fairmint/canton-protocol` and `@noble/hashes` (2.x, ESM only) to
28
+ CommonJS: add `'^.+\\.js$'` to `transform` (for example ts-jest with `allowJs`, `isolatedModules`
29
+ and `module: 'commonjs'`, as in this repository's
30
+ [`jest.config.js`](https://github.com/Fairmint/canton-node-sdk/blob/main/jest.config.js)) and
31
+ `transformIgnorePatterns: ['/node_modules/(?!(@fairmint/canton-protocol|@noble/hashes)/)']`.
32
+ canton-protocol's other dependencies publish CommonJS. Vitest and Node itself need nothing.
33
+
21
34
  ```ts
22
35
  import { Canton } from '@fairmint/canton-node-sdk';
23
36
 
@@ -69,31 +82,93 @@ same way; it requires an explicit `userId` and a non-empty `parties` list, as th
69
82
  See
70
83
  [`examples/read-any-party.ts`](https://github.com/Fairmint/canton-node-sdk/blob/main/examples/read-any-party.ts).
71
84
 
85
+ ## Onboarding an external party
86
+
87
+ `prepareExternalPartyOnboarding`, `createExternalPartyWithSigner`,
88
+ `createExternalPartyWithEd25519Signer`, the wallet bridge's `prepareExternalParty` and
89
+ `createExternalParty` never sign the participant's word for the topology. They read the local
90
+ participant's ID (`GET /v2/parties/participant-id`), check the generated topology with
91
+ `verifyPartyOnboardingTopology` from `@fairmint/canton-protocol/topology` (the party
92
+ `partyHint::fingerprint` built from the request, never the ID the participant answers; its one key
93
+ with the usages `NAMESPACE`, `PROTOCOL` and `PROOF_OF_OWNERSHIP`, every hosting participant with its
94
+ permission, and the threshold, which defaults to every confirming participant), and hand the signer
95
+ only the multi-hash recomputed from the transactions. A topology that differs is an `OperationError`
96
+ (`TRANSACTION_FAILED`) whose `cause` is the `CantonProtocolError`, and nothing is signed. Hosting
97
+ participant UIDs are `name::1220…` (no `PAR::` prefix), each listed once; at least one participant
98
+ must confirm. The hint is used exactly as given: one with leading or trailing whitespace, or one
99
+ canton-protocol's `buildExternalPartyId` refuses, is a `ValidationError` before any request. Pass
100
+ `expectedLocalParticipantUid` to pin the local participant: a `participant-id` answer naming any
101
+ other participant is then an `OperationError` before topology is generated. Without it, which
102
+ participant hosts the party with the local permission is the participant's own word.
103
+
104
+ `submitExternalPartyOnboarding` (and the wallet bridge's `submitExternalPartySignature`, and
105
+ `createExternalPartyWithSigner` on its own submit) refuses, with a `ValidationError` and before
106
+ allocating, a `multiHashHex` that is not the multi-hash of the submitted `topologyTransactions`, and
107
+ transactions that do not state exactly the onboarding of `partyId` with that key and the hosting
108
+ options it is given (the same options as prepare's: `localParticipantObservationOnly`,
109
+ `otherConfirmingParticipantUids`, `confirmationThreshold`, `observingParticipantUids` and
110
+ `expectedLocalParticipantUid`; by default the local participant confirming alone). It reads the
111
+ local participant's ID for that check. Canton 3.4 or later is required.
112
+
113
+ ## Signing a prepared transaction
114
+
115
+ Every place the SDK prepares a transaction for an external party to sign
116
+ (`executeExternalTransactionWithEd25519Signer`, `prepareExternalPartyCcTokenStandardTransfer`,
117
+ `prepareExternalPartyTransferOfferAcceptance`, the wallet bridge's `prepareCcTransfer` and
118
+ `prepareProviderTransfer`, and `prepareExternalPartyTransferPreapprovalSetup`) returns, or signs,
119
+ only the hash it recomputed from the prepared transaction with `verifyPreparedTransaction` from
120
+ `@fairmint/canton-protocol/transaction`. The participant's hash must equal it, under the hashing
121
+ scheme the SDK asked for (an answer naming another scheme is refused), and the transaction must act
122
+ exactly as the requested parties, under the requested command id, on the requested synchronizer.
123
+ Anything else is an `OperationError` (`TRANSACTION_FAILED`) whose `cause` is the
124
+ `CantonProtocolError` and whose context names its `code` and `field`; nothing is returned to sign.
125
+ The validator prepares the transfer-preapproval setup under a command id and synchronizer of its own
126
+ choosing, so for it the hash (scheme V2, which the validator executes under) and the acting party
127
+ are checked.
128
+
129
+ Before anything is executed or submitted, `executeExternalPartySignedTransaction` (and so every
130
+ submit helper) and `submitExternalPartyTransferPreapprovalSetup` recompute the hash of the submitted
131
+ `preparedTransaction` and refuse a `preparedTransactionHashHex` that differs, or a transaction that
132
+ acts as any party but the signer, with a `ValidationError`. The wallet bridge's prepare tokens bind
133
+ the recomputed hash, the command id and the synchronizer (CC transfer version 3, which
134
+ `submitCcTransfer` now needs `synchronizerId` back for; provider acceptance version 2), not the
135
+ transaction bytes: the submit recomputes the hash from the bytes instead. Signing your own
136
+ `prepareExternalTransaction` result? Recompute the hash the same way before you sign it.
137
+
138
+ `signAndVerifyCantonEd25519Payload` signs only a hash: a topology multi-hash (34 bytes, `1220…`) or
139
+ a prepared-transaction hash (32 bytes). Any other `payloadHex` is refused before the signer is
140
+ called. Hash signatures are checked with canton-protocol's `verifyCantonHashSignature`, and every
141
+ caller refuses a signature that does not verify.
142
+
72
143
  ## Finding every party a key controls
73
144
 
74
145
  An external party's ID is `hint::fingerprint`, where the fingerprint is Canton's SHA-256 multihash
75
146
  of the Ed25519 key: `1220` + hex(sha256(int32be(12) || rawKey)). Nothing about it depends on the
76
147
  signer, so one module serves any wallet. It is browser-safe: import
77
- `@fairmint/canton-node-sdk/external-parties` (it loads `@noble/hashes` and none of the SDK's Node
78
- dependencies); the package root also exports it as the `ExternalParties` namespace.
148
+ `@fairmint/canton-node-sdk/external-parties` (it loads `@fairmint/canton-protocol/party` and none of
149
+ the SDK's Node dependencies); the package root also exports it as the `ExternalParties` namespace.
150
+ To import `isCantonProtocolError`, add `@fairmint/canton-protocol` to your own dependencies (any
151
+ 0.1.x copy matches the directory's errors: the brand is registered with `Symbol.for`).
79
152
 
80
153
  ```typescript
81
- import {
82
- createExternalPartyDirectory,
83
- suggestExternalPartyHint,
84
- validateExternalPartyHint,
85
- } from '@fairmint/canton-node-sdk/external-parties';
154
+ import { createExternalPartyDirectory } from '@fairmint/canton-node-sdk/external-parties';
155
+ import { isCantonProtocolError } from '@fairmint/canton-protocol/party';
86
156
 
87
157
  // One directory per participant: one scan of its party store answers every key for 30 s.
88
158
  const directory = createExternalPartyDirectory({ ledgerClient }); // a LedgerJsonApiClient
89
- const { parties, complete } = await directory.listPartiesForKey({
90
- publicKeyBase64, // raw or DER Ed25519 key; or pass publicKeyFingerprint
91
- hints: ['wallet'], // looked up exactly when the scan does not show them
92
- signal,
93
- });
94
- // parties: [{ partyId, partyHint, hostedHere }], sorted by hint
95
- const hint = suggestExternalPartyHint({ base: 'My app', taken: parties.map((p) => p.partyHint) });
96
- validateExternalPartyHint(hint); // null, or 'empty' | 'too-long' | 'charset' | 'taken'
159
+ try {
160
+ const { parties, complete } = await directory.listPartiesForKey({
161
+ publicKeyBase64, // raw or DER Ed25519 key; or pass publicKeyFingerprint
162
+ hints: ['wallet'], // looked up exactly when the scan does not show them
163
+ signal,
164
+ });
165
+ // parties: [{ partyId, partyHint, hostedHere }], sorted by hint
166
+ } catch (error) {
167
+ if (isCantonProtocolError(error, 'LIST_FAILED')) {
168
+ // error.cause is the ledger client's error
169
+ }
170
+ throw error;
171
+ }
97
172
  ```
98
173
 
99
174
  The participant API has no namespace filter, so a scan reads `GET /v2/parties` page by page and
@@ -102,15 +177,26 @@ keeps the parties ending in `::fingerprint`. Each scan is bounded (`pageSize` 10
102
177
  callers share one scan). When a bound stops it first the answer is `complete: false`, and the hints
103
178
  asked for are still looked up with `GET /v2/parties/{party}` (also when the scan is complete, since
104
179
  a cached scan can predate a newer party). `noteAllocated(partyId)` lists a party you just allocated
105
- at once; `findParty({ partyId })` is the exact lookup on its own. `discoverExternalParties` is the
106
- same list-plus-lookups logic over your own `listParties` / `findParty` callbacks. Errors are
107
- `ExternalPartyError` with a `code` (`INVALID_INPUT`, `INVALID_RESPONSE`, `ABORTED`, `LIST_FAILED`,
180
+ at once; `findParty({ partyId })` is the exact lookup on its own. Errors are canton-protocol's
181
+ `CantonProtocolError` with a `code` (`INVALID_INPUT`, `INVALID_RESPONSE`, `ABORTED`, `LIST_FAILED`,
108
182
  `LOOKUP_FAILED`); a ledger failure is its `cause`.
109
183
 
110
- The same module has the identity helpers: `deriveCantonEd25519PublicKeyFingerprint`,
111
- `buildExternalPartyId`, `parseExternalPartyId`, `readPartyNamespace`,
112
- `normalizeEd25519PublicKeyForCanton` and `decodeEd25519PublicKey`. The Node helpers of the same
113
- names under the package root (which throw `ValidationError`) derive the fingerprint through it.
184
+ The identity rules and the list-plus-lookups logic are
185
+ [`@fairmint/canton-protocol`](https://www.npmjs.com/package/@fairmint/canton-protocol)'s: import
186
+ `fingerprintEd25519PublicKey`, `buildExternalPartyId`, `parsePartyId`, `readPartyNamespace`,
187
+ `normalizeEd25519PublicKeyForCanton`, `decodeEd25519PublicKey`, `isCantonHash` and
188
+ `discoverExternalParties` (over your own `listParties` / `findParty` callbacks) from
189
+ `@fairmint/canton-protocol/party`. A naming policy for new hints is the app's own.
190
+
191
+ Those rules are stricter than the SDK's former helpers. A party ID is never trimmed and must be a
192
+ Daml-LF Party (at most 255 ASCII letters, digits, spaces, `:`, `-` or `_`): an ID with surrounding
193
+ whitespace is refused wherever the SDK checks a party against its key (every external-party submit
194
+ and the wallet ownership checks), and the directory skips such IDs in listings. A space next to `::`
195
+ is read as Canton reads it: before `::` it is part of the hint (`alice ::<fingerprint>` is a party
196
+ of that key, listed and accepted), after it part of the namespace, which then is no key's
197
+ fingerprint. An Ed25519 key must be a point on the curve:
198
+ `deriveSolanaAddressFromEd25519PublicKeyBase64` and `assertEd25519Signature` refuse an off-curve
199
+ 32-byte value, such as a Solana program-derived address.
114
200
 
115
201
  ## Token actions through a CIP-0103 wallet
116
202
 
@@ -20,9 +20,11 @@ export type GenerateExternalPartyTopologyResponse = GeneratedResponse;
20
20
  /**
21
21
  * Generate a topology for an external party
22
22
  *
23
- * This endpoint generates the topology transactions and multi-hash needed to onboard an external party. The multi-hash
24
- * should be signed using the external party's private key and then submitted to the allocate endpoint along with the
25
- * generated topology transactions.
23
+ * This endpoint generates the topology transactions and multi-hash needed to onboard an external party. Do not sign
24
+ * `multiHash` as answered: check the transactions against the requested onboarding (party `partyHint::fingerprint`,
25
+ * key, hosting participants, threshold) with `verifyPartyOnboardingTopology` from `@fairmint/canton-protocol/topology`,
26
+ * or use `prepareExternalPartyOnboarding`, which does, and sign the multi-hash recomputed from them. Submit that
27
+ * signature to the allocate endpoint with the generated topology transactions.
26
28
  *
27
29
  * @example
28
30
  * ```typescript
@@ -35,9 +37,9 @@ export type GenerateExternalPartyTopologyResponse = GeneratedResponse;
35
37
  * keySpec: 'SIGNING_KEY_SPEC_EC_CURVE25519'
36
38
  * }
37
39
  * });
38
- * // result.multiHash - sign this with the external party's private key
39
- * // result.topologyTransactions - pass these to allocate endpoint
40
- * // result.partyId - the generated party ID
40
+ * // result.multiHash - the participant's word: verify it (verifyPartyOnboardingTopology), sign the recomputed hash
41
+ * // result.topologyTransactions - check these, then pass them to the allocate endpoint
42
+ * // result.partyId - the generated party ID: compare it with partyHint::fingerprint
41
43
  * ```;
42
44
  */
43
45
  export declare const GenerateExternalPartyTopology: new (client: BaseClient) => import("../../../../../..").ApiOperation<{
@@ -1 +1 @@
1
- {"version":3,"file":"generate-topology.d.ts","sourceRoot":"","sources":["../../../../../../../../src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8GAA8G,CAAC;AAK1I,KAAK,iBAAiB,GACpB,KAAK,CAAC,wCAAwC,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAU7G,eAAO,MAAM,yCAAyC;;;;;;;;;;;;iBAepD,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAE5G,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsBxC,CAAC"}
1
+ {"version":3,"file":"generate-topology.d.ts","sourceRoot":"","sources":["../../../../../../../../src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8GAA8G,CAAC;AAK1I,KAAK,iBAAiB,GACpB,KAAK,CAAC,wCAAwC,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAU7G,eAAO,MAAM,yCAAyC;;;;;;;;;;;;iBAepD,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAE5G,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsBxC,CAAC"}
@@ -29,9 +29,11 @@ exports.GenerateExternalPartyTopologyParamsSchema = zod_1.z.object({
29
29
  /**
30
30
  * Generate a topology for an external party
31
31
  *
32
- * This endpoint generates the topology transactions and multi-hash needed to onboard an external party. The multi-hash
33
- * should be signed using the external party's private key and then submitted to the allocate endpoint along with the
34
- * generated topology transactions.
32
+ * This endpoint generates the topology transactions and multi-hash needed to onboard an external party. Do not sign
33
+ * `multiHash` as answered: check the transactions against the requested onboarding (party `partyHint::fingerprint`,
34
+ * key, hosting participants, threshold) with `verifyPartyOnboardingTopology` from `@fairmint/canton-protocol/topology`,
35
+ * or use `prepareExternalPartyOnboarding`, which does, and sign the multi-hash recomputed from them. Submit that
36
+ * signature to the allocate endpoint with the generated topology transactions.
35
37
  *
36
38
  * @example
37
39
  * ```typescript
@@ -44,9 +46,9 @@ exports.GenerateExternalPartyTopologyParamsSchema = zod_1.z.object({
44
46
  * keySpec: 'SIGNING_KEY_SPEC_EC_CURVE25519'
45
47
  * }
46
48
  * });
47
- * // result.multiHash - sign this with the external party's private key
48
- * // result.topologyTransactions - pass these to allocate endpoint
49
- * // result.partyId - the generated party ID
49
+ * // result.multiHash - the participant's word: verify it (verifyPartyOnboardingTopology), sign the recomputed hash
50
+ * // result.topologyTransactions - check these, then pass them to the allocate endpoint
51
+ * // result.partyId - the generated party ID: compare it with partyHint::fingerprint
50
52
  * ```;
51
53
  */
52
54
  exports.GenerateExternalPartyTopology = (0, core_1.createApiOperation)({
@@ -1 +1 @@
1
- {"version":3,"file":"generate-topology.js","sourceRoot":"","sources":["../../../../../../../../src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iDAA6E;AAS7E,gCAAgC;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AAC,YAAY;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,+BAA+B,EAAE,MAAM,CAAC,+BAA+B,IAAI,KAAK;QAChF,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,IAAI,CAAC;QACxD,GAAG,CAAC,MAAM,CAAC,8BAA8B,IAAI;YAC3C,8BAA8B,EAAE,MAAM,CAAC,8BAA8B;SACtE,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,wBAAwB,IAAI;YACrC,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;SAC1D,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
1
+ {"version":3,"file":"generate-topology.js","sourceRoot":"","sources":["../../../../../../../../src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iDAA6E;AAS7E,gCAAgC;AAChC,MAAM,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,4BAA4B;AACf,QAAA,yCAAyC,GAAG,OAAC,CAAC,MAAM,CAAC;IAChE,oDAAoD;IACpD,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,6GAA6G;IAC7G,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,kCAAkC;IAClC,SAAS,EAAE,sBAAsB;IACjC,iGAAiG;IACjG,+BAA+B,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;IACtE,sEAAsE;IACtE,8BAA8B,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC9D,wGAAwG;IACxG,qBAAqB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7D,qDAAqD;IACrD,wBAAwB,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,6BAA6B,GAAG,IAAA,yBAAkB,EAG7D;IACA,YAAY,EAAE,QAAA,yCAAyC;IACvD,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,MAAM;IACxB,QAAQ,EAAE,CAAC,OAA4C,EAAE,MAAc,EAAE,EAAE,CACzE,GAAG,MAAM,wCAAwC;IACnD,gBAAgB,EAAE,CAAC,MAA2C,EAAE,OAAmB,EAAoB,EAAE,CAAC,CAAC;QACzG,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,+BAA+B,EAAE,MAAM,CAAC,+BAA+B,IAAI,KAAK;QAChF,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,IAAI,CAAC;QACxD,GAAG,CAAC,MAAM,CAAC,8BAA8B,IAAI;YAC3C,8BAA8B,EAAE,MAAM,CAAC,8BAA8B;SACtE,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,wBAAwB,IAAI;YACrC,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;SAC1D,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -1,10 +1,3 @@
1
- /**
2
- * Every party a key controls on one participant, over the Ledger JSON API: a bounded, cached read of `GET /v2/parties`
3
- * filtered to the key's namespace, plus exact `GET /v2/parties/{party}` lookups of the hints the read may not show.
4
- * Browser-safe: it takes the ledger client by its shape (node-sdk's `LedgerJsonApiClient` fits), and loads nothing
5
- * else.
6
- */
7
- import { type ExternalPartyListing } from './discovery';
8
1
  /** The request options the directory passes to the ledger client. */
9
2
  export interface ExternalPartyDirectoryRequestConfig {
10
3
  readonly contentType?: 'application/json';
@@ -48,6 +41,24 @@ export type ExternalPartyKey = {
48
41
  readonly publicKeyFingerprint: string;
49
42
  readonly publicKeyBase64?: undefined;
50
43
  };
44
+ /**
45
+ * One of a key's parties. Declared here (the same shape as canton-protocol's `ExternalPartyEntry`) so the SDK's public
46
+ * declarations do not import the ESM-only `@fairmint/canton-protocol`, which a CommonJS TypeScript consumer on `module:
47
+ * node16` cannot type-import without `skipLibCheck`.
48
+ */
49
+ export interface ExternalPartyDirectoryEntry {
50
+ readonly partyId: string;
51
+ /** What precedes `::` in the party ID. */
52
+ readonly partyHint: string;
53
+ /** Whether this participant hosts the party (it can prepare and submit for it here). */
54
+ readonly hostedHere: boolean;
55
+ }
56
+ /** What {@link ExternalPartyDirectory.listPartiesForKey} answers: the key's parties, sorted by hint. */
57
+ export interface ExternalPartyDirectoryListing {
58
+ readonly parties: readonly ExternalPartyDirectoryEntry[];
59
+ /** False when the scan was cut short (a page or time bound): a party it and the lookups did not show may still exist. */
60
+ readonly complete: boolean;
61
+ }
51
62
  /** What {@link ExternalPartyDirectory.findParty} answers. */
52
63
  export type ExternalPartyFound = {
53
64
  readonly exists: false;
@@ -62,13 +73,14 @@ export interface ExternalPartyDirectory {
62
73
  * scan's: false when a page or time bound stopped it first. With a complete scan a failed lookup is skipped; with an
63
74
  * incomplete one it fails the call. `signal` stops this caller's wait, not the shared scan.
64
75
  *
65
- * Throws {@link ExternalPartyError}: `INVALID_INPUT`, `ABORTED`, `INVALID_RESPONSE`, `LIST_FAILED` (the scan's request
66
- * failed: the ledger client's error is `cause`) or `LOOKUP_FAILED`.
76
+ * Throws canton-protocol's `CantonProtocolError` (match it with `isCantonProtocolError` from
77
+ * `@fairmint/canton-protocol/party`): `INVALID_INPUT`, `ABORTED`, `INVALID_RESPONSE`, `LIST_FAILED` (the scan's
78
+ * request failed: the ledger client's error is `cause`) or `LOOKUP_FAILED`.
67
79
  */
68
80
  listPartiesForKey(request: ExternalPartyKey & {
69
81
  readonly hints?: readonly string[];
70
82
  readonly signal?: AbortSignal;
71
- }): Promise<ExternalPartyListing>;
83
+ }): Promise<ExternalPartyDirectoryListing>;
72
84
  /**
73
85
  * One party by ID (`GET /v2/parties/{party}`): 404 or an answer that does not list it is not found; else it exists,
74
86
  * and `hostedHere` is its `isLocal`. The ledger client's errors pass through; an unreadable answer is
@@ -1 +1 @@
1
- {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../../src/external-parties/directory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAIrB,qEAAqE;AACrE,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD,SAAS,IAAI,MAAM,CAAC;IACpB,cAAc,CAAC,CAAC,EACd,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,mCAAmC;IAC5C,mEAAmE;IACnE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC1C,OAAO,CAAC,CAAC,CAAC,CAAC;CACf;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,YAAY,EAAE,kCAAkC,CAAC;IAC1D,gGAAgG;IAChG,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mHAAmH;IACnH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gHA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ls on one participant, over the Ledger JSON API: a bounded, cached read of `GET /v2/parties`
6
6
  * filtered to the key's namespace, plus exact `GET /v2/parties/{party}` lookups of the hints the read may not show.
7
- * Browser-safe: it takes the ledger client by its shape (node-sdk's `LedgerJsonApiClient` fits), and loads nothing
8
- * else.
7
+ * Browser-safe: it takes the ledger client by its shape (node-sdk's `LedgerJsonApiClient` fits), and loads only
8
+ * `@fairmint/canton-protocol/party`, whose `discoverExternalParties` it runs over that client.
9
9
  */
10
- const discovery_1 = require("./discovery");
11
- const errors_1 = require("./errors");
12
- const keys_1 = require("./keys");
10
+ const party_1 = require("@fairmint/canton-protocol/party");
13
11
  const CONFIG = Object.freeze({
14
12
  contentType: 'application/json',
15
13
  includeBearerToken: true,
@@ -27,18 +25,18 @@ function createExternalPartyDirectory(options) {
27
25
  // Checked as untyped input: a JavaScript caller may pass anything.
28
26
  const shape = ledgerClient;
29
27
  if (!isRecord(shape) || typeof shape['getApiUrl'] !== 'function' || typeof shape['makeGetRequest'] !== 'function') {
30
- throw (0, errors_1.invalidInput)("ledgerClient must be @fairmint/canton-node-sdk's LedgerJsonApiClient.");
28
+ throw invalidInput("ledgerClient must be @fairmint/canton-node-sdk's LedgerJsonApiClient.");
31
29
  }
32
30
  const identityProviderId = options.identityProviderId ?? '';
33
31
  if (typeof identityProviderId !== 'string')
34
- throw (0, errors_1.invalidInput)('identityProviderId must be a string.');
32
+ throw invalidInput('identityProviderId must be a string.');
35
33
  const pageSize = bounded(options.pageSize, 1000, 1, 10000, 'pageSize');
36
34
  const maxPages = bounded(options.maxPages, 10, 1, 1000, 'maxPages');
37
35
  const timeoutMs = bounded(options.timeoutMs, 10000, 100, 120000, 'timeoutMs');
38
36
  const cacheMs = bounded(options.cacheMs, 30000, 0, 600000, 'cacheMs');
39
37
  const now = options.now ?? Date.now;
40
38
  const url = (path) => `${ledgerClient.getApiUrl()}${path}`;
41
- const invalidResponse = (message, partyId) => new errors_1.ExternalPartyError('INVALID_RESPONSE', message, partyId === undefined ? {} : { partyId });
39
+ const invalidResponse = (message, partyId) => new party_1.CantonProtocolError('INVALID_RESPONSE', message, partyId === undefined ? {} : { partyId });
42
40
  let cachedScan;
43
41
  let scanInFlight;
44
42
  /** Parties recorded here, by ID, with when: a scan that started earlier may not hold them. */
@@ -87,11 +85,12 @@ function createExternalPartyDirectory(options) {
87
85
  if (!isRecord(detail))
88
86
  continue;
89
87
  const { party } = detail;
90
- // `hint::namespace` only: one separator, a non-empty hint and namespace.
91
- // And one a listing may answer (at most 255 characters, trimmed, one line), so one odd party in the store
92
- // never fails every key's listing.
93
- const parsed = (0, keys_1.parseExternalPartyId)(party);
94
- if (parsed === null || !(0, discovery_1.isBoundedIdentifier)(party))
88
+ // A listable party ID only ({@link listablePartyId}), so one odd party in the store never fails every key's
89
+ // listing.
90
+ if (typeof party !== 'string')
91
+ continue;
92
+ const parsed = listablePartyId(party);
93
+ if (parsed === null)
95
94
  continue;
96
95
  let parties = byNamespace.get(parsed.namespace);
97
96
  if (parties === undefined) {
@@ -131,9 +130,12 @@ function createExternalPartyDirectory(options) {
131
130
  }
132
131
  return scanInFlight;
133
132
  }
134
- /** The key's parties from the current scan and the recorded allocations, without lookups. */
135
- async function scannedParties(publicKeyFingerprint, signal) {
136
- const scan = await (0, discovery_1.raceAbort)(currentScan, signal, 'The party listing was aborted.');
133
+ /**
134
+ * The key's parties from the current scan and the recorded allocations, without lookups. `discoverExternalParties`
135
+ * races this against the caller's signal and sorts what it answers.
136
+ */
137
+ async function scannedParties(publicKeyFingerprint) {
138
+ const scan = await currentScan();
137
139
  const parties = new Map(scan.byNamespace.get(publicKeyFingerprint) ?? []);
138
140
  const suffix = `::${publicKeyFingerprint}`;
139
141
  const horizon = allocationHorizon();
@@ -146,24 +148,24 @@ function createExternalPartyDirectory(options) {
146
148
  parties.set(partyId, true);
147
149
  }
148
150
  }
149
- return { parties: (0, discovery_1.sortedEntries)(parties), complete: scan.complete };
151
+ return { parties: [...parties].map(([partyId, hostedHere]) => ({ partyId, hostedHere })), complete: scan.complete };
150
152
  }
151
153
  const directory = {
152
154
  async listPartiesForKey(request) {
153
155
  const publicKeyFingerprint = keyFingerprint(request);
154
156
  const { signal } = request;
155
- return (0, discovery_1.discoverExternalParties)({
157
+ return (0, party_1.discoverExternalParties)({
156
158
  publicKeyFingerprint,
157
159
  ...(request.hints === undefined ? {} : { hints: request.hints }),
158
160
  ...(signal === undefined ? {} : { signal }),
159
- listParties: async () => scannedParties(publicKeyFingerprint, signal),
161
+ listParties: async () => scannedParties(publicKeyFingerprint),
160
162
  findParty: async ({ partyId }) => directory.findParty(signal === undefined ? { partyId } : { partyId, signal }),
161
163
  }).then(({ parties, complete }) => Object.freeze({ parties, complete }));
162
164
  },
163
165
  async findParty(request) {
164
166
  const { partyId, signal } = request;
165
167
  if (typeof partyId !== 'string' || partyId.trim() === '')
166
- throw (0, errors_1.invalidInput)('partyId is required.');
168
+ throw invalidInput('partyId is required.');
167
169
  let response;
168
170
  try {
169
171
  // Same identity provider as the scan, as node-sdk's GetPartyDetails sends it.
@@ -188,8 +190,8 @@ function createExternalPartyDirectory(options) {
188
190
  },
189
191
  noteAllocated(partyId) {
190
192
  // Only an ID a listing may answer: one it refuses would fail every listing of its key until it expired.
191
- if ((0, keys_1.parseExternalPartyId)(partyId) === null || !(0, discovery_1.isBoundedIdentifier)(partyId)) {
192
- throw (0, errors_1.invalidInput)('partyId must be a hint::namespace party ID of at most 255 characters, trimmed, on one line.');
193
+ if (listablePartyId(partyId) === null) {
194
+ throw invalidInput('partyId must be a Daml-LF party ID (hint::namespace, at most 255 ASCII letters, digits, spaces, ":", "-" or "_"), trimmed, on one line.');
193
195
  }
194
196
  // Drops expired entries as it records one, so the map holds one cache window, not the process lifetime.
195
197
  const horizon = allocationHorizon();
@@ -204,20 +206,33 @@ function createExternalPartyDirectory(options) {
204
206
  }
205
207
  function keyFingerprint(key) {
206
208
  if (typeof key.publicKeyBase64 === 'string') {
207
- const fingerprint = (0, keys_1.deriveCantonEd25519PublicKeyFingerprint)(key.publicKeyBase64);
209
+ const fingerprint = (0, party_1.fingerprintEd25519PublicKey)(key.publicKeyBase64);
208
210
  if (key.publicKeyFingerprint !== undefined && key.publicKeyFingerprint !== fingerprint) {
209
- throw (0, errors_1.invalidInput)('publicKeyFingerprint does not match publicKeyBase64.');
211
+ throw invalidInput('publicKeyFingerprint does not match publicKeyBase64.');
210
212
  }
211
213
  return fingerprint;
212
214
  }
213
- if ((0, keys_1.isCantonPublicKeyFingerprint)(key.publicKeyFingerprint))
215
+ if ((0, party_1.isCantonHash)(key.publicKeyFingerprint))
214
216
  return key.publicKeyFingerprint;
215
- throw (0, errors_1.invalidInput)('Pass publicKeyBase64 or a Canton publicKeyFingerprint.');
217
+ throw invalidInput('Pass publicKeyBase64 or a Canton publicKeyFingerprint.');
218
+ }
219
+ function invalidInput(message) {
220
+ return new party_1.CantonProtocolError('INVALID_INPUT', message);
221
+ }
222
+ /**
223
+ * `value` parsed as a party ID a listing may answer: a Daml-LF Party `hint::namespace` (canton-protocol's
224
+ * `parsePartyId`: at most 255 ASCII letters, digits, spaces, ":", "-" or "_", one separator) without surrounding
225
+ * whitespace, which `discoverExternalParties` refuses in a list answer. Null for anything else.
226
+ */
227
+ function listablePartyId(value) {
228
+ if (typeof value !== 'string' || value.trim() !== value)
229
+ return null;
230
+ return (0, party_1.parsePartyId)(value);
216
231
  }
217
232
  function bounded(value, fallback, min, max, label) {
218
233
  const resolved = value ?? fallback;
219
234
  if (!Number.isSafeInteger(resolved) || resolved < min || resolved > max) {
220
- throw (0, errors_1.invalidInput)(`${label} must be an integer from ${min} to ${max}.`);
235
+ throw invalidInput(`${label} must be an integer from ${min} to ${max}.`);
221
236
  }
222
237
  return resolved;
223
238
  }
@@ -1 +1 @@
1
- {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../../src/external-parties/directory.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAOqB;AACrB,qCAA4D;AAC5D,iCAAqH;AA2ErH,MAA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AI,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -1,20 +1,13 @@
1
1
  /**
2
- * Browser-safe Canton external-party discovery: "find every party this key controls". Import
3
- * `@fairmint/canton-node-sdk/external-parties` in a browser bundle (it loads `@noble/hashes` and none of the SDK's Node
4
- * dependencies); the package root also exports it as the `ExternalParties` namespace.
2
+ * Browser-safe Canton external-party directory: "find every party this key controls" on one participant, over the
3
+ * Ledger JSON API. Import `@fairmint/canton-node-sdk/external-parties` in a browser bundle (it loads
4
+ * `@fairmint/canton-protocol/party` and none of the SDK's Node dependencies); the package root also exports it as the
5
+ * `ExternalParties` namespace.
5
6
  *
6
- * - Identity: {@link deriveCantonEd25519PublicKeyFingerprint} (`1220` + hex(sha256(int32be(12) || rawKey))),
7
- * {@link buildExternalPartyId} (`hint::fingerprint`), {@link readPartyNamespace}, {@link parseExternalPartyId},
8
- * {@link normalizeEd25519PublicKeyForCanton} and {@link decodeEd25519PublicKey}.
9
- * - Discovery: {@link createExternalPartyDirectory} over a Ledger JSON API client (bounded, cached `GET /v2/parties` scans
10
- * filtered to the key's namespace, exact `GET /v2/parties/{party}` lookups of the hints asked for), and
11
- * {@link discoverExternalParties}, the same orchestration over any list and lookup callbacks.
12
- * - Hints for new parties: {@link suggestExternalPartyHint} and {@link validateExternalPartyHint}.
13
- * - Errors: {@link ExternalPartyError} and {@link isExternalPartyError}.
7
+ * The directory throws canton-protocol's `CantonProtocolError` (match it with `isCantonProtocolError`, from
8
+ * `@fairmint/canton-protocol/party` as your own dependency: any 0.1.x copy matches, the brand is registered). Key
9
+ * fingerprints, party IDs and `discoverExternalParties` over any list and lookup callbacks are canton-protocol's:
10
+ * import them from `@fairmint/canton-protocol/party`.
14
11
  */
15
- export { createExternalPartyDirectory, type ExternalPartyDirectory, type ExternalPartyDirectoryLedgerClient, type ExternalPartyDirectoryOptions, type ExternalPartyDirectoryRequestConfig, type ExternalPartyFound, type ExternalPartyKey, } from './directory';
16
- export { discoverExternalParties, MAX_EXTERNAL_PARTY_LOOKUP_HINTS, type ExternalPartyDiscovery, type ExternalPartyEntry, type ExternalPartyListAnswer, type ExternalPartyListing, type ExternalPartyLookupAnswer, } from './discovery';
17
- export { ExternalPartyError, isExternalPartyError, type ExternalPartyErrorCode } from './errors';
18
- export { DEFAULT_EXTERNAL_PARTY_HINT, MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH, MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH, suggestExternalPartyHint, validateExternalPartyHint, type ExternalPartyHintError, } from './hints';
19
- export { buildExternalPartyId, decodeEd25519PublicKey, deriveCantonEd25519PublicKeyFingerprint, fingerprintRawEd25519PublicKey, isCantonPublicKeyFingerprint, isExternalPartyHint, MAX_EXTERNAL_PARTY_ID_LENGTH, normalizeEd25519PublicKeyForCanton, parseExternalPartyId, readPartyNamespace, } from './keys';
12
+ export { createExternalPartyDirectory, type ExternalPartyDirectory, type ExternalPartyDirectoryEntry, type ExternalPartyDirectoryListing, type ExternalPartyDirectoryLedgerClient, type ExternalPartyDirectoryOptions, type ExternalPartyDirectoryRequestConfig, type ExternalPartyFound, type ExternalPartyKey, } from './directory';
20
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/external-parties/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EAClC,KAAK,mCAAmC,EACxC,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACjG,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,EAClC,6CAA6C,EAC7C,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,uCAAuC,EACvC,8BAA8B,EAC9B,4BAA4B,EAC5B,mBAAmB,EACnB,4BAA4B,EAC5B,kCAAkC,EAClC,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/external-parties/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EAClC,KAAK,mCAAmC,EACxC,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC"}
@@ -1,43 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readPartyNamespace = exports.parseExternalPartyId = exports.normalizeEd25519PublicKeyForCanton = exports.MAX_EXTERNAL_PARTY_ID_LENGTH = exports.isExternalPartyHint = exports.isCantonPublicKeyFingerprint = exports.fingerprintRawEd25519PublicKey = exports.deriveCantonEd25519PublicKeyFingerprint = exports.decodeEd25519PublicKey = exports.buildExternalPartyId = exports.validateExternalPartyHint = exports.suggestExternalPartyHint = exports.MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH = exports.MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH = exports.DEFAULT_EXTERNAL_PARTY_HINT = exports.isExternalPartyError = exports.ExternalPartyError = exports.MAX_EXTERNAL_PARTY_LOOKUP_HINTS = exports.discoverExternalParties = exports.createExternalPartyDirectory = void 0;
3
+ exports.createExternalPartyDirectory = void 0;
4
4
  /**
5
- * Browser-safe Canton external-party discovery: "find every party this key controls". Import
6
- * `@fairmint/canton-node-sdk/external-parties` in a browser bundle (it loads `@noble/hashes` and none of the SDK's Node
7
- * dependencies); the package root also exports it as the `ExternalParties` namespace.
5
+ * Browser-safe Canton external-party directory: "find every party this key controls" on one participant, over the
6
+ * Ledger JSON API. Import `@fairmint/canton-node-sdk/external-parties` in a browser bundle (it loads
7
+ * `@fairmint/canton-protocol/party` and none of the SDK's Node dependencies); the package root also exports it as the
8
+ * `ExternalParties` namespace.
8
9
  *
9
- * - Identity: {@link deriveCantonEd25519PublicKeyFingerprint} (`1220` + hex(sha256(int32be(12) || rawKey))),
10
- * {@link buildExternalPartyId} (`hint::fingerprint`), {@link readPartyNamespace}, {@link parseExternalPartyId},
11
- * {@link normalizeEd25519PublicKeyForCanton} and {@link decodeEd25519PublicKey}.
12
- * - Discovery: {@link createExternalPartyDirectory} over a Ledger JSON API client (bounded, cached `GET /v2/parties` scans
13
- * filtered to the key's namespace, exact `GET /v2/parties/{party}` lookups of the hints asked for), and
14
- * {@link discoverExternalParties}, the same orchestration over any list and lookup callbacks.
15
- * - Hints for new parties: {@link suggestExternalPartyHint} and {@link validateExternalPartyHint}.
16
- * - Errors: {@link ExternalPartyError} and {@link isExternalPartyError}.
10
+ * The directory throws canton-protocol's `CantonProtocolError` (match it with `isCantonProtocolError`, from
11
+ * `@fairmint/canton-protocol/party` as your own dependency: any 0.1.x copy matches, the brand is registered). Key
12
+ * fingerprints, party IDs and `discoverExternalParties` over any list and lookup callbacks are canton-protocol's:
13
+ * import them from `@fairmint/canton-protocol/party`.
17
14
  */
18
15
  var directory_1 = require("./directory");
19
16
  Object.defineProperty(exports, "createExternalPartyDirectory", { enumerable: true, get: function () { return directory_1.createExternalPartyDirectory; } });
20
- var discovery_1 = require("./discovery");
21
- Object.defineProperty(exports, "discoverExternalParties", { enumerable: true, get: function () { return discovery_1.discoverExternalParties; } });
22
- Object.defineProperty(exports, "MAX_EXTERNAL_PARTY_LOOKUP_HINTS", { enumerable: true, get: function () { return discovery_1.MAX_EXTERNAL_PARTY_LOOKUP_HINTS; } });
23
- var errors_1 = require("./errors");
24
- Object.defineProperty(exports, "ExternalPartyError", { enumerable: true, get: function () { return errors_1.ExternalPartyError; } });
25
- Object.defineProperty(exports, "isExternalPartyError", { enumerable: true, get: function () { return errors_1.isExternalPartyError; } });
26
- var hints_1 = require("./hints");
27
- Object.defineProperty(exports, "DEFAULT_EXTERNAL_PARTY_HINT", { enumerable: true, get: function () { return hints_1.DEFAULT_EXTERNAL_PARTY_HINT; } });
28
- Object.defineProperty(exports, "MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH", { enumerable: true, get: function () { return hints_1.MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH; } });
29
- Object.defineProperty(exports, "MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH", { enumerable: true, get: function () { return hints_1.MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH; } });
30
- Object.defineProperty(exports, "suggestExternalPartyHint", { enumerable: true, get: function () { return hints_1.suggestExternalPartyHint; } });
31
- Object.defineProperty(exports, "validateExternalPartyHint", { enumerable: true, get: function () { return hints_1.validateExternalPartyHint; } });
32
- var keys_1 = require("./keys");
33
- Object.defineProperty(exports, "buildExternalPartyId", { enumerable: true, get: function () { return keys_1.buildExternalPartyId; } });
34
- Object.defineProperty(exports, "decodeEd25519PublicKey", { enumerable: true, get: function () { return keys_1.decodeEd25519PublicKey; } });
35
- Object.defineProperty(exports, "deriveCantonEd25519PublicKeyFingerprint", { enumerable: true, get: function () { return keys_1.deriveCantonEd25519PublicKeyFingerprint; } });
36
- Object.defineProperty(exports, "fingerprintRawEd25519PublicKey", { enumerable: true, get: function () { return keys_1.fingerprintRawEd25519PublicKey; } });
37
- Object.defineProperty(exports, "isCantonPublicKeyFingerprint", { enumerable: true, get: function () { return keys_1.isCantonPublicKeyFingerprint; } });
38
- Object.defineProperty(exports, "isExternalPartyHint", { enumerable: true, get: function () { return keys_1.isExternalPartyHint; } });
39
- Object.defineProperty(exports, "MAX_EXTERNAL_PARTY_ID_LENGTH", { enumerable: true, get: function () { return keys_1.MAX_EXTERNAL_PARTY_ID_LENGTH; } });
40
- Object.defineProperty(exports, "normalizeEd25519PublicKeyForCanton", { enumerable: true, get: function () { return keys_1.normalizeEd25519PublicKeyForCanton; } });
41
- Object.defineProperty(exports, "parseExternalPartyId", { enumerable: true, get: function () { return keys_1.parseExternalPartyId; } });
42
- Object.defineProperty(exports, "readPartyNamespace", { enumerable: true, get: function () { return keys_1.readPartyNamespace; } });
43
17
  //# sourceMappingURL=index.js.map