@sphereon/ssi-sdk.vc-status-list 0.33.0 → 0.33.1-feature.vcdm2.tsup.18

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.
Files changed (51) hide show
  1. package/dist/index.cjs +993 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +275 -0
  4. package/dist/index.d.ts +273 -3
  5. package/dist/index.js +944 -19
  6. package/dist/index.js.map +1 -1
  7. package/package.json +26 -16
  8. package/src/functions.ts +2 -0
  9. package/src/impl/encoding/cbor.ts +1 -1
  10. package/src/types/index.ts +1 -1
  11. package/dist/functions.d.ts +0 -69
  12. package/dist/functions.d.ts.map +0 -1
  13. package/dist/functions.js +0 -200
  14. package/dist/functions.js.map +0 -1
  15. package/dist/impl/IStatusList.d.ts +0 -26
  16. package/dist/impl/IStatusList.d.ts.map +0 -1
  17. package/dist/impl/IStatusList.js +0 -3
  18. package/dist/impl/IStatusList.js.map +0 -1
  19. package/dist/impl/OAuthStatusList.d.ts +0 -21
  20. package/dist/impl/OAuthStatusList.d.ts.map +0 -1
  21. package/dist/impl/OAuthStatusList.js +0 -155
  22. package/dist/impl/OAuthStatusList.js.map +0 -1
  23. package/dist/impl/StatusList2021.d.ts +0 -16
  24. package/dist/impl/StatusList2021.d.ts.map +0 -1
  25. package/dist/impl/StatusList2021.js +0 -186
  26. package/dist/impl/StatusList2021.js.map +0 -1
  27. package/dist/impl/StatusListFactory.d.ts +0 -11
  28. package/dist/impl/StatusListFactory.d.ts.map +0 -1
  29. package/dist/impl/StatusListFactory.js +0 -32
  30. package/dist/impl/StatusListFactory.js.map +0 -1
  31. package/dist/impl/encoding/cbor.d.ts +0 -6
  32. package/dist/impl/encoding/cbor.d.ts.map +0 -1
  33. package/dist/impl/encoding/cbor.js +0 -140
  34. package/dist/impl/encoding/cbor.js.map +0 -1
  35. package/dist/impl/encoding/common.d.ts +0 -12
  36. package/dist/impl/encoding/common.d.ts.map +0 -1
  37. package/dist/impl/encoding/common.js +0 -17
  38. package/dist/impl/encoding/common.js.map +0 -1
  39. package/dist/impl/encoding/jwt.d.ts +0 -9
  40. package/dist/impl/encoding/jwt.d.ts.map +0 -1
  41. package/dist/impl/encoding/jwt.js +0 -74
  42. package/dist/impl/encoding/jwt.js.map +0 -1
  43. package/dist/index.d.ts.map +0 -1
  44. package/dist/types/index.d.ts +0 -209
  45. package/dist/types/index.d.ts.map +0 -1
  46. package/dist/types/index.js +0 -15
  47. package/dist/types/index.js.map +0 -1
  48. package/dist/utils.d.ts +0 -17
  49. package/dist/utils.d.ts.map +0 -1
  50. package/dist/utils.js +0 -88
  51. package/dist/utils.js.map +0 -1
