github.com/consensys/gnark-crypto@v0.14.0/signature/eddsa/eddsa.go (about)

     1  /*
     2  Copyright © 2020 ConsenSys
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package eddsa
    18  
    19  import (
    20  	"io"
    21  
    22  	eddsa_bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377/twistededwards/eddsa"
    23  	eddsa_bls12378 "github.com/consensys/gnark-crypto/ecc/bls12-378/twistededwards/eddsa"
    24  	eddsa_bls12381_bandersnatch "github.com/consensys/gnark-crypto/ecc/bls12-381/bandersnatch/eddsa"
    25  	eddsa_bls12381 "github.com/consensys/gnark-crypto/ecc/bls12-381/twistededwards/eddsa"
    26  	eddsa_bls24315 "github.com/consensys/gnark-crypto/ecc/bls24-315/twistededwards/eddsa"
    27  	eddsa_bls24317 "github.com/consensys/gnark-crypto/ecc/bls24-317/twistededwards/eddsa"
    28  	eddsa_bn254 "github.com/consensys/gnark-crypto/ecc/bn254/twistededwards/eddsa"
    29  	eddsa_bw6633 "github.com/consensys/gnark-crypto/ecc/bw6-633/twistededwards/eddsa"
    30  	eddsa_bw6756 "github.com/consensys/gnark-crypto/ecc/bw6-756/twistededwards/eddsa"
    31  	eddsa_bw6761 "github.com/consensys/gnark-crypto/ecc/bw6-761/twistededwards/eddsa"
    32  	"github.com/consensys/gnark-crypto/ecc/twistededwards"
    33  	"github.com/consensys/gnark-crypto/signature"
    34  )
    35  
    36  // New takes a source of randomness and returns a new key pair
    37  func New(ss twistededwards.ID, r io.Reader) (signature.Signer, error) {
    38  	switch ss {
    39  	case twistededwards.BN254:
    40  		return eddsa_bn254.GenerateKey(r)
    41  	case twistededwards.BLS12_381:
    42  		return eddsa_bls12381.GenerateKey(r)
    43  	case twistededwards.BLS12_381_BANDERSNATCH:
    44  		return eddsa_bls12381_bandersnatch.GenerateKey(r)
    45  	case twistededwards.BLS12_377:
    46  		return eddsa_bls12377.GenerateKey(r)
    47  	case twistededwards.BLS12_378:
    48  		return eddsa_bls12378.GenerateKey(r)
    49  	case twistededwards.BW6_761:
    50  		return eddsa_bw6761.GenerateKey(r)
    51  	case twistededwards.BW6_756:
    52  		return eddsa_bw6756.GenerateKey(r)
    53  	case twistededwards.BLS24_315:
    54  		return eddsa_bls24315.GenerateKey(r)
    55  	case twistededwards.BLS24_317:
    56  		return eddsa_bls24317.GenerateKey(r)
    57  	case twistededwards.BW6_633:
    58  		return eddsa_bw6633.GenerateKey(r)
    59  	default:
    60  		panic("not implemented")
    61  	}
    62  }