@sphereon/ssi-sdk.vc-status-list 0.33.1-feature.vcdm2.4 → 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.
- package/dist/index.cjs +993 -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 +945 -4
- package/dist/index.js.map +1 -1
- package/package.json +26 -16
- package/src/functions.ts +2 -0
- package/src/impl/encoding/cbor.ts +1 -1
- package/src/types/index.ts +1 -1
- package/dist/functions.d.ts +0 -69
- package/dist/functions.d.ts.map +0 -1
- package/dist/functions.js +0 -172
- 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 -2
- 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 -144
- 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 -179
- 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 -29
- 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 -123
- 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 -9
- 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 -61
- 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 -12
- 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 -79
- package/dist/utils.js.map +0 -1
|
@@ -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,61 +0,0 @@
|
|
|
1
|
-
import { JoseSignatureAlgorithm } from '@sphereon/ssi-types';
|
|
2
|
-
import { createHeaderAndPayload, StatusList } from '@sd-jwt/jwt-status-list';
|
|
3
|
-
import base64url from 'base64url';
|
|
4
|
-
import { resolveIdentifier } from './common';
|
|
5
|
-
import { ensureManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
6
|
-
const STATUS_LIST_JWT_TYP = 'statuslist+jwt';
|
|
7
|
-
export const createSignedJwt = async (context, statusList, issuerString, id, expiresAt, keyRef) => {
|
|
8
|
-
const identifier = await resolveIdentifier(context, issuerString, keyRef);
|
|
9
|
-
const resolution = await ensureManagedIdentifierResult(identifier, context);
|
|
10
|
-
const payload = {
|
|
11
|
-
iss: issuerString,
|
|
12
|
-
sub: id,
|
|
13
|
-
iat: Math.floor(Date.now() / 1000),
|
|
14
|
-
...(expiresAt && { exp: Math.floor(expiresAt.getTime() / 1000) }),
|
|
15
|
-
};
|
|
16
|
-
const header = {
|
|
17
|
-
alg: getSigningAlgo(resolution.key.type),
|
|
18
|
-
typ: STATUS_LIST_JWT_TYP,
|
|
19
|
-
};
|
|
20
|
-
const values = createHeaderAndPayload(statusList, payload, header);
|
|
21
|
-
const signedJwt = await context.agent.jwtCreateJwsCompactSignature({
|
|
22
|
-
issuer: { ...identifier, noIssPayloadUpdate: false },
|
|
23
|
-
protectedHeader: values.header,
|
|
24
|
-
payload: values.payload,
|
|
25
|
-
});
|
|
26
|
-
return {
|
|
27
|
-
statusListCredential: signedJwt.jwt,
|
|
28
|
-
encodedList: values.payload.status_list.lst,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export const decodeStatusListJWT = (jwt) => {
|
|
32
|
-
const [, payloadBase64] = jwt.split('.');
|
|
33
|
-
const payload = JSON.parse(base64url.decode(payloadBase64));
|
|
34
|
-
if (!payload.iss || !payload.sub || !payload.status_list) {
|
|
35
|
-
throw new Error('Missing required fields in JWT payload');
|
|
36
|
-
}
|
|
37
|
-
const statusList = StatusList.decompressStatusList(payload.status_list.lst, payload.status_list.bits);
|
|
38
|
-
return {
|
|
39
|
-
issuer: payload.iss,
|
|
40
|
-
id: payload.sub,
|
|
41
|
-
statusList,
|
|
42
|
-
exp: payload.exp,
|
|
43
|
-
ttl: payload.ttl,
|
|
44
|
-
iat: payload.iat,
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export const getSigningAlgo = (type) => {
|
|
48
|
-
switch (type) {
|
|
49
|
-
case 'Ed25519':
|
|
50
|
-
return JoseSignatureAlgorithm.EdDSA;
|
|
51
|
-
case 'Secp256k1':
|
|
52
|
-
return JoseSignatureAlgorithm.ES256K;
|
|
53
|
-
case 'Secp256r1':
|
|
54
|
-
return JoseSignatureAlgorithm.ES256;
|
|
55
|
-
case 'RSA':
|
|
56
|
-
return JoseSignatureAlgorithm.RS256;
|
|
57
|
-
default:
|
|
58
|
-
throw Error('Key type not yet supported');
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=jwt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../src/impl/encoding/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAuD,MAAM,yBAAyB,CAAA;AACjI,OAAO,SAAS,MAAM,WAAW,CAAA;AAGjC,OAAO,EAA4B,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEtE,OAAO,EAAE,6BAA6B,EAA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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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AAa,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"}
|
package/dist/types/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export var StatusOAuth;
|
|
2
|
-
(function (StatusOAuth) {
|
|
3
|
-
StatusOAuth[StatusOAuth["Valid"] = 0] = "Valid";
|
|
4
|
-
StatusOAuth[StatusOAuth["Invalid"] = 1] = "Invalid";
|
|
5
|
-
StatusOAuth[StatusOAuth["Suspended"] = 2] = "Suspended";
|
|
6
|
-
})(StatusOAuth || (StatusOAuth = {}));
|
|
7
|
-
export var Status2021;
|
|
8
|
-
(function (Status2021) {
|
|
9
|
-
Status2021[Status2021["Valid"] = 0] = "Valid";
|
|
10
|
-
Status2021[Status2021["Invalid"] = 1] = "Invalid";
|
|
11
|
-
})(Status2021 || (Status2021 = {}));
|
|
12
|
-
//# 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,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,+CAAS,CAAA;IACT,mDAAW,CAAA;IACX,uDAAa,CAAA;AACf,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,iDAAW,CAAA;AACb,CAAC,EAHW,UAAU,KAAV,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,79 +0,0 @@
|
|
|
1
|
-
import { CredentialMapper, StatusListType, } from '@sphereon/ssi-types';
|
|
2
|
-
import { jwtDecode } from 'jwt-decode';
|
|
3
|
-
export function getAssertedStatusListType(type) {
|
|
4
|
-
const assertedType = type ?? StatusListType.StatusList2021;
|
|
5
|
-
if (![StatusListType.StatusList2021, StatusListType.OAuthStatusList].includes(assertedType)) {
|
|
6
|
-
throw Error(`StatusList type ${assertedType} is not supported (yet)`);
|
|
7
|
-
}
|
|
8
|
-
return assertedType;
|
|
9
|
-
}
|
|
10
|
-
export function getAssertedValue(name, value) {
|
|
11
|
-
if (value === undefined || value === null) {
|
|
12
|
-
throw Error(`Missing required ${name} value`);
|
|
13
|
-
}
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
export function getAssertedValues(args) {
|
|
17
|
-
const type = getAssertedStatusListType(args?.type);
|
|
18
|
-
const id = getAssertedValue('id', args.id);
|
|
19
|
-
const issuer = getAssertedValue('issuer', args.issuer);
|
|
20
|
-
return { id, issuer, type };
|
|
21
|
-
}
|
|
22
|
-
export function getAssertedProperty(propertyName, obj) {
|
|
23
|
-
if (!(propertyName in obj)) {
|
|
24
|
-
throw Error(`The input object does not contain required property: ${propertyName}`);
|
|
25
|
-
}
|
|
26
|
-
return getAssertedValue(propertyName, obj[propertyName]);
|
|
27
|
-
}
|
|
28
|
-
const ValidProofTypeMap = new Map([
|
|
29
|
-
[StatusListType.StatusList2021, ['jwt', 'lds', 'EthereumEip712Signature2021']],
|
|
30
|
-
[StatusListType.OAuthStatusList, ['jwt', 'cbor']],
|
|
31
|
-
]);
|
|
32
|
-
export function assertValidProofType(type, proofFormat) {
|
|
33
|
-
const validProofTypes = ValidProofTypeMap.get(type);
|
|
34
|
-
if (!validProofTypes?.includes(proofFormat)) {
|
|
35
|
-
throw Error(`Invalid proof format '${proofFormat}' for status list type ${type}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export function determineStatusListType(credential) {
|
|
39
|
-
const proofFormat = determineProofFormat(credential);
|
|
40
|
-
switch (proofFormat) {
|
|
41
|
-
case 'jwt':
|
|
42
|
-
const payload = jwtDecode(credential);
|
|
43
|
-
const keys = Object.keys(payload);
|
|
44
|
-
if (keys.includes('status_list')) {
|
|
45
|
-
return StatusListType.OAuthStatusList;
|
|
46
|
-
}
|
|
47
|
-
else if (keys.includes('vc')) {
|
|
48
|
-
return StatusListType.StatusList2021;
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
case 'lds':
|
|
52
|
-
const uniform = CredentialMapper.toUniformCredential(credential);
|
|
53
|
-
const type = uniform.type.find((t) => {
|
|
54
|
-
return Object.values(StatusListType).some((statusType) => t.includes(statusType));
|
|
55
|
-
});
|
|
56
|
-
if (!type) {
|
|
57
|
-
throw new Error('Invalid status list credential type');
|
|
58
|
-
}
|
|
59
|
-
return type.replace('Credential', '');
|
|
60
|
-
case 'cbor':
|
|
61
|
-
return StatusListType.OAuthStatusList;
|
|
62
|
-
}
|
|
63
|
-
throw new Error('Cannot determine status list type from credential payload');
|
|
64
|
-
}
|
|
65
|
-
export function determineProofFormat(credential) {
|
|
66
|
-
const type = CredentialMapper.detectDocumentType(credential);
|
|
67
|
-
switch (type) {
|
|
68
|
-
case 0 /* DocumentFormat.JWT */:
|
|
69
|
-
return 'jwt';
|
|
70
|
-
case 4 /* DocumentFormat.MSO_MDOC */:
|
|
71
|
-
// Not really mdoc, just assume Cbor for now, I'd need to decode at least the header to what type of Cbor we have
|
|
72
|
-
return 'cbor';
|
|
73
|
-
case 1 /* DocumentFormat.JSONLD */:
|
|
74
|
-
return 'lds';
|
|
75
|
-
default:
|
|
76
|
-
throw Error('Cannot determine credential payload type');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# 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":"AAAA,OAAO,EACL,gBAAgB,EAGhB,cAAc,GAIf,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,UAAU,yBAAyB,CAAC,IAAqB;IAC7D,MAAM,YAAY,GAAG,IAAI,IAAI,cAAc,CAAC,cAAc,CAAA;IAC1D,IAAI,CAAC,CAAC,cAAc,CAAC,cAAc,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5F,MAAM,KAAK,CAAC,mBAAmB,YAAY,yBAAyB,CAAC,CAAA;IACvE,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAI,IAAY,EAAE,KAAQ;IACxD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,MAAM,KAAK,CAAC,oBAAoB,IAAI,QAAQ,CAAC,CAAA;IAC/C,CAAC;IACD,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