@sphereon/ssi-sdk.vc-status-list 0.32.1-next.54 → 0.33.1-feature.vcdm2.4
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 +141 -225
- package/dist/functions.js.map +1 -1
- package/dist/impl/IStatusList.d.ts +26 -0
- package/dist/impl/IStatusList.d.ts.map +1 -0
- package/dist/impl/IStatusList.js +2 -0
- package/dist/impl/IStatusList.js.map +1 -0
- package/dist/impl/OAuthStatusList.d.ts +21 -0
- package/dist/impl/OAuthStatusList.d.ts.map +1 -0
- package/dist/impl/OAuthStatusList.js +144 -0
- package/dist/impl/OAuthStatusList.js.map +1 -0
- package/dist/impl/StatusList2021.d.ts +16 -0
- package/dist/impl/StatusList2021.d.ts.map +1 -0
- package/dist/impl/StatusList2021.js +179 -0
- package/dist/impl/StatusList2021.js.map +1 -0
- package/dist/impl/StatusListFactory.d.ts +11 -0
- package/dist/impl/StatusListFactory.d.ts.map +1 -0
- package/dist/impl/StatusListFactory.js +29 -0
- package/dist/impl/StatusListFactory.js.map +1 -0
- package/dist/impl/encoding/cbor.d.ts +6 -0
- package/dist/impl/encoding/cbor.d.ts.map +1 -0
- package/dist/impl/encoding/cbor.js +123 -0
- package/dist/impl/encoding/cbor.js.map +1 -0
- package/dist/impl/encoding/common.d.ts +12 -0
- package/dist/impl/encoding/common.d.ts.map +1 -0
- package/dist/impl/encoding/common.js +9 -0
- package/dist/impl/encoding/common.js.map +1 -0
- package/dist/impl/encoding/jwt.d.ts +9 -0
- package/dist/impl/encoding/jwt.d.ts.map +1 -0
- package/dist/impl/encoding/jwt.js +61 -0
- package/dist/impl/encoding/jwt.js.map +1 -0
- package/dist/index.js +2 -18
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +131 -33
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +11 -2
- package/dist/types/index.js.map +1 -1
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +79 -0
- package/dist/utils.js.map +1 -0
- package/package.json +17 -6
- package/src/functions.ts +73 -159
- package/src/impl/IStatusList.ts +42 -0
- package/src/impl/OAuthStatusList.ts +206 -0
- package/src/impl/StatusList2021.ts +241 -0
- package/src/impl/StatusListFactory.ts +34 -0
- package/src/impl/encoding/cbor.ts +171 -0
- package/src/impl/encoding/common.ts +20 -0
- package/src/impl/encoding/jwt.ts +80 -0
- package/src/types/index.ts +151 -37
- package/src/utils.ts +95 -0
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 { StatusListCredential, 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, Status2021, StatusList2021ToVerifiableCredentialArgs, StatusListResult, StatusOAuth, UpdateStatusListFromEncodedListArgs, UpdateStatusListIndexArgs } from './types';
|
|
6
6
|
export declare function fetchStatusListCredential(args: {
|
|
7
7
|
statusListCredential: string;
|
|
8
|
-
}): Promise<
|
|
8
|
+
}): Promise<StatusListCredential>;
|
|
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: StatusListCredential;
|
|
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: StatusListCredential;
|
|
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<number | Status2021 | StatusOAuth>;
|
|
53
53
|
export declare function checkStatusIndexFromStatusListCredential(args: {
|
|
54
|
-
statusListCredential:
|
|
54
|
+
statusListCredential: StatusListCredential;
|
|
55
55
|
statusPurpose?: StatusPurpose2021;
|
|
56
56
|
type?: StatusListType | 'StatusList2021Entry';
|
|
57
57
|
id?: string;
|
|
58
58
|
statusListIndex: string | number;
|
|
59
|
-
}): Promise<
|
|
59
|
+
}): Promise<number | Status2021 | StatusOAuth>;
|
|
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: UpdateStatusListIndexArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
62
62
|
export declare function statusListCredentialToDetails(args: {
|
|
63
|
-
statusListCredential:
|
|
63
|
+
statusListCredential: StatusListCredential;
|
|
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<StatusListResult>;
|
|
67
|
+
export declare function updateStatusListIndexFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
68
|
+
export declare function statusList2021ToVerifiableCredential(args: StatusList2021ToVerifiableCredentialArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListCredential>;
|
|
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,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAiC,aAAa,EAAE,iBAAiB,EAAoC,MAAM,cAAc,CAAA;AAGhI,OAAO,EAAuB,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EACL,2BAA2B,EAC3B,UAAU,EACV,wCAAwC,EACxC,gBAAgB,EAChB,WAAW,EACX,mCAAmC,EACnC,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAIhB,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgBrH;AAED,wBAAgB,0BAA0B,C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AC,CAmC/B"}
|
package/dist/functions.js
CHANGED
|
@@ -1,256 +1,172 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.fetchStatusListCredential = fetchStatusListCredential;
|
|
13
|
-
exports.statusPluginStatusFunction = statusPluginStatusFunction;
|
|
14
|
-
exports.vcLibCheckStatusFunction = vcLibCheckStatusFunction;
|
|
15
|
-
exports.checkStatusForCredential = checkStatusForCredential;
|
|
16
|
-
exports.simpleCheckStatusFromStatusListUrl = simpleCheckStatusFromStatusListUrl;
|
|
17
|
-
exports.checkStatusIndexFromStatusListCredential = checkStatusIndexFromStatusListCredential;
|
|
18
|
-
exports.createNewStatusList = createNewStatusList;
|
|
19
|
-
exports.updateStatusIndexFromStatusListCredential = updateStatusIndexFromStatusListCredential;
|
|
20
|
-
exports.statusListCredentialToDetails = statusListCredentialToDetails;
|
|
21
|
-
exports.updateStatusListIndexFromEncodedList = updateStatusListIndexFromEncodedList;
|
|
22
|
-
exports.statusList2021ToVerifiableCredential = statusList2021ToVerifiableCredential;
|
|
23
|
-
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
24
|
-
const vc_status_list_1 = require("@sphereon/vc-status-list");
|
|
25
|
-
function fetchStatusListCredential(args) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const url = getAssertedValue('statusListCredential', args.statusListCredential);
|
|
28
|
-
try {
|
|
29
|
-
const response = yield fetch(url);
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
const error = `Fetching status list ${url} resulted in an error: ${response.status} : ${response.statusText}`;
|
|
32
|
-
throw Error(error);
|
|
33
|
-
}
|
|
34
|
-
const responseAsText = yield response.text();
|
|
35
|
-
if (responseAsText.trim().startsWith('{')) {
|
|
36
|
-
return JSON.parse(responseAsText);
|
|
37
|
-
}
|
|
38
|
-
return responseAsText;
|
|
1
|
+
import { CredentialMapper, StatusListType, } from '@sphereon/ssi-types';
|
|
2
|
+
import { checkStatus } from '@sphereon/vc-status-list';
|
|
3
|
+
import { assertValidProofType, determineStatusListType, getAssertedValue, getAssertedValues } from './utils';
|
|
4
|
+
import { getStatusListImplementation } from './impl/StatusListFactory';
|
|
5
|
+
export async function fetchStatusListCredential(args) {
|
|
6
|
+
const url = getAssertedValue('statusListCredential', args.statusListCredential);
|
|
7
|
+
try {
|
|
8
|
+
const response = await fetch(url);
|
|
9
|
+
if (!response.ok) {
|
|
10
|
+
throw Error(`Fetching status list ${url} resulted in an error: ${response.status} : ${response.statusText}`);
|
|
39
11
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
12
|
+
const responseAsText = await response.text();
|
|
13
|
+
if (responseAsText.trim().startsWith('{')) {
|
|
14
|
+
return JSON.parse(responseAsText);
|
|
43
15
|
}
|
|
44
|
-
|
|
16
|
+
return responseAsText;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.error(`Fetching status list ${url} resulted in an unexpected error: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
45
22
|
}
|
|
46
|
-
function statusPluginStatusFunction(args) {
|
|
47
|
-
return (credential, didDoc) =>
|
|
48
|
-
const result =
|
|
49
|
-
|
|
50
|
-
|
|
23
|
+
export function statusPluginStatusFunction(args) {
|
|
24
|
+
return async (credential, didDoc) => {
|
|
25
|
+
const result = await checkStatusForCredential({
|
|
26
|
+
...args,
|
|
27
|
+
documentLoader: args.documentLoader,
|
|
28
|
+
credential: credential,
|
|
29
|
+
errorUnknownListType: args.errorUnknownListType,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
revoked: !result.verified || result.error,
|
|
33
|
+
...(result.error && { error: result.error }),
|
|
34
|
+
};
|
|
35
|
+
};
|
|
51
36
|
}
|
|
52
37
|
/**
|
|
53
38
|
* Function that can be used together with @digitalbazar/vc and @digitialcredentials/vc
|
|
54
39
|
* @param args
|
|
55
40
|
*/
|
|
56
|
-
function vcLibCheckStatusFunction(args) {
|
|
41
|
+
export function vcLibCheckStatusFunction(args) {
|
|
57
42
|
const { mandatoryCredentialStatus, verifyStatusListCredential, verifyMatchingIssuers, errorUnknownListType } = args;
|
|
58
43
|
return (args) => {
|
|
59
|
-
return checkStatusForCredential(
|
|
44
|
+
return checkStatusForCredential({
|
|
45
|
+
...args,
|
|
46
|
+
mandatoryCredentialStatus,
|
|
60
47
|
verifyStatusListCredential,
|
|
61
48
|
verifyMatchingIssuers,
|
|
62
|
-
errorUnknownListType
|
|
49
|
+
errorUnknownListType,
|
|
50
|
+
});
|
|
63
51
|
};
|
|
64
52
|
}
|
|
65
|
-
function checkStatusForCredential(args) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
console.log(error);
|
|
75
|
-
return { verified: false, error };
|
|
76
|
-
}
|
|
77
|
-
return { verified: true };
|
|
78
|
-
}
|
|
79
|
-
if ('credentialStatus' in uniform && uniform.credentialStatus) {
|
|
80
|
-
if (uniform.credentialStatus.type === 'StatusList2021Entry') {
|
|
81
|
-
return (0, vc_status_list_1.checkStatus)(Object.assign(Object.assign({}, args), { verifyStatusListCredential, verifyMatchingIssuers }));
|
|
82
|
-
}
|
|
83
|
-
else if (args === null || args === void 0 ? void 0 : args.errorUnknownListType) {
|
|
84
|
-
const error = `Credential status type ${uniform.credentialStatus.type} is not supported, and check status has been configured to not allow for that`;
|
|
85
|
-
console.log(error);
|
|
86
|
-
return { verified: false, error };
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
console.log(`Skipped verification of status type ${uniform.credentialStatus.type} as we do not support it (yet)`);
|
|
90
|
-
}
|
|
53
|
+
export async function checkStatusForCredential(args) {
|
|
54
|
+
const verifyStatusListCredential = args.verifyStatusListCredential ?? true;
|
|
55
|
+
const verifyMatchingIssuers = args.verifyMatchingIssuers ?? true;
|
|
56
|
+
const uniform = CredentialMapper.toUniformCredential(args.credential);
|
|
57
|
+
if (!('credentialStatus' in uniform) || !uniform.credentialStatus) {
|
|
58
|
+
if (args.mandatoryCredentialStatus) {
|
|
59
|
+
const error = 'No credential status object found in the Verifiable Credential and it is mandatory';
|
|
60
|
+
console.log(error);
|
|
61
|
+
return { verified: false, error };
|
|
91
62
|
}
|
|
92
63
|
return { verified: true };
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return checkStatusIndexFromStatusListCredential(Object.assign(Object.assign({}, args), { statusListCredential: yield fetchStatusListCredential(args) }));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function checkStatusIndexFromStatusListCredential(args) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
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
|
-
}
|
|
64
|
+
}
|
|
65
|
+
if ('credentialStatus' in uniform && uniform.credentialStatus) {
|
|
66
|
+
if (uniform.credentialStatus.type === 'StatusList2021Entry') {
|
|
67
|
+
return checkStatus({ ...args, verifyStatusListCredential, verifyMatchingIssuers });
|
|
112
68
|
}
|
|
113
|
-
else if (args
|
|
114
|
-
|
|
69
|
+
else if (args?.errorUnknownListType) {
|
|
70
|
+
const error = `Credential status type ${uniform.credentialStatus.type} is not supported, and check status has been configured to not allow for that`;
|
|
71
|
+
console.log(error);
|
|
72
|
+
return { verified: false, error };
|
|
115
73
|
}
|
|
116
|
-
|
|
117
|
-
|
|
74
|
+
else {
|
|
75
|
+
console.log(`Skipped verification of status type ${uniform.credentialStatus.type} as we do not support it (yet)`);
|
|
118
76
|
}
|
|
119
|
-
|
|
120
|
-
|
|
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;
|
|
124
|
-
});
|
|
77
|
+
}
|
|
78
|
+
return { verified: true };
|
|
125
79
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
};
|
|
80
|
+
export async function simpleCheckStatusFromStatusListUrl(args) {
|
|
81
|
+
return checkStatusIndexFromStatusListCredential({
|
|
82
|
+
...args,
|
|
83
|
+
statusListCredential: await fetchStatusListCredential(args),
|
|
151
84
|
});
|
|
152
85
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
86
|
+
export async function checkStatusIndexFromStatusListCredential(args) {
|
|
87
|
+
const statusListType = determineStatusListType(args.statusListCredential);
|
|
88
|
+
const implementation = getStatusListImplementation(statusListType);
|
|
89
|
+
return implementation.checkStatusIndex(args);
|
|
90
|
+
}
|
|
91
|
+
export async function createNewStatusList(args, context) {
|
|
92
|
+
const { type } = getAssertedValues(args);
|
|
93
|
+
const implementation = getStatusListImplementation(type);
|
|
94
|
+
return implementation.createNewStatusList(args, context);
|
|
157
95
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
96
|
+
export async function updateStatusIndexFromStatusListCredential(args, context) {
|
|
97
|
+
const credential = getAssertedValue('statusListCredential', args.statusListCredential);
|
|
98
|
+
const statusListType = determineStatusListType(credential);
|
|
99
|
+
const implementation = getStatusListImplementation(statusListType);
|
|
100
|
+
return implementation.updateStatusListIndex(args, context);
|
|
101
|
+
}
|
|
102
|
+
// Keeping helper function for backward compatibility
|
|
103
|
+
export async function statusListCredentialToDetails(args) {
|
|
104
|
+
const credential = getAssertedValue('statusListCredential', args.statusListCredential);
|
|
105
|
+
let statusListType;
|
|
106
|
+
const documentFormat = CredentialMapper.detectDocumentType(credential);
|
|
107
|
+
if (documentFormat === 0 /* DocumentFormat.JWT */) {
|
|
108
|
+
const [header] = credential.split('.');
|
|
109
|
+
const decodedHeader = JSON.parse(Buffer.from(header, 'base64').toString());
|
|
110
|
+
if (decodedHeader.typ === 'statuslist+jwt') {
|
|
111
|
+
statusListType = StatusListType.OAuthStatusList;
|
|
165
112
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
113
|
+
}
|
|
114
|
+
else if (documentFormat === 4 /* DocumentFormat.MSO_MDOC */) {
|
|
115
|
+
statusListType = StatusListType.OAuthStatusList;
|
|
116
|
+
// TODO check CBOR content?
|
|
117
|
+
}
|
|
118
|
+
if (!statusListType) {
|
|
119
|
+
const uniform = CredentialMapper.toUniformCredential(credential);
|
|
120
|
+
const type = uniform.type.find((t) => t.includes('StatusList2021') || t.includes('OAuth2StatusList'));
|
|
121
|
+
if (!type) {
|
|
122
|
+
throw new Error('Invalid status list credential type');
|
|
123
|
+
}
|
|
124
|
+
statusListType = type.replace('Credential', '');
|
|
125
|
+
}
|
|
126
|
+
const implementation = getStatusListImplementation(statusListType);
|
|
127
|
+
return await implementation.toStatusListDetails({
|
|
128
|
+
statusListPayload: credential,
|
|
129
|
+
correlationId: args.correlationId,
|
|
130
|
+
driverType: args.driverType,
|
|
173
131
|
});
|
|
174
132
|
}
|
|
175
|
-
function updateStatusListIndexFromEncodedList(args, context) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
};
|
|
201
|
-
});
|
|
133
|
+
export async function updateStatusListIndexFromEncodedList(args, context) {
|
|
134
|
+
const { type } = getAssertedValue('type', args);
|
|
135
|
+
const implementation = getStatusListImplementation(type);
|
|
136
|
+
return implementation.updateStatusListFromEncodedList(args, context);
|
|
202
137
|
}
|
|
203
|
-
function statusList2021ToVerifiableCredential(args, context) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
138
|
+
export async function statusList2021ToVerifiableCredential(args, context) {
|
|
139
|
+
const { issuer, id, type } = getAssertedValues(args);
|
|
140
|
+
const identifier = await context.agent.identifierManagedGet({
|
|
141
|
+
identifier: typeof issuer === 'string' ? issuer : issuer.id,
|
|
142
|
+
vmRelationship: 'assertionMethod',
|
|
143
|
+
offlineWhenNoDIDRegistered: true, // FIXME Fix identifier resolution for EBSI
|
|
144
|
+
});
|
|
145
|
+
const proofFormat = args?.proofFormat ?? 'lds';
|
|
146
|
+
assertValidProofType(StatusListType.StatusList2021, proofFormat);
|
|
147
|
+
const veramoProofFormat = proofFormat;
|
|
148
|
+
const encodedList = getAssertedValue('encodedList', args.encodedList);
|
|
149
|
+
const statusPurpose = getAssertedValue('statusPurpose', args.statusPurpose);
|
|
150
|
+
const credential = {
|
|
151
|
+
'@context': ['https://www.w3.org/2018/credentials/v1', 'https://w3id.org/vc/status-list/2021/v1'],
|
|
152
|
+
id,
|
|
153
|
+
issuer,
|
|
154
|
+
// issuanceDate: "2021-03-10T04:24:12.164Z",
|
|
155
|
+
type: ['VerifiableCredential', `${type}Credential`],
|
|
156
|
+
credentialSubject: {
|
|
216
157
|
id,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const verifiableCredential = yield context.agent.createVerifiableCredential({
|
|
229
|
-
credential,
|
|
230
|
-
keyRef: identifier.kmsKeyRef,
|
|
231
|
-
proofFormat: (_a = args.proofFormat) !== null && _a !== void 0 ? _a : 'lds',
|
|
232
|
-
fetchRemoteContexts: true,
|
|
233
|
-
});
|
|
234
|
-
return ssi_types_1.CredentialMapper.toWrappedVerifiableCredential(verifiableCredential).original;
|
|
158
|
+
type,
|
|
159
|
+
statusPurpose,
|
|
160
|
+
encodedList,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
// TODO copy statuslist schema to local and disable fetching remote contexts
|
|
164
|
+
const verifiableCredential = await context.agent.createVerifiableCredential({
|
|
165
|
+
credential,
|
|
166
|
+
keyRef: identifier.kmsKeyRef,
|
|
167
|
+
proofFormat: veramoProofFormat,
|
|
168
|
+
fetchRemoteContexts: true,
|
|
235
169
|
});
|
|
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 };
|
|
170
|
+
return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential).original;
|
|
255
171
|
}
|
|
256
172
|
//# 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":"AACA,OAAO,EACL,gBAAgB,EAKhB,cAAc,GAEf,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAWtD,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC5G,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAEtE,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,IAAsC;IACpF,MAAM,GAAG,GAAG,gBAAgB,CAAC,sBAAsB,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAA;IAC/E,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,KAAK,CAAC,wBAAwB,GAAG,0BAA0B,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;QAC9G,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC5C,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC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AAI,YAAY,CAAC;QACnD,iBAAiB,EAAE;YACjB,EAAE;YACF,IAAI;YACJ,aAAa;YACb,WAAW;SACZ;KACF,CAAA;IACD,4EAA4E;IAC5E,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC;QAC1E,UAAU;QACV,MAAM,EAAE,UAAU,CAAC,SAAS;QAC5B,WAAW,EAAE,iBAAiB;QAC9B,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAA;IAEF,OAAO,gBAAgB,CAAC,6BAA6B,CAAC,oBAA4C,CAAC,CAAC,QAAgC,CAAA;AACtI,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IAgentContext, ICredentialPlugin } from '@veramo/core';
|
|
2
|
+
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
3
|
+
import { CheckStatusIndexArgs, CreateStatusListArgs, Status2021, StatusListResult, StatusOAuth, ToStatusListDetailsArgs, UpdateStatusListFromEncodedListArgs, UpdateStatusListIndexArgs } from '../types';
|
|
4
|
+
export interface IStatusList {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new status list of the specific type
|
|
7
|
+
*/
|
|
8
|
+
createNewStatusList(args: CreateStatusListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Updates a status at the given index in the status list
|
|
11
|
+
*/
|
|
12
|
+
updateStatusListIndex(args: UpdateStatusListIndexArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Updates a status list using a base64 encoded list of statuses
|
|
15
|
+
*/
|
|
16
|
+
updateStatusListFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Checks the status at a given index in the status list
|
|
19
|
+
*/
|
|
20
|
+
checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | Status2021 | StatusOAuth>;
|
|
21
|
+
/**
|
|
22
|
+
* Collects the status list details
|
|
23
|
+
*/
|
|
24
|
+
toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=IStatusList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStatusList.d.ts","sourceRoot":"","sources":["../../src/impl/IStatusList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,aAAa,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE7I;;OAEG;IACH,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,aAAa,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEpJ;;OAEG;IACH,+BAA+B,CAC7B,IAAI,EAAE,mCAAmC,EACzC,OAAO,EAAE,aAAa,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAChE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE5B;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC,CAAA;IAExF;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStatusList.js","sourceRoot":"","sources":["../../src/impl/IStatusList.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IAgentContext, ICredentialPlugin, IKeyManager } from '@veramo/core';
|
|
2
|
+
import { ProofFormat } from '@sphereon/ssi-types';
|
|
3
|
+
import { CheckStatusIndexArgs, CreateStatusListArgs, StatusListResult, StatusOAuth, ToStatusListDetailsArgs, UpdateStatusListFromEncodedListArgs, UpdateStatusListIndexArgs } from '../types';
|
|
4
|
+
import { IStatusList } from './IStatusList';
|
|
5
|
+
import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
|
|
6
|
+
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
7
|
+
type IRequiredContext = IAgentContext<ICredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>;
|
|
8
|
+
export declare const DEFAULT_BITS_PER_STATUS = 1;
|
|
9
|
+
export declare const DEFAULT_LIST_LENGTH = 250000;
|
|
10
|
+
export declare const DEFAULT_PROOF_FORMAT: ProofFormat;
|
|
11
|
+
export declare class OAuthStatusListImplementation implements IStatusList {
|
|
12
|
+
createNewStatusList(args: CreateStatusListArgs, context: IRequiredContext): Promise<StatusListResult>;
|
|
13
|
+
updateStatusListIndex(args: UpdateStatusListIndexArgs, context: IRequiredContext): Promise<StatusListResult>;
|
|
14
|
+
updateStatusListFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IRequiredContext): Promise<StatusListResult>;
|
|
15
|
+
private buildContentType;
|
|
16
|
+
checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | StatusOAuth>;
|
|
17
|
+
toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult>;
|
|
18
|
+
private createSignedStatusList;
|
|
19
|
+
}
|
|
20
|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