@sphereon/oid4vci-common 0.10.4-unstable.81 → 0.12.0
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/events/index.d.ts +17 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +21 -0
- package/dist/events/index.js.map +1 -0
- package/dist/experimental/holder-vci.d.ts +13 -0
- package/dist/experimental/holder-vci.d.ts.map +1 -0
- package/dist/experimental/holder-vci.js +9 -0
- package/dist/experimental/holder-vci.js.map +1 -0
- package/dist/functions/CredentialOfferUtil.d.ts +3 -7
- package/dist/functions/CredentialOfferUtil.d.ts.map +1 -1
- package/dist/functions/CredentialOfferUtil.js +63 -64
- package/dist/functions/CredentialOfferUtil.js.map +1 -1
- package/dist/functions/CredentialRequestUtil.d.ts.map +1 -1
- package/dist/functions/CredentialRequestUtil.js +7 -10
- package/dist/functions/CredentialRequestUtil.js.map +1 -1
- package/dist/functions/CredentialResponseUtil.d.ts +3 -1
- package/dist/functions/CredentialResponseUtil.d.ts.map +1 -1
- package/dist/functions/CredentialResponseUtil.js +1 -1
- package/dist/functions/CredentialResponseUtil.js.map +1 -1
- package/dist/functions/IssuerMetadataUtils.d.ts +10 -3
- package/dist/functions/IssuerMetadataUtils.d.ts.map +1 -1
- package/dist/functions/IssuerMetadataUtils.js +147 -30
- package/dist/functions/IssuerMetadataUtils.js.map +1 -1
- package/dist/functions/ProofUtil.d.ts +38 -0
- package/dist/functions/ProofUtil.d.ts.map +1 -0
- package/dist/functions/ProofUtil.js +141 -0
- package/dist/functions/ProofUtil.js.map +1 -0
- package/dist/functions/index.d.ts +1 -0
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +1 -0
- package/dist/functions/index.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Authorization.types.d.ts +15 -1
- package/dist/types/Authorization.types.d.ts.map +1 -1
- package/dist/types/Authorization.types.js +7 -1
- package/dist/types/Authorization.types.js.map +1 -1
- package/dist/types/CredentialIssuance.types.d.ts +7 -3
- package/dist/types/CredentialIssuance.types.d.ts.map +1 -1
- package/dist/types/CredentialIssuance.types.js.map +1 -1
- package/dist/types/Generic.types.d.ts +21 -3
- package/dist/types/Generic.types.d.ts.map +1 -1
- package/dist/types/Generic.types.js.map +1 -1
- package/dist/types/StateManager.types.d.ts +1 -0
- package/dist/types/StateManager.types.d.ts.map +1 -1
- package/dist/types/StateManager.types.js.map +1 -1
- package/dist/types/v1_0_11.types.d.ts +2 -1
- package/dist/types/v1_0_11.types.d.ts.map +1 -1
- package/dist/types/v1_0_11.types.js.map +1 -1
- package/dist/types/v1_0_13.types.d.ts +6 -9
- package/dist/types/v1_0_13.types.d.ts.map +1 -1
- package/lib/__tests__/CredentialOfferUtil.spec.ts +19 -3
- package/lib/events/index.ts +20 -0
- package/lib/experimental/holder-vci.ts +19 -0
- package/lib/functions/CredentialOfferUtil.ts +57 -60
- package/lib/functions/CredentialRequestUtil.ts +8 -11
- package/lib/functions/CredentialResponseUtil.ts +4 -4
- package/lib/functions/IssuerMetadataUtils.ts +141 -38
- package/lib/functions/ProofUtil.ts +185 -0
- package/lib/functions/index.ts +1 -0
- package/lib/index.ts +7 -0
- package/lib/types/Authorization.types.ts +17 -1
- package/lib/types/CredentialIssuance.types.ts +8 -3
- package/lib/types/Generic.types.ts +38 -12
- package/lib/types/StateManager.types.ts +1 -0
- package/lib/types/v1_0_11.types.ts +3 -0
- package/lib/types/v1_0_13.types.ts +19 -14
- package/package.json +3 -11
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ICredentialContextType, IVerifiableCredential, W3CVerifiableCredential } from '@sphereon/ssi-types';
|
|
2
2
|
|
|
3
|
+
import { ExperimentalSubjectIssuance } from '../experimental/holder-vci';
|
|
4
|
+
|
|
3
5
|
import { ProofOfPossession } from './CredentialIssuance.types';
|
|
4
6
|
import { AuthorizationServerMetadata } from './ServerMetadata';
|
|
5
7
|
import { CredentialOfferSession } from './StateManager.types';
|
|
@@ -15,6 +17,8 @@ import {
|
|
|
15
17
|
export type InputCharSet = 'numeric' | 'text';
|
|
16
18
|
export type KeyProofType = 'jwt' | 'cwt' | 'ldp_vp';
|
|
17
19
|
|
|
20
|
+
export type PoPMode = 'pop' | 'jwt'; // Proof of posession, or regular JWT
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* Important Note: please be aware that these Common interfaces are based on versions v1_0.11 and v1_0.09
|
|
20
24
|
*/
|
|
@@ -62,6 +66,7 @@ export interface CredentialIssuerMetadataOpts {
|
|
|
62
66
|
credential_issuer: string; // REQUIRED. The Credential Issuer's identifier.
|
|
63
67
|
authorization_server?: string; // OPTIONAL. Identifier of the OAuth 2.0 Authorization Server (as defined in [RFC8414]) the Credential Issuer relies on for authorization. If this element is omitted, the entity providing the Credential Issuer is also acting as the AS, i.e. the Credential Issuer's identifier is used as the OAuth 2.0 Issuer value to obtain the Authorization Server metadata as per [RFC8414].
|
|
64
68
|
token_endpoint?: string;
|
|
69
|
+
notification_endpoint?: string;
|
|
65
70
|
display?: MetadataDisplay[]; // An array of objects, where each object contains display properties of a Credential Issuer for a certain language. Below is a non-exhaustive list of valid parameters that MAY be included:
|
|
66
71
|
credential_supplier_config?: CredentialSupplierConfig;
|
|
67
72
|
}
|
|
@@ -118,17 +123,18 @@ export interface ProofType {
|
|
|
118
123
|
proof_signing_alg_values_supported: string[];
|
|
119
124
|
}
|
|
120
125
|
|
|
121
|
-
export type CommonCredentialSupported = CredentialSupportedBrief &
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
export type CommonCredentialSupported = CredentialSupportedBrief &
|
|
127
|
+
ExperimentalSubjectIssuance & {
|
|
128
|
+
format: OID4VCICredentialFormat | string; //REQUIRED. A JSON string identifying the format of this credential, e.g. jwt_vc_json or ldp_vc.
|
|
129
|
+
id?: string; // OPTIONAL. A JSON string identifying the respective object. The value MUST be unique across all credentials_supported entries in the Credential Issuer Metadata
|
|
130
|
+
display?: CredentialsSupportedDisplay[]; // OPTIONAL. An array of objects, where each object contains the display properties of the supported credential for a certain language
|
|
131
|
+
scope?: string; // OPTIONAL. A JSON string identifying the scope value that this Credential Issuer supports for this particular Credential. The value can be the same across multiple credential_configurations_supported objects. The Authorization Server MUST be able to uniquely identify the Credential Issuer based on the scope value. The Wallet can use this value in the Authorization Request as defined in Section 5.1.2. Scope values in this Credential Issuer metadata MAY duplicate those in the scopes_supported parameter of the Authorization Server.
|
|
132
|
+
proof_types_supported?: Record<KeyProofType, ProofType>;
|
|
127
133
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
134
|
+
/**
|
|
135
|
+
* following properties are non-mso_mdoc specific and we might wanna rethink them when we're going to support mso_mdoc
|
|
136
|
+
*/
|
|
137
|
+
};
|
|
132
138
|
|
|
133
139
|
export interface CredentialSupportedJwtVcJsonLdAndLdpVc extends CommonCredentialSupported {
|
|
134
140
|
types: string[]; // REQUIRED. JSON array designating the types a certain credential type supports
|
|
@@ -217,7 +223,7 @@ export interface ErrorResponse extends Response {
|
|
|
217
223
|
|
|
218
224
|
export type UniformCredentialRequest = CredentialRequestV1_0_11 | CredentialRequestV1_0_13;
|
|
219
225
|
|
|
220
|
-
export interface CommonCredentialRequest {
|
|
226
|
+
export interface CommonCredentialRequest extends ExperimentalSubjectIssuance {
|
|
221
227
|
format: OID4VCICredentialFormat /* | OID4VCICredentialFormat[];*/; // for now it seems only one is supported in the spec
|
|
222
228
|
proof?: ProofOfPossession;
|
|
223
229
|
}
|
|
@@ -239,7 +245,7 @@ export interface CredentialRequestSdJwtVc extends CommonCredentialRequest {
|
|
|
239
245
|
claims?: IssuerCredentialSubject;
|
|
240
246
|
}
|
|
241
247
|
|
|
242
|
-
export interface CommonCredentialResponse {
|
|
248
|
+
export interface CommonCredentialResponse extends ExperimentalSubjectIssuance {
|
|
243
249
|
// format: string; TODO do we still need this for previous version support?
|
|
244
250
|
credential?: W3CVerifiableCredential;
|
|
245
251
|
acceptance_token?: string;
|
|
@@ -367,3 +373,23 @@ export const PRE_AUTH_CODE_LITERAL = 'pre-authorized_code';
|
|
|
367
373
|
export type EndpointMetadataResult = EndpointMetadataResultV1_0_13 | EndpointMetadataResultV1_0_11;
|
|
368
374
|
|
|
369
375
|
export type IssuerMetadata = IssuerMetadataV1_0_13 | IssuerMetadataV1_0_08;
|
|
376
|
+
|
|
377
|
+
export type NotificationEventType = 'credential_accepted' | 'credential_failure' | 'credential_deleted';
|
|
378
|
+
|
|
379
|
+
export interface NotificationRequest {
|
|
380
|
+
notification_id: string;
|
|
381
|
+
event: NotificationEventType | string;
|
|
382
|
+
event_description?: string;
|
|
383
|
+
credential?: any; // Experimental support to have a wallet sign a credential. Not part of the spec
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export type NotificationError = 'invalid_notification_id' | 'invalid_notification_request';
|
|
387
|
+
|
|
388
|
+
export type NotificationResult = {
|
|
389
|
+
error: boolean;
|
|
390
|
+
response?: NotificationErrorResponse;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export interface NotificationErrorResponse {
|
|
394
|
+
error: NotificationError | string;
|
|
395
|
+
}
|
|
@@ -13,6 +13,7 @@ export interface CredentialOfferSession extends StateType {
|
|
|
13
13
|
status: IssueStatus;
|
|
14
14
|
error?: string;
|
|
15
15
|
lastUpdatedAt: number;
|
|
16
|
+
notification_id: string;
|
|
16
17
|
issuerState?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
17
18
|
preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
18
19
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ExperimentalSubjectIssuance } from '../experimental/holder-vci';
|
|
2
|
+
|
|
1
3
|
import { AuthorizationDetailsJwtVcJson, AuthorizationServerOpts, CommonAuthorizationRequest } from './Authorization.types';
|
|
2
4
|
import { UniformCredentialOffer, UniformCredentialOfferRequest } from './CredentialIssuance.types';
|
|
3
5
|
import {
|
|
@@ -80,6 +82,7 @@ export interface CredentialOfferPayloadV1_0_11 {
|
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
export type CredentialRequestV1_0_11 = CommonCredentialRequest &
|
|
85
|
+
ExperimentalSubjectIssuance &
|
|
83
86
|
(CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);
|
|
84
87
|
|
|
85
88
|
export interface CredentialIssuerMetadataV1_0_11 extends CredentialIssuerMetadataOpts, Partial<AuthorizationServerMetadata> {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { ExperimentalSubjectIssuance } from '../experimental/holder-vci';
|
|
2
|
+
|
|
1
3
|
import { JWK, ProofOfPossession } from './CredentialIssuance.types';
|
|
2
4
|
import {
|
|
3
5
|
AlgValue,
|
|
4
6
|
CredentialDataSupplierInput,
|
|
7
|
+
CredentialRequestJwtVcJson,
|
|
8
|
+
CredentialRequestJwtVcJsonLdAndLdpVc,
|
|
9
|
+
CredentialRequestSdJwtVc,
|
|
5
10
|
CredentialsSupportedDisplay,
|
|
6
11
|
CredentialSupplierConfig,
|
|
7
12
|
EncValue,
|
|
@@ -54,20 +59,20 @@ export type CredentialConfigurationSupportedV1_0_13 = {
|
|
|
54
59
|
[x: string]: unknown;
|
|
55
60
|
};
|
|
56
61
|
|
|
57
|
-
export type CredentialRequestV1_0_13 =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
export type CredentialRequestV1_0_13 =
|
|
63
|
+
| (ExperimentalSubjectIssuance & {
|
|
64
|
+
// We add them here to keep existing other request versions happy. They cannot co-exists with an identifier
|
|
65
|
+
format?: OID4VCICredentialFormat /* | OID4VCICredentialFormat[];*/; // for now it seems only one is supported in the spec
|
|
66
|
+
proof?: ProofOfPossession;
|
|
67
|
+
|
|
68
|
+
credential_identifier?: string;
|
|
69
|
+
credential_response_encryption?: {
|
|
70
|
+
jwk: JWK;
|
|
71
|
+
alg: AlgValue;
|
|
72
|
+
enc: EncValue;
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
| (CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);
|
|
71
76
|
|
|
72
77
|
export interface CredentialOfferV1_0_13 {
|
|
73
78
|
credential_offer?: CredentialOfferPayloadV1_0_13;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/oid4vci-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "OpenID 4 Verifiable Credential Issuance Common Types",
|
|
5
5
|
"source": "lib/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build:clean": "tsc --build --clean && tsc --build"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@sphereon/ssi-types": "
|
|
13
|
+
"@sphereon/ssi-types": "0.25.1-unstable.87",
|
|
14
14
|
"cross-fetch": "^3.1.8",
|
|
15
15
|
"jwt-decode": "^3.1.2",
|
|
16
16
|
"sha.js": "^2.4.11",
|
|
@@ -21,14 +21,6 @@
|
|
|
21
21
|
"@types/sha.js": "^2.4.4",
|
|
22
22
|
"typescript": "5.4.5"
|
|
23
23
|
},
|
|
24
|
-
"peerDependencies": {
|
|
25
|
-
"msrcrypto": "^1.5.8"
|
|
26
|
-
},
|
|
27
|
-
"peerDependenciesMeta": {
|
|
28
|
-
"msrcrypto": {
|
|
29
|
-
"optional": true
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
24
|
"engines": {
|
|
33
25
|
"node": ">=18"
|
|
34
26
|
},
|
|
@@ -57,5 +49,5 @@
|
|
|
57
49
|
"publishConfig": {
|
|
58
50
|
"access": "public"
|
|
59
51
|
},
|
|
60
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "a76c382a36e38428391c9e8d1a6b67e477fc659a"
|
|
61
53
|
}
|