aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/login.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-29 03:21:43 +0000
committertv <tv@krebsco.de>2026-11-29 03:21:43 +0000
commite63d30c2581033a85489b10c3f5b252fdbb5049e (patch)
tree5f4e6f65f1cecfb32f841e7ad7d9d106aeb69b20 /src/api/login.rs
parent9188fa6e13ea7facfab5fb6f55bf26444ec2c01e (diff)
state: plain writes take a view to write, Automerge's are asked for as such
AppState::mutate_doc, mutate_doc_registering and mutate_doc_by hand what they are given a document::view::Write: the member registry, the users, sessions, forgetting and bootstrap write through them, and take whatever kind of document gives it. AppState::mutate_doc_for is for what asks more of an Automerge document than values at paths (the store's API, a remake's host, a store's events), and gives the heads after the write. What reads a view takes one of any size (dyn Write among them).
Diffstat (limited to 'src/api/login.rs')
-rw-r--r--src/api/login.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/api/login.rs b/src/api/login.rs
index 02c54a3..e442ea2 100644
--- a/src/api/login.rs
+++ b/src/api/login.rs
@@ -674,7 +674,7 @@ async fn end(state: &AppState, claims: &Claims, by: &str) -> Result<(), ApiError
let until = claims.login_exp.max(claims.session_exp);
let recorded = if state.is_ready().await {
state
- .mutate_doc_for(Some(by.to_owned()), Sign::Protocol, move |doc| {
+ .mutate_doc_by(Some(by.to_owned()), Sign::Protocol, move |doc| {
if !registry::exists(&*doc) {
return Ok::<_, ApiError>(false);
}
@@ -682,7 +682,6 @@ async fn end(state: &AppState, claims: &Claims, by: &str) -> Result<(), ApiError
Ok(true)
})
.await?
- .0
} else {
false
};
@@ -773,7 +772,7 @@ pub(crate) async fn revoke_tokens(state: &AppState, name: &str, by: &str) -> Res
// Issued in this very millisecond: revoked too.
let after = state.clock.now_millis().as_u64() + 1;
state
- .mutate_doc_for(Some(by.to_owned()), Sign::Protocol, move |doc| {
+ .mutate_doc_by(Some(by.to_owned()), Sign::Protocol, move |doc| {
if !registry::exists(&*doc) {
return Err(ApiError(
StatusCode::CONFLICT,