aboutsummaryrefslogtreecommitdiff
path: root/azalea-auth/src/cache.rs
diff options
context:
space:
mode:
authorAdam Reisenauer <58893124+Mythbusters123@users.noreply.github.com>2023-06-24 18:09:43 -0400
committerGitHub <noreply@github.com>2023-06-24 17:09:43 -0500
commit5e4699688207b8ac722ae7f96c49428242f49a9d (patch)
tree52b0f9b8507fa380376dab81411cb74eed413c95 /azalea-auth/src/cache.rs
parentfe687f9bdbdf3e0214ac4ac6da47a181e4dc23dd (diff)
downloadazalea-drasl-5e4699688207b8ac722ae7f96c49428242f49a9d.tar.xz
Add functions `auth_with_link_code`, `get_ms_link_code`, and `get_ms_auth_token`. (#88)
* Add option for grabbing authentication code for Microsoft seperately. Created two new functions, one that outputs the DeviceCodeResponse and one that uses this response to authenticate an actual account. * Added documentation and cleaned up function names. Still wondering about code repeition * reduce code duplication, more docs, cleanup * clippy --------- Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea-auth/src/cache.rs')
-rwxr-xr-xazalea-auth/src/cache.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/azalea-auth/src/cache.rs b/azalea-auth/src/cache.rs
index 404b05ff..1e8aee10 100755
--- a/azalea-auth/src/cache.rs
+++ b/azalea-auth/src/cache.rs
@@ -58,6 +58,15 @@ impl<T> ExpiringValue<T> {
}
}
+impl<T: Clone> Clone for ExpiringValue<T> {
+ fn clone(&self) -> Self {
+ Self {
+ expires_at: self.expires_at,
+ data: self.data.clone(),
+ }
+ }
+}
+
async fn get_entire_cache(cache_file: &Path) -> Result<Vec<CachedAccount>, CacheError> {
let mut cache: Vec<CachedAccount> = Vec::new();
if cache_file.exists() {