Sessions and devices.
A session tree people can read, revocation, and sessions bound to a key in the device's hardware.
On this page
svc.SessionTree(ctx, user)returns each device with the agents and tokens delegated from it, for a “Where you’re signed in” page.svc.RevokeOwn(ctx, principal, id)andsvc.RevokeOwnAgentend one of the person’s own sessions or agents;svc.RevokeOtherssigns out every other device.pk.Renamerelabels a passkey, andpk.AcceptedCredentialsfeeds the browser client’s password-manager sync.
Device-bound sessions
Device Bound Session Credentials (DBSC) are opt-in. To turn them on, set authroutes.Config.DeviceBound. In browsers that support DBSC, the session is bound to a key in the device’s hardware, the cookie lives 10 minutes, and the browser renews it by proving the key, so a stolen cookie stops working within minutes. Other browsers keep a plain cookie, and nothing changes for them.
Turning DBSC off again signs no one out. authroutes keeps the refresh route, and each bound browser proves its key one last time and gets a plain cookie for the rest of its session.
Without authroutes, pass authhttp.WithDeviceBound(prefix, lifetime) and serve authhttp.DeviceBound(svc) at that prefix, with refresh public. To turn it off, replace the option with authhttp.WithDeviceBoundRetired(prefix, lifetime) and keep the route until the longest session has expired. Removing both signs out every bound browser within 10 minutes.