forked from TrueCloudLab/frostfs-sdk-go
[#351] Add StringifyPublicKey method for NodeInfo
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
d2f3929b51
commit
21eef1ae7f
2 changed files with 15 additions and 0 deletions
9
crypto/util.go
Normal file
9
crypto/util.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
package neofscrypto
|
||||||
|
|
||||||
|
import "encoding/hex"
|
||||||
|
|
||||||
|
// StringifyKeyBinary returns string with HEX representation of source.
|
||||||
|
// Format can be changed and it's unsafe to rely on it beyond human-readable output.
|
||||||
|
func StringifyKeyBinary(src []byte) string {
|
||||||
|
return hex.EncodeToString(src)
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"github.com/nspcc-dev/hrw"
|
"github.com/nspcc-dev/hrw"
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||||
|
neofscrypto "github.com/nspcc-dev/neofs-sdk-go/crypto"
|
||||||
subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id"
|
subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -178,6 +179,11 @@ func (x NodeInfo) PublicKey() []byte {
|
||||||
return x.m.GetPublicKey()
|
return x.m.GetPublicKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StringifyPublicKey returns HEX representation of PublicKey.
|
||||||
|
func StringifyPublicKey(node NodeInfo) string {
|
||||||
|
return neofscrypto.StringifyKeyBinary(node.PublicKey())
|
||||||
|
}
|
||||||
|
|
||||||
// SetNetworkEndpoints sets list to the announced node's network endpoints.
|
// SetNetworkEndpoints sets list to the announced node's network endpoints.
|
||||||
// Node MUSt have at least one announced endpoint. List MUST be unique.
|
// Node MUSt have at least one announced endpoint. List MUST be unique.
|
||||||
// Endpoints are used for communication with the storage node within NeoFS
|
// Endpoints are used for communication with the storage node within NeoFS
|
||||||
|
|
Loading…
Reference in a new issue