2021-09-28 06:02:02 +00:00
|
|
|
package internal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-api-go/v2/session"
|
|
|
|
"github.com/TrueCloudLab/frostfs-node/pkg/core/client"
|
2021-09-28 06:02:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|