Delegation for the day the account holder dies
Years ago I built an authentication system with a feature in it that I hoped most of its users would never need. It let you hand someone else access to your account, properly, as themselves. And one of the reasons it existed was the day you died. I'd half forgotten it until recently, when I sat down to design sign-in for Scout's portal and went digging to see whether the old code was still…
A few years ago, a system was developed with an authentication feature that most users would likely never utilize. This feature allowed one to grant another individual access to their account, essentially acting as them. The creator of this system, who now builds sign-in systems for platforms like Scout, had partially forgotten about this functionality until recently. The feature in question is known as delegation, which the creator built into a JWT system with revocation and delegation, written in Scala at Wakelet.
Delegation is essential for three main reasons: when an account holder wants support staff to act on their encrypted data, when a family member needs to gain access to an account after the account holder has passed away, and when corporate access needs to be transferred between team members. Each of these scenarios represents a spare key being left with a neighbor, complete with a key, a reason, and a way to ensure the lock knows it was indeed the designated person using it.
The delegation system allows for two distinct methods of access: impersonation and delegation. Impersonation involves the acting party logging in and appearing to be the account holder themselves. Delegation, on the other hand, keeps the acting party's identity separate from the account holder's, with any actions taken being recorded as being taken by the acting party representing the account holder.
This distinction is outlined in RFC 8693, which defines delegation in terms of the acting party having its own identity separate from the one they are acting for.
In the creator's old system, delegation was implemented by adding an extra claim to the token, specifying the person the token was issued to alongside the owner it was for. This system also included optional date ranges for when the delegation was valid and when it would expire. The distinction between impersonation and delegation is crucial, as it ensures that the account holder's history accurately reflects the actions taken on their behalf.
For Scout's current alpha version, delegation is not a requirement, as the platform's sign-in currently only supports Discord. The creator, however, wanted to leave room for future implementation of delegation without making the alpha version unnecessarily complex. The old design proved to be handy for this purpose, as adding the additional column for delegation was the cheapest option and could be implemented before any tokens were issued.
The session table in Scout's system now includes two columns, one for the account the session is for and another for the account actually performing the action. Currently, these two columns always represent the same person (sign-in writes them equal), which allows for easy testing and asserts their equality.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to