MCPcopy Create free account
hub / github.com/allocnode/oh-my-sage / writeRoundTwo

Method writeRoundTwo

ref/gateway_client.js:215–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213 }
214
215 writeRoundTwo() {
216 if (this.roundTwoSent) throw new Error('Round two already sent');
217 if (!this.roundOneSent || !this.roundOneReceived) throw new Error('Round one not completed');
218 this.roundTwoSent = true;
219
220 const g_xa = this.g_x1.add(this.g_x3).add(this.g_x4);
221 const random = new BN(crypto.randomBytes(16));
222 const y = random.mul(EC.n).add(new BN(this.secretBytes));
223 const x2_s = this.x2.mul(y).umod(EC.n);
224 const g_s = g_xa.mul(x2_s);
225
226 const zkp = this.generateZKP(g_xa, g_s, x2_s, this.role);
227
228 const result = Buffer.alloc(165);
229 this.encodePoint(g_s).copy(result, 0);
230 this.encodeZKP(zkp.v, zkp.r).copy(result, 66);
231 return result;
232 }
233
234 readRoundTwo(data) {
235 if (this.roundTwoReceived) throw new Error('Round two already received');

Callers 1

authenticateMethod · 0.95

Calls 3

generateZKPMethod · 0.95
encodePointMethod · 0.95
encodeZKPMethod · 0.95

Tested by

no test coverage detected