diff --git a/internal/service/api/handlers/verify.go b/internal/service/api/handlers/verify.go index 2b896c2..2913a00 100644 --- a/internal/service/api/handlers/verify.go +++ b/internal/service/api/handlers/verify.go @@ -10,6 +10,7 @@ import ( providers "github.com/rarimo/kyc-service/internal/service/core/identity_providers" "github.com/rarimo/kyc-service/internal/service/core/identity_providers/civic" gcpsp "github.com/rarimo/kyc-service/internal/service/core/identity_providers/gitcoin_passport" + "github.com/rarimo/kyc-service/internal/service/core/identity_providers/kleros" "github.com/rarimo/kyc-service/internal/service/core/identity_providers/worldcoin" "github.com/rarimo/kyc-service/internal/data" @@ -69,5 +70,6 @@ func isUnauthorizedError(err error) bool { errors.Is(err, providers.ErrNonceNotFound) || errors.Is(err, worldcoin.ErrNotLikelyHuman) || errors.Is(err, gcpsp.ErrScoreIsTooLow) || - errors.Is(err, civic.ErrInvalidGatewayToken) + errors.Is(err, civic.ErrInvalidGatewayToken) || + errors.Is(err, kleros.ErrIsNotRegistered) } diff --git a/internal/service/core/identity_providers/kleros/main.go b/internal/service/core/identity_providers/kleros/main.go index c5911ca..7667e77 100644 --- a/internal/service/core/identity_providers/kleros/main.go +++ b/internal/service/core/identity_providers/kleros/main.go @@ -2,22 +2,22 @@ package kleros import ( "encoding/json" - cryptoPkg "github.com/ethereum/go-ethereum/crypto" - "github.com/rarimo/kyc-service/internal/config" - "github.com/rarimo/kyc-service/internal/crypto" - "github.com/rarimo/kyc-service/internal/service/core/identity_providers/kleros/contracts" "time" "github.com/ethereum/go-ethereum/common" + cryptoPkg "github.com/ethereum/go-ethereum/crypto" "gitlab.com/distributed_lab/logan/v3" "gitlab.com/distributed_lab/logan/v3/errors" + "github.com/rarimo/kyc-service/internal/config" + "github.com/rarimo/kyc-service/internal/crypto" "github.com/rarimo/kyc-service/internal/data" providers "github.com/rarimo/kyc-service/internal/service/core/identity_providers" + "github.com/rarimo/kyc-service/internal/service/core/identity_providers/kleros/contracts" "github.com/rarimo/kyc-service/internal/service/core/issuer" ) -type Kleros struct { // TODO? +type Kleros struct { logger *logan.Entry masterQ data.MasterQ proofOfHumanityContract *contracts.ProofOfHumanity @@ -113,7 +113,7 @@ func (k *Kleros) checkIfIsRegistered(userAddress common.Address) error { return errors.Wrap(err, "failed to call isRegistered contract method") } if !isRegistered { - return errors.New("user is not registered") + return ErrIsNotRegistered } return nil } diff --git a/internal/service/core/identity_providers/kleros/models.go b/internal/service/core/identity_providers/kleros/models.go index af9dd04..7a00972 100644 --- a/internal/service/core/identity_providers/kleros/models.go +++ b/internal/service/core/identity_providers/kleros/models.go @@ -3,10 +3,14 @@ package kleros import ( "github.com/ethereum/go-ethereum/common" validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/pkg/errors" + "github.com/rarimo/kyc-service/internal/service/api/requests" "github.com/rarimo/kyc-service/resources" ) +var ErrIsNotRegistered = errors.New("user is not registered") + type ( // VerificationData is a data that is required by Kleros to verify a user VerificationData resources.KlerosData