A micro webservice service to handle dispatching items for delivery using an experimental cryptographic identity system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
EOTL a73cab800e Merge pull request 'Refactoring Part 1' (#18) from refactor-api into master 2 weeks ago
auth Add tests 3 weeks ago
cmd Add signing cli 1 month ago
crypto Fix WTF where Verify does not return ErrBadSignature on bad signature 3 months ago
dump make Dump tool msgs clearer 2 months ago
listener Use httptest.newRecorder instead of custom impl 3 weeks ago
model Add abort with api error util 3 weeks ago
store Extract request verification to middleware 3 weeks ago
test Add tests 3 weeks ago
util Add abort with api error util 3 weeks ago
.gitignore Add .idea gitignore 3 weeks ago
API.md add rough API outline 3 months ago
LICENSE Initial commit 3 months ago
README.md Add signing cli 1 month ago
docker-compose.yml Remove db 1 month ago
go.mod re-enable go modules 3 months ago
go.sum re-enable go modules 3 months ago

README.md

Open Dispatch Daemon

A micro webservice to handle dispatching orders for delivery using an experimental cryptographic identity/verification system called Simple Signed Requests

Uses a front-end interface like open-dispatch

Currently WIP that doesn’t do much, yet!

Installing

You must have Go development environment working. Please follow the official install instructions to get going. Once done, proceed with the following

Postgres (docker)

Use Docker to start a postgres database:

$ docker-compose up -d

Postgres (manual)

For install on Debian 10+ machines

$ sudo apt install postgresql

Create a database and user with credentials to create databases

$ sudo -u postgres psql
[sudo] password for user:
psql (12.2 (Debian 12.2-1+b1))
Type "help" for help.

postgres=# CREATE user dispatch with encrypted password 'skrtpsswrd' createdb;
CREATE user
postgres=# CREATE DATABASE dispatch OWNER dispatch;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE dispatch to dispatch;
GRANT
postgres=# \q

Build

Now clone and build the daemon

$ go get https://codeberg.org/eotl/open-dispatch-daemon
$ cd $GOPATH

Add the following ENV variable (for PostGres) and build the code

$ export POSTGRES_URL=postgres://dispatch:skrtpsswd@127.0.0.1:5432/dispatch
$ cd src/codeberg.org/eotl/open-dispatch-daemon/cmd
$ go build

Assuming it builds with no errors, you should be able to the run the daemon

Running

On the first run of the system use the -c flag to create database You can run it on a custom port with the -p flag and -o to enable CORS

$ ./cmd -c
$ ./cmd -p 8181
$ ./cmd -p 8181 -o

Testing

Run basic testing coverage from the root project directory with

$ go test ./...

Tested with minimum Go version 1.13.6

Sign Requests

With sign.go you can sign JSON requests:

$ cat req.json | go run cmd/sign/sign.go -p private_ed25519.key | http POST ':8080/api/create'

req.json is a shipment.