[#30] add object name resolving
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
37dbb29535
commit
8c3c3782f5
17 changed files with 507 additions and 42 deletions
29
internal/frostfs/services/tree_client_grpc_signature.go
Normal file
29
internal/frostfs/services/tree_client_grpc_signature.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*REMOVE THIS AFTER SIGNATURE WILL BE AVAILABLE IN TREE CLIENT FROM FROSTFS NODE*/
|
||||
package services
|
||||
|
||||
import (
|
||||
crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (c *ServiceClientGRPC) signData(buf []byte, f func(key, sign []byte)) error {
|
||||
// crypto package should not be used outside of API libraries (see neofs-node#491).
|
||||
// For now tree service does not include into SDK Client nor SDK Pool, so there is no choice.
|
||||
// When SDK library adopts Tree service client, this should be dropped.
|
||||
sign, err := crypto.Sign(&c.key.PrivateKey, buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f(c.key.PublicKey().Bytes(), sign)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ServiceClientGRPC) signRequest(requestBody proto.Message, f func(key, sign []byte)) error {
|
||||
buf, err := proto.Marshal(requestBody)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.signData(buf, f)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue