@fairmint/canton-node-sdk 0.0.296 → 0.0.297

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 (33) hide show
  1. package/README.md +43 -0
  2. package/build/src/external-parties/directory.d.ts +96 -0
  3. package/build/src/external-parties/directory.d.ts.map +1 -0
  4. package/build/src/external-parties/directory.js +238 -0
  5. package/build/src/external-parties/directory.js.map +1 -0
  6. package/build/src/external-parties/discovery.d.ts +72 -0
  7. package/build/src/external-parties/discovery.d.ts.map +1 -0
  8. package/build/src/external-parties/discovery.js +160 -0
  9. package/build/src/external-parties/discovery.js.map +1 -0
  10. package/build/src/external-parties/errors.d.ts +28 -0
  11. package/build/src/external-parties/errors.d.ts.map +1 -0
  12. package/build/src/external-parties/errors.js +33 -0
  13. package/build/src/external-parties/errors.js.map +1 -0
  14. package/build/src/external-parties/hints.d.ts +42 -0
  15. package/build/src/external-parties/hints.d.ts.map +1 -0
  16. package/build/src/external-parties/hints.js +83 -0
  17. package/build/src/external-parties/hints.js.map +1 -0
  18. package/build/src/external-parties/index.d.ts +20 -0
  19. package/build/src/external-parties/index.d.ts.map +1 -0
  20. package/build/src/external-parties/index.js +43 -0
  21. package/build/src/external-parties/index.js.map +1 -0
  22. package/build/src/external-parties/keys.d.ts +34 -0
  23. package/build/src/external-parties/keys.d.ts.map +1 -0
  24. package/build/src/external-parties/keys.js +209 -0
  25. package/build/src/external-parties/keys.js.map +1 -0
  26. package/build/src/index.d.ts +1 -0
  27. package/build/src/index.d.ts.map +1 -1
  28. package/build/src/index.js +2 -1
  29. package/build/src/index.js.map +1 -1
  30. package/build/src/utils/external-signing/canton-protocol.d.ts.map +1 -1
  31. package/build/src/utils/external-signing/canton-protocol.js +11 -14
  32. package/build/src/utils/external-signing/canton-protocol.js.map +1 -1
  33. package/package.json +10 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/external-parties/discovery.ts"],"names":[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U,KAAK,SAAS,CAAC,CAAC;AACtG,CAAC;AAED,SAAS,OAAO,CAAC,CAAS,EAAE,CAAS;IACnC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The external-party module's one error type. Browser-safe: no Node or SDK dependency, and matched by a brand rather
