@sphereon/ssi-sdk.vc-status-list 0.33.0 → 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.
@@ -1,173 +1,167 @@
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.StatusList2021Implementation = exports.DEFAULT_PROOF_FORMAT = exports.DEFAULT_LIST_LENGTH = void 0;
13
- const ssi_types_1 = require("@sphereon/ssi-types");
14
- const vc_status_list_1 = require("@sphereon/vc-status-list");
15
- const types_1 = require("../types");
16
- const utils_1 = require("../utils");
17
- exports.DEFAULT_LIST_LENGTH = 250000;
18
- exports.DEFAULT_PROOF_FORMAT = 'lds';
19
- class StatusList2021Implementation {
20
- createNewStatusList(args, context) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- var _a, _b;
23
- const length = (_a = args === null || args === void 0 ? void 0 : args.length) !== null && _a !== void 0 ? _a : exports.DEFAULT_LIST_LENGTH;
24
- const proofFormat = (_b = args === null || args === void 0 ? void 0 : args.proofFormat) !== null && _b !== void 0 ? _b : exports.DEFAULT_PROOF_FORMAT;
25
- (0, utils_1.assertValidProofType)(ssi_types_1.StatusListType.StatusList2021, proofFormat);
26
- const veramoProofFormat = proofFormat;
27
- const { issuer, id } = args;
28
- const correlationId = (0, utils_1.getAssertedValue)('correlationId', args.correlationId);
29
- const list = new vc_status_list_1.StatusList({ length });
30
- const encodedList = yield list.encode();
31
- const statusPurpose = 'revocation';
32
- const statusListCredential = yield this.createVerifiableCredential(Object.assign(Object.assign({}, args), { encodedList, proofFormat: veramoProofFormat }), context);
33
- return {
34
- encodedList,
35
- statusListCredential: statusListCredential,
36
- statusList2021: {
37
- statusPurpose,
38
- indexingDirection: 'rightToLeft',
39
- },
40
- length,
41
- type: ssi_types_1.StatusListType.StatusList2021,
42
- proofFormat,
43
- id,
44
- correlationId,
45
- issuer,
46
- statuslistContentType: this.buildContentType(proofFormat),
47
- };
48
- });
1
+ import { CredentialMapper, StatusListType } from '@sphereon/ssi-types';
2
+ import { StatusList } from '@sphereon/vc-status-list';
3
+ import { Status2021, } from '../types';
4
+ import { assertValidProofType, getAssertedProperty, getAssertedValue, getAssertedValues } from '../utils';
5
+ export const DEFAULT_LIST_LENGTH = 250000;
6
+ export const DEFAULT_PROOF_FORMAT = 'lds';
7
+ export class StatusList2021Implementation {
8
+ async createNewStatusList(args, context) {
9
+ const length = args?.length ?? DEFAULT_LIST_LENGTH;
10
+ const proofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT;
11
+ assertValidProofType(StatusListType.StatusList2021, proofFormat);
12
+ const veramoProofFormat = proofFormat;
13
+ const { issuer, id } = args;
14
+ const correlationId = getAssertedValue('correlationId', args.correlationId);
15
+ const list = new StatusList({ length });
16
+ const encodedList = await list.encode();
17
+ const statusPurpose = 'revocation';
18
+ const statusListCredential = await this.createVerifiableCredential({
19
+ ...args,
20
+ encodedList,
21
+ proofFormat: veramoProofFormat,
22
+ }, context);
23
+ return {
24
+ encodedList,
25
+ statusListCredential: statusListCredential,
26
+ statusList2021: {
27
+ statusPurpose,
28
+ indexingDirection: 'rightToLeft',
29
+ },
30
+ length,
31
+ type: StatusListType.StatusList2021,
32
+ proofFormat,
33
+ id,
34
+ correlationId,
35
+ issuer,
36
+ statuslistContentType: this.buildContentType(proofFormat),
37
+ };
49
38
  }
50
- updateStatusListIndex(args, context) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- const credential = args.statusListCredential;
53
- const uniform = ssi_types_1.CredentialMapper.toUniformCredential(credential);
54
- const { issuer, credentialSubject } = uniform;
55
- const id = (0, utils_1.getAssertedValue)('id', uniform.id);
56
- const origEncodedList = (0, utils_1.getAssertedProperty)('encodedList', credentialSubject);
57
- const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex);
58
- const statusList = yield vc_status_list_1.StatusList.decode({ encodedList: origEncodedList });
59
- statusList.setStatus(index, args.value != 0);
60
- const encodedList = yield statusList.encode();
61
- const proofFormat = ssi_types_1.CredentialMapper.detectDocumentType(credential) === 0 /* DocumentFormat.JWT */ ? 'jwt' : 'lds';
62
- const updatedCredential = yield this.createVerifiableCredential(Object.assign(Object.assign({}, args), { id,
63
- issuer,
64
- encodedList, proofFormat: proofFormat }), context);
65
- return {
66
- statusListCredential: updatedCredential,
67
- encodedList,
68
- statusList2021: Object.assign(Object.assign({}, ('statusPurpose' in credentialSubject ? { statusPurpose: credentialSubject.statusPurpose } : {})), { indexingDirection: 'rightToLeft' }),
69
- length: statusList.length - 1,
70
- type: ssi_types_1.StatusListType.StatusList2021,
71
- proofFormat: proofFormat,
72
- id,
73
- issuer,
74
- statuslistContentType: this.buildContentType(proofFormat),
75
- };
76
- });
39
+ async updateStatusListIndex(args, context) {
40
+ const credential = args.statusListCredential;
41
+ const uniform = CredentialMapper.toUniformCredential(credential);
42
+ const { issuer, credentialSubject } = uniform;
43
+ const id = getAssertedValue('id', uniform.id);
44
+ const origEncodedList = getAssertedProperty('encodedList', credentialSubject);
45
+ const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex);
46
+ const statusList = await StatusList.decode({ encodedList: origEncodedList });
47
+ statusList.setStatus(index, args.value != 0);
48
+ const encodedList = await statusList.encode();
49
+ const proofFormat = CredentialMapper.detectDocumentType(credential) === 0 /* DocumentFormat.JWT */ ? 'jwt' : 'lds';
50
+ const updatedCredential = await this.createVerifiableCredential({
51
+ ...args,
52
+ id,
53
+ issuer,
54
+ encodedList,
55
+ proofFormat: proofFormat,
56
+ }, context);
57
+ return {
58
+ statusListCredential: updatedCredential,
59
+ encodedList,
60
+ statusList2021: {
61
+ ...('statusPurpose' in credentialSubject ? { statusPurpose: credentialSubject.statusPurpose } : {}),
62
+ indexingDirection: 'rightToLeft',
63
+ },
64
+ length: statusList.length - 1,
65
+ type: StatusListType.StatusList2021,
66
+ proofFormat: proofFormat,
67
+ id,
68
+ issuer,
69
+ statuslistContentType: this.buildContentType(proofFormat),
70
+ };
77
71
  }
