Privacy

https://img.shields.io/badge/auth-required-orange.svg

Hint

Rules of the creating requests to a node, see How to use the REST API section.

POST /privacy/sendData

Writing the confidential data to the node store.

Method request:

{
  "sender": "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
  "password": "apgJP9atQccdBPA",
  "policyId": "4gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaC",
  "type": "file",
  "info": {
    "filename":"Service contract #100/5.doc",
    "size": 2048,
    "timestamp": 1000000000,
    "author": "[email protected]",
    "comment": "some comments"
   },
   "data": "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=",
   "hash": "FRog42mnzTA292ukng6PHoEK9Mpx9GZNrEHecfvpwmta"
}

Parameters:

  • sender - blockchain address for data broadcast (corresponds the “privacy.owner-address” parameter value in the node configuration file);

  • password - access password to the private key of the node keystore;

  • policyId - the group ID managing data forwarding;

  • type - the type of the data;

  • info - the information about the data;

  • data - строка, содержащая данные в формате base64;

  • hash - sha256-хеш данных в формате base58.

Method answer:

{
  "senderPublicKey": "Gt3o1ghh2M2TS65UrHZCTJ82LLcMcBrxuaJyrgsLk5VY",
  "policyId": "4gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaC",
  "sender": "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
  "dataHash": "FRog42mnzTA292ukng6PHoEK9Mpx9GZNrEHecfvpwmta",
  "proofs": [
  "2jM4tw4uDmspuXUBt6492T7opuZskYhFGW9gkbq532BvLYRF6RJn3hVGNLuMLK8JSM61GkVgYvYJg9UscAayEYfc"
  ],
  "fee": 110000000,
  "id": "H3bdFTatppjnMmUe38YWh35Lmf4XDYrgsDK1P3KgQ5aa",
  "type": 114,
  "timestamp": 1571043910570
 }

POST /privacy/sendDataV2

The second version of the POST /privacy/sendData method allows to stream files with confidential data to the node storage.

Method request:

{
  "sender": "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
  "policyId": "4gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaC",
  "type": "file",
  "hash": "e67ad392ab4d933f39d5234asdd96c18c491140e119d590103e7fd6de15623f9",
  "info": {
    "filename": "Договор об оказании услуг №100/5.doc",
    "size": 2048,
    "timestamp": 1000000000,
    "author": "[email protected]",
    "comment": "la la fam"
  },
  "fee": 15000000,
  "password": "12345qwert",
  "timestamp": 0
}

The parameters differ from the parameters of the POST /privacy/sendData method only in the absence of the Data field. You need to select and attach the data file in the corresponding Swagger window instead of filling the Data field.

Method answer:

{
  "senderPublicKey": "Gt3o1ghh2M2TS65UrHZCTJ82LLcMcBrxuaJyrgsLk5VY",
  "policyId": "4gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaC",
  "sender": "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
  "dataHash": "FRog42mnzTA292ukng6PHoEK9Mpx9GZNrEHecfvpwmta",
  "proofs": [
  "2jM4tw4uDmspuXUBt6492T7opuZskYhFGW9gkbq532BvLYRF6RJn3hVGNLuMLK8JSM61GkVgYvYJg9UscAayEYfc"
  ],
  "fee": 110000000,
  "id": "H3bdFTatppjnMmUe38YWh35Lmf4XDYrgsDK1P3KgQ5aa",
  "type": 114,
  "timestamp": 1571043910570
 }

GET /privacy/{policy-id}/recipients

Getting all addresses of participants, signed to the access group {policy-id}.

Method answer:

[
"3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"3Mx2afTZ2KbRrLNbytyzTtXukZvqEB8SkW7"
]

GET /privacy/{policy-id}/getHashes

Getting all addresses of participants, signed to the access group {policy-id}.

Method answer:

[
  "3GCFaCWtvLDnC9yX29YftMbn75gwfdwGsBn",
  "3GGxcmNyq8ZAHzK7or14Ma84khwW8peBohJ",
  "3GRLFi4rz3SniCuC7rbd9UuD2KUZyNh84pn",
  "3GKpShRQRTddF1yYhQ58ZnKMTnp2xdEzKqW"
]

GET /privacy/{policy-id}/getHashes

Getting the array of identified hashes which are written with association to the {policy-id}.

Method answer:

[
"FdfdNBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"eedfdNBVqYXrapgJP9atQccdBPAgJPwHDKkh6A"
]

GET /privacy/{policyId}​/getData/{policyItemHash}

Getting the confidential data package by its identified hash.

Method answer:

c29tZV9iYXNlNjRfZW5jb2RlZF9zdHJpbmc=

GET ​/privacy​/{policyId}​/getInfo​/{policyItemHash}

Getting the metadata for the confidential data package by the identified hash.

Method answer:

{
  "sender": "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
  "policy": "4gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaC",
  "type": "file",
  "info": {
    "filename": "Contract №100/5.doc",
    "size": 2048,
    "timestamp": 1000000000,
    "author": "[email protected]",
    "comment": "Comment"
  },
"hash": "e67ad392ab4d933f39d5723aeed96c18c491140e119d590103e7fd6de15623f1"
}

POST /privacy/forceSync

Forced getting the confidential data package by the identified hash.

Method answer:

{
  "result": "success" // or "error"
  "message": "Address '3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8' not in policy 'policyName'"
}

POST /privacy/getInfos

Getting the meta information array about private data according with the provided group ID and data hash.

Request example:

{ "policiesDataHashes":
  [
   {
    "policyId": "somepolicyId_1",
    "datahashes": [ "datahash_1","datahash_2" ]
   },
   {
     "policyId": "somepolicyId_2",
     "datahashes": [ "datahash_3","datahash_4" ]
   }
  ]
 }

Method answer:

{
 "policiesDataInfo":[
    {
       "policyId":"somepolicyId_1",
       "datasInfo":[
          {
             "hash":"e67ad392ab4d933f39d5723aeed96c18c491140e119d590103e7fd6de15623f1",
             "sender":"3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
             "type":"file",
             "info":{
                "filename":"Contract №100/5.doc",
                "size":2048,
                "timestamp":1000000000,
                "author":"[email protected]",
                "comment":"Comment"
             }
          },
          {
             "hash":"e67ad392ab4d933f39d5723aeed96c18c491140e119d590103e7fd6de15623f1",
             "sender":"3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
             "type":"file",
             "info":{
                "filename":"Contract №101/5.doc",
                "size":"2048",
                "timestamp":1000000000,
                "author":"[email protected]",
                "comment":"Comment"
             }
          }
          }
        ]
    ]
}