@pagopa/io-react-native-wallet 1.4.0 → 1.6.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.
Files changed (85) hide show
  1. package/lib/commonjs/credential/issuance/06-obtain-credential.js +1 -5
  2. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +33 -21
  4. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  5. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +318 -24
  6. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  7. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +47 -83
  8. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  9. package/lib/commonjs/credential/presentation/errors.js +18 -1
  10. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  11. package/lib/commonjs/credential/presentation/index.js +8 -2
  12. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  13. package/lib/commonjs/credential/presentation/types.js +6 -2
  14. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  15. package/lib/commonjs/entity/trust/chain.js.map +1 -1
  16. package/lib/commonjs/mdoc/index.js +45 -13
  17. package/lib/commonjs/mdoc/index.js.map +1 -1
  18. package/lib/commonjs/sd-jwt/index.js +41 -1
  19. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  20. package/lib/commonjs/utils/crypto.js +70 -4
  21. package/lib/commonjs/utils/crypto.js.map +1 -1
  22. package/lib/commonjs/utils/string.js +6 -7
  23. package/lib/commonjs/utils/string.js.map +1 -1
  24. package/lib/module/credential/issuance/06-obtain-credential.js +1 -5
  25. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  26. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +33 -21
  27. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  28. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +311 -23
  29. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  30. package/lib/module/credential/presentation/08-send-authorization-response.js +46 -81
  31. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  32. package/lib/module/credential/presentation/errors.js +16 -0
  33. package/lib/module/credential/presentation/errors.js.map +1 -1
  34. package/lib/module/credential/presentation/index.js +2 -2
  35. package/lib/module/credential/presentation/index.js.map +1 -1
  36. package/lib/module/credential/presentation/types.js +6 -2
  37. package/lib/module/credential/presentation/types.js.map +1 -1
  38. package/lib/module/entity/trust/chain.js.map +1 -1
  39. package/lib/module/mdoc/index.js +43 -12
  40. package/lib/module/mdoc/index.js.map +1 -1
  41. package/lib/module/sd-jwt/index.js +40 -1
  42. package/lib/module/sd-jwt/index.js.map +1 -1
  43. package/lib/module/utils/crypto.js +67 -2
  44. package/lib/module/utils/crypto.js.map +1 -1
  45. package/lib/module/utils/string.js +4 -6
  46. package/lib/module/utils/string.js.map +1 -1
  47. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  48. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +1 -1
  49. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  50. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +106 -9
  51. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  52. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +4 -33
  53. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  54. package/lib/typescript/credential/presentation/errors.d.ts +11 -0
  55. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  56. package/lib/typescript/credential/presentation/index.d.ts +3 -3
  57. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  58. package/lib/typescript/credential/presentation/types.d.ts +18 -6
  59. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  60. package/lib/typescript/entity/trust/chain.d.ts.map +1 -1
  61. package/lib/typescript/mdoc/index.d.ts +6 -2
  62. package/lib/typescript/mdoc/index.d.ts.map +1 -1
  63. package/lib/typescript/sd-jwt/index.d.ts +19 -0
  64. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  65. package/lib/typescript/utils/crypto.d.ts +8 -0
  66. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  67. package/lib/typescript/utils/errors.d.ts.map +1 -1
  68. package/lib/typescript/utils/misc.d.ts.map +1 -1
  69. package/lib/typescript/utils/string.d.ts +3 -3
  70. package/lib/typescript/utils/string.d.ts.map +1 -1
  71. package/package.json +16 -14
  72. package/src/credential/issuance/06-obtain-credential.ts +1 -7
  73. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -16
  74. package/src/credential/presentation/07-evaluate-input-descriptor.ts +459 -49
  75. package/src/credential/presentation/08-send-authorization-response.ts +57 -101
  76. package/src/credential/presentation/errors.ts +16 -0
  77. package/src/credential/presentation/index.ts +8 -4
  78. package/src/credential/presentation/types.ts +16 -3
  79. package/src/entity/trust/chain.ts +14 -10
  80. package/src/mdoc/index.ts +72 -15
  81. package/src/sd-jwt/index.ts +49 -1
  82. package/src/utils/crypto.ts +61 -2
  83. package/src/utils/errors.ts +2 -2
  84. package/src/utils/misc.ts +2 -2
  85. package/src/utils/string.ts +4 -6
@@ -1,11 +1,56 @@
1
- import { InputDescriptor } from "./types";
1
+ import { InputDescriptor, type RemotePresentation } from "./types";
2
2
  import { SdJwt4VC, type DisclosureWithEncoded } from "../../sd-jwt/types";
