Merge pull request #7 from Faumaray/claude/hopeful-babbage-5h4kbg

myTeamSpeak account sign-in (codex/myteamspeak-account, merged with main)
This commit is contained in:
faumaray authored and GitHub committed 2026-10-04 22:30:24 +03:00
commit ff30338646
41 files changed
+9910 -222

No files matched your search

Generated
+234
View File
@@ -3502,6 +3502,19 @@ dependencies = [
"tower-service",
]
[[package]]
name = "hyper-timeout"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
dependencies = [
"hyper",
"hyper-util",
"pin-project-lite",
"tokio",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.21"
@@ -4864,6 +4877,12 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "multimap"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
[[package]]
name = "multiversion_no_op"
version = "1.0.0"
@@ -5842,6 +5861,7 @@ checksum = "112d82ceb8c5bf524d9af484d4e4970c9fd5a0cc15ba14ad93dccd28873b0629"
dependencies = [
"digest 0.11.3",
"hmac 0.13.0",
"sha2 0.11.0",
]
[[package]]
@@ -6320,6 +6340,27 @@ dependencies = [
"prost-derive",
]
[[package]]
name = "prost-build"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042"
dependencies = [
"heck",
"itertools 0.14.0",
"log",
"multimap",
"petgraph",
"prettyplease",
"prost",
"prost-types",
"pulldown-cmark",
"pulldown-cmark-to-cmark",
"regex",
"syn 2.0.119",
"tempfile",
]
[[package]]
name = "prost-derive"
version = "0.14.4"
@@ -6333,6 +6374,79 @@ dependencies = [
"syn 2.0.119",
]
[[package]]
name = "prost-types"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a"
dependencies = [
"prost",
]
[[package]]
name = "protoc-bin-vendored"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa"
dependencies = [
"protoc-bin-vendored-linux-aarch_64",
"protoc-bin-vendored-linux-ppcle_64",
"protoc-bin-vendored-linux-s390_64",
"protoc-bin-vendored-linux-x86_32",
"protoc-bin-vendored-linux-x86_64",
"protoc-bin-vendored-macos-aarch_64",
"protoc-bin-vendored-macos-x86_64",
"protoc-bin-vendored-win32",
]
[[package]]
name = "protoc-bin-vendored-linux-aarch_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c"
[[package]]
name = "protoc-bin-vendored-linux-ppcle_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c"
[[package]]
name = "protoc-bin-vendored-linux-s390_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0"
[[package]]
name = "protoc-bin-vendored-linux-x86_32"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5"
[[package]]
name = "protoc-bin-vendored-linux-x86_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78"
[[package]]
name = "protoc-bin-vendored-macos-aarch_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092"
[[package]]
name = "protoc-bin-vendored-macos-x86_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756"
[[package]]
name = "protoc-bin-vendored-win32"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3"
[[package]]
name = "pulldown-cmark"
version = "0.13.4"
@@ -6344,6 +6458,15 @@ dependencies = [
"unicase",
]
[[package]]
name = "pulldown-cmark-to-cmark"
version = "22.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84bbb29c624230c4bd1047bbdb2aa47e41c860e9665ce62ba9504eebe91bf867"
dependencies = [
"pulldown-cmark",
]
[[package]]
name = "pxfm"
version = "0.1.30"
@@ -7139,6 +7262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
dependencies = [
"aws-lc-rs",
"log",
"once_cell",
"rustls-pki-types",
"rustls-webpki",
@@ -7256,6 +7380,20 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "schema-api"
version = "0.1.0"
dependencies = [
"prost",
"prost-build",
"prost-types",
"protoc-bin-vendored",
"thiserror 2.0.21",
"tonic",
"tonic-prost",
"tonic-prost-build",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
@@ -8715,6 +8853,76 @@ version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
[[package]]
name = "tonic"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef"
dependencies = [
"async-trait",
"axum",
"base64 0.22.1",
"bytes",
"h2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-timeout",
"hyper-util",
"percent-encoding",
"pin-project",
"rustls-native-certs",
"socket2",
"sync_wrapper",
"tokio",
"tokio-rustls",
"tokio-stream",
"tower",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tonic-build"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c68f61875ac5293cf72e6c8cf0158086428c82c37229e98c840878f1706b0322"
dependencies = [
"prettyplease",
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "tonic-prost"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50849f68853be452acf590cde0b146665b8d507b3b8af17261df47e02c209ea0"
dependencies = [
"bytes",
"prost",
"tonic",
]
[[package]]
name = "tonic-prost-build"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "654e5643eff75d7f8c99197ce1440ed19a3474eada74c12bbac488b2cafdae27"
dependencies = [
"prettyplease",
"proc-macro2",
"prost-build",
"prost-types",
"quote",
"syn 2.0.119",
"tempfile",
"tonic-build",
]
[[package]]
name = "tower"
version = "0.5.3"
@@ -8723,9 +8931,12 @@ checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
dependencies = [
"futures-core",
"futures-util",
"indexmap",
"pin-project-lite",
"slab",
"sync_wrapper",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",
@@ -9099,6 +9310,7 @@ dependencies = [
"rand 0.10.3",
"rug",
"serde",
"serde_json",
"sha-1",
"sha2 0.10.9",
"thiserror 2.0.21",
@@ -9108,6 +9320,7 @@ dependencies = [
"tracing-subscriber",
"tsproto-packets",
"tsproto-types",
"zeroize",
]
[[package]]
@@ -9485,6 +9698,7 @@ dependencies = [
"md5",
"reqwest",
"rusqlite",
"rustls",
"serde",
"serde_json",
"thiserror 2.0.21",
@@ -9500,6 +9714,7 @@ dependencies = [
"voelin-gateway-proto",
"voelin-media",
"voelin-model",
"voelin-myts",
"voelin-observer",
"voelin-platform",
"voelin-query",
@@ -9603,6 +9818,24 @@ dependencies = [
"serde_json",
]
[[package]]
name = "voelin-myts"
version = "0.1.0"
dependencies = [
"aes 0.9.3",
"aes-gcm",
"base64 0.22.1",
"ctr 0.10.1",
"pbkdf2",
"reqwest",
"schema-api",
"subtle",
"thiserror 2.0.21",
"tokio",
"tsproto",
"zeroize",
]
[[package]]
name = "voelin-observer"
version = "0.1.0"
@@ -9698,6 +9931,7 @@ dependencies = [
"voelin-core",
"voelin-gateway-proto",
"voelin-model",
"voelin-myts",
"voelin-platform",
"voelin-query",
"voelin-store",
+3 -1
View File
@@ -2,7 +2,7 @@
resolver = "3"
# third_party: vendored crates patched in below (not workspace members, so
# their own tests and dev-dependencies stay out of our builds).
exclude = ["fuzz", "third_party"]
exclude = ["fuzz", "third_party", "third_party/schema-api"]
members = [
"crates/proto/tsproto-types",
"crates/proto/tsproto-structs",
@@ -17,6 +17,7 @@ members = [
"crates/voelin-gateway-proto",
"crates/voelin-media",
"crates/voelin-model",
"crates/voelin-myts",
"crates/voelin-observer",
"crates/voelin-platform",
"crates/voelin-query",
@@ -37,6 +38,7 @@ default-members = [
"crates/voelin-gateway",
"crates/voelin-gateway-proto",
"crates/voelin-model",
"crates/voelin-myts",
"crates/voelin-observer",
"crates/voelin-platform",
"crates/voelin-query",
+9 -2
View File
@@ -21,13 +21,16 @@ dependencies to their projects (tell us too if this client is affected).
## What the client stores
Everything stays on the device; there is no telemetry and no account with
us.
There is no telemetry and no account with us. The only outside account is
the optional myTeamSpeak sign-in (desktop), which talks to TeamSpeak's
service at `clientapi.myteamspeak.com`: at sign-in, when a saved session is
checked at start, and at sign-out.
| What | Where | Protection |
|---|---|---|
| Identities (TeamSpeak private keys) | SQLite database `client.db` in the data directory (`~/.local/share/voelin`, Flatpak `~/.var/app/<app id>/data/voelin`, `%APPDATA%\voelin`, Android app storage) | File permissions of the user account only; not encrypted. An identity is the account on every server that knows it: back it up, do not share the file |
| Server and ServerQuery passwords | OS keyring (Secret Service, Windows Credential Manager, Android Keystore), service `voelin` | Keyring; kept in memory for the session only when there is no keyring |
| myTeamSpeak account (optional sign-in, desktop): session, renewal and one-time-code renewal tokens, device id, email, username, account id and the account's private signing key | OS keyring, service `voelin`, item `myts/session` | Keyring only: without one the sign-in is not kept, not even in memory. Passwords and one-time codes are never stored. Signing out deletes the item and ends the session at TeamSpeak |
| Bookmarks, settings, chat history | `client.db` | File permissions; history stays until deleted |
| Crash reports (opt-in) | `crash-reports` in the state directory (`~/.local/state/voelin`, `%LOCALAPPDATA%\voelin`) | Local only, never uploaded. They contain the panic message and a backtrace, which may include server addresses or names; review before attaching one to an issue |
| OpenH264 (opt-in) | Downloaded from Cisco into the app's directories | Loaded only if its SHA-256 matches a known Cisco build |
@@ -37,6 +40,10 @@ us.
- **Voice connections** use the TeamSpeak protocol's encryption. The server
and its admins see what any client sees: your nickname, identity, IP
address, channel and messages.
- **Signed in to myTeamSpeak**, every voice server you join also gets your
account's myTeamSpeak id with a proof signed by the account, which links
your visits to different servers to one account. Signing out clears it on
the servers you are on.
- **Streams (TeamSpeak 6)** are peer-to-peer WebRTC (DTLS-SRTP). Viewers and
streamers exchange ICE candidates, so **they learn each other's IP
addresses**, including local network addresses. Only watch and share
+836 -9
View File
@@ -53,6 +53,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
## schema-api
The account client uses message bindings and session helpers from the local
schema-api 0.1.0 snapshot vendored under third_party/schema-api. The supplied
snapshot has no declared license or license file; no MIT or Apache license is
implied for it or its supplied schemas. See its VOELIN-PATCH.md for provenance.
## Native libraries
- Opus (libopus), compiled into the app: BSD-3-Clause, Copyright 2001-2023
@@ -175,12 +182,12 @@ the crate's authors are listed as its copyright holders.
| License | Crates |
|---|---|
| MIT License | 654 |
| Apache License 2.0 | 31 |
| MIT License | 657 |
| Apache License 2.0 | 34 |
| Unicode License v3 | 26 |
| ISC License | 24 |
| BSD 3-Clause "New" or "Revised" License | 22 |
| LicenseRef-Slint-Royalty-free-2.0 | 12 |
| ISC License | 8 |
| BSD 2-Clause "Simplified" License | 3 |
| zlib License | 3 |
| Boost Software License 1.0 | 2 |
@@ -398,6 +405,284 @@ Used by: flagset 0.4.7, hound 3.5.1
````
Used by: ring 0.17.14
````text
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Licenses for support code
-------------------------
Parts of the TLS test suite are under the Go license. This code is not included
in BoringSSL (i.e. libcrypto and libssl) when compiled, however, so
distributing code linked against BoringSSL does not trigger this license:
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
BoringSSL uses the Chromium test infrastructure to run a continuous build,
trybots etc. The scripts which manage this, and the script for generating build
metadata, are under the Chromium license. Distributing code linked against
BoringSSL does not trigger this license.
Copyright 2015 The Chromium Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
````
Used by: moka 0.12.16
````text
@@ -1019,7 +1304,7 @@ Used by: cpal 0.18.2, imgref 1.12.3, self_cell 1.3.0, unicode-linebreak 0.1.5
````
Used by: gethostname 1.1.0, prost-derive 0.14.4, prost 0.14.4
Used by: gethostname 1.1.0, prost-derive 0.14.4, prost-types 0.14.4, prost 0.14.4, ring 0.17.14
````text
Apache License
@@ -1796,7 +2081,7 @@ Standard text, used by:
- openh264 0.9.8: Ralf Biedert <rb@xr.io> (https://github.com/ralfbiedert/openh264-rs)
````text
Copyright (c) <year> <owner>
Copyright (c) <year> <owner>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -2009,7 +2294,7 @@ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
````
@@ -2078,7 +2363,7 @@ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
````
@@ -2090,7 +2375,7 @@ Standard text, used by:
- sonora-aec3 0.2.0 (https://github.com/dignifiedquire/sonora)
````text
Copyright (c) <year> <owner>.
Copyright (c) <year> <owner>.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -2233,6 +2518,84 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
### ISC License
Used by: ring 0.17.14
````text
/* Copyright (c) 2014, Intel Corporation.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#ifndef OPENSSL_HEADER_EC_ECP_NISTZ384_H
#define OPENSSL_HEADER_EC_ECP_NISTZ384_H
#include "../../limbs/limbs.h"
#define P384_LIMBS (384u / LIMB_BITS)
typedef struct {
Limb X[P384_LIMBS];
Limb Y[P384_LIMBS];
Limb Z[P384_LIMBS];
} P384_POINT;
typedef struct {
Limb X[P384_LIMBS];
Limb Y[P384_LIMBS];
} P384_POINT_AFFINE;
#endif // OPENSSL_HEADER_EC_ECP_NISTZ384_H
````
Used by: ring 0.17.14
````text
// Copyright 2015-2016 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//! EdDSA Signatures.
use super::ops::ELEM_LEN;
use crate::digest;
pub mod signing;
pub mod verification;
/// The length of an Ed25519 public key.
pub const ED25519_PUBLIC_KEY_LEN: usize = ELEM_LEN;
pub fn eddsa_digest(signature_r: &[u8], public_key: &[u8], msg: &[u8]) -> digest::Digest {
let mut ctx = digest::Context::new(&digest::SHA512);
ctx.update(signature_r);
ctx.update(public_key);
ctx.update(msg);
ctx.finish()
}
````
Used by: untrusted 0.7.1, untrusted 0.9.0
````text
@@ -2252,6 +2615,397 @@ Used by: untrusted 0.7.1, untrusted 0.9.0
````
Used by: ring 0.17.14
````text
// Copyright 2015-2022 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use crate::limb::Limb;
#[derive(Clone, Copy)]
#[repr(transparent)]
pub struct N0([Limb; 2]);
impl N0 {
#[cfg(feature = "alloc")]
pub(super) const LIMBS_USED: usize = 64 / crate::limb::LIMB_BITS;
#[inline]
pub const fn precalculated(n0: u64) -> Self {
#[cfg(target_pointer_width = "64")]
{
Self([n0, 0])
}
#[cfg(target_pointer_width = "32")]
{
Self([n0 as Limb, (n0 >> crate::limb::LIMB_BITS) as Limb])
}
}
}
````
Used by: ring 0.17.14
````text
// Copyright 2015-2025 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use crate::{bb, error};
#[deprecated(
note = "To be removed. Internal function not intended for external use with no promises regarding side channels."
)]
pub fn verify_slices_are_equal(a: &[u8], b: &[u8]) -> Result<(), error::Unspecified> {
bb::verify_slices_are_equal(a, b)
}
````
Used by: ring 0.17.14
````text
// Copyright 2016 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//! Elliptic curve operations and schemes using Curve25519.
pub mod ed25519;
pub mod x25519;
mod ops;
mod scalar;
````
Used by: ring 0.17.14
````text
// Copyright 2016-2024 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use crate::error::{KeyRejected, Unspecified};
impl From<untrusted::EndOfInput> for Unspecified {
fn from(source: untrusted::EndOfInput) -> Self {
super::erase(source)
}
}
impl From<core::array::TryFromSliceError> for Unspecified {
fn from(source: core::array::TryFromSliceError) -> Self {
super::erase(source)
}
}
impl From<KeyRejected> for Unspecified {
fn from(source: KeyRejected) -> Self {
super::erase(source)
}
}
````
Used by: ring 0.17.14
````text
// Copyright 2018 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//! Serialization and deserialization.
#[doc(hidden)]
pub mod der;
#[cfg(feature = "alloc")]
mod writer;
#[cfg(feature = "alloc")]
pub(crate) mod der_writer;
pub(crate) mod positive;
pub use self::positive::Positive;
#[cfg(feature = "alloc")]
pub(crate) use self::writer::TooLongError;
````
Used by: ring 0.17.14
````text
// Copyright 2019-2024 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use super::BlockLen;
pub(super) use self::{
sha2_32::{block_data_order_32, State32, SHA256_BLOCK_LEN},
sha2_64::{block_data_order_64, State64, SHA512_BLOCK_LEN},
};
pub(super) const CHAINING_WORDS: usize = 8;
#[cfg(any(
all(target_arch = "aarch64", target_endian = "little"),
all(target_arch = "arm", target_endian = "little"),
target_arch = "x86_64"
))]
#[macro_use]
mod ffi;
pub(super) mod fallback;
mod sha2_32;
mod sha2_64;
````
Used by: ring 0.17.14
````text
// Copyright 2024 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// TODO(MSRV 1.76): Replace with `core::ptr::from_mut`.
#[allow(dead_code)]
#[inline(always)]
pub fn from_mut<T: ?Sized>(r: &mut T) -> *mut T {
r
}
// TODO(MSRV 1.76): Replace with `core::ptr::from_ref`.
#[allow(dead_code)]
#[inline(always)]
pub const fn from_ref<T: ?Sized>(r: &T) -> *const T {
r
}
````
Used by: ring 0.17.14
````text
// Copyright 2024 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//! Integration tests for non-public APIs.
mod bits_tests;
````
Used by: ring 0.17.14
````text
// Copyright 2024 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
pub use self::{
array::Array,
base::{IndexError, Overlapping},
partial_block::PartialBlock,
};
mod array;
mod base;
mod partial_block;
````
Used by: ring 0.17.14
````text
// Copyright 2025 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#![cfg(all(target_arch = "aarch64", target_endian = "little"))]
pub(in super::super) mod mont;
````
Used by: ring 0.17.14
````text
// Copyright 2025 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#![cfg(target_arch = "x86_64")]
pub(in super::super::super) mod mont;
````
Used by: ring 0.17.14
````text
// Copyright 2025 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
mod storage;
pub(super) use self::storage::{AlignedStorage, LIMBS_PER_CHUNK};
````
Used by: ring 0.17.14
````text
// Copyright 2025 Brian Smith.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
pub(super) mod aarch64;
pub(super) mod x86_64;
````
Used by: aws-lc-sys 0.45.0
````text
@@ -2593,6 +3347,25 @@ THIS SOFTWARE.
````
Used by: ring 0.17.14
````text
Copyright 2015-2025 Brian Smith.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
````
Used by: libloading 0.8.9
````text
@@ -7899,6 +8672,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: tonic 0.14.6
````text
Copyright (c) 2025 Lucio Franco
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
````
Used by: secret-service 5.2.0
````text
@@ -9760,6 +10558,7 @@ Standard text, used by:
- str0m-proto 0.7.0: Martin Algesten <martin@algesten.se> (https://github.com/algesten/str0m)
- taffy 0.10.1: Alice Cecile <alice.i.cecile@gmail.com>, Johnathan Kelley <jkelleyrtp@gmail.com>, Nico Burns <nico@nicoburns.com> (https://github.com/DioxusLabs/taffy)
- tauri-winrt-notification 0.7.3: allenbenz, Tauri Programme within The Commons Conservancy (https://github.com/tauri-apps/winrt-notification)
- tonic-prost 0.14.6: Lucio Franco <luciofranco14@gmail.com> (https://github.com/hyperium/tonic)
- tract-extra 0.23.8: Mathieu Poumeyrol <kali@zoy.org> (https://github.com/sonos/tract)
- tract-transformers 0.23.8: Mathieu Poumeyrol <kali@zoy.org>, Louis Chouraki <louis.chouraki@sonos.com> (https://github.com/sonos/tract)
- windows-collections 0.2.0 (https://github.com/microsoft/windows-rs)
@@ -10725,6 +11524,34 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: hyper-timeout 0.5.2
````text
The MIT License (MIT)
Copyright (c) 2016 The weldr Project Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: same-file 1.0.6, winapi-util 0.1.11
@@ -11327,7 +12154,7 @@ Mozilla Public License Version 2.0
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
+7
View File
@@ -53,6 +53,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
## schema-api
The account client uses message bindings and session helpers from the local
schema-api 0.1.0 snapshot vendored under third_party/schema-api. The supplied
snapshot has no declared license or license file; no MIT or Apache license is
implied for it or its supplied schemas. See its VOELIN-PATCH.md for provenance.
## Native libraries
- Opus (libopus), compiled into the app: BSD-3-Clause, Copyright 2001-2023
+12
View File
@@ -117,3 +117,15 @@ against or offered back to upstream.
cannot drop the whole channel list; its numbers are those of
`HostBannerMode` (the server's `channeledit` documentation: 0 as it is,
1 stretched, 2 scaled keeping the aspect ratio).
14. **myTeamSpeak connection identity** (`tsproto/src/myts.rs`,
`tsclientlib/src/myts.rs`, `tsclientlib/src/lib.rs`). Validated, redacted account
credentials retain the original raw signing scalar and validate again when
deserialized from a credential store. Connection-bound account proofs use the
negotiated shared IV and the official raw-scalar signing construction, not
Ed25519 seed expansion. `clientinit` and `updatemytsid` carry the six official
case-sensitive proof fields; clearing an account sends only an empty
`myTeamspeakId`. Connection options retain the latest account for reconnects;
callers cancel and rebuild an in-flight attempt when its snapshot changes.
Tests cover an independent signature vector, persistence validation/redaction,
wire field names, clearing and reconnect snapshot replacement. The account
UUID and the ordinary server identity remain separate.
+21 -2
View File
@@ -44,6 +44,7 @@ use tsproto_packets::packets::{InCommandBuf, OutCommand, OutPacket, PacketType};
#[cfg(feature = "audio")]
pub mod audio;
mod myts;
pub mod prelude;
pub mod resolver;
pub mod sync;
@@ -382,9 +383,11 @@ impl Connection {
address: address.into(),
local_address: None,
identity: None,
myts_identity: None,
server: None,
name: "TeamSpeakUser".into(),
version: Version::Windows_3_X_X__1,
metadata: Cow::Borrowed(""),
hardware_id: "923f136fb1e22ae6ce95e60255529c00,d13231b1bc33edfecfb9169cc7a63bcc".into(),
channel: None,
channel_password: None,
@@ -536,7 +539,7 @@ impl Connection {
.as_ref()
.map(|p| tsproto_types::crypto::encode_password(p.as_bytes()))
.unwrap_or_default();
let packet = c2s::OutClientInitMessage::new(&mut iter::once(c2s::OutClientInitPart {
let mut packet = c2s::OutClientInitMessage::new(&mut iter::once(c2s::OutClientInitPart {
name: Cow::Borrowed(options.name.as_ref()),
version: Cow::Borrowed(client_version),
platform: Cow::Borrowed(client_platform),
@@ -549,7 +552,7 @@ impl Connection {
default_channel: Cow::Borrowed(options.channel.as_deref().unwrap_or_default()),
default_channel_password: Cow::Borrowed(default_channel_password.as_ref()),
password: Cow::Borrowed(password.as_ref()),
metadata: "".into(),
metadata: Cow::Borrowed(options.metadata.as_ref()),
version_sign: Cow::Borrowed(client_version_sign.as_ref()),
client_key_offset: counter,
phonetic_name: "".into(),
@@ -564,6 +567,13 @@ impl Connection {
security_hash: None,
}));
// Voelin patch: account proof is bound to this transport's negotiated IV.
// The generated legacy client_myteamspeak_id field stays absent.
if let Some(identity) = &options.myts_identity {
let params = client.params.as_ref().ok_or(Error::InitserverParamsMissing)?;
identity.proof(&params.shared_iv).write_to(&mut packet);
}
client.send_packet(packet.into_packet()).map_err(Error::SendClientinit)?;
match tokio::time::timeout(
@@ -1711,9 +1721,11 @@ pub struct ConnectOptions {
address: ServerAddress,
local_address: Option<SocketAddr>,
identity: Option<Identity>,
myts_identity: Option<tsproto::myts::Identity>,
server: Option<UidBuf>,
name: Cow<'static, str>,
version: Version,
metadata: Cow<'static, str>,
hardware_id: Cow<'static, str>,
channel: Option<Cow<'static, str>>,
channel_password: Option<Cow<'static, str>>,
@@ -1853,6 +1865,13 @@ impl ConnectOptions {
self
}
/// Application metadata, independently of the signed compatibility version.
/// Voelin patch: carries the actual application name/build to the server.
pub fn metadata<S: Into<Cow<'static, str>>>(mut self, metadata: S) -> Self {
self.metadata = metadata.into();
self
}
/// The hardware ID (HWID) of the client.
///
/// # Default
+91
View File
@@ -0,0 +1,91 @@
//! Voelin patch: connection-bound myTeamSpeak proof and live account changes.
use tsproto::myts::Identity;
use tsproto_packets::packets::{Direction, Flags, OutCommand, PacketType};
use crate::{ConnectOptions, Connection, ConnectionState, Error, MessageHandle, Result};
impl ConnectOptions {
/// Snapshot the account credential for the initial connection and reconnects.
/// This is separate from the server identity and account profile UUID.
pub fn myts_identity(mut self, identity: Option<Identity>) -> Self {
self.myts_identity = identity;
self
}
}
impl Connection {
/// Publish a connection-bound account proof, or clear the account identity.
///
/// Always updates the reconnect options, even if currently disconnected or
/// sending fails. A running connection attempt owns its previous snapshot:
/// callers must cancel and rebuild that attempt after `NotConnected`.
/// Await the returned handle's `StreamItem::MessageResult` for server acceptance.
pub fn update_myts_identity(&mut self, identity: Option<Identity>) -> Result<MessageHandle> {
self.options.myts_identity = identity;
let iv = match &self.state {
ConnectionState::Connected { con, .. } => {
con.client.params.as_ref().ok_or(Error::InitserverParamsMissing)?.shared_iv
}
_ => return Err(Error::NotConnected),
};
let packet = update_packet(self.options.myts_identity.as_ref(), &iv);
self.send_command_with_result(packet)
}
}
fn update_packet(identity: Option<&Identity>, iv: &[u8; 64]) -> OutCommand {
let mut packet =
OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "updatemytsid");
if let Some(identity) = identity {
identity.proof(iv).write_to(&mut packet);
} else {
// Empty arguments are serialized without '=' by the existing writer.
packet.write_arg("myTeamspeakId", &"");
}
packet
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn clear_contains_no_previous_account_proof() {
let packet = update_packet(None, &[0; 64]).into_packet();
assert_eq!(packet.content(), b"updatemytsid myTeamspeakId");
}
#[test]
fn update_uses_current_connection_challenge() {
// Scalar one and the standard compressed Edwards base point.
let mut private = [0; 32];
private[0] = 1;
let mut public = [0x66; 32];
public[0] = 0x58;
let identity = Identity::new(vec![1; 33], 42, public, private, vec![2; 65]).unwrap();
let first = update_packet(Some(&identity), &[0; 64]).into_packet();
let second = update_packet(Some(&identity), &[1; 64]).into_packet();
assert_ne!(first.content(), second.content());
let wire = std::str::from_utf8(first.content()).unwrap();
assert!(wire.starts_with("updatemytsid myTeamspeakId="));
assert!(wire.contains(" acTime=42 "));
assert!(!wire.contains("client_myteamspeak_id"));
assert_eq!(wire.split(' ').count(), 7);
}
#[test]
fn failed_update_still_replaces_reconnect_snapshot() {
// Building opens no socket until the connection future is polled.
let mut private = [0; 32];
private[0] = 1;
let mut public = [0x66; 32];
public[0] = 0x58;
let identity = Identity::new(vec![1; 33], 42, public, private, vec![2; 65]).unwrap();
let mut connection =
Connection::build("localhost").myts_identity(Some(identity)).connect().unwrap();
assert!(connection.options.myts_identity.is_some());
assert!(matches!(connection.update_myts_identity(None), Err(Error::NotConnected)));
assert!(connection.options.myts_identity.is_none());
}
}
+2
View File
@@ -43,8 +43,10 @@ tsproto-packets = { path = "../tsproto-packets", version = "0.1" }
tsproto-types = { path = "../tsproto-types", version = "0.1" }
quicklz = "0.3"
crypto-bigint = "0.6"
zeroize = "1"
[dev-dependencies]
serde_json = "1"
anyhow = "1"
criterion = "0.8"
once_cell = "1"
+1
View File
@@ -26,6 +26,7 @@ pub mod client;
pub mod connection;
pub mod license;
pub mod log;
pub mod myts;
pub mod packet_codec;
pub mod resend;
pub mod utils;
+247
View File
@@ -0,0 +1,247 @@
//! Validated myTeamSpeak signing credentials and connection-bound public proofs.
//!
//! Serializing an [`Identity`] exports its private key. Persist it only in a
//! credential store, never application settings, diagnostics or packet logs.
use std::fmt;
use base64::prelude::*;
use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar};
use serde::{Deserialize, Deserializer, Serialize};
use sha2::{Digest, Sha256, Sha512};
use thiserror::Error;
use tsproto_packets::packets::OutCommand;
use zeroize::Zeroize;
/// An account identity; distinct from the account UUID and server identity.
#[derive(Clone, Serialize)]
pub struct Identity {
myts_id: Vec<u8>,
creation_time: u64,
public_key: [u8; 32],
private_key: [u8; 32],
public_signature: Vec<u8>,
}
#[derive(Debug, Error)]
pub enum IdentityError {
#[error("myTeamSpeak identity must contain 33 bytes")]
InvalidId,
#[error("myTeamSpeak public signature must contain 65 to 4096 bytes")]
InvalidSignature,
#[error("myTeamSpeak private key is zero or does not match its public key")]
InvalidKeyPair,
}
impl fmt::Debug for Identity {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("Identity([REDACTED])") }
}
impl Drop for Identity {
fn drop(&mut self) { self.private_key.zeroize(); }
}
impl<'de> Deserialize<'de> for Identity {
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Stored {
myts_id: Vec<u8>,
creation_time: u64,
public_key: [u8; 32],
private_key: [u8; 32],
public_signature: Vec<u8>,
}
let mut stored = Stored::deserialize(deserializer)?;
let result = Self::new(
stored.myts_id,
stored.creation_time,
stored.public_key,
stored.private_key,
stored.public_signature,
);
stored.private_key.zeroize();
result.map_err(serde::de::Error::custom)
}
}
impl Identity {
/// `creation_time` is the voice protocol's decimal `acTime` integer,
/// byte-swapped from the account service's numeric creation timestamp.
pub fn new(
myts_id: Vec<u8>, creation_time: u64, public_key: [u8; 32], mut private_key: [u8; 32],
public_signature: Vec<u8>,
) -> Result<Self, IdentityError> {
let result = (|| {
if myts_id.len() != 33 {
return Err(IdentityError::InvalidId);
}
if !(65..=4096).contains(&public_signature.len()) {
return Err(IdentityError::InvalidSignature);
}
let mut scalar = Scalar::from_bytes_mod_order(private_key);
let valid = scalar != Scalar::ZERO
&& (ED25519_BASEPOINT_TABLE * &scalar).compress().to_bytes() == public_key;
scalar.zeroize();
if !valid {
return Err(IdentityError::InvalidKeyPair);
}
Ok(Self { myts_id, creation_time, public_key, private_key, public_signature })
})();
private_key.zeroize();
result
}
pub fn id(&self) -> String { BASE64_STANDARD.encode(&self.myts_id) }
/// Sign this connection's challenge with the original raw private scalar.
/// This is not Ed25519's seed expansion: the account already stores a scalar.
pub fn proof(&self, shared_iv: &[u8; 64]) -> Proof {
let mut challenge = Sha256::new();
challenge.update([0x30, 0x08, 0, 0, 0, 0]);
challenge.update(shared_iv);
let mut message = challenge.finalize().to_vec();
message.extend_from_slice(b"MyTeamSpeakID");
let mut nonce_hash = Sha512::new();
nonce_hash.update(self.private_key);
nonce_hash.update(&message);
let mut nonce = Scalar::from_bytes_mod_order_wide(&nonce_hash.finalize().into());
let public_nonce = (ED25519_BASEPOINT_TABLE * &nonce).compress().to_bytes();
let mut hash = Sha512::new();
hash.update(public_nonce);
hash.update(self.public_key);
hash.update(&message);
let challenge = Scalar::from_bytes_mod_order_wide(&hash.finalize().into());
let mut scalar = Scalar::from_bytes_mod_order(self.private_key);
let mut response = challenge * scalar + nonce;
let mut signature = [0; 64];
signature[..32].copy_from_slice(&public_nonce);
signature[32..].copy_from_slice(response.as_bytes());
scalar.zeroize();
nonce.zeroize();
response.zeroize();
Proof {
myteamspeak_id: self.id(),
creation_time: self.creation_time,
public_key: BASE64_STANDARD.encode(self.public_key),
auth_signature: BASE64_STANDARD.encode(signature),
public_signature: BASE64_STANDARD.encode(&self.public_signature[..64]),
public_signature_certificate: BASE64_STANDARD.encode(&self.public_signature[64..]),
}
}
}
/// Public, connection-bound authentication values. Never contains private keys.
#[derive(Clone)]
pub struct Proof {
pub myteamspeak_id: String,
pub creation_time: u64,
pub public_key: String,
pub auth_signature: String,
pub public_signature: String,
pub public_signature_certificate: String,
}
impl fmt::Debug for Proof {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("Proof([REDACTED])") }
}
impl Proof {
/// Append the official case-sensitive wire fields to an outgoing command.
pub fn write_to(&self, packet: &mut OutCommand) {
packet.write_arg("myTeamspeakId", &self.myteamspeak_id);
packet.write_arg("acTime", &self.creation_time);
packet.write_arg("userPubKey", &self.public_key);
packet.write_arg("authSign", &self.auth_signature);
packet.write_arg("pubSign", &self.public_signature);
packet.write_arg("pubSignCert", &self.public_signature_certificate);
}
}
#[cfg(test)]
mod tests {
use super::*;
use tsproto_packets::packets::{Direction, Flags, PacketType};
fn hex<const N: usize>(value: &str) -> [u8; N] {
let mut bytes = [0; N];
for (i, byte) in bytes.iter_mut().enumerate() {
*byte = u8::from_str_radix(&value[i * 2..i * 2 + 2], 16).unwrap();
}
bytes
}
fn identity() -> Identity {
Identity::new(
vec![7; 33],
123456,
hex("ce92350b547b6cf028df0618bf9aba55f949930059308d83ebd727e13472ed99"),
std::array::from_fn(|i| i as u8 + 1),
vec![9; 65],
)
.unwrap()
}
#[test]
fn raw_scalar_signature_matches_independent_vector() {
// Python integer Edwards arithmetic + hashlib, independent of dalek.
let proof = identity().proof(&std::array::from_fn(|i| i as u8));
let expected = hex::<64>(
"d56e1808e1ded53e20fc2849f016603c88eefe0494d75e9b869653e2bacaa495c562b571289d88a561c0f4b568cf90cc515b557b6d4321962e94ccf85f105a08",
);
assert_eq!(BASE64_STANDARD.decode(proof.auth_signature).unwrap(), expected);
assert_ne!(
identity().proof(&[0; 64]).auth_signature,
identity().proof(&[1; 64]).auth_signature
);
}
#[test]
fn credentials_roundtrip_validate_and_redact() {
let identity = identity();
let stored = serde_json::to_value(&identity).unwrap();
let restored: Identity = serde_json::from_value(stored.clone()).unwrap();
assert_eq!(serde_json::to_value(&restored).unwrap(), stored);
assert_eq!(
identity.proof(&[0; 64]).auth_signature,
restored.proof(&[0; 64]).auth_signature
);
assert_eq!(format!("{:?}", restored), "Identity([REDACTED])");
assert_eq!(format!("{:?}", restored.proof(&[0; 64])), "Proof([REDACTED])");
for field in ["myts_id", "public_signature", "public_key", "private_key"] {
let mut invalid = stored.clone();
invalid[field] = serde_json::json!([]);
assert!(serde_json::from_value::<Identity>(invalid).is_err(), "{}", field);
}
for private in [vec![0; 32], vec![1; 32]] {
let mut invalid = stored.clone();
invalid["private_key"] = serde_json::json!(private);
assert!(serde_json::from_value::<Identity>(invalid).is_err());
}
for length in [64, 4097] {
let mut invalid = stored.clone();
invalid["public_signature"] = serde_json::json!(vec![9; length]);
assert!(serde_json::from_value::<Identity>(invalid).is_err());
}
}
#[test]
fn proof_writes_exact_public_wire_fields() {
let mut command =
OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "clientinit");
identity().proof(&[0; 64]).write_to(&mut command);
let packet = command.into_packet();
let wire = std::str::from_utf8(packet.content()).unwrap();
let fields: Vec<_> =
wire.split(' ').skip(1).map(|field| field.split('=').next().unwrap()).collect();
assert_eq!(fields, [
"myTeamspeakId",
"acTime",
"userPubKey",
"authSign",
"pubSign",
"pubSignCert"
]);
assert!(!wire.contains("private"));
}
}
+3
View File
@@ -57,6 +57,9 @@ tsproto-packets = { path = "../proto/tsproto-packets" }
tsproto-types = { path = "../proto/tsproto-types" }
[dev-dependencies]
# Already in the app's graph (reqwest); for one_rustls_crypto_provider.
rustls = { version = "0.23", default-features = false }
voelin-myts = { path = "../voelin-myts" }
# `process`: the browser interop test drives Chromium through Node.js.
tokio = { version = "1", features = ["macros", "net", "process", "rt-multi-thread", "test-util"] }
+31 -2
View File
@@ -63,6 +63,7 @@ pub mod settings;
pub mod stream;
#[cfg(feature = "media")]
pub mod studio;
pub mod versions;
mod voice;
mod web;
@@ -70,7 +71,7 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::{broadcast, mpsc};
use tokio::sync::{broadcast, mpsc, watch};
pub use voelin_audio::settings::TransmitMode;
pub use voelin_audio::{AudioSettings, ProcessingSettings, VadSettings};
use voelin_model::{
@@ -101,6 +102,8 @@ pub type SessionId = u64;
/// What the UI asks for.
#[derive(Clone, Debug)]
pub enum Command {
/// Main account proof for every current and future voice connection.
SetMytsIdentity(Option<Arc<tsproto::myts::Identity>>),
ConnectVoice {
session: SessionId,
options: Box<VoiceOptions>,
@@ -812,6 +815,7 @@ async fn run(
// Before any command: a contact set meanwhile would be lost.
contacts.load().await;
let mut sessions: HashMap<SessionId, session::SessionHandle> = HashMap::new();
let (myts_identity, _) = watch::channel(None);
let mut current = shared.current();
// Pruning: at start, then hourly (and when the setting changes).
let mut prune = tokio::time::interval(std::time::Duration::from_secs(3600));
@@ -856,6 +860,19 @@ async fn run(
},
};
let id = match command {
Command::SetMytsIdentity(identity) => {
// Still no account is no change: every notification restarts
// handshakes and sends `updatemytsid` on every connection. Any
// account is (each connection's proof is signed anew).
myts_identity.send_if_modified(|current| {
if current.is_none() && identity.is_none() {
return false;
}
*current = identity;
true
});
continue;
}
Command::SetAudioSettings(new) => {
settings = (*new).clone();
for s in sessions.values() {
@@ -931,6 +948,7 @@ async fn run(
frames.clone(),
settings.clone(),
engine.clone(),
myts_identity.subscribe(),
);
if let Some(profiles) = &srtp_profiles {
s.send(Command::SetSrtpProfiles(profiles.clone()));
@@ -1008,7 +1026,8 @@ fn command_session(command: &Command) -> SessionId {
| Command::DeleteOfflineMessage { session, .. }
| Command::SetOfflineMessageRead { session, .. }
| Command::CloseSession { session } => *session,
Command::SetAudioSettings(_)
Command::SetMytsIdentity(_)
| Command::SetAudioSettings(_)
| Command::SetSrtpProfiles(_)
| Command::TestMicrophone { .. }
| Command::SetSetting { .. }
@@ -1022,3 +1041,13 @@ fn command_session(command: &Command) -> SessionId {
}
}
}
/// The app has one rustls crypto provider. With two (aws-lc-rs and ring), a
/// TLS client built without an explicit provider panics: `wss://` gateways
/// did. This test's build has the app's TLS dependencies (reqwest here,
/// tonic through the voelin-myts dev-dependency).
#[cfg(test)]
#[test]
fn one_rustls_crypto_provider() {
let _ = rustls::ClientConfig::builder();
}
+14 -3
View File
@@ -86,9 +86,12 @@ impl SessionHandle {
frames: broadcast::Sender<StreamFrame>,
audio_settings: AudioSettings,
shared: Shared,
myts_identity: watch::Receiver<Option<Arc<tsproto::myts::Identity>>>,
) -> Self {
let (tx, rx) = mpsc::unbounded_channel();
tokio::spawn(Session::new(id, events, frames, audio_settings, shared).run(rx));
tokio::spawn(
Session::new(id, events, frames, audio_settings, shared, myts_identity).run(rx),
);
Self { tx }
}
@@ -171,6 +174,7 @@ struct OwnStream {
}
struct Session {
myts_identity: watch::Receiver<Option<Arc<tsproto::myts::Identity>>>,
id: SessionId,
events: broadcast::Sender<Event>,
state: SessionState,
@@ -244,11 +248,13 @@ impl Session {
frames: broadcast::Sender<StreamFrame>,
audio_settings: AudioSettings,
shared: Shared,
myts_identity: watch::Receiver<Option<Arc<tsproto::myts::Identity>>>,
) -> Self {
let (sources_tx, sources_rx) = mpsc::unbounded_channel();
let Shared { settings, history, cache, contacts } = shared;
let contacts_rx = Some(contacts.watch());
Self {
myts_identity,
cache,
contacts,
contacts_rx,
@@ -381,6 +387,7 @@ impl Session {
self.forward(audio_rx, move |e| SourceEvent::Audio(generation, e));
}
let link = VoiceLink {
myts_identity: self.myts_identity.clone(),
session: self.id,
events: self.events.clone(),
settings: self.settings.clone(),
@@ -691,7 +698,8 @@ impl Session {
self.voice_request(Some(request), VoiceCmd::OfflineFlag { request, id, read });
}
// Engine-wide.
Command::CloseSession { .. }
Command::SetMytsIdentity(_)
| Command::CloseSession { .. }
| Command::TestMicrophone { .. }
| Command::SetSetting { .. }
| Command::ResetSetting { .. }
@@ -1915,7 +1923,10 @@ mod banner_tests {
cache: SharedCache::new(Cache::new(dir)),
contacts: Contacts::new(events.clone(), history),
};
(Session::new(1, events, frames, AudioSettings::default(), shared), receiver)
// No myTeamSpeak account; its source stays open, as the engine's does
// (a closed one ends voice connections).
let myts_identity = Box::leak(Box::new(watch::Sender::new(None))).subscribe();
(Session::new(1, events, frames, AudioSettings::default(), shared, myts_identity), receiver)
}
#[tokio::test]
+181
View File
@@ -0,0 +1,181 @@
//! Known signed client versions.
//!
//! `clientinit` must carry a `client_version_sign` produced by TeamSpeak's
//! private key, so a client can only claim versions from this list of captured
//! signatures (the `Versions.csv` declaration file).
use anyhow::{Context, Result, bail};
use base64::prelude::*;
use tsclientlib::Version;
const VERSIONS_CSV: &str = include_str!("../../proto/tsproto-structs/declarations/Versions.csv");
/// The signed generic version of every platform, tsclientlib's default.
const GENERIC_VERSION: &str = "3.?.? [Build: 5680278000]";
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct KnownVersion {
pub version: String,
pub platform: String,
pub signature: String,
}
impl KnownVersion {
pub fn to_version(&self) -> Result<Version> {
let signature = BASE64_STANDARD
.decode(&self.signature)
.with_context(|| format!("invalid signature for {}@{}", self.platform, self.version))?;
Ok(Version::Custom {
platform: self.platform.clone(),
version: self.version.clone(),
signature,
})
}
}
pub fn known_versions() -> Vec<KnownVersion> {
VERSIONS_CSV
.lines()
.skip(1)
.filter(|l| !l.trim().is_empty())
.filter_map(|l| {
// The version string contains no commas, the signature is base64.
let mut parts = l.splitn(3, ',');
Some(KnownVersion {
version: parts.next()?.to_string(),
platform: parts.next()?.to_string(),
signature: parts.next()?.trim().to_string(),
})
})
.collect()
}
/// Resolve a `--client-version` argument.
///
/// Accepts `default` (the core native-platform default), an index into [`known_versions`],
/// or `<platform>@<version>` with the exact strings from `voelinctl versions`.
pub fn resolve(spec: &str) -> Result<Option<Version>> {
if spec == "default" {
return Ok(None);
}
let versions = known_versions();
if let Ok(i) = spec.parse::<usize>() {
let Some(v) = versions.get(i) else {
bail!("version index {i} out of range (0..{})", versions.len());
};
return v.to_version().map(Some);
}
let Some((platform, version)) = spec.split_once('@') else {
bail!("expected `default`, an index or `<platform>@<version>`, got {spec:?}");
};
match versions.iter().find(|v| v.platform == platform && v.version == version) {
Some(v) => v.to_version().map(Some),
None => bail!("unknown client version {spec:?}, see `voelinctl versions`"),
}
}
/// The signed compatibility tuple for the native operating system.
///
/// The generic version retains the library's minimum-version compatibility.
/// Its version, platform and signature must stay together: the signature does
/// not authorize renaming the client or changing its platform.
///
/// Unsupported operating systems return an error rather than claiming another
/// platform. Product identity belongs in [`client_metadata`], not this tuple.
pub fn native_version() -> Result<Version> {
compatibility_version(std::env::consts::OS)
}
fn compatibility_version(os: &str) -> Result<Version> {
let platform = match os {
"linux" => "Linux",
"windows" => "Windows",
"macos" => "OS X",
"android" => "Android",
"ios" => "iOS",
_ => bail!("no signed compatibility version for operating system {os:?}"),
};
// The library's generic version: its build passes servers' minimum client
// version, which a real (older) build such as 3.6.0 may not.
known_versions()
.into_iter()
.find(|version| version.platform == platform && version.version == GENERIC_VERSION)
.with_context(|| format!("missing signed compatibility version for {platform}"))?
.to_version()
}
/// Truthful product identity, separate from the signed compatibility tuple.
pub fn client_metadata() -> String {
serde_json::json!({
"name": "Voelin",
// The app's version (it sets it at start), not this library's.
"version": voelin_platform::crash::app_version(),
"platform": std::env::consts::OS,
})
.to_string()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn native_platform_preserves_complete_signed_tuple() {
for (os, platform) in [
("linux", "Linux"),
("windows", "Windows"),
("macos", "OS X"),
("android", "Android"),
("ios", "iOS"),
] {
let version = compatibility_version(os).unwrap();
assert_eq!(version.get_platform(), platform);
assert_eq!(version.get_version_string(), "3.?.? [Build: 5680278000]");
assert_eq!(version.get_signature().len(), 64);
let known = known_versions()
.into_iter()
.find(|known| {
known.platform == platform && known.version == version.get_version_string()
})
.unwrap();
assert_eq!(version, known.to_version().unwrap());
}
assert!(compatibility_version("freebsd").is_err());
assert!(compatibility_version("unknown").is_err());
match compatibility_version(std::env::consts::OS) {
Ok(expected) => assert_eq!(native_version().unwrap(), expected),
Err(_) => assert!(native_version().is_err()),
}
}
#[test]
fn metadata_identifies_voelin_without_changing_signed_version() {
let metadata: serde_json::Value = serde_json::from_str(&client_metadata()).unwrap();
assert_eq!(metadata["name"], "Voelin");
assert_eq!(metadata["version"], voelin_platform::crash::app_version());
assert_eq!(metadata["platform"], std::env::consts::OS);
}
#[test]
fn parses_all_rows() {
let versions = known_versions();
assert!(versions.len() > 50);
for v in &versions {
let signature = BASE64_STANDARD.decode(&v.signature).unwrap();
assert_eq!(signature.len(), 64, "{v:?}");
}
}
#[test]
fn resolves_specs() {
assert!(resolve("default").unwrap().is_none());
let by_index = resolve("0").unwrap().unwrap();
let first = &known_versions()[0];
let by_name = resolve(&format!("{}@{}", first.platform, first.version)).unwrap().unwrap();
assert_eq!(by_index, by_name);
assert_eq!(by_name.get_platform(), first.platform);
assert!(resolve("Nope@1.0").is_err());
assert!(resolve("100000").is_err());
assert!(resolve("garbage").is_err());
}
}
+214 -33
View File
@@ -8,11 +8,12 @@
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;
use base64::Engine as _;
use futures::prelude::*;
use tokio::sync::{broadcast, mpsc};
use tokio::sync::{broadcast, mpsc, watch};
use tokio::task::AbortHandle;
use tokio::time::{Instant, timeout};
use tracing::{debug, info, warn};
@@ -39,7 +40,7 @@ pub struct VoiceOptions {
pub address: String,
pub nickname: String,
pub identity: Option<Identity>,
/// Signed client version; `None` for the library default.
/// Signed compatibility version; `None` selects the native platform's tuple.
pub client_version: Option<Version>,
pub server_password: Option<String>,
/// Channel path to join, e.g. `Lobby/Sub`.
@@ -68,6 +69,7 @@ impl VoiceOptions {
/// Where a voice connection reports answers the session does not need to see.
#[derive(Clone)]
pub(crate) struct VoiceLink {
pub myts_identity: watch::Receiver<Option<Arc<tsproto::myts::Identity>>>,
pub session: SessionId,
pub events: broadcast::Sender<Event>,
pub settings: SharedSettings,
@@ -224,6 +226,8 @@ fn now_ms() -> i64 {
}
enum Input {
MytsIdentityChanged,
AccountSourceClosed,
Item(Option<Result<StreamItem, tsclientlib::Error>>),
Cmd(Option<VoiceCmd>),
Tick,
@@ -231,6 +235,7 @@ enum Input {
/// A command waiting for the server's answer.
enum Pending {
MytsIdentity(Instant),
Stream(Request),
FileList {
request: RequestId,
@@ -343,35 +348,59 @@ async fn run_inner(
commands: &mut mpsc::UnboundedReceiver<VoiceCmd>,
events: &mpsc::UnboundedSender<VoiceEvent>,
) -> anyhow::Result<()> {
let mut builder = Connection::build(options.address.clone()).name(options.nickname.clone());
let version = match &options.client_version {
Some(version) => version.clone(),
None => crate::versions::native_version()?,
};
let mut builder = Connection::build(options.address.clone())
.name(options.nickname.clone())
.version(version)
.metadata(crate::versions::client_metadata());
if let Some(identity) = &options.identity {
builder = builder.identity(identity.clone());
}
if let Some(version) = &options.client_version {
builder = builder.version(version.clone());
}
if let Some(pw) = &options.server_password {
builder = builder.password(pw.clone());
}
if let Some(channel) = &options.channel {
builder = builder.channel(channel.clone());
}
let mut con = builder.connect()?;
// Wait for the initial state.
let connected = timeout(Duration::from_secs(30), async {
con.events()
.try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_))))
.next()
.await
let mut identity = link.myts_identity.clone();
// A changed account invalidates an in-flight handshake. Drop that connection
// and take a fresh snapshot before publishing any connected state.
let mut con = timeout(Duration::from_secs(30), async {
loop {
let snapshot = identity.borrow_and_update().as_deref().cloned();
let mut con = builder.clone().myts_identity(snapshot).connect()?;
let connected = tokio::select! {
biased;
changed = identity.changed() => {
changed.map_err(|_| anyhow::anyhow!("account source closed"))?;
continue;
}
connected = async {
con.events()
.try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_))))
.next().await
} => connected,
};
match connected {
Some(Ok(_)) => {}
Some(Err(e)) => return Err(anyhow::Error::from(e)),
None => anyhow::bail!("connection closed"),
}
if identity.has_changed().unwrap_or(true) {
// Connected already: leave properly, or the server keeps a
// client with the old account until it times out, next to
// the new one.
let _ = shutdown_connection(con).await;
continue;
}
return Ok(con);
}
})
.await
.map_err(|_| anyhow::anyhow!("timed out while connecting"))?;
match connected {
Some(Ok(_)) => {}
Some(Err(e)) => return Err(e.into()),
None => anyhow::bail!("connection closed"),
}
.map_err(|_| anyhow::anyhow!("timed out while connecting"))??;
let server_uid = {
let state = con.get_state()?;
let flavor = ServerFlavor::from_version_string(&state.server.version);
@@ -409,15 +438,25 @@ async fn run_inner(
let mut tick = tokio::time::interval(Duration::from_millis(250));
let result = loop {
let input = {
let mut stream = voice.con.events();
tokio::select! {
item = stream.next() => Input::Item(item),
cmd = commands.recv() => Input::Cmd(cmd),
_ = tick.tick() => Input::Tick,
}
};
// Check on every turn so busy command/audio queues cannot delay expiry.
if voice.pending.values().any(|pending| {
matches!(pending, Pending::MytsIdentity(started)
if started.elapsed() >= Duration::from_secs(10))
}) {
break Err(anyhow::anyhow!("myTeamSpeak account update timed out"));
}
let input = next_input(&mut voice.con.events(), commands, &mut tick, &mut identity).await;
match input {
Input::AccountSourceClosed => break Err(anyhow::anyhow!("account source closed")),
Input::MytsIdentityChanged => {
let snapshot = identity.borrow_and_update().as_deref().cloned();
match voice.con.update_myts_identity(snapshot) {
Ok(handle) => {
voice.pending.insert(handle, Pending::MytsIdentity(Instant::now()));
}
Err(e) => break Err(anyhow::anyhow!("myTeamSpeak account update: {e}")),
}
}
Input::Item(None) => break Err(anyhow::anyhow!("connection closed")),
Input::Item(Some(Err(e))) => break Err(e.into()),
Input::Item(Some(Ok(item))) => {
@@ -438,10 +477,52 @@ async fn run_inner(
for (_, job) in voice.jobs.drain() {
job.report()(TransferState::Failed("disconnected".into()));
}
let disconnect = shutdown_connection(voice.con).await;
result?;
voice.con.disconnect(DisconnectOptions::new())?;
let _ =
timeout(Duration::from_secs(3), voice.con.events().for_each(|_| future::ready(()))).await;
disconnect?;
Ok(())
}
async fn next_input(
stream: &mut (impl Stream<Item = Result<StreamItem, tsclientlib::Error>> + Unpin),
commands: &mut mpsc::UnboundedReceiver<VoiceCmd>,
tick: &mut tokio::time::Interval,
identity: &mut watch::Receiver<Option<Arc<tsproto::myts::Identity>>>,
) -> Input {
tokio::select! {
biased;
changed = identity.changed() => if changed.is_ok() {
Input::MytsIdentityChanged
} else {
Input::AccountSourceClosed
},
input = async {
// Keep account changes first without starving network or timers when
// the audio command queue remains ready.
tokio::select! {
cmd = commands.recv() => Input::Cmd(cmd),
_ = tick.tick() => Input::Tick,
item = stream.next() => Input::Item(item),
}
} => input,
}
}
async fn shutdown_connection(mut con: Connection) -> Result<(), tsclientlib::Error> {
// disconnect() also returns Ok while Connecting. Never poll that stale
// handshake: dropping it is the cancellation boundary for logout.
if con.get_state().is_err() {
return Ok(());
}
con.disconnect(DisconnectOptions::new())?;
let _ = timeout(Duration::from_secs(3), async {
while con.get_state().is_ok() {
if con.events().next().await.is_none() {
break;
}
}
})
.await;
Ok(())
}
@@ -496,7 +577,13 @@ impl Voice {
StreamItem::MessageEvent(msg) => self.message_event(&msg),
StreamItem::MessageResult(handle, result) => {
if let Some(pending) = self.pending.remove(&handle) {
self.answered(pending, result.map_err(|e| e.error));
if matches!(pending, Pending::MytsIdentity(_)) {
result.map_err(|e| {
anyhow::anyhow!("myTeamSpeak account update: {}", e.error)
})?;
} else {
self.answered(pending, result.map_err(|e| e.error));
}
}
}
StreamItem::FileDownload(handle, download) => {
@@ -714,7 +801,7 @@ impl Voice {
};
self.link.emit(Event::OfflineMessage { session, request, result });
}
Pending::Quiet => {}
Pending::Quiet | Pending::MytsIdentity(_) => {}
Pending::Report(what) => {
if let Err(e) = result {
let _ = self.events.send(VoiceEvent::Error(format!("{what}: {e}")));
@@ -1021,3 +1108,97 @@ mod image_download_tests {
assert_eq!(image_download_time(cache::MAX_PICTURE_BYTES), Duration::from_secs(30 + 2048));
}
}
#[cfg(test)]
mod account_tests {
use super::*;
#[tokio::test(start_paused = true)]
async fn account_priority_preserves_ready_network_and_timer_progress() {
let (account, mut identity) = watch::channel(None);
let (commands, mut receiver) = mpsc::unbounded_channel();
for _ in 0..512 {
commands.send(VoiceCmd::SetInputMuted(false)).unwrap();
}
let mut stream = futures::stream::poll_fn(|_| {
std::task::Poll::Ready(Some(Err(tsclientlib::Error::NotConnected)))
});
let mut tick = tokio::time::interval(Duration::from_millis(1));
account.send_replace(None);
assert!(matches!(
next_input(&mut stream, &mut receiver, &mut tick, &mut identity).await,
Input::MytsIdentityChanged
));
identity.borrow_and_update();
let (mut network, mut timers, mut audio) = (0, 0, 0);
for _ in 0..512 {
tokio::time::advance(Duration::from_millis(1)).await;
match next_input(&mut stream, &mut receiver, &mut tick, &mut identity).await {
Input::Item(_) => network += 1,
Input::Tick => timers += 1,
Input::Cmd(_) => audio += 1,
_ => panic!("unexpected account change"),
}
}
assert!(network > 0 && timers > 0 && audio > 0);
}
#[tokio::test]
async fn shutdown_never_polls_a_connecting_connection() {
let server = tokio::net::UdpSocket::bind("127.0.0.1:0").await.unwrap();
let mut con =
Connection::build(server.local_addr().unwrap().to_string()).connect().unwrap();
assert!(matches!(con.update_myts_identity(None), Err(tsclientlib::Error::NotConnected)));
// tsclientlib returns Ok here despite retaining its Connecting future.
assert!(con.disconnect(DisconnectOptions::new()).is_ok());
timeout(Duration::from_millis(100), shutdown_connection(con)).await.unwrap().unwrap();
let mut packet = [0; 2048];
assert!(matches!(server.try_recv_from(&mut packet), Err(error)
if error.kind() == std::io::ErrorKind::WouldBlock));
}
#[tokio::test]
async fn account_change_cancels_pending_handshake() {
// A silent UDP peer keeps the handshake in flight without an external server.
let server = tokio::net::UdpSocket::bind("127.0.0.1:0").await.unwrap();
let (account, identity) = watch::channel(None);
let (events, _) = broadcast::channel(8);
let link = VoiceLink {
session: 1,
events,
settings: SharedSettings::new(crate::settings::Settings::default()),
myts_identity: identity,
};
let (_commands, commands) = mpsc::unbounded_channel();
let (events, mut received) = mpsc::unbounded_channel();
let task = tokio::spawn(run(
VoiceOptions::new(server.local_addr().unwrap().to_string(), "account-test"),
link,
commands,
events,
));
let mut packet = [0; 2048];
let (_, first) =
timeout(Duration::from_secs(5), server.recv_from(&mut packet)).await.unwrap().unwrap();
// A logout/clear notification must cancel the old socket and restart.
account.send_replace(None);
let second = timeout(Duration::from_secs(5), async {
loop {
let (_, peer) = server.recv_from(&mut packet).await.unwrap();
if peer != first {
break peer;
}
}
})
.await
.unwrap();
assert_ne!(first, second);
// Losing the account authority fails closed immediately, not after connect timeout.
drop(account);
timeout(Duration::from_secs(2), task).await.unwrap().unwrap();
assert!(
matches!(received.recv().await, Some(VoiceEvent::Disconnected(Some(reason))) if reason == "account source closed")
);
assert!(received.try_recv().is_err());
}
}
+149
View File
@@ -0,0 +1,149 @@
//! Opt-in account + isolated server interoperability check. No keys are saved.
//! Requires VOELIN_MYTS_LIVE=1, EMAIL/PASSWORD/DEVICE_ID and optional OTP under
//! the VOELIN_MYTS_ prefix; TEST_TS3/TEST_TS6 and QUERY_TS3/QUERY_TS6 give
//! loopback voice/query addresses. QUERY_PASSWORD authenticates local query.
#![cfg(not(target_os = "android"))]
use std::{sync::Arc, time::Duration};
use anyhow::{Context, Result, bail, ensure};
use tokio::{sync::broadcast, time::timeout};
use voelin_core::{Command, Engine, Event, VoiceOptions, VoiceState};
use voelin_myts::{Client, ServerIdentity};
use voelin_query::{Command as QueryCommand, QueryClient, Row};
fn env(name: &str) -> Result<String> {
std::env::var(format!("VOELIN_MYTS_{name}")).with_context(|| format!("missing {name}"))
}
async fn connected(events: &mut broadcast::Receiver<Event>, session_id: u64) -> Result<u16> {
timeout(Duration::from_secs(35), async {
loop {
match events.recv().await? {
Event::State { session, state }
if session == session_id && state.voice == VoiceState::Connected =>
{
if let Some(id) = state.own_client {
return Ok(id);
}
}
Event::Error { message, .. } => bail!("engine: {message}"),
_ => {}
}
}
})
.await?
}
async fn info(query: &QueryClient, client: u16) -> Result<Row> {
query
.send(&QueryCommand::new("clientinfo").arg("clid", client))
.await?
.into_iter()
.next()
.context("clientinfo missing")
}
async fn wait_id(query: &QueryClient, client: u16, expected: &str) -> Result<()> {
timeout(Duration::from_secs(12), async {
loop {
let row = info(query, client).await?;
if row.get("client_myteamspeak_id") == Some(expected) {
return Ok(());
}
tokio::time::sleep(Duration::from_millis(200)).await;
}
})
.await
.context("server did not report the expected myTS association")?
}
async fn server(identity: Arc<ServerIdentity>, kind: &str) -> Result<()> {
let address = env(&format!("TEST_{kind}"))?;
let query_address = env(&format!("QUERY_{kind}"))?;
// This test is deliberately limited to caller-owned loopback test servers.
ensure!(address.starts_with("127.0.0.1:"), "voice endpoint must be loopback");
ensure!(query_address.starts_with("127.0.0.1:"), "query endpoint must be loopback");
let (query, _) = QueryClient::connect(&voelin_query::Connect {
transport: if kind == "TS3" {
voelin_query::Transport::Raw
} else {
voelin_query::Transport::Ssh
},
addr: query_address,
user: "serveradmin".into(),
secret: Some(env("QUERY_PASSWORD")?),
server_id: Some(1),
server_port: None,
line: voelin_query::LineOptions { rate_limit: None, ..Default::default() },
})
.await?;
let engine = Engine::start();
let mut events = engine.subscribe();
let result = async {
engine.send(Command::SetMytsIdentity(Some(identity.clone())));
for session in 1..=2 {
engine.send(Command::ConnectVoice {
session,
options: Box::new(VoiceOptions::new(&address, format!("myts-proof-{session}"))),
});
let client = connected(&mut events, session).await?;
let row = info(&query, client).await?;
let version = voelin_core::versions::native_version()?;
ensure!(row.get("client_platform") == Some(version.get_platform()), "wrong platform");
ensure!(
row.get("client_version") == Some(version.get_version_string()),
"wrong version"
);
let metadata: serde_json::Value =
serde_json::from_str(row.get("client_meta_data").context("missing metadata")?)?;
ensure!(metadata["name"] == "Voelin", "wrong client metadata");
ensure!(metadata["platform"] == std::env::consts::OS, "wrong metadata platform");
eprintln!("{kind}: native platform/Voelin metadata passed");
wait_id(&query, client, &identity.id()).await?;
eprintln!("{kind}: signed clientinit myTS ID passed");
// Two fresh connections prove the signature is bound to each handshake.
engine.send(Command::SetMytsIdentity(None));
wait_id(&query, client, "").await?;
engine.send(Command::SetMytsIdentity(Some(identity.clone())));
wait_id(&query, client, &identity.id()).await?;
eprintln!("{kind}: live clear and reattach passed");
engine.send(Command::CloseSession { session });
}
Ok(())
}
.await;
engine.send(Command::SetMytsIdentity(None));
for session in 1..=2 {
engine.send(Command::CloseSession { session });
}
query.quit().await;
result
}
#[tokio::test(flavor = "multi_thread")]
#[ignore = "requires owner-authorized account and isolated loopback servers"]
async fn authenticated_account_and_server_lifecycle() -> Result<()> {
ensure!(env("LIVE")? == "1", "explicit live opt-in required");
let client = Client::new()?;
let login = client
.login(&env("EMAIL")?, &env("PASSWORD")?, env("OTP").ok().as_deref(), &env("DEVICE_ID")?)
.await?;
// Capture every result before deleting the newly created remote session.
let result = async {
client.validate_session(&login.token).await?;
let identity = Arc::new(login.identity.context("server identity unlock failed")?);
let mut failures = Vec::new();
for kind in ["TS3", "TS6"] {
if let Err(error) = server(identity.clone(), kind).await {
failures.push(format!("{kind}: {error:#}"));
}
}
ensure!(failures.is_empty(), "{}", failures.join("; "));
Ok(())
}
.await;
let logout = client.logout(&login.token).await;
logout.context("remote test session revocation failed")?;
result
}
+5
View File
@@ -126,6 +126,11 @@ pub fn set_app_version(version: impl Into<String>) {
config().version = version.into();
}
/// The app's version ([`set_app_version`]), also what it tells servers.
pub fn app_version() -> String {
config().version.clone()
}
/// How many reports to keep (at least one).
pub fn set_keep(keep: usize) {
config().keep = keep.max(1);
+1
View File
@@ -49,6 +49,7 @@ tsclientlib = { path = "../proto/tsclientlib" }
# Desktop: the keyring for passwords, stream media with libvpx, OpenH264, X11
# and PipeWire, global hotkeys through the portal and X11.
[target.'cfg(not(target_os = "android"))'.dependencies]
voelin-myts = { path = "../voelin-myts" }
slint = { version = "1.18", features = ["renderer-software"] }
voelin-core = { path = "../voelin-core", default-features = false, features = ["media-desktop"] }
voelin-platform = { path = "../voelin-platform" }
File diff suppressed because it is too large. Load diff
+40 -5
View File
@@ -97,6 +97,9 @@ fn default_secrets() -> Box<dyn Secrets> {
#[cfg(not(target_os = "android"))]
impl Secrets for FallbackSecrets {
fn get(&self, key: &str) -> voelin_store::Result<Option<String>> {
if key.starts_with("myts/") {
return self.keyring.get(key);
}
match self.memory.get(key)? {
Some(v) => Ok(Some(v)),
None => Ok(self.keyring.get(key).unwrap_or(None)),
@@ -104,6 +107,9 @@ impl Secrets for FallbackSecrets {
}
fn set(&self, key: &str, value: &str) -> voelin_store::Result<()> {
if key.starts_with("myts/") {
return self.keyring.set(key, value);
}
if let Err(error) = self.keyring.set(key, value) {
warn!(%error, "keyring unavailable, keeping the secret for this session only");
return self.memory.set(key, value);
@@ -112,6 +118,9 @@ impl Secrets for FallbackSecrets {
}
fn delete(&self, key: &str) -> voelin_store::Result<()> {
if key.starts_with("myts/") {
return self.keyring.delete(key);
}
let _ = self.keyring.delete(key);
self.memory.delete(key)
}
@@ -407,6 +416,10 @@ impl Models {
}
pub(crate) struct App {
#[cfg(not(target_os = "android"))]
pub runtime: tokio::runtime::Handle,
#[cfg(not(target_os = "android"))]
pub myts: crate::myts::Account,
pub ui: slint::Weak<MainWindow>,
pub store: Store,
pub secrets: Box<dyn Secrets>,
@@ -646,9 +659,16 @@ pub fn run(options: RunOptions) -> Result<()> {
let mut video = Video::new(&dir, settings.openh264);
video.set_decoder_preference(decoder_preference(&prefs));
let app = App {
#[cfg(not(target_os = "android"))]
runtime: runtime.clone(),
#[cfg(not(target_os = "android"))]
myts: Default::default(),
ui: ui.as_weak(),
store,
secrets: options.secrets.unwrap_or_else(default_secrets),
// The sample data of VOELIN_DEMO_UI never reaches the system keyring.
secrets: options.secrets.unwrap_or_else(|| {
if switches.demo_ui { Box::new(MemorySecrets::default()) } else { default_secrets() }
}),
engine: engine.clone(),
identity,
current: bookmarks.first().map(|b| b.id),
@@ -701,6 +721,8 @@ pub fn run(options: RunOptions) -> Result<()> {
app.refresh_home();
app.refresh_notices();
app.refresh_pages();
#[cfg(not(target_os = "android"))]
app.start_myts();
if app.demo {
app.start_demo();
}
@@ -760,16 +782,29 @@ pub fn run(options: RunOptions) -> Result<()> {
/// Open a file or folder with the desktop's default application.
pub(crate) fn open_path(path: &Path) -> std::io::Result<()> {
open_target(path.as_os_str())
}
/// Open a file, folder or address with the desktop's handler. Success is that
/// the opener started: explorer's exit code means nothing (1 on success), and
/// xdg-open may wait until the browser closes.
pub(crate) fn open_target(target: &std::ffi::OsStr) -> std::io::Result<()> {
let mut child = desktop_opener(target).spawn()?;
// Reap it without blocking the UI.
std::thread::spawn(move || child.wait());
Ok(())
}
/// Build an argument-based desktop opener; never pass a target through a shell.
pub(crate) fn desktop_opener(target: &std::ffi::OsStr) -> std::process::Command {
#[cfg(windows)]
let mut command = std::process::Command::new("explorer");
#[cfg(target_os = "macos")]
let mut command = std::process::Command::new("open");
#[cfg(not(any(windows, target_os = "macos")))]
let mut command = std::process::Command::new("xdg-open");
let mut child = command.arg(path).spawn()?;
// Reap it without blocking the UI.
std::thread::spawn(move || child.wait());
Ok(())
command.arg(target);
command
}
pub(crate) fn model<T: Clone + 'static>(items: Vec<T>) -> ModelRc<T> {
+20
View File
@@ -6,6 +6,26 @@ use crate::app::{Bridge, MainWindow, with_app};
pub(super) fn wire(ui: &MainWindow) {
let bridge = ui.global::<Bridge>();
#[cfg(not(target_os = "android"))]
{
bridge.on_myts_login(|email, password, otp| {
with_app(|app| {
app.myts_login(email.to_string(), password.to_string(), otp.to_string())
});
});
bridge.on_myts_logout(|| {
with_app(|app| app.myts_logout());
});
bridge.on_myts_dismiss(|| {
with_app(|app| app.myts_dismiss());
});
bridge.on_myts_retry(|| {
with_app(|app| app.myts_retry());
});
bridge.on_myts_portal(|action| {
with_app(|app| app.myts_portal(action));
});
}
bridge.on_open_settings(|| {
with_app(|app| app.open_settings());
});
+25
View File
@@ -168,6 +168,31 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running {
for open in &switches.open {
let (what, arg) = open.split_once(':').unwrap_or((open.as_str(), ""));
match what {
"login" if switches.demo_ui => {
let bridge = ui.global::<Bridge>();
let mut account = bridge.get_myts();
account.available = true;
account.prompt = arg != "account";
if arg == "account" {
account.signed_in = true;
account.username = "Alex Example".into();
account.email = "alex@example.test".into();
account.uuid = "00000000-0000-0000-0000-000000000001".into();
account.myts_id = "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB".into();
account.identity_status = 1;
nav.invoke_open_settings(SettingsSection::Account);
}
account.otp_required = arg == "otp";
account.can_forget = arg == "saved" || arg == "account";
account.status = if arg == "otp" {
3
} else if arg == "saved" {
2
} else {
0
};
bridge.set_myts(account);
}
"home" => nav.invoke_show(Page::Home),
"server" => nav.invoke_show(Page::Server),
"settings" => nav.invoke_open_settings(section(arg)),
+2
View File
@@ -15,6 +15,8 @@ mod images;
mod inbox;
mod members;
mod messages;
#[cfg(not(target_os = "android"))]
mod myts;
mod previews;
mod servers;
mod settings;
+702
View File
@@ -0,0 +1,702 @@
//! Desktop account state. Only the UI thread mutates state or persists credentials.
use serde::{Deserialize, Serialize};
use slint::ComponentHandle;
use std::sync::Arc;
use voelin_myts::{Client, Login, ServerIdentity, SessionToken};
use voelin_store::Secrets;
use crate::app::{App, Bridge, MytsForm, later};
// One keyring item makes session replacement atomic: a failed write cannot
// combine a new session with another account's renewal material.
const KEY: &str = "myts/session";
#[derive(Default, Serialize, Deserialize)]
struct Saved {
session: String,
email: String,
username: String,
#[serde(default)]
uuid: String,
renewal_token: String,
device_id: String,
#[serde(default)]
otp_token: String,
// Private account identity belongs in the same secret-store transaction.
#[serde(default)]
identity: Option<ServerIdentity>,
}
#[derive(Default)]
pub(crate) struct Account {
saved: Option<Saved>,
signed_in: bool,
busy: bool,
otp_required: bool,
status: i32,
persistence_status: i32,
generation: u64,
started: bool,
prompt: bool,
// Also set after a failed read/delete so the user can retry clearing.
can_forget: bool,
identity_failed: bool,
}
impl Account {
fn load(&mut self, secrets: &dyn Secrets) {
match read_saved(secrets) {
Ok(saved) => {
self.saved = saved;
self.can_forget = false;
self.status = 0;
self.persistence_status = 0;
self.identity_failed = false;
}
Err(()) => {
self.can_forget = true;
self.persistence_status = 1;
}
}
}
fn restored(&mut self) {
self.signed_in = true;
self.prompt = false;
self.otp_required = false;
}
fn device_for(&self, email: &str) -> (String, String) {
self.saved
.as_ref()
.filter(|s| s.email.eq_ignore_ascii_case(email.trim()))
.map(|s| (s.device_id.clone(), s.otp_token.clone()))
.unwrap_or_default()
}
fn accept(&mut self, secrets: &dyn Secrets, login: Login, email: String) {
self.identity_failed = login.identity.is_err();
let (renewal_token, device_id, otp_token) = login
.renewal
.map(|renewal| (renewal.token, renewal.device_id, renewal.otp_token))
.unwrap_or_default();
let saved = Saved {
session: login.token.into_inner(),
email,
username: login.username,
uuid: login.uuid,
renewal_token,
device_id,
otp_token,
identity: login.identity.ok(),
};
self.persistence_status = if save(secrets, &saved) {
0
} else {
// Remove an older credential after a replacement failed. Do not
// silently sign back into the previous account on next startup.
let cleared = secrets.delete(KEY).is_ok();
if cleared { 5 } else { 6 }
};
self.status = 0;
self.saved = Some(saved);
self.restored();
}
fn revocation_failed(&mut self, generation: u64) {
if self.generation == generation && !self.signed_in && !self.busy && !self.can_forget {
self.status = 9;
}
}
fn form(&self) -> MytsForm {
let identity = self.identity();
MytsForm {
available: true,
prompt: self.prompt,
signed_in: self.signed_in,
email: self.saved.as_ref().map(|s| s.email.as_str()).unwrap_or_default().into(),
username: self.saved.as_ref().map(|s| s.username.as_str()).unwrap_or_default().into(),
uuid: self.saved.as_ref().map(|s| s.uuid.as_str()).unwrap_or_default().into(),
myts_id: identity.map(ServerIdentity::id).unwrap_or_default().into(),
identity_status: if !self.signed_in {
0
} else if identity.is_some() {
1
} else if self.identity_failed {
3
} else {
2
},
status: self.status,
persistence_status: self.persistence_status,
busy: self.busy,
otp_required: self.otp_required,
can_forget: self.can_forget || self.saved.is_some(),
}
}
fn identity(&self) -> Option<&ServerIdentity> {
self.saved.as_ref().filter(|_| self.signed_in).and_then(|s| s.identity.as_ref())
}
fn begin(&mut self) -> Option<u64> {
if self.busy {
return None;
}
self.generation += 1;
self.busy = true;
self.status = 0;
Some(self.generation)
}
fn finish(&mut self, generation: u64) -> bool {
if self.generation != generation {
return false;
}
self.busy = false;
true
}
fn forget(&mut self, secrets: &dyn Secrets) -> bool {
self.generation += 1;
self.busy = false;
self.signed_in = false;
self.prompt = true;
self.saved = None;
self.identity_failed = false;
self.otp_required = false;
let cleared = secrets.delete(KEY).is_ok();
self.persistence_status = if cleared { 0 } else { 8 };
self.can_forget = !cleared;
cleared
}
}
fn login_error_status(error: &voelin_myts::Error) -> i32 {
match error.status_code() {
Some(208) => 3,
Some(209) => 14,
Some(203) => 13,
Some(202) => 16,
Some(103 | 206 | 207) => 15,
_ if matches!(error, voelin_myts::Error::Http(429)) => 17,
_ => 4,
}
}
// Fixed official routes only. Neither the session nor an email goes in a URL.
fn portal_url(action: i32) -> Option<&'static str> {
match action {
0 => Some("https://www.myteamspeak.com/register"),
1 => Some("https://www.myteamspeak.com/forgot-password"),
2 => Some("https://www.myteamspeak.com/my-account"),
3 => Some("https://www.myteamspeak.com/resend-activation"),
4 => Some("https://www.myteamspeak.com/my-account/change-username"),
5 => Some("https://www.myteamspeak.com/my-account/change-email"),
6 => Some("https://www.myteamspeak.com/my-account/change-password"),
7 => Some("https://www.myteamspeak.com/my-account/change-2fa"),
8 => Some("https://www.myteamspeak.com/my-account/manage-account"),
9 => Some("https://www.myteamspeak.com/my-account/manage-data"),
_ => None,
}
}
fn read_saved(secrets: &dyn Secrets) -> Result<Option<Saved>, ()> {
secrets
.get(KEY)
.map_err(|_| ())?
.map(|value| {
let saved: Saved = serde_json::from_str(&value).map_err(|_| ())?;
SessionToken::new(saved.session.clone()).map_err(|_| ())?;
Ok(saved)
})
.transpose()
}
fn save(secrets: &dyn Secrets, saved: &Saved) -> bool {
serde_json::to_string(saved).ok().is_some_and(|value| secrets.set(KEY, &value).is_ok())
}
impl App {
fn publish_myts_identity(&self) {
self.engine.send(voelin_core::Command::SetMytsIdentity(
self.myts.identity().cloned().map(Arc::new),
));
}
pub(crate) fn refresh_myts(&self) {
let Some(ui) = self.ui.upgrade() else {
return;
};
ui.global::<Bridge>().set_myts(self.myts.form());
}
pub(crate) fn start_myts(&mut self) {
if self.myts.started {
return;
}
self.myts.started = true;
if self.demo_ui {
self.refresh_myts();
return;
}
self.myts.prompt = true;
self.myts_retry();
}
pub(crate) fn myts_dismiss(&mut self) {
self.myts.prompt = false;
self.refresh_myts();
}
pub(crate) fn myts_portal(&mut self, action: i32) {
let Some(url) = portal_url(action).filter(|_| !self.myts.busy) else {
return;
};
let opened = crate::app::open_target(std::ffi::OsStr::new(url)).is_ok();
self.myts.status = if opened { 11 } else { 10 };
self.refresh_myts();
}
pub(crate) fn myts_retry(&mut self) {
if self.demo_ui || self.myts.busy {
return;
}
if self.myts.saved.is_none() {
self.myts.load(self.secrets.as_ref());
}
let Some(saved) = self.myts.saved.as_ref() else {
self.refresh_myts();
return;
};
let token = SessionToken::new(saved.session.clone()).expect("validated stored token");
let generation = self.myts.begin().expect("startup is idle");
self.refresh_myts();
self.runtime.spawn(async move {
// Password login does not provide the separate auth token required
// by loginWithRenewalToken. Expiry requires a fresh password login.
let result = async { Client::new()?.validate_session(&token).await }.await;
later(move |app| {
if !app.myts.finish(generation) {
return;
}
let was_signed_in = app.myts.signed_in;
match result {
Ok(()) => app.myts.restored(),
Err(error) => {
app.myts.otp_required =
error.is_otp_required() || error.status_code() == Some(209);
app.myts.status = 2;
if error.is_invalid_session() {
app.myts.signed_in = false;
app.myts.status = 15;
}
}
}
if was_signed_in != app.myts.signed_in {
app.publish_myts_identity();
}
app.refresh_myts();
});
});
}
pub(crate) fn myts_login(&mut self, email: String, password: String, otp: String) {
// The sample screens of VOELIN_DEMO_UI sign in nowhere.
if self.demo_ui || email.trim().is_empty() || password.is_empty() || self.myts.signed_in {
return;
}
let (device, otp_renewal) = self.myts.device_for(&email);
let Some(generation) = self.myts.begin() else {
return;
};
self.refresh_myts();
self.runtime.spawn(async move {
let result = async {
Client::new()?
.login_with_otp_renewal(
email.trim(),
&password,
(!otp.is_empty()).then_some(otp.as_str()),
&device,
&otp_renewal,
)
.await
}
.await;
later(move |app| {
if !app.myts.finish(generation) {
app.discard_myts_login(result.ok());
return;
}
match result {
Ok(login) => {
app.myts.accept(app.secrets.as_ref(), login, email.trim().to_owned());
app.publish_myts_identity();
}
Err(error) => {
app.myts.otp_required =
error.is_otp_required() || error.status_code() == Some(209);
app.myts.status = login_error_status(&error);
}
}
app.refresh_myts();
});
});
}
// A canceled login can still have created a remote session. Revoke it,
// never publish or save it after a sign-out/replacement.
fn discard_myts_login(&self, login: Option<Login>) {
if let Some(login) = login {
let generation =
(!self.myts.busy && !self.myts.signed_in).then_some(self.myts.generation);
self.runtime.spawn(async move {
let result = async { Client::new()?.logout(&login.token).await }.await;
if result.is_err() {
// Static diagnostic: no credential, account, response body or URL.
tracing::warn!("canceled account sign-in session could not be revoked");
later(move |app| {
if let Some(generation) = generation {
app.myts.revocation_failed(generation);
}
app.refresh_myts();
});
}
});
}
}
pub(crate) fn myts_logout(&mut self) {
// Nor do they sign out: no session, keyring or engine account to clear.
if self.demo_ui {
return;
}
let token =
self.myts.saved.as_ref().and_then(|s| SessionToken::new(s.session.clone()).ok());
let cleared = self.myts.forget(self.secrets.as_ref());
self.publish_myts_identity();
self.myts.status = if cleared { 7 } else { 0 };
if let Some(token) = token {
let generation = self.myts.generation;
self.myts.busy = true;
self.runtime.spawn(async move {
let result = async { Client::new()?.logout(&token).await }.await;
later(move |app| {
if !app.myts.finish(generation) {
return;
}
if result.is_err() && cleared {
app.myts.status = 9;
}
app.refresh_myts();
});
});
}
self.refresh_myts();
}
}
#[cfg(test)]
mod tests {
use super::*;
use voelin_store::MemorySecrets;
fn login(name: &str) -> Login {
Login {
token: SessionToken::new(format!("{name}-session")).unwrap(),
uuid: format!("{name}-uuid"),
username: name.into(),
identity: Ok(server_identity()),
renewal: Some(voelin_myts::Renewal {
token: format!("{name}-renewal"),
otp_token: format!("{name}-otp"),
device_id: format!("{name}-device"),
}),
}
}
fn server_identity() -> ServerIdentity {
let mut private = [0; 32];
private[0] = 1;
let mut public = [0x66; 32];
public[0] = 0x58; // Compressed Ed25519 basepoint for scalar one.
ServerIdentity::new(vec![1; 33], 1, public, private, vec![2; 65]).unwrap()
}
#[test]
fn primary_account_persists_restores_after_validation_and_signout_returns_to_login() {
let secrets = MemorySecrets::default();
let mut account = Account { prompt: true, ..Default::default() };
account.load(&secrets);
assert!(account.form().prompt);
assert!(!account.form().signed_in);
account.accept(&secrets, login("Alice"), "alice@example.test".into());
assert!(!account.form().prompt);
assert!(account.form().signed_in);
assert_eq!(account.form().identity_status, 1);
assert!(account.identity().is_some());
assert_eq!(account.form().uuid, "Alice-uuid");
let mut restarted = Account { prompt: true, ..Default::default() };
restarted.load(&secrets);
assert!(restarted.identity().is_none(), "unvalidated cache cannot authenticate servers");
assert!(!restarted.form().signed_in, "cached profile is not validated yet");
let generation = restarted.begin().unwrap();
assert!(restarted.finish(generation));
restarted.restored();
assert!(restarted.identity().is_some());
assert!(!restarted.form().prompt);
assert_eq!(restarted.form().username, "Alice");
assert!(restarted.forget(&secrets));
assert!(restarted.form().prompt);
assert_eq!(restarted.form().username, "");
assert_eq!(restarted.form().uuid, "");
assert!(!restarted.form().signed_in);
assert!(restarted.identity().is_none());
assert_eq!(restarted.form().myts_id, "");
}
#[test]
fn switching_primary_account_never_reuses_another_accounts_device_material() {
let secrets = MemorySecrets::default();
let mut account = Account::default();
account.accept(&secrets, login("Alice"), "alice@example.test".into());
assert_eq!(
account.device_for(" ALICE@example.test "),
("Alice-device".into(), "Alice-otp".into())
);
assert_eq!(account.device_for("bob@example.test"), Default::default());
account.forget(&secrets);
assert_eq!(account.device_for("alice@example.test"), Default::default());
let mut bob = login("Bob");
bob.renewal = None;
account.accept(&secrets, bob, "bob@example.test".into());
let saved = read_saved(&secrets).unwrap().unwrap();
assert_eq!(saved.uuid, "Bob-uuid");
assert_eq!(saved.email, "bob@example.test");
assert!(saved.renewal_token.is_empty());
assert!(saved.otp_token.is_empty());
assert!(saved.device_id.is_empty());
}
#[test]
fn missing_server_key_keeps_login_but_never_reuses_previous_identity() {
let secrets = MemorySecrets::default();
let mut account = Account::default();
account.accept(&secrets, login("Alice"), "alice@example.test".into());
assert!(account.identity().is_some());
account.forget(&secrets);
let mut bob = login("Bob");
bob.identity = Err(voelin_myts::IdentityError::Missing);
account.accept(&secrets, bob, "bob@example.test".into());
assert!(account.signed_in);
assert!(account.identity().is_none());
assert_eq!(account.form().identity_status, 3);
assert!(account.form().myts_id.is_empty());
assert!(read_saved(&secrets).unwrap().unwrap().identity.is_none());
}
#[test]
fn corrupted_persisted_private_identity_cannot_be_restored() {
let secrets = MemorySecrets::default();
let mut account = Account::default();
account.accept(&secrets, login("Alice"), "alice@example.test".into());
let mut value: serde_json::Value =
serde_json::from_str(&secrets.get(KEY).unwrap().unwrap()).unwrap();
value["identity"]["private_key"] = serde_json::json!(vec![0u8; 32]);
secrets.set(KEY, &value.to_string()).unwrap();
assert!(read_saved(&secrets).is_err());
let mut restored = Account::default();
restored.load(&secrets);
assert!(restored.identity().is_none());
assert_eq!(restored.form().persistence_status, 1);
}
#[test]
fn keyring_retry_and_legacy_bundle_do_not_claim_a_validated_account() {
let secrets = MemorySecrets::default();
secrets.set(KEY, r#"{"session":"legacy","email":"a@example.test","username":"A","renewal_token":"r","device_id":"d"}"#).unwrap();
let mut account = Account { prompt: true, ..Default::default() };
account.load(&Unavailable);
assert_eq!(account.form().persistence_status, 1);
account.load(&secrets);
assert_eq!(account.status, 0);
assert_eq!(account.form().persistence_status, 0);
assert!(!account.can_forget);
assert!(!account.signed_in);
assert!(account.prompt);
assert_eq!(account.form().uuid, "");
account.restored();
assert_eq!(account.form().identity_status, 2);
assert!(account.identity().is_none());
assert_eq!(account.saved.unwrap().otp_token, "");
}
#[test]
fn login_survives_keyring_failure_with_visible_session_only_status() {
let mut account = Account { prompt: true, ..Default::default() };
account.accept(&Unavailable, login("Alice"), "alice@example.test".into());
assert!(account.signed_in);
assert!(!account.prompt);
assert_eq!(account.form().persistence_status, 6);
assert!(account.form().can_forget);
assert_eq!(account.form().username, "Alice");
let generation = account.begin().unwrap();
assert!(account.finish(generation));
account.restored();
assert_eq!(
account.form().persistence_status,
6,
"validation must not hide failed persistence"
);
account.status = 11;
assert_eq!(
account.form().persistence_status,
6,
"opening management must retain the warning"
);
account.forget(&Unavailable);
account.status = 11;
assert_eq!(
account.form().persistence_status,
8,
"failed deletion must remain visible after browser launch"
);
account.forget(&MemorySecrets::default());
assert_eq!(account.form().persistence_status, 0);
}
#[test]
fn portal_actions_are_fixed_official_https_destinations() {
for action in 0..10 {
let url = portal_url(action).unwrap();
assert!(url.starts_with("https://www.myteamspeak.com/"));
assert!(!url.contains(['?', '#', '@']));
}
assert!(portal_url(-1).is_none());
assert!(portal_url(10).is_none());
assert_eq!(portal_url(1), Some("https://www.myteamspeak.com/forgot-password"));
assert_eq!(login_error_status(&voelin_myts::Error::Http(429)), 17);
assert_eq!(login_error_status(&voelin_myts::Error::Timeout), 4);
}
#[test]
fn failed_late_session_revocation_reports_signed_out_without_overwriting_new_login() {
let mut account = Account::default();
let old = account.begin().unwrap();
account.forget(&MemorySecrets::default());
assert!(!account.finish(old));
let signed_out = account.generation;
account.revocation_failed(signed_out);
assert_eq!(account.status, 9);
let new = account.begin().unwrap();
account.revocation_failed(signed_out);
account.revocation_failed(new);
assert_eq!(account.status, 0);
assert!(account.busy);
account.finish(new);
account.signed_in = true;
account.revocation_failed(new);
assert_eq!(account.status, 0);
}
#[test]
fn form_exposes_signed_out_busy_otp_and_signed_in_states_without_tokens() {
let mut account = Account::default();
assert!(account.form().available);
assert!(!account.form().signed_in);
assert!(!account.form().can_forget);
let generation = account.begin().unwrap();
assert!(account.form().busy);
account.finish(generation);
account.otp_required = true;
account.status = 3;
assert!(account.form().otp_required);
assert_eq!(account.form().status, 3);
account.saved = Some(Saved {
session: "secret session".into(),
email: "a@example.test".into(),
username: "Name".into(),
..Default::default()
});
account.signed_in = true;
account.otp_required = false;
let form = account.form();
assert!(form.signed_in);
assert!(form.can_forget);
assert_eq!(form.username, "Name");
assert_eq!(form.email, "a@example.test");
assert!(!form.otp_required);
}
#[test]
fn persistence_roundtrip_and_logout_delete_all_material() {
let secrets = MemorySecrets::default();
let saved = Saved {
session: "session".into(),
email: "email".into(),
renewal_token: "renewal".into(),
device_id: "device".into(),
username: "name".into(),
otp_token: "otp renewal".into(),
uuid: "account-uuid".into(),
identity: Some(server_identity()),
};
assert!(save(&secrets, &saved));
let loaded = read_saved(&secrets).unwrap().unwrap();
assert_eq!(loaded.session, "session");
assert_eq!(loaded.renewal_token, "renewal");
assert_eq!(loaded.email, "email");
assert_eq!(loaded.identity.unwrap().id(), server_identity().id());
let loaded = read_saved(&secrets).unwrap().unwrap();
let mut account = Account { saved: Some(loaded), signed_in: true, ..Default::default() };
assert!(account.forget(&secrets));
assert!(read_saved(&secrets).unwrap().is_none());
assert!(!account.signed_in);
}
#[test]
fn single_operation_and_logout_prevent_stale_resurrection() {
let mut account = Account::default();
let generation = account.begin().unwrap();
assert!(account.begin().is_none());
account.forget(&MemorySecrets::default());
assert!(!account.finish(generation));
let replacement = account.begin().unwrap();
assert!(!account.finish(generation));
assert!(account.busy);
assert!(account.finish(replacement));
}
struct Unavailable;
impl Secrets for Unavailable {
fn get(&self, _: &str) -> voelin_store::Result<Option<String>> {
Err(voelin_store::Error::Secrets("locked".into()))
}
fn set(&self, _: &str, _: &str) -> voelin_store::Result<()> {
Err(voelin_store::Error::Secrets("locked".into()))
}
fn delete(&self, _: &str) -> voelin_store::Result<()> {
Err(voelin_store::Error::Secrets("locked".into()))
}
}
#[test]
fn keyring_failure_is_visible_and_logout_still_clears_memory() {
assert!(read_saved(&Unavailable).is_err());
assert!(!save(&Unavailable, &Saved::default()));
let mut account =
Account { saved: Some(Saved::default()), signed_in: true, ..Default::default() };
assert!(!account.forget(&Unavailable));
assert!(account.saved.is_none());
assert!(!account.signed_in);
assert!(account.can_forget);
}
#[test]
fn malformed_or_empty_session_is_not_used() {
let secrets = MemorySecrets::default();
secrets.set(KEY, "broken").unwrap();
assert!(read_saved(&secrets).is_err());
assert!(save(&secrets, &Saved::default()));
assert!(read_saved(&secrets).is_err());
}
}
+9
View File
@@ -120,6 +120,15 @@ impl App {
return;
}
let mut options = VoiceOptions::new(&b.address, &b.nickname);
if let Some(spec) = &b.client_version {
match voelin_core::versions::resolve(spec) {
Ok(version) => options.client_version = version,
Err(error) => {
self.set_status(format!("Invalid client compatibility version: {error}"));
return;
}
}
}
options.identity = Some(self.identity_for(Some(b.id)));
options.server_password = self.secrets.get(&b.server_password_key()).ok().flatten();
options.channel = channel;
+23 -16
View File
@@ -9,6 +9,7 @@ import "assets/fonts/Inter-Bold.ttf";
import "assets/fonts/Inter-Italic.ttf";
import { Palette } from "std-widgets.slint";
import { LoginPage } from "screens/account.slint";
import { Theme } from "theme.slint";
import { Icons } from "icons.slint";
import { Bridge } from "bridge.slint";
@@ -112,7 +113,7 @@ export component MainWindow inherits Window {
keys := FocusScope {
// Ctrl+K: search.
capture-key-pressed(event) => {
if event.modifiers.control && (event.text == "k" || event.text == "K") && root.chrome {
if event.modifiers.control && (event.text == "k" || event.text == "K") && root.chrome && !Bridge.myts.prompt {
Nav.open-search("");
return accept;
}
@@ -125,9 +126,11 @@ export component MainWindow inherits Window {
padding-right: root.safe-area-insets.right;
padding-bottom: max(root.safe-area-insets.bottom, root.keyboard-inset);
if !root.chrome: StreamViewer { }
if Bridge.myts.prompt: LoginPage { }
if !Nav.narrow && root.chrome: DesktopShell {
if !Bridge.myts.prompt && !root.chrome: StreamViewer { }
if !Bridge.myts.prompt && !Nav.narrow && root.chrome: DesktopShell {
context: Nav.page == Page.settings ? @tr("Settings") : Nav.page == Page.studio ? @tr("Stream Studio") : "";
if Nav.page == Page.home: Sidebar {
HomeNav { }
@@ -213,7 +216,7 @@ export component MainWindow inherits Window {
}
}
if Nav.narrow && root.chrome: MobileShell {
if !Bridge.myts.prompt && Nav.narrow && root.chrome: MobileShell {
property <bool> channel-chat: Nav.page == Page.server && !Nav.phone-voice
&& Nav.mobile-tab == MobileTab.chat && !Bridge.viewer-open
&& Bridge.current-tab >= 0 && Bridge.current-tab < Bridge.tabs.length
@@ -288,11 +291,15 @@ export component MainWindow inherits Window {
x: (parent.width - self.width) / 2;
y: parent.height - self.height - (Nav.narrow ? 140px : 96px);
text: Bridge.status-text;
visible: self.shown && !Bridge.myts.prompt;
// A notice from the start (an imported identity) waits for the
// account prompt to close.
paused: Bridge.myts.prompt;
widest: min(560px, parent.width - 32px);
}
// The member card of the members panel, over everything.
if Bridge.member-card.open: Rectangle {
if !Bridge.myts.prompt && (Bridge.member-card.open): Rectangle {
TouchArea {
clicked => { Bridge.open-member(-1); }
}
@@ -302,7 +309,7 @@ export component MainWindow inherits Window {
}
}
if Nav.emoji-open: Rectangle {
if !Bridge.myts.prompt && (Nav.emoji-open): Rectangle {
// Clicks outside the picker close it.
TouchArea {
clicked => { Nav.emoji-open = false; }
@@ -328,7 +335,7 @@ export component MainWindow inherits Window {
}
// The bell's panel, under the bell (the phone: the whole width).
if Nav.notifications-open: Rectangle {
if !Bridge.myts.prompt && (Nav.notifications-open): Rectangle {
TouchArea {
clicked => { Nav.notifications-open = false; }
}
@@ -340,39 +347,39 @@ export component MainWindow inherits Window {
}
}
if Nav.search-open: SearchPalette { }
if !Bridge.myts.prompt && (Nav.search-open): SearchPalette { }
if Nav.lightbox-open: Lightbox { }
if !Bridge.myts.prompt && (Nav.lightbox-open): Lightbox { }
if Nav.event-form-open: EventDialog {
if !Bridge.myts.prompt && (Nav.event-form-open): EventDialog {
form <=> Nav.event-form;
done => { Nav.event-form-open = false; }
}
if Nav.offline-form-open: OfflineDialog {
if !Bridge.myts.prompt && (Nav.offline-form-open): OfflineDialog {
done => { Nav.offline-form-open = false; }
}
if Nav.topic-form-open: TopicDialog {
if !Bridge.myts.prompt && (Nav.topic-form-open): TopicDialog {
done => { Nav.topic-form-open = false; }
}
if Nav.bookmark-open: BookmarkDialog {
if !Bridge.myts.prompt && (Nav.bookmark-open): BookmarkDialog {
form <=> Nav.bookmark-form;
join: Nav.join-open;
done => { Nav.bookmark-open = false; }
}
if Nav.share-open: ShareDialog {
if !Bridge.myts.prompt && (Nav.share-open): ShareDialog {
form <=> Nav.share-form;
done => { Nav.share-open = false; }
}
if Nav.client-open: ClientAudioDialog {
if !Bridge.myts.prompt && (Nav.client-open): ClientAudioDialog {
done => { Nav.client-open = false; }
}
if Nav.about-open: AboutDialog {
if !Bridge.myts.prompt && (Nav.about-open): AboutDialog {
done => { Nav.about-open = false; }
}
}
+23
View File
@@ -767,6 +767,22 @@ export struct AdvancedForm {
}
// Who we are (My Account page).
export struct MytsForm {
prompt: bool,
uuid: string,
myts-id: string,
identity-status: int,
available: bool,
signed_in: bool,
email: string,
username: string,
status: int,
persistence-status: int,
busy: bool,
otp_required: bool,
can_forget: bool,
}
export struct AccountForm {
nickname: string,
identity: string,
@@ -1092,6 +1108,13 @@ export global Bridge {
// Settings pages: a section was shown (its data is loaded then).
callback settings-section(int);
in property <AccountForm> account;
in property <MytsForm> myts;
in property <string> primary-name: myts.signed-in ? (myts.username != "" ? myts.username : myts.email) : nickname != "" ? nickname : app-name;
callback myts-dismiss();
callback myts-retry();
callback myts-portal(int);
callback myts-login(string, string, string);
callback myts-logout();
in property <[IdentityItem]> identities;
in property <[string]> identity-names;
in property <[BookmarkIdentity]> bookmark-identities;
+3 -1
View File
@@ -234,6 +234,8 @@ export component Toast inherits Rectangle {
in property <image> icon: Icons.info;
in property <duration> timeout: 5s;
in-out property <bool> shown;
// Hidden for now (under the account prompt): the time to read starts later.
in property <bool> paused;
// The widest it gets (e.g. the window less a margin); longer text wraps.
in property <length> widest: 560px;
height: shown ? row.preferred-height + 16px : 0px;
@@ -248,7 +250,7 @@ export component Toast inherits Rectangle {
accessible-live-region: polite;
Timer {
interval: root.timeout;
running: root.shown;
running: root.shown && !root.paused;
triggered => { root.shown = false; }
}
TouchArea {
+206
View File
@@ -0,0 +1,206 @@
// Shared account form for first launch and Settings → My Account.
import { Theme } from "../theme.slint";
import { Icons } from "../icons.slint";
import { Bridge } from "../bridge.slint";
import { Button, TextField, Field, Card, ScrollView } from "../components/index.slint";
component Note inherits Text {
// Keep wrapped account copy in the card’s layout bounds.
min-height: self.preferred-height;
color: Theme.text-secondary;
font-size: Theme.font-sm;
wrap: word-wrap;
}
component LoginForm inherits VerticalLayout {
spacing: Theme.space-3;
property <string> otp-text;
function submit() {
// The one-time code is asked for, never required to submit: another
// account needs none, and without it a 2FA account is asked again.
if !Bridge.myts.busy && email.text != "" && password.text != "" {
Bridge.myts-login(email.text, password.text, otp-text);
password.clear();
otp-text = "";
}
}
Field {
label: @tr("Email");
email := TextField {
text: Bridge.myts.email;
placeholder: @tr("Email");
enabled: !Bridge.myts.busy;
accepted(_) => { root.submit(); }
}
}
Field {
label: @tr("Password");
password := TextField {
placeholder: @tr("Password");
input-type: InputType.password;
enabled: !Bridge.myts.busy;
accepted(_) => { root.submit(); }
}
}
if Bridge.myts.otp-required: Field {
label: @tr("One-time code");
TextField {
text <=> root.otp-text;
placeholder: @tr("One-time code");
input-type: InputType.password;
enabled: !Bridge.myts.busy;
accepted(_) => { root.submit(); }
}
}
Button {
text: @tr("Sign in");
enabled: !Bridge.myts.busy && email.text != "" && password.text != "";
clicked => { root.submit(); }
}
Button {
text: @tr("Create account in browser");
enabled: !Bridge.myts.busy;
clicked => { Bridge.myts-portal(0); }
}
Button {
text: @tr("Forgot password?");
enabled: !Bridge.myts.busy;
clicked => { Bridge.myts-portal(1); }
}
Note { text: @tr("Registration and password recovery open the official myTeamSpeak website. Return here to sign in when finished."); }
}
export component AccountCard inherits Card {
title: @tr("myTeamSpeak");
icon: Icons.user;
property <string> account-status: Bridge.myts.status == 2 ? @tr("Saved session could not be validated. Your saved credentials were retained; sign in again or clear them.") :
Bridge.myts.status == 3 ? @tr("Enter your password again and the one-time code.") :
Bridge.myts.status == 4 ? @tr("Sign-in failed. Check your credentials and connection; the experimental service may be unavailable.") :
Bridge.myts.status == 7 ? @tr("Signed out.") :
Bridge.myts.status == 9 ? @tr("Signed out and saved credentials cleared. Remote session revocation failed.") :
Bridge.myts.status == 10 ? @tr("Could not open your browser. Visit myteamspeak.com to manage your account.") :
Bridge.myts.status == 11 ? @tr("Account website opened in your browser. When finished, return here and sign in again to apply changes.") :
Bridge.myts.status == 13 ? @tr("Your email address has not been verified. Activate your account using the link in your email, or request a new activation email.") :
Bridge.myts.status == 14 ? @tr("The one-time code was not accepted. Enter your password and a new code.") :
Bridge.myts.status == 15 ? @tr("Your saved session has expired. Sign in again.") :
Bridge.myts.status == 16 ? @tr("Email or password was not accepted. Check your details and try again.") :
Bridge.myts.status == 17 ? @tr("Too many requests. Wait a while before trying again.") : "";
if !Bridge.myts.available: Note { text: @tr("Account sign-in is available on desktop."); }
if Bridge.myts.available && !Bridge.myts.signed-in: LoginForm { }
if Bridge.myts.signed-in: VerticalLayout {
spacing: Theme.space-3;
Note { text: @tr("Primary account"); }
Text {
text: Bridge.primary-name;
color: Theme.text;
font-size: Theme.font-lg;
font-weight: Theme.weight-semibold;
wrap: word-wrap;
}
Note { text: Bridge.myts.email; }
if Bridge.myts.uuid != "": Field {
label: @tr("Account ID");
TextField {
text: Bridge.myts.uuid;
read-only: true;
label: @tr("Account ID");
}
}
if Bridge.myts.myts-id != "": Field {
label: @tr("myTS ID");
TextField {
text: Bridge.myts.myts-id;
read-only: true;
label: @tr("myTS ID");
}
}
if Bridge.myts.identity-status == 1: Note {
text: @tr("Your account identity is available for authentication on voice servers.");
}
if Bridge.myts.identity-status == 2: Note {
text: @tr("Sign out and sign in with your password to enable your myTS ID on voice servers.");
}
if Bridge.myts.identity-status == 3: Note {
text: @tr("Signed in, but the account identity could not be unlocked. Voice servers will not receive your myTS ID. Try signing in again; older account encryption may be unsupported.");
}
Note { text: @tr("This is your main app profile. Server identities and server nicknames are managed separately."); }
Note { text: @tr("Account management opens the official website. Check which account is signed in there. Sign in again here after making changes."); }
Button {
text: @tr("Manage account in browser");
enabled: !Bridge.myts.busy;
clicked => { Bridge.myts-portal(2); }
}
for action in [
{ text: @tr("Change username"), portal: 4 },
{ text: @tr("Change email"), portal: 5 },
{ text: @tr("Change password"), portal: 6 },
{ text: @tr("Two-factor authentication"), portal: 7 },
{ text: @tr("Manage account deletion"), portal: 8 },
{ text: @tr("Export account data"), portal: 9 },
]: Button {
text: action.text;
small: true;
enabled: !Bridge.myts.busy;
clicked => { Bridge.myts-portal(action.portal); }
}
}
if Bridge.myts.busy: Note { text: @tr("Contacting account service…"); }
if root.account-status != "": Note { text: root.account-status; }
if Bridge.myts.persistence-status == 1: Note {
text: @tr("Saved account credentials could not be read. Unlock the keyring or clear the saved session.");
}
if Bridge.myts.persistence-status == 5: Note {
text: @tr("Account credentials could not be saved. This session will not be restored after restarting.");
}
if Bridge.myts.persistence-status == 6: Note {
text: @tr("Account credentials could not be saved, and older credentials could not be removed. Unlock your keyring and clear the saved session.");
}
if Bridge.myts.persistence-status == 8: Note {
text: @tr("Signed out locally, but saved credentials could not be removed. Unlock your keyring and clear the saved session again.");
}
if Bridge.myts.status == 13: Button {
text: @tr("Resend activation email in browser");
enabled: !Bridge.myts.busy;
clicked => { Bridge.myts-portal(3); }
}
if Bridge.myts.can-forget && !Bridge.myts.busy: Button {
text: Bridge.myts.signed-in ? @tr("Check session") : @tr("Retry saved session");
clicked => { Bridge.myts-retry(); }
}
if Bridge.myts.can-forget || Bridge.myts.busy: Button {
text: Bridge.myts.busy ? @tr("Cancel and clear session") : Bridge.myts.signed-in ? @tr("Sign out") : @tr("Clear saved session");
clicked => { Bridge.myts-logout(); }
}
}
export component LoginPage inherits ScrollView {
VerticalLayout {
width: root.visible-width;
padding: Theme.space-4;
spacing: Theme.space-5;
alignment: start;
HorizontalLayout {
Rectangle { horizontal-stretch: 1; }
VerticalLayout {
max-width: 480px;
horizontal-stretch: 1;
spacing: Theme.space-4;
Text {
text: @tr("Welcome to {}", Bridge.app-name);
color: Theme.text;
font-size: Theme.font-xl;
font-weight: Theme.weight-semibold;
wrap: word-wrap;
}
Note { text: @tr("Sign in to make your myTeamSpeak account your main profile."); }
AccountCard { }
Button {
text: @tr("Continue without an account");
clicked => { Bridge.myts-dismiss(); }
}
Note { text: @tr("You can connect to servers without an account and sign in later in Settings → My Account."); }
}
Rectangle { horizontal-stretch: 1; }
}
}
}
+2 -1
View File
@@ -144,7 +144,8 @@ export component YouPage inherits ScrollView {
alignment: center;
horizontal-stretch: 1;
Text {
text: Bridge.nickname != "" ? Bridge.nickname : Bridge.app-name;
text: Bridge.primary-name;
overflow: elide;
color: Theme.text;
font-size: Theme.font-lg;
font-weight: Theme.weight-semibold;
@@ -3,6 +3,7 @@
// (encoding, SRTP, history, cache, logs, every setting); and the rows the
// sections share.
import { AccountCard } from "account.slint";
import { Theme } from "../theme.slint";
import { Icons } from "../icons.slint";
import { Bridge, IdentityItem, LayerItem, AudioSourceItem, ConfigItem, PermItem, SettingItem, EncoderItem } from "../bridge.slint";
@@ -168,6 +169,7 @@ component CopyField inherits Field {
export component AccountSection inherits VerticalLayout {
alignment: start;
spacing: Theme.space-5;
AccountCard { }
Card {
title: @tr("Identity in use");
icon: Icons.id-card;
@@ -219,21 +221,6 @@ export component AccountSection inherits VerticalLayout {
text: @tr("Servers know you by this id: your groups and permissions belong to it. Your nickname is set per server, in the server's bookmark.");
}
}
Card {
title: @tr("myTeamSpeak");
icon: Icons.info;
Hint {
text: @tr("{} does not sign in to myTeamSpeak, TeamSpeak's account service: it has no public API, and its terms do not allow using the private one. To use identities synchronised there, sign in once with the official client, then import them under Profiles: they are read from its settings, never written.", Bridge.app-name);
}
HorizontalLayout {
alignment: start;
Button {
icon: Icons.download;
text: @tr("Import identities");
clicked => { Nav.open-settings(SettingsSection.profiles); }
}
}
}
}
// Use as default, export, delete.
+1 -1
View File
@@ -1136,7 +1136,7 @@ export component SettingsPage inherits Rectangle {
: s == SettingsSection.keybinds ? @tr("How your voice goes out, and the keys for it.")
: s == SettingsSection.streaming ? @tr("Defaults of your streams, their layers and their sound.")
: s == SettingsSection.privacy ? @tr("Who can reach you, blocked people, what the app keeps.")
: s == SettingsSection.account ? @tr("Who servers see when you connect.")
: s == SettingsSection.account ? @tr("Your main account and server identity.")
: s == SettingsSection.profiles ? @tr("Your identities: each is a unique id on every server.")
: s == SettingsSection.devices ? @tr("Microphones, speakers, cameras and screens.")
: s == SettingsSection.notifications ? @tr("What the bell and the desktop tell you.")
+5 -5
View File
@@ -164,7 +164,7 @@ export component VoiceButtons inherits HorizontalLayout {
}
}
// Who we are on the current server, and the voice buttons.
// The primary app profile, with current server voice status and controls.
export component UserCard inherits Rectangle {
min-height: 60px;
border-radius: Theme.radius-lg;
@@ -179,10 +179,10 @@ export component UserCard inherits Rectangle {
alignment: center;
Avatar {
size: 38px;
initials: Bridge.nickname != "" ? "" : "?";
initials: Bridge.myts.signed-in || Bridge.nickname != "" ? "" : "?";
image: Bridge.own-avatar;
tint: Theme.accent;
label: Bridge.nickname;
label: Bridge.primary-name;
// Green ring while our voice goes out.
speaking: Bridge.transmitting;
status: Bridge.voice-connected ? Status.online : Bridge.observing ? Status.info : Status.offline;
@@ -190,7 +190,7 @@ export component UserCard inherits Rectangle {
source: Icons.user;
size: 20px;
tint: #ffffff;
visible: Bridge.nickname != "" && Bridge.own-avatar.width == 0;
visible: (Bridge.myts.signed-in || Bridge.nickname != "") && Bridge.own-avatar.width == 0;
}
}
}
@@ -198,7 +198,7 @@ export component UserCard inherits Rectangle {
alignment: center;
horizontal-stretch: 1;
Text {
text: Bridge.nickname != "" ? Bridge.nickname : Bridge.app-name;
text: Bridge.primary-name;
color: Theme.text;
font-weight: Theme.weight-semibold;
overflow: elide;
+10 -5
View File
@@ -1,9 +1,11 @@
# Translations
The UI is translated with Slint's gettext-based translations: strings in
The UI uses Slint's gettext-based translation markers: strings in
`.slint` files are marked with `@tr(...)`, extracted into a `.pot` template,
translated in `.po` files, and **compiled into the binary** (Slint's bundled
translations). Nothing is loaded at runtime, so there is no dependency on
translated in `.po` files, and can be **compiled into the binary** (Slint's bundled
translations). The repository currently has a `.pot` template but no `.po`
translations; bundled translations are not enabled yet. Nothing needs to be
loaded at runtime, so there is no dependency on
GNU gettext (LGPL) and it works the same on Linux, Windows and Android.
## Marking strings
@@ -68,7 +70,9 @@ MSYS2 or Git for Windows' bundled tools).
```sh
# 1. Extract the template after changing strings
slint-tr-extractor --package-name voelin-ui crates/voelin-ui/ui/*.slint -o crates/voelin-ui/lang/voelin-ui.pot
mkdir -p crates/voelin-ui/lang
rg --files crates/voelin-ui/ui -g '*.slint' | sort | \
xargs slint-tr-extractor --package-name voelin-ui -o crates/voelin-ui/lang/voelin-ui.pot
# 2. Update every translation (new strings empty, changed ones fuzzy)
for po in crates/voelin-ui/lang/*/LC_MESSAGES/voelin-ui.po; do
@@ -91,7 +95,8 @@ translatable yet.
## Bundling and language selection
`crates/voelin-ui/build.rs` compiles the translations into the binary:
Once the first `.po` translation exists, configure `crates/voelin-ui/build.rs`
to compile translations into the binary:
```rust
slint_build::compile_with_config(
+14 -4
View File
@@ -10,6 +10,12 @@ private key.**
Voelin can import identities from the official clients so that switching does
not mean starting over, and export them back so they are never trapped here.
The myTeamSpeak account has a separate signing identity. After password sign-in,
Voelin can authenticate its `myTS ID` on voice servers without replacing the
P-256 identity that owns server permissions. The primary account applies to all
voice connections and is cleared on sign-out. See
[the account protocol notes](research/myteamspeak.md#authenticated-account-identity-on-voice-servers).
## The unique ids
Both generations derive the unique id from `omega`, the base64 of the DER
@@ -232,10 +238,14 @@ the repository. Every fixture in the tests is generated by
and import that.
- **The other `ProtobufItems` item types.** Bookmarks, connection profiles and
server lists are not imported. Only identities are.
- **myTeamSpeak sign-in.** There is no public API and the terms forbid the
non-public ones, so identities synchronised only to a myTeamSpeak account and
not present locally cannot be fetched. Sign in with the official client once
so it writes them to `settings.db`, then import from there.
- **myTeamSpeak identity synchronisation.** Desktop My Account supports an
experimental account session, but does not fetch cloud identities or decrypt
account backups. Sign in with the official client once so it writes the
identities to `settings.db`, then import from there. See
[research/myteamspeak.md](research/myteamspeak.md) for the account client's
verification scope, session renewal, and cloud-sync limitations. The signed-in
account is the main app profile; server identities and bookmark nicknames are
independent.
- **Writing back to the official clients.** Voelin only reads them. Use the
`.ini` export and the client's own import.
- **Bringing the nickname's history along.** Only the key pair and the
+224 -11
View File
@@ -1,21 +1,234 @@
# myTeamSpeak
## Conclusion: out of scope
## Desktop account sessions
myTeamSpeak is TeamSpeak's account service: it holds the user's identities,
bookmarks and settings server-side so the official clients can synchronise
them. Voelin does **not** sign in to it.
them. Voelin opens a login page at desktop startup and makes the signed-in
myTeamSpeak account the main app profile. The same form lives in Settings →
My Account. Native login, OTP, saved-session validation and sign-out use
`voelin-myts`; registration, password recovery and account management open the
official website in the default browser.
There is no public API for it. The endpoints the official client uses are not
documented for third parties, and TeamSpeak's terms of service do not permit
using non-public ones. So there is nothing to implement here that could be
maintained, and nothing that would be allowed. This file exists so the question
is not re-researched.
This reverses the previous decision to leave account sign-in out of scope, at
the repository owner's request. The API remains non-public. This integration
does not establish permission to use or redistribute TeamSpeak's private API
or schemas.
What the user gets instead: sign in with the official client once, so that it
writes the synchronised identities into its local `settings.db`, then
`voelinctl identity import` reads them from there. See
[../identity.md](../identity.md).
Registration, activation-email resend, password recovery, username/email/password
changes, two-factor authentication, deletion and data export are available through
named browser actions. The website may be signed in to a different account;
Voelin does not transfer credentials to it. After completing a change, sign out
and back in to Voelin to refresh the profile.
Native cloud synchronization and recovery-key restoration are not implemented.
The app does not synchronize identities, bookmarks or settings, or create
account encryption and backup keys. Password login can decrypt an existing
version-2 account key to authenticate the account on voice servers (below).
To import cloud identities, sign in with the official client
so they are written to its local `settings.db`, then use the existing identity
import. See [../identity.md](../identity.md).
### Transport and verification boundary
The implementation consumes the message types, session status checks and wire
codec from the local `schema-api` snapshot in `third_party/schema-api`. Its
generated tonic gRPC clients are not used: the official clients use custom
protobuf-over-HTTP with `Content-Type: application/ts3cloud` at
`https://clientapi.myteamspeak.com`.
Requests contain a one-byte method-name length, the method name, and then the
protobuf payload. For login this is `05 6c 6f 67 69 6e` followed by `LoginData`.
Responses contain the protobuf alone. The live service labels these binary
responses `application/json`; decoding still uses protobuf and requires the
operation's explicit success status. Login uses `/authentication`; session
validation and deletion use `/session`.
`Client::login` accepts the user's password and derives the wire credential:
standard Base64 of PBKDF2-HMAC-SHA512 with 10,000 iterations, 48 output bytes,
and salt `ASCII_lowercase(email) + "ts3Login" + password`. The derivation runs
on Tokio's blocking pool. It reuses `base64` and `pbkdf2` already present in
the workspace dependency graph; no new cryptographic implementation is added.
These details replace the initial guessed header and raw-password handling.
On 2026-10-04, an owner-authorized live login, session validation, and logout
passed. Ordinary tests remain offline and use synthetic credentials. Live OTP
and expired-session renewal have not been verified.
Static evidence from the installed clients (ELF virtual addresses):
- TS3 request framing: `0x14a19dd`–`0x14a1a49`; password salt and iterations:
`0x1152b60`–`0x1152c24`; 48-byte derivation: `0x1154920`; SHA-512 selection:
`0x11e35af` and descriptor table `0x1b4a930`. Executable SHA-256:
`87c9b6927949d28c64e9da21fdf62bdf7a9e5b204597e9f75497ff6ee45be8ac`.
- TS6 request framing: `0x1dfd4e1`–`0x1dfd54c`; response decoding:
`0x1dfddcb`–`0x1dfde0b`. Executable SHA-256:
`9a32215a578a14525ec43f5e6f60aae087c0229c1b60487da235e3b3782cd40a`.
The renewal request has separate `renewal_token` and `auth_token` fields.
The official TS3 client requires both cached values before renewing
(`0x1143d81`–`0x1143dba`). Password login supplies no auth token, so an expired
password-login session requires fresh sign-in. The client API rejects missing
renewal credentials before making a request. It does not silently create the
separate shareable authentication token used by the official client's
sharing/import flow.
A saved OTP renewal token is used only with the same account's device ID in a
password login; an explicit one-time code takes precedence. Both are replaced
with the next successful response and cleared on sign-out. The installed TS6
serializer at `0x1cbed20`–`0x1cbefc1` independently confirms the email/password/OTP/
device/OTP-renewal fields. Live OTP and token rotation remain unverified.
Passwords and one-time codes are not persisted. Session and renewal material
are stored together as a single `myts/session` item through the app's secret
store, never in plaintext settings. Replacing one item prevents a partial write
from mixing credentials from different accounts. The bundle also stores the
account UUID, username and email, with backward-compatible defaults for older
bundles. Startup validates a saved session before showing its profile as signed
in. A valid session closes the login page; errors leave retry and manual sign-in
available. Transport failures retain saved credentials. A locked keyring can be
retried without restarting. Continue without an account dismisses the prompt
for the current run and leaves server features available.
Sign-out returns to login, clears local account material and attempts remote
session deletion; storage or remote errors are reported. A late completion
cannot sign a canceled operation back in. Server identities and bookmark
nicknames remain independent of the primary app profile.
### Authenticated account identity on voice servers
The account UUID is a profile identifier, not the authenticated `myTS ID`.
Password login unwraps the account's encrypted root key, then the account's
private signing scalar. The key pair is checked before it becomes usable.
The validated identity is stored with the session in the secret store; it is
not published to voice sessions until saved-session validation succeeds.
Older saved sessions need a fresh password sign-in to obtain this identity.
Missing, unsupported or invalid identity data leaves account login usable and
shows an explicit warning that voice servers will not receive a myTS ID.
The established version-2 format uses:
- PBKDF2-HMAC-SHA512, 10,000 iterations, 32 bytes, with salt
`ASCII_lowercase(email) + "ts3Encryption" + password`.
- Root wrapping: `02 || tag16 || nonce12 || ciphertext32`, AES-256-GCM
with empty associated data.
- Private-key wrapping: `iv16 || ciphertext32 || SHA512(plaintext32)`,
AES-256-CTR with a little-endian 128-bit counter. The digest and matching
public key must verify. Version-1 root wrapping is explicitly unsupported.
The existing transport's connection challenge is
`SHA256(30 08 00 00 00 00 || shared_iv64) || "MyTeamSpeakID"`.
Signing uses the raw account scalar, not Ed25519 seed expansion. The public
proof sends `myTeamspeakId`, `acTime`, `userPubKey`, `authSign`, `pubSign` and
`pubSignCert` on `clientinit`; the last two split `public_signature` at byte 64.
The HTTP response's numeric creation timestamp is byte-swapped once for the
voice protocol's decimal `acTime`. The provider public signature covers
`public_key32 || wire_acTime.to_le_bytes() || myTS_ID33`.
Neither the account UUID nor `mytsid_user_cert.cert` substitutes for these fields.
Private key material never belongs in a packet.
The main account is shared by all voice connections. Each new connection signs
its own challenge. Account changes cancel an unfinished handshake; connected
clients send `updatemytsid`, and logout sends an empty myTS ID. Rejected or
unanswered account updates disconnect rather than retaining a previous account
association. Cloud avatar retrieval is outside this branch.
Static TS3 evidence in the binary identified above: proof helper `0x1018580`,
`clientinit` invocation `0x1020c3b`, live update `0x1049659`, scalar signing
`0x1196800`, password KDF `0x1152cf0`, version-2 unwrap `0x11542d0`, GCM
layout `0x1155610`, and private-key integrity check `0x1153280`.
The login-to-storage timestamp swap is at `0x110b57c`; the server's public
signature payload is built at `0x1222da`–`0x12260d` in the pinned TS3 server.
Independent synthetic crypto vectors and malformed/tampered key tests cover
the local implementation. The ignored `voelin-core/tests/myts_live.rs` test
requires explicit account opt-in and caller-owned loopback servers; it checks
server-side identity association, clearing, reattachment, and fresh handshakes.
On 2026-10-04, owner-authorized live password login, authenticated key unwrap,
session validation and remote session deletion passed. Isolated official TS3
3.13.8 and TS6 6.0.0-beta13.1 servers each accepted two fresh signed handshakes,
reported the expected `client_myteamspeak_id`, and passed live clear/reattach
checks. Both reported the native Linux compatibility tuple and Voelin metadata.
The test servers needed a container-local DNS override to a working address
for `ts3services.teamspeak.com` before their official revocation-list downloads
succeeded; TLS and signature/revocation checks remained enabled. No server
override is part of the application.
Official-client visual inspection remains unverified: isolated TS3 3.6.2
crashed before showing its UI; isolated TS6 started but required account
confirmation before reaching the server view. No existing client profile was
changed. GUI checks of Voelin's account fields passed at desktop and narrow
sizes using synthetic account data.
### Client reporting
The voice engine chooses an unchanged signed compatibility tuple for the
actual operating system. A bookmark's explicit compatibility-version override
is honored and validated. `client_meta_data` identifies `Voelin`, its package
version and native OS. The CLI uses the same catalogue and native default.
TeamSpeak signs compatibility versions: replacing the signed version with an
arbitrary `Voelin` string is not supported. Metadata does not establish that
stock clients display Voelin in their standard version label.
An account change during an automatic transport reconnect cancels that voice
session to prevent stale credentials from being sent. Reconnect manually in
that case; ordinary connected account changes use the live update command.
The vendored crate has no declared license. Its provenance is recorded in
`third_party/schema-api/VOELIN-PATCH.md`; no license grant is inferred from its
presence. Runtime dependency notices are generated normally.
### Official account-management routes
Read-only inspection on 2026-10-04 verified these routes in the deployed
[main bundle](https://www.myteamspeak.com/main.a0429db5055b28c1.js) and
[account-management bundle](https://www.myteamspeak.com/933.0799f055321e36e9.js):
| Action | Official route |
| --- | --- |
| Registration | `https://www.myteamspeak.com/register` |
| Password recovery | `https://www.myteamspeak.com/forgot-password` |
| Activation email | `https://www.myteamspeak.com/resend-activation` |
| Account overview | `https://www.myteamspeak.com/my-account` |
| Username / email / password | `/my-account/change-username`, `/my-account/change-email`, `/my-account/change-password` |
| Two-factor authentication | `/my-account/change-2fa` |
| Deletion / data export | `/my-account/manage-account`, `/my-account/manage-data` |
The site's authentication guard preserves the requested destination. Its
[registration](https://www.myteamspeak.com/5.dcb40731983490af.js) and
[password recovery](https://www.myteamspeak.com/252.5c94d1e115160e7d.js) flows
use reCAPTCHA. Password changes rewrap encryption-key material, and deletion
requires a separate confirmation. Browser handoff retains those provider-owned
steps. Only fixed HTTPS URLs are passed as desktop-opener arguments; no shell,
email, password or token is included. Opening a page does not submit a change.
These are website-source findings, not a published native API guarantee.
### Local verification
```sh
cargo test -p voelin-myts
cargo test -p voelin-ui --lib myts::tests
cargo build -p voelin-myts -p voelin-ui
cargo clippy $(scripts/own-crates.sh) --all-targets --no-deps -- -D warnings
cargo fmt $(scripts/own-crates.sh) --check
scripts/notices.sh --check
```
The HTTP tests use loopback mock servers and synthetic credentials. UI tests
cover the secret-store bundle, failed reads/writes/deletes, form states,
concurrent operations, primary-account replacement, legacy-bundle migration,
remembered-device ownership and late completions after sign-out. Screenshot
fixtures use `VOELIN_DEMO_UI=1` and `VOELIN_OPEN=login`, `login:otp`,
`login:saved` or `login:account`; they never read the keyring. The formatting
command excludes vendored sources; `cargo fmt --all` also traverses local path
dependencies and reports upstream formatting differences. Clippy's `--no-deps`
also keeps diagnostics out of the existing vendored protocol crates.
The ignored `owner_live_login_validate_logout` test requires the owner to set
`VOELIN_MYTS_LIVE=1`, `VOELIN_MYTS_EMAIL`, `VOELIN_MYTS_PASSWORD`,
`VOELIN_MYTS_DEVICE_ID`, and optionally `VOELIN_MYTS_OTP`, then explicitly run
`cargo test -p voelin-myts owner_live_login_validate_logout -- --ignored`.
This test is not part of the offline verification commands above.
## The local record, structurally
+15 -3
View File
@@ -177,7 +177,7 @@ Settings sections (`settings:<section>`):
| Section | Holds |
|---|---|
| `account` | The identity in use (nickname, TeamSpeak 3 and 6 unique ids, security level) and why there is no myTeamSpeak sign-in |
| `account` | The identity in use (nickname, TeamSpeak 3 and 6 unique ids, security level); on desktop, the primary myTeamSpeak profile, login/OTP, session status, sign-out and official browser account-management actions |
| `profiles` (also `identities`) | Identities with where they came from: rename, use as default (the store's default, `Store::set_default_identity`), export as a TeamSpeak 3 .ini, delete, raise the security level on every core; the import of the official clients' identities on start (`identity.import_from_teamspeak`) and by hand from their settings and .ini files (key material is never shown); the identity per server |
| `appearance` | Theme, text size, the phone layout's width, the image cache |
| `voice` | Microphone (device, test, level, noise suppression, echo cancellation, automatic gain), output (device, test sound, volume), streaming permissions, camera (device, preview with the background effect), video settings (resolution, frame rate 15 to 320 fps, codec, hardware acceleration, mirror), stream quality presets (Auto, 720p to 8K) with free bitrate entry (slider up to 60 Mbit/s, empty: automatic) and the upload it takes |
@@ -189,8 +189,20 @@ Settings sections (`settings:<section>`):
| `integrations` | The gateways of our servers with their features, and their administration for admins (configuration keys, permission rules); FFmpeg, the video encoders and decoders, what works and why not |
| `advanced` | Encoder and decoder, hardware acceleration and decoding, SRTP profiles, chat history, cache, transfers, logs and crash reports, and every setting by its key as JSON |
Every control reads and writes `voelin_core::settings` and applies at
once; numbers are typed freely next to the presets.
Settings controls read and write `voelin_core::settings` and apply at once;
numbers are typed freely next to the presets.
Desktop startup shows the shared myTeamSpeak login page until a saved session
is validated, a login succeeds, or the user chooses Continue without an account.
The signed-in username/email becomes the primary app profile in the desktop
user card and mobile You page; it does not replace server identities or bookmark
nicknames. Settings → My Account reuses the form, supports retry/OTP/sign-out,
and opens official browser flows for registration, activation, recovery and
account management. Account and renewal material live only in the keyring;
passwords and one-time codes are cleared after submission. Expired sessions
require fresh sign-in because password login supplies no renewal auth token.
See [research/myteamspeak.md](research/myteamspeak.md) for protocol evidence
and remaining cloud-sync limitations.
## The Stream Studio
+4
View File
@@ -47,6 +47,10 @@ if grep -E "WARN|ERROR" "$tmp/log" >&2; then
exit 1
fi
cat about-assets.md >>"$tmp/$OUT"
# Some upstream license texts contain trailing spaces. Keep the generated
# Markdown clean without changing the words of those notices.
sed 's/[[:blank:]]*$//' "$tmp/$OUT" >"$tmp/normalized"
mv "$tmp/normalized" "$tmp/$OUT"
if $check; then
if ! diff -u "$OUT" "$tmp/$OUT" >"$tmp/diff"; then
+4 -3
View File
@@ -19,12 +19,13 @@ use tsproto_packets::packets::{Direction, Flags, OutCommand, PacketType};
use crate::{Action, ChatTarget, ConnectArgs, identity, tree, versions};
pub async fn run(args: ConnectArgs) -> Result<()> {
let version =
versions::resolve(&args.client_version)?.map_or_else(versions::native_version, Ok)?;
let mut options = Connection::build(args.address.clone())
.name(args.nick.clone())
.version(version)
.metadata(versions::client_metadata())
.log_commands(args.log_commands);
if let Some(version) = versions::resolve(&args.client_version)? {
options = options.version(version);
}
if let Some(path) = &args.identity {
options = options.identity(identity::load(path)?);
}
+2 -100
View File
@@ -1,101 +1,3 @@
//! Known signed client versions.
//!
//! `clientinit` must carry a `client_version_sign` produced by TeamSpeak's
//! private key, so a client can only claim versions from this list of captured
//! signatures (the `Versions.csv` declaration file).
//! Shared signed client versions and CLI argument resolution.
use anyhow::{Context, Result, bail};
use base64::prelude::*;
use tsclientlib::Version;
const VERSIONS_CSV: &str =
include_str!("../../../crates/proto/tsproto-structs/declarations/Versions.csv");
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct KnownVersion {
pub version: String,
pub platform: String,
pub signature: String,
}
impl KnownVersion {
pub fn to_version(&self) -> Result<Version> {
let signature = BASE64_STANDARD
.decode(&self.signature)
.with_context(|| format!("invalid signature for {}@{}", self.platform, self.version))?;
Ok(Version::Custom {
platform: self.platform.clone(),
version: self.version.clone(),
signature,
})
}
}
pub fn known_versions() -> Vec<KnownVersion> {
VERSIONS_CSV
.lines()
.skip(1)
.filter(|l| !l.trim().is_empty())
.filter_map(|l| {
// The version string contains no commas, the signature is base64.
let mut parts = l.splitn(3, ',');
Some(KnownVersion {
version: parts.next()?.to_string(),
platform: parts.next()?.to_string(),
signature: parts.next()?.trim().to_string(),
})
})
.collect()
}
/// Resolve a `--client-version` argument.
///
/// Accepts `default` (the library default), an index into [`known_versions`],
/// or `<platform>@<version>` with the exact strings from `voelinctl versions`.
pub fn resolve(spec: &str) -> Result<Option<Version>> {
if spec == "default" {
return Ok(None);
}
let versions = known_versions();
if let Ok(i) = spec.parse::<usize>() {
let Some(v) = versions.get(i) else {
bail!("version index {i} out of range (0..{})", versions.len());
};
return v.to_version().map(Some);
}
let Some((platform, version)) = spec.split_once('@') else {
bail!("expected `default`, an index or `<platform>@<version>`, got {spec:?}");
};
match versions.iter().find(|v| v.platform == platform && v.version == version) {
Some(v) => v.to_version().map(Some),
None => bail!("unknown client version {spec:?}, see `voelinctl versions`"),
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parses_all_rows() {
let versions = known_versions();
assert!(versions.len() > 50);
for v in &versions {
let signature = BASE64_STANDARD.decode(&v.signature).unwrap();
assert_eq!(signature.len(), 64, "{v:?}");
}
}
#[test]
fn resolves_specs() {
assert!(resolve("default").unwrap().is_none());
let by_index = resolve("0").unwrap().unwrap();
let first = &known_versions()[0];
let by_name = resolve(&format!("{}@{}", first.platform, first.version)).unwrap().unwrap();
assert_eq!(by_index, by_name);
assert_eq!(by_name.get_platform(), first.platform);
assert!(resolve("Nope@1.0").is_err());
assert!(resolve("100000").is_err());
assert!(resolve("garbage").is_err());
}
}
pub use voelin_core::versions::{client_metadata, known_versions, native_version, resolve};