@@ -1,140 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.decodeStatusListCWT = exports.createSignedCbor = void 0;
16
- const jwt_status_list_1 = require("@sd-jwt/jwt-status-list");
17
- const pako_1 = require("pako");
18
- const kmp_cbor_1 = require("@sphereon/kmp-cbor");
19
- const base64url_1 = __importDefault(require("base64url"));
20
- const common_1 = require("./common");
21
- const cbor = kmp_cbor_1.com.sphereon.cbor;
22
- const kmp = kmp_cbor_1.com.sphereon.kmp;
23
- const decompressRawStatusList = jwt_status_list_1.StatusList.decodeStatusList.bind(jwt_status_list_1.StatusList);
24
- const CWT_CLAIMS = {
25
- SUBJECT: 2,
26
- ISSUER: 1,
27
- ISSUED_AT: 6,
28
- EXPIRATION: 4,
29
- TIME_TO_LIVE: 65534,
30
- STATUS_LIST: 65533,
31
- };
32
- const createSignedCbor = (context, statusList, issuerString, id, expiresAt, keyRef) => __awaiter(void 0, void 0, void 0, function* () {
33
- const identifier = yield (0, common_1.resolveIdentifier)(context, issuerString, keyRef);
34
- const encodeStatusList = statusList.encodeStatusList();
35
- const compressedList = (0, pako_1.deflate)(encodeStatusList, { level: 9 });
36
- const compressedBytes = new Int8Array(compressedList);
37
- const statusListMap = new cbor.CborMap(kmp_cbor_1.kotlin.collections.KtMutableMap.fromJsMap(new Map([
38
- [new cbor.CborString('bits'), new cbor.CborUInt(kmp.LongKMP.fromNumber(statusList.getBitsPerStatus()))],
39
- [new cbor.CborString('lst'), new cbor.CborByteString(compressedBytes)],
40
- ])));
41
- const protectedHeader = new cbor.CborMap(kmp_cbor_1.kotlin.collections.KtMutableMap.fromJsMap(new Map([[new cbor.CborUInt(kmp.LongKMP.fromNumber(16)), new cbor.CborString('statuslist+cwt')]])));
42
- const protectedHeaderEncoded = cbor.Cbor.encode(protectedHeader);
43
- const claimsMap = buildClaimsMap(id, issuerString, statusListMap, expiresAt);
44
- const claimsEncoded = cbor.Cbor.encode(claimsMap);
45
- const signedCWT = yield context.agent.keyManagerSign({
46
- keyRef: identifier.kmsKeyRef,
47
- data: base64url_1.default.encode(Buffer.from(claimsEncoded)), // TODO test on RN
48
- encoding: undefined,
49
- });
50
- const protectedHeaderEncodedInt8 = new Int8Array(protectedHeaderEncoded);
51
- const claimsEncodedInt8 = new Int8Array(claimsEncoded);
52
- const signatureBytes = base64url_1.default.decode(signedCWT);
53
- const signatureInt8 = new Int8Array(Buffer.from(signatureBytes));
54
- const cwtArrayElements = [
55
- new cbor.CborByteString(protectedHeaderEncodedInt8),
56
- new cbor.CborByteString(claimsEncodedInt8),
57
- new cbor.CborByteString(signatureInt8),
58
- ];
59
- const cwtArray = new cbor.CborArray(kmp_cbor_1.kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
60
- const cwtEncoded = cbor.Cbor.encode(cwtArray);
61
- const cwtBuffer = Buffer.from(cwtEncoded);
62
- return {
63
- statusListCredential: base64url_1.default.encode(cwtBuffer),
64
- encodedList: base64url_1.default.encode(compressedList), // JS in @sd-jwt/jwt-status-list drops it in like this, so keep the same method
65
- };
66
- });
67
- exports.createSignedCbor = createSignedCbor;
68
- function buildClaimsMap(id, issuerString, statusListMap, expiresAt) {
69
- const ttl = 65535; // FIXME figure out what value should be / come from and what the difference is with exp
70
- const claimsEntries = [
71
- [new cbor.CborUInt(kmp.LongKMP.fromNumber(CWT_CLAIMS.SUBJECT)), new cbor.CborString(id)], // "sub"
72
- [new cbor.CborUInt(kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUER)), new cbor.CborString(issuerString)], // "iss"
73
- [
74
- new cbor.CborUInt(kmp.LongKMP.fromNumber(CWT_CLAIMS.ISSUED_AT)),
75
- new cbor.CborUInt(kmp.LongKMP.fromNumber(Math.floor(Date.now() / 1000))), // "iat"
76
- ],
77
- ];
78
- if (expiresAt) {
79
- claimsEntries.push([
80
- new cbor.CborUInt(kmp.LongKMP.fromNumber(CWT_CLAIMS.EXPIRATION)),
81
- new cbor.CborUInt(kmp.LongKMP.fromNumber(Math.floor(expiresAt.getTime() / 1000))), // "exp"
82
- ]);
83
- }
84
- if (ttl) {
85
- claimsEntries.push([
86
- new cbor.CborUInt(kmp.LongKMP.fromNumber(CWT_CLAIMS.TIME_TO_LIVE)),
87
- new cbor.CborUInt(kmp.LongKMP.fromNumber(ttl)), // "time to live"
88
- ]);
89
- }
90
- claimsEntries.push([new cbor.CborUInt(kmp.LongKMP.fromNumber(CWT_CLAIMS.STATUS_LIST)), statusListMap]);
91
- const claimsMap = new cbor.CborMap(kmp_cbor_1.kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)));
92
- return claimsMap;
93
- }
94
- const getCborValueFromMap = (map, key) => {
95
- const value = getCborOptionalValueFromMap(map, key);
96
- if (value === undefined) {
97
- throw new Error(`Required claim ${key} not found`);
98
- }
99
- return value;
100
- };
101
- const getCborOptionalValueFromMap = (map, key) => {
102
- const value = map.get(new kmp_cbor_1.com.sphereon.cbor.CborUInt(kmp.LongKMP.fromNumber(key)));
103
- if (!value) {
104
- return undefined;
105
- }
106
- return value.value;
107
- };
108
- const decodeStatusListCWT = (cwt) => {
109
- const encodedCbor = base64url_1.default.toBuffer(cwt);
110
- const encodedCborArray = new Int8Array(encodedCbor);
111
- const decodedCbor = kmp_cbor_1.com.sphereon.cbor.Cbor.decode(encodedCborArray);
112
- if (!(decodedCbor instanceof kmp_cbor_1.com.sphereon.cbor.CborArray)) {
113
- throw new Error('Invalid CWT format: Expected a CBOR array');
114
- }
115
- const [, payload] = decodedCbor.value.asJsArrayView();
116
- if (!(payload instanceof kmp_cbor_1.com.sphereon.cbor.CborByteString)) {
117
- throw new Error('Invalid payload format: Expected a CBOR ByteString');
118
- }
119
- const claims = kmp_cbor_1.com.sphereon.cbor.Cbor.decode(payload.value);
120
- if (!(claims instanceof kmp_cbor_1.com.sphereon.cbor.CborMap)) {
121
- throw new Error('Invalid claims format: Expected a CBOR map');
122
- }
123
- const claimsMap = claims.value.asJsMapView();
124
- const statusListMap = claimsMap.get(new kmp_cbor_1.com.sphereon.cbor.CborUInt(kmp.LongKMP.fromNumber(65533))).value.asJsMapView();
125
- const bits = Number(statusListMap.get(new kmp_cbor_1.com.sphereon.cbor.CborString('bits')).value);
126
- const decoded = new Uint8Array(statusListMap.get(new kmp_cbor_1.com.sphereon.cbor.CborString('lst')).value);
127
- const uint8Array = (0, pako_1.inflate)(decoded);
128
- const rawStatusList = decompressRawStatusList(uint8Array, bits);
129
- const statusList = new jwt_status_list_1.StatusList(rawStatusList, bits);
130
- return {
131
- issuer: getCborValueFromMap(claimsMap, CWT_CLAIMS.ISSUER),
132
- id: getCborValueFromMap(claimsMap, CWT_CLAIMS.SUBJECT),
133
- statusList,
134
- iat: Number(getCborValueFromMap(claimsMap, CWT_CLAIMS.ISSUED_AT)),
135
- exp: getCborOptionalValueFromMap(claimsMap, CWT_CLAIMS.EXPIRATION),
136
- ttl: getCborOptionalValueFromMap(claimsMap, CWT_CLAIMS.TIME_TO_LIVE),
137
- };
138
- };
139
- exports.decodeStatusListCWT = decodeStatusListCWT;
140
- //# sourceMappingURL=cbor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cbor.js","sourceRoot":"","sources":["../../../src/impl/encoding/cbor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAoD;AACpD,+BAAuC;AACvC,iDAAgD;AAChD,0DAAiC;AAEjC,qCAAsE;AAGtE,MAAM,IAAI,GAAG,cAAG,CAAC,QAAQ,CAAC,IAAI,CAAA;AAC9B,MAAM,GAAG,GAAG,cAAG,CAAC,QAAQ,CAAC,GAAG,CAAA;AAC5B,MAAM,uBAAuB,GAAI,4BAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,4BAAU,CAAC,CAAA;AAErF,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,KAAK;CACV,CAAA;AAEH,MAAM,gBAAgB,GAAG,CAC9B,OAAyB,EACzB,UAAsB,EACtB,YAAoB,EACpB,EAAU,EACV,SAAgB,EAChB,MAAe,EACgB,EAAE;IACjC,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAiB,EAAC,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;IAEzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;IACtD,MAAM,cAAc,GAAG,IAAA,cAAO,EAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;IAC9D,MAAM,eAAe,GAAG,IAA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Q,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAChG,MAAM,UAAU,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,CAAA;IACnC,MAAM,aAAa,GAAG,uBAAuB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC/D,MAAM,UAAU,GAAG,IAAI,4BAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAA;IAEtD,OAAO;QACL,MAAM,EAAE,mBAAmB,CAAS,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC;QACjE,EAAE,EAAE,mBAAmB,CAAS,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC;QAC9D,UAAU;QACV,GAAG,EAAE,MAAM,CAAC,mBAAmB,CAAS,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;QACzE,GAAG,EAAE,2BAA2B,CAAS,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC;QAC1E,GAAG,EAAE,2BAA2B,CAAS,SAAS,EAAE,UAAU,CAAC,YAAY,CAAC;KAC7E,CAAA;AACH,CAAC,CAAA;AArCY,QAAA,mBAAmB,uBAqC/B"}
@@ -1,12 +0,0 @@
1
- import { IRequiredContext } from '../../types';
2
- import { StatusList } from '@sd-jwt/jwt-status-list';
3
- export interface DecodedStatusListPayload {
4
- issuer: string;
5
- id: string;
6
- statusList: StatusList;
7
- exp?: number;
8
- ttl?: number;
9
- iat: number;
10
- }
11
- export declare const resolveIdentifier: (context: IRequiredContext, issuer: string, keyRef?: string) => Promise<import("@sphereon/ssi-sdk-ext.identifier-resolution").ManagedIdentifierResult>;
12
- //# sourceMappingURL=common.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/impl/encoding/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,UAAU,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,iBAAiB,YAAmB,gBAAgB,UAAU,MAAM,WAAW,MAAM,2FAOjG,CAAA"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.resolveIdentifier = void 0;
13
- const resolveIdentifier = (context, issuer, keyRef) => __awaiter(void 0, void 0, void 0, function* () {
14
- return yield context.agent.identifierManagedGet(Object.assign({ identifier: issuer, vmRelationship: 'assertionMethod', offlineWhenNoDIDRegistered: true }, (keyRef && { kmsKeyRef: keyRef })));
15
- });
16
- exports.resolveIdentifier = resolveIdentifier;
17
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/impl/encoding/common.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYO,MAAM,iBAAiB,GAAG,CAAO,OAAyB,EAAE,MAAc,EAAE,MAAe,EAAE,EAAE;IACpG,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,oBAAoB,iBAC7C,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,iBAAiB,EACjC,0BAA0B,EAAE,IAAI,IAC7B,CAAC,MAAM,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,EACpC,CAAA;AACJ,CAAC,CAAA,CAAA;AAPY,QAAA,iBAAiB,qBAO7B"}
@@ -1,9 +0,0 @@
1
- import { CompactJWT, JoseSignatureAlgorithm } from '@sphereon/ssi-types';
2
- import { StatusList } from '@sd-jwt/jwt-status-list';
3
- import { IRequiredContext, SignedStatusListData } from '../../types';
4
- import { DecodedStatusListPayload } from './common';
5
- import { TKeyType } from '@veramo/core';
6
- export declare const createSignedJwt: (context: IRequiredContext, statusList: StatusList, issuerString: string, id: string, expiresAt?: Date, keyRef?: string) => Promise<SignedStatusListData>;
7
- export declare const decodeStatusListJWT: (jwt: CompactJWT) => DecodedStatusListPayload;
8
- export declare const getSigningAlgo: (type: TKeyType) => JoseSignatureAlgorithm;
9
- //# sourceMappingURL=jwt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../src/impl/encoding/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAA0B,UAAU,EAAuD,MAAM,yBAAyB,CAAA;AAGjI,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAqB,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAKvC,eAAO,MAAM,eAAe,YACjB,gBAAgB,cACb,UAAU,gBACR,MAAM,MAChB,MAAM,cACE,IAAI,WACP,MAAM,KACd,OAAO,CAAC,oBAAoB,CA0B9B,CAAA;AAED,eAAO,MAAM,mBAAmB,QAAS,UAAU,KAAG,wBAkBrD,CAAA;AAED,eAAO,MAAM,cAAc,SAAU,QAAQ,KAAG,sBAa/C,CAAA"}
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getSigningAlgo = exports.decodeStatusListJWT = exports.createSignedJwt = void 0;
16
- const ssi_types_1 = require("@sphereon/ssi-types");
17
- const jwt_status_list_1 = require("@sd-jwt/jwt-status-list");
18
- const base64url_1 = __importDefault(require("base64url"));
19
- const common_1 = require("./common");
20
- const ssi_sdk_ext_identifier_resolution_1 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
21
- const STATUS_LIST_JWT_TYP = 'statuslist+jwt';
22
- const createSignedJwt = (context, statusList, issuerString, id, expiresAt, keyRef) => __awaiter(void 0, void 0, void 0, function* () {
23
- const identifier = yield (0, common_1.resolveIdentifier)(context, issuerString, keyRef);
24
- const resolution = yield (0, ssi_sdk_ext_identifier_resolution_1.ensureManagedIdentifierResult)(identifier, context);
25
- const payload = Object.assign({ iss: issuerString, sub: id, iat: Math.floor(Date.now() / 1000) }, (expiresAt && { exp: Math.floor(expiresAt.getTime() / 1000) }));
26
- const header = {
27
- alg: (0, exports.getSigningAlgo)(resolution.key.type),
28
- typ: STATUS_LIST_JWT_TYP,
29
- };
30
- const values = (0, jwt_status_list_1.createHeaderAndPayload)(statusList, payload, header);
31
- const signedJwt = yield context.agent.jwtCreateJwsCompactSignature({
32
- issuer: Object.assign(Object.assign({}, identifier), { noIssPayloadUpdate: false }),
33
- protectedHeader: values.header,
34
- payload: values.payload,
35
- });
36
- return {
37
- statusListCredential: signedJwt.jwt,
38
- encodedList: values.payload.status_list.lst,
39
- };
40
- });
41
- exports.createSignedJwt = createSignedJwt;
42
- const decodeStatusListJWT = (jwt) => {
43
- const [, payloadBase64] = jwt.split('.');
44
- const payload = JSON.parse(base64url_1.default.decode(payloadBase64));
45
- if (!payload.iss || !payload.sub || !payload.status_list) {
46
- throw new Error('Missing required fields in JWT payload');
47
- }
48
- const statusList = jwt_status_list_1.StatusList.decompressStatusList(payload.status_list.lst, payload.status_list.bits);
49
- return {
50
- issuer: payload.iss,
51
- id: payload.sub,
52
- statusList,
53
- exp: payload.exp,
54
- ttl: payload.ttl,
55
- iat: payload.iat,
56
- };
57
- };
58
- exports.decodeStatusListJWT = decodeStatusListJWT;
59
- const getSigningAlgo = (type) => {
60
- switch (type) {
61
- case 'Ed25519':
62
- return ssi_types_1.JoseSignatureAlgorithm.EdDSA;
63
- case 'Secp256k1':
64
- return ssi_types_1.JoseSignatureAlgorithm.ES256K;
65
- case 'Secp256r1':
66
- return ssi_types_1.JoseSignatureAlgorithm.ES256;
67
- case 'RSA':
68
- return ssi_types_1.JoseSignatureAlgorithm.RS256;
69
- default:
70
- throw Error('Key type not yet supported');
71
- }
72
- };
73
- exports.getSigningAlgo = getSigningAlgo;
74
- //# sourceMappingURL=jwt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../src/impl/encoding/jwt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAwE;AACxE,6DAAiI;AACjI,0DAAiC;AAGjC,qCAAsE;AAEtE,mGAA2F;AAE3F,MAAM,mBAAmB,GAAG,gBAAgB,CAAA;AAErC,MAAM,eAAe,GAAG,CAC7B,OAAyB,EACzB,UAAsB,EACtB,YAAoB,EACpB,EAAU,EACV,SAAgB,EAChB,MAAe,EACgB,EAAE;IACjC,MAAM,UAAU,GAAG,MA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BAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAA;IAE3D,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC3D,CAAC;IAED,MAAM,UAAU,GAAG,4BAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAErG,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,GAAG;QACnB,EAAE,EAAE,OAAO,CAAC,GAAG;QACf,UAAU;QACV,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAA;AACH,CAAC,CAAA;AAlBY,QAAA,mBAAmB,uBAkB/B;AAEM,MAAM,cAAc,GAAG,CAAC,IAAc,EAA0B,EAAE;IACvE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,kCAAsB,CAAC,KAAK,CAAA;QACrC,KAAK,WAAW;YACd,OAAO,kCAAsB,CAAC,MAAM,CAAA;QACtC,KAAK,WAAW;YACd,OAAO,kCAAsB,CAAC,KAAK,CAAA;QACrC,KAAK,KAAK;YACR,OAAO,kCAAsB,CAAC,KAAK,CAAA;QACrC;YACE,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC7C,CAAC;AACH,CAAC,CAAA;AAbY,QAAA,cAAc,kBAa1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;GACG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
@@ -1,209 +0,0 @@
1
- import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
2
- import { ICredential, ICredentialStatus, IIssuer, IVerifiableCredential, OrPromise, ProofFormat, StatusListCredential, StatusListCredentialIdMode, StatusListDriverType, StatusListIndexingDirection, StatusListType, StatusPurpose2021 } from '@sphereon/ssi-types';
3
- import { CredentialPayload, IAgentContext, ICredentialIssuer, ICredentialPlugin, ICredentialVerifier, IKeyManager, IPluginMethodMap } from '@veramo/core';
4
- import { DataSource } from 'typeorm';
5
- import { BitsPerStatus } from '@sd-jwt/jwt-status-list/dist';
6
- import { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc';
7
- import { StatusListOpts } from '@sphereon/oid4vci-common';
8
- export declare enum StatusOAuth {
9
- Valid = 0,
10
- Invalid = 1,
11
- Suspended = 2
12
- }
13
- export declare enum Status2021 {
14
- Valid = 0,
15
- Invalid = 1
16
- }
17
- export type StatusList2021Args = {
18
- indexingDirection: StatusListIndexingDirection;
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;
32
- keyRef?: string;
33
- statusList2021?: StatusList2021Args;
34
- oauthStatusList?: OAuthStatusListArgs;
35
- driverType?: StatusListDriverType;
36
- };
37
- export type UpdateStatusList2021Args = {
38
- statusPurpose: StatusPurpose2021;
39
- };
40
- export type UpdateOAuthStatusListArgs = {
41
- bitsPerStatus: BitsPerStatus;
42
- expiresAt?: Date;
43
- };
44
- export interface UpdateStatusListFromEncodedListArgs {
45
- type?: StatusListType;
46
- statusListIndex: number | string;
47
- value: boolean;
48
- proofFormat?: ProofFormat;
49
- keyRef?: string;
50
- correlationId?: string;
51
- encodedList: string;
52
- issuer: string | IIssuer;
53
- id: string;
54
- statusList2021?: UpdateStatusList2021Args;
55
- oauthStatusList?: UpdateOAuthStatusListArgs;
56
- }
57
- export interface UpdateStatusListFromStatusListCredentialArgs {
58
- statusListCredential: StatusListCredential;
59
- keyRef?: string;
60
- statusListIndex: number | string;
61
- value: number | Status2021 | StatusOAuth;
62
- }
63
- export interface StatusListResult {
64
- encodedList: string;
65
- statusListCredential: StatusListCredential;
66
- length: number;
67
- type: StatusListType;
68
- proofFormat: ProofFormat;
69
- id: string;
70
- statuslistContentType: string;
71
- issuer: string | IIssuer;
72
- statusList2021?: StatusList2021Details;
73
- oauthStatusList?: OAuthStatusDetails;
74
- correlationId?: string;
75
- driverType?: StatusListDriverType;
76
- credentialIdMode?: StatusListCredentialIdMode;
77
- }
78
- interface StatusList2021Details {
79
- indexingDirection: StatusListIndexingDirection;
80
- statusPurpose?: StatusPurpose2021;
81
- }
82
- interface OAuthStatusDetails {
83
- bitsPerStatus?: BitsPerStatus;
84
- expiresAt?: Date;
85
- }
86
- export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
87
- type: 'StatusList2021Entry';
88
- statusPurpose: StatusPurpose2021;
89
- statusListIndex: string;
90
- statusListCredential: string;
91
- }
92
- export interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus {
93
- type: 'OAuthStatusListEntry';
94
- bitsPerStatus: number;
95
- statusListIndex: string;
96
- statusListCredential: string;
97
- expiresAt?: Date;
98
- }
99
- export interface StatusList2021ToVerifiableCredentialArgs {
100
- issuer: string | IIssuer;
101
- id: string;
102
- type?: StatusListType;
103
- proofFormat?: ProofFormat;
104
- keyRef?: string;
105
- encodedList: string;
106
- statusPurpose: StatusPurpose2021;
107
- }
108
- export interface CreateStatusListArgs {
109
- issuer: string | IIssuer;
110
- id: string;
111
- proofFormat?: ProofFormat;
112
- keyRef?: string;
113
- correlationId?: string;
114
- length?: number;
115
- statusList2021?: StatusList2021Args;
116
- oauthStatusList?: OAuthStatusListArgs;
117
- }
118
- export interface UpdateStatusListIndexArgs {
119
- statusListCredential: StatusListCredential;
120
- statusListIndex: number | string;
121
- value: number | Status2021 | StatusOAuth;
122
- keyRef?: string;
123
- expiresAt?: Date;
124
- }
125
- export interface CheckStatusIndexArgs {
126
- statusListCredential: StatusListCredential;
127
- statusListIndex: string | number;
128
- }
129
- export interface ToStatusListDetailsArgs {
130
- statusListPayload: StatusListCredential;
131
- correlationId?: string;
132
- driverType?: StatusListDriverType;
133
- }
134
- /**
135
- * The interface definition for a plugin that can add statuslist info to a credential
136
- *
137
- * @remarks Please see {@link https://www.w3.org/TR/vc-data-model | W3C Verifiable Credentials data model}
138
- *
139
- * @beta This API is likely to change without a BREAKING CHANGE notice
140
- */
141
- export interface IStatusListPlugin extends IPluginMethodMap {
142
- /**
143
- * Create a new status list
144
- *
145
- * @param args Status list information like type and size
146
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
147
- *
148
- * @returns - The details of the newly created status list
149
- */
150
- slCreateStatusList(args: CreateNewStatusListArgs, context: IRequiredContext): Promise<StatusListResult>;
151
- /**
152
- * Ensures status list info like index and list id is added to a credential
153
- *
154
- * @param args - Arguments necessary to add the statuslist info.
155
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
156
- *
157
- * @returns - a promise that resolves to the credential now with status support
158
- *
159
- * @beta This API is likely to change without a BREAKING CHANGE notice
160
- */
161
- slAddStatusToCredential(args: IAddStatusToCredentialArgs, context: IRequiredContext): Promise<CredentialWithStatusSupport>;
162
- slAddStatusToSdJwtCredential(args: IAddStatusToSdJwtCredentialArgs, context: IRequiredContext): Promise<SdJwtVcPayload>;
163
- /**
164
- * Get the status list using the configured driver for the SL. Normally a correlationId or id should suffice. Optionally accepts a dbName/datasource
165
- * @param args
166
- * @param context
167
- */
168
- slGetStatusList(args: GetStatusListArgs, context: IRequiredContext): Promise<StatusListResult>;
169
- /**
170
- * Import status lists when noy yet present
171
- *
172
- * @param imports Array of status list information like type and size
173
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
174
- */
175
- slImportStatusLists(imports: Array<CreateNewStatusListArgs>, context: IRequiredContext): Promise<boolean>;
176
- }
177
- export type CreateNewStatusListFuncArgs = BaseCreateNewStatusListArgs;
178
- export type CreateNewStatusListArgs = BaseCreateNewStatusListArgs & {
179
- dbName?: string;
180
- dataSource?: OrPromise<DataSource>;
181
- isDefault?: boolean;
182
- };
183
- export type IAddStatusToCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
184
- credential: CredentialWithStatusSupport;
185
- };
186
- export type IAddStatusToSdJwtCredentialArgs = Omit<IIssueCredentialStatusOpts, 'dataSource'> & {
187
- credential: SdJwtVcPayload;
188
- };
189
- export interface IIssueCredentialStatusOpts {
190
- dataSource?: DataSource;
191
- statusLists?: Array<StatusListOpts>;
192
- credentialId?: string;
193
- value?: string;
194
- }
195
- export type GetStatusListArgs = {
196
- id?: string;
197
- correlationId?: string;
198
- dataSource?: OrPromise<DataSource>;
199
- dbName?: string;
200
- };
201
- export type CredentialWithStatusSupport = ICredential | CredentialPayload | IVerifiableCredential;
202
- export type SignedStatusListData = {
203
- statusListCredential: StatusListCredential;
204
- encodedList: string;
205
- };
206
- export type IRequiredPlugins = ICredentialPlugin & IIdentifierResolution;
207
- export type IRequiredContext = IAgentContext<ICredentialIssuer & ICredentialVerifier & IIdentifierResolution & IKeyManager & ICredentialPlugin>;
208
- export {};
209
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,WAAW,EACX,oBAAoB,EACpB,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,WAAW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C,0BAA0B,EAAE,YAAY,CAAC,GAAG;IACxF,UAAU,EAAE,2BAA2B,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAAC,0BAA0B,EAAE,YAAY,CAAC,GAAG;IAC7F,UAAU,EAAE,cAAc,CAAA;CAC3B,CAAA;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAA;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,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,2BAA2B,GAAG,WAAW,GAAG,iBAAiB,GAAG,qBAAqB,CAAA;AAEjG,MAAM,MAAM,oBAAoB,GAAG;IACjC,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,qBAAqB,CAAA;AACxE,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,iBAAiB,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,WAAW,GAAG,iBAAiB,CAAC,CAAA"}
@@ -1,15 +0,0 @@
1
- "use strict";
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
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AA6BA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,+CAAS,CAAA;IACT,mDAAW,CAAA;IACX,uDAAa,CAAA;AACf,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,iDAAW,CAAA;AACb,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB"}
package/dist/utils.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { IIssuer, ProofFormat, StatusListType, StatusListType as StatusListTypeW3C, StatusListCredential } from '@sphereon/ssi-types';
2
- export declare function getAssertedStatusListType(type?: StatusListType): StatusListType;
3
- export declare function getAssertedValue<T>(name: string, value: T): NonNullable<T>;
4
- export declare function getAssertedValues(args: {
5
- issuer: string | IIssuer;
6
- id: string;
7
- type?: StatusListTypeW3C | StatusListType;
8
- }): {
9
- id: string;
10
- issuer: NonNullable<string | IIssuer>;
11
- type: StatusListType;
12
- };
13
- export declare function getAssertedProperty<T extends object>(propertyName: string, obj: T): NonNullable<any>;
14
- export declare function assertValidProofType(type: StatusListType, proofFormat: ProofFormat): void;
15
- export declare function determineStatusListType(credential: StatusListCredential): StatusListType;
16
- export declare function determineProofFormat(credential: StatusListCredential): ProofFormat;
17
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,WAAW,EACX,cAAc,EACd,cAAc,IAAI,iBAAiB,EACnC,oBAAoB,EAErB,MAAM,qBAAqB,CAAA;AAG5B,wBAAgB,yBAAyB,CAAC,IAAI,CAAC,EAAE,cAAc,kBAM9D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAK1E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAAA;CAAE;;;;EAK1H;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAKpG;AAOD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,QAKlF;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,oBAAoB,GAAG,cAAc,CA2BxF;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,GAAG,WAAW,CAalF"}
package/dist/utils.js DELETED
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAssertedStatusListType = getAssertedStatusListType;
4
- exports.getAssertedValue = getAssertedValue;
5
- exports.getAssertedValues = getAssertedValues;
6
- exports.getAssertedProperty = getAssertedProperty;
7
- exports.assertValidProofType = assertValidProofType;
8
- exports.determineStatusListType = determineStatusListType;
9
- exports.determineProofFormat = determineProofFormat;
10
- const ssi_types_1 = require("@sphereon/ssi-types");
11
- const jwt_decode_1 = require("jwt-decode");
12
- function getAssertedStatusListType(type) {
13
- const assertedType = type !== null && type !== void 0 ? type : ssi_types_1.StatusListType.StatusList2021;
14
- if (![ssi_types_1.StatusListType.StatusList2021, ssi_types_1.StatusListType.OAuthStatusList].includes(assertedType)) {
15
- throw Error(`StatusList type ${assertedType} is not supported (yet)`);
16
- }
17
- return assertedType;
18
- }
19
- function getAssertedValue(name, value) {
20
- if (value === undefined || value === null) {
21
- throw Error(`Missing required ${name} value`);
22
- }
23
- return value;
24
- }
25
- function getAssertedValues(args) {
26
- const type = getAssertedStatusListType(args === null || args === void 0 ? void 0 : args.type);
27
- const id = getAssertedValue('id', args.id);
28
- const issuer = getAssertedValue('issuer', args.issuer);
29
- return { id, issuer, type };
30
- }
31
- function getAssertedProperty(propertyName, obj) {
32
- if (!(propertyName in obj)) {
33
- throw Error(`The input object does not contain required property: ${propertyName}`);
34
- }
35
- return getAssertedValue(propertyName, obj[propertyName]);
36
- }
37
- const ValidProofTypeMap = new Map([
38
- [ssi_types_1.StatusListType.StatusList2021, ['jwt', 'lds', 'EthereumEip712Signature2021']],
39
- [ssi_types_1.StatusListType.OAuthStatusList, ['jwt', 'cbor']],
40
- ]);
41
- function assertValidProofType(type, proofFormat) {
42
- const validProofTypes = ValidProofTypeMap.get(type);
43
- if (!(validProofTypes === null || validProofTypes === void 0 ? void 0 : validProofTypes.includes(proofFormat))) {
44
- throw Error(`Invalid proof format '${proofFormat}' for status list type ${type}`);
45
- }
46
- }
47
- function determineStatusListType(credential) {
48
- const proofFormat = determineProofFormat(credential);
49
- switch (proofFormat) {
50
- case 'jwt':
51
- const payload = (0, jwt_decode_1.jwtDecode)(credential);
52
- const keys = Object.keys(payload);
53
- if (keys.includes('status_list')) {
54
- return ssi_types_1.StatusListType.OAuthStatusList;
55
- }
56
- else if (keys.includes('vc')) {
57
- return ssi_types_1.StatusListType.StatusList2021;
58
- }
59
- break;
60
- case 'lds':
61
- const uniform = ssi_types_1.CredentialMapper.toUniformCredential(credential);
62
- const type = uniform.type.find((t) => {
63
- return Object.values(ssi_types_1.StatusListType).some((statusType) => t.includes(statusType));
64
- });
65
- if (!type) {
66
- throw new Error('Invalid status list credential type');
67
- }
68
- return type.replace('Credential', '');
69
- case 'cbor':
70
- return ssi_types_1.StatusListType.OAuthStatusList;
71
- }
72
- throw new Error('Cannot determine status list type from credential payload');
73
- }
74
- function determineProofFormat(credential) {
75
- const type = ssi_types_1.CredentialMapper.detectDocumentType(credential);
76
- switch (type) {
77
- case 0 /* DocumentFormat.JWT */:
78
- return 'jwt';
79
- case 4 /* DocumentFormat.MSO_MDOC */:
80
- // Not really mdoc, just assume Cbor for now, I'd need to decode at least the header to what type of Cbor we have
81
- return 'cbor';
82
- case 1 /* DocumentFormat.JSONLD */:
83
- return 'lds';
84
- default:
85
- throw Error('Cannot determine credential payload type');
86
- }
87
- }
88
- //# sourceMappingURL=utils.js.map