{"id":51193858,"url":"https://github.com/will8ug/quick-test-apis","last_synced_at":"2026-06-27T18:03:09.050Z","repository":{"id":352631570,"uuid":"1125269848","full_name":"will8ug/quick-test-apis","owner":"will8ug","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-03T15:07:43.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T17:07:31.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/will8ug.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-30T12:32:31.000Z","updated_at":"2026-06-03T15:27:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/will8ug/quick-test-apis","commit_stats":null,"previous_names":["will8ug/quick-test-apis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/will8ug/quick-test-apis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will8ug%2Fquick-test-apis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will8ug%2Fquick-test-apis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will8ug%2Fquick-test-apis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will8ug%2Fquick-test-apis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/will8ug","download_url":"https://codeload.github.com/will8ug/quick-test-apis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will8ug%2Fquick-test-apis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34862629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-27T18:03:08.333Z","updated_at":"2026-06-27T18:03:09.045Z","avatar_url":"https://github.com/will8ug.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quick-test-apis\n\n## 启动 HTTP 服务\n\n```bash\nuv run run.py\n```\n\n---\n\n## 启动 mTLS HTTPS 服务\n\n用于测试客户端证书（Mutual TLS）认证。\n\n### 1. 生成测试证书\n\n```bash\nuv run scripts/generate_certs.py\n```\n\n证书生成到 `certs/` 目录（已加入 `.gitignore`）：\n\n| 文件 | 说明 |\n|------|------|\n| `ca.crt` / `ca.key` | 受信 CA 根证书 |\n| `server.crt` / `server.key` | 服务器证书（localhost） |\n| `client.crt` / `client.key` | 受信客户端证书（PEM） |\n| `client-encrypted.key` | 带 passphrase 的加密私钥（密码：`test-passphrase`） |\n| `client.p12` | PFX/P12 格式 bundle（密码：`test-passphrase`） |\n| `untrusted-ca.crt` | 不受信任的 CA |\n| `untrusted-client.crt` / `untrusted-client.key` | 不受信任 CA 签发的客户端证书 |\n\n### 2. 启动服务\n\n```bash\nuv run run_mtls.py\n```\n\n服务运行在 `https://localhost:10443`\n\n### 3. mTLS 端点\n\n| 端点 | 说明 |\n|------|------|\n| `GET /mtls/echo-cert` | 要求客户端证书，返回证书详情 |\n| `GET /mtls/optional` | 可选客户端证书，有则返回详情，无则提示 |\n| `GET /mtls/verify` | 验证证书并返回 TLS 版本、加密套件等 |\n| `GET /mtls/headers` | 回传所有请求头 + 客户端证书信息 |\n\n### 4. 使用 curl 测试\n\n```bash\n# 不带客户端证书（/mtls/optional 正常返回，/mtls/verify 返回 403）\ncurl -sk https://localhost:10443/mtls/optional\ncurl -sk https://localhost:10443/mtls/verify\n\n# 带受信客户端证书\ncurl -sk \\\n  --cert certs/client.crt \\\n  --key certs/client.key \\\n  --cacert certs/ca.crt \\\n  https://localhost:10443/mtls/echo-cert\n\n# 使用加密私钥（需指定 passphrase）\ncurl -sk \\\n  --cert certs/client.crt \\\n  --key certs/client-encrypted.key \\\n  --pass \"test-passphrase\" \\\n  --cacert certs/ca.crt \\\n  https://localhost:10443/mtls/echo-cert\n\n# 使用不受信任的客户端证书（TLS 握手失败）\ncurl -sk \\\n  --cert certs/untrusted-client.crt \\\n  --key certs/untrusted-client.key \\\n  https://localhost:10443/mtls/optional\n```\n\n---\n\n## 运行测试\n\n```bash\nuv run pytest -v tests/\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwill8ug%2Fquick-test-apis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwill8ug%2Fquick-test-apis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwill8ug%2Fquick-test-apis/lists"}