Airat Arifullin
9b13a18aac
* Update version within go.mod; * Fix deprecated frostfs-api-go/v2 package and use frostfs-sdk-go/api instead. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
20 lines
552 B
Go
20 lines
552 B
Go
package internal
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
|
)
|
|
|
|
// VerifyResponseKeyV2 checks if response is signed with expected key. Returns client.ErrWrongPublicKey if not.
|
|
func VerifyResponseKeyV2(expectedKey []byte, resp interface {
|
|
GetVerificationHeader() *session.ResponseVerificationHeader
|
|
},
|
|
) error {
|
|
if !bytes.Equal(resp.GetVerificationHeader().GetBodySignature().GetKey(), expectedKey) {
|
|
return client.ErrWrongPublicKey
|
|
}
|
|
|
|
return nil
|
|
}
|