1 | # Indy SDK for Node.js
|
2 |
|
3 | [![stability - experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](https://nodejs.org/api/documentation.html#documentation_stability_index)
|
4 | ![Node version](https://img.shields.io/node/v/indy-sdk.svg)
|
5 |
|
6 | Native bindings for [Hyperledger Indy](https://www.hyperledger.org/projects/hyperledger-indy).
|
7 |
|
8 | - [Installing](#installing)
|
9 | - [Usage](#usage)
|
10 | - [API](#api)
|
11 | * [IndyError](#indyerror)
|
12 | * [anoncreds](#anoncreds)
|
13 | * [blob_storage](#blob_storage)
|
14 | * [crypto](#crypto)
|
15 | * [did](#did)
|
16 | * [ledger](#ledger)
|
17 | * [non_secrets](#non_secrets)
|
18 | * [pairwise](#pairwise)
|
19 | * [payment](#payment)
|
20 | * [pool](#pool)
|
21 | * [wallet](#wallet)
|
22 | * [logger](#logger)
|
23 | * [cache](#cache)
|
24 | * [mod](#mod)
|
25 | - [Advanced](#advanced)
|
26 | - [Contributing](#contributing)
|
27 |
|
28 | ## Installing
|
29 |
|
30 | This module has a native compile step. It compiles C++ code and dynamically links to `libindy`.
|
31 |
|
32 | You will need:
|
33 |
|
34 | * C++ build tools and Python 3.6+. See [this](https://github.com/nodejs/node-gyp#installation) for platform recommendations.
|
35 | * `libindy` v1.6+ in your system library path. (i.e. `/usr/lib/libindy.so` for linux)
|
36 |
|
37 | Then you can install via npm:
|
38 |
|
39 | ```sh
|
40 | npm install --save indy-sdk
|
41 | ```
|
42 |
|
43 | #### Troubleshooting
|
44 | Use environment variable `RUST_LOG={info|debug|trace}` to output logs of Libindy.
|
45 |
|
46 | ##### Linking errors
|
47 |
|
48 | i.e. `ld: library not found for -llibindy`
|
49 |
|
50 | First, make sure you have the latest libindy for your platform. Also make sure you have any other libraries it depends on. See [indy-sdk/doc](https://github.com/hyperledger/indy-sdk/tree/master/doc)
|
51 |
|
52 | Second, make sure it's in the linker search path. The easiest way is to use the system library path.
|
53 | * ubuntu `/usr/lib/libindy.so`
|
54 | * osx `/usr/local/lib/libindy.dylib`
|
55 | * windows use LD_LIBRARY_PATH to indicate the location of dll as specified below
|
56 |
|
57 | If you want to put the library in a custom folder i.e. `/foo/bar/libindy.so` then you can do this:
|
58 | ```sh
|
59 | LD_LIBRARY_PATH=/foo/bar npm i --save indy-sdk
|
60 | ```
|
61 | Then when you run your code, you'll still need the `LD_LIBRARY_PATH` set.
|
62 | ```sh
|
63 | LD_LIBRARY_PATH=/foo/bar node index.js
|
64 | ```
|
65 |
|
66 | ##### Other build errors
|
67 |
|
68 | We use [node-gyp](https://github.com/nodejs/node-gyp#installation) to manage the cross-platform build. Their readme is quite helpful.
|
69 |
|
70 | ## Usage
|
71 |
|
72 | ```js
|
73 | var indy = require('indy-sdk')
|
74 |
|
75 | var did = '...'
|
76 | var fullVerkey = '...'
|
77 |
|
78 | indy.abbreviateVerkey(did, fullVerkey, function(err, verkey){
|
79 | ..
|
80 | })
|
81 |
|
82 | // if you do not provide a callback, a Promise is returned
|
83 |
|
84 | var verkey = await indy.abbreviateVerkey(did, fullVerkey)
|
85 | ```
|
86 |
|
87 | # API
|
88 |
|
89 | ### IndyError
|
90 |
|
91 | All the functions may yield an IndyError. The errors are based on libindy error codes defined [here](https://github.com/hyperledger/indy-sdk/blob/master/libindy/include/indy_mod.h).
|
92 |
|
93 | * `err.indyCode`: Int - code number from libindy
|
94 | * `err.indyName`: String - name for the error code
|
95 | * `err.indyMessage`: String - human-readable error description
|
96 | * `err.indyBacktrace`: String? - if enabled, this is the libindy backtrace string
|
97 |
|
98 | Collecting of backtrace can be enabled by:
|
99 | 1. Setting environment variable `RUST_BACKTRACE=1`
|
100 | 2. Calling [setRuntimeConfig](#setruntimeconfig--config-)(`{collect_backtrace: true}`)
|
101 |
|
102 | ### anoncreds
|
103 |
|
104 | These functions wrap the Ursa algorithm as documented in this [paper](https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf):
|
105 |
|
106 | And is documented in this [HIPE](https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336fdc8cc1/text/anoncreds-protocol/README.md):
|
107 |
|
108 | #### issuerCreateSchema \( issuerDid, name, version, attrNames \) -> \[ id, schema \]
|
109 |
|
110 | Create credential schema entity that describes credential attributes list and allows credentials
|
111 | interoperability.
|
112 |
|
113 | Schema is public and intended to be shared with all anoncreds workflow actors usually by publishing SCHEMA transaction
|
114 | to Indy distributed ledger.
|
115 |
|
116 | It is IMPORTANT for current version POST Schema in Ledger and after that GET it from Ledger
|
117 | with correct seq\_no to save compatibility with Ledger.
|
118 | After that can call issuerCreateAndStoreCredentialDef to build corresponding Credential Definition.
|
119 |
|
120 | * `issuerDid`: String - DID of schema issuer
|
121 | * `name`: String - a name the schema
|
122 | * `version`: String - a version of the schema
|
123 | * `attrNames`: Json - a list of schema attributes descriptions (the number of attributes should be less or equal than 125)
|
124 | * __->__ [ `id`: String, `schema`: Json ] - schema\_id: identifier of created schema
|
125 | schema\_json: schema as json
|
126 |
|
127 | Errors: `Common*`, `Anoncreds*`
|
128 |
|
129 | #### issuerCreateAndStoreCredentialDef \( wh, issuerDid, schema, tag, signatureType, config \) -> \[ credDefId, credDef \]
|
130 |
|
131 | Create credential definition entity that encapsulates credentials issuer DID, credential schema, secrets used for signing credentials
|
132 | and secrets used for credentials revocation.
|
133 |
|
134 | Credential definition entity contains private and public parts. Private part will be stored in the wallet. Public part
|
135 | will be returned as json intended to be shared with all anoncreds workflow actors usually by publishing CRED\_DEF transaction
|
136 | to Indy distributed ledger.
|
137 |
|
138 | It is IMPORTANT for current version GET Schema from Ledger with correct seq\_no to save compatibility with Ledger.
|
139 |
|
140 | Note: Use combination of `issuerRotateCredentialDefStart` and `indy_issuer_rotate_credential_def_apply` functions
|
141 | to generate new keys for an existing credential definition.
|
142 |
|
143 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
144 | * `issuerDid`: String - a DID of the issuer signing cred\_def transaction to the Ledger
|
145 | * `schema`: Json - credential schema as a json
|
146 | * `tag`: String - allows to distinct between credential definitions for the same issuer and schema
|
147 | * `signatureType`: String - credential definition type \(optional, 'CL' by default\) that defines credentials signature and revocation math. Supported types are:
|
148 | * 'CL': Camenisch-Lysyanskaya credential signature type that is implemented according to the algorithm in this paper:
|
149 | https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf
|
150 | And is documented in this HIPE:
|
151 | https://github.com/hyperledger/indy-hipe/blob/c761c583b1e01c1e9d3ceda2b03b35336fdc8cc1/text/anoncreds-protocol/README.md
|
152 |
|
153 | * `config`: Json - \(optional\) type-specific configuration of credential definition as json:
|
154 | * 'CL':
|
155 | * support\_revocation: whether to request non-revocation credential \(optional, default false\)
|
156 | * __->__ [ `credDefId`: String, `credDef`: Json ] - cred\_def\_id: identifier of created credential definition
|
157 | cred\_def\_json: public part of created credential definition
|
158 |
|
159 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
160 |
|
161 | #### issuerRotateCredentialDefStart \( wh, credDefId, config \) -> credDef
|
162 |
|
163 | Generate temporary credential definitional keys for an existing one (owned by the caller of the library).
|
164 |
|
165 | Use `issuerRotateCredentialDefApply` function to set temporary keys as the main.
|
166 |
|
167 | **WARNING**: Rotating the credential definitional keys will result in making all credentials issued under the previous keys unverifiable.
|
168 |
|
169 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
170 | * `credDefId`: String - an identifier of created credential definition stored in the wallet
|
171 | * `config`: Json - \(optional\) type-specific configuration of credential definition as json:
|
172 | * 'CL':
|
173 | * support\_revocation: whether to request non-revocation credential \(optional, default false\)
|
174 | * __->__ `credDef`: Json - public part of temporary created credential definition
|
175 |
|
176 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
177 |
|
178 | #### issuerRotateCredentialDefApply \( wh, credDefId \) -> void
|
179 |
|
180 | Apply temporary keys as main for an existing Credential Definition (owned by the caller of the library).
|
181 |
|
182 | **WARNING**: Rotating the credential definitional keys will result in making all credentials issued under the previous keys unverifiable.
|
183 |
|
184 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
185 | * `credDefId`: String - an identifier of created credential definition stored in the wallet
|
186 | * __->__ void
|
187 |
|
188 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
189 |
|
190 | #### issuerCreateAndStoreRevocReg \( wh, issuerDid, revocDefType, tag, credDefId, config, tailsWriterHandle \) -> \[ revocRegId, revocRegDef, revocRegEntry \]
|
191 |
|
192 | Create a new revocation registry for the given credential definition as tuple of entities
|
193 | - Revocation registry definition that encapsulates credentials definition reference, revocation type specific configuration and
|
194 | secrets used for credentials revocation
|
195 | - Revocation registry state that stores the information about revoked entities in a non-disclosing way. The state can be
|
196 | represented as ordered list of revocation registry entries were each entry represents the list of revocation or issuance operations.
|
197 |
|
198 | Revocation registry definition entity contains private and public parts. Private part will be stored in the wallet. Public part
|
199 | will be returned as json intended to be shared with all anoncreds workflow actors usually by publishing REVOC\_REG\_DEF transaction
|
200 | to Indy distributed ledger.
|
201 |
|
202 | Revocation registry state is stored on the wallet and also intended to be shared as the ordered list of REVOC\_REG\_ENTRY transactions.
|
203 | This call initializes the state in the wallet and returns the initial entry.
|
204 |
|
205 | Some revocation registry types \(for example, 'CL\_ACCUM'\) can require generation of binary blob called tails used to hide information about revoked credentials in public
|
206 | revocation registry and intended to be distributed out of leger \(REVOC\_REG\_DEF transaction will still contain uri and hash of tails\).
|
207 | This call requires access to pre-configured blob storage writer instance handle that will allow to write generated tails.
|
208 |
|
209 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
210 | * `issuerDid`: String - a DID of the issuer signing transaction to the Ledger
|
211 | * `revocDefType`: String - revocation registry type \(optional, default value depends on credential definition type\). Supported types are:
|
212 | * 'CL\_ACCUM': Type-3 pairing based accumulator implemented according to the algorithm in this paper:
|
213 | https://github.com/hyperledger/ursa/blob/master/libursa/docs/AnonCred.pdf
|
214 | This type is default for 'CL' credential definition type.
|
215 | * `tag`: String - allows to distinct between revocation registries for the same issuer and credential definition
|
216 | * `credDefId`: String - id of stored in ledger credential definition
|
217 | * `config`: Json - type-specific configuration of revocation registry as json:
|
218 | * 'CL\_ACCUM':
|
219 | ```
|
220 | {
|
221 | "issuance_type": (optional) type of issuance. Currently supported:
|
222 | 1) ISSUANCE_BY_DEFAULT: all indices are assumed to be issued and initial accumulator is calculated over all indices;
|
223 | Revocation Registry is updated only during revocation.
|
224 | 2) ISSUANCE_ON_DEMAND: nothing is issued initially accumulator is 1 (used by default);
|
225 | "max_cred_num": maximum number of credentials the new registry can process (optional, default 100000)
|
226 | }
|
227 | ````
|
228 | * `tailsWriterHandle`: Handle (Number) - handle of blob storage to store tails
|
229 |
|
230 | NOTE:
|
231 | Recursive creation of folder for Default Tails Writer (correspondent to `tailsWriterHandle`)
|
232 | in the system-wide temporary directory may fail in some setup due to permissions: `IO error: Permission denied`.
|
233 | In this case use `TMPDIR` environment variable to define temporary directory specific for an application.
|
234 |
|
235 | * __->__ [ `revocRegId`: String, `revocRegDef`: Json, `revocRegEntry`: Json ] - revoc\_reg\_id: identifier of created revocation registry definition
|
236 | revoc\_reg\_def\_json: public part of revocation registry definition
|
237 | revoc\_reg\_entry\_json: revocation registry entry that defines initial state of revocation registry
|
238 |
|
239 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
240 |
|
241 | #### issuerCreateCredentialOffer \( wh, credDefId \) -> credOffer
|
242 |
|
243 | Create credential offer that will be used by Prover for
|
244 | credential request creation. Offer includes nonce and key correctness proof
|
245 | for authentication between protocol steps and integrity checking.
|
246 |
|
247 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
248 | * `credDefId`: String - id of credential definition stored in the wallet
|
249 | * __->__ `credOffer`: Json - credential offer json:
|
250 | ```
|
251 | {
|
252 | "schema_id": string,
|
253 | "cred_def_id": string,
|
254 | // Fields below can depend on Cred Def type
|
255 | "nonce": string,
|
256 | "key_correctness_proof" : key correctness proof for credential definition correspondent to cred_def_id
|
257 | (opaque type that contains data structures internal to Ursa.
|
258 | It should not be parsed and are likely to change in future versions).
|
259 | }
|
260 | ````
|
261 |
|
262 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
263 |
|
264 | #### issuerCreateCredential \( wh, credOffer, credReq, credValues, revRegId, blobStorageReaderHandle \) -> \[ cred, credRevocId, revocRegDelta \]
|
265 |
|
266 | Check Cred Request for the given Cred Offer and issue Credential for the given Cred Request.
|
267 |
|
268 | Cred Request must match Cred Offer. The credential definition and revocation registry definition
|
269 | referenced in Cred Offer and Cred Request must be already created and stored into the wallet.
|
270 |
|
271 | Information for this credential revocation will be store in the wallet as part of revocation registry under
|
272 | generated cred\_revoc\_id local for this wallet.
|
273 |
|
274 | This call returns revoc registry delta as json file intended to be shared as REVOC\_REG\_ENTRY transaction.
|
275 | Note that it is possible to accumulate deltas to reduce ledger load.
|
276 |
|
277 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
278 | * `credOffer`: Json - a cred offer created by issuerCreateCredentialOffer
|
279 | * `credReq`: Json - a credential request created by proverCreateCredentialReq
|
280 | * `credValues`: Json - a credential containing attribute values for each of requested attribute names.
|
281 | Example:
|
282 | ```
|
283 | {
|
284 | "attr1" : {"raw": "value1", "encoded": "value1_as_int" },
|
285 | "attr2" : {"raw": "value1", "encoded": "value1_as_int" }
|
286 | }
|
287 | ````
|
288 | If you want to use empty value for some credential field, you should set "raw" to "" and "encoded" should not be empty
|
289 | * `revRegId`: String - id of revocation registry stored in the wallet
|
290 | * `blobStorageReaderHandle`: Handle (Number) - configuration of blob storage reader handle that will allow to read revocation tails
|
291 | * __->__ [ `cred`: Json, `credRevocId`: String, `revocRegDelta`: Json ] - cred\_json: Credential json containing signed credential values
|
292 | ```
|
293 | {
|
294 | "schema_id": string,
|
295 | "cred_def_id": string,
|
296 | "rev_reg_def_id", Optional<string>,
|
297 | "values": <see cred_values_json above>,
|
298 | // Fields below can depend on Cred Def type
|
299 | "signature": <credential signature>,
|
300 | (opaque type that contains data structures internal to Ursa.
|
301 | It should not be parsed and are likely to change in future versions).
|
302 | "signature_correctness_proof": <signature_correctness_proof>
|
303 | (opaque type that contains data structures internal to Ursa.
|
304 | It should not be parsed and are likely to change in future versions).
|
305 | }
|
306 | cred_revoc_id: local id for revocation info (Can be used for revocation of this credential)
|
307 | revoc_reg_delta_json: Revocation registry delta json with a newly issued credential
|
308 | ````
|
309 |
|
310 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
311 |
|
312 | #### issuerRevokeCredential \( wh, blobStorageReaderHandle, revRegId, credRevocId \) -> revocRegDelta
|
313 |
|
314 | Revoke a credential identified by a cred\_revoc\_id \(returned by issuerCreateCredential\).
|
315 |
|
316 | The corresponding credential definition and revocation registry must be already
|
317 | created an stored into the wallet.
|
318 |
|
319 | This call returns revoc registry delta as json file intended to be shared as REVOC\_REG\_ENTRY transaction.
|
320 | Note that it is possible to accumulate deltas to reduce ledger load.
|
321 |
|
322 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
323 | * `blobStorageReaderHandle`: Handle (Number)
|
324 | * `revRegId`: String - id of revocation registry stored in wallet
|
325 | * `credRevocId`: String - local id for revocation info
|
326 | * __->__ `revocRegDelta`: Json - revoc\_reg\_delta\_json: Revocation registry delta json with a revoked credential
|
327 |
|
328 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
329 |
|
330 | #### issuerMergeRevocationRegistryDeltas \( revRegDelta, otherRevRegDelta \) -> mergedRevRegDelta
|
331 |
|
332 | Merge two revocation registry deltas \(returned by issuerCreateCredential or issuerRevokeCredential\) to accumulate common delta.
|
333 | Send common delta to ledger to reduce the load.
|
334 |
|
335 | * `revRegDelta`: Json - revocation registry delta.
|
336 | * `otherRevRegDelta`: Json - revocation registry delta for which PrevAccum value is equal to current accum value of rev\_reg\_delta\_json.
|
337 | * __->__ `mergedRevRegDelta`: Json - merged\_rev\_reg\_delta: Merged revocation registry delta
|
338 |
|
339 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
340 |
|
341 | #### proverCreateMasterSecret \( wh, masterSecretId \) -> outMasterSecretId
|
342 |
|
343 | Creates a master secret with a given id and stores it in the wallet.
|
344 | The id must be unique.
|
345 |
|
346 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
347 | * `masterSecretId`: String - \(optional, if not present random one will be generated\) new master id
|
348 | * __->__ `outMasterSecretId`: String - out\_master\_secret\_id: Id of generated master secret
|
349 |
|
350 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
351 |
|
352 | #### proverCreateCredentialReq \( wh, proverDid, credOffer, credDef, masterSecretId \) -> \[ credReq, credReqMetadata \]
|
353 |
|
354 | Creates a credential request for the given credential offer.
|
355 |
|
356 | The method creates a blinded master secret for a master secret identified by a provided name.
|
357 | The master secret identified by the name must be already stored in the secure wallet \(see prover\_create\_master\_secret\)
|
358 | The blinded master secret is a part of the credential request.
|
359 |
|
360 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
361 | * `proverDid`: String - a DID of the prover
|
362 | * `credOffer`: Json - credential offer as a json containing information about the issuer and a credential
|
363 | * `credDef`: Json - credential definition json related to <cred\_def\_id> in <cred\_offer\_json>
|
364 | * `masterSecretId`: String - the id of the master secret stored in the wallet
|
365 | * __->__ [ `credReq`: Json, `credReqMetadata`: Json ] - cred\_req\_json: Credential request json for creation of credential by Issuer
|
366 | ```
|
367 | {
|
368 | "prover_did" : string,
|
369 | "cred_def_id" : string,
|
370 | // Fields below can depend on Cred Def type
|
371 | "blinded_ms" : <blinded_master_secret>,
|
372 | (opaque type that contains data structures internal to Ursa.
|
373 | It should not be parsed and are likely to change in future versions).
|
374 | "blinded_ms_correctness_proof" : <blinded_ms_correctness_proof>,
|
375 | (opaque type that contains data structures internal to Ursa.
|
376 | It should not be parsed and are likely to change in future versions).
|
377 | "nonce": string
|
378 | }
|
379 | cred_req_metadata_json: Credential request metadata json for further processing of received form Issuer credential.
|
380 | Note: cred_req_metadata_json mustn't be shared with Issuer.
|
381 | ````
|
382 |
|
383 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
384 |
|
385 | #### proverStoreCredential \( wh, credId, credReqMetadata, cred, credDef, revRegDef \) -> outCredId
|
386 |
|
387 | Check credential provided by Issuer for the given credential request,
|
388 | updates the credential by a master secret and stores in a secure wallet.
|
389 |
|
390 | To support efficient and flexible search the following tags will be created for stored credential:
|
391 | ```
|
392 | {
|
393 | "schema_id": <credential schema id>,
|
394 | "schema_issuer_did": <credential schema issuer did>,
|
395 | "schema_name": <credential schema name>,
|
396 | "schema_version": <credential schema version>,
|
397 | "issuer_did": <credential issuer did>,
|
398 | "cred_def_id": <credential definition id>,
|
399 | "rev_reg_id": <credential revocation registry id>, // "None" as string if not present
|
400 | // for every attribute in <credential values>
|
401 | "attr::<attribute name>::marker": "1",
|
402 | "attr::<attribute name>::value": <attribute raw value>,
|
403 | }
|
404 | ````
|
405 |
|
406 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
407 | * `credId`: String - \(optional, default is a random one\) identifier by which credential will be stored in the wallet
|
408 | * `credReqMetadata`: Json - a credential request metadata created by proverCreateCredentialReq
|
409 | * `cred`: Json - credential json received from issuer
|
410 | * `credDef`: Json - credential definition json related to <cred\_def\_id> in <cred\_json>
|
411 | * `revRegDef`: Json - revocation registry definition json related to <rev\_reg\_def\_id> in <cred\_json>
|
412 | * __->__ `outCredId`: String - out\_cred\_id: identifier by which credential is stored in the wallet
|
413 |
|
414 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
415 |
|
416 | #### proverGetCredentials \( wh, filter \) -> credentials
|
417 |
|
418 | Gets human readable credentials according to the filter.
|
419 | If filter is NULL, then all credentials are returned.
|
420 | Credentials can be filtered by Issuer, credential\_def and\/or Schema.
|
421 |
|
422 | NOTE: This method is deprecated because immediately returns all fetched credentials.
|
423 | Use <proverSearchCredentials> to fetch records by small batches.
|
424 |
|
425 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
426 | * `filter`: Json - filter for credentials
|
427 | ```
|
428 | {
|
429 | "schema_id": string, (Optional)
|
430 | "schema_issuer_did": string, (Optional)
|
431 | "schema_name": string, (Optional)
|
432 | "schema_version": string, (Optional)
|
433 | "issuer_did": string, (Optional)
|
434 | "cred_def_id": string, (Optional)
|
435 | }
|
436 | ````
|
437 | * __->__ `credentials`: Json - credentials json
|
438 | ```
|
439 | [{
|
440 | "referent": string, // cred_id in the wallet
|
441 | "attrs": {"key1":"raw_value1", "key2":"raw_value2"},
|
442 | "schema_id": string,
|
443 | "cred_def_id": string,
|
444 | "rev_reg_id": Optional<string>,
|
445 | "cred_rev_id": Optional<string>
|
446 | }]
|
447 | ````
|
448 |
|
449 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
450 |
|
451 | #### proverGetCredential \( wh, credId \) -> credential
|
452 |
|
453 | Gets human readable credential by the given id.
|
454 |
|
455 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
456 | * `credId`: String - Identifier by which requested credential is stored in the wallet
|
457 | * __->__ `credential`: Json - credential json:
|
458 | ```
|
459 | {
|
460 | "referent": string, // cred_id in the wallet
|
461 | "attrs": {"key1":"raw_value1", "key2":"raw_value2"},
|
462 | "schema_id": string,
|
463 | "cred_def_id": string,
|
464 | "rev_reg_id": Optional<string>,
|
465 | "cred_rev_id": Optional<string>
|
466 | }
|
467 | ````
|
468 |
|
469 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
470 |
|
471 | #### proverSearchCredentials \( wh, query \) -> \[ sh, totalCount \]
|
472 |
|
473 | Search for credentials stored in wallet.
|
474 | Credentials can be filtered by tags created during saving of credential.
|
475 |
|
476 | Instead of immediately returning of fetched credentials
|
477 | this call returns search\_handle that can be used later
|
478 | to fetch records by small batches \(with proverFetchCredentials\).
|
479 |
|
480 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
481 | * `query`: Json - Wql query filter for credentials searching based on tags.
|
482 | where query: indy-sdk\/doc\/design\/011-wallet-query-language\/README.md
|
483 | * __->__ [ `sh`: Handle (Number), `totalCount`: Number ] - search\_handle: Search handle that can be used later to fetch records by small batches \(with proverFetchCredentials\)
|
484 | total\_count: Total count of records
|
485 |
|
486 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
487 |
|
488 | #### proverFetchCredentials \( sh, count \) -> credentials
|
489 |
|
490 | Fetch next credentials for search.
|
491 |
|
492 | * `sh`: Handle (Number) - Search handle \(created by proverSearchCredentials\)
|
493 | * `count`: Number - Count of credentials to fetch
|
494 | * __->__ `credentials`: Json - credentials\_json: List of human readable credentials:
|
495 | ```
|
496 | [{
|
497 | "referent": string, // cred_id in the wallet
|
498 | "attrs": {"key1":"raw_value1", "key2":"raw_value2"},
|
499 | "schema_id": string,
|
500 | "cred_def_id": string,
|
501 | "rev_reg_id": Optional<string>,
|
502 | "cred_rev_id": Optional<string>
|
503 | }]
|
504 | NOTE: The list of length less than the requested count means credentials search iterator is completed.
|
505 | ````
|
506 |
|
507 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
508 |
|
509 | #### proverCloseCredentialsSearch \( sh \) -> void
|
510 |
|
511 | Close credentials search \(make search handle invalid\)
|
512 |
|
513 | * `sh`: Handle (Number) - Search handle \(created by proverSearchCredentials\)
|
514 | * __->__ void
|
515 |
|
516 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
517 |
|
518 | #### proverGetCredentialsForProofReq \( wh, proofRequest \) -> credentials
|
519 |
|
520 | Gets human readable credentials matching the given proof request.
|
521 |
|
522 | NOTE: This method is deprecated because immediately returns all fetched credentials.
|
523 | Use <proverSearchCredentialsForProofReq> to fetch records by small batches.
|
524 |
|
525 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
526 | * `proofRequest`: Json - proof request json
|
527 | ```
|
528 | {
|
529 | "name": string,
|
530 | "version": string,
|
531 | "nonce": string, - a decimal number represented as a string (use `generateNonce` function to generate 80-bit number)
|
532 | "requested_attributes": { // set of requested attributes
|
533 | "<attr_referent>": <attr_info>, // see below
|
534 | ...,
|
535 | },
|
536 | "requested_predicates": { // set of requested predicates
|
537 | "<predicate_referent>": <predicate_info>, // see below
|
538 | ...,
|
539 | },
|
540 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
541 | // If specified prover must proof non-revocation
|
542 | // for date in this interval for each attribute
|
543 | // (can be overridden on attribute level)
|
544 | "ver": Optional<str> - proof request version:
|
545 | - omit to use unqualified identifiers for restrictions
|
546 | - "1.0" to use unqualified identifiers for restrictions
|
547 | - "2.0" to use fully qualified identifiers for restrictions
|
548 | }
|
549 | where:
|
550 | attr_info: Describes requested attribute
|
551 | {
|
552 | "name": Optional<string>, // attribute name, (case insensitive and ignore spaces)
|
553 | "names": Optional<[string, string]>, // attribute names, (case insensitive and ignore spaces)
|
554 | // NOTE: should either be "name" or "names", not both and not none of them.
|
555 | // Use "names" to specify several attributes that have to match a single credential.
|
556 | "restrictions": Optional<wql query>, // see below
|
557 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
558 | // If specified prover must proof non-revocation
|
559 | // for date in this interval this attribute
|
560 | // (overrides proof level interval)
|
561 | }
|
562 | predicate_referent: Proof-request local identifier of requested attribute predicate
|
563 | predicate_info: Describes requested attribute predicate
|
564 | {
|
565 | "name": attribute name, (case insensitive and ignore spaces)
|
566 | "p_type": predicate type (">=", ">", "<=", "<")
|
567 | "p_value": predicate value
|
568 | "restrictions": Optional<wql query>, // see below
|
569 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
570 | // If specified prover must proof non-revocation
|
571 | // for date in this interval this attribute
|
572 | // (overrides proof level interval)
|
573 | }
|
574 | non_revoc_interval: Defines non-revocation interval
|
575 | {
|
576 | "from": Optional<int>, // timestamp of interval beginning
|
577 | "to": Optional<int>, // timestamp of interval ending
|
578 | }
|
579 | ````
|
580 | * __->__ `credentials`: Json - credentials\_json: json with credentials for the given proof request.
|
581 | ```
|
582 | {
|
583 | "requested_attrs": {
|
584 | "<attr_referent>": [{ cred_info: <credential_info>, interval: Optional<non_revoc_interval> }],
|
585 | ...,
|
586 | },
|
587 | "requested_predicates": {
|
588 | "requested_predicates": [{ cred_info: <credential_info>, timestamp: Optional<integer> }, { cred_info: <credential_2_info>, timestamp: Optional<integer> }],
|
589 | "requested_predicate_2_referent": [{ cred_info: <credential_2_info>, timestamp: Optional<integer> }]
|
590 | }
|
591 | }, where credential is
|
592 | {
|
593 | "referent": <string>,
|
594 | "attrs": {"attr_name" : "attr_raw_value"},
|
595 | "schema_id": string,
|
596 | "cred_def_id": string,
|
597 | "rev_reg_id": Optional<int>,
|
598 | "cred_rev_id": Optional<int>,
|
599 | }
|
600 | ````
|
601 |
|
602 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
603 |
|
604 | #### proverSearchCredentialsForProofReq \( wh, proofRequest, extraQuery \) -> sh
|
605 |
|
606 | Search for credentials matching the given proof request.
|
607 |
|
608 | Instead of immediately returning of fetched credentials
|
609 | this call returns search\_handle that can be used later
|
610 | to fetch records by small batches \(with proverFetchCredentialsForProofReq\).
|
611 |
|
612 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
613 | * `proofRequest`: Json - proof request json
|
614 | ```
|
615 | {
|
616 | "name": string,
|
617 | "version": string,
|
618 | "nonce": string, - a decimal number represented as a string (use `generateNonce` function to generate 80-bit number)
|
619 | "requested_attributes": { // set of requested attributes
|
620 | "<attr_referent>": <attr_info>, // see below
|
621 | ...,
|
622 | },
|
623 | "requested_predicates": { // set of requested predicates
|
624 | "<predicate_referent>": <predicate_info>, // see below
|
625 | ...,
|
626 | },
|
627 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
628 | // If specified prover must proof non-revocation
|
629 | // for date in this interval for each attribute
|
630 | // (can be overridden on attribute level)
|
631 | "ver": Optional<str> - proof request version:
|
632 | - omit to use unqualified identifiers for restrictions
|
633 | - "1.0" to use unqualified identifiers for restrictions
|
634 | - "2.0" to use fully qualified identifiers for restrictions
|
635 | }
|
636 | where:
|
637 | attr_info: Describes requested attribute
|
638 | {
|
639 | "name": Optional<string>, // attribute name, (case insensitive and ignore spaces)
|
640 | "names": Optional<[string, string]>, // attribute names, (case insensitive and ignore spaces)
|
641 | // NOTE: should either be "name" or "names", not both and not none of them.
|
642 | // Use "names" to specify several attributes that have to match a single credential.
|
643 | "restrictions": Optional<wql query>, // see below
|
644 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
645 | // If specified prover must proof non-revocation
|
646 | // for date in this interval this attribute
|
647 | // (overrides proof level interval)
|
648 | }
|
649 | predicate_referent: Proof-request local identifier of requested attribute predicate
|
650 | predicate_info: Describes requested attribute predicate
|
651 | {
|
652 | "name": attribute name, (case insensitive and ignore spaces)
|
653 | "p_type": predicate type (">=", ">", "<=", "<")
|
654 | "p_value": predicate value
|
655 | "restrictions": Optional<wql query>, // see below
|
656 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
657 | // If specified prover must proof non-revocation
|
658 | // for date in this interval this attribute
|
659 | // (overrides proof level interval)
|
660 | }
|
661 | non_revoc_interval: Defines non-revocation interval
|
662 | {
|
663 | "from": Optional<int>, // timestamp of interval beginning
|
664 | "to": Optional<int>, // timestamp of interval ending
|
665 | }
|
666 | ````
|
667 | * `extraQuery`: Json - \(Optional\) List of extra queries that will be applied to correspondent attribute\/predicate:
|
668 | ```
|
669 | {
|
670 | "<attr_referent>": <wql query>,
|
671 | "<predicate_referent>": <wql query>,
|
672 | }
|
673 | where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md
|
674 | ````
|
675 | * __->__ `sh`: Handle (Number) - search\_handle: Search handle that can be used later to fetch records by small batches \(with proverFetchCredentialsForProofReq\)
|
676 |
|
677 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
678 |
|
679 | #### proverFetchCredentialsForProofReq \( sh, itemReferent, count \) -> credentials
|
680 |
|
681 | Fetch next credentials for the requested item using proof request search
|
682 | handle \(created by proverSearchCredentialsForProofReq\).
|
683 |
|
684 | * `sh`: Handle (Number) - Search handle \(created by proverSearchCredentialsForProofReq\)
|
685 | * `itemReferent`: String - Referent of attribute\/predicate in the proof request
|
686 | * `count`: Number - Count of credentials to fetch
|
687 | * __->__ `credentials`: Json - credentials\_json: List of credentials for the given proof request.
|
688 | ```
|
689 | [{
|
690 | cred_info: <credential_info>,
|
691 | interval: Optional<non_revoc_interval>
|
692 | }]
|
693 | where
|
694 | credential_info:
|
695 | {
|
696 | "referent": <string>,
|
697 | "attrs": {"attr_name" : "attr_raw_value"},
|
698 | "schema_id": string,
|
699 | "cred_def_id": string,
|
700 | "rev_reg_id": Optional<int>,
|
701 | "cred_rev_id": Optional<int>,
|
702 | }
|
703 | non_revoc_interval:
|
704 | {
|
705 | "from": Optional<int>, // timestamp of interval beginning
|
706 | "to": Optional<int>, // timestamp of interval ending
|
707 | }
|
708 | NOTE: The list of length less than the requested count means that search iterator
|
709 | correspondent to the requested <item_referent> is completed.
|
710 | ````
|
711 |
|
712 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
713 |
|
714 | #### proverCloseCredentialsSearchForProofReq \( sh \) -> void
|
715 |
|
716 | Close credentials search for proof request \(make search handle invalid\)
|
717 |
|
718 | * `sh`: Handle (Number) - Search handle \(created by proverSearchCredentialsForProofReq\)
|
719 | * __->__ void
|
720 |
|
721 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
722 |
|
723 | #### proverCreateProof \( wh, proofReq, requestedCredentials, masterSecretName, schemas, credentialDefs, revStates \) -> proof
|
724 |
|
725 | Creates a proof according to the given proof request
|
726 | Either a corresponding credential with optionally revealed attributes or self-attested attribute must be provided
|
727 | for each requested attribute \(see proverGetCredentials\_for\_pool\_req\).
|
728 | A proof request may request multiple credentials from different schemas and different issuers.
|
729 | All required schemas, public keys and revocation registries must be provided.
|
730 | The proof request also contains nonce.
|
731 | The proof contains either proof or self-attested attribute value for each requested attribute.
|
732 |
|
733 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
734 | * `proofReq`: Json - proof request json
|
735 | ```
|
736 | {
|
737 | "name": string,
|
738 | "version": string,
|
739 | "nonce": string, - a decimal number represented as a string (use `generateNonce` function to generate 80-bit number)
|
740 | "requested_attributes": { // set of requested attributes
|
741 | "<attr_referent>": <attr_info>, // see below
|
742 | ...,
|
743 | },
|
744 | "requested_predicates": { // set of requested predicates
|
745 | "<predicate_referent>": <predicate_info>, // see below
|
746 | ...,
|
747 | },
|
748 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
749 | // If specified prover must proof non-revocation
|
750 | // for date in this interval for each attribute
|
751 | // (can be overridden on attribute level)
|
752 | "ver": Optional<str> - proof request version:
|
753 | - omit to use unqualified identifiers for restrictions
|
754 | - "1.0" to use unqualified identifiers for restrictions
|
755 | - "2.0" to use fully qualified identifiers for restrictions
|
756 | }
|
757 | where:
|
758 | attr_info: Describes requested attribute
|
759 | {
|
760 | "name": Optional<string>, // attribute name, (case insensitive and ignore spaces)
|
761 | "names": Optional<[string, string]>, // attribute names, (case insensitive and ignore spaces)
|
762 | // NOTE: should either be "name" or "names", not both and not none of them.
|
763 | // Use "names" to specify several attributes that have to match a single credential.
|
764 | "restrictions": Optional<wql query>, // see below
|
765 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
766 | // If specified prover must proof non-revocation
|
767 | // for date in this interval this attribute
|
768 | // (overrides proof level interval)
|
769 | }
|
770 | predicate_referent: Proof-request local identifier of requested attribute predicate
|
771 | predicate_info: Describes requested attribute predicate
|
772 | {
|
773 | "name": attribute name, (case insensitive and ignore spaces)
|
774 | "p_type": predicate type (">=", ">", "<=", "<")
|
775 | "p_value": predicate value
|
776 | "restrictions": Optional<wql query>, // see below
|
777 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
778 | // If specified prover must proof non-revocation
|
779 | // for date in this interval this attribute
|
780 | // (overrides proof level interval)
|
781 | }
|
782 | non_revoc_interval: Defines non-revocation interval
|
783 | {
|
784 | "from": Optional<int>, // timestamp of interval beginning
|
785 | "to": Optional<int>, // timestamp of interval ending
|
786 | }
|
787 | ````
|
788 | * `requestedCredentials`: Json - either a credential or self-attested attribute for each requested attribute
|
789 | ```
|
790 | {
|
791 | "self_attested_attributes": {
|
792 | "self_attested_attribute_referent": string
|
793 | },
|
794 | "requested_attributes": {
|
795 | "requested_attribute_referent_1": {"cred_id": string, "timestamp": Optional<number>, revealed: <bool> }},
|
796 | "requested_attribute_referent_2": {"cred_id": string, "timestamp": Optional<number>, revealed: <bool> }}
|
797 | },
|
798 | "requested_predicates": {
|
799 | "requested_predicates_referent_1": {"cred_id": string, "timestamp": Optional<number> }},
|
800 | }
|
801 | }
|
802 | ````
|
803 | * `masterSecretName`: String
|
804 | * `schemas`: Json - all schemas json participating in the proof request
|
805 | ```
|
806 | {
|
807 | <schema1_id>: <schema1_json>,
|
808 | <schema2_id>: <schema2_json>,
|
809 | <schema3_id>: <schema3_json>,
|
810 | }
|
811 | ````
|
812 | * `credentialDefs`: Json - all credential definitions json participating in the proof request
|
813 | ```
|
814 | {
|
815 | "cred_def1_id": <credential_def1_json>,
|
816 | "cred_def2_id": <credential_def2_json>,
|
817 | "cred_def3_id": <credential_def3_json>,
|
818 | }
|
819 | ````
|
820 | * `revStates`: Json - all revocation states json participating in the proof request
|
821 | ```
|
822 | {
|
823 | "rev_reg_def1_id or credential_1_id"": {
|
824 | "timestamp1": <rev_state1>,
|
825 | "timestamp2": <rev_state2>,
|
826 | },
|
827 | "rev_reg_def2_id or credential_2_id"": {
|
828 | "timestamp3": <rev_state3>
|
829 | },
|
830 | "rev_reg_def3_id or credential_3_id"": {
|
831 | "timestamp4": <rev_state4>
|
832 | },
|
833 | } - Note: use credential_id instead rev_reg_id in case proving several credentials from the same revocation registry.
|
834 | where
|
835 | where wql query: indy-sdk/docs/design/011-wallet-query-language/README.md
|
836 | ````
|
837 | * __->__ `proof`: Json - Proof json
|
838 | For each requested attribute either a proof \(with optionally revealed attribute value\) or
|
839 | self-attested attribute value is provided.
|
840 | Each proof is associated with a credential and corresponding schema\_id, cred\_def\_id, rev\_reg\_id and timestamp.
|
841 | There is also aggregated proof part common for all credential proofs.
|
842 | ```
|
843 | {
|
844 | "requested_proof": {
|
845 | "revealed_attrs": {
|
846 | "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string},
|
847 | "requested_attr4_id": {sub_proof_index: number: string, encoded: string},
|
848 | },
|
849 | "revealed_attr_groups": {
|
850 | "requested_attr5_id": {
|
851 | "sub_proof_index": number,
|
852 | "values": {
|
853 | "attribute_name": {
|
854 | "raw": string,
|
855 | "encoded": string
|
856 | }
|
857 | },
|
858 | }
|
859 | },
|
860 | "unrevealed_attrs": {
|
861 | "requested_attr3_id": {sub_proof_index: number}
|
862 | },
|
863 | "self_attested_attrs": {
|
864 | "requested_attr2_id": self_attested_value,
|
865 | },
|
866 | "requested_predicates": {
|
867 | "requested_predicate_1_referent": {sub_proof_index: int},
|
868 | "requested_predicate_2_referent": {sub_proof_index: int},
|
869 | }
|
870 | }
|
871 | "proof": {
|
872 | "proofs": [ <credential_proof>, <credential_proof>, <credential_proof> ],
|
873 | "aggregated_proof": <aggregated_proof>
|
874 | } (opaque type that contains data structures internal to Ursa.
|
875 | It should not be parsed and are likely to change in future versions).
|
876 | "identifiers": [{schema_id, cred_def_id, Optional<rev_reg_id>, Optional<timestamp>}]
|
877 | }
|
878 | ````
|
879 |
|
880 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
881 |
|
882 | #### verifierVerifyProof \( proofRequest, proof, schemas, credentialDefsJsons, revRegDefs, revRegs \) -> valid
|
883 |
|
884 | Verifies a proof \(of multiple credential\).
|
885 | All required schemas, public keys and revocation registries must be provided.
|
886 |
|
887 | IMPORTANT: You must use *_id's (`schema_id`, `cred_def_id`, `rev_reg_id`) listed in `proof[identifiers]`
|
888 | as the keys for corresponding `schemas`, `credentialDefsJsons`, `revRegDefs`, `revRegs` objects.
|
889 |
|
890 | * `proofRequest`: Json - proof request json
|
891 | ```
|
892 | {
|
893 | "name": string,
|
894 | "version": string,
|
895 | "nonce": string, - a decimal number represented as a string (use `generateNonce` function to generate 80-bit number)
|
896 | "requested_attributes": { // set of requested attributes
|
897 | "<attr_referent>": <attr_info>, // see below
|
898 | ...,
|
899 | },
|
900 | "requested_predicates": { // set of requested predicates
|
901 | "<predicate_referent>": <predicate_info>, // see below
|
902 | ...,
|
903 | },
|
904 | "non_revoked": Optional<<non_revoc_interval>>, // see below,
|
905 | // If specified prover must proof non-revocation
|
906 | // for date in this interval for each attribute
|
907 | // (can be overridden on attribute level)
|
908 | "ver": Optional<str> - proof request version:
|
909 | - omit to use unqualified identifiers for restrictions
|
910 | - "1.0" to use unqualified identifiers for restrictions
|
911 | - "2.0" to use fully qualified identifiers for restrictions
|
912 | }
|
913 | ````
|
914 | * `proof`: Json - created for request proof json
|
915 | ```
|
916 | {
|
917 | "requested_proof": {
|
918 | "revealed_attrs": {
|
919 | "requested_attr1_id": {sub_proof_index: number, raw: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level
|
920 | "requested_attr4_id": {sub_proof_index: number: string, encoded: string}, // NOTE: check that `encoded` value match to `raw` value on application level
|
921 | },
|
922 | "revealed_attr_groups": {
|
923 | "requested_attr5_id": {
|
924 | "sub_proof_index": number,
|
925 | "values": {
|
926 | "attribute_name": {
|
927 | "raw": string,
|
928 | "encoded": string
|
929 | }
|
930 | }, // NOTE: check that `encoded` value match to `raw` value on application level
|
931 | }
|
932 | },
|
933 | "unrevealed_attrs": {
|
934 | "requested_attr3_id": {sub_proof_index: number}
|
935 | },
|
936 | "self_attested_attrs": {
|
937 | "requested_attr2_id": self_attested_value,
|
938 | },
|
939 | "requested_predicates": {
|
940 | "requested_predicate_1_referent": {sub_proof_index: int},
|
941 | "requested_predicate_2_referent": {sub_proof_index: int},
|
942 | }
|
943 | }
|
944 | "proof": {
|
945 | "proofs": [ <credential_proof>, <credential_proof>, <credential_proof> ],
|
946 | "aggregated_proof": <aggregated_proof>
|
947 | }
|
948 | "identifiers": [{schema_id, cred_def_id, Optional<rev_reg_id>, Optional<timestamp>}]
|
949 | }
|
950 | ````
|
951 | * `schemas`: Json - all schema jsons participating in the proof
|
952 | ```
|
953 | {
|
954 | <schema1_id>: <schema1_json>,
|
955 | <schema2_id>: <schema2_json>,
|
956 | <schema3_id>: <schema3_json>,
|
957 | }
|
958 | ````
|
959 | * `credentialDefsJsons`: Json
|
960 | * `revRegDefs`: Json - all revocation registry definitions json participating in the proof
|
961 | ```
|
962 | {
|
963 | "rev_reg_def1_id": <rev_reg_def1_json>,
|
964 | "rev_reg_def2_id": <rev_reg_def2_json>,
|
965 | "rev_reg_def3_id": <rev_reg_def3_json>,
|
966 | }
|
967 | ````
|
968 | * `revRegs`: Json - all revocation registries json participating in the proof
|
969 | ```
|
970 | {
|
971 | "rev_reg_def1_id": {
|
972 | "timestamp1": <rev_reg1>,
|
973 | "timestamp2": <rev_reg2>,
|
974 | },
|
975 | "rev_reg_def2_id": {
|
976 | "timestamp3": <rev_reg3>
|
977 | },
|
978 | "rev_reg_def3_id": {
|
979 | "timestamp4": <rev_reg4>
|
980 | },
|
981 | }
|
982 | ````
|
983 | * __->__ `valid`: Boolean - valid: true - if signature is valid, false - otherwise
|
984 |
|
985 | Errors: `Annoncreds*`, `Common*`, `Wallet*`
|
986 |
|
987 | #### createRevocationState \( blobStorageReaderHandle, revRegDef, revRegDelta, timestamp, credRevId \) -> revState
|
988 |
|
989 | Create revocation state for a credential that corresponds to a particular time.
|
990 |
|
991 | Note that revocation delta must cover the whole registry existence time.
|
992 | You can use `from`: `0` and `to`: `needed_time` as parameters for building request to get correct revocation delta.
|
993 |
|
994 | The resulting revocation state and provided timestamp can be saved and reused later with applying a new
|
995 | revocation delta with `updateRevocationState` function.
|
996 | This new delta should be received with parameters: `from`: `timestamp` and `to`: `needed_time`.
|
997 |
|
998 | * `blobStorageReaderHandle`: Handle (Number) - configuration of blob storage reader handle that will allow to read revocation tails
|
999 | * `revRegDef`: Json - revocation registry definition json
|
1000 | * `revRegDelta`: Json - revocation registry delta which covers the whole registry existence time
|
1001 | * `timestamp`: Timestamp (Number) - time represented as a total number of seconds from Unix Epoch
|
1002 | * `credRevId`: String - user credential revocation id in revocation registry
|
1003 | * __->__ `revState`: Json - revocation state json:
|
1004 | ```
|
1005 | {
|
1006 | "rev_reg": <revocation registry>,
|
1007 | "witness": <witness>,
|
1008 | "timestamp" : integer
|
1009 | }
|
1010 | ````
|
1011 |
|
1012 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
1013 |
|
1014 | #### updateRevocationState \( blobStorageReaderHandle, revState, revRegDef, revRegDelta, timestamp, credRevId \) -> updatedRevState
|
1015 |
|
1016 | Create a new revocation state for a credential based on a revocation state created before.
|
1017 | Note that provided revocation delta must cover the registry gap from based state creation until the specified time
|
1018 | (this new delta should be received with parameters: `from`: `state_timestamp` and `to`: `needed_time`).
|
1019 |
|
1020 | This function reduces the calculation time.
|
1021 |
|
1022 | The resulting revocation state and provided timestamp can be saved and reused later by applying a new revocation delta again.
|
1023 |
|
1024 | * `blobStorageReaderHandle`: Handle (Number) - configuration of blob storage reader handle that will allow to read revocation tails
|
1025 | * `revState`: Json - revocation registry state json
|
1026 | * `revRegDef`: Json - revocation registry definition json
|
1027 | * `revRegDelta`: Json - revocation registry definition delta which covers the gap form original `rev_state_json` creation till the requested timestamp
|
1028 | * `timestamp`: Timestamp (Number) - time represented as a total number of seconds from Unix Epoch
|
1029 | * `credRevId`: String - user credential revocation id in revocation registry
|
1030 | * __->__ `updatedRevState`: Json - revocation state json:
|
1031 | ```
|
1032 | {
|
1033 | "rev_reg": <revocation registry>,
|
1034 | "witness": <witness>,
|
1035 | "timestamp" : integer
|
1036 | }
|
1037 | ````
|
1038 |
|
1039 | Errors: `Common*`, `Wallet*`, `Anoncreds*`
|
1040 |
|
1041 | #### generateNonce \( \) -> nonce
|
1042 |
|
1043 | Generates 80-bit numbers that can be used as a nonce for proof request.
|
1044 |
|
1045 | * __->__ `nonce`: Json - generated number as a string
|
1046 |
|
1047 | Errors: `Common*`
|
1048 |
|
1049 | #### toUnqualified \( entity \) -> res
|
1050 |
|
1051 | Get unqualified form (short form without method) of a fully qualified entity like DID.
|
1052 |
|
1053 | This function should be used to the proper casting of fully qualified entity to unqualified form in the following cases:
|
1054 | 1) Issuer, which works with fully qualified identifiers, creates a Credential Offer for Prover, which doesn't support fully qualified identifiers.
|
1055 | 2) Verifier prepares a Proof Request based on fully qualified identifiers or Prover, which doesn't support fully qualified identifiers.
|
1056 | 3) another case when casting to unqualified form needed
|
1057 |
|
1058 | * `entity`: String - target entity to disqualify. Can be one of: Did, SchemaId, CredentialDefinitionId, RevocationRegistryId, Schema, CredentialDefinition, RevocationRegistryDefinition, CredentialOffer, CredentialRequest, ProofRequest.
|
1059 | * __->__ `res`: Json - entity either in unqualified form or original if casting isn't possible
|
1060 |
|
1061 | ### blob_storage
|
1062 |
|
1063 | #### openBlobStorageReader \( type, config \) -> handle
|
1064 |
|
1065 |
|
1066 |
|
1067 | * `type`: String
|
1068 | * `config`: Json
|
1069 | * __->__ `handle`: Handle (Number)
|
1070 |
|
1071 |
|
1072 | #### openBlobStorageWriter \( type, config \) -> handle
|
1073 |
|
1074 |
|
1075 |
|
1076 | * `type`: String
|
1077 | * `config`: Json
|
1078 | * __->__ `handle`: Handle (Number)
|
1079 |
|
1080 |
|
1081 | ### crypto
|
1082 |
|
1083 | #### createKey \( wh, key \) -> vk
|
1084 |
|
1085 | Creates keys pair and stores in the wallet.
|
1086 |
|
1087 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1088 | * `key`: Json - Key information as json. Example:
|
1089 | ```
|
1090 | {
|
1091 | "seed": string, (optional) Seed that allows deterministic key creation (if not set random one will be created).
|
1092 | Can be UTF-8, base64 or hex string.
|
1093 | "crypto_type": string, // Optional (if not set then ed25519 curve is used); Currently only 'ed25519' value is supported for this field.
|
1094 | }
|
1095 | ````
|
1096 | * __->__ `vk`: String - Ver key of generated key pair, also used as key identifier
|
1097 |
|
1098 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1099 |
|
1100 | #### setKeyMetadata \( wh, verkey, metadata \) -> void
|
1101 |
|
1102 | Saves\/replaces the meta information for the giving key in the wallet.
|
1103 |
|
1104 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1105 | * `verkey`: String
|
1106 | * `metadata`: String
|
1107 | * __->__ void
|
1108 |
|
1109 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1110 |
|
1111 | #### getKeyMetadata \( wh, verkey \) -> metadata
|
1112 |
|
1113 | Retrieves the meta information for the giving key in the wallet.
|
1114 |
|
1115 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1116 | * `verkey`: String
|
1117 | * __->__ `metadata`: String - The meta information stored with the key; Can be null if no metadata was saved for this key.
|
1118 |
|
1119 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1120 |
|
1121 | #### cryptoSign \( wh, signerVk, messageRaw \) -> signatureRaw
|
1122 |
|
1123 | Signs a message with a key.
|
1124 |
|
1125 | Note to use DID keys with this function you can call keyForDid to get key id \(verkey\)
|
1126 | for specific DID.
|
1127 |
|
1128 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1129 | * `signerVk`: String - id \(verkey\) of message signer. The key must be created by calling createKey or createAndStoreMyDid
|
1130 | * `messageRaw`: Buffer - a pointer to first byte of message to be signed
|
1131 | * __->__ `signatureRaw`: Buffer - a signature string
|
1132 |
|
1133 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1134 |
|
1135 | #### cryptoVerify \( signerVk, messageRaw, signatureRaw \) -> valid
|
1136 |
|
1137 | Verify a signature with a verkey.
|
1138 |
|
1139 | Note to use DID keys with this function you can call keyForDid to get key id \(verkey\)
|
1140 | for specific DID.
|
1141 |
|
1142 | * `signerVk`: String - verkey of the message signer
|
1143 | * `messageRaw`: Buffer - a pointer to first byte of message that has been signed
|
1144 | * `signatureRaw`: Buffer - a pointer to first byte of signature to be verified
|
1145 | * __->__ `valid`: Boolean - valid: true - if signature is valid, false - otherwise
|
1146 |
|
1147 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1148 |
|
1149 | #### cryptoAuthCrypt \( wh, senderVk, recipientVk, messageRaw \) -> encryptedMsgRaw
|
1150 |
|
1151 | **** THIS FUNCTION WILL BE DEPRECATED USE packMessage INSTEAD ****
|
1152 |
|
1153 | Encrypt a message by authenticated-encryption scheme.
|
1154 |
|
1155 | Sender can encrypt a confidential message specifically for Recipient, using Sender's public key.
|
1156 | Using Recipient's public key, Sender can compute a shared secret key.
|
1157 | Using Sender's public key and his secret key, Recipient can compute the exact same shared secret key.
|
1158 | That shared secret key can be used to verify that the encrypted message was not tampered with,
|
1159 | before eventually decrypting it.
|
1160 |
|
1161 | Note to use DID keys with this function you can call keyForDid to get key id \(verkey\)
|
1162 | for specific DID.
|
1163 |
|
1164 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1165 | * `senderVk`: String - id \(verkey\) of message sender. The key must be created by calling createKey or createAndStoreMyDid
|
1166 | * `recipientVk`: String - id \(verkey\) of message recipient
|
1167 | * `messageRaw`: Buffer - a pointer to first byte of message that to be encrypted
|
1168 | * __->__ `encryptedMsgRaw`: Buffer - an encrypted message as a pointer to array of bytes.
|
1169 |
|
1170 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1171 |
|
1172 | #### cryptoAuthDecrypt \( wh, recipientVk, encryptedMsgRaw \) -> \[ senderVk, decryptedMsgRaw \]
|
1173 |
|
1174 | **** THIS FUNCTION WILL BE DEPRECATED USE unpackMessage INSTEAD ****
|
1175 |
|
1176 | Decrypt a message by authenticated-encryption scheme.
|
1177 |
|
1178 | Sender can encrypt a confidential message specifically for Recipient, using Sender's public key.
|
1179 | Using Recipient's public key, Sender can compute a shared secret key.
|
1180 | Using Sender's public key and his secret key, Recipient can compute the exact same shared secret key.
|
1181 | That shared secret key can be used to verify that the encrypted message was not tampered with,
|
1182 | before eventually decrypting it.
|
1183 |
|
1184 | Note to use DID keys with this function you can call keyForDid to get key id \(verkey\)
|
1185 | for specific DID.
|
1186 |
|
1187 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1188 | * `recipientVk`: String - id \(verkey\) of message recipient. The key must be created by calling createKey or createAndStoreMyDid
|
1189 | * `encryptedMsgRaw`: Buffer - a pointer to first byte of message that to be decrypted
|
1190 | * __->__ [ `senderVk`: String, `decryptedMsgRaw`: Buffer ] - sender verkey and decrypted message as a pointer to array of bytes
|
1191 |
|
1192 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1193 |
|
1194 | #### cryptoAnonCrypt \( recipientVk, messageRaw \) -> encryptedMsgRaw
|
1195 |
|
1196 | Encrypts a message by anonymous-encryption scheme.
|
1197 |
|
1198 | Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
|
1199 | Only the Recipient can decrypt these messages, using its private key.
|
1200 | While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender.
|
1201 |
|
1202 | Note to use DID keys with this function you can call keyForDid to get key id \(verkey\)
|
1203 | for specific DID.
|
1204 |
|
1205 | Note: use packMessage function for A2A goals.
|
1206 |
|
1207 | * `recipientVk`: String - verkey of message recipient
|
1208 | * `messageRaw`: Buffer - a pointer to first byte of message that to be encrypted
|
1209 | * __->__ `encryptedMsgRaw`: Buffer - an encrypted message as a pointer to array of bytes
|
1210 |
|
1211 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1212 |
|
1213 | #### cryptoAnonDecrypt \( wh, recipientVk, encryptedMsg \) -> decryptedMsgRaw
|
1214 |
|
1215 | Decrypts a message by anonymous-encryption scheme.
|
1216 |
|
1217 | Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
|
1218 | Only the Recipient can decrypt these messages, using its private key.
|
1219 | While the Recipient can verify the integrity of the message, it cannot verify the identity of the Sender.
|
1220 |
|
1221 | Note to use DID keys with this function you can call keyForDid to get key id \(verkey\)
|
1222 | for specific DID.
|
1223 |
|
1224 | Note: use unpackMessage function for A2A goals.
|
1225 |
|
1226 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1227 | * `recipientVk`: String - id \(verkey\) of my key. The key must be created by calling createKey or createAndStoreMyDid
|
1228 | * `encryptedMsg`: Buffer
|
1229 | * __->__ `decryptedMsgRaw`: Buffer - decrypted message as a pointer to an array of bytes
|
1230 |
|
1231 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1232 |
|
1233 | #### packMessage \( wh, message, receiverKeys, senderVk \) -> jwe
|
1234 |
|
1235 | Packs a message by encrypting the message and serializes it in a JWE-like format (Experimental)
|
1236 |
|
1237 | Note to use DID keys with this function you can call keyForDid to get key id (verkey) for specific DID.
|
1238 |
|
1239 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1240 | * `message`: Buffer - message that to be packed
|
1241 | * `receiverKeys`: Array - an array of strings which contains receiver's keys the message is being encrypted for.
|
1242 | Example: \['receiver edge_agent_1 verkey', 'receiver edge_agent_2 verkey'\]
|
1243 | * `senderVk`: String - the sender's verkey as a string When null pointer is used in this parameter, anoncrypt is used
|
1244 | * __->__ `jwe`: Buffer - a JWE
|
1245 | ```
|
1246 | using authcrypt alg:
|
1247 | {
|
1248 | "protected": "b64URLencoded({
|
1249 | "enc": "xsalsa20poly1305",
|
1250 | "typ": "JWM/1.0",
|
1251 | "alg": "Authcrypt",
|
1252 | "recipients": [
|
1253 | {
|
1254 | "encrypted_key": base64URLencode(libsodium.crypto_box(my_key, their_vk, cek, cek_iv))
|
1255 | "header": {
|
1256 | "kid": "base58encode(recipient_verkey)",
|
1257 | "sender" : base64URLencode(libsodium.crypto_box_seal(their_vk, base58encode(sender_vk)),
|
1258 | "iv" : base64URLencode(cek_iv)
|
1259 | }
|
1260 | },
|
1261 | ],
|
1262 | })",
|
1263 | "iv": <b64URLencode(iv)>,
|
1264 | "ciphertext": b64URLencode(encrypt_detached({'@type'...}, protected_value_encoded, iv, cek),
|
1265 | "tag": <b64URLencode(tag)>
|
1266 | }
|
1267 |
|
1268 | Alternative example in using anoncrypt alg is defined below:
|
1269 | {
|
1270 | "protected": "b64URLencoded({
|
1271 | "enc": "xsalsa20poly1305",
|
1272 | "typ": "JWM/1.0",
|
1273 | "alg": "Anoncrypt",
|
1274 | "recipients": [
|
1275 | {
|
1276 | "encrypted_key": base64URLencode(libsodium.crypto_box_seal(their_vk, cek)),
|
1277 | "header": {
|
1278 | "kid": base58encode(recipient_verkey),
|
1279 | }
|
1280 | },
|
1281 | ],
|
1282 | })",
|
1283 | "iv": b64URLencode(iv),
|
1284 | "ciphertext": b64URLencode(encrypt_detached({'@type'...}, protected_value_encoded, iv, cek),
|
1285 | "tag": b64URLencode(tag)
|
1286 | }
|
1287 | ````
|
1288 |
|
1289 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1290 |
|
1291 | #### unpackMessage \( wh, jwe \) -> res
|
1292 |
|
1293 | Unpacks a JWE-like formatted message outputted by packMessage (Experimental)
|
1294 |
|
1295 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1296 | * `jwe`: Buffer - JWE to be unpacked
|
1297 | * __->__ `res`: Buffer - a result message
|
1298 | ```
|
1299 | if authcrypt was used to pack the message returns this json structure:
|
1300 | {
|
1301 | message: <decrypted message>,
|
1302 | sender_verkey: <sender_verkey>,
|
1303 | recipient_verkey: <recipient_verkey>
|
1304 | }
|
1305 |
|
1306 | OR
|
1307 |
|
1308 | if anoncrypt was used to pack the message returns this json structure:
|
1309 | {
|
1310 | message: <decrypted message>,
|
1311 | recipient_verkey: <recipient_verkey>
|
1312 | }
|
1313 | ````
|
1314 |
|
1315 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1316 |
|
1317 | ### did
|
1318 |
|
1319 | #### createAndStoreMyDid \( wh, did \) -> \[ did, verkey \]
|
1320 |
|
1321 | Creates keys \(signing and encryption keys\) for a new
|
1322 | DID \(owned by the caller of the library\).
|
1323 | Identity's DID must be either explicitly provided, or taken as the first 16 bit of verkey.
|
1324 | Saves the Identity DID with keys in a secured Wallet, so that it can be used to sign
|
1325 | and encrypt transactions.
|
1326 |
|
1327 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1328 | * `did`: Json - Identity information as json
|
1329 | ```
|
1330 | {
|
1331 | "did": string, (optional;
|
1332 | if not provided and cid param is false then the first 16 bit of the verkey will be used as a new DID;
|
1333 | if not provided and cid is true then the full verkey will be used as a new DID;
|
1334 | if provided, then keys will be replaced - key rotation use case)
|
1335 | "seed": string, (optional) Seed that allows deterministic did creation (if not set random one will be created).
|
1336 | Can be UTF-8, base64 or hex string.
|
1337 | "crypto_type": string, (optional; if not set then ed25519 curve is used;
|
1338 | currently only 'ed25519' value is supported for this field)
|
1339 | "cid": bool, (optional; if not set then false is used;)
|
1340 | "method_name": string, (optional) method name to create fully qualified did (Example: `did:method_name:NcYxiDXkpYi6ov5FcYDi1e`).
|
1341 | }
|
1342 | ```
|
1343 | * __->__ [ `did`: String, `verkey`: String ] - did: DID generated and stored in the wallet
|
1344 | verkey: The DIDs verification key
|
1345 |
|
1346 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1347 |
|
1348 | #### replaceKeysStart \( wh, did, identity \) -> verkey
|
1349 |
|
1350 | Generated temporary keys \(signing and encryption keys\) for an existing
|
1351 | DID \(owned by the caller of the library\).
|
1352 |
|
1353 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1354 | * `did`: String - target did to rotate keys.
|
1355 | * `identity`: Json
|
1356 | * __->__ `verkey`: String - verkey: The DIDs verification key
|
1357 |
|
1358 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1359 |
|
1360 | #### replaceKeysApply \( wh, did \) -> void
|
1361 |
|
1362 | Apply temporary keys as main for an existing DID \(owned by the caller of the library\).
|
1363 |
|
1364 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1365 | * `did`: String - DID stored in the wallet
|
1366 | * __->__ void
|
1367 |
|
1368 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1369 |
|
1370 | #### storeTheirDid \( wh, identity \) -> void
|
1371 |
|
1372 | Saves their DID for a pairwise connection in a secured Wallet,
|
1373 | so that it can be used to verify transaction.
|
1374 | Updates DID associated verkey in case DID already exists in the Wallet.
|
1375 |
|
1376 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1377 | * `identity`: Json - Identity information as json. Example:
|
1378 | ```
|
1379 | {
|
1380 | "did": string, (required)
|
1381 | "verkey": string
|
1382 | - optional is case of adding a new DID, and DID is cryptonym: did == verkey,
|
1383 | - mandatory in case of updating an existing DID
|
1384 | }
|
1385 | ````
|
1386 | * __->__ void
|
1387 |
|
1388 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1389 |
|
1390 | #### keyForDid \( poolHandle, wh, did \) -> key
|
1391 |
|
1392 | Returns ver key \(key id\) for the given DID.
|
1393 |
|
1394 | "keyForDid" call follow the idea that we resolve information about their DID from
|
1395 | the ledger with cache in the local wallet. The "openWallet" call has freshness parameter
|
1396 | that is used for checking the freshness of cached pool value.
|
1397 |
|
1398 | Note if you don't want to resolve their DID info from the ledger you can use
|
1399 | "keyForLocalDid" call instead that will look only to the local wallet and skip
|
1400 | freshness checking.
|
1401 |
|
1402 | Note that "createAndStoreMyDid" makes similar wallet record as "createKey".
|
1403 | As result we can use returned ver key in all generic crypto and messaging functions.
|
1404 |
|
1405 | * `poolHandle`: Handle (Number) - Pool handle \(created by open\_pool\).
|
1406 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1407 | * `did`: String
|
1408 | * __->__ `key`: String - The DIDs ver key \(key id\).
|
1409 |
|
1410 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1411 |
|
1412 | #### keyForLocalDid \( wh, did \) -> key
|
1413 |
|
1414 | Returns ver key \(key id\) for the given DID.
|
1415 |
|
1416 | "keyForLocalDid" call looks data stored in the local wallet only and skips freshness
|
1417 | checking.
|
1418 |
|
1419 | Note if you want to get fresh data from the ledger you can use "keyForDid" call
|
1420 | instead.
|
1421 |
|
1422 | Note that "createAndStoreMyDid" makes similar wallet record as "createKey".
|
1423 | As result we can use returned ver key in all generic crypto and messaging functions.
|
1424 |
|
1425 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1426 | * `did`: String
|
1427 | * __->__ `key`: String - The DIDs ver key \(key id\).
|
1428 |
|
1429 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1430 |
|
1431 | #### setEndpointForDid \( wh, did, address, transportKey \) -> void
|
1432 |
|
1433 | Set\/replaces endpoint information for the given DID.
|
1434 |
|
1435 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1436 | * `did`: String
|
1437 | * `address`: String
|
1438 | * `transportKey`: String
|
1439 | * __->__ void
|
1440 |
|
1441 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1442 |
|
1443 | #### getEndpointForDid \( wh, poolHandle, did \) -> \[ address, transportVk \]
|
1444 |
|
1445 | Returns endpoint information for the given DID.
|
1446 |
|
1447 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1448 | * `poolHandle`: Handle (Number)
|
1449 | * `did`: String
|
1450 | * __->__ [ `address`: String, `transportVk`: String ] - The DIDs endpoint.
|
1451 | - transport\_vk - The DIDs transport key \(ver key, key id\).
|
1452 |
|
1453 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1454 |
|
1455 | #### setDidMetadata \( wh, did, metadata \) -> void
|
1456 |
|
1457 | Saves\/replaces the meta information for the giving DID in the wallet.
|
1458 |
|
1459 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1460 | * `did`: String
|
1461 | * `metadata`: String
|
1462 | * __->__ void
|
1463 |
|
1464 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1465 |
|
1466 | #### getDidMetadata \( wh, did \) -> metadata
|
1467 |
|
1468 | Retrieves the meta information for the giving DID in the wallet.
|
1469 |
|
1470 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1471 | * `did`: String
|
1472 | * __->__ `metadata`: String - The meta information stored with the DID; Can be null if no metadata was saved for this DID.
|
1473 |
|
1474 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1475 |
|
1476 | #### getMyDidWithMeta \( wh, myDid \) -> didWithMeta
|
1477 |
|
1478 | Retrieves the information about the giving DID in the wallet.
|
1479 |
|
1480 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1481 | * `myDid`: String
|
1482 | * __->__ `didWithMeta`: Json - did\_with\_meta: {
|
1483 | "did": string - DID stored in the wallet,
|
1484 | "verkey": string - The DIDs transport key \(ver key, key id\),
|
1485 | "tempVerkey": string - Temporary DIDs transport key \(ver key, key id\), exist only during the rotation of the keys.
|
1486 | After rotation is done, it becomes a new verkey.
|
1487 | "metadata": string - The meta information stored with the DID
|
1488 | }
|
1489 |
|
1490 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1491 |
|
1492 | #### listMyDidsWithMeta \( wh \) -> dids
|
1493 |
|
1494 | Retrieves the information about all DIDs stored in the wallet.
|
1495 |
|
1496 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1497 | * __->__ `dids`: Json - dids: \[{
|
1498 | "did": string - DID stored in the wallet,
|
1499 | "verkey": string - The DIDs transport key \(ver key, key id\).,
|
1500 | "metadata": string - The meta information stored with the DID
|
1501 | }\]
|
1502 |
|
1503 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1504 |
|
1505 | #### abbreviateVerkey \( did, fullVerkey \) -> verkey
|
1506 |
|
1507 | Retrieves abbreviated verkey if it is possible otherwise return full verkey.
|
1508 |
|
1509 | * `did`: String - DID.
|
1510 | * `fullVerkey`: String - The DIDs verification key,
|
1511 | * __->__ `verkey`: String - verkey: The DIDs verification key in either abbreviated or full form
|
1512 |
|
1513 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1514 |
|
1515 | #### qualifyDid \( wh, did, method \) -> fullQualifiedDid
|
1516 |
|
1517 | Update DID stored in the wallet to make fully qualified, or to do other DID maintenance.
|
1518 | - If the DID has no prefix, a prefix will be appended (prepend did:peer to a legacy did)
|
1519 | - If the DID has a prefix, a prefix will be updated (migrate did:peer to did:peer-new)
|
1520 |
|
1521 | Update DID related entities stored in the wallet.
|
1522 |
|
1523 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1524 | * `did`: String - target DID stored in the wallet.
|
1525 | * `method`: String - method to apply to the DID.
|
1526 | * __->__ `fullQualifiedDid`: String - fully qualified did
|
1527 |
|
1528 | Errors: `Common*`, `Wallet*`, `Crypto*`
|
1529 |
|
1530 | ### ledger
|
1531 |
|
1532 | #### signAndSubmitRequest \( poolHandle, wh, submitterDid, request \) -> requestResult
|
1533 |
|
1534 | Signs and submits request message to validator pool.
|
1535 |
|
1536 | Adds submitter information to passed request json, signs it with submitter
|
1537 | sign key \(see wallet\_sign\), and sends signed request message
|
1538 | to validator pool \(see write\_request\).
|
1539 |
|
1540 | * `poolHandle`: Handle (Number) - pool handle \(created by open\_pool\_ledger\).
|
1541 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1542 | * `submitterDid`: String - Id of Identity stored in secured Wallet.
|
1543 | * `request`: Json - Request data json.
|
1544 | * __->__ `requestResult`: Json
|
1545 |
|
1546 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1547 |
|
1548 | #### submitRequest \( poolHandle, request \) -> requestResult
|
1549 |
|
1550 | Publishes request message to validator pool \(no signing, unlike sign\_and\_submit\_request\).
|
1551 |
|
1552 | The request is sent to the validator pool as is. It's assumed that it's already prepared.
|
1553 |
|
1554 | * `poolHandle`: Handle (Number) - pool handle \(created by open\_pool\_ledger\).
|
1555 | * `request`: Json - Request data json.
|
1556 | * __->__ `requestResult`: Json
|
1557 |
|
1558 | Errors: `Common*`, `Ledger*`
|
1559 |
|
1560 | #### submitAction \( poolHandle, request, nodes, timeout \) -> requestResult
|
1561 |
|
1562 | Send action to particular nodes of validator pool.
|
1563 |
|
1564 | The list of requests can be send:
|
1565 | POOL\_RESTART
|
1566 | GET\_VALIDATOR\_INFO
|
1567 |
|
1568 | The request is sent to the nodes as is. It's assumed that it's already prepared.
|
1569 |
|
1570 | * `poolHandle`: Handle (Number) - pool handle \(created by open\_pool\_ledger\).
|
1571 | * `request`: Json - Request data json.
|
1572 | * `nodes`: Json - \(Optional\) List of node names to send the request.
|
1573 | \["Node1", "Node2",...."NodeN"\]
|
1574 | * `timeout`: Number - \(Optional\) Time to wait respond from nodes \(override the default timeout\) \(in sec\).
|
1575 | Pass -1 to use default timeout
|
1576 | * __->__ `requestResult`: Json
|
1577 |
|
1578 | Errors: `Common*`, `Ledger*`
|
1579 |
|
1580 | #### signRequest \( wh, submitterDid, request \) -> signedRequest
|
1581 |
|
1582 | Signs request message.
|
1583 |
|
1584 | Adds submitter information to passed request json, signs it with submitter
|
1585 | sign key \(see wallet\_sign\).
|
1586 |
|
1587 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1588 | * `submitterDid`: String - Id of Identity stored in secured Wallet.
|
1589 | * `request`: Json - Request data json.
|
1590 | * __->__ `signedRequest`: Json - Signed request json.
|
1591 |
|
1592 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1593 |
|
1594 | #### multiSignRequest \( wh, submitterDid, request \) -> signedRequest
|
1595 |
|
1596 | Multi signs request message.
|
1597 |
|
1598 | Adds submitter information to passed request json, signs it with submitter
|
1599 | sign key \(see wallet\_sign\).
|
1600 |
|
1601 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
1602 | * `submitterDid`: String - Id of Identity stored in secured Wallet.
|
1603 | * `request`: Json - Request data json.
|
1604 | * __->__ `signedRequest`: Json - Signed request json.
|
1605 |
|
1606 | Errors: `Common*`, `Wallet*`, `Ledger*`, `Crypto*`
|
1607 |
|
1608 | #### buildGetDdoRequest \( submitterDid, targetDid \) -> requestResult
|
1609 |
|
1610 | Builds a request to get a DDO.
|
1611 |
|
1612 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1613 | * `targetDid`: String - Target DID as base58-encoded string for 16 or 32 bit DID value.
|
1614 | * __->__ `requestResult`: Json
|
1615 |
|
1616 | Errors: `Common*`
|
1617 |
|
1618 | #### buildNymRequest \( submitterDid, targetDid, verkey, alias, role \) -> request
|
1619 |
|
1620 | Builds a NYM request. Request to create a new NYM record for a specific user.
|
1621 |
|
1622 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1623 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1624 | * `targetDid`: String - Target DID as base58-encoded string for 16 or 32 bit DID value.
|
1625 | * `verkey`: String - Target identity verification key as base58-encoded string.
|
1626 | * `alias`: String - NYM's alias.
|
1627 | * `role`: String - Role of a user NYM record:
|
1628 | null \(common USER\)
|
1629 | TRUSTEE
|
1630 | STEWARD
|
1631 | TRUST\_ANCHOR
|
1632 | NETWORK\_MONITOR
|
1633 | empty string to reset role
|
1634 | * __->__ `request`: Json
|
1635 |
|
1636 | Errors: `Common*`
|
1637 |
|
1638 | #### buildAttribRequest \( submitterDid, targetDid, hash, raw, enc \) -> request
|
1639 |
|
1640 | Builds an ATTRIB request. Request to add attribute to a NYM record.
|
1641 |
|
1642 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1643 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1644 | * `targetDid`: String - Target DID as base58-encoded string for 16 or 32 bit DID value.
|
1645 | * `hash`: String - \(Optional\) Hash of attribute data.
|
1646 | * `raw`: Json - \(Optional\) Json, where key is attribute name and value is attribute value.
|
1647 | * `enc`: String - \(Optional\) Encrypted value attribute data.
|
1648 | * __->__ `request`: Json
|
1649 |
|
1650 | Errors: `Common*`
|
1651 |
|
1652 | #### buildGetAttribRequest \( submitterDid, targetDid, raw, hash, enc \) -> request
|
1653 |
|
1654 | Builds a GET\_ATTRIB request. Request to get information about an Attribute for the specified DID.
|
1655 |
|
1656 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1657 | * `targetDid`: String - Target DID as base58-encoded string for 16 or 32 bit DID value.
|
1658 | * `raw`: String - \(Optional\) Requested attribute name.
|
1659 | * `hash`: String - \(Optional\) Requested attribute hash.
|
1660 | * `enc`: String - \(Optional\) Requested attribute encrypted value.
|
1661 | * __->__ `request`: Json
|
1662 |
|
1663 | Errors: `Common*`
|
1664 |
|
1665 | #### buildGetNymRequest \( submitterDid, targetDid \) -> request
|
1666 |
|
1667 | Builds a GET\_NYM request. Request to get information about a DID \(NYM\).
|
1668 |
|
1669 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1670 | * `targetDid`: String - Target DID as base58-encoded string for 16 or 32 bit DID value.
|
1671 | * __->__ `request`: Json
|
1672 |
|
1673 | Errors: `Common*`
|
1674 |
|
1675 | #### parseGetNymResponse \( response \) -> nymData
|
1676 |
|
1677 | Parse a GET_NYM response to get NYM data.
|
1678 |
|
1679 | * `response`: String - response on GET_NYM request.
|
1680 | * __->__ `nymData`: Json
|
1681 | ```
|
1682 | {
|
1683 | did: DID as base58-encoded string for 16 or 32 bit DID value.
|
1684 | verkey: verification key as base58-encoded string.
|
1685 | role: Role associated number
|
1686 | null (common USER)
|
1687 | 0 - TRUSTEE
|
1688 | 2 - STEWARD
|
1689 | 101 - TRUST_ANCHOR
|
1690 | 101 - ENDORSER - equal to TRUST_ANCHOR that will be removed soon
|
1691 | 201 - NETWORK_MONITOR
|
1692 | }
|
1693 | ```
|
1694 |
|
1695 | Errors: `Common*`
|
1696 |
|
1697 | #### buildSchemaRequest \( submitterDid, data \) -> request
|
1698 |
|
1699 | Builds a SCHEMA request. Request to add Credential's schema.
|
1700 |
|
1701 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1702 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1703 | * `data`: Json - Credential schema.
|
1704 | ```
|
1705 | {
|
1706 | id: identifier of schema
|
1707 | attrNames: array of attribute name strings
|
1708 | name: Schema's name string (the number of attributes should be less or equal than 125)
|
1709 | version: Schema's version string,
|
1710 | ver: Version of the Schema json
|
1711 | }
|
1712 | ````
|
1713 | * __->__ `request`: Json
|
1714 |
|
1715 | Errors: `Common*`
|
1716 |
|
1717 | #### buildGetSchemaRequest \( submitterDid, id \) -> request
|
1718 |
|
1719 | Builds a GET\_SCHEMA request. Request to get Credential's Schema.
|
1720 |
|
1721 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1722 | * `id`: String - Schema ID in ledger
|
1723 | * __->__ `request`: Json
|
1724 |
|
1725 | Errors: `Common*`
|
1726 |
|
1727 | #### parseGetSchemaResponse \( getSchemaResponse \) -> \[ schemaId, schema \]
|
1728 |
|
1729 | Parse a GET\_SCHEMA response to get Schema in the format compatible with Anoncreds API.
|
1730 |
|
1731 | * `getSchemaResponse`: Json - response of GET\_SCHEMA request.
|
1732 | * __->__ [ `schemaId`: String, `schema`: Json ] - Schema Id and Schema json.
|
1733 | ```
|
1734 | {
|
1735 | id: identifier of schema
|
1736 | attrNames: array of attribute name strings
|
1737 | name: Schema's name string
|
1738 | version: Schema's version string
|
1739 | ver: Version of the Schema json
|
1740 | }
|
1741 | ````
|
1742 |
|
1743 | Errors: `Common*`
|
1744 |
|
1745 | #### buildCredDefRequest \( submitterDid, data \) -> request
|
1746 |
|
1747 | Builds an CRED\_DEF request. Request to add a Credential Definition \(in particular, public key\),
|
1748 | that Issuer creates for a particular Credential Schema.
|
1749 |
|
1750 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1751 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1752 | * `data`: Json - credential definition json
|
1753 | ```
|
1754 | {
|
1755 | id: string - identifier of credential definition
|
1756 | schemaId: string - identifier of stored in ledger schema
|
1757 | type: string - type of the credential definition. CL is the only supported type now.
|
1758 | tag: string - allows to distinct between credential definitions for the same issuer and schema
|
1759 | value: Dictionary with Credential Definition's data:
|
1760 | {
|
1761 | primary: primary credential public key,
|
1762 | Optional<revocation>: revocation credential public key
|
1763 | },
|
1764 | ver: Version of the CredDef json
|
1765 | }
|
1766 | ````
|
1767 | * __->__ `request`: Json
|
1768 |
|
1769 | Errors: `Common*`
|
1770 |
|
1771 | #### buildGetCredDefRequest \( submitterDid, id \) -> request
|
1772 |
|
1773 | Builds a GET\_CRED\_DEF request. Request to get a Credential Definition \(in particular, public key\),
|
1774 | that Issuer creates for a particular Credential Schema.
|
1775 |
|
1776 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1777 | * `id`: String - Credential Definition ID in ledger.
|
1778 | * __->__ `request`: Json
|
1779 |
|
1780 | Errors: `Common*`
|
1781 |
|
1782 | #### parseGetCredDefResponse \( getCredDefResponse \) -> \[ credDefId, credDef \]
|
1783 |
|
1784 | Parse a GET\_CRED\_DEF response to get Credential Definition in the format compatible with Anoncreds API.
|
1785 |
|
1786 | * `getCredDefResponse`: Json - response of GET\_CRED\_DEF request.
|
1787 | * __->__ [ `credDefId`: String, `credDef`: Json ] - Credential Definition Id and Credential Definition json.
|
1788 | ```
|
1789 | {
|
1790 | id: string - identifier of credential definition
|
1791 | schemaId: string - identifier of stored in ledger schema
|
1792 | type: string - type of the credential definition. CL is the only supported type now.
|
1793 | tag: string - allows to distinct between credential definitions for the same issuer and schema
|
1794 | value: Dictionary with Credential Definition's data: {
|
1795 | primary: primary credential public key,
|
1796 | Optional<revocation>: revocation credential public key
|
1797 | },
|
1798 | ver: Version of the Credential Definition json
|
1799 | }
|
1800 | ````
|
1801 |
|
1802 | Errors: `Common*`
|
1803 |
|
1804 | #### buildNodeRequest \( submitterDid, targetDid, data \) -> request
|
1805 |
|
1806 | Builds a NODE request. Request to add a new node to the pool, or updates existing in the pool.
|
1807 |
|
1808 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1809 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1810 | * `targetDid`: String - Target Node's DID. It differs from submitter\_did field.
|
1811 | * `data`: Json - Data associated with the Node:
|
1812 | ```
|
1813 | {
|
1814 | alias: string - Node's alias
|
1815 | blskey: string - (Optional) BLS multi-signature key as base58-encoded string.
|
1816 | blskey_pop: string - (Optional) BLS key proof of possession as base58-encoded string.
|
1817 | client_ip: string - (Optional) Node's client listener IP address.
|
1818 | client_port: string - (Optional) Node's client listener port.
|
1819 | node_ip: string - (Optional) The IP address other Nodes use to communicate with this Node.
|
1820 | node_port: string - (Optional) The port other Nodes use to communicate with this Node.
|
1821 | services: array<string> - (Optional) The service of the Node. VALIDATOR is the only supported one now.
|
1822 | }
|
1823 | ````
|
1824 | * __->__ `request`: Json
|
1825 |
|
1826 | Errors: `Common*`
|
1827 |
|
1828 | #### buildGetValidatorInfoRequest \( submitterDid \) -> request
|
1829 |
|
1830 | Builds a GET\_VALIDATOR\_INFO request.
|
1831 |
|
1832 | * `submitterDid`: String - DID of the read request sender.
|
1833 | * __->__ `request`: Json
|
1834 |
|
1835 | Errors: `Common*`
|
1836 |
|
1837 | #### buildGetTxnRequest \( submitterDid, ledgerType, seqNo \) -> request
|
1838 |
|
1839 | Builds a GET\_TXN request. Request to get any transaction by its seq\_no.
|
1840 |
|
1841 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1842 | * `ledgerType`: String - \(Optional\) type of the ledger the requested transaction belongs to:
|
1843 | DOMAIN - used default,
|
1844 | POOL,
|
1845 | CONFIG
|
1846 | any number
|
1847 | * `seqNo`: Number - requested transaction sequence number as it's stored on Ledger.
|
1848 | * __->__ `request`: Json
|
1849 |
|
1850 | Errors: `Common*`
|
1851 |
|
1852 | #### buildPoolConfigRequest \( submitterDid, writes, force \) -> request
|
1853 |
|
1854 | Builds a POOL\_CONFIG request. Request to change Pool's configuration.
|
1855 |
|
1856 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1857 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1858 | * `writes`: Boolean - Whether any write requests can be processed by the pool
|
1859 | \(if false, then pool goes to read-only state\). True by default.
|
1860 | * `force`: Boolean - Whether we should apply transaction \(for example, move pool to read-only state\)
|
1861 | without waiting for consensus of this transaction.
|
1862 | * __->__ `request`: Json
|
1863 |
|
1864 | Errors: `Common*`
|
1865 |
|
1866 | #### buildPoolRestartRequest \( submitterDid, action, datetime \) -> request
|
1867 |
|
1868 | Builds a POOL\_RESTART request.
|
1869 |
|
1870 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1871 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1872 | * `action`: String - Action that pool has to do after received transaction.
|
1873 | * `datetime`: String - <Optional> Restart time in datetime format. Skip to restart as early as possible.
|
1874 | * __->__ `request`: Json
|
1875 |
|
1876 | Errors: `Common*`
|
1877 |
|
1878 | #### buildPoolUpgradeRequest \( submitterDid, name, version, action, sha256, timeout, schedule, justification, reinstall, force, package\_ \) -> request
|
1879 |
|
1880 | Builds a POOL\_UPGRADE request. Request to upgrade the Pool \(sent by Trustee\).
|
1881 | It upgrades the specified Nodes \(either all nodes in the Pool, or some specific ones\).
|
1882 |
|
1883 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1884 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1885 | * `name`: String - Human-readable name for the upgrade.
|
1886 | * `version`: String - The version of indy-node package we perform upgrade to.
|
1887 | Must be greater than existing one \(or equal if reinstall flag is True\).
|
1888 | * `action`: String - Either start or cancel.
|
1889 | * `sha256`: String - sha256 hash of the package.
|
1890 | * `timeout`: Number - \(Optional\) Limits upgrade time on each Node.
|
1891 | * `schedule`: String - \(Optional\) Schedule of when to perform upgrade on each node. Map Node DIDs to upgrade time.
|
1892 | * `justification`: String - \(Optional\) justification string for this particular Upgrade.
|
1893 | * `reinstall`: Boolean - Whether it's allowed to re-install the same version. False by default.
|
1894 | * `force`: Boolean - Whether we should apply transaction \(schedule Upgrade\) without waiting
|
1895 | for consensus of this transaction.
|
1896 | * `package_`: String
|
1897 | * __->__ `request`: Json
|
1898 |
|
1899 | Errors: `Common*`
|
1900 |
|
1901 | #### buildRevocRegDefRequest \( submitterDid, data \) -> request
|
1902 |
|
1903 | Builds a REVOC\_REG\_DEF request. Request to add the definition of revocation registry
|
1904 | to an exists credential definition.
|
1905 |
|
1906 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1907 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1908 | * `data`: Json - Revocation Registry data:
|
1909 | ```
|
1910 | {
|
1911 | "id": string - ID of the Revocation Registry,
|
1912 | "revocDefType": string - Revocation Registry type (only CL_ACCUM is supported for now),
|
1913 | "tag": string - Unique descriptive ID of the Registry,
|
1914 | "credDefId": string - ID of the corresponding CredentialDefinition,
|
1915 | "value": Registry-specific data {
|
1916 | "issuanceType": string - Type of Issuance(ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND),
|
1917 | "maxCredNum": number - Maximum number of credentials the Registry can serve.
|
1918 | "tailsHash": string - Hash of tails.
|
1919 | "tailsLocation": string - Location of tails file.
|
1920 | "publicKeys": <public_keys> - Registry's public key.
|
1921 | },
|
1922 | "ver": string - version of revocation registry definition json.
|
1923 | }
|
1924 | ````
|
1925 | * __->__ `request`: Json
|
1926 |
|
1927 | Errors: `Common*`
|
1928 |
|
1929 | #### buildGetRevocRegDefRequest \( submitterDid, id \) -> request
|
1930 |
|
1931 | Builds a GET\_REVOC\_REG\_DEF request. Request to get a revocation registry definition,
|
1932 | that Issuer creates for a particular Credential Definition.
|
1933 |
|
1934 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
1935 | * `id`: String - ID of Revocation Registry Definition in ledger.
|
1936 | * __->__ `request`: Json
|
1937 |
|
1938 | Errors: `Common*`
|
1939 |
|
1940 | #### parseGetRevocRegDefResponse \( getRevocRefDefResponse \) -> \[ revocRegDefId, revocRegDef \]
|
1941 |
|
1942 | Parse a GET\_REVOC\_REG\_DEF response to get Revocation Registry Definition in the format
|
1943 | compatible with Anoncreds API.
|
1944 |
|
1945 | * `getRevocRefDefResponse`: Json
|
1946 | * __->__ [ `revocRegDefId`: String, `revocRegDef`: Json ] - Revocation Registry Definition Id and Revocation Registry Definition json.
|
1947 | ```
|
1948 | {
|
1949 | "id": string - ID of the Revocation Registry,
|
1950 | "revocDefType": string - Revocation Registry type (only CL_ACCUM is supported for now),
|
1951 | "tag": string - Unique descriptive ID of the Registry,
|
1952 | "credDefId": string - ID of the corresponding CredentialDefinition,
|
1953 | "value": Registry-specific data {
|
1954 | "issuanceType": string - Type of Issuance(ISSUANCE_BY_DEFAULT or ISSUANCE_ON_DEMAND),
|
1955 | "maxCredNum": number - Maximum number of credentials the Registry can serve.
|
1956 | "tailsHash": string - Hash of tails.
|
1957 | "tailsLocation": string - Location of tails file.
|
1958 | "publicKeys": <public_keys> - Registry's public key.
|
1959 | },
|
1960 | "ver": string - version of revocation registry definition json.
|
1961 | }
|
1962 | ````
|
1963 |
|
1964 | Errors: `Common*`
|
1965 |
|
1966 | #### buildRevocRegEntryRequest \( submitterDid, revocRegDefId, revDefType, value \) -> request
|
1967 |
|
1968 | Builds a REVOC\_REG\_ENTRY request. Request to add the RevocReg entry containing
|
1969 | the new accumulator value and issued\/revoked indices.
|
1970 | This is just a delta of indices, not the whole list.
|
1971 | So, it can be sent each time a new credential is issued\/revoked.
|
1972 |
|
1973 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
1974 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
1975 | * `revocRegDefId`: String - ID of the corresponding RevocRegDef.
|
1976 | * `revDefType`: String - Revocation Registry type \(only CL\_ACCUM is supported for now\).
|
1977 | * `value`: Json - Registry-specific data:
|
1978 | ```
|
1979 | {
|
1980 | value:
|
1981 | {
|
1982 | prevAccum: string - previous accumulator value.
|
1983 | accum: string - current accumulator value.
|
1984 | issued: array<number> - an array of issued indices.
|
1985 | revoked: array<number> an array of revoked indices.
|
1986 | },
|
1987 | ver: string - version revocation registry entry json
|
1988 | }
|
1989 | ````
|
1990 | * __->__ `request`: Json
|
1991 |
|
1992 | Errors: `Common*`
|
1993 |
|
1994 | #### buildGetRevocRegRequest \( submitterDid, revocRegDefId, timestamp \) -> request
|
1995 |
|
1996 | Builds a GET\_REVOC\_REG request. Request to get the accumulated state of the Revocation Registry
|
1997 | by ID. The state is defined by the given timestamp.
|
1998 |
|
1999 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
2000 | * `revocRegDefId`: String - ID of the corresponding Revocation Registry Definition in ledger.
|
2001 | * `timestamp`: Timestamp (Number) - Requested time represented as a total number of seconds from Unix Epoch
|
2002 | * __->__ `request`: Json
|
2003 |
|
2004 | Errors: `Common*`
|
2005 |
|
2006 | #### parseGetRevocRegResponse \( getRevocRegResponse \) -> \[ revocRegDefId, revocReg, timestamp \]
|
2007 |
|
2008 | Parse a GET\_REVOC\_REG response to get Revocation Registry in the format compatible with Anoncreds API.
|
2009 |
|
2010 | * `getRevocRegResponse`: Json - response of GET\_REVOC\_REG request.
|
2011 | * __->__ [ `revocRegDefId`: String, `revocReg`: Json, `timestamp`: Timestamp (Number) ] - Revocation Registry Definition Id, Revocation Registry json and Timestamp.
|
2012 | ```
|
2013 | {
|
2014 | "value": Registry-specific data {
|
2015 | "accum": string - current accumulator value.
|
2016 | },
|
2017 | "ver": string - version revocation registry json
|
2018 | }
|
2019 | ````
|
2020 |
|
2021 | Errors: `Common*`
|
2022 |
|
2023 | #### buildGetRevocRegDeltaRequest \( submitterDid, revocRegDefId, from, to \) -> request
|
2024 |
|
2025 | Builds a GET\_REVOC\_REG\_DELTA request. Request to get the delta of the accumulated state of the Revocation Registry.
|
2026 | The Delta is defined by from and to timestamp fields.
|
2027 | If from is not specified, then the whole state till to will be returned.
|
2028 |
|
2029 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
2030 | * `revocRegDefId`: String - ID of the corresponding Revocation Registry Definition in ledger.
|
2031 | * `from`: Timestamp (Number) - Requested time represented as a total number of seconds from Unix Epoch
|
2032 | * `to`: Timestamp (Number) - Requested time represented as a total number of seconds from Unix Epoch
|
2033 | * __->__ `request`: Json
|
2034 |
|
2035 | Errors: `Common*`
|
2036 |
|
2037 | #### parseGetRevocRegDeltaResponse \( getRevocRegDeltaResponse \) -> \[ revocRegDefId, revocRegDelta, timestamp \]
|
2038 |
|
2039 | Parse a GET\_REVOC\_REG\_DELTA response to get Revocation Registry Delta in the format compatible with Anoncreds API.
|
2040 |
|
2041 | * `getRevocRegDeltaResponse`: Json
|
2042 | * __->__ [ `revocRegDefId`: String, `revocRegDelta`: Json, `timestamp`: Timestamp (Number) ] - Revocation Registry Definition Id, Revocation Registry Delta json and Timestamp.
|
2043 | ```
|
2044 | {
|
2045 | "value": Registry-specific data {
|
2046 | prevAccum: string - previous accumulator value.
|
2047 | accum: string - current accumulator value.
|
2048 | issued: array<number> - an array of issued indices.
|
2049 | revoked: array<number> an array of revoked indices.
|
2050 | },
|
2051 | "ver": string - version revocation registry delta json
|
2052 | }
|
2053 | ````
|
2054 |
|
2055 | Errors: `Common*`
|
2056 |
|
2057 | #### buildAuthRuleRequest \( submitterDid, txnType, action, field, oldValue, newValue, constraint \) -> request
|
2058 |
|
2059 | Builds a AUTH_RULE request. Request to change authentication rules for a ledger transaction.
|
2060 |
|
2061 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
2062 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
2063 | * `txnType`: String - ledger transaction alias or associated value.
|
2064 | * `action`: String - type of an action.
|
2065 | * "ADD" - to add a new rule
|
2066 | * "EDIT" - to edit an existing one
|
2067 | * `field`: String - transaction field.
|
2068 | * `oldValue`: String - \(Optional\) old value of a field, which can be changed to a new_value (mandatory for EDIT action).
|
2069 | * `newValue`: String - \(Optional\) new value that can be used to fill the field.
|
2070 | * `constraint`: Json - set of constraints required for execution of an action in the following format:
|
2071 | ```
|
2072 | {
|
2073 | constraint_id - <string> type of a constraint.
|
2074 | Can be either "ROLE" to specify final constraint or "AND"/"OR" to combine constraints.
|
2075 | role - <string> (optional) role of a user which satisfy to constrain.
|
2076 | sig_count - <u32> the number of signatures required to execution action.
|
2077 | need_to_be_owner - <bool> (optional) if user must be an owner of transaction (false by default).
|
2078 | off_ledger_signature - <bool> (optional) allow signature of unknow for ledger did (false by default).
|
2079 | metadata - <object> (optional) additional parameters of the constraint.
|
2080 | }
|
2081 | can be combined by
|
2082 | {
|
2083 | 'constraint_id': <"AND" or "OR">
|
2084 | 'auth_constraints': [<constraint_1>, <constraint_2>]
|
2085 | }
|
2086 | ```
|
2087 |
|
2088 | Default ledger auth rules: https://github.com/hyperledger/indy-node/blob/master/docs/source/auth_rules.md
|
2089 |
|
2090 | More about AUTH_RULE request: https://github.com/hyperledger/indy-node/blob/master/docs/source/requests.md#auth_rule
|
2091 |
|
2092 | * __->__ `request`: Json
|
2093 |
|
2094 | Errors: `Common*`
|
2095 |
|
2096 | #### buildAuthRulesRequest \( submitterDid, data \) -> request
|
2097 |
|
2098 | Builds a AUTH_RULES request. Request to change multiple authentication rules for a ledger transaction.
|
2099 |
|
2100 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
2101 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
2102 | * `constraint`: Json - a list of auth rules:
|
2103 | ```
|
2104 | [
|
2105 | {
|
2106 | "auth_type": ledger transaction alias or associated value,
|
2107 | "auth_action": type of an action,
|
2108 | "field": transaction field,
|
2109 | "old_value": (Optional) old value of a field, which can be changed to a new_value (mandatory for EDIT action),
|
2110 | "new_value": (Optional) new value that can be used to fill the field,
|
2111 | "constraint": set of constraints required for execution of an action in the format described above for `buildAuthRuleRequest` function.
|
2112 | },
|
2113 | ...
|
2114 | ]
|
2115 | ```
|
2116 |
|
2117 | Default ledger auth rules: https://github.com/hyperledger/indy-node/blob/master/docs/source/auth_rules.md
|
2118 |
|
2119 | More about AUTH_RULE request: https://github.com/hyperledger/indy-node/blob/master/docs/source/requests.md#auth_rules
|
2120 |
|
2121 | * __->__ `request`: Json
|
2122 |
|
2123 | Errors: `Common*`
|
2124 |
|
2125 |
|
2126 | #### buildGetAuthRuleRequest \( submitterDid, txnType, action, field, oldValue, newValue \) -> request
|
2127 |
|
2128 | Builds a GET_AUTH_RULE request. Request to get authentication rules for a ledger transaction.
|
2129 |
|
2130 | NOTE: Either none or all transaction related parameters must be specified (`oldValue` can be skipped for `ADD` action).
|
2131 | * none - to get all authentication rules for all ledger transactions
|
2132 | * all - to get authentication rules for specific action (`oldValue` can be skipped for `ADD` action)
|
2133 |
|
2134 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
2135 | * `txnType`: String - target ledger transaction alias or associated value.
|
2136 | * `action`: String - target action type. Can be either "ADD" or "EDIT".
|
2137 | * `field`: String - target transaction field.
|
2138 | * `oldValue`: String - \(Optional\) old value of field, which can be changed to a new_value (mandatory for EDIT action).
|
2139 | * `newValue`: String - \(Optional\) new value that can be used to fill the field.
|
2140 |
|
2141 | * __->__ `request`: Json
|
2142 |
|
2143 | Errors: `Common*`
|
2144 |
|
2145 | #### buildTxnAuthorAgreementRequest \( submitterDid, text, version, ratificationTimestamp, retirementTimestamp \) -> request
|
2146 |
|
2147 | Builds a TXN_AUTHR_AGRMT request.
|
2148 | Request to add a new version of Transaction Author Agreement to the ledger.
|
2149 |
|
2150 | EXPERIMENTAL
|
2151 |
|
2152 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
2153 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
2154 | * `text`: String - \(Optional\) a content of the TTA.
|
2155 | * Mandatory in case of adding a new TAA. An existing TAA text can not be changed.
|
2156 | * for Indy Node version <= 1.12.0:
|
2157 | * Use empty string to reset TAA on the ledger
|
2158 | * for Indy Node version > 1.12.0
|
2159 | * Should be omitted in case of updating an existing TAA (setting `retirementTimestamp`)
|
2160 | * `version`: String - a version of the TTA (unique UTF-8 string).
|
2161 | * `version`: String - the date (timestamp) of TAA ratification by network government.
|
2162 | * `ratificationTimestamp`: Number - \(Optional\) Еhe date (timestamp) of TAA ratification by network government.
|
2163 | * for Indy Node version <= 1.12.0:
|
2164 | * Must be omitted
|
2165 | * for Indy Node version > 1.12.0:
|
2166 | * Must be specified in case of adding a new TAA
|
2167 | * Can be omitted in case of updating an existing TAA
|
2168 | * `retirementTimestamp`: Number - \(Optional\) the date \(timestamp\) of TAA retirement.
|
2169 | * for Indy Node version <= 1.12.0:
|
2170 | * Must be omitted
|
2171 | * for Indy Node version > 1.12.0:
|
2172 | * Must be omitted in case of adding a new (latest) TAA.
|
2173 | * Should be used for updating (deactivating) non-latest TAA on the ledger.
|
2174 |
|
2175 | Note: Use `buildDisableAllTxnAuthorAgreementsRequest` to disable all TAA's on the ledger.
|
2176 |
|
2177 | * __->__ `request`: Json
|
2178 |
|
2179 | Errors: `Common*`
|
2180 |
|
2181 | #### buildDisableAllTxnAuthorAgreementsRequest \( submitterDid \) -> request
|
2182 |
|
2183 | Builds a DISABLE_ALL_TXN_AUTHR_AGRMTS request.
|
2184 | Request to disable all Transaction Author Agreement on the ledger.
|
2185 |
|
2186 | EXPERIMENTAL
|
2187 |
|
2188 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
2189 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
2190 |
|
2191 | * __->__ `request`: Json
|
2192 |
|
2193 | Errors: `Common*`
|
2194 |
|
2195 |
|
2196 | #### buildGetTxnAuthorAgreementRequest \( submitterDid, data \) -> request
|
2197 |
|
2198 | Builds a GET_TXN_AUTHR_AGRMT request.
|
2199 | Request to get a specific Transaction Author Agreement from the ledger.
|
2200 |
|
2201 | EXPERIMENTAL
|
2202 |
|
2203 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
2204 | * `data`: Json - \(Optional\) specifies a condition for getting specific TAA.
|
2205 | Contains 3 mutually exclusive optional fields:
|
2206 | ```
|
2207 | {
|
2208 | hash: Optional<str> - hash of requested TAA,
|
2209 | version: Optional<str> - version of requested TAA.
|
2210 | timestamp: Optional<u64> - ledger will return TAA valid at requested timestamp.
|
2211 | }
|
2212 | ```
|
2213 | Null data or empty JSON are acceptable here. In this case, ledger will return the latest version of TAA.
|
2214 |
|
2215 | * __->__ `request`: Json
|
2216 |
|
2217 | Errors: `Common*`
|
2218 |
|
2219 | #### buildAcceptanceMechanismsRequest \( submitterDid, aml, version, amlContext \) -> request
|
2220 |
|
2221 | Builds a SET_TXN_AUTHR_AGRMT_AML request.
|
2222 | Request to add a new list of acceptance mechanisms for transaction author agreement.
|
2223 | Acceptance Mechanism is a description of the ways how the user may accept a transaction author agreement.
|
2224 |
|
2225 | EXPERIMENTAL
|
2226 |
|
2227 | * `submitterDid`: String - Identifier (DID) of the transaction author as base58-encoded string.
|
2228 | Actual request sender may differ if Endorser is used (look at `appendRequestEndorser`)
|
2229 | * `aml`: Json - a set of new acceptance mechanisms:
|
2230 | ```
|
2231 | {
|
2232 | “<acceptance mechanism label 1>”: { acceptance mechanism description 1},
|
2233 | “<acceptance mechanism label 2>”: { acceptance mechanism description 2},
|
2234 | ...
|
2235 | }
|
2236 | ```
|
2237 | * `version`: String - a version of new acceptance mechanisms. (Note: unique on the Ledger).
|
2238 | * `amlContext`: String - \(Optional\) common context information about acceptance mechanisms (may be a URL to external resource).
|
2239 |
|
2240 | * __->__ `request`: Json
|
2241 |
|
2242 | Errors: `Common*`
|
2243 |
|
2244 | #### buildGetAcceptanceMechanismsRequest \( submitterDid, timestamp \) -> request
|
2245 |
|
2246 | Builds a GET_TXN_AUTHR_AGRMT_AML request.
|
2247 | Request to get a list of acceptance mechanisms from the ledger valid for specified time or the latest one.
|
2248 |
|
2249 | EXPERIMENTAL
|
2250 |
|
2251 | * `submitterDid`: String - \(Optional\) DID of the read request sender \(if not provided then default Libindy DID will be used\).
|
2252 | * `timestamp`: Timestamp (Number) - \(Optional\) time to get an active acceptance mechanisms. The latest one will be returned for null.
|
2253 | * `version`: Timestamp (String) - \(Optional\) version of acceptance mechanisms.
|
2254 |
|
2255 | NOTE: timestamp and version cannot be specified together.
|
2256 |
|
2257 | * __->__ `request`: Json
|
2258 |
|
2259 | Errors: `Common*`
|
2260 |
|
2261 | #### appendTxnAuthorAgreementAcceptanceToRequest \( requestJson, text, version, taaDigest, accMechType, timeOfAcceptance \) -> request
|
2262 |
|
2263 | Append transaction author agreement acceptance data to a request.
|
2264 | This function should be called before signing and sending a request
|
2265 | if there is any transaction author agreement set on the Ledger.
|
2266 |
|
2267 | EXPERIMENTAL
|
2268 |
|
2269 | This function may calculate hash by itself or consume it as a parameter.
|
2270 | If all text, version and taaDigest parameters are specified, a check integrity of them will be done.
|
2271 |
|
2272 | * `requestJson`: Json - original request data json.
|
2273 | * `text`: String - \(Optional\) raw data about TAA from ledger.
|
2274 | * `version`: String - \(Optional\) raw data about TAA from ledger.
|
2275 | * `text` and `version` parameters should be passed together.
|
2276 | * `text` and `version` parameters are required if taaDigest parameter is omitted.
|
2277 | * `taaDigest`: String - \(Optional\) hash on text and version. Digest is sha256 hash calculated on concatenated strings: version || text. This parameter is required if text and version parameters are omitted.
|
2278 | * `accMechType`: String - mechanism how user has accepted the TAA.
|
2279 | * `timeOfAcceptance`: Timestamp (Number) - UTC timestamp when user has accepted the TAA. Note that the time portion will be discarded to avoid a privacy risk.
|
2280 |
|
2281 | * __->__ `request`: Json
|
2282 |
|
2283 | Errors: `Common*`
|
2284 |
|
2285 | #### appendRequestEndorser \( requestJson, endorserDid \) -> request
|
2286 |
|
2287 | Append Endorser to an existing request.
|
2288 |
|
2289 | An author of request still is a `DID` used as a `submitter_did` parameter for the building of the request.
|
2290 | But it is expecting that the transaction will be sent by the specified Endorser.
|
2291 |
|
2292 | Note: Both Transaction Author and Endorser must sign output request after that.
|
2293 |
|
2294 | More about Transaction Endorser: https://github.com/hyperledger/indy-node/blob/master/design/transaction_endorser.md
|
2295 | https://github.com/hyperledger/indy-sdk/blob/master/docs/configuration.md
|
2296 |
|
2297 | * `requestJson`: Json - original request data json.
|
2298 | * `endorser_did`: String - DID of the Endorser that will submit the transaction.
|
2299 | The Endorser's DID must be present on the ledger.
|
2300 |
|
2301 | * __->__ `request`: Json
|
2302 |
|
2303 | Errors: `Common*`
|
2304 |
|
2305 | #### getResponseMetadata \( response \) -> responseMetadata
|
2306 |
|
2307 | Parse transaction response to fetch metadata.
|
2308 | The important use case for this method is validation of Node's response freshens.
|
2309 |
|
2310 | Distributed Ledgers can reply with outdated information for consequence read request after write.
|
2311 | To reduce pool load libindy sends read requests to one random node in the pool.
|
2312 | Consensus validation is performed based on validation of nodes multi signature for current ledger Merkle Trie root.
|
2313 | This multi signature contains information about the latest ldeger's transaction ordering time and sequence number that this method returns.
|
2314 |
|
2315 | If node that returned response for some reason is out of consensus and has outdated ledger
|
2316 | it can be caught by analysis of the returned latest ledger's transaction ordering time and sequence number.
|
2317 |
|
2318 | There are two ways to filter outdated responses:
|
2319 | 1\) based on "seqNo" - sender knows the sequence number of transaction that he consider as a fresh enough.
|
2320 | 2\) based on "txnTime" - sender knows the timestamp that he consider as a fresh enough.
|
2321 |
|
2322 | Note: response of GET\_VALIDATOR\_INFO request isn't supported
|
2323 |
|
2324 | * `response`: Json - response of write or get request.
|
2325 | * __->__ `responseMetadata`: Json - response metadata.
|
2326 | ```
|
2327 | {
|
2328 | "seqNo": Option<u64> - transaction sequence number,
|
2329 | "txnTime": Option<u64> - transaction ordering time,
|
2330 | "lastSeqNo": Option<u64> - the latest transaction seqNo for particular Node,
|
2331 | "lastTxnTime": Option<u64> - the latest transaction ordering time for particular Node
|
2332 | }
|
2333 | ````
|
2334 |
|
2335 | Errors: `Common*`, `Ledger*`
|
2336 |
|
2337 | ### non_secrets
|
2338 |
|
2339 | #### addWalletRecord \( wh, type, id, value, tags \) -> void
|
2340 |
|
2341 | Create a new non-secret record in the wallet
|
2342 |
|
2343 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2344 | * `type`: String - allows to separate different record types collections
|
2345 | * `id`: String - the id of record
|
2346 | * `value`: String - the value of record
|
2347 | * `tags`: Json - \(optional\) the record tags used for search and storing meta information as json:
|
2348 | ```
|
2349 | {
|
2350 | "tagName1": <str>, // string tag (will be stored encrypted)
|
2351 | "tagName2": <str>, // string tag (will be stored encrypted)
|
2352 | "~tagName3": <str>, // string tag (will be stored un-encrypted)
|
2353 | "~tagName4": <str>, // string tag (will be stored un-encrypted)
|
2354 | }
|
2355 | Note that null means no tags
|
2356 | If tag name starts with "~" the tag will be stored un-encrypted that will allow
|
2357 | usage of this tag in complex search queries (comparison, predicates)
|
2358 | Encrypted tags can be searched only for exact matching
|
2359 | ````
|
2360 | * __->__ void
|
2361 |
|
2362 |
|
2363 | #### updateWalletRecordValue \( wh, type, id, value \) -> void
|
2364 |
|
2365 | Update a non-secret wallet record value
|
2366 |
|
2367 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2368 | * `type`: String - allows to separate different record types collections
|
2369 | * `id`: String - the id of record
|
2370 | * `value`: String - the new value of record
|
2371 | * __->__ void
|
2372 |
|
2373 |
|
2374 | #### updateWalletRecordTags \( wh, type, id, tags \) -> void
|
2375 |
|
2376 | Update a non-secret wallet record tags
|
2377 |
|
2378 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2379 | * `type`: String - allows to separate different record types collections
|
2380 | * `id`: String - the id of record
|
2381 | * `tags`: Json - the record tags used for search and storing meta information as json:
|
2382 | ```
|
2383 | {
|
2384 | "tagName1": <str>, // string tag (will be stored encrypted)
|
2385 | "tagName2": <str>, // string tag (will be stored encrypted)
|
2386 | "~tagName3": <str>, // string tag (will be stored un-encrypted)
|
2387 | "~tagName4": <str>, // string tag (will be stored un-encrypted)
|
2388 | }
|
2389 | If tag name starts with "~" the tag will be stored un-encrypted that will allow
|
2390 | usage of this tag in complex search queries (comparison, predicates)
|
2391 | Encrypted tags can be searched only for exact matching
|
2392 | ````
|
2393 | * __->__ void
|
2394 |
|
2395 |
|
2396 | #### addWalletRecordTags \( wh, type, id, tags \) -> void
|
2397 |
|
2398 | Add new tags to the wallet record
|
2399 |
|
2400 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2401 | * `type`: String - allows to separate different record types collections
|
2402 | * `id`: String - the id of record
|
2403 | * `tags`: Json - the record tags used for search and storing meta information as json:
|
2404 | ```
|
2405 | {
|
2406 | "tagName1": <str>, // string tag (will be stored encrypted)
|
2407 | "tagName2": <str>, // string tag (will be stored encrypted)
|
2408 | "~tagName3": <str>, // string tag (will be stored un-encrypted)
|
2409 | "~tagName4": <str>, // string tag (will be stored un-encrypted)
|
2410 | }
|
2411 | If tag name starts with "~" the tag will be stored un-encrypted that will allow
|
2412 | usage of this tag in complex search queries (comparison, predicates)
|
2413 | Encrypted tags can be searched only for exact matching
|
2414 | Note if some from provided tags already assigned to the record than
|
2415 | corresponding tags values will be replaced
|
2416 | ````
|
2417 | * __->__ void
|
2418 |
|
2419 |
|
2420 | #### deleteWalletRecordTags \( wh, type, id, tagNames \) -> void
|
2421 |
|
2422 | Delete tags from the wallet record
|
2423 |
|
2424 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2425 | * `type`: String - allows to separate different record types collections
|
2426 | * `id`: String - the id of record
|
2427 | * `tagNames`: Json - the list of tag names to remove from the record as json array:
|
2428 | \["tagName1", "tagName2", ...\]
|
2429 | * __->__ void
|
2430 |
|
2431 |
|
2432 | #### deleteWalletRecord \( wh, type, id \) -> void
|
2433 |
|
2434 | Delete an existing wallet record in the wallet
|
2435 |
|
2436 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2437 | * `type`: String - record type
|
2438 | * `id`: String - the id of record
|
2439 | * __->__ void
|
2440 |
|
2441 |
|
2442 | #### getWalletRecord \( wh, type, id, options \) -> record
|
2443 |
|
2444 | Get an wallet record by id
|
2445 |
|
2446 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2447 | * `type`: String - allows to separate different record types collections
|
2448 | * `id`: String - the id of record
|
2449 | * `options`: Json - \/\/TODO: FIXME: Think about replacing by bitmask
|
2450 | ```
|
2451 | {
|
2452 | retrieveType: (optional, false by default) Retrieve record type,
|
2453 | retrieveValue: (optional, true by default) Retrieve record value,
|
2454 | retrieveTags: (optional, false by default) Retrieve record tags
|
2455 | }
|
2456 | ````
|
2457 | * __->__ `record`: Json - wallet record json:
|
2458 | ```
|
2459 | {
|
2460 | id: "Some id",
|
2461 | type: "Some type", // present only if retrieveType set to true
|
2462 | value: "Some value", // present only if retrieveValue set to true
|
2463 | tags: <tags json>, // present only if retrieveTags set to true
|
2464 | }
|
2465 | ````
|
2466 |
|
2467 |
|
2468 | #### openWalletSearch \( wh, type, query, options \) -> sh
|
2469 |
|
2470 | Search for wallet records.
|
2471 |
|
2472 | Note instead of immediately returning of fetched records
|
2473 | this call returns wallet\_search\_handle that can be used later
|
2474 | to fetch records by small batches \(with fetchWalletSearchNextRecords\).
|
2475 |
|
2476 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2477 | * `type`: String - allows to separate different record types collections
|
2478 | * `query`: Json - MongoDB style query to wallet record tags:
|
2479 | ```
|
2480 | {
|
2481 | "tagName": "tagValue",
|
2482 | $or:
|
2483 | {
|
2484 | "tagName2": { $regex: 'pattern' },
|
2485 | "tagName3": { $gte: '123' },
|
2486 | },
|
2487 | }
|
2488 | ````
|
2489 | * `options`: Json - \/\/TODO: FIXME: Think about replacing by bitmask
|
2490 | ```
|
2491 | {
|
2492 | retrieveRecords: (optional, true by default) If false only "counts" will be calculated,
|
2493 | retrieveTotalCount: (optional, false by default) Calculate total count,
|
2494 | retrieveType: (optional, false by default) Retrieve record type,
|
2495 | retrieveValue: (optional, true by default) Retrieve record value,
|
2496 | retrieveTags: (optional, false by default) Retrieve record tags,
|
2497 | }
|
2498 | ````
|
2499 | * __->__ `sh`: Handle (Number) - search\_handle: Wallet search handle that can be used later
|
2500 | to fetch records by small batches \(with fetchWalletSearchNextRecords\)
|
2501 |
|
2502 |
|
2503 | #### fetchWalletSearchNextRecords \( wh, walletSearchHandle, count \) -> records
|
2504 |
|
2505 | Fetch next records for wallet search.
|
2506 |
|
2507 | Not if there are no records this call returns WalletNoRecords error.
|
2508 |
|
2509 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2510 | * `walletSearchHandle`: Handle (Number) - wallet search handle \(created by openWalletSearch\)
|
2511 | * `count`: Number - Count of records to fetch
|
2512 | * __->__ `records`: Json - wallet records json:
|
2513 | ```
|
2514 | {
|
2515 | totalCount: <str>, // present only if retrieveTotalCount set to true
|
2516 | records: [{ // present only if retrieveRecords set to true
|
2517 | id: "Some id",
|
2518 | type: "Some type", // present only if retrieveType set to true
|
2519 | value: "Some value", // present only if retrieveValue set to true
|
2520 | tags: <tags json>, // present only if retrieveTags set to true
|
2521 | }],
|
2522 | }
|
2523 | ````
|
2524 |
|
2525 |
|
2526 | #### closeWalletSearch \( walletSearchHandle \) -> void
|
2527 |
|
2528 | Close wallet search \(make search handle invalid\)
|
2529 |
|
2530 | * `walletSearchHandle`: Handle (Number) - wallet search handle
|
2531 | * __->__ void
|
2532 |
|
2533 |
|
2534 | ### pairwise
|
2535 |
|
2536 | #### isPairwiseExists \( wh, theirDid \) -> exists
|
2537 |
|
2538 | Check if pairwise is exists.
|
2539 |
|
2540 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2541 | * `theirDid`: String - encrypted DID
|
2542 | * __->__ `exists`: Boolean - exists: true - if pairwise is exists, false - otherwise
|
2543 |
|
2544 | Errors: `Common*`, `Wallet*`
|
2545 |
|
2546 | #### createPairwise \( wh, theirDid, myDid, metadata \) -> void
|
2547 |
|
2548 | Creates pairwise.
|
2549 |
|
2550 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2551 | * `theirDid`: String - encrypted DID
|
2552 | * `myDid`: String - encrypted DID
|
2553 | metadata Optional: extra information for pairwise
|
2554 | * `metadata`: String
|
2555 | * __->__ void
|
2556 |
|
2557 | Errors: `Common*`, `Wallet*`
|
2558 |
|
2559 | #### listPairwise \( wh \) -> listPairwise
|
2560 |
|
2561 | Get list of saved pairwise.
|
2562 |
|
2563 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2564 | * __->__ `listPairwise`: Json - list\_pairwise: list of saved pairwise
|
2565 |
|
2566 | Errors: `Common*`, `Wallet*`
|
2567 |
|
2568 | #### getPairwise \( wh, theirDid \) -> pairwiseInfo
|
2569 |
|
2570 | Gets pairwise information for specific their\_did.
|
2571 |
|
2572 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2573 | * `theirDid`: String - encoded Did
|
2574 | * __->__ `pairwiseInfo`: Json - pairwise\_info\_json: did info associated with their did
|
2575 |
|
2576 | Errors: `Common*`, `Wallet*`
|
2577 |
|
2578 | #### setPairwiseMetadata \( wh, theirDid, metadata \) -> void
|
2579 |
|
2580 | Save some data in the Wallet for pairwise associated with Did.
|
2581 |
|
2582 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2583 | * `theirDid`: String - encoded Did
|
2584 | * `metadata`: String - some extra information for pairwise
|
2585 | * __->__ void
|
2586 |
|
2587 | Errors: `Common*`, `Wallet*`
|
2588 |
|
2589 | ### payment
|
2590 |
|
2591 | #### createPaymentAddress \( wh, paymentMethod, config \) -> paymentAddress
|
2592 |
|
2593 | Create the payment address for specified payment method
|
2594 |
|
2595 |
|
2596 | This method generates private part of payment address
|
2597 | and stores it in a secure place. Ideally it should be
|
2598 | secret in libindy wallet \(see crypto module\).
|
2599 |
|
2600 | Note that payment method should be able to resolve this
|
2601 | secret by fully resolvable payment address format.
|
2602 |
|
2603 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2604 | * `paymentMethod`: String - payment method to use \(for example, 'sov'\)
|
2605 | * `config`: Json - payment address config as json:
|
2606 | ```
|
2607 | {
|
2608 | seed: <str>, // allows deterministic creation of payment address
|
2609 | }
|
2610 | ````
|
2611 | * __->__ `paymentAddress`: String - payment\_address - public identifier of payment address in fully resolvable payment address format
|
2612 |
|
2613 |
|
2614 | #### listPaymentAddresses \( wh \) -> paymentAddresses
|
2615 |
|
2616 | Lists all payment addresses that are stored in the wallet
|
2617 |
|
2618 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2619 | * __->__ `paymentAddresses`: Json - payment\_addresses\_json - json array of string with json addresses
|
2620 |
|
2621 |
|
2622 | #### addRequestFees \( wh, submitterDid, req, inputs, outputs, extra \) -> \[ reqWithFees, paymentMethod \]
|
2623 |
|
2624 | Modifies Indy request by adding information how to pay fees for this transaction
|
2625 | according to this payment method.
|
2626 |
|
2627 | This method consumes set of inputs and outputs. The difference between inputs balance
|
2628 | and outputs balance is the fee for this transaction.
|
2629 |
|
2630 | Not that this method also produces correct fee signatures.
|
2631 |
|
2632 | Format of inputs is specific for payment method. Usually it should reference payment transaction
|
2633 | with at least one output that corresponds to payment address that user owns.
|
2634 |
|
2635 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2636 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2637 | * `req`: Json - initial transaction request as json
|
2638 | * `inputs`: Json - The list of payment sources as json array:
|
2639 | \["source1", ...\]
|
2640 | - each input should reference paymentAddress
|
2641 | - this param will be used to determine payment\_method
|
2642 | * `outputs`: Json - The list of outputs as json array:
|
2643 | ```
|
2644 | [{
|
2645 | recipient: <str>, // payment address of recipient
|
2646 | amount: <int>, // amount
|
2647 | }]
|
2648 | ````
|
2649 | * `extra`: String - \/\/ optional information for payment operation
|
2650 | * __->__ [ `reqWithFees`: Json, `paymentMethod`: String ] - req\_with\_fees\_json - modified Indy request with added fees info
|
2651 | payment\_method - used payment method
|
2652 |
|
2653 |
|
2654 | #### parseResponseWithFees \( paymentMethod, resp \) -> receipts
|
2655 |
|
2656 | Parses response for Indy request with fees.
|
2657 |
|
2658 | * `paymentMethod`: String - payment method to use
|
2659 | * `resp`: Json - response for Indy request with fees
|
2660 | * __->__ `receipts`: Json - receipts\_json - parsed \(payment method and node version agnostic\) receipts info as json:
|
2661 | ```
|
2662 | [{
|
2663 | receipt: <str>, // receipt that can be used for payment referencing and verification
|
2664 | recipient: <str>, //payment address of recipient
|
2665 | amount: <int>, // amount
|
2666 | extra: <str>, // optional data from payment transaction
|
2667 | }]
|
2668 | ````
|
2669 |
|
2670 |
|
2671 | #### buildGetPaymentSourcesRequest \( wh, submitterDid, paymentAddress \) -> \[ getSourcesTxn, paymentMethod \]
|
2672 |
|
2673 | Builds Indy request for getting sources list for payment address
|
2674 | according to this payment method.
|
2675 |
|
2676 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2677 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2678 | * `paymentAddress`: String - target payment address
|
2679 | * __->__ [ `getSourcesTxn`: Json, `paymentMethod`: String ] - get\_sources\_txn\_json - Indy request for getting sources list for payment address
|
2680 | payment\_method - used payment method
|
2681 |
|
2682 |
|
2683 | #### parseGetPaymentSourcesResponse \( paymentMethod, resp \) -> sources
|
2684 |
|
2685 | Parses response for Indy request for getting sources list.
|
2686 |
|
2687 | * `paymentMethod`: String - payment method to use.
|
2688 | * `resp`: Json - response for Indy request for getting sources list
|
2689 | * __->__ `sources`: Json - sources\_json - parsed \(payment method and node version agnostic\) sources info as json:
|
2690 | ```
|
2691 | [{
|
2692 | source: <str>, // source input
|
2693 | paymentAddress: <str>, //payment address for this source
|
2694 | amount: <int>, // amount
|
2695 | extra: <str>, // optional data from payment transaction
|
2696 | }]
|
2697 | ````
|
2698 |
|
2699 |
|
2700 | #### buildPaymentReq \( wh, submitterDid, inputs, outputs, extra \) -> \[ paymentReq, paymentMethod \]
|
2701 |
|
2702 | Builds Indy request for doing payment
|
2703 | according to this payment method.
|
2704 |
|
2705 | This method consumes set of inputs and outputs.
|
2706 |
|
2707 | Format of inputs is specific for payment method. Usually it should reference payment transaction
|
2708 | with at least one output that corresponds to payment address that user owns.
|
2709 |
|
2710 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2711 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2712 | * `inputs`: Json - The list of payment sources as json array:
|
2713 | \["source1", ...\]
|
2714 | Note that each source should reference payment address
|
2715 | * `outputs`: Json - The list of outputs as json array:
|
2716 | ```
|
2717 | [{
|
2718 | recipient: <str>, // payment address of recipient
|
2719 | amount: <int>, // amount
|
2720 | }]
|
2721 | ````
|
2722 | * `extra`: String - \/\/ optional information for payment operation
|
2723 | * __->__ [ `paymentReq`: Json, `paymentMethod`: String ] - payment\_req\_json - Indy request for doing payment
|
2724 | payment\_method - used payment method
|
2725 |
|
2726 |
|
2727 | #### parsePaymentResponse \( paymentMethod, resp \) -> receipts
|
2728 |
|
2729 | Parses response for Indy request for payment txn.
|
2730 |
|
2731 | * `paymentMethod`: String - payment method to use
|
2732 | * `resp`: Json - response for Indy request for payment txn
|
2733 | * __->__ `receipts`: Json - receipts\_json - parsed \(payment method and node version agnostic\) receipts info as json:
|
2734 | ```
|
2735 | [{
|
2736 | receipt: <str>, // receipt that can be used for payment referencing and verification
|
2737 | recipient: <str>, // payment address of recipient
|
2738 | amount: <int>, // amount
|
2739 | extra: <str>, // optional data from payment transaction
|
2740 | }]
|
2741 | ````
|
2742 |
|
2743 | #### preparePaymentExtraWithAcceptanceData \( extraJson, text, version, taaDigest, accMechType, timeOfAcceptance \) -> request
|
2744 |
|
2745 | Append payment extra JSON with TAA acceptance data
|
2746 |
|
2747 | EXPERIMENTAL
|
2748 |
|
2749 | This function may calculate hash by itself or consume it as a parameter.
|
2750 | If all text, version and taaDigest parameters are specified, a check integrity of them will be done.
|
2751 |
|
2752 | * `extraJson`: Json - \(Optional\) original extra json.
|
2753 | * `text`: String - \(Optional\) raw data about TAA from ledger.
|
2754 | * `version`: String - \(Optional\) raw data about TAA from ledger.
|
2755 | * `text` and `version` parameters should be passed together.
|
2756 | * `text` and `version` parameters are required if taaDigest parameter is omitted.
|
2757 | * `taaDigest`: String - \(Optional\) hash on text and version. This parameter is required if text and version parameters are omitted.
|
2758 | * `accMechType`: String - mechanism how user has accepted the TAA.
|
2759 | * `timeOfAcceptance`: Timestamp (Number) - UTC timestamp when user has accepted the TAA.
|
2760 |
|
2761 | * __->__ `request`: Json
|
2762 |
|
2763 | Errors: `Common*`
|
2764 |
|
2765 | #### buildMintReq \( wh, submitterDid, outputs, extra \) -> \[ mintReq, paymentMethod \]
|
2766 |
|
2767 | Builds Indy request for doing minting
|
2768 | according to this payment method.
|
2769 |
|
2770 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2771 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2772 | * `outputs`: Json - The list of outputs as json array:
|
2773 | ```
|
2774 | [{
|
2775 | recipient: <str>, // payment address of recipient
|
2776 | amount: <int>, // amount
|
2777 | }]
|
2778 | ````
|
2779 | * `extra`: String - \/\/ optional information for mint operation
|
2780 | * __->__ [ `mintReq`: Json, `paymentMethod`: String ] - mint\_req\_json - Indy request for doing minting
|
2781 | payment\_method - used payment method
|
2782 |
|
2783 |
|
2784 | #### buildSetTxnFeesReq \( wh, submitterDid, paymentMethod, fees \) -> setTxnFees
|
2785 |
|
2786 | Builds Indy request for setting fees for transactions in the ledger
|
2787 |
|
2788 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2789 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2790 | * `paymentMethod`: String - payment method to use
|
2791 | fees\_json {
|
2792 | txnType1: amount1,
|
2793 | txnType2: amount2,
|
2794 | .................
|
2795 | txnTypeN: amountN,
|
2796 | }
|
2797 | * `fees`: Json
|
2798 | * __->__ `setTxnFees`: Json - set\_txn\_fees\_json - Indy request for setting fees for transactions in the ledger
|
2799 |
|
2800 |
|
2801 | #### buildGetTxnFeesReq \( wh, submitterDid, paymentMethod \) -> getTxnFees
|
2802 |
|
2803 | Builds Indy get request for getting fees for transactions in the ledger
|
2804 |
|
2805 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2806 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2807 | * `paymentMethod`: String - payment method to use
|
2808 | * __->__ `getTxnFees`: Json - get\_txn\_fees\_json - Indy request for getting fees for transactions in the ledger
|
2809 |
|
2810 |
|
2811 | #### parseGetTxnFeesResponse \( paymentMethod, resp \) -> fees
|
2812 |
|
2813 | Parses response for Indy request for getting fees
|
2814 |
|
2815 | * `paymentMethod`: String - payment method to use
|
2816 | * `resp`: Json - response for Indy request for getting fees
|
2817 | * __->__ `fees`: Json - fees\_json {
|
2818 | txnType1: amount1,
|
2819 | txnType2: amount2,
|
2820 | .................
|
2821 | txnTypeN: amountN,
|
2822 | }
|
2823 |
|
2824 |
|
2825 | #### buildVerifyPaymentReq \( wh, submitterDid, receipt \) -> \[ verifyTxn, paymentMethod \]
|
2826 |
|
2827 | Builds Indy request for information to verify the payment receipt
|
2828 |
|
2829 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2830 | * `submitterDid`: String - \(Optional\) DID of request sender
|
2831 | * `receipt`: String - payment receipt to verify
|
2832 | * __->__ [ `verifyTxn`: Json, `paymentMethod`: String ] - verify\_txn\_json: Indy request for verification receipt
|
2833 | payment\_method: used payment method
|
2834 |
|
2835 |
|
2836 | #### parseVerifyPaymentResponse \( paymentMethod, resp \) -> txn
|
2837 |
|
2838 | Parses Indy response with information to verify receipt
|
2839 |
|
2840 | * `paymentMethod`: String - payment method to use
|
2841 | * `resp`: Json - response of the ledger for verify txn
|
2842 | * __->__ `txn`: Json - txn\_json: {
|
2843 | sources: \[<str>, \]
|
2844 | receipts: \[ {
|
2845 | recipient: <str>, \/\/ payment address of recipient
|
2846 | receipt: <str>, \/\/ receipt that can be used for payment referencing and verification
|
2847 | amount: <int>, \/\/ amount
|
2848 | } \],
|
2849 | extra: <str>, \/\/optional data
|
2850 | }
|
2851 |
|
2852 | #### getRequestInfo \( getAuthRuleResponse, requesterInfo, fees \) -> requestInfo
|
2853 |
|
2854 | Gets request requirements (with minimal price) correspondent to specific auth rule
|
2855 | in case the requester can perform this action.
|
2856 |
|
2857 | *EXPERIMENTAL*
|
2858 |
|
2859 | If the requester does not match to the request constraints `TransactionNotAllowed` error will be thrown.
|
2860 |
|
2861 | * `getAuthRuleResponse`: String - response on GET_AUTH_RULE request returning action constraints set on the ledger.
|
2862 | * `requesterInfo`: Json:
|
2863 | ```
|
2864 | {
|
2865 | "role": string (optional) - role of a user which can sign a transaction.
|
2866 | "sig_count": u64 - number of signers.
|
2867 | "is_owner": bool (optional) - if user is an owner of transaction (false by default).
|
2868 | "is_off_ledger_signature": bool (optional) - if user did is unknow for ledger (false by default).
|
2869 | }
|
2870 | ```
|
2871 | * `fees`: Json - fees set on the ledger (result of `parseGetTxnFeesResponse`).
|
2872 | * __->__ `requestInfo`: Json - request info if a requester match to the action constraints.
|
2873 | ```
|
2874 | {
|
2875 | "price": u64 - fee required for the action performing,
|
2876 | "requirements": [{
|
2877 | "role": string (optional) - role of users who should sign,
|
2878 | "sig_count": u64 - number of signers,
|
2879 | "need_to_be_owner": bool - if requester need to be owner,
|
2880 | "off_ledger_signature": bool - allow signature of unknow for ledger did (false by default).
|
2881 | }]
|
2882 | }
|
2883 | ```
|
2884 |
|
2885 | Errors: `Common*`, `Ledger*`
|
2886 |
|
2887 | #### signWithAddress \( wh, address, message \) -> signature
|
2888 |
|
2889 | Signs a message with a payment address.
|
2890 |
|
2891 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
2892 | * `address`: String - payment address of message signer. The key must be created by calling createPaymentAddress
|
2893 | * `message`: Buffer - a pointer to first byte of message to be signed
|
2894 | * __->__ `signature`: Buffer - a signature string
|
2895 |
|
2896 | Errors: `Common*`, `Wallet*`, `Payment*`
|
2897 |
|
2898 | #### verifyWithAddress \( address, message, signature \) -> valid
|
2899 |
|
2900 | Verify a signature with a payment address.
|
2901 |
|
2902 | * `address`: String - payment address of the message signer
|
2903 | * `message`: Buffer - a pointer to first byte of message that has been signed
|
2904 | * `signature`: Buffer - a pointer to first byte of signature to be verified
|
2905 | * __->__ `valid`: Boolean - valid: true - if signature is valid, false - otherwise
|
2906 |
|
2907 | Errors: `Common*`, `Wallet*`, `Payment*`
|
2908 |
|
2909 |
|
2910 | ### pool
|
2911 |
|
2912 | #### createPoolLedgerConfig \( configName, config \) -> void
|
2913 |
|
2914 | Creates a new local pool ledger configuration that can be used later to connect pool nodes.
|
2915 |
|
2916 | * `configName`: String - Name of the pool ledger configuration.
|
2917 | * `config`: Json? - Pool configuration json. if NULL, then default config will be used. Example:
|
2918 | ```
|
2919 | {
|
2920 | "genesis_txn": string (optional), A path to genesis transaction file. If NULL, then a default one will be used.
|
2921 | If file doesn't exists default one will be created.
|
2922 | }
|
2923 | ````
|
2924 | * __->__ void
|
2925 |
|
2926 | Errors: `Common*`, `Ledger*`
|
2927 |
|
2928 | #### openPoolLedger \( configName, config \) -> poolHandle
|
2929 |
|
2930 | Opens pool ledger and performs connecting to pool nodes.
|
2931 |
|
2932 | Pool ledger configuration with corresponded name must be previously created
|
2933 | with createPoolLedgerConfig method.
|
2934 | It is impossible to open pool with the same name more than once.
|
2935 |
|
2936 | config\_name: Name of the pool ledger configuration.
|
2937 | config \(optional\): Runtime pool configuration json.
|
2938 | if NULL, then default config will be used. Example:
|
2939 | ```
|
2940 | {
|
2941 | "timeout": int (optional), timeout for network request (in sec).
|
2942 | "extended_timeout": int (optional), extended timeout for network request (in sec).
|
2943 | "preordered_nodes": array<string> - (optional), names of nodes which will have a priority during request sending:
|
2944 | ["name_of_1st_prior_node", "name_of_2nd_prior_node", .... ]
|
2945 | This can be useful if a user prefers querying specific nodes.
|
2946 | Assume that `Node1` and `Node2` nodes reply faster.
|
2947 | If you pass them Libindy always sends a read request to these nodes first and only then (if not enough) to others.
|
2948 | Note: Nodes not specified will be placed randomly.
|
2949 | "number_read_nodes": int (optional) - the number of nodes to send read requests (2 by default)
|
2950 | By default Libindy sends a read requests to 2 nodes in the pool.
|
2951 | If response isn't received or `state proof` is invalid Libindy sends the request again but to 2 (`number_read_nodes`) * 2 = 4 nodes and so far until completion.
|
2952 | }
|
2953 | ````
|
2954 |
|
2955 | * `configName`: String
|
2956 | * `config`: Json
|
2957 | * __->__ `poolHandle`: Handle (Number) - Handle to opened pool to use in methods that require pool connection.
|
2958 |
|
2959 | Errors: `Common*`, `Ledger*`
|
2960 |
|
2961 | #### refreshPoolLedger \( handle \) -> void
|
2962 |
|
2963 | Refreshes a local copy of a pool ledger and updates pool nodes connections.
|
2964 |
|
2965 | * `handle`: Handle (Number) - pool handle returned by openPoolLedger
|
2966 | * __->__ void
|
2967 |
|
2968 | Errors: `Common*`, `Ledger*`
|
2969 |
|
2970 | #### listPools \( \) -> pools
|
2971 |
|
2972 | Lists names of created pool ledgers
|
2973 |
|
2974 | * __->__ `pools`: Json
|
2975 |
|
2976 |
|
2977 | #### closePoolLedger \( handle \) -> void
|
2978 |
|
2979 | Closes opened pool ledger, opened nodes connections and frees allocated resources.
|
2980 |
|
2981 | * `handle`: Handle (Number) - pool handle returned by openPoolLedger.
|
2982 | * __->__ void
|
2983 |
|
2984 | Errors: `Common*`, `Ledger*`
|
2985 |
|
2986 | #### deletePoolLedgerConfig \( configName \) -> void
|
2987 |
|
2988 | Deletes created pool ledger configuration.
|
2989 |
|
2990 | * `configName`: String - Name of the pool ledger configuration to delete.
|
2991 | * __->__ void
|
2992 |
|
2993 | Errors: `Common*`, `Ledger*`
|
2994 |
|
2995 | #### setProtocolVersion \( protocolVersion \) -> void
|
2996 |
|
2997 | Set PROTOCOL\_VERSION to specific version.
|
2998 |
|
2999 | There is a global property PROTOCOL\_VERSION that used in every request to the pool and
|
3000 | specified version of Indy Node which Libindy works.
|
3001 |
|
3002 | By default PROTOCOL\_VERSION=1.
|
3003 |
|
3004 | * `protocolVersion`: Number - Protocol version will be used:
|
3005 | 1 - for Indy Node 1.3
|
3006 | 2 - for Indy Node 1.4 and greater
|
3007 | * __->__ void
|
3008 |
|
3009 | Errors: `Common*`
|
3010 |
|
3011 | ### wallet
|
3012 |
|
3013 | #### createWallet \( config, credentials \) -> void
|
3014 |
|
3015 | Create a new secure wallet.
|
3016 |
|
3017 | * `config`: Json - Wallet configuration json.
|
3018 | ```
|
3019 | {
|
3020 | "id": string, Identifier of the wallet.
|
3021 | Configured storage uses this identifier to lookup exact wallet data placement.
|
3022 | "storage_type": optional<string>, Type of the wallet storage. Defaults to 'default'.
|
3023 | 'Default' storage type allows to store wallet data in the local file.
|
3024 | Custom storage types can be registered with indy_register_wallet_storage call.
|
3025 | "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
|
3026 | Can be optional if storage supports default configuration.
|
3027 | For 'default' storage type configuration is:
|
3028 | {
|
3029 | "path": optional<string>, Path to the directory with wallet files.
|
3030 | Defaults to $HOME/.indy_client/wallet.
|
3031 | Wallet will be stored in the file {path}/{id}/sqlite.db
|
3032 | }
|
3033 | }
|
3034 | ````
|
3035 | * `credentials`: Json - Wallet credentials json
|
3036 | ```
|
3037 | {
|
3038 | "key": string, Key or passphrase used for wallet key derivation.
|
3039 | Look to key_derivation_method param for information about supported key derivation methods.
|
3040 | "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
|
3041 | Can be optional if storage supports default configuration.
|
3042 | For 'default' storage type should be empty.
|
3043 | "key_derivation_method": optional<string> Algorithm to use for wallet key derivation:
|
3044 | ARGON2I_MOD - derive secured wallet master key (used by default)
|
3045 | ARGON2I_INT - derive secured wallet master key (less secured but faster)
|
3046 | RAW - raw wallet key master provided (skip derivation).
|
3047 | RAW keys can be generated with generateWalletKey call
|
3048 | }
|
3049 | ````
|
3050 | * __->__ void
|
3051 |
|
3052 | Errors: `Common*`, `Wallet*`
|
3053 |
|
3054 | #### openWallet \( config, credentials \) -> handle
|
3055 |
|
3056 | Open the wallet.
|
3057 |
|
3058 | Wallet must be previously created with createWallet method.
|
3059 |
|
3060 | * `config`: Json - Wallet configuration json.
|
3061 | ```
|
3062 | {
|
3063 | "id": string, Identifier of the wallet.
|
3064 | Configured storage uses this identifier to lookup exact wallet data placement.
|
3065 | "storage_type": optional<string>, Type of the wallet storage. Defaults to 'default'.
|
3066 | 'Default' storage type allows to store wallet data in the local file.
|
3067 | Custom storage types can be registered with indy_register_wallet_storage call.
|
3068 | "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
|
3069 | Can be optional if storage supports default configuration.
|
3070 | For 'default' storage type configuration is:
|
3071 | {
|
3072 | "path": optional<string>, Path to the directory with wallet files.
|
3073 | Defaults to $HOME/.indy_client/wallet.
|
3074 | Wallet will be stored in the file {path}/{id}/sqlite.db
|
3075 | }
|
3076 | }
|
3077 | ````
|
3078 | * `credentials`: Json - Wallet credentials json
|
3079 | ```
|
3080 | {
|
3081 | "key": string, Key or passphrase used for wallet key derivation.
|
3082 | Look to key_derivation_method param for information about supported key derivation methods.
|
3083 | "rekey": optional<string>, If present than wallet master key will be rotated to a new one.
|
3084 | "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
|
3085 | Can be optional if storage supports default configuration.
|
3086 | For 'default' storage type should be empty.
|
3087 | "key_derivation_method": optional<string> Algorithm to use for wallet key derivation:
|
3088 | ARGON2I_MOD - derive secured wallet master key (used by default)
|
3089 | ARGON2I_INT - derive secured wallet master key (less secured but faster)
|
3090 | RAW - raw wallet key master provided (skip derivation).
|
3091 | RAW keys can be generated with generateWalletKey call
|
3092 | "rekey_derivation_method": optional<string> Algorithm to use for wallet rekey derivation:
|
3093 | ARGON2I_MOD - derive secured wallet master rekey (used by default)
|
3094 | ARGON2I_INT - derive secured wallet master rekey (less secured but faster)
|
3095 | RAW - raw wallet rekey master provided (skip derivation).
|
3096 | RAW keys can be generated with generateWalletKey call
|
3097 | }
|
3098 | ````
|
3099 | * __->__ `handle`: Handle (Number) - err: Error code
|
3100 | handle: Handle to opened wallet to use in methods that require wallet access.
|
3101 |
|
3102 | Errors: `Common*`, `Wallet*`
|
3103 |
|
3104 | #### exportWallet \( wh, exportConfig \) -> void
|
3105 |
|
3106 | Exports opened wallet
|
3107 |
|
3108 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
3109 | * `exportConfig`: Json
|
3110 | * __->__ void
|
3111 |
|
3112 | Errors: `Common*`, `Wallet*`
|
3113 |
|
3114 | #### importWallet \( config, credentials, importConfig \) -> void
|
3115 |
|
3116 | Creates a new secure wallet and then imports its content
|
3117 | according to fields provided in import\_config
|
3118 | This can be seen as an createWallet call with additional content import
|
3119 |
|
3120 | * `config`: Json - Wallet configuration json.
|
3121 | ```
|
3122 | {
|
3123 | "id": string, Identifier of the wallet.
|
3124 | Configured storage uses this identifier to lookup exact wallet data placement.
|
3125 | "storage_type": optional<string>, Type of the wallet storage. Defaults to 'default'.
|
3126 | 'Default' storage type allows to store wallet data in the local file.
|
3127 | Custom storage types can be registered with indy_register_wallet_storage call.
|
3128 | "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
|
3129 | Can be optional if storage supports default configuration.
|
3130 | For 'default' storage type configuration is:
|
3131 | {
|
3132 | "path": optional<string>, Path to the directory with wallet files.
|
3133 | Defaults to $HOME/.indy_client/wallet.
|
3134 | Wallet will be stored in the file {path}/{id}/sqlite.db
|
3135 | }
|
3136 | }
|
3137 | ````
|
3138 | * `credentials`: Json - Wallet credentials json
|
3139 | ```
|
3140 | {
|
3141 | "key": string, Key or passphrase used for wallet key derivation.
|
3142 | Look to key_derivation_method param for information about supported key derivation methods.
|
3143 | "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
|
3144 | Can be optional if storage supports default configuration.
|
3145 | For 'default' storage type should be empty.
|
3146 | "key_derivation_method": optional<string> Algorithm to use for wallet key derivation:
|
3147 | ARGON2I_MOD - derive secured wallet master key (used by default)
|
3148 | ARGON2I_INT - derive secured wallet master key (less secured but faster)
|
3149 | RAW - raw wallet key master provided (skip derivation).
|
3150 | RAW keys can be generated with generateWalletKey call
|
3151 | }
|
3152 | ````
|
3153 | * `importConfig`: Json
|
3154 | * __->__ void
|
3155 |
|
3156 | Errors: `Common*`, `Wallet*`
|
3157 |
|
3158 | #### closeWallet \( wh \) -> void
|
3159 |
|
3160 | Closes opened wallet and frees allocated resources.
|
3161 |
|
3162 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
3163 | * __->__ void
|
3164 |
|
3165 | Errors: `Common*`, `Wallet*`
|
3166 |
|
3167 | #### deleteWallet \( config, credentials \) -> void
|
3168 |
|
3169 | Deletes created wallet.
|
3170 |
|
3171 | * `config`: Json - Wallet configuration json.
|
3172 | ```
|
3173 | {
|
3174 | "id": string, Identifier of the wallet.
|
3175 | Configured storage uses this identifier to lookup exact wallet data placement.
|
3176 | "storage_type": optional<string>, Type of the wallet storage. Defaults to 'default'.
|
3177 | 'Default' storage type allows to store wallet data in the local file.
|
3178 | Custom storage types can be registered with indy_register_wallet_storage call.
|
3179 | "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
|
3180 | Can be optional if storage supports default configuration.
|
3181 | For 'default' storage type configuration is:
|
3182 | {
|
3183 | "path": optional<string>, Path to the directory with wallet files.
|
3184 | Defaults to $HOME/.indy_client/wallet.
|
3185 | Wallet will be stored in the file {path}/{id}/sqlite.db
|
3186 | }
|
3187 | }
|
3188 | ````
|
3189 | * `credentials`: Json - Wallet credentials json
|
3190 | ```
|
3191 | {
|
3192 | "key": string, Key or passphrase used for wallet key derivation.
|
3193 | Look to key_derivation_method param for information about supported key derivation methods.
|
3194 | "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
|
3195 | Can be optional if storage supports default configuration.
|
3196 | For 'default' storage type should be empty.
|
3197 | "key_derivation_method": optional<string> Algorithm to use for wallet key derivation:
|
3198 | ARGON2I_MOD - derive secured wallet master key (used by default)
|
3199 | ARGON2I_INT - derive secured wallet master key (less secured but faster)
|
3200 | RAW - raw wallet key master provided (skip derivation).
|
3201 | RAW keys can be generated with generateWalletKey call
|
3202 | }
|
3203 | ````
|
3204 | * __->__ void
|
3205 |
|
3206 | Errors: `Common*`, `Wallet*`
|
3207 |
|
3208 | #### generateWalletKey \( config \) -> key
|
3209 |
|
3210 | Generate wallet master key.
|
3211 | Returned key is compatible with "RAW" key derivation method.
|
3212 | It allows to avoid expensive key derivation for use cases when wallet keys can be stored in a secure enclave.
|
3213 |
|
3214 | * `config`: Json - \(optional\) key configuration json.
|
3215 | ```
|
3216 | {
|
3217 | "seed": string, (optional) Seed that allows deterministic key creation (if not set random one will be created).
|
3218 | Can be UTF-8, base64 or hex string.
|
3219 | }
|
3220 | ````
|
3221 | * __->__ `key`: String - err: Error code
|
3222 |
|
3223 | Errors: `Common*`, `Wallet*`
|
3224 |
|
3225 |
|
3226 | ### logger
|
3227 |
|
3228 | WARNING: You can only set the logger **once**. Call `setLogger`, `setDefaultLogger`, not both. Once it's been set, libindy won't let you change it.
|
3229 |
|
3230 | #### setDefaultLogger \( pattern \)
|
3231 |
|
3232 | Calling this turns on the default logger and libindy will write logs to stdout.
|
3233 |
|
3234 | * `pattern`: String - pattern that corresponds with the log messages to show.
|
3235 |
|
3236 | Errors: `Common*`
|
3237 |
|
3238 | NOTE: This is a synchronous function (does not return a promise.)
|
3239 |
|
3240 | #### setLogger \( logFn \)
|
3241 |
|
3242 | Set a function to be called every time a log is emitted from libindy.
|
3243 |
|
3244 | * `logFn`: Function(Int level, String target, String message, String module_path, String file, Int line)
|
3245 |
|
3246 | Example:
|
3247 | ```js
|
3248 | indy.setLogger(function (level, target, message, modulePath, file, line) {
|
3249 | console.log('libindy said:', level, target, message, modulePath, file, line)
|
3250 | })
|
3251 | ```
|
3252 |
|
3253 | Errors: `Common*`
|
3254 |
|
3255 | NOTE: This is a synchronous function (does not return a promise) but may call `logFn` asynchronously many times.
|
3256 |
|
3257 | ### cache
|
3258 |
|
3259 | #### getSchema \( poolHandle, wh, submitterDid, id, options \) -> schema
|
3260 |
|
3261 | Get schema json data for specified schema id.
|
3262 | If data is present inside of cache, cached data is returned.
|
3263 | Otherwise data is fetched from the ledger and stored inside of cache for future use.
|
3264 |
|
3265 | EXPERIMENTAL
|
3266 |
|
3267 | * `poolHandle`:
|
3268 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
3269 | * `submitterDid`: String - DID of the read request sender.
|
3270 | * `id`: String - Schema ID in ledger
|
3271 | * `options`: Json
|
3272 | ```
|
3273 | {
|
3274 | noCache: (bool, optional, false by default) Skip usage of cache,
|
3275 | noUpdate: (bool, optional, false by default) Use only cached data, do not try to update.
|
3276 | noStore: (bool, optional, false by default) Skip storing fresh data if updated,
|
3277 | minFresh: (int, optional, -1 by default) Return cached data if not older than this many seconds. -1 means do not check age.
|
3278 | }
|
3279 |
|
3280 | ```
|
3281 | __->__ schema: Json
|
3282 | ```
|
3283 | {
|
3284 | id: identifier of schema
|
3285 | attrNames: array of attribute name strings
|
3286 | name: Schema's name string
|
3287 | version: Schema's version string
|
3288 | ver: Version of the Schema json
|
3289 | }
|
3290 | ```
|
3291 |
|
3292 | Errors: `Common*`, `Wallet*`, `Ledger*`
|
3293 |
|
3294 | #### getCredDef \( poolHandle, wh, submitterDid, id, options \) -> credDef
|
3295 |
|
3296 | EXPERIMENTAL
|
3297 |
|
3298 | Get credential definition json data for specified credential definition id.
|
3299 | If data is present inside of cache, cached data is returned.
|
3300 | Otherwise data is fetched from the ledger and stored inside of cache for future use.
|
3301 |
|
3302 | * `poolHandle`:
|
3303 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
3304 | * `submitterDid`: String - DID of the read request sender.
|
3305 | * `id`: String - Credential Definition ID in ledger.
|
3306 | * `options`: Json
|
3307 | ```
|
3308 | {
|
3309 | noCache: (bool, optional, false by default) Skip usage of cache,
|
3310 | noUpdate: (bool, optional, false by default) Use only cached data, do not try to update.
|
3311 | noStore: (bool, optional, false by default) Skip storing fresh data if updated,
|
3312 | minFresh: (int, optional, -1 by default) Return cached data if not older than this many seconds. -1 means do not check age.
|
3313 | }
|
3314 |
|
3315 | ```
|
3316 | __->__ credDef: Json
|
3317 | ```
|
3318 | {
|
3319 | id: string - identifier of credential definition
|
3320 | schemaId: string - identifier of stored in ledger schema
|
3321 | type: string - type of the credential definition. CL is the only supported type now.
|
3322 | tag: string - allows to distinct between credential definitions for the same issuer and schema
|
3323 | value: Dictionary with Credential Definition's data: {
|
3324 | primary: primary credential public key,
|
3325 | Optional<revocation>: revocation credential public key
|
3326 | },
|
3327 | ver: Version of the Credential Definition json
|
3328 | }
|
3329 | ```
|
3330 |
|
3331 | Errors: `Common*`, `Wallet*`, `Ledger*`
|
3332 |
|
3333 | #### purgeSchemaCache \( wh, options \) -> void
|
3334 |
|
3335 | Purge schema cache.
|
3336 |
|
3337 | EXPERIMENTAL
|
3338 |
|
3339 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
3340 | * `options`: Json
|
3341 | ```
|
3342 | {
|
3343 | maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all.
|
3344 | }
|
3345 | ```
|
3346 | * __->__ void
|
3347 |
|
3348 | Errors: `Common*`, `Wallet*`
|
3349 |
|
3350 | #### purgeCredDefCache \( wh, options \) -> void
|
3351 |
|
3352 | Purge credential definition cache.
|
3353 |
|
3354 | EXPERIMENTAL
|
3355 |
|
3356 | * `wh`: Handle (Number) - wallet handle (created by openWallet)
|
3357 | * `options`: Json
|
3358 | ```
|
3359 | {
|
3360 | maxAge: (int, optional, -1 by default) Purge cached data if older than this many seconds. -1 means purge all.
|
3361 | }
|
3362 | ```
|
3363 | * __->__ void
|
3364 |
|
3365 | Errors: `Common*`, `Wallet*`
|
3366 |
|
3367 | ### mod
|
3368 |
|
3369 | #### setRuntimeConfig \( config \)
|
3370 |
|
3371 | Set libindy runtime configuration. Can be optionally called to change current params.
|
3372 |
|
3373 | * `config`: Json
|
3374 | ```
|
3375 | {
|
3376 | "crypto_thread_pool_size": Optional<int> - size of thread pool for the most expensive crypto operations. (4 by default)
|
3377 | "collect_backtrace": Optional<bool> - whether errors backtrace should be collected.
|
3378 | Capturing of backtrace can affect library performance.
|
3379 | NOTE: must be set before invocation of any other API functions.
|
3380 | }
|
3381 | ```
|
3382 |
|
3383 | Errors: `Common*`
|
3384 |
|
3385 | NOTE: This is a synchronous function (does not return a promise.)
|
3386 |
|
3387 | ## Advanced
|
3388 |
|
3389 | If you need to get closer to the metal, you can access the node bindings directly.
|
3390 |
|
3391 | * The function names and parameters are the same.
|
3392 | * It will not json stringify or parse for you.
|
3393 | * Only callbacks.
|
3394 | * Errors are plain numbers for indy error codes.
|
3395 |
|
3396 | ```js
|
3397 | var indy = require('indy-sdk')
|
3398 |
|
3399 | indy.capi.abbreviateVerkey(did, fullVerkey, function(err, verkey){
|
3400 | // err will be 0 on success, and a code number on failure
|
3401 | // verkey will be the result string on success
|
3402 | })
|
3403 | ```
|
3404 |
|
3405 | ## Contributing
|
3406 |
|
3407 | [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
|
3408 |
|
3409 | Setup an Indy SDK environment, and start a local pool.
|
3410 |
|
3411 | * [ubuntu](https://github.com/hyperledger/indy-sdk/blob/master/docs/ubuntu-build.md)
|
3412 | * [osx](https://github.com/hyperledger/indy-sdk/blob/master/docs/mac-build.md)
|
3413 | * [windows](https://github.com/hyperledger/indy-sdk/blob/master/docs/windows-build.md)
|
3414 |
|
3415 | ```sh
|
3416 | # You will need libindy in your system library path. (i.e. /usr/lib/libindy.so for linux)
|
3417 | # or in this directory (i.e. wrappers/nodejs/libindy.so)
|
3418 |
|
3419 | # Install dependencies and do the initial build.
|
3420 | npm install
|
3421 |
|
3422 | # Run the tests
|
3423 | TEST_POOL_IP=10.0.0.2 npm test
|
3424 |
|
3425 | # If you built with libindy locally (i.e. wrappers/nodejs/libindy.so) you need to set LD_LIBRARY_PATH
|
3426 | LD_LIBRARY_PATH=./ TEST_POOL_IP=10.0.0.2 npm test
|
3427 |
|
3428 | # To recompile the native bindings
|
3429 | npm run rebuild
|
3430 | ```
|