@verii/verii-issuing 1.1.0-pre.1761568887 → 1.1.0-pre.1761696091

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verii/verii-issuing",
3
- "version": "1.1.0-pre.1761568887",
3
+ "version": "1.1.0-pre.1761696091",
4
4
  "description": "Verii Issuing Package",
5
5
  "repository": "https://github.com/LFDT-Verii/core",
6
6
  "main": "src/index.js",
@@ -18,23 +18,23 @@
18
18
  "author": "Andres Olave",
19
19
  "license": "Apache-2.0",
20
20
  "dependencies": {
21
- "@verii/blockchain-functions": "1.1.0-pre.1761568887",
22
- "@verii/common-functions": "1.1.0-pre.1761568887",
23
- "@verii/crypto": "1.1.0-pre.1761568887",
24
- "@verii/did-doc": "1.1.0-pre.1761568887",
25
- "@verii/jwt": "1.1.0-pre.1761568887",
26
- "@verii/metadata-registration": "1.1.0-pre.1761568887",
27
- "@verii/vc-checks": "1.1.0-pre.1761568887",
21
+ "@verii/blockchain-functions": "1.1.0-pre.1761696091",
22
+ "@verii/common-functions": "1.1.0-pre.1761696091",
23
+ "@verii/crypto": "1.1.0-pre.1761696091",
24
+ "@verii/did-doc": "1.1.0-pre.1761696091",
25
+ "@verii/jwt": "1.1.0-pre.1761696091",
26
+ "@verii/metadata-registration": "1.1.0-pre.1761696091",
27
+ "@verii/vc-checks": "1.1.0-pre.1761696091",
28
28
  "canonicalize": "2.1.0",
29
29
  "eth-url-parser": "1.0.4",
30
30
  "fast-shuffle": "6.1.1",
31
31
  "lodash": "^4.17.21"
32
32
  },
33
33
  "devDependencies": {
34
- "@verii/contract-permissions": "1.1.0-pre.1761568887",
35
- "@verii/http-client": "1.1.0-pre.1761568887",
36
- "@verii/test-regexes": "1.1.0-pre.1761568887",
37
- "@verii/tests-helpers": "1.1.0-pre.1761568887",
34
+ "@verii/contract-permissions": "1.1.0-pre.1761696091",
35
+ "@verii/http-client": "1.1.0-pre.1761696091",
36
+ "@verii/test-regexes": "1.1.0-pre.1761696091",
37
+ "@verii/tests-helpers": "1.1.0-pre.1761696091",
38
38
  "eslint": "8.57.1",
39
39
  "eslint-config-airbnb-base": "14.2.1",
40
40
  "eslint-config-prettier": "8.10.2",
@@ -56,5 +56,5 @@
56
56
  "lib"
57
57
  ]
58
58
  },
59
- "gitHead": "6dc96130d21ad629626e8ef1881dee3c3bb1b477"
59
+ "gitHead": "8e55493e4463ffb7d788e5315fb3a77c90e82930"
60
60
  }
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- const { filter, flow, map } = require('lodash/fp');
17
+ const { map } = require('lodash/fp');
18
18
  const { allocateListEntries } = require('./allocate-list-entries');
19
19
  const {
20
20
  initCredentialMetadataContract,
@@ -80,6 +80,14 @@ const signVeriiCredentials = async (
80
80
  METADATA_LIST_SIZE,
81
81
  context
82
82
  );
83
+ const newMetadataListEntry = getNewListEntry(metadataEntries);
84
+ if (newMetadataListEntry != null) {
85
+ const { createList } = await initCredentialMetadataContract(
86
+ issuer,
87
+ context
88
+ );
89
+ await createList(newMetadataListEntry.listId);
90
+ }
83
91
 
84
92
  // pre-allocate list entries using internal tables/collections
85
93
  const revocationListEntries = await allocateListEntries(
@@ -89,13 +97,10 @@ const signVeriiCredentials = async (
89
97
  REVOCATION_LIST_SIZE,
90
98
  context
91
99
  );
92
-
93
- await Promise.all(
94
- flow(
95
- filter({ isNewList: true }),
96
- map((entry) => createRevocationList(entry.listId, issuer, context))
97
- )(revocationListEntries)
98
- );
100
+ const newRevocationListEntry = getNewListEntry(revocationListEntries);
101
+ if (newRevocationListEntry != null) {
102
+ await createRevocationList(newRevocationListEntry.listId, issuer, context);
103
+ }
99
104
 
100
105
  return prepareJwtVcs(
101
106
  offers,
@@ -115,23 +120,19 @@ const signVeriiCredentials = async (
115
120
  * @param {Context} context the context
116
121
  */
117
122
  const anchorVeriiCredentials = async (credentialMetadatas, issuer, context) => {
118
- const { addEntry, createList } = await initCredentialMetadataContract(
119
- issuer,
120
- context
121
- );
122
-
123
- // create any necessary metadata lists on dlt
124
- await Promise.all(
125
- flow(
126
- filter({ isNewList: true }),
127
- map(({ listId }) => createList(listId, issuer, context))
128
- )(credentialMetadatas)
129
- );
123
+ const { addEntry } = await initCredentialMetadataContract(issuer, context);
130
124
 
131
125
  // create credential metadata entries on dlt
132
126
  await Promise.all(map((metadata) => addEntry(metadata), credentialMetadatas));
133
127
  };
134
128
 
129
+ /**
130
+ * Gets the new list entry. Since the number of entries per list is 10k then only one will ever be returned
131
+ * @param {AllocationListEntry[]} entries the entries
132
+ * @returns {AllocationListEntry | undefined} returns the new list entry if it exists, otherwise undefined
133
+ */
134
+ const getNewListEntry = (entries) => entries?.find((entry) => entry.isNewList);
135
+
135
136
  module.exports = {
136
137
  anchorVeriiCredentials,
137
138
  issueVeriiCredentials,