diff --git a/spec/index.html b/spec/index.html index 29100fd..45c5d8d 100644 --- a/spec/index.html +++ b/spec/index.html @@ -215,7 +215,7 @@
DID-Relative URL example for passing multiple messages:
-For example purposes, the queries
parameter value below is neither JSON stringified nor Base64Url encoded, but should be when using Decentralized Web Node URLs in practice (see the DID-relative URL Composition instructions above).
For example purposes, the queries
parameter value below is neither JSON stringified nor Base64Url encoded, but should be when using Decentralized Web Node URLs in practice (see the DID-relative URL Composition instructions above).
did:example:123?service=DecentralizedWebNode&queries=[{ "method": "CollectionsQuery", "schema": "https://schema.org/SocialMediaPosting" }]
@@ -305,7 +305,7 @@ Individual Interface methods may describe additional properties that the descriptor
object MUST or MAY contain, which are detailed in the Interfaces section of the specification.
Individual Interface methods may describe additional properties that the descriptor
object MUST or MAY contain, which are detailed in the Interfaces section of the specification.
Some messages may require authorization material for processing them in accordance with the permissions a Decentralized Web Node owner has specified. If a message requires authorization it MUST include an authorization
property with a value that is a [RFC7515] General JSON Web Signature (JWS), constructed as follows:
descriptor
object.
-permissionsGrantCid
property, and its value MUST be the stringified Version 1 CID of the DAG CBOR encoded Permission Grant being invoked.payload
MAY include an attestationCid
property, and its value MUST be the stringified Version 1 CID of the DAG CBOR encoded attestation
string.descriptorCid
property, and its value MUST be the stringified Version 1 CID of the DAG CBOR encoded descriptor
object.permissionsGrantCid
property, and its value MUST be the stringified Version 1 CID of the DAG CBOR encoded Permission Grant being invoked.payload
MAY include a attestationCid
property, and its value MUST be the stringified Version 1 CID of the DAG CBOR encoded attestation
string.If no results are found, the status
remains 200
, and the implementation MUST return an empty entries
array.
If no results are found, the status
remains 200
, and the implementation MUST return an empty entries
array.
Request Example:
{ // Request Object
@@ -621,7 +621,25 @@ EXAMPLE{
"replies": [
{
- "status": { "code": 501, "detail": "The interface method is not implemented" }
+ "status": {
+ "code": 501,
+ "detail": "The interface method is not implemented"
+ }
+ }
+ ]
+}
+
+
Resource consumption limit exceeded
+If the DWeb Node instance receiving the request has determined that the rate of resource consumption has exceeded its tolerances and cannot process the request, the instance MUST respond with the following status entry:
+Response Example:
+{
+ "replies": [
+ {
+ "status": {
+ "code": 429,
+ "detail": "Resource consumption has exceeded tolerances"
+ }
}
]
}
@@ -659,20 +677,6 @@ §
CollectionsDelete
-The object MAY contain a actions
property. If the property is not present,
-it indicates the Decentralized Web Node implementation does not support any methods of the interface. If the
-property is present, its value MUST be an object that MAY include any of the
-following properties, wherein a boolean true
value indicates support for the interface
-method, while a boolean false
value or omission of the property indicates the interface
-method is not supported:
-
-ThreadsQuery
-ThreadsCreate
-ThreadsReply
-ThreadsClose
-ThreadsDelete
-
-
The object MAY contain a permissions
property. If the property is not present,
it indicates the Decentralized Web Node implementation does not support any methods of the interface. If the
property is present, its value MUST be an object that MAY include any of the
@@ -715,8 +719,11 @@ § Query
The message object MUST contain a descriptor
property, and its value MUST be a JSON object composed as follows:
- The object MUST contain a
method
property, and its value MUST be the string CollectionsQuery
.
+- The object MAY contain a
filter
property, and if present its value MUST be an object that MAY contain the following properties:
+
+- The object MAY contain a
contextId
property, and its value MUST be a [RFC4122] UUID Version 4 string.
- The object MAY contain a
schema
property, and if present its value Must be a URI string that indicates the schema of the associated data.
-- The object MAY contain an
recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string.
+- The object MAY contain a
recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string.
- The object MAY contain a
dataFormat
property, and its value MUST be a string that indicates the format of the data in accordance with its MIME type designation. The most common format is JSON, which is indicated by setting the value of the dataFormat
property to application/json
.
- The object MAY contain a
dateSort
field, and if present its value MUST be one of the following strings:
@@ -729,12 +736,16 @@ § Query
+
+
Get a single object by its ID reference:
{ // Message
"descriptor": {
"nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
"method": "CollectionsQuery",
- "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e",
+ "filter": {
+ "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e"
+ }
}
}
@@ -743,7 +754,9 @@ § Query
"descriptor": {
"nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
"method": "CollectionsQuery",
- "schema": "https://schema.org/MusicPlaylist"
+ "filter": {
+ "schema": "https://schema.org/MusicPlaylist"
+ }
}
}
@@ -752,7 +765,10 @@ descriptor
property, and its value MUST be a JSON object composed as follows:
method
property, and its value MUST be the string CollectionsWrite
.recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string.recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string.contextId
property, and its value MUST be a [RFC4122] UUID Version 4 string.schema
property, and if present its value Must be a URI string that indicates the schema of the associated data.published
property, and if present its value Must be a boolean indicating the record’s publication state. A value of true
indicates the record has been published for public queries and consumption without requiring authorization. A value of false
or the absence of the property indicates the record MUST NOT be served in response to public queries that lack proper authorization.dateCreated
property, and its value MUST be a Unix epoch timestamp that MUST be set and interpreted as the time the logical entry was created by the DID owner or another permitted party.descriptor
property, and its value MUST be a JSON object composed as follows:
method
property, and its value MUST be the string CollectionsCommit
.recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string.recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string.schema
property, and if present its value Must be a URI string that indicates the schema of the associated data.dateCreated
property, and its value MUST be a Unix epoch timestamp that MUST be set and interpreted as the time the logical entry was created by the DID owner or another permitted party.datePublished
property, and its value MUST be a Unix epoch timestamp that MUST be set and interpreted as the time the logical entry was published by the DID owner or another permitted party.descriptor
property, and its value MUST be a JSON object composed as follows:
method
property, and its value MUST be the string CollectionsDelete
.recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string of the record to be deleted.Threads are a linked series of topically associated messages that are intended to result -in activities performed by entities participating in the message thread.
-{ // Message
- "descriptor": { // Message Descriptor
- "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
- "method": "ThreadsQuery",
- "threadId": "b6464162-84af-4aab-aff5-f1f8438dfc1e"
- }
-}
-
-{ // Message
- "data": {...},
- "descriptor": { // Message Descriptor
- "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
- "method": "ThreadsCreate",
- "threadId": "b6464162-84af-4aab-aff5-f1f8438dfc1e",
- "threadType": "https://fintech.org/dex",
- "schema": "https://schema.org/ask",
- "dataType": "application/json"
- }
-}
-
-ThreadsCreate
messages are JSON objects that include general Message Descriptor properties and the following additional properties, which must be composed as follows:
descriptor
property, and its value MUST be a JSON object composed as follows:
-method
property, and its value MUST be the string ThreadsCreate
.threadId
property, and its value MUST be a [RFC4122] UUID Version 4 string for the Thread being created.threadType
property, and its value Must be a URI string that indicates the overall type of thread that is being transacted.schema
property, and its value Must be a URI string that indicates the schema of the data being passed in the thread message.published
property, and if present its value Must be a boolean indicating the thread’s publication state. A value of true
indicates the record has been published for public queries and consumption without requiring authorization. A value of false
or the absence of the property indicates the thread MUST NOT be served in response to public queries that lack proper authorization.{ // Message
- "data": {...},
- "descriptor": { // Message Descriptor
- "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
- "threadId": "b6464162-84af-7gab-aff5-j8f8438dfc1e",
- "parentId": "r7874162-r6hr-456h-g65e-f1f8438dfc1e",
- "method": "ThreadsReply",
- "schema": "https://fintech.org/BidAcceptance"
- }
-}
-
-ThreadsReply
messages are JSON objects that include general Message Descriptor properties and the following additional properties, which must be composed as follows:
descriptor
property, and its value MUST be a JSON object composed as follows:
-method
property, and its value MUST be the string ThreadsReply
.threadId
property, and its value MUST be a [RFC4122] UUID Version 4 string of the Thread to which the reply belongs.parentId
property, and its value MUST be a [RFC4122] UUID Version 4 string of the message in the Thread being replied to.schema
property, and its value Must be a URI string that indicates the schema of the data being passed in the thread message.{ // Message
- "descriptor": { // Message Descriptor
- "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
- "method": "ThreadsClose",
- "threadId": "b6464162-84af-4aab-aff5-f1f8438dfc1e",
- }
-}
-
-ThreadsClose
messages are JSON objects that include general Message Descriptor properties and the following additional properties, which must be composed as follows:
descriptor
property, and its value MUST be a JSON object composed as follows:
-method
property, and its value MUST be the string ThreadsClose
.threadId
property, and its value MUST be a [RFC4122] UUID Version 4 string of the initiating Thread message.{ // Message
- "descriptor": { // Message Descriptor
- "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
- "method": "ThreadsDelete",
- "threadId": "b6464162-84af-4aab-aff5-f1f8438dfc1e",
- }
-}
-
-ThreadsDelete
messages are JSON objects that include general Message Descriptor properties and the following additional properties, which must be composed as follows:
descriptor
property, and its value MUST be a JSON object composed as follows:
-method
property, and its value MUST be the string ThreadsDelete
.threadId
property, and its value MUST be a [RFC4122] UUID Version 4 string of the initiating Thread message.recordId
property, and its value MUST be a [RFC4122] UUID Version 4 string of the record to be deleted.descriptor
property, and its value MUST be a JSON object composed as follows:
method
property, and its value MUST be the string PermissionsGrant
.permissionGrantId
property, and its value MUST be a [RFC4122] UUID Version 4 string representing the reply object.permissionGrantId
property, and its value MUST be a [RFC4122] UUID Version 4 string representing the reply object.PermissionRequest
, the object MUST contain a permissionRequestId
property, and its value MUST be the [RFC4122] UUID Version 4 string of the PermissionRequest
object the permission is being granted in relation to.grantedBy
property, and its value MUST be the DID URI string of the party that is granting the permission.grantedTo
property, and its value MUST be the DID URI string of the party that is being granted the permission.The PermissionQuery
method exists to facilitate lookup of any retained Permissions objects that exist in a given DID’s DWeb Node instance.
{ // Message
"descriptor": { // Message Descriptor
@@ -1156,12 +1077,15 @@ § Query
§ Sync
The Sync interface and its methods allow different Decentralized Web Nodes to communicate and sync on the state of the data they contain, including replication of messages and files.
§ Commit Strategies
-Some interface methods may be bound to, or allow for choice between, the data modification algorithms detailed below. Interfaces methods that are bound to one or more of these strategies will indicate it within their interface definitions under the Interfaces section.
+Collections interface records may operate under the data modification algorithms detailed below. A record may only operate under one commit strategy at a time, as indicated via the value set on the strategy
property of the current CollectionsWrite
root.
§ Last-Write Wins
-Last-Write Wins is the most basic Commit Strategy that allows for the traditional experience of posting an update to a file that fully replaces the data.
+Last-Write Wins is the most basic Commit Strategy that allows for the traditional experience of posting an update to a file that fully replaces the data. This strategy is the default and need not be declared. All Writes and Commits replace all of the preceding record entries.
+§ JSON Patch
+To declare a record is operating under the JSON Merge Patch commit strategy the strategy
property of the current root CollectionsWrite
MUST be set to the value json-patch
.
+JSON Patch is an IETF standard [spec:rfc6902] for modifying the content of JSON documents based on a JSON-encoded delta based operation syntax that, when applied to the target JSON document in accordance with the standard’s rules, may add, remove, or modify the target document. To read more about the syntax of patches, consult IETF JSON Patch [spec:rfc6902].
§ JSON Merge Patch
-TODODetail JSON Merge Patch as a commit strategy option.
-
+To declare a record is operating under the JSON Merge Patch commit strategy the strategy
property of the current root CollectionsWrite
MUST be set to the value json-merge-patch
.
+JSON Merge Patch is an IETF standard [spec:rfc7386] for modifying the content of JSON documents based on partial deltas of a target JSON document that add, remove, and modify the target document when applied according to the standard processing rules. To read more about the syntax of patches, consult IETF JSON Merge Patch [spec:rfc7386].
§ Configurations
While it is strongly encouraged to implement the full set of Decentralized Web Node features and Interfaces, not all devices and providers may be capable of doing so. To allow for maximum reach and proliferation in the ecosystem, the following are well-recognized configurations of Decentralized Web Node feature sets that tend to serve different purposes.
§ Open Data Publication
@@ -1194,7 +1118,7 @@ Delete