arnaucube
arnaucube/go-blindsecp256k1Public Self-hosted repository
go-blindsecp256k1/README.md
README.mdRaw
 1# go-blindsecp256k1 [![GoDoc](https://godoc.org/github.com/arnaucube/go-blindsecp256k1?status.svg)](https://godoc.org/github.com/arnaucube/go-blindsecp256k1) [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/go-blindsecp256k1)](https://goreportcard.com/report/github.com/arnaucube/go-blindsecp256k1) [![Test](https://github.com/arnaucube/go-blindsecp256k1/workflows/Test/badge.svg)](https://github.com/arnaucube/go-blindsecp256k1/actions?query=workflow%3ATest)
 2
 3Blind signature over [secp256k1](https://en.bitcoin.it/wiki/Secp256k1), based on *"[An Efficient Blind Signature Scheme Based on the Elliptic Curve Discrete Logarithm Problem](http://www.isecure-journal.com/article_39171_47f9ec605dd3918c2793565ec21fcd7a.pdf)"* paper.
 4
 5**WARNING**: this repo is experimental, do not use in production.
 6
 7## Usage
 8
 9```go
10// message to be signed
11msg := new(big.Int).SetBytes([]byte("test"))
12
13// create new signer
14signerPrivateData := blindsecp256k1.NewSigner()
15signerPublicData := signerPrivateData.PublicData()
16
17// user blinds the msg
18msgBlinded, user := blindsecp256k1.Blind(msg, signerPublicData)
19
20// signer signs the blinded message
21sBlind := signerPrivateData.BlindSign(msgBlinded)
22
23// user unblinds the blinded signature
24sig := blindsecp256k1.Unblind(sBlind, msg, user)
25
26// signature can be verified with signer PublicKey
27verified := blindsecp256k1.Verify(msg, sig, signerPublicData.Q)
28assert.True(t, verified)
29```
30
31## WASM usage
32WASM 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.