@fairmint/canton-node-sdk 0.0.300 → 0.0.302

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 (102) hide show
  1. package/README.md +116 -26
  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/clients/ledger-json-api/schemas/api/interactive-submission.d.ts +4 -1
  7. package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.d.ts.map +1 -1
  8. package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.js +1 -0
  9. package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.js.map +1 -1
  10. package/build/src/external-parties/directory.d.ts +22 -10
  11. package/build/src/external-parties/directory.d.ts.map +1 -1
  12. package/build/src/external-parties/directory.js +42 -27
  13. package/build/src/external-parties/directory.js.map +1 -1
  14. package/build/src/external-parties/index.d.ts +9 -16
  15. package/build/src/external-parties/index.d.ts.map +1 -1
  16. package/build/src/external-parties/index.js +9 -35
  17. package/build/src/external-parties/index.js.map +1 -1
  18. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.d.ts +1 -1
  19. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.d.ts.map +1 -1
  20. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.js +16 -5
  21. package/build/src/utils/amulet/external-party-cc-token-standard-transfer.js.map +1 -1
  22. package/build/src/utils/amulet/external-party-transfer-offer.d.ts +5 -3
  23. package/build/src/utils/amulet/external-party-transfer-offer.d.ts.map +1 -1
  24. package/build/src/utils/amulet/external-party-transfer-offer.js +21 -7
  25. package/build/src/utils/amulet/external-party-transfer-offer.js.map +1 -1
  26. package/build/src/utils/amulet/external-party-transfer-preapproval.d.ts +8 -1
  27. package/build/src/utils/amulet/external-party-transfer-preapproval.d.ts.map +1 -1
  28. package/build/src/utils/amulet/external-party-transfer-preapproval.js +30 -7
  29. package/build/src/utils/amulet/external-party-transfer-preapproval.js.map +1 -1
  30. package/build/src/utils/amulet/index.d.ts +0 -1
  31. package/build/src/utils/amulet/index.d.ts.map +1 -1
  32. package/build/src/utils/amulet/index.js +0 -1
  33. package/build/src/utils/amulet/index.js.map +1 -1
  34. package/build/src/utils/external-signing/canton-ed25519-signer.d.ts +7 -1
  35. package/build/src/utils/external-signing/canton-ed25519-signer.d.ts.map +1 -1
  36. package/build/src/utils/external-signing/canton-ed25519-signer.js +15 -7
  37. package/build/src/utils/external-signing/canton-ed25519-signer.js.map +1 -1
  38. package/build/src/utils/external-signing/canton-protocol.d.ts +5 -37
  39. package/build/src/utils/external-signing/canton-protocol.d.ts.map +1 -1
  40. package/build/src/utils/external-signing/canton-protocol.js +10 -217
  41. package/build/src/utils/external-signing/canton-protocol.js.map +1 -1
  42. package/build/src/utils/external-signing/create-external-party.d.ts +27 -6
  43. package/build/src/utils/external-signing/create-external-party.d.ts.map +1 -1
  44. package/build/src/utils/external-signing/create-external-party.js +39 -11
  45. package/build/src/utils/external-signing/create-external-party.js.map +1 -1
  46. package/build/src/utils/external-signing/execute-external-party-signed-transaction.d.ts +7 -3
  47. package/build/src/utils/external-signing/execute-external-party-signed-transaction.d.ts.map +1 -1
  48. package/build/src/utils/external-signing/execute-external-party-signed-transaction.js +17 -7
  49. package/build/src/utils/external-signing/execute-external-party-signed-transaction.js.map +1 -1
  50. package/build/src/utils/external-signing/external-party-lifecycle.js +2 -2
  51. package/build/src/utils/external-signing/external-party-lifecycle.js.map +1 -1
  52. package/build/src/utils/external-signing/external-party-onboarding.d.ts +56 -14
  53. package/build/src/utils/external-signing/external-party-onboarding.d.ts.map +1 -1
  54. package/build/src/utils/external-signing/external-party-onboarding.js +71 -26
  55. package/build/src/utils/external-signing/external-party-onboarding.js.map +1 -1
  56. package/build/src/utils/external-signing/external-party-wallet.d.ts +23 -6
  57. package/build/src/utils/external-signing/external-party-wallet.d.ts.map +1 -1
  58. package/build/src/utils/external-signing/external-party-wallet.js +52 -18
  59. package/build/src/utils/external-signing/external-party-wallet.js.map +1 -1
  60. package/build/src/utils/external-signing/external-signing-client.d.ts.map +1 -1
  61. package/build/src/utils/external-signing/external-signing-client.js +17 -16
  62. package/build/src/utils/external-signing/external-signing-client.js.map +1 -1
  63. package/build/src/utils/external-signing/hash-signature.d.ts +20 -0
  64. package/build/src/utils/external-signing/hash-signature.d.ts.map +1 -0
  65. package/build/src/utils/external-signing/hash-signature.js +63 -0
  66. package/build/src/utils/external-signing/hash-signature.js.map +1 -0
  67. package/build/src/utils/external-signing/onboarding-topology.d.ts +82 -0
  68. package/build/src/utils/external-signing/onboarding-topology.d.ts.map +1 -0
  69. package/build/src/utils/external-signing/onboarding-topology.js +213 -0
  70. package/build/src/utils/external-signing/onboarding-topology.js.map +1 -0
  71. package/build/src/utils/external-signing/party-identity.d.ts +43 -0
  72. package/build/src/utils/external-signing/party-identity.d.ts.map +1 -0
  73. package/build/src/utils/external-signing/party-identity.js +120 -0
  74. package/build/src/utils/external-signing/party-identity.js.map +1 -0
  75. package/build/src/utils/external-signing/prepared-transaction.d.ts +58 -0
  76. package/build/src/utils/external-signing/prepared-transaction.d.ts.map +1 -0
  77. package/build/src/utils/external-signing/prepared-transaction.js +158 -0
  78. package/build/src/utils/external-signing/prepared-transaction.js.map +1 -0
  79. package/build/src/utils/external-signing/wallet-ownership-checks.d.ts.map +1 -1
  80. package/build/src/utils/external-signing/wallet-ownership-checks.js +8 -5
  81. package/build/src/utils/external-signing/wallet-ownership-checks.js.map +1 -1
  82. package/package.json +6 -4
  83. package/build/src/external-parties/discovery.d.ts +0 -72
  84. package/build/src/external-parties/discovery.d.ts.map +0 -1
  85. package/build/src/external-parties/discovery.js +0 -160
  86. package/build/src/external-parties/discovery.js.map +0 -1
  87. package/build/src/external-parties/errors.d.ts +0 -28
  88. package/build/src/external-parties/errors.d.ts.map +0 -1
  89. package/build/src/external-parties/errors.js +0 -33
  90. package/build/src/external-parties/errors.js.map +0 -1
  91. package/build/src/external-parties/hints.d.ts +0 -42
  92. package/build/src/external-parties/hints.d.ts.map +0 -1
  93. package/build/src/external-parties/hints.js +0 -83
  94. package/build/src/external-parties/hints.js.map +0 -1
  95. package/build/src/external-parties/keys.d.ts +0 -34
  96. package/build/src/external-parties/keys.d.ts.map +0 -1
  97. package/build/src/external-parties/keys.js +0 -209
  98. package/build/src/external-parties/keys.js.map +0 -1
  99. package/build/src/utils/amulet/external-party-cc-transfer.d.ts +0 -67
  100. package/build/src/utils/amulet/external-party-cc-transfer.d.ts.map +0 -1
  101. package/build/src/utils/amulet/external-party-cc-transfer.js +0 -148
  102. package/build/src/utils/amulet/external-party-cc-transfer.js.map +0 -1
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createExternalParty = createExternalParty;
4
4
  const errors_1 = require("../../core/errors");
