From 30b97c4ef6509e06a443ed1a219929809b8ab947 Mon Sep 17 00:00:00 2001 From: daveroga Date: Wed, 24 Jul 2024 18:52:31 +0200 Subject: [PATCH] fix lint errors --- pkg/services/blockchain/eth/resolver.go | 16 ++++++++-------- pkg/services/blockchain/eth/resolver_test.go | 4 ++-- pkg/services/did.go | 4 ++-- pkg/services/registry.go | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/services/blockchain/eth/resolver.go b/pkg/services/blockchain/eth/resolver.go index 7ed4d46..2f2b9ab 100644 --- a/pkg/services/blockchain/eth/resolver.go +++ b/pkg/services/blockchain/eth/resolver.go @@ -53,7 +53,7 @@ var ( stateNotFoundException = "execution reverted: State does not exist" ) -var IdentityStateApiTypes = apitypes.Types{ +var IdentityStateAPITypes = apitypes.Types{ "IdentityState": []apitypes.Type{ {Name: "from", Type: "address"}, {Name: "timestamp", Type: "uint256"}, @@ -71,7 +71,7 @@ var IdentityStateApiTypes = apitypes.Types{ }, } -var GlobalStateApiTypes = apitypes.Types{ +var GlobalStateAPITypes = apitypes.Types{ "GlobalState": []apitypes.Type{ {Name: "from", Type: "address"}, {Name: "timestamp", Type: "uint256"}, @@ -237,9 +237,9 @@ func (r *Resolver) Resolve( signature := "" if r.walletKey != "" && opts.Signature != "" { - primaryType := services.IDENTITY_STATE_TYPE + primaryType := services.IdentityStateType if stateInfo == nil { - primaryType = services.GLOBAL_STATE_TYPE + primaryType = services.GlobalStateType } signature, err = r.signTypedData(primaryType, did, identityState) if err != nil { @@ -321,9 +321,9 @@ func (r *Resolver) TypedData(primaryType services.PrimaryType, did w3c.DID, iden timestamp := TimeStamp() switch primaryType { - case services.IDENTITY_STATE_TYPE: + case services.IdentityStateType: primaryTypeString = "IdentityState" - apiTypes = IdentityStateApiTypes + apiTypes = IdentityStateAPITypes message = apitypes.TypedDataMessage{ "from": walletAddress, "timestamp": timestamp, @@ -333,9 +333,9 @@ func (r *Resolver) TypedData(primaryType services.PrimaryType, did w3c.DID, iden "createdAtTimestamp": createdAtTimestamp, "replacedAtTimestamp": replacedAtTimestamp, } - case services.GLOBAL_STATE_TYPE: + case services.GlobalStateType: primaryTypeString = "GlobalState" - apiTypes = GlobalStateApiTypes + apiTypes = GlobalStateAPITypes message = apitypes.TypedDataMessage{ "from": walletAddress, "timestamp": timestamp, diff --git a/pkg/services/blockchain/eth/resolver_test.go b/pkg/services/blockchain/eth/resolver_test.go index 83f500b..3672139 100644 --- a/pkg/services/blockchain/eth/resolver_test.go +++ b/pkg/services/blockchain/eth/resolver_test.go @@ -363,9 +363,9 @@ func TestResolveSignature_Success(t *testing.T) { require.NoError(t, err) require.Equal(t, tt.expectedIdentityState, identityState) - primaryType := services.IDENTITY_STATE_TYPE + primaryType := services.IdentityStateType if tt.expectedIdentityState.StateInfo == nil { - primaryType = services.GLOBAL_STATE_TYPE + primaryType = services.GlobalStateType } ok, _ := resolver.VerifyState(primaryType, identityState, *tt.userDID) diff --git a/pkg/services/did.go b/pkg/services/did.go index ea75a78..d37e76c 100644 --- a/pkg/services/did.go +++ b/pkg/services/did.go @@ -142,9 +142,9 @@ func (d *DidDocumentServices) GetDidDocument(ctx context.Context, did string, op walletAddress, err := resolver.WalletAddress() if err == nil && opts.Signature != "" { - primaryType := IDENTITY_STATE_TYPE + primaryType := IdentityStateType if userDID.IDStrings[2] == "000000000000000000000000000000000000000000" { - primaryType = GLOBAL_STATE_TYPE + primaryType = GlobalStateType } eip712TypedData, err := resolver.TypedData(primaryType, *userDID, identityState, walletAddress) if err != nil { diff --git a/pkg/services/registry.go b/pkg/services/registry.go index 77c5fff..5e858a2 100644 --- a/pkg/services/registry.go +++ b/pkg/services/registry.go @@ -22,8 +22,8 @@ var ( type PrimaryType int32 const ( - IDENTITY_STATE_TYPE PrimaryType = 0 - GLOBAL_STATE_TYPE PrimaryType = 1 + IdentityStateType PrimaryType = 0 + GlobalStateType PrimaryType = 1 ) type IdentityState struct {