-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuser.js
More file actions
54 lines (47 loc) · 1.89 KB
/
user.js
File metadata and controls
54 lines (47 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const { createECDH } = require('crypto'),
secp256k1 = 'secp256k1';
class User {
// I think ECDH and ECDSA keys are generally interchangable.
generateKeypair() {
this.ecdh = createECDH('secp256k1');
this.keys = this.ecdh.generateKeys();
}
sendBlindedKey() {
// copy the go implementation here:
// https://github.com/securepollingsystem/registrar/blob/c2a8102fc07cdc4f0ea3ae442707d50b3de6fb8f/voter/voter.go#L37
//
// the bulk of this will be copying the blinding stuff from here:
// https://github.com/securepollingsystem/registrar/blob/c2a8102fc07cdc4f0ea3ae442707d50b3de6fb8f/blind/requester.go#L25
}
getSignature() {
}
}
function blindKey(pubKey) {
}
function newRequest(Q, R, m) {
// https://github.com/securepollingsystem/registrar/blob/c2a8102fc07cdc4f0ea3ae442707d50b3de6fb8f/blind/requester.go#L25
let a, b, bInv, c;
}
function randFieldElement() {
// https://github.com/securepollingsystem/registrar/blob/c2a8102fc07cdc4f0ea3ae442707d50b3de6fb8f/blind/random.go#L13
}
const BN = require('bn.js');
// https://github.com/securepollingsystem/registrar/blob/c2a8102fc07cdc4f0ea3ae442707d50b3de6fb8f/blind/secp256k1.go#L33
const Secp256kParams = {
p: new BN('FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F', 16),
a: new BN('00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000', 16),
b: new BN('00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000007', 16),
// this is the compressed form of G... What does that mean?
G: new BN('02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798', 16),
n: new BN('FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141', 16),
h: new BN('01', 16),
/*
P: curve.P,
N: curve.N,
B: curve.B,
Gx: curve.Gx,
Gy: curve.Gy,
BitSize: curve.BitSize,
*/
}
Object.assign(module.exports, {User, blindKey});