5
5
  const allocation_user_id_1 = require("./allocation-user-id");
6
+ const onboarding_topology_1 = require("./onboarding-topology");
7
+ const party_identity_1 = require("./party-identity");
6
8
  const stellar_utils_1 = require("./stellar-utils");
7
9
  /**
8
10
  * Creates an external party in Canton
@@ -10,10 +12,16 @@ const stellar_utils_1 = require("./stellar-utils");
10
12
  * This is a convenience function that combines the three-step process:
11
13
  *
12
14
  * 1. Generate topology transactions
13
- * 2. Sign the multi-hash
15
+ * 2. Check them and sign the multi-hash recomputed from them
14
16
  * 3. Allocate the party
15
17
  *
16
- * The keypair's private key is used to sign the onboarding transactions, proving ownership of the public key.
18
+ * The keypair's private key is used to sign the onboarding transactions, proving ownership of the public key. The
19
+ * participant's answer is not signed on its word: the SDK reads the local participant's unique identifier (`GET
20
+ * /v2/parties/participant-id`), checks that the generated topology states exactly the requested onboarding (the party
21
+ * `partyName::fingerprint` of this key, the key with the usages `NAMESPACE`, `PROTOCOL` and `PROOF_OF_OWNERSHIP`, the
22
+ * hosting participants with their permissions, and the confirmation threshold), recomputes the multi-hash and signs
23
+ * only that. A topology that differs is an `OperationError` (`TRANSACTION_FAILED`) and nothing is signed or allocated.
24
+ * Canton 3.4 or later is required.
17
25
  *
18
26
  * @example
19
27
  * ```typescript
@@ -36,12 +44,21 @@ const stellar_utils_1 = require("./stellar-utils");
36
44
  * @returns Party details including party ID and key fingerprint
37
45
  */