3
+ * than `instanceof`, so it is recognised across copies of this module.
4
+ */
5
+ /**
6
+ * Why an external-party call failed:
7
+ *
8
+ * - `INVALID_INPUT`: a key, fingerprint, hint, option or argument the caller passed is not valid.
9
+ * - `INVALID_RESPONSE`: the participant (or a `listParties` / `findParty` callback) answered something unreadable.
10
+ * - `ABORTED`: the caller's `signal` aborted the call.
11
+ * - `LIST_FAILED`: reading the participant's party list failed; `cause` is the ledger client's error.
12
+ * - `LOOKUP_FAILED`: an exact party lookup failed; `cause` is the ledger client's error.
13
+ */
14
+ export type ExternalPartyErrorCode = 'INVALID_INPUT' | 'INVALID_RESPONSE' | 'ABORTED' | 'LIST_FAILED' | 'LOOKUP_FAILED';
15
+ export declare class ExternalPartyError extends Error {
16
+ readonly name = "ExternalPartyError";
17
+ readonly code: ExternalPartyErrorCode;
18
+ /** For `LOOKUP_FAILED`, and `ABORTED` or `INVALID_RESPONSE` of a lookup: the party ID that was looked up. */
19
+ readonly partyId: string | undefined;
20
+ constructor(code: ExternalPartyErrorCode, message: string, options?: {
21
+ readonly cause?: unknown;
22
+ readonly partyId?: string;
23
+ });
24
+ }
25
+ /** Whether `error` is an {@link ExternalPartyError} (of any copy of this module), optionally with one of `codes`. */
26
+ export declare function isExternalPartyError(error: unknown, ...codes: readonly ExternalPartyErrorCode[]): error is ExternalPartyError;
27
+ export declare function invalidInput(message: string): ExternalPartyError;
28
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/external-parties/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,kBAAkB,GAAG,SAAS,GAAG,aAAa,GAAG,eAAe,CAAC;AAIxH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAyB,IAAI,wBAAwB;IACrD,SAAgB,IAAI,EAAE,sBAAsB,CAAC;IAC7C,6GAA6G;IAC7G,SAAgB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5C,YACE,IAAI,EAAE,sBAAsB,EAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,EAStE;CACF;AAED,qHAAqH;AACrH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,GAAG,KAAK,EAAE,SAAS,sBAAsB,EAAE,GAC1C,KAAK,IAAI,kBAAkB,CAG7B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAEhE"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * The external-party module's one error type. Browser-safe: no Node or SDK dependency, and matched by a brand rather
4
+ * than `instanceof`, so it is recognised across copies of this module.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ExternalPartyError = void 0;
8
+ exports.isExternalPartyError = isExternalPartyError;
9
+ exports.invalidInput = invalidInput;
10
+ const BRAND = Symbol.for('@fairmint/canton-node-sdk/ExternalPartyError');
11
+ class ExternalPartyError extends Error {
12
+ constructor(code, message, options = {}) {
13
+ super(message);
14
+ this.name = 'ExternalPartyError';
15
+ this.code = code;
16
+ this.partyId = options.partyId;
17
+ if ('cause' in options) {
18
+ Object.defineProperty(this, 'cause', { value: options.cause, enumerable: false, writable: true });
19
+ }
20
+ Object.defineProperty(this, BRAND, { value: true });
21
+ }
22
+ }
23
+ exports.ExternalPartyError = ExternalPartyError;
24
+ /** Whether `error` is an {@link ExternalPartyError} (of any copy of this module), optionally with one of `codes`. */
25
+ function isExternalPartyError(error, ...codes) {
26
+ if (typeof error !== 'object' || error === null || error[BRAND] !== true)
27
+ return false;
28
+ return codes.length === 0 || codes.includes(error.code);
29
+ }
30
+ function invalidInput(message) {
31
+ return new ExternalPartyError('INVALID_INPUT', message);
32
+ }
33
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/external-parties/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAaH,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;AAEzE,wBAAgC,SAAQ,KAAK;IAM3C,YACE,IAA4B,EAC5B,OAAe,EACf,OAAO,GAA4D,EAAE;QAErE,KAAK,CAAC,OAAO,CAAC,CAAC;QAVQ,SAAI,GAAG,oBAAoB,CAAC;QAWnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACpG,CAAC;QACD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;CACF;;AAED,qHAAqH;AACrH,8BACE,KAAc,EACd,GAAG,KAAwC;IAE3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAiC,CAAC,KAAK,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACpH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAE,KAA4B,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC;AAED,sBAA6B,OAAe;IAC1C,OAAO,IAAI,kBAAkB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Party hints for new external parties: a short, readable suggestion, and the check of a hint a user typed. Pure and
3
+ * browser-safe. A party ID already carries its key's fingerprint, so a hint only has to be unique among that key's own
4
+ * parties. The hint is public and permanent on the ledger (every counterparty, Scan and explorers see the party ID):
5
+ * never a name, email or other personal data.
6
+ */
7
+ /** The hint {@link suggestExternalPartyHint} uses when given no base name. */
8
+ export declare const DEFAULT_EXTERNAL_PARTY_HINT = "wallet";
9
+ /** The longest base {@link suggestExternalPartyHint} keeps, before any `-2`, `-3`, ... suffix. */
10
+ export declare const MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH = 24;
11
+ /** The longest new party hint {@link validateExternalPartyHint} accepts. */
12
+ export declare const MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH = 40;
13
+ /**
14
+ * Why a new party hint is refused:
15
+ *
16
+ * - `empty`: nothing but whitespace.
17
+ * - `too-long`: more than {@link MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH} characters.
18
+ * - `charset`: not a letter or digit followed by letters, digits, `-` and `_`.
19
+ * - `taken`: one of the key's parties already has it (use that party instead).
20
+ */
21
+ export type ExternalPartyHintError = 'empty' | 'too-long' | 'charset' | 'taken';
22
+ /**
23
+ * A short, readable party hint, unique among the key's parties: `base` reduced to lowercase letters, digits and dashes
24
+ * (at most {@link MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH} characters), else `fallback` reduced the same way
25
+ * ({@link DEFAULT_EXTERNAL_PARTY_HINT} by default), then `-2`, `-3`, ... until it is not one of `taken` (the hints of
26
+ * the key's parties). Pass an app label or a nickname the user picks as `base`.
27
+ */
28
+ export declare function suggestExternalPartyHint(options?: {
29
+ readonly base?: string;
30
+ readonly taken?: Iterable<string>;
31
+ readonly fallback?: string;
32
+ }): string;
33
+ /**
34
+ * Checks a hint the user typed for a **new** party, after trimming it: null when it is fine, else why not. `taken` is
35
+ * the hints the key's parties already have.
36
+ *
37
+ * Only for new names: an existing party keeps its hint, which may be longer or use other characters, so check `taken`
38
+ * first and use an existing party by its own hint without validating it. The rule is deliberately narrower than what
39
+ * the participant accepts, so a hint is short, readable and safe in a URL.
40
+ */
41
+ export declare function validateExternalPartyHint(hint: string, taken?: readonly string[]): ExternalPartyHintError | null;
42
+ //# sourceMappingURL=hints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../../src/external-parties/hints.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,2BAA2B,WAAW,CAAC;AAEpD,kGAAkG;AAClG,eAAO,MAAM,6CAA6C,KAAK,CAAC;AAEhE,4EAA4E;AAC5E,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAOrD;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,GAAE;IACP,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACvB,GACL,MAAM,CASR;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,sBAAsB,GAAG,IAAI,CAOpH"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Party hints for new external parties: a short, readable suggestion, and the check of a hint a user typed. Pure and
4
+ * browser-safe. A party ID already carries its key's fingerprint, so a hint only has to be unique among that key's own
5
+ * parties. The hint is public and permanent on the ledger (every counterparty, Scan and explorers see the party ID):
6
+ * never a name, email or other personal data.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH = exports.MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH = exports.DEFAULT_EXTERNAL_PARTY_HINT = void 0;
10
+ exports.suggestExternalPartyHint = suggestExternalPartyHint;
11
+ exports.validateExternalPartyHint = validateExternalPartyHint;
12
+ /** The hint {@link suggestExternalPartyHint} uses when given no base name. */
13
+ exports.DEFAULT_EXTERNAL_PARTY_HINT = 'wallet';
14
+ /** The longest base {@link suggestExternalPartyHint} keeps, before any `-2`, `-3`, ... suffix. */
15
+ exports.MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH = 24;
16
+ /** The longest new party hint {@link validateExternalPartyHint} accepts. */
17
+ exports.MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH = 40;
18
+ /** The most characters of `base` {@link suggestExternalPartyHint} reads: far more than it keeps. */
19
+ const MAX_BASE_INPUT_LENGTH = 1000;
20
+ const NEW_PARTY_HINT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u;
21
+ /**
22
+ * A short, readable party hint, unique among the key's parties: `base` reduced to lowercase letters, digits and dashes
23
+ * (at most {@link MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH} characters), else `fallback` reduced the same way
24
+ * ({@link DEFAULT_EXTERNAL_PARTY_HINT} by default), then `-2`, `-3`, ... until it is not one of `taken` (the hints of
25
+ * the key's parties). Pass an app label or a nickname the user picks as `base`.
26
+ */
27
+ function suggestExternalPartyHint(options = {}) {
28
+ // A base, or the fallback, reduced to lowercase letters, digits and dashes and bounded; '' when nothing is left.
29
+ const base = reduceHintBase(options.base) || reduceHintBase(options.fallback) || exports.DEFAULT_EXTERNAL_PARTY_HINT;
30
+ const taken = new Set(options.taken ?? []);
31
+ if (!taken.has(base))
32
+ return base;
33
+ for (let suffix = 2;; suffix += 1) {
34
+ const hint = `${base}-${suffix}`;
35
+ if (!taken.has(hint))
36
+ return hint;
37
+ }
38
+ }
39
+ /**
40
+ * Checks a hint the user typed for a **new** party, after trimming it: null when it is fine, else why not. `taken` is
41
+ * the hints the key's parties already have.
42
+ *
43
+ * Only for new names: an existing party keeps its hint, which may be longer or use other characters, so check `taken`
44
+ * first and use an existing party by its own hint without validating it. The rule is deliberately narrower than what
45
+ * the participant accepts, so a hint is short, readable and safe in a URL.
46
+ */
47
+ function validateExternalPartyHint(hint, taken = []) {
48
+ const trimmed = typeof hint === 'string' ? hint.trim() : '';
49
+ if (trimmed === '')
50
+ return 'empty';
51
+ if (trimmed.length > exports.MAX_NEW_EXTERNAL_PARTY_HINT_LENGTH)
52
+ return 'too-long';
53
+ if (!NEW_PARTY_HINT_PATTERN.test(trimmed))
54
+ return 'charset';
55
+ if (taken.includes(trimmed))
56
+ return 'taken';
57
+ return null;
58
+ }
59
+ /** `value` without leading and trailing dashes. */
60
+ function trimDashes(value) {
61
+ let start = 0;
62
+ let end = value.length;
63
+ while (start < end && value[start] === '-')
64
+ start += 1;
65
+ while (end > start && value[end - 1] === '-')
66
+ end -= 1;
67
+ return value.slice(start, end);
68
+ }
69
+ /**
70
+ * `value` reduced to a suggestion base: lowercase letters, digits and dashes, at most
71
+ * {@link MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH} characters, no leading or trailing dash; '' when nothing is
72
+ * left. Linear time: the input is bounded first, and dashes are trimmed without a backtracking pattern.
73
+ */
74
+ function reduceHintBase(value) {
75
+ const reduced = (typeof value === 'string' ? value : '')
76
+ .slice(0, MAX_BASE_INPUT_LENGTH)
77
+ .normalize('NFKD')
78
+ .replace(/[\u0300-\u036f]/gu, '')
79
+ .toLowerCase()
80
+ .replace(/[^a-z0-9]+/gu, '-');
81
+ return trimDashes(trimDashes(reduced).slice(0, exports.MAX_SUGGESTED_EXTERNAL_PARTY_HINT_BASE_LENGTH));
82
+ }
83
+ //# sourceMappingURL=hints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hints.js","sourceRoot":"","sources":["../../../src/external-parties/hints.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,8EAA8E;AACjE,QAAA,2BAA2B,GAAG,QAAQ,CAAC;AAEpD,kGAAkG;AACrF,QAAA,6CAA6C,GAAG,EAAE,CAAC;AAEhE,4EAA4E;AAC/D,QAAA,kCAAkC,GAAG,EAAE,CAAC;AAErD,oGAAoG;AACpG,MAAM,qBAAqB,GAAG,IAAK,CAAC;AAEpC,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAY9D;;;;;GAKG;AACH,kCACE,OAAO,GAIH,EAAE;IAEN,iHAAiH;IACjH,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAA,2BAA2B,CAAC;IAC7G,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,IAAI,MAAM,GAAG,CAAC,GAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;IACpC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,mCAA0C,IAAY,EAAE,KAAK,GAAsB,EAAE;IACnF,MA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OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAA,6CAA6C,CAAC,CAAC,CAAC;AACjG,CAAC"}
@@ -0,0 +1,20 @@
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.
5
+ *
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}.
14
+ */
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';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,43 @@
1
+ "use strict";
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;
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.
8
+ *
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}.
17
+ */
18
+ var directory_1 = require("./directory");
19
+ 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
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/external-parties/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,yCAQqB;AAPnB,yHAAA,4BAA4B,OAAA;AAQ9B,yCAQqB;AAPnB,oHAAA,uBAAuB,OAAA;AACvB,4HAAA,+BAA+B,OAAA;AAOjC,mCAAiG;AAAxF,4GAAA,kBAAkB,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AACjD,iCAOiB;AANf,oHAAA,2BAA2B,OAAA;AAC3B,2HAAA,kCAAkC,OAAA;AAClC,sIAAA,6CAA6C,OAAA;AAC7C,iHAAA,wBAAwB,OAAA;AACxB,kHAAA,yBAAyB,OAAA;AAG3B,+BAWgB;AAVd,4GAAA,oBAAoB,OAAA;AACpB,8GAAA,sBAAsB,OAAA;AACtB,+HAAA,uCAAuC,OAAA;AACvC,sHAAA,8BAA8B,OAAA;AAC9B,oHAAA,4BAA4B,OAAA;AAC5B,2GAAA,mBAAmB,OAAA;AACnB,oHAAA,4BAA4B,OAAA;AAC5B,0HAAA,kCAAkC,OAAA;AAClC,4GAAA,oBAAoB,OAAA;AACpB,0GAAA,kBAAkB,OAAA"}
@@ -0,0 +1,34 @@
1
+ /** The longest party ID this module builds: a Daml-LF Party is at most 255 characters (`LedgerPartyIdSchema`). */
2
+ export declare const MAX_EXTERNAL_PARTY_ID_LENGTH = 255;
3
+ /**
4
+ * Whether `hint` can start a party ID: non-empty, only Daml-LF Party characters, no `::` and no trailing `:` (which
5
+ * would run into the separator). Not trimmed.
6
+ */
7
+ export declare function isExternalPartyHint(hint: unknown): hint is string;
8
+ /**
9
+ * The raw 32-byte Ed25519 key of a raw (32 bytes) or DER X.509 SubjectPublicKeyInfo (44 bytes) key, base64 or
10
+ * base64url. Refuses a non-canonical encoding and the small-order points, as Canton does.
11
+ */
12
+ export declare function decodeEd25519PublicKey(publicKeyBase64: string): Uint8Array;
13
+ /** Canton's DER X.509 SubjectPublicKeyInfo encoding (base64) of a raw or DER Ed25519 public key. */
14
+ export declare function normalizeEd25519PublicKeyForCanton(publicKeyBase64: string): string;
15
+ /** The Canton fingerprint of a raw 32-byte Ed25519 key: `1220` + hex(sha256(int32be(12) || rawKey)). */
16
+ export declare function fingerprintRawEd25519PublicKey(rawPublicKey: Uint8Array): string;
17
+ /** The Canton fingerprint (`1220…`, 68 lowercase hex characters) of a raw or DER Ed25519 public key in base64. */
18
+ export declare function deriveCantonEd25519PublicKeyFingerprint(publicKeyBase64: string): string;
19
+ /** Whether `value` is a Canton SHA-256 multihash fingerprint: `1220` and 64 lowercase hex characters. */
20
+ export declare function isCantonPublicKeyFingerprint(value: unknown): value is string;
21
+ /**
22
+ * The party ID `hint::fingerprint`. The hint is trimmed; it must be non-empty, hold only Daml-LF Party characters, no
23
+ * `::` and no trailing `:`, and leave the ID within {@link MAX_EXTERNAL_PARTY_ID_LENGTH} characters. The fingerprint
24
+ * must be a lowercase SHA-256 multihash.
25
+ */
26
+ export declare function buildExternalPartyId(partyHint: string, publicKeyFingerprint: string): string;
27
+ /** The parts of a `hint::namespace` party ID (exactly one `::`, both sides non-empty), or null. Not trimmed. */
28
+ export declare function parseExternalPartyId(partyId: unknown): {
29
+ readonly partyHint: string;
30
+ readonly namespace: string;
31
+ } | null;
32
+ /** The namespace of a `hint::namespace` party ID (for an external party, its key's fingerprint), or null. */
33
+ export declare function readPartyNamespace(partyId: unknown): string | null;
34
+ //# sourceMappingURL=keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/external-parties/keys.ts"],"names":[],"mappings":"AAoBA,kHAAkH;AAClH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAIhD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAQjE;AAYD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,UAAU,CAiB1E;AAED,oGAAoG;AACpG,wBAAgB,kCAAkC,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAMlF;AAED,wGAAwG;AACxG,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAQ/E;AAED,kHAAkH;AAClH,wBAAgB,uCAAuC,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAEvF;AAED,yGAAyG;AACzG,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAoB5F;AAED,gHAAgH;AAChH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GACf;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKnE;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAElE"}
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_EXTERNAL_PARTY_ID_LENGTH = void 0;
4
+ exports.isExternalPartyHint = isExternalPartyHint;
5
+ exports.decodeEd25519PublicKey = decodeEd25519PublicKey;
6
+ exports.normalizeEd25519PublicKeyForCanton = normalizeEd25519PublicKeyForCanton;
7
+ exports.fingerprintRawEd25519PublicKey = fingerprintRawEd25519PublicKey;
8
+ exports.deriveCantonEd25519PublicKeyFingerprint = deriveCantonEd25519PublicKeyFingerprint;
9
+ exports.isCantonPublicKeyFingerprint = isCantonPublicKeyFingerprint;
10
+ exports.buildExternalPartyId = buildExternalPartyId;
11
+ exports.parseExternalPartyId = parseExternalPartyId;
12
+ exports.readPartyNamespace = readPartyNamespace;
13
+ /**
14
+ * Canton external-party identity for an Ed25519 key, browser-safe (Uint8Array and `@noble/hashes`, no `Buffer`, no
15
+ * `node:crypto`):
16
+ *
17
+ * - Fingerprint = `1220` + hex(sha256(int32be(12) || rawKey)): Canton's SHA-256 multihash of the key, hash purpose 12;
18
+ * - Party ID = `hint::fingerprint`;
19
+ * - A party's namespace is what follows its one `::`.
20
+ *
21
+ * The Node helpers of the same names under `utils/external-signing` (`canton-protocol.ts`) hash through this module and
22
+ * throw the SDK's `ValidationError`; these throw {@link ExternalPartyError} (`INVALID_INPUT`).
23
+ */
24
+ const sha2_1 = require("@noble/hashes/sha2");
25
+ const errors_1 = require("./errors");
26
+ const ED25519_DER_X509_PREFIX = Uint8Array.of(0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00);
27
+ const ED25519_RAW_PUBLIC_KEY_LENGTH = 32;
28
+ const ED25519_DER_X509_PUBLIC_KEY_LENGTH = ED25519_DER_X509_PREFIX.length + ED25519_RAW_PUBLIC_KEY_LENGTH;
29
+ const CANTON_PUBLIC_KEY_FINGERPRINT_HASH_PURPOSE = 12;
30
+ const CANTON_SHA256_MULTIHASH_PREFIX_HEX = '1220';
31
+ const CANTON_FINGERPRINT_PATTERN = /^1220[0-9a-f]{64}$/;
32
+ /** The longest party ID this module builds: a Daml-LF Party is at most 255 characters (`LedgerPartyIdSchema`). */
33
+ exports.MAX_EXTERNAL_PARTY_ID_LENGTH = 255;
34
+ /** The characters a Daml-LF Party may hold (`LedgerPartyIdSchema`): ASCII letters, digits, space, `:`, `-` and `_`. */
35
+ const DAML_PARTY_CHARACTERS = /^[A-Za-z0-9:_ -]+$/;
36
+ /**
37
+ * Whether `hint` can start a party ID: non-empty, only Daml-LF Party characters, no `::` and no trailing `:` (which
38
+ * would run into the separator). Not trimmed.
39
+ */
40
+ function isExternalPartyHint(hint) {
41
+ return (typeof hint === 'string' &&
42
+ hint.length > 0 &&
43
+ DAML_PARTY_CHARACTERS.test(hint) &&
44
+ !hint.includes('::') &&
45
+ !hint.endsWith(':'));
46
+ }
47
+ const ED25519_FIELD_PRIME_LE = hexToBytes('edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f');
48
+ const ED25519_SMALL_ORDER_PUBLIC_KEYS_HEX = new Set([
49
+ // The eight small-order points (the torsion subgroup), compared with the sign bit cleared: the identity (order 1),
50
+ // y = -1 (order 2), y = 0 (order 4) and the two order-8 y coordinates. Their sign-bit twins match the same entries.
51
+ '0100000000000000000000000000000000000000000000000000000000000000',
52
+ 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f',
53
+ '0000000000000000000000000000000000000000000000000000000000000000',
54
+ 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a',
55
+ '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05',
56
+ ]);
57
+ /**
58
+ * The raw 32-byte Ed25519 key of a raw (32 bytes) or DER X.509 SubjectPublicKeyInfo (44 bytes) key, base64 or
59
+ * base64url. Refuses a non-canonical encoding and the small-order points, as Canton does.
60
+ */
61
+ function decodeEd25519PublicKey(publicKeyBase64) {
62
+ const key = decodeBase64(publicKeyBase64);
63
+ let raw;
64
+ if (key.length === ED25519_RAW_PUBLIC_KEY_LENGTH) {
65
+ raw = key;
66
+ }
67
+ else if (key.length === ED25519_DER_X509_PUBLIC_KEY_LENGTH &&
68
+ ED25519_DER_X509_PREFIX.every((byte, index) => key[index] === byte)) {
69
+ raw = key.slice(ED25519_DER_X509_PREFIX.length);
70
+ }
71
+ else {
72
+ throw (0, errors_1.invalidInput)(`Invalid Ed25519 public key length: ${key.length}; expected raw 32 bytes or DER-wrapped 44 bytes`);
73
+ }
74
+ assertCanonicalEd25519PublicKey(raw);
75
+ return raw;
76
+ }
77
+ /** Canton's DER X.509 SubjectPublicKeyInfo encoding (base64) of a raw or DER Ed25519 public key. */
78
+ function normalizeEd25519PublicKeyForCanton(publicKeyBase64) {
79
+ const raw = decodeEd25519PublicKey(publicKeyBase64);
80
+ const der = new Uint8Array(ED25519_DER_X509_PUBLIC_KEY_LENGTH);
81
+ der.set(ED25519_DER_X509_PREFIX);
82
+ der.set(raw, ED25519_DER_X509_PREFIX.length);
83
+ return bytesToBase64(der);
84
+ }
85
+ /** The Canton fingerprint of a raw 32-byte Ed25519 key: `1220` + hex(sha256(int32be(12) || rawKey)). */
86
+ function fingerprintRawEd25519PublicKey(rawPublicKey) {
87
+ if (rawPublicKey.length !== ED25519_RAW_PUBLIC_KEY_LENGTH) {
88
+ throw (0, errors_1.invalidInput)(`Invalid Ed25519 public key length: ${rawPublicKey.length}; expected raw 32 bytes`);
89
+ }
90
+ const payload = new Uint8Array(4 + ED25519_RAW_PUBLIC_KEY_LENGTH);
91
+ new DataView(payload.buffer).setInt32(0, CANTON_PUBLIC_KEY_FINGERPRINT_HASH_PURPOSE, false);
92
+ payload.set(rawPublicKey, 4);
93
+ return `${CANTON_SHA256_MULTIHASH_PREFIX_HEX}${bytesToHex((0, sha2_1.sha256)(payload))}`;
94
+ }
95
+ /** The Canton fingerprint (`1220…`, 68 lowercase hex characters) of a raw or DER Ed25519 public key in base64. */
96
+ function deriveCantonEd25519PublicKeyFingerprint(publicKeyBase64) {
97
+ return fingerprintRawEd25519PublicKey(decodeEd25519PublicKey(publicKeyBase64));
98
+ }
99
+ /** Whether `value` is a Canton SHA-256 multihash fingerprint: `1220` and 64 lowercase hex characters. */
100
+ function isCantonPublicKeyFingerprint(value) {
101
+ return typeof value === 'string' && CANTON_FINGERPRINT_PATTERN.test(value);
102
+ }
103
+ /**
104
+ * The party ID `hint::fingerprint`. The hint is trimmed; it must be non-empty, hold only Daml-LF Party characters, no
105
+ * `::` and no trailing `:`, and leave the ID within {@link MAX_EXTERNAL_PARTY_ID_LENGTH} characters. The fingerprint
106
+ * must be a lowercase SHA-256 multihash.
107
+ */
108
+ function buildExternalPartyId(partyHint, publicKeyFingerprint) {
109
+ const hint = typeof partyHint === 'string' ? partyHint.trim() : '';
110
+ if (hint === '')
111
+ throw (0, errors_1.invalidInput)('partyHint is required');
112
+ // A trailing ':' would run into the separator (`wallet:` gives `wallet:::…`, which no reader parses).
113
+ if (hint.includes('::') || hint.endsWith(':')) {
114
+ throw (0, errors_1.invalidInput)('partyHint cannot include the reserved "::" separator or end with ":"');
115
+ }
116
+ if (!isExternalPartyHint(hint)) {
117
+ throw (0, errors_1.invalidInput)('partyHint may hold only ASCII letters, digits, spaces, ":", "-" and "_"');
118
+ }
119
+ if (!isCantonPublicKeyFingerprint(publicKeyFingerprint)) {
120
+ throw (0, errors_1.invalidInput)('publicKeyFingerprint must be a Canton SHA-256 multihash (1220 and 64 lowercase hex characters)');
121
+ }
122
+ const partyId = `${hint}::${publicKeyFingerprint}`;
123
+ if (partyId.length > exports.MAX_EXTERNAL_PARTY_ID_LENGTH) {
124
+ throw (0, errors_1.invalidInput)(`partyHint is too long: the party id would exceed ${exports.MAX_EXTERNAL_PARTY_ID_LENGTH} characters`);
125
+ }
126
+ return partyId;
127
+ }
128
+ /** The parts of a `hint::namespace` party ID (exactly one `::`, both sides non-empty), or null. Not trimmed. */
129
+ function parseExternalPartyId(partyId) {
130
+ if (typeof partyId !== 'string')
131
+ return null;
132
+ const separator = partyId.indexOf('::');
133
+ if (separator <= 0 || separator !== partyId.lastIndexOf('::') || separator + 2 >= partyId.length)
134
+ return null;
135
+ return { partyHint: partyId.slice(0, separator), namespace: partyId.slice(separator + 2) };
136
+ }
137
+ /** The namespace of a `hint::namespace` party ID (for an external party, its key's fingerprint), or null. */
138
+ function readPartyNamespace(partyId) {
139
+ return parseExternalPartyId(partyId)?.namespace ?? null;
140
+ }
141
+ function assertCanonicalEd25519PublicKey(raw) {
142
+ // Compared with the sign bit cleared, so both x signs of a small-order y (00..80 is the order-4 point) are refused.
143
+ const encodedY = Uint8Array.from(raw);
144
+ encodedY[ED25519_RAW_PUBLIC_KEY_LENGTH - 1] = (encodedY[ED25519_RAW_PUBLIC_KEY_LENGTH - 1] ?? 0) & 0x7f;
145
+ if (ED25519_SMALL_ORDER_PUBLIC_KEYS_HEX.has(bytesToHex(encodedY))) {
146
+ throw (0, errors_1.invalidInput)('Invalid Ed25519 public key: a small-order point is not safe for Canton signing');
147
+ }
148
+ // The encoded y coordinate (sign bit cleared) must be below the field prime.
149
+ for (let index = ED25519_RAW_PUBLIC_KEY_LENGTH - 1; index >= 0; index -= 1) {
150
+ const byte = (raw[index] ?? 0) & (index === ED25519_RAW_PUBLIC_KEY_LENGTH - 1 ? 0x7f : 0xff);
151
+ const prime = ED25519_FIELD_PRIME_LE[index] ?? 0;
152
+ if (byte < prime)
153
+ return;
154
+ if (byte > prime)
155
+ break;
156
+ }
157
+ throw (0, errors_1.invalidInput)('Invalid Ed25519 public key: not canonically encoded');
158
+ }
159
+ function decodeBase64(value) {
160
+ const normalized = typeof value === 'string' ? value.trim().replace(/-/g, '+').replace(/_/g, '/') : '';
161
+ const unpadded = trimTrailingPadding(normalized);
162
+ // Padding is optional, but when present it must complete the last quantum (as the Node decoder requires).
163
+ if (!/^[A-Za-z0-9+/]+={0,2}$/.test(normalized) ||
164
+ unpadded.length % 4 === 1 ||
165
+ (unpadded.length !== normalized.length && normalized.length % 4 !== 0)) {
166
+ throw (0, errors_1.invalidInput)('publicKeyBase64 must be base64-encoded');
167
+ }
168
+ const padded = unpadded.padEnd(unpadded.length + ((4 - (unpadded.length % 4)) % 4), '=');
169
+ let binary;
170
+ try {
171
+ binary = atob(padded);
172
+ }
173
+ catch {
174
+ throw (0, errors_1.invalidInput)('publicKeyBase64 must be base64-encoded');
175
+ }
176
+ const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
177
+ // Refuse trailing bits that do not round-trip (a non-canonical encoding).
178
+ if (trimTrailingPadding(bytesToBase64(bytes)) !== unpadded) {
179
+ throw (0, errors_1.invalidInput)('publicKeyBase64 must be base64-encoded');
180
+ }
181
+ return bytes;
182
+ }
183
+ /** `value` without trailing `=`, in linear time (no backtracking pattern on caller input). */
184
+ function trimTrailingPadding(value) {
185
+ let end = value.length;
186
+ while (end > 0 && value[end - 1] === '=')
187
+ end -= 1;
188
+ return value.slice(0, end);
189
+ }
190
+ function bytesToBase64(bytes) {
191
+ let binary = '';
192
+ for (const byte of bytes)
193
+ binary += String.fromCharCode(byte);
194
+ return btoa(binary);
195
+ }
196
+ function bytesToHex(bytes) {
197
+ let hex = '';
198
+ for (const byte of bytes)
199
+ hex += byte.toString(16).padStart(2, '0');
200
+ return hex;
201
+ }
202
+ function hexToBytes(hex) {
203
+ const bytes = new Uint8Array(hex.length / 2);
204
+ for (let index = 0; index < bytes.length; index += 1) {
205
+ bytes[index] = parseInt(hex.slice(index * 2, index * 2 + 2), 16);
206
+ }
207
+ return bytes;
208
+ }
209
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/external-parties/keys.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,6CAA4C;AAC5C,qCAAwC;AAExC,MAAM,uBAAuB,GAAG,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAA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AK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,KAAK,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -2,6 +2,7 @@ export { Canton, type CantonConfig, type CantonHealthCheckOptions, type CantonHe
2
2
  export * from './clients';
3
3
  export * from './core';
4
4
  export * from './da-registry';
5
+ export * as ExternalParties from './external-parties';
5
6
  export * from './utils';
6
7
  export * as Wallets from './wallets';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAClB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAClB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
@@ -36,12 +36,13 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Wallets = exports.Canton = void 0;
39
+ exports.Wallets = exports.ExternalParties = exports.Canton = void 0;
40
40
  var Canton_1 = require("./Canton");
41
41
  Object.defineProperty(exports, "Canton", { enumerable: true, get: function () { return Canton_1.Canton; } });
42
42
  __exportStar(require("./clients"), exports);
43
43
  __exportStar(require("./core"), exports);
44
44
  __exportStar(require("./da-registry"), exports);
45
+ exports.ExternalParties = __importStar(require("./external-parties"));
45
46
  __exportStar(require("./utils"), exports);
46
47
  exports.Wallets = __importStar(require("./wallets"));
47
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOkB;AANhB,gGAAA,MAAM,OAAA;AAOR,4CAA0B;AAC1B,yCAAuB;AACvB,gDAA8B;AAC9B,0CAAwB;AACxB,QAAY,OAAO,sCAAkB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOkB;AANhB,gGAAA,MAAM,OAAA;AAOR,4CAA0B;AAC1B,yCAAuB;AACvB,gDAA8B;AAC9B,QAAY,eAAe,+CAA2B;AACtD,0CAAwB;AACxB,QAAY,OAAO,sCAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"canton-protocol.d.ts","sourceRoot":"","sources":["../../../../src/utils/external-signing/canton-protocol.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,oBAAoB,CAAC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