@sphereon/ssi-sdk.vc-status-list 0.32.1-feature.IATAB2B.52.190 → 0.32.1-feature.MWALL.715.120
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/dist/functions.d.ts +13 -13
- package/dist/functions.d.ts.map +1 -1
- package/dist/functions.js +109 -53
- package/dist/functions.js.map +1 -1
- package/dist/types/index.d.ts +33 -123
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -12
- package/dist/types/index.js.map +1 -1
- package/package.json +5 -16
- package/src/functions.ts +159 -73
- package/src/types/index.ts +37 -142
- package/dist/impl/IStatusList.d.ts +0 -26
- package/dist/impl/IStatusList.d.ts.map +0 -1
- package/dist/impl/IStatusList.js +0 -3
- package/dist/impl/IStatusList.js.map +0 -1
- package/dist/impl/OAuthStatusList.d.ts +0 -21
- package/dist/impl/OAuthStatusList.d.ts.map +0 -1
- package/dist/impl/OAuthStatusList.js +0 -153
- package/dist/impl/OAuthStatusList.js.map +0 -1
- package/dist/impl/StatusList2021.d.ts +0 -16
- package/dist/impl/StatusList2021.d.ts.map +0 -1
- package/dist/impl/StatusList2021.js +0 -182
- package/dist/impl/StatusList2021.js.map +0 -1
- package/dist/impl/StatusListFactory.d.ts +0 -11
- package/dist/impl/StatusListFactory.d.ts.map +0 -1
- package/dist/impl/StatusListFactory.js +0 -32
- package/dist/impl/StatusListFactory.js.map +0 -1
- package/dist/impl/encoding/cbor.d.ts +0 -6
- package/dist/impl/encoding/cbor.d.ts.map +0 -1
- package/dist/impl/encoding/cbor.js +0 -140
- package/dist/impl/encoding/cbor.js.map +0 -1
- package/dist/impl/encoding/common.d.ts +0 -12
- package/dist/impl/encoding/common.d.ts.map +0 -1
- package/dist/impl/encoding/common.js +0 -26
- package/dist/impl/encoding/common.js.map +0 -1
- package/dist/impl/encoding/jwt.d.ts +0 -9
- package/dist/impl/encoding/jwt.d.ts.map +0 -1
- package/dist/impl/encoding/jwt.js +0 -74
- package/dist/impl/encoding/jwt.js.map +0 -1
- package/dist/utils.d.ts +0 -17
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -88
- package/dist/utils.js.map +0 -1
- package/src/impl/IStatusList.ts +0 -42
- package/src/impl/OAuthStatusList.ts +0 -204
- package/src/impl/StatusList2021.ts +0 -236
- package/src/impl/StatusListFactory.ts +0 -34
- package/src/impl/encoding/cbor.ts +0 -171
- package/src/impl/encoding/common.ts +0 -25
- package/src/impl/encoding/jwt.ts +0 -80
- package/src/utils.ts +0 -95
package/dist/functions.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import {
|
|
2
|
+
import { OriginalVerifiableCredential, StatusListDriverType, StatusListType, StatusPurpose2021 } from '@sphereon/ssi-types';
|
|
3
3
|
import { IAgentContext, ICredentialPlugin } from '@veramo/core';
|
|
4
4
|
import { StatusMethod } from 'credential-status';
|
|
5
|
-
import { CreateNewStatusListFuncArgs,
|
|
5
|
+
import { CreateNewStatusListFuncArgs, StatusList2021ToVerifiableCredentialArgs, StatusListDetails, StatusListResult, UpdateStatusListFromEncodedListArgs, UpdateStatusListFromStatusListCredentialArgs } from './types';
|
|
6
6
|
export declare function fetchStatusListCredential(args: {
|
|
7
7
|
statusListCredential: string;
|
|
8
|
-
}): Promise<
|
|
8
|
+
}): Promise<OriginalVerifiableCredential>;
|
|
9
9
|
export declare function statusPluginStatusFunction(args: {
|
|
10
10
|
documentLoader: any;
|
|
11
11
|
suite: any;
|
|
@@ -24,7 +24,7 @@ export declare function vcLibCheckStatusFunction(args: {
|
|
|
24
24
|
verifyMatchingIssuers?: boolean;
|
|
25
25
|
errorUnknownListType?: boolean;
|
|
26
26
|
}): (args: {
|
|
27
|
-
credential:
|
|
27
|
+
credential: OriginalVerifiableCredential;
|
|
28
28
|
documentLoader: any;
|
|
29
29
|
suite: any;
|
|
30
30
|
}) => Promise<{
|
|
@@ -32,7 +32,7 @@ export declare function vcLibCheckStatusFunction(args: {
|
|
|
32
32
|
error?: any;
|
|
33
33
|
}>;
|
|
34
34
|
export declare function checkStatusForCredential(args: {
|
|
35
|
-
credential:
|
|
35
|
+
credential: OriginalVerifiableCredential;
|
|
36
36
|
documentLoader: any;
|
|
37
37
|
suite: any;
|
|
38
38
|
mandatoryCredentialStatus?: boolean;
|
|
@@ -49,21 +49,21 @@ export declare function simpleCheckStatusFromStatusListUrl(args: {
|
|
|
49
49
|
type?: StatusListType | 'StatusList2021Entry';
|
|
50
50
|
id?: string;
|
|
51
51
|
statusListIndex: string;
|
|
52
|
-
}): Promise<
|
|
52
|
+
}): Promise<boolean>;
|
|
53
53
|
export declare function checkStatusIndexFromStatusListCredential(args: {
|
|
54
|
-
statusListCredential:
|
|
54
|
+
statusListCredential: OriginalVerifiableCredential;
|
|
55
55
|
statusPurpose?: StatusPurpose2021;
|
|
56
56
|
type?: StatusListType | 'StatusList2021Entry';
|
|
57
57
|
id?: string;
|
|
58
58
|
statusListIndex: string | number;
|
|
59
|
-
}): Promise<
|
|
59
|
+
}): Promise<boolean>;
|
|
60
60
|
export declare function createNewStatusList(args: CreateNewStatusListFuncArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
61
|
-
export declare function updateStatusIndexFromStatusListCredential(args:
|
|
61
|
+
export declare function updateStatusIndexFromStatusListCredential(args: UpdateStatusListFromStatusListCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListDetails>;
|
|
62
62
|
export declare function statusListCredentialToDetails(args: {
|
|
63
|
-
statusListCredential:
|
|
63
|
+
statusListCredential: OriginalVerifiableCredential;
|
|
64
64
|
correlationId?: string;
|
|
65
65
|
driverType?: StatusListDriverType;
|
|
66
|
-
}): Promise<
|
|
67
|
-
export declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<
|
|
68
|
-
export declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<
|
|
66
|
+
}): Promise<StatusListDetails>;
|
|
67
|
+
export declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListDetails>;
|
|
68
|
+
export declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<OriginalVerifiableCredential>;
|
|
69
69
|
//# sourceMappingURL=functions.d.ts.map
|
package/dist/functions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAIL,
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAIL,4BAA4B,EAC5B,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAiC,aAAa,EAAE,iBAAiB,EAAe,MAAM,cAAc,CAAA;AAC3G,OAAO,EAAuB,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EACL,2BAA2B,EAC3B,wCAAwC,EACxC,iBAAiB,EACjB,gBAAgB,EAChB,mCAAmC,EACnC,4CAA4C,EAC7C,MAAM,SAAS,CAAA;AAEhB,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAiB7H;AAED,wBAAgB,0BAA0B,CAAC,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@@ exports.updateStatusListIndexFromEncodedList = updateStatusListIndexFromEncodedL
|
|
|
22
22
|
exports.statusList2021ToVerifiableCredential = statusList2021ToVerifiableCredential;
|
|
23
23
|
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
24
24
|
const vc_status_list_1 = require("@sphereon/vc-status-list");
|
|
25
|
-
const utils_1 = require("./utils");
|
|
26
|
-
const StatusListFactory_1 = require("./impl/StatusListFactory");
|
|
27
25
|
function fetchStatusListCredential(args) {
|
|
28
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const url =
|
|
27
|
+
const url = getAssertedValue('statusListCredential', args.statusListCredential);
|
|
30
28
|
try {
|
|
31
29
|
const response = yield fetch(url);
|
|
32
30
|
if (!response.ok) {
|
|
33
|
-
|
|
31
|
+
const error = `Fetching status list ${url} resulted in an error: ${response.status} : ${response.statusText}`;
|
|
32
|
+
throw Error(error);
|
|
34
33
|
}
|
|
35
34
|
const responseAsText = yield response.text();
|
|
36
35
|
if (responseAsText.trim().startsWith('{')) {
|
|
@@ -39,7 +38,7 @@ function fetchStatusListCredential(args) {
|
|
|
39
38
|
return responseAsText;
|
|
40
39
|
}
|
|
41
40
|
catch (error) {
|
|
42
|
-
console.
|
|
41
|
+
console.log(`Fetching status list ${url} resulted in an unexpected error: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
|
|
43
42
|
throw error;
|
|
44
43
|
}
|
|
45
44
|
});
|
|
@@ -100,80 +99,118 @@ function simpleCheckStatusFromStatusListUrl(args) {
|
|
|
100
99
|
}
|
|
101
100
|
function checkStatusIndexFromStatusListCredential(args) {
|
|
102
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
102
|
+
var _a;
|
|
103
|
+
const requestedType = getAssertedStatusListType((_a = args.type) === null || _a === void 0 ? void 0 : _a.replace('Entry', ''));
|
|
104
|
+
const uniform = ssi_types_1.CredentialMapper.toUniformCredential(args.statusListCredential);
|
|
105
|
+
const { issuer, type, credentialSubject, id } = uniform;
|
|
106
|
+
getAssertedValue('issuer', issuer); // We are only checking the value here
|
|
107
|
+
getAssertedValue('credentialSubject', credentialSubject);
|
|
108
|
+
if (args.statusPurpose && 'statusPurpose' in credentialSubject) {
|
|
109
|
+
if (args.statusPurpose !== credentialSubject.statusPurpose) {
|
|
110
|
+
throw Error(`Status purpose in StatusList credential with id ${id} and value ${credentialSubject.statusPurpose} does not match supplied purpose: ${args.statusPurpose}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (args.id && args.id !== id) {
|
|
114
|
+
throw Error(`Status list id ${id} did not match required supplied id: ${args.id}`);
|
|
115
|
+
}
|
|
116
|
+
if (!type || !(type.includes(requestedType) || type.includes(requestedType + 'Credential'))) {
|
|
117
|
+
throw Error(`Credential type ${JSON.stringify(type)} does not contain requested type ${requestedType}`);
|
|
118
|
+
}
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
const encodedList = getAssertedValue('encodedList', credentialSubject['encodedList']);
|
|
121
|
+
const statusList = yield vc_status_list_1.StatusList.decode({ encodedList });
|
|
122
|
+
const status = statusList.getStatus(typeof args.statusListIndex === 'number' ? args.statusListIndex : Number.parseInt(args.statusListIndex));
|
|
123
|
+
return status;
|
|
106
124
|
});
|
|
107
125
|
}
|
|
108
126
|
function createNewStatusList(args, context) {
|
|
109
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
128
|
+
var _a, _b, _c;
|
|
129
|
+
const length = (_a = args === null || args === void 0 ? void 0 : args.length) !== null && _a !== void 0 ? _a : 250000;
|
|
130
|
+
const proofFormat = (_b = args === null || args === void 0 ? void 0 : args.proofFormat) !== null && _b !== void 0 ? _b : 'lds';
|
|
131
|
+
const { issuer, type, id } = getAssertedValues(args);
|
|
132
|
+
const correlationId = getAssertedValue('correlationId', args.correlationId);
|
|
133
|
+
const list = new vc_status_list_1.StatusList({ length });
|
|
134
|
+
const encodedList = yield list.encode();
|
|
135
|
+
const statusPurpose = (_c = args.statusPurpose) !== null && _c !== void 0 ? _c : 'revocation';
|
|
136
|
+
const statusListCredential = yield statusList2021ToVerifiableCredential(Object.assign(Object.assign({}, args), { type,
|
|
137
|
+
proofFormat,
|
|
138
|
+
encodedList }), context);
|
|
139
|
+
return {
|
|
140
|
+
encodedList,
|
|
141
|
+
statusListCredential,
|
|
142
|
+
length,
|
|
143
|
+
type,
|
|
144
|
+
proofFormat,
|
|
145
|
+
id,
|
|
146
|
+
correlationId,
|
|
147
|
+
issuer,
|
|
148
|
+
statusPurpose,
|
|
149
|
+
indexingDirection: 'rightToLeft',
|
|
150
|
+
};
|
|
113
151
|
});
|
|
114
152
|
}
|
|
115
153
|
function updateStatusIndexFromStatusListCredential(args, context) {
|
|
116
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
|
|
118
|
-
const statusListType = (0, utils_1.determineStatusListType)(credential);
|
|
119
|
-
const implementation = (0, StatusListFactory_1.getStatusListImplementation)(statusListType);
|
|
120
|
-
return implementation.updateStatusListIndex(args, context);
|
|
155
|
+
return updateStatusListIndexFromEncodedList(Object.assign(Object.assign({}, (yield statusListCredentialToDetails(args))), { statusListIndex: args.statusListIndex, value: args.value }), context);
|
|
121
156
|
});
|
|
122
157
|
}
|
|
123
|
-
// Keeping helper function for backward compatibility
|
|
124
158
|
function statusListCredentialToDetails(args) {
|
|
125
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
const credential =
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
const decodedHeader = JSON.parse(Buffer.from(header, 'base64').toString());
|
|
132
|
-
if (decodedHeader.typ === 'statuslist+jwt') {
|
|
133
|
-
statusListType = ssi_types_1.StatusListType.OAuthStatusList;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
else if (documentFormat === 4 /* DocumentFormat.MSO_MDOC */) {
|
|
137
|
-
statusListType = ssi_types_1.StatusListType.OAuthStatusList;
|
|
138
|
-
// TODO check CBOR content?
|
|
139
|
-
}
|
|
140
|
-
if (!statusListType) {
|
|
141
|
-
const uniform = ssi_types_1.CredentialMapper.toUniformCredential(credential);
|
|
142
|
-
const type = uniform.type.find((t) => t.includes('StatusList2021') || t.includes('OAuth2StatusList'));
|
|
143
|
-
if (!type) {
|
|
144
|
-
throw new Error('Invalid status list credential type');
|
|
145
|
-
}
|
|
146
|
-
statusListType = type.replace('Credential', '');
|
|
160
|
+
const credential = getAssertedValue('statusListCredential', args.statusListCredential);
|
|
161
|
+
const uniform = ssi_types_1.CredentialMapper.toUniformCredential(credential);
|
|
162
|
+
const { issuer, type, credentialSubject } = uniform;
|
|
163
|
+
if (!type.includes('StatusList2021Credential')) {
|
|
164
|
+
throw Error('StatusList2021Credential type should be present in the Verifiable Credential');
|
|
147
165
|
}
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
166
|
+
const id = getAssertedValue('id', uniform.id);
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
const { encodedList, statusPurpose } = credentialSubject;
|
|
169
|
+
const proofFormat = ssi_types_1.CredentialMapper.detectDocumentType(credential) === 0 /* DocumentFormat.JWT */ ? 'jwt' : 'lds';
|
|
170
|
+
return Object.assign(Object.assign({ id,
|
|
171
|
+
encodedList,
|
|
172
|
+
issuer, type: ssi_types_1.StatusListType.StatusList2021, proofFormat, indexingDirection: 'rightToLeft', length: (yield vc_status_list_1.StatusList.decode({ encodedList })).length, statusPurpose, statusListCredential: credential }, (args.correlationId && { correlationId: args.correlationId })), (args.driverType && { driverType: args.driverType }));
|
|
154
173
|
});
|
|
155
174
|
}
|
|
156
175
|
function updateStatusListIndexFromEncodedList(args, context) {
|
|
157
176
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
177
|
+
var _a;
|
|
178
|
+
const { issuer, type, id } = getAssertedValues(args);
|
|
179
|
+
const proofFormat = (_a = args === null || args === void 0 ? void 0 : args.proofFormat) !== null && _a !== void 0 ? _a : 'lds';
|
|
180
|
+
const origEncodedList = getAssertedValue('encodedList', args.encodedList);
|
|
181
|
+
const index = getAssertedValue('index', typeof args.statusListIndex === 'number' ? args.statusListIndex : Number.parseInt(args.statusListIndex));
|
|
182
|
+
const value = getAssertedValue('value', args.value);
|
|
183
|
+
const statusPurpose = getAssertedValue('statusPurpose', args.statusPurpose);
|
|
184
|
+
const statusList = yield vc_status_list_1.StatusList.decode({ encodedList: origEncodedList });
|
|
185
|
+
statusList.setStatus(index, value);
|
|
186
|
+
const encodedList = yield statusList.encode();
|
|
187
|
+
const statusListCredential = yield statusList2021ToVerifiableCredential(Object.assign(Object.assign({}, args), { type,
|
|
188
|
+
proofFormat,
|
|
189
|
+
encodedList }), context);
|
|
190
|
+
return {
|
|
191
|
+
encodedList,
|
|
192
|
+
statusListCredential,
|
|
193
|
+
length: statusList.length - 1,
|
|
194
|
+
type,
|
|
195
|
+
proofFormat,
|
|
196
|
+
id,
|
|
197
|
+
issuer,
|
|
198
|
+
statusPurpose,
|
|
199
|
+
indexingDirection: 'rightToLeft',
|
|
200
|
+
};
|
|
161
201
|
});
|
|
162
202
|
}
|
|
163
203
|
function statusList2021ToVerifiableCredential(args, context) {
|
|
164
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
205
|
var _a;
|
|
166
|
-
const { issuer, id, type } =
|
|
206
|
+
const { issuer, id, type } = getAssertedValues(args);
|
|
167
207
|
const identifier = yield context.agent.identifierManagedGet({
|
|
168
208
|
identifier: typeof issuer === 'string' ? issuer : issuer.id,
|
|
169
209
|
vmRelationship: 'assertionMethod',
|
|
170
210
|
offlineWhenNoDIDRegistered: true, // FIXME Fix identifier resolution for EBSI
|
|
171
211
|
});
|
|
172
|
-
const
|
|
173
|
-
(
|
|
174
|
-
const veramoProofFormat = proofFormat;
|
|
175
|
-
const encodedList = (0, utils_1.getAssertedValue)('encodedList', args.encodedList);
|
|
176
|
-
const statusPurpose = (0, utils_1.getAssertedValue)('statusPurpose', args.statusPurpose);
|
|
212
|
+
const encodedList = getAssertedValue('encodedList', args.encodedList);
|
|
213
|
+
const statusPurpose = getAssertedValue('statusPurpose', args.statusPurpose);
|
|
177
214
|
const credential = {
|
|
178
215
|
'@context': ['https://www.w3.org/2018/credentials/v1', 'https://w3id.org/vc/status-list/2021/v1'],
|
|
179
216
|
id,
|
|
@@ -191,10 +228,29 @@ function statusList2021ToVerifiableCredential(args, context) {
|
|
|
191
228
|
const verifiableCredential = yield context.agent.createVerifiableCredential({
|
|
192
229
|
credential,
|
|
193
230
|
keyRef: identifier.kmsKeyRef,
|
|
194
|
-
proofFormat:
|
|
231
|
+
proofFormat: (_a = args.proofFormat) !== null && _a !== void 0 ? _a : 'lds',
|
|
195
232
|
fetchRemoteContexts: true,
|
|
196
233
|
});
|
|
197
234
|
return ssi_types_1.CredentialMapper.toWrappedVerifiableCredential(verifiableCredential).original;
|
|
198
235
|
});
|
|
199
236
|
}
|
|
237
|
+
function getAssertedStatusListType(type) {
|
|
238
|
+
const assertedType = type !== null && type !== void 0 ? type : ssi_types_1.StatusListType.StatusList2021;
|
|
239
|
+
if (assertedType !== ssi_types_1.StatusListType.StatusList2021) {
|
|
240
|
+
throw Error(`StatusList type ${assertedType} is not supported (yet)`);
|
|
241
|
+
}
|
|
242
|
+
return assertedType;
|
|
243
|
+
}
|
|
244
|
+
function getAssertedValue(name, value) {
|
|
245
|
+
if (value === undefined || value === null) {
|
|
246
|
+
throw Error(`Missing required ${name} value`);
|
|
247
|
+
}
|
|
248
|
+
return value;
|
|
249
|
+
}
|
|
250
|
+
function getAssertedValues(args) {
|
|
251
|
+
const type = getAssertedStatusListType(args === null || args === void 0 ? void 0 : args.type);
|
|
252
|
+
const id = getAssertedValue('id', args.id);
|
|
253
|
+
const issuer = getAssertedValue('issuer', args.issuer);
|
|
254
|
+
return { id, issuer, type };
|
|
255
|
+
}
|
|
200
256
|
//# sourceMappingURL=functions.js.map
|
package/dist/functions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;;;;;;;;;AAuBA,8DAiBC;AAED,gEAqBC;AAMD,4DAuBC;AAED,4DAgCC;AAED,gFAWC;AAED,4FA8BC;AAED,kDAkCC;AAED,8FAYC;AAED,sEA4BC;AAED,oFAkCC;AAED,oFAkCC;AAlUD,mDAQ4B;AAE5B,6DAAkE;AAYlE,SAAsB,yBAAyB,CAAC,IAAsC;;QACpF,MAAM,GAAG,GAAG,gBAAgB,CAAC,sBAAsB,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAA;QAC/E,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;YACjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,KAAK,GAAG,wBAAwB,GAAG,0BAA0B,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAA;gBAC7G,MAAM,KAAK,CAAC,KAAK,CAAC,CAAA;YACpB,CAAC;YACD,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAC5C,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAiC,CAAA;YACnE,CAAC;YACD,OAAO,cAA8C,CAAA;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,qCAAqC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC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G,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,0BAAc,CAAC,cAAc,CAAA;IAC1D,IAAI,YAAY,KAAK,0BAAc,CAAC,cAAc,EAAE,CAAC;QACnD,MAAM,KAAK,CAAC,mBAAmB,YAAY,yBAAyB,CAAC,CAAA;IACvE,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAI,IAAY,EAAE,KAAQ;IACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,MAAM,KAAK,CAAC,oBAAoB,IAAI,QAAQ,CAAC,CAAA;IAC/C,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAqE;IAC9F,MAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,CAAA;IAClD,MAAM,EAAE,GAAG,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1C,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACtD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC7B,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,86 +1,46 @@
|
|
|
1
1
|
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
2
|
-
import { ICredential, ICredentialStatus, IIssuer, IVerifiableCredential,
|
|
3
|
-
import { CredentialPayload, IAgentContext, ICredentialIssuer, ICredentialPlugin, ICredentialVerifier,
|
|
2
|
+
import { ICredential, ICredentialStatus, IIssuer, IVerifiableCredential, OriginalVerifiableCredential, OrPromise, StatusListCredentialIdMode, StatusListDriverType, StatusListIndexingDirection, StatusListType, StatusPurpose2021 } from '@sphereon/ssi-types';
|
|
3
|
+
import { CredentialPayload, IAgentContext, ICredentialIssuer, ICredentialPlugin, ICredentialVerifier, IPluginMethodMap, ProofFormat } from '@veramo/core';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare enum StatusOAuth {
|
|
9
|
-
Valid = 0,
|
|
10
|
-
Invalid = 1,
|
|
11
|
-
Suspended = 2
|
|
5
|
+
export interface CreateNewStatusListFuncArgs extends Omit<StatusList2021ToVerifiableCredentialArgs, 'encodedList'> {
|
|
6
|
+
correlationId: string;
|
|
7
|
+
length?: number;
|
|
12
8
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export interface UpdateStatusListFromEncodedListArgs extends StatusList2021ToVerifiableCredentialArgs {
|
|
10
|
+
statusListIndex: number | string;
|
|
11
|
+
value: boolean;
|
|
16
12
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
statusPurpose?: StatusPurpose2021;
|
|
20
|
-
};
|
|
21
|
-
export type OAuthStatusListArgs = {
|
|
22
|
-
bitsPerStatus?: BitsPerStatus;
|
|
23
|
-
expiresAt?: Date;
|
|
24
|
-
};
|
|
25
|
-
export type BaseCreateNewStatusListArgs = {
|
|
26
|
-
type: StatusListType;
|
|
27
|
-
id: string;
|
|
28
|
-
issuer: string | IIssuer;
|
|
29
|
-
correlationId?: string;
|
|
30
|
-
length?: number;
|
|
31
|
-
proofFormat?: ProofFormat;
|
|
13
|
+
export interface UpdateStatusListFromStatusListCredentialArgs {
|
|
14
|
+
statusListCredential: OriginalVerifiableCredential;
|
|
32
15
|
keyRef?: string;
|
|
33
|
-
statusList2021?: StatusList2021Args;
|
|
34
|
-
oauthStatusList?: OAuthStatusListArgs;
|
|
35
|
-
};
|
|
36
|
-
export type UpdateStatusList2021Args = {
|
|
37
|
-
statusPurpose: StatusPurpose2021;
|
|
38
|
-
};
|
|
39
|
-
export type UpdateOAuthStatusListArgs = {
|
|
40
|
-
bitsPerStatus: BitsPerStatus;
|
|
41
|
-
expiresAt?: Date;
|
|
42
|
-
};
|
|
43
|
-
export interface UpdateStatusListFromEncodedListArgs {
|
|
44
|
-
type?: StatusListType;
|
|
45
16
|
statusListIndex: number | string;
|
|
46
17
|
value: boolean;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
correlationId?: string;
|
|
50
|
-
encodedList: string;
|
|
18
|
+
}
|
|
19
|
+
export interface StatusList2021ToVerifiableCredentialArgs {
|
|
51
20
|
issuer: string | IIssuer;
|
|
52
21
|
id: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
statusListCredential: StatusListCredential;
|
|
22
|
+
type?: StatusListType;
|
|
23
|
+
statusPurpose: StatusPurpose2021;
|
|
24
|
+
encodedList: string;
|
|
25
|
+
proofFormat?: ProofFormat;
|
|
58
26
|
keyRef?: string;
|
|
59
|
-
statusListIndex: number | string;
|
|
60
|
-
value: number | Status2021 | StatusOAuth;
|
|
61
27
|
}
|
|
62
|
-
export interface
|
|
28
|
+
export interface StatusListDetails {
|
|
63
29
|
encodedList: string;
|
|
64
|
-
statusListCredential: StatusListCredential;
|
|
65
30
|
length: number;
|
|
66
31
|
type: StatusListType;
|
|
67
32
|
proofFormat: ProofFormat;
|
|
33
|
+
statusPurpose: StatusPurpose2021;
|
|
68
34
|
id: string;
|
|
69
|
-
statuslistContentType: string;
|
|
70
35
|
issuer: string | IIssuer;
|
|
71
|
-
|
|
72
|
-
|
|
36
|
+
indexingDirection: StatusListIndexingDirection;
|
|
37
|
+
statusListCredential: OriginalVerifiableCredential;
|
|
73
38
|
correlationId?: string;
|
|
74
39
|
driverType?: StatusListDriverType;
|
|
75
40
|
credentialIdMode?: StatusListCredentialIdMode;
|
|
76
41
|
}
|
|
77
|
-
interface
|
|
78
|
-
|
|
79
|
-
statusPurpose?: StatusPurpose2021;
|
|
80
|
-
}
|
|
81
|
-
interface OAuthStatusDetails {
|
|
82
|
-
bitsPerStatus?: BitsPerStatus;
|
|
83
|
-
expiresAt?: Date;
|
|
42
|
+
export interface StatusListResult extends StatusListDetails {
|
|
43
|
+
statusListCredential: OriginalVerifiableCredential;
|
|
84
44
|
}
|
|
85
45
|
export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
|
|
86
46
|
type: 'StatusList2021Entry';
|
|
@@ -88,48 +48,6 @@ export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
|
|
|
88
48
|
statusListIndex: string;
|
|
89
49
|
statusListCredential: string;
|
|
90
50
|
}
|
|
91
|
-
export interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus {
|
|
92
|
-
type: 'OAuthStatusListEntry';
|
|
93
|
-
bitsPerStatus: number;
|
|
94
|
-
statusListIndex: string;
|
|
95
|
-
statusListCredential: string;
|
|
96
|
-
expiresAt?: Date;
|
|
97
|
-
}
|
|
98
|
-
export interface StatusList2021ToVerifiableCredentialArgs {
|
|
99
|
-
issuer: string | IIssuer;
|
|
100
|
-
id: string;
|
|
101
|
-
type?: StatusListType;
|
|
102
|
-
proofFormat?: ProofFormat;
|
|
103
|
-
keyRef?: string;
|
|
104
|
-
encodedList: string;
|
|
105
|
-
statusPurpose: StatusPurpose2021;
|
|
106
|
-
}
|
|
107
|
-
export interface CreateStatusListArgs {
|
|
108
|
-
issuer: string | IIssuer;
|
|
109
|
-
id: string;
|
|
110
|
-
proofFormat?: ProofFormat;
|
|
111
|
-
keyRef?: string;
|
|
112
|
-
correlationId?: string;
|
|
113
|
-
length?: number;
|
|
114
|
-
statusList2021?: StatusList2021Args;
|
|
115
|
-
oauthStatusList?: OAuthStatusListArgs;
|
|
116
|
-
}
|
|
117
|
-
export interface UpdateStatusListIndexArgs {
|
|
118
|
-
statusListCredential: StatusListCredential;
|
|
119
|
-
statusListIndex: number | string;
|
|
120
|
-
value: number | Status2021 | StatusOAuth;
|
|
121
|
-
keyRef?: string;
|
|
122
|
-
expiresAt?: Date;
|
|
123
|
-
}
|
|
124
|
-
export interface CheckStatusIndexArgs {
|
|
125
|
-
statusListCredential: StatusListCredential;
|
|
126
|
-
statusListIndex: string | number;
|
|
127
|
-
}
|
|
128
|
-
export interface ToStatusListDetailsArgs {
|
|
129
|
-
statusListPayload: StatusListCredential;
|
|
130
|
-
correlationId?: string;
|
|
131
|
-
driverType?: StatusListDriverType;
|
|
132
|
-
}
|
|
133
51
|
/**
|
|
134
52
|
* The interface definition for a plugin that can add statuslist info to a credential
|
|
135
53
|
*
|
|
@@ -146,7 +64,7 @@ export interface IStatusListPlugin extends IPluginMethodMap {
|
|
|
146
64
|
*
|
|
147
65
|
* @returns - The details of the newly created status list
|
|
148
66
|
*/
|
|
149
|
-
slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<
|
|
67
|
+
slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListDetails>;
|
|
150
68
|
/**
|
|
151
69
|
* Ensures status list info like index and list id is added to a credential
|
|
152
70
|
*
|
|
@@ -158,30 +76,22 @@ export interface IStatusListPlugin extends IPluginMethodMap {
|
|
|
158
76
|
* @beta This API is likely to change without a BREAKING CHANGE notice
|
|
159
77
|
*/
|
|
160
78
|
slAddStatusToCredential(args: IAddStatusToCredentialArgs, context: IRequiredContext): Promise<CredentialWithStatusSupport>;
|
|
161
|
-
slAddStatusToSdJwtCredential(args: IAddStatusToSdJwtCredentialArgs, context: IRequiredContext): Promise<SdJwtVcPayload>;
|
|
162
79
|
/**
|
|
163
80
|
* Get the status list using the configured driver for the SL. Normally a correlationId or id should suffice. Optionally accepts a dbName/datasource
|
|
164
81
|
* @param args
|
|
165
82
|
* @param context
|
|
166
83
|
*/
|
|
167
|
-
slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<
|
|
84
|
+
slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListDetails>;
|
|
168
85
|
}
|
|
169
|
-
export type CreateNewStatusListFuncArgs = BaseCreateNewStatusListArgs;
|
|
170
|
-
export type CreateNewStatusListArgs = BaseCreateNewStatusListArgs & {
|
|
171
|
-
dataSource?: OrPromise<DataSource>;
|
|
172
|
-
dbName?: string;
|
|
173
|
-
isDefault?: boolean;
|
|
174
|
-
};
|
|
175
86
|
export type IAddStatusToCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
|
|
176
87
|
credential: CredentialWithStatusSupport;
|
|
177
88
|
};
|
|
178
|
-
export type IAddStatusToSdJwtCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
|
|
179
|
-
credential: SdJwtVcPayload;
|
|
180
|
-
};
|
|
181
89
|
export interface IIssueCredentialStatusOpts {
|
|
182
90
|
dataSource?: DataSource;
|
|
183
|
-
statusListOpts?: Array<StatusListOpts>;
|
|
184
91
|
credentialId?: string;
|
|
92
|
+
statusListId?: string;
|
|
93
|
+
statusListIndex?: number | string;
|
|
94
|
+
statusEntryCorrelationId?: string;
|
|
185
95
|
value?: string;
|
|
186
96
|
}
|
|
187
97
|
export type GetStatusListArgs = {
|
|
@@ -190,12 +100,12 @@ export type GetStatusListArgs = {
|
|
|
190
100
|
dataSource?: OrPromise<DataSource>;
|
|
191
101
|
dbName?: string;
|
|
192
102
|
};
|
|
193
|
-
export type
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
103
|
+
export type CreateNewStatusListArgs = CreateNewStatusListFuncArgs & {
|
|
104
|
+
dataSource?: OrPromise<DataSource>;
|
|
105
|
+
dbName?: string;
|
|
106
|
+
isDefault?: boolean;
|
|
197
107
|
};
|
|
108
|
+
export type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential;
|
|
198
109
|
export type IRequiredPlugins = ICredentialPlugin & IIdentifierResolution;
|
|
199
|
-
export type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution
|
|
200
|
-
export {};
|
|
110
|
+
export type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution>;
|
|
201
111
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,4BAA4B,EAC5B,SAAS,EACT,0BAA0B,EAC1B,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,wCAAwC,EAAE,aAAa,CAAC;IAChH,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mCAAoC,SAAQ,wCAAwC;IACnG,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;IAChC,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,4CAA4C;IAC3D,oBAAoB,EAAE,4BAA4B,CAAA;IAClD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;IAChC,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,wCAAwC;IACvD,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,EAAE,E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AC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAChG;AAED,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,0BAA0B,EAAE,YAAY,CAAC,GAAG;IACxF,UAAU,EAAE,2BAA2B,CAAA;CACxC,CAAA;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,CAAC,EAAE,UAAU,CAAA;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,GAAG;IAClE,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG,WAAW,GAAG,iBAAiB,GAAG,qBAAqB,CAAA;AAEjG,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,qBAAqB,CAAA;AACxE,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,iBAAiB,GAAG,mBAAmB,GAAG,qBAAqB,CAAC,CAAA"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Status2021 = exports.StatusOAuth = void 0;
|
|
4
|
-
var StatusOAuth;
|
|
5
|
-
(function (StatusOAuth) {
|
|
6
|
-
StatusOAuth[StatusOAuth["Valid"] = 0] = "Valid";
|
|
7
|
-
StatusOAuth[StatusOAuth["Invalid"] = 1] = "Invalid";
|
|
8
|
-
StatusOAuth[StatusOAuth["Suspended"] = 2] = "Suspended";
|
|
9
|
-
})(StatusOAuth || (exports.StatusOAuth = StatusOAuth = {}));
|
|
10
|
-
var Status2021;
|
|
11
|
-
(function (Status2021) {
|
|
12
|
-
Status2021[Status2021["Valid"] = 0] = "Valid";
|
|
13
|
-
Status2021[Status2021["Invalid"] = 1] = "Invalid";
|
|
14
|
-
})(Status2021 || (exports.Status2021 = Status2021 = {}));
|
|
15
3
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|