@pagopa/io-wallet-oauth2 1.2.0 → 1.3.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/index.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as _openid4vc_oauth2 from '@openid4vc/oauth2';
2
- import { CallbackContext, JwtSigner as JwtSigner$1, JwtSignerJwk as JwtSignerJwk$1, AuthorizationServerMetadata, ClientAttestationJwtPayload, RequestDpopOptions, decodeJwt as decodeJwt$1, JwtSignerWithJwk as JwtSignerWithJwk$1, HttpMethod as HttpMethod$1 } from '@openid4vc/oauth2';
2
+ import { CallbackContext, JwtSigner as JwtSigner$1, JwtSignerJwk as JwtSignerJwk$1, ClientAttestationJwtPayload, RequestDpopOptions, JwtSignerWithJwk as JwtSignerWithJwk$1, HttpMethod as HttpMethod$1 } from '@openid4vc/oauth2';
3
3
  export { CallbackContext, ClientAttestationPopJwtHeader, ClientAttestationPopJwtPayload, DecryptJweCallback, EncryptJweCallback, GenerateRandomCallback, HashAlgorithm, JweEncryptor, JwtSigner, JwtSignerJwk, Oauth2JwtParseError, RequestDpopOptions, SignJwtCallback, VerifyJwtCallback, verifyJwt } from '@openid4vc/oauth2';
4
4
  import z, { z as z$1 } from 'zod';
5
- import { RequestLike as RequestLike$1, ContentType, FetchHeaders, HttpMethod, IoWalletSdkConfig, ItWalletSpecsVersion, Fetch, BaseSchema } from '@pagopa/io-wallet-utils';
5
+ import { RequestLike as RequestLike$1, IoWalletSdkConfig, ItWalletSpecsVersion, FetchHeaders, HttpMethod, BaseSchema, ContentType, Fetch } from '@pagopa/io-wallet-utils';
6
+ import { ItWalletAuthorizationServerMetadata } from '@pagopa/io-wallet-oid-federation';
6
7
 
7
8
  interface RetrieveAuthorizationCodeAccessTokenOptions {
8
9
  /**
@@ -544,245 +545,271 @@ interface CreateClientAttestationPopJwtOptions {
544
545
  }
545
546
  declare function createClientAttestationPopJwt(options: CreateClientAttestationPopJwtOptions): Promise<string>;
546
547
 
547
- /**
548
- * Supported OAuth 2.0 client authentication methods.
549
- */
550
- declare const SupportedClientAuthenticationMethod: {
551
- readonly ClientSecretBasic: "client_secret_basic";
552
- readonly ClientSecretPost: "client_secret_post";
553
- readonly None: "none";
554
- readonly WalletAttestationJwt: "attest_jwt_client_auth";
555
- };
556
- /**
557
- * Union type of supported client authentication methods.
558
- */
559
- type SupportedClientAuthenticationMethod = (typeof SupportedClientAuthenticationMethod)[keyof typeof SupportedClientAuthenticationMethod];
560
- /**
561
- * Options for checking client attestation support.
562
- */
563
- interface IsClientAttestationSupportedOptions {
564
- /** Authorization server metadata containing supported authentication methods. */
565
- authorizationServerMetadata: AuthorizationServerMetadata;
566
- }
567
- /**
568
- * Checks whether the authorization server supports client attestation authentication.
569
- *
570
- * @param options - Configuration including authorization server metadata
571
- * @returns Object with `supported` boolean indicating if client attestation is available
572
- */
573
- declare function isClientAttestationSupported(options: IsClientAttestationSupportedOptions): {
574
- supported: boolean;
575
- };
576
- /**
577
- * Options for client authentication
578
- */
579
- interface ClientAuthenticationCallbackOptions {
548
+ interface ClientAttestationOptions {
580
549
  /**
581
- * Metadata of the authorization server
550
+ * The client attestation DPoP JWT provided in the request.
582
551
  */
583
- authorizationServerMetadata: AuthorizationServerMetadata;
552
+ clientAttestationPopJwt: string;
584
553
  /**
585
- * The body as a JSON object. If content type `x-www-form-urlencoded`
586
- * is used, it will be encoded after this call.
554
+ * Whether to ensure that the key used in client attestation confirmation
555
+ * is the same key used for DPoP. This only has effect if both DPoP and client
556
+ * attestations are present.
587
557
  *
588
- * You can modify this object
558
+ * @default false
589
559
  */
590
- body: Record<string, unknown>;
591
- contentType: ContentType;
560
+ ensureConfirmationKeyMatchesDpopKey?: boolean;
592
561
  /**
593
- * Headers for the request. You can modify this object
562
+ * The wallet attestation JWT provided in the request.
594
563
  */
595
- headers: FetchHeaders;
564
+ walletAttestationJwt: string;
565
+ }
566
+ interface VerifyClientAttestationOptions {
596
567
  /**
597
- * http method that will be used
568
+ * The authorization server metadata.
598
569
  */
599
- method: HttpMethod;
570
+ authorizationServerMetadata: ItWalletAuthorizationServerMetadata;
600
571
  /**
601
- * URL to which the request will be made
572
+ * Callbacks for hashing and JWT verification.
573
+ */
574
+ callbacks: Pick<CallbackContext, "hash" | "verifyJwt">;
575
+ /**
576
+ * The client attestation options.
577
+ */
578
+ clientAttestation: ClientAttestationOptions;
579
+ /**
580
+ * The IT-Wallet SDK configuration, used to select the correct version-specific
581
+ * validation schema for the wallet attestation JWT.
582
+ */
583
+ config: IoWalletSdkConfig;
584
+ /**
585
+ * The DPoP JWK thumbprint value, if DPoP is being used in the request.
586
+ */
587
+ dpopJwkThumbprint?: string;
588
+ /**
589
+ * The current time to use when verifying the JWTs.
590
+ * If not provided current time will be used.
591
+ *
592
+ * @default new Date()
602
593
  */
603
- url: string;
604
- }
605
- /**
606
- * Callback method to determine the client authentication for a request.
607
- */
608
- type ClientAuthenticationCallback = (options: ClientAuthenticationCallbackOptions) => Promise<void> | void;
609
- /**
610
- * Anonymous client authentication
611
- */
612
- declare function clientAuthenticationAnonymous(): ClientAuthenticationCallback;
613
- interface ClientAuthenticationWalletAttestationJwtOptions {
614
- callbacks: Pick<CallbackContext, "generateRandom" | "signJwt">;
615
- walletAttestationJwt: string;
616
- }
617
- /**
618
- * Client authentication using wallet attestation JWT.
619
- * This method adds the wallet attestation JWT and a proof-of-possession JWT to the request headers.
620
- */
621
- declare function clientAuthenticationWalletAttestationJwt(options: ClientAuthenticationWalletAttestationJwtOptions): ClientAuthenticationCallback;
622
-
623
- interface BaseVerifyWalletAttestationJwtOptions {
624
- callbacks: Pick<CallbackContext, "verifyJwt">;
625
594
  now?: Date;
626
- walletAttestationJwt: string;
627
- }
628
- /**
629
- * Base options shared across all wallet attestation versions
630
- */
631
- interface BaseWalletAttestationOptions {
632
- callbacks: Pick<CallbackContext, "signJwt">;
633
- dpopJwkPublic: ClientAttestationJwtPayload["cnf"]["jwk"];
634
- expiresAt?: Date;
635
- issuer: string;
636
- walletLink?: string;
637
- walletName?: string;
638
- }
639
- declare const zOauthClientAttestationHeader: z.ZodLiteral<"OAuth-Client-Attestation">;
640
- declare const oauthClientAttestationHeader: "OAuth-Client-Attestation";
641
- declare const zOauthClientAttestationPopHeader: z.ZodLiteral<"OAuth-Client-Attestation-PoP">;
642
- declare const oauthClientAttestationPopHeader: "OAuth-Client-Attestation-PoP";
643
-
644
- /**
645
- * JWT Header schema for IT-Wallet v1.0 Wallet Attestation
646
- *
647
- * Version 1.0 specifics:
648
- * - trust_chain is REQUIRED
649
- * - x5c is NOT supported
650
- */
651
- declare const zWalletAttestationJwtHeaderV1_0: z$1.ZodObject<{
652
- trust_chain: z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>;
653
- typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
654
- alg: z$1.ZodString;
655
- jwk: z$1.ZodOptional<z$1.ZodObject<{
656
- alg: z$1.ZodOptional<z$1.ZodString>;
657
- crv: z$1.ZodOptional<z$1.ZodString>;
658
- d: z$1.ZodOptional<z$1.ZodString>;
659
- dp: z$1.ZodOptional<z$1.ZodString>;
660
- dq: z$1.ZodOptional<z$1.ZodString>;
661
- e: z$1.ZodOptional<z$1.ZodString>;
662
- ext: z$1.ZodOptional<z$1.ZodBoolean>;
663
- k: z$1.ZodOptional<z$1.ZodString>;
664
- key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
665
- kid: z$1.ZodOptional<z$1.ZodString>;
666
- kty: z$1.ZodString;
667
- n: z$1.ZodOptional<z$1.ZodString>;
668
- oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
669
- d: z$1.ZodOptional<z$1.ZodString>;
670
- r: z$1.ZodOptional<z$1.ZodString>;
671
- t: z$1.ZodOptional<z$1.ZodString>;
672
- }, z$1.core.$loose>>>;
673
- p: z$1.ZodOptional<z$1.ZodString>;
674
- q: z$1.ZodOptional<z$1.ZodString>;
675
- qi: z$1.ZodOptional<z$1.ZodString>;
676
- use: z$1.ZodOptional<z$1.ZodString>;
677
- x: z$1.ZodOptional<z$1.ZodString>;
678
- x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
679
- x5t: z$1.ZodOptional<z$1.ZodString>;
680
- "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
681
- x5u: z$1.ZodOptional<z$1.ZodString>;
682
- y: z$1.ZodOptional<z$1.ZodString>;
683
- }, z$1.core.$loose>>;
684
- kid: z$1.ZodOptional<z$1.ZodString>;
685
- x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
686
- }, z$1.core.$loose>;
687
- /**
688
- * JWT Payload schema for IT-Wallet v1.0 Wallet Attestation
689
- *
690
- * Version 1.0 specifics:
691
- * - Standard claims only
692
- * - No nbf or status support
693
- */
694
- declare const zWalletAttestationJwtPayloadV1_0: z$1.ZodObject<{
695
- aal: z$1.ZodString;
696
- cnf: z$1.ZodObject<{
697
- jwk: z$1.ZodObject<{
698
- alg: z$1.ZodOptional<z$1.ZodString>;
699
- crv: z$1.ZodOptional<z$1.ZodString>;
700
- d: z$1.ZodOptional<z$1.ZodString>;
701
- dp: z$1.ZodOptional<z$1.ZodString>;
702
- dq: z$1.ZodOptional<z$1.ZodString>;
703
- e: z$1.ZodOptional<z$1.ZodString>;
704
- ext: z$1.ZodOptional<z$1.ZodBoolean>;
705
- k: z$1.ZodOptional<z$1.ZodString>;
706
- key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
707
- kid: z$1.ZodOptional<z$1.ZodString>;
708
- kty: z$1.ZodString;
709
- n: z$1.ZodOptional<z$1.ZodString>;
710
- oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
711
- d: z$1.ZodOptional<z$1.ZodString>;
712
- r: z$1.ZodOptional<z$1.ZodString>;
713
- t: z$1.ZodOptional<z$1.ZodString>;
714
- }, z$1.core.$loose>>>;
715
- p: z$1.ZodOptional<z$1.ZodString>;
716
- q: z$1.ZodOptional<z$1.ZodString>;
717
- qi: z$1.ZodOptional<z$1.ZodString>;
718
- use: z$1.ZodOptional<z$1.ZodString>;
719
- x: z$1.ZodOptional<z$1.ZodString>;
720
- x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
721
- x5t: z$1.ZodOptional<z$1.ZodString>;
722
- "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
723
- x5u: z$1.ZodOptional<z$1.ZodString>;
724
- y: z$1.ZodOptional<z$1.ZodString>;
725
- }, z$1.core.$loose>;
726
- }, z$1.core.$strip>;
727
- exp: z$1.ZodNumber;
728
- iat: z$1.ZodNumber;
729
- iss: z$1.ZodString;
730
- sub: z$1.ZodString;
731
- wallet_link: z$1.ZodOptional<z$1.ZodURL>;
732
- wallet_name: z$1.ZodOptional<z$1.ZodString>;
733
- aud: z$1.ZodOptional<z$1.ZodString>;
734
- jti: z$1.ZodOptional<z$1.ZodString>;
735
- nbf: z$1.ZodOptional<z$1.ZodNumber>;
736
- nonce: z$1.ZodOptional<z$1.ZodString>;
737
- status: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
738
- trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
739
- }, z$1.core.$loose>;
740
- /**
741
- * Wallet Attestation JWT type for v1.0
742
- * The JWT is returned as a compact string
743
- */
744
- type WalletAttestationJwtV1_0 = string;
745
- /**
746
- * Zod schema for wallet attestation JWT validation (v1.0)
747
- * Validates that the result is a non-empty string
748
- */
749
- declare const zWalletAttestationJwtV1_0: z$1.ZodString;
750
-
751
- /**
752
- * Options for creating a wallet attestation with v1.0
753
- * Uses only trust_chain (federation method)
754
- */
755
- interface WalletAttestationOptionsV1_0 extends BaseWalletAttestationOptions {
756
595
  /**
757
- * It expresses the strength of the authentication mechanism backing the Wallet instance when interacting with a Relying Party.
596
+ * The client id provided in the authorization request, if any.
597
+ *
598
+ * Pass this when the authorization request includes a `client_id` parameter.
599
+ * The function will verify that it matches the `sub` claim in the client attestation JWT.
600
+ * If not provided, no client_id validation is performed.
758
601
  */
759
- authenticatorAssuranceLevel: string;
760
- signer: {
761
- alg: string;
762
- kid: string;
763
- method: "federation";
764
- trustChain: [string, ...string[]];
765
- };
602
+ requestClientId?: string;
766
603
  }
