Skip to content

Commit

Permalink
update id and idType for identity and global messages
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroga committed Aug 23, 2024
1 parent b8b234d commit 1ffe271
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions pkg/services/blockchain/eth/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var (
var IdentityStateAPITypes = apitypes.Types{
"IdentityState": []apitypes.Type{
{Name: "timestamp", Type: "uint256"},
{Name: "userID", Type: "uint256"},
{Name: "id", Type: "uint256"},
{Name: "state", Type: "uint256"},
{Name: "replacedAtTimestamp", Type: "uint256"},
},
Expand All @@ -72,7 +72,7 @@ var IdentityStateAPITypes = apitypes.Types{
var GlobalStateAPITypes = apitypes.Types{
"GlobalState": []apitypes.Type{
{Name: "timestamp", Type: "uint256"},
{Name: "userID", Type: "uint256"},
{Name: "idType", Type: "bytes2"},
{Name: "root", Type: "uint256"},
{Name: "replacedAtTimestamp", Type: "uint256"},
},
Expand Down Expand Up @@ -288,7 +288,8 @@ func (r *Resolver) TypedData(primaryType services.PrimaryType, did w3c.DID, iden
return apitypes.TypedData{},
fmt.Errorf("invalid did format for did '%s': %v", did, err)
}
userID := id.BigInt().String()
ID := id.BigInt().String()
idType := fmt.Sprintf("0x%02X%02X", id.Type()[0], id.Type()[1])

root := "0"
state := "0"
Expand All @@ -314,7 +315,7 @@ func (r *Resolver) TypedData(primaryType services.PrimaryType, did w3c.DID, iden
apiTypes = IdentityStateAPITypes
message = apitypes.TypedDataMessage{
"timestamp": timestamp,
"userID": userID,
"id": ID,
"state": state,
"replacedAtTimestamp": replacedAtTimestamp,
}
Expand All @@ -323,7 +324,7 @@ func (r *Resolver) TypedData(primaryType services.PrimaryType, did w3c.DID, iden
apiTypes = GlobalStateAPITypes
message = apitypes.TypedDataMessage{
"timestamp": timestamp,
"userID": userID,
"idType": idType,
"root": root,
"replacedAtTimestamp": replacedAtTimestamp,
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/services/blockchain/eth/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestResolveSignature_Success(t *testing.T) {
ReplacedByRoot: big.NewInt(0),
ReplacedAtTimestamp: big.NewInt(0),
},
Signature: "0xc3dd18cd87c75fe225a569473f822daf66eed38f6e81dfc6766f4c35f1610ad96c546812eb416cd29f30098e5e9e38db78c4887db517f0569762e9f62227154d1b",
Signature: "0x388e838580e95a771a10806ea1514ab441e9f598ccca01899dea8541411a631c1d67525c652b1662c51547ea0aad445bc4e9d0fc3d41802221e66b0f534526841b",
},
},
{
Expand All @@ -279,7 +279,7 @@ func TestResolveSignature_Success(t *testing.T) {
ReplacedAtTimestamp: big.NewInt(0),
},
GistInfo: nil,
Signature: "0xc373a5a9df5c9227af61724bccaacffb117bf96437d9d7c41aff9be9f7662890716f2254dfc750b3768f2afa45843b53a8139264aa79626f4ad351f9390321841c",
Signature: "0x3bf7344312b0ef482974de45c722fbd431316b0bc42bd1050b5cb7bbe53034c51aa885d72c6cd958bdc3b46fc247f38b67c03767d98ba815ae3d8c33aac7398c1c",
},
},
{
Expand Down Expand Up @@ -314,7 +314,7 @@ func TestResolveSignature_Success(t *testing.T) {
ReplacedByRoot: big.NewInt(0),
ReplacedAtTimestamp: big.NewInt(0),
},
Signature: "0xc373a5a9df5c9227af61724bccaacffb117bf96437d9d7c41aff9be9f7662890716f2254dfc750b3768f2afa45843b53a8139264aa79626f4ad351f9390321841c",
Signature: "0x3bf7344312b0ef482974de45c722fbd431316b0bc42bd1050b5cb7bbe53034c51aa885d72c6cd958bdc3b46fc247f38b67c03767d98ba815ae3d8c33aac7398c1c",
},
},
}
Expand Down

0 comments on commit 1ffe271

Please sign in to comment.