Client library for the Wallet Attached Storage specification
Project description
Wallet Attached Storage Client
Python client library for the Wallet Attached Storage specification.
Installation
pip install wallet-attached-storage-client
Usage
import json
from wallet_attached_storage_client import Ed25519Signer, StorageClient
# Generate a new Ed25519 key pair (or pass your own Ed25519PrivateKey)
signer = Ed25519Signer()
print(f"Signer DID: {signer.id}") # did:key:z6Mk...
with StorageClient("https://your-was-server.example") as client:
# 1. Create a space (auto-generates a urn:uuid)
space = client.space(signer=signer)
print(f"Space: {space.id}")
print(f"Path: {space.path}")
# 2. Write a resource into the space
resource = space.resource("/hello.txt")
put_resp = resource.put(b"Hello from Python!", "text/plain")
print(f"PUT {resource.path} -> {put_resp.status}") # 204
# 3. Read it back
get_resp = resource.get()
print(f"GET {resource.path} -> {get_resp.status}") # 200
print(f"Body: {get_resp.text()}") # Hello from Python!
# 4. Overwrite with JSON
doc = json.dumps({"greeting": "hi", "from": "python"}).encode()
resource.put(doc, "application/json")
print(f"JSON: {resource.get().json()}")
# 5. Delete the resource
del_resp = resource.delete()
print(f"DEL {resource.path} -> {del_resp.status}") # 204
# 6. Confirm it's gone
gone_resp = resource.get()
print(f"GET {resource.path} -> {gone_resp.status}") # 404
Custom Signers
Ed25519Signer is built in, but any object that satisfies the Signer protocol
works — you are not locked into a specific cryptography library:
class MySigner:
@property
def id(self) -> str:
"""Return a DID key identifier, e.g. did:key:z6Mkh..."""
...
def sign(self, data: bytes) -> bytes:
"""Sign raw bytes and return the raw signature bytes."""
...
API
StorageClient(base_url)— entry point; createsSpacehandlesSpace— represents a WAS space (get(),put(),delete(),resource())Resource— represents a resource within a space (get(),put(),post(),delete())StorageResponse— wraps HTTP responses (status,ok,headers,content(),json(),text())
Scripts
uv run safety scan
uv run ruff check
uv run flake8 src tests
uv run bandit -r src
uv run bandit -r tests -s B101
uv run -m pytest -vv --cov=src --cov-report=term --cov-report=xml
uv version --bump patch
git add . && git commit -m "Bump patch version" && git tag -sm "New feature" $version
rm -rf dist && uv build
uv publish -t $(keyring get https://upload.pypi.org/legacy/ __token__)
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wallet_attached_storage_client-0.2.0.tar.gz.
File metadata
- Download URL: wallet_attached_storage_client-0.2.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
499091459adb701a95975cc591d26061c89a9dd93f29272170d529fab182cc8e
|
|
| MD5 |
b9e9f0b4cc74b9542592a4a13ce2a0cc
|
|
| BLAKE2b-256 |
ff909d7104417e9bd09a0359a93ea9bc8224fa6754071b82ef68e43ac55b8b41
|
File details
Details for the file wallet_attached_storage_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: wallet_attached_storage_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd9a6c7fc3530afd8c77543aa52e7aee592b453e3fe7c3f045bd387bb0cd8541
|
|
| MD5 |
b49fcb99ee3b09e3ad2e3977b21a0fd1
|
|
| BLAKE2b-256 |
75918d4f17e03c1a3cc4829c801b807174cca3638c876350e28b6a0265ebe097
|