@openeudi/openid4vp 0.10.1 → 0.11.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.cts CHANGED
@@ -18,6 +18,15 @@ interface AuthorizationRequest {
18
18
  interface SignedAuthorizationRequestInput {
19
19
  clientIdPrefix?: 'x509_san_dns' | 'x509_hash';
20
20
  hostname?: string;
21
+ /**
22
+ * Permit a self-signed leaf certificate for the verifier's own identity.
23
+ *
24
+ * Defaults to `false`. HAIP 1.0 Final requires the verifier certificate to
25
+ * chain to a trust anchor the wallet recognises; a self-signed leaf asserts
26
+ * an identity nothing vouches for, so wallets enforcing the profile will
27
+ * reject the request object. Set this only for local development or tests.
28
+ */
29
+ allowSelfSignedCertificate?: boolean;
21
30
  requestUri: string;
22
31
  responseUri: string;
23
32
  nonce: string;
@@ -615,7 +624,7 @@ declare class LotlFetchError extends OpenID4VPError {
615
624
  declare class LotlSignatureError extends OpenID4VPError {
616
625
  readonly code: "lotl_signature_invalid";
617
626
  }
618
- type SignedRequestBuildErrorCode = 'empty_cert_chain' | 'hostname_cert_mismatch' | 'signing_key_cert_mismatch' | 'missing_encryption_jwk' | 'missing_encryption_alg' | 'missing_vp_formats' | 'unsupported_signing_alg' | 'empty_supported_enc_values' | 'missing_hostname';
627
+ type SignedRequestBuildErrorCode = 'empty_cert_chain' | 'hostname_cert_mismatch' | 'signing_key_cert_mismatch' | 'missing_encryption_jwk' | 'missing_encryption_alg' | 'missing_vp_formats' | 'unsupported_signing_alg' | 'empty_supported_enc_values' | 'missing_hostname' | 'self_signed_leaf';
619
628
  declare class SignedRequestBuildError extends OpenID4VPError {
620
629
  readonly code: SignedRequestBuildErrorCode;
621
630
  constructor(code: SignedRequestBuildErrorCode, message: string);
@@ -684,6 +693,6 @@ declare class LotlTrustStore implements TrustStore {
684
693
  private refresh;
685
694
  }
686
695
 
687
- declare const VERSION = "0.10.1";
696
+ declare const VERSION = "0.11.0";
688
697
 
689
698
  export { type AuthorizationRequest, type AuthorizationRequestInput, type AuthorizationResponse, type Cache, CertificateChainError, type ChainErrorReason, CompositeTrustStore, type CredentialClaims, type CredentialFormat, DecryptionFailedError, type EncryptedResponse, ExpiredCredentialError, type Fetcher, HAIP_DOCTYPE_NAMESPACES, type HaipQueryInput, type HaipValidationCode, HaipValidationError, type ICredentialParser, InMemoryCache, InvalidSignatureError, type IssuerInfo, type LotlAnchorMetadata, LotlFetchError, LotlSignatureError, LotlTrustStore, type LotlTrustStoreOptions, MalformedCredentialError, MdocParser, MissingDecryptionKeyError, MissingVerifierEncryptionKeyError, MultipleCredentialsNotSupportedError, NonceValidationError, OpenID4VPError, type ParseOptions, type PresentationResult, RevocationCheckFailedError, RevokedCertificateError, SdJwtParser, type SignedAuthorizationRequest, type SignedAuthorizationRequestInput, SignedRequestBuildError, type SignedRequestBuildErrorCode, StaticTrustStore, type TrustAnchor, TrustAnchorNotFoundError, type TrustStore, type TrustStoreHint, type TrustStoreInput, UnsupportedFormatError, UnsupportedJweError, VERSION, type VerifyAuthorizationResponseOptions, type VerifyOptions, type VerifyResult, buildHaipQuery, buildOid4vpSessionTranscript, buildOpenID4VPHandoverSessionTranscript, createAuthorizationRequest, createSignedAuthorizationRequest, decryptAuthorizationResponse, isHaipQuery, parsePresentation, validateHaipQuery, verifyAuthorizationResponse, verifyPresentation };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,15 @@ interface AuthorizationRequest {
18
18
  interface SignedAuthorizationRequestInput {
19
19
  clientIdPrefix?: 'x509_san_dns' | 'x509_hash';
20
20
  hostname?: string;
21
+ /**
22
+ * Permit a self-signed leaf certificate for the verifier's own identity.
23
+ *
24
+ * Defaults to `false`. HAIP 1.0 Final requires the verifier certificate to
25
+ * chain to a trust anchor the wallet recognises; a self-signed leaf asserts
26
+ * an identity nothing vouches for, so wallets enforcing the profile will
27
+ * reject the request object. Set this only for local development or tests.
28
+ */
29
+ allowSelfSignedCertificate?: boolean;
21
30
  requestUri: string;
22
31
  responseUri: string;
23
32
  nonce: string;
@@ -615,7 +624,7 @@ declare class LotlFetchError extends OpenID4VPError {
615
624
  declare class LotlSignatureError extends OpenID4VPError {
616
625
  readonly code: "lotl_signature_invalid";
617
626
  }
618
- type SignedRequestBuildErrorCode = 'empty_cert_chain' | 'hostname_cert_mismatch' | 'signing_key_cert_mismatch' | 'missing_encryption_jwk' | 'missing_encryption_alg' | 'missing_vp_formats' | 'unsupported_signing_alg' | 'empty_supported_enc_values' | 'missing_hostname';
627
+ type SignedRequestBuildErrorCode = 'empty_cert_chain' | 'hostname_cert_mismatch' | 'signing_key_cert_mismatch' | 'missing_encryption_jwk' | 'missing_encryption_alg' | 'missing_vp_formats' | 'unsupported_signing_alg' | 'empty_supported_enc_values' | 'missing_hostname' | 'self_signed_leaf';
619
628
  declare class SignedRequestBuildError extends OpenID4VPError {
620
629
  readonly code: SignedRequestBuildErrorCode;
621
630
  constructor(code: SignedRequestBuildErrorCode, message: string);
@@ -684,6 +693,6 @@ declare class LotlTrustStore implements TrustStore {
684
693
  private refresh;
685
694
  }
686
695
 
687
- declare const VERSION = "0.10.1";
696
+ declare const VERSION = "0.11.0";
688
697
 
689
698
  export { type AuthorizationRequest, type AuthorizationRequestInput, type AuthorizationResponse, type Cache, CertificateChainError, type ChainErrorReason, CompositeTrustStore, type CredentialClaims, type CredentialFormat, DecryptionFailedError, type EncryptedResponse, ExpiredCredentialError, type Fetcher, HAIP_DOCTYPE_NAMESPACES, type HaipQueryInput, type HaipValidationCode, HaipValidationError, type ICredentialParser, InMemoryCache, InvalidSignatureError, type IssuerInfo, type LotlAnchorMetadata, LotlFetchError, LotlSignatureError, LotlTrustStore, type LotlTrustStoreOptions, MalformedCredentialError, MdocParser, MissingDecryptionKeyError, MissingVerifierEncryptionKeyError, MultipleCredentialsNotSupportedError, NonceValidationError, OpenID4VPError, type ParseOptions, type PresentationResult, RevocationCheckFailedError, RevokedCertificateError, SdJwtParser, type SignedAuthorizationRequest, type SignedAuthorizationRequestInput, SignedRequestBuildError, type SignedRequestBuildErrorCode, StaticTrustStore, type TrustAnchor, TrustAnchorNotFoundError, type TrustStore, type TrustStoreHint, type TrustStoreInput, UnsupportedFormatError, UnsupportedJweError, VERSION, type VerifyAuthorizationResponseOptions, type VerifyOptions, type VerifyResult, buildHaipQuery, buildOid4vpSessionTranscript, buildOpenID4VPHandoverSessionTranscript, createAuthorizationRequest, createSignedAuthorizationRequest, decryptAuthorizationResponse, isHaipQuery, parsePresentation, validateHaipQuery, verifyAuthorizationResponse, verifyPresentation };
package/dist/index.js CHANGED
@@ -8274,6 +8274,12 @@ async function createSignedAuthorizationRequest(input, query) {
8274
8274
  "signer.publicKey SPKI does not match leaf certificate SPKI"
8275
8275
  );
8276
8276
  }
8277
+ if (input.allowSelfSignedCertificate !== true && await leafCert.isSelfSigned()) {
8278
+ throw new SignedRequestBuildError(
8279
+ "self_signed_leaf",
8280
+ "leaf certificate is self-signed; HAIP 1.0 Final requires a certificate chaining to a trust anchor. Pass allowSelfSignedCertificate: true to override for local development or tests."
8281
+ );
8282
+ }
8277
8283
  const responseMode = input.responseMode ?? "direct_post.jwt";
8278
8284
  if (responseMode === "direct_post.jwt") {
8279
8285
  if (!input.encryptionKey?.publicJwk) {
@@ -10435,7 +10441,7 @@ function equalBytes(a, b) {
10435
10441
 
10436
10442
  // src/index.ts
10437
10443
  init_errors();
10438
- var VERSION = "0.10.1";
10444
+ var VERSION = "0.11.0";
10439
10445
  /*! Bundled license information:
10440
10446
 
10441
10447
  pvtsutils/build/index.es.js: