@openid4vc/openid4vci 0.5.2 → 0.5.3-alpha-20260702123119
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.d.mts +128 -3
- package/dist/index.mjs +69 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1721,10 +1721,14 @@ declare const zCredentialRequestProof: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1721
1721
|
}, z.core.$strip>, z.ZodObject<{
|
|
1722
1722
|
proof_type: z.ZodLiteral<"attestation">;
|
|
1723
1723
|
attestation: z.ZodString;
|
|
1724
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1725
|
+
proof_type: z.ZodLiteral<"di_vp">;
|
|
1726
|
+
di_vp: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1724
1727
|
}, z.core.$strip>], "proof_type">]>;
|
|
1725
1728
|
declare const zCredentialRequestProofs: z.ZodObject<{
|
|
1726
1729
|
jwt: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1727
1730
|
attestation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1731
|
+
di_vp: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1728
1732
|
}, z.core.$strip>;
|
|
1729
1733
|
type CredentialRequestProof = z.infer<typeof zCredentialRequestProof>;
|
|
1730
1734
|
type CredentialRequestProofsFormatSpecific = z.infer<typeof zCredentialRequestProofs>;
|
|
@@ -1773,10 +1777,14 @@ declare const zCredentialRequestCommon: z.ZodObject<{
|
|
|
1773
1777
|
}, z.core.$strip>, z.ZodObject<{
|
|
1774
1778
|
proof_type: z.ZodLiteral<"attestation">;
|
|
1775
1779
|
attestation: z.ZodString;
|
|
1780
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1781
|
+
proof_type: z.ZodLiteral<"di_vp">;
|
|
1782
|
+
di_vp: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1776
1783
|
}, z.core.$strip>], "proof_type">]>>;
|
|
1777
1784
|
proofs: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>, z.ZodObject<{
|
|
1778
1785
|
jwt: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1779
1786
|
attestation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1787
|
+
di_vp: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1780
1788
|
}, z.core.$strip>>>;
|
|
1781
1789
|
credential_response_encryption: z.ZodOptional<z.ZodObject<{
|
|
1782
1790
|
jwk: z.ZodObject<{
|
|
@@ -1865,10 +1873,14 @@ declare const zCredentialRequestDraft15: z.ZodUnion<readonly [z.ZodIntersection<
|
|
|
1865
1873
|
}, z.core.$strip>, z.ZodObject<{
|
|
1866
1874
|
proof_type: z.ZodLiteral<"attestation">;
|
|
1867
1875
|
attestation: z.ZodString;
|
|
1876
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1877
|
+
proof_type: z.ZodLiteral<"di_vp">;
|
|
1878
|
+
di_vp: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1868
1879
|
}, z.core.$strip>], "proof_type">]>>;
|
|
1869
1880
|
proofs: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>, z.ZodObject<{
|
|
1870
1881
|
jwt: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1871
1882
|
attestation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1883
|
+
di_vp: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1872
1884
|
}, z.core.$strip>>>;
|
|
1873
1885
|
credential_response_encryption: z.ZodOptional<z.ZodObject<{
|
|
1874
1886
|
jwk: z.ZodObject<{
|
|
@@ -1916,10 +1928,14 @@ declare const zCredentialRequestDraft15: z.ZodUnion<readonly [z.ZodIntersection<
|
|
|
1916
1928
|
}, z.core.$strip>, z.ZodObject<{
|
|
1917
1929
|
proof_type: z.ZodLiteral<"attestation">;
|
|
1918
1930
|
attestation: z.ZodString;
|
|
1931
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1932
|
+
proof_type: z.ZodLiteral<"di_vp">;
|
|
1933
|
+
di_vp: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1919
1934
|
}, z.core.$strip>], "proof_type">]>>;
|
|
1920
1935
|
proofs: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>, z.ZodObject<{
|
|
1921
1936
|
jwt: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1922
1937
|
attestation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1938
|
+
di_vp: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1923
1939
|
}, z.core.$strip>>>;
|
|
1924
1940
|
credential_response_encryption: z.ZodOptional<z.ZodObject<{
|
|
1925
1941
|
jwk: z.ZodObject<{
|
|
@@ -1968,10 +1984,14 @@ declare const zCredentialRequestDraft14: z.ZodUnion<readonly [z.ZodPipe<z.ZodInt
|
|
|
1968
1984
|
}, z.core.$strip>, z.ZodObject<{
|
|
1969
1985
|
proof_type: z.ZodLiteral<"attestation">;
|
|
1970
1986
|
attestation: z.ZodString;
|
|
1987
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1988
|
+
proof_type: z.ZodLiteral<"di_vp">;
|
|
1989
|
+
di_vp: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1971
1990
|
}, z.core.$strip>], "proof_type">]>>;
|
|
1972
1991
|
proofs: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>, z.ZodObject<{
|
|
1973
1992
|
jwt: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1974
1993
|
attestation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1994
|
+
di_vp: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1975
1995
|
}, z.core.$strip>>>;
|
|
1976
1996
|
credential_response_encryption: z.ZodOptional<z.ZodObject<{
|
|
1977
1997
|
jwk: z.ZodObject<{
|
|
@@ -2019,6 +2039,9 @@ declare const zCredentialRequestDraft14: z.ZodUnion<readonly [z.ZodPipe<z.ZodInt
|
|
|
2019
2039
|
} | {
|
|
2020
2040
|
proof_type: "attestation";
|
|
2021
2041
|
attestation: string;
|
|
2042
|
+
} | {
|
|
2043
|
+
proof_type: "di_vp";
|
|
2044
|
+
di_vp: Record<string, unknown>;
|
|
2022
2045
|
} | {
|
|
2023
2046
|
[x: string]: unknown;
|
|
2024
2047
|
proof_type: string;
|
|
@@ -2026,6 +2049,7 @@ declare const zCredentialRequestDraft14: z.ZodUnion<readonly [z.ZodPipe<z.ZodInt
|
|
|
2026
2049
|
proofs?: (Record<string, unknown[]> & {
|
|
2027
2050
|
jwt?: string[] | undefined;
|
|
2028
2051
|
attestation?: string[] | undefined;
|
|
2052
|
+
di_vp?: Record<string, unknown>[] | undefined;
|
|
2029
2053
|
}) | undefined;
|
|
2030
2054
|
credential_response_encryption?: {
|
|
2031
2055
|
[x: string]: unknown;
|
|
@@ -2077,6 +2101,9 @@ declare const zCredentialRequestDraft14: z.ZodUnion<readonly [z.ZodPipe<z.ZodInt
|
|
|
2077
2101
|
} | {
|
|
2078
2102
|
proof_type: "attestation";
|
|
2079
2103
|
attestation: string;
|
|
2104
|
+
} | {
|
|
2105
|
+
proof_type: "di_vp";
|
|
2106
|
+
di_vp: Record<string, unknown>;
|
|
2080
2107
|
} | {
|
|
2081
2108
|
[x: string]: unknown;
|
|
2082
2109
|
proof_type: string;
|
|
@@ -2084,6 +2111,7 @@ declare const zCredentialRequestDraft14: z.ZodUnion<readonly [z.ZodPipe<z.ZodInt
|
|
|
2084
2111
|
proofs?: (Record<string, unknown[]> & {
|
|
2085
2112
|
jwt?: string[] | undefined;
|
|
2086
2113
|
attestation?: string[] | undefined;
|
|
2114
|
+
di_vp?: Record<string, unknown>[] | undefined;
|
|
2087
2115
|
}) | undefined;
|
|
2088
2116
|
credential_response_encryption?: {
|
|
2089
2117
|
[x: string]: unknown;
|
|
@@ -2136,10 +2164,14 @@ declare const zCredentialRequestDraft14: z.ZodUnion<readonly [z.ZodPipe<z.ZodInt
|
|
|
2136
2164
|
}, z.core.$strip>, z.ZodObject<{
|
|
2137
2165
|
proof_type: z.ZodLiteral<"attestation">;
|
|
2138
2166
|
attestation: z.ZodString;
|
|
2167
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2168
|
+
proof_type: z.ZodLiteral<"di_vp">;
|
|
2169
|
+
di_vp: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2139
2170
|
}, z.core.$strip>], "proof_type">]>>;
|
|
2140
2171
|
proofs: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>, z.ZodObject<{
|
|
2141
2172
|
jwt: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2142
2173
|
attestation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2174
|
+
di_vp: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
2143
2175
|
}, z.core.$strip>>>;
|
|
2144
2176
|
credential_response_encryption: z.ZodOptional<z.ZodObject<{
|
|
2145
2177
|
jwk: z.ZodObject<{
|
|
@@ -2622,6 +2654,10 @@ type Iso18045 = z.infer<typeof zIso18045>;
|
|
|
2622
2654
|
declare const zAttestationProofTypeIdentifier: z.ZodLiteral<"attestation">;
|
|
2623
2655
|
type AttestationProofTypeIdentifier = z.infer<typeof zAttestationProofTypeIdentifier>;
|
|
2624
2656
|
//#endregion
|
|
2657
|
+
//#region src/formats/proof-type/di-vp/z-di-vp-proof-type.d.ts
|
|
2658
|
+
declare const zDiVpProofTypeIdentifier: z.ZodLiteral<"di_vp">;
|
|
2659
|
+
type DiVpProofTypeIdentifier = z.infer<typeof zDiVpProofTypeIdentifier>;
|
|
2660
|
+
//#endregion
|
|
2625
2661
|
//#region src/formats/proof-type/jwt/z-jwt-proof-type.d.ts
|
|
2626
2662
|
declare const zJwtProofTypeIdentifier: z.ZodLiteral<"jwt">;
|
|
2627
2663
|
type JwtProofTypeIdentifier = z.infer<typeof zJwtProofTypeIdentifier>;
|
|
@@ -2710,7 +2746,7 @@ declare const zCredentialRequestJwtProofTypePayload: z.ZodObject<{
|
|
|
2710
2746
|
type CredentialRequestJwtProofTypePayload = z.infer<typeof zCredentialRequestJwtProofTypePayload>;
|
|
2711
2747
|
//#endregion
|
|
2712
2748
|
//#region src/formats/proof-type/index.d.ts
|
|
2713
|
-
type ProofTypeIdentifier = JwtProofTypeIdentifier | AttestationProofTypeIdentifier;
|
|
2749
|
+
type ProofTypeIdentifier = JwtProofTypeIdentifier | AttestationProofTypeIdentifier | DiVpProofTypeIdentifier;
|
|
2714
2750
|
//#endregion
|
|
2715
2751
|
//#region src/interactive-authorization/create-interactive-authorization-response.d.ts
|
|
2716
2752
|
interface CreateInteractiveAuthorizationCodeResponseOptions {
|
|
@@ -2912,8 +2948,8 @@ declare function createInteractiveAuthorizationErrorResponse(options: CreateInte
|
|
|
2912
2948
|
declare const zInteractiveAuthorizationInitialRequest: z$1.ZodObject<{
|
|
2913
2949
|
interaction_types_supported: z$1.ZodString;
|
|
2914
2950
|
response_type: z$1.ZodDefault<z$1.ZodLiteral<"code">>;
|
|
2915
|
-
scope: z$1.ZodOptional<z$1.ZodString>;
|
|
2916
2951
|
issuer_state: z$1.ZodOptional<z$1.ZodString>;
|
|
2952
|
+
scope: z$1.ZodOptional<z$1.ZodString>;
|
|
2917
2953
|
client_id: z$1.ZodString;
|
|
2918
2954
|
redirect_uri: z$1.ZodOptional<z$1.ZodURL>;
|
|
2919
2955
|
resource: z$1.ZodOptional<z$1.ZodURL>;
|
|
@@ -4305,6 +4341,13 @@ type VerifyJwtCallback = (jwtSigner: JwtSigner$1, jwt: {
|
|
|
4305
4341
|
verified: false;
|
|
4306
4342
|
signerJwk?: Jwk$1;
|
|
4307
4343
|
}>;
|
|
4344
|
+
type VerifyDataIntegrityProofCallback = (dataIntegrityProof: Record<string, unknown>, document: Record<string, unknown>) => OrPromise<{
|
|
4345
|
+
verified: true;
|
|
4346
|
+
signerJwk: Jwk$1;
|
|
4347
|
+
} | {
|
|
4348
|
+
verified: false;
|
|
4349
|
+
signerJwk?: Jwk$1;
|
|
4350
|
+
}>;
|
|
4308
4351
|
interface DecryptJweCallbackOptions {
|
|
4309
4352
|
jwk?: Jwk$1;
|
|
4310
4353
|
}
|
|
@@ -4349,6 +4392,11 @@ interface CallbackContext$1 {
|
|
|
4349
4392
|
* Verify jwt callback for verification of Json Web Tokens
|
|
4350
4393
|
*/
|
|
4351
4394
|
verifyJwt: VerifyJwtCallback;
|
|
4395
|
+
/**
|
|
4396
|
+
* Verify a Data Integrity proof (e.g. the `proof` of a `di_vp` key proof's Verifiable
|
|
4397
|
+
* Presentation). Optional because most issuers won't support the `di_vp` proof type.
|
|
4398
|
+
*/
|
|
4399
|
+
verifyDataIntegrityProof?: VerifyDataIntegrityProofCallback;
|
|
4352
4400
|
/**
|
|
4353
4401
|
* Generate random callback to generate random bytes. Used for
|
|
4354
4402
|
* e.g. the 'jti' value in a dpop jwt, and 'code_verifier' in pkce.
|
|
@@ -4413,6 +4461,34 @@ interface ParseDeferredCredentialRequestReturn {
|
|
|
4413
4461
|
//#region src/formats/proof-type/attestation/attestation-proof-type.d.ts
|
|
4414
4462
|
interface VerifyCredentialRequestAttestationProofOptions extends Omit<VerifyKeyAttestationJwtOptions, 'use'> {}
|
|
4415
4463
|
//#endregion
|
|
4464
|
+
//#region src/formats/proof-type/di-vp/di-vp-proof-type.d.ts
|
|
4465
|
+
interface VerifyCredentialRequestDiVpProofOptions {
|
|
4466
|
+
/**
|
|
4467
|
+
* The di_vp proof — a W3C Verifiable Presentation
|
|
4468
|
+
*/
|
|
4469
|
+
vp: Record<string, unknown>;
|
|
4470
|
+
/**
|
|
4471
|
+
* Expected nonce. Should be a c_nonce previously shared with the wallet
|
|
4472
|
+
*/
|
|
4473
|
+
expectedNonce?: string;
|
|
4474
|
+
/**
|
|
4475
|
+
* Date at which the nonce will expire
|
|
4476
|
+
*/
|
|
4477
|
+
nonceExpiresAt?: Date;
|
|
4478
|
+
/**
|
|
4479
|
+
* The credential issuer identifier, will be matched against the DataIntegrityProof's `domain`.
|
|
4480
|
+
*/
|
|
4481
|
+
credentialIssuer: string;
|
|
4482
|
+
/**
|
|
4483
|
+
* Current time, if not provided a new date instance will be created
|
|
4484
|
+
*/
|
|
4485
|
+
now?: Date;
|
|
4486
|
+
/**
|
|
4487
|
+
* Callbacks required for the di_vp proof verification.
|
|
4488
|
+
*/
|
|
4489
|
+
callbacks: Pick<CallbackContext, 'verifyDataIntegrityProof'>;
|
|
4490
|
+
}
|
|
4491
|
+
//#endregion
|
|
4416
4492
|
//#region src/metadata/credential-issuer/signed-credential-issuer-metadata.d.ts
|
|
4417
4493
|
interface CreateSignedCredentialIssuerMetadataJwtOptions {
|
|
4418
4494
|
/**
|
|
@@ -4935,6 +5011,55 @@ declare class Openid4vciIssuer {
|
|
|
4935
5011
|
};
|
|
4936
5012
|
signer: import("@openid4vc/oauth2").JwtSignerWithJwk;
|
|
4937
5013
|
}>;
|
|
5014
|
+
/**
|
|
5015
|
+
* @throws Oauth2ServerErrorResponseError - if verification of the di_vp proof failed. You can
|
|
5016
|
+
* extract the credential error response from this.
|
|
5017
|
+
*/
|
|
5018
|
+
verifyCredentialRequestDiVpProof(options: Pick<VerifyCredentialRequestDiVpProofOptions, 'vp' | 'now' | 'expectedNonce' | 'nonceExpiresAt'> & {
|
|
5019
|
+
issuerMetadata: IssuerMetadataResult;
|
|
5020
|
+
}): Promise<{
|
|
5021
|
+
vp: Record<string, unknown>;
|
|
5022
|
+
proof: {
|
|
5023
|
+
[x: string]: unknown;
|
|
5024
|
+
type: "DataIntegrityProof";
|
|
5025
|
+
cryptosuite: string;
|
|
5026
|
+
proofPurpose: "authentication";
|
|
5027
|
+
domain: string;
|
|
5028
|
+
verificationMethod: string;
|
|
5029
|
+
challenge?: string | undefined;
|
|
5030
|
+
};
|
|
5031
|
+
signerJwk: {
|
|
5032
|
+
[x: string]: unknown;
|
|
5033
|
+
kty: string;
|
|
5034
|
+
crv?: string | undefined;
|
|
5035
|
+
x?: string | undefined;
|
|
5036
|
+
y?: string | undefined;
|
|
5037
|
+
e?: string | undefined;
|
|
5038
|
+
n?: string | undefined;
|
|
5039
|
+
alg?: string | undefined;
|
|
5040
|
+
d?: string | undefined;
|
|
5041
|
+
dp?: string | undefined;
|
|
5042
|
+
dq?: string | undefined;
|
|
5043
|
+
ext?: boolean | undefined;
|
|
5044
|
+
k?: string | undefined;
|
|
5045
|
+
key_ops?: string[] | undefined;
|
|
5046
|
+
kid?: string | undefined;
|
|
5047
|
+
oth?: {
|
|
5048
|
+
[x: string]: unknown;
|
|
5049
|
+
d?: string | undefined;
|
|
5050
|
+
r?: string | undefined;
|
|
5051
|
+
t?: string | undefined;
|
|
5052
|
+
}[] | undefined;
|
|
5053
|
+
p?: string | undefined;
|
|
5054
|
+
q?: string | undefined;
|
|
5055
|
+
qi?: string | undefined;
|
|
5056
|
+
use?: string | undefined;
|
|
5057
|
+
x5c?: string[] | undefined;
|
|
5058
|
+
x5t?: string | undefined;
|
|
5059
|
+
'x5t#S256'?: string | undefined;
|
|
5060
|
+
x5u?: string | undefined;
|
|
5061
|
+
};
|
|
5062
|
+
}>;
|
|
4938
5063
|
/**
|
|
4939
5064
|
* @throws Oauth2ServerErrorResponseError - when validation of the credential request fails
|
|
4940
5065
|
* You can extract the credential error response from this.
|
|
@@ -5249,5 +5374,5 @@ declare class Openid4vciWalletProvider {
|
|
|
5249
5374
|
createKeyAttestationJwt(options: Omit<CreateKeyAttestationJwtOptions, 'callbacks'>): Promise<string>;
|
|
5250
5375
|
}
|
|
5251
5376
|
//#endregion
|
|
5252
|
-
export { AuthorizationFlow, type CreateCredentialResponseOptions, type CreateCredentialResponseReturn, type CreateInteractiveAuthorizationCodeResponseOptions, type CreateInteractiveAuthorizationErrorResponseOptions, type CreateInteractiveAuthorizationOpenid4vpInteractionOptions, type CreateInteractiveAuthorizationRedirectToWebInteractionOptions, type CreateKeyAttestationJwtOptions, type CredentialConfigurationSupported, type CredentialConfigurationSupportedWithFormats, type CredentialConfigurationsSupported, type CredentialConfigurationsSupportedWithFormats, type CredentialErrorResponse, type CredentialFormatIdentifier, type CredentialIssuerMetadata, type CredentialIssuerMetadataDisplayEntry, type CredentialOfferAuthorizationCodeGrant, type CredentialOfferGrants, type CredentialOfferObject, type CredentialOfferPreAuthorizedCodeGrant, type CredentialOfferPreAuthorizedCodeGrantTxCode, type CredentialRequest, type CredentialRequestFormatSpecific, type CredentialRequestJwtProofTypeHeader, type CredentialRequestJwtProofTypePayload, type CredentialRequestWithFormats, type CredentialResponse, type CredentialResponseEncryption, type DeferredCredentialRequest, type DeferredCredentialResponse, type ExtractScopesForCredentialConfigurationIdsOptions, type GetCredentialConfigurationsMatchingRequestFormatOptions, type InteractiveAuthorizationCodeResponse, type InteractiveAuthorizationFollowUpRequest, type InteractiveAuthorizationInitialRequest, type InteractiveAuthorizationInteractionRequiredResponse, type InteractiveAuthorizationOpenid4vpPresentationResponse, type InteractiveAuthorizationRedirectToWebResponse, type InteractiveAuthorizationRequest, InteractiveAuthorizationRequestType, type InteractiveAuthorizationResponse, type IssuerMetadataResult, type JwtProofTypeIdentifier, type JwtVcJsonFormatIdentifier, type JwtVcJsonLdFormatIdentifier, type LdpVcFormatIdentifier, type LegacySdJwtVcFormatIdentifier, type MsoMdocFormatIdentifier, type NonceResponse, type NotificationErrorResponse, type NotificationEvent, type Oid4vcTsConfig, Openid4vciClient, Openid4vciClientInteractiveAuthorizationError, type Openid4vciClientOptions, Openid4vciDraftVersion, Openid4vciError, type Openid4vciErrorOptions, Openid4vciIssuer, type Openid4vciIssuerOptions, Openid4vciRetrieveCredentialsError, Openid4vciSendNotificationError, Openid4vciVersion, Openid4vciWalletProvider, type Openid4vciWalletProviderOptions, type ParseCredentialRequestReturn, type ParseInteractiveAuthorizationFollowUpRequestResult, type ParseInteractiveAuthorizationInitialRequestResult, type ParseInteractiveAuthorizationRequestOptions, type ParseKeyAttestationJwtOptions, type ProofTypeIdentifier, type RetrieveCredentialsResponseNotOk, type RetrieveCredentialsResponseOk, type SendInteractiveAuthorizationRequestOptions, type SendNotificationResponseNotOk, type SendNotificationResponseOk, type VerifyInteractiveAuthorizationInitialRequestOptions, type VerifyInteractiveAuthorizationInitialRequestReturn, type VerifyKeyAttestationJwtOptions, type VerifyKeyAttestationJwtReturn, createInteractiveAuthorizationCodeResponse, createInteractiveAuthorizationErrorResponse, createInteractiveAuthorizationOpenid4vpInteraction, createInteractiveAuthorizationRedirectToWebInteraction, createKeyAttestationJwt, credentialsSupportedToCredentialConfigurationsSupported, determineAuthorizationServerForCredentialOffer, extractScopesForCredentialConfigurationIds, getCredentialConfigurationsMatchingRequestFormat, getGlobalConfig, parseInteractiveAuthorizationRequest, parseKeyAttestationJwt, sendInteractiveAuthorizationRequest, setGlobalConfig, verifyInteractiveAuthorizationInitialRequest, verifyKeyAttestationJwt, zCredentialIssuerMetadataDraft14Draft15V1 as zCredentialIssuerMetadataSchema };
|
|
5377
|
+
export { AuthorizationFlow, type CreateCredentialResponseOptions, type CreateCredentialResponseReturn, type CreateInteractiveAuthorizationCodeResponseOptions, type CreateInteractiveAuthorizationErrorResponseOptions, type CreateInteractiveAuthorizationOpenid4vpInteractionOptions, type CreateInteractiveAuthorizationRedirectToWebInteractionOptions, type CreateKeyAttestationJwtOptions, type CredentialConfigurationSupported, type CredentialConfigurationSupportedWithFormats, type CredentialConfigurationsSupported, type CredentialConfigurationsSupportedWithFormats, type CredentialErrorResponse, type CredentialFormatIdentifier, type CredentialIssuerMetadata, type CredentialIssuerMetadataDisplayEntry, type CredentialOfferAuthorizationCodeGrant, type CredentialOfferGrants, type CredentialOfferObject, type CredentialOfferPreAuthorizedCodeGrant, type CredentialOfferPreAuthorizedCodeGrantTxCode, type CredentialRequest, type CredentialRequestFormatSpecific, type CredentialRequestJwtProofTypeHeader, type CredentialRequestJwtProofTypePayload, type CredentialRequestWithFormats, type CredentialResponse, type CredentialResponseEncryption, type DeferredCredentialRequest, type DeferredCredentialResponse, type DiVpProofTypeIdentifier, type ExtractScopesForCredentialConfigurationIdsOptions, type GetCredentialConfigurationsMatchingRequestFormatOptions, type InteractiveAuthorizationCodeResponse, type InteractiveAuthorizationFollowUpRequest, type InteractiveAuthorizationInitialRequest, type InteractiveAuthorizationInteractionRequiredResponse, type InteractiveAuthorizationOpenid4vpPresentationResponse, type InteractiveAuthorizationRedirectToWebResponse, type InteractiveAuthorizationRequest, InteractiveAuthorizationRequestType, type InteractiveAuthorizationResponse, type IssuerMetadataResult, type JwtProofTypeIdentifier, type JwtVcJsonFormatIdentifier, type JwtVcJsonLdFormatIdentifier, type LdpVcFormatIdentifier, type LegacySdJwtVcFormatIdentifier, type MsoMdocFormatIdentifier, type NonceResponse, type NotificationErrorResponse, type NotificationEvent, type Oid4vcTsConfig, Openid4vciClient, Openid4vciClientInteractiveAuthorizationError, type Openid4vciClientOptions, Openid4vciDraftVersion, Openid4vciError, type Openid4vciErrorOptions, Openid4vciIssuer, type Openid4vciIssuerOptions, Openid4vciRetrieveCredentialsError, Openid4vciSendNotificationError, Openid4vciVersion, Openid4vciWalletProvider, type Openid4vciWalletProviderOptions, type ParseCredentialRequestReturn, type ParseInteractiveAuthorizationFollowUpRequestResult, type ParseInteractiveAuthorizationInitialRequestResult, type ParseInteractiveAuthorizationRequestOptions, type ParseKeyAttestationJwtOptions, type ProofTypeIdentifier, type RetrieveCredentialsResponseNotOk, type RetrieveCredentialsResponseOk, type SendInteractiveAuthorizationRequestOptions, type SendNotificationResponseNotOk, type SendNotificationResponseOk, type VerifyInteractiveAuthorizationInitialRequestOptions, type VerifyInteractiveAuthorizationInitialRequestReturn, type VerifyKeyAttestationJwtOptions, type VerifyKeyAttestationJwtReturn, createInteractiveAuthorizationCodeResponse, createInteractiveAuthorizationErrorResponse, createInteractiveAuthorizationOpenid4vpInteraction, createInteractiveAuthorizationRedirectToWebInteraction, createKeyAttestationJwt, credentialsSupportedToCredentialConfigurationsSupported, determineAuthorizationServerForCredentialOffer, extractScopesForCredentialConfigurationIds, getCredentialConfigurationsMatchingRequestFormat, getGlobalConfig, parseInteractiveAuthorizationRequest, parseKeyAttestationJwt, sendInteractiveAuthorizationRequest, setGlobalConfig, verifyInteractiveAuthorizationInitialRequest, verifyKeyAttestationJwt, zCredentialIssuerMetadataDraft14Draft15V1 as zCredentialIssuerMetadataSchema };
|
|
5253
5378
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1506,6 +1506,22 @@ const zCredentialRequestProofAttestation = z.object({
|
|
|
1506
1506
|
});
|
|
1507
1507
|
zKeyAttestationJwtPayloadForUse("proof_type.attestation");
|
|
1508
1508
|
//#endregion
|
|
1509
|
+
//#region src/formats/proof-type/di-vp/z-di-vp-proof-type.ts
|
|
1510
|
+
const zDiVpProofTypeIdentifier = z.literal("di_vp");
|
|
1511
|
+
const diVpProofTypeIdentifier = zDiVpProofTypeIdentifier.value;
|
|
1512
|
+
const zCredentialRequestProofDiVp = z.object({
|
|
1513
|
+
proof_type: zDiVpProofTypeIdentifier,
|
|
1514
|
+
di_vp: z.record(z.string(), z.unknown())
|
|
1515
|
+
});
|
|
1516
|
+
const zDataIntegrityProof = z.object({
|
|
1517
|
+
type: z.literal("DataIntegrityProof", { message: `di_vp proof 'proof.type' must be 'DataIntegrityProof'` }),
|
|
1518
|
+
cryptosuite: z.string({ message: `di_vp proof is missing required 'proof.cryptosuite'` }),
|
|
1519
|
+
proofPurpose: z.literal("authentication", { message: `di_vp proof 'proof.proofPurpose' must be 'authentication'` }),
|
|
1520
|
+
domain: z.string(),
|
|
1521
|
+
challenge: z.string().optional(),
|
|
1522
|
+
verificationMethod: z.string({ message: `di_vp proof is missing required 'proof.verificationMethod'` })
|
|
1523
|
+
}).loose();
|
|
1524
|
+
//#endregion
|
|
1509
1525
|
//#region src/formats/proof-type/jwt/z-jwt-proof-type.ts
|
|
1510
1526
|
const zJwtProofTypeIdentifier = z.literal("jwt");
|
|
1511
1527
|
const jwtProofTypeIdentifier = zJwtProofTypeIdentifier.value;
|
|
@@ -1525,12 +1541,17 @@ const zCredentialRequestJwtProofTypePayload = z.object({
|
|
|
1525
1541
|
//#endregion
|
|
1526
1542
|
//#region src/credential-request/z-credential-request-common.ts
|
|
1527
1543
|
const zCredentialRequestProofCommon = z.object({ proof_type: z.string() }).loose();
|
|
1528
|
-
const allCredentialRequestProofs = [
|
|
1544
|
+
const allCredentialRequestProofs = [
|
|
1545
|
+
zCredentialRequestProofJwt,
|
|
1546
|
+
zCredentialRequestProofAttestation,
|
|
1547
|
+
zCredentialRequestProofDiVp
|
|
1548
|
+
];
|
|
1529
1549
|
const zCredentialRequestProof = z.union([zCredentialRequestProofCommon, z.discriminatedUnion("proof_type", allCredentialRequestProofs)]);
|
|
1530
1550
|
const zCredentialRequestProofsCommon = z.record(z.string(), z.array(z.unknown()));
|
|
1531
1551
|
const zCredentialRequestProofs = z.object({
|
|
1532
1552
|
[zJwtProofTypeIdentifier.value]: z.optional(z.array(zCredentialRequestProofJwt.shape.jwt)),
|
|
1533
|
-
[zAttestationProofTypeIdentifier.value]: z.optional(z.array(zCredentialRequestProofAttestation.shape.attestation))
|
|
1553
|
+
[zAttestationProofTypeIdentifier.value]: z.optional(z.array(zCredentialRequestProofAttestation.shape.attestation)),
|
|
1554
|
+
[zDiVpProofTypeIdentifier.value]: z.optional(z.array(zCredentialRequestProofDiVp.shape.di_vp))
|
|
1534
1555
|
});
|
|
1535
1556
|
const zCredentialResponseEncryption = z.object({
|
|
1536
1557
|
jwk: zJwk,
|
|
@@ -2528,6 +2549,7 @@ function parseCredentialRequest(options) {
|
|
|
2528
2549
|
const knownProof = z.union(allCredentialRequestProofs).safeParse(credentialRequest.proof);
|
|
2529
2550
|
if (knownProof.success && knownProof.data.proof_type === jwtProofTypeIdentifier) proofs = { [jwtProofTypeIdentifier]: [knownProof.data.jwt] };
|
|
2530
2551
|
else if (knownProof.success && knownProof.data.proof_type === attestationProofTypeIdentifier) proofs = { [attestationProofTypeIdentifier]: [knownProof.data.attestation] };
|
|
2552
|
+
else if (knownProof.success && knownProof.data.proof_type === diVpProofTypeIdentifier) proofs = { [diVpProofTypeIdentifier]: [knownProof.data.di_vp] };
|
|
2531
2553
|
const credentialResponseEncryption = credentialRequest.credential_response_encryption;
|
|
2532
2554
|
if (credentialRequest.credential_configuration_id) {
|
|
2533
2555
|
getKnownCredentialConfigurationSupportedById(options.issuerMetadata, credentialRequest.credential_configuration_id);
|
|
@@ -2571,6 +2593,27 @@ async function verifyCredentialRequestAttestationProof(options) {
|
|
|
2571
2593
|
});
|
|
2572
2594
|
}
|
|
2573
2595
|
//#endregion
|
|
2596
|
+
//#region src/formats/proof-type/di-vp/di-vp-proof-type.ts
|
|
2597
|
+
async function verifyCredentialRequestDiVpProof(options) {
|
|
2598
|
+
const now = options.now?.getTime() ?? Date.now();
|
|
2599
|
+
if (options.nonceExpiresAt && now > options.nonceExpiresAt.getTime()) throw new Openid4vciError("Nonce used for credential request proof expired");
|
|
2600
|
+
const rawProof = options.vp.proof;
|
|
2601
|
+
if (rawProof === void 0) throw new Openid4vciError(`di_vp proof is missing a 'proof' entry`);
|
|
2602
|
+
const proof = parseWithErrorHandling(zDataIntegrityProof, Array.isArray(rawProof) ? rawProof[0] : rawProof, "di_vp proof contains an invalid proof entry");
|
|
2603
|
+
if (proof.domain !== options.credentialIssuer) throw new Openid4vciError(`di_vp proof 'proof.domain' does not match the credential issuer identifier`);
|
|
2604
|
+
if (options.expectedNonce !== void 0) {
|
|
2605
|
+
if (proof.challenge !== options.expectedNonce) throw new Openid4vciError(`di_vp proof 'proof.challenge' does not match the expected nonce`);
|
|
2606
|
+
} else if (proof.challenge !== void 0) throw new Openid4vciError(`di_vp proof 'proof.challenge' must not be present when no nonce was issued`);
|
|
2607
|
+
if (!options.callbacks.verifyDataIntegrityProof) throw new Openid4vciError("Cannot verify di_vp proof: no verifyDataIntegrityProof callback configured");
|
|
2608
|
+
const result = await options.callbacks.verifyDataIntegrityProof(proof, options.vp);
|
|
2609
|
+
if (!result.verified) throw new Openid4vciError("Error verifying credential request di_vp proof");
|
|
2610
|
+
return {
|
|
2611
|
+
vp: options.vp,
|
|
2612
|
+
proof,
|
|
2613
|
+
signerJwk: result.signerJwk
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
//#endregion
|
|
2574
2617
|
//#region src/metadata/credential-issuer/signed-credential-issuer-metadata.ts
|
|
2575
2618
|
async function createSignedCredentialIssuerMetadataJwt(options) {
|
|
2576
2619
|
const header = parseWithErrorHandling(zSignedCredentialIssuerMetadataHeader, {
|
|
@@ -2678,6 +2721,30 @@ var Openid4vciIssuer = class {
|
|
|
2678
2721
|
}
|
|
2679
2722
|
}
|
|
2680
2723
|
/**
|
|
2724
|
+
* @throws Oauth2ServerErrorResponseError - if verification of the di_vp proof failed. You can
|
|
2725
|
+
* extract the credential error response from this.
|
|
2726
|
+
*/
|
|
2727
|
+
async verifyCredentialRequestDiVpProof(options) {
|
|
2728
|
+
try {
|
|
2729
|
+
return await verifyCredentialRequestDiVpProof({
|
|
2730
|
+
callbacks: this.options.callbacks,
|
|
2731
|
+
credentialIssuer: options.issuerMetadata.credentialIssuer.credential_issuer,
|
|
2732
|
+
expectedNonce: options.expectedNonce,
|
|
2733
|
+
nonceExpiresAt: options.nonceExpiresAt,
|
|
2734
|
+
vp: options.vp,
|
|
2735
|
+
now: options.now
|
|
2736
|
+
});
|
|
2737
|
+
} catch (error) {
|
|
2738
|
+
throw new Oauth2ServerErrorResponseError({
|
|
2739
|
+
error: Oauth2ErrorCodes.InvalidProof,
|
|
2740
|
+
error_description: error instanceof Openid4vciError ? error.message : "Invalid proof"
|
|
2741
|
+
}, {
|
|
2742
|
+
internalMessage: "Error verifying credential request di_vp proof",
|
|
2743
|
+
cause: error
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2681
2748
|
* @throws Oauth2ServerErrorResponseError - when validation of the credential request fails
|
|
2682
2749
|
* You can extract the credential error response from this.
|
|
2683
2750
|
*/
|