/mempass-api

An example Go server for generating memorable passwords built with Connect and libpass

Primary LanguageGoMIT LicenseMIT

mempass-api

mempass-api is a example RPC service built with Connect and libpass. Its API is defined by a Protocol Buffer schema, and the service supports the gRPC, gRPC-Web, and Connect protocols.

Run

cp .env.example .env
go run ./cmd/server

Run on Docker

docker compose up

Call using curl

curl -i \
    --header "Content-Type: application/json" \
    --data '{}' \
    http://127.0.0.1:4321/mempass.v1.PasswordService/GeneratePasswords
curl -i \
    --header "Content-Type: application/json" \
    --data '{"preset": "XKCD", "word_list": "POKEMON"}' \
    http://127.0.0.1:4321/mempass.v1.PasswordService/GeneratePasswords
curl -i \
    --header "Content-Type: application/json" \
    --data '{
        "preset": "XKCD",
        "word_list": "MIDDLE_EARTH",
        "case_transform": "SENTENCE",
        "num_passwords": 10
    }' \
    http://127.0.0.1:4321/mempass.v1.PasswordService/GeneratePasswords

Call using grpcurl

grpcurl \
    -protoset <(buf build -o -) -plaintext \
    -d '{}' \
    127.0.0.1:4321 mempass.v1.PasswordService/GeneratePasswords
grpcurl \
    -protoset <(buf build -o -) -plaintext \
    -d '{"preset": "XKCD", "word_list": "POKEMON"}' \
    127.0.0.1:4321 mempass.v1.PasswordService/GeneratePasswords
grpcurl \
    -protoset <(buf build -o -) -plaintext \
    -d '{
        "preset": "XKCD",
        "word_list": "MIDDLE_EARTH",
        "case_transform": "SENTENCE",
        "num_passwords": 10
    }' \
    127.0.0.1:4321 mempass.v1.PasswordService/GeneratePasswords