767
- /**
768
- * Create a Wallet Attestation JWT for IT-Wallet v1.0
769
- *
770
- * Version 1.0 specifics:
771
- * - Uses only `trust_chain` in header (federation method)
772
- *
773
- * @param options - Wallet attestation options for v1.0
774
- * @returns Signed wallet attestation JWT string
775
- * @throws {ValidationError} When validation of the JWT structure fails
776
- * @throws {ClientAttestationError} For other unexpected errors during creation
777
- * @internal This function is called by the WalletProvider router
778
- */
779
- declare const createWalletAttestationJwt$1: (options: WalletAttestationOptionsV1_0) => Promise<WalletAttestationJwtV1_0>;
780
-
604
+ declare function verifyClientAttestation(options: VerifyClientAttestationOptions): Promise<{
605
+ clientAttestation: {
606
+ header: {
607
+ [x: string]: unknown;
608
+ trust_chain: [string, ...string[]];
609
+ typ: "oauth-client-attestation+jwt";
610
+ alg: string;
611
+ jwk?: {
612
+ [x: string]: unknown;
613
+ kty: string;
614
+ alg?: string | undefined;
615
+ crv?: string | undefined;
616
+ d?: string | undefined;
617
+ dp?: string | undefined;
618
+ dq?: string | undefined;
619
+ e?: string | undefined;
620
+ ext?: boolean | undefined;
621
+ k?: string | undefined;
622
+ key_ops?: string[] | undefined;
623
+ kid?: string | undefined;
624
+ n?: string | undefined;
625
+ oth?: {
626
+ [x: string]: unknown;
627
+ d?: string | undefined;
628
+ r?: string | undefined;
629
+ t?: string | undefined;
630
+ }[] | undefined;
631
+ p?: string | undefined;
632
+ q?: string | undefined;
633
+ qi?: string | undefined;
634
+ use?: string | undefined;
635
+ x?: string | undefined;
636
+ x5c?: string[] | undefined;
637
+ x5t?: string | undefined;
638
+ "x5t#S256"?: string | undefined;
639
+ x5u?: string | undefined;
640
+ y?: string | undefined;
641
+ } | undefined;
642
+ kid?: string | undefined;
643
+ x5c?: string[] | undefined;
644
+ };
645
+ payload: {
646
+ [x: string]: unknown;
647
+ aal: string;
648
+ cnf: {
649
+ jwk: {
650
+ [x: string]: unknown;
651
+ kty: string;
652
+ alg?: string | undefined;
653
+ crv?: string | undefined;
654
+ d?: string | undefined;
655
+ dp?: string | undefined;
656
+ dq?: string | undefined;
657
+ e?: string | undefined;
658
+ ext?: boolean | undefined;
659
+ k?: string | undefined;
660
+ key_ops?: string[] | undefined;
661
+ kid?: string | undefined;
662
+ n?: string | undefined;
663
+ oth?: {
664
+ [x: string]: unknown;
665
+ d?: string | undefined;
666
+ r?: string | undefined;
667
+ t?: string | undefined;
668
+ }[] | undefined;
669
+ p?: string | undefined;
670
+ q?: string | undefined;
671
+ qi?: string | undefined;
672
+ use?: string | undefined;
673
+ x?: string | undefined;
674
+ x5c?: string[] | undefined;
675
+ x5t?: string | undefined;
676
+ "x5t#S256"?: string | undefined;
677
+ x5u?: string | undefined;
678
+ y?: string | undefined;
679
+ };
680
+ };
681
+ exp: number;
682
+ iat: number;
683
+ iss: string;
684
+ sub: string;
685
+ wallet_link?: string | undefined;
686
+ wallet_name?: string | undefined;
687
+ aud?: string | undefined;
688
+ jti?: string | undefined;
689
+ nbf?: number | undefined;
690
+ nonce?: string | undefined;
691
+ status?: Record<string, any> | undefined;
692
+ trust_chain?: [string, ...string[]] | undefined;
693
+ };
694
+ signer: _openid4vc_oauth2.JwtSignerWithJwk;
695
+ };
696
+ clientAttestationPop: {
697
+ header: {
698
+ [x: string]: unknown;
699
+ alg: string;
700
+ jwk?: {
701
+ [x: string]: unknown;
702
+ kty: string;
703
+ alg?: string | undefined;
704
+ crv?: string | undefined;
705
+ d?: string | undefined;
706
+ dp?: string | undefined;
707
+ dq?: string | undefined;
708
+ e?: string | undefined;
709
+ ext?: boolean | undefined;
710
+ k?: string | undefined;
711
+ key_ops?: string[] | undefined;
712
+ kid?: string | undefined;
713
+ n?: string | undefined;
714
+ oth?: {
715
+ [x: string]: unknown;
716
+ d?: string | undefined;
717
+ r?: string | undefined;
718
+ t?: string | undefined;
719
+ }[] | undefined;
720
+ p?: string | undefined;
721
+ q?: string | undefined;
722
+ qi?: string | undefined;
723
+ use?: string | undefined;
724
+ x?: string | undefined;
725
+ x5c?: string[] | undefined;
726
+ x5t?: string | undefined;
727
+ "x5t#S256"?: string | undefined;
728
+ x5u?: string | undefined;
729
+ y?: string | undefined;
730
+ } | undefined;
731
+ kid?: string | undefined;
732
+ trust_chain?: [string, ...string[]] | undefined;
733
+ typ?: string | undefined;
734
+ x5c?: string[] | undefined;
735
+ };
736
+ payload: {
737
+ [x: string]: unknown;
738
+ aud?: string | undefined;
739
+ cnf?: {
740
+ [x: string]: unknown;
741
+ jkt?: string | undefined;
742
+ jwk?: {
743
+ [x: string]: unknown;
744
+ kty: string;
745
+ alg?: string | undefined;
746
+ crv?: string | undefined;
747
+ d?: string | undefined;
748
+ dp?: string | undefined;
749
+ dq?: string | undefined;
750
+ e?: string | undefined;
751
+ ext?: boolean | undefined;
752
+ k?: string | undefined;
753
+ key_ops?: string[] | undefined;
754
+ kid?: string | undefined;
755
+ n?: string | undefined;
756
+ oth?: {
757
+ [x: string]: unknown;
758
+ d?: string | undefined;
759
+ r?: string | undefined;
760
+ t?: string | undefined;
761
+ }[] | undefined;
762
+ p?: string | undefined;
763
+ q?: string | undefined;
764
+ qi?: string | undefined;
765
+ use?: string | undefined;
766
+ x?: string | undefined;
767
+ x5c?: string[] | undefined;
768
+ x5t?: string | undefined;
769
+ "x5t#S256"?: string | undefined;
770
+ x5u?: string | undefined;
771
+ y?: string | undefined;
772
+ } | undefined;
773
+ } | undefined;
774
+ exp?: number | undefined;
775
+ iat?: number | undefined;
776
+ iss?: string | undefined;
777
+ jti?: string | undefined;
778
+ nbf?: number | undefined;
779
+ nonce?: string | undefined;
780
+ status?: Record<string, any> | undefined;
781
+ trust_chain?: [string, ...string[]] | undefined;
782
+ };
783
+ signer: _openid4vc_oauth2.JwtSignerWithJwk;
784
+ };
785
+ }>;
786
+
787
+ interface BaseVerifyWalletAttestationJwtOptions {
788
+ callbacks: Pick<CallbackContext, "verifyJwt">;
789
+ now?: Date;
790
+ walletAttestationJwt: string;
791
+ }
792
+ /**
793
+ * Base options shared across all wallet attestation versions
794
+ */
795
+ interface BaseWalletAttestationOptions {
796
+ callbacks: Pick<CallbackContext, "signJwt">;
797
+ dpopJwkPublic: ClientAttestationJwtPayload["cnf"]["jwk"];
798
+ expiresAt?: Date;
799
+ issuer: string;
800
+ walletLink?: string;
801
+ walletName?: string;
802
+ }
803
+ declare const zOauthClientAttestationHeader: z.ZodLiteral<"OAuth-Client-Attestation">;
804
+ declare const oauthClientAttestationHeader: "OAuth-Client-Attestation";
805
+ declare const zOauthClientAttestationPopHeader: z.ZodLiteral<"OAuth-Client-Attestation-PoP">;
806
+ declare const oauthClientAttestationPopHeader: "OAuth-Client-Attestation-PoP";
807
+
781
808
  interface VerifyWalletAttestationJwtOptionsV1_0 extends BaseVerifyWalletAttestationJwtOptions {
782
809
  config: IoWalletSdkConfig<ItWalletSpecsVersion.V1_0>;
783
810
  }
