atmovault-client 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- atmovault_client-0.1.0/.dockerignore +9 -0
- atmovault_client-0.1.0/.gitattributes +1 -0
- atmovault_client-0.1.0/.github/workflows/ci.yml +23 -0
- atmovault_client-0.1.0/.github/workflows/publish.yml +16 -0
- atmovault_client-0.1.0/.gitignore +13 -0
- atmovault_client-0.1.0/Dockerfile +24 -0
- atmovault_client-0.1.0/LICENSE +202 -0
- atmovault_client-0.1.0/PKG-INFO +281 -0
- atmovault_client-0.1.0/README.md +257 -0
- atmovault_client-0.1.0/pyproject.toml +75 -0
- atmovault_client-0.1.0/src/atmovault_client/__init__.py +35 -0
- atmovault_client-0.1.0/src/atmovault_client/__main__.py +3 -0
- atmovault_client-0.1.0/src/atmovault_client/cli.py +257 -0
- atmovault_client-0.1.0/src/atmovault_client/crypto.py +477 -0
- atmovault_client-0.1.0/src/atmovault_client/docs/api.md +110 -0
- atmovault_client-0.1.0/src/atmovault_client/docs/index.md +82 -0
- atmovault_client-0.1.0/src/atmovault_client/docs/keys.md +50 -0
- atmovault_client-0.1.0/src/atmovault_client/docs/running.md +105 -0
- atmovault_client-0.1.0/src/atmovault_client/docs/security.md +56 -0
- atmovault_client-0.1.0/src/atmovault_client/gateway.py +456 -0
- atmovault_client-0.1.0/src/atmovault_client/keys.py +209 -0
- atmovault_client-0.1.0/src/atmovault_client/service.py +1073 -0
- atmovault_client-0.1.0/src/atmovault_client/trust.py +362 -0
- atmovault_client-0.1.0/tests/conftest.py +332 -0
- atmovault_client-0.1.0/tests/fixtures/api-key-vectors.json +21 -0
- atmovault_client-0.1.0/tests/fixtures/crypto-vectors.json +276 -0
- atmovault_client-0.1.0/tests/test_api_key.py +296 -0
- atmovault_client-0.1.0/tests/test_cli.py +327 -0
- atmovault_client-0.1.0/tests/test_crypto.py +209 -0
- atmovault_client-0.1.0/tests/test_gateway.py +494 -0
- atmovault_client-0.1.0/tests/test_rotation.py +245 -0
- atmovault_client-0.1.0/tests/test_service.py +376 -0
- atmovault_client-0.1.0/tests/test_signed_grants.py +323 -0
- atmovault_client-0.1.0/tests/test_transport.py +79 -0
- atmovault_client-0.1.0/tests/test_trust.py +208 -0
- atmovault_client-0.1.0/tests/test_vectors.py +107 -0
- atmovault_client-0.1.0/tests/test_vectors_more.py +62 -0
- atmovault_client-0.1.0/tests/test_vectors_signing.py +78 -0
- atmovault_client-0.1.0/tests/test_vectors_v2.py +45 -0
- atmovault_client-0.1.0/uv.lock +892 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python: ["3.11", "3.13"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: astral-sh/setup-uv@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python }}
|
|
19
|
+
- run: uv sync --frozen
|
|
20
|
+
- run: uv run ruff check .
|
|
21
|
+
- run: uv run ruff format --check .
|
|
22
|
+
- run: uv run mypy
|
|
23
|
+
- run: uv run pytest -q
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: astral-sh/setup-uv@v5
|
|
15
|
+
- run: uv build
|
|
16
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
FROM ghcr.io/astral-sh/uv:0.13.6-python3.13-trixie-slim@sha256:e586c1c65b7071aec78f02c5587c76c5011159cd76b3d6f1255f40e48e850abc
|
|
2
|
+
|
|
3
|
+
ENV UV_COMPILE_BYTECODE=1 \
|
|
4
|
+
UV_LINK_MODE=copy \
|
|
5
|
+
PYTHONUNBUFFERED=1 \
|
|
6
|
+
ATMOVAULT_STATE=/state
|
|
7
|
+
|
|
8
|
+
WORKDIR /app
|
|
9
|
+
|
|
10
|
+
COPY pyproject.toml uv.lock ./
|
|
11
|
+
RUN uv sync --frozen --no-dev --extra gateway --no-install-project
|
|
12
|
+
|
|
13
|
+
COPY . .
|
|
14
|
+
RUN uv sync --frozen --no-dev --extra gateway
|
|
15
|
+
|
|
16
|
+
RUN useradd --system --uid 999 --create-home atmovault \
|
|
17
|
+
&& mkdir -p /state \
|
|
18
|
+
&& chown -R atmovault:atmovault /state /app
|
|
19
|
+
USER atmovault
|
|
20
|
+
VOLUME /state
|
|
21
|
+
|
|
22
|
+
EXPOSE 8200
|
|
23
|
+
|
|
24
|
+
CMD ["/app/.venv/bin/python", "-m", "atmovault_client", "serve", "--host", "0.0.0.0"]
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
https://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: atmovault-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Client library, command line and local HTTP gateway for Atmovault, end-to-end encrypted file storage
|
|
5
|
+
Project-URL: Homepage, https://atmovault.app
|
|
6
|
+
Project-URL: Documentation, https://atmovault.app/docs/index.html
|
|
7
|
+
Project-URL: Repository, https://github.com/hb1dys/atmovault-client
|
|
8
|
+
Author: Aleksandar Ivanov Ivanov
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: atmovault,encryption,end-to-end,storage,zero-knowledge
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Security :: Cryptography
|
|
16
|
+
Classifier: Topic :: System :: Archiving
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: cryptography>=44.0
|
|
19
|
+
Requires-Dist: httpx>=0.28
|
|
20
|
+
Provides-Extra: gateway
|
|
21
|
+
Requires-Dist: fastapi>=0.115; extra == 'gateway'
|
|
22
|
+
Requires-Dist: uvicorn>=0.34; extra == 'gateway'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# atmovault-client
|
|
26
|
+
|
|
27
|
+
Read and write files in an [Atmovault](https://atmovault.app) vault from your own program.
|
|
28
|
+
|
|
29
|
+
Atmovault is end-to-end encrypted file storage: files are encrypted before they leave the
|
|
30
|
+
machine, so the server stores ciphertext and never sees a file's contents or its name.
|
|
31
|
+
That means a program cannot simply call a REST API on the server and get a document
|
|
32
|
+
back. Something on your side has to hold the key and do the encryption. This package is
|
|
33
|
+
that something, in three forms:
|
|
34
|
+
|
|
35
|
+
- **A gateway.** A small HTTP server you run next to your program. Your code makes plain
|
|
36
|
+
HTTP requests to `127.0.0.1`, in any language, and the gateway encrypts and decrypts.
|
|
37
|
+
- **A Python library**, if your program is written in Python.
|
|
38
|
+
- **A command line**, `atmovault-service`, for scripts and for trying things out.
|
|
39
|
+
|
|
40
|
+
All three use the same code and the same API key.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
your program --plain HTTP--> gateway (your machine) --ciphertext--> Atmovault
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Contents
|
|
47
|
+
|
|
48
|
+
- [Getting a key](#getting-a-key)
|
|
49
|
+
- [Install](#install)
|
|
50
|
+
- [Quickstart](#quickstart)
|
|
51
|
+
- [HTTP API](#http-api)
|
|
52
|
+
- [Command line](#command-line)
|
|
53
|
+
- [Python library](#python-library)
|
|
54
|
+
- [Configuration](#configuration)
|
|
55
|
+
- [Security](#security)
|
|
56
|
+
- [Development](#development)
|
|
57
|
+
- [License](#license)
|
|
58
|
+
|
|
59
|
+
## Getting a key
|
|
60
|
+
|
|
61
|
+
The owner of the vault makes one in **Settings -> Services -> New API key**. They pick a
|
|
62
|
+
folder, choose **View** (read only) or **Edit** (add, rename, move, trash), and set an
|
|
63
|
+
end date. The key is shown once:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
atmv1_... (156 characters)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A key reaches only the folder it was made for. Nothing a key does is permanent: what it
|
|
70
|
+
deletes goes to the owner's trash, what it replaces keeps its old version, and the owner
|
|
71
|
+
sees everything it did, with Undo.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
Python 3.11 or newer.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
pip install "atmovault-client[gateway] @ git+https://github.com/hb1dys/atmovault-client"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Leave out `[gateway]` if you only want the library and the command line. That drops
|
|
82
|
+
FastAPI and uvicorn and leaves two dependencies, `cryptography` and `httpx`.
|
|
83
|
+
|
|
84
|
+
Or build the gateway as a container:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
docker build -t atmovault-gateway https://github.com/hb1dys/atmovault-client.git
|
|
88
|
+
docker run -d --name atmovault-gateway \
|
|
89
|
+
-p 127.0.0.1:8200:8200 \
|
|
90
|
+
-v atmovault-state:/state \
|
|
91
|
+
atmovault-gateway
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Quickstart
|
|
95
|
+
|
|
96
|
+
Put the key in the environment, never in your code or your repository:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
export ATMOVAULT_API_KEY=atmv1_...
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Start the gateway:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
atmovault-service serve
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Upload a file into the folder the key was made for, here called `Finance`:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
curl -T invoice.pdf -H "Authorization: Bearer $ATMOVAULT_API_KEY" \
|
|
112
|
+
http://127.0.0.1:8200/v1/files/Finance/invoice.pdf
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
List the folder:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
curl -H "Authorization: Bearer $ATMOVAULT_API_KEY" http://127.0.0.1:8200/v1/list/Finance
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Download the file:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
curl -o invoice.pdf -H "Authorization: Bearer $ATMOVAULT_API_KEY" \
|
|
125
|
+
http://127.0.0.1:8200/v1/files/Finance/invoice.pdf
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The same three calls from PHP, Node, Go or anything else are ordinary HTTP requests with
|
|
129
|
+
one header.
|
|
130
|
+
|
|
131
|
+
## HTTP API
|
|
132
|
+
|
|
133
|
+
Base URL `http://127.0.0.1:8200`. Every request except `/healthz` carries
|
|
134
|
+
`Authorization: Bearer <key>`. A path starts at the name of the key's folder.
|
|
135
|
+
|
|
136
|
+
| Method and path | Needs | What it does |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| `GET /healthz` | nothing | `{"ok": true}` when the gateway is up |
|
|
139
|
+
| `GET /v1` | any key | Checks the key and lists the folders it reaches |
|
|
140
|
+
| `GET /v1/list/<path>` | View | What is in a folder. `?limit=`, `?offset=` |
|
|
141
|
+
| `GET /v1/meta/<path>` | View | One file or folder, without its bytes |
|
|
142
|
+
| `GET /v1/files/<path>` | View | A file's bytes. `?download=1`, `Range` |
|
|
143
|
+
| `PUT /v1/files/<path>` | Edit | Upload the request body. `?replace=true` adds a version |
|
|
144
|
+
| `POST /v1/folders/<path>` | Edit | Make a folder |
|
|
145
|
+
| `POST /v1/move` | Edit | Rename or move: `{"from": "<path>", "to": "<path>"}` |
|
|
146
|
+
| `DELETE /v1/files/<path>` | Edit | Move a file or folder to the owner's trash |
|
|
147
|
+
| `GET /v1/versions/<path>` | Edit | Every version a file has had, newest first |
|
|
148
|
+
|
|
149
|
+
Errors always look the same, with a `code` to match on:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{"error": {"code": "not_found", "message": "nothing called 'a.pdf' here"}}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The full reference, with the item format, every error code and the limits, is in
|
|
156
|
+
[docs/api.md](src/atmovault_client/docs/api.md). A running gateway serves the same pages
|
|
157
|
+
at `/docs` and an OpenAPI description at `/openapi.json`.
|
|
158
|
+
|
|
159
|
+
## Command line
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
atmovault-service ls the folders this key reaches
|
|
163
|
+
atmovault-service ls Finance what is in a folder
|
|
164
|
+
atmovault-service get Finance/invoice.pdf download and decrypt
|
|
165
|
+
atmovault-service put scan.pdf Finance encrypt and upload
|
|
166
|
+
atmovault-service put scan.pdf Finance --replace a new version of Finance/scan.pdf
|
|
167
|
+
atmovault-service mkdir Finance/2026
|
|
168
|
+
atmovault-service rename Finance/scan.pdf invoice.pdf
|
|
169
|
+
atmovault-service mv Finance/invoice.pdf Finance/2026
|
|
170
|
+
atmovault-service rm Finance/old.txt to the owner's trash
|
|
171
|
+
atmovault-service serve run the gateway
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Any part of a path can be an item's id instead of its name. Two items in one folder can
|
|
175
|
+
share a name, because the server never sees names, and the id is how you tell them apart.
|
|
176
|
+
|
|
177
|
+
## Python library
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
import os
|
|
181
|
+
from atmovault_client import connect
|
|
182
|
+
|
|
183
|
+
key = os.environ["ATMOVAULT_API_KEY"]
|
|
184
|
+
|
|
185
|
+
with connect("https://atmovault.app/api", key, "atmovault-state") as vault:
|
|
186
|
+
finance = vault.find("Finance")
|
|
187
|
+
|
|
188
|
+
for item in vault.children(finance):
|
|
189
|
+
print(item.path, item.size)
|
|
190
|
+
|
|
191
|
+
with open("invoice.pdf", "rb") as f:
|
|
192
|
+
vault.upload(finance, "invoice.pdf", f, "application/pdf")
|
|
193
|
+
|
|
194
|
+
data = vault.read(vault.find("Finance/invoice.pdf"))
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
| Method | |
|
|
198
|
+
|---|---|
|
|
199
|
+
| `grants()` | the folders the key reaches |
|
|
200
|
+
| `find(path)` | an item by path |
|
|
201
|
+
| `children(folder)`, `walk(folder)` | what is in a folder, or everything beneath it |
|
|
202
|
+
| `read(file)`, `read_into(file, out)`, `read_chunks(file)` | a file's bytes, whole or a chunk at a time |
|
|
203
|
+
| `upload(folder, name, data, mime)` | add a file; `data` is bytes or an open binary file |
|
|
204
|
+
| `new_version(file, data)` | replace a file's bytes, keeping the old ones in its history |
|
|
205
|
+
| `mkdir(folder, name)`, `rename(item, name)`, `move(item, folder)`, `trash(item)` | |
|
|
206
|
+
| `versions(file)` | a file's history |
|
|
207
|
+
|
|
208
|
+
Large files are read and written 4 MiB at a time, so memory use stays flat. An upload
|
|
209
|
+
resumes by itself if the connection drops.
|
|
210
|
+
|
|
211
|
+
Exceptions: `ApiError` (the server refused; it has `status` and `detail`), `Untrusted`
|
|
212
|
+
(a folder the owner did not sign over to this key), `KeyOutOfDate` (the owner changed
|
|
213
|
+
their password; ask for a new key), `Ambiguous` (two items share that name) and
|
|
214
|
+
`DecryptError`.
|
|
215
|
+
|
|
216
|
+
## Configuration
|
|
217
|
+
|
|
218
|
+
| Option | Environment | Default | |
|
|
219
|
+
|---|---|---|---|
|
|
220
|
+
| | `ATMOVAULT_API_KEY` | | the key, for the command line. The gateway takes it per request |
|
|
221
|
+
| `--url` | `ATMOVAULT_URL` | `https://atmovault.app/api` | the vault's API root |
|
|
222
|
+
| `--state` | `ATMOVAULT_STATE` | `atmovault-state` | the state folder, see below |
|
|
223
|
+
| `serve --host` | | `127.0.0.1` | where the gateway listens |
|
|
224
|
+
| `serve --port` | | `8200` | |
|
|
225
|
+
|
|
226
|
+
**The state folder** holds one small file per key: the newest key version seen of each
|
|
227
|
+
folder and the newest version written of each file. That is what lets the client notice
|
|
228
|
+
a server replaying something old. It contains no key and nothing readable. Keep it on
|
|
229
|
+
storage that survives a restart (a Docker volume, not the container's own filesystem)
|
|
230
|
+
and writable only by the user the program runs as.
|
|
231
|
+
|
|
232
|
+
More on running it in production: [docs/running.md](src/atmovault_client/docs/running.md).
|
|
233
|
+
|
|
234
|
+
## Security
|
|
235
|
+
|
|
236
|
+
The short version. The long one is in
|
|
237
|
+
[docs/security.md](src/atmovault_client/docs/security.md).
|
|
238
|
+
|
|
239
|
+
- **The API key is a private key.** It carries the token the server knows your program
|
|
240
|
+
by and the private key that opens the folder. Only the token is ever sent to the
|
|
241
|
+
server. Whoever has the string can read the folder, so keep it in the environment of
|
|
242
|
+
the one process that needs it.
|
|
243
|
+
- **The server is not trusted to say what the key may open.** A folder is used only if
|
|
244
|
+
the vault's owner signed it over to this key, and the client checks that signature
|
|
245
|
+
before reading or writing anything.
|
|
246
|
+
- **After the owner changes their password, the key stops working** and the client says
|
|
247
|
+
so. The owner issues a replacement with one click.
|
|
248
|
+
- **The gateway listens on `127.0.0.1` and speaks plain HTTP.** Do not expose it. It
|
|
249
|
+
keeps no key on disk and writes no request log, because a path is a decrypted name.
|
|
250
|
+
- **Treat what you read as untrusted input.** File names, types and contents are
|
|
251
|
+
whatever the writer put there. Do not build a path, a shell command or an HTML page
|
|
252
|
+
from them without checking.
|
|
253
|
+
- `https://` only. A plain `http://` vault address is refused unless it is this machine
|
|
254
|
+
or you pass `--allow-http`, and redirects are never followed.
|
|
255
|
+
|
|
256
|
+
Found a vulnerability? Please report it privately, as described at
|
|
257
|
+
<https://atmovault.app/security.html>, rather than in a public issue.
|
|
258
|
+
|
|
259
|
+
## Development
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
git clone https://github.com/hb1dys/atmovault-client
|
|
263
|
+
cd atmovault-client
|
|
264
|
+
uv sync
|
|
265
|
+
uv run pytest -q
|
|
266
|
+
uv run ruff check . && uv run ruff format --check . && uv run mypy
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The tests need no network and no vault. `tests/conftest.py` is a fake server, including
|
|
270
|
+
one that forges grants and signatures the way a hostile server could. `tests/fixtures`
|
|
271
|
+
holds known-answer vectors shared with the Atmovault web app, so the two implementations
|
|
272
|
+
are held to the same bytes.
|
|
273
|
+
|
|
274
|
+
Issues and pull requests are welcome. The encrypted format is fixed by those vectors and
|
|
275
|
+
by files people have already stored, so a change to it is not something a pull request
|
|
276
|
+
can make on its own.
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
[Apache License 2.0](LICENSE). It covers this client and gateway. The Atmovault server
|
|
281
|
+
and web app are not open source.
|