Atmovault

With Docker

docker build -t atmovault-gateway https://github.com/hb1dys/atmovault-client.git
docker run -d --name atmovault-gateway \
  -p 127.0.0.1:8200:8200 \
  -v atmovault-state:/state \
  atmovault-gateway

Publish the port on 127.0.0.1 only. The gateway hands out decrypted files to whoever presents the key, and it speaks plain HTTP.

With Python

Python 3.11 or newer:

pip install "atmovault-client[gateway]"
atmovault-service serve
OptionEnvironmentDefault
--urlATMOVAULT_URLthe hosted vaultthe vault's API root, for a vault you host yourself
--stateATMOVAULT_STATEatmovault-statethe state folder
serve --host| 127.0.0.1where to listen
serve --port| 8200

The key is not a setting of the gateway. Your program sends it with every request.

The state folder

One small file per key. It holds no key and nothing readable: only, for each folder, the newest key version the gateway has seen, and for each file your program has replaced, the newest version it wrote.

  • Keep it on storage that outlives a restart or a redeploy: a Docker volume, not the container's own filesystem.
  • Keep it writable by the gateway's user alone.
  • If it is lost, the gateway starts again without it and everything keeps working. What is lost is its memory of what it has seen, which is what lets it notice a vault server replaying something older.
  • A file that is there but damaged stops the gateway from serving that key, on purpose.

What it logs

Start-up lines and nothing else. There is no request log, because a path is a decrypted file name.

Reaching it from another machine

Do not expose it as it is. Put it behind something that adds TLS and reaches it over a private network, and treat the address as carefully as the key.

Checking it is up

GET /healthz answers {"ok": true} and needs no key. GET /v1 with the key answers the folders it reaches.

Upgrading

Stop the old one and start the new one against the same state folder. /v1 only ever gains fields and routes.

Without the gateway

The same package is a Python library and a command line. For the library alone, leave [gateway] out:

pip install "atmovault-client"
import os
from atmovault_client import connect

key = os.environ["ATMOVAULT_API_KEY"]

with connect("https://atmovault.app/api", key, "atmovault-state") as vault:
    folder = vault.find("Finance")

    with open("invoice.pdf", "rb") as f:
        vault.upload(folder, "invoice.pdf", f, "application/pdf")

    for item in vault.children(folder):
        print(item.name, item.size)

    data = vault.read(vault.find("Finance/invoice.pdf"))

The third argument is the state folder described above. vault.read_into(file, out) writes a large file to an open file a chunk at a time, and new_version, mkdir, rename, move and trash do what their names say. Errors are exceptions: ApiError when the vault refuses, KeyOutOfDate when the owner has to issue a new key.

export ATMOVAULT_API_KEY=atmv1_...
atmovault-service ls Finance
atmovault-service put invoice.pdf Finance
atmovault-service get Finance/invoice.pdf