Skip to content

Commit

Permalink
stash commits
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony bible committed Mar 6, 2023
1 parent 26af5d2 commit d4f90e6
Show file tree
Hide file tree
Showing 14 changed files with 567 additions and 344 deletions.
53 changes: 37 additions & 16 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ go_repository(
go_repository(
name = "com_github_aws_aws_sdk_go",
importpath = "github.com/aws/aws-sdk-go",
sum = "h1:QN1nsY27ssD/JmW4s83qmSb+uL6DG4GmCDzjmJB4xUI=",
version = "v1.40.45",
sum = "h1:c0NzHHnPXV5kJoTUFQxFN5cUPpX1SxO635XnwL5/oIY=",
version = "v1.44.175",
)

go_repository(
Expand Down Expand Up @@ -1214,6 +1214,27 @@ go_repository(
version = "v1.1.2",
)

go_repository(
name = "com_github_dapr_go_sdk",
importpath = "github.com/dapr/go-sdk",
sum = "h1:jg5A2khSCHF8bGZsig5RWN/gD0jjitszc2V6Uq2pPdY=",
version = "v1.6.0",
)

go_repository(
name = "com_github_gorilla_mux",
importpath = "github.com/gorilla/mux",
sum = "h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=",
version = "v1.8.0",
)

go_repository(
name = "com_github_niemeyer_pretty",
importpath = "github.com/niemeyer/pretty",
sum = "h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=",
version = "v0.0.0-20200227124842-a10e7caefd8e",
)

gazelle_protobuf_extension_go_deps()

protobuf_core_deps()
Expand Down Expand Up @@ -1592,8 +1613,8 @@ go_repository(
go_repository(
name = "com_github_golang_mock",
importpath = "github.com/golang/mock",
sum = "h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=",
version = "v1.4.4",
sum = "h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=",
version = "v1.6.0",
)

go_repository(
Expand Down Expand Up @@ -1655,8 +1676,8 @@ go_repository(
go_repository(
name = "com_github_google_uuid",
importpath = "github.com/google/uuid",
sum = "h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=",
version = "v1.1.2",
sum = "h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=",
version = "v1.3.0",
)

go_repository(
Expand Down Expand Up @@ -2173,8 +2194,8 @@ go_repository(
go_repository(
name = "com_github_yuin_goldmark",
importpath = "github.com/yuin/goldmark",
sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=",
version = "v1.3.5",
sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=",
version = "v1.4.13",
)

go_repository(
Expand Down Expand Up @@ -2398,8 +2419,8 @@ go_repository(
go_repository(
name = "org_golang_x_net",
importpath = "golang.org/x/net",
sum = "h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU=",
version = "v0.0.0-20221014081412-f15817d10f9b",
sum = "h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=",
version = "v0.1.0",
)

go_repository(
Expand All @@ -2412,22 +2433,22 @@ go_repository(
go_repository(
name = "org_golang_x_sync",
importpath = "golang.org/x/sync",
sum = "h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=",
version = "v0.1.0",
sum = "h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=",
version = "v0.0.0-20220722155255-886fb9371eb4",
)

go_repository(
name = "org_golang_x_sys",
importpath = "golang.org/x/sys",
sum = "h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=",
version = "v0.0.0-20220919091848-fb04ddd9f9c8",
sum = "h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=",
version = "v0.1.0",
)

go_repository(
name = "org_golang_x_term",
importpath = "golang.org/x/term",
sum = "h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=",
version = "v0.0.0-20210927222741-03fcf44c2211",
sum = "h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=",
version = "v0.1.0",
)

go_repository(
Expand Down
7 changes: 4 additions & 3 deletions app/cmd/database/database2.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Config struct {

func (conf *Config) Connect() (db *sql.DB) {
dbConnectionString := fmt.Sprintf("%s:%s@(%s)/%s?parseTime=true", conf.PassConfig.DbUser, conf.PassConfig.DbPass, conf.PassConfig.DbHost, conf.PassConfig.DbName)

log.Debug().Msgf("Connecting to database ")
db, err := sql.Open("mysql", dbConnectionString)
if err != nil {
panic(err.Error()) // Just for example purpose. You should use proper error handling instead of panic
Expand All @@ -35,6 +35,7 @@ func (conf *Config) Select(ctx context.Context, request *db.SelectRequest) (*db.
dbconnection := conf.Connect()
response := db.SelectResponse{}
uuid := request.GetUuid()
log.Debug().Msgf("select %s", uuid)
err := dbconnection.QueryRow("select message,uniqueid,other_lastname from messages where uniqueid=?", uuid).Scan(&response.Content, &request.Uuid, &response.Passphrase)

if err != nil {
Expand All @@ -47,8 +48,8 @@ func (conf *Config) Select(ctx context.Context, request *db.SelectRequest) (*db.
//Insert encrypted information into database (this is base64 encoded)
func (conf *Config) Insert(ctx context.Context, request *db.InsertRequest) (*emptypb.Empty, error) {
db := conf.Connect()

_, err := db.Exec("INSERT INTO messages( message, uniqueid, other_lastname) VALUES(?,?,?)", request.GetContent(), request.GetUuid(), request.GetPassphrase())
log.Debug().Msgf("Inserting into database: %+v", request)
_, err := db.Exec("INSERT INTO messages( message, uniqueid, other_lastname, fileid) VALUES(?,?,?,?)", request.GetContent(), request.GetUuid(), request.GetPassphrase(), request.GetFileid())
defer db.Close()
if err != nil {
log.Error().Err(err).Msg("Something went wrong with Inserting into database")
Expand Down
1 change: 1 addition & 0 deletions app/cmd/encryption/encryption2.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (*server) DecryptMessage(ctx context.Context, request *pb.DecryptedMessageR

response.Plaintext = append(response.Plaintext, string(base64.URLEncoding.EncodeToString(plaintext)))
}
log.Debug().Msgf("Decrypted Message: %v", response)
return response, nil
}

Expand Down
7 changes: 6 additions & 1 deletion app/cmd/web/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ go_library(
"//protos:databasepb_go_proto",
"//protos:encryptionpb_go_proto",
"//protos:messagepb_go_proto",
"@com_github_aws_aws_sdk_go//aws",
"@com_github_aws_aws_sdk_go//aws/credentials",
"@com_github_aws_aws_sdk_go//aws/session",
"@com_github_aws_aws_sdk_go//service/s3",
"@com_github_dapr_go_sdk//client",
"@com_github_gin_gonic_gin//:gin",
"@com_github_p768lwy3_gin_server_timing//:go_default_library",
"@com_github_p768lwy3_gin_server_timing//:gin-server-timing",
"@com_github_rabbitmq_amqp091_go//:amqp091-go",
"@com_github_rs_xid//:xid",
"@com_github_rs_zerolog//log",
Expand Down
Loading

0 comments on commit d4f90e6

Please sign in to comment.