784
- type VerifiedWalletAttestationJwtV1_0 = Awaited<ReturnType<typeof verifyWalletAttestationJwt$2>>;
785
- declare function verifyWalletAttestationJwt$2(options: VerifyWalletAttestationJwtOptionsV1_0): Promise<{
811
+ type VerifiedWalletAttestationJwtV1_0 = Awaited<ReturnType<typeof verifyWalletAttestationJwt$3>>;
812
+ declare function verifyWalletAttestationJwt$3(options: VerifyWalletAttestationJwtOptionsV1_0): Promise<{
786
813
  header: {
787
814
  [x: string]: unknown;
788
815
  trust_chain: [string, ...string[]];
@@ -874,169 +901,11 @@ declare function verifyWalletAttestationJwt$2(options: VerifyWalletAttestationJw
874
901
  signer: _openid4vc_oauth2.JwtSignerWithJwk;
875
902
  }>;
876
903
 
877
- type index$1_VerifiedWalletAttestationJwtV1_0 = VerifiedWalletAttestationJwtV1_0;
878
- type index$1_VerifyWalletAttestationJwtOptionsV1_0 = VerifyWalletAttestationJwtOptionsV1_0;
879
- type index$1_WalletAttestationJwtV1_0 = WalletAttestationJwtV1_0;
880
- type index$1_WalletAttestationOptionsV1_0 = WalletAttestationOptionsV1_0;
881
- declare const index$1_zWalletAttestationJwtHeaderV1_0: typeof zWalletAttestationJwtHeaderV1_0;
882
- declare const index$1_zWalletAttestationJwtPayloadV1_0: typeof zWalletAttestationJwtPayloadV1_0;
883
- declare const index$1_zWalletAttestationJwtV1_0: typeof zWalletAttestationJwtV1_0;
884
- declare namespace index$1 {
885
- export { type index$1_VerifiedWalletAttestationJwtV1_0 as VerifiedWalletAttestationJwtV1_0, type index$1_VerifyWalletAttestationJwtOptionsV1_0 as VerifyWalletAttestationJwtOptionsV1_0, type index$1_WalletAttestationJwtV1_0 as WalletAttestationJwtV1_0, type index$1_WalletAttestationOptionsV1_0 as WalletAttestationOptionsV1_0, createWalletAttestationJwt$1 as createWalletAttestationJwt, verifyWalletAttestationJwt$2 as verifyWalletAttestationJwt, index$1_zWalletAttestationJwtHeaderV1_0 as zWalletAttestationJwtHeaderV1_0, index$1_zWalletAttestationJwtPayloadV1_0 as zWalletAttestationJwtPayloadV1_0, index$1_zWalletAttestationJwtV1_0 as zWalletAttestationJwtV1_0 };
904
+ interface VerifyWalletAttestationJwtOptionsV1_3 extends BaseVerifyWalletAttestationJwtOptions {
905
+ config: IoWalletSdkConfig<ItWalletSpecsVersion.V1_3>;
886
906
  }
887
-
888
- /**
889
- * JWT Header schema for IT-Wallet v1.3 Wallet Attestation
890
- *
891
- * Version 1.3 specifics:
892
- * - x5c is REQUIRED
893
- * - trust_chain is OPTIONAL
894
- */
895
- declare const zWalletAttestationJwtHeaderV1_3: z$1.ZodObject<{
896
- trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
897
- typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
898
- x5c: z$1.ZodArray<z$1.ZodString>;
899
- alg: z$1.ZodString;
900
- jwk: z$1.ZodOptional<z$1.ZodObject<{
901
- alg: z$1.ZodOptional<z$1.ZodString>;
902
- crv: z$1.ZodOptional<z$1.ZodString>;
903
- d: z$1.ZodOptional<z$1.ZodString>;
904
- dp: z$1.ZodOptional<z$1.ZodString>;
905
- dq: z$1.ZodOptional<z$1.ZodString>;
906
- e: z$1.ZodOptional<z$1.ZodString>;
907
- ext: z$1.ZodOptional<z$1.ZodBoolean>;
908
- k: z$1.ZodOptional<z$1.ZodString>;
909
- key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
910
- kid: z$1.ZodOptional<z$1.ZodString>;
911
- kty: z$1.ZodString;
912
- n: z$1.ZodOptional<z$1.ZodString>;
913
- oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
914
- d: z$1.ZodOptional<z$1.ZodString>;
915
- r: z$1.ZodOptional<z$1.ZodString>;
916
- t: z$1.ZodOptional<z$1.ZodString>;
917
- }, z$1.core.$loose>>>;
918
- p: z$1.ZodOptional<z$1.ZodString>;
919
- q: z$1.ZodOptional<z$1.ZodString>;
920
- qi: z$1.ZodOptional<z$1.ZodString>;
921
- use: z$1.ZodOptional<z$1.ZodString>;
922
- x: z$1.ZodOptional<z$1.ZodString>;
923
- x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
924
- x5t: z$1.ZodOptional<z$1.ZodString>;
925
- "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
926
- x5u: z$1.ZodOptional<z$1.ZodString>;
927
- y: z$1.ZodOptional<z$1.ZodString>;
928
- }, z$1.core.$loose>>;
929
- kid: z$1.ZodOptional<z$1.ZodString>;
930
- }, z$1.core.$loose>;
931
- /**
932
- * JWT Payload schema for IT-Wallet v1.3 Wallet Attestation
933
- *
934
- * Version 1.3 specifics:
935
- * - Supports nbf (not before) claim
936
- * - Supports status claim for revocation mechanisms
937
- */
938
- declare const zWalletAttestationJwtPayloadV1_3: z$1.ZodObject<{
939
- cnf: z$1.ZodObject<{
940
- jwk: z$1.ZodObject<{
941
- alg: z$1.ZodOptional<z$1.ZodString>;
942
- crv: z$1.ZodOptional<z$1.ZodString>;
943
- d: z$1.ZodOptional<z$1.ZodString>;
944
- dp: z$1.ZodOptional<z$1.ZodString>;
945
- dq: z$1.ZodOptional<z$1.ZodString>;
946
- e: z$1.ZodOptional<z$1.ZodString>;
947
- ext: z$1.ZodOptional<z$1.ZodBoolean>;
948
- k: z$1.ZodOptional<z$1.ZodString>;
949
- key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
950
- kid: z$1.ZodOptional<z$1.ZodString>;
951
- kty: z$1.ZodString;
952
- n: z$1.ZodOptional<z$1.ZodString>;
953
- oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
954
- d: z$1.ZodOptional<z$1.ZodString>;
955
- r: z$1.ZodOptional<z$1.ZodString>;
956
- t: z$1.ZodOptional<z$1.ZodString>;
957
- }, z$1.core.$loose>>>;
958
- p: z$1.ZodOptional<z$1.ZodString>;
959
- q: z$1.ZodOptional<z$1.ZodString>;
960
- qi: z$1.ZodOptional<z$1.ZodString>;
961
- use: z$1.ZodOptional<z$1.ZodString>;
962
- x: z$1.ZodOptional<z$1.ZodString>;
963
- x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
964
- x5t: z$1.ZodOptional<z$1.ZodString>;
965
- "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
966
- x5u: z$1.ZodOptional<z$1.ZodString>;
967
- y: z$1.ZodOptional<z$1.ZodString>;
968
- }, z$1.core.$loose>;
969
- }, z$1.core.$strip>;
970
- exp: z$1.ZodNumber;
971
- iat: z$1.ZodNumber;
972
- iss: z$1.ZodString;
973
- nbf: z$1.ZodOptional<z$1.ZodNumber>;
974
- status: z$1.ZodOptional<z$1.ZodObject<{
975
- status_list: z$1.ZodObject<{
976
- idx: z$1.ZodNumber;
977
- uri: z$1.ZodString;
978
- }, z$1.core.$strip>;
979
- }, z$1.core.$strip>>;
980
- sub: z$1.ZodString;
981
- wallet_link: z$1.ZodOptional<z$1.ZodURL>;
982
- wallet_name: z$1.ZodOptional<z$1.ZodString>;
983
- aud: z$1.ZodOptional<z$1.ZodString>;
984
- jti: z$1.ZodOptional<z$1.ZodString>;
985
- nonce: z$1.ZodOptional<z$1.ZodString>;
986
- trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
987
- }, z$1.core.$loose>;
988
- /**
989
- * Wallet Attestation JWT type for v1.3
990
- * The JWT is returned as a compact string
991
- */
992
- type WalletAttestationJwtV1_3 = string;
993
- /**
994
- * Zod schema for wallet attestation JWT validation (v1.3)
995
- * Validates that the result is a non-empty string
996
- */
997
- declare const zWalletAttestationJwtV1_3: z$1.ZodString;
998
-
999
- /**
1000
- * Options for creating a wallet attestation with v1.3
1001
- * Requires x5c, optional trust_chain, nbf, and status
1002
- */
1003
- interface WalletAttestationOptionsV1_3 extends BaseWalletAttestationOptions {
1004
- nbf?: Date;
1005
- signer: {
1006
- alg: string;
1007
- kid: string;
1008
- method: "x5c";
1009
- trustChain?: [string, ...string[]];
1010
- x5c: [string, ...string[]];
1011
- };
1012
- status?: {
1013
- status_list: {
1014
- idx: number;
1015
- uri: string;
1016
- };
1017
- };
1018
- }
1019
- /**
1020
- * Create a Wallet Attestation JWT for IT-Wallet v1.3
1021
- *
1022
- * Version 1.3 specifics:
1023
- * - x5c in header is REQUIRED
1024
- * - trust_chain in header is OPTIONAL
1025
- * - Supports nbf and status claims in payload
1026
- *
1027
- * @param options - Wallet attestation options for v1.3
1028
- * @returns Signed wallet attestation JWT string
1029
- * @throws {ValidationError} When validation fails (including nbf >= exp)
1030
- * @throws {ClientAttestationError} For other unexpected errors during creation
1031
- * @internal This function is called by the WalletProvider router
1032
- */
1033
- declare const createWalletAttestationJwt: (options: WalletAttestationOptionsV1_3) => Promise<WalletAttestationJwtV1_3>;
1034
-
1035
- interface VerifyWalletAttestationJwtOptionsV1_3 extends BaseVerifyWalletAttestationJwtOptions {
1036
- config: IoWalletSdkConfig<ItWalletSpecsVersion.V1_3>;
1037
- }
1038
- type VerifiedWalletAttestationJwtV1_3 = Awaited<ReturnType<typeof verifyWalletAttestationJwt$1>>;
1039
- declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJwtOptionsV1_3): Promise<{
907
+ type VerifiedWalletAttestationJwtV1_3 = Awaited<ReturnType<typeof verifyWalletAttestationJwt$2>>;
908
+ declare function verifyWalletAttestationJwt$2(options: VerifyWalletAttestationJwtOptionsV1_3): Promise<{
1040
909
  header: {
1041
910
  [x: string]: unknown;
1042
911
  typ: "oauth-client-attestation+jwt";
@@ -1132,82 +1001,54 @@ declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJw
1132
1001
  signer: _openid4vc_oauth2.JwtSignerWithJwk;
1133
1002
  }>;
1134
1003
 
1135
- type index_VerifiedWalletAttestationJwtV1_3 = VerifiedWalletAttestationJwtV1_3;
1136
- type index_VerifyWalletAttestationJwtOptionsV1_3 = VerifyWalletAttestationJwtOptionsV1_3;
1137
- type index_WalletAttestationJwtV1_3 = WalletAttestationJwtV1_3;
1138
- type index_WalletAttestationOptionsV1_3 = WalletAttestationOptionsV1_3;
1139
- declare const index_createWalletAttestationJwt: typeof createWalletAttestationJwt;
1140
- declare const index_zWalletAttestationJwtHeaderV1_3: typeof zWalletAttestationJwtHeaderV1_3;
1141
- declare const index_zWalletAttestationJwtPayloadV1_3: typeof zWalletAttestationJwtPayloadV1_3;
1142
- declare const index_zWalletAttestationJwtV1_3: typeof zWalletAttestationJwtV1_3;
1143
- declare namespace index {
1144
- export { type index_VerifiedWalletAttestationJwtV1_3 as VerifiedWalletAttestationJwtV1_3, type index_VerifyWalletAttestationJwtOptionsV1_3 as VerifyWalletAttestationJwtOptionsV1_3, type index_WalletAttestationJwtV1_3 as WalletAttestationJwtV1_3, type index_WalletAttestationOptionsV1_3 as WalletAttestationOptionsV1_3, index_createWalletAttestationJwt as createWalletAttestationJwt, verifyWalletAttestationJwt$1 as verifyWalletAttestationJwt, index_zWalletAttestationJwtHeaderV1_3 as zWalletAttestationJwtHeaderV1_3, index_zWalletAttestationJwtPayloadV1_3 as zWalletAttestationJwtPayloadV1_3, index_zWalletAttestationJwtV1_3 as zWalletAttestationJwtV1_3 };
1145
- }
1146
-
1147
- interface ClientAttestationOptions {
1148
- /**
1149
- * The client attestation DPoP JWT provided in the request.
1150
- */
1151
- clientAttestationPopJwt: string;
1152
- /**
1153
- * Whether to ensure that the key used in client attestation confirmation
1154
- * is the same key used for DPoP. This only has effect if both DPoP and client
1155
- * attestations are present.
1156
- *
1157
- * @default false
1158
- */
1159
- ensureConfirmationKeyMatchesDpopKey?: boolean;
1160
- /**
1161
- * The wallet attestation JWT provided in the request.
1162
- */
1163
- walletAttestationJwt: string;
1164
- }
1165
- interface VerifyClientAttestationOptions {
1166
- /**
1167
- * The authorization server metadata.
1168
- */
1169
- authorizationServerMetadata: AuthorizationServerMetadata;
1170
- /**
1171
- * Callbacks for hashing and JWT verification.
1172
- */
1173
- callbacks: Pick<CallbackContext, "hash" | "verifyJwt">;
1174
- /**
1175
- * The client attestation options.
1176
- */
1177
- clientAttestation: ClientAttestationOptions;
1178
- /**
1179
- * The IT-Wallet SDK configuration, used to select the correct version-specific
1180
- * validation schema for the wallet attestation JWT.
1181
- */
1182
- config: IoWalletSdkConfig;
1183
- /**
1184
- * The DPoP JWK thumbprint value, if DPoP is being used in the request.
1185
- */
1186
- dpopJwkThumbprint?: string;
1187
- /**
1188
- * The current time to use when verifying the JWTs.
1189
- * If not provided current time will be used.
1190
- *
1191
- * @default new Date()
1192
- */
1193
- now?: Date;
1194
- /**
1195
- * The client id provided in the authorization request, if any.
1196
- *
1197
- * Pass this when the authorization request includes a `client_id` parameter.
1198
- * The function will verify that it matches the `sub` claim in the client attestation JWT.
1199
- * If not provided, no client_id validation is performed.
1200
- */
1201
- requestClientId?: string;
1004
+ interface VerifyWalletAttestationJwtOptionsV1_4 extends BaseVerifyWalletAttestationJwtOptions {
1005
+ config: IoWalletSdkConfig<ItWalletSpecsVersion.V1_4>;
1202
1006
  }
1203
- declare function verifyClientAttestation(options: VerifyClientAttestationOptions): Promise<{
1204
- clientAttestation: {
1205
- header: {
1007
+ type VerifiedWalletAttestationJwtV1_4 = Awaited<ReturnType<typeof verifyWalletAttestationJwt$1>>;
1008
+ declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJwtOptionsV1_4): Promise<{
1009
+ header: {
1010
+ [x: string]: unknown;
1011
+ typ: "oauth-client-attestation+jwt";
1012
+ x5c: string[];
1013
+ alg: string;
1014
+ trust_chain?: [string, ...string[]] | undefined;
1015
+ jwk?: {
1206
1016
  [x: string]: unknown;
1207
- trust_chain: [string, ...string[]];
1208
- typ: "oauth-client-attestation+jwt";
1209
- alg: string;
1210
- jwk?: {
1017
+ kty: string;
1018
+ alg?: string | undefined;
1019
+ crv?: string | undefined;
1020
+ d?: string | undefined;
1021
+ dp?: string | undefined;
1022
+ dq?: string | undefined;
1023
+ e?: string | undefined;
1024
+ ext?: boolean | undefined;
1025
+ k?: string | undefined;
1026
+ key_ops?: string[] | undefined;
1027
+ kid?: string | undefined;
1028
+ n?: string | undefined;
1029
+ oth?: {
1030
+ [x: string]: unknown;
1031
+ d?: string | undefined;
1032
+ r?: string | undefined;
1033
+ t?: string | undefined;
1034
+ }[] | undefined;
1035
+ p?: string | undefined;
1036
+ q?: string | undefined;
1037
+ qi?: string | undefined;
1038
+ use?: string | undefined;
1039
+ x?: string | undefined;
1040
+ x5c?: string[] | undefined;
1041
+ x5t?: string | undefined;
1042
+ "x5t#S256"?: string | undefined;
1043
+ x5u?: string | undefined;
1044
+ y?: string | undefined;
1045
+ } | undefined;
1046
+ kid?: string | undefined;
1047
+ };
1048
+ payload: {
1049
+ [x: string]: unknown;
1050
+ cnf: {
1051
+ jwk: {
1211
1052
  [x: string]: unknown;
1212
1053
  kty: string;
1213
1054
  alg?: string | undefined;
@@ -1237,156 +1078,42 @@ declare function verifyClientAttestation(options: VerifyClientAttestationOptions
1237
1078
  "x5t#S256"?: string | undefined;
1238
1079
  x5u?: string | undefined;
1239
1080
  y?: string | undefined;
1240
- } | undefined;
1241
- kid?: string | undefined;
1242
- x5c?: string[] | undefined;
1243
- };
1244
- payload: {
1245
- [x: string]: unknown;
1246
- aal: string;
1247
- cnf: {
1248
- jwk: {
1249
- [x: string]: unknown;
1250
- kty: string;
1251
- alg?: string | undefined;
1252
- crv?: string | undefined;
1253
- d?: string | undefined;
1254
- dp?: string | undefined;
1255
- dq?: string | undefined;
1256
- e?: string | undefined;
1257
- ext?: boolean | undefined;
1258
- k?: string | undefined;
1259
- key_ops?: string[] | undefined;
1260
- kid?: string | undefined;
1261
- n?: string | undefined;
1262
- oth?: {
1263
- [x: string]: unknown;
1264
- d?: string | undefined;
1265
- r?: string | undefined;
1266
- t?: string | undefined;
1267
- }[] | undefined;
1268
- p?: string | undefined;
1269
- q?: string | undefined;
1270
- qi?: string | undefined;
1271
- use?: string | undefined;
1272
- x?: string | undefined;
1273
- x5c?: string[] | undefined;
1274
- x5t?: string | undefined;
1275
- "x5t#S256"?: string | undefined;
1276
- x5u?: string | undefined;
1277
- y?: string | undefined;
1278
- };
1279
1081
  };
1280
- exp: number;
1281
- iat: number;
1282
- iss: string;
1283
- sub: string;
1284
- wallet_link?: string | undefined;
1285
- wallet_name?: string | undefined;
1286
- aud?: string | undefined;
1287
- jti?: string | undefined;
1288
- nbf?: number | undefined;
1289
- nonce?: string | undefined;
1290
- status?: Record<string, any> | undefined;
1291
- trust_chain?: [string, ...string[]] | undefined;
1292
1082
  };
1293
- signer: _openid4vc_oauth2.JwtSignerWithJwk;
1294
- };
1295
- clientAttestationPop: {
1296
- header: {
1297
- [x: string]: unknown;
1298
- alg: string;
1299
- jwk?: {
1300
- [x: string]: unknown;
1301
- kty: string;
1302
- alg?: string | undefined;
1303
- crv?: string | undefined;
1304
- d?: string | undefined;
1305
- dp?: string | undefined;
1306
- dq?: string | undefined;
1307
- e?: string | undefined;
1308
- ext?: boolean | undefined;
1309
- k?: string | undefined;
1310
- key_ops?: string[] | undefined;
1311
- kid?: string | undefined;
1312
- n?: string | undefined;
1313
- oth?: {
1314
- [x: string]: unknown;
1315
- d?: string | undefined;
1316
- r?: string | undefined;
1317
- t?: string | undefined;
1318
- }[] | undefined;
1319
- p?: string | undefined;
1320
- q?: string | undefined;
1321
- qi?: string | undefined;
1322
- use?: string | undefined;
1323
- x?: string | undefined;
1324
- x5c?: string[] | undefined;
1325
- x5t?: string | undefined;
1326
- "x5t#S256"?: string | undefined;
1327
- x5u?: string | undefined;
1328
- y?: string | undefined;
1329
- } | undefined;
1330
- kid?: string | undefined;
1331
- trust_chain?: [string, ...string[]] | undefined;
1332
- typ?: string | undefined;
1333
- x5c?: string[] | undefined;
1334
- };
1335
- payload: {
1336
- [x: string]: unknown;
1337
- aud?: string | undefined;
1338
- cnf?: {
1339
- [x: string]: unknown;
1340
- jkt?: string | undefined;
1341
- jwk?: {
1342
- [x: string]: unknown;
1343
- kty: string;
1344
- alg?: string | undefined;
1345
- crv?: string | undefined;
1346
- d?: string | undefined;
1347
- dp?: string | undefined;
1348
- dq?: string | undefined;
1349
- e?: string | undefined;
1350
- ext?: boolean | undefined;
1351
- k?: string | undefined;
1352
- key_ops?: string[] | undefined;
1353
- kid?: string | undefined;
1354
- n?: string | undefined;
1355
- oth?: {
1356
- [x: string]: unknown;
1357
- d?: string | undefined;
1358
- r?: string | undefined;
1359
- t?: string | undefined;
1360
- }[] | undefined;
1361
- p?: string | undefined;
1362
- q?: string | undefined;
1363
- qi?: string | undefined;
1364
- use?: string | undefined;
1365
- x?: string | undefined;
1366
- x5c?: string[] | undefined;
1367
- x5t?: string | undefined;
1368
- "x5t#S256"?: string | undefined;
1369
- x5u?: string | undefined;
1370
- y?: string | undefined;
1371
- } | undefined;
1372
- } | undefined;
1373
- exp?: number | undefined;
1374
- iat?: number | undefined;
1375
- iss?: string | undefined;
1376
- jti?: string | undefined;
1377
- nbf?: number | undefined;
1378
- nonce?: string | undefined;
1379
- status?: Record<string, any> | undefined;
1380
- trust_chain?: [string, ...string[]] | undefined;
1083
+ exp: number;
1084
+ iat: number;
1085
+ iss: string;
1086
+ status: {
1087
+ status_list: {
1088
+ idx: number;
1089
+ uri: string;
1090
+ };
1381
1091
  };
1382
- signer: _openid4vc_oauth2.JwtSignerWithJwk;
1092
+ sub: string;
1093
+ wallet_link: string;
1094
+ wallet_name: string;
1095
+ eudi_wallet_info?: {
1096
+ general_info: {
1097
+ wallet_provider_name: string;
1098
+ wallet_solution_certification_information: string;
1099
+ wallet_solution_id: string;
1100
+ wallet_solution_version: string;
1101
+ };
1102
+ } | undefined;
1103
+ nbf?: number | undefined;
1104
+ aud?: string | undefined;
1105
+ jti?: string | undefined;
1106
+ nonce?: string | undefined;
1107
+ trust_chain?: [string, ...string[]] | undefined;
1383
1108
  };
1109
+ signer: _openid4vc_oauth2.JwtSignerWithJwk;
1384
1110
  }>;
1385
1111
 
1386
- type VerifiedWalletAttestationJwt = VerifiedWalletAttestationJwtV1_0 | VerifiedWalletAttestationJwtV1_3;
1387
- type VerifyWalletAttestationJwtOptions = VerifyWalletAttestationJwtOptionsV1_0 | VerifyWalletAttestationJwtOptionsV1_3;
1112
+ type VerifiedWalletAttestationJwt = VerifiedWalletAttestationJwtV1_0 | VerifiedWalletAttestationJwtV1_3 | VerifiedWalletAttestationJwtV1_4;
1113
+ type VerifyWalletAttestationJwtOptions = VerifyWalletAttestationJwtOptionsV1_0 | VerifyWalletAttestationJwtOptionsV1_3 | VerifyWalletAttestationJwtOptionsV1_4;
1388
1114
  declare function verifyWalletAttestationJwt(options: VerifyWalletAttestationJwtOptionsV1_0): Promise<VerifiedWalletAttestationJwtV1_0>;
1389
1115
  declare function verifyWalletAttestationJwt(options: VerifyWalletAttestationJwtOptionsV1_3): Promise<VerifiedWalletAttestationJwtV1_3>;
1116
+ declare function verifyWalletAttestationJwt(options: VerifyWalletAttestationJwtOptionsV1_4): Promise<VerifiedWalletAttestationJwtV1_4>;
1390
1117
  declare function extractClientAttestationJwtsFromHeaders(headers: FetchHeaders): {
1391
1118
  clientAttestationPopHeader: string;
1392
1119
  valid: true;
@@ -1445,6 +1172,16 @@ interface VerifyAccessTokenRequestDpop {
1445
1172
  * to handle the alg.
1446
1173
  */
1447
1174
  allowedSigningAlgs?: string[];
1175
+ /**
1176
+ * The expected DPoP nonce value that must appear in the `nonce` claim of the DPoP proof JWT.
1177
+ *
1178
+ * AS implementations **SHOULD** issue server-provided nonces (via the `DPoP-Nonce` response
1179
+ * header) and pass the expected value here to prevent pre-generated DPoP proofs from being
1180
+ * reused across requests within the `iat` window.
1181
+ *
1182
+ * See RFC 9449 §8 for the full nonce issuance flow.
1183
+ */
1184
+ expectedNonce?: string;
1448
1185
  /**
1449
1186
  * The dpop jwt from the access token request
1450
1187
  */
@@ -1458,7 +1195,7 @@ interface VerifyAccessTokenRequestOptions {
1458
1195
  /**
1459
1196
  * The authorization server metadata
1460
1197
  */
1461
- authorizationServerMetadata: AuthorizationServerMetadata;
1198
+ authorizationServerMetadata: ItWalletAuthorizationServerMetadata;
1462
1199
  /**
1463
1200
  * Callbacks used during verification
1464
1201
  */
@@ -1539,7 +1276,11 @@ interface VerifyAccessTokenRequestResult {
1539
1276
  * callbacks: { hash, verifyJwt },
1540
1277
  * clientAttestation: { jwt: "...", popJwt: "..." },
1541
1278
  * codeExpiresAt: new Date(Date.now() + 600000),
1542
- * dpop: { jwt: dpopJwt, allowedSigningAlgs: ["ES256"] },
1279
+ * dpop: {
1280
+ * allowedSigningAlgs: ["ES256"],
1281
+ * expectedNonce: "server-issued-nonce",
1282
+ * jwt: dpopJwt,
1283
+ * },
1543
1284
  * expectedCode: "auth_code_123",
1544
1285
  * grant: parsedGrant,
1545
1286
  * pkce: { codeChallenge, codeChallengeMethod: "S256", codeVerifier },
@@ -1644,7 +1385,7 @@ interface CreatePushedAuthorizationRequestOptions {
1644
1385
  * MUST be set to the thumbprint of the jwk value in the cnf parameter inside the Wallet Attestation.
1645
1386
  */
1646
1387
  clientId: string;
1647
- codeChallengeMethodsSupported: AuthorizationServerMetadata["code_challenge_methods_supported"];
1388
+ codeChallengeMethodsSupported: ItWalletAuthorizationServerMetadata["code_challenge_methods_supported"];
1648
1389
  /**
1649
1390
  * DPoP options. Required when `require_signed_request_object` is `true`
1650
1391
  * (enforced at the type level via function overloads). Not used in the
@@ -1954,7 +1695,7 @@ interface VerifyAuthorizationRequestOptions {
1954
1695
  authorizationRequest: {
1955
1696
  client_id?: string;
1956
1697
  };
1957
- authorizationServerMetadata: AuthorizationServerMetadata;
1698
+ authorizationServerMetadata: ItWalletAuthorizationServerMetadata;
1958
1699
  callbacks: Pick<CallbackContext, "hash" | "verifyJwt">;
1959
1700
  clientAttestation: ClientAttestationOptions;
1960
1701
  config: IoWalletSdkConfig;
@@ -2041,6 +1782,7 @@ interface RequestLike {
2041
1782
  url: string;
2042
1783
  }
2043
1784
 
1785
+ declare const MAX_JTI_LENGTH = 256;
2044
1786
  interface JwtSignerDid {
2045
1787
  alg: string;
2046
1788
  didUrl: string;
@@ -2223,6 +1965,35 @@ declare const zJwtHeader: z.ZodObject<{
2223
1965
  }, z.core.$loose>;
2224
1966
  type JwtHeader = z.infer<typeof zJwtHeader>;
2225
1967
 
1968
+ interface DecodeJwtOptions<HeaderSchema extends BaseSchema | undefined, PayloadSchema extends BaseSchema | undefined> {
1969
+ /**
1970
+ * Optional prefix for error messages thrown during decoding, to provide more context on where the error occurred
1971
+ */
1972
+ errorMessagePrefix?: string;
1973
+ /**
1974
+ * Schema to use for validating the header. If not provided the
1975
+ * default `zJwtHeader` schema will be used
1976
+ */
1977
+ headerSchema?: HeaderSchema;
1978
+ /**
1979
+ * The compact encoded jwt
1980
+ */
1981
+ jwt: string;
1982
+ /**
1983
+ * Schema to use for validating the payload. If not provided the
1984
+ * default `zJwtPayload` schema will be used
1985
+ */
1986
+ payloadSchema?: PayloadSchema;
1987
+ }
1988
+ interface DecodeJwtResult<HeaderSchema extends BaseSchema | undefined = undefined, PayloadSchema extends BaseSchema | undefined = undefined> {
1989
+ header: InferSchemaOrDefaultOutput<HeaderSchema, typeof zJwtHeader>;
1990
+ payload: InferSchemaOrDefaultOutput<PayloadSchema, typeof zJwtPayload>;
1991
+ signature: string;
1992
+ }
1993
+ declare function decodeJwt<HeaderSchema extends BaseSchema | undefined = undefined, PayloadSchema extends BaseSchema | undefined = undefined>(options: DecodeJwtOptions<HeaderSchema, PayloadSchema>): DecodeJwtResult<HeaderSchema, PayloadSchema>;
1994
+ type IsSchemaProvided<T> = T extends undefined ? false : true;
1995
+ type InferSchemaOrDefaultOutput<ProvidedSchema extends BaseSchema | undefined, DefaultSchema extends BaseSchema> = IsSchemaProvided<ProvidedSchema> extends true ? ProvidedSchema extends BaseSchema ? z.infer<ProvidedSchema> : never : z.infer<DefaultSchema>;
1996
+
2226
1997
  declare const zJarAuthorizationRequest: z.ZodObject<{
2227
1998
  client_id: z.ZodOptional<z.ZodString>;
2228
1999
  request: z.ZodOptional<z.ZodString>;
@@ -2315,185 +2086,66 @@ type JarRequestObjectHeader = z.infer<typeof zJarRequestObjectHeader>;
2315
2086
  declare const signedAuthorizationRequestJwtHeaderTyp: "oauth-authz-req+jwt";
2316
2087
  declare const jwtAuthorizationRequestJwtHeaderTyp: "jwt";
2317
2088
 
2318
- interface CreateJarRequestOptions {
2319
- /**
2320
- * Additional claims merged into the request object payload before
2321
- * `authorizationRequestPayload`.
2322
- */
2323
- additionalJwtPayload?: Record<string, unknown>;
2324
- /**
2325
- * Authorization request claims used as JWT header parameters.
2326
- */
2327
- authorizationRequestHeader: JarRequestObjectHeader;
2328
- /**
2329
- * Authorization request claims used as JWT payload.
2330
- */
2331
- authorizationRequestPayload: JarRequestObjectPayload;
2332
- /**
2333
- * Cryptographic callbacks used to sign and optionally encrypt the JAR.
2334
- */
2335
- callbacks: Partial<Pick<CallbackContext, "encryptJwe">> & Pick<CallbackContext, "signJwt">;
2336
- /**
2337
- * Request object lifetime in seconds from `now`.
2338
- */
2339
- expiresInSeconds: number;
2340
- /**
2341
- * Encryptor configuration. When provided, the signed request object is wrapped
2342
- * as JWE and returned as encrypted `request` value.
2343
- */
2344
- jweEncryptor?: JweEncryptor;
2345
- /**
2346
- * Signer configuration used to produce the request object JWT.
2347
- */
2348
- jwtSigner: JwtSigner;
2349
- /**
2350
- * Date that should be used as now. If not provided current date will be used.
2351
- */
2089
+ interface VerifyJarRequestOptions {
2090
+ authorizationRequestJwt: string;
2091
+ callbacks: Pick<CallbackContext, "verifyJwt">;
2092
+ jarRequestParams: {
2093
+ client_id?: string;
2094
+ };
2095
+ jwtSigner: JwtSigner$1;
2352
2096
  now?: Date;
2353
- /**
2354
- * Optional request URI for by-reference JAR transmission.
2355
- * When provided, `jarAuthorizationRequest` will include `request_uri` instead of `request`.
2356
- */
2357
- requestUri?: string;
2358
2097
  }
2359
- interface CreateJarRequestResult {
2360
- /**
2361
- * The signed (and optionally encrypted) JWT string representing the authorization request.
2362
- * This value is included in `jarAuthorizationRequest` when `requestUri` is not provided.
2363
- */
2364
- authorizationRequestJwt: string;
2098
+ interface VerifiedJarRequest {
2099
+ authorizationRequestPayload: JarRequestObjectPayload;
2100
+ jwt: {
2101
+ payload: JarRequestObjectPayload;
2102
+ } & Omit<ReturnType<typeof decodeJwt>, "payload">;
2103
+ signer: JwtSignerWithJwk$1;
2104
+ }
2105
+ /**
2106
+ * Verifies a JAR (JWT Secured Authorization Request) request by validating and verifying signatures.
2107
+ *
2108
+ * @param options - The input parameters
2109
+ * @param options.jarRequestParams - The JAR authorization request parameters
2110
+ * @param options.callbacks - Context containing the relevant Jose crypto operations
2111
+ * @returns The verified authorization request parameters and metadata
2112
+ */
2113
+ declare function verifyJarRequest(options: VerifyJarRequestOptions): Promise<VerifiedJarRequest>;
2114
+
2115
+ interface VerifyPushedAuthorizationRequestReturn extends VerifyAuthorizationRequestResult {
2365
2116
  /**
2366
- * The JWK used for encryption when `jweEncryptor` is provided, otherwise undefined.
2117
+ * The verified JAR request, if `authorizationRequestJwt` was provided
2367
2118
  */
2368
- encryptionJwk?: Jwk;
2119
+ jar?: VerifiedJarRequest;
2120
+ }
2121
+ interface VerifyPushedAuthorizationRequestOptions extends Omit<VerifyAuthorizationRequestOptions, "authorizationServerMetadata"> {
2369
2122
  /**
2370
- * The JAR authorization request parameters to be sent to the authorization endpoint.
2371
- * Contains either `request` or `request_uri` depending on the presence of `requestUri` in options.
2123
+ * The authorization request JWT to verify. If this value was returned from `parsePushedAuthorizationRequest`
2124
+ * you MUST provide this value to ensure the JWT is verified.
2372
2125
  */
2373
- jarAuthorizationRequest: JarAuthorizationRequest;
2126
+ authorizationRequestJwt?: {
2127
+ jwt: string;
2128
+ signer: JwtSigner$1;
2129
+ };
2374
2130
  /**
2375
- * The JWK used for signing the request object JWT.
2131
+ * Authorization Server metadata for enforcing JAR signing policy.
2132
+ * Includes standard Authorization Server metadata plus require_signed_request_object.
2133
+ * When require_signed_request_object is true, the server will reject unsigned requests.
2134
+ * Defaults to false (permissive) if not provided.
2135
+ *
2136
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc9101#section-10.5 RFC 9101 Section 10.5}
2376
2137
  */
2377
- signerJwk: Jwk;
2138
+ authorizationServerMetadata: {
2139
+ require_signed_request_object?: boolean;
2140
+ } & VerifyAuthorizationRequestOptions["authorizationServerMetadata"];
2378
2141
  }
2379
2142
  /**
2380
- * Creates a JWT Secured Authorization Request (JAR) request payload.
2381
- *
2382
- * The request object is always signed, and optionally encrypted when `jweEncryptor`
2383
- * is provided. The returned `jarAuthorizationRequest` is created in one of two forms:
2384
- * - by-value, with `request`
2385
- * - by-reference, with `request_uri`
2143
+ * Verifies a pushed authorization request (PAR) including JAR, DPoP, and client attestation.
2386
2144
  *
2387
- * @param options - Parameters used to create the JAR request
2388
- * @param options.additionalJwtPayload - Additional JWT claims merged before authorization claims
2389
- * @param options.authorizationRequestPayload - Base authorization request JWT payload
2390
- * @param options.authorizationRequestHeader - JWT header parameters for the request object
2391
- * @param options.callbacks - Callback context with required `signJwt` and optional `encryptJwe`
2392
- * @param options.expiresInSeconds - JWT expiration offset in seconds
2393
- * @param options.jweEncryptor - Optional JWE encryptor to wrap the signed JWT
2394
- * @param options.jwtSigner - JWT signer used for request object signing
2395
- * @param options.now - Optional reference time used for `iat` and `exp`
2396
- * @param options.requestUri - Optional request URI for by-reference transmission
2397
- *
2398
- * @returns Signed (and optionally encrypted) authorization request data, signer key material,
2399
- * and JAR request parameters for transmission.
2400
- */
2401
- declare function createJarRequest(options: CreateJarRequestOptions): Promise<CreateJarRequestResult>;
2402
-
2403
- declare function fetchJarRequestObject(options: {
2404
- fetch?: Fetch;
2405
- requestUri: string;
2406
- }): Promise<string>;
2407
-
2408
- interface ParsedJarRequestOptions {
2409
- callbacks: Pick<CallbackContext, "fetch">;
2410
- jarRequestParams: JarAuthorizationRequest;
2411
- }
2412
- interface ParsedJarRequest {
2413
- authorizationRequestJwt: string;
2414
- sendBy: "reference" | "value";
2415
- }
2416
- declare function isJarAuthorizationRequest(request: JarAuthorizationRequest): request is JarAuthorizationRequest;
2417
- /**
2418
- * Parse a JAR (JWT Secured Authorization Request) request by validating and optionally fetch from uri.
2419
- *
2420
- * @param options - The input parameters
2421
- * @param options.jarRequestParams - The JAR authorization request parameters
2422
- * @param options.callbacks - Context containing the relevant Jose crypto operations
2423
- * @returns An object containing the transmission method ('value' or 'reference') and the JWT request object.
2424
- */
2425
- declare function parseJarRequest(options: ParsedJarRequestOptions): Promise<ParsedJarRequest>;
2426
-
2427
- declare function validateJarRequestParams(options: {
2428
- jarRequestParams: JarAuthorizationRequest;
2429
- }): ({
2430
- request: string;
2431
- request_uri?: never;
2432
- } | {
2433
- request?: never;
2434
- request_uri: string;
2435
- }) & JarAuthorizationRequest;
2436
-
2437
- interface VerifyJarRequestOptions {
2438
- authorizationRequestJwt: string;
2439
- callbacks: Pick<CallbackContext, "verifyJwt">;
2440
- jarRequestParams: {
2441
- client_id?: string;
2442
- };
2443
- jwtSigner: JwtSigner$1;
2444
- now?: Date;
2445
- }
2446
- interface VerifiedJarRequest {
2447
- authorizationRequestPayload: JarRequestObjectPayload;
2448
- jwt: {
2449
- payload: JarRequestObjectPayload;
2450
- } & Omit<ReturnType<typeof decodeJwt$1>, "payload">;
2451
- signer: JwtSignerWithJwk$1;
2452
- }
2453
- /**
2454
- * Verifies a JAR (JWT Secured Authorization Request) request by validating and verifying signatures.
2455
- *
2456
- * @param options - The input parameters
2457
- * @param options.jarRequestParams - The JAR authorization request parameters
2458
- * @param options.callbacks - Context containing the relevant Jose crypto operations
2459
- * @returns The verified authorization request parameters and metadata
2460
- */
2461
- declare function verifyJarRequest(options: VerifyJarRequestOptions): Promise<VerifiedJarRequest>;
2462
-
2463
- interface VerifyPushedAuthorizationRequestReturn extends VerifyAuthorizationRequestResult {
2464
- /**
2465
- * The verified JAR request, if `authorizationRequestJwt` was provided
2466
- */
2467
- jar?: VerifiedJarRequest;
2468
- }
2469
- interface VerifyPushedAuthorizationRequestOptions extends Omit<VerifyAuthorizationRequestOptions, "authorizationServerMetadata"> {
2470
- /**
2471
- * The authorization request JWT to verify. If this value was returned from `parsePushedAuthorizationRequest`
2472
- * you MUST provide this value to ensure the JWT is verified.
2473
- */
2474
- authorizationRequestJwt?: {
2475
- jwt: string;
2476
- signer: JwtSigner$1;
2477
- };
2478
- /**
2479
- * Authorization Server metadata for enforcing JAR signing policy.
2480
- * Includes standard Authorization Server metadata plus require_signed_request_object.
2481
- * When require_signed_request_object is true, the server will reject unsigned requests.
2482
- * Defaults to false (permissive) if not provided.
2483
- *
2484
- * @see {@link https://datatracker.ietf.org/doc/html/rfc9101#section-10.5 RFC 9101 Section 10.5}
2485
- */
2486
- authorizationServerMetadata: {
2487
- require_signed_request_object?: boolean;
2488
- } & VerifyAuthorizationRequestOptions["authorizationServerMetadata"];
2489
- }
2490
- /**
2491
- * Verifies a pushed authorization request (PAR) including JAR, DPoP, and client attestation.
2492
- *
2493
- * This function extends `verifyAuthorizationRequest` by adding support for JWT-secured
2494
- * Authorization Requests (JAR). It performs comprehensive verification of all security
2495
- * mechanisms used in pushed authorization requests according to RFC 9126 (PAR) and
2496
- * RFC 9101 (JAR).
2145
+ * This function extends `verifyAuthorizationRequest` by adding support for JWT-secured
2146
+ * Authorization Requests (JAR). It performs comprehensive verification of all security
2147
+ * mechanisms used in pushed authorization requests according to RFC 9126 (PAR) and
2148
+ * RFC 9101 (JAR).
2497
2149
  *
2498
2150
  * The verification process includes:
2499
2151
  * 1. JAR signing policy enforcement (per RFC 9101 Section 10.5) - validates require_signed_request_object
@@ -2589,36 +2241,502 @@ interface VerifyPushedAuthorizationRequestOptions extends Omit<VerifyAuthorizati
2589
2241
  * });
2590
2242
  * ```
2591
2243
  *
2592
- * @see {@link https://datatracker.ietf.org/doc/html/rfc9101#section-10.5 RFC 9101 Section 10.5 - require_signed_request_object}
2244
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc9101#section-10.5 RFC 9101 Section 10.5 - require_signed_request_object}
2245
+ */
2246
+ declare function verifyPushedAuthorizationRequest(options: VerifyPushedAuthorizationRequestOptions): Promise<VerifyPushedAuthorizationRequestReturn>;
2247
+
2248
+ /**
2249
+ * Supported OAuth 2.0 client authentication methods.
2250
+ */
2251
+ declare const SupportedClientAuthenticationMethod: {
2252
+ readonly ClientSecretBasic: "client_secret_basic";
2253
+ readonly ClientSecretPost: "client_secret_post";
2254
+ readonly None: "none";
2255
+ readonly WalletAttestationJwt: "attest_jwt_client_auth";
2256
+ };
2257
+ /**
2258
+ * Union type of supported client authentication methods.
2259
+ */
2260
+ type SupportedClientAuthenticationMethod = (typeof SupportedClientAuthenticationMethod)[keyof typeof SupportedClientAuthenticationMethod];
2261
+ /**
2262
+ * Options for checking client attestation support.
2263
+ */
2264
+ interface IsClientAttestationSupportedOptions {
2265
+ /** Authorization server metadata containing supported authentication methods. */
2266
+ authorizationServerMetadata: ItWalletAuthorizationServerMetadata;
2267
+ }
2268
+ /**
2269
+ * Checks whether the authorization server supports client attestation authentication.
2270
+ *
2271
+ * @param options - Configuration including authorization server metadata
2272
+ * @returns Object with `supported` boolean indicating if client attestation is available
2273
+ */
2274
+ declare function isClientAttestationSupported(options: IsClientAttestationSupportedOptions): {
2275
+ supported: boolean;
2276
+ };
2277
+ /**
2278
+ * Options for client authentication
2279
+ */
2280
+ interface ClientAuthenticationCallbackOptions {
2281
+ /**
2282
+ * Metadata of the authorization server
2283
+ */
2284
+ authorizationServerMetadata: ItWalletAuthorizationServerMetadata;
2285
+ /**
2286
+ * The body as a JSON object. If content type `x-www-form-urlencoded`
2287
+ * is used, it will be encoded after this call.
2288
+ *
2289
+ * You can modify this object
2290
+ */
2291
+ body: Record<string, unknown>;
2292
+ contentType: ContentType;
2293
+ /**
2294
+ * Headers for the request. You can modify this object
2295
+ */
2296
+ headers: FetchHeaders;
2297
+ /**
2298
+ * http method that will be used
2299
+ */
2300
+ method: HttpMethod;
2301
+ /**
2302
+ * URL to which the request will be made
2303
+ */
2304
+ url: string;
2305
+ }
2306
+ /**
2307
+ * Callback method to determine the client authentication for a request.
2308
+ */
2309
+ type ClientAuthenticationCallback = (options: ClientAuthenticationCallbackOptions) => Promise<void> | void;
2310
+ /**
2311
+ * Anonymous client authentication
2312
+ */
2313
+ declare function clientAuthenticationAnonymous(): ClientAuthenticationCallback;
2314
+ interface ClientAuthenticationWalletAttestationJwtOptions {
2315
+ callbacks: Pick<CallbackContext, "generateRandom" | "signJwt">;
2316
+ walletAttestationJwt: string;
2317
+ }
2318
+ /**
2319
+ * Client authentication using wallet attestation JWT.
2320
+ * This method adds the wallet attestation JWT and a proof-of-possession JWT to the request headers.
2321
+ */
2322
+ declare function clientAuthenticationWalletAttestationJwt(options: ClientAuthenticationWalletAttestationJwtOptions): ClientAuthenticationCallback;
2323
+
2324
+ /**
2325
+ * JWT Header schema for IT-Wallet v1.0 Wallet Attestation
2326
+ *
2327
+ * Version 1.0 specifics:
2328
+ * - trust_chain is REQUIRED
2329
+ * - x5c is NOT supported
2330
+ */
2331
+ declare const zWalletAttestationJwtHeaderV1_0: z$1.ZodObject<{
2332
+ trust_chain: z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>;
2333
+ typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
2334
+ alg: z$1.ZodString;
2335
+ jwk: z$1.ZodOptional<z$1.ZodObject<{
2336
+ alg: z$1.ZodOptional<z$1.ZodString>;
2337
+ crv: z$1.ZodOptional<z$1.ZodString>;
2338
+ d: z$1.ZodOptional<z$1.ZodString>;
2339
+ dp: z$1.ZodOptional<z$1.ZodString>;
2340
+ dq: z$1.ZodOptional<z$1.ZodString>;
2341
+ e: z$1.ZodOptional<z$1.ZodString>;
2342
+ ext: z$1.ZodOptional<z$1.ZodBoolean>;
2343
+ k: z$1.ZodOptional<z$1.ZodString>;
2344
+ key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2345
+ kid: z$1.ZodOptional<z$1.ZodString>;
2346
+ kty: z$1.ZodString;
2347
+ n: z$1.ZodOptional<z$1.ZodString>;
2348
+ oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2349
+ d: z$1.ZodOptional<z$1.ZodString>;
2350
+ r: z$1.ZodOptional<z$1.ZodString>;
2351
+ t: z$1.ZodOptional<z$1.ZodString>;
2352
+ }, z$1.core.$loose>>>;
2353
+ p: z$1.ZodOptional<z$1.ZodString>;
2354
+ q: z$1.ZodOptional<z$1.ZodString>;
2355
+ qi: z$1.ZodOptional<z$1.ZodString>;
2356
+ use: z$1.ZodOptional<z$1.ZodString>;
2357
+ x: z$1.ZodOptional<z$1.ZodString>;
2358
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2359
+ x5t: z$1.ZodOptional<z$1.ZodString>;
2360
+ "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
2361
+ x5u: z$1.ZodOptional<z$1.ZodString>;
2362
+ y: z$1.ZodOptional<z$1.ZodString>;
2363
+ }, z$1.core.$loose>>;
2364
+ kid: z$1.ZodOptional<z$1.ZodString>;
2365
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2366
+ }, z$1.core.$loose>;
2367
+ /**
2368
+ * JWT Payload schema for IT-Wallet v1.0 Wallet Attestation
2369
+ *
2370
+ * Version 1.0 specifics:
2371
+ * - Standard claims only
2372
+ * - No nbf or status support
2373
+ */
2374
+ declare const zWalletAttestationJwtPayloadV1_0: z$1.ZodObject<{
2375
+ aal: z$1.ZodString;
2376
+ cnf: z$1.ZodObject<{
2377
+ jwk: z$1.ZodObject<{
2378
+ alg: z$1.ZodOptional<z$1.ZodString>;
2379
+ crv: z$1.ZodOptional<z$1.ZodString>;
2380
+ d: z$1.ZodOptional<z$1.ZodString>;
2381
+ dp: z$1.ZodOptional<z$1.ZodString>;
2382
+ dq: z$1.ZodOptional<z$1.ZodString>;
2383
+ e: z$1.ZodOptional<z$1.ZodString>;
2384
+ ext: z$1.ZodOptional<z$1.ZodBoolean>;
2385
+ k: z$1.ZodOptional<z$1.ZodString>;
2386
+ key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2387
+ kid: z$1.ZodOptional<z$1.ZodString>;
2388
+ kty: z$1.ZodString;
2389
+ n: z$1.ZodOptional<z$1.ZodString>;
2390
+ oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2391
+ d: z$1.ZodOptional<z$1.ZodString>;
2392
+ r: z$1.ZodOptional<z$1.ZodString>;
2393
+ t: z$1.ZodOptional<z$1.ZodString>;
2394
+ }, z$1.core.$loose>>>;
2395
+ p: z$1.ZodOptional<z$1.ZodString>;
2396
+ q: z$1.ZodOptional<z$1.ZodString>;
2397
+ qi: z$1.ZodOptional<z$1.ZodString>;
2398
+ use: z$1.ZodOptional<z$1.ZodString>;
2399
+ x: z$1.ZodOptional<z$1.ZodString>;
2400
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2401
+ x5t: z$1.ZodOptional<z$1.ZodString>;
2402
+ "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
2403
+ x5u: z$1.ZodOptional<z$1.ZodString>;
2404
+ y: z$1.ZodOptional<z$1.ZodString>;
2405
+ }, z$1.core.$loose>;
2406
+ }, z$1.core.$strip>;
2407
+ exp: z$1.ZodNumber;
2408
+ iat: z$1.ZodNumber;
2409
+ iss: z$1.ZodString;
2410
+ sub: z$1.ZodString;
2411
+ wallet_link: z$1.ZodOptional<z$1.ZodURL>;
2412
+ wallet_name: z$1.ZodOptional<z$1.ZodString>;
2413
+ aud: z$1.ZodOptional<z$1.ZodString>;
2414
+ jti: z$1.ZodOptional<z$1.ZodString>;
2415
+ nbf: z$1.ZodOptional<z$1.ZodNumber>;
2416
+ nonce: z$1.ZodOptional<z$1.ZodString>;
2417
+ status: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
2418
+ trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
2419
+ }, z$1.core.$loose>;
2420
+ /**
2421
+ * Wallet Attestation JWT type for v1.0
2422
+ * The JWT is returned as a compact string
2423
+ */
2424
+ type WalletAttestationJwtV1_0 = string;
2425
+ /**
2426
+ * Zod schema for wallet attestation JWT validation (v1.0)
2427
+ * Validates that the result is a non-empty string
2428
+ */
2429
+ declare const zWalletAttestationJwtV1_0: z$1.ZodString;
2430
+
2431
+ /**
2432
+ * Options for creating a wallet attestation with v1.0
2433
+ * Uses only trust_chain (federation method)
2434
+ */
2435
+ interface WalletAttestationOptionsV1_0 extends BaseWalletAttestationOptions {
2436
+ /**
2437
+ * It expresses the strength of the authentication mechanism backing the Wallet instance when interacting with a Relying Party.
2438
+ */
2439
+ authenticatorAssuranceLevel: string;
2440
+ signer: {
2441
+ alg: string;
2442
+ kid: string;
2443
+ method: "federation";
2444
+ trustChain: [string, ...string[]];
2445
+ };
2446
+ }
2447
+ /**
2448
+ * Create a Wallet Attestation JWT for IT-Wallet v1.0
2449
+ *
2450
+ * Version 1.0 specifics:
2451
+ * - Uses only `trust_chain` in header (federation method)
2452
+ *
2453
+ * @param options - Wallet attestation options for v1.0
2454
+ * @returns Signed wallet attestation JWT string
2455
+ * @throws {ValidationError} When validation of the JWT structure fails
2456
+ * @throws {ClientAttestationError} For other unexpected errors during creation
2457
+ * @internal This function is called by the WalletProvider router
2458
+ */
2459
+ declare const createWalletAttestationJwt$2: (options: WalletAttestationOptionsV1_0) => Promise<WalletAttestationJwtV1_0>;
2460
+
2461
+ /**
2462
+ * JWT Header schema for IT-Wallet v1.3 Wallet Attestation
2463
+ *
2464
+ * Version 1.3 specifics:
2465
+ * - x5c is REQUIRED
2466
+ * - trust_chain is OPTIONAL
2467
+ */
2468
+ declare const zWalletAttestationJwtHeaderV1_3: z$1.ZodObject<{
2469
+ trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
2470
+ typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
2471
+ x5c: z$1.ZodArray<z$1.ZodString>;
2472
+ alg: z$1.ZodString;
2473
+ jwk: z$1.ZodOptional<z$1.ZodObject<{
2474
+ alg: z$1.ZodOptional<z$1.ZodString>;
2475
+ crv: z$1.ZodOptional<z$1.ZodString>;
2476
+ d: z$1.ZodOptional<z$1.ZodString>;
2477
+ dp: z$1.ZodOptional<z$1.ZodString>;
2478
+ dq: z$1.ZodOptional<z$1.ZodString>;
2479
+ e: z$1.ZodOptional<z$1.ZodString>;
2480
+ ext: z$1.ZodOptional<z$1.ZodBoolean>;
2481
+ k: z$1.ZodOptional<z$1.ZodString>;
2482
+ key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2483
+ kid: z$1.ZodOptional<z$1.ZodString>;
2484
+ kty: z$1.ZodString;
2485
+ n: z$1.ZodOptional<z$1.ZodString>;
2486
+ oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2487
+ d: z$1.ZodOptional<z$1.ZodString>;
2488
+ r: z$1.ZodOptional<z$1.ZodString>;
2489
+ t: z$1.ZodOptional<z$1.ZodString>;
2490
+ }, z$1.core.$loose>>>;
2491
+ p: z$1.ZodOptional<z$1.ZodString>;
2492
+ q: z$1.ZodOptional<z$1.ZodString>;
2493
+ qi: z$1.ZodOptional<z$1.ZodString>;
2494
+ use: z$1.ZodOptional<z$1.ZodString>;
2495
+ x: z$1.ZodOptional<z$1.ZodString>;
2496
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2497
+ x5t: z$1.ZodOptional<z$1.ZodString>;
2498
+ "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
2499
+ x5u: z$1.ZodOptional<z$1.ZodString>;
2500
+ y: z$1.ZodOptional<z$1.ZodString>;
2501
+ }, z$1.core.$loose>>;
2502
+ kid: z$1.ZodOptional<z$1.ZodString>;
2503
+ }, z$1.core.$loose>;
2504
+ /**
2505
+ * JWT Payload schema for IT-Wallet v1.3 Wallet Attestation
2506
+ *
2507
+ * Version 1.3 specifics:
2508
+ * - Supports nbf (not before) claim
2509
+ * - Supports status claim for revocation mechanisms
2510
+ */
2511
+ declare const zWalletAttestationJwtPayloadV1_3: z$1.ZodObject<{
2512
+ cnf: z$1.ZodObject<{
2513
+ jwk: z$1.ZodObject<{
2514
+ alg: z$1.ZodOptional<z$1.ZodString>;
2515
+ crv: z$1.ZodOptional<z$1.ZodString>;
2516
+ d: z$1.ZodOptional<z$1.ZodString>;
2517
+ dp: z$1.ZodOptional<z$1.ZodString>;
2518
+ dq: z$1.ZodOptional<z$1.ZodString>;
2519
+ e: z$1.ZodOptional<z$1.ZodString>;
2520
+ ext: z$1.ZodOptional<z$1.ZodBoolean>;
2521
+ k: z$1.ZodOptional<z$1.ZodString>;
2522
+ key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2523
+ kid: z$1.ZodOptional<z$1.ZodString>;
2524
+ kty: z$1.ZodString;
2525
+ n: z$1.ZodOptional<z$1.ZodString>;
2526
+ oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2527
+ d: z$1.ZodOptional<z$1.ZodString>;
2528
+ r: z$1.ZodOptional<z$1.ZodString>;
2529
+ t: z$1.ZodOptional<z$1.ZodString>;
2530
+ }, z$1.core.$loose>>>;
2531
+ p: z$1.ZodOptional<z$1.ZodString>;
2532
+ q: z$1.ZodOptional<z$1.ZodString>;
2533
+ qi: z$1.ZodOptional<z$1.ZodString>;
2534
+ use: z$1.ZodOptional<z$1.ZodString>;
2535
+ x: z$1.ZodOptional<z$1.ZodString>;
2536
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2537
+ x5t: z$1.ZodOptional<z$1.ZodString>;
2538
+ "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
2539
+ x5u: z$1.ZodOptional<z$1.ZodString>;
2540
+ y: z$1.ZodOptional<z$1.ZodString>;
2541
+ }, z$1.core.$loose>;
2542
+ }, z$1.core.$strip>;
2543
+ exp: z$1.ZodNumber;
2544
+ iat: z$1.ZodNumber;
2545
+ iss: z$1.ZodString;
2546
+ nbf: z$1.ZodOptional<z$1.ZodNumber>;
2547
+ status: z$1.ZodOptional<z$1.ZodObject<{
2548
+ status_list: z$1.ZodObject<{
2549
+ idx: z$1.ZodNumber;
2550
+ uri: z$1.ZodString;
2551
+ }, z$1.core.$strip>;
2552
+ }, z$1.core.$strip>>;
2553
+ sub: z$1.ZodString;
2554
+ wallet_link: z$1.ZodOptional<z$1.ZodURL>;
2555
+ wallet_name: z$1.ZodOptional<z$1.ZodString>;
2556
+ aud: z$1.ZodOptional<z$1.ZodString>;
2557
+ jti: z$1.ZodOptional<z$1.ZodString>;
2558
+ nonce: z$1.ZodOptional<z$1.ZodString>;
2559
+ trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
2560
+ }, z$1.core.$loose>;
2561
+ /**
2562
+ * Wallet Attestation JWT type for v1.3
2563
+ * The JWT is returned as a compact string
2564
+ */
2565
+ type WalletAttestationJwtV1_3 = string;
2566
+ /**
2567
+ * Zod schema for wallet attestation JWT validation (v1.3)
2568
+ * Validates that the result is a non-empty string
2569
+ */
2570
+ declare const zWalletAttestationJwtV1_3: z$1.ZodString;
2571
+
2572
+ /**
2573
+ * Options for creating a wallet attestation with v1.3
2574
+ * Requires x5c, optional trust_chain, nbf, and status
2575
+ */
2576
+ interface WalletAttestationOptionsV1_3 extends BaseWalletAttestationOptions {
2577
+ nbf?: Date;
2578
+ signer: {
2579
+ alg: string;
2580
+ kid: string;
2581
+ method: "x5c";
2582
+ trustChain?: [string, ...string[]];
2583
+ x5c: [string, ...string[]];
2584
+ };
2585
+ status?: {
2586
+ status_list: {
2587
+ idx: number;
2588
+ uri: string;
2589
+ };
2590
+ };
2591
+ }
2592
+ /**
2593
+ * Create a Wallet Attestation JWT for IT-Wallet v1.3
2594
+ *
2595
+ * Version 1.3 specifics:
2596
+ * - x5c in header is REQUIRED
2597
+ * - trust_chain in header is OPTIONAL
2598
+ * - Supports nbf and status claims in payload
2599
+ *
2600
+ * @param options - Wallet attestation options for v1.3
2601
+ * @returns Signed wallet attestation JWT string
2602
+ * @throws {ValidationError} When validation fails (including nbf >= exp)
2603
+ * @throws {ClientAttestationError} For other unexpected errors during creation
2604
+ * @internal This function is called by the WalletProvider router
2593
2605
  */
2594
- declare function verifyPushedAuthorizationRequest(options: VerifyPushedAuthorizationRequestOptions): Promise<VerifyPushedAuthorizationRequestReturn>;
2606
+ declare const createWalletAttestationJwt$1: (options: WalletAttestationOptionsV1_3) => Promise<WalletAttestationJwtV1_3>;
2595
2607
 
2596
- interface DecodeJwtOptions<HeaderSchema extends BaseSchema | undefined, PayloadSchema extends BaseSchema | undefined> {
2597
- /**
2598
- * Schema to use for validating the header. If not provided the
2599
- * default `zJwtHeader` schema will be used
2600
- */
2601
- headerSchema?: HeaderSchema;
2602
- /**
2603
- * The compact encoded jwt
2604
- */
2605
- jwt: string;
2606
- /**
2607
- * Schema to use for validating the payload. If not provided the
2608
- * default `zJwtPayload` schema will be used
2609
- */
2610
- payloadSchema?: PayloadSchema;
2611
- }
2612
- interface DecodeJwtResult<HeaderSchema extends BaseSchema | undefined = undefined, PayloadSchema extends BaseSchema | undefined = undefined> {
2613
- header: InferSchemaOrDefaultOutput<HeaderSchema, typeof zJwtHeader>;
2614
- payload: InferSchemaOrDefaultOutput<PayloadSchema, typeof zJwtPayload>;
2615
- signature: string;
2608
+ declare const zWalletAttestationStatusV1_4: z$1.ZodObject<{
2609
+ status_list: z$1.ZodObject<{
2610
+ idx: z$1.ZodNumber;
2611
+ uri: z$1.ZodString;
2612
+ }, z$1.core.$strip>;
2613
+ }, z$1.core.$strip>;
2614
+ declare const zEudiWalletInfoV1_4: z$1.ZodObject<{
2615
+ general_info: z$1.ZodObject<{
2616
+ wallet_provider_name: z$1.ZodString;
2617
+ wallet_solution_certification_information: z$1.ZodURL;
2618
+ wallet_solution_id: z$1.ZodString;
2619
+ wallet_solution_version: z$1.ZodString;
2620
+ }, z$1.core.$strip>;
2621
+ }, z$1.core.$strip>;
2622
+ declare const zWalletAttestationJwtHeaderV1_4: z$1.ZodObject<{
2623
+ trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
2624
+ typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
2625
+ x5c: z$1.ZodArray<z$1.ZodString>;
2626
+ alg: z$1.ZodString;
2627
+ jwk: z$1.ZodOptional<z$1.ZodObject<{
2628
+ alg: z$1.ZodOptional<z$1.ZodString>;
2629
+ crv: z$1.ZodOptional<z$1.ZodString>;
2630
+ d: z$1.ZodOptional<z$1.ZodString>;
2631
+ dp: z$1.ZodOptional<z$1.ZodString>;
2632
+ dq: z$1.ZodOptional<z$1.ZodString>;
2633
+ e: z$1.ZodOptional<z$1.ZodString>;
2634
+ ext: z$1.ZodOptional<z$1.ZodBoolean>;
2635
+ k: z$1.ZodOptional<z$1.ZodString>;
2636
+ key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2637
+ kid: z$1.ZodOptional<z$1.ZodString>;
2638
+ kty: z$1.ZodString;
2639
+ n: z$1.ZodOptional<z$1.ZodString>;
2640
+ oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2641
+ d: z$1.ZodOptional<z$1.ZodString>;
2642
+ r: z$1.ZodOptional<z$1.ZodString>;
2643
+ t: z$1.ZodOptional<z$1.ZodString>;
2644
+ }, z$1.core.$loose>>>;
2645
+ p: z$1.ZodOptional<z$1.ZodString>;
2646
+ q: z$1.ZodOptional<z$1.ZodString>;
2647
+ qi: z$1.ZodOptional<z$1.ZodString>;
2648
+ use: z$1.ZodOptional<z$1.ZodString>;
2649
+ x: z$1.ZodOptional<z$1.ZodString>;
2650
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2651
+ x5t: z$1.ZodOptional<z$1.ZodString>;
2652
+ "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
2653
+ x5u: z$1.ZodOptional<z$1.ZodString>;
2654
+ y: z$1.ZodOptional<z$1.ZodString>;
2655
+ }, z$1.core.$loose>>;
2656
+ kid: z$1.ZodOptional<z$1.ZodString>;
2657
+ }, z$1.core.$loose>;
2658
+ declare const zWalletAttestationJwtPayloadV1_4: z$1.ZodObject<{
2659
+ cnf: z$1.ZodObject<{
2660
+ jwk: z$1.ZodObject<{
2661
+ alg: z$1.ZodOptional<z$1.ZodString>;
2662
+ crv: z$1.ZodOptional<z$1.ZodString>;
2663
+ d: z$1.ZodOptional<z$1.ZodString>;
2664
+ dp: z$1.ZodOptional<z$1.ZodString>;
2665
+ dq: z$1.ZodOptional<z$1.ZodString>;
2666
+ e: z$1.ZodOptional<z$1.ZodString>;
2667
+ ext: z$1.ZodOptional<z$1.ZodBoolean>;
2668
+ k: z$1.ZodOptional<z$1.ZodString>;
2669
+ key_ops: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2670
+ kid: z$1.ZodOptional<z$1.ZodString>;
2671
+ kty: z$1.ZodString;
2672
+ n: z$1.ZodOptional<z$1.ZodString>;
2673
+ oth: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2674
+ d: z$1.ZodOptional<z$1.ZodString>;
2675
+ r: z$1.ZodOptional<z$1.ZodString>;
2676
+ t: z$1.ZodOptional<z$1.ZodString>;
2677
+ }, z$1.core.$loose>>>;
2678
+ p: z$1.ZodOptional<z$1.ZodString>;
2679
+ q: z$1.ZodOptional<z$1.ZodString>;
2680
+ qi: z$1.ZodOptional<z$1.ZodString>;
2681
+ use: z$1.ZodOptional<z$1.ZodString>;
2682
+ x: z$1.ZodOptional<z$1.ZodString>;
2683
+ x5c: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2684
+ x5t: z$1.ZodOptional<z$1.ZodString>;
2685
+ "x5t#S256": z$1.ZodOptional<z$1.ZodString>;
2686
+ x5u: z$1.ZodOptional<z$1.ZodString>;
2687
+ y: z$1.ZodOptional<z$1.ZodString>;
2688
+ }, z$1.core.$loose>;
2689
+ }, z$1.core.$strip>;
2690
+ eudi_wallet_info: z$1.ZodOptional<z$1.ZodObject<{
2691
+ general_info: z$1.ZodObject<{
2692
+ wallet_provider_name: z$1.ZodString;
2693
+ wallet_solution_certification_information: z$1.ZodURL;
2694
+ wallet_solution_id: z$1.ZodString;
2695
+ wallet_solution_version: z$1.ZodString;
2696
+ }, z$1.core.$strip>;
2697
+ }, z$1.core.$strip>>;
2698
+ exp: z$1.ZodNumber;
2699
+ iat: z$1.ZodNumber;
2700
+ iss: z$1.ZodString;
2701
+ nbf: z$1.ZodOptional<z$1.ZodNumber>;
2702
+ status: z$1.ZodObject<{
2703
+ status_list: z$1.ZodObject<{
2704
+ idx: z$1.ZodNumber;
2705
+ uri: z$1.ZodString;
2706
+ }, z$1.core.$strip>;
2707
+ }, z$1.core.$strip>;
2708
+ sub: z$1.ZodString;
2709
+ wallet_link: z$1.ZodURL;
2710
+ wallet_name: z$1.ZodString;
2711
+ aud: z$1.ZodOptional<z$1.ZodString>;
2712
+ jti: z$1.ZodOptional<z$1.ZodString>;
2713
+ nonce: z$1.ZodOptional<z$1.ZodString>;
2714
+ trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
2715
+ }, z$1.core.$loose>;
2716
+ type WalletAttestationJwtV1_4 = string;
2717
+ declare const zWalletAttestationJwtV1_4: z$1.ZodString;
2718
+
2719
+ interface WalletAttestationOptionsV1_4 extends Omit<BaseWalletAttestationOptions, "walletLink" | "walletName"> {
2720
+ eudiWalletInfo?: z$1.infer<typeof zEudiWalletInfoV1_4>;
2721
+ nbf?: Date;
2722
+ signer: {
2723
+ alg: string;
2724
+ kid: string;
2725
+ method: "x5c";
2726
+ trustChain?: [string, ...string[]];
2727
+ x5c: [string, ...string[]];
2728
+ };
2729
+ status: z$1.infer<typeof zWalletAttestationStatusV1_4>;
2730
+ walletLink: string;
2731
+ walletName: string;
2616
2732
  }
2617
- declare function decodeJwt<HeaderSchema extends BaseSchema | undefined = undefined, PayloadSchema extends BaseSchema | undefined = undefined>(options: DecodeJwtOptions<HeaderSchema, PayloadSchema>): DecodeJwtResult<HeaderSchema, PayloadSchema>;
2618
- type IsSchemaProvided<T> = T extends undefined ? false : true;
2619
- type InferSchemaOrDefaultOutput<ProvidedSchema extends BaseSchema | undefined, DefaultSchema extends BaseSchema> = IsSchemaProvided<ProvidedSchema> extends true ? ProvidedSchema extends BaseSchema ? z.infer<ProvidedSchema> : never : z.infer<DefaultSchema>;
2733
+ declare const createWalletAttestationJwt: (options: WalletAttestationOptionsV1_4) => Promise<WalletAttestationJwtV1_4>;
2620
2734
 
2621
2735
  interface DecodeJwtHeaderOptions<HeaderSchema extends BaseSchema | undefined> {
2736
+ /**
2737
+ * Optional prefix for error messages thrown during decoding, to provide more context on where the error occurred
2738
+ */
2739
+ errorMessagePrefix?: string;
2622
2740
  /**
2623
2741
  * Schema to use for validating the header. If not provided the
2624
2742
  * default `zJwtHeader` schema will be used
@@ -2701,48 +2819,177 @@ declare const zCompactJwe: z$1.ZodString;
2701
2819
  * Generic error thrown on OAuth2 operations
2702
2820
  */
2703
2821
  declare class Oauth2Error extends Error {
2704
- readonly statusCode?: number | undefined;
2705
- constructor(message: string, statusCode?: number | undefined);
2822
+ readonly statusCode?: number;
2823
+ constructor(message: string, options?: {
2824
+ statusCode?: number;
2825
+ } & ErrorOptions);
2706
2826
  }
2707
2827
  /**
2708
2828
  * Custom error thrown when pushed authorization request operations fail
2709
2829
  */
2710
2830
  declare class PushedAuthorizationRequestError extends Oauth2Error {
2711
- readonly statusCode?: number | undefined;
2712
- constructor(message: string, statusCode?: number | undefined);
2831
+ readonly statusCode?: number;
2832
+ constructor(message: string, options?: {
2833
+ statusCode?: number;
2834
+ } & ErrorOptions);
2713
2835
  }
2714
2836
  /**
2715
2837
  * Error thrown in case {@link createTokenDPoP} is called without neither a custom jti
2716
2838
  * nor a generateRandom callback or when the signJwt callback throws
2717
2839
  */
2718
2840
  declare class CreateTokenDPoPError extends Oauth2Error {
2719
- constructor(message: string);
2841
+ constructor(message: string, options?: ErrorOptions);
2720
2842
  }
2721
2843
  /**
2722
2844
  * Error thrown during MRTD (Machine Readable Travel Document) Proof of Possession operations.
2723
2845
  * Used in eID Substantial Authentication with MRTD Verification flow (IT-Wallet L2+ specification).
2724
2846
  */
2725
2847
  declare class MrtdPopError extends Oauth2Error {
2726
- readonly statusCode?: number | undefined;
2727
- constructor(message: string, statusCode?: number | undefined);
2848
+ readonly statusCode?: number;
2849
+ constructor(message: string, options?: {
2850
+ statusCode?: number;
2851
+ } & ErrorOptions);
2728
2852
  }
2729
2853
  /**
2730
2854
  * Custom error thrown when pushed authorization request operations fail
2731
2855
  */
2732
2856
  declare class FetchTokenResponseError extends Oauth2Error {
2733
- readonly statusCode?: number | undefined;
2734
- constructor(message: string, statusCode?: number | undefined);
2857
+ readonly statusCode?: number;
2858
+ constructor(message: string, options?: {
2859
+ statusCode?: number;
2860
+ } & ErrorOptions);
2735
2861
  }
2736
2862
  declare class CreateTokenResponseError extends Oauth2Error {
2737
- readonly statusCode?: number | undefined;
2738
- constructor(message: string, statusCode?: number | undefined);
2863
+ readonly statusCode?: number;
2864
+ constructor(message: string, options?: {
2865
+ statusCode?: number;
2866
+ } & ErrorOptions);
2739
2867
  }
2740
2868
  /**
2741
2869
  * Error thrown when an unexpected error occurs during client attestation (wallet attestation) creation.
2742
2870
  */
2743
2871
  declare class ClientAttestationError extends Oauth2Error {
2744
- constructor(message: string, cause?: unknown);
2872
+ constructor(message: string, options?: ErrorOptions);
2873
+ }
2874
+
2875
+ interface CreateJarRequestOptions {
2876
+ /**
2877
+ * Additional claims merged into the request object payload before
2878
+ * `authorizationRequestPayload`.
2879
+ */
2880
+ additionalJwtPayload?: Record<string, unknown>;
2881
+ /**
2882
+ * Authorization request claims used as JWT header parameters.
2883
+ */
2884
+ authorizationRequestHeader: JarRequestObjectHeader;
2885
+ /**
2886
+ * Authorization request claims used as JWT payload.
2887
+ */
2888
+ authorizationRequestPayload: JarRequestObjectPayload;
2889
+ /**
2890
+ * Cryptographic callbacks used to sign and optionally encrypt the JAR.
2891
+ */
2892
+ callbacks: Partial<Pick<CallbackContext, "encryptJwe">> & Pick<CallbackContext, "signJwt">;
2893
+ /**
2894
+ * Request object lifetime in seconds from `now`.
2895
+ */
2896
+ expiresInSeconds: number;
2897
+ /**
2898
+ * Encryptor configuration. When provided, the signed request object is wrapped
2899
+ * as JWE and returned as encrypted `request` value.
2900
+ */
2901
+ jweEncryptor?: JweEncryptor;
2902
+ /**
2903
+ * Signer configuration used to produce the request object JWT.
2904
+ */
2905
+ jwtSigner: JwtSigner;
2906
+ /**
2907
+ * Date that should be used as now. If not provided current date will be used.
2908
+ */
2909
+ now?: Date;
2910
+ /**
2911
+ * Optional request URI for by-reference JAR transmission.
2912
+ * When provided, `jarAuthorizationRequest` will include `request_uri` instead of `request`.
2913
+ */
2914
+ requestUri?: string;
2915
+ }
2916
+ interface CreateJarRequestResult {
2917
+ /**
2918
+ * The signed (and optionally encrypted) JWT string representing the authorization request.
2919
+ * This value is included in `jarAuthorizationRequest` when `requestUri` is not provided.
2920
+ */
2921
+ authorizationRequestJwt: string;
2922
+ /**
2923
+ * The JWK used for encryption when `jweEncryptor` is provided, otherwise undefined.
2924
+ */
2925
+ encryptionJwk?: Jwk;
2926
+ /**
2927
+ * The JAR authorization request parameters to be sent to the authorization endpoint.
2928
+ * Contains either `request` or `request_uri` depending on the presence of `requestUri` in options.
2929
+ */
2930
+ jarAuthorizationRequest: JarAuthorizationRequest;
2931
+ /**
2932
+ * The JWK used for signing the request object JWT.
2933
+ */
2934
+ signerJwk: Jwk;
2935
+ }
2936
+ /**
2937
+ * Creates a JWT Secured Authorization Request (JAR) request payload.
2938
+ *
2939
+ * The request object is always signed, and optionally encrypted when `jweEncryptor`
2940
+ * is provided. The returned `jarAuthorizationRequest` is created in one of two forms:
2941
+ * - by-value, with `request`
2942
+ * - by-reference, with `request_uri`
2943
+ *
2944
+ * @param options - Parameters used to create the JAR request
2945
+ * @param options.additionalJwtPayload - Additional JWT claims merged before authorization claims
2946
+ * @param options.authorizationRequestPayload - Base authorization request JWT payload
2947
+ * @param options.authorizationRequestHeader - JWT header parameters for the request object
2948
+ * @param options.callbacks - Callback context with required `signJwt` and optional `encryptJwe`
2949
+ * @param options.expiresInSeconds - JWT expiration offset in seconds
2950
+ * @param options.jweEncryptor - Optional JWE encryptor to wrap the signed JWT
2951
+ * @param options.jwtSigner - JWT signer used for request object signing
2952
+ * @param options.now - Optional reference time used for `iat` and `exp`
2953
+ * @param options.requestUri - Optional request URI for by-reference transmission
2954
+ *
2955
+ * @returns Signed (and optionally encrypted) authorization request data, signer key material,
2956
+ * and JAR request parameters for transmission.
2957
+ */
2958
+ declare function createJarRequest(options: CreateJarRequestOptions): Promise<CreateJarRequestResult>;
2959
+
2960
+ declare function fetchJarRequestObject(options: {
2961
+ fetch?: Fetch;
2962
+ requestUri: string;
2963
+ }): Promise<string>;
2964
+
2965
+ interface ParsedJarRequestOptions {
2966
+ callbacks: Pick<CallbackContext, "fetch">;
2967
+ jarRequestParams: JarAuthorizationRequest;
2745
2968
  }
2969
+ interface ParsedJarRequest {
2970
+ authorizationRequestJwt: string;
2971
+ sendBy: "reference" | "value";
2972
+ }
2973
+ declare function isJarAuthorizationRequest(request: JarAuthorizationRequest): request is JarAuthorizationRequest;
2974
+ /**
2975
+ * Parse a JAR (JWT Secured Authorization Request) request by validating and optionally fetch from uri.
2976
+ *
2977
+ * @param options - The input parameters
2978
+ * @param options.jarRequestParams - The JAR authorization request parameters
2979
+ * @param options.callbacks - Context containing the relevant Jose crypto operations
2980
+ * @returns An object containing the transmission method ('value' or 'reference') and the JWT request object.
2981
+ */
2982
+ declare function parseJarRequest(options: ParsedJarRequestOptions): Promise<ParsedJarRequest>;
2983
+
2984
+ declare function validateJarRequestParams(options: {
2985
+ jarRequestParams: JarAuthorizationRequest;
2986
+ }): ({
2987
+ request: string;
2988
+ request_uri?: never;
2989
+ } | {
2990
+ request?: never;
2991
+ request_uri: string;
2992
+ }) & JarAuthorizationRequest;
2746
2993
 
2747
2994
  /**
2748
2995
  * Options for extracting and decoding the JWT from a form_post.jwt response
@@ -3315,4 +3562,4 @@ declare const zDpopJwtHeader: z.ZodObject<{
3315
3562
  }, z.core.$loose>;
3316
3563
  type DpopJwtHeader = z.infer<typeof zDpopJwtHeader>;
3317
3564
 
3318
- export { type AccessTokenProfileJwtHeader, type AccessTokenProfileJwtPayload, type AccessTokenRequest, type AccessTokenResponse, type AuthorizationCodeGrantIdentifier, type AuthorizationCodeGrantType, type AuthorizationRequest, type BaseVerifyWalletAttestationJwtOptions, type BaseWalletAttestationOptions, type CertificateChain, ClientAttestationError, type ClientAttestationOptions, type ClientAuthenticationCallback, type ClientAuthenticationCallbackOptions, type ClientAuthenticationWalletAttestationJwtOptions, type CreateAccessTokenResponseOptions, type CreateClientAttestationPopJwtOptions, type CreateJarRequestOptions, type CreateJarRequestResult, type CreateMrtdValidationJwtOptions, type CreatePkceOptions, type CreatePkceReturn, type CreatePushedAuthorizationRequestOptions, CreateTokenDPoPError, type CreateTokenDPoPOptions, CreateTokenResponseError, type DecodeJwtHeaderOptions, type DecodeJwtHeaderResult, type DecodeJwtOptions, type DecodeJwtResult, type DpopJwtHeader, type DpopJwtPayload, type FetchMrtdPopInitOptions, type FetchMrtdPopInitResult, type FetchMrtdPopVerifyOptions, type FetchMrtdPopVerifyResult, FetchTokenResponseError, type FetchTokenResponseOptions, type GetJwtFromFormPostOptions, type InferSchemaOrDefaultOutput, type IsClientAttestationSupportedOptions, type JarAuthorizationRequest, type JarRequestObjectHeader, type JarRequestObjectPayload, type Jwk, type JwkSet, type JwtHeader, type JwtPayload, type JwtSignerCustom, type JwtSignerDid, type JwtSignerFederation, type JwtSignerWithJwk, type JwtSignerX5c, type MrtdChallengeJwtHeader, type MrtdChallengeJwtPayload, type MrtdDocumentData, MrtdPopError, type MrtdPopInitResponseJwtHeader, type MrtdPopInitResponseJwtPayload, type MrtdPopVerifyResponse, type MrtdValidationJwtHeader, type MrtdValidationJwtPayload, Oauth2Error, type ParseAccessTokenRequestOptions, type ParseAccessTokenRequestResult, type ParseAuthorizationRequestOptions, type ParseAuthorizationRequestResult, type ParseMrtdChallengeOptions, type ParseMrtdChallengeResult, type ParsePushedAuthorizationRequestOptions, type ParsePushedAuthorizationRequestResult, type ParsedAccessTokenAuthorizationCodeRequestGrant, type ParsedAccessTokenRefreshTokenRequestGrant, type ParsedJarRequest, type ParsedJarRequestOptions, PkceCodeChallengeMethod, type PushedAuthorizationRequest, PushedAuthorizationRequestError, type PushedAuthorizationRequestSigned, type PushedAuthorizationRequestUnsigned, type PushedAuthorizationResponse, type RefreshTokenGrantIdentifier, type RefreshTokenGrantType, type RequestLike, type RetrieveAuthorizationCodeAccessTokenOptions, SupportedClientAuthenticationMethod, type TrustChain, index$1 as V1_0, index as V1_3, type VerifiedClientAttestationPopJwt, type VerifiedJarRequest, type VerifiedWalletAttestationJwt, type VerifyAccessTokenRequestDpop, type VerifyAccessTokenRequestOptions, type VerifyAccessTokenRequestPkce, type VerifyAccessTokenRequestResult, type VerifyAuthorizationRequestDPoP, type VerifyAuthorizationRequestOptions, type VerifyAuthorizationRequestResult, type VerifyClientAttestationOptions, type VerifyClientAttestationPopJwtOptions, type VerifyJarRequestOptions, type VerifyMrtdChallengeOptions, type VerifyMrtdChallengeResult, type VerifyPkceOptions, type VerifyPushedAuthorizationRequestOptions, type VerifyPushedAuthorizationRequestReturn, type VerifyTokenDPoPOptions, type VerifyWalletAttestationJwtOptions, authorizationCodeGrantIdentifier, clientAuthenticationAnonymous, clientAuthenticationWalletAttestationJwt, createAccessTokenResponse, createClientAttestationPopJwt, createJarRequest, createMrtdValidationJwt, createPkce, createPushedAuthorizationRequest, createTokenDPoP, createTokenRequest, decodeJwt, decodeJwtHeader, extractClientAttestationJwtsFromHeaders, extractDpopJwtFromHeaders, fetchJarRequestObject, fetchMrtdPopInit, fetchMrtdPopVerify, fetchPushedAuthorizationResponse, type fetchPushedAuthorizationResponseOptions, fetchTokenResponse, getJwtFromFormPost, htuFromRequestUrl, isClientAttestationSupported, isJarAuthorizationRequest, isPushedAuthorizationRequestSigned, isPushedAuthorizationRequestUnsigned, jwtAuthorizationRequestJwtHeaderTyp, jwtHeaderFromJwtSigner, oauthClientAttestationHeader, oauthClientAttestationPopHeader, parseAccessTokenRequest, parseAuthorizationRequest, parseJarRequest, parseMrtdChallenge, parsePushedAuthorizationRequest, refreshTokenGrantIdentifier, signedAuthorizationRequestJwtHeaderTyp, toURLSearchParams, validateJarRequestParams, verifyAccessTokenRequest, verifyAuthorizationRequest, verifyClientAttestation, verifyClientAttestationPopJwt, verifyJarRequest, verifyMrtdChallenge, verifyPkce, verifyPushedAuthorizationRequest, verifyTokenDPoP, verifyWalletAttestationJwt, zAccessTokenProfileJwtHeader, zAccessTokenProfileJwtPayload, zAccessTokenRequest, zAccessTokenResponse, zAlgValueNotNone, zAuthorizationCodeGrantIdentifier, zAuthorizationRequest, zCertificateChain, zCompactJwe, zCompactJwt, zDpopJwtHeader, zDpopJwtPayload, zJarAuthorizationRequest, zJarRequestObjectHeader, zJarRequestObjectPayload, zJwk, zJwkSet, zJwtConfirmationPayload, zJwtHeader, zJwtPayload, zMrtdChallengeJwtHeader, zMrtdChallengeJwtPayload, zMrtdPopInitResponseJwtHeader, zMrtdPopInitResponseJwtPayload, zMrtdPopVerifyResponse, zMrtdValidationJwtHeader, zMrtdValidationJwtPayload, zOauthClientAttestationHeader, zOauthClientAttestationPopHeader, zPushedAuthorizationRequestSigned, zPushedAuthorizationRequestUnsigned, zPushedAuthorizationResponse, zRefreshTokenGrantIdentifier, zSignedAuthorizationRequestJwtHeaderTyp, zTrustChain };
3565
+ export { type AccessTokenProfileJwtHeader, type AccessTokenProfileJwtPayload, type AccessTokenRequest, type AccessTokenResponse, type AuthorizationCodeGrantIdentifier, type AuthorizationCodeGrantType, type AuthorizationRequest, type BaseVerifyWalletAttestationJwtOptions, type BaseWalletAttestationOptions, type CertificateChain, ClientAttestationError, type ClientAttestationOptions, type ClientAuthenticationCallback, type ClientAuthenticationCallbackOptions, type ClientAuthenticationWalletAttestationJwtOptions, type CreateAccessTokenResponseOptions, type CreateClientAttestationPopJwtOptions, type CreateJarRequestOptions, type CreateJarRequestResult, type CreateMrtdValidationJwtOptions, type CreatePkceOptions, type CreatePkceReturn, type CreatePushedAuthorizationRequestOptions, CreateTokenDPoPError, type CreateTokenDPoPOptions, CreateTokenResponseError, type DecodeJwtHeaderOptions, type DecodeJwtHeaderResult, type DecodeJwtOptions, type DecodeJwtResult, type DpopJwtHeader, type DpopJwtPayload, type FetchMrtdPopInitOptions, type FetchMrtdPopInitResult, type FetchMrtdPopVerifyOptions, type FetchMrtdPopVerifyResult, FetchTokenResponseError, type FetchTokenResponseOptions, type GetJwtFromFormPostOptions, type InferSchemaOrDefaultOutput, type IsClientAttestationSupportedOptions, type JarAuthorizationRequest, type JarRequestObjectHeader, type JarRequestObjectPayload, type Jwk, type JwkSet, type JwtHeader, type JwtPayload, type JwtSignerCustom, type JwtSignerDid, type JwtSignerFederation, type JwtSignerWithJwk, type JwtSignerX5c, MAX_JTI_LENGTH, type MrtdChallengeJwtHeader, type MrtdChallengeJwtPayload, type MrtdDocumentData, MrtdPopError, type MrtdPopInitResponseJwtHeader, type MrtdPopInitResponseJwtPayload, type MrtdPopVerifyResponse, type MrtdValidationJwtHeader, type MrtdValidationJwtPayload, Oauth2Error, type ParseAccessTokenRequestOptions, type ParseAccessTokenRequestResult, type ParseAuthorizationRequestOptions, type ParseAuthorizationRequestResult, type ParseMrtdChallengeOptions, type ParseMrtdChallengeResult, type ParsePushedAuthorizationRequestOptions, type ParsePushedAuthorizationRequestResult, type ParsedAccessTokenAuthorizationCodeRequestGrant, type ParsedAccessTokenRefreshTokenRequestGrant, type ParsedJarRequest, type ParsedJarRequestOptions, PkceCodeChallengeMethod, type PushedAuthorizationRequest, PushedAuthorizationRequestError, type PushedAuthorizationRequestSigned, type PushedAuthorizationRequestUnsigned, type PushedAuthorizationResponse, type RefreshTokenGrantIdentifier, type RefreshTokenGrantType, type RequestLike, type RetrieveAuthorizationCodeAccessTokenOptions, SupportedClientAuthenticationMethod, type TrustChain, type VerifiedClientAttestationPopJwt, type VerifiedJarRequest, type VerifiedWalletAttestationJwt, type VerifiedWalletAttestationJwtV1_0, type VerifiedWalletAttestationJwtV1_3, type VerifiedWalletAttestationJwtV1_4, type VerifyAccessTokenRequestDpop, type VerifyAccessTokenRequestOptions, type VerifyAccessTokenRequestPkce, type VerifyAccessTokenRequestResult, type VerifyAuthorizationRequestDPoP, type VerifyAuthorizationRequestOptions, type VerifyAuthorizationRequestResult, type VerifyClientAttestationOptions, type VerifyClientAttestationPopJwtOptions, type VerifyJarRequestOptions, type VerifyMrtdChallengeOptions, type VerifyMrtdChallengeResult, type VerifyPkceOptions, type VerifyPushedAuthorizationRequestOptions, type VerifyPushedAuthorizationRequestReturn, type VerifyTokenDPoPOptions, type VerifyWalletAttestationJwtOptions, type VerifyWalletAttestationJwtOptionsV1_0, type VerifyWalletAttestationJwtOptionsV1_3, type VerifyWalletAttestationJwtOptionsV1_4, type WalletAttestationJwtV1_0, type WalletAttestationJwtV1_3, type WalletAttestationJwtV1_4, type WalletAttestationOptionsV1_0, type WalletAttestationOptionsV1_3, type WalletAttestationOptionsV1_4, authorizationCodeGrantIdentifier, clientAuthenticationAnonymous, clientAuthenticationWalletAttestationJwt, createAccessTokenResponse, createClientAttestationPopJwt, createJarRequest, createMrtdValidationJwt, createPkce, createPushedAuthorizationRequest, createTokenDPoP, createTokenRequest, createWalletAttestationJwt$2 as createWalletAttestationJwtV1_0, createWalletAttestationJwt$1 as createWalletAttestationJwtV1_3, createWalletAttestationJwt as createWalletAttestationJwtV1_4, decodeJwt, decodeJwtHeader, extractClientAttestationJwtsFromHeaders, extractDpopJwtFromHeaders, fetchJarRequestObject, fetchMrtdPopInit, fetchMrtdPopVerify, fetchPushedAuthorizationResponse, type fetchPushedAuthorizationResponseOptions, fetchTokenResponse, getJwtFromFormPost, htuFromRequestUrl, isClientAttestationSupported, isJarAuthorizationRequest, isPushedAuthorizationRequestSigned, isPushedAuthorizationRequestUnsigned, jwtAuthorizationRequestJwtHeaderTyp, jwtHeaderFromJwtSigner, oauthClientAttestationHeader, oauthClientAttestationPopHeader, parseAccessTokenRequest, parseAuthorizationRequest, parseJarRequest, parseMrtdChallenge, parsePushedAuthorizationRequest, refreshTokenGrantIdentifier, signedAuthorizationRequestJwtHeaderTyp, toURLSearchParams, validateJarRequestParams, verifyAccessTokenRequest, verifyAuthorizationRequest, verifyClientAttestation, verifyClientAttestationPopJwt, verifyJarRequest, verifyMrtdChallenge, verifyPkce, verifyPushedAuthorizationRequest, verifyTokenDPoP, verifyWalletAttestationJwt, verifyWalletAttestationJwt$3 as verifyWalletAttestationJwtV1_0, verifyWalletAttestationJwt$2 as verifyWalletAttestationJwtV1_3, verifyWalletAttestationJwt$1 as verifyWalletAttestationJwtV1_4, zAccessTokenProfileJwtHeader, zAccessTokenProfileJwtPayload, zAccessTokenRequest, zAccessTokenResponse, zAlgValueNotNone, zAuthorizationCodeGrantIdentifier, zAuthorizationRequest, zCertificateChain, zCompactJwe, zCompactJwt, zDpopJwtHeader, zDpopJwtPayload, zJarAuthorizationRequest, zJarRequestObjectHeader, zJarRequestObjectPayload, zJwk, zJwkSet, zJwtConfirmationPayload, zJwtHeader, zJwtPayload, zMrtdChallengeJwtHeader, zMrtdChallengeJwtPayload, zMrtdPopInitResponseJwtHeader, zMrtdPopInitResponseJwtPayload, zMrtdPopVerifyResponse, zMrtdValidationJwtHeader, zMrtdValidationJwtPayload, zOauthClientAttestationHeader, zOauthClientAttestationPopHeader, zPushedAuthorizationRequestSigned, zPushedAuthorizationRequestUnsigned, zPushedAuthorizationResponse, zRefreshTokenGrantIdentifier, zSignedAuthorizationRequestJwtHeaderTyp, zTrustChain, zWalletAttestationJwtHeaderV1_0, zWalletAttestationJwtHeaderV1_3, zWalletAttestationJwtHeaderV1_4, zWalletAttestationJwtPayloadV1_0, zWalletAttestationJwtPayloadV1_3, zWalletAttestationJwtPayloadV1_4, zWalletAttestationJwtV1_0, zWalletAttestationJwtV1_3, zWalletAttestationJwtV1_4 };