mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
feat(bedrock): Update Bedrock support to 26.10 (#2067)
* Update Bedrock support to 26.10 Co-authored-by: A. Jakubiak <contact@jakubiak.fr> * Fix key extraction for self-signed * Restructure login to fix resource pack race condition * Undo unrelated changes to blocks * Fix relavent clippy warnings. --------- Co-authored-by: A. Jakubiak <contact@jakubiak.fr>
This commit is contained in:
27
Cargo.lock
generated
27
Cargo.lock
generated
@@ -2608,9 +2608,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.11.0-rc.11"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12922b6296c06eb741b02d7b5161e3aaa22864af38dfa025a1a3ba3f68c84577"
|
||||
checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7"
|
||||
dependencies = [
|
||||
"der 0.8.0",
|
||||
"spki 0.8.0",
|
||||
@@ -2803,7 +2803,6 @@ dependencies = [
|
||||
"notify",
|
||||
"num-bigint",
|
||||
"ordered-float",
|
||||
"pkcs8 0.11.0-rc.11",
|
||||
"postcard",
|
||||
"pumpkin-config",
|
||||
"pumpkin-data",
|
||||
@@ -2821,6 +2820,7 @@ dependencies = [
|
||||
"rustyline",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"sha1",
|
||||
"sha2 0.11.0",
|
||||
"sysinfo",
|
||||
@@ -2962,6 +2962,7 @@ dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"colored",
|
||||
"crypto-bigint 0.7.3",
|
||||
"ecdsa",
|
||||
"enum_dispatch",
|
||||
"md5",
|
||||
@@ -2971,11 +2972,14 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"pumpkin-nbt",
|
||||
"quote",
|
||||
"rsa",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.0",
|
||||
"syn",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"ureq",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
@@ -3202,16 +3206,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rsa"
|
||||
version = "0.10.0-rc.17"
|
||||
version = "0.10.0-rc.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87ed3e93fc7e473e464b9726f4759659e72bc8665e4b8ea227547024f416d905"
|
||||
checksum = "30b2aa4ba0d89f73d1e332df05be0eeab8840351c36ca5654341dfdb57bb3caf"
|
||||
dependencies = [
|
||||
"const-oid 0.10.2",
|
||||
"crypto-bigint 0.7.3",
|
||||
"crypto-primes",
|
||||
"digest 0.11.2",
|
||||
"pkcs1",
|
||||
"pkcs8 0.11.0-rc.11",
|
||||
"pkcs8 0.11.0",
|
||||
"rand_core 0.10.1",
|
||||
"signature 3.0.0-rc.10",
|
||||
"spki 0.8.0",
|
||||
@@ -3449,6 +3453,17 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_repr"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.1.1"
|
||||
|
||||
@@ -104,6 +104,7 @@ crossbeam = "0.8"
|
||||
|
||||
uuid = { version = "1.23", features = ["serde", "v3", "v4"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_repr = { version = "0.1" }
|
||||
serde_json = "1.0"
|
||||
|
||||
tempfile = { version = "3.27.0", default-features = false }
|
||||
@@ -120,6 +121,7 @@ crc-fast = "1.10.0"
|
||||
criterion = { version = "0.8", default-features = false }
|
||||
crossbeam-utils = "0.8.21"
|
||||
crossfire = { version = "3.1.7", features = ["compat"] }
|
||||
crypto-bigint = "0.7.3"
|
||||
dashmap = "6.1"
|
||||
ecdsa = "0.16.9"
|
||||
either = "1.15.0"
|
||||
@@ -138,7 +140,6 @@ num-derive = "0.4"
|
||||
num-traits = "0.2"
|
||||
p384 = "0.13.1"
|
||||
phf = "0.13.1"
|
||||
pkcs8 = "=0.11.0-rc.11"
|
||||
proc-macro2 = "1.0"
|
||||
pumpkin-codecs = { path = "pumpkin-codecs" }
|
||||
pumpkin-config = { path = "pumpkin-config" }
|
||||
@@ -151,7 +152,7 @@ pumpkin-util = { path = "pumpkin-util" }
|
||||
pumpkin-world = { path = "pumpkin-world" }
|
||||
quote = "1.0"
|
||||
rand = "0.10.1"
|
||||
rsa = "=0.10.0-rc.17"
|
||||
rsa = "=0.10.0-rc.18"
|
||||
cipher = "0.5.1"
|
||||
rustc-hash = "2.1.2"
|
||||
rustyline = "18.0.0"
|
||||
|
||||
Binary file not shown.
506
pumpkin-codegen/Cargo.lock
generated
506
pumpkin-codegen/Cargo.lock
generated
@@ -26,6 +26,12 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
|
||||
|
||||
[[package]]
|
||||
name = "base16ct"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.1"
|
||||
@@ -53,6 +59,15 @@ dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be"
|
||||
dependencies = [
|
||||
"hybrid-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.19.1"
|
||||
@@ -65,6 +80,16 @@ version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cesu8"
|
||||
version = "1.1.0"
|
||||
@@ -77,13 +102,19 @@ version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "cmov"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746"
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "3.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -92,6 +123,18 @@ version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
|
||||
|
||||
[[package]]
|
||||
name = "cpubits"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ef0c543070d296ea414df2dd7625d1b24866ce206709d8a4a424f28377f5861"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.17"
|
||||
@@ -101,6 +144,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
@@ -142,11 +194,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-bigint"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42a0d26b245348befa0c121944541476763dcc46ede886c88f9d12e1697d27c3"
|
||||
dependencies = [
|
||||
"cpubits",
|
||||
"ctutils",
|
||||
"num-traits",
|
||||
"rand_core 0.10.1",
|
||||
"serdect",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
@@ -157,14 +223,54 @@ dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710"
|
||||
dependencies = [
|
||||
"hybrid-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-primes"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21f41f23de7d24cdbda7f0c4d9c0351f99a4ceb258ef30e5c1927af8987ffe5a"
|
||||
dependencies = [
|
||||
"crypto-bigint 0.7.3",
|
||||
"libm",
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctutils"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
|
||||
dependencies = [
|
||||
"cmov",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"pem-rfc7468",
|
||||
"const-oid 0.9.6",
|
||||
"pem-rfc7468 0.7.0",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71fd89660b2dc699704064e59e9dba0147b903e85319429e131620d022be411b"
|
||||
dependencies = [
|
||||
"const-oid 0.10.2",
|
||||
"pem-rfc7468 1.0.0",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@@ -174,24 +280,35 @@ version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"const-oid",
|
||||
"crypto-common",
|
||||
"block-buffer 0.10.4",
|
||||
"const-oid 0.9.6",
|
||||
"crypto-common 0.1.6",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c"
|
||||
dependencies = [
|
||||
"block-buffer 0.12.0",
|
||||
"const-oid 0.10.2",
|
||||
"crypto-common 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ecdsa"
|
||||
version = "0.16.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
|
||||
dependencies = [
|
||||
"der",
|
||||
"digest",
|
||||
"der 0.7.10",
|
||||
"digest 0.10.7",
|
||||
"elliptic-curve",
|
||||
"rfc6979",
|
||||
"signature",
|
||||
"spki",
|
||||
"signature 2.2.0",
|
||||
"spki 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -206,16 +323,16 @@ version = "0.13.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
|
||||
dependencies = [
|
||||
"base16ct",
|
||||
"crypto-bigint",
|
||||
"digest",
|
||||
"base16ct 0.2.0",
|
||||
"crypto-bigint 0.5.5",
|
||||
"digest 0.10.7",
|
||||
"ff",
|
||||
"generic-array",
|
||||
"group",
|
||||
"hkdf",
|
||||
"pem-rfc7468",
|
||||
"pkcs8",
|
||||
"rand_core",
|
||||
"pem-rfc7468 0.7.0",
|
||||
"pkcs8 0.10.2",
|
||||
"rand_core 0.6.4",
|
||||
"sec1",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
@@ -245,10 +362,16 @@ version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.9"
|
||||
@@ -307,7 +430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
|
||||
dependencies = [
|
||||
"ff",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
@@ -347,7 +470,32 @@ version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||
|
||||
[[package]]
|
||||
name = "hybrid-array"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d46837a0ed51fe95bd3b05de33cd64a1ee88fc797477ca48446872504507c5"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -396,6 +544,12 @@ version = "0.2.180"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.29"
|
||||
@@ -409,7 +563,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"digest",
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -469,7 +623,7 @@ dependencies = [
|
||||
"ecdsa",
|
||||
"elliptic-curve",
|
||||
"primeorder",
|
||||
"sha2",
|
||||
"sha2 0.10.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -481,6 +635,21 @@ dependencies = [
|
||||
"base64ct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pem-rfc7468"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.8.6"
|
||||
@@ -521,7 +690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220"
|
||||
dependencies = [
|
||||
"pest",
|
||||
"sha2",
|
||||
"sha2 0.10.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -530,14 +699,34 @@ version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs1"
|
||||
version = "0.8.0-rc.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "986d2e952779af96ea048f160fd9194e1751b4faea78bcf3ceb456efe008088e"
|
||||
dependencies = [
|
||||
"der 0.8.0",
|
||||
"spki 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
"der 0.7.10",
|
||||
"spki 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7"
|
||||
dependencies = [
|
||||
"der 0.8.0",
|
||||
"spki 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -616,6 +805,7 @@ dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
"colored",
|
||||
"crypto-bigint 0.7.3",
|
||||
"ecdsa",
|
||||
"enum_dispatch",
|
||||
"md5",
|
||||
@@ -625,11 +815,14 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"pumpkin-nbt",
|
||||
"quote",
|
||||
"rsa",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.0",
|
||||
"syn",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"ureq",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
@@ -657,6 +850,12 @@ dependencies = [
|
||||
"getrandom 0.2.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.11.0"
|
||||
@@ -687,6 +886,73 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"getrandom 0.2.17",
|
||||
"libc",
|
||||
"untrusted",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rsa"
|
||||
version = "0.10.0-rc.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30b2aa4ba0d89f73d1e332df05be0eeab8840351c36ca5654341dfdb57bb3caf"
|
||||
dependencies = [
|
||||
"const-oid 0.10.2",
|
||||
"crypto-bigint 0.7.3",
|
||||
"crypto-primes",
|
||||
"digest 0.11.2",
|
||||
"pkcs1",
|
||||
"pkcs8 0.11.0",
|
||||
"rand_core 0.10.1",
|
||||
"signature 3.0.0-rc.10",
|
||||
"spki 0.8.0",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c2c118cb077cca2822033836dfb1b975355dfb784b5e8da48f7b6c5db74e60e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9"
|
||||
dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.103.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.22"
|
||||
@@ -699,10 +965,10 @@ version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
|
||||
dependencies = [
|
||||
"base16ct",
|
||||
"der",
|
||||
"base16ct 0.2.0",
|
||||
"der 0.7.10",
|
||||
"generic-array",
|
||||
"pkcs8",
|
||||
"pkcs8 0.10.2",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
@@ -767,6 +1033,16 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serdect"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9af4a3e75ebd5599b30d4de5768e00b5095d518a79fefc3ecbaf77e665d1ec06"
|
||||
dependencies = [
|
||||
"base16ct 1.0.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.9"
|
||||
@@ -774,18 +1050,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
"cpufeatures 0.2.17",
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures 0.3.0",
|
||||
"digest 0.11.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"rand_core",
|
||||
"digest 0.10.7",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "3.0.0-rc.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f1880df446116126965eeec169136b2e0251dba37c6223bcc819569550edea3"
|
||||
dependencies = [
|
||||
"digest 0.11.2",
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -801,7 +1104,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
"der 0.7.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -883,9 +1196,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.19.0"
|
||||
version = "1.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
||||
checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
@@ -905,6 +1218,47 @@ version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "ureq"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"flate2",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"ureq-proto",
|
||||
"utf8-zero",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ureq-proto"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8-zero"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.23.0"
|
||||
@@ -1027,12 +1381,30 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
@@ -1042,6 +1414,70 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.51.0"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,7 @@
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_util::math::position::BlockPos;
|
||||
|
||||
use crate::{
|
||||
codec::{bedrock_block_pos::NetworkPos, var_long::VarLong},
|
||||
serial::PacketWrite,
|
||||
};
|
||||
use crate::{codec::var_long::VarLong, serial::PacketWrite};
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
#[packet(46)]
|
||||
@@ -11,6 +9,6 @@ pub struct CContainerOpen {
|
||||
// https://mojang.github.io/bedrock-protocol-docs/html/ContainerOpenPacket.html
|
||||
pub container_id: u8,
|
||||
pub container_type: u8,
|
||||
pub position: NetworkPos,
|
||||
pub position: BlockPos,
|
||||
pub target_entity_id: VarLong,
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ use pumpkin_macros::packet;
|
||||
use pumpkin_util::math::{position::BlockPos, vector2::Vector2};
|
||||
|
||||
use crate::{
|
||||
codec::{bedrock_block_pos::NetworkPos, var_int::VarInt, var_uint::VarUInt},
|
||||
codec::{var_int::VarInt, var_uint::VarUInt},
|
||||
serial::PacketWrite,
|
||||
};
|
||||
|
||||
#[packet(121)]
|
||||
pub struct CNetworkChunkPublisherUpdate {
|
||||
// https://mojang.github.io/bedrock-protocol-docs/html/NetworkChunkPublisherUpdatePacket.html
|
||||
pub pos_for_view: NetworkPos,
|
||||
pub pos_for_view: BlockPos,
|
||||
// Is in blocks, not chunks!
|
||||
pub new_radius: VarUInt,
|
||||
// TODO
|
||||
@@ -22,7 +22,7 @@ impl CNetworkChunkPublisherUpdate {
|
||||
#[must_use]
|
||||
pub const fn new(pos_for_view: BlockPos, new_radius: u32) -> Self {
|
||||
Self {
|
||||
pos_for_view: NetworkPos(pos_for_view),
|
||||
pos_for_view,
|
||||
new_radius: VarUInt(new_radius),
|
||||
server_build_chunk_list: Vec::new(),
|
||||
}
|
||||
@@ -31,7 +31,7 @@ impl CNetworkChunkPublisherUpdate {
|
||||
|
||||
impl PacketWrite for CNetworkChunkPublisherUpdate {
|
||||
fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error> {
|
||||
self.pos_for_view.write_signed(writer)?;
|
||||
self.pos_for_view.write(writer)?;
|
||||
self.new_radius.write(writer)?;
|
||||
|
||||
(self.server_build_chunk_list.len() as u32).write(writer)?;
|
||||
|
||||
@@ -5,6 +5,7 @@ use crate::{
|
||||
serial::PacketWrite,
|
||||
};
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_util::math::{position::BlockPos, vector3::Vector3};
|
||||
use std::io::Error;
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
@@ -83,9 +84,9 @@ pub enum MetadataValue {
|
||||
Float(f32),
|
||||
String(String),
|
||||
CompoundTag,
|
||||
BlockPos,
|
||||
BlockPos(BlockPos),
|
||||
Long(i64),
|
||||
Vec3,
|
||||
Vec3(Vector3<f32>),
|
||||
}
|
||||
|
||||
impl MetadataValue {
|
||||
@@ -98,9 +99,9 @@ impl MetadataValue {
|
||||
Self::Float(_) => 3,
|
||||
Self::String(_) => 4,
|
||||
Self::CompoundTag => 5,
|
||||
Self::BlockPos => 6,
|
||||
Self::BlockPos(_) => 6,
|
||||
Self::Long(_) => 7,
|
||||
Self::Vec3 => 8,
|
||||
Self::Vec3(_) => 8,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,16 +109,17 @@ impl MetadataValue {
|
||||
match self {
|
||||
Self::Byte(v) => v.write(writer),
|
||||
Self::Short(v) => v.write(writer),
|
||||
// Type 2: Signed VarInt
|
||||
Self::Int(v) => VarInt(*v).write(writer),
|
||||
// Type 3: LE Float (4 bytes)
|
||||
Self::Float(v) => writer.write_all(&v.to_le_bytes()),
|
||||
// Type 4: VarInt length + UTF8 String
|
||||
Self::String(v) => v.write(writer),
|
||||
Self::CompoundTag => todo!(),
|
||||
Self::BlockPos => todo!(),
|
||||
Self::BlockPos(v) => v.write(writer),
|
||||
Self::Long(v) => VarLong(*v).write(writer),
|
||||
Self::Vec3 => todo!(),
|
||||
Self::Vec3(v) => {
|
||||
writer.write_all(&v.x.to_le_bytes())?;
|
||||
writer.write_all(&v.y.to_le_bytes())?;
|
||||
writer.write_all(&v.z.to_le_bytes())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ use std::io::{Error, Write};
|
||||
|
||||
use crate::{
|
||||
bedrock::client::gamerules_changed::GameRules,
|
||||
codec::{
|
||||
bedrock_block_pos::NetworkPos, var_int::VarInt, var_long::VarLong, var_uint::VarUInt,
|
||||
var_ulong::VarULong,
|
||||
},
|
||||
codec::{var_int::VarInt, var_long::VarLong, var_uint::VarUInt, var_ulong::VarULong},
|
||||
serial::PacketWrite,
|
||||
};
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_util::{GameMode, math::vector3::Vector3};
|
||||
use pumpkin_util::{
|
||||
GameMode,
|
||||
math::{position::BlockPos, vector3::Vector3},
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
@@ -63,17 +63,33 @@ pub struct CStartGame {
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
pub struct ServerJoinInformation {
|
||||
gathering_info: Option<GatheringJoinInfo>,
|
||||
gathering: Option<GatheringJoinInfo>,
|
||||
store_entry_point: Option<StoreEntryPointInfo>,
|
||||
presence: Option<PresenceInfo>,
|
||||
}
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
pub struct GatheringJoinInfo {
|
||||
experience_id: String,
|
||||
experience_id: Uuid,
|
||||
experience_name: String,
|
||||
experience_world_id: String,
|
||||
experience_world_id: Uuid,
|
||||
experience_world_name: String,
|
||||
creator_id: String,
|
||||
unknown_uuid_1: Uuid,
|
||||
unknown_uuid_2: Uuid,
|
||||
server_id: String,
|
||||
}
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
pub struct StoreEntryPointInfo {
|
||||
store_id: String,
|
||||
store_name: String,
|
||||
}
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
pub struct PresenceInfo {
|
||||
experience_name: String,
|
||||
world_name: String,
|
||||
}
|
||||
|
||||
#[derive(PacketWrite)]
|
||||
@@ -100,7 +116,7 @@ pub struct LevelSettings {
|
||||
pub world_gamemode: GameMode,
|
||||
pub hardcore: bool,
|
||||
pub difficulty: VarInt,
|
||||
pub spawn_position: NetworkPos,
|
||||
pub spawn_position: BlockPos,
|
||||
pub has_achievements_disabled: bool,
|
||||
pub editor_world_type: VarInt,
|
||||
pub is_created_in_editor: bool,
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
use std::io::{Error, Write};
|
||||
|
||||
use pumpkin_util::math::position::BlockPos;
|
||||
|
||||
use crate::{
|
||||
codec::{var_int::VarInt, var_uint::VarUInt},
|
||||
serial::PacketWrite,
|
||||
};
|
||||
|
||||
/// A wrapper for `BlockPos` that handles Bedrock-specific network serialization.
|
||||
///
|
||||
/// Bedrock Edition encodes coordinates differently than Java Edition, using
|
||||
/// `VarInt`'s to save bandwidth.
|
||||
pub struct NetworkPos(pub BlockPos);
|
||||
|
||||
impl NetworkPos {
|
||||
/// Writes coordinates where all axes (X, Y, Z) are treated as signed `VarInt`.
|
||||
pub fn write_signed<W: Write>(&self, writer: &mut W) -> Result<(), Error> {
|
||||
VarInt(self.0.0.x).write(writer)?;
|
||||
VarInt(self.0.0.y).write(writer)?;
|
||||
VarInt(self.0.0.z).write(writer)
|
||||
}
|
||||
}
|
||||
|
||||
impl PacketWrite for NetworkPos {
|
||||
/// The default Bedrock network encoding for block positions.
|
||||
///
|
||||
/// Note: X and Z are signed (`VarInt`), but Y is unsigned (`VarUInt`).
|
||||
/// This matches the standard Bedrock block action and block update packets
|
||||
fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error> {
|
||||
VarInt(self.0.0.x).write(writer)?;
|
||||
VarUInt(self.0.0.y as u32).write(writer)?;
|
||||
VarInt(self.0.0.z).write(writer)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
pub mod bedrock_block_pos;
|
||||
pub mod bit_set;
|
||||
pub mod bitset;
|
||||
pub mod data_component;
|
||||
|
||||
@@ -27,6 +27,10 @@ base64.workspace = true
|
||||
p384 = { workspace = true, features = ["ecdsa"] }
|
||||
thiserror.workspace = true
|
||||
ecdsa.workspace = true
|
||||
rsa.workspace = true
|
||||
sha2.workspace = true
|
||||
crypto-bigint.workspace = true
|
||||
ureq.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -13,19 +13,16 @@ use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Represents the claims extracted from the player's JWT token.
|
||||
/// Represents the claims extracted from a Minecraft Bedrock player's JWT token.
|
||||
///
|
||||
/// This struct contains the player's display name, UUID, and XUID.
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug)]
|
||||
pub struct PlayerClaims {
|
||||
/// The player's display name (in-game name).
|
||||
#[serde(rename = "displayName")]
|
||||
pub display_name: String,
|
||||
/// The player's unique identifier (UUID).
|
||||
#[serde(rename = "identity")]
|
||||
pub uuid: String,
|
||||
/// The player's Xbox User ID (XUID).
|
||||
#[serde(rename = "XUID")]
|
||||
pub xuid: String,
|
||||
}
|
||||
|
||||
@@ -135,78 +132,371 @@ pub fn decode_header_get_x5u(header_b64: &str) -> Result<String, AuthError> {
|
||||
Err(AuthError::MissingX5U)
|
||||
}
|
||||
|
||||
/// Verifies a chain of JWT tokens from a Minecraft: Bedrock Edition client.
|
||||
///
|
||||
/// This function performs the following steps:
|
||||
/// 1. Decodes and verifies each token in the chain.
|
||||
/// 2. Ensures that the chain is properly linked, with each token being signed by the key from the previous one.
|
||||
/// 3. Verifies that the second token in the chain is signed by the trusted Mojang public key.
|
||||
/// 4. Extracts and returns the player's claims from the final token in the chain.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `raw_chain` - A slice of strings, where each string is a raw JWT token.
|
||||
/// * `mojang_key_b64` - The Base64 encoded Mojang public key.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `Result` containing the `PlayerClaims` if verification is successful, or an `AuthError` if it fails.
|
||||
pub fn verify_chain(raw_chain: &[&str], mojang_key_b64: &str) -> Result<PlayerClaims, AuthError> {
|
||||
let mojang_pk = VerifyingKey::from(build_public_key_from_b64(mojang_key_b64)?);
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Jwks {
|
||||
pub keys: Vec<Jwk>,
|
||||
}
|
||||
|
||||
let tokens: Vec<String> = raw_chain
|
||||
.iter()
|
||||
.map(|t| t.trim().replace(['\n', '\r'], ""))
|
||||
.collect();
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct Jwk {
|
||||
pub kty: String,
|
||||
#[serde(default)]
|
||||
pub alg: Option<String>,
|
||||
#[serde(default)]
|
||||
pub crv: Option<String>,
|
||||
pub x: Option<String>,
|
||||
pub y: Option<String>,
|
||||
pub n: Option<String>,
|
||||
pub e: Option<String>,
|
||||
pub kid: String,
|
||||
}
|
||||
|
||||
let first_token = tokens.first().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let first_header_b64 = first_token
|
||||
.split('.')
|
||||
.next()
|
||||
.ok_or(AuthError::InvalidTokenFormat)?;
|
||||
|
||||
let mut current_verifying_key = VerifyingKey::from(build_public_key_from_b64(
|
||||
&decode_header_get_x5u(first_header_b64)?,
|
||||
)?);
|
||||
|
||||
// 4. Verification Loop
|
||||
for (i, token) in tokens.iter().enumerate() {
|
||||
let (signing_input, b64_sig) = token
|
||||
.rsplit_once('.')
|
||||
.ok_or(AuthError::InvalidTokenFormat)?;
|
||||
|
||||
let sig_bytes = decode_b64_url_nopad(b64_sig)?;
|
||||
let signature =
|
||||
Signature::from_slice(&sig_bytes).map_err(|_| AuthError::InvalidSignature)?;
|
||||
|
||||
current_verifying_key
|
||||
.verify(signing_input.as_bytes(), &signature)
|
||||
.map_err(|_| AuthError::InvalidSignature)?;
|
||||
|
||||
if i == 1 && current_verifying_key != mojang_pk {
|
||||
return Err(AuthError::MojangKeyMismatch);
|
||||
impl Jwk {
|
||||
pub fn to_ec_public_key(&self) -> Result<PublicKey, AuthError> {
|
||||
if self.kty != "EC" {
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"Unsupported JWK kty for EC: {}",
|
||||
self.kty
|
||||
)));
|
||||
}
|
||||
|
||||
let payload_b64 = signing_input
|
||||
.split('.')
|
||||
.nth(1)
|
||||
.ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let payload_bytes = decode_b64_url_nopad(payload_b64)?;
|
||||
let payload: Value = serde_json::from_slice(&payload_bytes)?;
|
||||
if let Some(ref crv) = self.crv
|
||||
&& crv != "P-384"
|
||||
{
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"Unsupported JWK crv: {crv}"
|
||||
)));
|
||||
}
|
||||
|
||||
if let Some(next_key_b64) = payload.get("identityPublicKey").and_then(|v| v.as_str()) {
|
||||
current_verifying_key = VerifyingKey::from(build_public_key_from_b64(next_key_b64)?);
|
||||
let x = self.x.as_ref().ok_or_else(|| {
|
||||
AuthError::PublicKeyBuild("JWK missing x coordinate for EC key".into())
|
||||
})?;
|
||||
let y = self.y.as_ref().ok_or_else(|| {
|
||||
AuthError::PublicKeyBuild("JWK missing y coordinate for EC key".into())
|
||||
})?;
|
||||
|
||||
let x_bytes = decode_b64_url_nopad(x)?;
|
||||
let y_bytes = decode_b64_url_nopad(y)?;
|
||||
|
||||
if x_bytes.len() != 48 || y_bytes.len() != 48 {
|
||||
return Err(AuthError::PublicKeyBuild(
|
||||
"Invalid P-384 coordinate lengths".into(),
|
||||
));
|
||||
}
|
||||
|
||||
let mut sec1 = Vec::with_capacity(97);
|
||||
sec1.push(0x04u8);
|
||||
sec1.extend_from_slice(&x_bytes);
|
||||
sec1.extend_from_slice(&y_bytes);
|
||||
|
||||
PublicKey::from_sec1_bytes(&sec1).map_err(|e| AuthError::PublicKeyBuild(e.to_string()))
|
||||
}
|
||||
|
||||
pub fn to_rsa_public_key(&self) -> Result<rsa::RsaPublicKey, AuthError> {
|
||||
if self.kty != "RSA" {
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"Unsupported JWK kty for RSA: {}",
|
||||
self.kty
|
||||
)));
|
||||
}
|
||||
|
||||
let n = self
|
||||
.n
|
||||
.as_ref()
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("JWK missing n modulus for RSA key".into()))?;
|
||||
let e = self.e.as_ref().ok_or_else(|| {
|
||||
AuthError::PublicKeyBuild("JWK missing e exponent for RSA key".into())
|
||||
})?;
|
||||
|
||||
let n_bytes = decode_b64_url_nopad(n)?;
|
||||
let e_bytes = decode_b64_url_nopad(e)?;
|
||||
|
||||
let n_boxed = crypto_bigint::BoxedUint::from_be_slice_vartime(&n_bytes);
|
||||
let e_boxed = crypto_bigint::BoxedUint::from_be_slice_vartime(&e_bytes);
|
||||
|
||||
rsa::RsaPublicKey::new(n_boxed, e_boxed)
|
||||
.map_err(|err| AuthError::PublicKeyBuild(err.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
pub const OIDC_ISSUER: &str = "https://identity.minecraft-services.net";
|
||||
pub const OIDC_AUDIENCE: &str = "api://auth-minecraft-services/multiplayer";
|
||||
pub const OIDC_DISCOVERY_URL: &str =
|
||||
"https://client.discovery.minecraft-services.net/api/v1.0/discovery/MinecraftPE/builds/1.0.0.0";
|
||||
|
||||
pub fn fetch_oidc_jwks() -> Result<(String, Jwks), AuthError> {
|
||||
let discovery: Value = ureq::get(OIDC_DISCOVERY_URL)
|
||||
.call()
|
||||
.map_err(|e| AuthError::PublicKeyBuild(e.to_string()))?
|
||||
.body_mut()
|
||||
.read_to_string()
|
||||
.map_err(|e| AuthError::PublicKeyBuild(format!("Failed to read response: {e}")))
|
||||
.and_then(|s| {
|
||||
serde_json::from_str(&s).map_err(|e| AuthError::PublicKeyBuild(e.to_string()))
|
||||
})?;
|
||||
|
||||
let service_uri = discovery
|
||||
.get("result")
|
||||
.and_then(|v| v.get("serviceEnvironments"))
|
||||
.and_then(|v| v.get("auth"))
|
||||
.and_then(|v| v.get("prod"))
|
||||
.and_then(|v| v.get("serviceUri"))
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("Discovery missing serviceUri".into()))?;
|
||||
|
||||
let openid_config_url = format!("{service_uri}/.well-known/openid-configuration");
|
||||
let openid_config: Value = ureq::get(&openid_config_url)
|
||||
.call()
|
||||
.map_err(|e| AuthError::PublicKeyBuild(e.to_string()))?
|
||||
.body_mut()
|
||||
.read_to_string()
|
||||
.map_err(|e| AuthError::PublicKeyBuild(format!("Failed to read response: {e}")))
|
||||
.and_then(|s| {
|
||||
serde_json::from_str(&s).map_err(|e| AuthError::PublicKeyBuild(e.to_string()))
|
||||
})?;
|
||||
|
||||
let jwks_uri = openid_config
|
||||
.get("jwks_uri")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OpenID config missing jwks_uri".into()))?;
|
||||
|
||||
let issuer = openid_config
|
||||
.get("issuer")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OpenID config missing issuer".into()))?
|
||||
.to_string();
|
||||
|
||||
let jwks: Jwks = ureq::get(jwks_uri)
|
||||
.call()
|
||||
.map_err(|e| AuthError::PublicKeyBuild(e.to_string()))?
|
||||
.body_mut()
|
||||
.read_to_string()
|
||||
.map_err(|e| AuthError::PublicKeyBuild(format!("Failed to read response: {e}")))
|
||||
.and_then(|s| {
|
||||
serde_json::from_str(&s).map_err(|e| AuthError::PublicKeyBuild(e.to_string()))
|
||||
})?;
|
||||
|
||||
Ok((issuer, jwks))
|
||||
}
|
||||
|
||||
pub fn verify_oidc_token(
|
||||
token: &str,
|
||||
expected_issuer: &str,
|
||||
jwks: &Jwks,
|
||||
) -> Result<PlayerClaims, AuthError> {
|
||||
let mut parts = token.split('.');
|
||||
let header_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let payload_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let signature_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
|
||||
let signing_input = format!("{header_b64}.{payload_b64}");
|
||||
|
||||
let header_bytes = decode_b64_url_nopad(header_b64)?;
|
||||
let header: Value = serde_json::from_slice(&header_bytes)?;
|
||||
let kid = header
|
||||
.get("kid")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OIDC header missing kid".into()))?;
|
||||
let alg = header
|
||||
.get("alg")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OIDC header missing alg".into()))?;
|
||||
|
||||
let jwk = jwks
|
||||
.keys
|
||||
.iter()
|
||||
.find(|k| k.kid == kid)
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild(format!("Key not found in JWKS: {kid}")))?;
|
||||
|
||||
if alg == "ES384" {
|
||||
verify_es384_signature(&jwk.to_ec_public_key()?, &signing_input, signature_b64)?;
|
||||
} else if alg == "RS256" {
|
||||
verify_rs256_signature(jwk, &signing_input, signature_b64)?;
|
||||
} else {
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"Unsupported OIDC algorithm: {alg}"
|
||||
)));
|
||||
}
|
||||
|
||||
let payload_bytes = decode_b64_url_nopad(payload_b64)?;
|
||||
let v: Value = serde_json::from_slice(&payload_bytes)?;
|
||||
|
||||
verify_oidc_claims(&v, Some(expected_issuer))?;
|
||||
|
||||
Ok(extract_oidc_player_claims(&v))
|
||||
}
|
||||
|
||||
pub fn verify_oidc_token_self_signed(token: &str) -> Result<PlayerClaims, AuthError> {
|
||||
let mut parts = token.split('.');
|
||||
let header_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let payload_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let signature_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
|
||||
let signing_input = format!("{header_b64}.{payload_b64}");
|
||||
|
||||
let header_bytes = decode_b64_url_nopad(header_b64)?;
|
||||
let header: Value = serde_json::from_slice(&header_bytes)?;
|
||||
let alg = header
|
||||
.get("alg")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OIDC header missing alg".into()))?;
|
||||
if alg == "ES384" {
|
||||
verify_es384_signature(
|
||||
&PublicKey::from_public_key_der(&decode_b64_standard(&decode_header_get_x5u(
|
||||
header_b64,
|
||||
)?)?)
|
||||
.map_err(|_| AuthError::PublicKeyBuild("Couldn't build public key from x5u".into()))?,
|
||||
&signing_input,
|
||||
signature_b64,
|
||||
)?;
|
||||
} else {
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"Unsupported OIDC algorithm (for self-signed): {alg}"
|
||||
)));
|
||||
}
|
||||
|
||||
let payload_bytes = decode_b64_url_nopad(payload_b64)?;
|
||||
let v: Value = serde_json::from_slice(&payload_bytes)?;
|
||||
|
||||
verify_oidc_claims(&v, None)?;
|
||||
|
||||
Ok(extract_oidc_player_claims(&v))
|
||||
}
|
||||
|
||||
fn verify_es384_signature(
|
||||
public_key: &PublicKey,
|
||||
signing_input: &str,
|
||||
signature_b64: &str,
|
||||
) -> Result<(), AuthError> {
|
||||
let verifying_key = VerifyingKey::from(public_key);
|
||||
|
||||
let sig_bytes = decode_b64_url_nopad(signature_b64)?;
|
||||
let signature = Signature::from_slice(&sig_bytes).map_err(|_| AuthError::InvalidSignature)?;
|
||||
|
||||
verifying_key
|
||||
.verify(signing_input.as_bytes(), &signature)
|
||||
.map_err(|_| AuthError::InvalidSignature)
|
||||
}
|
||||
|
||||
fn verify_rs256_signature(
|
||||
jwk: &Jwk,
|
||||
signing_input: &str,
|
||||
signature_b64: &str,
|
||||
) -> Result<(), AuthError> {
|
||||
use rsa::pkcs1v15::VerifyingKey as RsaVerifyingKey;
|
||||
use rsa::signature::Verifier;
|
||||
use sha2::Sha256;
|
||||
|
||||
let public_key = jwk.to_rsa_public_key()?;
|
||||
let sig_bytes = decode_b64_url_nopad(signature_b64)?;
|
||||
|
||||
let verifying_key: RsaVerifyingKey<Sha256> = RsaVerifyingKey::new(public_key);
|
||||
let signature = rsa::pkcs1v15::Signature::try_from(sig_bytes.as_slice())
|
||||
.map_err(|_| AuthError::InvalidSignature)?;
|
||||
|
||||
verifying_key
|
||||
.verify(signing_input.as_bytes(), &signature)
|
||||
.map_err(|_| AuthError::InvalidSignature)
|
||||
}
|
||||
|
||||
fn verify_oidc_claims(payload: &Value, expected_issuer: Option<&str>) -> Result<(), AuthError> {
|
||||
if let Some(expected_issuer) = expected_issuer {
|
||||
let iss = payload
|
||||
.get("iss")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OIDC payload missing iss".into()))?;
|
||||
if iss != expected_issuer {
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"OIDC issuer mismatch: expected {expected_issuer}, got {iss}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
let last_token = tokens.last().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let last_payload_b64 = last_token
|
||||
.split('.')
|
||||
.nth(1)
|
||||
.ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let payload_bytes = decode_b64_url_nopad(last_payload_b64)?;
|
||||
let v: Value = serde_json::from_slice(&payload_bytes)?;
|
||||
let extra_data: PlayerClaims = serde_json::from_value(v["extraData"].clone())?;
|
||||
let aud = payload
|
||||
.get("aud")
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OIDC payload missing aud".into()))?;
|
||||
let aud_match = aud.as_str().map_or_else(
|
||||
|| {
|
||||
aud.as_array()
|
||||
.is_some_and(|arr| arr.iter().any(|v| v.as_str() == Some(OIDC_AUDIENCE)))
|
||||
},
|
||||
|s| s == OIDC_AUDIENCE,
|
||||
);
|
||||
if !aud_match {
|
||||
return Err(AuthError::PublicKeyBuild(format!(
|
||||
"OIDC audience mismatch: expected {OIDC_AUDIENCE}, got {aud:?}"
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(extra_data)
|
||||
let exp = payload
|
||||
.get("exp")
|
||||
.and_then(Value::as_u64)
|
||||
.ok_or_else(|| AuthError::PublicKeyBuild("OIDC payload missing exp".into()))?;
|
||||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs();
|
||||
if now > exp {
|
||||
return Err(AuthError::PublicKeyBuild("OIDC token expired".into()));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn extract_oidc_token_player_claims(token: &str) -> Result<PlayerClaims, AuthError> {
|
||||
let mut parts = token.split('.');
|
||||
parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
let payload_b64 = parts.next().ok_or(AuthError::InvalidTokenFormat)?;
|
||||
|
||||
let payload_bytes = decode_b64_url_nopad(payload_b64)?;
|
||||
let v: Value = serde_json::from_slice(&payload_bytes)?;
|
||||
|
||||
Ok(extract_oidc_player_claims(&v))
|
||||
}
|
||||
|
||||
fn extract_oidc_player_claims(payload: &Value) -> PlayerClaims {
|
||||
let display_name = payload
|
||||
.get("xname")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
let xuid = payload
|
||||
.get("xid")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
|
||||
let uuid = if xuid.is_empty() {
|
||||
let leguuid = payload
|
||||
.get("leguuid")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
|
||||
if leguuid.is_empty() {
|
||||
let input = format!("pocket-auth-1-xuid:{xuid}");
|
||||
let mut bytes = *md5::compute(input.as_bytes());
|
||||
bytes[6] = (bytes[6] & 0x0f) | 0x30;
|
||||
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||
uuid::Uuid::from_bytes(bytes).to_string()
|
||||
} else {
|
||||
leguuid
|
||||
}
|
||||
} else {
|
||||
xuid_to_uuid(&xuid)
|
||||
};
|
||||
|
||||
PlayerClaims {
|
||||
display_name,
|
||||
uuid,
|
||||
xuid,
|
||||
}
|
||||
}
|
||||
|
||||
fn xuid_to_uuid(xuid: &str) -> String {
|
||||
let input = format!("pocket-auth-1-xuid:{xuid}");
|
||||
let mut bytes = *md5::compute(input.as_bytes());
|
||||
bytes[6] = (bytes[6] & 0x0f) | 0x30;
|
||||
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||
uuid::Uuid::from_bytes(bytes).to_string()
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ pub type BlockStateId = u16;
|
||||
|
||||
pub const CURRENT_MC_VERSION: &str = "26.1";
|
||||
|
||||
pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.26";
|
||||
pub const CURRENT_BEDROCK_MC_PROTOCOL: u32 = 924;
|
||||
pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.26.10";
|
||||
pub const CURRENT_BEDROCK_MC_PROTOCOL: u32 = 944;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! global_path {
|
||||
|
||||
@@ -49,6 +49,7 @@ notify.workspace = true
|
||||
|
||||
# config
|
||||
serde.workspace = true
|
||||
serde_repr.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
bytes.workspace = true
|
||||
@@ -62,7 +63,6 @@ rustyline.workspace = true
|
||||
|
||||
# encryption
|
||||
rsa.workspace = true
|
||||
pkcs8.workspace = true
|
||||
|
||||
# authentication
|
||||
ureq = { workspace = true, features = ["json"] }
|
||||
|
||||
@@ -43,7 +43,6 @@ pub struct MojangPublicKeys {
|
||||
pub authentication_keys: Option<Vec<JsonPublicKey>>,
|
||||
}
|
||||
|
||||
pub const MOJANG_BEDROCK_PUBLIC_KEY_BASE64: &str = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAECRXueJeTDqNRRgJi/vlRufByu/2G0i2Ebt6YMar5QX/R0DIIyrJMcUpruK4QveTfJSTp3Shlq4Gk34cD/4GUWwkv0DVuzeuB+tXija7HBxii03NHDbPAD0AKnLr2wdAp";
|
||||
const MOJANG_AUTHENTICATION_URL: &str = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username={username}&serverId={server_hash}";
|
||||
const MOJANG_PREVENT_PROXY_AUTHENTICATION_URL: &str = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username={username}&serverId={server_hash}";
|
||||
const MOJANG_SERVICES_URL: &str = "https://api.minecraftservices.com/";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::net::authentication::MOJANG_BEDROCK_PUBLIC_KEY_BASE64;
|
||||
use crate::{
|
||||
net::{ClientPlatform, DisconnectReason, GameProfile, bedrock::BedrockClient},
|
||||
server::Server,
|
||||
@@ -17,9 +16,10 @@ use pumpkin_protocol::{
|
||||
},
|
||||
codec::var_uint::VarUInt,
|
||||
};
|
||||
use pumpkin_util::jwt::{AuthError, verify_chain};
|
||||
use pumpkin_util::jwt::AuthError;
|
||||
use pumpkin_world::{CURRENT_BEDROCK_MC_PROTOCOL, CURRENT_BEDROCK_MC_VERSION};
|
||||
use serde::Deserialize;
|
||||
use serde_repr::Deserialize_repr;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, warn};
|
||||
@@ -27,7 +27,7 @@ use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum LoginError {
|
||||
#[error("Login packet data is not a valid JSON array of tokens")]
|
||||
#[error("Login packet data is not valid JSON")]
|
||||
InvalidTokenFormat(#[from] serde_json::Error),
|
||||
#[error("JWT chain validation failed: {0}")]
|
||||
ChainValidationFailed(#[from] AuthError),
|
||||
@@ -35,17 +35,48 @@ pub enum LoginError {
|
||||
InvalidUsername,
|
||||
#[error("Could not parse UUID from validated token")]
|
||||
InvalidUuid,
|
||||
#[error("Cannot accept self-signed token. Authentication is enforced by server config.")]
|
||||
SelfSignedNotAllowed,
|
||||
#[error("Got a guest/splitscreen login request. Currently unimplemented.")]
|
||||
GuestUnimplemented,
|
||||
}
|
||||
|
||||
#[derive(Deserialize_repr)]
|
||||
#[repr(u8)]
|
||||
enum AuthenticationType {
|
||||
Full,
|
||||
Guest,
|
||||
SelfSigned,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
struct FullLoginPayload {
|
||||
certificate: String,
|
||||
struct AuthPayload {
|
||||
authentication_type: AuthenticationType,
|
||||
token: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct CertificateChainPayload {
|
||||
chain: Vec<String>,
|
||||
/// Verifies OIDC tokens for Bedrock 1.26.10+ clients.
|
||||
fn verify_oidc_token_path(
|
||||
server: &Server,
|
||||
token: &str,
|
||||
self_signed: bool,
|
||||
) -> Result<pumpkin_util::jwt::PlayerClaims, LoginError> {
|
||||
if self_signed {
|
||||
pumpkin_util::jwt::verify_oidc_token_self_signed(token)
|
||||
.map_err(LoginError::ChainValidationFailed)
|
||||
} else {
|
||||
let (issuer, jwks) =
|
||||
server
|
||||
.bedrock_oidc_keys
|
||||
.get()
|
||||
.ok_or(LoginError::ChainValidationFailed(
|
||||
AuthError::PublicKeyBuild("OIDC keys not initialized".into()),
|
||||
))?;
|
||||
|
||||
pumpkin_util::jwt::verify_oidc_token(token, issuer, jwks)
|
||||
.map_err(LoginError::ChainValidationFailed)
|
||||
}
|
||||
}
|
||||
|
||||
impl BedrockClient {
|
||||
@@ -83,12 +114,26 @@ impl BedrockClient {
|
||||
packet: SLogin,
|
||||
server: &Server,
|
||||
) -> Result<(), LoginError> {
|
||||
let outer_payload: FullLoginPayload = serde_json::from_slice(&packet.jwt)?;
|
||||
let inner_payload: CertificateChainPayload =
|
||||
serde_json::from_str(&outer_payload.certificate)?;
|
||||
let auth_payload: AuthPayload = serde_json::from_slice(&packet.jwt)?;
|
||||
let player_data = if server.basic_config.online_mode {
|
||||
match auth_payload.authentication_type {
|
||||
AuthenticationType::Full => {
|
||||
verify_oidc_token_path(server, &auth_payload.token, false)?
|
||||
}
|
||||
AuthenticationType::SelfSigned => {
|
||||
if server.advanced_config.networking.authentication.enabled {
|
||||
return Err(LoginError::SelfSignedNotAllowed);
|
||||
}
|
||||
|
||||
let chain_vec: Vec<&str> = inner_payload.chain.iter().map(String::as_str).collect();
|
||||
let player_data = verify_chain(&chain_vec, MOJANG_BEDROCK_PUBLIC_KEY_BASE64)?;
|
||||
verify_oidc_token_path(server, &auth_payload.token, true)?
|
||||
}
|
||||
AuthenticationType::Guest => {
|
||||
return Err(LoginError::GuestUnimplemented);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pumpkin_util::jwt::extract_oidc_token_player_claims(&auth_payload.token)?
|
||||
};
|
||||
|
||||
let profile = GameProfile {
|
||||
id: Uuid::parse_str(&player_data.uuid).map_err(|_| LoginError::InvalidUuid)?,
|
||||
@@ -97,13 +142,6 @@ impl BedrockClient {
|
||||
profile_actions: None,
|
||||
};
|
||||
|
||||
//let raw_token = unsafe { String::from_utf8_unchecked(packet.raw_token) };
|
||||
//let raw_token: Vec<&str> = raw_token.split('.').collect();
|
||||
// We dont care about the validation, we just want to get the data
|
||||
//let _raw_token = unsafe {
|
||||
// String::from_utf8_unchecked(general_purpose::URL_SAFE_NO_PAD.decode(raw_token[1]).unwrap())
|
||||
//};
|
||||
|
||||
let mut frame_set = FrameSet::default();
|
||||
|
||||
self.write_game_packet_to_set(&CPlayStatus::LoginSuccess, &mut frame_set)
|
||||
@@ -116,40 +154,77 @@ impl BedrockClient {
|
||||
|
||||
self.send_frame_set(frame_set, 0x84).await;
|
||||
|
||||
if let Some((player, world)) = server
|
||||
if let Some((player, _world)) = server
|
||||
.add_player(ClientPlatform::Bedrock(self.clone()), profile, None)
|
||||
.await
|
||||
{
|
||||
world
|
||||
.spawn_bedrock_player(&server.basic_config, player.clone(), server)
|
||||
.await;
|
||||
// player spawn happens after resource packs are resolved
|
||||
*self.player.lock().await = Some(player);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn handle_resource_pack_response(&self, packet: SResourcePackResponse) {
|
||||
// TODO: Add all
|
||||
if packet.response == SResourcePackResponse::STATUS_HAVE_ALL_PACKS {
|
||||
debug!("Bedrock: STATUS_HAVE_ALL_PACKS");
|
||||
let mut frame_set = FrameSet::default();
|
||||
pub async fn handle_resource_pack_response(
|
||||
&self,
|
||||
packet: SResourcePackResponse,
|
||||
server: &Server,
|
||||
) {
|
||||
// TODO: warn & ignore if the player is already spawned in
|
||||
|
||||
self.write_game_packet_to_set(
|
||||
&CResourcePackStackPacket::new(
|
||||
false,
|
||||
VarUInt(0),
|
||||
CURRENT_BEDROCK_MC_VERSION.to_string(),
|
||||
Experiments {
|
||||
names_size: 0,
|
||||
experiments_ever_toggled: false,
|
||||
},
|
||||
false,
|
||||
),
|
||||
&mut frame_set,
|
||||
)
|
||||
.await;
|
||||
self.send_frame_set(frame_set, 0x84).await;
|
||||
match packet.response {
|
||||
SResourcePackResponse::STATUS_REFUSED => {
|
||||
debug!("Bedrock: SResourcePackResponse::STATUS_REFUSED");
|
||||
self.kick(
|
||||
DisconnectReason::ResourcePackProblem,
|
||||
"You must accept resource packs to join this server.".into(),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
SResourcePackResponse::STATUS_SEND_PACKS => {
|
||||
debug!("Bedrock: SResourcePackResponse::STATUS_SEND_PACKS");
|
||||
// TODO: send packs
|
||||
}
|
||||
SResourcePackResponse::STATUS_HAVE_ALL_PACKS => {
|
||||
debug!("Bedrock: SResourcePackResponse::STATUS_HAVE_ALL_PACKS");
|
||||
let mut frame_set = FrameSet::default();
|
||||
|
||||
self.write_game_packet_to_set(
|
||||
&CResourcePackStackPacket::new(
|
||||
false,
|
||||
VarUInt(0),
|
||||
CURRENT_BEDROCK_MC_VERSION.to_string(),
|
||||
Experiments {
|
||||
names_size: 0,
|
||||
experiments_ever_toggled: false,
|
||||
},
|
||||
false,
|
||||
),
|
||||
&mut frame_set,
|
||||
)
|
||||
.await;
|
||||
self.send_frame_set(frame_set, 0x84).await;
|
||||
}
|
||||
SResourcePackResponse::STATUS_COMPLETED => {
|
||||
debug!("Bedrock: SResourcePackResponse::STATUS_COMPLETED");
|
||||
if let Some(player) = &*self.player.lock().await {
|
||||
player
|
||||
.world()
|
||||
.spawn_bedrock_player(&server.basic_config, player.clone(), server)
|
||||
.await;
|
||||
} else {
|
||||
tracing::error!(
|
||||
"Got SResourcePackResponse::STATUS_COMPLETED before authentication was completed."
|
||||
);
|
||||
self.kick(DisconnectReason::Disconnected, String::new())
|
||||
.await;
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
tracing::error!("Bedrock: SResourcePackResponse bad response type");
|
||||
self.kick(DisconnectReason::Disconnected, String::new())
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ impl BedrockClient {
|
||||
// TODO
|
||||
}
|
||||
SResourcePackResponse::PACKET_ID => {
|
||||
self.handle_resource_pack_response(SResourcePackResponse::read(payload)?)
|
||||
self.handle_resource_pack_response(SResourcePackResponse::read(payload)?, server)
|
||||
.await;
|
||||
}
|
||||
_ => {
|
||||
|
||||
@@ -16,7 +16,7 @@ use pumpkin_protocol::{
|
||||
text::SText,
|
||||
},
|
||||
},
|
||||
codec::{bedrock_block_pos::NetworkPos, var_int::VarInt, var_long::VarLong},
|
||||
codec::{var_int::VarInt, var_long::VarLong},
|
||||
java::client::play::CSystemChatMessage,
|
||||
};
|
||||
use pumpkin_util::{math::position::BlockPos, text::TextComponent};
|
||||
@@ -149,7 +149,7 @@ impl BedrockClient {
|
||||
self.send_game_packet(&CContainerOpen {
|
||||
container_id: 0,
|
||||
container_type: 0xff,
|
||||
position: NetworkPos(BlockPos::ZERO),
|
||||
position: BlockPos::ZERO,
|
||||
target_entity_id: VarLong(-1),
|
||||
})
|
||||
.await;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use num_bigint::BigInt;
|
||||
use pkcs8::EncodePublicKey;
|
||||
use pumpkin_protocol::java::client::login::CEncryptionRequest;
|
||||
use rsa::pkcs8::EncodePublicKey;
|
||||
use rsa::{Pkcs1v15Encrypt, RsaPrivateKey};
|
||||
use sha1::Sha1;
|
||||
use sha2::Digest;
|
||||
|
||||
@@ -76,6 +76,8 @@ pub struct Server {
|
||||
|
||||
/// Handles cryptographic keys for secure communication.
|
||||
key_store: OnceCell<Arc<KeyStore>>,
|
||||
/// Bedrock OIDC provider keys, fetched on startup for 1.26.10+ token validation.
|
||||
pub bedrock_oidc_keys: OnceCell<(String, pumpkin_util::jwt::Jwks)>,
|
||||
/// Manages server status information.
|
||||
listing: Mutex<CachedStatus>,
|
||||
/// Saves server branding information.
|
||||
@@ -222,6 +224,7 @@ impl Server {
|
||||
block_registry: block_registry.clone(),
|
||||
item_registry: super::item::items::default_registry(),
|
||||
key_store: OnceCell::new(),
|
||||
bedrock_oidc_keys: OnceCell::new(),
|
||||
listing,
|
||||
branding: CachedBranding::new(),
|
||||
bossbars: Mutex::new(CustomBossbars::new()),
|
||||
@@ -301,6 +304,23 @@ impl Server {
|
||||
}
|
||||
|
||||
info!("All worlds loaded successfully.");
|
||||
|
||||
if server.basic_config.online_mode {
|
||||
let server_clone = server.clone();
|
||||
tokio::spawn(async move {
|
||||
server_clone
|
||||
.bedrock_oidc_keys
|
||||
.get_or_init(|| async {
|
||||
tokio::task::block_in_place(|| {
|
||||
pumpkin_util::jwt::fetch_oidc_jwks().unwrap_or_else(|e| {
|
||||
error!("Failed to fetch Bedrock OIDC keys: {e}");
|
||||
(String::new(), pumpkin_util::jwt::Jwks { keys: Vec::new() })
|
||||
})
|
||||
})
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
server
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,7 @@ use pumpkin_protocol::{
|
||||
network_item::NetworkItemDescriptor,
|
||||
server::text::SText,
|
||||
},
|
||||
codec::{
|
||||
bedrock_block_pos::NetworkPos, var_long::VarLong, var_uint::VarUInt, var_ulong::VarULong,
|
||||
},
|
||||
codec::{var_long::VarLong, var_uint::VarUInt, var_ulong::VarULong},
|
||||
java::{
|
||||
self,
|
||||
client::play::{
|
||||
@@ -1586,11 +1584,11 @@ impl World {
|
||||
world_gamemode: server.defaultgamemode.lock().await.gamemode,
|
||||
hardcore: base_config.hardcore,
|
||||
difficulty: VarInt(level_info.difficulty as i32),
|
||||
spawn_position: NetworkPos(BlockPos::new(
|
||||
spawn_position: BlockPos::new(
|
||||
level_info.spawn_x,
|
||||
level_info.spawn_y,
|
||||
level_info.spawn_z,
|
||||
)),
|
||||
),
|
||||
has_achievements_disabled: false,
|
||||
editor_world_type: VarInt(0),
|
||||
is_created_in_editor: false,
|
||||
|
||||
Reference in New Issue
Block a user