package
0.0.0-20230130093704-c219ecdef2a7
Repository: https://github.com/packtpublishing/go-programming-blueprints.git
Documentation: pkg.go.dev

# README

Usage

Run the vaultd service:

cd vault/cmd/vaultd
go run main.go

Hash a password:

curl -XPOST -d'{"password":"MySecretPassword123"}' localhost:8080/hash
{"hash":"$2a$10$L/Riz9xbgTBDn7F6uLInq.9Tr67PvBCmxzrLgemitnRM53ht7LGpC"}

Validate passwords with hashes:

curl -XPOST -d'{"password":"MySecretPassword123","hash":"$2a$10$L/Riz9xbgTBDn7F6uLInq.9Tr67PvBCmxzrLgemitnRM53ht7LGpC"}' localhost:8080/validate
{"valid":true}

or if you get the password wrong:

curl -XPOST -d'{"password":"NOPE","hash":"$2a$10$L/Riz9xbgTBDn7F6uLInq.9Tr67PvBCmxzrLgemitnRM53ht7LGpC"}' localhost:8080/validate
{"valid":false}

Compiling protobuf

Install proto3 from source:

brew install autoconf automake libtool
git clone https://github.com/google/protobuf
./autogen.sh ; ./configure ; make ; make install

Update protoc Go bindings:

go get -u github.com/golang/protobuf/{proto,protoc-gen-go}

See also https://github.com/grpc/grpc-go/tree/master/examples

Compile the protobuf (from inside pb folder):

protoc vault.proto --go_out=plugins=grpc:.

# Packages

No description provided by the author
No description provided by the author
Package pb is a generated protocol buffer package.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewGRPCServer gets a new pb.VaultServer.
NewHTTPServer makes a new Vault HTTP service.
NewService makes a new Service.

# Structs

Endpoints represents all endpoints for the vault Service.

# Interfaces

Service provides password hashing capabilities.