Skip to content

Commit

Permalink
Merge pull request #7 from rarimo/refactor/rename-kyc
Browse files Browse the repository at this point in the history
Refаctor: rename all 'kyc' occurrences to 'humanornot'
  • Loading branch information
artemskriabin authored Apr 11, 2024
2 parents deb4dd4 + efb29dd commit dd5490a
Show file tree
Hide file tree
Showing 58 changed files with 220 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build KYC service docker image
name: Build Humanornot service docker image
on:
workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/actions_onlymain.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build KYC service docker image
name: Build Humanornot service docker image
on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build KYC service docker image
name: Build Humanornot service docker image
on:
push:
tags:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ FROM golang:1.19-alpine as buildbase

RUN apk add git build-base

WORKDIR /go/src/github.com/rarimo/kyc-service
WORKDIR /go/src/github.com/rarimo/humanornot-svc
COPY vendor .
COPY . .

RUN GOOS=linux go build -o /usr/local/bin/kyc-service /go/src/github.com/rarimo/kyc-service
RUN GOOS=linux go build -o /usr/local/bin/humanornot-svc /go/src/github.com/rarimo/humanornot-svc


FROM alpine:3.9

COPY --from=buildbase /usr/local/bin/kyc-service /usr/local/bin/kyc-service
COPY --from=buildbase /usr/local/bin/humanornot-svc /usr/local/bin/humanornot-svc
RUN apk add --no-cache ca-certificates

