<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!--
Written by lowtide, 2026. CC0 1.0: dedicated to the public domain.
Online accounts: the accounts PC settings signs in to, and the access
tokens apps use with them.
c8-accounts serves this at /org/cont8nuum/Accounts under the name
org.cont8nuum.Accounts on the session bus. D-Bus starts it when it is
first called, and it quits when it has been idle a few minutes. It is
the only one that holds the refresh tokens (in the Secret Service, the
wallet), and the only one that refreshes them: providers that hand out
a new refresh token on every refresh would otherwise sign out whoever
refreshed second.
Providers
A provider is a keyfile, NAME.provider, in cont8nuum/accounts under
the XDG data dirs (the user's first, so one there replaces a shipped
one of the same name):
[Provider]
Name=snail.zone
Description=The RSS reader and weather on snail.zone
Color=#9fb069 the tile's colour in PC settings, without an icon
Icon=snail.zone.svg optional: its logo, a file beside this one, an
absolute path or an icon name
Site=https://snail.zone
[Service rssnail] one group per service; "rssnail" is its type
Name=RSS reader
Description=News follows the feeds you read on rssnail
Issuer=https://auth.snail.zone/application/o/rss/
ClientId=rss a public OAuth 2 client (no secret)
Scopes=openid email profile offline_access rssnail
Api=https://rss.snail.zone
Redirect=… optional, see below
Ready=false optional: listed, but not offered for signing in
Each service is its own OAuth 2 client of an OpenID Connect issuer
(its endpoints come from Issuer + .well-known/openid-configuration),
so each has its own tokens. Signing in is the authorization code flow
with PKCE (S256) in the user's browser, redirected to a loopback
address (RFC 8252):
http://127.0.0.1:PORT/callback
where PORT changes every time, so the client must accept any port
(Authentik: a regex redirect URI, ^http://127\.0\.0\.1:\d+/callback$).
The services of one sign-in are authorized one after another in the
same browser tab (the loopback answers the first with a redirect to
the second), so the user signs in once. offline_access is asked for so
there is a refresh token; without one the user has to sign in again
whenever the access token runs out.
An issuer that won't redirect to a loopback address can still be used
with Redirect=: one of its own pages the client may redirect to, where
the browser stops (an empty page, or an error) with the code in the
address bar. The user copies that address into PC settings, which
hands it to FinishSignIn. Clumsy, so only until the issuer takes the
loopback.
Accounts (not their tokens) are kept in ~/.config/cont8nuum/accounts.ini.
Dictionaries
A provider (ListProviders):
id the file's name, without .provider
name, description, color, site
icon an absolute path or an icon name; may be empty
services aa{sv}: id, name, description, ready (b)
An account (ListAccounts):
id ours, stable
provider the provider's id; provider-name, color, icon as above
name the user's name, from the issuer's userinfo
email may be empty
services aa{sv}: id, name, description,
enabled (b): the user wants apps to use it,
signed-in (b): there are tokens for it,
needs-sign-in (b): enabled, but the tokens stopped working
(or there never were any): PC settings offers to sign in
Errors (org.cont8nuum.Accounts1.Error.*)
NoAccount no account has that service turned on
SignInNeeded one has, but the user has to sign in again (PC settings)
Offline the issuer couldn't be reached: try again later
Failed anything else; the message says what
-->
<node>
<interface name="org.cont8nuum.Accounts1">
<method name="ListProviders">
<arg name="providers" type="aa{sv}" direction="out"/>
</method>
<method name="ListAccounts">
<arg name="accounts" type="aa{sv}" direction="out"/>
</method>
<!--
SignIn: starts signing in to a provider's services, and returns at
once with the address to open in the browser (the caller opens it,
so the browser comes forward with the caller's activation token).
account is "" for a new account, or one to sign in to again;
services are the service ids, or none for all of the provider's.
paste is true when this service's Redirect= is used: show a box for
the address and call FinishSignIn with it. A sign-in of several
services emits SignInNext as it moves to each next one: after a
paste the caller opens its uri (the browser won't go there by
itself); after the loopback the browser is already sent there.
SignInFinished tells how it ended. It is given up after ten minutes,
when CancelSignIn is called, or when the caller leaves the bus.
-->
<method name="SignIn">
<arg name="provider" type="s" direction="in"/>
<arg name="account" type="s" direction="in"/>
<arg name="services" type="as" direction="in"/>
<arg name="handle" type="s" direction="out"/>
<arg name="uri" type="s" direction="out"/>
<arg name="paste" type="b" direction="out"/>
</method>
<!-- address: what the browser ended on (a bare code is taken too) -->
<method name="FinishSignIn">
<arg name="handle" type="s" direction="in"/>
<arg name="address" type="s" direction="in"/>
</method>
<signal name="SignInNext">
<arg name="handle" type="s"/>
<arg name="uri" type="s"/>
<arg name="paste" type="b"/>
</signal>
<method name="CancelSignIn">
<arg name="handle" type="s" direction="in"/>
</method>
<!-- account: the one signed in to; error: "" if it worked, else why
(and "cancelled" when it was given up) -->
<signal name="SignInFinished">
<arg name="handle" type="s"/>
<arg name="account" type="s"/>
<arg name="error" type="s"/>
</signal>
<!-- Forgets the account and its tokens (revoked, if the issuer lets) -->
<method name="RemoveAccount">
<arg name="account" type="s" direction="in"/>
</method>
<method name="SetServiceEnabled">
<arg name="account" type="s" direction="in"/>
<arg name="service" type="s" direction="in"/>
<arg name="enabled" type="b" direction="in"/>
</method>
<!--
GetAccessToken: for apps. A token for the first account with that
service turned on, refreshed if it is about to run out. An app that
is told 401 by the API passes the token it used as rejected: that
one is refreshed even if it hasn't run out. api is the service's
Api= (no trailing slash); account its id, to notice a change of
account.
-->
<method name="GetAccessToken">
<arg name="service" type="s" direction="in"/>
<arg name="rejected" type="s" direction="in"/>
<arg name="account" type="s" direction="out"/>
<arg name="token" type="s" direction="out"/>
<arg name="api" type="s" direction="out"/>
</method>
<!-- Accounts came or went, a service was turned on or off, or one
needs signing in again -->
<signal name="Changed"/>
</interface>
</node>