aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/rbw/actions.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-10-27 05:38:03 -0400
committerJesse Luehrs <doy@tozt.net>2021-10-27 05:44:08 -0400
commit9acabc3a7497e3eb3536992212d34f77a649ae16 (patch)
treee1433fe36c6768704ea63443910731c4ad7fbcc1 /src/bin/rbw/actions.rs
parenteb5e4ea7bcc3008a8d06da6884ee9713f8df0034 (diff)
downloadrbw-9acabc3a7497e3eb3536992212d34f77a649ae16.tar.gz
rbw-9acabc3a7497e3eb3536992212d34f77a649ae16.zip
start working on apikey authentication
not entirely working yet, because api keys aren't allowed to use the offline_access scope which provides access to the oauth refresh token. we will probably need to move to using stable device identifiers (should be able to generate one when the config is first created) and move this logic to a separate "rbw register" command which just does an apikey login but doesn't try to store any data, and then use the normal login flow after that
Diffstat (limited to 'src/bin/rbw/actions.rs')
-rw-r--r--src/bin/rbw/actions.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/rbw/actions.rs b/src/bin/rbw/actions.rs
index 75703f9..e0e1e55 100644
--- a/src/bin/rbw/actions.rs
+++ b/src/bin/rbw/actions.rs
@@ -1,8 +1,12 @@
use anyhow::Context as _;
use std::io::Read as _;
-pub fn login() -> anyhow::Result<()> {
- simple_action(rbw::protocol::Action::Login)
+pub fn login(apikey: bool) -> anyhow::Result<()> {
+ if apikey {
+ simple_action(rbw::protocol::Action::LoginApiKey)
+ } else {
+ simple_action(rbw::protocol::Action::Login)
+ }
}
pub fn unlock() -> anyhow::Result<()> {