@sphereon/ssi-sdk.vc-status-list 0.32.1-fix.160 → 0.32.1-next.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions.d.ts +13 -13
- package/dist/functions.d.ts.map +1 -1
- package/dist/functions.js +109 -53
- package/dist/functions.js.map +1 -1
- package/dist/types/index.d.ts +30 -115
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -12
- package/dist/types/index.js.map +1 -1
- package/package.json +3 -11
- package/src/functions.ts +159 -73
- package/src/types/index.ts +34 -132
- package/dist/impl/IStatusList.d.ts +0 -26
- package/dist/impl/IStatusList.d.ts.map +0 -1
- package/dist/impl/IStatusList.js +0 -3
- package/dist/impl/IStatusList.js.map +0 -1
- package/dist/impl/OAuthStatusList.d.ts +0 -20
- package/dist/impl/OAuthStatusList.d.ts.map +0 -1
- package/dist/impl/OAuthStatusList.js +0 -147
- package/dist/impl/OAuthStatusList.js.map +0 -1
- package/dist/impl/StatusList2021.d.ts +0 -15
- package/dist/impl/StatusList2021.d.ts.map +0 -1
- package/dist/impl/StatusList2021.js +0 -170
- package/dist/impl/StatusList2021.js.map +0 -1
- package/dist/impl/StatusListFactory.d.ts +0 -11
- package/dist/impl/StatusListFactory.d.ts.map +0 -1
- package/dist/impl/StatusListFactory.js +0 -32
- package/dist/impl/StatusListFactory.js.map +0 -1
- package/dist/impl/encoding/cbor.d.ts +0 -6
- package/dist/impl/encoding/cbor.d.ts.map +0 -1
- package/dist/impl/encoding/cbor.js +0 -140
- package/dist/impl/encoding/cbor.js.map +0 -1
- package/dist/impl/encoding/common.d.ts +0 -12
- package/dist/impl/encoding/common.d.ts.map +0 -1
- package/dist/impl/encoding/common.js +0 -26
- package/dist/impl/encoding/common.js.map +0 -1
- package/dist/impl/encoding/jwt.d.ts +0 -9
- package/dist/impl/encoding/jwt.d.ts.map +0 -1
- package/dist/impl/encoding/jwt.js +0 -74
- package/dist/impl/encoding/jwt.js.map +0 -1
- package/dist/utils.d.ts +0 -17
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -88
- package/dist/utils.js.map +0 -1
- package/src/impl/IStatusList.ts +0 -42
- package/src/impl/OAuthStatusList.ts +0 -196
- package/src/impl/StatusList2021.ts +0 -223
- package/src/impl/StatusListFactory.ts +0 -34
- package/src/impl/encoding/cbor.ts +0 -171
- package/src/impl/encoding/common.ts +0 -25
- package/src/impl/encoding/jwt.ts +0 -80
- package/src/utils.ts +0 -95
|
@@ -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,umCAYjG,CAAA"}
|
|
@@ -1,26 +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
|
-
if (keyRef) {
|
|
15
|
-
return yield context.agent.identifierManagedGetByKid({
|
|
16
|
-
identifier: keyRef,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return yield context.agent.identifierManagedGet({
|
|
20
|
-
identifier: issuer,
|
|
21
|
-
vmRelationship: 'assertionMethod',
|
|
22
|
-
offlineWhenNoDIDRegistered: true,
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
exports.resolveIdentifier = resolveIdentifier;
|
|
26
|
-
//# 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,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC;YACnD,UAAU,EAAE,MAAM;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC;QAC9C,UAAU,EAAE,MAAM;QAClB,cAAc,EAAE,iBAAiB;QACjC,0BAA0B,EAAE,IAAI;KACjC,CAAC,CAAA;AACJ,CAAC,CAAA,CAAA;AAZY,QAAA,iBAAiB,qBAY7B"}
|
|
@@ -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 = getSigningA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AAK,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"}
|
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
|
package/dist/utils.d.ts.map
DELETED
|
@@ -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
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAWA,8DAMC;AAED,4CAKC;AAED,8CAKC;AAED,kDAKC;AAOD,oDAKC;AAED,0DA2BC;AAED,o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AAO,MAAM,CAAC,MAAM,CAAC,0BAAc,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;YACnF,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;YACxD,CAAC;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAmB,CAAA;QAEzD,KAAK,MAAM;YACT,OAAO,0BAAc,CAAC,eAAe,CAAA;IACzC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,CAAC;AAED,SAAgB,oBAAoB,CAAC,UAAgC;IACnE,MAAM,IAAI,GAAmB,4BAAgB,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAC5E,QAAQ,IAAI,EAAE,CAAC;QACb;YACE,OAAO,KAAK,CAAA;QACd;YACE,iHAAiH;YACjH,OAAO,MAAM,CAAA;QACf;YACE,OAAO,KAAK,CAAA;QACd;YACE,MAAM,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC3D,CAAC;AACH,CAAC"}
|
package/src/impl/IStatusList.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { IAgentContext, ICredentialPlugin } from '@veramo/core'
|
|
2
|
-
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
3
|
-
import {
|
|
4
|
-
CheckStatusIndexArgs,
|
|
5
|
-
CreateStatusListArgs,
|
|
6
|
-
Status2021,
|
|
7
|
-
StatusListResult,
|
|
8
|
-
StatusOAuth,
|
|
9
|
-
ToStatusListDetailsArgs,
|
|
10
|
-
UpdateStatusListFromEncodedListArgs,
|
|
11
|
-
UpdateStatusListIndexArgs,
|
|
12
|
-
} from '../types'
|
|
13
|
-
|
|
14
|
-
export interface IStatusList {
|
|
15
|
-
/**
|
|
16
|
-
* Creates a new status list of the specific type
|
|
17
|
-
*/
|
|
18
|
-
createNewStatusList(args: CreateStatusListArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Updates a status at the given index in the status list
|
|
22
|
-
*/
|
|
23
|
-
updateStatusListIndex(args: UpdateStatusListIndexArgs, context: IAgentContext<ICredentialPlugin & IIdentifierResolution>): Promise<StatusListResult>
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Updates a status list using a base64 encoded list of statuses
|
|
27
|
-
*/
|
|
28
|
-
updateStatusListFromEncodedList(
|
|
29
|
-
args: UpdateStatusListFromEncodedListArgs,
|
|
30
|
-
context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
|
|
31
|
-
): Promise<StatusListResult>
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Checks the status at a given index in the status list
|
|
35
|
-
*/
|
|
36
|
-
checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | Status2021 | StatusOAuth>
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Collects the status list details
|
|
40
|
-
*/
|
|
41
|
-
toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult>
|
|
42
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { IAgentContext, ICredentialPlugin, IKeyManager } from '@veramo/core'
|
|
2
|
-
import { CompactJWT, CWT, ProofFormat, StatusListType } from '@sphereon/ssi-types'
|
|
3
|
-
import {
|
|
4
|
-
CheckStatusIndexArgs,
|
|
5
|
-
CreateStatusListArgs,
|
|
6
|
-
SignedStatusListData,
|
|
7
|
-
StatusListResult,
|
|
8
|
-
StatusOAuth,
|
|
9
|
-
ToStatusListDetailsArgs,
|
|
10
|
-
UpdateStatusListFromEncodedListArgs,
|
|
11
|
-
UpdateStatusListIndexArgs,
|
|
12
|
-
} from '../types'
|
|
13
|
-
import { determineProofFormat, getAssertedValue, getAssertedValues } from '../utils'
|
|
14
|
-
import { IStatusList } from './IStatusList'
|
|
15
|
-
import { StatusList } from '@sd-jwt/jwt-status-list'
|
|
16
|
-
import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service'
|
|
17
|
-
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
18
|
-
import { createSignedJwt, decodeStatusListJWT } from './encoding/jwt'
|
|
19
|
-
import { createSignedCbor, decodeStatusListCWT } from './encoding/cbor'
|
|
20
|
-
|
|
21
|
-
type IRequiredContext = IAgentContext<ICredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>
|
|
22
|
-
|
|
23
|
-
export const DEFAULT_BITS_PER_STATUS = 2 // 2 bits are sufficient for 0x00 - "VALID" 0x01 - "INVALID" & 0x02 - "SUSPENDED"
|
|
24
|
-
export const DEFAULT_LIST_LENGTH = 250000
|
|
25
|
-
export const DEFAULT_PROOF_FORMAT = 'jwt' as ProofFormat
|
|
26
|
-
|
|
27
|
-
export class OAuthStatusListImplementation implements IStatusList {
|
|
28
|
-
async createNewStatusList(args: CreateStatusListArgs, context: IRequiredContext): Promise<StatusListResult> {
|
|
29
|
-
if (!args.oauthStatusList) {
|
|
30
|
-
throw new Error('OAuthStatusList options are required for type OAuthStatusList')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const proofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT
|
|
34
|
-
const { issuer, id, oauthStatusList, keyRef } = args
|
|
35
|
-
const { bitsPerStatus, expiresAt } = oauthStatusList
|
|
36
|
-
const length = args.length ?? DEFAULT_LIST_LENGTH
|
|
37
|
-
const issuerString = typeof issuer === 'string' ? issuer : issuer.id
|
|
38
|
-
const correlationId = getAssertedValue('correlationId', args.correlationId)
|
|
39
|
-
|
|
40
|
-
const statusList = new StatusList(new Array(length).fill(0), bitsPerStatus ?? DEFAULT_BITS_PER_STATUS)
|
|
41
|
-
const encodedList = statusList.compressStatusList()
|
|
42
|
-
const { statusListCredential } = await this.createSignedStatusList(proofFormat, context, statusList, issuerString, id, expiresAt, keyRef)
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
encodedList,
|
|
46
|
-
statusListCredential,
|
|
47
|
-
oauthStatusList: { bitsPerStatus },
|
|
48
|
-
length,
|
|
49
|
-
type: StatusListType.OAuthStatusList,
|
|
50
|
-
proofFormat,
|
|
51
|
-
id,
|
|
52
|
-
correlationId,
|
|
53
|
-
issuer,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async updateStatusListIndex(args: UpdateStatusListIndexArgs, context: IRequiredContext): Promise<StatusListResult> {
|
|
58
|
-
const { statusListCredential, value, expiresAt, keyRef } = args
|
|
59
|
-
if (typeof statusListCredential !== 'string') {
|
|
60
|
-
return Promise.reject('statusListCredential in neither JWT nor CWT')
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const proofFormat = determineProofFormat(statusListCredential)
|
|
64
|
-
const decoded = proofFormat === 'jwt' ? decodeStatusListJWT(statusListCredential) : decodeStatusListCWT(statusListCredential)
|
|
65
|
-
const { statusList, issuer, id } = decoded
|
|
66
|
-
|
|
67
|
-
const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
|
|
68
|
-
if (index < 0 || index >= statusList.statusList.length) {
|
|
69
|
-
throw new Error('Status list index out of bounds')
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
statusList.setStatus(index, value)
|
|
73
|
-
const { statusListCredential: signedCredential, encodedList } = await this.createSignedStatusList(
|
|
74
|
-
proofFormat,
|
|
75
|
-
context,
|
|
76
|
-
statusList,
|
|
77
|
-
issuer,
|
|
78
|
-
id,
|
|
79
|
-
expiresAt,
|
|
80
|
-
keyRef,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
statusListCredential: signedCredential,
|
|
85
|
-
encodedList,
|
|
86
|
-
oauthStatusList: {
|
|
87
|
-
bitsPerStatus: statusList.getBitsPerStatus(),
|
|
88
|
-
},
|
|
89
|
-
length: statusList.statusList.length,
|
|
90
|
-
type: StatusListType.OAuthStatusList,
|
|
91
|
-
proofFormat,
|
|
92
|
-
id,
|
|
93
|
-
issuer,
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async updateStatusListFromEncodedList(args: UpdateStatusListFromEncodedListArgs, context: IRequiredContext): Promise<StatusListResult> {
|
|
98
|
-
if (!args.oauthStatusList) {
|
|
99
|
-
throw new Error('OAuthStatusList options are required for type OAuthStatusList')
|
|
100
|
-
}
|
|
101
|
-
const { proofFormat, oauthStatusList, keyRef } = args
|
|
102
|
-
const { bitsPerStatus, expiresAt } = oauthStatusList
|
|
103
|
-
|
|
104
|
-
const { issuer, id } = getAssertedValues(args)
|
|
105
|
-
const issuerString = typeof issuer === 'string' ? issuer : issuer.id
|
|
106
|
-
|
|
107
|
-
const listToUpdate = StatusList.decompressStatusList(args.encodedList, bitsPerStatus ?? DEFAULT_BITS_PER_STATUS)
|
|
108
|
-
const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
|
|
109
|
-
listToUpdate.setStatus(index, args.value ? 1 : 0)
|
|
110
|
-
|
|
111
|
-
const { statusListCredential, encodedList } = await this.createSignedStatusList(
|
|
112
|
-
proofFormat ?? DEFAULT_PROOF_FORMAT,
|
|
113
|
-
context,
|
|
114
|
-
listToUpdate,
|
|
115
|
-
issuerString,
|
|
116
|
-
id,
|
|
117
|
-
expiresAt,
|
|
118
|
-
keyRef,
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
encodedList,
|
|
123
|
-
statusListCredential,
|
|
124
|
-
oauthStatusList: {
|
|
125
|
-
bitsPerStatus,
|
|
126
|
-
expiresAt,
|
|
127
|
-
},
|
|
128
|
-
length: listToUpdate.statusList.length,
|
|
129
|
-
type: StatusListType.OAuthStatusList,
|
|
130
|
-
proofFormat: proofFormat ?? DEFAULT_PROOF_FORMAT,
|
|
131
|
-
id,
|
|
132
|
-
issuer,
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | StatusOAuth> {
|
|
137
|
-
const { statusListCredential, statusListIndex } = args
|
|
138
|
-
if (typeof statusListCredential !== 'string') {
|
|
139
|
-
return Promise.reject('statusListCredential in neither JWT nor CWT')
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const proofFormat = determineProofFormat(statusListCredential)
|
|
143
|
-
const { statusList } = proofFormat === 'jwt' ? decodeStatusListJWT(statusListCredential) : decodeStatusListCWT(statusListCredential)
|
|
144
|
-
|
|
145
|
-
const index = typeof statusListIndex === 'number' ? statusListIndex : parseInt(statusListIndex)
|
|
146
|
-
if (index < 0 || index >= statusList.statusList.length) {
|
|
147
|
-
throw new Error('Status list index out of bounds')
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return statusList.getStatus(index)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
async toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult> {
|
|
154
|
-
const { statusListPayload } = args as { statusListPayload: CompactJWT | CWT }
|
|
155
|
-
const proofFormat = determineProofFormat(statusListPayload)
|
|
156
|
-
const decoded = proofFormat === 'jwt' ? decodeStatusListJWT(statusListPayload) : decodeStatusListCWT(statusListPayload)
|
|
157
|
-
const { statusList, issuer, id, exp } = decoded
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
id,
|
|
161
|
-
encodedList: statusList.compressStatusList(),
|
|
162
|
-
issuer,
|
|
163
|
-
type: StatusListType.OAuthStatusList,
|
|
164
|
-
proofFormat,
|
|
165
|
-
length: statusList.statusList.length,
|
|
166
|
-
statusListCredential: statusListPayload,
|
|
167
|
-
oauthStatusList: {
|
|
168
|
-
bitsPerStatus: statusList.getBitsPerStatus(),
|
|
169
|
-
...(exp && { expiresAt: new Date(exp * 1000) }),
|
|
170
|
-
},
|
|
171
|
-
...(args.correlationId && { correlationId: args.correlationId }),
|
|
172
|
-
...(args.driverType && { driverType: args.driverType }),
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
private async createSignedStatusList(
|
|
177
|
-
proofFormat: 'jwt' | 'lds' | 'EthereumEip712Signature2021' | 'cbor',
|
|
178
|
-
context: IAgentContext<ICredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>,
|
|
179
|
-
statusList: StatusList,
|
|
180
|
-
issuerString: string,
|
|
181
|
-
id: string,
|
|
182
|
-
expiresAt?: Date,
|
|
183
|
-
keyRef?: string,
|
|
184
|
-
): Promise<SignedStatusListData> {
|
|
185
|
-
switch (proofFormat) {
|
|
186
|
-
case 'jwt': {
|
|
187
|
-
return await createSignedJwt(context, statusList, issuerString, id, expiresAt, keyRef)
|
|
188
|
-
}
|
|
189
|
-
case 'cbor': {
|
|
190
|
-
return await createSignedCbor(context, statusList, issuerString, id, expiresAt, keyRef)
|
|
191
|
-
}
|
|
192
|
-
default:
|
|
193
|
-
throw new Error(`Invalid proof format '${proofFormat}' for OAuthStatusList`)
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|