ENTRYPOINT ["kyc-service"]
ENTRYPOINT ["humanornot-svc"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# kyc-service
# humanornot-svc

## Description

Expand All @@ -15,8 +15,8 @@ Integrated identity provider:
## Install

```
git clone github.com/rarimo/kyc-service
cd kyc-service
git clone github.com/rarimo/humanornot-svc
cd humanornot-svc
go build main.go
export KV_VIPER_FILE=./config.yaml
./main migrate up
Expand Down Expand Up @@ -47,8 +47,8 @@ Make sure that docker installed.
use `docker run ` with `-p 8080:80` to expose port 80 to 8080

```
docker build -t github.com/rarimo/kyc-service .
docker run -e KV_VIPER_FILE=/config.yaml github.com/rarimo/kyc-service
docker build -t github.com/rarimo/humanornot-svc .
docker run -e KV_VIPER_FILE=/config.yaml github.com/rarimo/humanornot-svc
```

## Running from Source
Expand Down
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ kleros:
eth_rpc_url:
proof_of_humanity_contract:

kyc_service:
humanornot_svc:
nonce_life_time: 30m

cop:
disabled: true
endpoint: "http://..."
upstream: "http://..."
service_name: kyc-service
service_name: humanornot-svc
service_port: 80
2 changes: 1 addition & 1 deletion docs/.redoclyrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

apiTitle: kyc-service
apiTitle: humanornot-svc
splitSpec: true
codeSamples: false
swaggerUI: true
Expand Down
4 changes: 2 additions & 2 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "kyc-service",
"name": "humanornot-svc",
"version": "1.0.0",
"dependencies": {
"@tokend/redoc-cli": "^0.9.9",
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/components/schemas/VerifyStatus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ allOf:
description: Verification status of the account.
claim_id:
type: string
description: KYC claim ID.
description: Humanornot claim ID.
2 changes: 1 addition & 1 deletion docs/spec/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
openapi: 3.0.0
info:
version: 1.0.0
title: kyc-service
title: humanornot-svc
description: ''
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ post:
'400':
description: Bad request
'401':
description: Unauthorized. KYC failed
description: Unauthorized. Humanornot failed to check humanity.
content:
application/json:
schema:
Expand Down
2 changes: 1 addition & 1 deletion docs/web/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="utf8" />
<title>kyc-service Service Documentation</title>
<title>humanornot-svc Service Documentation</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
Expand Down
2 changes: 1 addition & 1 deletion docs/web/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>kyc-service | ReDoc</title>
<title>humanornot-svc | ReDoc</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="favicon.png">
Expand Down
4 changes: 2 additions & 2 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
GENERATOR_IMAGE=registry.gitlab.com/tokend/openapi-go-generator:69f004b58152c83f007b593cc13e94b81d7200da


GENERATED="${GOPATH}/src/github.com/rarimo/kyc-service/resources"
OPENAPI_DIR="${GOPATH}/src/github.com/rarimo/kyc-service/docs/web_deploy"
GENERATED="${GOPATH}/src/github.com/rarimo/humanornot-svc/resources"
OPENAPI_DIR="${GOPATH}/src/github.com/rarimo/humanornot-svc/docs/web_deploy"
PACKAGE_NAME=resources

function printHelp {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/rarimo/kyc-service
module github.com/rarimo/humanornot-svc

go 1.21

Expand Down
8 changes: 4 additions & 4 deletions internal/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"sync"
"syscall"

nonceCleaner "github.com/rarimo/kyc-service/internal/service/nonce_cleaner"
nonceCleaner "github.com/rarimo/humanornot-svc/internal/service/nonce_cleaner"

"github.com/alecthomas/kingpin"
"gitlab.com/distributed_lab/kit/kv"
"gitlab.com/distributed_lab/logan/v3"

"github.com/rarimo/kyc-service/internal/config"
"github.com/rarimo/kyc-service/internal/service/api"
"github.com/rarimo/humanornot-svc/internal/config"
"github.com/rarimo/humanornot-svc/internal/service/api"
)

func Run(args []string) bool {
Expand All @@ -29,7 +29,7 @@ func Run(args []string) bool {
cfg := config.New(kv.MustFromEnv())
log = cfg.Log()

app := kingpin.New("kyc-service", "")
app := kingpin.New("humanornot-svc", "")

runCmd := app.Command("run", "run command")
serviceCmd := runCmd.Command("service", "run service")
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
migrate "github.com/rubenv/sql-migrate"
"gitlab.com/distributed_lab/logan/v3/errors"

"github.com/rarimo/kyc-service/internal/assets"
"github.com/rarimo/kyc-service/internal/config"
"github.com/rarimo/humanornot-svc/internal/assets"
"github.com/rarimo/humanornot-svc/internal/config"
)

var migrations = &migrate.EmbedFileSystemMigrationSource{
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cli
import (
"context"

"github.com/rarimo/kyc-service/internal/config"
"github.com/rarimo/humanornot-svc/internal/config"
)

type (
Expand Down
12 changes: 6 additions & 6 deletions internal/config/kyc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import (
"gitlab.com/distributed_lab/kit/kv"
)

type KYCService struct {
type HumanornotSvc struct {
NonceLifeTime time.Duration `fig:"nonce_life_time,required"`
}

func (c *config) KYCService() *KYCService {
return c.kycService.Do(func() interface{} {
cfg := KYCService{}
func (c *config) HumanornotSvc() *HumanornotSvc {
return c.humanOrNotSvc.Do(func() interface{} {
cfg := HumanornotSvc{}
err := figure.
Out(&cfg).
From(kv.MustGetStringMap(c.getter, "kyc_service")).
From(kv.MustGetStringMap(c.getter, "humanornot_svc")).
Please()
if err != nil {
panic(errors.Wrap(err, "failed to figure out"))
}

return &cfg
}).(*KYCService)
}).(*HumanornotSvc)
}
4 changes: 2 additions & 2 deletions internal/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Config interface {
GitcoinPassportSettings() *GitcoinPassportSettings
Kleros() *Kleros
Issuer() *Issuer
KYCService() *KYCService
HumanornotSvc() *HumanornotSvc
}

type config struct {
Expand All @@ -36,7 +36,7 @@ type config struct {
worldcoinSettings comfig.Once
kleros comfig.Once
issuer comfig.Once
kycService comfig.Once
humanOrNotSvc comfig.Once
}

func New(getter kv.Getter) Config {
Expand Down
2 changes: 1 addition & 1 deletion internal/data/pg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pg
import (
"gitlab.com/distributed_lab/kit/pgdb"

"github.com/rarimo/kyc-service/internal/data"
"github.com/rarimo/humanornot-svc/internal/data"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/data/pg/nonces.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/ethereum/go-ethereum/common"

"github.com/rarimo/kyc-service/internal/data"
"github.com/rarimo/humanornot-svc/internal/data"

sq "github.com/Masterminds/squirrel"
"github.com/fatih/structs"
Expand Down
2 changes: 1 addition & 1 deletion internal/data/pg/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"

"github.com/rarimo/kyc-service/internal/data"
"github.com/rarimo/humanornot-svc/internal/data"
)

type usersQ struct {
Expand Down
12 changes: 6 additions & 6 deletions internal/service/api/handlers/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (

"gitlab.com/distributed_lab/logan/v3"

"github.com/rarimo/kyc-service/internal/service/core"
"github.com/rarimo/humanornot-svc/internal/service/core"
)

type ctxKey int

const (
logCtxKey ctxKey = iota
kycServiceCtxKey
humanOrNotServiceCtxKey
)

func CtxLog(entry *logan.Entry) func(context.Context) context.Context {
Expand All @@ -26,12 +26,12 @@ func Log(r *http.Request) *logan.Entry {
return r.Context().Value(logCtxKey).(*logan.Entry)
}

func CtxKYCService(kycService core.KYCService) func(context.Context) context.Context {
func CtxHumanornotSvc(humanOrNotSvc core.HumanornotSvc) func(context.Context) context.Context {
return func(ctx context.Context) context.Context {
return context.WithValue(ctx, kycServiceCtxKey, kycService)
return context.WithValue(ctx, humanOrNotServiceCtxKey, humanOrNotSvc)
}
}

func KYCService(r *http.Request) core.KYCService {
return r.Context().Value(kycServiceCtxKey).(core.KYCService).New()
func HumanornotSvc(r *http.Request) core.HumanornotSvc {
return r.Context().Value(humanOrNotServiceCtxKey).(core.HumanornotSvc).New()
}
8 changes: 4 additions & 4 deletions internal/service/api/handlers/get_provider_by_identity_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"net/http"

"github.com/pkg/errors"
"github.com/rarimo/kyc-service/internal/service/api/requests"
identityproviders "github.com/rarimo/kyc-service/internal/service/core/identity_providers"
"github.com/rarimo/kyc-service/resources"
"github.com/rarimo/humanornot-svc/internal/service/api/requests"
identityproviders "github.com/rarimo/humanornot-svc/internal/service/core/identity_providers"
"github.com/rarimo/humanornot-svc/resources"
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/ape/problems"
)
Expand All @@ -19,7 +19,7 @@ func GetProviderByIdentityId(w http.ResponseWriter, r *http.Request) {
return
}

provider, err := KYCService(r).GetProviderByIdentityId(req)
provider, err := HumanornotSvc(r).GetProviderByIdentityId(req)
switch {
case errors.Is(err, identityproviders.ErrProviderNotFound), errors.Is(err, identityproviders.ErrUserNotFound):
Log(r).WithField("reason", err).Debug("Not found")
Expand Down
6 changes: 3 additions & 3 deletions internal/service/api/handlers/nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/ape/problems"

"github.com/rarimo/kyc-service/internal/service/api/requests"
"github.com/rarimo/kyc-service/internal/service/api/responses"
"github.com/rarimo/humanornot-svc/internal/service/api/requests"
"github.com/rarimo/humanornot-svc/internal/service/api/responses"
)

func GetNonce(w http.ResponseWriter, r *http.Request) {
Expand All @@ -17,7 +17,7 @@ func GetNonce(w http.ResponseWriter, r *http.Request) {
return
}

nonce, err := KYCService(r).NewNonce(req)
nonce, err := HumanornotSvc(r).NewNonce(req)
switch {
case err != nil:
Log(r).WithError(err).Error("Failed to create new nonce")
Expand Down
20 changes: 10 additions & 10 deletions internal/service/api/handlers/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"gitlab.com/distributed_lab/ape"
"gitlab.com/distributed_lab/ape/problems"

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"
providers "github.com/rarimo/humanornot-svc/internal/service/core/identity_providers"
"github.com/rarimo/humanornot-svc/internal/service/core/identity_providers/civic"
gcpsp "github.com/rarimo/humanornot-svc/internal/service/core/identity_providers/gitcoin_passport"
"github.com/rarimo/humanornot-svc/internal/service/core/identity_providers/kleros"
"github.com/rarimo/humanornot-svc/internal/service/core/identity_providers/worldcoin"

"github.com/rarimo/kyc-service/internal/data"
"github.com/rarimo/kyc-service/internal/service/api/requests"
"github.com/rarimo/kyc-service/internal/service/api/responses"
"github.com/rarimo/kyc-service/internal/service/core"
"github.com/rarimo/humanornot-svc/internal/data"
"github.com/rarimo/humanornot-svc/internal/service/api/requests"
"github.com/rarimo/humanornot-svc/internal/service/api/responses"
"github.com/rarimo/humanornot-svc/internal/service/core"
)

func Verify(w http.ResponseWriter, r *http.Request) {
Expand All @@ -27,7 +27,7 @@ func Verify(w http.ResponseWriter, r *http.Request) {
return
}

user, err := KYCService(r).NewVerifyRequest(req)
user, err := HumanornotSvc(r).NewVerifyRequest(req)
switch {
case errors.Is(err, providers.ErrInvalidVerificationData):
Log(r).WithField("reason", err).
Expand Down
Loading

0 comments on commit dd5490a

Please sign in to comment.