wire-mesh-core 1.47.0 → 1.48.0
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.
|
@@ -41,6 +41,23 @@ function dkgRound1(ownDeviceId, maxSigners, minSigners) {
|
|
|
41
41
|
package: toBufferSource(out.package)
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
/** Splits a serialized DKG round-1 package (dkgRound1's own `package` output) into `threshold-keygen-round1`'s own wire shape: the Feldman commitment as an array of independently-serialized coefficients (`commitment: [* bstr]`) and the Schnorr proof of knowledge as a separate byte string -- unlike frost-core's own combined-blob serialization. The inverse of combineRound1Package. */
|
|
45
|
+
function splitRound1Package(serializedPackage) {
|
|
46
|
+
const out = wasm_dist_wire_mesh_threshold_wasm_js.split_round1_package(serializedPackage);
|
|
47
|
+
const commitment = [];
|
|
48
|
+
for (const coefficient of out.commitment) {
|
|
49
|
+
if (!isUint8Array(coefficient)) throw new Error("wasm returned a non-Uint8Array entry in split_round1_package's own commitment array");
|
|
50
|
+
commitment.push(toBufferSource(coefficient));
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
commitment,
|
|
54
|
+
proofOfKnowledge: toBufferSource(out.proofOfKnowledge)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Reconstructs a serialized DKG round-1 package (the same combined-blob shape dkgRound2/dkgRound3/dkgTranscriptDigest expect) from the two independently-serialized wire fields `threshold-keygen-round1` carries. The inverse of splitRound1Package. */
|
|
58
|
+
function combineRound1Package(commitment, proofOfKnowledge) {
|
|
59
|
+
return toBufferSource(wasm_dist_wire_mesh_threshold_wasm_js.combine_round1_package([...commitment], proofOfKnowledge));
|
|
60
|
+
}
|
|
44
61
|
/** Round 2: verifies every other participant's round-1 proof of knowledge and computes this participant's own pairwise sub-shares. `round1` MUST NOT include this participant's own package. */
|
|
45
62
|
function dkgRound2(ownSecretPackage, round1) {
|
|
46
63
|
const [ids, packages] = toParallelArrays(round1);
|
|
@@ -84,6 +101,18 @@ function signingRound1Commit(ownKeyPackage) {
|
|
|
84
101
|
commitments: toBufferSource(out.commitments)
|
|
85
102
|
};
|
|
86
103
|
}
|
|
104
|
+
/** Splits a serialized SigningCommitments blob (signingRound1Commit's own `commitments` output) into the two independently-serialized halves `threshold-commitment`'s wire shape carries (`hiding: bstr, binding: bstr`) -- unlike frost-core's own combined-blob serialization, which is opaque and not spec-shaped. The inverse of combineCommitments. */
|
|
105
|
+
function splitCommitments(commitments) {
|
|
106
|
+
const out = wasm_dist_wire_mesh_threshold_wasm_js.split_commitments(commitments);
|
|
107
|
+
return {
|
|
108
|
+
hiding: toBufferSource(out.hiding),
|
|
109
|
+
binding: toBufferSource(out.binding)
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** Reconstructs a serialized SigningCommitments blob (the same combined-blob shape signingBuildPackage/signingRound2Sign expect) from the two independently-serialized halves `threshold-commitment` carries on the wire. The inverse of splitCommitments. */
|
|
113
|
+
function combineCommitments(hiding, binding) {
|
|
114
|
+
return toBufferSource(wasm_dist_wire_mesh_threshold_wasm_js.combine_commitments(hiding, binding));
|
|
115
|
+
}
|
|
87
116
|
/** Coordinator-side: builds the signing-package bytes every participant's round 2 is computed against. */
|
|
88
117
|
function signingBuildPackage(commitments, message) {
|
|
89
118
|
const [ids, values] = toParallelArrays(commitments);
|
|
@@ -110,30 +139,59 @@ function reshareRound1(ownDeviceId, ownOldSigningShare, survivorDeviceIds, newPa
|
|
|
110
139
|
outgoing: fromParallelArrays(out.recipientIds, out.shares)
|
|
111
140
|
};
|
|
112
141
|
}
|
|
142
|
+
/** Splits a survivor's serialized broadcast commitment (reshareRound1's own `commitment` output) into `threshold-keygen-round1`'s own wire shape: an array of independently-serialized coefficients (`commitment: [* bstr]`) -- unlike reshareRound1's own whole-blob serialization. The inverse of reshareCombineCommitmentParts. */
|
|
143
|
+
function reshareSplitCommitment(commitment) {
|
|
144
|
+
const out = [];
|
|
145
|
+
for (const part of wasm_dist_wire_mesh_threshold_wasm_js.reshare_split_commitment(commitment)) {
|
|
146
|
+
if (!isUint8Array(part)) throw new Error("wasm returned a non-Uint8Array entry in reshare_split_commitment's own output array");
|
|
147
|
+
out.push(toBufferSource(part));
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
/** Reconstructs a survivor's serialized broadcast commitment (the same whole-blob shape reshareCombineCommitments expects each entry of its own commitments array to be) from the wire's own per-coefficient array. The inverse of reshareSplitCommitment. */
|
|
152
|
+
function reshareCombineCommitmentParts(parts) {
|
|
153
|
+
return toBufferSource(wasm_dist_wire_mesh_threshold_wasm_js.reshare_combine_commitment_parts([...parts]));
|
|
154
|
+
}
|
|
113
155
|
/** Sums T survivors' broadcast commitment vectors into the one combined VSS commitment `reshareDerivePublicKeyPackage` needs. */
|
|
114
156
|
function reshareCombineCommitments(commitments) {
|
|
115
157
|
return toBufferSource(wasm_dist_wire_mesh_threshold_wasm_js.reshare_combine_commitments([...commitments]));
|
|
116
158
|
}
|
|
117
|
-
/** The
|
|
159
|
+
/** The echo-broadcast transcript digest a member of the new participant set sends on threshold-keygen-confirm for a reshare -- the reshare analogue of dkgTranscriptDigest, structurally distinct because a reshare's own survivor commitment carries no proof-of-knowledge component: deserializing one as a DKG round-1 package fails outright, since the two are different wire shapes entirely. `survivorCommitments` entries are each the same whole-blob shape reshareRound1's own `commitment` output is (NOT the wire's own split [* bstr] parts -- combine those first via reshareCombineCommitmentParts if collected off the wire). */
|
|
160
|
+
function reshareTranscriptDigest(survivorCommitments, groupVerifyingKey) {
|
|
161
|
+
const [ids, commitments] = toParallelArrays(survivorCommitments);
|
|
162
|
+
return toBufferSource(wasm_dist_wire_mesh_threshold_wasm_js.reshare_transcript_digest(ids, commitments, groupVerifyingKey));
|
|
163
|
+
}
|
|
164
|
+
/** The group's derived public key package given the combined commitment and the new participant set. `groupVerifyingKey` is what `threshold-keygen-confirm`'s own `group-key` field carries and what a reshare's own verifier obligation checks against `existing-group-key` (MUST equal it -- a reshare that changes the group key is a takeover, not a reshare). */
|
|
118
165
|
function reshareDerivePublicKeyPackage(combinedCommitment, newParticipantDeviceIds) {
|
|
119
|
-
|
|
166
|
+
const out = wasm_dist_wire_mesh_threshold_wasm_js.reshare_derive_public_key_package(combinedCommitment, [...newParticipantDeviceIds]);
|
|
167
|
+
return {
|
|
168
|
+
publicKeyPackage: toBufferSource(out.publicKeyPackage),
|
|
169
|
+
groupVerifyingKey: toBufferSource(out.groupVerifyingKey)
|
|
170
|
+
};
|
|
120
171
|
}
|
|
121
172
|
/** New-participant side (local): verifies each received share against its own embedded commitment, sums the validated shares, and builds this participant's final key package. */
|
|
122
173
|
function reshareCombineReceivedShares(ownDeviceId, received, publicKeyPackage, newMinSigners) {
|
|
123
174
|
return toBufferSource(wasm_dist_wire_mesh_threshold_wasm_js.reshare_combine_received_shares(ownDeviceId, [...received], publicKeyPackage, newMinSigners));
|
|
124
175
|
}
|
|
125
176
|
//#endregion
|
|
177
|
+
exports.combineCommitments = combineCommitments;
|
|
178
|
+
exports.combineRound1Package = combineRound1Package;
|
|
126
179
|
exports.dkgConfirmMatches = dkgConfirmMatches;
|
|
127
180
|
exports.dkgRound1 = dkgRound1;
|
|
128
181
|
exports.dkgRound2 = dkgRound2;
|
|
129
182
|
exports.dkgRound3 = dkgRound3;
|
|
130
183
|
exports.dkgTranscriptDigest = dkgTranscriptDigest;
|
|
131
184
|
exports.keyPackageSigningShare = keyPackageSigningShare;
|
|
185
|
+
exports.reshareCombineCommitmentParts = reshareCombineCommitmentParts;
|
|
132
186
|
exports.reshareCombineCommitments = reshareCombineCommitments;
|
|
133
187
|
exports.reshareCombineReceivedShares = reshareCombineReceivedShares;
|
|
134
188
|
exports.reshareDerivePublicKeyPackage = reshareDerivePublicKeyPackage;
|
|
135
189
|
exports.reshareRound1 = reshareRound1;
|
|
190
|
+
exports.reshareSplitCommitment = reshareSplitCommitment;
|
|
191
|
+
exports.reshareTranscriptDigest = reshareTranscriptDigest;
|
|
136
192
|
exports.signingAggregate = signingAggregate;
|
|
137
193
|
exports.signingBuildPackage = signingBuildPackage;
|
|
138
194
|
exports.signingRound1Commit = signingRound1Commit;
|
|
139
195
|
exports.signingRound2Sign = signingRound2Sign;
|
|
196
|
+
exports.splitCommitments = splitCommitments;
|
|
197
|
+
exports.splitRound1Package = splitRound1Package;
|
|
@@ -11,6 +11,14 @@ export interface DkgRound1Result {
|
|
|
11
11
|
}
|
|
12
12
|
/** Round 1: samples this participant's own polynomial and commits to it. See `wire_mesh_threshold::dkg::round1`'s own doc comment for the full design. */
|
|
13
13
|
export declare function dkgRound1(ownDeviceId: DeviceId, maxSigners: number, minSigners: number): DkgRound1Result;
|
|
14
|
+
export interface SplitRound1PackageResult {
|
|
15
|
+
commitment: Uint8Array<ArrayBuffer>[];
|
|
16
|
+
proofOfKnowledge: Uint8Array<ArrayBuffer>;
|
|
17
|
+
}
|
|
18
|
+
/** Splits a serialized DKG round-1 package (dkgRound1's own `package` output) into `threshold-keygen-round1`'s own wire shape: the Feldman commitment as an array of independently-serialized coefficients (`commitment: [* bstr]`) and the Schnorr proof of knowledge as a separate byte string -- unlike frost-core's own combined-blob serialization. The inverse of combineRound1Package. */
|
|
19
|
+
export declare function splitRound1Package(serializedPackage: Uint8Array): SplitRound1PackageResult;
|
|
20
|
+
/** Reconstructs a serialized DKG round-1 package (the same combined-blob shape dkgRound2/dkgRound3/dkgTranscriptDigest expect) from the two independently-serialized wire fields `threshold-keygen-round1` carries. The inverse of splitRound1Package. */
|
|
21
|
+
export declare function combineRound1Package(commitment: readonly Uint8Array[], proofOfKnowledge: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
14
22
|
export interface DkgRound2Result {
|
|
15
23
|
secretPackage: Uint8Array<ArrayBuffer>;
|
|
16
24
|
outgoing: DeviceKeyed[];
|
|
@@ -38,6 +46,14 @@ export interface SigningRound1Result {
|
|
|
38
46
|
* The pure-crypto half of round 1: generates a fresh nonce pair and its commitments. Persisting `nonces` durably before this participant's own round-1 response leaves the device is the CALLER's own obligation -- nonce reuse across two released signature shares discloses this participant's long-term key share outright. This function has no storage dependency and cannot enforce that obligation itself.
|
|
39
47
|
*/
|
|
40
48
|
export declare function signingRound1Commit(ownKeyPackage: Uint8Array): SigningRound1Result;
|
|
49
|
+
export interface SplitCommitmentsResult {
|
|
50
|
+
hiding: Uint8Array<ArrayBuffer>;
|
|
51
|
+
binding: Uint8Array<ArrayBuffer>;
|
|
52
|
+
}
|
|
53
|
+
/** Splits a serialized SigningCommitments blob (signingRound1Commit's own `commitments` output) into the two independently-serialized halves `threshold-commitment`'s wire shape carries (`hiding: bstr, binding: bstr`) -- unlike frost-core's own combined-blob serialization, which is opaque and not spec-shaped. The inverse of combineCommitments. */
|
|
54
|
+
export declare function splitCommitments(commitments: Uint8Array): SplitCommitmentsResult;
|
|
55
|
+
/** Reconstructs a serialized SigningCommitments blob (the same combined-blob shape signingBuildPackage/signingRound2Sign expect) from the two independently-serialized halves `threshold-commitment` carries on the wire. The inverse of splitCommitments. */
|
|
56
|
+
export declare function combineCommitments(hiding: Uint8Array, binding: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
41
57
|
/** Coordinator-side: builds the signing-package bytes every participant's round 2 is computed against. */
|
|
42
58
|
export declare function signingBuildPackage(commitments: readonly DeviceKeyed[], message: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
43
59
|
/** Round 2: releases this participant's signature share. The CALLER MUST have already taken (one-shot) `nonces` from its own durable nonce store before calling this. */
|
|
@@ -54,10 +70,20 @@ export interface ReshareRound1Result {
|
|
|
54
70
|
* Survivor side: re-shares this device's own Lagrange-weighted sub-share of the group secret across a new (possibly different) participant set. See `wire_mesh_threshold::reshare`'s own module doc comment (Rust side) for the full design rationale -- deliberately not built on a zero-secret "refresh" delta, which cannot onboard a device with no prior share or safely change the threshold.
|
|
55
71
|
*/
|
|
56
72
|
export declare function reshareRound1(ownDeviceId: DeviceId, ownOldSigningShare: Uint8Array, survivorDeviceIds: readonly DeviceId[], newParticipantDeviceIds: readonly DeviceId[], newMinSigners: number): ReshareRound1Result;
|
|
73
|
+
/** Splits a survivor's serialized broadcast commitment (reshareRound1's own `commitment` output) into `threshold-keygen-round1`'s own wire shape: an array of independently-serialized coefficients (`commitment: [* bstr]`) -- unlike reshareRound1's own whole-blob serialization. The inverse of reshareCombineCommitmentParts. */
|
|
74
|
+
export declare function reshareSplitCommitment(commitment: Uint8Array): Uint8Array<ArrayBuffer>[];
|
|
75
|
+
/** Reconstructs a survivor's serialized broadcast commitment (the same whole-blob shape reshareCombineCommitments expects each entry of its own commitments array to be) from the wire's own per-coefficient array. The inverse of reshareSplitCommitment. */
|
|
76
|
+
export declare function reshareCombineCommitmentParts(parts: readonly Uint8Array[]): Uint8Array<ArrayBuffer>;
|
|
57
77
|
/** Sums T survivors' broadcast commitment vectors into the one combined VSS commitment `reshareDerivePublicKeyPackage` needs. */
|
|
58
78
|
export declare function reshareCombineCommitments(commitments: readonly Uint8Array[]): Uint8Array<ArrayBuffer>;
|
|
59
|
-
/** The
|
|
60
|
-
export declare function
|
|
79
|
+
/** The echo-broadcast transcript digest a member of the new participant set sends on threshold-keygen-confirm for a reshare -- the reshare analogue of dkgTranscriptDigest, structurally distinct because a reshare's own survivor commitment carries no proof-of-knowledge component: deserializing one as a DKG round-1 package fails outright, since the two are different wire shapes entirely. `survivorCommitments` entries are each the same whole-blob shape reshareRound1's own `commitment` output is (NOT the wire's own split [* bstr] parts -- combine those first via reshareCombineCommitmentParts if collected off the wire). */
|
|
80
|
+
export declare function reshareTranscriptDigest(survivorCommitments: readonly DeviceKeyed[], groupVerifyingKey: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
81
|
+
export interface ReshareDerivePublicKeyPackageResult {
|
|
82
|
+
publicKeyPackage: Uint8Array<ArrayBuffer>;
|
|
83
|
+
groupVerifyingKey: Uint8Array<ArrayBuffer>;
|
|
84
|
+
}
|
|
85
|
+
/** The group's derived public key package given the combined commitment and the new participant set. `groupVerifyingKey` is what `threshold-keygen-confirm`'s own `group-key` field carries and what a reshare's own verifier obligation checks against `existing-group-key` (MUST equal it -- a reshare that changes the group key is a takeover, not a reshare). */
|
|
86
|
+
export declare function reshareDerivePublicKeyPackage(combinedCommitment: Uint8Array, newParticipantDeviceIds: readonly DeviceId[]): ReshareDerivePublicKeyPackageResult;
|
|
61
87
|
/** New-participant side (local): verifies each received share against its own embedded commitment, sums the validated shares, and builds this participant's final key package. */
|
|
62
88
|
export declare function reshareCombineReceivedShares(ownDeviceId: DeviceId, received: readonly Uint8Array[], publicKeyPackage: Uint8Array, newMinSigners: number): Uint8Array<ArrayBuffer>;
|
|
63
89
|
//#endregion
|
|
@@ -11,6 +11,14 @@ export interface DkgRound1Result {
|
|
|
11
11
|
}
|
|
12
12
|
/** Round 1: samples this participant's own polynomial and commits to it. See `wire_mesh_threshold::dkg::round1`'s own doc comment for the full design. */
|
|
13
13
|
export declare function dkgRound1(ownDeviceId: DeviceId, maxSigners: number, minSigners: number): DkgRound1Result;
|
|
14
|
+
export interface SplitRound1PackageResult {
|
|
15
|
+
commitment: Uint8Array<ArrayBuffer>[];
|
|
16
|
+
proofOfKnowledge: Uint8Array<ArrayBuffer>;
|
|
17
|
+
}
|
|
18
|
+
/** Splits a serialized DKG round-1 package (dkgRound1's own `package` output) into `threshold-keygen-round1`'s own wire shape: the Feldman commitment as an array of independently-serialized coefficients (`commitment: [* bstr]`) and the Schnorr proof of knowledge as a separate byte string -- unlike frost-core's own combined-blob serialization. The inverse of combineRound1Package. */
|
|
19
|
+
export declare function splitRound1Package(serializedPackage: Uint8Array): SplitRound1PackageResult;
|
|
20
|
+
/** Reconstructs a serialized DKG round-1 package (the same combined-blob shape dkgRound2/dkgRound3/dkgTranscriptDigest expect) from the two independently-serialized wire fields `threshold-keygen-round1` carries. The inverse of splitRound1Package. */
|
|
21
|
+
export declare function combineRound1Package(commitment: readonly Uint8Array[], proofOfKnowledge: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
14
22
|
export interface DkgRound2Result {
|
|
15
23
|
secretPackage: Uint8Array<ArrayBuffer>;
|
|
16
24
|
outgoing: DeviceKeyed[];
|
|
@@ -38,6 +46,14 @@ export interface SigningRound1Result {
|
|
|
38
46
|
* The pure-crypto half of round 1: generates a fresh nonce pair and its commitments. Persisting `nonces` durably before this participant's own round-1 response leaves the device is the CALLER's own obligation -- nonce reuse across two released signature shares discloses this participant's long-term key share outright. This function has no storage dependency and cannot enforce that obligation itself.
|
|
39
47
|
*/
|
|
40
48
|
export declare function signingRound1Commit(ownKeyPackage: Uint8Array): SigningRound1Result;
|
|
49
|
+
export interface SplitCommitmentsResult {
|
|
50
|
+
hiding: Uint8Array<ArrayBuffer>;
|
|
51
|
+
binding: Uint8Array<ArrayBuffer>;
|
|
52
|
+
}
|
|
53
|
+
/** Splits a serialized SigningCommitments blob (signingRound1Commit's own `commitments` output) into the two independently-serialized halves `threshold-commitment`'s wire shape carries (`hiding: bstr, binding: bstr`) -- unlike frost-core's own combined-blob serialization, which is opaque and not spec-shaped. The inverse of combineCommitments. */
|
|
54
|
+
export declare function splitCommitments(commitments: Uint8Array): SplitCommitmentsResult;
|
|
55
|
+
/** Reconstructs a serialized SigningCommitments blob (the same combined-blob shape signingBuildPackage/signingRound2Sign expect) from the two independently-serialized halves `threshold-commitment` carries on the wire. The inverse of splitCommitments. */
|
|
56
|
+
export declare function combineCommitments(hiding: Uint8Array, binding: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
41
57
|
/** Coordinator-side: builds the signing-package bytes every participant's round 2 is computed against. */
|
|
42
58
|
export declare function signingBuildPackage(commitments: readonly DeviceKeyed[], message: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
43
59
|
/** Round 2: releases this participant's signature share. The CALLER MUST have already taken (one-shot) `nonces` from its own durable nonce store before calling this. */
|
|
@@ -54,10 +70,20 @@ export interface ReshareRound1Result {
|
|
|
54
70
|
* Survivor side: re-shares this device's own Lagrange-weighted sub-share of the group secret across a new (possibly different) participant set. See `wire_mesh_threshold::reshare`'s own module doc comment (Rust side) for the full design rationale -- deliberately not built on a zero-secret "refresh" delta, which cannot onboard a device with no prior share or safely change the threshold.
|
|
55
71
|
*/
|
|
56
72
|
export declare function reshareRound1(ownDeviceId: DeviceId, ownOldSigningShare: Uint8Array, survivorDeviceIds: readonly DeviceId[], newParticipantDeviceIds: readonly DeviceId[], newMinSigners: number): ReshareRound1Result;
|
|
73
|
+
/** Splits a survivor's serialized broadcast commitment (reshareRound1's own `commitment` output) into `threshold-keygen-round1`'s own wire shape: an array of independently-serialized coefficients (`commitment: [* bstr]`) -- unlike reshareRound1's own whole-blob serialization. The inverse of reshareCombineCommitmentParts. */
|
|
74
|
+
export declare function reshareSplitCommitment(commitment: Uint8Array): Uint8Array<ArrayBuffer>[];
|
|
75
|
+
/** Reconstructs a survivor's serialized broadcast commitment (the same whole-blob shape reshareCombineCommitments expects each entry of its own commitments array to be) from the wire's own per-coefficient array. The inverse of reshareSplitCommitment. */
|
|
76
|
+
export declare function reshareCombineCommitmentParts(parts: readonly Uint8Array[]): Uint8Array<ArrayBuffer>;
|
|
57
77
|
/** Sums T survivors' broadcast commitment vectors into the one combined VSS commitment `reshareDerivePublicKeyPackage` needs. */
|
|
58
78
|
export declare function reshareCombineCommitments(commitments: readonly Uint8Array[]): Uint8Array<ArrayBuffer>;
|
|
59
|
-
/** The
|
|
60
|
-
export declare function
|
|
79
|
+
/** The echo-broadcast transcript digest a member of the new participant set sends on threshold-keygen-confirm for a reshare -- the reshare analogue of dkgTranscriptDigest, structurally distinct because a reshare's own survivor commitment carries no proof-of-knowledge component: deserializing one as a DKG round-1 package fails outright, since the two are different wire shapes entirely. `survivorCommitments` entries are each the same whole-blob shape reshareRound1's own `commitment` output is (NOT the wire's own split [* bstr] parts -- combine those first via reshareCombineCommitmentParts if collected off the wire). */
|
|
80
|
+
export declare function reshareTranscriptDigest(survivorCommitments: readonly DeviceKeyed[], groupVerifyingKey: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
81
|
+
export interface ReshareDerivePublicKeyPackageResult {
|
|
82
|
+
publicKeyPackage: Uint8Array<ArrayBuffer>;
|
|
83
|
+
groupVerifyingKey: Uint8Array<ArrayBuffer>;
|
|
84
|
+
}
|
|
85
|
+
/** The group's derived public key package given the combined commitment and the new participant set. `groupVerifyingKey` is what `threshold-keygen-confirm`'s own `group-key` field carries and what a reshare's own verifier obligation checks against `existing-group-key` (MUST equal it -- a reshare that changes the group key is a takeover, not a reshare). */
|
|
86
|
+
export declare function reshareDerivePublicKeyPackage(combinedCommitment: Uint8Array, newParticipantDeviceIds: readonly DeviceId[]): ReshareDerivePublicKeyPackageResult;
|
|
61
87
|
/** New-participant side (local): verifies each received share against its own embedded commitment, sums the validated shares, and builds this participant's final key package. */
|
|
62
88
|
export declare function reshareCombineReceivedShares(ownDeviceId: DeviceId, received: readonly Uint8Array[], publicKeyPackage: Uint8Array, newMinSigners: number): Uint8Array<ArrayBuffer>;
|
|
63
89
|
//#endregion
|
|
@@ -38,6 +38,23 @@ function dkgRound1(ownDeviceId, maxSigners, minSigners) {
|
|
|
38
38
|
package: toBufferSource(out.package)
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
/** Splits a serialized DKG round-1 package (dkgRound1's own `package` output) into `threshold-keygen-round1`'s own wire shape: the Feldman commitment as an array of independently-serialized coefficients (`commitment: [* bstr]`) and the Schnorr proof of knowledge as a separate byte string -- unlike frost-core's own combined-blob serialization. The inverse of combineRound1Package. */
|
|
42
|
+
function splitRound1Package(serializedPackage) {
|
|
43
|
+
const out = wasm.split_round1_package(serializedPackage);
|
|
44
|
+
const commitment = [];
|
|
45
|
+
for (const coefficient of out.commitment) {
|
|
46
|
+
if (!isUint8Array(coefficient)) throw new Error("wasm returned a non-Uint8Array entry in split_round1_package's own commitment array");
|
|
47
|
+
commitment.push(toBufferSource(coefficient));
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
commitment,
|
|
51
|
+
proofOfKnowledge: toBufferSource(out.proofOfKnowledge)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Reconstructs a serialized DKG round-1 package (the same combined-blob shape dkgRound2/dkgRound3/dkgTranscriptDigest expect) from the two independently-serialized wire fields `threshold-keygen-round1` carries. The inverse of splitRound1Package. */
|
|
55
|
+
function combineRound1Package(commitment, proofOfKnowledge) {
|
|
56
|
+
return toBufferSource(wasm.combine_round1_package([...commitment], proofOfKnowledge));
|
|
57
|
+
}
|
|
41
58
|
/** Round 2: verifies every other participant's round-1 proof of knowledge and computes this participant's own pairwise sub-shares. `round1` MUST NOT include this participant's own package. */
|
|
42
59
|
function dkgRound2(ownSecretPackage, round1) {
|
|
43
60
|
const [ids, packages] = toParallelArrays(round1);
|
|
@@ -81,6 +98,18 @@ function signingRound1Commit(ownKeyPackage) {
|
|
|
81
98
|
commitments: toBufferSource(out.commitments)
|
|
82
99
|
};
|
|
83
100
|
}
|
|
101
|
+
/** Splits a serialized SigningCommitments blob (signingRound1Commit's own `commitments` output) into the two independently-serialized halves `threshold-commitment`'s wire shape carries (`hiding: bstr, binding: bstr`) -- unlike frost-core's own combined-blob serialization, which is opaque and not spec-shaped. The inverse of combineCommitments. */
|
|
102
|
+
function splitCommitments(commitments) {
|
|
103
|
+
const out = wasm.split_commitments(commitments);
|
|
104
|
+
return {
|
|
105
|
+
hiding: toBufferSource(out.hiding),
|
|
106
|
+
binding: toBufferSource(out.binding)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Reconstructs a serialized SigningCommitments blob (the same combined-blob shape signingBuildPackage/signingRound2Sign expect) from the two independently-serialized halves `threshold-commitment` carries on the wire. The inverse of splitCommitments. */
|
|
110
|
+
function combineCommitments(hiding, binding) {
|
|
111
|
+
return toBufferSource(wasm.combine_commitments(hiding, binding));
|
|
112
|
+
}
|
|
84
113
|
/** Coordinator-side: builds the signing-package bytes every participant's round 2 is computed against. */
|
|
85
114
|
function signingBuildPackage(commitments, message) {
|
|
86
115
|
const [ids, values] = toParallelArrays(commitments);
|
|
@@ -107,17 +136,39 @@ function reshareRound1(ownDeviceId, ownOldSigningShare, survivorDeviceIds, newPa
|
|
|
107
136
|
outgoing: fromParallelArrays(out.recipientIds, out.shares)
|
|
108
137
|
};
|
|
109
138
|
}
|
|
139
|
+
/** Splits a survivor's serialized broadcast commitment (reshareRound1's own `commitment` output) into `threshold-keygen-round1`'s own wire shape: an array of independently-serialized coefficients (`commitment: [* bstr]`) -- unlike reshareRound1's own whole-blob serialization. The inverse of reshareCombineCommitmentParts. */
|
|
140
|
+
function reshareSplitCommitment(commitment) {
|
|
141
|
+
const out = [];
|
|
142
|
+
for (const part of wasm.reshare_split_commitment(commitment)) {
|
|
143
|
+
if (!isUint8Array(part)) throw new Error("wasm returned a non-Uint8Array entry in reshare_split_commitment's own output array");
|
|
144
|
+
out.push(toBufferSource(part));
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
/** Reconstructs a survivor's serialized broadcast commitment (the same whole-blob shape reshareCombineCommitments expects each entry of its own commitments array to be) from the wire's own per-coefficient array. The inverse of reshareSplitCommitment. */
|
|
149
|
+
function reshareCombineCommitmentParts(parts) {
|
|
150
|
+
return toBufferSource(wasm.reshare_combine_commitment_parts([...parts]));
|
|
151
|
+
}
|
|
110
152
|
/** Sums T survivors' broadcast commitment vectors into the one combined VSS commitment `reshareDerivePublicKeyPackage` needs. */
|
|
111
153
|
function reshareCombineCommitments(commitments) {
|
|
112
154
|
return toBufferSource(wasm.reshare_combine_commitments([...commitments]));
|
|
113
155
|
}
|
|
114
|
-
/** The
|
|
156
|
+
/** The echo-broadcast transcript digest a member of the new participant set sends on threshold-keygen-confirm for a reshare -- the reshare analogue of dkgTranscriptDigest, structurally distinct because a reshare's own survivor commitment carries no proof-of-knowledge component: deserializing one as a DKG round-1 package fails outright, since the two are different wire shapes entirely. `survivorCommitments` entries are each the same whole-blob shape reshareRound1's own `commitment` output is (NOT the wire's own split [* bstr] parts -- combine those first via reshareCombineCommitmentParts if collected off the wire). */
|
|
157
|
+
function reshareTranscriptDigest(survivorCommitments, groupVerifyingKey) {
|
|
158
|
+
const [ids, commitments] = toParallelArrays(survivorCommitments);
|
|
159
|
+
return toBufferSource(wasm.reshare_transcript_digest(ids, commitments, groupVerifyingKey));
|
|
160
|
+
}
|
|
161
|
+
/** The group's derived public key package given the combined commitment and the new participant set. `groupVerifyingKey` is what `threshold-keygen-confirm`'s own `group-key` field carries and what a reshare's own verifier obligation checks against `existing-group-key` (MUST equal it -- a reshare that changes the group key is a takeover, not a reshare). */
|
|
115
162
|
function reshareDerivePublicKeyPackage(combinedCommitment, newParticipantDeviceIds) {
|
|
116
|
-
|
|
163
|
+
const out = wasm.reshare_derive_public_key_package(combinedCommitment, [...newParticipantDeviceIds]);
|
|
164
|
+
return {
|
|
165
|
+
publicKeyPackage: toBufferSource(out.publicKeyPackage),
|
|
166
|
+
groupVerifyingKey: toBufferSource(out.groupVerifyingKey)
|
|
167
|
+
};
|
|
117
168
|
}
|
|
118
169
|
/** New-participant side (local): verifies each received share against its own embedded commitment, sums the validated shares, and builds this participant's final key package. */
|
|
119
170
|
function reshareCombineReceivedShares(ownDeviceId, received, publicKeyPackage, newMinSigners) {
|
|
120
171
|
return toBufferSource(wasm.reshare_combine_received_shares(ownDeviceId, [...received], publicKeyPackage, newMinSigners));
|
|
121
172
|
}
|
|
122
173
|
//#endregion
|
|
123
|
-
export { dkgConfirmMatches, dkgRound1, dkgRound2, dkgRound3, dkgTranscriptDigest, keyPackageSigningShare, reshareCombineCommitments, reshareCombineReceivedShares, reshareDerivePublicKeyPackage, reshareRound1, signingAggregate, signingBuildPackage, signingRound1Commit, signingRound2Sign };
|
|
174
|
+
export { combineCommitments, combineRound1Package, dkgConfirmMatches, dkgRound1, dkgRound2, dkgRound3, dkgTranscriptDigest, keyPackageSigningShare, reshareCombineCommitmentParts, reshareCombineCommitments, reshareCombineReceivedShares, reshareDerivePublicKeyPackage, reshareRound1, reshareSplitCommitment, reshareTranscriptDigest, signingAggregate, signingBuildPackage, signingRound1Commit, signingRound2Sign, splitCommitments, splitRound1Package };
|