PageSourceSearch

https://elastos-wiki.netlify.app/assets/js/d5fb4b52.ab53507e.js

js elastos-wiki.netlify.app collected 2026-10-03 10:43:38 UTC 40,827 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5572],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),p=d(n),m=a,h=p["".concat(l,".").concat(m)]||p[m]||c[m]||i;return n?r.createElement(h,s(s({ref:t},u),{},{components:n})):r.createElement(h,s({ref:t},u))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[p]="string"==typeof e?e:a,s[1]=o;for(var d=2;d<i;d++)s[d]=n[d];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},4713:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>d,toc:()=>p});var r=n(7462),a=n(3366),i=(n(7294),n(3905)),s=["components"],o={title:"Custom EID RPC Interfaces"},l=void 0,d={unversionedId:"api/sidechains/eid/rpc",id:"api/sidechains/eid/rpc",title:"Custom EID RPC Interfaces",description:"EID inherits all RPC interfaces of ESC, so please refer to the Github Wiki for the full reference. This section describes the two RPC interfaces (didresolveDID and didresolveCredential) that are unique to the EID chain.",source:"@site/../docs/6.api/sidechains/eid/rpc.md",sourceDirName:"6.api/sidechains/eid",slug:"/api/sidechains/eid/rpc",permalink:"/api/sidechains/eid/rpc",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/6.api/sidechains/eid/rpc.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1676175778,formattedLastUpdatedAt:"Feb 12, 2023",frontMatter:{title:"Custom EID RPC Interfaces"},sidebar:"apiSidebar",previous:{title:"Elastos Smart Chain CLI",permalink:"/api/sidechains/esc/cli"},next:{title:"Arbiter JSON-RPC",permalink:"/api/arbiter/rpc"}},u={},p=[{value:"Contents",id:"contents",level:2},{value:"Abstract",id:"abstract",level:2},{value:"DID Resolve",id:"did-resolve",level:2},{value:"Resolve Request",id:"resolve-request",level:3},{value:"method",id:"method",level:4},{value:"params",id:"params",level:4},{value:"id",id:"id",level:4},{value:"Resolve Response",id:"resolve-response",level:3},{value:"jsonrpc",id:"jsonrpc",level:4},{value:"result",id:"result",level:4},{value:"error",id:"error",level:4},{value:"id",id:"id-1",level:4},{value:"Resolve Result Object",id:"resolve-result-object",level:3},{value:"did",id:"did",level:4},{value:"status",id:"status",level:4},{value:"transaction",id:"transaction",level:4},{value:"Examples",id:"examples",level:3},{value:"Resolve the DID document, and the document is valid",id:"resolve-the-did-document-and-the-document-is-valid",level:4},{value:"Request",id:"request",level:5},{value:"Response",id:"response",level:5},{value:"Resolve the DID document, the document is expired",id:"resolve-the-did-document-the-document-is-expired",level:4},{value:"Request",id:"request-1",level:5},{value:"Response",id:"response-1",level:5},{value:"Resolve the DID document, the DID has been deactivated",id:"resolve-the-did-document-the-did-has-been-deactivated",level:4},{value:"Request",id:"request-2",level:5},{value:"Response",id:"response-2",level:5},{value:"Resolve the DID document, the DID does not exist",id:"resolve-the-did-document-the-did-does-not-exist",level:4},{value:"Request",id:"request-3",level:5},{value:"Response",id:"response-3",level:5},{value:"Resolve all DID operation records",id:"resolve-all-did-operation-records",level:4},{value:"Request",id:"request-4",level:5},{value:"Response",id:"response-4",level:5},{value:"Resolve the DID error",id:"resolve-the-did-error",level:4},{value:"Request",id:"request-5",level:5},{value:"Response",id:"response-5",level:5},{value:"DID Query",id:"did-query",level:2},{value:"Query Request",id:"query-request",level:3},{value:"method",id:"method-1",level:4},{value:"params",id:"params-1",level:4},{value:"id",id:"id-2",level:4},{value:"Query Response",id:"query-response",level:3},{value:"jsonrpc",id:"jsonrpc-1",level:4},{value:"result",id:"result-1",level:4},{value:"error",id:"error-1",level:4},{value:"id",id:"id-3",level:4},{value:"Query Result Object",id:"query-result-object",level:3},{value:"total",id:"total",level:4},{value:"start",id:"start",level:4},{value:"count",id:"count",level:4},{value:"document",id:"document",level:4},{value:"Examples",id:"examples-1",level:3},{value:"Querying DIDs containing specific service, return the 3rd page, 10 documents per page",id:"querying-dids-containing-specific-service-return-the-3rd-page-10-documents-per-page",level:4},{value:"Request",id:"request-6",level:5},{value:"Response",id:"response-6",level:5},{value:"Querying DIDs containing specific credential",id:"querying-dids-containing-specific-credential",level:4},{value:"Request",id:"request-7",level:5},{value:"Response",id:"response-7",level:5},{value:"Customized query",id:"customized-query",level:4},{value:"MongoDB&#39;s find condition",id:"mongodbs-find-condition",level:5},{value:"Request",id:"request-8",level:5},{value:"Response",id:"response-8",level:5},{value:"Empty query result",id:"empty-query-result",level:4},{value:"Request",id:"request-9",level:5},{value:"Response",id:"response-9",level:5},{value:"Query error",id:"query-error",level:4},{value:"Request",id:"request-10",level:5},{value:"Response",id:"response-10",level:5},{value:"Error object",id:"error-object",level:2}
1,{value:"code",id:"code",level:3},{value:"message",id:"message",level:3},{value:"data",id:"data",level:3}],c={toc:p},m="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,s);return(0,i.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"EID inherits all RPC interfaces of ESC, so please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/elastos/Elastos.ELA.SideChain.ESC/wiki/JSON-RPC"},"Github Wiki")," for the full reference. This section describes the two RPC interfaces (did_resolveDID and did_resolveCredential) that are unique to the EID chain.")),(0,i.kt)("h2",{id:"contents"},"Contents"),(0,i.kt)("p",null,"This document is the Elastos DID Resolver specification, which is published and maintained by the Elastos Foundation. It mainly explains the definition of the Elastos DID Resolver, as well as the definition of related requests and response data. In the future, we will continue to upgrade this document so that it reflects the latest state of development of the Elastos DID technology."),(0,i.kt)("h2",{id:"abstract"},"Abstract"),(0,i.kt)("p",null,"This specification defines the method and interface for resolving or querying DID on the Elastos ID side chain."),(0,i.kt)("p",null,"Elastos uses the ",(0,i.kt)("a",{parentName:"p",href:"https://www.jsonrpc.org/specification"},"JSON-RPC")," interface to provide the DID resolve method. For more details about ",(0,i.kt)("a",{parentName:"p",href:"https://www.jsonrpc.org/specification"},"JSON-RPC"),", please see specifications on the official website."),(0,i.kt)("h2",{id:"did-resolve"},"DID Resolve"),(0,i.kt)("p",null,"DID Resolve is the method used to resolve specific DID documents."),(0,i.kt)("h3",{id:"resolve-request"},"Resolve Request"),(0,i.kt)("h4",{id:"method"},"method"),(0,i.kt)("p",null,'The string value contains the name of the method to be invoked. For the DID Resolve request, the value is "resolvedid".'),(0,i.kt)("h4",{id:"params"},"params"),(0,i.kt)("p",null,"The object value, which is the parameter to be included in the call of ",(0,i.kt)("inlineCode",{parentName:"p"},"resolvedid")," method. The parameters are defined as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"did"),(0,i.kt)("p",{parentName:"li"},"DID string. Can be a complete DID string, such as ",(0,i.kt)("em",{parentName:"p"},"did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4"),", or just a method specific string, such as: ",(0,i.kt)("em",{parentName:"p"},"iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4"),".")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"all"),(0,i.kt)("p",{parentName:"li"},"Whether or not all operation history of this DID are obtained. Boolean, true or false."))),(0,i.kt)("h4",{id:"id"},"id"),(0,i.kt)("p",null,"The request identifier set by the client must include a string, numerical or null value (if contained). The value usually should not be null, and the numerals should not include decimals."),(0,i.kt)("h3",{id:"resolve-response"},"Resolve Response"),(0,i.kt)("h4",{id:"jsonrpc"},"jsonrpc"),(0,i.kt)("p",null,'The JSON-RPC default response property, a string value, indicates the JSON-RPC protocol version. Must be "2.0."'),(0,i.kt)("h4",{id:"result"},"result"),(0,i.kt)("p",null,"If Resolve is executed successfully, then this member is included, and the value is the result object of resolve. If an error occurs when resolve is invoked, then this member does not exist or is null. See ",(0,i.kt)("a",{parentName:"p",href:"#resolve-result-object"},"Resolve Result Object")," for the definition of the DID Resolver\u2019s resolve result object."),(0,i.kt)("h4",{id:"error"},"error"),(0,i.kt)("p",null,"If Resolve executes normally, then this member does not exist or is null. If there is an error in the execution of Resolve, this member is included, the value is an error object. See ",(0,i.kt)("a",{parentName:"p",href:"#error-object"},"Error Object")," for the definition of error objects."),(0,i.kt)("h4",{id:"id-1"},"id"),(0,i.kt)("p",null,"This member is necessary. It must be identical to the value of the id member in the request object. If an error occurs at the time of ID inspection in the request object (for example resolve error/invalid request), then this value must be null."),(0,i.kt)("h3",{id:"resolve-result-object"},"Resolve Result Object"),(0,i.kt)("p",null,"When the DID Resolve executes successfully, the response must contain a result member whose value is an object c
1ontaining the following members:"),(0,i.kt)("h4",{id:"did"},"did"),(0,i.kt)("p",null,"The request's target DID."),(0,i.kt)("h4",{id:"status"},"status"),(0,i.kt)("p",null,"The numerical value type status code indicates the result status of resolving target DID. This value is an integer. The value is defined as the following:"),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"status"),(0,i.kt)("th",{parentName:"tr",align:null},"meaning"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:null},"DID document is valid. Transaction member contains an array which is the result of requesting DID transaction.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"1"),(0,i.kt)("td",{parentName:"tr",align:null},"DID document is expired. Transaction member contains an array which is the result of requesting DID transaction.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"2"),(0,i.kt)("td",{parentName:"tr",align:null},"DID document is deactivated. Transaction member contains an array which is the result of requesting DID transaction.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"3"),(0,i.kt)("td",{parentName:"tr",align:null},"DID does not exist. The result object does not contain the transaction member.")))),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"When resolving a DID, regardless of the DID status, it should return this object, and should not return the error object, as long as the resolve is executed normally. Different resolve results are expressed though different status values. For example, statuses such as DID does not exists, is expired, or is deactivated, are all normal, and should return this object. It will only return the error object when the Resolver service cannot execute resolve actions, and in general is a JSON-RPC error or a Resolver error itself.")),(0,i.kt)("h4",{id:"transaction"},"transaction"),(0,i.kt)("p",null,"An array object, and the elements are the ID transaction and operation information of the target DID being requested. The element is an object c
1ontaining the following members:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"txid")),(0,i.kt)("p",{parentName:"li"},"The string member which is the current ID transaction's transaction id.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"timestamp")),(0,i.kt)("p",{parentName:"li"},"For the transaction time, whose value must be a valid string value conforming to ",(0,i.kt)("a",{parentName:"p",href:"https://tools.ietf.org/html/rfc3339"},"RFC3339"),' combining the date and time, and must also be normalized to UTC time, followed in "Z."')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"operation")),(0,i.kt)("p",{parentName:"li"},"The object member, which is the payload of the current ID transaction, that is, the JSON object of the DID operation."))),(0,i.kt)("p",null,"When",(0,i.kt)("inlineCode",{parentName:"p"},"all")," in ",(0,i.kt)("a",{parentName:"p",href:"#params"},"the parameters of Resolve DID request")," is ",(0,i.kt)("em",{parentName:"p"},"false"),", the transaction array object only contains information from the target ID's last transaction. When ",(0,i.kt)("inlineCode",{parentName:"p"},"all")," is ",(0,i.kt)("em",{parentName:"p"},"true"),", the transaction array object contains all transaction information of the target DID, and the array elements are stored in descending order according to ID\u2019s transaction time, meaning that no. #0 is the newest ID transaction."),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("h4",{id:"resolve-the-did-document-and-the-document-is-valid"},"Resolve the DID document, and the document is valid"),(0,i.kt)("h5",{id:"request"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "resolvedid",\n  params: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    all: false,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  result: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    status: 0,\n    transaction: [\n      {\n        txid: "467491e6be79fbc6...ce9192d6f15ca81e",\n        timestamp: "2019-08-10T17:30:00Z",\n        operation: {\n          header: {\n            specification: "elastos/did/1.0",\n            operation: "update",\n            previousTxid: "3641de55f368583c...8917756a872093d2",\n          },\n          payload: "eyJpZCI6ImRpZDplbGFzdG9zOmlWUGFk...UMDI6MDA6MDBaIn0",\n          proof: {\n            type: "ECDSAsecp256r1",\n            verificationMethod: "#primary",\n            signature: "IdcfNkS7yA_GHL6g...6lWq7eI9OJGaNPbg",\n          },\n        },\n      },\n    ],\n  },\n}\n')),(0,i.kt)("h4",{id:"resolve-the-did-document-the-document-is-expired"},"Resolve the DID document, the document is expired"),(0,i.kt)("h5",{id:"request-1"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "resolvedid",\n  params: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    all: false,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-1"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  result: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    status: 1,\n    transaction: [\n      {\n        txid: "467491e6be79fbc6...ce9192d6f15ca81e",\n        timestamp: "2019-08-10T17:30:00Z",\n        operation: {\n          header: {\n            specification: "elastos/did/1.0",\n            operation: "update",\n            previousTxid: "3641de55f368583c...8917756a872093d2",\n          },\n          payload: "eyJpZCI6ImRpZDplbGFzdG9zOmlWUGFk...UMDI6MDA6MDBaIn0",\n          proof: {\n            type: "ECDSAsecp256r1",\n            verificationMethod: "#primary",\n            signature: "IdcfNkS7yA_GHL6g...6lWq7eI9OJGaNPbg",\n          },\n        },\n      },\n    ],\n  },\n}\n')),(0,i.kt)("h4",{id:"resolve-the-did-document-the-did-has-been-deactivated"},"Resolve the DID document, the DID has been deactivated"),(0,i.kt)("h5",{id:"request-2"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "resolvedid",\n  params: {\n    did: "iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    all: false,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-2"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  result: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    status: 2,\n    transaction: [\n      {\n        txid: "467491e6be79fbc6...ce9192d6f15ca81e",\n        timestamp: "2019-11-10T21:30:00Z",\n        operation: {\n          header: {\n            specification: "elastos/did/1.0",\n            operation: "deactivate",\n          },\n          payload: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n          proof: {\n            verificationMethod: "#recovery",\n            signature: "IdcfNkS7yA_GHL6g...6lWq7eI9OJGaNPbg",\n          },\n        },\n      },\n    ],\n  },\n}\n')),(0,i.kt)("h4",{id:"resolve-the-did-document-the-did-does-not-exist"},"Resolve the DID document, the DID does not exist"),(0,i.kt)("h5",{id:"request-3"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "resolvedid",\n  params: {\n    did: "iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    all: false,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-3"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  result: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    status: 3,\n  },\n}\n')),(0,i.kt)("h4",{id:"resolve-all-did-operation-records"},"Resolve all DID operation records"),(0,i.kt)("h5",{id:"request-4"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "resolvedid",\n  params: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    all: true,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-4"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  result: {\n    did: "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    status: 0, // Maybe 0, 1, 2\n    transaction: [\n      {\n        txid: "467491e6be79fbc6...ce9192d6f15ca81e",\n        timestamp: "2019-12-1T17:30:00Z",\n        operation: {\n          header: {\n            specification: "elastos/did/1.0",\n            operation: "update",\n            previousTxid: "3641de55f368583c...8917756a872093d2",\n          },\n          payload: "eyJpZCI6ImRpZDplbGFzdG9zOmlWUGFk...UMDI6MDA6MDBaIn0",\n          proof: {\n            type: "ECDSAsecp256r1",\n            verificationMethod: "#primary",\n            signature: "IdcfNkS7yA_GHL6g...6lWq7eI9OJGaNPbg",\n          },\n        },\n      },\n      {\n        txid: "3641de55f368583c...8917756a872093d2",\n        timestamp: "2019-10-18T10:30:00Z",\n        operation: {\n          header: {\n            specification: "elastos/did/1.0",\n            operation: "update",\n            previousTxid: "3a2936c4777f02a9...3f683c82a1aa378c",\n          },\n          payload: "E1NndTUkR2dEQ1SEt2Q1BOcnlITszcV...ZTVTQiLCJw
1dWJsaW",\n          proof: {\n            type: "ECDSAsecp256r1",\n            verificationMethod: "#primary",\n            signature: "xOanVzekR2aGk5aW...l2NlJxQ0RHc1Rjc0",\n          },\n        },\n      },\n      {\n        txid: "3a2936c4777f02a9...3f683c82a1aa378c",\n        timestamp: "2019-08-10T17:30:00Z",\n        operation: {\n          header: {\n            specification: "elastos/did/1.0",\n            operation: "create",\n          },\n          payload: "NLZXkiOlt7ImlkIjoiI3ByaW1hcnkiLC...JwdWJsaWNLZXlCYX",\n          proof: {\n            type: "ECDSAsecp256r1",\n            verificationMethod: "#primary",\n            signature: "NlNTgiOiJwdmZBUU...68dTRnTm1hdDZHTE",\n          },\n        },\n      },\n    ],\n  },\n}\n')),(0,i.kt)("h4",{id:"resolve-the-did-error"},"Resolve the DID error"),(0,i.kt)("h5",{id:"request-5"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "resolvedid",\n  params: {\n    did: "iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",\n    all: false,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-5"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  error: {\n    code: -32001,\n    message: "Resolver internal error.",\n  },\n}\n')),(0,i.kt)("h2",{id:"did-query"},"DID Query"),(0,i.kt)("p",null,"DID Query is a method for querying DID documents on the ID side chain. The query scope is all latest DID documents in non-deactivated state, the expired documents are in the scope."),(0,i.kt)("h3",{id:"query-request"},"Query Request"),(0,i.kt)("h4",{id:"method-1"},"method"),(0,i.kt)("p",null,'The string value contains the name of the method to be invoked. For the DID query request, the value is "query".'),(0,i.kt)("h4",{id:"params-1"},"params"),(0,i.kt)("p",null,"The object value, which is the parameter to be included in the call of ",(0,i.kt)("inlineCode",{parentName:"p"},"query")," method. The parameters are defined as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"service"),(0,i.kt)("p",{parentName:"li"},'Optional, a string representing the service type. For service type, see the definition of service in the Elastos DID method specification. Only supports single values. For complex queries, use "query".')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"credential"),(0,i.kt)("p",{parentName:"li"},'Optional, a string representing the credential type. For credential type, see the definition of credential in the Elastos Verifiable Claims Specification. Only supports single values. For complex queries, use "query".')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"query"),(0,i.kt)("p",{parentName:"li"},"Optional, query conditions in MongoDB query syntax, only supports the conditional syntax of MongoDB's find method.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"skip"),(0,i.kt)("p",{parentName:"li"},"Optional, the number of documents to skip in the results set. The default value is 0.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"limit"),(0,i.kt)("p",{parentName:"li"},"Optional, the number of documents returned in the result set."),(0,i.kt)("p",{parentName:"li"},"If no limit is specified, the size of the results returned is determined by the server. If the result set is large, the server may return a subset of the results to avoid excessive server resource consumption."))),(0,i.kt)("p",null,"Although all the above three parameters ",(0,i.kt)("inlineCode",{parentName:"p"},"service"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"credential")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"query")," are optional, they can only support one and must have one."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"skip")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"limit")," parameters are used to provide pagination support, which controls the subset of the query results that should be returned."),(0,i.kt)("h4",{id:"id-2"},"id"),(0,i.kt)("p",null,"The request identifier set by the client must include a string, numerical or null value (if contained). The value usually should not be null, and the numerals should not include decimals."),(0,i.kt)("h3",{id:"query-response"},"Query Response"),(0,i.kt)("h4",{id:"jsonrpc-1"},"jsonrpc"),(0,i.kt)("p",null,'The JSON-RPC default response property, a string value, indicates the JSON-RPC protocol version. Must be "2.0."'),(0,i.kt)("h4",{id:"result-1"},"result"),(0,i.kt)("p",null,"If query is executed successfully, then this member is included, and the value is the result object of query. If an error occurs when query is invoked, then this member does not exist or is null. See ",(0,i.kt)("a",{parentName:"p",href:"#query-result-object"},"Query Result Object")," for the definition of the DID query result object."),(0,i.kt)("h4",{id:"error-1"},"error"),(0,i.kt)("p",null,"If query executes normally, then this member does not exist or is null. If there is an error in the execution of query, this member is included, the value is an error object. See ",(0,i.kt)("a",{parentName:"p",href:"#error-object"},"Error Object")," for the definition of error objects."),(0,i.kt)("h4",{id:"id-3"},"id"),(0,i.kt)("p",null,"This member is necessary. It must be identical to the value of the id member in the request object. If an error occurs at the time of ID inspection in the request object (for example query error/invalid request), then this value must be null."),(0,i.kt)("h3",{id:"query-result-object"},"Query Result Object"),(0,i.kt)("p",null,"When the DID Query executes successfully, the response must contain a result member whose value is an object c
1ontaining the following members:"),(0,i.kt)("h4",{id:"total"},"total"),(0,i.kt)("p",null,"The total number of document that meet the query conditions."),(0,i.kt)("h4",{id:"start"},"start"),(0,i.kt)("p",null,"The start document position of the current results set."),(0,i.kt)("h4",{id:"count"},"count"),(0,i.kt)("p",null,"The number of documents returned in the current result set."),(0,i.kt)("h4",{id:"document"},"document"),(0,i.kt)("p",null,"An array object, and the elements are the DID document that meet the query conditions. If there are no matching DIDs, an empty array is returned."),(0,i.kt)("h3",{id:"examples-1"},"Examples"),(0,i.kt)("h4",{id:"querying-dids-containing-specific-service-return-the-3rd-page-10-documents-per-page"},"Querying DIDs containing specific service, return the 3rd page, 10 documents per page"),(0,i.kt)("h5",{id:"request-6"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "query",\n  params: {\n    service: "CredentialRepositoryService",\n    skip: 20,\n    limit: 10,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-6"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  "id": "8555cbd1afbf3b8fd8748464ee949574",\n  "jsonrpc": "2.0",\n  "result": {\n    "total": 1234,\n    "start": 20,\n    "count": 10,\n    "document": [{\n      "id":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz",\n      "publicKey":[\n        {\n          "id":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz",\n          "publicKeyBase58":"29sd8BAPMWcTvDxT2igvQ86rbd8WYboYbmt3szo1zszdB"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz#primary",\n        "signatureValue":"DNBIrcX9...Dz0j5q1g"\n      }\n    }, {\n      "id":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m",\n      "publicKey":[\n        {\n          "id":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m",\n          "publicKeyBase58":"22z1jcrBqX75yRBUNgDHkWmPs1SGe57gkHYA7UCij6Nge"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m#primary",\n        "signatureValue":"vJH4s1KH...LWSU-8MA"\n      }\n    },\n    ......\n    {\n      "id":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT",\n      "publicKey":[\n        {\n          "id":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT",\n          "publicKeyBase58":"26aiYAHBGGKvHWneoaLfgJNKihfGjhHsva1YLBT89WvFB"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT#primary",\n        "signatureValue":"4yoSU799...zv5euakA"\n      }\n    }]\n  }\n}\n')),(0,i.kt)("h4",{id:"querying-dids-containing-specific-credential"},"Querying DIDs containing specific credential"),(0,i.kt)("h5",{id:"request-7"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "query",\n  params: {\n    credential: "TrinityCredential",\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-7"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  "id": "8555cbd1afbf3b8fd8748464ee949574",\n  "jsonrpc": "2.0",\n  "result": {\n    "total": 1234,\n    "start": 0,\n    "count": 20,\n    "document": [{\n      "id":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz",\n      "publicKey":[\n        {\n          "id":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz",\n          "publicKeyBase58":"29sd8BAPMWcTvDxT2igvQ86rbd8WYboYbmt3szo1zszdB"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz#primary",\n        "signatureValue":"DNBIrcX9...Dz0j5q1g"\n      }\n    }, {\n      "id":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m",\n      "publicKey":[\n        {\n          "id":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m",\n          "publicKeyBase58":"22z1jcrBqX75yRBUNgDHkWmPs1SGe57gkHYA7UCij6Nge"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m#primary",\n        "signatureValue":"vJH4s1KH...LWSU-8MA"\n      }\n    },\n    ......\n    {\n      "id":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT",\n      "publicKey":[\n        {\n          "id":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT",\n          "publicKeyBase58":"26aiYAHBGGKvHWneoaLfgJNKihfGjhHsva1YLBT89WvFB"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT#primary",\n        "signatureValue":"4yoSU799...zv5euakA"\n      }\n    }]\n  }\n}\n')),(0,i.kt)("h4",{id:"customized-query"},"Customized query"),(0,i.kt)("h5",{id:"mongodbs-find-condition"},"MongoDB's find condition"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  credential: {\n    type: ["SelfProclaimedCredential"],\n    subject: {\n      email: { $exists: true },\n    },\n  },\n}\n')),(0,i.kt)("h5",{id:"request-8"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "query",\n  params: {\n    query: \'{"credential":{"type":["SelfProclaimedCredential"],"subject":{"email":{$exists:true}}}}\',\n    skip: 10,\n    limit: 10,\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-8"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  "id": "8555cbd1afbf3b8fd8748464ee949574",\n  "jsonrpc": "2.0",\n  "result": {\n    "total": 1234,\n    "start": 10,\n    "count": 10,\n    "document": [{\n      "id":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz",\n      "publicKey":[\n        {\n          "id":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz",\n          "publicKeyBase58":"29sd8BAPMWcTvDxT2igvQ86rbd8WYboYbmt3szo1zszdB"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ir3YWGtyHNe9FoX9JXELgxCd8VkrGDaGcz#primary",\n        "signatureValue":"DNBIrcX9...Dz0j5q1g"\n      }\n    }, {\n      "id":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m",\n      "publicKey":[\n        {\n          "id":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m",\n          "publicKeyBase58":"22z1jcrBqX75yRBUNgDHkWmPs1SGe57gkHYA7UCij6Nge"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ieMT72pyCe6NtHC9wbeKoVR1vjkWVTaG3m#primary",\n        "signatureValue":"vJH4s1KH...LWSU-8MA"\n      }\n    },\n    ......\n    {\n      "id":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT",\n      "publicKey":[\n        {\n          "id":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT#primary",\n          "type":"ECDSAsecp256r1",\n          "controller":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT",\n          "publicKeyBase58":"26aiYAHBGGKvHWneoaLfgJNKihfGjhHsva1YLBT89WvFB"\n        }\n      ],\n      ......\n      "expires":"2025-03-24T02:25:41Z",\n      "proof":{\n        "type":"ECDSAsecp256r1",\n        "created":"2020-03-24T02:25:41Z",\n        "creator":"did:elastos:ioz9sPWmCdATbpbhSmrYGJ5V9hYkqT1kGT#primary",\n        "signatureValue":"4yoSU799...zv5euakA"\n      }\n    }]\n  }\n}\n')),(0,i.kt)("h4",{id:"empty-query-result"},"Empty query result"),(0,i.kt)("h5",{id:"request-9"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "query",\n  params: {\n    query: \'{"credential":{"type":["InternetCredential"],"subject":{"email":{$exists:true}}}}\',\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-9"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  result: {\n    total: 0,\n    start: 0,\n    count: 0,\n    document: [],\n  },\n}\n')),(0,i.kt)("h4",{id:"query-error"},"Query error"),(0,i.kt)("h5",{id:"request-10"},"Request"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  method: "query",\n  params: {\n    service: "carrier",\n    query: \'{"credential":{"type":["SelfProclaimedCredential"],"subject":{"email":{$exists:true}}}}\',\n  },\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n}\n')),(0,i.kt)("h5",{id:"response-10"},"Response"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json5"},'{\n  id: "8555cbd1afbf3b8fd8748464ee949574",\n  jsonrpc: "2.0",\n  error: {\n    code: -32602,\n    message: "Query parameters invalid.",\n  },\n}\n')),(0,i.kt)("h2",{id:"error-object"},"Error object"),(0,i.kt)("p",null,"When the Resolve or Query encounters an error, an error member must be contained in the response, whose value is an object c
1ontaining the following members:"),(0,i.kt)("h3",{id:"code"},"code"),(0,i.kt)("p",null,"The numerical type error code indicating the error type occurred. This value is an integer."),(0,i.kt)("p",null,"According to the definition in ",(0,i.kt)("a",{parentName:"p",href:"https://www.jsonrpc.org/specification"},"specification"),", error codes from -32768 to -32000 (including -32768 to -32000) are reserved for predefined errors. Any code within this scope that has not been specifically defined below is reserved for future use."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"code"),(0,i.kt)("th",{parentName:"tr",align:null},"message"),(0,i.kt)("th",{parentName:"tr",align:null},"meaning"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"-32700"),(0,i.kt)("td",{parentName:"tr",align:null},"Parse error"),(0,i.kt)("td",{parentName:"tr",align:null},"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"-32600"),(0,i.kt)("td",{parentName:"tr",align:null},"Invalid Request"),(0,i.kt)("td",{parentName:"tr",align:null},"The JSON sent is not a valid Request object.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"-32601"),(0,i.kt)("td",{parentName:"tr",align:null},"Method not found"),(0,i.kt)("td",{parentName:"tr",align:null},"The method does not exist / is not available.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"-32602"),(0,i.kt)("td",{parentName:"tr",align:null},"Invalid params"),(0,i.kt)("td",{parentName:"tr",align:null},"Invalid method parameter(s).")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"-32603"),(0,i.kt)("td",{parentName:"tr",align:null},"Internal error"),(0,i.kt)("td",{parentName:"tr",align:null},"Internal JSON-RPC error.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"-32000 to -32099"),(0,i.kt)("td",{parentName:"tr",align:null},"Server error"),(0,i.kt)("td",{parentName:"tr",align:null},"Reserved for implementation-defined server-errors.")))),(0,i.kt)("h3",{id:"message"},"message"),(0,i.kt)("p",null,"A string briefly describing the error. Generally, a concise sentence."),(0,i.kt)("h3",{id:"data"},"data"),(0,i.kt)("p",null,"Member optional, contains other information related to the error. The value is defined by the Resolver server (for example, detailed error information, nested errors, etc.)."))}h.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.