78
- updateStatusListFromEncodedList(args, context) {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- var _a, _b;
81
- if (!args.statusList2021) {
82
- throw new Error('statusList2021 options required for type StatusList2021');
83
- }
84
- const proofFormat = (_a = args === null || args === void 0 ? void 0 : args.proofFormat) !== null && _a !== void 0 ? _a : exports.DEFAULT_PROOF_FORMAT;
85
- (0, utils_1.assertValidProofType)(ssi_types_1.StatusListType.StatusList2021, proofFormat);
86
- const veramoProofFormat = proofFormat;
87
- const { issuer, id } = (0, utils_1.getAssertedValues)(args);
88
- const statusList = yield vc_status_list_1.StatusList.decode({ encodedList: args.encodedList });
89
- const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex);
90
- statusList.setStatus(index, args.value);
91
- const newEncodedList = yield statusList.encode();
92
- const credential = yield this.createVerifiableCredential({
93
- id,
94
- issuer,
95
- encodedList: newEncodedList,
96
- proofFormat: veramoProofFormat,
97
- keyRef: args.keyRef,
98
- }, context);
99
- return {
100
- type: ssi_types_1.StatusListType.StatusList2021,
101
- statusListCredential: credential,
102
- encodedList: newEncodedList,
103
- statusList2021: {
104
- statusPurpose: args.statusList2021.statusPurpose,
105
- indexingDirection: 'rightToLeft',
106
- },
107
- length: statusList.length,
108
- proofFormat: (_b = args.proofFormat) !== null && _b !== void 0 ? _b : 'lds',
109
- id: id,
110
- issuer: issuer,
111
- statuslistContentType: this.buildContentType(proofFormat),
112
- };
113
- });
72
+ async updateStatusListFromEncodedList(args, context) {
73
+ if (!args.statusList2021) {
74
+ throw new Error('statusList2021 options required for type StatusList2021');
75
+ }
76
+ const proofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT;
77
+ assertValidProofType(StatusListType.StatusList2021, proofFormat);
78
+ const veramoProofFormat = proofFormat;
79
+ const { issuer, id } = getAssertedValues(args);
80
+ const statusList = await StatusList.decode({ encodedList: args.encodedList });
81
+ const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex);
82
+ statusList.setStatus(index, args.value);
83
+ const newEncodedList = await statusList.encode();
84
+ const credential = await this.createVerifiableCredential({
85
+ id,
86
+ issuer,
87
+ encodedList: newEncodedList,
88
+ proofFormat: veramoProofFormat,
89
+ keyRef: args.keyRef,
90
+ }, context);
91
+ return {
92
+ type: StatusListType.StatusList2021,
93
+ statusListCredential: credential,
94
+ encodedList: newEncodedList,
95
+ statusList2021: {
96
+ statusPurpose: args.statusList2021.statusPurpose,
97
+ indexingDirection: 'rightToLeft',
98
+ },
99
+ length: statusList.length,
100
+ proofFormat: args.proofFormat ?? 'lds',
101
+ id: id,
102
+ issuer: issuer,
103
+ statuslistContentType: this.buildContentType(proofFormat),
104
+ };
114
105
  }
