go-blindsecp256k1/README.md
README.mdRaw
1# go-blindsecp256k1 [](https://godoc.org/github.com/arnaucube/go-blindsecp256k1) [](https://goreportcard.com/report/github.com/arnaucube/go-blindsecp256k1) [](https://github.com/arnaucube/go-blindsecp256k1/actions?query=workflow%3ATest)
2
3Blind signature over [secp256k1](https://en.bitcoin.it/wiki/Secp256k1), based on *"[New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem](https://sci-hub.do/10.1109/ICCKE.2013.6682844)"* paper by Hamid Mala & Nafiseh Nezhadansari.
4
5**WARNING**: this repo is experimental, do not use in production.
6
7## Usage
8
9```go
10// signer: create new signer key pair
11sk := NewPrivateKey()
12signerPubK := sk.Public()
13
14// signer: when user requests new R parameter to blind a new msg,
15// create new signerR (public) with its secret k
16k, signerR := NewRequestParameters()
17
18// user: blinds the msg using signer's R
19msg := new(big.Int).SetBytes([]byte("test"))
20msgBlinded, userSecretData, err := Blind(msg, signerR)
21require.Nil(t, err)
22
23// signer: signs the blinded message using its private key & secret k
24sBlind, err := sk.BlindSign(msgBlinded, k)
25require.Nil(t, err)
26
27// user: unblinds the blinded signature
28sig := Unblind(sBlind, userSecretData)
29
30// signature can be verified with signer PublicKey
31verified := Verify(msg, sig, signerPubK)
32assert.True(t, verified)
33```
34
35## WASM usage
36WASM wrappers for browser usage can be found at the [wasm](https://github.com/arnaucube/go-blindsecp256k1/tree/master/wasm/) directory with an example in html&js.