@sphereon/ssi-sdk.vc-status-list 0.33.1-next.2 → 0.33.1-next.68
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/index.cjs +979 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +275 -0
- package/dist/index.d.ts +273 -3
- package/dist/index.js +946 -19
- package/dist/index.js.map +1 -1
- package/package.json +28 -17
- package/src/functions.ts +9 -7
- package/src/impl/IStatusList.ts +3 -3
- package/src/impl/OAuthStatusList.ts +7 -7
- package/src/impl/StatusList2021.ts +17 -9
- package/src/impl/StatusListFactory.ts +1 -1
- package/src/impl/encoding/cbor.ts +53 -42
- package/src/impl/encoding/common.ts +1 -1
- package/src/impl/encoding/jwt.ts +6 -6
- package/src/types/index.ts +19 -19
- package/src/utils.ts +6 -6
- package/dist/functions.d.ts +0 -69
- package/dist/functions.d.ts.map +0 -1
- package/dist/functions.js +0 -200
- package/dist/functions.js.map +0 -1
- 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 -21
- package/dist/impl/OAuthStatusList.d.ts.map +0 -1
- package/dist/impl/OAuthStatusList.js +0 -155
- package/dist/impl/OAuthStatusList.js.map +0 -1
- package/dist/impl/StatusList2021.d.ts +0 -16
- package/dist/impl/StatusList2021.d.ts.map +0 -1
- package/dist/impl/StatusList2021.js +0 -186
- 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 -17
- 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/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -209
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -15
- package/dist/types/index.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
|
@@ -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,MAAM,IAAA,0BAAiB,EAAC,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;IACzE,MAAM,UAAU,GAAG,MAAM,IAAA,iEAA6B,EAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAE3E,MAAM,OAA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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"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -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"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -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,EACX,gBAAgB,EACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,oBAAY,WAAW;IACrB,KAAK,IAAI;IACT,OAAO,IAAI;IACX,SAAS,IAAI;CACd;AAED,oBAAY,UAAU;IACpB,KAAK,IAAI;IACT,OAAO,IAAI;CACZ;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,EAAE,2BAA2B,CAAA;IAC9C,aAAa,CAAC,EAAE,iBAAiB,CAAA;CAElC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAA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AAA;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"}
|
package/dist/types/index.js
DELETED
|
@@ -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
|
package/dist/types/index.js.map
DELETED
|
@@ -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
|
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,oDAaC;AA9FD,mDAQ4B;AAC5B,2CAAsC;AAEtC,SAAgB,yBAAyB,CAAC,IAAqB;IAC7D,MAAM,YAAY,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,0BAAc,CAAC,cAAc,CAAA;IAC1D,IAAI,CAAC,CAAC,0BAAc,CAAC,cAAc,EAAE,0BAAc,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,YAA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