@graffiti-garden/api
    Preparing search index...

    Interface GraffitiSession

    This object contains information that the underlying implementation can use to authenticate a particular actor. 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 the actor URI to authenticate with. However it is likely that the session object must contain other implementation-specific properties. For example, a Solid implementation might include a fetch 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 people who are not logged in with Graffiti.get and Graffiti.discover but without type-checking the session 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 the session 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.

    interface GraffitiSession {
        actor: string;
        scope?: {};
    }
    Index

    Properties

    Properties

    actor: string

    The actor to authenticate with.

    scope?: {}

    A yet undefined property detailing what operations the session grants the actor to perform. For example, to allow a actor to read private messages from a particular set of channels or to allow the actor to write object matching a particular schema.