neofs: drop WIF() from Credentials

It's never used and never needs to be used, the key shouldn't be exported from
the gate.
This commit is contained in:
Roman Khimov 2021-04-14 22:59:12 +03:00 committed by Roman Khimov
parent c06a3137e5
commit 0d21ca382f

View file

@ -13,7 +13,6 @@ import (
type ( type (
// Credentials contains methods that needed to work with NeoFS. // Credentials contains methods that needed to work with NeoFS.
Credentials interface { Credentials interface {
WIF() string
Owner() *owner.ID Owner() *owner.ID
PublicKey() *ecdsa.PublicKey PublicKey() *ecdsa.PublicKey
PrivateKey() *ecdsa.PrivateKey PrivateKey() *ecdsa.PrivateKey
@ -22,7 +21,6 @@ type (
credentials struct { credentials struct {
key *ecdsa.PrivateKey key *ecdsa.PrivateKey
ownerID *owner.ID ownerID *owner.ID
wif string
} }
) )
@ -70,20 +68,11 @@ func (c *credentials) Owner() *owner.ID {
return c.ownerID return c.ownerID
} }
// WIF returns string representation of WIF.
func (c *credentials) WIF() string {
return c.wif
}
func setFromPrivateKey(key *ecdsa.PrivateKey) (*credentials, error) { func setFromPrivateKey(key *ecdsa.PrivateKey) (*credentials, error) {
wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ownerID := owner.NewIDFromNeo3Wallet(wallet) ownerID := owner.NewIDFromNeo3Wallet(wallet)
wif, err := crypto.WIFEncode(key) return &credentials{key: key, ownerID: ownerID}, nil
if err != nil {
return nil, err
}
return &credentials{key: key, ownerID: ownerID, wif: wif}, nil
} }