115
- checkStatusIndex(args) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- const uniform = ssi_types_1.CredentialMapper.toUniformCredential(args.statusListCredential);
118
- const { credentialSubject } = uniform;
119
- const encodedList = (0, utils_1.getAssertedProperty)('encodedList', credentialSubject);
120
- const statusList = yield vc_status_list_1.StatusList.decode({ encodedList });
121
- const status = statusList.getStatus(typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex));
122
- return status ? types_1.Status2021.Invalid : types_1.Status2021.Valid;
123
- });
106
+ async checkStatusIndex(args) {
107
+ const uniform = CredentialMapper.toUniformCredential(args.statusListCredential);
108
+ const { credentialSubject } = uniform;
109
+ const encodedList = getAssertedProperty('encodedList', credentialSubject);
110
+ const statusList = await StatusList.decode({ encodedList });
111
+ const status = statusList.getStatus(typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex));
112
+ return status ? Status2021.Invalid : Status2021.Valid;
124
113
  }
125
- toStatusListDetails(args) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- const { statusListPayload } = args;
128
- const uniform = ssi_types_1.CredentialMapper.toUniformCredential(statusListPayload);
129
- const { issuer, credentialSubject } = uniform;
130
- const id = (0, utils_1.getAssertedValue)('id', uniform.id);
131
- const encodedList = (0, utils_1.getAssertedProperty)('encodedList', credentialSubject);
132
- const proofFormat = ssi_types_1.CredentialMapper.detectDocumentType(statusListPayload) === 0 /* DocumentFormat.JWT */ ? 'jwt' : 'lds';
133
- const statusPurpose = (0, utils_1.getAssertedProperty)('statusPurpose', credentialSubject);
134
- const list = yield vc_status_list_1.StatusList.decode({ encodedList });
135
- return Object.assign(Object.assign({ id,
136
- encodedList,
137
- issuer, type: ssi_types_1.StatusListType.StatusList2021, proofFormat, length: list.length, statusListCredential: statusListPayload, statuslistContentType: this.buildContentType(proofFormat), statusList2021: {
138
- indexingDirection: 'rightToLeft',
139
- statusPurpose,
140
- } }, (args.correlationId && { correlationId: args.correlationId })), (args.driverType && { driverType: args.driverType }));
141
- });
114
+ async toStatusListDetails(args) {
115
+ const { statusListPayload } = args;
116
+ const uniform = CredentialMapper.toUniformCredential(statusListPayload);
117
+ const { issuer, credentialSubject } = uniform;
118
+ const id = getAssertedValue('id', uniform.id);
119
+ const encodedList = getAssertedProperty('encodedList', credentialSubject);
120
+ const proofFormat = CredentialMapper.detectDocumentType(statusListPayload) === 0 /* DocumentFormat.JWT */ ? 'jwt' : 'lds';
121
+ const statusPurpose = getAssertedProperty('statusPurpose', credentialSubject);
122
+ const list = await StatusList.decode({ encodedList });
123
+ return {
124
+ id,
125
+ encodedList,
126
+ issuer,
127
+ type: StatusListType.StatusList2021,
128
+ proofFormat,
129
+ length: list.length,
130
+ statusListCredential: statusListPayload,
131
+ statuslistContentType: this.buildContentType(proofFormat),
132
+ statusList2021: {
133
+ indexingDirection: 'rightToLeft',
134
+ statusPurpose,
135
+ },
136
+ ...(args.correlationId && { correlationId: args.correlationId }),
137
+ ...(args.driverType && { driverType: args.driverType }),
138
+ };
142
139
  }
