Skip to content

Commit 9d54193

Browse files
committed
Merge branch 'release/v2.18.0'
2 parents f1d9707 + 6b9a6c4 commit 9d54193

31 files changed

Lines changed: 1522 additions & 821 deletions

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
// note you must disable the base rule as it can report incorrect errors
1919
'@typescript-eslint/indent': ['error', 2],
2020
'@typescript-eslint/explicit-function-return-type': ['off'],
21+
'@typescript-eslint/member-ordering': ['error'],
2122
'@typescript-eslint/no-explicit-any': ['off'],
2223
'@typescript-eslint/no-unused-expressions': ['off'],
2324
'chai-friendly/no-unused-expressions': ['error'],
@@ -26,6 +27,6 @@ module.exports = {
2627
// exclude cycle dependencies
2728
'import/no-cycle': ['off'],
2829
'no-await-in-loop': ['off'],
29-
'no-restricted-syntax': ['off']
30+
'no-restricted-syntax': ['off'],
3031
},
3132
};

VERSIONS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@
88
### Deprecations
99

1010

11+
## Version 2.18.0
12+
### Features
13+
- add methods `deactivateDidDocument` and `didIsDeactivated` to check and handle DID deactivation status
14+
- improve performance of `shareProperties`, `unshareProperties`, `setContainerShareConfigs` and related operations in `Container`
15+
- add methods `deactivateDidDocument` and `didIsDeactivated` to check and handle DID deactivation status
16+
- added additional properties `updated`, `created`, and `proof` to DID documents
17+
- added proof validation to `getDidDocument` (only for documents that actually contain a proof)
18+
- export `config` and `runtimeConfig` by `createDefaultRuntime`
19+
- introduced interfaces for did documents `getDidDocument`, `setDidDocument`, and `setDidDocumentOffline`
20+
21+
### Fixes
22+
- fix `credentialStatus.id` uses short hand path for resolver links
23+
- add check for `getRevokeVcStatus` to throw error when non existing VC is passed
24+
- fix `ipfsLib` now uses the configured port
25+
- fix `getListEntries` in the api docs
26+
- fix buffer-to-string conversion, try to decode to `utf8`, if this fails, decode it to `binary`
27+
- add `member-ordering` rule to eslint config
28+
- fix `container.getListEntry` to not throw an exception on call anymore
29+
- replaced deprecated property `owner` in DID publicKey fields with `controller`
30+
- fix pending contract members after unshare
31+
- update verification keys for onboarding, when `useIdentity` is enabled
32+
- reset `activeIdentity` within `createOfflineProfile` when useIdentity is enabled
33+
34+
1135
## Version 2.17.0
1236
### Features
1337
- add support for identity based accounts to `KeyExchange`, `Sharing` and `Profile` modules

docs/contracts/container.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +722,10 @@ getListEntries
722722

723723
.. code-block:: typescript
724724
725-
container.getListEntries(contract, listName, accountId[, dfsStorage, encryptedHashes, count, offset, reverse]);
725+
container.getListEntries(listName, count, offset, reverse);
726726
727727
Return list entries from contract.
728-
Note, that in the current implementation, this function retrieves the entries one at a time and may take a longer time when querying large lists, so be aware of that, when you retrieve lists with many entries.
728+
Note, that in the current implementation, this function retrieves the entries one at a time and may take a longer time when querying large lists, so be aware of that, when you retrieve lists with many entries. Keep in mind if only the listName is passed it will not retrieve the entire list instead only the first 10 elements in the list.
729729

730730
----------
731731
Parameters
@@ -753,21 +753,27 @@ Example
753753
// Output:
754754
// 0
755755
756-
const sampleValue = {
757-
foo: 'sample',
758-
bar: 123,
759-
};
756+
const sampleValue = [ 'Hello', 'welcome', 'to', 'evan', 'network' ];
760757
await container.addListEntries(listName, [sampleValue]);
761758
console.log(await container.getListEntryCount(listName));
762759
// Output:
763-
// 1
760+
// 5
764761
765762
console.dir(await container.getListEntries(listName));
766763
// Output:
767-
// [{
768-
// foo: 'sample',
769-
// bar: 123,
770-
// }]
764+
// [ 'Hello', 'welcome', 'to', 'evan', 'network' ]
765+
766+
console.log(await container.getListEntries(listName, 2));
767+
//Output:
768+
// [ 'Hello', 'welcome' ]
769+
770+
console.log(await container.getListEntries(listName, 10, 2));
771+
//Output
772+
// [ 'to', 'evan', 'network' ]
773+
774+
console.log(await container.getListEntries('testList', 10, 0, true));
775+
//Output:
776+
// [ 'network', 'evan', 'to', 'welcome', 'Hello' ]
771777
772778
773779

