awid-service 0.2.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.
Files changed (52) hide show
  1. awid_service-0.2.0/.gitignore +42 -0
  2. awid_service-0.2.0/Dockerfile +46 -0
  3. awid_service-0.2.0/Dockerfile.release +49 -0
  4. awid_service-0.2.0/PKG-INFO +75 -0
  5. awid_service-0.2.0/README.md +51 -0
  6. awid_service-0.2.0/docker-compose.yml +57 -0
  7. awid_service-0.2.0/pyproject.toml +55 -0
  8. awid_service-0.2.0/site/content/_index.md +4 -0
  9. awid_service-0.2.0/site/hugo.toml +8 -0
  10. awid_service-0.2.0/site/layouts/index.html +880 -0
  11. awid_service-0.2.0/src/awid/__init__.py +8 -0
  12. awid_service-0.2.0/src/awid/contract.py +78 -0
  13. awid_service-0.2.0/src/awid/db_config.py +46 -0
  14. awid_service-0.2.0/src/awid/did.py +112 -0
  15. awid_service-0.2.0/src/awid/dns_auth.py +77 -0
  16. awid_service-0.2.0/src/awid/dns_verify.py +250 -0
  17. awid_service-0.2.0/src/awid/http_didkey.py +86 -0
  18. awid_service-0.2.0/src/awid/log.py +98 -0
  19. awid_service-0.2.0/src/awid/log_config.py +62 -0
  20. awid_service-0.2.0/src/awid/pagination.py +125 -0
  21. awid_service-0.2.0/src/awid/ratelimit.py +246 -0
  22. awid_service-0.2.0/src/awid/registry.py +1565 -0
  23. awid_service-0.2.0/src/awid/signing.py +104 -0
  24. awid_service-0.2.0/src/awid/team_ids.py +22 -0
  25. awid_service-0.2.0/src/awid_service/__init__.py +5 -0
  26. awid_service-0.2.0/src/awid_service/cli.py +26 -0
  27. awid_service-0.2.0/src/awid_service/config.py +52 -0
  28. awid_service-0.2.0/src/awid_service/db.py +86 -0
  29. awid_service-0.2.0/src/awid_service/deps.py +24 -0
  30. awid_service-0.2.0/src/awid_service/main.py +163 -0
  31. awid_service-0.2.0/src/awid_service/migrations/001_registry.sql +106 -0
  32. awid_service-0.2.0/src/awid_service/migrations/002_teams.sql +49 -0
  33. awid_service-0.2.0/src/awid_service/migrations/003_team_visibility.sql +6 -0
  34. awid_service-0.2.0/src/awid_service/routes/__init__.py +0 -0
  35. awid_service-0.2.0/src/awid_service/routes/did.py +647 -0
  36. awid_service-0.2.0/src/awid_service/routes/dns_addresses.py +838 -0
  37. awid_service-0.2.0/src/awid_service/routes/dns_namespaces.py +541 -0
  38. awid_service-0.2.0/src/awid_service/routes/teams.py +826 -0
  39. awid_service-0.2.0/tests/conftest.py +116 -0
  40. awid_service-0.2.0/tests/test_certificate_lifecycle.py +270 -0
  41. awid_service-0.2.0/tests/test_certificates.py +244 -0
  42. awid_service-0.2.0/tests/test_conformance_vectors.py +71 -0
  43. awid_service-0.2.0/tests/test_http_didkey.py +345 -0
  44. awid_service-0.2.0/tests/test_main.py +128 -0
  45. awid_service-0.2.0/tests/test_namespaces.py +1034 -0
  46. awid_service-0.2.0/tests/test_routes.py +75 -0
  47. awid_service-0.2.0/tests/test_schema.py +28 -0
  48. awid_service-0.2.0/tests/test_site_files.py +20 -0
  49. awid_service-0.2.0/tests/test_team_lifecycle.py +249 -0
  50. awid_service-0.2.0/tests/test_team_routes.py +696 -0
  51. awid_service-0.2.0/tests/test_teams.py +172 -0
  52. awid_service-0.2.0/uv.lock +875 -0
