Objects are the atomic unit in Graffiti that can represent both data (e.g. a social media post or profile) and activities (e.g. a like or follow). Objects are created and modified by a single actor.

Most of an object's content is stored in its value property, which can be any JSON object. However, we recommend using properties from the Activity Vocabulary or properties that emerge in the Graffiti folksonomy to promote interoperability.

The object is globally addressable via its url.

The channels and allowed properties enable the object's creator to shape the visibility of and access to their object.

The lastModified property can be used to compare object versions.

interface GraffitiObjectBase {
    actor: string;
    allowed?: null | string[];
    channels: string[];
    lastModified: number;
    url: string;
    value: {};
}

Properties

actor: string

The URI of the actor that created the object. This actor also has the unique permission to modify or delete the object.

We borrow the term actor from the ActivityPub because like in ActivityPub there is not necessarily a one-to-one mapping between actors and people/users. Multiple people can share the same actor or one person can have multiple actors. Actors can also be bots.

In Graffiti, actors are always globally unique URIs which allows them to also function as channels.

allowed?: null | string[]

An optional array of actor URIs that the creator allows to access the object. If no allowed array is provided, the object can be accessed by anyone (so long as they also know the right channel to look in). An object can always be accessed by its creator, even if the allowed array is empty.

The allowed array is not revealed to users other than the creator, like a BCC email. A user may choose to add a to property to the object's value to indicate other recipients, however this is not enforced by Graffiti and may not accurately reflect the actual allowed array.

allowed can be combined with channels. For example, to send someone a direct message the sender should put their object in the channel of the recipient's actor URI to notify them of the message and also add the recipient's actor URI to the allowed array to prevent others from seeing the message.

channels: string[]

An array of URIs the creator associates with the object. Objects can only be found by querying one of the object's channels using the Graffiti.discover method. This allows creators to express the intended audience of their object which helps to prevent context collapse even in the highly interoperable ecosystem that Graffiti envisions. For example, channel URIs may be:

  • A user's own actor URI. Putting an object in this channel is a way to broadcast the object to the user's followers, like posting a tweet.
  • The URL of a Graffiti post. Putting an object in this channel is a way to broadcast to anyone viewing the post, like commenting on a tweet.
  • A URI representing a topic. Putting an object in this channel is a way to broadcast to anyone interested in that topic, like posting in a subreddit.
lastModified: number

The time the object was last modified, measured in milliseconds since January 1, 1970. It can be used to compare object versions. A number, rather than an ISO string or Date object, is used for easy comparison, sorting, and JSON Schema range queries.

It is possible to use this value to sort objects in a user's interface but in many cases it would be better to use a published property in the object's value to indicate when the object was created rather than when it was modified.

url: string

A globally unique identifier and locator for the object. It can be used to point to an object or to retrieve the object directly with Graffiti.get. If an object is put with the same URL as an existing object, the existing object will be replaced with the new object.

An object's URL is generated when the object is first created and should include sufficient randomness to prevent collisions and guessing. The URL starts with a "scheme," just like web URLs start with http or https, to indicate to indicate the particular Graffiti implementation. This allows for applications to pull from multiple coexisting Graffiti implementations without collision. Existing schemes include graffiti:local: for objects stored locally (see the local implementation) and graffiti:remote: for objects stored on Graffiti-specific web servers (see the remote implementation). Options available in the future might include graffiti:solid: for objects stored on Solid servers or graffiti:p2p: for objects stored on a peer-to-peer network.

value: {}

The object's content as freeform JSON. We recommend using properties from the Activity Vocabulary or properties that emerge in the Graffiti folksonomy to promote interoperability.