Skip to content

Commit

Permalink
[-] Transferred ownership to Naughty Gopher
Browse files Browse the repository at this point in the history
[minor] Refactor to change non standard field names
[minor] upgraded all dependencies
[-] ran `go mod tidy`
  • Loading branch information
bnkamalesh committed Oct 1, 2024
1 parent b3d6902 commit 74f3077
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 193 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Kamaleshwar BN
Copyright (c) 2024 Naughty Gopher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<p align="center"><img src="https://repository-images.githubusercontent.com/214951539/5b1d4880-be23-11ea-956f-13b099260266" alt="verifier gopher" width="256px"/></p>


[![](https://travis-ci.org/bnkamalesh/verifier.svg?branch=master)](https://travis-ci.org/bnkamalesh/verifier)
[![coverage](https://img.shields.io/codecov/c/github/bnkamalesh/verifier.svg)](https://codecov.io/gh/bnkamalesh/verifier)
[![](https://goreportcard.com/badge/github.com/bnkamalesh/verifier)](https://goreportcard.com/report/github.com/bnkamalesh/verifier)
[![Maintainability](https://api.codeclimate.com/v1/badges/46f26b25639d09d0419d/maintainability)](https://codeclimate.com/github/bnkamalesh/verifier/maintainability)
[![](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/bnkamalesh/verifier)
[![](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/naughtygopher/verifier)

# Verifier v0.1.0

Verifier package lets you verify emails & phone numbers, with customization available at different components. There's a functional (if provided with valid configurations) sample app provided [here](https://github.com/bnkamalesh/verifier/blob/master/cmd/main.go).
Verifier package lets you verify emails & phone numbers, with customization available at different components. There's a functional (if provided with valid configurations) sample app provided [here](https://github.com/naughtygopher/verifier/blob/master/cmd/main.go).

## How does it work?

Verifier generates secrets with an expiry, appropriate for emails & mobile phones. In case of emails,
Verifier generates secrets with an expiry, appropriate for emails & mobile phones. In case of emails,
it generates a 256 character long random alpha-numeric string, and a 6 character long numeric string
for mobile phones.

Expand All @@ -24,7 +19,7 @@ By default, it uses [AWS SES](https://aws.amazon.com/ses/) for sending e-mails &
You can customize the following components of verifier.

```golang

// Customize the default templates
// there should be 2 string placeholders for email body. First is the 'callback URL' and 2nd is the expiry
verifier.DefaultEmailOTPPayload = ``
Expand All @@ -37,7 +32,7 @@ You can customize the following components of verifier.
log.Println(err)
return
}

// Service provider for sending emails
err := v.CustomEmailHandler(email)
if err != nil {
Expand All @@ -53,7 +48,7 @@ You can customize the following components of verifier.
return err
}
// ==

// Persistent store used by verifier for storing secrets and all the requests
err = v.CustomStore(verStore)
if err != nil {
Expand Down Expand Up @@ -91,8 +86,9 @@ You can customize the following components of verifier.
```

## TODO

1. Unit tests
3. Setup a web service, which can be independently run, and consumed via APIs
2. Setup a web service, which can be independently run, and consumed via APIs

## The gopher

Expand Down
22 changes: 11 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"os"
"time"

"github.com/bnkamalesh/verifier"
"github.com/bnkamalesh/verifier/awsses"
"github.com/bnkamalesh/verifier/awssns"
"github.com/bnkamalesh/verifier/stores"
"github.com/naughtygopher/verifier"
"github.com/naughtygopher/verifier/awsses"
"github.com/naughtygopher/verifier/awssns"
"github.com/naughtygopher/verifier/stores"
)

func newHTTPClient() *http.Client {
Expand Down Expand Up @@ -46,9 +46,9 @@ func redisConfig() *stores.RedisConfig {
Hosts: []string{
"localhost:6379",
},
DialTimeoutSecs: time.Second * 3,
ReadTimeoutSecs: time.Second * 1,
WriteTimeoutSecs: time.Second * 2,
DialTimeout: time.Second * 3,
ReadTimeout: time.Second * 1,
WriteTimeout: time.Second * 2,
}
}

Expand All @@ -61,10 +61,10 @@ func postgresConfig() *stores.PostgresConfig {
StoreName: "mydb",
PoolSize: 100,

DialTimeoutSecs: time.Second * 10,
ReadTimeoutSecs: time.Second * 10,
WriteTimeoutSecs: time.Second * 20,
IdleTimeoutSecs: time.Minute * 5,
DialTimeout: time.Second * 10,
ReadTimeout: time.Second * 10,
WriteTimeout: time.Second * 20,
IdleTimeout: time.Minute * 5,

TableName: "VerificationRequests",
}
Expand Down
39 changes: 28 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
module github.com/bnkamalesh/verifier
module github.com/naughtygopher/verifier

go 1.13
go 1.23.1

require (
github.com/Masterminds/squirrel v1.1.0
github.com/aws/aws-sdk-go v1.25.11
github.com/Masterminds/squirrel v1.5.4
github.com/aws/aws-sdk-go v1.55.5
github.com/fatih/structs v1.1.0
github.com/go-redis/redis v6.15.6+incompatible
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/jackc/pgx/v4 v4.1.2
github.com/mattn/go-sqlite3 v1.11.0 // indirect
github.com/onsi/ginkgo v1.10.2 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/vmihailenco/msgpack/v4 v4.2.1
github.com/go-redis/redis v6.15.9+incompatible
github.com/jackc/pgx/v5 v5.7.1
github.com/vmihailenco/msgpack/v4 v4.3.13
)

require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.34.2 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)
Loading

0 comments on commit 74f3077

Please sign in to comment.