You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,6 +166,14 @@ $ mpcium start -n node2
166
166
167
167
Mpcium supports flexible client authentication through a signer interface, allowing you to use either local keys or AWS KMS for signing operations.
168
168
169
+
#### Client ID (Result Routing)
170
+
171
+
When multiple client instances connect to the same MPC cluster, each client **must** set a unique `ClientID` to avoid result routing conflicts. Without distinct client IDs, two clients requesting operations concurrently may race for the same result message, causing one client to receive the other's response.
172
+
173
+
-`ClientID` scopes the NATS consumer and result subject so each client only receives its own results.
174
+
- Allowed characters: alphanumeric, hyphens, and underscores (e.g. `"backend-svc-1"`, `"mobile_api"`).
175
+
- If you only run a single client instance, `ClientID` can be omitted (empty string).
176
+
169
177
#### Local Signer (Ed25519)
170
178
171
179
```go
@@ -193,10 +201,11 @@ func main() {
193
201
logger.Fatal("Failed to create local signer", err)
194
202
}
195
203
196
-
// Create MPC client with signer
204
+
// Create MPC client with signer and a unique client ID
197
205
mpcClient:= client.NewMPCClient(client.Options{
198
206
NatsConn: natsConn,
199
207
Signer: localSigner,
208
+
ClientID: "backend-svc-1", // unique per client instance
200
209
})
201
210
202
211
// Handle wallet creation results
@@ -253,6 +262,7 @@ func main() {
253
262
mpcClient:= client.NewMPCClient(client.Options{
254
263
NatsConn: natsConn,
255
264
Signer: kmsSigner,
265
+
ClientID: "kms-client-1", // unique per client instance
0 commit comments