@verii/verii-issuing 1.0.0-pre.1754562801 → 1.0.0-pre.1754861809
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 +13 -13
- package/src/issue-verii-credentials.js +58 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/verii-issuing",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.1754861809",
|
|
4
4
|
"description": "Verii Issuing Package",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"author": "Andres Olave",
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@verii/blockchain-functions": "1.0.0-pre.
|
|
20
|
-
"@verii/common-functions": "1.0.0-pre.
|
|
21
|
-
"@verii/crypto": "1.0.0-pre.
|
|
22
|
-
"@verii/did-doc": "1.0.0-pre.
|
|
23
|
-
"@verii/jwt": "1.0.0-pre.
|
|
24
|
-
"@verii/metadata-registration": "1.0.0-pre.
|
|
25
|
-
"@verii/vc-checks": "1.0.0-pre.
|
|
19
|
+
"@verii/blockchain-functions": "1.0.0-pre.1754861809",
|
|
20
|
+
"@verii/common-functions": "1.0.0-pre.1754861809",
|
|
21
|
+
"@verii/crypto": "1.0.0-pre.1754861809",
|
|
22
|
+
"@verii/did-doc": "1.0.0-pre.1754861809",
|
|
23
|
+
"@verii/jwt": "1.0.0-pre.1754861809",
|
|
24
|
+
"@verii/metadata-registration": "1.0.0-pre.1754861809",
|
|
25
|
+
"@verii/vc-checks": "1.0.0-pre.1754861809",
|
|
26
26
|
"canonicalize": "2.1.0",
|
|
27
27
|
"eth-url-parser": "1.0.4",
|
|
28
28
|
"fast-shuffle": "6.1.1",
|
|
29
29
|
"lodash": "^4.17.21"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@verii/contract-permissions": "1.0.0-pre.
|
|
33
|
-
"@verii/request": "1.0.0-pre.
|
|
34
|
-
"@verii/test-regexes": "1.0.0-pre.
|
|
35
|
-
"@verii/tests-helpers": "1.0.0-pre.
|
|
32
|
+
"@verii/contract-permissions": "1.0.0-pre.1754861809",
|
|
33
|
+
"@verii/request": "1.0.0-pre.1754861809",
|
|
34
|
+
"@verii/test-regexes": "1.0.0-pre.1754861809",
|
|
35
|
+
"@verii/tests-helpers": "1.0.0-pre.1754861809",
|
|
36
36
|
"eslint": "8.57.1",
|
|
37
37
|
"eslint-config-airbnb-base": "14.2.1",
|
|
38
38
|
"eslint-config-prettier": "8.10.2",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"lib"
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ebaffffc5a66200d47536eece3ebd4bd29b85a1e"
|
|
58
58
|
}
|
|
@@ -30,16 +30,16 @@ const METADATA_LIST_SIZE = 10000;
|
|
|
30
30
|
/** @import { Issuer, AllocationListEntry, CredentialOffer, CredentialMetadata, CredentialTypeMetadata, Context } from "../types/types" */
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* including @context, type, contentHash
|
|
33
|
+
* Prepares verifiable credentials from local offers without anchoring them to the blockchain.
|
|
34
|
+
* Current assumption is that offers contain all required fields including @context, type, contentHash
|
|
35
35
|
* @param {CredentialOffer[]} offers array of offers
|
|
36
36
|
* @param {string} credentialSubjectId optional field if credential subject needs to be bound into the offer
|
|
37
37
|
* @param {{[Name: string]: CredentialTypeMetadata}} credentialTypesMap the credential types metadata
|
|
38
38
|
* @param {Issuer} issuer the issuer
|
|
39
39
|
* @param {Context} context the context
|
|
40
|
-
* @returns {Promise<
|
|
40
|
+
* @returns {Promise<{vcs: object[], revocationListEntries: object[]}>} Returns prepared credentials and revocation list entries
|
|
41
41
|
*/
|
|
42
|
-
const
|
|
42
|
+
const prepareVeriiVerifiableCredentials = async (
|
|
43
43
|
offers,
|
|
44
44
|
credentialSubjectId,
|
|
45
45
|
credentialTypesMap,
|
|
@@ -74,6 +74,23 @@ const issueVeriiCredentials = async (
|
|
|
74
74
|
context
|
|
75
75
|
);
|
|
76
76
|
|
|
77
|
+
return { vcs, revocationListEntries };
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Anchors prepared verifiable credentials to the blockchain.
|
|
82
|
+
* @param {object[]} vcs array of verifiable credentials
|
|
83
|
+
* @param {object[]} revocationListEntries array of revocation list entries
|
|
84
|
+
* @param {Issuer} issuer the issuer
|
|
85
|
+
* @param {Context} context the context
|
|
86
|
+
* @returns {Promise<string[]>} Returns signed credentials for each offer in vc-jwt format
|
|
87
|
+
*/
|
|
88
|
+
const anchorVeriiVerifiableCredentials = async (
|
|
89
|
+
vcs,
|
|
90
|
+
revocationListEntries,
|
|
91
|
+
issuer,
|
|
92
|
+
context
|
|
93
|
+
) => {
|
|
77
94
|
// create any necessary revocation lists on dlt
|
|
78
95
|
await Promise.all(
|
|
79
96
|
flow(
|
|
@@ -101,4 +118,40 @@ const issueVeriiCredentials = async (
|
|
|
101
118
|
return map('vcJwt', vcs);
|
|
102
119
|
};
|
|
103
120
|
|
|
104
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Creates verifiable credential from a local offer. Current assumption is that offers contain all required fields
|
|
123
|
+
* including @context, type, contentHash
|
|
124
|
+
* @param {CredentialOffer[]} offers array of offers
|
|
125
|
+
* @param {string} credentialSubjectId optional field if credential subject needs to be bound into the offer
|
|
126
|
+
* @param {{[Name: string]: CredentialTypeMetadata}} credentialTypesMap the credential types metadata
|
|
127
|
+
* @param {Issuer} issuer the issuer
|
|
128
|
+
* @param {Context} context the context
|
|
129
|
+
* @returns {Promise<string[]>} Returns signed credentials for each offer in vc-jwt format
|
|
130
|
+
*/
|
|
131
|
+
const issueVeriiCredentials = async (
|
|
132
|
+
offers,
|
|
133
|
+
credentialSubjectId,
|
|
134
|
+
credentialTypesMap,
|
|
135
|
+
issuer,
|
|
136
|
+
context
|
|
137
|
+
) => {
|
|
138
|
+
const { vcs, revocationListEntries } =
|
|
139
|
+
await prepareVeriiVerifiableCredentials(
|
|
140
|
+
offers,
|
|
141
|
+
credentialSubjectId,
|
|
142
|
+
credentialTypesMap,
|
|
143
|
+
issuer,
|
|
144
|
+
context
|
|
145
|
+
);
|
|
146
|
+
return anchorVeriiVerifiableCredentials(
|
|
147
|
+
vcs,
|
|
148
|
+
revocationListEntries,
|
|
149
|
+
issuer,
|
|
150
|
+
context
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
module.exports = {
|
|
154
|
+
anchorVeriiVerifiableCredentials,
|
|
155
|
+
issueVeriiCredentials,
|
|
156
|
+
prepareVeriiVerifiableCredentials,
|
|
157
|
+
};
|