docs/contracts/sharing.rst

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Sharing
1515
* - Examples
1616
- `sharing.spec.ts <https://github.com/evannetwork/api-blockchain-core/tree/master/src/contracts/sharing.spec.ts>`_
1717

18+
.. _Sharing_example:
19+
20+
1821
For getting a better understanding about how Sharings and Multikeys work, have a look at `Security <https://evannetwork.github.io/docs/developers/concepts/sharings.html>`_ in the evan.network wiki.
1922

2023
Following is a sample for a sharing info with these properties:
@@ -36,12 +39,17 @@ Following is a sample for a sharing info with these properties:
3639
* ``secret area`` - available for all members
3740
* ``super secret area`` - available for ``0x03``
3841

42+
Keep in mind, that an actual sharings object only stores the sha3-hashes of every property. For example, sharings for the user `0x01` were actually to be found
43+
at the property `"0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2"`.
44+
For the sake of understanding, the following sample uses clear text properties. For an example of an actual sharings object, please refer to the :ref:`getSharings <sharing_getSharings>`
45+
example section.
46+
3947
.. code-block:: typescript
4048
4149
{
4250
"0x01": {
43-
"82745": {
44-
"*": {
51+
"*": {
52+
"82745": {
4553
"private": "secret for 0x01, starting from block 82745 for all data",
4654
"cryptoInfo": {
4755
"originator": "0x01,0x01",
@@ -50,16 +58,18 @@ Following is a sample for a sharing info with these properties:
5058
}
5159
}
5260
},
53-
"90000": {
54-
"secret area": {
61+
"secret area": {
62+
"90000": {
5563
"private": "secret for 0x01, starting from block 90000 for 'secret area'",
5664
"cryptoInfo": {
5765
"originator": "0x01,0x01",
5866
"keyLength": 256,
5967
"algorithm": "aes-256-cbc"
6068
}
61-
},
62-
"super secret area": {
69+
}
70+
},
71+
"super secret area": {
72+
"90000": {
6373
"private": "secret for 0x01, starting from block 90000 for 'super secret area'",
6474
"cryptoInfo": {
6575
"originator": "0x01,0x01",
@@ -70,8 +80,8 @@ Following is a sample for a sharing info with these properties:
7080
}
7181
},
7282
"0x02": {
73-
"82745": {
74-
"*": {
83+
"*": {
84+
"82745": {
7585
"private": "secret for 0x02, starting from block 82745 for all data",
7686
"cryptoInfo": {
7787
"originator": "0x01,0x02",
@@ -80,28 +90,30 @@ Following is a sample for a sharing info with these properties:
8090
}
8191
}
8292
},
83-
"90000": {
84-
"secret area": {
93+
"secret area": {
94+
"90000": {
8595
"private": "secret for 0x02, starting from block 90000 for 'secret area'",
8696
"cryptoInfo": {
8797
"originator": "0x01,0x02",
8898
"keyLength": 256,
8999
"algorithm": "aes-256-cbc"
90100
}
91-
},
92-
"super secret area": {
101+
}
102+
},
103+
"super secret area": {
104+
"90000": {
93105
"private": "secret for 0x02, starting from block 90000 for 'super secret area'",
94106
"cryptoInfo": {
95107
"originator": "0x01,0x02",
96108
"keyLength": 256,
97109
"algorithm": "aes-256-cbc"
98110
}
99111
}
100-
},
112+
}
101113
},
102114
"0x03": {
103-
"90000": {
104-
"secret area": {
115+
"secret area": {
116+
"90000": {
105117
"private": "secret for 0x03, starting from block 90000 for 'secret area'",
106118
"cryptoInfo": {
107119
"originator": "0x01,0x03",
@@ -121,7 +133,7 @@ There are two functions to share keys with another user:
121133

122134
- :ref:`extendSharing <sharing_extendSharing>` is used to edit a sharings configuration that has been pulled or "checked out" with :ref:`getSharingsFromContract <sharing_getSharingsFromContract>`. Hash keys have to be shared manually, if required. :ref:`extendSharing <sharing_extendSharing>` make no transaction, so the contract isn't updated - this has to be done with :ref:`saveSharingsToContract <sharing_saveSharingsToContract>`. See function documentation :ref:`below <sharing_extendSharing>` for an example with hash key and storing updates.
123135

124-
Be careful when performing multiple updates to sharings synchronously. As sharings are retrieved as a single file from a smart contract, updated and then saved back to it, doing two or more updates in parallel may overwrite each other and lead to unexpected and most probably undesired results.
136+
Be careful when performing multiple updates to sharings synchronously. As sharings are retrieved as a single file from a smart contract, updated and then saved back to it, doing two or more updates in parallel may overwrite each other and lead to unexpected and most probably undesired results.
125137

126138
Perform sharing updates for the same contracts **one after another**, this goes for :ref:`addSharing <sharing_addSharing>` **and** for :ref:`extendSharing <sharing_extendSharing>`. When wishing to speed things up, :ref:`extendSharing <sharing_extendSharing>` can be used, but its updates need to be performed synchronously as well. Keep in mind, that single updates will be made off-chain and therefore be performed much faster than multiple updates with :ref:`addSharing <sharing_addSharing>`.
127139

@@ -594,6 +606,8 @@ getSharings
594606
595607
Get sharing from a contract, if _partner, _section, _block matches.
596608
609+
Sharings can also be retrieved using ENS address.
610+
597611
----------
598612
Parameters
599613
----------
@@ -608,7 +622,7 @@ Parameters
608622
Returns
609623
-------
610624
611-
``Promise`` returns ``void``: resolved when done
625+
``Promise`` returns ``any``: sharings as an object. For more details, refer to the :ref:`example at the top of the page <Sharing_example>`.
612626
613627
-------
614628
Example
@@ -618,7 +632,22 @@ Example
618632
619633
const randomSecret = `super secret; ${Math.random()}`;
620634
await sharing.addSharing(testAddress, accounts[1], accounts[0], '*', 0, randomSecret);
621-
const sharings = await sharing.getSharings(testAddress);
635+
await sharing.addSharing(testAddress, accounts[1], accounts[0], 'test', 100, randomSecret);
636+
const sharings = await sharing.getSharings(contract.options.address, null, null, null, sharingId);
637+
/* Output:
638+
{
639+
'0x2260228fd705cd9420a07827b8e64e808daba1b6675c3956783cc09fcc56a327': { // sha3(contract owner)
640+
'0x04994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829': { hashKey: [Object] },
641+
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658': { '0': [Object] }, // sha3('test')
642+
'0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0': { '0': [Object] } // additional unshared field
643+
},
644+
'0xb45ce1cd2e464ce53a8102a5f855c112a2a384c36923fe5c6e249c2a9286369e': { // sha3(accounts[1])
645+
'0x04994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829': { hashKey: [Object] }, // '*'
646+
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658': { // sha3('test')
647+
'100': [Object] // Valid from block 100
648+
}
649+
}
650+
*/
622651
623652
624653
@@ -686,7 +715,9 @@ getSharingsFromContract
686715
687716
Get encrypted sharings from smart contract.
688717
689-
This can be used in combination with :ref:`getSharingsFromContract<sharing_saveSharingsToContract>` to bulk editing sharing info.
718+
The encrypted sharings are usually used in combination with other functions for purposes of adding, removing, extending sharings etc.
719+
For Example:
720+
This can be used in combination with :ref:`saveSharingsToContract<sharing_saveSharingsToContract>` to bulk editing sharing info.
690721
691722
----------
692723
Parameters
@@ -699,7 +730,7 @@ Parameters
699730
Returns
700731
-------
701732
702-
``Promise`` returns ``void``: resolved when done
733+
``Promise`` returns ``any``: sharings as an object
703734
704735
-------
705736
Example
@@ -709,6 +740,9 @@ Example
709740
710741
// get sharings (encrypted)
711742
const sharings = await sharing.getSharingsFromContract(serviceContract, callIdHash);
743+
// Output:
744+
{ '0x6760305476495b089868ae42c2293d5e8c1c7bf9bfe51a9ad85b36d85f4113cb':
745+
{ '0x04994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829': { hashKey: [Object] } }
712746
713747
// make changes to sharing
714748
await sharing.extendSharings(sharings, accountId, target, section, 0, contentKeyToShare, null);
@@ -851,4 +885,4 @@ Example
851885
.. _source logLogInterface: ../common/logger.html#logloginterface
852886
853887
.. |source nameResolver| replace:: ``NameResolver``
854-
.. _source nameResolver: ../blockchain/name-resolver.html
888+
.. _source nameResolver: ../blockchain/name-resolver.html

docs/dfs/ipfs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Parameters
332332
----------
333333

334334
#. ``hash`` - ``string``: ipfs hash (or bytes32 encoded) of the data
335-
#. ``returnBuffer`` - ``bool``: should the function return the plain buffer, defaults to ``false``
335+
#. ``returnBuffer`` - ``bool``: if true the method will return a raw buffer holding the data (default false)
336336

337337
-------
338338
Returns

0 commit comments

Comments
 (0)