The actor
a user wants to authenticate with.
Optional
scopeA yet undefined property detailing what operations the session grants the user to perform. For example, to allow a user to read private messages from a particular set of channels or to allow the user to write object matching a particular schema.
This object contains information that
source
s can use to verify that a user has permission to operate a particularactor
. This object is required of all Graffiti methods that modify objects and is optional for methods that read objects.At a minimum the
session
object must contain theactor
URI the user wants to authenticate with. However it is likely that thesession
object must contain other implementation-specific properties. For example, a Solid implementation might include afetch
function. A distributed implementation may include a cryptographic signature.As to why the
session
object is passed as an argument to every method rather than being an internal property of the Graffiti instance, this is primarily for type-checking to catch bugs related to login state. Graffiti applications can expose some functionality to users who are not logged in with Graffiti.get and Graffiti.discover but without type-checking thesession
it can be easy to forget to hide buttons that trigger other methods that require login. In the future,session
object may be updated to include scope information and passing thesession
to each method can type-check whether the session provides the necessary permissions.Passing the
session
object per-method also allows for multiple sessions to be used within the same application, like an Email client fetching from multiple accounts.