@bcts/frost-hubert 1.0.0-alpha.19 → 1.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -1
- package/dist/bin/frost.cjs +7 -2
- package/dist/bin/frost.cjs.map +1 -1
- package/dist/bin/frost.mjs +7 -2
- package/dist/bin/frost.mjs.map +1 -1
- package/dist/cmd/index.cjs +4 -4
- package/dist/cmd/index.d.cts +1 -1
- package/dist/cmd/index.d.mts +1 -1
- package/dist/cmd/index.mjs +4 -4
- package/dist/dkg/index.cjs +1 -1
- package/dist/dkg/index.mjs +1 -1
- package/dist/frost/index.cjs +4 -0
- package/dist/frost/index.cjs.map +1 -1
- package/dist/frost/index.d.cts.map +1 -1
- package/dist/frost/index.d.mts.map +1 -1
- package/dist/frost/index.mjs +4 -0
- package/dist/frost/index.mjs.map +1 -1
- package/dist/{group-invite-CgDh9dmd.cjs → group-invite-CrbOabFL.cjs} +5 -1
- package/dist/group-invite-CrbOabFL.cjs.map +1 -0
- package/dist/group-invite-Dz1Jmiky.d.cts.map +1 -1
- package/dist/{group-invite-Dx9z9mIL.mjs → group-invite-RPElq-fm.mjs} +5 -1
- package/dist/{group-invite-CgDh9dmd.cjs.map → group-invite-RPElq-fm.mjs.map} +1 -1
- package/dist/group-invite-Wk9CIbHL.d.mts.map +1 -1
- package/dist/{index-Dfa7J_Uq.d.cts → index-CcvTi5EA.d.cts} +5 -1
- package/dist/index-CcvTi5EA.d.cts.map +1 -0
- package/dist/{index-C1wKERLw.d.mts → index-DNCPeLNM.d.mts} +5 -1
- package/dist/index-DNCPeLNM.d.mts.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/registry/index.cjs +1 -1
- package/dist/registry/index.mjs +1 -1
- package/dist/{registry-l7VlItwO.mjs → registry-BDnNV1Rk.mjs} +14 -2
- package/dist/registry-BDnNV1Rk.mjs.map +1 -0
- package/dist/{registry-CmsVWFv9.cjs → registry-FMU-ec5K.cjs} +14 -2
- package/dist/registry-FMU-ec5K.cjs.map +1 -0
- package/dist/registry-impl-BETn_lEO.d.mts.map +1 -1
- package/dist/{registry-impl-jitwNQUo.cjs → registry-impl-C7w4awTv.cjs} +9 -1
- package/dist/registry-impl-C7w4awTv.cjs.map +1 -0
- package/dist/registry-impl-CE76sTXQ.d.cts.map +1 -1
- package/dist/{registry-impl-CRr0oOyI.mjs → registry-impl-eYXVSPwM.mjs} +9 -1
- package/dist/registry-impl-eYXVSPwM.mjs.map +1 -0
- package/dist/{sign-BTY-iAN6.cjs → sign-2bOp18Fs.cjs} +79 -7
- package/dist/sign-2bOp18Fs.cjs.map +1 -0
- package/dist/{sign-NQ8KssL7.mjs → sign-D8C3HJ4B.mjs} +79 -7
- package/dist/sign-D8C3HJ4B.mjs.map +1 -0
- package/package.json +17 -28
- package/src/bin/frost.ts +5 -0
- package/src/cmd/busy.ts +4 -0
- package/src/cmd/check.ts +4 -0
- package/src/cmd/common.ts +4 -0
- package/src/cmd/dkg/common.ts +4 -0
- package/src/cmd/dkg/coordinator/finalize.ts +7 -2
- package/src/cmd/dkg/coordinator/index.ts +4 -0
- package/src/cmd/dkg/coordinator/invite.ts +4 -0
- package/src/cmd/dkg/coordinator/round1.ts +4 -0
- package/src/cmd/dkg/coordinator/round2.ts +4 -0
- package/src/cmd/dkg/index.ts +4 -0
- package/src/cmd/dkg/participant/finalize.ts +4 -0
- package/src/cmd/dkg/participant/index.ts +4 -0
- package/src/cmd/dkg/participant/receive.ts +4 -0
- package/src/cmd/dkg/participant/round1.ts +4 -0
- package/src/cmd/dkg/participant/round2.ts +4 -0
- package/src/cmd/index.ts +4 -0
- package/src/cmd/parallel.ts +4 -0
- package/src/cmd/registry/index.ts +4 -0
- package/src/cmd/registry/owner/index.ts +4 -0
- package/src/cmd/registry/owner/set.ts +4 -0
- package/src/cmd/registry/participant/add.ts +4 -0
- package/src/cmd/registry/participant/index.ts +4 -0
- package/src/cmd/sign/common.ts +4 -0
- package/src/cmd/sign/coordinator/index.ts +4 -0
- package/src/cmd/sign/coordinator/invite.ts +5 -1
- package/src/cmd/sign/coordinator/round1.ts +4 -0
- package/src/cmd/sign/coordinator/round2.ts +4 -0
- package/src/cmd/sign/index.ts +4 -0
- package/src/cmd/sign/participant/finalize.ts +4 -0
- package/src/cmd/sign/participant/index.ts +4 -0
- package/src/cmd/sign/participant/receive.ts +4 -0
- package/src/cmd/sign/participant/round1.ts +4 -0
- package/src/cmd/sign/participant/round2.ts +4 -0
- package/src/cmd/storage.ts +4 -0
- package/src/dkg/group-invite.ts +4 -0
- package/src/dkg/index.ts +4 -0
- package/src/dkg/proposed-participant.ts +4 -0
- package/src/frost/index.ts +4 -0
- package/src/index.ts +4 -0
- package/src/registry/group-record.ts +4 -0
- package/src/registry/index.ts +4 -0
- package/src/registry/owner-record.ts +4 -0
- package/src/registry/participant-record.ts +4 -0
- package/src/registry/registry-impl.ts +4 -0
- package/dist/group-invite-Dx9z9mIL.mjs.map +0 -1
- package/dist/index-C1wKERLw.d.mts.map +0 -1
- package/dist/index-Dfa7J_Uq.d.cts.map +0 -1
- package/dist/registry-CmsVWFv9.cjs.map +0 -1
- package/dist/registry-impl-CRr0oOyI.mjs.map +0 -1
- package/dist/registry-impl-jitwNQUo.cjs.map +0 -1
- package/dist/registry-l7VlItwO.mjs.map +0 -1
- package/dist/sign-BTY-iAN6.cjs.map +0 -1
- package/dist/sign-NQ8KssL7.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-impl-C7w4awTv.cjs","names":["XID","ARID","SigningPublicKey","sanitizeXidUr","UR","Envelope","XIDDocument","XIDVerifySignature","UR","Envelope","XIDDocument","XIDVerifySignature","fs","path"],"sources":["../src/registry/group-record.ts","../src/registry/owner-record.ts","../src/registry/participant-record.ts","../src/registry/registry-impl.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Group record for the registry.\n *\n * Port of registry/group_record.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { ARID, SigningPublicKey, XID } from \"@bcts/components\";\n\n/**\n * A participant in a group.\n *\n * Port of `struct GroupParticipant` from group_record.rs lines 9-13.\n */\nexport class GroupParticipant {\n private readonly _xid: XID;\n\n constructor(xid: XID) {\n this._xid = xid;\n }\n\n xid(): XID {\n return this._xid;\n }\n\n toJSON(): string {\n return this._xid.urString();\n }\n\n static fromJSON(value: string): GroupParticipant {\n const xid = XID.fromURString(value);\n return new GroupParticipant(xid);\n }\n}\n\n/**\n * Contribution paths for DKG state files.\n *\n * Port of `struct ContributionPaths` from group_record.rs lines 21-29.\n */\nexport class ContributionPaths {\n round1Secret?: string | undefined;\n round1Package?: string | undefined;\n round2Secret?: string | undefined;\n keyPackage?: string | undefined;\n\n constructor(init?: Partial<ContributionPaths>) {\n if (init !== undefined) {\n this.round1Secret = init.round1Secret;\n this.round1Package = init.round1Package;\n this.round2Secret = init.round2Secret;\n this.keyPackage = init.keyPackage;\n }\n }\n\n /**\n * Merge missing fields from another ContributionPaths.\n *\n * Port of `ContributionPaths::merge_missing()` from group_record.rs lines 32-45.\n */\n mergeMissing(other: ContributionPaths): void {\n this.round1Secret ??= other.round1Secret;\n this.round1Package ??= other.round1Package;\n this.round2Secret ??= other.round2Secret;\n this.keyPackage ??= other.keyPackage;\n }\n\n /**\n * Check if all fields are empty.\n *\n * Port of `ContributionPaths::is_empty()` from group_record.rs lines 47-53.\n */\n isEmpty(): boolean {\n return (\n this.round1Secret === undefined &&\n this.round1Package === undefined &&\n this.round2Secret === undefined &&\n this.keyPackage === undefined\n );\n }\n\n toJSON(): Record<string, string> {\n const obj: Record<string, string> = {};\n if (this.round1Secret !== undefined) obj[\"round1_secret\"] = this.round1Secret;\n if (this.round1Package !== undefined) obj[\"round1_package\"] = this.round1Package;\n if (this.round2Secret !== undefined) obj[\"round2_secret\"] = this.round2Secret;\n if (this.keyPackage !== undefined) obj[\"key_package\"] = this.keyPackage;\n return obj;\n }\n\n static fromJSON(json: Record<string, string>): ContributionPaths {\n return new ContributionPaths({\n round1Secret: json[\"round1_secret\"],\n round1Package: json[\"round1_package\"],\n round2Secret: json[\"round2_secret\"],\n keyPackage: json[\"key_package\"],\n });\n }\n}\n\n/**\n * A pending request entry.\n */\ninterface PendingRequestEntry {\n participant: XID;\n sendToArid?: ARID | undefined;\n collectFromArid: ARID;\n}\n\n/**\n * Tracks pending communication with participants (coordinator-side).\n *\n * Port of `struct PendingRequests` from group_record.rs lines 71-75.\n */\nexport class PendingRequests {\n private readonly requests: PendingRequestEntry[] = [];\n\n /**\n * Add a pending request where we only know where to collect from.\n *\n * Port of `PendingRequests::add_collect_only()` from group_record.rs lines 90-99.\n */\n addCollectOnly(participant: XID, collectFromArid: ARID): void {\n this.requests.push({\n participant,\n sendToArid: undefined,\n collectFromArid,\n });\n }\n\n /**\n * Add a pending request where we know where to send AND where to collect.\n *\n * Port of `PendingRequests::add_send_and_collect()` from group_record.rs lines 103-115.\n */\n addSendAndCollect(participant: XID, sendToArid: ARID, collectFromArid: ARID): void {\n this.requests.push({\n participant,\n sendToArid,\n collectFromArid,\n });\n }\n\n /**\n * Add a pending request where we only know where to send.\n *\n * Port of `PendingRequests::add_send_only()` from group_record.rs lines 118-127.\n */\n addSendOnly(participant: XID, sendToArid: ARID): void {\n this.requests.push({\n participant,\n sendToArid,\n collectFromArid: sendToArid, // Placeholder\n });\n }\n\n /**\n * Check if there are no pending requests.\n *\n * Port of `PendingRequests::is_empty()` from group_record.rs line 129.\n */\n isEmpty(): boolean {\n return this.requests.length === 0;\n }\n\n /**\n * Get the number of pending requests.\n *\n * Port of `PendingRequests::len()` from group_record.rs line 165.\n */\n len(): number {\n return this.requests.length;\n }\n\n /**\n * Iterate over (participant, collectFromArid) pairs.\n *\n * Port of `PendingRequests::iter_collect()` from group_record.rs lines 132-138.\n */\n *iterCollect(): Generator<[XID, ARID]> {\n for (const r of this.requests) {\n yield [r.participant, r.collectFromArid];\n }\n }\n\n /**\n * Iterate over (participant, sendToArid) pairs.\n *\n * Port of `PendingRequests::iter_send()` from group_record.rs lines 141-150.\n */\n *iterSend(): Generator<[XID, ARID]> {\n for (const r of this.requests) {\n if (r.sendToArid === undefined) {\n throw new Error(\"send_to_arid not set for this request\");\n }\n yield [r.participant, r.sendToArid];\n }\n }\n\n /**\n * Iterate over full (participant, sendToArid, collectFromArid) tuples.\n *\n * Port of `PendingRequests::iter_full()` from group_record.rs lines 153-163.\n */\n *iterFull(): Generator<[XID, ARID | undefined, ARID]> {\n for (const r of this.requests) {\n yield [r.participant, r.sendToArid, r.collectFromArid];\n }\n }\n\n toJSON(): unknown[] {\n return this.requests.map((r) => ({\n participant: r.participant.urString(),\n send_to_arid: r.sendToArid?.urString(),\n collect_from_arid: r.collectFromArid.urString(),\n }));\n }\n\n static fromJSON(json: unknown[]): PendingRequests {\n const pr = new PendingRequests();\n for (const entry of json as Record<string, string>[]) {\n const participant = XID.fromURString(entry[\"participant\"]);\n const sendToArid =\n entry[\"send_to_arid\"] !== undefined && entry[\"send_to_arid\"] !== \"\"\n ? ARID.fromURString(entry[\"send_to_arid\"])\n : undefined;\n const collectFromArid = ARID.fromURString(entry[\"collect_from_arid\"]);\n pr.requests.push({ participant, sendToArid, collectFromArid });\n }\n return pr;\n }\n}\n\n/**\n * Record of a DKG group.\n *\n * Port of `struct GroupRecord` from group_record.rs lines 168-186.\n */\nexport class GroupRecord {\n private readonly _charter: string;\n private readonly _minSigners: number;\n private readonly _coordinator: GroupParticipant;\n private readonly _participants: GroupParticipant[];\n private _contributions: ContributionPaths;\n private _listeningAtArid?: ARID | undefined;\n private _pendingRequests: PendingRequests;\n private _verifyingKey?: SigningPublicKey | undefined;\n\n constructor(\n charter: string,\n minSigners: number,\n coordinator: GroupParticipant,\n participants: GroupParticipant[],\n ) {\n this._charter = charter;\n this._minSigners = minSigners;\n this._coordinator = coordinator;\n this._participants = participants;\n this._contributions = new ContributionPaths();\n this._listeningAtArid = undefined;\n this._pendingRequests = new PendingRequests();\n this._verifyingKey = undefined;\n }\n\n coordinator(): GroupParticipant {\n return this._coordinator;\n }\n\n participants(): GroupParticipant[] {\n return this._participants;\n }\n\n minSigners(): number {\n return this._minSigners;\n }\n\n charter(): string {\n return this._charter;\n }\n\n contributions(): ContributionPaths {\n return this._contributions;\n }\n\n setContributions(contributions: ContributionPaths): void {\n this._contributions = contributions;\n }\n\n mergeContributions(other: ContributionPaths): void {\n this._contributions.mergeMissing(other);\n }\n\n listeningAtArid(): ARID | undefined {\n return this._listeningAtArid;\n }\n\n setListeningAtArid(arid: ARID): void {\n this._listeningAtArid = arid;\n }\n\n clearListeningAtArid(): void {\n this._listeningAtArid = undefined;\n }\n\n pendingRequests(): PendingRequests {\n return this._pendingRequests;\n }\n\n setPendingRequests(requests: PendingRequests): void {\n this._pendingRequests = requests;\n }\n\n clearPendingRequests(): void {\n this._pendingRequests = new PendingRequests();\n }\n\n /**\n * Check if the config matches another group record.\n *\n * Port of `GroupRecord::config_matches()` from group_record.rs lines 247-253.\n */\n configMatches(other: GroupRecord): boolean {\n return (\n this._charter === other._charter &&\n this._minSigners === other._minSigners &&\n this._coordinator.xid().toString() === other._coordinator.xid().toString() &&\n this._participants.length === other._participants.length &&\n this._participants.every(\n (p, i) => p.xid().toString() === other._participants[i].xid().toString(),\n )\n );\n }\n\n verifyingKey(): SigningPublicKey | undefined {\n return this._verifyingKey;\n }\n\n setVerifyingKey(key: SigningPublicKey): void {\n this._verifyingKey = key;\n }\n\n toJSON(): Record<string, unknown> {\n const obj: Record<string, unknown> = {\n charter: this._charter,\n min_signers: this._minSigners,\n coordinator: this._coordinator.toJSON(),\n participants: this._participants.map((p) => p.toJSON()),\n };\n if (!this._contributions.isEmpty()) {\n obj[\"contributions\"] = this._contributions.toJSON();\n }\n if (this._listeningAtArid !== undefined) {\n obj[\"listening_at_arid\"] = this._listeningAtArid.urString();\n }\n if (!this._pendingRequests.isEmpty()) {\n obj[\"pending_requests\"] = this._pendingRequests.toJSON();\n }\n if (this._verifyingKey !== undefined) {\n obj[\"verifying_key\"] = this._verifyingKey.urString();\n }\n return obj;\n }\n\n static fromJSON(json: Record<string, unknown>): GroupRecord {\n const charter = json[\"charter\"] as string;\n const minSigners = json[\"min_signers\"] as number;\n const coordinator = GroupParticipant.fromJSON(json[\"coordinator\"] as string);\n const participants = (json[\"participants\"] as string[]).map((p) =>\n GroupParticipant.fromJSON(p),\n );\n\n const record = new GroupRecord(charter, minSigners, coordinator, participants);\n\n if (json[\"contributions\"] !== undefined) {\n record._contributions = ContributionPaths.fromJSON(\n json[\"contributions\"] as Record<string, string>,\n );\n }\n if (json[\"listening_at_arid\"] !== undefined) {\n record._listeningAtArid = ARID.fromURString(json[\"listening_at_arid\"] as string);\n }\n if (json[\"pending_requests\"] !== undefined) {\n record._pendingRequests = PendingRequests.fromJSON(json[\"pending_requests\"] as unknown[]);\n }\n if (json[\"verifying_key\"] !== undefined) {\n record._verifyingKey = SigningPublicKey.fromURString(json[\"verifying_key\"] as string);\n }\n\n return record;\n }\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Owner record for the registry.\n *\n * Port of registry/owner_record.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type XID } from \"@bcts/components\";\nimport { type Cbor } from \"@bcts/dcbor\";\nimport { Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { XIDDocument, XIDVerifySignature } from \"@bcts/xid\";\n\n/**\n * Record of the registry owner (coordinator).\n *\n * Port of `struct OwnerRecord` from owner_record.rs lines 13-17.\n */\nexport class OwnerRecord {\n private readonly _xidDocumentUr: string;\n private readonly _xidDocument: XIDDocument;\n private readonly _petName: string | undefined;\n\n private constructor(\n xidDocumentUr: string,\n xidDocument: XIDDocument,\n petName: string | undefined,\n ) {\n this._xidDocumentUr = xidDocumentUr;\n this._xidDocument = xidDocument;\n this._petName = petName;\n }\n\n /**\n * Create an owner record from a signed XID UR string.\n *\n * Port of `OwnerRecord::from_signed_xid_ur()` from owner_record.rs lines 20-32.\n */\n static fromSignedXidUr(xidDocumentUr: string, petName?: string): OwnerRecord {\n const [raw, document] = parseRelaxedXidDocument(xidDocumentUr);\n\n if (document.inceptionPrivateKeys() === undefined) {\n throw new Error(\"Owner XID document must include private keys\");\n }\n\n return new OwnerRecord(raw, document, petName);\n }\n\n /**\n * Get the XID of the owner.\n *\n * Port of `OwnerRecord::xid()` from owner_record.rs line 34.\n */\n xid(): XID {\n return this._xidDocument.xid();\n }\n\n /**\n * Get the XID document of the owner.\n *\n * Port of `OwnerRecord::xid_document()` from owner_record.rs line 36.\n */\n xidDocument(): XIDDocument {\n return this._xidDocument;\n }\n\n /**\n * Get the UR string of the XID document.\n *\n * Port of `OwnerRecord::xid_document_ur()` from owner_record.rs line 38.\n */\n xidDocumentUr(): string {\n return this._xidDocumentUr;\n }\n\n /**\n * Get the pet name of the owner.\n *\n * Port of `OwnerRecord::pet_name()` from owner_record.rs line 40.\n */\n petName(): string | undefined {\n return this._petName;\n }\n\n /**\n * Serialize to JSON object.\n */\n toJSON(): Record<string, unknown> {\n const obj: Record<string, unknown> = {\n xid_document: this._xidDocumentUr,\n };\n if (this._petName !== undefined) {\n obj[\"pet_name\"] = this._petName;\n }\n return obj;\n }\n\n /**\n * Deserialize from JSON object.\n */\n static fromJSON(json: Record<string, unknown>): OwnerRecord {\n const xidDocumentUr = json[\"xid_document\"] as string;\n const petName = json[\"pet_name\"] as string | undefined;\n return OwnerRecord.fromSignedXidUr(xidDocumentUr, petName);\n }\n}\n\n/**\n * Parse a XID document with relaxed validation (no signature verification).\n *\n * Port of `parse_relaxed_xid_document()` from owner_record.rs lines 144-165.\n */\nfunction parseRelaxedXidDocument(xidDocumentUr: string): [string, XIDDocument] {\n const sanitized = sanitizeXidUr(xidDocumentUr);\n const ur = UR.fromURString(sanitized);\n\n if (ur.urTypeStr() !== \"xid\" && ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected a ur:xid document, found ur:${ur.urTypeStr()}`);\n }\n\n const envelopeCbor = ur.cbor() as unknown as Cbor;\n let envelope: Envelope;\n try {\n envelope = Envelope.fromTaggedCbor(envelopeCbor);\n } catch {\n envelope = Envelope.fromUntaggedCbor(envelopeCbor);\n }\n\n const document = XIDDocument.fromEnvelope(envelope, undefined, XIDVerifySignature.None);\n\n return [sanitized, document];\n}\n\n/**\n * Sanitize XID UR input.\n *\n * Port of `sanitize_xid_ur()` from owner_record.rs lines 167-174.\n */\nfunction sanitizeXidUr(input: string): string {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"XID document is required\");\n }\n return trimmed;\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Participant record for the registry.\n *\n * Port of registry/participant_record.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type PublicKeys, type XID } from \"@bcts/components\";\nimport { type Cbor } from \"@bcts/dcbor\";\nimport { Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { XIDDocument, XIDVerifySignature } from \"@bcts/xid\";\n\n/**\n * Record of a participant in the registry.\n *\n * Port of `struct ParticipantRecord` from participant_record.rs lines 12-17.\n */\nexport class ParticipantRecord {\n private readonly _xidDocumentUr: string;\n private readonly _xidDocument: XIDDocument;\n private readonly _publicKeys: PublicKeys;\n private readonly _petName: string | undefined;\n\n private constructor(\n xidDocumentUr: string,\n xidDocument: XIDDocument,\n publicKeys: PublicKeys,\n petName: string | undefined,\n ) {\n this._xidDocumentUr = xidDocumentUr;\n this._xidDocument = xidDocument;\n this._publicKeys = publicKeys;\n this._petName = petName;\n }\n\n /**\n * Create a participant record from a signed XID UR string.\n *\n * Port of `ParticipantRecord::from_signed_xid_ur()` from participant_record.rs lines 20-26.\n */\n static fromSignedXidUr(xidDocumentUr: string, petName?: string): ParticipantRecord {\n const [raw, document] = parseSignedXidDocument(xidDocumentUr);\n return ParticipantRecord.buildFromParts(document, raw, petName);\n }\n\n /**\n * Get the pet name of the participant.\n *\n * Port of `ParticipantRecord::pet_name()` from participant_record.rs line 28.\n */\n petName(): string | undefined {\n return this._petName;\n }\n\n /**\n * Get the public keys of the participant.\n *\n * Port of `ParticipantRecord::public_keys()` from participant_record.rs line 29.\n */\n publicKeys(): PublicKeys {\n return this._publicKeys;\n }\n\n /**\n * Get the XID of the participant.\n *\n * Port of `ParticipantRecord::xid()` from participant_record.rs line 30.\n */\n xid(): XID {\n return this._xidDocument.xid();\n }\n\n /**\n * Get the XID document of the participant.\n *\n * Port of `ParticipantRecord::xid_document()` from participant_record.rs line 31.\n */\n xidDocument(): XIDDocument {\n return this._xidDocument;\n }\n\n /**\n * Get the UR string of the XID document.\n *\n * Port of `ParticipantRecord::xid_document_ur()` from participant_record.rs line 32.\n */\n xidDocumentUr(): string {\n return this._xidDocumentUr;\n }\n\n /**\n * Build from constituent parts.\n *\n * Port of `ParticipantRecord::build_from_parts()` from participant_record.rs lines 34-49.\n */\n private static buildFromParts(\n document: XIDDocument,\n xidDocumentUr: string,\n petName: string | undefined,\n ): ParticipantRecord {\n const inceptionKey = document.inceptionKey();\n if (inceptionKey === undefined) {\n throw new Error(\"XID document missing inception key\");\n }\n\n const publicKeys = inceptionKey.publicKeys();\n\n return new ParticipantRecord(xidDocumentUr, document, publicKeys, petName);\n }\n\n /**\n * Recreate from serialized data.\n *\n * Port of `ParticipantRecord::recreate_from_serialized()` from participant_record.rs lines 51-57.\n */\n private static recreateFromSerialized(\n xidDocumentUr: string,\n petName: string | undefined,\n ): ParticipantRecord {\n const [raw, document] = parseSignedXidDocument(xidDocumentUr);\n return ParticipantRecord.buildFromParts(document, raw, petName);\n }\n\n /**\n * Serialize to JSON object.\n */\n toJSON(): Record<string, unknown> {\n const obj: Record<string, unknown> = {\n xid_document: this._xidDocumentUr,\n };\n if (this._petName !== undefined) {\n obj[\"pet_name\"] = this._petName;\n }\n return obj;\n }\n\n /**\n * Deserialize from JSON object.\n */\n static fromJSON(json: Record<string, unknown>): ParticipantRecord {\n const xidDocumentUr = json[\"xid_document\"] as string;\n const petName = json[\"pet_name\"] as string | undefined;\n return ParticipantRecord.recreateFromSerialized(xidDocumentUr, petName);\n }\n}\n\n/**\n * Parse a signed XID document from a UR string.\n *\n * Port of `parse_signed_xid_document()` from participant_record.rs lines 170-194.\n */\nfunction parseSignedXidDocument(xidDocumentUr: string): [string, XIDDocument] {\n const sanitized = sanitizeXidUr(xidDocumentUr);\n const ur = UR.fromURString(sanitized);\n\n if (ur.urTypeStr() !== \"xid\" && ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected a ur:xid document, found ur:${ur.urTypeStr()}`);\n }\n\n const envelopeCbor = ur.cbor() as unknown as Cbor;\n let envelope: Envelope;\n try {\n envelope = Envelope.fromTaggedCbor(envelopeCbor);\n } catch {\n envelope = Envelope.fromUntaggedCbor(envelopeCbor);\n }\n\n const document = XIDDocument.fromEnvelope(envelope, undefined, XIDVerifySignature.Inception);\n\n return [sanitized, document];\n}\n\n/**\n * Sanitize XID UR input.\n *\n * Port of `sanitize_xid_ur()` from participant_record.rs lines 196-203.\n */\nfunction sanitizeXidUr(input: string): string {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"XID document is required\");\n }\n return trimmed;\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Registry implementation for managing participants and groups.\n *\n * Port of registry/registry_impl.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { type ARID, type XID } from \"@bcts/components\";\n\nimport { GroupRecord } from \"./group-record.js\";\nimport { OwnerRecord } from \"./owner-record.js\";\nimport { ParticipantRecord } from \"./participant-record.js\";\n\n/**\n * Outcome of adding a participant to the registry.\n *\n * Port of `enum AddOutcome` from registry_impl.rs.\n */\nexport enum AddOutcome {\n /** Participant was already present in the registry */\n AlreadyPresent = \"already_present\",\n /** Participant was successfully inserted */\n Inserted = \"inserted\",\n}\n\n/**\n * Outcome of setting the owner in the registry.\n *\n * Port of `enum OwnerOutcome` from registry_impl.rs.\n */\nexport enum OwnerOutcome {\n /** Owner was already present in the registry */\n AlreadyPresent = \"already_present\",\n /** Owner was successfully inserted */\n Inserted = \"inserted\",\n}\n\n/**\n * Outcome of recording a group in the registry.\n *\n * Port of `enum GroupOutcome` from registry_impl.rs.\n */\nexport enum GroupOutcome {\n /** Group was successfully inserted as new */\n Inserted = \"inserted\",\n /** Group already existed and was updated (contributions merged) */\n Updated = \"updated\",\n}\n\n/**\n * Registry for managing participants and groups.\n *\n * Port of `struct Registry` from registry_impl.rs lines 22-26.\n */\nexport class Registry {\n private _owner?: OwnerRecord | undefined;\n private readonly _participants: Map<string, ParticipantRecord>; // Map by XID UR string\n private readonly _groups: Map<string, GroupRecord>; // Map by ARID hex\n\n constructor() {\n this._owner = undefined;\n this._participants = new Map();\n this._groups = new Map();\n }\n\n /**\n * Get the owner record.\n */\n owner(): OwnerRecord | undefined {\n return this._owner;\n }\n\n /**\n * Set the owner record.\n *\n * Returns the outcome indicating whether the owner was already present or newly inserted.\n *\n * Port of `Registry::set_owner()` from registry_impl.rs.\n */\n setOwner(owner: OwnerRecord): OwnerOutcome {\n // Check for pet name conflicts with participants\n const petName = owner.petName();\n if (petName !== undefined) {\n const conflicting = this.participantByPetName(petName);\n if (conflicting?.[1].petName() === petName) {\n throw new Error(`Pet name '${petName}' already used by a participant`);\n }\n }\n\n if (this._owner === undefined) {\n this._owner = owner;\n return OwnerOutcome.Inserted;\n }\n\n const existing = this._owner;\n const existingXidUr = existing.xid().urString();\n const ownerXidUr = owner.xid().urString();\n\n if (\n existingXidUr === ownerXidUr &&\n existing.xidDocumentUr() === owner.xidDocumentUr() &&\n existing.petName() === owner.petName()\n ) {\n return OwnerOutcome.AlreadyPresent;\n }\n\n if (existingXidUr === ownerXidUr) {\n if (existing.xidDocumentUr() !== owner.xidDocumentUr()) {\n throw new Error(\"Owner already exists with different keys\");\n }\n this._owner = owner;\n return OwnerOutcome.Inserted;\n }\n\n throw new Error(`Owner already recorded for ${existing.xid().toString()}`);\n }\n\n /**\n * Get all participants.\n */\n participants(): Map<string, ParticipantRecord> {\n return this._participants;\n }\n\n /**\n * Get a participant by XID.\n */\n participant(xid: XID): ParticipantRecord | undefined {\n return this._participants.get(xid.urString());\n }\n\n /**\n * Add a participant.\n *\n * Returns the outcome indicating whether the participant was already present or newly inserted.\n */\n addParticipant(xid: XID, record: ParticipantRecord): AddOutcome {\n const xidUr = xid.urString();\n\n // Check if already present\n if (this._participants.has(xidUr)) {\n return AddOutcome.AlreadyPresent;\n }\n\n // Check for conflicting pet name\n const petName = record.petName();\n if (petName !== undefined && this.petNameExists(petName)) {\n throw new Error(`Pet name \"${petName}\" is already used by another participant`);\n }\n\n this._participants.set(xidUr, record);\n return AddOutcome.Inserted;\n }\n\n /**\n * Check if a pet name is already used.\n */\n petNameExists(petName: string): boolean {\n for (const record of this._participants.values()) {\n if (record.petName() === petName) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Find a participant by pet name.\n *\n * Port of `Registry::participant_by_pet_name()` from registry_impl.rs.\n */\n participantByPetName(petName: string): [XID, ParticipantRecord] | undefined {\n for (const record of this._participants.values()) {\n if (record.petName() === petName) {\n return [record.xid(), record];\n }\n }\n return undefined;\n }\n\n /**\n * Get all groups.\n */\n groups(): Map<string, GroupRecord> {\n return this._groups;\n }\n\n /**\n * Get a group by ARID.\n */\n group(arid: ARID): GroupRecord | undefined {\n return this._groups.get(arid.hex());\n }\n\n /**\n * Get a mutable reference to a group by ARID.\n */\n groupMut(arid: ARID): GroupRecord | undefined {\n return this._groups.get(arid.hex());\n }\n\n /**\n * Record a group in the registry.\n *\n * If the group already exists:\n * - Validates that the config matches\n * - Merges contributions from the new record\n * - Updates verifying key if not already set\n *\n * Port of `Registry::record_group()` from registry_impl.rs.\n */\n recordGroup(groupId: ARID, record: GroupRecord): GroupOutcome {\n const key = groupId.hex();\n const existing = this._groups.get(key);\n\n if (existing !== undefined) {\n // Validate config matches\n if (!existing.configMatches(record)) {\n throw new Error(`Group ${groupId.hex()} already exists with a different configuration`);\n }\n\n // Merge contributions\n existing.mergeContributions(record.contributions());\n\n // Update verifying key if not already set\n const existingKey = existing.verifyingKey();\n const recordKey = record.verifyingKey();\n if (existingKey === undefined && recordKey !== undefined) {\n existing.setVerifyingKey(recordKey);\n } else if (\n existingKey !== undefined &&\n recordKey !== undefined &&\n existingKey.urString() !== recordKey.urString()\n ) {\n throw new Error(`Group ${groupId.hex()} already exists with a different verifying key`);\n }\n\n return GroupOutcome.Updated;\n }\n\n this._groups.set(key, record);\n return GroupOutcome.Inserted;\n }\n\n /**\n * Add a group (simple variant without merge logic).\n *\n * @deprecated Use recordGroup() for proper merge behavior.\n */\n addGroup(arid: ARID, record: GroupRecord): void {\n this._groups.set(arid.hex(), record);\n }\n\n /**\n * Load a registry from a file.\n */\n static load(filePath: string): Registry {\n if (!fs.existsSync(filePath)) {\n return new Registry();\n }\n\n const content = fs.readFileSync(filePath, \"utf-8\");\n const json = JSON.parse(content) as Record<string, unknown>;\n return Registry.fromJSON(json);\n }\n\n /**\n * Save the registry to a file.\n */\n save(filePath: string): void {\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n const json = this.toJSON();\n fs.writeFileSync(filePath, JSON.stringify(json, null, 2));\n }\n\n /**\n * Serialize to JSON object.\n */\n toJSON(): Record<string, unknown> {\n const participants: Record<string, unknown> = {};\n for (const [xidUr, record] of this._participants) {\n participants[xidUr] = record.toJSON();\n }\n\n const groups: Record<string, unknown> = {};\n for (const [aridHex, record] of this._groups) {\n groups[aridHex] = record.toJSON();\n }\n\n const obj: Record<string, unknown> = {\n groups,\n participants,\n };\n\n if (this._owner !== undefined) {\n obj[\"owner\"] = this._owner.toJSON();\n }\n\n return obj;\n }\n\n /**\n * Deserialize from JSON object.\n */\n static fromJSON(json: Record<string, unknown>): Registry {\n const registry = new Registry();\n\n if (json[\"owner\"] !== undefined) {\n registry._owner = OwnerRecord.fromJSON(json[\"owner\"] as Record<string, unknown>);\n }\n\n const participantsJson = json[\"participants\"] as\n | Record<string, Record<string, unknown>>\n | undefined;\n if (participantsJson !== undefined) {\n for (const [, recordJson] of Object.entries(participantsJson)) {\n const record = ParticipantRecord.fromJSON(recordJson);\n registry._participants.set(record.xid().urString(), record);\n }\n }\n\n const groupsJson = json[\"groups\"] as Record<string, Record<string, unknown>> | undefined;\n if (groupsJson !== undefined) {\n for (const [aridHex, recordJson] of Object.entries(groupsJson)) {\n const record = GroupRecord.fromJSON(recordJson);\n registry._groups.set(aridHex, record);\n }\n }\n\n return registry;\n }\n}\n\n/**\n * Resolve the registry file path from a given argument.\n *\n * Port of `resolve_registry_path()` from registry/mod.rs lines 49-78.\n */\nexport function resolveRegistryPath(registryArg: string | undefined, cwd: string): string {\n if (registryArg === undefined || registryArg === \"\") {\n return path.join(cwd, \"registry.json\");\n }\n\n // If it ends with / or is a directory, append registry.json\n if (registryArg.endsWith(\"/\") || registryArg.endsWith(path.sep)) {\n return path.join(cwd, registryArg, \"registry.json\");\n }\n\n // If it's just a filename, put it in cwd\n if (!registryArg.includes(\"/\") && !registryArg.includes(path.sep)) {\n return path.join(cwd, registryArg);\n }\n\n // Otherwise, treat as relative path\n return path.resolve(cwd, registryArg);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,IAAa,mBAAb,MAAa,iBAAiB;CAC5B,AAAiB;CAEjB,YAAY,KAAU;AACpB,OAAK,OAAO;;CAGd,MAAW;AACT,SAAO,KAAK;;CAGd,SA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AmB,KAAK;AAG9B,MAAI,qBAAqB,OACvB,MAAK,MAAM,GAAG,eAAe,OAAO,QAAQ,iBAAiB,EAAE;GAC7D,MAAM,SAAS,kBAAkB,SAAS,WAAW;AACrD,YAAS,cAAc,IAAI,OAAO,KAAK,CAAC,UAAU,EAAE,OAAO;;EAI/D,MAAM,aAAa,KAAK;AACxB,MAAI,eAAe,OACjB,MAAK,MAAM,CAAC,SAAS,eAAe,OAAO,QAAQ,WAAW,EAAE;GAC9D,MAAM,SAAS,YAAY,SAAS,WAAW;AAC/C,YAAS,QAAQ,IAAI,SAAS,OAAO;;AAIzC,SAAO;;;;;;;;AASX,SAAgB,oBAAoB,aAAiC,KAAqB;AACxF,KAAI,gBAAgB,UAAa,gBAAgB,GAC/C,QAAOC,UAAK,KAAK,KAAK,gBAAgB;AAIxC,KAAI,YAAY,SAAS,IAAI,IAAI,YAAY,SAASA,UAAK,IAAI,CAC7D,QAAOA,UAAK,KAAK,KAAK,aAAa,gBAAgB;AAIrD,KAAI,CAAC,YAAY,SAAS,IAAI,IAAI,CAAC,YAAY,SAASA,UAAK,IAAI,CAC/D,QAAOA,UAAK,KAAK,KAAK,YAAY;AAIpC,QAAOA,UAAK,QAAQ,KAAK,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-impl-CE76sTXQ.d.cts","names":[],"sources":["../src/registry/group-record.ts","../src/registry/owner-record.ts","../src/registry/participant-record.ts","../src/registry/registry-impl.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"registry-impl-CE76sTXQ.d.cts","names":[],"sources":["../src/registry/group-record.ts","../src/registry/owner-record.ts","../src/registry/participant-record.ts","../src/registry/registry-impl.ts"],"mappings":";;;;;;;;;cAmBa,gBAAA;EAAA,iBACM,IAAA;cAEL,GAAA,EAAK,GAAA;EAIjB,GAAA,CAAA,GAAO,GAAA;EAIP,MAAA,CAAA;EAAA,OAIO,QAAA,CAAS,KAAA,WAAgB,gBAAA;AA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AA,EAAM,MAAA,EAAQ,WAAA,GAAc,YAAA;EHwBtC;;;;;EGcX,QAAA,CAAS,IAAA,EAAM,IAAA,EAAM,MAAA,EAAQ,WAAA;EHgBb;;;EAAA,OGTT,IAAA,CAAK,QAAA,WAAmB,QAAA;EHiCZ;;;EGpBnB,IAAA,CAAK,QAAA;EHiDgB;;;EGpCrB,MAAA,CAAA,GAAU,MAAA;EH8EY;;;EAAA,OGpDf,QAAA,CAAS,IAAA,EAAM,MAAA,oBAA0B,QAAA;AAAA;;;;;;iBAkClC,mBAAA,CAAoB,WAAA,sBAAiC,GAAA"}
|
|
@@ -7,6 +7,10 @@ import * as path from "node:path";
|
|
|
7
7
|
|
|
8
8
|
//#region src/registry/group-record.ts
|
|
9
9
|
/**
|
|
10
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
11
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
12
|
+
*
|
|
13
|
+
*
|
|
10
14
|
* Group record for the registry.
|
|
11
15
|
*
|
|
12
16
|
* Port of registry/group_record.rs from frost-hubert-rust.
|
|
@@ -540,6 +544,10 @@ function sanitizeXidUr(input) {
|
|
|
540
544
|
//#endregion
|
|
541
545
|
//#region src/registry/registry-impl.ts
|
|
542
546
|
/**
|
|
547
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
548
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
549
|
+
*
|
|
550
|
+
*
|
|
543
551
|
* Registry implementation for managing participants and groups.
|
|
544
552
|
*
|
|
545
553
|
* Port of registry/registry_impl.rs from frost-hubert-rust.
|
|
@@ -786,4 +794,4 @@ function resolveRegistryPath(registryArg, cwd) {
|
|
|
786
794
|
|
|
787
795
|
//#endregion
|
|
788
796
|
export { resolveRegistryPath as a, ContributionPaths as c, PendingRequests as d, Registry as i, GroupParticipant as l, GroupOutcome as n, ParticipantRecord as o, OwnerOutcome as r, OwnerRecord as s, AddOutcome as t, GroupRecord as u };
|
|
789
|
-
//# sourceMappingURL=registry-impl-
|
|
797
|
+
//# sourceMappingURL=registry-impl-eYXVSPwM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-impl-eYXVSPwM.mjs","names":["sanitizeXidUr"],"sources":["../src/registry/group-record.ts","../src/registry/owner-record.ts","../src/registry/participant-record.ts","../src/registry/registry-impl.ts"],"sourcesContent":["/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Group record for the registry.\n *\n * Port of registry/group_record.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { ARID, SigningPublicKey, XID } from \"@bcts/components\";\n\n/**\n * A participant in a group.\n *\n * Port of `struct GroupParticipant` from group_record.rs lines 9-13.\n */\nexport class GroupParticipant {\n private readonly _xid: XID;\n\n constructor(xid: XID) {\n this._xid = xid;\n }\n\n xid(): XID {\n return this._xid;\n }\n\n toJSON(): string {\n return this._xid.urString();\n }\n\n static fromJSON(value: string): GroupParticipant {\n const xid = XID.fromURString(value);\n return new GroupParticipant(xid);\n }\n}\n\n/**\n * Contribution paths for DKG state files.\n *\n * Port of `struct ContributionPaths` from group_record.rs lines 21-29.\n */\nexport class ContributionPaths {\n round1Secret?: string | undefined;\n round1Package?: string | undefined;\n round2Secret?: string | undefined;\n keyPackage?: string | undefined;\n\n constructor(init?: Partial<ContributionPaths>) {\n if (init !== undefined) {\n this.round1Secret = init.round1Secret;\n this.round1Package = init.round1Package;\n this.round2Secret = init.round2Secret;\n this.keyPackage = init.keyPackage;\n }\n }\n\n /**\n * Merge missing fields from another ContributionPaths.\n *\n * Port of `ContributionPaths::merge_missing()` from group_record.rs lines 32-45.\n */\n mergeMissing(other: ContributionPaths): void {\n this.round1Secret ??= other.round1Secret;\n this.round1Package ??= other.round1Package;\n this.round2Secret ??= other.round2Secret;\n this.keyPackage ??= other.keyPackage;\n }\n\n /**\n * Check if all fields are empty.\n *\n * Port of `ContributionPaths::is_empty()` from group_record.rs lines 47-53.\n */\n isEmpty(): boolean {\n return (\n this.round1Secret === undefined &&\n this.round1Package === undefined &&\n this.round2Secret === undefined &&\n this.keyPackage === undefined\n );\n }\n\n toJSON(): Record<string, string> {\n const obj: Record<string, string> = {};\n if (this.round1Secret !== undefined) obj[\"round1_secret\"] = this.round1Secret;\n if (this.round1Package !== undefined) obj[\"round1_package\"] = this.round1Package;\n if (this.round2Secret !== undefined) obj[\"round2_secret\"] = this.round2Secret;\n if (this.keyPackage !== undefined) obj[\"key_package\"] = this.keyPackage;\n return obj;\n }\n\n static fromJSON(json: Record<string, string>): ContributionPaths {\n return new ContributionPaths({\n round1Secret: json[\"round1_secret\"],\n round1Package: json[\"round1_package\"],\n round2Secret: json[\"round2_secret\"],\n keyPackage: json[\"key_package\"],\n });\n }\n}\n\n/**\n * A pending request entry.\n */\ninterface PendingRequestEntry {\n participant: XID;\n sendToArid?: ARID | undefined;\n collectFromArid: ARID;\n}\n\n/**\n * Tracks pending communication with participants (coordinator-side).\n *\n * Port of `struct PendingRequests` from group_record.rs lines 71-75.\n */\nexport class PendingRequests {\n private readonly requests: PendingRequestEntry[] = [];\n\n /**\n * Add a pending request where we only know where to collect from.\n *\n * Port of `PendingRequests::add_collect_only()` from group_record.rs lines 90-99.\n */\n addCollectOnly(participant: XID, collectFromArid: ARID): void {\n this.requests.push({\n participant,\n sendToArid: undefined,\n collectFromArid,\n });\n }\n\n /**\n * Add a pending request where we know where to send AND where to collect.\n *\n * Port of `PendingRequests::add_send_and_collect()` from group_record.rs lines 103-115.\n */\n addSendAndCollect(participant: XID, sendToArid: ARID, collectFromArid: ARID): void {\n this.requests.push({\n participant,\n sendToArid,\n collectFromArid,\n });\n }\n\n /**\n * Add a pending request where we only know where to send.\n *\n * Port of `PendingRequests::add_send_only()` from group_record.rs lines 118-127.\n */\n addSendOnly(participant: XID, sendToArid: ARID): void {\n this.requests.push({\n participant,\n sendToArid,\n collectFromArid: sendToArid, // Placeholder\n });\n }\n\n /**\n * Check if there are no pending requests.\n *\n * Port of `PendingRequests::is_empty()` from group_record.rs line 129.\n */\n isEmpty(): boolean {\n return this.requests.length === 0;\n }\n\n /**\n * Get the number of pending requests.\n *\n * Port of `PendingRequests::len()` from group_record.rs line 165.\n */\n len(): number {\n return this.requests.length;\n }\n\n /**\n * Iterate over (participant, collectFromArid) pairs.\n *\n * Port of `PendingRequests::iter_collect()` from group_record.rs lines 132-138.\n */\n *iterCollect(): Generator<[XID, ARID]> {\n for (const r of this.requests) {\n yield [r.participant, r.collectFromArid];\n }\n }\n\n /**\n * Iterate over (participant, sendToArid) pairs.\n *\n * Port of `PendingRequests::iter_send()` from group_record.rs lines 141-150.\n */\n *iterSend(): Generator<[XID, ARID]> {\n for (const r of this.requests) {\n if (r.sendToArid === undefined) {\n throw new Error(\"send_to_arid not set for this request\");\n }\n yield [r.participant, r.sendToArid];\n }\n }\n\n /**\n * Iterate over full (participant, sendToArid, collectFromArid) tuples.\n *\n * Port of `PendingRequests::iter_full()` from group_record.rs lines 153-163.\n */\n *iterFull(): Generator<[XID, ARID | undefined, ARID]> {\n for (const r of this.requests) {\n yield [r.participant, r.sendToArid, r.collectFromArid];\n }\n }\n\n toJSON(): unknown[] {\n return this.requests.map((r) => ({\n participant: r.participant.urString(),\n send_to_arid: r.sendToArid?.urString(),\n collect_from_arid: r.collectFromArid.urString(),\n }));\n }\n\n static fromJSON(json: unknown[]): PendingRequests {\n const pr = new PendingRequests();\n for (const entry of json as Record<string, string>[]) {\n const participant = XID.fromURString(entry[\"participant\"]);\n const sendToArid =\n entry[\"send_to_arid\"] !== undefined && entry[\"send_to_arid\"] !== \"\"\n ? ARID.fromURString(entry[\"send_to_arid\"])\n : undefined;\n const collectFromArid = ARID.fromURString(entry[\"collect_from_arid\"]);\n pr.requests.push({ participant, sendToArid, collectFromArid });\n }\n return pr;\n }\n}\n\n/**\n * Record of a DKG group.\n *\n * Port of `struct GroupRecord` from group_record.rs lines 168-186.\n */\nexport class GroupRecord {\n private readonly _charter: string;\n private readonly _minSigners: number;\n private readonly _coordinator: GroupParticipant;\n private readonly _participants: GroupParticipant[];\n private _contributions: ContributionPaths;\n private _listeningAtArid?: ARID | undefined;\n private _pendingRequests: PendingRequests;\n private _verifyingKey?: SigningPublicKey | undefined;\n\n constructor(\n charter: string,\n minSigners: number,\n coordinator: GroupParticipant,\n participants: GroupParticipant[],\n ) {\n this._charter = charter;\n this._minSigners = minSigners;\n this._coordinator = coordinator;\n this._participants = participants;\n this._contributions = new ContributionPaths();\n this._listeningAtArid = undefined;\n this._pendingRequests = new PendingRequests();\n this._verifyingKey = undefined;\n }\n\n coordinator(): GroupParticipant {\n return this._coordinator;\n }\n\n participants(): GroupParticipant[] {\n return this._participants;\n }\n\n minSigners(): number {\n return this._minSigners;\n }\n\n charter(): string {\n return this._charter;\n }\n\n contributions(): ContributionPaths {\n return this._contributions;\n }\n\n setContributions(contributions: ContributionPaths): void {\n this._contributions = contributions;\n }\n\n mergeContributions(other: ContributionPaths): void {\n this._contributions.mergeMissing(other);\n }\n\n listeningAtArid(): ARID | undefined {\n return this._listeningAtArid;\n }\n\n setListeningAtArid(arid: ARID): void {\n this._listeningAtArid = arid;\n }\n\n clearListeningAtArid(): void {\n this._listeningAtArid = undefined;\n }\n\n pendingRequests(): PendingRequests {\n return this._pendingRequests;\n }\n\n setPendingRequests(requests: PendingRequests): void {\n this._pendingRequests = requests;\n }\n\n clearPendingRequests(): void {\n this._pendingRequests = new PendingRequests();\n }\n\n /**\n * Check if the config matches another group record.\n *\n * Port of `GroupRecord::config_matches()` from group_record.rs lines 247-253.\n */\n configMatches(other: GroupRecord): boolean {\n return (\n this._charter === other._charter &&\n this._minSigners === other._minSigners &&\n this._coordinator.xid().toString() === other._coordinator.xid().toString() &&\n this._participants.length === other._participants.length &&\n this._participants.every(\n (p, i) => p.xid().toString() === other._participants[i].xid().toString(),\n )\n );\n }\n\n verifyingKey(): SigningPublicKey | undefined {\n return this._verifyingKey;\n }\n\n setVerifyingKey(key: SigningPublicKey): void {\n this._verifyingKey = key;\n }\n\n toJSON(): Record<string, unknown> {\n const obj: Record<string, unknown> = {\n charter: this._charter,\n min_signers: this._minSigners,\n coordinator: this._coordinator.toJSON(),\n participants: this._participants.map((p) => p.toJSON()),\n };\n if (!this._contributions.isEmpty()) {\n obj[\"contributions\"] = this._contributions.toJSON();\n }\n if (this._listeningAtArid !== undefined) {\n obj[\"listening_at_arid\"] = this._listeningAtArid.urString();\n }\n if (!this._pendingRequests.isEmpty()) {\n obj[\"pending_requests\"] = this._pendingRequests.toJSON();\n }\n if (this._verifyingKey !== undefined) {\n obj[\"verifying_key\"] = this._verifyingKey.urString();\n }\n return obj;\n }\n\n static fromJSON(json: Record<string, unknown>): GroupRecord {\n const charter = json[\"charter\"] as string;\n const minSigners = json[\"min_signers\"] as number;\n const coordinator = GroupParticipant.fromJSON(json[\"coordinator\"] as string);\n const participants = (json[\"participants\"] as string[]).map((p) =>\n GroupParticipant.fromJSON(p),\n );\n\n const record = new GroupRecord(charter, minSigners, coordinator, participants);\n\n if (json[\"contributions\"] !== undefined) {\n record._contributions = ContributionPaths.fromJSON(\n json[\"contributions\"] as Record<string, string>,\n );\n }\n if (json[\"listening_at_arid\"] !== undefined) {\n record._listeningAtArid = ARID.fromURString(json[\"listening_at_arid\"] as string);\n }\n if (json[\"pending_requests\"] !== undefined) {\n record._pendingRequests = PendingRequests.fromJSON(json[\"pending_requests\"] as unknown[]);\n }\n if (json[\"verifying_key\"] !== undefined) {\n record._verifyingKey = SigningPublicKey.fromURString(json[\"verifying_key\"] as string);\n }\n\n return record;\n }\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Owner record for the registry.\n *\n * Port of registry/owner_record.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type XID } from \"@bcts/components\";\nimport { type Cbor } from \"@bcts/dcbor\";\nimport { Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { XIDDocument, XIDVerifySignature } from \"@bcts/xid\";\n\n/**\n * Record of the registry owner (coordinator).\n *\n * Port of `struct OwnerRecord` from owner_record.rs lines 13-17.\n */\nexport class OwnerRecord {\n private readonly _xidDocumentUr: string;\n private readonly _xidDocument: XIDDocument;\n private readonly _petName: string | undefined;\n\n private constructor(\n xidDocumentUr: string,\n xidDocument: XIDDocument,\n petName: string | undefined,\n ) {\n this._xidDocumentUr = xidDocumentUr;\n this._xidDocument = xidDocument;\n this._petName = petName;\n }\n\n /**\n * Create an owner record from a signed XID UR string.\n *\n * Port of `OwnerRecord::from_signed_xid_ur()` from owner_record.rs lines 20-32.\n */\n static fromSignedXidUr(xidDocumentUr: string, petName?: string): OwnerRecord {\n const [raw, document] = parseRelaxedXidDocument(xidDocumentUr);\n\n if (document.inceptionPrivateKeys() === undefined) {\n throw new Error(\"Owner XID document must include private keys\");\n }\n\n return new OwnerRecord(raw, document, petName);\n }\n\n /**\n * Get the XID of the owner.\n *\n * Port of `OwnerRecord::xid()` from owner_record.rs line 34.\n */\n xid(): XID {\n return this._xidDocument.xid();\n }\n\n /**\n * Get the XID document of the owner.\n *\n * Port of `OwnerRecord::xid_document()` from owner_record.rs line 36.\n */\n xidDocument(): XIDDocument {\n return this._xidDocument;\n }\n\n /**\n * Get the UR string of the XID document.\n *\n * Port of `OwnerRecord::xid_document_ur()` from owner_record.rs line 38.\n */\n xidDocumentUr(): string {\n return this._xidDocumentUr;\n }\n\n /**\n * Get the pet name of the owner.\n *\n * Port of `OwnerRecord::pet_name()` from owner_record.rs line 40.\n */\n petName(): string | undefined {\n return this._petName;\n }\n\n /**\n * Serialize to JSON object.\n */\n toJSON(): Record<string, unknown> {\n const obj: Record<string, unknown> = {\n xid_document: this._xidDocumentUr,\n };\n if (this._petName !== undefined) {\n obj[\"pet_name\"] = this._petName;\n }\n return obj;\n }\n\n /**\n * Deserialize from JSON object.\n */\n static fromJSON(json: Record<string, unknown>): OwnerRecord {\n const xidDocumentUr = json[\"xid_document\"] as string;\n const petName = json[\"pet_name\"] as string | undefined;\n return OwnerRecord.fromSignedXidUr(xidDocumentUr, petName);\n }\n}\n\n/**\n * Parse a XID document with relaxed validation (no signature verification).\n *\n * Port of `parse_relaxed_xid_document()` from owner_record.rs lines 144-165.\n */\nfunction parseRelaxedXidDocument(xidDocumentUr: string): [string, XIDDocument] {\n const sanitized = sanitizeXidUr(xidDocumentUr);\n const ur = UR.fromURString(sanitized);\n\n if (ur.urTypeStr() !== \"xid\" && ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected a ur:xid document, found ur:${ur.urTypeStr()}`);\n }\n\n const envelopeCbor = ur.cbor() as unknown as Cbor;\n let envelope: Envelope;\n try {\n envelope = Envelope.fromTaggedCbor(envelopeCbor);\n } catch {\n envelope = Envelope.fromUntaggedCbor(envelopeCbor);\n }\n\n const document = XIDDocument.fromEnvelope(envelope, undefined, XIDVerifySignature.None);\n\n return [sanitized, document];\n}\n\n/**\n * Sanitize XID UR input.\n *\n * Port of `sanitize_xid_ur()` from owner_record.rs lines 167-174.\n */\nfunction sanitizeXidUr(input: string): string {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"XID document is required\");\n }\n return trimmed;\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Participant record for the registry.\n *\n * Port of registry/participant_record.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport { type PublicKeys, type XID } from \"@bcts/components\";\nimport { type Cbor } from \"@bcts/dcbor\";\nimport { Envelope } from \"@bcts/envelope\";\nimport { UR } from \"@bcts/uniform-resources\";\nimport { XIDDocument, XIDVerifySignature } from \"@bcts/xid\";\n\n/**\n * Record of a participant in the registry.\n *\n * Port of `struct ParticipantRecord` from participant_record.rs lines 12-17.\n */\nexport class ParticipantRecord {\n private readonly _xidDocumentUr: string;\n private readonly _xidDocument: XIDDocument;\n private readonly _publicKeys: PublicKeys;\n private readonly _petName: string | undefined;\n\n private constructor(\n xidDocumentUr: string,\n xidDocument: XIDDocument,\n publicKeys: PublicKeys,\n petName: string | undefined,\n ) {\n this._xidDocumentUr = xidDocumentUr;\n this._xidDocument = xidDocument;\n this._publicKeys = publicKeys;\n this._petName = petName;\n }\n\n /**\n * Create a participant record from a signed XID UR string.\n *\n * Port of `ParticipantRecord::from_signed_xid_ur()` from participant_record.rs lines 20-26.\n */\n static fromSignedXidUr(xidDocumentUr: string, petName?: string): ParticipantRecord {\n const [raw, document] = parseSignedXidDocument(xidDocumentUr);\n return ParticipantRecord.buildFromParts(document, raw, petName);\n }\n\n /**\n * Get the pet name of the participant.\n *\n * Port of `ParticipantRecord::pet_name()` from participant_record.rs line 28.\n */\n petName(): string | undefined {\n return this._petName;\n }\n\n /**\n * Get the public keys of the participant.\n *\n * Port of `ParticipantRecord::public_keys()` from participant_record.rs line 29.\n */\n publicKeys(): PublicKeys {\n return this._publicKeys;\n }\n\n /**\n * Get the XID of the participant.\n *\n * Port of `ParticipantRecord::xid()` from participant_record.rs line 30.\n */\n xid(): XID {\n return this._xidDocument.xid();\n }\n\n /**\n * Get the XID document of the participant.\n *\n * Port of `ParticipantRecord::xid_document()` from participant_record.rs line 31.\n */\n xidDocument(): XIDDocument {\n return this._xidDocument;\n }\n\n /**\n * Get the UR string of the XID document.\n *\n * Port of `ParticipantRecord::xid_document_ur()` from participant_record.rs line 32.\n */\n xidDocumentUr(): string {\n return this._xidDocumentUr;\n }\n\n /**\n * Build from constituent parts.\n *\n * Port of `ParticipantRecord::build_from_parts()` from participant_record.rs lines 34-49.\n */\n private static buildFromParts(\n document: XIDDocument,\n xidDocumentUr: string,\n petName: string | undefined,\n ): ParticipantRecord {\n const inceptionKey = document.inceptionKey();\n if (inceptionKey === undefined) {\n throw new Error(\"XID document missing inception key\");\n }\n\n const publicKeys = inceptionKey.publicKeys();\n\n return new ParticipantRecord(xidDocumentUr, document, publicKeys, petName);\n }\n\n /**\n * Recreate from serialized data.\n *\n * Port of `ParticipantRecord::recreate_from_serialized()` from participant_record.rs lines 51-57.\n */\n private static recreateFromSerialized(\n xidDocumentUr: string,\n petName: string | undefined,\n ): ParticipantRecord {\n const [raw, document] = parseSignedXidDocument(xidDocumentUr);\n return ParticipantRecord.buildFromParts(document, raw, petName);\n }\n\n /**\n * Serialize to JSON object.\n */\n toJSON(): Record<string, unknown> {\n const obj: Record<string, unknown> = {\n xid_document: this._xidDocumentUr,\n };\n if (this._petName !== undefined) {\n obj[\"pet_name\"] = this._petName;\n }\n return obj;\n }\n\n /**\n * Deserialize from JSON object.\n */\n static fromJSON(json: Record<string, unknown>): ParticipantRecord {\n const xidDocumentUr = json[\"xid_document\"] as string;\n const petName = json[\"pet_name\"] as string | undefined;\n return ParticipantRecord.recreateFromSerialized(xidDocumentUr, petName);\n }\n}\n\n/**\n * Parse a signed XID document from a UR string.\n *\n * Port of `parse_signed_xid_document()` from participant_record.rs lines 170-194.\n */\nfunction parseSignedXidDocument(xidDocumentUr: string): [string, XIDDocument] {\n const sanitized = sanitizeXidUr(xidDocumentUr);\n const ur = UR.fromURString(sanitized);\n\n if (ur.urTypeStr() !== \"xid\" && ur.urTypeStr() !== \"envelope\") {\n throw new Error(`Expected a ur:xid document, found ur:${ur.urTypeStr()}`);\n }\n\n const envelopeCbor = ur.cbor() as unknown as Cbor;\n let envelope: Envelope;\n try {\n envelope = Envelope.fromTaggedCbor(envelopeCbor);\n } catch {\n envelope = Envelope.fromUntaggedCbor(envelopeCbor);\n }\n\n const document = XIDDocument.fromEnvelope(envelope, undefined, XIDVerifySignature.Inception);\n\n return [sanitized, document];\n}\n\n/**\n * Sanitize XID UR input.\n *\n * Port of `sanitize_xid_ur()` from participant_record.rs lines 196-203.\n */\nfunction sanitizeXidUr(input: string): string {\n const trimmed = input.trim();\n if (trimmed.length === 0) {\n throw new Error(\"XID document is required\");\n }\n return trimmed;\n}\n","/**\n * Copyright © 2023-2026 Blockchain Commons, LLC\n * Copyright © 2025-2026 Parity Technologies\n *\n *\n * Registry implementation for managing participants and groups.\n *\n * Port of registry/registry_impl.rs from frost-hubert-rust.\n *\n * @module\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { type ARID, type XID } from \"@bcts/components\";\n\nimport { GroupRecord } from \"./group-record.js\";\nimport { OwnerRecord } from \"./owner-record.js\";\nimport { ParticipantRecord } from \"./participant-record.js\";\n\n/**\n * Outcome of adding a participant to the registry.\n *\n * Port of `enum AddOutcome` from registry_impl.rs.\n */\nexport enum AddOutcome {\n /** Participant was already present in the registry */\n AlreadyPresent = \"already_present\",\n /** Participant was successfully inserted */\n Inserted = \"inserted\",\n}\n\n/**\n * Outcome of setting the owner in the registry.\n *\n * Port of `enum OwnerOutcome` from registry_impl.rs.\n */\nexport enum OwnerOutcome {\n /** Owner was already present in the registry */\n AlreadyPresent = \"already_present\",\n /** Owner was successfully inserted */\n Inserted = \"inserted\",\n}\n\n/**\n * Outcome of recording a group in the registry.\n *\n * Port of `enum GroupOutcome` from registry_impl.rs.\n */\nexport enum GroupOutcome {\n /** Group was successfully inserted as new */\n Inserted = \"inserted\",\n /** Group already existed and was updated (contributions merged) */\n Updated = \"updated\",\n}\n\n/**\n * Registry for managing participants and groups.\n *\n * Port of `struct Registry` from registry_impl.rs lines 22-26.\n */\nexport class Registry {\n private _owner?: OwnerRecord | undefined;\n private readonly _participants: Map<string, ParticipantRecord>; // Map by XID UR string\n private readonly _groups: Map<string, GroupRecord>; // Map by ARID hex\n\n constructor() {\n this._owner = undefined;\n this._participants = new Map();\n this._groups = new Map();\n }\n\n /**\n * Get the owner record.\n */\n owner(): OwnerRecord | undefined {\n return this._owner;\n }\n\n /**\n * Set the owner record.\n *\n * Returns the outcome indicating whether the owner was already present or newly inserted.\n *\n * Port of `Registry::set_owner()` from registry_impl.rs.\n */\n setOwner(owner: OwnerRecord): OwnerOutcome {\n // Check for pet name conflicts with participants\n const petName = owner.petName();\n if (petName !== undefined) {\n const conflicting = this.participantByPetName(petName);\n if (conflicting?.[1].petName() === petName) {\n throw new Error(`Pet name '${petName}' already used by a participant`);\n }\n }\n\n if (this._owner === undefined) {\n this._owner = owner;\n return OwnerOutcome.Inserted;\n }\n\n const existing = this._owner;\n const existingXidUr = existing.xid().urString();\n const ownerXidUr = owner.xid().urString();\n\n if (\n existingXidUr === ownerXidUr &&\n existing.xidDocumentUr() === owner.xidDocumentUr() &&\n existing.petName() === owner.petName()\n ) {\n return OwnerOutcome.AlreadyPresent;\n }\n\n if (existingXidUr === ownerXidUr) {\n if (existing.xidDocumentUr() !== owner.xidDocumentUr()) {\n throw new Error(\"Owner already exists with different keys\");\n }\n this._owner = owner;\n return OwnerOutcome.Inserted;\n }\n\n throw new Error(`Owner already recorded for ${existing.xid().toString()}`);\n }\n\n /**\n * Get all participants.\n */\n participants(): Map<string, ParticipantRecord> {\n return this._participants;\n }\n\n /**\n * Get a participant by XID.\n */\n participant(xid: XID): ParticipantRecord | undefined {\n return this._participants.get(xid.urString());\n }\n\n /**\n * Add a participant.\n *\n * Returns the outcome indicating whether the participant was already present or newly inserted.\n */\n addParticipant(xid: XID, record: ParticipantRecord): AddOutcome {\n const xidUr = xid.urString();\n\n // Check if already present\n if (this._participants.has(xidUr)) {\n return AddOutcome.AlreadyPresent;\n }\n\n // Check for conflicting pet name\n const petName = record.petName();\n if (petName !== undefined && this.petNameExists(petName)) {\n throw new Error(`Pet name \"${petName}\" is already used by another participant`);\n }\n\n this._participants.set(xidUr, record);\n return AddOutcome.Inserted;\n }\n\n /**\n * Check if a pet name is already used.\n */\n petNameExists(petName: string): boolean {\n for (const record of this._participants.values()) {\n if (record.petName() === petName) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Find a participant by pet name.\n *\n * Port of `Registry::participant_by_pet_name()` from registry_impl.rs.\n */\n participantByPetName(petName: string): [XID, ParticipantRecord] | undefined {\n for (const record of this._participants.values()) {\n if (record.petName() === petName) {\n return [record.xid(), record];\n }\n }\n return undefined;\n }\n\n /**\n * Get all groups.\n */\n groups(): Map<string, GroupRecord> {\n return this._groups;\n }\n\n /**\n * Get a group by ARID.\n */\n group(arid: ARID): GroupRecord | undefined {\n return this._groups.get(arid.hex());\n }\n\n /**\n * Get a mutable reference to a group by ARID.\n */\n groupMut(arid: ARID): GroupRecord | undefined {\n return this._groups.get(arid.hex());\n }\n\n /**\n * Record a group in the registry.\n *\n * If the group already exists:\n * - Validates that the config matches\n * - Merges contributions from the new record\n * - Updates verifying key if not already set\n *\n * Port of `Registry::record_group()` from registry_impl.rs.\n */\n recordGroup(groupId: ARID, record: GroupRecord): GroupOutcome {\n const key = groupId.hex();\n const existing = this._groups.get(key);\n\n if (existing !== undefined) {\n // Validate config matches\n if (!existing.configMatches(record)) {\n throw new Error(`Group ${groupId.hex()} already exists with a different configuration`);\n }\n\n // Merge contributions\n existing.mergeContributions(record.contributions());\n\n // Update verifying key if not already set\n const existingKey = existing.verifyingKey();\n const recordKey = record.verifyingKey();\n if (existingKey === undefined && recordKey !== undefined) {\n existing.setVerifyingKey(recordKey);\n } else if (\n existingKey !== undefined &&\n recordKey !== undefined &&\n existingKey.urString() !== recordKey.urString()\n ) {\n throw new Error(`Group ${groupId.hex()} already exists with a different verifying key`);\n }\n\n return GroupOutcome.Updated;\n }\n\n this._groups.set(key, record);\n return GroupOutcome.Inserted;\n }\n\n /**\n * Add a group (simple variant without merge logic).\n *\n * @deprecated Use recordGroup() for proper merge behavior.\n */\n addGroup(arid: ARID, record: GroupRecord): void {\n this._groups.set(arid.hex(), record);\n }\n\n /**\n * Load a registry from a file.\n */\n static load(filePath: string): Registry {\n if (!fs.existsSync(filePath)) {\n return new Registry();\n }\n\n const content = fs.readFileSync(filePath, \"utf-8\");\n const json = JSON.parse(content) as Record<string, unknown>;\n return Registry.fromJSON(json);\n }\n\n /**\n * Save the registry to a file.\n */\n save(filePath: string): void {\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n const json = this.toJSON();\n fs.writeFileSync(filePath, JSON.stringify(json, null, 2));\n }\n\n /**\n * Serialize to JSON object.\n */\n toJSON(): Record<string, unknown> {\n const participants: Record<string, unknown> = {};\n for (const [xidUr, record] of this._participants) {\n participants[xidUr] = record.toJSON();\n }\n\n const groups: Record<string, unknown> = {};\n for (const [aridHex, record] of this._groups) {\n groups[aridHex] = record.toJSON();\n }\n\n const obj: Record<string, unknown> = {\n groups,\n participants,\n };\n\n if (this._owner !== undefined) {\n obj[\"owner\"] = this._owner.toJSON();\n }\n\n return obj;\n }\n\n /**\n * Deserialize from JSON object.\n */\n static fromJSON(json: Record<string, unknown>): Registry {\n const registry = new Registry();\n\n if (json[\"owner\"] !== undefined) {\n registry._owner = OwnerRecord.fromJSON(json[\"owner\"] as Record<string, unknown>);\n }\n\n const participantsJson = json[\"participants\"] as\n | Record<string, Record<string, unknown>>\n | undefined;\n if (participantsJson !== undefined) {\n for (const [, recordJson] of Object.entries(participantsJson)) {\n const record = ParticipantRecord.fromJSON(recordJson);\n registry._participants.set(record.xid().urString(), record);\n }\n }\n\n const groupsJson = json[\"groups\"] as Record<string, Record<string, unknown>> | undefined;\n if (groupsJson !== undefined) {\n for (const [aridHex, recordJson] of Object.entries(groupsJson)) {\n const record = GroupRecord.fromJSON(recordJson);\n registry._groups.set(aridHex, record);\n }\n }\n\n return registry;\n }\n}\n\n/**\n * Resolve the registry file path from a given argument.\n *\n * Port of `resolve_registry_path()` from registry/mod.rs lines 49-78.\n */\nexport function resolveRegistryPath(registryArg: string | undefined, cwd: string): string {\n if (registryArg === undefined || registryArg === \"\") {\n return path.join(cwd, \"registry.json\");\n }\n\n // If it ends with / or is a directory, append registry.json\n if (registryArg.endsWith(\"/\") || registryArg.endsWith(path.sep)) {\n return path.join(cwd, registryArg, \"registry.json\");\n }\n\n // If it's just a filename, put it in cwd\n if (!registryArg.includes(\"/\") && !registryArg.includes(path.sep)) {\n return path.join(cwd, registryArg);\n }\n\n // Otherwise, treat as relative path\n return path.resolve(cwd, registryArg);\n}\n"],"mappings":";;;;;;;;;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M,WAAW,IAAI,UAAU;AAE/B,MAAI,KAAK,aAAa,OACpB,UAAS,SAAS,YAAY,SAAS,KAAK,SAAoC;EAGlF,MAAM,mBAAmB,KAAK;AAG9B,MAAI,qBAAqB,OACvB,MAAK,MAAM,GAAG,eAAe,OAAO,QAAQ,iBAAiB,EAAE;GAC7D,MAAM,SAAS,kBAAkB,SAAS,WAAW;AACrD,YAAS,cAAc,IAAI,OAAO,KAAK,CAAC,UAAU,EAAE,OAAO;;EAI/D,MAAM,aAAa,KAAK;AACxB,MAAI,eAAe,OACjB,MAAK,MAAM,CAAC,SAAS,eAAe,OAAO,QAAQ,WAAW,EAAE;GAC9D,MAAM,SAAS,YAAY,SAAS,WAAW;AAC/C,YAAS,QAAQ,IAAI,SAAS,OAAO;;AAIzC,SAAO;;;;;;;;AASX,SAAgB,oBAAoB,aAAiC,KAAqB;AACxF,KAAI,gBAAgB,UAAa,gBAAgB,GAC/C,QAAO,KAAK,KAAK,KAAK,gBAAgB;AAIxC,KAAI,YAAY,SAAS,IAAI,IAAI,YAAY,SAAS,KAAK,IAAI,CAC7D,QAAO,KAAK,KAAK,KAAK,aAAa,gBAAgB;AAIrD,KAAI,CAAC,YAAY,SAAS,IAAI,IAAI,CAAC,YAAY,SAAS,KAAK,IAAI,CAC/D,QAAO,KAAK,KAAK,KAAK,YAAY;AAIpC,QAAO,KAAK,QAAQ,KAAK,YAAY"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-uaV2rQ02.cjs');
|
|
2
|
-
const require_group_invite = require('./group-invite-
|
|
3
|
-
const require_registry_impl = require('./registry-impl-
|
|
2
|
+
const require_group_invite = require('./group-invite-CrbOabFL.cjs');
|
|
3
|
+
const require_registry_impl = require('./registry-impl-C7w4awTv.cjs');
|
|
4
4
|
const require_frost_index = require('./frost/index.cjs');
|
|
5
5
|
let _bcts_components = require("@bcts/components");
|
|
6
6
|
let _bcts_dcbor = require("@bcts/dcbor");
|
|
@@ -17,6 +17,10 @@ let _frosts_core = require("@frosts/core");
|
|
|
17
17
|
|
|
18
18
|
//#region src/cmd/common.ts
|
|
19
19
|
/**
|
|
20
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
21
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
22
|
+
*
|
|
23
|
+
*
|
|
20
24
|
* Common utilities for commands.
|
|
21
25
|
*
|
|
22
26
|
* Port of cmd/common.rs from frost-hubert-rust.
|
|
@@ -395,6 +399,10 @@ async function checkAridExists(client, arid) {
|
|
|
395
399
|
//#endregion
|
|
396
400
|
//#region src/cmd/dkg/common.ts
|
|
397
401
|
/**
|
|
402
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
403
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
404
|
+
*
|
|
405
|
+
*
|
|
398
406
|
* Common utilities for DKG commands.
|
|
399
407
|
*
|
|
400
408
|
* Port of cmd/dkg/common.rs from frost-hubert-rust.
|
|
@@ -547,6 +555,10 @@ function signingKeyFromVerifying(verifyingKeyBytes) {
|
|
|
547
555
|
//#endregion
|
|
548
556
|
//#region src/cmd/dkg/coordinator/invite.ts
|
|
549
557
|
/**
|
|
558
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
559
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
560
|
+
*
|
|
561
|
+
*
|
|
550
562
|
* DKG coordinator invite command.
|
|
551
563
|
*
|
|
552
564
|
* Port of cmd/dkg/coordinator/invite.rs from frost-hubert-rust.
|
|
@@ -628,6 +640,10 @@ async function invite$1(client, options, cwd) {
|
|
|
628
640
|
//#endregion
|
|
629
641
|
//#region src/cmd/dkg/coordinator/round1.ts
|
|
630
642
|
/**
|
|
643
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
644
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
645
|
+
*
|
|
646
|
+
*
|
|
631
647
|
* DKG coordinator round 1 command.
|
|
632
648
|
*
|
|
633
649
|
* Port of cmd/dkg/coordinator/round1.rs from frost-hubert-rust.
|
|
@@ -1061,6 +1077,10 @@ async function round1$4(client, options, cwd) {
|
|
|
1061
1077
|
//#endregion
|
|
1062
1078
|
//#region src/cmd/dkg/coordinator/round2.ts
|
|
1063
1079
|
/**
|
|
1080
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
1081
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
1082
|
+
*
|
|
1083
|
+
*
|
|
1064
1084
|
* DKG coordinator round 2 command.
|
|
1065
1085
|
*
|
|
1066
1086
|
* Port of cmd/dkg/coordinator/round2.rs from frost-hubert-rust.
|
|
@@ -1486,6 +1506,10 @@ async function round2$4(client, options, cwd) {
|
|
|
1486
1506
|
//#endregion
|
|
1487
1507
|
//#region src/cmd/dkg/coordinator/finalize.ts
|
|
1488
1508
|
/**
|
|
1509
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
1510
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
1511
|
+
*
|
|
1512
|
+
*
|
|
1489
1513
|
* DKG coordinator finalize command.
|
|
1490
1514
|
*
|
|
1491
1515
|
* Port of cmd/dkg/coordinator/finalize.rs from frost-hubert-rust.
|
|
@@ -1626,7 +1650,7 @@ function finalizeFinalizeCollectionResults(collection, registryPath, registry, g
|
|
|
1626
1650
|
try {
|
|
1627
1651
|
signingKey = signingKeyFromVerifying(hexToBytes(pubKeyPkg.verifying_key));
|
|
1628
1652
|
} catch (err) {
|
|
1629
|
-
throw new Error(`Failed to extract verifying key for ${xid.urString()}: ${err instanceof Error ? err.message : String(err)}
|
|
1653
|
+
throw new Error(`Failed to extract verifying key for ${xid.urString()}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
1630
1654
|
}
|
|
1631
1655
|
if (groupVerifyingKey !== void 0) {
|
|
1632
1656
|
if (groupVerifyingKey.urString() !== signingKey.urString()) throw new Error(`Group verifying key mismatch for participant ${xid.urString()}`);
|
|
@@ -1682,9 +1706,9 @@ async function finalize$2(client, options, cwd) {
|
|
|
1682
1706
|
const coordinatorKeys = owner.xidDocument().inceptionPrivateKeys();
|
|
1683
1707
|
if (coordinatorKeys === void 0) throw new Error("Coordinator XID document has no private keys");
|
|
1684
1708
|
let verifyingKey;
|
|
1685
|
-
let collected
|
|
1709
|
+
let collected;
|
|
1686
1710
|
let rejected = 0;
|
|
1687
|
-
let errors
|
|
1711
|
+
let errors;
|
|
1688
1712
|
let timeouts = 0;
|
|
1689
1713
|
if (options.parallel === true) {
|
|
1690
1714
|
const collection = await collectFinalizeParallel(client, registry, pendingRequests, coordinatorKeys, groupId, options.timeoutSeconds);
|
|
@@ -1776,6 +1800,10 @@ var coordinator_exports$1 = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
1776
1800
|
//#endregion
|
|
1777
1801
|
//#region src/cmd/dkg/participant/receive.ts
|
|
1778
1802
|
/**
|
|
1803
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
1804
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
1805
|
+
*
|
|
1806
|
+
*
|
|
1779
1807
|
* DKG participant receive command.
|
|
1780
1808
|
*
|
|
1781
1809
|
* Port of cmd/dkg/participant/receive.rs from frost-hubert-rust.
|
|
@@ -1940,6 +1968,10 @@ async function receive$1(_client, options, cwd) {
|
|
|
1940
1968
|
//#endregion
|
|
1941
1969
|
//#region src/cmd/dkg/participant/round1.ts
|
|
1942
1970
|
/**
|
|
1971
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
1972
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
1973
|
+
*
|
|
1974
|
+
*
|
|
1943
1975
|
* DKG participant round 1 command.
|
|
1944
1976
|
*
|
|
1945
1977
|
* Port of cmd/dkg/participant/round1.rs from frost-hubert-rust.
|
|
@@ -2136,6 +2168,10 @@ function resolveSenderXidDocument(registry, raw) {
|
|
|
2136
2168
|
//#endregion
|
|
2137
2169
|
//#region src/cmd/dkg/participant/round2.ts
|
|
2138
2170
|
/**
|
|
2171
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
2172
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
2173
|
+
*
|
|
2174
|
+
*
|
|
2139
2175
|
* DKG participant round 2 command.
|
|
2140
2176
|
*
|
|
2141
2177
|
* Port of cmd/dkg/participant/round2.rs from frost-hubert-rust.
|
|
@@ -2370,6 +2406,10 @@ async function round2$3(_client, options, cwd) {
|
|
|
2370
2406
|
//#endregion
|
|
2371
2407
|
//#region src/cmd/dkg/participant/finalize.ts
|
|
2372
2408
|
/**
|
|
2409
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
2410
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
2411
|
+
*
|
|
2412
|
+
*
|
|
2373
2413
|
* DKG participant finalize command.
|
|
2374
2414
|
*
|
|
2375
2415
|
* Port of cmd/dkg/participant/finalize.rs from frost-hubert-rust.
|
|
@@ -2626,6 +2666,10 @@ var dkg_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
2626
2666
|
//#endregion
|
|
2627
2667
|
//#region src/cmd/sign/common.ts
|
|
2628
2668
|
/**
|
|
2669
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
2670
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
2671
|
+
*
|
|
2672
|
+
*
|
|
2629
2673
|
* Common utilities for sign commands.
|
|
2630
2674
|
*
|
|
2631
2675
|
* Port of cmd/sign/common.rs from frost-hubert-rust.
|
|
@@ -2714,6 +2758,10 @@ var SignFinalizeContent = class SignFinalizeContent {
|
|
|
2714
2758
|
//#endregion
|
|
2715
2759
|
//#region src/cmd/sign/coordinator/invite.ts
|
|
2716
2760
|
/**
|
|
2761
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
2762
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
2763
|
+
*
|
|
2764
|
+
*
|
|
2717
2765
|
* Sign coordinator invite command.
|
|
2718
2766
|
*
|
|
2719
2767
|
* Port of cmd/sign/coordinator/invite.rs from frost-hubert-rust.
|
|
@@ -2840,7 +2888,7 @@ function loadEnvelopeFromPath(filePath) {
|
|
|
2840
2888
|
try {
|
|
2841
2889
|
return _bcts_envelope.Envelope.fromURString(trimmed);
|
|
2842
2890
|
} catch (e) {
|
|
2843
|
-
throw new Error(`Failed to load target envelope from ${filePath}: ${String(e)}
|
|
2891
|
+
throw new Error(`Failed to load target envelope from ${filePath}: ${String(e)}`, { cause: e });
|
|
2844
2892
|
}
|
|
2845
2893
|
}
|
|
2846
2894
|
/**
|
|
@@ -2906,6 +2954,10 @@ async function invite(client, options, cwd) {
|
|
|
2906
2954
|
//#endregion
|
|
2907
2955
|
//#region src/cmd/sign/coordinator/round1.ts
|
|
2908
2956
|
/**
|
|
2957
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
2958
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
2959
|
+
*
|
|
2960
|
+
*
|
|
2909
2961
|
* Sign coordinator round 1 command.
|
|
2910
2962
|
*
|
|
2911
2963
|
* Port of cmd/sign/coordinator/round1.rs from frost-hubert-rust.
|
|
@@ -3255,6 +3307,10 @@ async function round1$1(client, options, cwd) {
|
|
|
3255
3307
|
//#endregion
|
|
3256
3308
|
//#region src/cmd/sign/coordinator/round2.ts
|
|
3257
3309
|
/**
|
|
3310
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
3311
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
3312
|
+
*
|
|
3313
|
+
*
|
|
3258
3314
|
* Sign coordinator round 2 command.
|
|
3259
3315
|
*
|
|
3260
3316
|
* Port of cmd/sign/coordinator/round2.rs from frost-hubert-rust.
|
|
@@ -3654,6 +3710,10 @@ var coordinator_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
3654
3710
|
//#endregion
|
|
3655
3711
|
//#region src/cmd/sign/participant/receive.ts
|
|
3656
3712
|
/**
|
|
3713
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
3714
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
3715
|
+
*
|
|
3716
|
+
*
|
|
3657
3717
|
* Sign participant receive command.
|
|
3658
3718
|
*
|
|
3659
3719
|
* Port of cmd/sign/participant/receive.rs from frost-hubert-rust.
|
|
@@ -3815,6 +3875,10 @@ async function receive(client, selection, options, cwd) {
|
|
|
3815
3875
|
//#endregion
|
|
3816
3876
|
//#region src/cmd/sign/participant/round1.ts
|
|
3817
3877
|
/**
|
|
3878
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
3879
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
3880
|
+
*
|
|
3881
|
+
*
|
|
3818
3882
|
* Sign participant round 1 command.
|
|
3819
3883
|
*
|
|
3820
3884
|
* Port of cmd/sign/participant/round1.rs from frost-hubert-rust.
|
|
@@ -4003,6 +4067,10 @@ async function round1(_client, options, cwd) {
|
|
|
4003
4067
|
//#endregion
|
|
4004
4068
|
//#region src/cmd/sign/participant/round2.ts
|
|
4005
4069
|
/**
|
|
4070
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
4071
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
4072
|
+
*
|
|
4073
|
+
*
|
|
4006
4074
|
* Sign participant round 2 command.
|
|
4007
4075
|
*
|
|
4008
4076
|
* Port of cmd/sign/participant/round2.rs from frost-hubert-rust.
|
|
@@ -4275,6 +4343,10 @@ async function round2(client, options, cwd) {
|
|
|
4275
4343
|
//#endregion
|
|
4276
4344
|
//#region src/cmd/sign/participant/finalize.ts
|
|
4277
4345
|
/**
|
|
4346
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
4347
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
4348
|
+
*
|
|
4349
|
+
*
|
|
4278
4350
|
* Sign participant finalize command.
|
|
4279
4351
|
*
|
|
4280
4352
|
* Port of cmd/sign/participant/finalize.rs from frost-hubert-rust.
|
|
@@ -4800,4 +4872,4 @@ Object.defineProperty(exports, 'sign_exports', {
|
|
|
4800
4872
|
return sign_exports;
|
|
4801
4873
|
}
|
|
4802
4874
|
});
|
|
4803
|
-
//# sourceMappingURL=sign-
|
|
4875
|
+
//# sourceMappingURL=sign-2bOp18Fs.cjs.map
|