Use same format for identity
This commit is contained in:
parent
447272a1f1
commit
92ed77ab5a
@ -60,11 +60,15 @@ func CheckReceipt(peerId, spaceId string, accountIdentity []byte, coordinators [
|
||||
if payload.PeerId != peerId {
|
||||
return errReceiptPeerIdIncorrect
|
||||
}
|
||||
protoIdentity, err := crypto.UnmarshalEd25519PublicKeyProto(payload.AccountIdentity)
|
||||
protoRaw, err := crypto.UnmarshalEd25519PublicKeyProto(payload.AccountIdentity)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !bytes.Equal(protoIdentity.Storage(), accountIdentity) {
|
||||
accountRaw, err := crypto.UnmarshalEd25519PublicKeyProto(accountIdentity)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !bytes.Equal(protoRaw.Storage(), accountRaw.Storage()) {
|
||||
return errReceiptAccountIncorrect
|
||||
}
|
||||
err = checkCoordinator(
|
||||
|
||||
@ -24,16 +24,16 @@ type fixture struct {
|
||||
func newFixture(t *testing.T) *fixture {
|
||||
coordinatorKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
||||
require.NoError(t, err)
|
||||
signKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
||||
accountKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
||||
require.NoError(t, err)
|
||||
signKeyRaw, err := signKey.GetPublic().Raw()
|
||||
accountKeyProto, err := accountKey.GetPublic().Marshall()
|
||||
require.NoError(t, err)
|
||||
return &fixture{
|
||||
spaceId: "spaceId",
|
||||
peerId: "peerId",
|
||||
accountIdentity: signKeyRaw,
|
||||
accountIdentity: accountKeyProto,
|
||||
coordinatorKey: coordinatorKey,
|
||||
accountKey: signKey.GetPublic(),
|
||||
accountKey: accountKey.GetPublic(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user