@pagopa/io-wallet-oid4vci 1.3.0 → 1.4.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/README.md CHANGED
@@ -36,6 +36,7 @@ import { WalletProvider, WalletAttestationOptions } from '@pagopa/io-wallet-oid4
36
36
 
37
37
  // Create wallet attestation
38
38
  const attestationOptions: WalletAttestationOptions = {
39
+ callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
39
40
  issuer: "https://wallet-provider.example.com",
40
41
  dpopJwkPublic: {
41
42
  // JWK public key for DPoP binding
@@ -306,7 +307,7 @@ export class Oid4vciError extends Error {
306
307
  ```
307
308
  Generic error thrown on Oid4vci operations
308
309
 
309
- Error thrown in case the DPoP key passed to the `WalletProvider.createItWalletAttestationJwt` method doesn't contain a kid
310
+ Error thrown when wallet-provider options are invalid or when wallet attestation and key attestation JWT creation fails.
310
311
  ```typescript
311
312
  export class WalletProviderError extends Oid4vciError {
312
313
  constructor(message: string, cause?: unknown) {
package/dist/index.d.mts CHANGED
@@ -1251,9 +1251,8 @@ declare class Oid4vciError extends Error {
1251
1251
  } & ErrorOptions);
1252
1252
  }
1253
1253
  /**
1254
- * Error thrown in case the DPoP key passed to the
1255
- * {@link WalletProvider.createItWalletAttestationJwt} method
1256
- * doesn't contain a kid
1254
+ * Error thrown when wallet-provider options are invalid or when wallet
1255
+ * attestation and key attestation creation fails.
1257
1256
  */
1258
1257
  declare class WalletProviderError extends Oid4vciError {
1259
1258
  constructor(message: string, options?: ErrorOptions);
@@ -10015,18 +10014,22 @@ declare class WalletProvider {
10015
10014
  * - v1.0: Uses only `trust_chain` in header (federation method); no `status` claim
10016
10015
  * - v1.3: Requires `x5c` in header, optional `trust_chain`; supports optional `nbf` and `status` claims
10017
10016
  * - v1.4: Requires `x5c` in header, optional `trust_chain`; `status`, `wallet_link`, and `wallet_name`
10018
- * are all **required**; optional `eudi_wallet_info` claim; sets `sub` to `dpopJwkPublic.kid`
10017
+ * are all **required**; optional `eudi_wallet_info` claim; sets `sub` to the DPoP JWK thumbprint
10019
10018
  *
10020
10019
  * @public
10021
10020
  * @async
10022
10021
  * @param {WalletAttestationOptions} options - The necessary parameters to build the attestation.
10023
10022
  * @returns {Promise<string>} A promise that resolves to the signed wallet attestation JWT as a string.
10024
- * @throws {WalletProviderError} When dpopJwkPublic.kid is missing
10025
- * @throws {ItWalletSpecsVersionError} When version is not supported
10023
+ * @throws {WalletProviderError} When the provided options do not match the configured IT-Wallet
10024
+ * specification version, or when v1.4 options are missing `walletLink`, `walletName`, or `status`.
10025
+ * @throws {ValidationError} When the generated wallet attestation JWT fails validation.
10026
+ * @throws {ClientAttestationError} When wallet attestation JWT creation fails unexpectedly,
10027
+ * including signing errors from the configured `signJwt` callback.
10028
+ * @throws {ItWalletSpecsVersionError} When the configured IT-Wallet specification version is not supported.
10026
10029
  *
10027
10030
  * @example v1.0 - Basic wallet attestation with trust chain
10028
10031
  * const jwt = await provider.createItWalletAttestationJwt({
10029
- * callbacks: { signJwt: mySignJwtCallback },
10032
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
10030
10033
  * dpopJwkPublic: myJwk,
10031
10034
  * issuer: "https://wallet-provider.example.com",
10032
10035
  * signer: {
@@ -10038,7 +10041,7 @@ declare class WalletProvider {
10038
10041
  *
10039
10042
  * @example v1.3 - Wallet attestation with x5c and optional fields
10040
10043
  * const jwt = await provider.createItWalletAttestationJwt({
10041
- * callbacks: { signJwt: mySignJwtCallback },
10044
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
10042
10045
  * dpopJwkPublic: myJwk,
10043
10046
  * issuer: "https://wallet-provider.example.com",
10044
10047
  * signer: {
@@ -10053,7 +10056,7 @@ declare class WalletProvider {
10053
10056
  *
10054
10057
  * @example v1.4 - Wallet attestation with required status and optional eudi_wallet_info
10055
10058
  * const jwt = await provider.createItWalletAttestationJwt({
10056
- * callbacks: { signJwt: mySignJwtCallback },
10059
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
10057
10060
  * dpopJwkPublic: myJwk,
10058
10061
  * issuer: "https://wallet-provider.example.com",
10059
10062
  * signer: {
package/dist/index.d.ts CHANGED
@@ -1251,9 +1251,8 @@ declare class Oid4vciError extends Error {
1251
1251
  } & ErrorOptions);
1252
1252
  }
1253
1253
  /**
1254
- * Error thrown in case the DPoP key passed to the
1255
- * {@link WalletProvider.createItWalletAttestationJwt} method
1256
- * doesn't contain a kid
1254
+ * Error thrown when wallet-provider options are invalid or when wallet
1255
+ * attestation and key attestation creation fails.
1257
1256
  */
1258
1257
  declare class WalletProviderError extends Oid4vciError {
1259
1258
  constructor(message: string, options?: ErrorOptions);
@@ -10015,18 +10014,22 @@ declare class WalletProvider {
10015
10014
  * - v1.0: Uses only `trust_chain` in header (federation method); no `status` claim
10016
10015
  * - v1.3: Requires `x5c` in header, optional `trust_chain`; supports optional `nbf` and `status` claims
10017
10016
  * - v1.4: Requires `x5c` in header, optional `trust_chain`; `status`, `wallet_link`, and `wallet_name`
10018
- * are all **required**; optional `eudi_wallet_info` claim; sets `sub` to `dpopJwkPublic.kid`
10017
+ * are all **required**; optional `eudi_wallet_info` claim; sets `sub` to the DPoP JWK thumbprint
10019
10018
  *
10020
10019
  * @public
10021
10020
  * @async
10022
10021
  * @param {WalletAttestationOptions} options - The necessary parameters to build the attestation.
10023
10022
  * @returns {Promise<string>} A promise that resolves to the signed wallet attestation JWT as a string.
10024
- * @throws {WalletProviderError} When dpopJwkPublic.kid is missing
10025
- * @throws {ItWalletSpecsVersionError} When version is not supported
10023
+ * @throws {WalletProviderError} When the provided options do not match the configured IT-Wallet
10024
+ * specification version, or when v1.4 options are missing `walletLink`, `walletName`, or `status`.
10025
+ * @throws {ValidationError} When the generated wallet attestation JWT fails validation.
10026
+ * @throws {ClientAttestationError} When wallet attestation JWT creation fails unexpectedly,
10027
+ * including signing errors from the configured `signJwt` callback.
10028
+ * @throws {ItWalletSpecsVersionError} When the configured IT-Wallet specification version is not supported.
10026
10029
  *
10027
10030
  * @example v1.0 - Basic wallet attestation with trust chain
10028
10031
  * const jwt = await provider.createItWalletAttestationJwt({
10029
- * callbacks: { signJwt: mySignJwtCallback },
10032
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
10030
10033
  * dpopJwkPublic: myJwk,
10031
10034
  * issuer: "https://wallet-provider.example.com",
10032
10035
  * signer: {
@@ -10038,7 +10041,7 @@ declare class WalletProvider {
10038
10041
  *
10039
10042
  * @example v1.3 - Wallet attestation with x5c and optional fields
10040
10043
  * const jwt = await provider.createItWalletAttestationJwt({
10041
- * callbacks: { signJwt: mySignJwtCallback },
10044
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
10042
10045
  * dpopJwkPublic: myJwk,
10043
10046
  * issuer: "https://wallet-provider.example.com",
10044
10047
  * signer: {
@@ -10053,7 +10056,7 @@ declare class WalletProvider {
10053
10056
  *
10054
10057
  * @example v1.4 - Wallet attestation with required status and optional eudi_wallet_info
10055
10058
  * const jwt = await provider.createItWalletAttestationJwt({
10056
- * callbacks: { signJwt: mySignJwtCallback },
10059
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
10057
10060
  * dpopJwkPublic: myJwk,
10058
10061
  * issuer: "https://wallet-provider.example.com",
10059
10062
  * signer: {
package/dist/index.js CHANGED
@@ -1593,18 +1593,22 @@ var WalletProvider = class {
1593
1593
  * - v1.0: Uses only `trust_chain` in header (federation method); no `status` claim
1594
1594
  * - v1.3: Requires `x5c` in header, optional `trust_chain`; supports optional `nbf` and `status` claims
1595
1595
  * - v1.4: Requires `x5c` in header, optional `trust_chain`; `status`, `wallet_link`, and `wallet_name`
1596
- * are all **required**; optional `eudi_wallet_info` claim; sets `sub` to `dpopJwkPublic.kid`
1596
+ * are all **required**; optional `eudi_wallet_info` claim; sets `sub` to the DPoP JWK thumbprint
1597
1597
  *
1598
1598
  * @public
1599
1599
  * @async
1600
1600
  * @param {WalletAttestationOptions} options - The necessary parameters to build the attestation.
1601
1601
  * @returns {Promise<string>} A promise that resolves to the signed wallet attestation JWT as a string.
1602
- * @throws {WalletProviderError} When dpopJwkPublic.kid is missing
1603
- * @throws {ItWalletSpecsVersionError} When version is not supported
1602
+ * @throws {WalletProviderError} When the provided options do not match the configured IT-Wallet
1603
+ * specification version, or when v1.4 options are missing `walletLink`, `walletName`, or `status`.
1604
+ * @throws {ValidationError} When the generated wallet attestation JWT fails validation.
1605
+ * @throws {ClientAttestationError} When wallet attestation JWT creation fails unexpectedly,
1606
+ * including signing errors from the configured `signJwt` callback.
1607
+ * @throws {ItWalletSpecsVersionError} When the configured IT-Wallet specification version is not supported.
1604
1608
  *
1605
1609
  * @example v1.0 - Basic wallet attestation with trust chain
1606
1610
  * const jwt = await provider.createItWalletAttestationJwt({
1607
- * callbacks: { signJwt: mySignJwtCallback },
1611
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
1608
1612
  * dpopJwkPublic: myJwk,
1609
1613
  * issuer: "https://wallet-provider.example.com",
1610
1614
  * signer: {
@@ -1616,7 +1620,7 @@ var WalletProvider = class {
1616
1620
  *
1617
1621
  * @example v1.3 - Wallet attestation with x5c and optional fields
1618
1622
  * const jwt = await provider.createItWalletAttestationJwt({
1619
- * callbacks: { signJwt: mySignJwtCallback },
1623
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
1620
1624
  * dpopJwkPublic: myJwk,
1621
1625
  * issuer: "https://wallet-provider.example.com",
1622
1626
  * signer: {
@@ -1631,7 +1635,7 @@ var WalletProvider = class {
1631
1635
  *
1632
1636
  * @example v1.4 - Wallet attestation with required status and optional eudi_wallet_info
1633
1637
  * const jwt = await provider.createItWalletAttestationJwt({
1634
- * callbacks: { signJwt: mySignJwtCallback },
1638
+ * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
1635
1639
  * dpopJwkPublic: myJwk,
1636
1640
  * issuer: "https://wallet-provider.example.com",
1637
1641
  * signer: {
@@ -1655,9 +1659,6 @@ var WalletProvider = class {
1655
1659
  * });
1656
1660
  */
1657
1661
  async createItWalletAttestationJwt(options) {
1658
- if (!options.dpopJwkPublic.kid) {
1659
- throw new WalletProviderError("The DPoP JWK must have a 'kid' property");
1660
- }
1661
1662
  if (this.specVersion === import_io_wallet_utils15.ItWalletSpecsVersion.V1_0) {
1662
1663
  assertV1_0Options(options);
1663
1664
  return (0, import_io_wallet_oauth29.createWalletAttestationJwtV1_0)({