Skip to content

Commit 7fd22ca

Browse files
authored
Merge pull request #43 from rubixchain/api-reference2
adding api references get all did, register did
2 parents d5f0ef9 + bbd501d commit 7fd22ca

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

docs/api.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,19 @@ To create a DID, you can use the following API endpoint:
173173

174174
![create did image](/img/basic-api-images/createdid.png)
175175

176+
- **type**[`int`]: DID type (0=Basic, 1=Standard, 2=Wallet, 3=Child, 4=Light; default: 0).
177+
- **priv_pwd**[`string`]: Private key password is needed to encrypt the private key file(default: "mypassword").
178+
- **mnemonic_file**[`String`]:Mnemonic key file (default: "mnemonic.txt").
179+
- **secret**[`string`]: DID secret (default: "My DID Secret").
180+
- **quorum_pwd** [`string`]: Quorum key password (default: "mypassword").
181+
- **img_file** [`string`]: Image file for DID creation (must be 256x256 PNG; default: "image.png").
182+
- **priv_img_file** [`string`]: Private share image file name (default: "pvtShare.png").
183+
- **pub_img_file** [`string`]: Public share image file name (default: "pubShare.png").
184+
- **priv_key_file** `[string]`: Private key file name (default: "pvtKey.pem").
185+
- **pub_key_file** [`string`]: Public key file name (default: "pubKey.pem").
186+
- **childPath** [`int`]: BIP Child Path (default: 0).
187+
188+
176189
**Response**:
177190
```
178191
{
@@ -190,8 +203,75 @@ To create a DID, you can use the following API endpoint:
190203
curl --location 'http://localhost:20900/api/createdid' \
191204
--form 'did_config="{\"type\": 4, \"priv_pwd\":\"mypassword\"}"'
192205
```
206+
### Get all DID's
207+
208+
To get all DIDs of a node, you can use the following API endpoint:
209+
210+
**Endpoint**: `/api/getalldid`
211+
212+
**Method**: `GET`
213+
214+
**Request format**:
215+
- Request body will be empty for this API as shown in the following image.
216+
217+
![getall did image](/img/basic-api-images/getall-did.png)
218+
219+
220+
**curl request**:
221+
```
222+
curl --location 'http://localhost:20900/api/getalldid' \
223+
--data ''
224+
```
225+
226+
### Register DID
227+
To regisster DID, you can use the following API endpoint:
228+
229+
**Endpoint**: `/api/register-did`
230+
231+
**Method**: `POST`
232+
233+
**Request format**:
234+
- **did** [`String`]: The DID of the account which you want to register
235+
236+
**Model request**:
237+
```
238+
{
239+
"did": "bafybmicggfkxfz667vnra3datk5h3y5el24ir7gx7tciciaaoniaxnadwi"
240+
}
241+
```
242+
**Response**:
243+
244+
```
245+
{
246+
"status": true,
247+
"message": "Password needed",
248+
"result": {
249+
"id": "B5C0C562-2F60-4BA7-B887-A0FB64FCBFBA",
250+
"mode": 4,
251+
"hash": null,
252+
"only_priv_key": false
253+
}
254+
}
255+
```
256+
NOTE: Use the `id` in the `api/signature-Response` with password (default password: mypassword).
193257

258+
**Final Response**:
259+
```
260+
{
261+
"status": true,
262+
"message": "DID registered successfully",
263+
"result": null
264+
}
265+
```
194266

267+
**curl request**:
268+
```
269+
curl --location 'http://localhost:20900/api/register-did' \
270+
--header 'Content-Type: application/json' \
271+
--data '{
272+
"did": "bafybmicggfkxfz667vnra3datk5h3y5el24ir7gx7tciciaaoniaxnadwi"
273+
}'
274+
```
195275

196276
###
197277
## Smart Contract
@@ -292,7 +372,7 @@ curl --header "Content-Type: application/json" --request POST 'http://localhost:
292372
}
293373
}
294374
```
295-
NOTE: Use the `id` in the `api/signature-Response` with password if created (default password: mypassword).
375+
NOTE: Use the `id` in the `api/signature-Response` with password (default password: mypassword).
296376

297377
```
298378
{
26.4 KB
Loading

0 commit comments

Comments
 (0)