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.

36 lines
1.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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. // signer: create new signer key pair
  7. sk := NewPrivateKey()
  8. signerPubK := sk.Public()
  9. // signer: when user requests new R parameter to blind a new msg,
  10. // create new signerR (public) with its secret k
  11. k, signerR := NewRequestParameters()
  12. // user: blinds the msg using signer's R
  13. msg := new(big.Int).SetBytes([]byte("test"))
  14. msgBlinded, userSecretData, err := Blind(msg, signerR)
  15. require.Nil(t, err)
  16. // signer: signs the blinded message using its private key & secret k
  17. sBlind, err := sk.BlindSign(msgBlinded, k)
  18. require.Nil(t, err)
  19. // user: unblinds the blinded signature
  20. sig := Unblind(sBlind, userSecretData)
  21. // signature can be verified with signer PublicKey
  22. verified := Verify(msg, sig, signerPubK)
  23. assert.True(t, verified)
  24. ```
  25. ## WASM usage
  26. 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.