@pagopa/io-react-native-wallet 0.28.0 → 0.28.2
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/lib/commonjs/credential/issuance/03-start-user-authorization.js +3 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +5 -3
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +12 -23
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +4 -2
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/03-get-request-object.js +31 -43
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +32 -0
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -0
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +60 -0
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -0
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +39 -0
- package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -0
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +134 -0
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -0
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +296 -0
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -0
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +170 -0
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -0
- package/lib/commonjs/credential/presentation/README.md +88 -2
- package/lib/commonjs/credential/presentation/errors.js +68 -1
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +54 -1
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +125 -4
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +41 -1
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/trust/chain.js.map +1 -1
- package/lib/commonjs/trust/types.js +26 -6
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/trust/utils.js +5 -0
- package/lib/commonjs/trust/utils.js.map +1 -1
- package/lib/commonjs/utils/jwk.js +5 -1
- package/lib/commonjs/utils/jwk.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +3 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +5 -3
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +13 -24
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +4 -2
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/module/credential/presentation/03-get-request-object.js +32 -44
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +25 -0
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -0
- package/lib/module/credential/presentation/05-verify-request-object.js +53 -0
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -0
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js +32 -0
- package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -0
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +127 -0
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -0
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +285 -0
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -0
- package/lib/module/credential/presentation/08-send-authorization-response.js +158 -0
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -0
- package/lib/module/credential/presentation/README.md +88 -2
- package/lib/module/credential/presentation/errors.js +63 -0
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/index.js +7 -2
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +122 -3
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/sd-jwt/index.js +40 -1
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/trust/chain.js.map +1 -1
- package/lib/module/trust/types.js +26 -6
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/trust/utils.js +5 -0
- package/lib/module/trust/utils.js.map +1 -1
- package/lib/module/utils/jwk.js +3 -0
- package/lib/module/utils/jwk.js.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +2 -2
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +23 -7
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +1 -0
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -11
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +23 -0
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +20 -0
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +21 -0
- package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +28 -0
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +93 -0
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +70 -0
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/errors.d.ts +43 -0
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +8 -3
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +750 -13
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +19 -0
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/trust/index.d.ts +236 -8
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +3046 -76
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/trust/utils.d.ts +6 -6
- package/lib/typescript/trust/utils.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.d.ts +1 -1
- package/lib/typescript/utils/decoder.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/jwk.d.ts +137 -0
- package/lib/typescript/utils/jwk.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +16 -16
- package/package.json +15 -11
- package/src/credential/issuance/03-start-user-authorization.ts +3 -0
- package/src/credential/issuance/04-complete-user-authorization.ts +6 -3
- package/src/credential/presentation/01-start-flow.ts +18 -28
- package/src/credential/presentation/02-evaluate-rp-trust.ts +3 -2
- package/src/credential/presentation/03-get-request-object.ts +36 -60
- package/src/credential/presentation/04-retrieve-rp-jwks.ts +34 -0
- package/src/credential/presentation/05-verify-request-object.ts +63 -0
- package/src/credential/presentation/06-fetch-presentation-definition.ts +48 -0
- package/src/credential/presentation/07-evaluate-dcql-query.ts +174 -0
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +393 -0
- package/src/credential/presentation/08-send-authorization-response.ts +222 -0
- package/src/credential/presentation/README.md +88 -2
- package/src/credential/presentation/errors.ts +64 -0
- package/src/credential/presentation/index.ts +40 -1
- package/src/credential/presentation/types.ts +135 -4
- package/src/sd-jwt/index.ts +49 -1
- package/src/trust/chain.ts +2 -2
- package/src/trust/types.ts +25 -5
- package/src/trust/utils.ts +6 -3
- package/src/utils/decoder.ts +1 -1
- package/src/utils/errors.ts +2 -2
- package/src/utils/jwk.ts +8 -1
- package/src/utils/misc.ts +2 -2
- package/lib/commonjs/credential/presentation/04-send-authorization-response.js +0 -138
- package/lib/commonjs/credential/presentation/04-send-authorization-response.js.map +0 -1
- package/lib/module/credential/presentation/04-send-authorization-response.js +0 -128
- package/lib/module/credential/presentation/04-send-authorization-response.js.map +0 -1
- package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts +0 -34
- package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts.map +0 -1
- package/src/credential/presentation/04-send-authorization-response.ts +0 -168
@@ -39,3 +39,67 @@ export class NoSuitableKeysFoundInEntityConfiguration extends IoWalletError {
|
|
39
39
|
super(message);
|
40
40
|
}
|
41
41
|
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* When a QR code is not valid.
|
45
|
+
*
|
46
|
+
*/
|
47
|
+
export class InvalidQRCodeError extends IoWalletError {
|
48
|
+
code = "ERR_INVALID_QR_CODE";
|
49
|
+
|
50
|
+
/** Detailed reason for the QR code validation failure. */
|
51
|
+
reason: string;
|
52
|
+
|
53
|
+
constructor(reason: string) {
|
54
|
+
super("Invalid QR code");
|
55
|
+
this.reason = reason;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* When the entity is unverified because the Relying Party is not trusted.
|
61
|
+
*
|
62
|
+
*/
|
63
|
+
export class UnverifiedEntityError extends IoWalletError {
|
64
|
+
code = "ERR_UNVERIFIED_RP_ENTITY";
|
65
|
+
|
66
|
+
/**
|
67
|
+
* @param reason A description of why the entity cannot be verified.
|
68
|
+
*/
|
69
|
+
constructor(reason: string) {
|
70
|
+
const message = `Unverified entity: ${reason}.`;
|
71
|
+
super(message);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* When some required data is missing to continue because certain attributes are not contained inside the wallet.
|
77
|
+
*
|
78
|
+
*/
|
79
|
+
export class MissingDataError extends IoWalletError {
|
80
|
+
code = "ERR_MISSING_DATA";
|
81
|
+
|
82
|
+
/**
|
83
|
+
* @param missingAttributes An array or description of the attributes that are missing.
|
84
|
+
*/
|
85
|
+
constructor(missingAttributes: string) {
|
86
|
+
const message = `Some required data is missing: ${missingAttributes}.`;
|
87
|
+
super(message);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* When a credential is not found in the wallet.
|
93
|
+
*
|
94
|
+
*/
|
95
|
+
export class CredentialNotFoundError extends IoWalletError {
|
96
|
+
code = "ERR_CREDENTIAL_NOT_FOUND";
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @param credentialId The ID of the credential that was not found.
|
100
|
+
*/
|
101
|
+
constructor(credentialId: string) {
|
102
|
+
const message = `Credential not found: ${credentialId}.`;
|
103
|
+
super(message);
|
104
|
+
}
|
105
|
+
}
|
@@ -7,22 +7,61 @@ import {
|
|
7
7
|
getRequestObject,
|
8
8
|
type GetRequestObject,
|
9
9
|
} from "./03-get-request-object";
|
10
|
+
import { getJwksFromConfig, type FetchJwks } from "./04-retrieve-rp-jwks";
|
11
|
+
import {
|
12
|
+
verifyRequestObject,
|
13
|
+
type VerifyRequestObject,
|
14
|
+
} from "./05-verify-request-object";
|
15
|
+
import {
|
16
|
+
fetchPresentDefinition,
|
17
|
+
type FetchPresentationDefinition,
|
18
|
+
} from "./06-fetch-presentation-definition";
|
19
|
+
import {
|
20
|
+
evaluateInputDescriptors,
|
21
|
+
prepareLegacyRemotePresentations,
|
22
|
+
type EvaluateInputDescriptors,
|
23
|
+
type PrepareLegacyRemotePresentations,
|
24
|
+
} from "./07-evaluate-input-descriptor";
|
25
|
+
import {
|
26
|
+
evaluateDcqlQuery,
|
27
|
+
prepareRemotePresentations,
|
28
|
+
type EvaluateDcqlQuery,
|
29
|
+
type PrepareRemotePresentations,
|
30
|
+
} from "./07-evaluate-dcql-query";
|
10
31
|
import {
|
11
32
|
sendAuthorizationResponse,
|
12
33
|
type SendAuthorizationResponse,
|
13
|
-
|
34
|
+
sendLegacyAuthorizationResponse,
|
35
|
+
type SendLegacyAuthorizationResponse,
|
36
|
+
} from "./08-send-authorization-response";
|
14
37
|
import * as Errors from "./errors";
|
15
38
|
|
16
39
|
export {
|
17
40
|
startFlowFromQR,
|
18
41
|
evaluateRelyingPartyTrust,
|
19
42
|
getRequestObject,
|
43
|
+
getJwksFromConfig,
|
44
|
+
verifyRequestObject,
|
45
|
+
fetchPresentDefinition,
|
46
|
+
evaluateInputDescriptors,
|
47
|
+
evaluateDcqlQuery,
|
48
|
+
prepareLegacyRemotePresentations,
|
49
|
+
prepareRemotePresentations,
|
20
50
|
sendAuthorizationResponse,
|
51
|
+
sendLegacyAuthorizationResponse,
|
21
52
|
Errors,
|
22
53
|
};
|
23
54
|
export type {
|
24
55
|
StartFlow,
|
25
56
|
EvaluateRelyingPartyTrust,
|
26
57
|
GetRequestObject,
|
58
|
+
FetchJwks,
|
59
|
+
VerifyRequestObject,
|
60
|
+
FetchPresentationDefinition,
|
61
|
+
EvaluateInputDescriptors,
|
62
|
+
EvaluateDcqlQuery,
|
63
|
+
PrepareLegacyRemotePresentations,
|
64
|
+
PrepareRemotePresentations,
|
27
65
|
SendAuthorizationResponse,
|
66
|
+
SendLegacyAuthorizationResponse,
|
28
67
|
};
|
@@ -8,20 +8,151 @@ import * as z from "zod";
|
|
8
8
|
export type Presentation = [
|
9
9
|
/* verified credential token */ string,
|
10
10
|
/* claims */ string[],
|
11
|
-
/* the context for the key associated to the credential */ CryptoContext
|
11
|
+
/* the context for the key associated to the credential */ CryptoContext,
|
12
12
|
];
|
13
13
|
|
14
|
+
/**
|
15
|
+
* A object that associate the information needed to multiple remote presentation
|
16
|
+
* Used with `presentation_definition`
|
17
|
+
* @deprecated Use `RemotePresentation`
|
18
|
+
*/
|
19
|
+
export type LegacyRemotePresentation = {
|
20
|
+
requestedClaims: string[];
|
21
|
+
inputDescriptor: InputDescriptor;
|
22
|
+
format: string;
|
23
|
+
vpToken: string;
|
24
|
+
};
|
25
|
+
|
26
|
+
/**
|
27
|
+
* A object that associate the information needed to multiple remote presentation
|
28
|
+
* Used with DCQL queries
|
29
|
+
*/
|
30
|
+
export type RemotePresentation = {
|
31
|
+
requestedClaims: string[];
|
32
|
+
credentialId: string;
|
33
|
+
format: string;
|
34
|
+
vpToken: string;
|
35
|
+
};
|
36
|
+
|
37
|
+
const Fields = z.object({
|
38
|
+
path: z.array(z.string().min(1)), // Array of JSONPath string expressions
|
39
|
+
id: z.string().optional(), // Unique string ID
|
40
|
+
purpose: z.string().optional(), // Purpose of the field
|
41
|
+
name: z.string().optional(), // Human-friendly name
|
42
|
+
filter: z.any().optional(), // JSON Schema descriptor for filtering
|
43
|
+
optional: z.boolean().optional(), // Boolean indicating if the field is optional
|
44
|
+
intent_to_retain: z.boolean().optional(), // Boolean indicating that the Verifier intends to retain the Claim's data being requested
|
45
|
+
});
|
46
|
+
|
47
|
+
// Define the Constraints Object Schema
|
48
|
+
const Constraints = z.object({
|
49
|
+
fields: z.array(Fields).optional(), // Array of Field Objects
|
50
|
+
limit_disclosure: z.enum(["required", "preferred"]).optional(), // Limit disclosure property
|
51
|
+
});
|
52
|
+
|
53
|
+
// Define the Input Descriptor Object Schema
|
54
|
+
export type InputDescriptor = z.infer<typeof InputDescriptor>;
|
55
|
+
export const InputDescriptor = z.object({
|
56
|
+
id: z.string().min(1), // Mandatory unique string ID
|
57
|
+
name: z.string().optional(), // Human-friendly name
|
58
|
+
purpose: z.string().optional(), // Purpose of the schema
|
59
|
+
format: z.record(z.string(), z.any()).optional(), // Object with Claim Format Designations
|
60
|
+
constraints: Constraints, // Constraints Object (mandatory)
|
61
|
+
group: z.string().optional(), // Match one of the grouping strings listed in the "from" values of a Submission Requirement Rule
|
62
|
+
});
|
63
|
+
|
64
|
+
const SubmissionRequirement = z.object({
|
65
|
+
name: z.string().optional(),
|
66
|
+
purpose: z.string().optional(),
|
67
|
+
rule: z.string(), // "all": all group's rules must be present, or "pick": at least group's "count" rules must be present
|
68
|
+
from: z.string().optional(), // MUST contain either a "from" or "from_nested" property
|
69
|
+
from_nested: z
|
70
|
+
.array(
|
71
|
+
z.object({
|
72
|
+
name: z.string().optional(),
|
73
|
+
purpose: z.string().optional(),
|
74
|
+
rule: z.string(),
|
75
|
+
from: z.string(),
|
76
|
+
})
|
77
|
+
)
|
78
|
+
.optional(),
|
79
|
+
count: z.number().optional(),
|
80
|
+
//"count", "min", and "max" may be present with a "pick" rule
|
81
|
+
});
|
82
|
+
|
83
|
+
export type PresentationDefinition = z.infer<typeof PresentationDefinition>;
|
84
|
+
export const PresentationDefinition = z.object({
|
85
|
+
id: z.string(),
|
86
|
+
name: z.string().optional(),
|
87
|
+
purpose: z.string().optional(),
|
88
|
+
input_descriptors: z.array(InputDescriptor),
|
89
|
+
submission_requirements: z.array(SubmissionRequirement).optional(),
|
90
|
+
});
|
91
|
+
|
14
92
|
export type RequestObject = z.infer<typeof RequestObject>;
|
15
93
|
export const RequestObject = z.object({
|
16
94
|
iss: z.string(),
|
17
95
|
iat: UnixTime,
|
18
96
|
exp: UnixTime,
|
19
|
-
state: z.string(),
|
97
|
+
state: z.string().optional(),
|
20
98
|
nonce: z.string(),
|
21
99
|
response_uri: z.string(),
|
100
|
+
response_uri_method: z.string().optional(),
|
22
101
|
response_type: z.literal("vp_token"),
|
23
102
|
response_mode: z.literal("direct_post.jwt"),
|
24
103
|
client_id: z.string(),
|
25
|
-
|
26
|
-
scope: z.string(),
|
104
|
+
dcql_query: z.record(z.string(), z.any()).optional(), // Validation happens within the `dcql` library, no need to duplicate it here
|
105
|
+
scope: z.string().optional(),
|
106
|
+
presentation_definition: PresentationDefinition.optional(),
|
107
|
+
});
|
108
|
+
|
109
|
+
export type WalletMetadata = z.infer<typeof WalletMetadata>;
|
110
|
+
export const WalletMetadata = z.object({
|
111
|
+
presentation_definition_uri_supported: z.boolean().optional(),
|
112
|
+
client_id_schemes_supported: z.array(z.string()).optional(),
|
113
|
+
request_object_signing_alg_values_supported: z.array(z.string()).optional(),
|
114
|
+
vp_formats_supported: z.record(
|
115
|
+
z.string(), // TODO [SIW-2110]: use explicit credential format?
|
116
|
+
z.object({
|
117
|
+
"sd-jwt_alg_values": z.array(z.string()).optional(), // alg_values_supported?
|
118
|
+
})
|
119
|
+
),
|
120
|
+
// TODO [SIW-2110]: include other metadata?
|
121
|
+
});
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Wallet capabilities that must be submitted to get the Request Object
|
125
|
+
* via POST request when the `request_uri_method` is `post`.
|
126
|
+
*/
|
127
|
+
export type RequestObjectWalletCapabilities = z.infer<
|
128
|
+
typeof RequestObjectWalletCapabilities
|
129
|
+
>;
|
130
|
+
export const RequestObjectWalletCapabilities = z.object({
|
131
|
+
wallet_metadata: WalletMetadata,
|
132
|
+
wallet_nonce: z.string().optional(),
|
133
|
+
});
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Authorization Response payload when using `presentation_definition`.
|
137
|
+
* @deprecated Use `DirectAuthorizationBodyPayload`
|
138
|
+
*/
|
139
|
+
export type LegacyDirectAuthorizationBodyPayload = z.infer<
|
140
|
+
typeof LegacyDirectAuthorizationBodyPayload
|
141
|
+
>;
|
142
|
+
/**
|
143
|
+
* @deprecated Use `DirectAuthorizationBodyPayload`
|
144
|
+
*/
|
145
|
+
export const LegacyDirectAuthorizationBodyPayload = z.object({
|
146
|
+
vp_token: z.union([z.string(), z.array(z.string())]).optional(),
|
147
|
+
presentation_submission: z.record(z.string(), z.unknown()),
|
148
|
+
});
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Authorization Response payload when using DCQL queries.
|
152
|
+
*/
|
153
|
+
export type DirectAuthorizationBodyPayload = z.infer<
|
154
|
+
typeof DirectAuthorizationBodyPayload
|
155
|
+
>;
|
156
|
+
export const DirectAuthorizationBodyPayload = z.object({
|
157
|
+
vp_token: z.record(z.string(), z.string()),
|
27
158
|
});
|
package/src/sd-jwt/index.ts
CHANGED
@@ -2,12 +2,13 @@ import { z } from "zod";
|
|
2
2
|
|
3
3
|
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
4
4
|
import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
|
5
|
-
import { sha256ToBase64 } from "@pagopa/io-react-native-jwt";
|
5
|
+
import { SignJWT, sha256ToBase64 } from "@pagopa/io-react-native-jwt";
|
6
6
|
import { Disclosure, SdJwt4VC, type DisclosureWithEncoded } from "./types";
|
7
7
|
import { verifyDisclosure } from "./verifier";
|
8
8
|
import type { JWK } from "../utils/jwk";
|
9
9
|
import * as Errors from "./errors";
|
10
10
|
import { Base64 } from "js-base64";
|
11
|
+
import { type Presentation } from "../credential/presentation/types";
|
11
12
|
|
12
13
|
const decodeDisclosure = (encoded: string): DisclosureWithEncoded => {
|
13
14
|
const utf8String = Base64.decode(encoded); // Decode Base64 into UTF-8 string
|
@@ -163,4 +164,51 @@ export const verify = async <S extends z.ZodType<SdJwt4VC>>(
|
|
163
164
|
};
|
164
165
|
};
|
165
166
|
|
167
|
+
/**
|
168
|
+
* Prepares a Verified Presentation (VP) token to be sent as part of an
|
169
|
+
* authorization response in an OpenID 4 Verifiable Presentations flow.
|
170
|
+
*
|
171
|
+
* @param nonce - The nonce provided by the relying party.
|
172
|
+
* @param client_id - The client identifier of the relying party.
|
173
|
+
* @param presentation - An object containing the verifiable credential, the claims to disclose,
|
174
|
+
* and the cryptographic context for signing.
|
175
|
+
* @returns An object containing the signed VP token (`vp_token`).
|
176
|
+
*
|
177
|
+
* @remarks
|
178
|
+
* 1. The `disclose()` function is used to produce a token with only the requested claims.
|
179
|
+
* 2. A KB-JWT is then signed, including sd_hash and `nonce`.
|
180
|
+
* 3. The `vp_token` is composed of the disclosed VP and the KB-JWT.
|
181
|
+
*/
|
182
|
+
export const prepareVpToken = async (
|
183
|
+
nonce: string,
|
184
|
+
client_id: string,
|
185
|
+
[verifiableCredential, requestedClaims, cryptoContext]: Presentation
|
186
|
+
): Promise<{
|
187
|
+
vp_token: string;
|
188
|
+
}> => {
|
189
|
+
// Produce a VP token with only requested claims from the verifiable credential
|
190
|
+
const { token: vp } = await disclose(verifiableCredential, requestedClaims);
|
191
|
+
|
192
|
+
// <Issuer-signed JWT>~<Disclosure 1>~<Disclosure N>~
|
193
|
+
const sd_hash = await sha256ToBase64(`${vp}~`);
|
194
|
+
|
195
|
+
const kbJwt = await new SignJWT(cryptoContext)
|
196
|
+
.setProtectedHeader({
|
197
|
+
typ: "kb+jwt",
|
198
|
+
alg: "ES256",
|
199
|
+
})
|
200
|
+
.setPayload({
|
201
|
+
sd_hash,
|
202
|
+
nonce: nonce,
|
203
|
+
})
|
204
|
+
.setAudience(client_id)
|
205
|
+
.setIssuedAt()
|
206
|
+
.sign();
|
207
|
+
|
208
|
+
// <Issuer-signed JWT>~<Disclosure 1>~...~<Disclosure N>~<KB-JWT>
|
209
|
+
const vp_token = [vp, kbJwt].join("~");
|
210
|
+
|
211
|
+
return { vp_token };
|
212
|
+
};
|
213
|
+
|
166
214
|
export { SdJwt4VC, Errors };
|
package/src/trust/chain.ts
CHANGED
@@ -42,8 +42,8 @@ export async function validateTrustChain(
|
|
42
42
|
elementIndex === 0
|
43
43
|
? FirstElementShape
|
44
44
|
: elementIndex === chain.length - 1
|
45
|
-
|
46
|
-
|
45
|
+
? LastElementShape
|
46
|
+
: MiddleElementShape;
|
47
47
|
|
48
48
|
// select the kid from the current index
|
49
49
|
const selectKid = (currentIndex: number): string => {
|
package/src/trust/types.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { UnixTime } from "../sd-jwt/types";
|
2
2
|
import { JWK } from "../utils/jwk";
|
3
3
|
import * as z from "zod";
|
4
|
+
import { PresentationDefinition } from "../credential/presentation/types";
|
4
5
|
|
5
6
|
export const TrustMark = z.object({ id: z.string(), trust_mark: z.string() });
|
6
7
|
export type TrustMark = z.infer<typeof TrustMark>;
|
@@ -11,6 +12,11 @@ const RelyingPartyMetadata = z.object({
|
|
11
12
|
client_name: z.string().optional(),
|
12
13
|
jwks: z.object({ keys: z.array(JWK) }),
|
13
14
|
contacts: z.array(z.string()).optional(),
|
15
|
+
presentation_definition: PresentationDefinition.optional(),
|
16
|
+
request_uris: z.array(z.string()).optional(),
|
17
|
+
authorization_signed_response_alg: z.string().optional(),
|
18
|
+
authorization_encrypted_response_alg: z.string().optional(),
|
19
|
+
authorization_encrypted_response_enc: z.string().optional(),
|
14
20
|
});
|
15
21
|
|
16
22
|
// Display metadata for a credential, used by the issuer to
|
@@ -173,10 +179,24 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(
|
|
173
179
|
token_endpoint_auth_signing_alg_values_supported: z.array(z.string()),
|
174
180
|
request_object_signing_alg_values_supported: z.array(z.string()),
|
175
181
|
}),
|
176
|
-
/**
|
177
|
-
|
178
|
-
|
179
|
-
|
182
|
+
/**
|
183
|
+
* Credential Issuers act as Relying Party when they require the presentation of other credentials.
|
184
|
+
* This does not apply for PID issuance, which requires CIE authz.
|
185
|
+
*/
|
186
|
+
openid_credential_verifier: RelyingPartyMetadata.optional(),
|
187
|
+
/**
|
188
|
+
* @deprecated use `openid_credential_verifier`
|
189
|
+
* TODO [SIW-2111]: remove after migrating to 0.9.x
|
190
|
+
*/
|
191
|
+
wallet_relying_party: z
|
192
|
+
.object({
|
193
|
+
application_type: z.string().optional(),
|
194
|
+
client_id: z.string().optional(),
|
195
|
+
client_name: z.string().optional(),
|
196
|
+
jwks: z.object({ keys: z.array(JWK) }),
|
197
|
+
contacts: z.array(z.string()).optional(),
|
198
|
+
})
|
199
|
+
.optional(),
|
180
200
|
}),
|
181
201
|
}),
|
182
202
|
})
|
@@ -190,7 +210,7 @@ export const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(
|
|
190
210
|
z.object({
|
191
211
|
payload: z.object({
|
192
212
|
metadata: z.object({
|
193
|
-
|
213
|
+
openid_credential_verifier: RelyingPartyMetadata,
|
194
214
|
}),
|
195
215
|
}),
|
196
216
|
})
|
package/src/trust/utils.ts
CHANGED
@@ -3,8 +3,7 @@ import {
|
|
3
3
|
verify as verifyJwt,
|
4
4
|
} from "@pagopa/io-react-native-jwt";
|
5
5
|
|
6
|
-
import type { JWK } from "../utils/jwk";
|
7
|
-
import type { JWTDecodeResult } from "@pagopa/io-react-native-jwt/lib/typescript/types";
|
6
|
+
import type { JWK, JWTDecodeResult } from "../utils/jwk";
|
8
7
|
|
9
8
|
export type ParsedToken = {
|
10
9
|
header: JWTDecodeResult["protectedHeader"];
|
@@ -26,7 +25,11 @@ export const verify = async (
|
|
26
25
|
return { header, payload };
|
27
26
|
};
|
28
27
|
|
29
|
-
|
28
|
+
/**
|
29
|
+
* Return type for this function is necessary to avoid an issue during the bob build process.
|
30
|
+
* It seems like typescript can't correctly infer the return type of the function.
|
31
|
+
*/
|
32
|
+
export const decode = (token: string): ParsedToken => {
|
30
33
|
const { protectedHeader: header, payload } = decodeJwt(token);
|
31
34
|
return { header, payload };
|
32
35
|
};
|
package/src/utils/decoder.ts
CHANGED
package/src/utils/errors.ts
CHANGED
@@ -225,8 +225,8 @@ export const isWalletProviderResponseError = (
|
|
225
225
|
type ErrorCodeMap<T> = T extends typeof IssuerResponseError
|
226
226
|
? IssuerResponseErrorCode
|
227
227
|
: T extends typeof WalletProviderResponseError
|
228
|
-
|
229
|
-
|
228
|
+
? WalletProviderResponseErrorCode
|
229
|
+
: never;
|
230
230
|
|
231
231
|
type ErrorCase<T> = {
|
232
232
|
code: ErrorCodeMap<T>;
|
package/src/utils/jwk.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { removePadding } from "@pagopa/io-react-native-jwt";
|
1
|
+
import { decode, removePadding } from "@pagopa/io-react-native-jwt";
|
2
2
|
import { z } from "zod";
|
3
3
|
|
4
4
|
export type JWK = z.infer<typeof JWK>;
|
@@ -58,3 +58,10 @@ export function fixBase64EncodingOnKey(key: JWK): JWK {
|
|
58
58
|
...(n ? { n: removePadding(n) } : {}),
|
59
59
|
};
|
60
60
|
}
|
61
|
+
|
62
|
+
export type JWKS = z.infer<typeof JWKS>;
|
63
|
+
export const JWKS = z.object({
|
64
|
+
keys: z.array(JWK),
|
65
|
+
});
|
66
|
+
|
67
|
+
export type JWTDecodeResult = ReturnType<typeof decode>;
|
package/src/utils/misc.ts
CHANGED
@@ -37,8 +37,8 @@ export const parseRawHttpResponse = <T extends Record<string, unknown>>(
|
|
37
37
|
export type Out<FN> = FN extends (...args: any[]) => Promise<any>
|
38
38
|
? Awaited<ReturnType<FN>>
|
39
39
|
: FN extends (...args: any[]) => any
|
40
|
-
|
41
|
-
|
40
|
+
? ReturnType<FN>
|
41
|
+
: never;
|
42
42
|
|
43
43
|
/**
|
44
44
|
* TODO [SIW-1310]: replace this function with a cryptographically secure one.
|
@@ -1,138 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.sendAuthorizationResponse = exports.AuthorizationResponse = void 0;
|
7
|
-
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
8
|
-
var _uuid = require("uuid");
|
9
|
-
var WalletInstanceAttestation = _interopRequireWildcard(require("../../wallet-instance-attestation"));
|
10
|
-
var _errors = require("./errors");
|
11
|
-
var _misc = require("../../utils/misc");
|
12
|
-
var _sdJwt = require("../../sd-jwt");
|
13
|
-
var z = _interopRequireWildcard(require("zod"));
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
16
|
-
const AuthorizationResponse = z.object({
|
17
|
-
status: z.string(),
|
18
|
-
response_code: z.string() /**
|
19
|
-
FIXME: [SIW-627] we expect this value from every RP implementation
|
20
|
-
Actually some RP does not return the value
|
21
|
-
We make it optional to not break the flow.
|
22
|
-
*/.optional()
|
23
|
-
});
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Choose an RSA public key from those offered by the RP for encryption.
|
27
|
-
*
|
28
|
-
* @param entity The RP entity configuration
|
29
|
-
* @returns A suitable public key with its compatible encryption algorithm
|
30
|
-
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
|
31
|
-
*/
|
32
|
-
exports.AuthorizationResponse = AuthorizationResponse;
|
33
|
-
const chooseRSAPublicKeyToEncrypt = entity => {
|
34
|
-
const [usingRsa256] = entity.wallet_relying_party.jwks.keys.filter(jwk => jwk.use === "enc" && jwk.kty === "RSA");
|
35
|
-
if (usingRsa256) {
|
36
|
-
return usingRsa256;
|
37
|
-
}
|
38
|
-
|
39
|
-
// No suitable key has been found
|
40
|
-
throw new _errors.NoSuitableKeysFoundInEntityConfiguration("Encrypt with RP public key");
|
41
|
-
};
|
42
|
-
|
43
|
-
/**
|
44
|
-
* Generate a Verified Presentation token for a received request object within the context of an authorization request flow.
|
45
|
-
* The presentation is created by revealing data from the provided credentials based on the requested claims.
|
46
|
-
* Each Verified Credential is accompanied by the claims that the user consents to disclose from it.
|
47
|
-
*
|
48
|
-
* @todo: Allow for handling more than one Verified Credential.
|
49
|
-
*/
|
50
|
-
const prepareVpToken = async (requestObject, walletInstanceAttestation, _ref) => {
|
51
|
-
let [vc, claims, cryptoCtx] = _ref;
|
52
|
-
// this throws if vc cannot satisfy all the requested claims
|
53
|
-
const {
|
54
|
-
token: vp,
|
55
|
-
paths
|
56
|
-
} = await (0, _sdJwt.disclose)(vc, claims);
|
57
|
-
|
58
|
-
// obtain issuer from Wallet Instance
|
59
|
-
const {
|
60
|
-
payload: {
|
61
|
-
iss
|
62
|
-
}
|
63
|
-
} = WalletInstanceAttestation.decode(walletInstanceAttestation);
|
64
|
-
const pidKid = await cryptoCtx.getPublicKey().then(_ => _.kid);
|
65
|
-
|
66
|
-
// TODO: [SIW-359] check all requeste claims of the requestedObj are satisfied
|
67
|
-
const vp_token = await new _ioReactNativeJwt.SignJWT(cryptoCtx).setProtectedHeader({
|
68
|
-
typ: "JWT",
|
69
|
-
kid: pidKid
|
70
|
-
}).setPayload({
|
71
|
-
vp: vp,
|
72
|
-
jti: `${(0, _uuid.v4)()}`,
|
73
|
-
iss,
|
74
|
-
nonce: requestObject.nonce
|
75
|
-
}).setAudience(requestObject.response_uri).setIssuedAt().setExpirationTime("1h").sign();
|
76
|
-
const vc_scope = requestObject.scope;
|
77
|
-
const presentation_submission = {
|
78
|
-
definition_id: `${(0, _uuid.v4)()}`,
|
79
|
-
id: `${(0, _uuid.v4)()}`,
|
80
|
-
descriptor_map: paths.map(p => ({
|
81
|
-
id: vc_scope,
|
82
|
-
path: `$.vp_token.${p.path}`,
|
83
|
-
format: "vc+sd-jwt"
|
84
|
-
}))
|
85
|
-
};
|
86
|
-
return {
|
87
|
-
vp_token,
|
88
|
-
presentation_submission
|
89
|
-
};
|
90
|
-
};
|
91
|
-
/**
|
92
|
-
* Complete the presentation flow by sending the authorization response to the Relying Party
|
93
|
-
*
|
94
|
-
* @param requestObject The Request Object that describes the presentation
|
95
|
-
* @param rpConf The Relying Party's configuration
|
96
|
-
* @param presentation The presentation tuple consisting in the signed credential,
|
97
|
-
* the list of claims to be disclosed, and the context to access the key that proves the holder binding
|
98
|
-
* @param context.walletInstanceAttestation The Wallet Instance Attestation token
|
99
|
-
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
100
|
-
* @returns The result of the presentation flow
|
101
|
-
*/
|
102
|
-
const sendAuthorizationResponse = async (requestObject, rpConf, presentation, _ref2) => {
|
103
|
-
let {
|
104
|
-
appFetch = fetch,
|
105
|
-
walletInstanceAttestation
|
106
|
-
} = _ref2;
|
107
|
-
// the request is an unsigned jws without iss, aud, exp
|
108
|
-
// https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-signed-and-encrypted-respon
|
109
|
-
const rsaPublicJwk = chooseRSAPublicKeyToEncrypt(rpConf);
|
110
|
-
const {
|
111
|
-
vp_token,
|
112
|
-
presentation_submission
|
113
|
-
} = await prepareVpToken(requestObject, walletInstanceAttestation, presentation);
|
114
|
-
const authzResponsePayload = JSON.stringify({
|
115
|
-
state: requestObject.state,
|
116
|
-
presentation_submission,
|
117
|
-
nonce: requestObject.nonce,
|
118
|
-
vp_token
|
119
|
-
});
|
120
|
-
const encrypted = await new _ioReactNativeJwt.EncryptJwe(authzResponsePayload, {
|
121
|
-
alg: "RSA-OAEP-256",
|
122
|
-
enc: "A256CBC-HS512",
|
123
|
-
kid: rsaPublicJwk.kid
|
124
|
-
}).encrypt(rsaPublicJwk);
|
125
|
-
const formBody = new URLSearchParams({
|
126
|
-
response: encrypted
|
127
|
-
});
|
128
|
-
const body = formBody.toString();
|
129
|
-
return appFetch(requestObject.response_uri, {
|
130
|
-
method: "POST",
|
131
|
-
headers: {
|
132
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
133
|
-
},
|
134
|
-
body
|
135
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
|
136
|
-
};
|
137
|
-
exports.sendAuthorizationResponse = sendAuthorizationResponse;
|
138
|
-
//# sourceMappingURL=04-send-authorization-response.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_uuid","WalletInstanceAttestation","_interopRequireWildcard","_errors","_misc","_sdJwt","z","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","response_code","optional","exports","chooseRSAPublicKeyToEncrypt","entity","usingRsa256","wallet_relying_party","jwks","keys","filter","jwk","use","kty","NoSuitableKeysFoundInEntityConfiguration","prepareVpToken","requestObject","walletInstanceAttestation","_ref","vc","claims","cryptoCtx","token","vp","paths","disclose","payload","iss","decode","pidKid","getPublicKey","then","_","kid","vp_token","SignJWT","setProtectedHeader","typ","setPayload","jti","uuidv4","nonce","setAudience","response_uri","setIssuedAt","setExpirationTime","sign","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","rpConf","presentation","_ref2","appFetch","fetch","rsaPublicJwk","authzResponsePayload","JSON","stringify","state","encrypted","EncryptJwe","alg","enc","encrypt","formBody","URLSearchParams","response","body","toString","method","headers","hasStatusOrThrow","res","json","parse"],"sourceRoot":"../../../../src","sources":["credential/presentation/04-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,O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