fix: libpaket: delete everything and introduce packstation secrets

This commit is contained in:
jane400 2024-09-21 21:12:08 +02:00 committed by jane400
parent d5c2997c62
commit b320ca0c61

View file

@ -17,10 +17,13 @@ fn get_keyring_attributes_packstation() -> Vec<(&'static str, &'static str)> {
]
}
pub async fn keyring_delete_all_items() -> oo7::Result<()> {
get_keyring()
.delete(&vec![get_keyring_base_attribute()])
.await
pub async fn keyring_delete_all_items() {
let keyring = get_keyring();
let attr1 = get_keyring_attributes_refresh_token();
let attr2 = get_keyring_attributes_packstation();
let _ = futures::join!(keyring.delete(&attr1), keyring.delete(&attr2),);
}
fn get_keyring<'a>() -> &'a oo7::Keyring {
@ -46,7 +49,26 @@ pub async fn keyring_get_refresh_token() -> oo7::Result<Option<String>> {
pub async fn keyring_set_refresh_token(value: String) -> oo7::Result<()> {
get_keyring()
.create_item(
"Refresh Token",
"Paket: Login credentials",
&get_keyring_attributes_refresh_token(),
value,
true,
)
.await
}
pub async fn keyring_get_packstation() -> oo7::Result<Option<String>> {
let items = get_keyring()
.search_items(&get_keyring_attributes_packstation())
.await?;
todo!()
}
pub async fn keyring_set_packstation(value: String) -> oo7::Result<()> {
get_keyring()
.create_item(
"Paket: Device keys",
&get_keyring_attributes_refresh_token(),
value,
true,