forked from TrueCloudLab/frostfs-node
Alex Vanin
20de74a505
Due to source code relocation from GitHub. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
19 lines
549 B
Go
19 lines
549 B
Go
package internal
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
|
)
|
|
|
|
// 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
|
|
}
|