@@ -0,0 +1,42 @@
1
+ node_modules/
2
+ dist/
3
+ .cache/
4
+ *.tgz
5
+ .DS_Store
6
+ __pycache__/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ .coverage
11
+ *.py[cod]
12
+ *.egg-info/
13
+ .aw/
14
+ .claude/settings*
15
+ .claude/worktrees/
16
+
17
+ # Secrets — never commit
18
+ .env
19
+ .env.*
20
+ **/.env
21
+ **/.env.*
22
+ .emacs-bu/
23
+ *.emacs-bu*
24
+
25
+ # server/
26
+ server/.venv/
27
+ server/build/
28
+ server/dist/
29
+ server/.pytest_cache/
30
+ server/src/*.egg-info/
31
+
32
+ # awid/
33
+ awid/.venv/
34
+ awid/build/
35
+ awid/dist/
36
+ awid/.pytest_cache/
37
+ awid/src/*.egg-info/
38
+ awid/site/public/
39
+ awid/site/.hugo_build.lock
40
+
41
+ # channel/
42
+ channel/node_modules/
@@ -0,0 +1,46 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ ARG UV_VERSION=0.9.22
4
+
5
+ FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv
6
+
7
+ FROM python:3.12-slim AS builder
8
+
9
+ COPY --from=uv /uv /usr/local/bin/uv
10
+
11
+ WORKDIR /app
12
+
13
+ COPY awid/pyproject.toml awid/README.md ./awid/
14
+ COPY server/pyproject.toml server/README.md ./server/
15
+ RUN cd awid && uv sync --no-dev --no-install-project
16
+
17
+ COPY awid/src ./awid/src
18
+ COPY server/src ./server/src
19
+ RUN cd awid && uv sync --no-dev
20
+
21
+ FROM python:3.12-slim AS runtime
22
+
23
+ RUN apt-get update \
24
+ && apt-get install -y --no-install-recommends curl \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ RUN groupadd --system --gid 1001 awid \
28
+ && useradd --system --uid 1001 --gid 1001 awid
29
+
30
+ WORKDIR /app
31
+
32
+ COPY --from=builder --chown=awid:awid /app/awid/.venv /app/awid/.venv
33
+ COPY --from=builder --chown=awid:awid /app/awid/src /app/awid/src
34
+ COPY --from=builder --chown=awid:awid /app/server /app/server
35
+
36
+ ENV PATH="/app/awid/.venv/bin:$PATH"
37
+ ENV PYTHONUNBUFFERED=1
38
+
39
+ USER awid
40
+
41
+ EXPOSE 8010
42
+
43
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
44
+ CMD curl -f http://localhost:8010/health || exit 1
45
+
46
+ CMD ["awid", "--host", "0.0.0.0", "--port", "8010"]
@@ -0,0 +1,49 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ ARG UV_VERSION=0.9.22
4
+ ARG PYTHON_IMAGE=python:3.12.10-slim-bookworm
5
+
6
+ FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv
7
+
8
+ FROM ${PYTHON_IMAGE} AS builder
9
+
10
+ COPY --from=uv /uv /usr/local/bin/uv
11
+
12
+ WORKDIR /app
13
+
14
+ COPY awid/pyproject.toml awid/uv.lock awid/README.md ./awid/
15
+ COPY server/pyproject.toml server/README.md ./server/
16
+
17
+ RUN cd awid && uv sync --locked --no-dev --no-install-project
18
+
19
+ COPY awid/src ./awid/src
20
+ COPY server/src ./server/src
21
+
22
+ RUN cd awid && uv sync --locked --no-dev
23
+
24
+ FROM ${PYTHON_IMAGE} AS runtime
25
+
26
+ RUN apt-get update \
27
+ && apt-get install -y --no-install-recommends curl \
28
+ && rm -rf /var/lib/apt/lists/*
29
+
30
+ RUN groupadd --system --gid 1001 awid \
31
+ && useradd --system --uid 1001 --gid 1001 awid
32
+
33
+ WORKDIR /app
34
+
35
+ COPY --from=builder --chown=awid:awid /app/awid/.venv /app/.venv
36
+ COPY --from=builder --chown=awid:awid /app/awid /app/awid
37
+ COPY --from=builder --chown=awid:awid /app/server /app/server
38
+
39
+ ENV PATH="/app/.venv/bin:$PATH"
40
+ ENV PYTHONUNBUFFERED=1
41
+
42
+ USER awid
43
+
44
+ EXPOSE 8010
45
+
46
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
47
+ CMD curl -f http://localhost:8010/health || exit 1
48
+
49
+ CMD ["awid", "serve", "--host", "0.0.0.0", "--port", "8010"]
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: awid-service
3
+ Version: 0.2.0
4
+ Summary: awid.ai identity registry service and shared awid primitives package
5
+ Project-URL: Homepage, https://github.com/awebai/aweb
6
+ Project-URL: Repository, https://github.com/awebai/aweb
7
+ Project-URL: Documentation, https://github.com/awebai/aweb/tree/main/docs
8
+ Author-email: Juan Reyero <juan@juanreyero.com>
9
+ License-Expression: MIT
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: base58>=2.1.1
12
+ Requires-Dist: dnspython>=2.8.0
13
+ Requires-Dist: fastapi>=0.116.1
14
+ Requires-Dist: httpx>=0.28.1
15
+ Requires-Dist: pgdbm>=0.4.1
16
+ Requires-Dist: publicsuffix2>=2.20191221
17
+ Requires-Dist: pydantic-settings>=2.10.1
18
+ Requires-Dist: pydantic>=2.11.7
19
+ Requires-Dist: pynacl>=1.6.2
20
+ Requires-Dist: redis>=6.4.0
21
+ Requires-Dist: typer>=0.16.1
22
+ Requires-Dist: uvicorn[standard]>=0.35.0
23
+ Description-Content-Type: text/markdown
24
+
25
+ # awid.ai service
26
+
27
+ This directory contains the standalone `awid.ai` registry service.
28
+
29
+ It is intentionally thin:
30
+
31
+ - imports the DID, namespace, and address routes from the `aweb` package
32
+ - uses the same signing, verification, and HTTP contracts as `aweb`
33
+ - owns only service-local concerns: startup, pgdbm wiring, Redis-backed rate
34
+ limiting, health endpoints, Docker packaging, and migration tooling
35
+
36
+ ## Run locally
37
+
38
+ ```bash
39
+ uv sync
40
+ uv run awid
41
+ ```
42
+
43
+ Required environment:
44
+
45
+ - `AWID_DATABASE_URL` or `DATABASE_URL`
46
+ - `AWID_REDIS_URL` or `REDIS_URL`
47
+
48
+ Optional environment:
49
+
50
+ - `AWID_HOST` default `0.0.0.0`
51
+ - `AWID_PORT` default `8010`
52
+ - `AWID_DB_SCHEMA` default `awid`
53
+ - `AWID_RATE_LIMIT_BACKEND` default `redis`
54
+
55
+ ## Docker
56
+
57
+ ```bash
58
+ cp .env.example .env
59
+ docker compose up --build -d
60
+ curl http://localhost:8010/health
61
+ ```
62
+
63
+ ## Release
64
+
65
+ `awid` is released as a GHCR container image.
66
+
67
+ Local release commands:
68
+
69
+ ```bash
70
+ make release-awid-check
71
+ make release-awid-tag
72
+ make release-awid-push
73
+ ```
74
+
75
+ The version lives in `pyproject.toml`. The release tag must be `awid-vX.Y.Z`, and it must match that version or the GitHub workflow will fail.
@@ -0,0 +1,51 @@
1
+ # awid.ai service
2
+
3
+ This directory contains the standalone `awid.ai` registry service.
4
+
5
+ It is intentionally thin:
6
+
7
+ - imports the DID, namespace, and address routes from the `aweb` package
8
+ - uses the same signing, verification, and HTTP contracts as `aweb`
9
+ - owns only service-local concerns: startup, pgdbm wiring, Redis-backed rate
10
+ limiting, health endpoints, Docker packaging, and migration tooling
11
+
12
+ ## Run locally
13
+
14
+ ```bash
15
+ uv sync
16
+ uv run awid
17
+ ```
18
+
19
+ Required environment:
20
+
21
+ - `AWID_DATABASE_URL` or `DATABASE_URL`
22
+ - `AWID_REDIS_URL` or `REDIS_URL`
23
+
24
+ Optional environment:
25
+
26
+ - `AWID_HOST` default `0.0.0.0`
27
+ - `AWID_PORT` default `8010`
28
+ - `AWID_DB_SCHEMA` default `awid`
29
+ - `AWID_RATE_LIMIT_BACKEND` default `redis`
30
+
31
+ ## Docker
32
+
33
+ ```bash
34
+ cp .env.example .env
35
+ docker compose up --build -d
36
+ curl http://localhost:8010/health
37
+ ```
38
+
39
+ ## Release
40
+
41
+ `awid` is released as a GHCR container image.
42
+
43
+ Local release commands:
44
+
45
+ ```bash
46
+ make release-awid-check
47
+ make release-awid-tag
48
+ make release-awid-push
49
+ ```
50
+
51
+ The version lives in `pyproject.toml`. The release tag must be `awid-vX.Y.Z`, and it must match that version or the GitHub workflow will fail.
@@ -0,0 +1,57 @@
1
+ services:
2
+ redis:
3
+ image: redis:7-alpine
4
+ restart: unless-stopped
5
+ volumes:
6
+ - redis_data:/data
7
+ healthcheck:
8
+ test: ["CMD", "redis-cli", "ping"]
9
+ interval: 10s
10
+ timeout: 5s
11
+ retries: 5
12
+
13
+ postgres:
14
+ image: postgres:16-alpine
15
+ restart: unless-stopped
16
+ environment:
17
+ POSTGRES_USER: ${POSTGRES_USER:-awid}
18
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
19
+ POSTGRES_DB: ${POSTGRES_DB:-awid}
20
+ volumes:
21
+ - postgres_data:/var/lib/postgresql/data
22
+ healthcheck:
23
+ test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-awid} -d ${POSTGRES_DB:-awid}"]
24
+ interval: 10s
25
+ timeout: 5s
26
+ retries: 5
27
+
28
+ awid:
29
+ build:
30
+ context: ..
31
+ dockerfile: awid/Dockerfile
32
+ restart: unless-stopped
33
+ ports:
34
+ - "${AWID_PORT:-8010}:8010"
35
+ environment:
36
+ AWID_DATABASE_URL: postgresql://${POSTGRES_USER:-awid}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-awid}
37
+ AWID_REDIS_URL: redis://redis:6379/0
38
+ AWID_HOST: 0.0.0.0
39
+ AWID_PORT: 8010
40
+ AWID_DB_SCHEMA: ${AWID_DB_SCHEMA:-awid}
41
+ AWID_LOG_JSON: ${AWID_LOG_JSON:-true}
42
+ AWID_RATE_LIMIT_BACKEND: ${AWID_RATE_LIMIT_BACKEND:-redis}
43
+ depends_on:
44
+ redis:
45
+ condition: service_healthy
46
+ postgres:
47
+ condition: service_healthy
48
+ healthcheck:
49
+ test: ["CMD", "curl", "-f", "http://localhost:8010/health"]
50
+ interval: 30s
51
+ timeout: 5s
52
+ start_period: 30s
53
+ retries: 3
54
+
55
+ volumes:
56
+ postgres_data:
57
+ redis_data:
@@ -0,0 +1,55 @@
1
+ [project]
2
+ name = "awid-service"
3
+ version = "0.2.0"
4
+ description = "awid.ai identity registry service and shared awid primitives package"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "Juan Reyero", email = "juan@juanreyero.com" }
9
+ ]
10
+ requires-python = ">=3.12"
11
+ dependencies = [
12
+ "base58>=2.1.1",
13
+ "dnspython>=2.8.0",
14
+ "fastapi>=0.116.1",
15
+ "httpx>=0.28.1",
16
+ "pgdbm>=0.4.1",
17
+ "publicsuffix2>=2.20191221",
18
+ "pynacl>=1.6.2",
19
+ "pydantic>=2.11.7",
20
+ "pydantic-settings>=2.10.1",
21
+ "redis>=6.4.0",
22
+ "typer>=0.16.1",
23
+ "uvicorn[standard]>=0.35.0",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/awebai/aweb"
28
+ Repository = "https://github.com/awebai/aweb"
29
+ Documentation = "https://github.com/awebai/aweb/tree/main/docs"
30
+
31
+ [project.scripts]
32
+ awid = "awid_service.cli:app"
33
+
34
+ [build-system]
35
+ requires = ["hatchling"]
36
+ build-backend = "hatchling.build"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["src/awid", "src/awid_service"]
40
+
41
+ [tool.hatch.build.targets.sdist]
42
+ exclude = [
43
+ ".claude/",
44
+ "AGENTS.md",
45
+ "CLAUDE.md",
46
+ ]
47
+
48
+ [dependency-groups]
49
+ dev = [
50
+ "pytest>=9.0.0",
51
+ "pytest-asyncio>=1.2.0",
52
+ ]
53
+
54
+ [tool.pytest.ini_options]
55
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ +++
2
+ title = "awid.ai"
3
+ description = "DNS-rooted identity, address, and team registry for the aweb ecosystem"
4
+ +++
@@ -0,0 +1,8 @@
1
+ baseURL = "https://awid.ai/"
2
+ languageCode = "en-us"
3
+ title = "awid.ai"
4
+ disableKinds = ["taxonomy", "term", "RSS", "section", "sitemap", "robotsTXT"]
5
+
6
+ [params]
7
+ tagline = "Identity resolution for agents"
8
+ description = "awid.ai resolves human-readable addresses to cryptographic identities through DNS-verified namespaces."