3
- export type EvaluatedDisclosures = {
4
- requiredDisclosures: DisclosureWithEncoded[];
5
- optionalDisclosures: DisclosureWithEncoded[];
6
- unrequestedDisclosures: DisclosureWithEncoded[];
3
+ import { CBOR } from "@pagopa/io-react-native-cbor";
4
+ type EvaluatedDisclosures = {
5
+ requiredDisclosures: EvaluatedDisclosure[];
6
+ optionalDisclosures: EvaluatedDisclosure[];
7
7
  };
8
- export type EvaluateInputDescriptorSdJwt4VC = (inputDescriptor: InputDescriptor, payloadCredential: SdJwt4VC["payload"], disclosures: DisclosureWithEncoded[]) => EvaluatedDisclosures;
8
+ export type EvaluatedDisclosure = {
9
+ namespace?: string;
10
+ name: string;
11
+ value: unknown;
12
+ };
13
+ type EvaluateInputDescriptorSdJwt4VC = (inputDescriptor: InputDescriptor, payloadCredential: SdJwt4VC["payload"], disclosures: DisclosureWithEncoded[]) => EvaluatedDisclosures;
14
+ type EvaluateInputDescriptorMdoc = (inputDescriptor: InputDescriptor, issuerSigned: CBOR.IssuerSigned) => EvaluatedDisclosures;
15
+ export type EvaluateInputDescriptors = (descriptors: InputDescriptor[], credentialsSdJwt: [string, string][], credentialsMdoc: [string, string][]) => Promise<{
16
+ evaluatedDisclosure: EvaluatedDisclosures;
17
+ inputDescriptor: InputDescriptor;
18
+ credential: string;
19
+ keyTag: string;
20
+ }[]>;
21
+ export type PrepareRemotePresentations = (credentialAndDescriptors: {
22
+ requestedClaims: string[];
23
+ inputDescriptor: InputDescriptor;
24
+ credential: string;
25
+ keyTag: string;
26
+ }[], authRequestObject: {
27
+ nonce: string;
28
+ clientId: string;
29
+ responseUri: string;
30
+ }) => Promise<RemotePresentation>;
31
+ export declare const disclosureWithEncodedToEvaluatedDisclosure: (disclosure: DisclosureWithEncoded) => EvaluatedDisclosure;
32
+ type DecodedCredentialMdoc = {
33
+ keyTag: string;
34
+ credential: string;
35
+ issuerSigned: CBOR.IssuerSigned;
36
+ };
37
+ type DecodedCredentialSdJwt = {
38
+ keyTag: string;
39
+ credential: string;
40
+ sdJwt: SdJwt4VC;
41
+ disclosures: DisclosureWithEncoded[];
42
+ };
43
+ /**
44
+ * Evaluates the input descriptor for an mDoc by verifying that the issuerSigned claims meet
45
+ * the constraints defined in the input descriptor. It categorizes disclosures as either required
46
+ * or optional based on the field definitions.
47
+ *
48
+ * @param inputDescriptor - Contains constraints and field definitions specifying required/optional claims.
49
+ * @param issuerSigned - Contains the issuerSigned with namespaces and their associated claims.
50
+ * @returns An object with two arrays: one for required disclosures and one for optional disclosures.
51
+ * @throws MissingDataError - If a required field is missing or if a claim fails JSON Schema validation.
52
+ */
53
+ export declare const evaluateInputDescriptorForMdoc: EvaluateInputDescriptorMdoc;
9
54
  /**
10
55
  * Evaluates an InputDescriptor for an SD-JWT-based verifiable credential.
11
56
  *
@@ -14,15 +59,67 @@ export type EvaluateInputDescriptorSdJwt4VC = (inputDescriptor: InputDescriptor,
14
59
  * - Validates whether required fields are present (unless marked optional)
15
60
  * and match any specified JSONPath.
16
61
  * - If a field includes a JSON Schema filter, validates the claim value against that schema.
17
- * - Enforces `limit_disclosure` rules by returning only disclosures, required and optional, matching the specified fields
18
- * if set to "required". Otherwise also return the array unrequestedDisclosures with disclosures which can be passed for a particular use case.
19
62
  * - Throws an error if a required field is invalid or missing.
20
63
  *
21
64
  * @param inputDescriptor - Describes constraints (fields, filters, etc.) that must be satisfied.
22
65
  * @param payloadCredential - The credential payload to check against.
23
66
  * @param disclosures - An array of DisclosureWithEncoded objects representing selective disclosures.
24
- * @returns A filtered list of disclosures satisfying the descriptor constraints, or throws an error if not.
67
+ * @returns An object with two arrays: one for required disclosures and one for optional disclosures.
25
68
  * @throws Will throw an error if any required constraint fails or if JSONPath lookups are invalid.
26
69
  */
27
70
  export declare const evaluateInputDescriptorForSdJwt4VC: EvaluateInputDescriptorSdJwt4VC;
71
+ /**
72
+ * Finds the first credential that satisfies the input descriptor constraints.
73
+ * @param inputDescriptor The input descriptor to evaluate.
74
+ * @param decodedSdJwtCredentials An array of decoded SD-JWT credentials.
75
+ * @returns An object containing the matched evaluation, keyTag, and credential.
76
+ */
77
+ export declare const findCredentialSdJwt: (inputDescriptor: InputDescriptor, decodedSdJwtCredentials: DecodedCredentialSdJwt[]) => {
78
+ matchedEvaluation: EvaluatedDisclosures;
79
+ matchedKeyTag: string;
80
+ matchedCredential: string;
81
+ };
82
+ /**
83
+ * Finds the first credential that satisfies the input descriptor constraints.
84
+ * @param inputDescriptor The input descriptor to evaluate.
85
+ * @param decodedMdocCredentials An array of decoded MDOC credentials.
86
+ * @returns An object containing the matched evaluation, keyTag, and credential.
87
+ */
88
+ export declare const findCredentialMDoc: (inputDescriptor: InputDescriptor, decodedMDocCredentials: DecodedCredentialMdoc[]) => {
89
+ matchedEvaluation: EvaluatedDisclosures;
90
+ matchedKeyTag: string;
91
+ matchedCredential: string;
92
+ };
93
+ /**
94
+ * Evaluates multiple input descriptors against provided SD-JWT and MDOC credentials.
95
+ *
96
+ * For each input descriptor, this function:
97
+ * - Checks the credential format.
98
+ * - Decodes the credential.
99
+ * - Evaluates the descriptor using the associated disclosures.
100
+ *
101
+ * @param inputDescriptors - An array of input descriptors.
102
+ * @param credentialsSdJwt - An array of tuples containing keyTag and SD-JWT credential.
103
+ * @param credentialsMdoc - An array of tuples containing keyTag and MDOC credential.
104
+ * @returns An array of objects, each containing the evaluated disclosures,
105
+ * the input descriptor, the credential, and the keyTag.
106
+ * @throws {CredentialNotFoundError} When the credential format is unsupported.
107
+ */
108
+ export declare const evaluateInputDescriptors: EvaluateInputDescriptors;
109
+ /**
110
+ * Prepares remote presentations for a set of credentials based on input descriptors.
111
+ *
112
+ * For each credential and its corresponding input descriptor, this function:
113
+ * - Validates the credential format.
114
+ * - Generates a verifiable presentation token (vpToken) using the provided nonce and client identifier.
115
+ *
116
+ * @param credentialAndDescriptors - An array containing objects with requested claims,
117
+ * input descriptor, credential, and keyTag.
118
+ * @param nonce - A unique nonce for the verifiable presentation token.
119
+ * @param client_id - The client identifier.
120
+ * @returns A promise that resolves to an array of RemotePresentation objects.
121
+ * @throws {CredentialNotFoundError} When the credential format is unsupported.
122
+ */
123
+ export declare const prepareRemotePresentations: PrepareRemotePresentations;
124
+ export {};
28
125
  //# sourceMappingURL=07-evaluate-input-descriptor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"07-evaluate-input-descriptor.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-input-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAO1E,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,CAC5C,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,QAAQ,CAAC,SAAS,CAAC,EACtC,WAAW,EAAE,qBAAqB,EAAE,KACjC,oBAAoB,CAAC;AA4E1B;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAsG9C,CAAC"}
1
+ {"version":3,"file":"07-evaluate-input-descriptor.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-input-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAK1E,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAMpD,KAAK,oBAAoB,GAAG;IAC1B,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;IAC3C,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,+BAA+B,GAAG,CACrC,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,QAAQ,CAAC,SAAS,CAAC,EACtC,WAAW,EAAE,qBAAqB,EA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,8BAA8B,EAAE,2BAkE5C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BA6E9C,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,oBACb,eAAe,2BACP,sBAAsB,EAAE,KAChD;IACD,iBAAiB,EAAE,oBAAoB,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CA6B3B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,oBACZ,eAAe,0BACR,qBAAqB,EAAE,KAC9C;IACD,iBAAiB,EAAE,oBAAoB,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CAuB3B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,EAAE,wBAuEtC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,EAAE,0BA+DxC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { FetchJwks } from "./04-retrieve-rp-jwks";
2
2
  import type { VerifyRequestObjectSignature } from "./05-verify-request-object";
3
3
  import { type Out } from "../../utils/misc";
4
- import { DirectAuthorizationBodyPayload, ErrorResponse, PresentationDefinition, type Presentation } from "./types";
4
+ import { DirectAuthorizationBodyPayload, ErrorResponse, type RemotePresentation } from "./types";
5
5
  import * as z from "zod";
6
6
  import type { JWK } from "../../utils/jwk";
7
7
  export type AuthorizationResponse = z.infer<typeof AuthorizationResponse>;
@@ -27,35 +27,6 @@ export declare const AuthorizationResponse: z.ZodObject<{
27
27
  * @throws {NoSuitableKeysFoundInEntityConfiguration} If no suitable encryption key is found.
28
28
  */
29
29
  export declare const choosePublicKeyToEncrypt: (rpJwkKeys: Out<FetchJwks>["keys"]) => JWK;
30
- /**
31
- * Prepares a Verified Presentation (VP) token to be sent as part of an
32
- * authorization response in an OpenID 4 Verifiable Presentations flow.
33
- *
34
- * @param requestObject - The request object containing the nonce, response URI, and other necessary info.
35
- * @param presentationTuple - A tuple containing a verifiable credential, the claims to disclose,
36
- * and a cryptographic context for signing.
37
- * @returns An object containing the signed VP token (`vp_token`) and a `presentation_submission` object.
38
- * @param presentationDefinition - Definition outlining presentation requirements.
39
- * @param presentationTuple - Tuple containing:
40
- * - A verifiable credential.
41
- * - Claims that should be disclosed.
42
- * - Cryptographic context for signing.
43
- * @returns An object with:
44
- * - `vp_token`: The signed VP token.
45
- * - `presentation_submission`: Object mapping disclosed credentials to the request.
46
- *
47
- * @remarks
48
- * 1. The `disclose()` function is used to produce a token with only the requested claims.
49
- * 2. A new JWT is then signed, including the VP, `jti`, `iss`, `nonce`, audience, and expiration.
50
- * 3. The `presentation_submission` object follows the OpenID 4 VP specification for describing
51
- * how the disclosed credentials map to the request.
52
- *
53
- * @todo [SIW-353] Support multiple verifiable credentials in a single request.
54
- */
55
- export declare const prepareVpToken: (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], presentationDefinition: PresentationDefinition, [verifiableCredential, requestedClaims, cryptoContext]: Presentation) => Promise<{
56
- vp_token: string;
57
- presentation_submission: Record<string, unknown>;
58
- }>;
59
30
  /**
60
31
  * Builds a URL-encoded form body for a direct POST response without encryption.
61
32
  *
@@ -70,16 +41,16 @@ export declare const buildDirectPostBody: (requestObject: Out<VerifyRequestObjec
70
41
  * @param jwkKeys - Array of JWKs from the Relying Party for encryption.
71
42
  * @param requestObject - Contains state, nonce, and other relevant info.
72
43
  * @param payload - Object that contains either the VP token to encrypt and the mapping of the credential disclosures or the error code
44
+ * @param generatedNonce - Optional nonce for the `apu` claim in the JWE header, it is used during ISO 18013-7.
73
45
  * @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body,
74
46
  * where `response` contains the encrypted JWE.
75
47
  */
76
- export declare const buildDirectPostJwtBody: (jwkKeys: Out<FetchJwks>["keys"], requestObject: Out<VerifyRequestObjectSignature>["requestObject"], payload: DirectAuthorizationBodyPayload) => Promise<string>;
48
+ export declare const buildDirectPostJwtBody: (jwkKeys: Out<FetchJwks>["keys"], requestObject: Out<VerifyRequestObjectSignature>["requestObject"], payload: DirectAuthorizationBodyPayload, generatedNonce?: string) => Promise<string>;
77
49
  /**
78
50
  * Type definition for the function that sends the authorization response
79
51
  * to the Relying Party, completing the presentation flow.
80
52
  */
81
- export type SendAuthorizationResponse = (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], presentationDefinition: PresentationDefinition, jwkKeys: Out<FetchJwks>["keys"], presentation: Presentation, // TODO: [SIW-353] support multiple presentations
82
- context?: {
53
+ export type SendAuthorizationResponse = (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], presentationDefinitionId: string, jwkKeys: Out<FetchJwks>["keys"], remotePresentation: RemotePresentation, context?: {
83
54
  appFetch?: GlobalFetch["fetch"];
84
55
  }) => Promise<AuthorizationResponse>;
85
56
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EACL,8BAA8B,EAC9B,aAAa,EACb,sBAAsB,EACtB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAUhC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,cACxB,IA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AAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAuB1C,CAAC"}
1
+ {"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,aAAa,EACb,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAUhC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,cACxB,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,KAChC,GAWF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,kBACf,IAAI,4BAA4B,CAAC,CAAC,eAAe,CAAC,WACxD,8BAA8B,KACtC,QAAQ,MAAM,CAgBhB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,YACxB,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,iBAChB,IAAI,4BAA4B,CAAC,CAAC,eAAe,CAAC,WACxD,8BAA8B,mBACtB,MAAM,KACtB,QAAQ,MAAM,CAgChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,aAAa,EAAE,GAAG,CAAC,4BAA4B,CAAC,CAAC,eAAe,CAAC,EACjE,wBAAwB,EAAE,MAAM,EAChC,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAC/B,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,EAAE,yBA6DvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAC3C,aAAa,EAAE,GAAG,CAAC,4BAA4B,CAAC,CAAC,eAAe,CAAC,EACjE,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAC/B,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAuB1C,CAAC"}
@@ -44,4 +44,15 @@ export declare class MissingDataError extends IoWalletError {
44
44
  */
45
45
  constructor(missingAttributes: string);
46
46
  }
47
+ /**
48
+ * When a credential is not found in the wallet.
49
+ *
50
+ */
51
+ export declare class CredentialNotFoundError extends IoWalletError {
52
+ code: string;
53
+ /**
54
+ * @param credentialId The ID of the credential that was not found.
55
+ */
56
+ constructor(credentialId: string);
57
+ }
47
58
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEnE;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,IAAI,SAAwD;IAE5D,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;gBAGb,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAsB,EAC7B,MAAM,GAAE,MAAsB;CAMjC;AAED;;;GAGG;AACH,qBAAa,wCAAyC,SAAQ,aAAa;IACzE,IAAI,SAAoC;IAExC;;OAEG;gBACS,QAAQ,EAAE,MAAM;CAI7B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,IAAI,SAA8B;IAElC;;OAEG;gBACS,MAAM,EAAE,MAAM;CAI3B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,IAAI,SAAsB;IAE1B;;OAEG;gBACS,iBAAiB,EAAE,MAAM;CAItC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEnE;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,IAAI,SAAwD;IAE5D,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;gBAGb,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAsB,EAC7B,MAAM,GAAE,MAAsB;CAMjC;AAED;;;GAGG;AACH,qBAAa,wCAAyC,SAAQ,aAAa;IACzE,IAAI,SAAoC;IAExC;;OAEG;gBACS,QAAQ,EAAE,MAAM;CAI7B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,IAAI,SAA8B;IAElC;;OAEG;gBACS,MAAM,EAAE,MAAM;CAI3B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,IAAI,SAAsB;IAE1B;;OAEG;gBACS,iBAAiB,EAAE,MAAM;CAItC;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,IAAI,SAA8B;IAElC;;OAEG;gBACS,YAAY,EAAE,MAAM;CAIjC"}
@@ -4,9 +4,9 @@ import { getRequestObject, type GetRequestObject } from "./03-get-request-object
4
4
  import { fetchJwksFromRequestObject, fetchJwksFromConfig, type FetchJwks } from "./04-retrieve-rp-jwks";
5
5
  import { verifyRequestObjectSignature, type VerifyRequestObjectSignature } from "./05-verify-request-object";
6
6
  import { fetchPresentDefinition, type FetchPresentationDefinition } from "./06-fetch-presentation-definition";
7
- import { evaluateInputDescriptorForSdJwt4VC, type EvaluateInputDescriptorSdJwt4VC } from "./07-evaluate-input-descriptor";
7
+ import { evaluateInputDescriptors, prepareRemotePresentations, type EvaluateInputDescriptors, type PrepareRemotePresentations } from "./07-evaluate-input-descriptor";
8
8
  import { sendAuthorizationResponse, type SendAuthorizationResponse, sendAuthorizationErrorResponse, type SendAuthorizationErrorResponse } from "./08-send-authorization-response";
9
9
  import * as Errors from "./errors";
10
- export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, fetchJwksFromRequestObject, fetchJwksFromConfig, verifyRequestObjectSignature, fetchPresentDefinition, evaluateInputDescriptorForSdJwt4VC, sendAuthorizationResponse, sendAuthorizationErrorResponse, Errors, };
11
- export type { StartFlow, EvaluateRelyingPartyTrust, GetRequestObject, FetchJwks, VerifyRequestObjectSignature, FetchPresentationDefinition, EvaluateInputDescriptorSdJwt4VC, SendAuthorizationResponse, SendAuthorizationErrorResponse, };
10
+ export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, fetchJwksFromRequestObject, fetchJwksFromConfig, verifyRequestObjectSignature, fetchPresentDefinition, evaluateInputDescriptors, sendAuthorizationResponse, sendAuthorizationErrorResponse, prepareRemotePresentations, Errors, };
11
+ export type { StartFlow, EvaluateRelyingPartyTrust, GetRequestObject, FetchJwks, VerifyRequestObjectSignature, FetchPresentationDefinition, EvaluateInputDescriptors, PrepareRemotePresentations, SendAuthorizationResponse, SendAuthorizationErrorResponse, };
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,EACjC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,kCAAkC,EAClC,KAAK,+BAA+B,EACrC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,8BAA8B,EAC9B,KAAK,8BAA8B,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,kCAAkC,EAClC,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,GACP,CAAC;AACF,YAAY,EACV,SAAS,EACT,yBAAyB,EACzB,gBAAgB,EAChB,SAAS,EACT,4BAA4B,EAC5B,2BAA2B,EAC3B,+BAA+B,EAC/B,yBAAyB,EACzB,8BAA8B,GAC/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,EACjC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,8BAA8B,EAC9B,KAAK,8BAA8B,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,0BAA0B,EAC1B,MAAM,GACP,CAAC;AACF,YAAY,EACV,SAAS,EACT,yBAAyB,EACzB,gBAAgB,EAChB,SAAS,EACT,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,8BAA8B,GAC/B,CAAC"}
@@ -8,6 +8,18 @@ export type Presentation = [
8
8
  string[],
9
9
  CryptoContext
10
10
  ];