38
46
  async function createExternalParty(params) {
39
- const { ledgerClient, keypair, partyName, synchronizerId, identityProviderId = 'default', userId: rawUserId, localParticipantObservationOnly, otherConfirmingParticipantUids, confirmationThreshold, observingParticipantUids, } = params;
47
+ const { ledgerClient, keypair, partyName, synchronizerId, identityProviderId = 'default', userId: rawUserId, localParticipantObservationOnly, otherConfirmingParticipantUids, confirmationThreshold, observingParticipantUids, expectedLocalParticipantUid, } = params;
40
48
  const userId = rawUserId === undefined ? undefined : (0, allocation_user_id_1.normalizeAllocationUserId)(rawUserId);
49
+ const hostingRequest = (0, onboarding_topology_1.checkOnboardingHosting)({
50
+ localParticipantObservationOnly,
51
+ otherConfirmingParticipantUids,
52
+ confirmationThreshold,
53
+ observingParticipantUids,
54
+ expectedLocalParticipantUid,
55
+ });
41
56
  // Step 1: Convert Stellar public key to base64 for Ledger API
42
57
  const publicKeyBase64 = (0, stellar_utils_1.stellarPublicKeyToBase64)(keypair);
43
58
  const publicKeyHex = (0, stellar_utils_1.stellarPublicKeyToHex)(keypair);
59
+ const expectedPartyId = (0, party_identity_1.requestedExternalPartyId)(partyName, publicKeyBase64);
44
60
  // Step 2: Generate external party topology using Ledger JSON API
61
+ const hosting = await (0, onboarding_topology_1.resolveOnboardingHosting)(ledgerClient, hostingRequest);
45
62
  const topology = await ledgerClient.generateExternalPartyTopology({
46
63
  synchronizer: synchronizerId,
47
64
  partyHint: partyName,
@@ -68,15 +85,26 @@ async function createExternalParty(params) {
68
85
  !rawTopologyTransactions.every((transaction) => typeof transaction === 'string')) {
69
86
  throw new errors_1.OperationError('No topology transactions returned from topology generation', errors_1.OperationErrorCode.PARTY_CREATION_FAILED, { partyName, synchronizerId, partyId });
70
87
  }
71
- // Validate fingerprint before using it in the API call
72
- const publicKeyFingerprint = partyId.split('::')[1];
73
- if (!publicKeyFingerprint) {
74
- throw new errors_1.OperationError('Failed to extract public key fingerprint from party ID', errors_1.OperationErrorCode.PARTY_CREATION_FAILED, { partyId, partyName });
88
+ // The party must be this key's, and the topology exactly the requested onboarding.
89
+ let publicKeyFingerprint;
90
+ try {
91
+ publicKeyFingerprint = (0, party_identity_1.assertPartyKey)({ partyId, publicKeyBase64 });
75
92
  }
76
- // Step 3: Sign the multi-hash using the Stellar keypair
77
- const multiHashSignatureHex = (0, stellar_utils_1.signHexWithStellarKeypair)(keypair, multiHash);
78
- // Convert signature from hex to base64 for Canton
79
- const multiHashSignature = Buffer.from(multiHashSignatureHex, 'hex').toString('base64');
93
+ catch (error) {
94
+ throw new errors_1.OperationError('Topology generation returned a party ID that does not match the keypair', errors_1.OperationErrorCode.PARTY_CREATION_FAILED, { partyId, partyName, cause: error instanceof Error ? error.message : String(error) });
95
+ }
96
+ if (partyId !== expectedPartyId) {
97
+ throw new errors_1.OperationError('Topology generation returned a party ID that is not the requested party', errors_1.OperationErrorCode.PARTY_CREATION_FAILED, { expectedPartyId, partyId, partyName });
98
+ }
99
+ const multiHashHex = (0, onboarding_topology_1.verifyGeneratedOnboardingTopology)({
100
+ transactions: rawTopologyTransactions,
101
+ multiHash,
102
+ partyId: expectedPartyId,
103
+ publicKeyBase64,
104
+ hosting,
105
+ });
106
+ // Step 3: Sign the recomputed multi-hash using the Stellar keypair (raw signature, base64 for Canton)
107
+ const multiHashSignature = keypair.sign(Buffer.from(multiHashHex, 'hex')).toString('base64');
80
108
  // Step 4: Allocate the party using Ledger JSON API
81
109
  const onboardingTransactions = rawTopologyTransactions.map((transaction) => ({ transaction }));
82
110
  const allocateResult = await ledgerClient.allocateExternalParty({
@@ -1 +1 @@
1
- {"version":3,"file":"create-external-party.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/create-external-party.ts"],"names":[],"mappings":";;;AAEA,8CAAuE;AACvE,6DAAiE;AACjE,mDAA6G;AA4C7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,KAAK,8BAA8B,MAAiC;IACzE,MAAM,EACJ,YAAY,EACZ,OAAO,EACP,SAAS,EACT,cAAc,EACd,kBAAkB,GAAG,SAAS,EAC9B,MAAM,EAAE,SAAS,EACjB,+BAA+B,EAC/B,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,GACzB,GAAG,MAAM,CAAC;IACX,MAAM,MAAM,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,8CAAyB,EAAC,SAAS,CAAC,CAAC;IAE1F,8DAA8D;IAC9D,MAAM,eAAe,GAAG,IAAA,wCAAwB,EAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,IAAA,qCAAqB,EAAC,OAAO,CAAC,CAAC;IAEpD,iEAAiE;IACjE,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,6BAA6B,CAAC;QAChE,YAAY,EAAE,cAAc;QAC5B,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE;YACT,MAAM,EAAE,oDAAoD;YAC5D,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,gCAAgC;SAC1C;QACD,+BAA+B;QAC/B,8BAA8B,EAAE,8BAA8B,CAAC,CAAC,CAAC,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAC,SAAS;QAChH,qBAAqB;QACrB,wBAAwB,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC,SAAS;KAC/F,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,QAAQ,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;Q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AC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;IAE/F,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC,qBAAqB,CAAC;QAC9D,YAAY,EAAE,cAAc;QAC5B,kBAAkB;QAClB,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,sBAAsB;QACtB,mBAAmB,EAAE;YACnB;gBACE,MAAM,EAAE,sBAAsB;gBAC9B,SAAS,EAAE,kBAAkB;gBAC7B,QAAQ,EAAE,oBAAoB;gBAC9B,oBAAoB,EAAE,gCAAgC;aACvD;SACF;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,uBAAc,CACtB,0DAA0D,EAC1D,2BAAkB,CAAC,qBAAqB,EACxC,EAAE,SAAS,EAAE,cAAc,EAAE,CAC9B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,SAAS,EAAE,YAAY;QACvB,oBAAoB;QACpB,cAAc,EAAE,OAAO,CAAC,SAAS,EAAE;QACnC,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE;KAChC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"create-external-party.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/create-external-party.ts"],"names":[],"mappings":";;;AAEA,8CAAuE;AACvE,6DAAiE;AACjE,+DAI+B;AAC/B,qDAA4E;AAC5E,mDAAkF;AA2DlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACI,KAAK,8BAA8B,MAAiC;IACzE,MAAM,EACJ,YAAY,EACZ,OAAO,EACP,SAAS,EACT,cAAc,EACd,kBAAkB,GAAG,SAAS,EAC9B,MAAM,EAAE,SAAS,EACjB,+BAA+B,EAC/B,8BAA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,CAAC;AACJ,CAAC"}
@@ -10,13 +10,16 @@ export interface ExecuteExternalPartySignedTransactionOptions {
10
10
  readonly publicKeyBase64: string;
11
11
  /** When given, must match the fingerprint derived from `publicKeyBase64`. */
12
12
  readonly publicKeyFingerprint?: string | null;
13
+ /** The participant's prepared transaction, base64, as prepare returned it. */
13
14
  readonly preparedTransaction: string;
15
+ /** The signed hash (32 bytes, hex): it must be the hash of `preparedTransaction` under `hashingSchemeVersion`. */
14
16
  readonly preparedTransactionHashHex: string;
15
17
  /**
16
18
  * Ed25519 signature over the prepared transaction hash bytes, base64. Unpadded, base64url and whitespace-padded input
17
19
  * is accepted; it is sent to the participant as canonical, padded standard base64.
18
20
  */
19
21
  readonly signatureBase64: string;
22
+ /** The scheme the transaction was prepared under, and is executed under. Default: V2. */
20
23
  readonly hashingSchemeVersion?: InteractiveSubmissionHashingSchemeVersion;
21
24
  readonly submissionId?: string;
22
25
  }
@@ -24,9 +27,10 @@ export interface ExecuteExternalPartySignedTransactionOptions {
24
27
  * Verifies a single external party's Ed25519 signature over a prepared transaction hash and executes the prepared
25
28
  * transaction with it (`interactiveSubmissionExecuteAndWait`), returning the update id.
26
29
  *
27
- * The party id must belong to the public key, and the signature must verify against the hash, before anything is sent
28
- * to the participant. The signature is sent in the raw Ed25519 format, as canonical padded base64, signed by the key's
29
- * Canton fingerprint.
30
+ * Before anything is sent to the participant: the party id must belong to the public key; the hash must be the hash of
31
+ * `preparedTransaction` under `hashingSchemeVersion`, recomputed here, and the transaction must act only as `partyId`
32
+ * (its command id and synchronizer are the ones it states); and the signature must verify against that hash. The
33
+ * signature is sent in the raw Ed25519 format, as canonical padded base64, signed by the key's Canton fingerprint.
30
34
  */
31
35
  export declare function executeExternalPartySignedTransaction(options: ExecuteExternalPartySignedTransactionOptions): Promise<ExecuteExternalTransactionAndWaitResult>;
32
36
  //# sourceMappingURL=execute-external-party-signed-transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute-external-party-signed-transaction.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/execute-external-party-signed-transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIzE,OAAO,EAEL,KAAK,uCAAuC,EAC5C,KAAK,yCAAyC,EAC/C,MAAM,gCAAgC,CAAC;AAGxC,MAAM,WAAW,4CAA4C;IAC3D,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,yCAAyC,CAAC;IAC1E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAsB,qCAAqC,CACzD,OAAO,EAAE,4CAA4C,GACpD,OAAO,CAAC,uCAAuC,CAAC,CAqClD"}
1
+ {"version":3,"file":"execute-external-party-signed-transaction.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/execute-external-party-signed-transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAKzE,OAAO,EAEL,KAAK,uCAAuC,EAC5C,KAAK,yCAAyC,EAC/C,MAAM,gCAAgC,CAAC;AAIxC,MAAM,WAAW,4CAA4C;IAC3D,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,8EAA8E;IAC9E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,kHAAkH;IAClH,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,yFAAyF;IACzF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,yCAAyC,CAAC;IAC1E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAsB,qCAAqC,CACzD,OAAO,EAAE,4CAA4C,GACpD,OAAO,CAAC,uCAAuC,CAAC,CA4ClD"}
@@ -4,27 +4,37 @@ exports.executeExternalPartySignedTransaction = executeExternalPartySignedTransa
4
4
  const node_crypto_1 = require("node:crypto");
5
5
  const errors_1 = require("../../core/errors");
6
6
  const canton_ed25519_signer_1 = require("./canton-ed25519-signer");
7
- const canton_protocol_1 = require("./canton-protocol");
7
+ const hash_signature_1 = require("./hash-signature");
8
+ const party_identity_1 = require("./party-identity");
8
9
  const execute_external_transaction_1 = require("./execute-external-transaction");
9
10
  const external_party_onboarding_1 = require("./external-party-onboarding");
11
+ const prepared_transaction_1 = require("./prepared-transaction");
10
12
  /**
11
13
  * Verifies a single external party's Ed25519 signature over a prepared transaction hash and executes the prepared
12
14
  * transaction with it (`interactiveSubmissionExecuteAndWait`), returning the update id.
13
15
  *
14
- * The party id must belong to the public key, and the signature must verify against the hash, before anything is sent
15
- * to the participant. The signature is sent in the raw Ed25519 format, as canonical padded base64, signed by the key's
16
- * Canton fingerprint.
16
+ * Before anything is sent to the participant: the party id must belong to the public key; the hash must be the hash of
17
+ * `preparedTransaction` under `hashingSchemeVersion`, recomputed here, and the transaction must act only as `partyId`
18
+ * (its command id and synchronizer are the ones it states); and the signature must verify against that hash. The
19
+ * signature is sent in the raw Ed25519 format, as canonical padded base64, signed by the key's Canton fingerprint.
17
20
  */
18
21
  async function executeExternalPartySignedTransaction(options) {
19
22
  if (!options.userId.trim()) {
20
23
  throw new errors_1.ValidationError('userId is required', { userId: options.userId });
21
24
  }
22
- const publicKeyFingerprint = (0, canton_protocol_1.assertCantonPartyMatchesPublicKey)({
25
+ const publicKeyFingerprint = (0, party_identity_1.assertPartyKey)({
23
26
  partyId: options.partyId,
24
27
  publicKeyBase64: options.publicKeyBase64,
25
28
  ...(options.publicKeyFingerprint !== undefined ? { publicKeyFingerprint: options.publicKeyFingerprint } : {}),
26
29
  });
27
- (0, canton_protocol_1.assertCantonHashSignature)({
30
+ const hashingSchemeVersion = options.hashingSchemeVersion ?? 'HASHING_SCHEME_VERSION_V2';
31
+ await (0, prepared_transaction_1.assertSubmittedPreparedTransaction)({
32
+ preparedTransaction: options.preparedTransaction,
33
+ preparedTransactionHashHex: options.preparedTransactionHashHex,
34
+ hashingScheme: hashingSchemeVersion,
35
+ expected: { actAs: [options.partyId] },
36
+ });
37
+ await (0, hash_signature_1.assertCantonHashSigned)({
28
38
  publicKeyBase64: options.publicKeyBase64,
29
39
  hashHex: options.preparedTransactionHashHex,
30
40
  signatureBase64: options.signatureBase64,
@@ -35,7 +45,7 @@ async function executeExternalPartySignedTransaction(options) {
35
45
  ledgerClient: options.ledgerClient,
36
46
  userId: options.userId,
37
47
  preparedTransaction: options.preparedTransaction,
38
- hashingSchemeVersion: options.hashingSchemeVersion ?? 'HASHING_SCHEME_VERSION_V2',
48
+ hashingSchemeVersion,
39
49
  submissionId: options.submissionId ?? (0, node_crypto_1.randomUUID)(),
40
50
  partySignatures: [
41
51
  {
@@ -1 +1 @@
1
- {"version":3,"file":"execute-external-party-signed-transaction.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/execute-external-party-signed-transaction.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,8CAAoD;AACpD,mEAA0E;AAC1E,uDAAiG;AACjG,iFAIwC;AACxC,2EAA8G;AAuB9G;;;;;;;GAOG;AACI,KAAK,gDACV,OAAqD;IAErD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,wBAAe,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,oBAAoB,GAAG,IAAA,mDAAiC,EAAC;QAC7D,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,GAAG,CAAC,OAAO,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9G,CAAC,CAAC;IACH,IAAA,2CAAyB,EAAC;QACxB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,OAAO,EAAE,OAAO,CAAC,0BAA0B;QAC3C,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;IACH,6GAA6G;IAC7G,MAAM,SAAS,GAAG,IAAA,uDAA+B,EAAC,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAEhG,OAAO,IAAA,gEAAiC,EAAC;QACvC,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;QAChD,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,2BAA2B;QACjF,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAA,wBAAU,GAAE;QAClD,eAAe,EAAE;YACf;gBACE,KAAK,EAAE,OAAO,CAAC,OAAO;gBACtB,UAAU,EAAE;oBACV;wBACE,SAAS;wBACT,QAAQ,EAAE,oBAAoB;wBAC9B,MAAM,EAAE,uDAA2B;wBACnC,oBAAoB,EAAE,8DAAkC;qBACzD;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"execute-external-party-signed-transaction.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/execute-external-party-signed-transaction.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,8CAAoD;AACpD,mEAA0E;AAC1E,qDAA0D;AAC1D,qDAAkD;AAClD,iFAIwC;AACxC,2EAA8G;AAC9G,iEAA4E;AA0B5E;;;;;;;;GAQG;AACI,KAAK,gDACV,OAAqD;IAErD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,wBAAe,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,oBAAoB,GAAG,IAAA,+BAAc,EAAC;QAC1C,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,GAAG,CAAC,OAAO,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9G,CAAC,CAAC;IACH,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,IAAI,2BAA2B,CAAC;IACzF,MAAM,IAAA,yDAAkC,EAAC;QACvC,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;QAChD,0BAA0B,EAAE,OAAO,CAAC,0BAA0B;QAC9D,aAAa,EAAE,oBAAoB;QACnC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;KACvC,CAAC,CAAC;IACH,MAAM,IAAA,uCAAsB,EAAC;QAC3B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,OAAO,EAAE,OAAO,CAAC,0BAA0B;QAC3C,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;IACH,6GAA6G;IAC7G,MAAM,SAAS,GAAG,IAAA,uDAA+B,EAAC,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAEhG,OAAO,IAAA,gEAAiC,EAAC;QACvC,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;QAChD,oBAAoB;QACpB,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAA,wBAAU,GAAE;QAClD,eAAe,EAAE;YACf;gBACE,KAAK,EAAE,OAAO,CAAC,OAAO;gBACtB,UAAU,EAAE;oBACV;wBACE,SAAS;wBACT,QAAQ,EAAE,oBAAoB;wBAC9B,MAAM,EAAE,uDAA2B;wBACnC,oBAAoB,EAAE,8DAAkC;qBACzD;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -7,7 +7,7 @@ const errors_1 = require("../../core/errors");
7
7
  const abort_1 = require("../../core/http/abort");
8
8
  const abort_2 = require("../../core/utils/abort");
9
9
  const party_readiness_1 = require("../party-readiness");
10
- const canton_protocol_1 = require("./canton-protocol");
10
+ const party_identity_1 = require("./party-identity");
11
11
  const external_party_details_1 = require("./external-party-details");
12
12
  const external_party_onboarding_1 = require("./external-party-onboarding");
13
13
  /**
@@ -17,7 +17,7 @@ const external_party_onboarding_1 = require("./external-party-onboarding");
17
17
  * synchronizer. `unknown` preserves transport/API uncertainty instead of incorrectly treating it as absence.
18
18
  */
19
19
  async function reconcileExternalPartyOnboarding(options) {
20
- const publicKeyFingerprint = (0, canton_protocol_1.assertCantonPartyMatchesPublicKey)({
20
+ const publicKeyFingerprint = (0, party_identity_1.assertPartyKey)({
21
21
  partyId: options.partyId,
22
22
  publicKeyBase64: options.publicKeyBase64,
23
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"external-party-lifecycle.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/external-party-lifecycle.ts"],"names":[],"mappings":";;;;;AACA,8CAO2B;AAC3B,iDAAqD;AACrD,kDAA4D;AAC5D,wDAAsG;AACtG,uDAAsE;AACtE,qEAA4E;AAC5E,2EAAkF;AAiFlF;;;;;GAKG;AACI,KAAK,2CACV,OAAgD;IAEhD,MAAM,oBAAoB,GAAG,IAAA,mDAAiC,EAAC;QAC7D,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG;QACX,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,oBAAoB;QACpB,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;IAEF,IAAI,YAAqC,CAAC;IAC1C,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/E,MAAM,4BAA4B,GAAG,GAAoB,EAAE,CAAC,sBAAsB,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,IAAA,0BAAkB,EAClC,OAAO,CAAC,MAAM,EACd,4BAA4B;QAC5B,0EAA0E;QAC1E,qEAAqE;QACrE,GAAG,EAAE,CACH,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC;YACnC,KAAK,EAAE,OAAO,CAAC,OAAO;YACtB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,+DAAmC;SACtF,CAAC,CACL,CAAC;QACF,MAAM,OAAO,GAAG,IAAA,yDAAgC,EAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;gBACL,GAA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G,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,IAAA,6BAAoB,EAAC,KAAK,CAAC,EAAE,MAAM,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"external-party-lifecycle.js","sourceRoot":"","sources":["../../../../src/utils/external-signing/external-party-lifecycle.ts"],"names":[],"mappings":";;;;;AACA,8CAO2B;AAC3B,iDAAqD;AACrD,kDAA4D;AAC5D,wDAAsG;AACtG,qDAAkD;AAClD,qEAA4E;AAC5E,2EAAkF;AAiFlF;;;;;GAKG;AACI,KAAK,2CACV,OAAgD;IAEhD,MAAM,oBAAoB,GAAG,IAAA,+BAAc,EAAC;QAC1C,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG;QACX,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,oBAAoB;QACpB,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;IAEF,IAAI,YAAqC,CAAC;IAC1C,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/E,MAAM,4BAA4B,GAAG,GAAoB,EAAE,CAAC,sBAAsB,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,IAAA,0BAAkB,EAClC,OAAO,CAAC,MAAM,EACd,4BAA4B;QAC5B,0EAA0E;QAC1E,qEAAqE;QACrE,GAAG,EAAE,CACH,OAAO,CAAC,YAAY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C;AACH,CAAC;AAED,SAAS,eAAe,CAAC,OAAqC;IAC5D,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,IAAA,6BAAoB,EAAC,KAAK,CAAC,EAAE,MAAM,CAAC;AAC7C,CAAC"}
@@ -5,23 +5,47 @@ export declare const CANTON_EC_CURVE25519_PUBLIC_KEY_SPEC = "SIGNING_KEY_SPEC_EC
5
5
  export declare const CANTON_RAW_SIGNATURE_FORMAT = "SIGNATURE_FORMAT_RAW";
6
6
  export declare const CANTON_ED25519_SIGNATURE_ALGORITHM = "SIGNING_ALGORITHM_SPEC_ED25519";
7
7
  export declare const DEFAULT_CANTON_IDENTITY_PROVIDER_ID = "";
8
- export interface PrepareExternalPartyOnboardingOptions {
9
- readonly ledgerClient: LedgerJsonApiClient;
10
- readonly synchronizerId: string;
11
- readonly partyHint: string;
12
- readonly publicKeyBase64: string;
8
+ /**
9
+ * The hosting an external party is onboarded with. {@link prepareExternalPartyOnboarding} asks the participant for it
10
+ * and checks the generated topology states it; {@link submitExternalPartyOnboarding} checks the submitted topology
11
+ * states it, so pass the same values to both.
12
+ */
13
+ export interface ExternalPartyOnboardingHostingOptions {
13
14
  /** If true, the local participant will only observe, not confirm (default: false). */
14
15
  readonly localParticipantObservationOnly?: boolean;
15
- /** Other participant UIDs that should confirm for this party. */
16
+ /**
17
+ * Other participant UIDs that should confirm for this party: each a participant's unique identifier, `name::1220<64
18
+ * lowercase hex>` without the `PAR::` prefix, listed once, and not the local participant.
19
+ */
16
20
  readonly otherConfirmingParticipantUids?: readonly string[];
17
- /** Confirmation threshold for multi-hosted party (default: all confirmers). */
21
+ /**
22
+ * Confirmation threshold for multi-hosted party: a non-negative integer, at most the number of confirming
23
+ * participants (default, or 0: all confirmers).
24
+ */
18
25
  readonly confirmationThreshold?: number;
19
- /** Other participant UIDs that should only observe. */
26
+ /** Other participant UIDs that should only observe (same form and rules as `otherConfirmingParticipantUids`). */
20
27
  readonly observingParticipantUids?: readonly string[];
28
+ /**
29
+ * The local participant's unique identifier (`name::1220<64 lowercase hex>`, no `PAR::` prefix) as the caller knows
30
+ * it. When set, a `GET /v2/parties/participant-id` answering any other identifier is refused before anything is
31
+ * signed or allocated. Without it, which participant hosts the party with the local permission is the participant's
32
+ * own word.
33
+ */
34
+ readonly expectedLocalParticipantUid?: string;
35
+ }
36
+ export interface PrepareExternalPartyOnboardingOptions extends ExternalPartyOnboardingHostingOptions {
37
+ readonly ledgerClient: LedgerJsonApiClient;
38
+ readonly synchronizerId: string;
39
+ readonly partyHint: string;
40
+ readonly publicKeyBase64: string;
21
41
  }
22
42
  export interface PreparedExternalPartyOnboarding {
23
43
  readonly partyId: string;
24
44
  readonly publicKeyFingerprint: string;
45
+ /**
46
+ * The multi-hash the party signs, canonical hex (`1220…`): recomputed from `topologyTransactions` after they were
47
+ * checked against the requested onboarding, never the participant's own value.
48
+ */
25
49
  readonly multiHashHex: string;
26
50
  readonly synchronizerId: string;
27
51
  readonly topologyTransactions: readonly string[];
@@ -29,7 +53,7 @@ export interface PreparedExternalPartyOnboarding {
29
53
  readonly signingAlgorithmSpec: typeof CANTON_ED25519_SIGNATURE_ALGORITHM;
30
54
  readonly raw: unknown;
31
55
  }
32
- export interface SubmitExternalPartyOnboardingOptions {
56
+ export interface SubmitExternalPartyOnboardingOptions extends ExternalPartyOnboardingHostingOptions {
33
57
  readonly ledgerClient: LedgerJsonApiClient;
34
58
  readonly synchronizerId: string;
35
59
  readonly partyId: string;
@@ -130,18 +154,36 @@ export interface CreatedExternalPartyWithSigner {
130
154
  /**
131
155
  * Prepares external-party topology for a raw or DER-wrapped Ed25519 public key.
132
156
  *
133
- * The caller should ask the end-user wallet to sign `multiHashHex` before calling {@link submitExternalPartyOnboarding}.
157
+ * The participant's answer is not trusted: the SDK reads the local participant's unique identifier (`GET
158
+ * /v2/parties/participant-id`), checks the generated topology states exactly the requested onboarding (the party
159
+ * `partyHint::fingerprint` built from the request, its one key with the usages `NAMESPACE`, `PROTOCOL` and
160
+ * `PROOF_OF_OWNERSHIP`, the hosting participants with their permissions, and the confirmation threshold) and recomputes
161
+ * the multi-hash from it. A topology that differs, or a participant multi-hash that is not the recomputed one, is an
162
+ * `OperationError` (`TRANSACTION_FAILED`) whose `cause` is `@fairmint/canton-protocol`'s `CantonProtocolError`. Canton
163
+ * 3.4 or later is required (one generated transaction).
164
+ *
165
+ * The caller should ask the end-user wallet to sign `multiHashHex` (the recomputed multi-hash) before calling
166
+ * {@link submitExternalPartyOnboarding}.
134
167
  */
135
168
  export declare function prepareExternalPartyOnboarding(options: PrepareExternalPartyOnboardingOptions): Promise<PreparedExternalPartyOnboarding>;
136
169
  /**
137
170
  * Creates an external party using an external Ed25519 signer.
138
171
  *
139
- * Use this when the private key is held by a wallet service or browser wallet. The SDK prepares Canton topology, passes
140
- * the multihash to `signMultiHash`, validates the returned signature against the submitted public key, and submits the
141
- * allocation.
172
+ * Use this when the private key is held by a wallet service or browser wallet. The SDK prepares Canton topology and
173
+ * checks it (see {@link prepareExternalPartyOnboarding}), passes the multi-hash it recomputed to `signMultiHash`,
174
+ * validates the returned signature against the submitted public key, and submits the allocation. `signMultiHash` is
175
+ * never called for a topology that does not match the request.
142
176
  */
143
177
  export declare function createExternalPartyWithSigner(options: CreateExternalPartyWithSignerOptions): Promise<CreatedExternalPartyWithSigner>;
144
- /** Verifies the end-user Ed25519 signature and submits prepared external-party topology to Canton. */
178
+ /**
179
+ * Verifies the submitted topology and the end-user Ed25519 signature, then submits the prepared external-party topology
180
+ * to Canton. `multiHashHex` must be the multi-hash recomputed from `topologyTransactions`, the signature must verify
181
+ * over it with `publicKeyBase64`, and `topologyTransactions` must state exactly the onboarding of `partyId` with that
182
+ * key (usages `NAMESPACE`, `PROTOCOL` and `PROOF_OF_OWNERSHIP`) and the hosting options given here (the same as
183
+ * prepare's; by default the local participant, read from `GET /v2/parties/participant-id`, confirming alone); otherwise
184
+ * a `ValidationError` is thrown and nothing is allocated. A participant-id answer that is not a participant unique
185
+ * identifier, or not `expectedLocalParticipantUid`, is an `OperationError`.
186
+ */
145
187
  export declare function submitExternalPartyOnboarding(options: SubmitExternalPartyOnboardingOptions): Promise<SubmittedExternalPartyOnboarding>;
146
188
  /** Lists party ids whose suffix matches the supplied Ed25519 public key fingerprint. */
147
189
  export declare function listExternalPartyIdsForPublicKey(ledgerClient: LedgerJsonApiClient, publicKeyBase64: string, signal?: AbortSignal): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"external-party-onboarding.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/external-party-onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EAAE,KAAK,sBAAsB,EAAmC,MAAM,yBAAyB,CAAC;AAcvG,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,oCAAoC,mCAAmC,CAAC;AACrF,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,kCAAkC,mCAAmC,CAAC;AACnF,eAAO,MAAM,mCAAmC,KAAK,CAAC;AAEtD,MAAM,WAAW,qCAAqC;IACpD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C,OAAO,CAAC,gCAAgC,CAAC,CA2E3C;AAaD,wFAAwF;AACxF,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,mBAAmB,EACjC,eAAe,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IACT,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,CAAC,CASD;AAED,+EAA+E;AAC/E,wBAAsB,qCAAqC,CACzD,YAAY,EAAE,mBAAmB,EACjC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,kBAAkB,SAAsC,EACxD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IACT,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,CAAC,CA0BD"}
1
+ {"version":3,"file":"external-party-onboarding.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/external-party-onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EAAE,KAAK,sBAAsB,EAAmC,MAAM,yBAAyB,CAAC;AAuBvG,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,oCAAoC,mCAAmC,CAAC;AACrF,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,kCAAkC,mCAAmC,CAAC;AACnF,eAAO,MAAM,mCAAmC,KAAK,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,qCAAqC;IACpD,sFAAsF;IACtF,QAAQ,CAAC,+BAA+B,CAAC,EAAE,OAAO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O,CAAC,8BAA8B,CAAC,CA8CzC;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,gCAAgC,CAAC,CA4F3C;AAaD,wFAAwF;AACxF,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,mBAAmB,EACjC,eAAe,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IACT,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,CAAC,CASD;AAED,+EAA+E;AAC/E,wBAAsB,qCAAqC,CACzD,YAAY,EAAE,mBAAmB,EACjC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,kBAAkB,SAAsC,EACxD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IACT,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,CAAC,CA0BD"}
@@ -13,9 +13,13 @@ const canton_response_utils_1 = require("../canton-response-utils");
13
13
  const allocate_external_party_1 = require("./allocate-external-party");
14
14
  const allocation_user_id_1 = require("./allocation-user-id");
15
15
  const canton_ed25519_signer_1 = require("./canton-ed25519-signer");
16
+ const topology_1 = require("@fairmint/canton-protocol/topology");
16
17
  const canton_protocol_1 = require("./canton-protocol");
18
+ const hash_signature_1 = require("./hash-signature");
19
+ const party_identity_1 = require("./party-identity");
17
20
  const external_party_details_1 = require("./external-party-details");
18
21
  const generate_external_party_1 = require("./generate-external-party");
22
+ const onboarding_topology_1 = require("./onboarding-topology");
19
23
  exports.CANTON_DER_X509_PUBLIC_KEY_FORMAT = 'CRYPTO_KEY_FORMAT_DER_X509_SUBJECT_PUBLIC_KEY_INFO';
20
24
  exports.CANTON_EC_CURVE25519_PUBLIC_KEY_SPEC = 'SIGNING_KEY_SPEC_EC_CURVE25519';
21
25
  exports.CANTON_RAW_SIGNATURE_FORMAT = 'SIGNATURE_FORMAT_RAW';
@@ -35,18 +39,30 @@ exports.ExternalPartyConflictReconciliationError = ExternalPartyConflictReconcil
35
39
  /**
36
40
  * Prepares external-party topology for a raw or DER-wrapped Ed25519 public key.
37
41
  *
38
- * The caller should ask the end-user wallet to sign `multiHashHex` before calling {@link submitExternalPartyOnboarding}.
42
+ * The participant's answer is not trusted: the SDK reads the local participant's unique identifier (`GET
43
+ * /v2/parties/participant-id`), checks the generated topology states exactly the requested onboarding (the party
44
+ * `partyHint::fingerprint` built from the request, its one key with the usages `NAMESPACE`, `PROTOCOL` and
45
+ * `PROOF_OF_OWNERSHIP`, the hosting participants with their permissions, and the confirmation threshold) and recomputes
46
+ * the multi-hash from it. A topology that differs, or a participant multi-hash that is not the recomputed one, is an
47
+ * `OperationError` (`TRANSACTION_FAILED`) whose `cause` is `@fairmint/canton-protocol`'s `CantonProtocolError`. Canton
48
+ * 3.4 or later is required (one generated transaction).
49
+ *
50
+ * The caller should ask the end-user wallet to sign `multiHashHex` (the recomputed multi-hash) before calling
51
+ * {@link submitExternalPartyOnboarding}.
39
52
  */
40
53
  async function prepareExternalPartyOnboarding(options) {
41
54
  validateRequiredString('synchronizerId', options.synchronizerId);
42
55
  validateRequiredString('partyHint', options.partyHint);
56
+ const publicKeyBase64 = (0, party_identity_1.cantonPublicKeyBase64)(options.publicKeyBase64);
57
+ const expectedPartyId = (0, party_identity_1.requestedExternalPartyId)(options.partyHint, publicKeyBase64);
58
+ const hosting = await (0, onboarding_topology_1.resolveOnboardingHosting)(options.ledgerClient, (0, onboarding_topology_1.checkOnboardingHosting)(options));
43
59
  const topology = await (0, generate_external_party_1.generateExternalPartyTopology)({
44
60
  ledgerClient: options.ledgerClient,
45
61
  synchronizerId: options.synchronizerId,
46
62
  partyHint: options.partyHint,
47
63
  publicKey: {
48
64
  format: exports.CANTON_DER_X509_PUBLIC_KEY_FORMAT,
49
- keyData: (0, canton_protocol_1.normalizeEd25519PublicKeyForCanton)(options.publicKeyBase64),
65
+ keyData: publicKeyBase64,
50
66
  keySpec: exports.CANTON_EC_CURVE25519_PUBLIC_KEY_SPEC,
51
67
  },
52
68
  ...(options.localParticipantObservationOnly !== undefined
@@ -65,12 +81,23 @@ async function prepareExternalPartyOnboarding(options) {
65
81
  partyId,
66
82
  publicKeyBase64: options.publicKeyBase64,
67
83
  });
84
+ if (partyId !== expectedPartyId) {
85
+ throw new errors_1.OperationError('Canton topology generation response party ID is not the requested party', errors_1.OperationErrorCode.TRANSACTION_FAILED, { expectedPartyId, partyId });
86
+ }
87
+ const topologyTransactions = readRequiredStringArray(topology, 'topologyTransactions', 'topology generation');
88
+ const multiHashHex = (0, onboarding_topology_1.verifyGeneratedOnboardingTopology)({
89
+ transactions: topologyTransactions,
90
+ multiHash: (0, canton_response_utils_1.readRequiredString)(topology, 'multiHash', 'topology generation'),
91
+ partyId: expectedPartyId,
92
+ publicKeyBase64,
93
+ hosting,
94
+ });
68
95
  return {
69
96
  partyId,
70
97
  publicKeyFingerprint,
71
- multiHashHex: (0, canton_protocol_1.normalizeCantonHashToHex)((0, canton_response_utils_1.readRequiredString)(topology, 'multiHash', 'topology generation'), 'topology generation'),
98
+ multiHashHex,
72
99
  synchronizerId: options.synchronizerId,
73
- topologyTransactions: readRequiredStringArray(topology, 'topologyTransactions', 'topology generation'),
100
+ topologyTransactions,
74
101
  publicKeyFormat: exports.CANTON_DER_X509_PUBLIC_KEY_FORMAT,
75
102
  signingAlgorithmSpec: exports.CANTON_ED25519_SIGNATURE_ALGORITHM,
76
103
  raw: topology,
@@ -79,28 +106,20 @@ async function prepareExternalPartyOnboarding(options) {
79
106
  /**
80
107
  * Creates an external party using an external Ed25519 signer.
81
108
  *
82
- * Use this when the private key is held by a wallet service or browser wallet. The SDK prepares Canton topology, passes
83
- * the multihash to `signMultiHash`, validates the returned signature against the submitted public key, and submits the
84
- * allocation.
109
+ * Use this when the private key is held by a wallet service or browser wallet. The SDK prepares Canton topology and
110
+ * checks it (see {@link prepareExternalPartyOnboarding}), passes the multi-hash it recomputed to `signMultiHash`,
111
+ * validates the returned signature against the submitted public key, and submits the allocation. `signMultiHash` is
112
+ * never called for a topology that does not match the request.
85
113
  */
86
114
  async function createExternalPartyWithSigner(options) {
87
115
  const userId = options.userId === undefined ? undefined : (0, allocation_user_id_1.normalizeAllocationUserId)(options.userId);
88
- const publicKeyBase64 = (0, canton_protocol_1.normalizeEd25519PublicKeyForCanton)(options.publicKeyBase64);
116
+ const publicKeyBase64 = (0, party_identity_1.cantonPublicKeyBase64)(options.publicKeyBase64);
89
117
  const prepared = await prepareExternalPartyOnboarding({
90
118
  ledgerClient: options.ledgerClient,
91
119
  synchronizerId: options.synchronizerId,
92
120
  partyHint: options.partyHint,
93
121
  publicKeyBase64,
94
- ...(options.localParticipantObservationOnly !== undefined
95
- ? { localParticipantObservationOnly: options.localParticipantObservationOnly }
96
- : {}),
97
- ...(options.otherConfirmingParticipantUids !== undefined
98
- ? { otherConfirmingParticipantUids: options.otherConfirmingParticipantUids }
99
- : {}),
100
- ...(options.confirmationThreshold !== undefined ? { confirmationThreshold: options.confirmationThreshold } : {}),
101
- ...(options.observingParticipantUids !== undefined
102
- ? { observingParticipantUids: options.observingParticipantUids }
103
- : {}),
122
+ ...(0, onboarding_topology_1.onboardingHostingOptions)(options),
104
123
  });
105
124
  const signature = await options.signMultiHash({
106
125
  partyHint: options.partyHint,
@@ -122,6 +141,7 @@ async function createExternalPartyWithSigner(options) {
122
141
  multiHashHex: prepared.multiHashHex,
123
142
  topologyTransactions: prepared.topologyTransactions,
124
143
  multiHashSignatureBase64: normalizeExternalPartyHashSignature(signature),
144
+ ...(0, onboarding_topology_1.onboardingHostingOptions)(options),
125
145
  ...(options.identityProviderId !== undefined ? { identityProviderId: options.identityProviderId } : {}),
126
146
  ...(userId !== undefined ? { userId } : {}),
127
147
  ...(options.allowAlreadyExists !== undefined ? { allowAlreadyExists: options.allowAlreadyExists } : {}),
@@ -137,21 +157,46 @@ async function createExternalPartyWithSigner(options) {
137
157
  alreadyExisted: submitted.alreadyExisted,
138
158
  };
139
159
  }
140
- /** Verifies the end-user Ed25519 signature and submits prepared external-party topology to Canton. */
160
+ /**
161
+ * Verifies the submitted topology and the end-user Ed25519 signature, then submits the prepared external-party topology
162
+ * to Canton. `multiHashHex` must be the multi-hash recomputed from `topologyTransactions`, the signature must verify
163
+ * over it with `publicKeyBase64`, and `topologyTransactions` must state exactly the onboarding of `partyId` with that
164
+ * key (usages `NAMESPACE`, `PROTOCOL` and `PROOF_OF_OWNERSHIP`) and the hosting options given here (the same as
165
+ * prepare's; by default the local participant, read from `GET /v2/parties/participant-id`, confirming alone); otherwise
166
+ * a `ValidationError` is thrown and nothing is allocated. A participant-id answer that is not a participant unique
167
+ * identifier, or not `expectedLocalParticipantUid`, is an `OperationError`.
168
+ */
141
169
  async function submitExternalPartyOnboarding(options) {
142
170
  validateRequiredString('synchronizerId', options.synchronizerId);
143
171
  const userId = options.userId === undefined ? undefined : (0, allocation_user_id_1.normalizeAllocationUserId)(options.userId);
144
- const publicKeyFingerprint = (0, canton_protocol_1.assertCantonPartyMatchesPublicKey)({
172
+ const hostingRequest = (0, onboarding_topology_1.checkOnboardingHosting)(options);
173
+ const publicKeyFingerprint = (0, party_identity_1.assertPartyKey)({
145
174
  partyId: options.partyId,
146
175
  publicKeyBase64: options.publicKeyBase64,
147
176
  ...(options.publicKeyFingerprint !== undefined ? { publicKeyFingerprint: options.publicKeyFingerprint } : {}),
148
177
  });
149
- const multiHashHex = (0, canton_protocol_1.assertCantonSha256MultihashHex)(options.multiHashHex);
150
- (0, canton_protocol_1.assertCantonHashSignature)({
178
+ const multiHashHex = (0, party_identity_1.cantonHashHexOf)(options.multiHashHex);
179
+ const recomputedMultiHashHex = (0, party_identity_1.onCallerInput)(() => (0, topology_1.computeTopologyMultiHash)(options.topologyTransactions));
180
+ if (recomputedMultiHashHex !== multiHashHex) {
181
+ throw new errors_1.ValidationError('multiHashHex is not the multi-hash of topologyTransactions', {
182
+ multiHashHex,
183
+ recomputedMultiHashHex,
184
+ });
185
+ }
186
+ await (0, hash_signature_1.assertCantonHashSigned)({
151
187
  publicKeyBase64: options.publicKeyBase64,
152
188
  hashHex: multiHashHex,
153
189
  signatureBase64: options.multiHashSignatureBase64,
154
190
  });
191
+ // The signed transactions must onboard this party, with this key, on the requested hosting: the participant allocates
192
+ // whatever they state.
193
+ (0, onboarding_topology_1.verifySubmittedOnboardingTopology)({
194
+ transactions: options.topologyTransactions,
195
+ multiHash: multiHashHex,
196
+ partyId: options.partyId,
197
+ publicKeyBase64: options.publicKeyBase64,
198
+ hosting: await (0, onboarding_topology_1.resolveOnboardingHosting)(options.ledgerClient, hostingRequest),
199
+ });
155
200
  const multiHashSignature = normalizeExternalPartyHashSignature({ signatureBase64: options.multiHashSignatureBase64 });
156
201
  try {
157
202
  const raw = await (0, allocate_external_party_1.allocateExternalParty)({
@@ -211,7 +256,7 @@ function normalizeExternalPartyHashSignature(signature) {
211
256
  }
212
257
  /** Lists party ids whose suffix matches the supplied Ed25519 public key fingerprint. */
213
258
  async function listExternalPartyIdsForPublicKey(ledgerClient, publicKeyBase64, signal) {
214
- const publicKeyFingerprint = (0, canton_protocol_1.deriveCantonEd25519PublicKeyFingerprint)(publicKeyBase64);
259
+ const publicKeyFingerprint = (0, party_identity_1.publicKeyFingerprintOf)(publicKeyBase64);
215
260
  const raw = signal === undefined ? await ledgerClient.listParties({}) : await ledgerClient.listParties({}, { signal });
216
261
  return {
217
262
  publicKeyFingerprint,
@@ -221,8 +266,8 @@ async function listExternalPartyIdsForPublicKey(ledgerClient, publicKeyBase64, s
221
266
  }
222
267
  /** Checks one exact external-party id built from party hint and public key. */
223
268
  async function getExternalPartyIdForHintAndPublicKey(ledgerClient, partyHint, publicKeyBase64, identityProviderId = exports.DEFAULT_CANTON_IDENTITY_PROVIDER_ID, signal) {
224
- const publicKeyFingerprint = (0, canton_protocol_1.deriveCantonEd25519PublicKeyFingerprint)(publicKeyBase64);
225
- const partyId = (0, canton_protocol_1.buildExternalPartyId)(partyHint, publicKeyFingerprint);
269
+ const publicKeyFingerprint = (0, party_identity_1.publicKeyFingerprintOf)(publicKeyBase64);
270
+ const partyId = (0, party_identity_1.externalPartyIdOf)(partyHint, publicKeyFingerprint);
226
271
  try {
227
272
  const params = { party: partyId, identityProviderId };
228
273
  const raw = signal === undefined
@@ -317,7 +362,7 @@ function validateRequiredString(name, value) {
317
362
  }
318
363
  function assertGeneratedPartyMatchesPublicKey(input) {
319
364
  try {
320
- return (0, canton_protocol_1.assertCantonPartyMatchesPublicKey)(input);
365
+ return (0, party_identity_1.assertPartyKey)(input);
321
366
  }
322
367
  catch (error) {
323
368
  throw new errors_1.OperationError('Canton topology generation response did not include a party ID matching the submitted public key', errors_1.OperationErrorCode.TRANSACTION_FAILED, { cause: error instanceof Error ? error.message : String(error) });