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 {
|
if payload.PeerId != peerId {
|
||||||
return errReceiptPeerIdIncorrect
|
return errReceiptPeerIdIncorrect
|
||||||
}
|
}
|
||||||
protoIdentity, err := crypto.UnmarshalEd25519PublicKeyProto(payload.AccountIdentity)
|
protoRaw, err := crypto.UnmarshalEd25519PublicKeyProto(payload.AccountIdentity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
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
|
return errReceiptAccountIncorrect
|
||||||
}
|
}
|
||||||
err = checkCoordinator(
|
err = checkCoordinator(
|
||||||
|
|||||||
@ -24,16 +24,16 @@ type fixture struct {
|
|||||||
func newFixture(t *testing.T) *fixture {
|
func newFixture(t *testing.T) *fixture {
|
||||||
coordinatorKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
coordinatorKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
signKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
accountKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
signKeyRaw, err := signKey.GetPublic().Raw()
|
accountKeyProto, err := accountKey.GetPublic().Marshall()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
return &fixture{
|
return &fixture{
|
||||||
spaceId: "spaceId",
|
spaceId: "spaceId",
|
||||||
peerId: "peerId",
|
peerId: "peerId",
|
||||||
accountIdentity: signKeyRaw,
|
accountIdentity: accountKeyProto,
|
||||||
coordinatorKey: coordinatorKey,
|
coordinatorKey: coordinatorKey,
|
||||||
accountKey: signKey.GetPublic(),
|
accountKey: accountKey.GetPublic(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user