# Yggdrasil Client based on ADOFAI
基于 [ADOFAI](https://github.com/silverteal/adofai) 和 aiohttp 的 Minecraft Yggdrasil 协议兼容客户端,支持
Mojang 后端。
目前已经实现了 Authlib-Injector Yggdrasil 协议中所有公共(无需认证) API 的包装
Yggdrasil 是 Minecraft 中身份验证服务的实现名称。
## 快速开始
### 安装
```shell
pip install yggdrasil-client
```
### 示例
```python
import asyncio
from uuid import UUID
from adofai import GameName, GameId
from yggdrasil_client import AuthInjCompatibleProvider, MojangProvider
async def usage_example():
littleskin = AuthInjCompatibleProvider("https://littleskin.cn/api/yggdrasil")
mojang = MojangProvider()
async with littleskin as r:
print(await r.has_joined(GameName("Notch"), "serverid"))
print(await r.query_by_name(GameName("NoTcH")))
print((await r.profile_public_key()).export_key().decode())
async with mojang as r:
print(await r.has_joined(GameName("Notch"), "serverid"))
print(await r.query_by_name(GameName("Notch")))
print(await r.query_by_uuid(GameId(UUID("069a79f444e94726a5befca90e38aaf5"))))
print(await r.query_by_uuid_raw(GameId(UUID("069a79f444e94726a5befca90e38aaf5"))))
print((await r.profile_public_keys())[0].export_key().decode())
if __name__ == "__main__":
asyncio.run(usage_example())
```
## 另请参阅
[ADOFAI](https://github.com/silverteal/adofai) 是一组数据模型和配套工具,旨在简化自定义实现 Authlib-injector 的规范
Yggdrasil 服务端、客户端及其配套程序的过程。
[Yggdrasil Scaffold](https://github.com/silverteal/yggdrasil-scaffold) 是基于 ADOFAI 和 FastAPI 的 Yggdrasil
身份验证协议实现脚手架。
Raw data
{
"_id": null,
"home_page": "https://github.com/Silverteal/yggdrasil-client",
"name": "yggdrasil-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "minecraft, mc, authlib, authlib-injector, client, mojang, api, yggdrasil",
"author": "Silverteal",
"author_email": "67404722+Silverteal@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/2d/f9/ed2979217e252442ec706266688e0a30c899c917b639ccb257ed6fbf5d23/yggdrasil_client-0.1.0.dev10.tar.gz",
"platform": null,
"description": "# Yggdrasil Client based on ADOFAI\n\n\u57fa\u4e8e [ADOFAI](https://github.com/silverteal/adofai) \u548c aiohttp \u7684 Minecraft Yggdrasil \u534f\u8bae\u517c\u5bb9\u5ba2\u6237\u7aef\uff0c\u652f\u6301\nMojang \u540e\u7aef\u3002\n\n\u76ee\u524d\u5df2\u7ecf\u5b9e\u73b0\u4e86 Authlib-Injector Yggdrasil \u534f\u8bae\u4e2d\u6240\u6709\u516c\u5171\uff08\u65e0\u9700\u8ba4\u8bc1\uff09 API \u7684\u5305\u88c5\n\nYggdrasil \u662f Minecraft \u4e2d\u8eab\u4efd\u9a8c\u8bc1\u670d\u52a1\u7684\u5b9e\u73b0\u540d\u79f0\u3002\n\n## \u5feb\u901f\u5f00\u59cb\n\n### \u5b89\u88c5\n\n```shell\npip install yggdrasil-client\n```\n\n### \u793a\u4f8b\n\n```python\nimport asyncio\nfrom uuid import UUID\nfrom adofai import GameName, GameId\nfrom yggdrasil_client import AuthInjCompatibleProvider, MojangProvider\n\n\nasync def usage_example():\n littleskin = AuthInjCompatibleProvider(\"https://littleskin.cn/api/yggdrasil\")\n mojang = MojangProvider()\n async with littleskin as r:\n print(await r.has_joined(GameName(\"Notch\"), \"serverid\"))\n print(await r.query_by_name(GameName(\"NoTcH\")))\n print((await r.profile_public_key()).export_key().decode())\n\n async with mojang as r:\n print(await r.has_joined(GameName(\"Notch\"), \"serverid\"))\n print(await r.query_by_name(GameName(\"Notch\")))\n\n print(await r.query_by_uuid(GameId(UUID(\"069a79f444e94726a5befca90e38aaf5\"))))\n print(await r.query_by_uuid_raw(GameId(UUID(\"069a79f444e94726a5befca90e38aaf5\"))))\n print((await r.profile_public_keys())[0].export_key().decode())\n\nif __name__ == \"__main__\":\n asyncio.run(usage_example())\n\n```\n\n## \u53e6\u8bf7\u53c2\u9605\n\n[ADOFAI](https://github.com/silverteal/adofai) \u662f\u4e00\u7ec4\u6570\u636e\u6a21\u578b\u548c\u914d\u5957\u5de5\u5177\uff0c\u65e8\u5728\u7b80\u5316\u81ea\u5b9a\u4e49\u5b9e\u73b0 Authlib-injector \u7684\u89c4\u8303\nYggdrasil \u670d\u52a1\u7aef\u3001\u5ba2\u6237\u7aef\u53ca\u5176\u914d\u5957\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u3002\n\n[Yggdrasil Scaffold](https://github.com/silverteal/yggdrasil-scaffold) \u662f\u57fa\u4e8e ADOFAI \u548c FastAPI \u7684 Yggdrasil\n\u8eab\u4efd\u9a8c\u8bc1\u534f\u8bae\u5b9e\u73b0\u811a\u624b\u67b6\u3002",
"bugtrack_url": null,
"license": "MIT",
"summary": "Minecraft Yggdrasil protocol compatible client based on ADOFAI. Supports mojang backend.",
"version": "0.1.0.dev10",
"project_urls": {
"Homepage": "https://github.com/Silverteal/yggdrasil-client",
"Repository": "https://github.com/Silverteal/yggdrasil-client"
},
"split_keywords": [
"minecraft",
" mc",
" authlib",
" authlib-injector",
" client",
" mojang",
" api",
" yggdrasil"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ac5100613438147ae32708ec88a804339df12fd7625ec9702b5316943a9e80f",
"md5": "0c5de8539b7e0811f4b55dd97173c8b9",
"sha256": "04fb140eb019b4737587a6d00d2abcd70b7aa55d3f65c798c83f37232abcd2d9"
},
"downloads": -1,
"filename": "yggdrasil_client-0.1.0.dev10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0c5de8539b7e0811f4b55dd97173c8b9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 6011,
"upload_time": "2024-10-05T14:07:33",
"upload_time_iso_8601": "2024-10-05T14:07:33.894020Z",
"url": "https://files.pythonhosted.org/packages/7a/c5/100613438147ae32708ec88a804339df12fd7625ec9702b5316943a9e80f/yggdrasil_client-0.1.0.dev10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2df9ed2979217e252442ec706266688e0a30c899c917b639ccb257ed6fbf5d23",
"md5": "cf37bfef8568a4ddd0328f4ed8e8fbbd",
"sha256": "5c3be934111203b567dfb7e42c4f4f919ee37cecdb5de408548d58c29e7beef9"
},
"downloads": -1,
"filename": "yggdrasil_client-0.1.0.dev10.tar.gz",
"has_sig": false,
"md5_digest": "cf37bfef8568a4ddd0328f4ed8e8fbbd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 5055,
"upload_time": "2024-10-05T14:07:36",
"upload_time_iso_8601": "2024-10-05T14:07:36.193390Z",
"url": "https://files.pythonhosted.org/packages/2d/f9/ed2979217e252442ec706266688e0a30c899c917b639ccb257ed6fbf5d23/yggdrasil_client-0.1.0.dev10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-05 14:07:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Silverteal",
"github_project": "yggdrasil-client",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "yggdrasil-client"
}