github.com/ronperry/cryptoedge@v0.0.0-20150815114006-cc363e290743/singhdas/interface_test.go (about)

     1  package singhdas
     2  
     3  import (
     4  	"crypto/elliptic"
     5  	"crypto/rand"
     6  	"github.com/ronperry/cryptoedge/eccutil"
     7  	"github.com/ronperry/cryptoedge/genericblinding"
     8  	"testing"
     9  )
    10  
    11  func GetParams(blindingServer genericblinding.BlindingServer) (genericblinding.BlindingParamClient, genericblinding.BlindingParamServer, error) {
    12  	bpc, bps, err := blindingServer.GetParams()
    13  	return bpc.(BlindingParamClient), bps.(BlindingParamServer), err
    14  	//return blindingServer.GetParams()
    15  }
    16  
    17  func Test_Interface(t *testing.T) {
    18  	c := eccutil.SetCurve(elliptic.P256, rand.Reader, eccutil.Sha1Hash)
    19  	privkey, pubkey, err := c.GenerateKey()
    20  	if err != nil {
    21  		t.Fatalf("Error creating keys: %s", err)
    22  	}
    23  	signer := NewGenericBlindingServer(privkey, pubkey, c)
    24  	clientParams, serverParams, err := GetParams(signer)
    25  	if err != nil {
    26  		t.Fatalf("Error GetParams: %s", err)
    27  	}
    28  	_, _ = clientParams, serverParams
    29  }
    30  
    31  // // does not implement wrong type for method