Update interface

This commit is contained in:
arnaucube
2021-01-16 18:00:52 +01:00
parent ec095bba83
commit becff7b647
10 changed files with 78 additions and 134 deletions

View File

@@ -57,8 +57,7 @@ func blindv0(this js.Value, values []js.Value) interface{} {
Y: signerRy,
}
signer := &blindsecp256k1v0.SignerPublicData{signerQ, signerR}
mBlinded, user := blindsecp256k1v0.Blind(m, signer)
mBlinded, user := blindsecp256k1v0.Blind(m, signerQ, signerR)
r := make(map[string]interface{})
r["mBlinded"] = mBlinded.String()
@@ -108,28 +107,19 @@ func unblindv0(this js.Value, values []js.Value) interface{} {
}
func blind(this js.Value, values []js.Value) interface{} {
mStr := values[0].String()
signerQxStr := values[1].String()
signerQyStr := values[2].String()
signerRxStr := values[3].String()
signerRyStr := values[4].String()
signerRxStr := values[1].String()
signerRyStr := values[2].String()
m := stringToBigInt(mStr)
signerQx := stringToBigInt(signerQxStr)
signerQy := stringToBigInt(signerQyStr)
signerRx := stringToBigInt(signerRxStr)
signerRy := stringToBigInt(signerRyStr)
signerQ := &blindsecp256k1.PublicKey{
X: signerQx,
Y: signerQy,
}
signerR := &blindsecp256k1.Point{
X: signerRx,
Y: signerRy,
}
signer := &blindsecp256k1.SignerPublicData{signerQ, signerR}
mBlinded, user := blindsecp256k1.Blind(m, signer)
mBlinded, user := blindsecp256k1.Blind(m, signerR)
r := make(map[string]interface{})
r["mBlinded"] = mBlinded.String()

Binary file not shown.

View File

@@ -2,15 +2,15 @@ function test() {
let m = "1952805748";
console.log("using: https://sci-hub.do/10.1109/ICCKE.2013.6682844");
// Q & R would be received from the Signer
let signerQx = "26613296432153871833441195158297038913673464785502568519907582377915678491093";
let signerQy = "81940194042971427014176158889809922552127995083760111384335138546589994227275";
// R would be received from the Signer
let signerRx = "59371873487402651110657306418818354906476102545298559461791300717696053835454";
let signerRy = "98322875246066710654579302898391677189379767946198239290895789444110962324342";
let blindRes = blind(m, signerQx, signerQy, signerRx, signerRy);
let blindRes = blind(m, signerRx, signerRy);
console.log("blind", blindRes);
// sBlind would be received from the Signer
// Q & sBlind would be received from the Signer
let signerQx = "26613296432153871833441195158297038913673464785502568519907582377915678491093";
let signerQy = "81940194042971427014176158889809922552127995083760111384335138546589994227275";
let sBlind = "7240298625621589352655632414257224668430424461224914067754717095121139699933353374227084479180038954015287518505167995306229258561275087198611946596619855";
let unblindRes = unblind(sBlind, m, blindRes.uA, blindRes.uB, blindRes.uFx, blindRes.uFy);
console.log("unblind", unblindRes);