You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.6 KiB

3 years ago
  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. Blind 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.
  3. **WARNING**: this repo is experimental, do not use in production.
  4. ## Usage
  5. ```go
  6. // message to be signed
  7. msg := new(big.Int).SetBytes([]byte("test"))
  8. // create new signer
  9. signerPrivateData := blindsecp256k1.NewSigner()
  10. signerPublicData := signerPrivateData.PublicData()
  11. // user blinds the msg
  12. msgBlinded, user := blindsecp256k1.Blind(msg, signerPublicData)
  13. // signer signs the blinded message
  14. sBlind := signerPrivateData.BlindSign(msgBlinded)
  15. // user unblinds the blinded signature
  16. sig := blindsecp256k1.Unblind(sBlind, msg, user)
  17. // signature can be verified with signer PublicKey
  18. verified := blindsecp256k1.Verify(msg, sig, signerPublicData.Q)
  19. assert.True(t, verified)
  20. ```
  21. ## WASM usage
  22. WASM 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.