143
- createVerifiableCredential(args, context) {
144
- return __awaiter(this, void 0, void 0, function* () {
145
- var _a;
146
- const identifier = yield context.agent.identifierManagedGet({
147
- identifier: typeof args.issuer === 'string' ? args.issuer : args.issuer.id,
148
- vmRelationship: 'assertionMethod',
149
- offlineWhenNoDIDRegistered: true,
150
- });
151
- const credential = {
152
- '@context': ['https://www.w3.org/2018/credentials/v1', 'https://w3id.org/vc/status-list/2021/v1'],
140
+ async createVerifiableCredential(args, context) {
141
+ const identifier = await context.agent.identifierManagedGet({
142
+ identifier: typeof args.issuer === 'string' ? args.issuer : args.issuer.id,
143
+ vmRelationship: 'assertionMethod',
144
+ offlineWhenNoDIDRegistered: true,
145
+ });
146
+ const credential = {
147
+ '@context': ['https://www.w3.org/2018/credentials/v1', 'https://w3id.org/vc/status-list/2021/v1'],
148
+ id: args.id,
149
+ issuer: args.issuer,
150
+ type: ['VerifiableCredential', 'StatusList2021Credential'],
151
+ credentialSubject: {
153
152
  id: args.id,
154
- issuer: args.issuer,
155
- type: ['VerifiableCredential', 'StatusList2021Credential'],
156
- credentialSubject: {
157
- id: args.id,
158
- type: 'StatusList2021',
159
- statusPurpose: 'revocation',
160
- encodedList: args.encodedList,
161
- },
162
- };
163
- const verifiableCredential = yield context.agent.createVerifiableCredential({
164
- credential,
165
- keyRef: (_a = args.keyRef) !== null && _a !== void 0 ? _a : identifier.kmsKeyRef,
166
- proofFormat: args.proofFormat,
167
- fetchRemoteContexts: true,
168
- });
169
- return ssi_types_1.CredentialMapper.toWrappedVerifiableCredential(verifiableCredential).original;
153
+ type: 'StatusList2021',
154
+ statusPurpose: 'revocation',
155
+ encodedList: args.encodedList,
156
+ },
157
+ };
158
+ const verifiableCredential = await context.agent.createVerifiableCredential({
159
+ credential,
160
+ keyRef: args.keyRef ?? identifier.kmsKeyRef,
161
+ proofFormat: args.proofFormat,
162
+ fetchRemoteContexts: true,
170
163
  });
164
+ return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential).original;
171
165
  }
172
166
  buildContentType(proofFormat) {
173
167
  switch (proofFormat) {
@@ -182,5 +176,4 @@ class StatusList2021Implementation {
182
176
  }
183
177
  }
184
178
  }
185
- exports.StatusList2021Implementation = StatusList2021Implementation;
186
179
  //# sourceMappingURL=StatusList2021.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusList2021.js","sourceRoot":"","sources":["../../src/impl/StatusList2021.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,mDAAkI;AAElI,6DAAqD;AAErD,oCAQiB;AACjB,oCAAyG;AAE5F,QAAA,mBAAmB,GAAG,MAAM,CAAA;AAC5B,QAAA,oBAAoB,GAAG,KAA0B,CAAA;AAE9D,MAAa,4BAA4B;IACjC,mBAAmB,CACvB,IAA0B,EAC1B,OAAiE;;;YAEjE,MAAM,MAAM,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,2BAAmB,CAAA;YAClD,MAAM,WAAW,GAAgB,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,mCAAI,4BAAoB,CAAA;YAC1E,IAAA,4BAAoB,EAAC,0BAAc,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;YAChE,MAAM,iBAAiB,GAAsB,WAAgC,CAAA;YAE7E,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAA;YAC3B,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;YAE3E,MAAM,IAAI,GAAG,IAAI,2BAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;YACvC,MAAM,WAAW,GAAG,MAAM,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;aAC9B;SACF,CAAA;QAED,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC;YAC1E,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,SAAS;YAC3C,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,mBAAmB,EAAE,IAAI;SAC1B,CAAC,CAAA;QAEF,OAAO,gBAAgB,CAAC,6BAA6B,CAAC,oBAA4C,CAAC,CAAC,QAAgC,CAAA;IACtI,CAAC;IAEO,gBAAgB,CAAC,WAA+E;QACtG,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,KAAK;gBACR,OAAO,4BAA4B,CAAA;YACrC,KAAK,MAAM;gBACT,OAAO,4BAA4B,CAAA;YACrC,KAAK,KAAK;gBACR,OAAO,gCAAgC,CAAA;YACzC;gBACE,MAAM,KAAK,CAAC,6BAA6B,WAAW,oBAAoB,CAAC,CAAA;QAC7E,CAAC;IACH,CAAC;CACF"}
@@ -1,15 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatusListFactory = void 0;
4
- exports.getStatusListImplementation = getStatusListImplementation;
5
- const StatusList2021_1 = require("./StatusList2021");
6
- const OAuthStatusList_1 = require("./OAuthStatusList");
7
- const ssi_types_1 = require("@sphereon/ssi-types");
8
- class StatusListFactory {
1
+ import { StatusList2021Implementation } from './StatusList2021';
2
+ import { OAuthStatusListImplementation } from './OAuthStatusList';
3
+ import { StatusListType } from '@sphereon/ssi-types';
4
+ export class StatusListFactory {
5
+ static instance;
6
+ implementations;
9
7
  constructor() {
10
8
  this.implementations = new Map();
11
- this.implementations.set(ssi_types_1.StatusListType.StatusList2021, new StatusList2021_1.StatusList2021Implementation());
12
- this.implementations.set(ssi_types_1.StatusListType.OAuthStatusList, new OAuthStatusList_1.OAuthStatusListImplementation());
9
+ this.implementations.set(StatusListType.StatusList2021, new StatusList2021Implementation());
10
+ this.implementations.set(StatusListType.OAuthStatusList, new OAuthStatusListImplementation());
13
11
  }
14
12
  static getInstance() {
15
13
  if (!StatusListFactory.instance) {
@@ -25,8 +23,7 @@ class StatusListFactory {
25
23
  return statusList;
26
24
  }
27
25
  }
28
- exports.StatusListFactory = StatusListFactory;
29
- function getStatusListImplementation(type) {
26
+ export function getStatusListImplementation(type) {
30
27
  return StatusListFactory.getInstance().getByType(type);
31
28
  }
32
29
  //# sourceMappingURL=StatusListFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusListFactory.js","sourceRoot":"","sources":["../../src/impl/StatusListFactory.ts"],"names":[],"mappings":";;;AA+BA,kEAEC;AAhCD,qDAA+D;AAC/D,uDAAiE;AACjE,mDAAoD;AAEpD,MAAa,iBAAiB;IAI5B;QACE,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAA;QAChC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,0BAAc,CAAC,cAAc,EAAE,IAAI,6CAA4B,EAAE,CAAC,CAAA;QAC3F,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,0BAAc,CAAC,eAAe,EAAE,IAAI,+CAA6B,EAAE,CAAC,CAAA;IAC/F,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAA;QACtD,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAA;IACnC,CAAC;IAEM,SAAS,CAAC,IAAoB;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAA;QAC1E,CAAC;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAxBD,8CAwBC;AAED,SAAgB,2BAA2B,CAA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CAAC,IAAI,CAAC,CAAA;AACxD,CAAC"}
@@ -1,26 +1,11 @@
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);
1
+ import { StatusList } from '@sd-jwt/jwt-status-list';
2
+ import { deflate, inflate } from 'pako';
3
+ import { com, kotlin } from '@sphereon/kmp-cbor';
4
+ import base64url from 'base64url';
5
+ import { resolveIdentifier } from './common';
6
+ const cbor = com.sphereon.cbor;
7
+ const kmp = com.sphereon.kmp;
8
+ const decompressRawStatusList = StatusList.decodeStatusList.bind(StatusList);
24
9
  const CWT_CLAIMS = {
25
10
  SUBJECT: 2,
26
11
  ISSUER: 1,
@@ -29,42 +14,41 @@ const CWT_CLAIMS = {
29
14
  TIME_TO_LIVE: 65534,
30
15
  STATUS_LIST: 65533,
31
16
  };
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);
17
+ export const createSignedCbor = async (context, statusList, issuerString, id, expiresAt, keyRef) => {
18
+ const identifier = await resolveIdentifier(context, issuerString, keyRef);
34
19
  const encodeStatusList = statusList.encodeStatusList();
35
- const compressedList = (0, pako_1.deflate)(encodeStatusList, { level: 9 });
20
+ const compressedList = deflate(encodeStatusList, { level: 9 });
36
21
  const compressedBytes = new Int8Array(compressedList);
37
- const statusListMap = new cbor.CborMap(kmp_cbor_1.kotlin.collections.KtMutableMap.fromJsMap(new Map([
22
+ const statusListMap = new cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map([
38
23
  [new cbor.CborString('bits'), new cbor.CborUInt(kmp.LongKMP.fromNumber(statusList.getBitsPerStatus()))],
39
24
  [new cbor.CborString('lst'), new cbor.CborByteString(compressedBytes)],
40
25
  ])));
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')]])));
26
+ const protectedHeader = new cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map([[new cbor.CborUInt(kmp.LongKMP.fromNumber(16)), new cbor.CborString('statuslist+cwt')]])));
42
27
  const protectedHeaderEncoded = cbor.Cbor.encode(protectedHeader);
43
28
  const claimsMap = buildClaimsMap(id, issuerString, statusListMap, expiresAt);
44
29
  const claimsEncoded = cbor.Cbor.encode(claimsMap);
45
- const signedCWT = yield context.agent.keyManagerSign({
30
+ const signedCWT = await context.agent.keyManagerSign({
46
31
  keyRef: identifier.kmsKeyRef,
47
- data: base64url_1.default.encode(Buffer.from(claimsEncoded)), // TODO test on RN
32
+ data: base64url.encode(Buffer.from(claimsEncoded)), // TODO test on RN
48
33
  encoding: undefined,
49
34
  });
50
35
  const protectedHeaderEncodedInt8 = new Int8Array(protectedHeaderEncoded);
51
36
  const claimsEncodedInt8 = new Int8Array(claimsEncoded);
52
- const signatureBytes = base64url_1.default.decode(signedCWT);
37
+ const signatureBytes = base64url.decode(signedCWT);
53
38
  const signatureInt8 = new Int8Array(Buffer.from(signatureBytes));
54
39
  const cwtArrayElements = [
55
40
  new cbor.CborByteString(protectedHeaderEncodedInt8),
56
41
  new cbor.CborByteString(claimsEncodedInt8),
57
42
  new cbor.CborByteString(signatureInt8),
58
43
  ];
59
- const cwtArray = new cbor.CborArray(kmp_cbor_1.kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
44
+ const cwtArray = new cbor.CborArray(kotlin.collections.KtMutableList.fromJsArray(cwtArrayElements));
60
45
  const cwtEncoded = cbor.Cbor.encode(cwtArray);
61
46
  const cwtBuffer = Buffer.from(cwtEncoded);
62
47
  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
48
+ statusListCredential: base64url.encode(cwtBuffer),
49
+ encodedList: base64url.encode(compressedList), // JS in @sd-jwt/jwt-status-list drops it in like this, so keep the same method
65
50
  };
66
- });
67
- exports.createSignedCbor = createSignedCbor;
51
+ };
68
52
  function buildClaimsMap(id, issuerString, statusListMap, expiresAt) {
69
53
  const ttl = 65535; // FIXME figure out what value should be / come from and what the difference is with exp
70
54
  const claimsEntries = [
@@ -88,7 +72,7 @@ function buildClaimsMap(id, issuerString, statusListMap, expiresAt) {
88
72
  ]);
89
73
  }
90
74
  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)));
75
+ const claimsMap = new cbor.CborMap(kotlin.collections.KtMutableMap.fromJsMap(new Map(claimsEntries)));
92
76
  return claimsMap;
93
77
  }
94
78
  const getCborValueFromMap = (map, key) => {
@@ -99,34 +83,34 @@ const getCborValueFromMap = (map, key) => {
99
83
  return value;
100
84
  };
101
85
  const getCborOptionalValueFromMap = (map, key) => {
102
- const value = map.get(new kmp_cbor_1.com.sphereon.cbor.CborUInt(kmp.LongKMP.fromNumber(key)));
86
+ const value = map.get(new com.sphereon.cbor.CborUInt(kmp.LongKMP.fromNumber(key)));
103
87
  if (!value) {
104
88
  return undefined;
105
89
  }
106
90
  return value.value;
107
91
  };
108
- const decodeStatusListCWT = (cwt) => {
109
- const encodedCbor = base64url_1.default.toBuffer(cwt);
92
+ export const decodeStatusListCWT = (cwt) => {
93
+ const encodedCbor = base64url.toBuffer(cwt);
110
94
  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)) {
95
+ const decodedCbor = com.sphereon.cbor.Cbor.decode(encodedCborArray);
96
+ if (!(decodedCbor instanceof com.sphereon.cbor.CborArray)) {
113
97
  throw new Error('Invalid CWT format: Expected a CBOR array');
114
98
  }
115
99
  const [, payload] = decodedCbor.value.asJsArrayView();
116
- if (!(payload instanceof kmp_cbor_1.com.sphereon.cbor.CborByteString)) {
100
+ if (!(payload instanceof com.sphereon.cbor.CborByteString)) {
117
101
  throw new Error('Invalid payload format: Expected a CBOR ByteString');
118
102
  }
119
- const claims = kmp_cbor_1.com.sphereon.cbor.Cbor.decode(payload.value);
120
- if (!(claims instanceof kmp_cbor_1.com.sphereon.cbor.CborMap)) {
103
+ const claims = com.sphereon.cbor.Cbor.decode(payload.value);
104
+ if (!(claims instanceof com.sphereon.cbor.CborMap)) {
121
105
  throw new Error('Invalid claims format: Expected a CBOR map');
122
106
  }
123
107
  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);
108
+ const statusListMap = claimsMap.get(new com.sphereon.cbor.CborUInt(kmp.LongKMP.fromNumber(65533))).value.asJsMapView();
109
+ const bits = Number(statusListMap.get(new com.sphereon.cbor.CborString('bits')).value);
110
+ const decoded = new Uint8Array(statusListMap.get(new com.sphereon.cbor.CborString('lst')).value);
111
+ const uint8Array = inflate(decoded);
128
112
  const rawStatusList = decompressRawStatusList(uint8Array, bits);
129
- const statusList = new jwt_status_list_1.StatusList(rawStatusList, bits);
113
+ const statusList = new StatusList(rawStatusList, bits);
130
114
  return {
131
115
  issuer: getCborValueFromMap(claimsMap, CWT_CLAIMS.ISSUER),
132
116
  id: getCborValueFromMap(claimsMap, CWT_CLAIMS.SUBJECT),
@@ -136,5 +120,4 @@ const decodeStatusListCWT = (cwt) => {
136
120
  ttl: getCborOptionalValueFromMap(claimsMap, CWT_CLAIMS.TIME_TO_LIVE),
137
121
  };
138
122
  };
139
- exports.decodeStatusListCWT = decodeStatusListCWT;
140
123
  //# sourceMappingURL=cbor.js.map