Each application instantiates its own with its own protocol. This protocol can be configured to suit the needs of the application.
The protocol definition is an object where you can define the protocol's name, the schemas needed for your application, and the permissions for those schemas. Altogether, it looks like this:
The protocol
property defines the name of the protocol for your application. It should be consistent across the application.
The types
property is where you can define all of the schemas needed for your application.
Each property defined in the types
object is the name of a schema for your application.
The schema
property is the name of the protocol and the name of the schema with a /
between them.
The dataFormats
property defines what types of data this schema can be.
The structure
property allows you to define the permissions for your schemas.
There should be a corresponding property defined in the structure
object for every schema.
$actions
is an array of objects that define the permissions for the schema.
Let's assume that we're building a simple file storage application called Store. We would need to configure our protocol to include a schema for documents. That could look like this:
One your protocol has been defined, it should be added to the DWN when a is initialized. See the for a full example.