Skip to content

credential: Use CreateSession pattern for backend interface - #2

Closed
LucFauvel wants to merge 1 commit into
linux-credentials:credentials-portalfrom
LucFauvel:wip/credential-impl-create-session
Closed

LucFauvel wants to merge 1 commit into
linux-credentials:credentials-portalfrom
LucFauvel:wip/credential-impl-create-session

Conversation

@LucFauvel

@LucFauvel LucFauvel commented Nov 14, 2026 •

Copy link
Copy Markdown

org.freedesktop.impl.portal.experimental.Credential.xml still describes the original Initialize / Credential.Ceremony / NotifyStateChanged / UserInteracted design. credentialsd moved the UI backend to a session-based interface in linux-credentials/credentialsd@42dc12f, and has since added NotifyPinNotSet, SetDevicePin and the *Restarting notifications. A backend implemented from this file today can't talk to credentialsd.

This updates the interface to match what credentialsd calls (credentialsd/src/dbus/ui_control.rs):

  • CreateSession creates one org.freedesktop.impl.portal.Session per ceremony at session_handle.
  • Notify* methods carry state updates, each taking the session handle.
  • DiscoveryRequested, ClientPinEntered, SetDevicePin and CredentialSelected signals carry the session handle.

It also documents each method and signal in the same style as the other backend interfaces, including behavior that is currently only implied by credentialsd:

  • Signals, including the session's Closed, must be sent unicast to the caller. credentialsd's match rules filter on destination, and the PIN signals carry fds.
  • Backends must reject Notify* calls from peers other than the session's creator.
  • When Closed is and isn't emitted (user dismissal vs. caller Close(), completion, caller disconnect).
  • type values, transports, options keys, PinNotSet reasons, credential metadata keys, error codes, and the memfd conventions for PIN and QR data.

No C code in this repo uses the impl interface, so only the installed XML and the generated docs change. This doesn't overlap with #1, which touches the handler interface.

Testing:

  • gdbus-codegen --generate-rst renders it without warnings, and all internal :ref: targets resolve.
  • Installed this branch to a local prefix and built a work-in-progress xdg-desktop-portal-gnome backend against the installed file. Ran the backend on a private bus with a client that mimics credentialsd's calls: all methods are accepted with credentialsd's signatures, signals arrive unicast, PIN and QR fds round-trip, and session teardown works on completion, cancel, Close() and caller disconnect.

AI was used while making these changes but all output was review by me.

credentialsd moved the UI backend to a session-based interface in
linux-credentials/credentialsd@42dc12f: one CreateSession call per
ceremony, Notify methods for state updates, and signals carrying the
session handle, with each ceremony represented by an
org.freedesktop.impl.portal.Session. Since then it also gained
NotifyPinNotSet, SetDevicePin and the Restarting notifications.

Update the backend interface to match what credentialsd calls, and
document it in the same style as the other backend interfaces,
including the requirement that signals are sent unicast to the caller.

Assisted-by: Claude:claude-opus-5-5
@LucFauvel LucFauvel closed this Nov 14, 2026
@LucFauvel
LucFauvel deleted the wip/credential-impl-create-session branch November 14, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant