@pagopa/io-react-native-wallet 3.5.0 → 3.5.1
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/lib/commonjs/credential/status/README.md +15 -13
- package/lib/commonjs/credential/status/api/index.js.map +1 -1
- package/lib/commonjs/credential/status/api/types.js +27 -0
- package/lib/commonjs/credential/status/api/types.js.map +1 -1
- package/lib/commonjs/credential/status/v1.3.3/01-status-list.js +26 -22
- package/lib/commonjs/credential/status/v1.3.3/01-status-list.js.map +1 -1
- package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js +4 -25
- package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
- package/lib/commonjs/credential/status/v1.3.3/03-get-status.js +34 -0
- package/lib/commonjs/credential/status/v1.3.3/03-get-status.js.map +1 -0
- package/lib/commonjs/credential/status/v1.3.3/index.js +4 -1
- package/lib/commonjs/credential/status/v1.3.3/index.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js +1 -1
- package/lib/module/credential/status/README.md +15 -13
- package/lib/module/credential/status/api/index.js +3 -1
- package/lib/module/credential/status/api/index.js.map +1 -1
- package/lib/module/credential/status/api/types.js +20 -0
- package/lib/module/credential/status/api/types.js.map +1 -1
- package/lib/module/credential/status/v1.3.3/01-status-list.js +24 -21
- package/lib/module/credential/status/v1.3.3/01-status-list.js.map +1 -1
- package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js +5 -26
- package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
- package/lib/module/credential/status/v1.3.3/03-get-status.js +27 -0
- package/lib/module/credential/status/v1.3.3/03-get-status.js.map +1 -0
- package/lib/module/credential/status/v1.3.3/index.js +5 -2
- package/lib/module/credential/status/v1.3.3/index.js.map +1 -1
- package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js +1 -1
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credential/status/api/index.d.ts +3 -1
- package/lib/typescript/credential/status/api/index.d.ts.map +1 -1
- package/lib/typescript/credential/status/api/status-assertion.d.ts +1 -1
- package/lib/typescript/credential/status/api/status-list.d.ts +27 -9
- package/lib/typescript/credential/status/api/status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/api/types.d.ts +20 -0
- package/lib/typescript/credential/status/api/types.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts +1 -0
- package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/02-verify-and-parse-status-list.d.ts.map +1 -1
- package/lib/typescript/credential/status/v1.3.3/03-get-status.d.ts +3 -0
- package/lib/typescript/credential/status/v1.3.3/03-get-status.d.ts.map +1 -0
- package/lib/typescript/credential/status/v1.3.3/index.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/index.d.ts +1 -1
- package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts +1 -1
- package/package.json +6 -6
- package/src/credential/status/README.md +15 -13
- package/src/credential/status/api/index.ts +3 -1
- package/src/credential/status/api/status-assertion.ts +1 -1
- package/src/credential/status/api/status-list.ts +35 -12
- package/src/credential/status/api/types.ts +27 -0
- package/src/credential/status/v1.3.3/01-status-list.ts +30 -18
- package/src/credential/status/v1.3.3/02-verify-and-parse-status-list.ts +5 -27
- package/src/credential/status/v1.3.3/03-get-status.ts +40 -0
- package/src/credential/status/v1.3.3/index.ts +4 -1
- package/src/credentials-catalogue/api/index.ts +1 -1
- package/src/credentials-catalogue/common/get-status-l10n-ids.ts +1 -1
|
@@ -31,8 +31,10 @@ graph TD;
|
|
|
31
31
|
1[verifyAndParseStatusAssertion]
|
|
32
32
|
2[getStatusList]
|
|
33
33
|
3[verifyAndParseStatusList]
|
|
34
|
+
4[getStatus]
|
|
34
35
|
0 --> 1
|
|
35
36
|
2 --> 3
|
|
37
|
+
3 --> 4
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
## Mapped results
|
|
@@ -104,24 +106,24 @@ const credentialIssuerUrl = "https://issuer.example.com";
|
|
|
104
106
|
|
|
105
107
|
const { issuerConf } = await wallet.CredentialIssuance.evaluateIssuerTrust(credentialIssuerUrl);
|
|
106
108
|
|
|
107
|
-
// Get the status list
|
|
108
|
-
const
|
|
109
|
-
credential,
|
|
110
|
-
|
|
109
|
+
// Get the status list token and credential reference index
|
|
110
|
+
const { statusList: statusListJwt, idx } =
|
|
111
|
+
await wallet.CredentialStatus.statusList.get(credential, format);
|
|
112
|
+
|
|
113
|
+
// Verify and parse the status list token
|
|
114
|
+
const statusList = await wallet.CredentialStatus.statusList.verifyAndParse(
|
|
115
|
+
issuerConf.keys,
|
|
116
|
+
statusListJwt,
|
|
111
117
|
);
|
|
112
118
|
|
|
113
|
-
//
|
|
114
|
-
const { status,
|
|
115
|
-
await wallet.CredentialStatus.statusList.verifyAndParse(
|
|
116
|
-
issuerConf.keys,
|
|
117
|
-
res
|
|
118
|
-
);
|
|
119
|
+
// Read the credential status from the decoded status list
|
|
120
|
+
const { status, rawStatus } = wallet.CredentialStatus.statusList.getStatus(statusList, idx);
|
|
119
121
|
|
|
120
122
|
return {
|
|
121
|
-
statusList
|
|
123
|
+
statusList,
|
|
122
124
|
status,
|
|
123
|
-
|
|
125
|
+
rawStatus,
|
|
124
126
|
};
|
|
125
127
|
```
|
|
126
128
|
|
|
127
|
-
</details>
|
|
129
|
+
</details>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../../../src","sources":["credential/status/api/index.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../../../src","sources":["credential/status/api/index.ts"],"mappings":";;;;;AAwBA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,2 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StatusListContent = exports.StatusList = void 0;
|
|
7
|
+
var _zod = require("zod");
|
|
8
|
+
var _zod2 = require("../../../utils/zod");
|
|
9
|
+
/**
|
|
10
|
+
* Common type for a parsed Status Assertion
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const StatusListBits = _zod.z.union([_zod.z.literal(1), _zod.z.literal(2), _zod.z.literal(4), _zod.z.literal(8)]);
|
|
14
|
+
const StatusListContent = _zod.z.object({
|
|
15
|
+
bits: StatusListBits,
|
|
16
|
+
lst: _zod.z.string().min(1),
|
|
17
|
+
aggregation_uri: _zod.z.url().optional()
|
|
18
|
+
});
|
|
19
|
+
exports.StatusListContent = StatusListContent;
|
|
20
|
+
const StatusList = _zod.z.object({
|
|
21
|
+
sub: _zod.z.url(),
|
|
22
|
+
iat: _zod2.UnixTime,
|
|
23
|
+
iss: _zod.z.url().optional(),
|
|
24
|
+
exp: _zod2.UnixTime.optional(),
|
|
25
|
+
ttl: _zod.z.number().positive().optional(),
|
|
26
|
+
status_list: StatusListContent
|
|
27
|
+
});
|
|
28
|
+
exports.StatusList = StatusList;
|
|
2
29
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/status/api/types.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["_zod","require","_zod2","StatusListBits","z","union","literal","StatusListContent","object","bits","lst","string","min","aggregation_uri","url","optional","exports","StatusList","sub","iat","UnixTime","iss","exp","ttl","number","positive","status_list"],"sourceRoot":"../../../../../src","sources":["credential/status/api/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA;AACA;AACA;;AAcA,MAAME,cAAc,GAAGC,MAAC,CAACC,KAAK,CAAC,CAC7BD,MAAC,CAACE,OAAO,CAAC,CAAC,CAAC,EACZF,MAAC,CAACE,OAAO,CAAC,CAAC,CAAC,EACZF,MAAC,CAACE,OAAO,CAAC,CAAC,CAAC,EACZF,MAAC,CAACE,OAAO,CAAC,CAAC,CAAC,CACb,CAAC;AAGK,MAAMC,iBAAiB,GAAGH,MAAC,CAACI,MAAM,CAAC;EACxCC,IAAI,EAAEN,cAAc;EACpBO,GAAG,EAAEN,MAAC,CAACO,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACtBC,eAAe,EAAET,MAAC,CAACU,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC;AACpC,CAAC,CAAC;AAACC,OAAA,CAAAT,iBAAA,GAAAA,iBAAA;AAGI,MAAMU,UAAU,GAAGb,MAAC,CAACI,MAAM,CAAC;EACjCU,GAAG,EAAEd,MAAC,CAACU,GAAG,CAAC,CAAC;EACZK,GAAG,EAAEC,cAAQ;EACbC,GAAG,EAAEjB,MAAC,CAACU,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACvBO,GAAG,EAAEF,cAAQ,CAACL,QAAQ,CAAC,CAAC;EACxBQ,GAAG,EAAEnB,MAAC,CAACoB,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACV,QAAQ,CAAC,CAAC;EACrCW,WAAW,EAAEnB;AACf,CAAC,CAAC;AAACS,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getStatusList = void 0;
|
|
6
|
+
exports.getStatusListByUri = exports.getStatusList = void 0;
|
|
7
7
|
var _ioReactNativeIso = require("@pagopa/io-react-native-iso18013");
|
|
8
8
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
|
9
9
|
var _jwtStatusList = require("@sd-jwt/jwt-status-list");
|
|
@@ -25,28 +25,23 @@ const getStatusListEntry = async (credential, format) => {
|
|
|
25
25
|
}
|
|
26
26
|
return statusListEntry;
|
|
27
27
|
};
|
|
28
|
-
const
|
|
28
|
+
const fetchStatusList = function (uri, appFetch) {
|
|
29
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
30
|
+
return appFetch(uri, {
|
|
31
|
+
headers: {
|
|
32
|
+
Accept: "application/statuslist+jwt",
|
|
33
|
+
...(options.cacheDisabled && {
|
|
34
|
+
"Cache-Control": "no-cache"
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}).then((0, _misc.hasStatusOrThrow)(200)).then(response => response.text());
|
|
38
|
+
};
|
|
39
|
+
const getStatusListByUri = async function (uri) {
|
|
29
40
|
let {
|
|
30
41
|
appFetch = fetch
|
|
31
|
-
} = arguments.length >
|
|
32
|
-
const {
|
|
33
|
-
uri,
|
|
34
|
-
idx
|
|
35
|
-
} = await getStatusListEntry(credential, format);
|
|
36
|
-
const fetchStatusList = function () {
|
|
37
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
38
|
-
return appFetch(uri, {
|
|
39
|
-
headers: {
|
|
40
|
-
Accept: "application/statuslist+jwt",
|
|
41
|
-
...(options.cacheDisabled && {
|
|
42
|
-
"Cache-Control": "no-cache"
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(response => response.text());
|
|
46
|
-
};
|
|
47
|
-
|
|
42
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
48
43
|
// When the HTTP response includes cache headers, fetch will return a cached response and the JWT might be expired
|
|
49
|
-
let statusList = await fetchStatusList();
|
|
44
|
+
let statusList = await fetchStatusList(uri, appFetch);
|
|
50
45
|
const decoded = (0, _ioReactNativeJwt.decode)(statusList);
|
|
51
46
|
const {
|
|
52
47
|
exp
|
|
@@ -55,14 +50,23 @@ const getStatusList = async function (credential, format) {
|
|
|
55
50
|
// If the status list JWT is expired, try to fetch it again bypassing the HTTP cache.
|
|
56
51
|
// If it is still expired after the refetch, `verifyAndParseStatusList` will throw.
|
|
57
52
|
if (exp && exp < Math.floor(Date.now() / 1000)) {
|
|
58
|
-
statusList = await fetchStatusList({
|
|
53
|
+
statusList = await fetchStatusList(uri, appFetch, {
|
|
59
54
|
cacheDisabled: true
|
|
60
55
|
});
|
|
61
56
|
}
|
|
57
|
+
return statusList;
|
|
58
|
+
};
|
|
59
|
+
exports.getStatusListByUri = getStatusListByUri;
|
|
60
|
+
const getStatusList = async (credential, format, context) => {
|
|
61
|
+
const {
|
|
62
|
+
uri,
|
|
63
|
+
idx
|
|
64
|
+
} = await getStatusListEntry(credential, format);
|
|
65
|
+
const statusList = await getStatusListByUri(uri, context);
|
|
62
66
|
return {
|
|
63
|
-
statusList,
|
|
64
67
|
uri,
|
|
65
68
|
idx,
|
|
69
|
+
statusList,
|
|
66
70
|
format: "jwt"
|
|
67
71
|
};
|
|
68
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ioReactNativeIso","require","_ioReactNativeJwt","_jwtStatusList","_errors","_misc","getStatusListEntry","credential","format","statusListEntry","_decoded$issuerAuth","decoded","CBOR","decode","issuerAuth","payload","status","status_list","getStatusListFromJWT","IoWalletError","
|
|
1
|
+
{"version":3,"names":["_ioReactNativeIso","require","_ioReactNativeJwt","_jwtStatusList","_errors","_misc","getStatusListEntry","credential","format","statusListEntry","_decoded$issuerAuth","decoded","CBOR","decode","issuerAuth","payload","status","status_list","getStatusListFromJWT","IoWalletError","fetchStatusList","uri","appFetch","options","arguments","length","undefined","headers","Accept","cacheDisabled","then","hasStatusOrThrow","response","text","getStatusListByUri","fetch","statusList","decodeJwt","exp","Math","floor","Date","now","exports","getStatusList","context","idx"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/01-status-list.ts"],"mappings":"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"}
|
|
@@ -5,31 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.verifyAndParseStatusList = void 0;
|
|
7
7
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
const CredentialStatusMap = {
|
|
14
|
-
0x00: "VALID",
|
|
15
|
-
0x01: "INVALID",
|
|
16
|
-
0x02: "SUSPENDED",
|
|
17
|
-
0x03: "UPDATE",
|
|
18
|
-
0x0b: "ATTRIBUTE_UPDATE"
|
|
19
|
-
};
|
|
20
|
-
const verifyAndParseStatusList = async (keys, _ref) => {
|
|
21
|
-
let {
|
|
22
|
-
statusList: rawStatusList,
|
|
23
|
-
idx
|
|
24
|
-
} = _ref;
|
|
25
|
-
await (0, _ioReactNativeJwt.verify)(rawStatusList, keys);
|
|
26
|
-
const statusList = (0, _jwtStatusList.getListFromStatusListJWT)(rawStatusList);
|
|
27
|
-
const statusBit = statusList.getStatus(idx);
|
|
28
|
-
const status = CredentialStatusMap[statusBit];
|
|
29
|
-
return {
|
|
30
|
-
status,
|
|
31
|
-
statusBit: `0x${statusBit.toString(16).padStart(2, "0").toUpperCase()}`
|
|
32
|
-
};
|
|
8
|
+
var _types = require("../api/types");
|
|
9
|
+
const verifyAndParseStatusList = async (keys, statusList) => {
|
|
10
|
+
await (0, _ioReactNativeJwt.verify)(statusList, keys);
|
|
11
|
+
return _types.StatusList.parse((0, _ioReactNativeJwt.decode)(statusList).payload);
|
|
33
12
|
};
|
|
34
13
|
exports.verifyAndParseStatusList = verifyAndParseStatusList;
|
|
35
14
|
//# sourceMappingURL=02-verify-and-parse-status-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","
|
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_types","verifyAndParseStatusList","keys","statusList","verify","StatusList","parse","decodeJwt","payload","exports"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/02-verify-and-parse-status-list.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,wBAAyD,GAAG,MAAAA,CACvEC,IAAI,EACJC,UAAU,KACP;EACH,MAAM,IAAAC,wBAAM,EAACD,UAAU,EAAED,IAAI,CAAC;EAC9B,OAAOG,iBAAU,CAACC,KAAK,CAAC,IAAAC,wBAAS,EAACJ,UAAU,CAAC,CAACK,OAAO,CAAC;AACxD,CAAC;AAACC,OAAA,CAAAR,wBAAA,GAAAA,wBAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getStatus = void 0;
|
|
7
|
+
var _jwtStatusList = require("@sd-jwt/jwt-status-list");
|
|
8
|
+
var _errors = require("../../../utils/errors");
|
|
9
|
+
/**
|
|
10
|
+
* Mapping of status bits to their corresponding meaning as defined in the specification.
|
|
11
|
+
* @see https://italia.github.io/eid-wallet-it-docs/releases/1.3.3/en/credential-revocation.html#token-status-lists
|
|
12
|
+
*/
|
|
13
|
+
const CredentialStatusMap = {
|
|
14
|
+
0x00: "VALID",
|
|
15
|
+
0x01: "INVALID",
|
|
16
|
+
0x02: "SUSPENDED",
|
|
17
|
+
0x03: "UPDATE",
|
|
18
|
+
0x0b: "ATTRIBUTE_UPDATE"
|
|
19
|
+
};
|
|
20
|
+
const formatStatusBit = statusBit => `0x${statusBit.toString(16).padStart(2, "0").toUpperCase()}`;
|
|
21
|
+
const getStatus = (statusList, idx) => {
|
|
22
|
+
const decodedStatusList = _jwtStatusList.StatusList.decompressStatusList(statusList.lst, statusList.bits);
|
|
23
|
+
const statusBit = decodedStatusList.getStatus(idx);
|
|
24
|
+
const status = CredentialStatusMap[statusBit];
|
|
25
|
+
if (!status) {
|
|
26
|
+
throw new _errors.IoWalletError(`Unsupported credential status bit: ${formatStatusBit(statusBit)}`);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
status,
|
|
30
|
+
rawStatus: formatStatusBit(statusBit)
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.getStatus = getStatus;
|
|
34
|
+
//# sourceMappingURL=03-get-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_jwtStatusList","require","_errors","CredentialStatusMap","formatStatusBit","statusBit","toString","padStart","toUpperCase","getStatus","statusList","idx","decodedStatusList","JwtStatusList","decompressStatusList","lst","bits","status","IoWalletError","rawStatus","exports"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/03-get-status.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA,MAAME,mBAAmB,GAAG;EAC1B,IAAI,EAAE,OAAO;EACb,IAAI,EAAE,SAAS;EACf,IAAI,EAAE,WAAW;EACjB,IAAI,EAAE,QAAQ;EACd,IAAI,EAAE;AACR,CAAU;AAIV,MAAMC,eAAe,GAAIC,SAAiB,IACvC,KAAIA,SAAS,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAACC,WAAW,CAAC,CAAE,EAAC;AAEvD,MAAMC,SAAqC,GAAGA,CAACC,UAAU,EAAEC,GAAG,KAAK;EACxE,MAAMC,iBAAiB,GAAGC,yBAAa,CAACC,oBAAoB,CAC1DJ,UAAU,CAACK,GAAG,EACdL,UAAU,CAACM,IACb,CAAC;EACD,MAAMX,SAAS,GAAGO,iBAAiB,CAACH,SAAS,CAACE,GAAG,CAAwB;EACzE,MAAMM,MAAM,GAAGd,mBAAmB,CAACE,SAAS,CAAC;EAE7C,IAAI,CAACY,MAAM,EAAE;IACX,MAAM,IAAIC,qBAAa,CACpB,sCAAqCd,eAAe,CAACC,SAAS,CAAE,EACnE,CAAC;EACH;EAEA,OAAO;IACLY,MAAM;IACNE,SAAS,EAAEf,eAAe,CAACC,SAAS;EACtC,CAAC;AACH,CAAC;AAACe,OAAA,CAAAX,SAAA,GAAAA,SAAA"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CredentialStatus = void 0;
|
|
7
7
|
var _statusList = require("./01-status-list");
|
|
8
8
|
var _verifyAndParseStatusList = require("./02-verify-and-parse-status-list");
|
|
9
|
+
var _getStatus = require("./03-get-status");
|
|
9
10
|
const CredentialStatus = {
|
|
10
11
|
statusAssertion: {
|
|
11
12
|
isSupported: false
|
|
@@ -13,7 +14,9 @@ const CredentialStatus = {
|
|
|
13
14
|
statusList: {
|
|
14
15
|
isSupported: true,
|
|
15
16
|
get: _statusList.getStatusList,
|
|
16
|
-
|
|
17
|
+
getByUri: _statusList.getStatusListByUri,
|
|
18
|
+
verifyAndParse: _verifyAndParseStatusList.verifyAndParseStatusList,
|
|
19
|
+
getStatus: _getStatus.getStatus
|
|
17
20
|
}
|
|
18
21
|
};
|
|
19
22
|
exports.CredentialStatus = CredentialStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_statusList","require","_verifyAndParseStatusList","CredentialStatus","statusAssertion","isSupported","statusList","get","getStatusList","verifyAndParse","verifyAndParseStatusList","exports"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/index.ts"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_statusList","require","_verifyAndParseStatusList","_getStatus","CredentialStatus","statusAssertion","isSupported","statusList","get","getStatusList","getByUri","getStatusListByUri","verifyAndParse","verifyAndParseStatusList","getStatus","exports"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/index.ts"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,MAAMG,gBAAqC,GAAG;EACnDC,eAAe,EAAE;IACfC,WAAW,EAAE;EACf,CAAC;EACDC,UAAU,EAAE;IACVD,WAAW,EAAE,IAAI;IACjBE,GAAG,EAAEC,yBAAa;IAClBC,QAAQ,EAAEC,8BAAkB;IAC5BC,cAAc,EAAEC,kDAAwB;IACxCC,SAAS,EAATA;EACF;AACF,CAAC;AAACC,OAAA,CAAAX,gBAAA,GAAAA,gBAAA"}
|
|
@@ -8,7 +8,7 @@ exports.getStatusL10nIds = void 0;
|
|
|
8
8
|
* Given a statusBit (e.g. "0x00", "0x0B") and a DigitalCredential from the
|
|
9
9
|
* catalogue, returns the matching l10n IDs or undefined if not found.
|
|
10
10
|
* The comparison is case-insensitive to handle uppercase statusBit values
|
|
11
|
-
* returned by
|
|
11
|
+
* returned by getStatus against lowercase keys in the catalogue.
|
|
12
12
|
*/
|
|
13
13
|
const getStatusL10nIds = (statusBit, credentialConfig) => {
|
|
14
14
|
const normalizedBit = statusBit.toLowerCase();
|
|
@@ -31,8 +31,10 @@ graph TD;
|
|
|
31
31
|
1[verifyAndParseStatusAssertion]
|
|
32
32
|
2[getStatusList]
|
|
33
33
|
3[verifyAndParseStatusList]
|
|
34
|
+
4[getStatus]
|
|
34
35
|
0 --> 1
|
|
35
36
|
2 --> 3
|
|
37
|
+
3 --> 4
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
## Mapped results
|
|
@@ -104,24 +106,24 @@ const credentialIssuerUrl = "https://issuer.example.com";
|
|
|
104
106
|
|
|
105
107
|
const { issuerConf } = await wallet.CredentialIssuance.evaluateIssuerTrust(credentialIssuerUrl);
|
|
106
108
|
|
|
107
|
-
// Get the status list
|
|
108
|
-
const
|
|
109
|
-
credential,
|
|
110
|
-
|
|
109
|
+
// Get the status list token and credential reference index
|
|
110
|
+
const { statusList: statusListJwt, idx } =
|
|
111
|
+
await wallet.CredentialStatus.statusList.get(credential, format);
|
|
112
|
+
|
|
113
|
+
// Verify and parse the status list token
|
|
114
|
+
const statusList = await wallet.CredentialStatus.statusList.verifyAndParse(
|
|
115
|
+
issuerConf.keys,
|
|
116
|
+
statusListJwt,
|
|
111
117
|
);
|
|
112
118
|
|
|
113
|
-
//
|
|
114
|
-
const { status,
|
|
115
|
-
await wallet.CredentialStatus.statusList.verifyAndParse(
|
|
116
|
-
issuerConf.keys,
|
|
117
|
-
res
|
|
118
|
-
);
|
|
119
|
+
// Read the credential status from the decoded status list
|
|
120
|
+
const { status, rawStatus } = wallet.CredentialStatus.statusList.getStatus(statusList, idx);
|
|
119
121
|
|
|
120
122
|
return {
|
|
121
|
-
statusList
|
|
123
|
+
statusList,
|
|
122
124
|
status,
|
|
123
|
-
|
|
125
|
+
rawStatus,
|
|
124
126
|
};
|
|
125
127
|
```
|
|
126
128
|
|
|
127
|
-
</details>
|
|
129
|
+
</details>
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* if (CredentialStatus.statusList.isSupported) {
|
|
8
|
-
* const statusList = await CredentialStatus.statusList.get(credential, format)
|
|
8
|
+
* const { statusList: statusListJwt, idx } = await CredentialStatus.statusList.get(credential, format)
|
|
9
|
+
* const statusList = await CredentialStatus.statusList.verifyAndParse(keys, statusListJwt)
|
|
10
|
+
* const status = CredentialStatus.statusList.getStatus(statusList, idx)
|
|
9
11
|
* }
|
|
10
12
|
*/
|
|
11
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/status/api/index.ts"],"mappings":"AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,cAAc,SAAS;AAAC"}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/status/api/index.ts"],"mappings":"AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,cAAc,SAAS;AAAC"}
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { UnixTime } from "../../../utils/zod";
|
|
1
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Common type for a parsed Status Assertion
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const StatusListBits = z.union([z.literal(1), z.literal(2), z.literal(4), z.literal(8)]);
|
|
9
|
+
export const StatusListContent = z.object({
|
|
10
|
+
bits: StatusListBits,
|
|
11
|
+
lst: z.string().min(1),
|
|
12
|
+
aggregation_uri: z.url().optional()
|
|
13
|
+
});
|
|
14
|
+
export const StatusList = z.object({
|
|
15
|
+
sub: z.url(),
|
|
16
|
+
iat: UnixTime,
|
|
17
|
+
iss: z.url().optional(),
|
|
18
|
+
exp: UnixTime.optional(),
|
|
19
|
+
ttl: z.number().positive().optional(),
|
|
20
|
+
status_list: StatusListContent
|
|
21
|
+
});
|
|
2
22
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/status/api/types.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["z","UnixTime","StatusListBits","union","literal","StatusListContent","object","bits","lst","string","min","aggregation_uri","url","optional","StatusList","sub","iat","iss","exp","ttl","number","positive","status_list"],"sourceRoot":"../../../../../src","sources":["credential/status/api/types.ts"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;;AAcA,MAAMC,cAAc,GAAGF,CAAC,CAACG,KAAK,CAAC,CAC7BH,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,EACZJ,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,EACZJ,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,EACZJ,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CACb,CAAC;AAGF,OAAO,MAAMC,iBAAiB,GAAGL,CAAC,CAACM,MAAM,CAAC;EACxCC,IAAI,EAAEL,cAAc;EACpBM,GAAG,EAAER,CAAC,CAACS,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACtBC,eAAe,EAAEX,CAAC,CAACY,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC;AACpC,CAAC,CAAC;AAGF,OAAO,MAAMC,UAAU,GAAGd,CAAC,CAACM,MAAM,CAAC;EACjCS,GAAG,EAAEf,CAAC,CAACY,GAAG,CAAC,CAAC;EACZI,GAAG,EAAEf,QAAQ;EACbgB,GAAG,EAAEjB,CAAC,CAACY,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACvBK,GAAG,EAAEjB,QAAQ,CAACY,QAAQ,CAAC,CAAC;EACxBM,GAAG,EAAEnB,CAAC,CAACoB,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACR,QAAQ,CAAC,CAAC;EACrCS,WAAW,EAAEjB;AACf,CAAC,CAAC"}
|
|
@@ -19,28 +19,23 @@ const getStatusListEntry = async (credential, format) => {
|
|
|
19
19
|
}
|
|
20
20
|
return statusListEntry;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const fetchStatusList = function (uri, appFetch) {
|
|
23
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
24
|
+
return appFetch(uri, {
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: "application/statuslist+jwt",
|
|
27
|
+
...(options.cacheDisabled && {
|
|
28
|
+
"Cache-Control": "no-cache"
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}).then(hasStatusOrThrow(200)).then(response => response.text());
|
|
32
|
+
};
|
|
33
|
+
export const getStatusListByUri = async function (uri) {
|
|
23
34
|
let {
|
|
24
35
|
appFetch = fetch
|
|
25
|
-
} = arguments.length >
|
|
26
|
-
const {
|
|
27
|
-
uri,
|
|
28
|
-
idx
|
|
29
|
-
} = await getStatusListEntry(credential, format);
|
|
30
|
-
const fetchStatusList = function () {
|
|
31
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
-
return appFetch(uri, {
|
|
33
|
-
headers: {
|
|
34
|
-
Accept: "application/statuslist+jwt",
|
|
35
|
-
...(options.cacheDisabled && {
|
|
36
|
-
"Cache-Control": "no-cache"
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}).then(hasStatusOrThrow(200)).then(response => response.text());
|
|
40
|
-
};
|
|
41
|
-
|
|
36
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
42
37
|
// When the HTTP response includes cache headers, fetch will return a cached response and the JWT might be expired
|
|
43
|
-
let statusList = await fetchStatusList();
|
|
38
|
+
let statusList = await fetchStatusList(uri, appFetch);
|
|
44
39
|
const decoded = decodeJwt(statusList);
|
|
45
40
|
const {
|
|
46
41
|
exp
|
|
@@ -49,14 +44,22 @@ export const getStatusList = async function (credential, format) {
|
|
|
49
44
|
// If the status list JWT is expired, try to fetch it again bypassing the HTTP cache.
|
|
50
45
|
// If it is still expired after the refetch, `verifyAndParseStatusList` will throw.
|
|
51
46
|
if (exp && exp < Math.floor(Date.now() / 1000)) {
|
|
52
|
-
statusList = await fetchStatusList({
|
|
47
|
+
statusList = await fetchStatusList(uri, appFetch, {
|
|
53
48
|
cacheDisabled: true
|
|
54
49
|
});
|
|
55
50
|
}
|
|
51
|
+
return statusList;
|
|
52
|
+
};
|
|
53
|
+
export const getStatusList = async (credential, format, context) => {
|
|
54
|
+
const {
|
|
55
|
+
uri,
|
|
56
|
+
idx
|
|
57
|
+
} = await getStatusListEntry(credential, format);
|
|
58
|
+
const statusList = await getStatusListByUri(uri, context);
|
|
56
59
|
return {
|
|
57
|
-
statusList,
|
|
58
60
|
uri,
|
|
59
61
|
idx,
|
|
62
|
+
statusList,
|
|
60
63
|
format: "jwt"
|
|
61
64
|
};
|
|
62
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CBOR","decode","decodeJwt","getStatusListFromJWT","IoWalletError","hasStatusOrThrow","getStatusListEntry","credential","format","statusListEntry","_decoded$issuerAuth","decoded","issuerAuth","payload","status","status_list","
|
|
1
|
+
{"version":3,"names":["CBOR","decode","decodeJwt","getStatusListFromJWT","IoWalletError","hasStatusOrThrow","getStatusListEntry","credential","format","statusListEntry","_decoded$issuerAuth","decoded","issuerAuth","payload","status","status_list","fetchStatusList","uri","appFetch","options","arguments","length","undefined","headers","Accept","cacheDisabled","then","response","text","getStatusListByUri","fetch","statusList","exp","Math","floor","Date","now","getStatusList","context","idx"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/01-status-list.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,kCAAkC;AACvD,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SACEC,oBAAoB,QAEf,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,gBAAgB,QAAQ,qBAAqB;AAItD,MAAMC,kBAAkB,GAAG,MAAAA,CACzBC,UAAkB,EAClBC,MAAwB,KACK;EAC7B,IAAIC,eAA4C;EAEhD,IAAID,MAAM,KAAK,UAAU,EAAE;IAAA,IAAAE,mBAAA;IACzB;IACA,MAAMC,OAAO,GAAG,MAAMX,IAAI,CAACC,MAAM,CAACM,UAAU,CAAC;IAC7CE,eAAe,IAAAC,mBAAA,GAAGC,OAAO,CAACC,UAAU,cAAAF,mBAAA,gBAAAA,mBAAA,GAAlBA,mBAAA,CAAoBG,OAAO,cAAAH,mBAAA,gBAAAA,mBAAA,GAA3BA,mBAAA,CAA6BI,MAAM,cAAAJ,mBAAA,uBAAnCA,mBAAA,CAAqCK,WAAW;EACpE;EAEA,IAAIP,MAAM,KAAK,WAAW,EAAE;IAC1BC,eAAe,GAAGN,oBAAoB,CAACI,UAAU,CAAC;EACpD;EAEA,IAAI,CAACE,eAAe,EAAE;IACpB,MAAM,IAAIL,aAAa,CAAC,+CAA+C,CAAC;EAC1E;EAEA,OAAOK,eAAe;AACxB,CAAC;AAED,MAAMO,eAAe,GAAG,SAAAA,CACtBC,GAAW,EACXC,QAA8B;EAAA,IAC9BC,OAAoC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,OAEzCF,QAAQ,CAACD,GAAG,EAAE;IACZM,OAAO,EAAE;MACPC,MAAM,EAAE,4BAA4B;MACpC,IAAIL,OAAO,CAACM,aAAa,IAAI;QAAE,eAAe,EAAE;MAAW,CAAC;IAC9D;EACF,CAAC,CAAC,CACCC,IAAI,CAACrB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAC3BqB,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAC;AAAA;AAExC,OAAO,MAAMC,kBAA6C,GAAG,eAAAA,CAC3DZ,GAAG,EAEA;EAAA,IADH;IAAEC,QAAQ,GAAGY;EAAM,CAAC,GAAAV,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEzB;EACA,IAAIW,UAAU,GAAG,MAAMf,eAAe,CAACC,GAAG,EAAEC,QAAQ,CAAC;EACrD,MAAMP,OAAO,GAAGT,SAAS,CAAC6B,UAAU,CAAC;EAErC,MAAM;IAAEC;EAAI,CAAC,GAAGrB,OAAO,CAACE,OAAO;;EAE/B;EACA;EACA,IAAImB,GAAG,IAAIA,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;IAC9CL,UAAU,GAAG,MAAMf,eAAe,CAACC,GAAG,EAAEC,QAAQ,EAAE;MAAEO,aAAa,EAAE;IAAK,CAAC,CAAC;EAC5E;EAEA,OAAOM,UAAU;AACnB,CAAC;AAED,OAAO,MAAMM,aAAmC,GAAG,MAAAA,CACjD9B,UAAU,EACVC,MAAM,EACN8B,OAAO,KACJ;EACH,MAAM;IAAErB,GAAG;IAAEsB;EAAI,CAAC,GAAG,MAAMjC,kBAAkB,CAACC,UAAU,EAAEC,MAAM,CAAC;EACjE,MAAMuB,UAAU,GAAG,MAAMF,kBAAkB,CAACZ,GAAG,EAAEqB,OAAO,CAAC;EACzD,OAAO;IAAErB,GAAG;IAAEsB,GAAG;IAAER,UAAU;IAAEvB,MAAM,EAAE;EAAM,CAAC;AAChD,CAAC"}
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import { verify } from "@pagopa/io-react-native-jwt";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
const CredentialStatusMap = {
|
|
8
|
-
0x00: "VALID",
|
|
9
|
-
0x01: "INVALID",
|
|
10
|
-
0x02: "SUSPENDED",
|
|
11
|
-
0x03: "UPDATE",
|
|
12
|
-
0x0b: "ATTRIBUTE_UPDATE"
|
|
13
|
-
};
|
|
14
|
-
export const verifyAndParseStatusList = async (keys, _ref) => {
|
|
15
|
-
let {
|
|
16
|
-
statusList: rawStatusList,
|
|
17
|
-
idx
|
|
18
|
-
} = _ref;
|
|
19
|
-
await verify(rawStatusList, keys);
|
|
20
|
-
const statusList = getListFromStatusListJWT(rawStatusList);
|
|
21
|
-
const statusBit = statusList.getStatus(idx);
|
|
22
|
-
const status = CredentialStatusMap[statusBit];
|
|
23
|
-
return {
|
|
24
|
-
status,
|
|
25
|
-
statusBit: `0x${statusBit.toString(16).padStart(2, "0").toUpperCase()}`
|
|
26
|
-
};
|
|
1
|
+
import { decode as decodeJwt, verify } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { StatusList } from "../api/types";
|
|
3
|
+
export const verifyAndParseStatusList = async (keys, statusList) => {
|
|
4
|
+
await verify(statusList, keys);
|
|
5
|
+
return StatusList.parse(decodeJwt(statusList).payload);
|
|
27
6
|
};
|
|
28
7
|
//# sourceMappingURL=02-verify-and-parse-status-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["decode","decodeJwt","verify","StatusList","verifyAndParseStatusList","keys","statusList","parse","payload"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/02-verify-and-parse-status-list.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,EAAEC,MAAM,QAAQ,6BAA6B;AAEzE,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,wBAAyD,GAAG,MAAAA,CACvEC,IAAI,EACJC,UAAU,KACP;EACH,MAAMJ,MAAM,CAACI,UAAU,EAAED,IAAI,CAAC;EAC9B,OAAOF,UAAU,CAACI,KAAK,CAACN,SAAS,CAACK,UAAU,CAAC,CAACE,OAAO,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StatusList as JwtStatusList } from "@sd-jwt/jwt-status-list";
|
|
2
|
+
import { IoWalletError } from "../../../utils/errors";
|
|
3
|
+
/**
|
|
4
|
+
* Mapping of status bits to their corresponding meaning as defined in the specification.
|
|
5
|
+
* @see https://italia.github.io/eid-wallet-it-docs/releases/1.3.3/en/credential-revocation.html#token-status-lists
|
|
6
|
+
*/
|
|
7
|
+
const CredentialStatusMap = {
|
|
8
|
+
0x00: "VALID",
|
|
9
|
+
0x01: "INVALID",
|
|
10
|
+
0x02: "SUSPENDED",
|
|
11
|
+
0x03: "UPDATE",
|
|
12
|
+
0x0b: "ATTRIBUTE_UPDATE"
|
|
13
|
+
};
|
|
14
|
+
const formatStatusBit = statusBit => `0x${statusBit.toString(16).padStart(2, "0").toUpperCase()}`;
|
|
15
|
+
export const getStatus = (statusList, idx) => {
|
|
16
|
+
const decodedStatusList = JwtStatusList.decompressStatusList(statusList.lst, statusList.bits);
|
|
17
|
+
const statusBit = decodedStatusList.getStatus(idx);
|
|
18
|
+
const status = CredentialStatusMap[statusBit];
|
|
19
|
+
if (!status) {
|
|
20
|
+
throw new IoWalletError(`Unsupported credential status bit: ${formatStatusBit(statusBit)}`);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
status,
|
|
24
|
+
rawStatus: formatStatusBit(statusBit)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=03-get-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StatusList","JwtStatusList","IoWalletError","CredentialStatusMap","formatStatusBit","statusBit","toString","padStart","toUpperCase","getStatus","statusList","idx","decodedStatusList","decompressStatusList","lst","bits","status","rawStatus"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/03-get-status.ts"],"mappings":"AAAA,SAASA,UAAU,IAAIC,aAAa,QAAQ,yBAAyB;AACrE,SAASC,aAAa,QAAQ,uBAAuB;AAGrD;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG;EAC1B,IAAI,EAAE,OAAO;EACb,IAAI,EAAE,SAAS;EACf,IAAI,EAAE,WAAW;EACjB,IAAI,EAAE,QAAQ;EACd,IAAI,EAAE;AACR,CAAU;AAIV,MAAMC,eAAe,GAAIC,SAAiB,IACvC,KAAIA,SAAS,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAACC,WAAW,CAAC,CAAE,EAAC;AAE9D,OAAO,MAAMC,SAAqC,GAAGA,CAACC,UAAU,EAAEC,GAAG,KAAK;EACxE,MAAMC,iBAAiB,GAAGX,aAAa,CAACY,oBAAoB,CAC1DH,UAAU,CAACI,GAAG,EACdJ,UAAU,CAACK,IACb,CAAC;EACD,MAAMV,SAAS,GAAGO,iBAAiB,CAACH,SAAS,CAACE,GAAG,CAAwB;EACzE,MAAMK,MAAM,GAAGb,mBAAmB,CAACE,SAAS,CAAC;EAE7C,IAAI,CAACW,MAAM,EAAE;IACX,MAAM,IAAId,aAAa,CACpB,sCAAqCE,eAAe,CAACC,SAAS,CAAE,EACnE,CAAC;EACH;EAEA,OAAO;IACLW,MAAM;IACNC,SAAS,EAAEb,eAAe,CAACC,SAAS;EACtC,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { getStatusList } from "./01-status-list";
|
|
1
|
+
import { getStatusList, getStatusListByUri } from "./01-status-list";
|
|
2
2
|
import { verifyAndParseStatusList } from "./02-verify-and-parse-status-list";
|
|
3
|
+
import { getStatus } from "./03-get-status";
|
|
3
4
|
export const CredentialStatus = {
|
|
4
5
|
statusAssertion: {
|
|
5
6
|
isSupported: false
|
|
@@ -7,7 +8,9 @@ export const CredentialStatus = {
|
|
|
7
8
|
statusList: {
|
|
8
9
|
isSupported: true,
|
|
9
10
|
get: getStatusList,
|
|
10
|
-
|
|
11
|
+
getByUri: getStatusListByUri,
|
|
12
|
+
verifyAndParse: verifyAndParseStatusList,
|
|
13
|
+
getStatus
|
|
11
14
|
}
|
|
12
15
|
};
|
|
13
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getStatusList","verifyAndParseStatusList","CredentialStatus","statusAssertion","isSupported","statusList","get","verifyAndParse"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/index.ts"],"mappings":"AACA,SAASA,aAAa,QAAQ,kBAAkB;
|
|
1
|
+
{"version":3,"names":["getStatusList","getStatusListByUri","verifyAndParseStatusList","getStatus","CredentialStatus","statusAssertion","isSupported","statusList","get","getByUri","verifyAndParse"],"sourceRoot":"../../../../../src","sources":["credential/status/v1.3.3/index.ts"],"mappings":"AACA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,kBAAkB;AACpE,SAASC,wBAAwB,QAAQ,mCAAmC;AAC5E,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,OAAO,MAAMC,gBAAqC,GAAG;EACnDC,eAAe,EAAE;IACfC,WAAW,EAAE;EACf,CAAC;EACDC,UAAU,EAAE;IACVD,WAAW,EAAE,IAAI;IACjBE,GAAG,EAAER,aAAa;IAClBS,QAAQ,EAAER,kBAAkB;IAC5BS,cAAc,EAAER,wBAAwB;IACxCC;EACF;AACF,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Given a statusBit (e.g. "0x00", "0x0B") and a DigitalCredential from the
|
|
3
3
|
* catalogue, returns the matching l10n IDs or undefined if not found.
|
|
4
4
|
* The comparison is case-insensitive to handle uppercase statusBit values
|
|
5
|
-
* returned by
|
|
5
|
+
* returned by getStatus against lowercase keys in the catalogue.
|
|
6
6
|
*/
|
|
7
7
|
export const getStatusL10nIds = (statusBit, credentialConfig) => {
|
|
8
8
|
const normalizedBit = statusBit.toLowerCase();
|