zib-vault 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.
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zib contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---------------------------------------------------------------------------
24
+ The word list in src/zib_vault/wordlist-pt.txt is the official Portuguese BIP39
25
+ word list (bitcoin/bips, MIT License).
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: zib-vault
3
+ Version: 0.1.0
4
+ Summary: MCP server and CLI for Zib (beta): encrypted letters for the people you choose, encrypted locally.
5
+ Author: Zib contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://zib-vault.hmv-pt.workers.dev
8
+ Project-URL: Repository, https://github.com/Santiago1971/zib
9
+ Project-URL: Issues, https://github.com/Santiago1971/zib/issues
10
+ Project-URL: Documentation, https://github.com/Santiago1971/zib#readme
11
+ Keywords: mcp,mcp-server,encryption,shamir,digital-legacy,zib
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Operating System :: POSIX
19
+ Classifier: Operating System :: MacOS
20
+ Classifier: Environment :: Console
21
+ Classifier: Topic :: Security :: Cryptography
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: mcp<3,>=2.3
26
+ Requires-Dist: cryptography>=41
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=8; extra == "test"
29
+ Dynamic: license-file
30
+
31
+ # Zib — servidor MCP (`zib-vault`)
32
+
33
+ <!-- mcp-name: io.github.Santiago1971/zib -->
34
+
35
+ > **Beta.** O Zib é recente e ainda está em revisão. Guarde as suas próprias cópias de tudo o que for importante.
36
+ >
37
+ > **O Zib não substitui um testamento** e não tem valor legal. **Não guarde palavras-passe**, PINs nem códigos de acesso num cofre.
38
+
39
+ O [Zib](https://zib-vault.hmv-pt.workers.dev) guarda, durante 5 anos, uma carta cifrada e alguns ficheiros pequenos
40
+ para as pessoas que escolher. Este pacote permite a um agente de IA (por MCP) ou a si (pela linha de comandos)
41
+ criar, guardar e abrir cofres Zib. É gratuito e não precisa de conta.
42
+
43
+ ## Como o protege
44
+
45
+ * **Cifrado no seu computador.** AES-256-GCM, com chaves derivadas por PBKDF2-SHA256 (600 000 iterações, sal aleatório).
46
+ O servidor do Zib só recebe identificadores aleatórios e texto cifrado. Não consegue ler o seu cofre.
47
+ * **A frase fica fora da conversa.** As ferramentas leem e escrevem a frase de recuperação de 9 palavras e as 4 partes
48
+ em ficheiros locais criados com permissões `0600`. Nenhuma ferramenta devolve a frase, uma parte ou a carta decifrada
49
+ (a não ser que peça expressamente para ler a carta na conversa).
50
+ * **Abrir um cofre precisa de si.** A ferramenta `zib_open_vault` pede-lhe confirmação através do cliente MCP (*elicitation*).
51
+ Se o cliente não souber pedir, a abertura é recusada, a menos que arranque o servidor com `ZIB_ALLOW_OPEN=1`.
52
+ * **O mesmo formato do site.** Os cofres criados aqui abrem no site e vice-versa (formato 2; os cofres antigos,
53
+ de formato 1, continuam a abrir).
54
+ * **Sem conta e sem rastreio.** Em vez de um captcha, guardar um cofre custa ao seu computador alguns segundos de
55
+ prova de trabalho. Depois de guardados, os cofres não podem ser alterados e são apagados ao fim de 5 anos.
56
+
57
+ ## Instalação
58
+
59
+ Requer Python 3.10 ou mais recente.
60
+
61
+ ```bash
62
+ uvx zib-vault # arranca o servidor MCP em stdio
63
+ # ou
64
+ pip install zib-vault
65
+ ```
66
+
67
+ ## Configuração MCP
68
+
69
+ Para clientes como o Claude Desktop ou o Cursor:
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "zib": { "command": "uvx", "args": ["zib-vault"] }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## Ferramentas
80
+
81
+ | Ferramenta | O que faz | Devolve |
82
+ |---|---|---|
83
+ | `zib_new_phrase` | Gera uma frase de recuperação de 9 palavras num ficheiro **novo** (0600). Copie-a para papel. | caminho |
84
+ | `zib_create_vault` | Cifra localmente uma carta (ficheiro ou texto) e anexos opcionais; com `split` escreve também 4 ficheiros de partes (quaisquer 2 abrem o cofre). Nada é enviado. | caminhos, validade |
85
+ | `zib_store_vault` | Envia o cofre cifrado (resolve a prova de trabalho em poucos segundos). | id, validade |
86
+ | `zib_vault_info` | Com a frase (ou 2 partes), verifica se o cofre existe e quando expira. Não decifra. | existe, validade |
87
+ | `zib_open_vault` | Depois da sua confirmação, decifra para uma pasta (0700, ficheiros 0600). | caminhos |
88
+
89
+ Através deste pacote, os anexos estão limitados a 3 MB no total.
90
+
91
+ ## Linha de comandos
92
+
93
+ ```bash
94
+ zib-vault new-phrase ~/zib/frase.txt
95
+ zib-vault create ~/zib/frase.txt ~/zib/cofre.json --letter-file carta.txt --attach foto.jpg --split-into ~/zib/partes
96
+ zib-vault store ~/zib/cofre.json
97
+ zib-vault info --phrase-file ~/zib/frase.txt
98
+ zib-vault open --part-files ~/zib/partes/zib-part-1-of-4.txt ~/zib/partes/zib-part-3-of-4.txt ~/zib/aberto
99
+ ```
100
+
101
+ Depois de passar a frase para papel e de entregar as partes a pessoas de confiança, apague os ficheiros de que já não precisa.
102
+
103
+ ## Desenvolvimento
104
+
105
+ ```bash
106
+ pip install -e ".[test]"
107
+ pytest # testes unitários, vetores cruzados e testes MCP em stdio
108
+ ZIB_E2E=1 pytest -m e2e # fala também com o servidor de produção (guarda 2 cofres de teste pequenos)
109
+ ```
110
+
111
+ Os testes com vetores cruzados confirmam que os cofres feitos pelo JavaScript do site abrem em Python e vice-versa
112
+ (`tests/vectors/`, gerados de novo com `node tests/js/make_vectors.mjs`; as frases que lá estão são dados de teste descartáveis).
113
+ Defina `ZIB_WEB_DIR` com uma cópia do código do site para correr as verificações em JavaScript e o Worker local.
114
+
115
+ `ZIB_BASE_URL` aponta o cliente para outro servidor (https, ou localhost para desenvolvimento).
116
+
117
+ ## Licença
118
+
119
+ MIT. Ver [LICENSE](https://github.com/Santiago1971/zib/blob/main/LICENSE).
120
+
121
+ ## English summary
122
+
123
+ **Zib (beta)** keeps an encrypted letter and a few small files for the people you choose, for 5 years.
124
+ `zib-vault` is its MCP server (stdio) and command-line tool. Everything is encrypted locally (AES-256-GCM,
125
+ PBKDF2-SHA256); the server only sees random ids and ciphertext. The recovery phrase and the Shamir parts stay
126
+ out of the chat: tools read and write them as `0600` files and never return them. Opening a vault requires the
127
+ human's confirmation (MCP elicitation, or `ZIB_ALLOW_OPEN=1` set by the human). Storing uses a few seconds of
128
+ proof of work instead of a captcha. **Zib is not a will and must not be used to store passwords.**
129
+
130
+ Install: `uvx zib-vault` (Python 3.10+). Tools: `zib_new_phrase`, `zib_create_vault`, `zib_store_vault`,
131
+ `zib_vault_info`, `zib_open_vault`. Website: https://zib-vault.hmv-pt.workers.dev · Source:
132
+ https://github.com/Santiago1971/zib · License: MIT.
@@ -0,0 +1,102 @@
1
+ # Zib — servidor MCP (`zib-vault`)
2
+
3
+ <!-- mcp-name: io.github.Santiago1971/zib -->
4
+
5
+ > **Beta.** O Zib é recente e ainda está em revisão. Guarde as suas próprias cópias de tudo o que for importante.
6
+ >
7
+ > **O Zib não substitui um testamento** e não tem valor legal. **Não guarde palavras-passe**, PINs nem códigos de acesso num cofre.
8
+
9
+ O [Zib](https://zib-vault.hmv-pt.workers.dev) guarda, durante 5 anos, uma carta cifrada e alguns ficheiros pequenos
10
+ para as pessoas que escolher. Este pacote permite a um agente de IA (por MCP) ou a si (pela linha de comandos)
11
+ criar, guardar e abrir cofres Zib. É gratuito e não precisa de conta.
12
+
13
+ ## Como o protege
14
+
15
+ * **Cifrado no seu computador.** AES-256-GCM, com chaves derivadas por PBKDF2-SHA256 (600 000 iterações, sal aleatório).
16
+ O servidor do Zib só recebe identificadores aleatórios e texto cifrado. Não consegue ler o seu cofre.
17
+ * **A frase fica fora da conversa.** As ferramentas leem e escrevem a frase de recuperação de 9 palavras e as 4 partes
18
+ em ficheiros locais criados com permissões `0600`. Nenhuma ferramenta devolve a frase, uma parte ou a carta decifrada
19
+ (a não ser que peça expressamente para ler a carta na conversa).
20
+ * **Abrir um cofre precisa de si.** A ferramenta `zib_open_vault` pede-lhe confirmação através do cliente MCP (*elicitation*).
21
+ Se o cliente não souber pedir, a abertura é recusada, a menos que arranque o servidor com `ZIB_ALLOW_OPEN=1`.
22
+ * **O mesmo formato do site.** Os cofres criados aqui abrem no site e vice-versa (formato 2; os cofres antigos,
23
+ de formato 1, continuam a abrir).
24
+ * **Sem conta e sem rastreio.** Em vez de um captcha, guardar um cofre custa ao seu computador alguns segundos de
25
+ prova de trabalho. Depois de guardados, os cofres não podem ser alterados e são apagados ao fim de 5 anos.
26
+
27
+ ## Instalação
28
+
29
+ Requer Python 3.10 ou mais recente.
30
+
31
+ ```bash
32
+ uvx zib-vault # arranca o servidor MCP em stdio
33
+ # ou
34
+ pip install zib-vault
35
+ ```
36
+
37
+ ## Configuração MCP
38
+
39
+ Para clientes como o Claude Desktop ou o Cursor:
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "zib": { "command": "uvx", "args": ["zib-vault"] }
45
+ }
46
+ }
47
+ ```
48
+
49
+ ## Ferramentas
50
+
51
+ | Ferramenta | O que faz | Devolve |
52
+ |---|---|---|
53
+ | `zib_new_phrase` | Gera uma frase de recuperação de 9 palavras num ficheiro **novo** (0600). Copie-a para papel. | caminho |
54
+ | `zib_create_vault` | Cifra localmente uma carta (ficheiro ou texto) e anexos opcionais; com `split` escreve também 4 ficheiros de partes (quaisquer 2 abrem o cofre). Nada é enviado. | caminhos, validade |
55
+ | `zib_store_vault` | Envia o cofre cifrado (resolve a prova de trabalho em poucos segundos). | id, validade |
56
+ | `zib_vault_info` | Com a frase (ou 2 partes), verifica se o cofre existe e quando expira. Não decifra. | existe, validade |
57
+ | `zib_open_vault` | Depois da sua confirmação, decifra para uma pasta (0700, ficheiros 0600). | caminhos |
58
+
59
+ Através deste pacote, os anexos estão limitados a 3 MB no total.
60
+
61
+ ## Linha de comandos
62
+
63
+ ```bash
64
+ zib-vault new-phrase ~/zib/frase.txt
65
+ zib-vault create ~/zib/frase.txt ~/zib/cofre.json --letter-file carta.txt --attach foto.jpg --split-into ~/zib/partes
66
+ zib-vault store ~/zib/cofre.json
67
+ zib-vault info --phrase-file ~/zib/frase.txt
68
+ zib-vault open --part-files ~/zib/partes/zib-part-1-of-4.txt ~/zib/partes/zib-part-3-of-4.txt ~/zib/aberto
69
+ ```
70
+
71
+ Depois de passar a frase para papel e de entregar as partes a pessoas de confiança, apague os ficheiros de que já não precisa.
72
+
73
+ ## Desenvolvimento
74
+
75
+ ```bash
76
+ pip install -e ".[test]"
77
+ pytest # testes unitários, vetores cruzados e testes MCP em stdio
78
+ ZIB_E2E=1 pytest -m e2e # fala também com o servidor de produção (guarda 2 cofres de teste pequenos)
79
+ ```
80
+
81
+ Os testes com vetores cruzados confirmam que os cofres feitos pelo JavaScript do site abrem em Python e vice-versa
82
+ (`tests/vectors/`, gerados de novo com `node tests/js/make_vectors.mjs`; as frases que lá estão são dados de teste descartáveis).
83
+ Defina `ZIB_WEB_DIR` com uma cópia do código do site para correr as verificações em JavaScript e o Worker local.
84
+
85
+ `ZIB_BASE_URL` aponta o cliente para outro servidor (https, ou localhost para desenvolvimento).
86
+
87
+ ## Licença
88
+
89
+ MIT. Ver [LICENSE](https://github.com/Santiago1971/zib/blob/main/LICENSE).
90
+
91
+ ## English summary
92
+
93
+ **Zib (beta)** keeps an encrypted letter and a few small files for the people you choose, for 5 years.
94
+ `zib-vault` is its MCP server (stdio) and command-line tool. Everything is encrypted locally (AES-256-GCM,
95
+ PBKDF2-SHA256); the server only sees random ids and ciphertext. The recovery phrase and the Shamir parts stay
96
+ out of the chat: tools read and write them as `0600` files and never return them. Opening a vault requires the
97
+ human's confirmation (MCP elicitation, or `ZIB_ALLOW_OPEN=1` set by the human). Storing uses a few seconds of
98
+ proof of work instead of a captcha. **Zib is not a will and must not be used to store passwords.**
99
+
100
+ Install: `uvx zib-vault` (Python 3.10+). Tools: `zib_new_phrase`, `zib_create_vault`, `zib_store_vault`,
101
+ `zib_vault_info`, `zib_open_vault`. Website: https://zib-vault.hmv-pt.workers.dev · Source:
102
+ https://github.com/Santiago1971/zib · License: MIT.
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "zib-vault"
7
+ version = "0.1.0"
8
+ description = "MCP server and CLI for Zib (beta): encrypted letters for the people you choose, encrypted locally."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Zib contributors" }]
14
+ keywords = ["mcp", "mcp-server", "encryption", "shamir", "digital-legacy", "zib"]
15
+ dependencies = ["mcp>=2.3,<3", "cryptography>=41"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Operating System :: POSIX",
24
+ "Operating System :: MacOS",
25
+ "Environment :: Console",
26
+ "Topic :: Security :: Cryptography",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ test = ["pytest>=8"]
31
+
32
+ [project.urls]
33
+ Homepage = "https://zib-vault.hmv-pt.workers.dev"
34
+ Repository = "https://github.com/Santiago1971/zib"
35
+ Issues = "https://github.com/Santiago1971/zib/issues"
36
+ Documentation = "https://github.com/Santiago1971/zib#readme"
37
+
38
+ [project.scripts]
39
+ zib-vault = "zib_vault.cli:main"
40
+ zib-mcp = "zib_vault.server:main"
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["src"]
44
+
45
+ [tool.setuptools.package-data]
46
+ zib_vault = ["wordlist-pt.txt"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
50
+ markers = ["e2e: talks to the production Zib server (opt-in with ZIB_E2E=1)"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ """zib-vault: create, store and open Zib vaults from an MCP client or the command line (beta)."""
2
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,49 @@
1
+ """Command line: `zib-vault` with no arguments runs the MCP server (stdio); subcommands do the same jobs by hand."""
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import json
6
+ import sys
7
+
8
+ from . import __version__
9
+
10
+
11
+ def main(argv: list[str] | None = None) -> int:
12
+ argv = sys.argv[1:] if argv is None else argv
13
+ if not argv or argv[0] in ("mcp", "serve"):
14
+ from .server import main as serve
15
+ serve()
16
+ return 0
17
+ from . import vault
18
+ p = argparse.ArgumentParser(prog="zib-vault", description="Zib vaults (beta). Not a will; do not store passwords.")
19
+ p.add_argument("--version", action="version", version=__version__)
20
+ sub = p.add_subparsers(dest="cmd", required=True)
21
+ s = sub.add_parser("new-phrase"); s.add_argument("phrase_file")
22
+ s = sub.add_parser("create"); s.add_argument("phrase_file"); s.add_argument("out_file")
23
+ s.add_argument("--letter-file", required=True); s.add_argument("--attach", action="append", default=[])
24
+ s.add_argument("--split-into", metavar="PARTS_DIR")
25
+ s = sub.add_parser("store"); s.add_argument("vault_file")
26
+ for name in ("info", "open"):
27
+ s = sub.add_parser(name)
28
+ g = s.add_mutually_exclusive_group(required=True)
29
+ g.add_argument("--phrase-file"); g.add_argument("--part-files", nargs=2)
30
+ if name == "open":
31
+ s.add_argument("out_dir")
32
+ a = p.parse_args(argv)
33
+ if a.cmd == "new-phrase":
34
+ r = vault.new_phrase(a.phrase_file)
35
+ elif a.cmd == "create":
36
+ r = vault.create_vault(a.phrase_file, a.out_file, letter_file=a.letter_file, attachments=a.attach,
37
+ split=bool(a.split_into), parts_dir=a.split_into)
38
+ elif a.cmd == "store":
39
+ r = vault.store_vault(a.vault_file)
40
+ elif a.cmd == "info":
41
+ r = vault.vault_info(a.phrase_file, a.part_files)
42
+ else:
43
+ r, _ = vault.open_vault(a.out_dir, a.phrase_file, a.part_files)
44
+ print(json.dumps(r, indent=2))
45
+ return 0
46
+
47
+
48
+ if __name__ == "__main__":
49
+ raise SystemExit(main())
@@ -0,0 +1,68 @@
1
+ """Minimal HTTP client for the Zib Worker (standard library only)."""
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import os
6
+ import re
7
+ import urllib.error
8
+ import urllib.request
9
+
10
+ from . import __version__, pow as _pow
11
+
12
+ DEFAULT_BASE_URL = "https://zib-vault.hmv-pt.workers.dev"
13
+ _ID = re.compile(r"^[0-9a-f]{40}$")
14
+ MAX_POW_BITS = 28 # refuse absurd difficulty from a misbehaving server
15
+
16
+
17
+ class ZibApiError(RuntimeError):
18
+ def __init__(self, status: int, code: str | None, message: str):
19
+ super().__init__(f"{status} {code or ''} {message}".strip())
20
+ self.status, self.code = status, code
21
+
22
+
23
+ def base_url() -> str:
24
+ url = os.environ.get("ZIB_BASE_URL", DEFAULT_BASE_URL).rstrip("/")
25
+ if not (url.startswith("https://") or url.startswith("http://127.0.0.1") or url.startswith("http://localhost")):
26
+ raise ValueError("ZIB_BASE_URL must be https (or a localhost URL for development).")
27
+ return url
28
+
29
+
30
+ def _request(method: str, path: str, body: bytes | None = None, headers: dict | None = None, timeout: float = 60) -> dict:
31
+ req = urllib.request.Request(base_url() + path, data=body, method=method, headers={
32
+ "user-agent": f"zib-vault/{__version__}", "accept": "application/json", **(headers or {})})
33
+ try:
34
+ with urllib.request.urlopen(req, timeout=timeout) as r:
35
+ return json.loads(r.read().decode("utf-8"))
36
+ except urllib.error.HTTPError as e:
37
+ try:
38
+ j = json.loads(e.read().decode("utf-8"))
39
+ except Exception: # noqa: BLE001
40
+ j = {}
41
+ raise ZibApiError(e.code, j.get("code"), j.get("error") or e.reason) from None
42
+
43
+
44
+ def get_challenge() -> dict:
45
+ return _request("GET", "/api/v1/challenge")
46
+
47
+
48
+ def store(ids: list[str], record: dict) -> dict:
49
+ """Solve the proof of work and store an encrypted record. Returns the server reply ({"ok": true})."""
50
+ if not ids or not all(_ID.match(i) for i in ids):
51
+ raise ValueError("Invalid vault ids.")
52
+ body = json.dumps({"ids": ids, "record": record}, separators=(",", ":")).encode("utf-8")
53
+ ch = get_challenge()
54
+ if len(body) > int(ch.get("maxBytes", 5 * 1024 * 1024)):
55
+ raise ValueError("The vault is too large for the API (limit %d bytes)." % ch.get("maxBytes"))
56
+ bits = int(ch["bits"])
57
+ if bits > MAX_POW_BITS:
58
+ raise ZibApiError(0, "pow_too_hard", "Server asked for an unreasonable proof of work.")
59
+ nonce = _pow.solve(ch["challenge"], body, bits)
60
+ return _request("POST", "/api/v1/vault", body, {
61
+ "content-type": "application/json", "x-zib-pow-challenge": ch["challenge"], "x-zib-pow-nonce": nonce})
62
+
63
+
64
+ def fetch(vault_id: str) -> dict:
65
+ """Return the stored record, or raise ZibApiError(404) when no vault exists for this id."""
66
+ if not _ID.match(vault_id):
67
+ raise ValueError("Invalid vault id.")
68
+ return _request("GET", "/api/v1/vault/" + vault_id)["record"]