Skip to content

Commit

Permalink
modify for supporting removed keyGenOpt function in Key interface
Browse files Browse the repository at this point in the history
  • Loading branch information
owljoa committed Oct 13, 2018
1 parent e1343db commit 57a097b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 16 deletions.
1 change: 0 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type PeerInfo struct {
IP string
PubKeyBytes []byte
IsPrivate bool
KeyGenOpt string
MetaData map[string]string
}

Expand Down
12 changes: 1 addition & 11 deletions mocks/mock_key_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,9 @@ func (recoverer *MockECDSAKeyRecoverer) RecoverKeyFromByte(keyBytes []byte, isPr
return nil, errors.New("isPrivateKey value should be true or false")
}

func curveFromString(keyGenOpt string) elliptic.Curve {
switch keyGenOpt {
case "P-384":
return elliptic.P384()
}
return nil
}

type mockKeyFile struct {
KeyBytes []byte
IsPrivateKey bool
KeyGenOpt string
}

func MockStoreKey(key bifrost.Key, keyDirPath string) error {
Expand All @@ -175,10 +166,9 @@ func MockStoreKey(key bifrost.Key, keyDirPath string) error {
// byte formatted key
keyBytes := key.ToByte()
isPrivateKey := key.IsPrivate()
keyGenOpt := key.KeyGenOpt()

// make json marshal
jsonKeyFile, err := json.Marshal(mockKeyFile{KeyBytes: keyBytes, IsPrivateKey: isPrivateKey, KeyGenOpt: keyGenOpt})
jsonKeyFile, err := json.Marshal(mockKeyFile{KeyBytes: keyBytes, IsPrivateKey: isPrivateKey})
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion server/server_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func TestServer_validateRequestPeerInfo_whenInValidPeerInfo(t *testing.T) {
IP: "127.0.0.1",
PubKeyBytes: []byte("123"),
IsPrivate: false,
KeyGenOpt: "P-384",
}

keyOpt := bifrost.KeyOpts{
Expand Down
2 changes: 0 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func TestServer_validateRequestPeerInfo_whenValidPeerInfo(t *testing.T) {
IP: "127.0.0.1",
PubKeyBytes: keyOpt.PubKey.ToByte(),
IsPrivate: keyOpt.PubKey.IsPrivate(),
KeyGenOpt: keyOpt.PubKey.KeyGenOpt(),
}

mockServer := mocks.NewMockServer()
Expand Down Expand Up @@ -49,7 +48,6 @@ func TestServer_BifrostStream(t *testing.T) {
IP: "127.0.0.1",
PubKeyBytes: keyOpt.PubKey.ToByte(),
IsPrivate: keyOpt.PubKey.IsPrivate(),
KeyGenOpt: keyOpt.PubKey.KeyGenOpt(),
}

mockStreamServer := mocks.NewMockStreamServer(*peerInfo)
Expand Down
1 change: 0 additions & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func BuildResponsePeerInfo(pubKey Key, metaData map[string]string) (*pb.Envelope
pi := &PeerInfo{
PubKeyBytes: b,
IsPrivate: pubKey.IsPrivate(),
KeyGenOpt: pubKey.KeyGenOpt(),
MetaData: metaData,
}

Expand Down

0 comments on commit 57a097b

Please sign in to comment.