11
+ /**
12
+ * A object that associate the information needed to multiple remote presentation
13
+ */
14
+ export type RemotePresentation = {
15
+ presentations: {
16
+ requestedClaims: string[];
17
+ inputDescriptor: InputDescriptor;
18
+ format: string;
19
+ vpToken: string;
20
+ }[];
21
+ generatedNonce?: string;
22
+ };
11
23
  export type InputDescriptor = z.infer<typeof InputDescriptor>;
12
24
  export declare const InputDescriptor: z.ZodObject<{
13
25
  id: z.ZodString;
@@ -325,7 +337,7 @@ export declare const RequestObject: z.ZodObject<{
325
337
  iss: z.ZodOptional<z.ZodString>;
326
338
  iat: z.ZodOptional<z.ZodNumber>;
327
339
  exp: z.ZodOptional<z.ZodNumber>;
328
- state: z.ZodString;
340
+ state: z.ZodOptional<z.ZodString>;
329
341
  nonce: z.ZodString;
330
342
  response_uri: z.ZodString;
331
343
  response_type: z.ZodLiteral<"vp_token">;
@@ -738,7 +750,6 @@ export declare const RequestObject: z.ZodObject<{
738
750
  }[] | undefined;
739
751
  }>>;
740
752
  }, "strip", z.ZodTypeAny, {
741
- state: string;
742
753
  nonce: string;
743
754
  response_type: "vp_token";
744
755
  response_mode: "direct_post.jwt" | "direct_post";
@@ -747,6 +758,7 @@ export declare const RequestObject: z.ZodObject<{
747
758
  iss?: string | undefined;
748
759
  iat?: number | undefined;
749
760
  exp?: number | undefined;
761
+ state?: string | undefined;
750
762
  client_id_scheme?: string | undefined;
751
763
  client_metadata?: {
752
764
  authorization_encrypted_response_alg?: string | undefined;
@@ -818,7 +830,6 @@ export declare const RequestObject: z.ZodObject<{
818
830
  }[] | undefined;
819
831
  } | undefined;
820
832
  }, {
821
- state: string;
822
833
  nonce: string;
823
834
  response_type: "vp_token";
824
835
  response_mode: "direct_post.jwt" | "direct_post";
@@ -827,6 +838,7 @@ export declare const RequestObject: z.ZodObject<{
827
838
  iss?: string | undefined;
828
839
  iat?: number | undefined;
829
840
  exp?: number | undefined;
841
+ state?: string | undefined;
830
842
  client_id_scheme?: string | undefined;
831
843
  client_metadata?: {
832
844
  authorization_encrypted_response_alg?: string | undefined;
@@ -909,14 +921,14 @@ export declare const ErrorResponse: z.ZodEnum<["invalid_scope", "invalid_request
909
921
  */
910
922
  export type DirectAuthorizationBodyPayload = z.infer<typeof DirectAuthorizationBodyPayload>;
911
923
  export declare const DirectAuthorizationBodyPayload: z.ZodUnion<[z.ZodObject<{
912
- vp_token: z.ZodString;
924
+ vp_token: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
913
925
  presentation_submission: z.ZodRecord<z.ZodString, z.ZodUnknown>;
914
926
  }, "strip", z.ZodTypeAny, {
915
- vp_token: string;
916
927
  presentation_submission: Record<string, unknown>;
928
+ vp_token?: string | string[] | undefined;
917
929
  }, {
918
- vp_token: string;
919
930
  presentation_submission: Record<string, unknown>;
931
+ vp_token?: string | string[] | undefined;
920
932
  }>, z.ZodObject<{
921
933
  error: z.ZodEnum<["invalid_scope", "invalid_request", "invalid_client", "access_denied"]>;
922
934
  }, "strip", z.ZodTypeAny, {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACO,MAAM;IACzB,MAAM,EAAE;IACsC,aAAa;CACzE,CAAC;AAmBF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO1B,CAAC;AAqBH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,iBAAiB,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAiCF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,qBA6BvC"}
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAO,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAiCF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,qBAiCvC"}
@@ -1,6 +1,10 @@
1
1
  import { CBOR } from "@pagopa/io-react-native-cbor";
2
2
  import type { JWK } from "../utils/jwk";
3
- export declare const verify: (token: string, publicKey: JWK | JWK[]) => Promise<{
4
- mDoc: CBOR.MDOC;
3
+ import { type Presentation } from "../credential/presentation/types";
4
+ export declare const verify: (token: string, _: JWK | JWK[]) => Promise<{
5
+ issuerSigned: CBOR.IssuerSigned;
6
+ }>;
7
+ export declare const prepareVpTokenMdoc: (requestNonce: string, generatedNonce: string, clientId: string, responseUri: string, docType: string, keyTag: string, [verifiableCredential, requestedClaims, _]: Presentation) => Promise<{
8
+ vp_token: string;
5
9
  }>;
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mdoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,MAAM,UACV,MAAM,aACF,GAAG,GAAG,GAAG,EAAE;UACL,KAAK,IAAI;EAqB3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mdoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,eAAO,MAAM,MAAM,UACV,MAAM,KACV,GAAG,GAAG,GAAG,EAAE;kBACW,KAAK,YAAY;EA0B3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,iBACf,MAAM,kBACJ,MAAM,YACZ,MAAM,eACH,MAAM,WACV,MAAM,UACP,MAAM;cAGJ,MAAM;EAgCjB,CAAC"}
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { Disclosure, SdJwt4VC, type DisclosureWithEncoded } from "./types";
3
3
  import type { JWK } from "../utils/jwk";
4
4
  import * as Errors from "./errors";
5
+ import { type Presentation } from "../credential/presentation/types";
5
6
  /**
6
7
  * Decode a given SD-JWT with Disclosures to get the parsed SD-JWT object they define.
7
8
  * It ensures provided data is in a valid shape.
@@ -288,5 +289,23 @@ export declare const verify: <S extends z.ZodType<{
288
289
  sdJwt: z.TypeOf<S>;
289
290
  disclosures: Disclosure[];
290
291
  }>;
292
+ /**
293
+ * Prepares a Verified Presentation (VP) token to be sent as part of an
294
+ * authorization response in an OpenID 4 Verifiable Presentations flow.
295
+ *
296
+ * @param nonce - The nonce provided by the relying party.
297
+ * @param client_id - The client identifier of the relying party.
298
+ * @param presentation - An object containing the verifiable credential, the claims to disclose,
299
+ * and the cryptographic context for signing.
300
+ * @returns An object containing the signed VP token (`vp_token`).
301
+ *
302
+ * @remarks
303
+ * 1. The `disclose()` function is used to produce a token with only the requested claims.
304
+ * 2. A KB-JWT is then signed, including sd_hash and `nonce`.
305
+ * 3. The `vp_token` is composed of the disclosed VP and the KB-JWT.
306
+ */
307
+ export declare const prepareVpToken: (nonce: string, client_id: string, [verifiableCredential, requestedClaims, cryptoContext]: Presentation) => Promise<{
308
+ vp_token: string;
309
+ }>;
291
310
  export { SdJwt4VC, Errors };
292
311
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AASnC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WACV,MAAM;;iBAIA,qBAAqB,EAAE;CA0BrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,UACZ,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;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WACV,MAAM,aACF,GAAG,GAAG,GAAG,EAAE;;iBAEqB,UAAU,EAAE;EAqBxD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,UAClB,MAAM,aACF,MAAM;cAGP,MAAM;EAyBjB,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type PublicKey } from "@pagopa/io-react-native-crypto";
1
2
  import { type CryptoContext } from "@pagopa/io-react-native-jwt";
2
3
  import { RSAKey, KJUR } from "jsrsasign";
3
4
  import { JWK } from "./jwk";
@@ -40,4 +41,11 @@ export declare const parsePublicKey: (pemCert: string) => RSAKey | KJUR.crypto.E
40
41
  * @returns The signing JWK.
41
42
  */
42
43
  export declare const getSigningJwk: (publicKey: RSAKey | KJUR.crypto.ECDSA) => JWK;
44
+ /**
45
+ * This function takes two {@link PublicKey} and evaluates and compares their thumbprints
46
+ * @param key1 The first key
47
+ * @param key2 The second key
48
+ * @returns true if the keys' thumbprints are equal, false otherwise
49
+ */
50
+ export declare const compareKeysByThumbprint: (key1: PublicKey, key2: PublicKey) => Promise<boolean>;
43
51
  //# sourceMappingURL=crypto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAiB,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,W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AAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAChC,UAAU,CAAC,EAAE,CAAC,GACd,KAAK,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,SAAU,MAAM,WAGjD,CAAC;AAEb;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,eAChC,MAAM,KACjB,QAAQ,MAAM,CAMhB,CAAC;AAEF,eAAO,MAAM,aAAa,YAAa,MAAM,0CAM5C,CAAC"}
@@ -15,10 +15,10 @@
15
15
  */
16
16
  export declare const obfuscateString: (value: string, percentage?: number, obfuscatedChar?: string) => string;
17
17
  /**
18
- * Converts a hexadecimal byte string to a Base64 URL-encoded string.
18
+ * Converts a base64 string to a Base64 URL-encoded string.
19
19
  *
20
- * @param byteString - The input string in hexadecimal format.
20
+ * @param byteString - The input string in base64 format.
21
21
  * @returns The Base64 URL-encoded string.
22
22
  */
23
- export declare const byteStringToBase64Url: (byteString: string) => string;
23
+ export declare const base64ToBase64Url: (base64: string) => string;
24
24
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,eACD,MAAM,mBACF,MAAM,KACrB,MAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,eAAgB,MAAM,KAAG,MAE1D,CAAC"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,eACD,MAAM,mBACF,MAAM,KACrB,MAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,MAElD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -53,29 +53,29 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "devDependencies": {
56
- "@pagopa/eslint-config": "^3.0.0",
57
56
  "@pagopa/io-react-native-crypto": "^0.2.3",
58
- "@pagopa/io-react-native-jwt": "^2.0.0",
59
- "@pagopa/io-react-native-cbor": "^1.0.0",
60
- "@react-native/eslint-config": "^0.72.2",
57
+ "@pagopa/io-react-native-jwt": "^2.1.0",
58
+ "@pagopa/io-react-native-cbor": "^1.2.0",
59
+ "@react-native/eslint-config": "^0.75.5",
61
60
  "@rushstack/eslint-patch": "^1.3.2",
62
61
  "@types/jest": "^28.1.2",
63
- "@types/react": "^18.0.24",
62
+ "@types/react": "^18.2.6",
64
63
  "@types/react-native": "0.70.0",
64
+ "@types/url-parse": "^1.4.11",
65
65
  "del-cli": "^5.0.0",
66
66
  "eslint": "^8.4.1",
67
- "eslint-config-prettier": "^10.0.1",
67
+ "eslint-plugin-prettier": "^5.2.3",
68
68
  "jest": "^28.1.1",
69
69
  "pod-install": "^0.1.0",
70
- "prettier": "^2.0.5",
71
- "react": "18.2.0",
72
- "react-native": "0.72.14",
70
+ "prettier": "^3.5.3",
71
+ "react": "18.3.1",
72
+ "react-native": "0.75.5",
73
73
  "react-native-builder-bob": "^0.20.0",
74
74
  "typed-openapi": "^0.4.1",
75
- "typescript": "^5.0.2"
75
+ "typescript": "5.0.4"
76
76
  },
77
77
  "resolutions": {
78
- "@types/react": "^18.0.24"
78
+ "@types/react": "^18.2.6"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@pagopa/io-react-native-crypto": "*",
@@ -93,6 +93,9 @@
93
93
  "modulePathIgnorePatterns": [
94
94
  "<rootDir>/example/node_modules",
95
95
  "<rootDir>/lib/"
96
+ ],
97
+ "transformIgnorePatterns": [
98
+ "node_modules/(?!(jest-)?@react-native|react-native|uuid)"
96
99
  ]
97
100
  },
98
101
  "react-native-builder-bob": {
@@ -114,12 +117,11 @@
114
117
  "ajv": "^8.17.1",
115
118
  "js-base64": "^3.7.7",
116
119
  "js-sha256": "^0.9.0",
117
- "jsonpath-plus": "^10.2.0",
120
+ "jsonpath-plus": "^10.3.0",
118
121
  "jsrsasign": "^11.1.0",
119
122
  "parse-url": "^9.2.0",
120
123
  "react-native-url-polyfill": "^2.0.0",
121
124
  "react-native-uuid": "^2.0.1",
122
- "yarn.lock": "^0.0.1-security",
123
125
  "zod": "^3.21.4"
124
126
  }
125
127
  }
@@ -17,7 +17,6 @@ import {
17
17
  import { CredentialResponse } from "./types";
18
18
  import { createDPopToken } from "../../utils/dpop";
19
19
  import uuid from "react-native-uuid";
20
- import { byteStringToBase64Url } from "../../utils/string";
21
20
 
22
21
  export type ObtainCredential = (
23
22
  issuerConf: Out<GetIssuerConfig>["issuerConf"],
@@ -171,12 +170,7 @@ export const obtainCredential: ObtainCredential = async (
171
170
  }
172
171
 
173
172
  /* temporary base64 parsing for the "mso_mdoc" format until the credential submission with this format is fixed. */
174
- return format === "mso_mdoc"
175
- ? {
176
- ...credentialRes.data,
177
- credential: byteStringToBase64Url(credentialRes.data.credential),
178
- }
179
- : credentialRes.data;
173
+ return credentialRes.data;
180
174
  };
181
175
 
182
176
  /**