Compare commits

...

71 commits

Author SHA1 Message Date
Carson McManus
96a30c6150
setup: debug print full authenticator status when verification fails (#396) 2024-07-16 20:32:18 -04:00
Carson McManus
dd153a617c
fix a potential panic when querying authenticator status (#395) 2024-07-16 20:13:39 -04:00
Carson McManus
28c7a797cf
fix new lints (#397) 2024-07-16 20:07:33 -04:00
Carson McManus
c2a72fee6c update PKGBUILD 2024-06-02 18:21:36 -04:00
mp
602acc6641
PKGBUILD: disabled link time optimization to avoid build errors (#385)
This solves build errors for me described in
https://aur.archlinux.org/packages/steamguard-cli-git#comment-884235 and
also reproduced in
https://github.com/dyc3/steamguard-cli/actions/runs/9340294638/job/25705683797

```
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/usr/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcWfC4he/symbols.o" "/var/ab/.cache/yay/steamguard-cli-git/src/steamguard-cli/target/release/deps/steamguard-22c99af53504a9e5.steamguard.7abfd362c63e99bf-cgu.13.rcgu.o" "-Wl,--as-needed" "-L" "/var/ab/.cache/yay/steamguard-cli-git/src/steamguard-cli/target/release/deps" "-L" "/var/ab/.cache/yay/steamguard-cli-git/src/steamguard-cli/target/release/build/ring-0dc12641040c6e8f/out" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustcWfC4he/libring-949bba2bc6e40fcb.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-3ce9c50abe6de474.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/var/ab/.cache/yay/steamguard-cli-git/src/steamguard-cli/target/release/deps/steamguard-22c99af53504a9e5" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
  = note: /usr/sbin/ld: /var/ab/.cache/yay/steamguard-cli-git/src/steamguard-cli/target/release/deps/steamguard-22c99af53504a9e5.steamguard.7abfd362c63e99bf-cgu.13.rcgu.o: in function `ring::aead::aes_gcm::aes_gcm_seal':
          steamguard.7abfd362c63e99bf-cgu.13:(.text._ZN4ring4aead7aes_gcm12aes_gcm_seal17hdce0b4a4f2d32350E+0xa9): undefined reference to `ring_core_0_17_8_OPENSSL_ia32cap_P'
```
2024-06-02 21:59:36 +00:00
Carson McManus
b4564b7d5e Release steamguard v0.14.0, steamguard-cli v0.14.0 2024-06-02 14:12:44 -04:00
Carson McManus
d30ba017c9 Bump steamguard v0.14.0, steamguard-cli v0.14.0 2024-06-02 14:12:19 -04:00
Carson McManus
37ae7c76a6 Release steamguard v0.14.0, steamguard-cli v0.14.0 2024-06-02 14:10:37 -04:00
Carson McManus
ef72bd898c Bump steamguard v0.14.0, steamguard-cli v0.14.0, safety bump steamguard-cli v0.14.0 2024-06-02 14:02:38 -04:00
Carson McManus
52044c95bb
upgrade more misc dependencies (#384)
- upgrade uuid to 1.8
- remove scraper from deps
- upgrade cookie to 0.18
- upgrade reqwest to 0.12
- upgrade qrcode to 0.14
- upgrade dirs to 5.0.1
2024-06-02 17:56:05 +00:00
Carson McManus
b24a7415f6
upgrade misc deps, set rust edition to 2021 (#383) 2024-06-02 16:26:00 +00:00
Carson McManus
8d54a1254a
upgrade to clap v4 (#382) 2024-06-02 14:59:25 +00:00
Carson McManus
ab5cb00ee3
qr-login: add a --image argument for providing an image to scan for the QR code (#381)
closes #380
2024-06-01 18:47:24 -04:00
dependabot[bot]
c7fefc1452
Bump rustls from 0.21.2 to 0.21.11 (#379)
Bumps [rustls](https://github.com/rustls/rustls) from 0.21.2 to 0.21.11.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="7b8d1dbc1e"><code>7b8d1db</code></a>
Prepare 0.21.11</li>
<li><a
href="ebcb4782f2"><code>ebcb478</code></a>
complete_io: bail out if progress is impossible</li>
<li><a
href="20f35dfb6d"><code>20f35df</code></a>
Regression test for <code>complete_io</code> infinite loop bug</li>
<li><a
href="2f2aae15a4"><code>2f2aae1</code></a>
Don't specially handle unauthenticated close_notify alerts</li>
<li><a
href="e163587b98"><code>e163587</code></a>
Don't deny warnings from nightly clippy</li>
<li><a
href="9f864874cf"><code>9f86487</code></a>
server::handy: fix new nightly clippy lint</li>
<li><a
href="7e0e8ab599"><code>7e0e8ab</code></a>
Correct assorted clippy warnings in test code</li>
<li><a
href="3587d98f4e"><code>3587d98</code></a>
Apply clippy suggestions from Rust 1.72</li>
<li><a
href="d082e837b3"><code>d082e83</code></a>
Address <code>clippy::redundant_static_lifetimes</code></li>
<li><a
href="5e7a06ca45"><code>5e7a06c</code></a>
Address <code>clippy::slow_vector_initialization</code></li>
<li>Additional commits viewable in <a
href="https://github.com/rustls/rustls/compare/v/0.21.2...v/0.21.11">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rustls&package-manager=cargo&previous-version=0.21.2&new-version=0.21.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 10:22:37 -04:00
dependabot[bot]
a64f7d4134
Bump h2 from 0.3.24 to 0.3.26 (#377)
Bumps [h2](https://github.com/hyperium/h2) from 0.3.24 to 0.3.26.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/hyperium/h2/releases">h2's
releases</a>.</em></p>
<blockquote>
<h2>v0.3.26</h2>
<h2>What's Changed</h2>
<ul>
<li>Limit number of CONTINUATION frames for misbehaving
connections.</li>
</ul>
<p>See <a
href="https://seanmonstar.com/blog/hyper-http2-continuation-flood/">https://seanmonstar.com/blog/hyper-http2-continuation-flood/</a>
for more info.</p>
<h2>v0.3.25</h2>
<h2>What's Changed</h2>
<ul>
<li>perf: optimize header list size calculations by <a
href="https://github.com/Noah-Kennedy"><code>@​Noah-Kennedy</code></a>
in <a
href="https://redirect.github.com/hyperium/h2/pull/750">hyperium/h2#750</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/hyperium/h2/compare/v0.3.24...v0.3.25">https://github.com/hyperium/h2/compare/v0.3.24...v0.3.25</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/hyperium/h2/blob/v0.3.26/CHANGELOG.md">h2's
changelog</a>.</em></p>
<blockquote>
<h1>0.3.26 (April 3, 2024)</h1>
<ul>
<li>Limit number of CONTINUATION frames for misbehaving
connections.</li>
</ul>
<h1>0.3.25 (March 15, 2024)</h1>
<ul>
<li>Improve performance decoding many headers.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="357127e279"><code>357127e</code></a>
v0.3.26</li>
<li><a
href="1a357aaefc"><code>1a357aa</code></a>
fix: limit number of CONTINUATION frames allowed</li>
<li><a
href="5b6c9e0da0"><code>5b6c9e0</code></a>
refactor: cleanup new unused warnings (<a
href="https://redirect.github.com/hyperium/h2/issues/757">#757</a>)</li>
<li><a
href="3a79832721"><code>3a79832</code></a>
v0.3.25</li>
<li><a
href="94e80b1c72"><code>94e80b1</code></a>
perf: optimize header list size calculations (<a
href="https://redirect.github.com/hyperium/h2/issues/750">#750</a>)</li>
<li>See full diff in <a
href="https://github.com/hyperium/h2/compare/v0.3.24...v0.3.26">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=h2&package-manager=cargo&previous-version=0.3.24&new-version=0.3.26)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-05 13:07:58 -04:00
Carson McManus
0a41e8b042 Release steamguard v0.13.0, steamguard-cli v0.13.0 2024-03-04 17:23:00 -05:00
Carson McManus
d3c1dfb3d5 Bump steamguard v0.13.0, steamguard-cli v0.13.0, safety bump steamguard-cli v0.13.0 2024-03-04 17:18:59 -05:00
Carson McManus
a8d3f3fc99 update release script 2024-03-04 17:17:38 -05:00
dependabot[bot]
5e24031719
Bump mio from 0.8.8 to 0.8.11 (#372)
Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.8 to 0.8.11.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md">mio's
changelog</a>.</em></p>
<blockquote>
<h1>0.8.11</h1>
<ul>
<li>Fix receiving IOCP events after deregistering a Windows named pipe
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1760">tokio-rs/mio#1760</a>,
backport pr:
<a
href="https://redirect.github.com/tokio-rs/mio/pull/1761">tokio-rs/mio#1761</a>).</li>
</ul>
<h1>0.8.10</h1>
<h2>Added</h2>
<ul>
<li>Solaris support
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1724">tokio-rs/mio#1724</a>).</li>
</ul>
<h1>0.8.9</h1>
<h2>Added</h2>
<ul>
<li>ESP-IDF framework support
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1692">tokio-rs/mio#1692</a>).</li>
<li>AIX operating system support
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1704">tokio-rs/mio#1704</a>).</li>
<li>Vita support
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1721">tokio-rs/mio#1721</a>).</li>
<li><code>{UnixListener,UnixStream}:bind_addr</code>
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1630">tokio-rs/mio#1630</a>).</li>
<li><code>mio_unsupported_force_poll_poll</code> and
<code>mio_unsupported_force_waker_pipe</code>
<strong>unsupported</strong> configuration flags to force a specific
poll or waker
implementation
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1684">tokio-rs/mio#1684</a>,
<a
href="https://redirect.github.com/tokio-rs/mio/pull/1685">tokio-rs/mio#1685</a>,
<a
href="https://redirect.github.com/tokio-rs/mio/pull/1692">tokio-rs/mio#1692</a>).</li>
</ul>
<h2>Fixed</h2>
<ul>
<li>The <code>pipe(2)</code> based waker (swapped file descriptors)
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1722">tokio-rs/mio#1722</a>).</li>
<li>The duplicate waker check to work correctly with cloned
<code>Registry</code>s.
(<a
href="https://redirect.github.com/tokio-rs/mio/pull/1706">tokio-rs/mio#1706</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0328bdef90"><code>0328bde</code></a>
Release v0.8.11</li>
<li><a
href="7084498512"><code>7084498</code></a>
Fix warnings</li>
<li><a
href="90d4fe00df"><code>90d4fe0</code></a>
named-pipes: fix receiving IOCP events after deregister</li>
<li><a
href="c710a307f8"><code>c710a30</code></a>
Add v0.8.x to the CI</li>
<li><a
href="c29e21c244"><code>c29e21c</code></a>
Release v0.8.10</li>
<li><a
href="f6a20da1c8"><code>f6a20da</code></a>
Add Solaris operating system support (<a
href="https://redirect.github.com/tokio-rs/mio/issues/1724">#1724</a>)</li>
<li><a
href="e80c3b21b5"><code>e80c3b2</code></a>
Release v0.8.9</li>
<li><a
href="862786bbbf"><code>862786b</code></a>
Fix importing of IoSourceState</li>
<li><a
href="40348728e4"><code>4034872</code></a>
Add support for vita target</li>
<li><a
href="8eb4010a92"><code>8eb4010</code></a>
Fix receiver and sender fd in pipe based waker</li>
<li>Additional commits viewable in <a
href="https://github.com/tokio-rs/mio/compare/v0.8.8...v0.8.11">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mio&package-manager=cargo&previous-version=0.8.8&new-version=0.8.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-04 21:55:03 +00:00
Carson McManus
d67e925a47
ci: add workflow_dispatch trigger to aur-checker (#371) 2024-03-04 07:20:18 -05:00
Carson McManus
4c9f494ed3
chore: update CI to use node 20 actions (#369) 2024-03-04 07:05:23 -05:00
Carson McManus
46a1c2ed04
rename trade subcommand to confirm and deprecate trade subcommand (#368) 2024-03-04 06:56:48 -05:00
Carson McManus
ad146c97c9 Release steamguard v0.12.6, steamguard-cli v0.12.6 2024-02-19 09:33:29 -05:00
Carson McManus
d96b6e65a6 Bump steamguard v0.12.6, steamguard-cli v0.12.6 2024-02-19 09:29:22 -05:00
Carson McManus
84da432b2d
tests: Replace tempdir crate with tempfile (#366) 2024-02-19 13:43:52 +00:00
dependabot[bot]
2629b0b715
Bump h2 from 0.3.20 to 0.3.24 (#359)
Bumps [h2](https://github.com/hyperium/h2) from 0.3.20 to 0.3.24.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/hyperium/h2/releases">h2's
releases</a>.</em></p>
<blockquote>
<h2>v0.3.24</h2>
<h2>Fixed</h2>
<ul>
<li>Limit error resets for misbehaving connections.</li>
</ul>
<h2>v0.3.23</h2>
<h2>What's Changed</h2>
<ul>
<li>cherry-pick fix: streams awaiting capacity lockout in <a
href="https://redirect.github.com/hyperium/h2/pull/734">hyperium/h2#734</a></li>
</ul>
<h2>v0.3.22</h2>
<h2>What's Changed</h2>
<ul>
<li>Add <code>header_table_size(usize)</code> option to client and
server builders.</li>
<li>Improve throughput when vectored IO is not available.</li>
<li>Update indexmap to 2.</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/tottoto"><code>@​tottoto</code></a> made
their first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/714">hyperium/h2#714</a></li>
<li><a href="https://github.com/xiaoyawei"><code>@​xiaoyawei</code></a>
made their first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/712">hyperium/h2#712</a></li>
<li><a href="https://github.com/Protryon"><code>@​Protryon</code></a>
made their first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/719">hyperium/h2#719</a></li>
<li><a href="https://github.com/4JX"><code>@​4JX</code></a> made their
first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/638">hyperium/h2#638</a></li>
<li><a
href="https://github.com/vuittont60"><code>@​vuittont60</code></a> made
their first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/724">hyperium/h2#724</a></li>
</ul>
<h2>v0.3.21</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix opening of new streams over peer's max concurrent limit.</li>
<li>Fix <code>RecvStream</code> to return data even if it has received a
<code>CANCEL</code> stream error.</li>
<li>Update MSRV to 1.63.</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/DDtKey"><code>@​DDtKey</code></a> made
their first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/703">hyperium/h2#703</a></li>
<li><a href="https://github.com/jwilm"><code>@​jwilm</code></a> made
their first contribution in <a
href="https://redirect.github.com/hyperium/h2/pull/707">hyperium/h2#707</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/hyperium/h2/blob/v0.3.24/CHANGELOG.md">h2's
changelog</a>.</em></p>
<blockquote>
<h1>0.3.24 (January 17, 2024)</h1>
<ul>
<li>Limit error resets for misbehaving connections.</li>
</ul>
<h1>0.3.23 (January 10, 2024)</h1>
<ul>
<li>Backport fix from 0.4.1 for stream capacity assignment.</li>
</ul>
<h1>0.3.22 (November 15, 2023)</h1>
<ul>
<li>Add <code>header_table_size(usize)</code> option to client and
server builders.</li>
<li>Improve throughput when vectored IO is not available.</li>
<li>Update indexmap to 2.</li>
</ul>
<h1>0.3.21 (August 21, 2023)</h1>
<ul>
<li>Fix opening of new streams over peer's max concurrent limit.</li>
<li>Fix <code>RecvStream</code> to return data even if it has received a
<code>CANCEL</code> stream error.</li>
<li>Update MSRV to 1.63.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="7243ab5854"><code>7243ab5</code></a>
Prepare v0.3.24</li>
<li><a
href="d919cd6fd8"><code>d919cd6</code></a>
streams: limit error resets for misbehaving connections</li>
<li><a
href="a7eb14a487"><code>a7eb14a</code></a>
v0.3.23</li>
<li><a
href="b668c7fbe2"><code>b668c7f</code></a>
fix: streams awaiting capacity lockout (<a
href="https://redirect.github.com/hyperium/h2/issues/730">#730</a>) (<a
href="https://redirect.github.com/hyperium/h2/issues/734">#734</a>)</li>
<li><a
href="0f412d8b9c"><code>0f412d8</code></a>
v0.3.22</li>
<li><a
href="c7ca62f69b"><code>c7ca62f</code></a>
docs: fix typos (<a
href="https://redirect.github.com/hyperium/h2/issues/724">#724</a>)</li>
<li><a
href="ef743ecb22"><code>ef743ec</code></a>
Add a setter for header_table_size (<a
href="https://redirect.github.com/hyperium/h2/issues/638">#638</a>)</li>
<li><a
href="56651e6e51"><code>56651e6</code></a>
fix lint about unused import</li>
<li><a
href="4aa7b16342"><code>4aa7b16</code></a>
Fix documentation for max_send_buffer_size (<a
href="https://redirect.github.com/hyperium/h2/issues/718">#718</a>)</li>
<li><a
href="d03c54a80d"><code>d03c54a</code></a>
chore(dependencies): update tracing minimal version to 0.1.35</li>
<li>Additional commits viewable in <a
href="https://github.com/hyperium/h2/compare/v0.3.20...v0.3.24">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=h2&package-manager=cargo&previous-version=0.3.20&new-version=0.3.24)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

> **Note**
> Automatic rebases have been disabled on this pull request as it has
been open for over 30 days.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 08:30:56 -05:00
Carson McManus
f7a4ce6133
Bump stderrlog to 0.6 (#365) 2024-02-19 08:26:03 -05:00
Carson McManus
c5d51b5174
trade: fix ApiKeyCreation confirmation getting iterpreted as Unknown (#363) 2024-02-19 08:20:43 -05:00
Carson McManus
8394baa157
remove dead code to fix lints (#364) 2024-02-19 13:12:44 +00:00
Carson McManus
25280abc62
add new confirmation type: api key creation (#357) 2024-01-04 21:59:18 -05:00
Carson McManus
bdc8d3c526 Release steamguard v0.12.5, steamguard-cli v0.12.5 2023-12-08 16:47:29 -05:00
Carson McManus
bcac6fa7a3 Bump steamguard v0.12.5, steamguard-cli v0.12.5 2023-12-08 16:43:47 -05:00
Carson McManus
225b53d719
setup: add support for transfering or removing authenticators (#354)
- add methods for remove auth via challenge
- add `transfer_start` and `transfer_finish` to account linker
2023-12-08 17:38:36 +00:00
Carson McManus
4ea44151b9
login: make the 2fa and email code prompts less easy to mess up (#352) 2023-12-08 11:48:14 -05:00
Carson McManus
68dcedaeb7
remove: move main remove_authenticator request logic into AccountLinker (#353) 2023-12-08 16:39:41 +00:00
Carson McManus
9358fb60c9 Release steamguard v0.12.4, steamguard-cli v0.12.4 2023-12-03 11:53:57 -05:00
Carson McManus
9795453a04 Bump steamguard v0.12.4, steamguard-cli v0.12.4 2023-12-03 11:45:35 -05:00
Carson McManus
8f7ca33e8a tweak the release script a little 2023-12-03 11:43:31 -05:00
Carson McManus
fca7e53a0d
fix a missing step (#349) 2023-12-03 16:39:45 +00:00
Carson McManus
166b7a908c
setup: add support for different link confirmation types, and verify that the authenticator was actually set up (#348)
fixes #345
2023-12-03 16:36:35 +00:00
Carson McManus
63805293ff
update steam protobufs (#347) 2023-12-03 15:14:59 +00:00
Carson McManus
d18dd378c3
login: don't print a warning for EAuthSessionGuardType::None (#346) 2023-12-03 10:12:03 -05:00
Carson McManus
41bf8a45ec Release steamguard v0.12.3, steamguard-cli v0.12.3 2023-10-25 10:23:51 -04:00
Carson McManus
37b7b75077 Bump steamguard v0.12.3, steamguard-cli v0.12.3 2023-10-25 10:20:26 -04:00
Carson McManus
8bfab8d2a2
adjust the types used for migrating from SDA to be a little more lenient (#338)
fixes #337
2023-10-25 10:17:21 -04:00
dependabot[bot]
a9e39b4215
Bump rustix from 0.37.22 to 0.37.25 (#336)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.37.22
to 0.37.25.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="00b84d6aac"><code>00b84d6</code></a>
chore: Release rustix version 0.37.25</li>
<li><a
href="cad15a7076"><code>cad15a7</code></a>
Fixes for <code>Dir</code> on macOS, FreeBSD, and WASI.</li>
<li><a
href="df3c3a192c"><code>df3c3a1</code></a>
Merge pull request from GHSA-c827-hfw6-qwvm</li>
<li><a
href="b78aeff1a2"><code>b78aeff</code></a>
chore: Release rustix version 0.37.24</li>
<li><a
href="c0c3f01d7c"><code>c0c3f01</code></a>
Add GNU/Hurd support (<a
href="https://redirect.github.com/bytecodealliance/rustix/issues/852">#852</a>)</li>
<li><a
href="f416b6b27b"><code>f416b6b</code></a>
Fix the <code>test_ttyname_ok</code> test when /dev/stdin is
inaccessable. (<a
href="https://redirect.github.com/bytecodealliance/rustix/issues/821">#821</a>)</li>
<li><a
href="aee5b0954e"><code>aee5b09</code></a>
Downgrade dependencies and disable tests to compile under Rust
1.48.</li>
<li><a
href="6d42c38311"><code>6d42c38</code></a>
Disable MIPS in CI. (<a
href="https://redirect.github.com/bytecodealliance/rustix/issues/793">#793</a>)</li>
<li><a
href="7cdacb1145"><code>7cdacb1</code></a>
chore: Release rustix version 0.37.23</li>
<li><a
href="c6b1d4e690"><code>c6b1d4e</code></a>
Pin Rust nightly to 2023-07-03.</li>
<li>Additional commits viewable in <a
href="https://github.com/bytecodealliance/rustix/compare/v0.37.22...v0.37.25">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rustix&package-manager=cargo&previous-version=0.37.22&new-version=0.37.25)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 16:19:03 -04:00
Carson McManus
a50109ad63
login: add a debug log for available confirmation methods (#335) 2023-10-17 18:01:05 +00:00
Carson McManus
7eb62cfa7b
trade: if confirmation failure response contains a message, keep it so the user can see it (#329) 2023-10-08 15:12:34 +00:00
Carson McManus
94a3210f09
import: add support for importing winauth exports (#331)
closes #295
2023-10-08 11:10:46 -04:00
dependabot[bot]
6d4915a39c
Bump webpki from 0.22.1 to 0.22.2 (#330)
Bumps [webpki](https://github.com/briansmith/webpki) from 0.22.1 to
0.22.2.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/briansmith/webpki/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=webpki&package-manager=cargo&previous-version=0.22.1&new-version=0.22.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 18:51:05 -04:00
Carson McManus
e529b76c97 Release steamguard v0.12.2, steamguard-cli v0.12.2 2023-09-28 18:11:40 -04:00
Carson McManus
47894cc217 Bump steamguard v0.12.2, steamguard-cli v0.12.2 2023-09-28 18:08:33 -04:00
Carson McManus
c809d1e725
clean up some unused code (#327) 2023-09-28 22:06:51 +00:00
Carson McManus
0c256a0e05
add --password argument and STEAMGUARD_CLI_STEAM_PASSWORD environment variable (#326)
closes #324
2023-09-28 21:52:42 +00:00
Carson McManus
04295dc742
update rpassword to 7.2.0 and add some debug logs (#325)
related: #324
2023-09-28 21:12:50 +00:00
dependabot[bot]
4fb0e4cfcd
Bump phonenumber from 0.3.2+8.13.9 to 0.3.3+8.13.9 (#323)
Bumps [phonenumber](https://github.com/whisperfish/rust-phonenumber)
from 0.3.2+8.13.9 to 0.3.3+8.13.9.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/whisperfish/rust-phonenumber/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=phonenumber&package-manager=cargo&previous-version=0.3.2+8.13.9&new-version=0.3.3+8.13.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-22 10:04:11 -04:00
dependabot[bot]
e032008fdb
Bump webpki from 0.22.0 to 0.22.1 (#321)
Bumps [webpki](https://github.com/briansmith/webpki) from 0.22.0 to
0.22.1.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/briansmith/webpki/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=webpki&package-manager=cargo&previous-version=0.22.0&new-version=0.22.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-13 10:29:08 -04:00
Carson McManus
5178238f8d Release steamguard v0.12.1, steamguard-cli v0.12.1 2023-09-13 10:20:59 -04:00
Carson McManus
90ba3b64b5 Bump steamguard v0.12.1, steamguard-cli v0.12.1 2023-09-13 10:17:20 -04:00
Carson McManus
14589e70d5
misc fixes for deb packaging (#315)
- change debian package arch to `amd64`
- change compression type for debian package to `xz`

fixes #314
2023-09-13 14:15:58 +00:00
Carson McManus
a9af82da13
fix how UserLogin handles access tokens for new api behavior, fixes #319 (#320)
fixes #319
2023-09-13 14:15:09 +00:00
Carson McManus
f952ed5b1b
remove normalize_comments rustfmt rule (#316) 2023-09-10 21:22:23 +00:00
Carson McManus
97a9040eb8 Release steamguard v0.12.0, steamguard-cli v0.12.0 2023-09-04 13:47:12 -04:00
Carson McManus
544608a330 Bump steamguard v0.12.0, steamguard-cli v0.12.0 2023-09-04 13:43:38 -04:00
Carson McManus
9f26e6b241 update version numbers 2023-09-04 13:43:05 -04:00
Carson McManus
2c63350bcf update release script 2023-09-04 13:39:27 -04:00
Carson McManus
29aca56067
adjust error message for when mobile confirmation fails (#311)
- adjust error message for when mobile confirmation fails
- update issue template
2023-09-04 17:10:30 +00:00
Carson McManus
f2821d2837 Release steamguard-cli v0.11.0 2023-08-23 17:41:18 -04:00
Carson McManus
84993dedae Bump steamguard-cli v0.11.0 2023-08-23 17:37:26 -04:00
Carson McManus
4348529ffd
import: add support for importing steam mobile app v2 format, remove --sda argument (#307)
- add account schema for steam app v2
- make it possible to import steam v2 accounts
- import: remove the `--sda` flag, the format should be detected
automatically
- add unit tests
- make it actually work

closes #305
2023-08-23 17:59:14 +00:00
dependabot[bot]
40d81f360b
Bump rustls-webpki from 0.100.1 to 0.100.2 (#306)
Bumps [rustls-webpki](https://github.com/rustls/webpki) from 0.100.1 to
0.100.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rustls/webpki/releases">rustls-webpki's
releases</a>.</em></p>
<blockquote>
<h2>v/0.100.2</h2>
<h2>Release notes</h2>
<ul>
<li>certificate path building and verification is now capped at 100
signature validation operations to avoid the risk of CPU usage
denial-of-service attack when validating crafted certificate chains
producing quadratic runtime. This risk affected both clients, as well as
servers that verified client certificates.</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>v0.100.2 prep by <a
href="https://github.com/cpu"><code>@​cpu</code></a> in <a
href="https://redirect.github.com/rustls/webpki/pull/154">rustls/webpki#154</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/rustls/webpki/compare/v/0.100.1...v/0.100.2">https://github.com/rustls/webpki/compare/v/0.100.1...v/0.100.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c8b821450b"><code>c8b8214</code></a>
Bump MSRV to 1.60</li>
<li><a
href="855752292e"><code>8557522</code></a>
Avoid testing MSRV of dev-dependencies</li>
<li><a
href="73a7f0c7d7"><code>73a7f0c</code></a>
Cargo: version 0.100.1 -&gt; 0.100.2</li>
<li><a
href="4ea052366f"><code>4ea0523</code></a>
verify_cert: enforce maximum number of signatures.</li>
<li>See full diff in <a
href="https://github.com/rustls/webpki/compare/v/0.100.1...v/0.100.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rustls-webpki&package-manager=cargo&previous-version=0.100.1&new-version=0.100.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/dyc3/steamguard-cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-22 14:29:36 -04:00
51 changed files with 2351 additions and 1341 deletions

View file

@ -10,7 +10,7 @@ body:
id: version id: version
attributes: attributes:
label: Version label: Version
description: What version of steamguard-cli are you running? You can find this by running `steamguard --version`. description: What version of steamguard-cli are you running? You can find this by running `steamguard --version`. **Do NOT just say "latest", or your issue will be automatically closed.**
validations: validations:
required: true required: true
- type: textarea - type: textarea

View file

@ -5,12 +5,13 @@ on:
- cron: "32 5 */3 * *" - cron: "32 5 */3 * *"
push: push:
branches: [ master, main ] branches: [ master, main ]
workflow_dispatch:
jobs: jobs:
test-install: test-install:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install AUR package - name: Install AUR package
run: ./scripts/check-aur.sh run: ./scripts/check-aur.sh

View file

@ -15,9 +15,9 @@ jobs:
steps: steps:
- run: rustup component add clippy rustfmt - run: rustup component add clippy rustfmt
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0 uses: Swatinem/rust-cache@v2
- name: Check format - name: Check format
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
- name: Check - name: Check
@ -34,13 +34,13 @@ jobs:
matrix: matrix:
target: [x86_64-unknown-linux-musl, x86_64-pc-windows-gnu] target: [x86_64-unknown-linux-musl, x86_64-pc-windows-gnu]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0 uses: Swatinem/rust-cache@v2
with: with:
prefix-key: v0-rust-${{ matrix.target }} prefix-key: v0-rust-${{ matrix.target }}
- name: Install Cross - name: Install Cross
uses: baptiste0928/cargo-install@v1 uses: baptiste0928/cargo-install@v2
with: with:
crate: cross crate: cross
- name: Check - name: Check

2137
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -4,9 +4,9 @@ members = ["steamguard"]
[package] [package]
name = "steamguard-cli" name = "steamguard-cli"
version = "0.10.5" version = "0.14.0"
authors = ["dyc3 (Carson McManus) <carson.mcmanus1@gmail.com>"] authors = ["dyc3 (Carson McManus) <carson.mcmanus1@gmail.com>"]
edition = "2018" edition = "2021"
description = "A command line utility to generate Steam 2FA codes and respond to confirmations." description = "A command line utility to generate Steam 2FA codes and respond to confirmations."
keywords = ["steam", "2fa", "steamguard", "authentication", "cli"] keywords = ["steam", "2fa", "steamguard", "authentication", "cli"]
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
@ -27,38 +27,43 @@ keyring = ["dep:keyring"]
name = "steamguard" name = "steamguard"
path = "src/main.rs" path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
anyhow = "^1.0" anyhow = "^1.0"
base64 = "0.21.2" base64 = "0.22.1"
text_io = "0.1.8" text_io = "0.1.8"
rpassword = "5.0" rpassword = "7.2.0"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "cookies", "gzip", "rustls-tls"] } reqwest = { version = "0.12", default-features = false, features = [
"blocking",
"json",
"cookies",
"gzip",
"rustls-tls",
] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
rsa = "0.9.2" rsa = "0.9.2"
rand = "0.8.5" rand = "0.8.5"
standback = "0.2.17" # required to fix a compilation error on a transient dependency clap = { version = "4.5.4", features = ["derive", "cargo", "env"] }
clap = { version = "3.1.18", features = ["derive", "cargo", "env"] } clap_complete = "4.5.2"
clap_complete = "3.2.1"
log = "0.4.19" log = "0.4.19"
stderrlog = "0.4" stderrlog = "0.6"
cookie = "0.14" cookie = "0.18"
regex = "1" regex = "1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
uuid = { version = "0.8", features = ["v4"] } uuid = { version = "1.8", features = ["v4"] }
steamguard = { version = "^0.10.3", path = "./steamguard" } steamguard = { version = "^0.14.0", path = "./steamguard" }
dirs = "3.0.2" dirs = "5.0.1"
aes = { version = "0.8.3", features = ["zeroize"] } aes = { version = "0.8.3", features = ["zeroize"] }
thiserror = "1.0.26" thiserror = "1.0.61"
crossterm = { version = "0.23.2", features = ["event-stream"] } crossterm = { version = "0.23.2", features = ["event-stream"] }
qrcode = { version = "0.12.0", optional = true } qrcode = { version = "0.14.0", optional = true }
gethostname = "0.4.3" gethostname = "0.4.3"
secrecy = { version = "0.8", features = ["serde"] } secrecy = { version = "0.8", features = ["serde"] }
zeroize = { version = "^1.6.0", features = ["std", "zeroize_derive"] } zeroize = { version = "^1.6.0", features = ["std", "zeroize_derive"] }
serde_path_to_error = "0.1.11" serde_path_to_error = "0.1.11"
update-informer = { version = "1.0.0", optional = true, default-features = false, features = ["github"] } update-informer = { version = "1.0.0", optional = true, default-features = false, features = [
"github",
] }
phonenumber = "0.3" phonenumber = "0.3"
cbc = { version = "0.1.2", features = ["std", "zeroize"] } cbc = { version = "0.1.2", features = ["std", "zeroize"] }
inout = { version = "0.1.3", features = ["std"] } inout = { version = "0.1.3", features = ["std"] }
@ -67,9 +72,11 @@ argon2 = { version = "0.5.0", features = ["std", "zeroize"] }
pbkdf2 = { version = "0.12.1", features = ["parallel"] } pbkdf2 = { version = "0.12.1", features = ["parallel"] }
sha1 = "0.10.5" sha1 = "0.10.5"
rayon = "1.7.0" rayon = "1.7.0"
rqrr = "0.7.1"
image = "0.25"
[dev-dependencies] [dev-dependencies]
tempdir = "0.3" tempfile = "3"
proptest = "1" proptest = "1"
[profile.release] [profile.release]

View file

@ -3,7 +3,7 @@
_pkgname=steamguard-cli _pkgname=steamguard-cli
pkgname=${_pkgname}-git pkgname=${_pkgname}-git
pkgver=0.8.1.r1.fe0d6e9a pkgver=0.14.0.r1.602acc66
pkgrel=1 pkgrel=1
pkgdesc="A command line utility to generate Steam 2FA codes and respond to confirmations." pkgdesc="A command line utility to generate Steam 2FA codes and respond to confirmations."
arch=('i686' 'x86_64' 'armv6h' 'armv7h') arch=('i686' 'x86_64' 'armv6h' 'armv7h')
@ -12,6 +12,7 @@ license=('GPL3')
makedepends=('rust' 'cargo' 'git') makedepends=('rust' 'cargo' 'git')
source=("git+https://github.com/dyc3/steamguard-cli.git") source=("git+https://github.com/dyc3/steamguard-cli.git")
sha256sums=('SKIP') sha256sums=('SKIP')
options=(!lto)
pkgver() { pkgver() {
cd "${srcdir}/${_pkgname}" cd "${srcdir}/${_pkgname}"

View file

@ -3,7 +3,7 @@
[![Lint, Build, Test](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml) [![Lint, Build, Test](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml)
[![AUR Tester](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml) [![AUR Tester](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml)
A command line utility for setting up and using Steam Mobile Authenticator (AKA Steam 2FA). It can also be used to respond to trade and market confirmations. A command line utility for setting up and using Steam Mobile Authenticator (AKA Steam 2FA). It can also be used to respond to trade, market, and any other steam mobile confirmations that you would normally get in the app.
**The only legitimate place to download steamguard-cli binaries is through this repo's releases, or by any package manager that is linked in this document.** **The only legitimate place to download steamguard-cli binaries is through this repo's releases, or by any package manager that is linked in this document.**

View file

@ -1,3 +1,2 @@
tab_spaces = 4 tab_spaces = 4
hard_tabs = true hard_tabs = true
normalize_comments = true

View file

@ -4,6 +4,7 @@ set -e
DRY_RUN=true DRY_RUN=true
SKIP_CRATE_PUBLISH=false SKIP_CRATE_PUBLISH=false
ALLOW_DIRTY=false
POSITIONAL=() POSITIONAL=()
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@ -23,6 +24,10 @@ while [[ $# -gt 0 ]]; do
SKIP_CRATE_PUBLISH=true SKIP_CRATE_PUBLISH=true
shift # past argument shift # past argument
;; ;;
--allow-dirty)
ALLOW_DIRTY=true
shift # past argument
;;
*) # unknown option *) # unknown option
POSITIONAL+=("$1") # save it in an array for later POSITIONAL+=("$1") # save it in an array for later
shift # past argument shift # past argument
@ -47,6 +52,21 @@ This will do everything needed to release a new version:
- publish crates on crates.io - publish crates on crates.io
- upload artifacts to a new release on github - upload artifacts to a new release on github
""" """
echo "Previewing changes..."
params=()
if [[ $BUMP != "" ]]; then
params+=(--bump "$BUMP")
params+=(--bump-dependencies "$BUMP")
fi
if [[ $SKIP_CRATE_PUBLISH == true ]]; then
params+=(--no-publish)
fi
if [[ $ALLOW_DIRTY == true ]]; then
params+=(--allow-dirty)
fi
cargo smart-release --update-crates-index --no-changelog --no-tag --no-push --no-publish "${params[@]}"
if [ "$DRY_RUN" = true ]; then if [ "$DRY_RUN" = true ]; then
echo "This is a dry run, nothing will be done. Artifacts will be built, but not published. Use --execute to do it for real." echo "This is a dry run, nothing will be done. Artifacts will be built, but not published. Use --execute to do it for real."
else else
@ -55,17 +75,10 @@ fi
echo "Press any key to continue..." echo "Press any key to continue..."
read -n 1 -s -r read -n 1 -s -r
params=()
if [[ $DRY_RUN == false ]]; then if [[ $DRY_RUN == false ]]; then
params+=(--execute) params+=(--execute)
fi fi
if [[ $BUMP != "" ]]; then
params+=(--bump "$BUMP")
params+=(--bump-dependencies "$BUMP")
fi
if [[ $SKIP_CRATE_PUBLISH == true ]]; then
params+=(--no-publish)
fi
cargo smart-release --update-crates-index --no-changelog --no-tag --no-push --no-publish "${params[@]}" cargo smart-release --update-crates-index --no-changelog --no-tag --no-push --no-publish "${params[@]}"
#echo "Verify that the publish succeeded, and Press any key to continue..." #echo "Verify that the publish succeeded, and Press any key to continue..."

View file

@ -32,12 +32,12 @@ Depends:
Version: $VERSION Version: $VERSION
Section: base Section: base
Priority: optional Priority: optional
Architecture: x86-64 Architecture: amd64
Maintainer: Carson McManus <carson.mcmanus1@gmail.com> Maintainer: Carson McManus <carson.mcmanus1@gmail.com>
Description: steamguard-cli Description: steamguard-cli
A command line utility to generate Steam 2FA codes and respond to confirmations. A command line utility to generate Steam 2FA codes and respond to confirmations.
EOT EOT
dpkg-deb --build "$TEMP_PKG_PATH" "steamguard-cli_$VERSION-0.deb" dpkg-deb -Zxz --build "$TEMP_PKG_PATH" "steamguard-cli_$VERSION-0.deb"
rm -rf "$TEMP_PKG_PATH" rm -rf "$TEMP_PKG_PATH"

View file

@ -15,6 +15,8 @@ use thiserror::Error;
mod legacy; mod legacy;
pub mod manifest; pub mod manifest;
pub mod migrate; pub mod migrate;
mod steamv2;
mod winauth;
pub use manifest::*; pub use manifest::*;
@ -194,14 +196,14 @@ impl AccountManager {
Ok(()) Ok(())
} }
pub fn remove_account(&mut self, account_name: String) { pub fn remove_account(&mut self, account_name: &String) {
let index = self let index = self
.manifest .manifest
.entries .entries
.iter() .iter()
.position(|a| a.account_name == account_name) .position(|a| &a.account_name == account_name)
.unwrap(); .unwrap();
self.accounts.remove(&account_name); self.accounts.remove(account_name);
self.manifest.entries.remove(index); self.manifest.entries.remove(index);
} }
@ -337,8 +339,9 @@ impl AccountManager {
debug!("Adding missing account names"); debug!("Adding missing account names");
for i in 0..self.manifest.entries.len() { for i in 0..self.manifest.entries.len() {
let account = self.load_account_by_entry(&self.manifest.entries[i].clone())?; let account = self.load_account_by_entry(&self.manifest.entries[i].clone())?;
self.manifest.entries[i].account_name = self.manifest.entries[i]
account.lock().unwrap().account_name.clone(); .account_name
.clone_from(&account.lock().unwrap().account_name);
} }
upgraded = true; upgraded = true;
} }
@ -468,19 +471,19 @@ pub enum ManifestAccountImportError {
mod tests { mod tests {
use super::*; use super::*;
use steamguard::ExposeSecret; use steamguard::ExposeSecret;
use tempdir::TempDir; use tempfile::TempDir;
#[test] #[test]
fn test_should_save_new_manifest() { fn test_should_save_new_manifest() {
let tmp_dir = TempDir::new("steamguard-cli-test").unwrap(); let tmp_dir = TempDir::new().unwrap();
let manifest_path = tmp_dir.path().join("manifest.json"); let manifest_path = tmp_dir.path().join("manifest.json");
let manager = AccountManager::new(manifest_path.as_path()); let manager = AccountManager::new(manifest_path.as_path());
assert!(matches!(manager.save(), Ok(_))); assert!(manager.save().is_ok());
} }
#[test] #[test]
fn test_should_save_and_load_manifest() -> anyhow::Result<()> { fn test_should_save_and_load_manifest() -> anyhow::Result<()> {
let tmp_dir = TempDir::new("steamguard-cli-test")?; let tmp_dir = TempDir::new()?;
let manifest_path = tmp_dir.path().join("manifest.json"); let manifest_path = tmp_dir.path().join("manifest.json");
println!("tempdir: {}", manifest_path.display()); println!("tempdir: {}", manifest_path.display());
let mut manager = AccountManager::new(manifest_path.as_path()); let mut manager = AccountManager::new(manifest_path.as_path());
@ -516,7 +519,7 @@ mod tests {
#[test] #[test]
fn test_should_save_and_load_manifest_encrypted() -> anyhow::Result<()> { fn test_should_save_and_load_manifest_encrypted() -> anyhow::Result<()> {
let passkey = Some(SecretString::new("password".into())); let passkey = Some(SecretString::new("password".into()));
let tmp_dir = TempDir::new("steamguard-cli-test")?; let tmp_dir = TempDir::new()?;
let manifest_path = tmp_dir.path().join("manifest.json"); let manifest_path = tmp_dir.path().join("manifest.json");
let mut manager = AccountManager::new(manifest_path.as_path()); let mut manager = AccountManager::new(manifest_path.as_path());
let mut account = SteamGuardAccount::new(); let mut account = SteamGuardAccount::new();
@ -528,7 +531,7 @@ mod tests {
manager.add_account(account); manager.add_account(account);
manager.manifest.entries[0].encryption = Some(EncryptionScheme::generate()); manager.manifest.entries[0].encryption = Some(EncryptionScheme::generate());
manager.submit_passkey(passkey.clone()); manager.submit_passkey(passkey.clone());
assert!(matches!(manager.save(), Ok(_))); assert!(manager.save().is_ok());
let mut loaded_manager = AccountManager::load(manifest_path.as_path()).unwrap(); let mut loaded_manager = AccountManager::load(manifest_path.as_path()).unwrap();
loaded_manager.submit_passkey(passkey); loaded_manager.submit_passkey(passkey);
@ -541,7 +544,7 @@ mod tests {
if _r.is_err() { if _r.is_err() {
eprintln!("{:?}", _r); eprintln!("{:?}", _r);
} }
assert!(matches!(_r, Ok(_))); assert!(_r.is_ok());
assert_eq!( assert_eq!(
loaded_manager.manifest.entries.len(), loaded_manager.manifest.entries.len(),
loaded_manager.accounts.len() loaded_manager.accounts.len()
@ -565,7 +568,7 @@ mod tests {
#[test] #[test]
fn test_should_save_and_load_manifest_encrypted_longer() -> anyhow::Result<()> { fn test_should_save_and_load_manifest_encrypted_longer() -> anyhow::Result<()> {
let passkey = Some(SecretString::new("password".into())); let passkey = Some(SecretString::new("password".into()));
let tmp_dir = TempDir::new("steamguard-cli-test")?; let tmp_dir = TempDir::new()?;
let manifest_path = tmp_dir.path().join("manifest.json"); let manifest_path = tmp_dir.path().join("manifest.json");
let mut manager = AccountManager::new(manifest_path.as_path()); let mut manager = AccountManager::new(manifest_path.as_path());
let mut account = SteamGuardAccount::new(); let mut account = SteamGuardAccount::new();
@ -612,7 +615,7 @@ mod tests {
#[test] #[test]
fn test_should_import() -> anyhow::Result<()> { fn test_should_import() -> anyhow::Result<()> {
let tmp_dir = TempDir::new("steamguard-cli-test")?; let tmp_dir = TempDir::new()?;
let manifest_path = tmp_dir.path().join("manifest.json"); let manifest_path = tmp_dir.path().join("manifest.json");
let mut manager = AccountManager::new(manifest_path.as_path()); let mut manager = AccountManager::new(manifest_path.as_path());
let mut account = SteamGuardAccount::new(); let mut account = SteamGuardAccount::new();
@ -627,17 +630,16 @@ mod tests {
std::fs::remove_file(&manifest_path)?; std::fs::remove_file(&manifest_path)?;
let mut loaded_manager = AccountManager::new(manifest_path.as_path()); let mut loaded_manager = AccountManager::new(manifest_path.as_path());
assert!(matches!( assert!(loaded_manager
loaded_manager.import_account( .import_account(
&tmp_dir &tmp_dir
.path() .path()
.join("asdf1234.maFile") .join("asdf1234.maFile")
.into_os_string() .into_os_string()
.into_string() .into_string()
.unwrap() .unwrap()
), )
Ok(_) .is_ok());
));
assert_eq!( assert_eq!(
loaded_manager.manifest.entries.len(), loaded_manager.manifest.entries.len(),
loaded_manager.accounts.len() loaded_manager.accounts.len()

View file

@ -128,9 +128,11 @@ pub struct SdaAccount {
pub token_gid: String, pub token_gid: String,
#[serde(with = "crate::secret_string")] #[serde(with = "crate::secret_string")]
pub identity_secret: SecretString, pub identity_secret: SecretString,
#[serde(default)]
pub server_time: u64, pub server_time: u64,
#[serde(with = "crate::secret_string")] #[serde(with = "crate::secret_string")]
pub uri: SecretString, pub uri: SecretString,
#[serde(default)]
pub fully_enrolled: bool, pub fully_enrolled: bool,
pub device_id: String, pub device_id: String,
#[serde(with = "crate::secret_string")] #[serde(with = "crate::secret_string")]

View file

@ -1,6 +1,6 @@
use std::{fs::File, io::Read, path::Path}; use std::{fs::File, io::Read, path::Path};
use log::debug; use log::*;
use secrecy::SecretString; use secrecy::SecretString;
use serde::{de::Error, Deserialize}; use serde::{de::Error, Deserialize};
use steamguard::SteamGuardAccount; use steamguard::SteamGuardAccount;
@ -11,6 +11,8 @@ use crate::encryption::EncryptionScheme;
use super::{ use super::{
legacy::{SdaAccount, SdaManifest}, legacy::{SdaAccount, SdaManifest},
manifest::ManifestV1, manifest::ManifestV1,
steamv2::SteamMobileV2,
winauth::parse_winauth_exports,
EntryLoader, Manifest, EntryLoader, Manifest,
}; };
@ -145,7 +147,11 @@ impl MigratingManifest {
errors errors
)); ));
} }
accounts.into_iter().map(MigratingAccount::Sda).collect() accounts
.into_iter()
.map(ExternalAccount::Sda)
.map(MigratingAccount::External)
.collect()
} }
Self::ManifestV1(manifest) => { Self::ManifestV1(manifest) => {
let (accounts, errors) = manifest let (accounts, errors) = manifest
@ -228,15 +234,16 @@ fn deserialize_manifest(
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
enum MigratingAccount { enum MigratingAccount {
Sda(SdaAccount), External(ExternalAccount),
ManifestV1(SteamGuardAccount), ManifestV1(SteamGuardAccount),
} }
impl MigratingAccount { impl MigratingAccount {
pub fn upgrade(self) -> Self { pub fn upgrade(self) -> Self {
match self { match self {
Self::Sda(sda) => Self::ManifestV1(sda.into()), Self::External(account) => Self::ManifestV1(account.into()),
Self::ManifestV1(_) => self, Self::ManifestV1(_) => self,
} }
} }
@ -255,19 +262,65 @@ impl From<MigratingAccount> for SteamGuardAccount {
} }
} }
pub fn load_and_upgrade_sda_account(path: &Path) -> anyhow::Result<SteamGuardAccount> { pub fn load_and_upgrade_external_accounts(path: &Path) -> anyhow::Result<Vec<SteamGuardAccount>> {
let file = File::open(path)?; let mut file = File::open(path)?;
let account: SdaAccount = serde_json::from_reader(file)?; let mut buf = vec![];
let mut account = MigratingAccount::Sda(account); file.read_to_end(&mut buf)?;
let mut deser = serde_json::Deserializer::from_slice(&buf);
let accounts = match serde_path_to_error::deserialize(&mut deser) {
Ok(account) => {
vec![MigratingAccount::External(account)]
}
Err(json_err) => {
// the file is not JSON, so it's probably a winauth export
match parse_winauth_exports(buf) {
Ok(accounts) => accounts
.into_iter()
.map(MigratingAccount::External)
.collect(),
Err(winauth_err) => {
bail!(
"Failed to parse as JSON: {}\nFailed to parse as Winauth export: {}",
json_err,
winauth_err
)
}
}
}
};
Ok(accounts
.into_iter()
.map(|mut account| {
while !account.is_latest() { while !account.is_latest() {
account = account.upgrade(); account = account.upgrade();
} }
account.into()
})
.collect())
}
Ok(account.into()) #[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub(crate) enum ExternalAccount {
Sda(SdaAccount),
SteamMobileV2(SteamMobileV2),
}
impl From<ExternalAccount> for SteamGuardAccount {
fn from(account: ExternalAccount) -> Self {
match account {
ExternalAccount::Sda(account) => account.into(),
ExternalAccount::SteamMobileV2(account) => account.into(),
}
}
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use tempfile::TempDir;
use crate::{accountmanager::CURRENT_MANIFEST_VERSION, AccountManager}; use crate::{accountmanager::CURRENT_MANIFEST_VERSION, AccountManager};
use super::*; use super::*;
@ -308,6 +361,10 @@ mod tests {
manifest: "src/fixtures/maFiles/compat/difficult-migration/manifest.json", manifest: "src/fixtures/maFiles/compat/difficult-migration/manifest.json",
passkey: None, passkey: None,
}, },
Test {
manifest: "src/fixtures/maFiles/compat/missing-unnecessary/manifest.json",
passkey: None,
},
]; ];
for case in cases { for case in cases {
eprintln!("testing: {:?}", case); eprintln!("testing: {:?}", case);
@ -360,10 +417,26 @@ mod tests {
account_name: "example", account_name: "example",
steam_id: 1234, steam_id: 1234,
}, },
Test {
mafile: "src/fixtures/maFiles/compat/steamv2/sample.maFile",
account_name: "afarihm",
steam_id: 76561199441992970,
},
Test {
mafile: "src/fixtures/maFiles/compat/winauth/exports.txt",
account_name: "example",
steam_id: 1234,
},
Test {
mafile: "src/fixtures/maFiles/compat/missing-unnecessary/1234.maFile",
account_name: "example",
steam_id: 1234,
},
]; ];
for case in cases { for case in cases {
eprintln!("testing: {:?}", case); eprintln!("testing: {:?}", case);
let account = load_and_upgrade_sda_account(Path::new(case.mafile))?; let accounts = load_and_upgrade_external_accounts(Path::new(case.mafile))?;
let account = accounts[0].clone();
assert_eq!(account.account_name, case.account_name); assert_eq!(account.account_name, case.account_name);
assert_eq!(account.steam_id, case.steam_id); assert_eq!(account.steam_id, case.steam_id);
} }
@ -406,7 +479,7 @@ mod tests {
]; ];
for case in cases { for case in cases {
eprintln!("testing: {:?}", case); eprintln!("testing: {:?}", case);
let temp = tempdir::TempDir::new("steamguard-cli-test")?; let temp = TempDir::new()?;
for file in std::fs::read_dir(case.dir)? { for file in std::fs::read_dir(case.dir)? {
let file = file?; let file = file?;
let path = file.path(); let path = file.path();

View file

@ -0,0 +1,73 @@
use secrecy::SecretString;
use serde::{Deserialize, Deserializer};
use serde_json::Value;
use steamguard::{token::TwoFactorSecret, SteamGuardAccount};
use uuid::Uuid;
/// Defines the schema for loading steamguard accounts extracted from backups of the official Steam app (v2).
///
/// ```json
/// {
/// "steamid": "X",
/// "shared_secret": "X",
/// "serial_number": "X",
/// "revocation_code": "X",
/// "uri": "otpauth:\/\/totp\/Steam:USERNAME?secret=X&issuer=Steam",
/// "server_time": "X",
/// "account_name": "USERNAME",
/// "token_gid": "X",
/// "identity_secret": "X",
/// "secret_1": "X",
/// "status": 1,
/// "steamguard_scheme": "2"
/// }
/// ```
#[derive(Debug, Clone, Deserialize)]
pub struct SteamMobileV2 {
#[serde(deserialize_with = "de_parse_number")]
pub steamid: u64,
pub shared_secret: TwoFactorSecret,
pub serial_number: String,
#[serde(with = "crate::secret_string")]
pub revocation_code: SecretString,
#[serde(with = "crate::secret_string")]
pub uri: SecretString,
pub server_time: Option<serde_json::Value>,
pub account_name: String,
pub token_gid: String,
#[serde(with = "crate::secret_string")]
pub identity_secret: SecretString,
#[serde(with = "crate::secret_string")]
pub secret_1: SecretString,
pub status: Option<serde_json::Value>,
pub steamguard_scheme: Option<serde_json::Value>,
}
impl From<SteamMobileV2> for SteamGuardAccount {
fn from(account: SteamMobileV2) -> Self {
Self {
shared_secret: account.shared_secret,
identity_secret: account.identity_secret,
revocation_code: account.revocation_code,
uri: account.uri,
account_name: account.account_name,
token_gid: account.token_gid,
serial_number: account.serial_number,
steam_id: account.steamid,
// device_id is unknown, so we just make one up
device_id: format!("android:{}", Uuid::new_v4()),
secret_1: account.secret_1,
tokens: None,
}
}
}
fn de_parse_number<'de, D: Deserializer<'de>>(deserializer: D) -> Result<u64, D::Error> {
Ok(match Value::deserialize(deserializer)? {
Value::String(s) => s.parse().map_err(serde::de::Error::custom)?,
Value::Number(num) => num
.as_u64()
.ok_or(serde::de::Error::custom("Invalid number"))?,
_ => return Err(serde::de::Error::custom("wrong type")),
})
}

View file

@ -0,0 +1,50 @@
//! Accounts exported from Winauth are in the following format:
//!
//! One account per line, with each account represented as a URL.
//!
//! ```ignore
//! otpauth://totp/Steam:<steamaccountname>?secret=<ABCDEFG1234_secret_dunno_what_for>&digits=5&issuer=Steam&deviceid=<URL_Escaped_device_name>&data=<url_encoded_data_json>
//! ```
//!
//! The `data` field is a URL encoded JSON object with the following fields:
//!
//! ```json
//! {"steamid":"<steam_id>","status":1,"shared_secret":"<shared_secret>","serial_number":"<serial_number>","revocation_code":"<revocation_code>","uri":"<uri>","server_time":"<server_time>","account_name":"<steam_login_name>","token_gid":"<token_gid>","identity_secret":"<identity_secret>","secret_1":"<secret_1>","steamguard_scheme":"2"}
//! ```
use anyhow::Context;
use log::*;
use reqwest::Url;
use super::migrate::ExternalAccount;
pub(crate) fn parse_winauth_exports(buf: Vec<u8>) -> anyhow::Result<Vec<ExternalAccount>> {
let buf = String::from_utf8(buf)?;
let mut accounts = Vec::new();
for line in buf.split('\n') {
if line.is_empty() {
continue;
}
let url = Url::parse(line).context("parsing as winauth export URL")?;
let mut query = url.query_pairs();
let issuer = query
.find(|(key, _)| key == "issuer")
.context("missing issuer field")?
.1;
if issuer != "Steam" {
debug!("skipping non-Steam account: {}", issuer);
continue;
}
let data = query
.find(|(key, _)| key == "data")
.context("missing data field")?
.1;
trace!("data: {}", data);
let mut deser = serde_json::Deserializer::from_str(&data);
let account = serde_path_to_error::deserialize(&mut deser)?;
accounts.push(account);
}
Ok(accounts)
}

View file

@ -1,6 +1,6 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use clap::{clap_derive::ArgEnum, Parser}; use clap::{Parser, Subcommand, ValueEnum};
use clap_complete::Shell; use clap_complete::Shell;
use secrecy::SecretString; use secrecy::SecretString;
use std::str::FromStr; use std::str::FromStr;
@ -10,6 +10,7 @@ use crate::AccountManager;
pub mod code; pub mod code;
pub mod completions; pub mod completions;
pub mod confirm;
pub mod debug; pub mod debug;
pub mod decrypt; pub mod decrypt;
pub mod encrypt; pub mod encrypt;
@ -19,10 +20,10 @@ pub mod qr;
pub mod qr_login; pub mod qr_login;
pub mod remove; pub mod remove;
pub mod setup; pub mod setup;
pub mod trade;
pub use code::CodeCommand; pub use code::CodeCommand;
pub use completions::CompletionsCommand; pub use completions::CompletionsCommand;
pub use confirm::ConfirmCommand;
pub use debug::DebugCommand; pub use debug::DebugCommand;
pub use decrypt::DecryptCommand; pub use decrypt::DecryptCommand;
pub use encrypt::EncryptCommand; pub use encrypt::EncryptCommand;
@ -32,7 +33,6 @@ pub use qr::QrCommand;
pub use qr_login::QrLoginCommand; pub use qr_login::QrLoginCommand;
pub use remove::RemoveCommand; pub use remove::RemoveCommand;
pub use setup::SetupCommand; pub use setup::SetupCommand;
pub use trade::TradeCommand;
/// A command that does not operate on the manifest or individual accounts. /// A command that does not operate on the manifest or individual accounts.
pub(crate) trait ConstCommand { pub(crate) trait ConstCommand {
@ -44,7 +44,12 @@ pub(crate) trait ManifestCommand<T>
where where
T: Transport, T: Transport,
{ {
fn execute(&self, transport: T, manager: &mut AccountManager) -> anyhow::Result<()>; fn execute(
&self,
transport: T,
manager: &mut AccountManager,
args: &GlobalArgs,
) -> anyhow::Result<()>;
} }
/// A command that operates on individual accounts. /// A command that operates on individual accounts.
@ -57,6 +62,7 @@ where
transport: T, transport: T,
manager: &mut AccountManager, manager: &mut AccountManager,
accounts: Vec<Arc<Mutex<SteamGuardAccount>>>, accounts: Vec<Arc<Mutex<SteamGuardAccount>>>,
args: &GlobalArgs,
) -> anyhow::Result<()>; ) -> anyhow::Result<()>;
} }
@ -92,6 +98,13 @@ pub(crate) struct GlobalArgs {
long_help = "Select the account you want by steam username. Case-sensitive. By default, the first account in the manifest is selected." long_help = "Select the account you want by steam username. Case-sensitive. By default, the first account in the manifest is selected."
)] )]
pub username: Option<String>, pub username: Option<String>,
#[clap(
long,
conflicts_with = "all",
help = "Steam account password. You really shouldn't use this if you can avoid it.",
env = "STEAMGUARD_CLI_STEAM_PASSWORD"
)]
pub password: Option<SecretString>,
#[clap( #[clap(
short, short,
long, long,
@ -114,7 +127,7 @@ pub(crate) struct GlobalArgs {
help = "Specify your encryption passkey." help = "Specify your encryption passkey."
)] )]
pub passkey: Option<SecretString>, pub passkey: Option<SecretString>,
#[clap(short, long, arg_enum, default_value_t=Verbosity::Info, help = "Set the log level. Be warned, trace is capable of printing sensitive data.")] #[clap(short, long, value_enum, default_value_t=Verbosity::Info, help = "Set the log level. Be warned, trace is capable of printing sensitive data.")]
pub verbosity: Verbosity, pub verbosity: Verbosity,
#[cfg(feature = "updater")] #[cfg(feature = "updater")]
@ -147,13 +160,14 @@ pub(crate) struct GlobalArgs {
pub danger_accept_invalid_certs: bool, pub danger_accept_invalid_certs: bool,
} }
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Subcommand)]
pub(crate) enum Subcommands { pub(crate) enum Subcommands {
Debug(DebugCommand), Debug(DebugCommand),
Completion(CompletionsCommand), Completion(CompletionsCommand),
Setup(SetupCommand), Setup(SetupCommand),
Import(ImportCommand), Import(ImportCommand),
Trade(TradeCommand), #[clap(alias = "trade")]
Confirm(ConfirmCommand),
Remove(RemoveCommand), Remove(RemoveCommand),
Encrypt(EncryptCommand), Encrypt(EncryptCommand),
Decrypt(DecryptCommand), Decrypt(DecryptCommand),
@ -163,7 +177,7 @@ pub(crate) enum Subcommands {
QrLogin(QrLoginCommand), QrLogin(QrLoginCommand),
} }
#[derive(Debug, Clone, Copy, ArgEnum)] #[derive(Debug, Clone, Copy, ValueEnum)]
pub(crate) enum Verbosity { pub(crate) enum Verbosity {
Error = 0, Error = 0,
Warn = 1, Warn = 1,
@ -209,3 +223,14 @@ impl From<Args> for CodeCommand {
args.code args.code
} }
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn verify_cli() {
use clap::CommandFactory;
Args::command().debug_assert()
}
}

View file

@ -29,6 +29,7 @@ where
transport: T, transport: T,
_manager: &mut AccountManager, _manager: &mut AccountManager,
accounts: Vec<Arc<Mutex<SteamGuardAccount>>>, accounts: Vec<Arc<Mutex<SteamGuardAccount>>>,
_args: &GlobalArgs,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let server_time = if self.offline { let server_time = if self.offline {
SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs()

View file

@ -5,7 +5,12 @@ use super::*;
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Parser)]
#[clap(about = "Generate shell completions")] #[clap(about = "Generate shell completions")]
pub struct CompletionsCommand { pub struct CompletionsCommand {
#[clap(short, long, arg_enum, help = "The shell to generate completions for.")] #[clap(
short,
long,
value_enum,
help = "The shell to generate completions for."
)]
pub shell: Shell, pub shell: Shell,
} }

View file

@ -9,12 +9,12 @@ use crate::{tui, AccountManager};
use super::*; use super::*;
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Parser)]
#[clap(about = "Interactive interface for trade confirmations")] #[clap(about = "Interactive interface for steam mobile confirmations")]
pub struct TradeCommand { pub struct ConfirmCommand {
#[clap( #[clap(
short, short,
long, long,
help = "Accept all open trade confirmations. Does not open interactive interface." help = "Accept all open mobile confirmations. Does not open interactive interface."
)] )]
pub accept_all: bool, pub accept_all: bool,
#[clap( #[clap(
@ -25,7 +25,7 @@ pub struct TradeCommand {
pub fail_fast: bool, pub fail_fast: bool,
} }
impl<T> AccountCommand<T> for TradeCommand impl<T> AccountCommand<T> for ConfirmCommand
where where
T: Transport + Clone, T: Transport + Clone,
{ {
@ -34,31 +34,32 @@ where
transport: T, transport: T,
manager: &mut AccountManager, manager: &mut AccountManager,
accounts: Vec<Arc<Mutex<SteamGuardAccount>>>, accounts: Vec<Arc<Mutex<SteamGuardAccount>>>,
args: &GlobalArgs,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
for a in accounts { for a in accounts {
let mut account = a.lock().unwrap(); let mut account = a.lock().unwrap();
if !account.is_logged_in() { if !account.is_logged_in() {
info!("Account does not have tokens, logging in"); info!("Account does not have tokens, logging in");
crate::do_login(transport.clone(), &mut account)?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
} }
info!("{}: Checking for trade confirmations", account.account_name); info!("{}: Checking for confirmations", account.account_name);
let confirmations: Vec<Confirmation>; let confirmations: Vec<Confirmation>;
loop { loop {
let confirmer = Confirmer::new(transport.clone(), &account); let confirmer = Confirmer::new(transport.clone(), &account);
match confirmer.get_trade_confirmations() { match confirmer.get_confirmations() {
Ok(confs) => { Ok(confs) => {
confirmations = confs; confirmations = confs;
break; break;
} }
Err(ConfirmerError::InvalidTokens) => { Err(ConfirmerError::InvalidTokens) => {
info!("obtaining new tokens"); info!("obtaining new tokens");
crate::do_login(transport.clone(), &mut account)?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
} }
Err(err) => { Err(err) => {
error!("Failed to get trade confirmations: {}", err); error!("Failed to get confirmations: {}", err);
return Err(err.into()); return Err(err.into());
} }
} }

View file

@ -12,7 +12,12 @@ impl<T> ManifestCommand<T> for DecryptCommand
where where
T: Transport, T: Transport,
{ {
fn execute(&self, _transport: T, manager: &mut AccountManager) -> anyhow::Result<()> { fn execute(
&self,
_transport: T,
manager: &mut AccountManager,
_args: &GlobalArgs,
) -> anyhow::Result<()> {
load_accounts_with_prompts(manager)?; load_accounts_with_prompts(manager)?;
#[cfg(feature = "keyring")] #[cfg(feature = "keyring")]

View file

@ -16,7 +16,12 @@ impl<T> ManifestCommand<T> for EncryptCommand
where where
T: Transport, T: Transport,
{ {
fn execute(&self, _transport: T, manager: &mut AccountManager) -> anyhow::Result<()> { fn execute(
&self,
_transport: T,
manager: &mut AccountManager,
_args: &GlobalArgs,
) -> anyhow::Result<()> {
if !manager.has_passkey() { if !manager.has_passkey() {
let passkey: Option<SecretString>; let passkey: Option<SecretString>;
loop { loop {
@ -25,8 +30,7 @@ where
error!("Passkey cannot be empty, try again."); error!("Passkey cannot be empty, try again.");
continue; continue;
} }
let passkey_confirm = let passkey_confirm = rpassword::prompt_password("Confirm encryption passkey: ")
rpassword::prompt_password_stdout("Confirm encryption passkey: ")
.map(SecretString::new)?; .map(SecretString::new)?;
if passkey1.expose_secret() == passkey_confirm.expose_secret() { if passkey1.expose_secret() == passkey_confirm.expose_secret() {
passkey = Some(passkey1); passkey = Some(passkey1);

View file

@ -11,9 +11,6 @@ use super::*;
about = "Import an account with steamguard already set up. It must not be encrypted. If you haven't used steamguard-cli before, you probably don't need to use this command." about = "Import an account with steamguard already set up. It must not be encrypted. If you haven't used steamguard-cli before, you probably don't need to use this command."
)] )]
pub struct ImportCommand { pub struct ImportCommand {
#[clap(long, help = "Whether or not the provided maFiles are from SDA.")]
pub sda: bool,
#[clap(long, help = "Paths to one or more maFiles, eg. \"./gaben.maFile\"")] #[clap(long, help = "Paths to one or more maFiles, eg. \"./gaben.maFile\"")]
pub files: Vec<String>, pub files: Vec<String>,
} }
@ -22,15 +19,15 @@ impl<T> ManifestCommand<T> for ImportCommand
where where
T: Transport, T: Transport,
{ {
fn execute(&self, _transport: T, manager: &mut AccountManager) -> anyhow::Result<()> { fn execute(
&self,
_transport: T,
manager: &mut AccountManager,
_args: &GlobalArgs,
) -> anyhow::Result<()> {
let mut accounts_added = 0;
for file_path in self.files.iter() { for file_path in self.files.iter() {
debug!("loading entry: {:?}", file_path); debug!("loading entry: {:?}", file_path);
if self.sda {
let path = Path::new(&file_path);
let account = crate::accountmanager::migrate::load_and_upgrade_sda_account(path)?;
manager.add_account(account);
info!("Imported account: {}", &file_path);
} else {
match manager.import_account(file_path) { match manager.import_account(file_path) {
Ok(_) => { Ok(_) => {
info!("Imported account: {}", &file_path); info!("Imported account: {}", &file_path);
@ -38,15 +35,34 @@ where
Err(ManifestAccountImportError::AlreadyExists { .. }) => { Err(ManifestAccountImportError::AlreadyExists { .. }) => {
warn!("Account already exists: {} -- Ignoring", &file_path); warn!("Account already exists: {} -- Ignoring", &file_path);
} }
Err(ManifestAccountImportError::DeserializationFailed(err)) => { Err(ManifestAccountImportError::DeserializationFailed(orig_err)) => {
warn!("Failed to import account: {} {}", &file_path, err); debug!("Falling back to external account import",);
warn!("If this file came from SDA, try using --sda");
let path = Path::new(&file_path);
let accounts =
match crate::accountmanager::migrate::load_and_upgrade_external_accounts(
path,
) {
Ok(accounts) => accounts,
Err(err) => {
error!("Failed to import account: {} {}", &file_path, err);
error!("The original error was: {}", orig_err);
continue;
}
};
for account in accounts {
manager.add_account(account);
info!("Imported account: {}", &file_path);
accounts_added += 1;
}
} }
Err(err) => { Err(err) => {
bail!("Failed to import account: {} {}", &file_path, err); bail!("Failed to import account: {} {}", &file_path, err);
} }
} }
} }
if accounts_added > 0 {
info!("Imported {} accounts", accounts_added);
} }
manager.save()?; manager.save()?;

View file

@ -27,6 +27,7 @@ where
_transport: T, _transport: T,
_manager: &mut AccountManager, _manager: &mut AccountManager,
accounts: Vec<Arc<Mutex<SteamGuardAccount>>>, accounts: Vec<Arc<Mutex<SteamGuardAccount>>>,
_args: &GlobalArgs,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
use anyhow::Context; use anyhow::Context;

View file

@ -1,6 +1,10 @@
use std::sync::{Arc, Mutex}; use std::{
path::{Path, PathBuf},
sync::{Arc, Mutex},
};
use log::*; use log::*;
use rqrr::PreparedImage;
use steamguard::{QrApprover, QrApproverError}; use steamguard::{QrApprover, QrApproverError};
use crate::AccountManager; use crate::AccountManager;
@ -10,11 +14,8 @@ use super::*;
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Parser)]
#[clap(about = "Log in to Steam on another device using the QR code that it's displaying.")] #[clap(about = "Log in to Steam on another device using the QR code that it's displaying.")]
pub struct QrLoginCommand { pub struct QrLoginCommand {
#[clap( #[clap(flatten)]
long, login_url_source: LoginUrlSource,
help = "The URL that would normally open in the Steam app. This is the URL that the QR code is displaying. It should start with \"https://s.team/...\""
)]
pub url: String,
} }
impl<T> AccountCommand<T> for QrLoginCommand impl<T> AccountCommand<T> for QrLoginCommand
@ -26,6 +27,7 @@ where
transport: T, transport: T,
_manager: &mut AccountManager, _manager: &mut AccountManager,
accounts: Vec<Arc<Mutex<SteamGuardAccount>>>, accounts: Vec<Arc<Mutex<SteamGuardAccount>>>,
args: &GlobalArgs,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
ensure!( ensure!(
accounts.len() == 1, accounts.len() == 1,
@ -37,24 +39,29 @@ where
info!("Approving login to {}", account.account_name); info!("Approving login to {}", account.account_name);
if account.tokens.is_none() { if account.tokens.is_none() {
crate::do_login(transport.clone(), &mut account)?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
} }
let url = self.login_url_source.url()?;
debug!("Using login URL to approve: {}", url);
loop { loop {
let Some(tokens) = account.tokens.as_ref() else { let Some(tokens) = account.tokens.as_ref() else {
error!("No tokens found for {}. Can't approve login if we aren't logged in ourselves.", account.account_name); error!(
"No tokens found for {}. Can't approve login if we aren't logged in ourselves.",
account.account_name
);
return Err(anyhow!("No tokens found for {}", account.account_name)); return Err(anyhow!("No tokens found for {}", account.account_name));
}; };
let mut approver = QrApprover::new(transport.clone(), tokens); let mut approver = QrApprover::new(transport.clone(), tokens);
match approver.approve(&account, &self.url) { match approver.approve(&account, url.to_owned()) {
Ok(_) => { Ok(_) => {
info!("Login approved."); info!("Login approved.");
break; break;
} }
Err(QrApproverError::Unauthorized) => { Err(QrApproverError::Unauthorized) => {
warn!("tokens are invalid. Attempting to log in again."); warn!("tokens are invalid. Attempting to log in again.");
crate::do_login(transport.clone(), &mut account)?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
} }
Err(e) => { Err(e) => {
error!("Failed to approve login: {}", e); error!("Failed to approve login: {}", e);
@ -66,3 +73,56 @@ where
Ok(()) Ok(())
} }
} }
#[derive(Debug, Clone, clap::Args)]
#[group(required = true, multiple = false)]
pub struct LoginUrlSource {
/// The URL that would normally open in the Steam app. This is the URL that the QR code is displaying. It should start with \"https://s.team/...\"
#[clap(long)]
url: Option<String>,
/// Path to an image file containing the QR code. The QR code will be scanned from this image.
#[clap(long)]
image: Option<PathBuf>,
}
impl LoginUrlSource {
fn url(&self) -> anyhow::Result<String> {
match self {
Self { url: Some(url), .. } => Ok(url.clone()),
Self {
image: Some(path), ..
} => read_qr_image(path),
_ => Err(anyhow!(
"You must provide either a URL with --url or an image file with --image."
)),
}
}
}
fn read_qr_image(path: &Path) -> anyhow::Result<String> {
use image::io::Reader as ImageReader;
let image = ImageReader::open(path)?.decode()?.to_luma8();
let mut img = PreparedImage::prepare(image);
let grids = img.detect_grids();
for grid in grids {
let (_meta, text) = grid.decode()?;
// a rough validation that the QR code is a Steam login code
if text.contains("s.team") {
return Ok(text);
}
}
Err(anyhow!("No Steam login url found in the QR code"))
}
#[cfg(test)]
mod tests {
use super::*;
use std::path::Path;
#[test]
fn test_read_qr_image() {
let path = Path::new("src/fixtures/qr-codes/login-qr.png");
let url = read_qr_image(path).unwrap();
assert_eq!(url, "https://s.team/q/1/2372462679780599330");
}
}

View file

@ -1,7 +1,7 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use log::*; use log::*;
use steamguard::{steamapi::TwoFactorClient, transport::TransportError, RemoveAuthenticatorError}; use steamguard::{accountlinker::RemoveAuthenticatorError, transport::TransportError};
use crate::{errors::UserError, tui, AccountManager}; use crate::{errors::UserError, tui, AccountManager};
@ -20,6 +20,7 @@ where
transport: T, transport: T,
manager: &mut AccountManager, manager: &mut AccountManager,
accounts: Vec<Arc<Mutex<SteamGuardAccount>>>, accounts: Vec<Arc<Mutex<SteamGuardAccount>>>,
args: &GlobalArgs,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
eprintln!( eprintln!(
"This will remove the mobile authenticator from {} accounts: {}", "This will remove the mobile authenticator from {} accounts: {}",
@ -42,11 +43,10 @@ where
let mut successful = vec![]; let mut successful = vec![];
for a in accounts { for a in accounts {
let mut account = a.lock().unwrap(); let mut account = a.lock().unwrap();
let client = TwoFactorClient::new(transport.clone());
let mut revocation: Option<String> = None; let mut revocation: Option<String> = None;
loop { loop {
match account.remove_authenticator(&client, revocation.as_ref()) { match account.remove_authenticator(transport.clone(), revocation.as_ref()) {
Ok(_) => { Ok(_) => {
info!("Removed authenticator from {}", account.account_name); info!("Removed authenticator from {}", account.account_name);
successful.push(account.account_name.clone()); successful.push(account.account_name.clone());
@ -54,7 +54,7 @@ where
} }
Err(RemoveAuthenticatorError::TransportError(TransportError::Unauthorized)) => { Err(RemoveAuthenticatorError::TransportError(TransportError::Unauthorized)) => {
error!("Account {} is not logged in", account.account_name); error!("Account {} is not logged in", account.account_name);
crate::do_login(transport.clone(), &mut account)?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
continue; continue;
} }
Err(RemoveAuthenticatorError::IncorrectRevocationCode { Err(RemoveAuthenticatorError::IncorrectRevocationCode {
@ -68,17 +68,17 @@ where
error!("No attempts remaining, aborting!"); error!("No attempts remaining, aborting!");
break; break;
} }
eprint!("Enter the revocation code for {}: ", account.account_name); let code = tui::prompt_non_empty(format!(
let code = tui::prompt(); "Enter the revocation code for {}: ",
account.account_name
));
revocation = Some(code); revocation = Some(code);
} }
Err(RemoveAuthenticatorError::MissingRevocationCode) => { Err(RemoveAuthenticatorError::MissingRevocationCode) => {
error!( let code = tui::prompt_non_empty(format!(
"Account {} does not have a revocation code", "Enter the revocation code for {}: ",
account.account_name account.account_name
); ));
eprint!("Enter the revocation code for {}: ", account.account_name);
let code = tui::prompt();
revocation = Some(code); revocation = Some(code);
} }
Err(err) => { Err(err) => {
@ -93,7 +93,7 @@ where
} }
for account_name in successful { for account_name in successful {
manager.remove_account(account_name); manager.remove_account(&account_name);
} }
manager.save()?; manager.save()?;

View file

@ -2,8 +2,11 @@ use log::*;
use phonenumber::PhoneNumber; use phonenumber::PhoneNumber;
use secrecy::ExposeSecret; use secrecy::ExposeSecret;
use steamguard::{ use steamguard::{
accountlinker::AccountLinkSuccess, phonelinker::PhoneLinker, steamapi::PhoneClient, accountlinker::{AccountLinkConfirmType, AccountLinkSuccess, RemoveAuthenticatorError},
token::Tokens, AccountLinkError, AccountLinker, FinalizeLinkError, phonelinker::PhoneLinker,
steamapi::PhoneClient,
token::Tokens,
AccountLinkError, AccountLinker, FinalizeLinkError,
}; };
use crate::{tui, AccountManager}; use crate::{tui, AccountManager};
@ -18,7 +21,12 @@ impl<T> ManifestCommand<T> for SetupCommand
where where
T: Transport + Clone, T: Transport + Clone,
{ {
fn execute(&self, transport: T, manager: &mut AccountManager) -> anyhow::Result<()> { fn execute(
&self,
transport: T,
manager: &mut AccountManager,
args: &GlobalArgs,
) -> anyhow::Result<()> {
eprintln!("Log in to the account that you want to link to steamguard-cli"); eprintln!("Log in to the account that you want to link to steamguard-cli");
eprint!("Username: "); eprint!("Username: ");
let username = tui::prompt().to_lowercase(); let username = tui::prompt().to_lowercase();
@ -30,19 +38,18 @@ where
); );
} }
info!("Logging in to {}", username); info!("Logging in to {}", username);
let tokens = crate::do_login_raw(transport.clone(), username) let tokens = crate::do_login_raw(transport.clone(), username, args.password.clone())
.expect("Failed to log in. Account has not been linked."); .expect("Failed to log in. Account has not been linked.");
info!("Adding authenticator..."); info!("Adding authenticator...");
let mut linker = AccountLinker::new(transport.clone(), tokens); let mut linker = AccountLinker::new(transport.clone(), tokens);
let link: AccountLinkSuccess;
loop { loop {
match linker.link() { match linker.link() {
Ok(a) => { Ok(link) => {
link = a; return Self::add_new_account(link, manager, account_name, linker);
break;
} }
Err(AccountLinkError::MustProvidePhoneNumber) => { Err(AccountLinkError::MustProvidePhoneNumber) => {
// As of Dec 12, 2023, Steam no longer appears to require a phone number to add an authenticator. Keeping this code here just in case.
eprintln!("Looks like you don't have a phone number on this account."); eprintln!("Looks like you don't have a phone number on this account.");
do_add_phone_number(transport.clone(), linker.tokens())?; do_add_phone_number(transport.clone(), linker.tokens())?;
} }
@ -50,6 +57,49 @@ where
println!("Check your email and click the link."); println!("Check your email and click the link.");
tui::pause(); tui::pause();
} }
Err(AccountLinkError::AuthenticatorPresent) => {
eprintln!("It looks like there's already an authenticator on this account. If you want to link it to steamguard-cli, you'll need to remove it first. If you remove it using your revocation code (R#####), you'll get a 15 day trade ban.");
eprintln!("However, you can \"transfer\" the authenticator to steamguard-cli if you have access to the phone number associated with your account. This will cause you to get only a 2 day trade ban.");
eprintln!("If you were using SDA or WinAuth, you can import it into steamguard-cli with the `import` command, and have no trade ban.");
eprintln!("You can't have the same authenticator on steamguard-cli and the steam mobile app at the same time.");
eprintln!("\nHere are your options:");
eprintln!("[T] Transfer authenticator to steamguard-cli (2 day trade ban)");
eprintln!("[R] Revoke authenticator with revocation code (15 day trade ban)");
eprintln!("[A] Abort setup");
let answer = tui::prompt_char("What would you like to do?", "Tra");
match answer {
't' => return Self::transfer_new_account(linker, manager),
'r' => {
loop {
let revocation_code =
tui::prompt_non_empty("Enter your revocation code (R#####): ");
match linker.remove_authenticator(Some(&revocation_code)) {
Ok(_) => break,
Err(RemoveAuthenticatorError::IncorrectRevocationCode {
attempts_remaining,
}) => {
error!(
"Revocation code was incorrect ({} attempts remaining)",
attempts_remaining
);
if attempts_remaining == 0 {
error!("No attempts remaining, aborting!");
bail!("Failed to remove authenticator: no attempts remaining")
}
}
Err(err) => {
error!("Failed to remove authenticator: {}", err);
}
}
}
}
_ => {
info!("Aborting account linking.");
return Err(AccountLinkError::AuthenticatorPresent.into());
}
}
}
Err(err) => { Err(err) => {
error!( error!(
"Failed to link authenticator. Account has not been linked. {}", "Failed to link authenticator. Account has not been linked. {}",
@ -59,8 +109,23 @@ where
} }
} }
} }
}
}
impl SetupCommand {
/// Add a new account to the manifest after linking has started.
fn add_new_account<T>(
link: AccountLinkSuccess,
manager: &mut AccountManager,
account_name: String,
mut linker: AccountLinker<T>,
) -> Result<(), anyhow::Error>
where
T: Transport + Clone,
{
let mut server_time = link.server_time(); let mut server_time = link.server_time();
let phone_number_hint = link.phone_number_hint().to_owned(); let phone_number_hint = link.phone_number_hint().to_owned();
let confirm_type = link.confirm_type();
manager.add_account(link.into_account()); manager.add_account(link.into_account());
match manager.save() { match manager.save() {
Ok(_) => {} Ok(_) => {}
@ -73,25 +138,35 @@ where
return Err(err); return Err(err);
} }
} }
let account_arc = manager let account_arc = manager
.get_account(&account_name) .get_account(&account_name)
.expect("account was not present in manifest"); .expect("account was not present in manifest");
let mut account = account_arc.lock().unwrap(); let mut account = account_arc.lock().unwrap();
eprintln!("Authenticator has not yet been linked. Before continuing with finalization, please take the time to write down your revocation code: {}", account.revocation_code.expose_secret()); eprintln!("Authenticator has not yet been linked. Before continuing with finalization, please take the time to write down your revocation code: {}", account.revocation_code.expose_secret());
tui::pause(); tui::pause();
debug!("attempting link finalization"); debug!("attempting link finalization");
println!( let confirm_code = match confirm_type {
AccountLinkConfirmType::Email => {
eprintln!(
"A code has been sent to the email address associated with this account."
);
tui::prompt_non_empty("Enter email code: ")
}
AccountLinkConfirmType::SMS => {
eprintln!(
"A code has been sent to your phone number ending in {}.", "A code has been sent to your phone number ending in {}.",
phone_number_hint phone_number_hint
); );
print!("Enter SMS code: "); tui::prompt_non_empty("Enter SMS code: ")
let sms_code = tui::prompt(); }
AccountLinkConfirmType::Unknown(t) => {
error!("Unknown link confirm type: {}", t);
bail!("Unknown link confirm type: {}", t);
}
};
let mut tries = 0; let mut tries = 0;
loop { loop {
match linker.finalize(server_time, &mut account, sms_code.clone()) { match linker.finalize(server_time, &mut account, confirm_code.clone()) {
Ok(_) => break, Ok(_) => break,
Err(FinalizeLinkError::WantMore { server_time: s }) => { Err(FinalizeLinkError::WantMore { server_time: s }) => {
server_time = s; server_time = s;
@ -109,8 +184,20 @@ where
} }
} }
let revocation_code = account.revocation_code.clone(); let revocation_code = account.revocation_code.clone();
drop(account); // explicitly drop the lock so we don't hang on the mutex drop(account);
info!("Verifying authenticator status...");
let status =
linker.query_status(&manager.get_account(&account_name).unwrap().lock().unwrap())?;
if status.state() == 0 {
debug!(
"authenticator state: {} -- did not actually finalize",
status.state()
);
debug!("full status: {:#?}", status);
manager.remove_account(&account_name);
manager.save()?;
bail!("Authenticator finalization was unsuccessful. You may have entered the wrong confirm code in the previous step. Try again.");
}
info!("Authenticator finalized."); info!("Authenticator finalized.");
match manager.save() { match manager.save() {
Ok(_) => {} Ok(_) => {}
@ -122,12 +209,52 @@ where
return Err(err); return Err(err);
} }
} }
eprintln!( eprintln!(
"Authenticator has been finalized. Please actually write down your revocation code: {}", "Authenticator has been finalized. Please actually write down your revocation code: {}",
revocation_code.expose_secret() revocation_code.expose_secret()
); );
Ok(())
}
/// Transfer an existing authenticator to steamguard-cli.
fn transfer_new_account<T>(
mut linker: AccountLinker<T>,
manager: &mut AccountManager,
) -> anyhow::Result<()>
where
T: Transport + Clone,
{
info!("Transferring authenticator to steamguard-cli");
linker.transfer_start()?;
let account: SteamGuardAccount;
loop {
let sms_code = tui::prompt_non_empty("Enter SMS code: ");
match linker.transfer_finish(sms_code) {
Ok(acc) => {
account = acc;
break;
}
Err(err) => {
error!("Failed to transfer authenticator: {}", err);
}
}
}
info!("Transfer successful, adding account to manifest");
let revocation_code = account.revocation_code.clone();
eprintln!(
"Take a moment to write down your revocation code: {}",
revocation_code.expose_secret()
);
manager.add_account(account);
manager.save()?;
eprintln!(
"Make sure you have your revocation code written down: {}",
revocation_code.expose_secret()
);
Ok(()) Ok(())
} }
} }

View file

@ -0,0 +1 @@
{"shared_secret":"zvIayp3JPvtvX/QGHqsqKBk/44s=","serial_number":"kljasfhds","revocation_code":"R12345","uri":"otpauth://totp/Steam:example?secret=ASDF&issuer=Steam","account_name":"example","token_gid":"jkkjlhkhjgf","identity_secret":"kjsdlwowiqe=","secret_1":"sklduhfgsdlkjhf=","status":1,"device_id":"android:99d2ad0e-4bad-4247-b111-26393aae0be3","Session":{"SessionID":"a;lskdjf","SteamLogin":"983498437543","SteamLoginSecure":"dlkjdsl;j%7C%32984730298","WebCookie":";lkjsed;klfjas98093","OAuthToken":"asdk;lf;dsjlkfd","SteamID":1234}}

View file

@ -0,0 +1 @@
{"encrypted":false,"first_run":true,"entries":[{"encryption_iv":null,"encryption_salt":null,"filename":"1234.maFile","steamid":1234}],"periodic_checking":false,"periodic_checking_interval":5,"periodic_checking_checkall":false,"auto_confirm_market_transactions":false,"auto_confirm_trades":false}

View file

@ -0,0 +1,14 @@
{
"steamid": "76561199441992970",
"shared_secret": "kSJa7hfbr8IvReG9/1Ax13BhTJA=",
"serial_number": "5182004572898897156",
"revocation_code": "R52260",
"uri": "otpauth://totp/Steam:afarihm?secret=SERFV3QX3OX4EL2F4G676UBR25YGCTEQ&issuer=Steam",
"server_time": "123",
"account_name": "afarihm",
"token_gid": "2d5a1b6cdbbfa9cc",
"identity_secret": "f62XbJcml4r1j3NcFm0GGTtmcXw=",
"secret_1": "BEelQHBr74ahsgiJbGArNV62/Bs=",
"status": 1,
"steamguard_scheme": "2"
}

View file

@ -0,0 +1,2 @@
otpauth://totp/Steam:example?secret=ASDF&issuer=Steam&data=%7B%22shared%5Fsecret%22%3A%22zvIayp3JPvtvX%2FQGHqsqKBk%2F44s%3D%22%2C%22serial%5Fnumber%22%3A%22kljasfhds%22%2C%22revocation%5Fcode%22%3A%22R12345%22%2C%22uri%22%3A%22otpauth%3A%2F%2Ftotp%2FSteam%3Aexample%3Fsecret%3DASDF%26issuer%3DSteam%22%2C%22server%5Ftime%22%3A1602522478%2C%22account%5Fname%22%3A%22example%22%2C%22token%5Fgid%22%3A%22jkkjlhkhjgf%22%2C%22identity%5Fsecret%22%3A%22kjsdlwowiqe%3D%22%2C%22secret%5F1%22%3A%22sklduhfgsdlkjhf%3D%22%2C%22status%22%3A1%2C%22device%5Fid%22%3A%22android%3A99d2ad0e%2D4bad%2D4247%2Db111%2D26393aae0be3%22%2C%22fully%5Fenrolled%22%3Atrue%2C%22Session%22%3A%7B%22SessionID%22%3A%22a%3Blskdjf%22%2C%22SteamLogin%22%3A%22983498437543%22%2C%22SteamLoginSecure%22%3A%22dlkjdsl%3Bj%257C%2532984730298%22%2C%22WebCookie%22%3A%22%3Blkjsed%3Bklfjas98093%22%2C%22OAuthToken%22%3A%22asdk%3Blf%3Bdsjlkfd%22%2C%22SteamID%22%3A1234%7D%7D
otpauth://totp/Steam:example2?secret=ASDF&issuer=Steam&data=%7B%22shared%5Fsecret%22%3A%22zvIayp3JPvtvX%2FQGHqsqKBk%2F44s%3D%22%2C%22serial%5Fnumber%22%3A%22kljasfhds%22%2C%22revocation%5Fcode%22%3A%22R56789%22%2C%22uri%22%3A%22otpauth%3A%2F%2Ftotp%2FSteam%3Aexample%3Fsecret%3DASDF%26issuer%3DSteam%22%2C%22server%5Ftime%22%3A1602522478%2C%22account%5Fname%22%3A%22example2%22%2C%22token%5Fgid%22%3A%22jkkjlhkhjgf%22%2C%22identity%5Fsecret%22%3A%22kjsdlwowiqe%3D%22%2C%22secret%5F1%22%3A%22sklduhfgsdlkjhf%3D%22%2C%22status%22%3A1%2C%22device%5Fid%22%3A%22android%3A99d2ad0e%2D4bad%2D4247%2Db111%2D26393aae0be3%22%2C%22fully%5Fenrolled%22%3Atrue%2C%22Session%22%3A%7B%22SessionID%22%3A%22a%3Blskdjf%22%2C%22SteamLogin%22%3A%22983498437543%22%2C%22SteamLoginSecure%22%3A%22dlkjdsl%3Bj%257C%2532984730298%22%2C%22WebCookie%22%3A%22%3Blkjsed%3Bklfjas98093%22%2C%22OAuthToken%22%3A%22asdk%3Blf%3Bdsjlkfd%22%2C%22SteamID%22%3A5678%7D%7D

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -8,6 +8,7 @@ use steamguard::{
steamapi::{self, AuthenticationClient}, steamapi::{self, AuthenticationClient},
token::Tokens, token::Tokens,
transport::Transport, transport::Transport,
userlogin::UpdateAuthSessionError,
DeviceDetails, LoginError, SteamGuardAccount, UserLogin, DeviceDetails, LoginError, SteamGuardAccount, UserLogin,
}; };
@ -17,6 +18,7 @@ use crate::tui;
pub fn do_login<T: Transport + Clone>( pub fn do_login<T: Transport + Clone>(
transport: T, transport: T,
account: &mut SteamGuardAccount, account: &mut SteamGuardAccount,
password: Option<SecretString>,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
if let Some(tokens) = account.tokens.as_mut() { if let Some(tokens) = account.tokens.as_mut() {
info!("Refreshing access token..."); info!("Refreshing access token...");
@ -44,7 +46,11 @@ pub fn do_login<T: Transport + Clone>(
account.account_name = tui::prompt(); account.account_name = tui::prompt();
} }
let _ = std::io::stdout().flush(); let _ = std::io::stdout().flush();
let password = tui::prompt_password()?; let password = if let Some(p) = password {
p
} else {
tui::prompt_password()?
};
if !password.expose_secret().is_empty() { if !password.expose_secret().is_empty() {
debug!("password is present"); debug!("password is present");
} else { } else {
@ -65,9 +71,14 @@ pub fn do_login<T: Transport + Clone>(
pub fn do_login_raw<T: Transport + Clone>( pub fn do_login_raw<T: Transport + Clone>(
transport: T, transport: T,
username: String, username: String,
password: Option<SecretString>,
) -> anyhow::Result<Tokens> { ) -> anyhow::Result<Tokens> {
let _ = std::io::stdout().flush(); let _ = std::io::stdout().flush();
let password = tui::prompt_password()?; let password = if let Some(p) = password {
p
} else {
tui::prompt_password()?
};
if !password.expose_secret().is_empty() { if !password.expose_secret().is_empty() {
debug!("password is present"); debug!("password is present");
} else { } else {
@ -82,6 +93,7 @@ fn do_login_impl<T: Transport + Clone>(
password: SecretString, password: SecretString,
account: Option<&SteamGuardAccount>, account: Option<&SteamGuardAccount>,
) -> anyhow::Result<Tokens> { ) -> anyhow::Result<Tokens> {
debug!("starting login");
let mut login = UserLogin::new(transport.clone(), build_device_details()); let mut login = UserLogin::new(transport.clone(), build_device_details());
let mut password = password; let mut password = password;
@ -108,6 +120,12 @@ fn do_login_impl<T: Transport + Clone>(
} }
} }
debug!(
"got {} confirmation methods: {:#?}",
confirmation_methods.len(),
confirmation_methods
);
for method in confirmation_methods { for method in confirmation_methods {
match method.confirmation_type { match method.confirmation_type {
EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceConfirmation => { EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceConfirmation => {
@ -124,21 +142,52 @@ fn do_login_impl<T: Transport + Clone>(
eprintln!("Press enter when you have confirmed."); eprintln!("Press enter when you have confirmed.");
tui::pause(); tui::pause();
} }
EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceCode => { EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceCode
| EAuthSessionGuardType::k_EAuthSessionGuardType_EmailCode => {
let prompt = if method.confirmation_type
== EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceCode
{
"Enter the 2fa code from your device: "
} else {
"Enter the 2fa code sent to your email: "
};
let mut attempts = 0;
loop {
let code = if let Some(account) = account { let code = if let Some(account) = account {
debug!("Generating 2fa code..."); debug!("Generating 2fa code...");
let time = steamapi::get_server_time(transport)?.server_time(); let time = steamapi::get_server_time(transport.clone())?.server_time();
account.generate_code(time) account.generate_code(time)
} else { } else {
eprint!("Enter the 2fa code from your device: "); tui::prompt_non_empty(prompt).trim().to_owned()
tui::prompt().trim().to_owned()
}; };
login.submit_steam_guard_code(method.confirmation_type, code)?;
match login.submit_steam_guard_code(method.confirmation_type, code) {
Ok(_) => break,
Err(err) => {
error!("Failed to submit code: {}", err);
match err {
UpdateAuthSessionError::TooManyAttempts
| UpdateAuthSessionError::SessionExpired
| UpdateAuthSessionError::InvalidGuardType => {
error!("Error is unrecoverable. Aborting.");
return Err(err.into());
} }
EAuthSessionGuardType::k_EAuthSessionGuardType_EmailCode => { _ => {}
eprint!("Enter the 2fa code sent to your email: "); }
let code = tui::prompt().trim().to_owned(); attempts += 1;
login.submit_steam_guard_code(method.confirmation_type, code)?; debug!("Attempts: {}/3", attempts);
if attempts >= 3 {
error!("Too many failed attempts. Aborting.");
return Err(err.into());
}
}
}
}
}
EAuthSessionGuardType::k_EAuthSessionGuardType_None => {
debug!("No login confirmation required. Proceeding with login.");
continue;
} }
_ => { _ => {
warn!("Unknown confirmation method: {:?}", method); warn!("Unknown confirmation method: {:?}", method);

View file

@ -86,7 +86,7 @@ fn run(args: commands::Args) -> anyhow::Result<()> {
Subcommands::Import(args) => CommandType::Manifest(Box::new(args)), Subcommands::Import(args) => CommandType::Manifest(Box::new(args)),
Subcommands::Encrypt(args) => CommandType::Manifest(Box::new(args)), Subcommands::Encrypt(args) => CommandType::Manifest(Box::new(args)),
Subcommands::Decrypt(args) => CommandType::Manifest(Box::new(args)), Subcommands::Decrypt(args) => CommandType::Manifest(Box::new(args)),
Subcommands::Trade(args) => CommandType::Account(Box::new(args)), Subcommands::Confirm(args) => CommandType::Account(Box::new(args)),
Subcommands::Remove(args) => CommandType::Account(Box::new(args)), Subcommands::Remove(args) => CommandType::Account(Box::new(args)),
Subcommands::Code(args) => CommandType::Account(Box::new(args)), Subcommands::Code(args) => CommandType::Account(Box::new(args)),
#[cfg(feature = "qr")] #[cfg(feature = "qr")]
@ -232,7 +232,7 @@ fn run(args: commands::Args) -> anyhow::Result<()> {
let transport = WebApiTransport::new(http_client); let transport = WebApiTransport::new(http_client);
if let CommandType::Manifest(cmd) = cmd { if let CommandType::Manifest(cmd) = cmd {
cmd.execute(transport, &mut manager)?; cmd.execute(transport, &mut manager, &globalargs)?;
return Ok(()); return Ok(());
} }
@ -269,7 +269,7 @@ fn run(args: commands::Args) -> anyhow::Result<()> {
); );
if let CommandType::Account(cmd) = cmd { if let CommandType::Account(cmd) = cmd {
return cmd.execute(transport, &mut manager, selected_accounts); return cmd.execute(transport, &mut manager, selected_accounts, &globalargs);
} }
Ok(()) Ok(())

View file

@ -1,3 +1,4 @@
use anyhow::Context;
use crossterm::{ use crossterm::{
cursor, cursor,
event::{Event, KeyCode, KeyEvent, KeyModifiers}, event::{Event, KeyCode, KeyEvent, KeyModifiers},
@ -6,6 +7,7 @@ use crossterm::{
terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen}, terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen},
QueueableCommand, QueueableCommand,
}; };
use log::debug;
use secrecy::SecretString; use secrecy::SecretString;
use std::collections::HashSet; use std::collections::HashSet;
use std::io::{stderr, stdout, Write}; use std::io::{stderr, stdout, Write};
@ -32,9 +34,20 @@ pub(crate) fn prompt() -> String {
line line
} }
pub(crate) fn prompt_non_empty(prompt_text: impl AsRef<str>) -> String {
loop {
eprint!("{}", prompt_text.as_ref());
let input = prompt();
if !input.is_empty() {
return input;
}
}
}
/// Prompt the user for a single character response. Useful for asking yes or no questions. /// Prompt the user for a single character response. Useful for asking yes or no questions.
/// ///
/// `chars` should be all lowercase characters, with at most 1 uppercase character. The uppercase character is the default answer if no answer is provided. /// `chars` should be all lowercase characters, with at most 1 uppercase character. The uppercase character is the default answer if no answer is provided.
/// The selected character returned will always be lowercase.
pub(crate) fn prompt_char(text: &str, chars: &str) -> char { pub(crate) fn prompt_char(text: &str, chars: &str) -> char {
loop { loop {
let _ = stderr().queue(Print(format!("{} [{}] ", text, chars))); let _ = stderr().queue(Print(format!("{} [{}] ", text, chars)));
@ -46,10 +59,7 @@ pub(crate) fn prompt_char(text: &str, chars: &str) -> char {
} }
} }
fn prompt_char_impl<T>(input: T, chars: &str) -> anyhow::Result<char> fn prompt_char_impl(input: impl Into<String>, chars: &str) -> anyhow::Result<char> {
where
T: Into<String>,
{
let uppers = chars.replace(char::is_lowercase, ""); let uppers = chars.replace(char::is_lowercase, "");
if uppers.len() > 1 { if uppers.len() > 1 {
panic!("Invalid chars for prompt_char. Maximum 1 uppercase letter is allowed."); panic!("Invalid chars for prompt_char. Maximum 1 uppercase letter is allowed.");
@ -245,18 +255,21 @@ pub(crate) fn pause() {
} }
} }
pub(crate) fn prompt_passkey() -> std::io::Result<SecretString> { pub(crate) fn prompt_passkey() -> anyhow::Result<SecretString> {
debug!("prompting for passkey");
loop { loop {
let raw = rpassword::prompt_password_stdout("Enter encryption passkey: ")?; let raw = rpassword::prompt_password("Enter encryption passkey: ")
.context("prompting for passkey")?;
if !raw.is_empty() { if !raw.is_empty() {
return Ok(SecretString::new(raw)); return Ok(SecretString::new(raw));
} }
} }
} }
pub(crate) fn prompt_password() -> std::io::Result<SecretString> { pub(crate) fn prompt_password() -> anyhow::Result<SecretString> {
debug!("prompting for password");
loop { loop {
let raw = rpassword::prompt_password_stdout("Password: ")?; let raw = rpassword::prompt_password("Password: ").context("prompting for password")?;
if !raw.is_empty() { if !raw.is_empty() {
return Ok(SecretString::new(raw)); return Ok(SecretString::new(raw));
} }
@ -288,7 +301,7 @@ mod prompt_char_tests {
#[test] #[test]
fn test_should_not_give_invalid() { fn test_should_not_give_invalid() {
let answer = prompt_char_impl("g", "yn"); let answer = prompt_char_impl("g", "yn");
assert!(matches!(answer, Err(_))); assert!(answer.is_err());
let answer = prompt_char_impl("n", "yn").unwrap(); let answer = prompt_char_impl("n", "yn").unwrap();
assert_eq!(answer, 'n'); assert_eq!(answer, 'n');
} }
@ -296,6 +309,6 @@ mod prompt_char_tests {
#[test] #[test]
fn test_should_not_give_multichar() { fn test_should_not_give_multichar() {
let answer = prompt_char_impl("yy", "yn"); let answer = prompt_char_impl("yy", "yn");
assert!(matches!(answer, Err(_))); assert!(answer.is_err());
} }
} }

View file

@ -1,31 +1,34 @@
[package] [package]
name = "steamguard" name = "steamguard"
version = "0.10.3" version = "0.14.0"
authors = ["Carson McManus <carson.mcmanus1@gmail.com>"] authors = ["Carson McManus <carson.mcmanus1@gmail.com>"]
edition = "2018" edition = "2021"
description = "Library for generating 2fa codes for Steam and responding to mobile confirmations." description = "Library for generating 2fa codes for Steam and responding to mobile confirmations."
keywords = ["steam", "2fa", "steamguard", "authentication"] keywords = ["steam", "2fa", "steamguard", "authentication"]
repository = "https://github.com/dyc3/steamguard-cli/tree/master/steamguard" repository = "https://github.com/dyc3/steamguard-cli/tree/master/steamguard"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
anyhow = "^1.0" anyhow = "^1.0"
sha1 = "^0.10" sha1 = "^0.10"
base64 = "^0.21" base64 = "^0.22.1"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "cookies", "gzip", "rustls-tls", "multipart"] } reqwest = { version = "0.12", default-features = false, features = [
"blocking",
"json",
"cookies",
"gzip",
"rustls-tls",
"multipart",
] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
rsa = "0.9.2" rsa = "0.9.2"
rand = "0.8.4" rand = "0.8.4"
standback = "0.2.17" # required to fix a compilation error on a transient dependency cookie = "0.18"
cookie = "0.14"
regex = "1" regex = "1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
uuid = { version = "0.8", features = ["v4"] } uuid = { version = "1.8", features = ["v4"] }
log = "0.4.19" log = "0.4.19"
scraper = "0.12.0"
maplit = "1.0.2" maplit = "1.0.2"
thiserror = "1.0.26" thiserror = "1.0.26"
secrecy = { version = "0.8", features = ["serde"] } secrecy = { version = "0.8", features = ["serde"] }
@ -36,6 +39,7 @@ phonenumber = "0.3"
serde_path_to_error = "0.1.11" serde_path_to_error = "0.1.11"
hmac = "^0.12" hmac = "^0.12"
sha2 = "^0.10" sha2 = "^0.10"
num_enum = "0.7.2"
[build-dependencies] [build-dependencies]
anyhow = "^1.0" anyhow = "^1.0"

View file

@ -19,5 +19,3 @@ message CAuthentication_BeginAuthSessionViaCredentials_Request_BinaryGuardData {
optional uint32 language = 11; optional uint32 language = 11;
optional int32 qos_level = 12 [default = 2, (description) = "[ENetQOSLevel] client-specified priority for this auth attempt"]; optional int32 qos_level = 12 [default = 2, (description) = "[ENetQOSLevel] client-specified priority for this auth attempt"];
} }
message CTwoFactor_Time_Request {}

View file

@ -59,9 +59,10 @@ enum EPersonaStateFlag {
enum EContentCheckProvider { enum EContentCheckProvider {
k_EContentCheckProvider_Invalid = 0; k_EContentCheckProvider_Invalid = 0;
k_EContentCheckProvider_Google = 1; k_EContentCheckProvider_Google_DEPRECATED = 1;
k_EContentCheckProvider_Amazon = 2; k_EContentCheckProvider_Amazon = 2;
k_EContentCheckProvider_Local = 3; k_EContentCheckProvider_Local = 3;
k_EContentCheckProvider_GoogleVertexAI = 4;
} }
enum EProfileCustomizationType { enum EProfileCustomizationType {
@ -89,6 +90,7 @@ enum EProfileCustomizationType {
k_EProfileCustomizationTypeLoyaltyRewardReactions = 21; k_EProfileCustomizationTypeLoyaltyRewardReactions = 21;
k_EProfileCustomizationTypeSingleArtworkShowcase = 22; k_EProfileCustomizationTypeSingleArtworkShowcase = 22;
k_EProfileCustomizationTypeAchievementsCompletionist = 23; k_EProfileCustomizationTypeAchievementsCompletionist = 23;
k_EProfileCustomizationTypeReplay = 24;
} }
enum EPublishedFileStorageSystem { enum EPublishedFileStorageSystem {
@ -113,17 +115,32 @@ enum ESDCardFormatStage {
k_ESDCardFormatStage_Finalizing = 5; k_ESDCardFormatStage_Finalizing = 5;
} }
enum EStorageFormatStage {
k_EStorageFormatStage_Invalid = 0;
k_EStorageFormatStage_NotRunning = 1;
k_EStorageFormatStage_Starting = 2;
k_EStorageFormatStage_Testing = 3;
k_EStorageFormatStage_Rescuing = 4;
k_EStorageFormatStage_Formatting = 5;
k_EStorageFormatStage_Finalizing = 6;
}
enum ESystemFanControlMode { enum ESystemFanControlMode {
k_SystemFanControlMode_Invalid = 0; k_SystemFanControlMode_Invalid = 0;
k_SystemFanControlMode_Disabled = 1; k_SystemFanControlMode_Disabled = 1;
k_SystemFanControlMode_Default = 2; k_SystemFanControlMode_Default = 2;
} }
enum EColorProfile { enum EStartupMovieVariant {
k_EColorProfile_Invalid = 0; k_EStartupMovieVariant_Invalid = 0;
k_EColorProfile_Native = 1; k_EStartupMovieVariant_Default = 1;
k_EColorProfile_Standard = 2; k_EStartupMovieVariant_Orange = 2;
k_EColorProfile_Vivid = 3; }
enum EColorGamutLabelSet {
k_ColorGamutLabelSet_Default = 0;
k_ColorGamutLabelSet_sRGB_Native = 1;
k_ColorGamutLabelSet_Native_sRGB_Boosted = 2;
} }
enum EBluetoothDeviceType { enum EBluetoothDeviceType {
@ -206,6 +223,52 @@ enum EScalingFilter {
k_EScalingFilter_NIS = 5; k_EScalingFilter_NIS = 5;
} }
enum ESplitScalingFilter {
k_ESplitScalingFilter_Invalid = 0;
k_ESplitScalingFilter_Linear = 1;
k_ESplitScalingFilter_Nearest = 2;
k_ESplitScalingFilter_FSR = 3;
k_ESplitScalingFilter_NIS = 4;
}
enum ESplitScalingScaler {
k_ESplitScalingScaler_Invalid = 0;
k_ESplitScalingScaler_Auto = 1;
k_ESplitScalingScaler_Integer = 2;
k_ESplitScalingScaler_Fit = 3;
k_ESplitScalingScaler_Fill = 4;
k_ESplitScalingScaler_Stretch = 5;
}
enum EGamescopeBlurMode {
k_EGamescopeBlurMode_Disabled = 0;
k_EGamescopeBlurMode_IfOccluded = 1;
k_EGamescopeBlurMode_Always = 2;
}
enum ESLSHelper {
k_ESLSHelper_Invalid = 0;
k_ESLSHelper_Minidump = 1;
k_ESLSHelper_Kdump = 2;
k_ESLSHelper_Journal = 3;
k_ESLSHelper_Gpu = 4;
k_ESLSHelper_SystemInfo = 5;
}
enum EHDRVisualization {
k_EHDRVisualization_None = 0;
k_EHDRVisualization_Heatmap = 1;
k_EHDRVisualization_Analysis = 2;
k_EHDRVisualization_HeatmapExtended = 3;
k_EHDRVisualization_HeatmapClassic = 4;
}
enum EHDRToneMapOperator {
k_EHDRToneMapOperator_Invalid = 0;
k_EHDRToneMapOperator_Uncharted = 1;
k_EHDRToneMapOperator_Reinhard = 2;
}
enum ECPUGovernor { enum ECPUGovernor {
k_ECPUGovernor_Invalid = 0; k_ECPUGovernor_Invalid = 0;
k_ECPUGovernor_Perf = 1; k_ECPUGovernor_Perf = 1;
@ -249,6 +312,20 @@ enum EStorageBlockFileSystemType {
k_EStorageBlockFileSystemType_Ext4 = 3; k_EStorageBlockFileSystemType_Ext4 = 3;
} }
enum EStorageDriveMediaType {
k_EStorageDriveMediaType_Invalid = 0;
k_EStorageDriveMediaType_Unknown = 1;
k_EStorageDriveMediaType_HDD = 2;
k_EStorageDriveMediaType_SSD = 3;
k_EStorageDriveMediaType_Removable = 4;
}
enum ESystemDisplayCompatibilityMode {
k_ESystemDisplayCompatibilityMode_Invalid = 0;
k_ESystemDisplayCompatibilityMode_None = 1;
k_ESystemDisplayCompatibilityMode_MinimalBandwith = 2;
}
enum ESteamDeckCompatibilityCategory { enum ESteamDeckCompatibilityCategory {
k_ESteamDeckCompatibilityCategory_Unknown = 0; k_ESteamDeckCompatibilityCategory_Unknown = 0;
k_ESteamDeckCompatibilityCategory_Unsupported = 1; k_ESteamDeckCompatibilityCategory_Unsupported = 1;
@ -285,6 +362,7 @@ enum EOSBranch {
k_EOSBranch_Beta = 3; k_EOSBranch_Beta = 3;
k_EOSBranch_BetaCandidate = 4; k_EOSBranch_BetaCandidate = 4;
k_EOSBranch_Main = 5; k_EOSBranch_Main = 5;
k_EOSBranch_Staging = 6;
} }
enum ECommunityItemClass { enum ECommunityItemClass {
@ -305,6 +383,7 @@ enum ECommunityItemClass {
k_ECommunityItemClass_AvatarFrame = 14; k_ECommunityItemClass_AvatarFrame = 14;
k_ECommunityItemClass_AnimatedAvatar = 15; k_ECommunityItemClass_AnimatedAvatar = 15;
k_ECommunityItemClass_SteamDeckKeyboardSkin = 16; k_ECommunityItemClass_SteamDeckKeyboardSkin = 16;
k_ECommunityItemClass_SteamDeckStartupMovie = 17;
} }
enum ESteamDeckCompatibilityFeedback { enum ESteamDeckCompatibilityFeedback {
@ -342,3 +421,54 @@ enum ESessionPersistence {
k_ESessionPersistence_Ephemeral = 0; k_ESessionPersistence_Ephemeral = 0;
k_ESessionPersistence_Persistent = 1; k_ESessionPersistence_Persistent = 1;
} }
enum ENewSteamAnnouncementState {
k_ENewSteamAnnouncementState_Invalid = 0;
k_ENewSteamAnnouncementState_AllRead = 1;
k_ENewSteamAnnouncementState_NewAnnouncement = 2;
k_ENewSteamAnnouncementState_FeaturedAnnouncement = 3;
}
enum ECommentThreadType {
k_ECommentThreadTypeInvalid = 0;
k_ECommentThreadTypeScreenshot_Deprecated = 1;
k_ECommentThreadTypeWorkshopAccount_Developer = 2;
k_ECommentThreadTypeWorkshopAccount_Public = 3;
k_ECommentThreadTypePublishedFile_Developer = 4;
k_ECommentThreadTypePublishedFile_Public = 5;
k_ECommentThreadTypeTest = 6;
k_ECommentThreadTypeForumTopic = 7;
k_ECommentThreadTypeRecommendation = 8;
k_ECommentThreadTypeVideo_Deprecated = 9;
k_ECommentThreadTypeProfile = 10;
k_ECommentThreadTypeNewsPost = 11;
k_ECommentThreadTypeClan = 12;
k_ECommentThreadTypeClanAnnouncement = 13;
k_ECommentThreadTypeClanEvent = 14;
k_ECommentThreadTypeUserStatusPublished = 15;
k_ECommentThreadTypeUserReceivedNewGame = 16;
k_ECommentThreadTypePublishedFile_Announcement = 17;
k_ECommentThreadTypeModeratorMessage = 18;
k_ECommentThreadTypeClanCuratedApp = 19;
k_ECommentThreadTypeQAndASession = 20;
k_ECommentThreadTypeMax = 21;
}
enum EBroadcastPermission {
k_EBroadcastPermissionDisabled = 0;
k_EBroadcastPermissionFriendsApprove = 1;
k_EBroadcastPermissionFriendsAllowed = 2;
k_EBroadcastPermissionPublic = 3;
k_EBroadcastPermissionSubscribers = 4;
}
enum EBroadcastEncoderSetting {
k_EBroadcastEncoderBestQuality = 0;
k_EBroadcastEncoderBestPerformance = 1;
}
enum ECloudGamingPlatform {
k_ECloudGamingPlatformNone = 0;
k_ECloudGamingPlatformValve = 1;
k_ECloudGamingPlatformNVIDIA = 2;
}

View file

@ -38,20 +38,13 @@ message CTwoFactor_AddAuthenticator_Response {
optional bytes secret_1 = 9; optional bytes secret_1 = 9;
optional int32 status = 10; optional int32 status = 10;
optional string phone_number_hint = 11; optional string phone_number_hint = 11;
} optional int32 confirm_type = 12;
message CTwoFactor_CreateEmergencyCodes_Request {
optional string code = 1;
} }
message CTwoFactor_CreateEmergencyCodes_Response { message CTwoFactor_CreateEmergencyCodes_Response {
repeated string codes = 1; repeated string codes = 1;
} }
message CTwoFactor_DestroyEmergencyCodes_Request {
optional fixed64 steamid = 1;
}
message CTwoFactor_DestroyEmergencyCodes_Response { message CTwoFactor_DestroyEmergencyCodes_Response {
} }
@ -132,6 +125,10 @@ message CTwoFactor_Status_Response {
optional uint32 version = 14; optional uint32 version = 14;
} }
message CTwoFactor_Time_Request {
optional uint64 sender_time = 1;
}
message CTwoFactor_Time_Response { message CTwoFactor_Time_Response {
optional uint64 server_time = 1; optional uint64 server_time = 1;
optional uint64 skew_tolerance_seconds = 2; optional uint64 skew_tolerance_seconds = 2;
@ -153,25 +150,21 @@ message CTwoFactor_UpdateTokenVersion_Request {
message CTwoFactor_UpdateTokenVersion_Response { message CTwoFactor_UpdateTokenVersion_Response {
} }
message CTwoFactor_ValidateToken_Request {
optional string code = 1;
}
message CTwoFactor_ValidateToken_Response { message CTwoFactor_ValidateToken_Response {
optional bool valid = 1; optional bool valid = 1;
} }
service TwoFactor { service TwoFactor {
rpc AddAuthenticator (.CTwoFactor_AddAuthenticator_Request) returns (.CTwoFactor_AddAuthenticator_Response); rpc AddAuthenticator (.CTwoFactor_AddAuthenticator_Request) returns (.CTwoFactor_AddAuthenticator_Response);
rpc CreateEmergencyCodes (.CTwoFactor_CreateEmergencyCodes_Request) returns (.CTwoFactor_CreateEmergencyCodes_Response); rpc CreateEmergencyCodes (.NotImplemented) returns (.CTwoFactor_CreateEmergencyCodes_Response);
rpc DestroyEmergencyCodes (.CTwoFactor_DestroyEmergencyCodes_Request) returns (.CTwoFactor_DestroyEmergencyCodes_Response); rpc DestroyEmergencyCodes (.NotImplemented) returns (.CTwoFactor_DestroyEmergencyCodes_Response);
rpc FinalizeAddAuthenticator (.CTwoFactor_FinalizeAddAuthenticator_Request) returns (.CTwoFactor_FinalizeAddAuthenticator_Response); rpc FinalizeAddAuthenticator (.CTwoFactor_FinalizeAddAuthenticator_Request) returns (.CTwoFactor_FinalizeAddAuthenticator_Response);
rpc QueryStatus (.CTwoFactor_Status_Request) returns (.CTwoFactor_Status_Response); rpc QueryStatus (.CTwoFactor_Status_Request) returns (.CTwoFactor_Status_Response);
rpc QueryTime (.NotImplemented) returns (.CTwoFactor_Time_Response); rpc QueryTime (.CTwoFactor_Time_Request) returns (.CTwoFactor_Time_Response);
rpc RemoveAuthenticator (.CTwoFactor_RemoveAuthenticator_Request) returns (.CTwoFactor_RemoveAuthenticator_Response); rpc RemoveAuthenticator (.CTwoFactor_RemoveAuthenticator_Request) returns (.CTwoFactor_RemoveAuthenticator_Response);
rpc RemoveAuthenticatorViaChallengeContinue (.CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request) returns (.CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Response); rpc RemoveAuthenticatorViaChallengeContinue (.CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request) returns (.CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Response);
rpc RemoveAuthenticatorViaChallengeStart (.CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request) returns (.CTwoFactor_RemoveAuthenticatorViaChallengeStart_Response); rpc RemoveAuthenticatorViaChallengeStart (.CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request) returns (.CTwoFactor_RemoveAuthenticatorViaChallengeStart_Response);
rpc SendEmail (.CTwoFactor_SendEmail_Request) returns (.CTwoFactor_SendEmail_Response); rpc SendEmail (.CTwoFactor_SendEmail_Request) returns (.CTwoFactor_SendEmail_Response);
rpc UpdateTokenVersion (.CTwoFactor_UpdateTokenVersion_Request) returns (.CTwoFactor_UpdateTokenVersion_Response); rpc UpdateTokenVersion (.CTwoFactor_UpdateTokenVersion_Request) returns (.CTwoFactor_UpdateTokenVersion_Response);
rpc ValidateToken (.CTwoFactor_ValidateToken_Request) returns (.CTwoFactor_ValidateToken_Response); rpc ValidateToken (.NotImplemented) returns (.CTwoFactor_ValidateToken_Response);
} }

View file

@ -28,12 +28,20 @@ enum EAuthSessionSecurityHistory {
k_EAuthSessionSecurityHistory_NoPriorHistory = 2; k_EAuthSessionSecurityHistory_NoPriorHistory = 2;
} }
enum ETokenRenewalType {
k_ETokenRenewalType_None = 0;
k_ETokenRenewalType_Allow = 1;
}
enum EAuthTokenRevokeAction { enum EAuthTokenRevokeAction {
k_EAuthTokenRevokeLogout = 0; k_EAuthTokenRevokeLogout = 0;
k_EAuthTokenRevokePermanent = 1; k_EAuthTokenRevokePermanent = 1;
k_EAuthTokenRevokeReplaced = 2; k_EAuthTokenRevokeReplaced = 2;
k_EAuthTokenRevokeSupport = 3; k_EAuthTokenRevokeSupport = 3;
k_EAuthTokenRevokeConsume = 4; k_EAuthTokenRevokeConsume = 4;
k_EAuthTokenRevokeNonRememberedLogout = 5;
k_EAuthTokenRevokeNonRememberedPermanent = 6;
k_EAuthTokenRevokeAutomatic = 7;
} }
enum EAuthTokenState { enum EAuthTokenState {
@ -62,6 +70,8 @@ message CAuthentication_DeviceDetails {
optional .EAuthTokenPlatformType platform_type = 2 [default = k_EAuthTokenPlatformType_Unknown, (description) = "EAuthTokenPlatformType, claimed, of device"]; optional .EAuthTokenPlatformType platform_type = 2 [default = k_EAuthTokenPlatformType_Unknown, (description) = "EAuthTokenPlatformType, claimed, of device"];
optional int32 os_type = 3 [(description) = "EOSType, claimed, of authorized device"]; optional int32 os_type = 3 [(description) = "EOSType, claimed, of authorized device"];
optional uint32 gaming_device_type = 4 [(description) = "EGamingDeviceType, claimed, of authorized device for steam client-type devices"]; optional uint32 gaming_device_type = 4 [(description) = "EGamingDeviceType, claimed, of authorized device for steam client-type devices"];
optional uint32 client_count = 5 [(description) = "For desktop clients, quantized number of users in history"];
optional bytes machine_id = 6 [(description) = "Additional device context"];
} }
message CAuthentication_BeginAuthSessionViaQR_Request { message CAuthentication_BeginAuthSessionViaQR_Request {
@ -173,10 +183,12 @@ message CAuthentication_UpdateAuthSessionWithSteamGuardCode_Response {
message CAuthentication_AccessToken_GenerateForApp_Request { message CAuthentication_AccessToken_GenerateForApp_Request {
optional string refresh_token = 1; optional string refresh_token = 1;
optional fixed64 steamid = 2; optional fixed64 steamid = 2;
optional .ETokenRenewalType renewal_type = 3 [default = k_ETokenRenewalType_None];
} }
message CAuthentication_AccessToken_GenerateForApp_Response { message CAuthentication_AccessToken_GenerateForApp_Response {
optional string access_token = 1; optional string access_token = 1;
optional string refresh_token = 2;
} }
message CAuthentication_RefreshToken_Enumerate_Request { message CAuthentication_RefreshToken_Enumerate_Request {
@ -228,6 +240,14 @@ message CAuthentication_MigrateMobileSession_Response {
optional string access_token = 2; optional string access_token = 2;
} }
message CAuthentication_Token_Revoke_Request {
optional string token = 1;
optional .EAuthTokenRevokeAction revoke_action = 2 [default = k_EAuthTokenRevokePermanent, (description) = "Select between logout and logout-and-forget-machine"];
}
message CAuthentication_Token_Revoke_Response {
}
message CAuthentication_RefreshToken_Revoke_Request { message CAuthentication_RefreshToken_Revoke_Request {
optional fixed64 token_id = 1; optional fixed64 token_id = 1;
optional fixed64 steamid = 2 [(description) = "Token holder if an admin action on behalf of another user"]; optional fixed64 steamid = 2 [(description) = "Token holder if an admin action on behalf of another user"];
@ -373,6 +393,10 @@ service Authentication {
option (method_description) = "Migrates a WG token to an access and refresh token using a signature generated with the user's 2FA secret"; option (method_description) = "Migrates a WG token to an access and refresh token using a signature generated with the user's 2FA secret";
} }
rpc RevokeToken (.CAuthentication_Token_Revoke_Request) returns (.CAuthentication_Token_Revoke_Response) {
option (method_description) = "Revoke a single token immediately, making it unable to renew or generate new access tokens";
}
rpc RevokeRefreshToken (.CAuthentication_RefreshToken_Revoke_Request) returns (.CAuthentication_RefreshToken_Revoke_Response) { rpc RevokeRefreshToken (.CAuthentication_RefreshToken_Revoke_Request) returns (.CAuthentication_RefreshToken_Revoke_Response) {
option (method_description) = "Mark the given refresh token as revoked"; option (method_description) = "Mark the given refresh token as revoked";
} }

View file

@ -92,6 +92,11 @@ message CMsgGCRoutingProtoBufHeader {
} }
message CMsgProtoBufHeader { message CMsgProtoBufHeader {
enum ESessionDisposition {
k_ESessionDispositionNormal = 0;
k_ESessionDispositionDisconnect = 1;
}
optional fixed64 steamid = 1; optional fixed64 steamid = 1;
optional int32 client_sessionid = 2; optional int32 client_sessionid = 2;
optional uint32 routing_appid = 3; optional uint32 routing_appid = 3;
@ -120,6 +125,10 @@ message CMsgProtoBufHeader {
optional uint32 debug_source_string_index = 35; optional uint32 debug_source_string_index = 35;
optional uint64 token_id = 36; optional uint64 token_id = 36;
optional .CMsgGCRoutingProtoBufHeader routing_gc = 37; optional .CMsgGCRoutingProtoBufHeader routing_gc = 37;
optional .CMsgProtoBufHeader.ESessionDisposition session_disposition = 38 [default = k_ESessionDispositionNormal];
optional string wg_token = 39;
optional string webui_auth_key = 40;
repeated int32 exclude_client_sessionids = 41;
oneof ip_addr { oneof ip_addr {
uint32 ip = 15; uint32 ip = 15;
@ -145,6 +154,7 @@ message CMsgAuthTicket {
optional uint32 ticket_crc = 6; optional uint32 ticket_crc = 6;
optional bytes ticket = 7; optional bytes ticket = 7;
optional bytes server_secret = 8; optional bytes server_secret = 8;
optional uint32 ticket_type = 9;
} }
message CCDDBAppDetailCommon { message CCDDBAppDetailCommon {
@ -302,6 +312,8 @@ message CPackageReservationStatus {
optional bool expired = 6; optional bool expired = 6;
optional uint32 time_expires = 7; optional uint32 time_expires = 7;
optional uint32 time_reserved = 8; optional uint32 time_reserved = 8;
optional uint32 rtime_estimated_notification = 9;
optional string notificaton_token = 10;
} }
message CMsgKeyValuePair { message CMsgKeyValuePair {
@ -312,3 +324,12 @@ message CMsgKeyValuePair {
message CMsgKeyValueSet { message CMsgKeyValueSet {
repeated .CMsgKeyValuePair pairs = 1; repeated .CMsgKeyValuePair pairs = 1;
} }
message UserContentDescriptorPreferences {
message ContentDescriptor {
optional uint32 content_descriptorid = 1;
optional uint32 timestamp_added = 2;
}
repeated .UserContentDescriptorPreferences.ContentDescriptor content_descriptors_to_exclude = 1;
}

View file

@ -99,11 +99,11 @@ message CMsgClientLogonResponse {
optional string email_domain = 8; optional string email_domain = 8;
optional bytes steam2_ticket = 9; optional bytes steam2_ticket = 9;
optional int32 eresult_extended = 10; optional int32 eresult_extended = 10;
optional string webapi_authenticate_user_nonce = 11;
optional uint32 cell_id_ping_threshold = 12; optional uint32 cell_id_ping_threshold = 12;
optional bool deprecated_use_pics = 13; optional bool deprecated_use_pics = 13;
optional string vanity_url = 14; optional string vanity_url = 14;
optional .CMsgIPAddress public_ip = 15; optional .CMsgIPAddress public_ip = 15;
optional string user_country = 16;
optional fixed64 client_supplied_steamid = 20; optional fixed64 client_supplied_steamid = 20;
optional string ip_country_code = 21; optional string ip_country_code = 21;
optional bytes parental_settings = 22; optional bytes parental_settings = 22;

View file

@ -1,9 +1,12 @@
use crate::protobufs::service_twofactor::{ use crate::protobufs::service_twofactor::{
CTwoFactor_AddAuthenticator_Request, CTwoFactor_FinalizeAddAuthenticator_Request, CTwoFactor_AddAuthenticator_Request, CTwoFactor_FinalizeAddAuthenticator_Request,
CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request,
CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request,
CTwoFactor_RemoveAuthenticator_Request, CTwoFactor_Status_Request, CTwoFactor_Status_Response,
}; };
use crate::steamapi::twofactor::TwoFactorClient; use crate::steamapi::twofactor::TwoFactorClient;
use crate::token::TwoFactorSecret; use crate::token::TwoFactorSecret;
use crate::transport::Transport; use crate::transport::{Transport, TransportError};
use crate::{steamapi::EResult, token::Tokens, SteamGuardAccount}; use crate::{steamapi::EResult, token::Tokens, SteamGuardAccount};
use anyhow::Context; use anyhow::Context;
use base64::Engine; use base64::Engine;
@ -85,6 +88,7 @@ where
account, account,
server_time: resp.server_time(), server_time: resp.server_time(),
phone_number_hint: resp.take_phone_number_hint(), phone_number_hint: resp.take_phone_number_hint(),
confirm_type: resp.confirm_type().into(),
}; };
Ok(success) Ok(success)
} }
@ -94,7 +98,7 @@ where
&mut self, &mut self,
time: u64, time: u64,
account: &mut SteamGuardAccount, account: &mut SteamGuardAccount,
sms_code: String, confirm_code: String,
) -> anyhow::Result<(), FinalizeLinkError> { ) -> anyhow::Result<(), FinalizeLinkError> {
let code = account.generate_code(time); let code = account.generate_code(time);
@ -105,7 +109,8 @@ where
req.set_steamid(steam_id); req.set_steamid(steam_id);
req.set_authenticator_code(code); req.set_authenticator_code(code);
req.set_authenticator_time(time); req.set_authenticator_time(time);
req.set_activation_code(sms_code); req.set_activation_code(confirm_code);
req.set_validate_sms_code(true);
let resp = self.client.finalize_authenticator(req, token)?; let resp = self.client.finalize_authenticator(req, token)?;
@ -124,6 +129,105 @@ where
self.finalized = true; self.finalized = true;
Ok(()) Ok(())
} }
pub fn query_status(
&self,
account: &SteamGuardAccount,
) -> anyhow::Result<CTwoFactor_Status_Response> {
let mut req = CTwoFactor_Status_Request::new();
req.set_steamid(account.steam_id);
let resp = self.client.query_status(req, self.tokens.access_token())?;
Ok(resp.into_response_data())
}
pub fn remove_authenticator(
&self,
revocation_code: Option<&String>,
) -> Result<(), RemoveAuthenticatorError> {
let Some(revocation_code) = revocation_code else {
return Err(RemoveAuthenticatorError::MissingRevocationCode);
};
if revocation_code.is_empty() {
return Err(RemoveAuthenticatorError::MissingRevocationCode);
}
let mut req = CTwoFactor_RemoveAuthenticator_Request::new();
req.set_revocation_code(revocation_code.clone());
let resp = self
.client
.remove_authenticator(req, self.tokens.access_token())?;
// returns EResult::TwoFactorCodeMismatch if the revocation code is incorrect
if resp.result != EResult::OK && resp.result != EResult::TwoFactorCodeMismatch {
return Err(resp.result.into());
}
let resp = resp.into_response_data();
if !resp.success() {
return Err(RemoveAuthenticatorError::IncorrectRevocationCode {
attempts_remaining: resp.revocation_attempts_remaining(),
});
}
Ok(())
}
/// Begin the process of "transfering" a mobile authenticator from a different device to this device.
///
/// "Transfering" does not actually literally transfer the secrets from one device to another. Instead, it generates a new set of secrets on this device, and invalidates the old secrets on the other device. Call [`Self::transfer_finish`] to complete the process.
pub fn transfer_start(&mut self) -> Result<(), TransferError> {
let req = CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request::new();
let resp = self
.client
.remove_authenticator_via_challenge_start(req, self.tokens().access_token())?;
if resp.result != EResult::OK {
return Err(resp.result.into());
}
// the success field in the response is always None, so we can't check that
// it appears to not be used at all
Ok(())
}
/// Completes the process of "transfering" a mobile authenticator from a different device to this device.
pub fn transfer_finish(
&mut self,
sms_code: impl AsRef<str>,
) -> Result<SteamGuardAccount, TransferError> {
let access_token = self.tokens.access_token();
let steam_id = access_token
.decode()
.context("decoding access token")?
.steam_id();
let mut req = CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request::new();
req.set_sms_code(sms_code.as_ref().to_owned());
req.set_generate_new_token(true);
let resp = self
.client
.remove_authenticator_via_challenge_continue(req, access_token)?;
if resp.result != EResult::OK {
return Err(resp.result.into());
}
let resp = resp.into_response_data();
let mut resp = resp.replacement_token.clone().unwrap();
let account = SteamGuardAccount {
account_name: resp.take_account_name(),
steam_id,
serial_number: resp.serial_number().to_string(),
revocation_code: resp.take_revocation_code().into(),
uri: resp.take_uri().into(),
shared_secret: TwoFactorSecret::from_bytes(resp.take_shared_secret()),
token_gid: resp.take_token_gid(),
identity_secret: base64::engine::general_purpose::STANDARD
.encode(resp.take_identity_secret())
.into(),
device_id: self.device_id.clone(),
secret_1: base64::engine::general_purpose::STANDARD
.encode(resp.take_secret_1())
.into(),
tokens: Some(self.tokens.clone()),
};
Ok(account)
}
} }
#[derive(Debug)] #[derive(Debug)]
@ -131,6 +235,7 @@ pub struct AccountLinkSuccess {
account: SteamGuardAccount, account: SteamGuardAccount,
server_time: u64, server_time: u64,
phone_number_hint: String, phone_number_hint: String,
confirm_type: AccountLinkConfirmType,
} }
impl AccountLinkSuccess { impl AccountLinkSuccess {
@ -149,6 +254,28 @@ impl AccountLinkSuccess {
pub fn phone_number_hint(&self) -> &str { pub fn phone_number_hint(&self) -> &str {
&self.phone_number_hint &self.phone_number_hint
} }
pub fn confirm_type(&self) -> AccountLinkConfirmType {
self.confirm_type
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum AccountLinkConfirmType {
SMS = 1,
Email = 3,
Unknown(i32),
}
impl From<i32> for AccountLinkConfirmType {
fn from(i: i32) -> Self {
match i {
1 => AccountLinkConfirmType::SMS,
3 => AccountLinkConfirmType::Email,
_ => AccountLinkConfirmType::Unknown(i),
}
}
} }
fn generate_device_id() -> String { fn generate_device_id() -> String {
@ -212,3 +339,44 @@ impl From<EResult> for FinalizeLinkError {
} }
} }
} }
#[derive(Debug, thiserror::Error)]
pub enum RemoveAuthenticatorError {
#[error("Missing revocation code")]
MissingRevocationCode,
#[error("Incorrect revocation code, {attempts_remaining} attempts remaining")]
IncorrectRevocationCode { attempts_remaining: u32 },
#[error("Transport error: {0}")]
TransportError(#[from] TransportError),
#[error("Steam returned an enexpected result: {0:?}")]
UnknownEResult(EResult),
#[error("Unexpected error: {0}")]
Unknown(#[from] anyhow::Error),
}
impl From<EResult> for RemoveAuthenticatorError {
fn from(e: EResult) -> Self {
Self::UnknownEResult(e)
}
}
#[derive(Error, Debug)]
pub enum TransferError {
#[error("Provided SMS code was incorrect.")]
BadSmsCode,
#[error("Failed to send request to Steam: {0:?}")]
Transport(#[from] crate::transport::TransportError),
#[error("Steam returned an unexpected error code: {0:?}")]
UnknownEResult(EResult),
#[error(transparent)]
Unknown(#[from] anyhow::Error),
}
impl From<EResult> for TransferError {
fn from(result: EResult) -> Self {
match result {
EResult::SMSCodeFailed => TransferError::BadSmsCode,
r => TransferError::UnknownEResult(r),
}
}
}

View file

@ -1,6 +1,7 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
#[allow(dead_code)]
pub struct OAuthData { pub struct OAuthData {
pub oauth_token: String, pub oauth_token: String,
pub steamid: String, pub steamid: String,

View file

@ -3,5 +3,3 @@ mod login;
mod phone_ajax; mod phone_ajax;
pub use i_authentication_service::*; pub use i_authentication_service::*;
pub use login::*;
pub use phone_ajax::*;

View file

@ -82,7 +82,7 @@ where
cookies cookies
} }
pub fn get_trade_confirmations(&self) -> Result<Vec<Confirmation>, ConfirmerError> { pub fn get_confirmations(&self) -> Result<Vec<Confirmation>, ConfirmerError> {
let cookies = self.build_cookie_jar(); let cookies = self.build_cookie_jar();
let client = self.transport.innner_http_client()?; let client = self.transport.innner_http_client()?;
@ -109,7 +109,11 @@ where
return Err(ConfirmerError::InvalidTokens); return Err(ConfirmerError::InvalidTokens);
} }
if !body.success { if !body.success {
return Err(anyhow!("Server responded with failure.").into()); if let Some(msg) = body.message {
return Err(ConfirmerError::RemoteFailureWithMessage(msg));
} else {
return Err(ConfirmerError::RemoteFailure);
}
} }
Ok(body.conf) Ok(body.conf)
} }
@ -162,7 +166,11 @@ where
return Err(ConfirmerError::InvalidTokens); return Err(ConfirmerError::InvalidTokens);
} }
if !body.success { if !body.success {
return Err(anyhow!("Server responded with failure.").into()); if let Some(msg) = body.message {
return Err(ConfirmerError::RemoteFailureWithMessage(msg));
} else {
return Err(ConfirmerError::RemoteFailure);
}
} }
Ok(()) Ok(())
@ -237,7 +245,11 @@ where
return Err(ConfirmerError::InvalidTokens); return Err(ConfirmerError::InvalidTokens);
} }
if !body.success { if !body.success {
return Err(anyhow!("Server responded with failure.").into()); if let Some(msg) = body.message {
return Err(ConfirmerError::RemoteFailureWithMessage(msg));
} else {
return Err(ConfirmerError::RemoteFailure);
}
} }
Ok(()) Ok(())
@ -316,6 +328,10 @@ pub enum ConfirmerError {
NetworkFailure(#[from] reqwest::Error), NetworkFailure(#[from] reqwest::Error),
#[error("Failed to deserialize response: {0}")] #[error("Failed to deserialize response: {0}")]
DeserializeError(#[from] serde_path_to_error::Error<serde_json::Error>), DeserializeError(#[from] serde_path_to_error::Error<serde_json::Error>),
#[error("Remote failure: Valve's server responded with a failure and did not elaborate any further. This is likely not a steamguard-cli bug, Steam's confirmation API is just unreliable. Wait a bit and try again.")]
RemoteFailure,
#[error("Remote failure: Valve's server responded with a failure and said: {0}")]
RemoteFailureWithMessage(String),
#[error("Unknown error: {0}")] #[error("Unknown error: {0}")]
Unknown(#[from] anyhow::Error), Unknown(#[from] anyhow::Error),
} }
@ -351,34 +367,27 @@ impl Confirmation {
} }
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, num_enum::FromPrimitive)]
#[repr(u32)] #[repr(u32)]
#[serde(from = "u32")] #[serde(from = "u32")]
/// Source: <https://github.com/SteamDatabase/SteamTracking/blob/6e7797e69b714c59f4b5784780b24753c17732ba/Structs/enums.steamd#L1607-L1616> /// Source: https://github.com/SteamDatabase/SteamTracking/blob/6e7797e69b714c59f4b5784780b24753c17732ba/Structs/enums.steamd#L1607-L1616
/// There are also some additional undocumented types.
pub enum ConfirmationType { pub enum ConfirmationType {
Test = 1, Test = 1,
/// Occurs when sending a trade offer or accepting a received trade offer, only when there is items on the user's side
Trade = 2, Trade = 2,
/// Occurs when selling an item on the Steam community market
MarketSell = 3, MarketSell = 3,
FeatureOptOut = 4, FeatureOptOut = 4,
/// Occurs when changing the phone number associated with the account
PhoneNumberChange = 5, PhoneNumberChange = 5,
AccountRecovery = 6, AccountRecovery = 6,
/// Occurs when a new web API key is created via https://steamcommunity.com/dev/apikey
ApiKeyCreation = 9,
#[num_enum(catch_all)]
Unknown(u32), Unknown(u32),
} }
impl From<u32> for ConfirmationType {
fn from(text: u32) -> Self {
match text {
1 => ConfirmationType::Test,
2 => ConfirmationType::Trade,
3 => ConfirmationType::MarketSell,
4 => ConfirmationType::FeatureOptOut,
5 => ConfirmationType::PhoneNumberChange,
6 => ConfirmationType::AccountRecovery,
v => ConfirmationType::Unknown(v),
}
}
}
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct ConfirmationListResponse { pub struct ConfirmationListResponse {
pub success: bool, pub success: bool,
@ -386,13 +395,17 @@ pub struct ConfirmationListResponse {
pub needauth: Option<bool>, pub needauth: Option<bool>,
#[serde(default)] #[serde(default)]
pub conf: Vec<Confirmation>, pub conf: Vec<Confirmation>,
#[serde(default)]
pub message: Option<String>,
} }
#[derive(Debug, Clone, Copy, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct SendConfirmationResponse { pub struct SendConfirmationResponse {
pub success: bool, pub success: bool,
#[serde(default)] #[serde(default)]
pub needsauth: Option<bool>, pub needsauth: Option<bool>,
#[serde(default)]
pub message: Option<String>,
} }
fn build_time_bytes(time: u64) -> [u8; 8] { fn build_time_bytes(time: u64) -> [u8; 8] {

View file

@ -1,6 +1,5 @@
use crate::protobufs::service_twofactor::CTwoFactor_RemoveAuthenticator_Request; use crate::token::TwoFactorSecret;
use crate::steamapi::EResult; use accountlinker::RemoveAuthenticatorError;
use crate::{steamapi::twofactor::TwoFactorClient, token::TwoFactorSecret};
pub use accountlinker::{AccountLinkError, AccountLinker, FinalizeLinkError}; pub use accountlinker::{AccountLinkError, AccountLinker, FinalizeLinkError};
pub use confirmation::*; pub use confirmation::*;
pub use qrapprover::{QrApprover, QrApproverError}; pub use qrapprover::{QrApprover, QrApproverError};
@ -96,56 +95,21 @@ impl SteamGuardAccount {
/// Removes the mobile authenticator from the steam account. If this operation succeeds, this object can no longer be considered valid. /// Removes the mobile authenticator from the steam account. If this operation succeeds, this object can no longer be considered valid.
/// Returns whether or not the operation was successful. /// Returns whether or not the operation was successful.
pub fn remove_authenticator<T: Transport>( ///
/// A convenience method for [`AccountLinker::remove_authenticator`].
pub fn remove_authenticator(
&self, &self,
client: &TwoFactorClient<T>, transport: impl Transport,
revocation_code: Option<&String>, revocation_code: Option<&String>,
) -> Result<(), RemoveAuthenticatorError> { ) -> Result<(), RemoveAuthenticatorError> {
if !matches!(revocation_code, Some(_)) && self.revocation_code.expose_secret().is_empty() {
return Err(RemoveAuthenticatorError::MissingRevocationCode);
}
let Some(tokens) = &self.tokens else { let Some(tokens) = &self.tokens else {
return Err(RemoveAuthenticatorError::TransportError(TransportError::Unauthorized)); return Err(RemoveAuthenticatorError::TransportError(
TransportError::Unauthorized,
));
}; };
let mut req = CTwoFactor_RemoveAuthenticator_Request::new(); let revocation_code =
req.set_revocation_code( Some(revocation_code.unwrap_or_else(|| self.revocation_code.expose_secret()));
revocation_code let linker = AccountLinker::new(transport, tokens.clone());
.unwrap_or(self.revocation_code.expose_secret()) linker.remove_authenticator(revocation_code)
.to_owned(),
);
let resp = client.remove_authenticator(req, tokens.access_token())?;
// returns EResult::TwoFactorCodeMismatch if the revocation code is incorrect
if resp.result != EResult::OK && resp.result != EResult::TwoFactorCodeMismatch {
return Err(resp.result.into());
}
let resp = resp.into_response_data();
if !resp.success() {
return Err(RemoveAuthenticatorError::IncorrectRevocationCode {
attempts_remaining: resp.revocation_attempts_remaining(),
});
}
Ok(())
}
}
#[derive(Debug, thiserror::Error)]
pub enum RemoveAuthenticatorError {
#[error("Missing revocation code")]
MissingRevocationCode,
#[error("Incorrect revocation code, {attempts_remaining} attempts remaining")]
IncorrectRevocationCode { attempts_remaining: u32 },
#[error("Transport error: {0}")]
TransportError(#[from] TransportError),
#[error("Steam returned an enexpected result: {0:?}")]
UnknownEResult(EResult),
#[error("Unexpected error: {0}")]
Unknown(#[from] anyhow::Error),
}
impl From<EResult> for RemoveAuthenticatorError {
fn from(e: EResult) -> Self {
Self::UnknownEResult(e)
} }
} }

View file

@ -4,7 +4,6 @@ pub mod twofactor;
use crate::transport::Transport; use crate::transport::Transport;
use crate::{protobufs::service_twofactor::CTwoFactor_Time_Response, token::Jwt}; use crate::{protobufs::service_twofactor::CTwoFactor_Time_Response, token::Jwt};
use reqwest::Url;
use serde::Deserialize; use serde::Deserialize;
pub use self::authentication::AuthenticationClient; pub use self::authentication::AuthenticationClient;
@ -12,7 +11,6 @@ pub use self::phone::PhoneClient;
pub use self::twofactor::TwoFactorClient; pub use self::twofactor::TwoFactorClient;
lazy_static! { lazy_static! {
static ref STEAM_COOKIE_URL: Url = "https://steamcommunity.com".parse::<Url>().unwrap();
static ref STEAM_API_BASE: String = "https://api.steampowered.com".into(); static ref STEAM_API_BASE: String = "https://api.steampowered.com".into();
} }

View file

@ -11,7 +11,7 @@ const SERVICE_NAME: &str = "IAuthenticationService";
use super::{ApiRequest, ApiResponse, BuildableRequest}; use super::{ApiRequest, ApiResponse, BuildableRequest};
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct AuthenticationClient<T> pub struct AuthenticationClient<T>
where where
T: Transport, T: Transport,

View file

@ -3,7 +3,6 @@ use crate::transport::{Transport, TransportError};
use super::{ApiRequest, ApiResponse, BuildableRequest}; use super::{ApiRequest, ApiResponse, BuildableRequest};
use crate::protobufs::custom::CTwoFactor_Time_Request;
use crate::protobufs::service_twofactor::*; use crate::protobufs::service_twofactor::*;
const SERVICE_NAME: &str = "ITwoFactorService"; const SERVICE_NAME: &str = "ITwoFactorService";
@ -70,6 +69,45 @@ where
Ok(resp) Ok(resp)
} }
pub fn remove_authenticator_via_challenge_start(
&self,
req: CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request,
access_token: &Jwt,
) -> Result<ApiResponse<CTwoFactor_RemoveAuthenticatorViaChallengeStart_Response>, TransportError>
{
let req = ApiRequest::new(SERVICE_NAME, "RemoveAuthenticatorViaChallengeStart", 1, req)
.with_access_token(access_token);
let resp = self
.transport
.send_request::<CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request, CTwoFactor_RemoveAuthenticatorViaChallengeStart_Response>(
req,
)?;
Ok(resp)
}
pub fn remove_authenticator_via_challenge_continue(
&self,
req: CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request,
access_token: &Jwt,
) -> Result<
ApiResponse<CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Response>,
TransportError,
> {
let req = ApiRequest::new(
SERVICE_NAME,
"RemoveAuthenticatorViaChallengeContinue",
1,
req,
)
.with_access_token(access_token);
let resp = self
.transport
.send_request::<CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request, CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Response>(
req,
)?;
Ok(resp)
}
pub fn query_status( pub fn query_status(
&self, &self,
req: CTwoFactor_Status_Request, req: CTwoFactor_Status_Request,
@ -109,5 +147,13 @@ macro_rules! impl_buildable_req {
impl_buildable_req!(CTwoFactor_AddAuthenticator_Request, true); impl_buildable_req!(CTwoFactor_AddAuthenticator_Request, true);
impl_buildable_req!(CTwoFactor_FinalizeAddAuthenticator_Request, true); impl_buildable_req!(CTwoFactor_FinalizeAddAuthenticator_Request, true);
impl_buildable_req!(CTwoFactor_RemoveAuthenticator_Request, true); impl_buildable_req!(CTwoFactor_RemoveAuthenticator_Request, true);
impl_buildable_req!(
CTwoFactor_RemoveAuthenticatorViaChallengeStart_Request,
true
);
impl_buildable_req!(
CTwoFactor_RemoveAuthenticatorViaChallengeContinue_Request,
true
);
impl_buildable_req!(CTwoFactor_Status_Request, true); impl_buildable_req!(CTwoFactor_Status_Request, true);
impl_buildable_req!(CTwoFactor_Time_Request, false); impl_buildable_req!(CTwoFactor_Time_Request, false);

View file

@ -1,15 +1,10 @@
use log::{debug, trace}; use log::{debug, trace};
use protobuf::MessageFull; use protobuf::MessageFull;
use reqwest::{blocking::multipart::Form, Url}; use reqwest::blocking::multipart::Form;
use super::{Transport, TransportError}; use super::{Transport, TransportError};
use crate::steamapi::{ApiRequest, ApiResponse, BuildableRequest, EResult}; use crate::steamapi::{ApiRequest, ApiResponse, BuildableRequest, EResult};
lazy_static! {
static ref STEAM_COOKIE_URL: Url = "https://steamcommunity.com".parse::<Url>().unwrap();
static ref STEAM_API_BASE: String = "https://api.steampowered.com".into();
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WebApiTransport { pub struct WebApiTransport {
client: reqwest::blocking::Client, client: reqwest::blocking::Client,

View file

@ -13,10 +13,12 @@ use crate::protobufs::steammessages_auth_steamclient::{
CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request, CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request,
CAuthentication_UpdateAuthSessionWithSteamGuardCode_Response, EAuthTokenPlatformType, CAuthentication_UpdateAuthSessionWithSteamGuardCode_Response, EAuthTokenPlatformType,
}; };
use crate::refresher::TokenRefresher;
use crate::steamapi::authentication::AuthenticationClient; use crate::steamapi::authentication::AuthenticationClient;
use crate::steamapi::EResult; use crate::steamapi::EResult;
use crate::token::Tokens; use crate::token::Tokens;
use crate::transport::Transport; use crate::transport::Transport;
use anyhow::Context;
use base64::Engine; use base64::Engine;
use log::*; use log::*;
use rsa::{Pkcs1v15Encrypt, RsaPublicKey}; use rsa::{Pkcs1v15Encrypt, RsaPublicKey};
@ -82,7 +84,7 @@ impl BeginQrLoginResponse {
#[derive(Debug)] #[derive(Debug)]
pub struct UserLogin<T> pub struct UserLogin<T>
where where
T: Transport, T: Transport + Clone,
{ {
client: AuthenticationClient<T>, client: AuthenticationClient<T>,
device_details: DeviceDetails, device_details: DeviceDetails,
@ -92,7 +94,7 @@ where
impl<T> UserLogin<T> impl<T> UserLogin<T>
where where
T: Transport, T: Transport + Clone,
{ {
pub fn new(transport: T, device_details: DeviceDetails) -> Self { pub fn new(transport: T, device_details: DeviceDetails) -> Self {
Self { Self {
@ -214,11 +216,29 @@ where
loop { loop {
let mut next_poll = self.poll_until_info()?; let mut next_poll = self.poll_until_info()?;
if next_poll.has_access_token() { if next_poll.has_access_token() || next_poll.has_refresh_token() {
return Ok(Tokens::new( // On 2023-09-12, Steam stopped issuing access tokens alongside refresh tokens for newly authenticated sessions.
// If they decide to revert this change, we'll accept the access token if it's present.
let access_token = next_poll.take_access_token();
if access_token.is_empty() {
// Let's go ahead an fetch the access token, because we are going to need it anyway.
let mut refresher = TokenRefresher::new(self.client.clone());
let mut tokens = Tokens::new(
next_poll.take_access_token(), next_poll.take_access_token(),
next_poll.take_refresh_token(), next_poll.take_refresh_token(),
)); );
let steamid = tokens
.refresh_token()
.decode()
.context("decoding refresh token for steam id")?
.steam_id();
let access_token = refresher.refresh(steamid, &tokens)?;
tokens.set_access_token(access_token);
return Ok(tokens);
} else {
return Ok(Tokens::new(access_token, next_poll.take_refresh_token()));
};
} }
} }
} }