@pagopa/io-react-native-wallet 0.7.4 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +49 -31
- package/lib/commonjs/credential/index.js +13 -0
- package/lib/commonjs/credential/index.js.map +1 -0
- package/lib/commonjs/credential/issuance/01-start-flow.js +2 -0
- package/lib/commonjs/credential/issuance/01-start-flow.js.map +1 -0
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +26 -0
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +119 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -0
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +6 -0
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -0
- package/lib/commonjs/credential/issuance/05-authorize-access.js +63 -0
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -0
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +128 -0
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -0
- package/lib/commonjs/credential/issuance/07-confirm-credential.js +6 -0
- package/lib/commonjs/credential/issuance/07-confirm-credential.js.map +1 -0
- package/lib/commonjs/credential/issuance/const.js +9 -0
- package/lib/commonjs/credential/issuance/const.js.map +1 -0
- package/lib/commonjs/credential/issuance/index.js +34 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -0
- package/lib/commonjs/credential/presentation/01-start-flow.js +55 -0
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -0
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +32 -0
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -0
- package/lib/commonjs/credential/presentation/03-get-request-object.js +68 -0
- package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -0
- package/lib/commonjs/credential/presentation/04-send-authorization-response.js +139 -0
- package/lib/commonjs/credential/presentation/04-send-authorization-response.js.map +1 -0
- package/lib/commonjs/credential/presentation/index.js +34 -0
- package/lib/commonjs/credential/presentation/index.js.map +1 -0
- package/lib/commonjs/{rp → credential/presentation}/types.js +17 -34
- package/lib/commonjs/credential/presentation/types.js.map +1 -0
- package/lib/commonjs/index.js +10 -61
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/index.js +1 -3
- package/lib/commonjs/pid/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +1 -1
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +1 -1
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/trust/chain.js +32 -4
- package/lib/commonjs/trust/chain.js.map +1 -1
- package/lib/commonjs/trust/index.js +105 -20
- package/lib/commonjs/trust/index.js.map +1 -1
- package/lib/commonjs/trust/types.js +54 -35
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +5 -18
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/errors.js +35 -4
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/misc.js +23 -0
- package/lib/commonjs/utils/misc.js.map +1 -0
- package/lib/commonjs/utils/par.js +86 -0
- package/lib/commonjs/utils/par.js.map +1 -0
- package/lib/module/credential/index.js +4 -0
- package/lib/module/credential/index.js.map +1 -0
- package/lib/module/credential/issuance/01-start-flow.js +2 -0
- package/lib/module/credential/issuance/01-start-flow.js.map +1 -0
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +19 -0
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js +109 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -0
- package/lib/module/credential/issuance/04-complete-user-authorization.js +2 -0
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -0
- package/lib/module/credential/issuance/05-authorize-access.js +55 -0
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -0
- package/lib/module/credential/issuance/06-obtain-credential.js +117 -0
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -0
- package/lib/module/credential/issuance/07-confirm-credential.js +2 -0
- package/lib/module/credential/issuance/07-confirm-credential.js.map +1 -0
- package/lib/module/credential/issuance/const.js +2 -0
- package/lib/module/credential/issuance/const.js.map +1 -0
- package/lib/module/credential/issuance/index.js +6 -0
- package/lib/module/credential/issuance/index.js.map +1 -0
- package/lib/module/credential/presentation/01-start-flow.js +46 -0
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -0
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +25 -0
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -0
- package/lib/module/credential/presentation/03-get-request-object.js +60 -0
- package/lib/module/credential/presentation/03-get-request-object.js.map +1 -0
- package/lib/module/credential/presentation/04-send-authorization-response.js +128 -0
- package/lib/module/credential/presentation/04-send-authorization-response.js.map +1 -0
- package/lib/module/credential/presentation/index.js +6 -0
- package/lib/module/credential/presentation/index.js.map +1 -0
- package/lib/module/credential/presentation/types.js +21 -0
- package/lib/module/credential/presentation/types.js.map +1 -0
- package/lib/module/index.js +4 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/index.js +1 -2
- package/lib/module/pid/index.js.map +1 -1
- package/lib/module/sd-jwt/index.js +1 -1
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +1 -1
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/trust/chain.js +30 -3
- package/lib/module/trust/chain.js.map +1 -1
- package/lib/module/trust/index.js +99 -16
- package/lib/module/trust/index.js.map +1 -1
- package/lib/module/trust/types.js +50 -31
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/utils/crypto.js +2 -15
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/errors.js +35 -4
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/misc.js +17 -0
- package/lib/module/utils/misc.js.map +1 -0
- package/lib/module/utils/par.js +74 -0
- package/lib/module/utils/par.js.map +1 -0
- package/lib/typescript/credential/index.d.ts +4 -0
- package/lib/typescript/credential/index.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +11 -0
- package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +18 -0
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +31 -0
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +16 -0
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +26 -0
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +32 -0
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/07-confirm-credential.d.ts +11 -0
- package/lib/typescript/credential/issuance/07-confirm-credential.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/const.d.ts +2 -0
- package/lib/typescript/credential/issuance/const.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/index.d.ts +10 -0
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +20 -0
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +18 -0
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +25 -0
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts +34 -0
- package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/index.d.ts +7 -0
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/types.d.ts +49 -0
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +4 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/index.d.ts +1 -2
- package/lib/typescript/pid/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +2 -2
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +5 -5
- package/lib/typescript/trust/chain.d.ts +12 -3
- package/lib/typescript/trust/chain.d.ts.map +1 -1
- package/lib/typescript/trust/index.d.ts +198 -24
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +1299 -623
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +1 -1
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/dpop.d.ts +2 -2
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts +8 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -0
- package/lib/typescript/utils/par.d.ts +68 -0
- package/lib/typescript/utils/par.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/credential/index.ts +4 -0
- package/src/credential/issuance/01-start-flow.ts +10 -0
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +31 -0
- package/src/credential/issuance/03-start-user-authorization.ts +138 -0
- package/src/credential/issuance/04-complete-user-authorization.ts +17 -0
- package/src/credential/issuance/05-authorize-access.ts +92 -0
- package/src/credential/issuance/06-obtain-credential.ts +179 -0
- package/src/credential/issuance/07-confirm-credential.ts +14 -0
- package/src/credential/issuance/const.ts +2 -0
- package/src/credential/issuance/index.ts +32 -0
- package/src/credential/presentation/01-start-flow.ts +51 -0
- package/src/credential/presentation/02-evaluate-rp-trust.ts +33 -0
- package/src/credential/presentation/03-get-request-object.ts +85 -0
- package/src/credential/presentation/04-send-authorization-response.ts +168 -0
- package/src/credential/presentation/index.ts +26 -0
- package/src/credential/presentation/types.ts +27 -0
- package/src/index.ts +7 -28
- package/src/pid/index.ts +1 -2
- package/src/sd-jwt/index.ts +2 -2
- package/src/sd-jwt/types.ts +1 -1
- package/src/trust/chain.ts +45 -3
- package/src/trust/index.ts +136 -19
- package/src/trust/types.ts +57 -35
- package/src/utils/crypto.ts +2 -20
- package/src/utils/errors.ts +40 -8
- package/src/utils/misc.ts +23 -0
- package/src/utils/par.ts +103 -0
- package/lib/commonjs/pid/issuing.js +0 -276
- package/lib/commonjs/pid/issuing.js.map +0 -1
- package/lib/commonjs/rp/__test__/index.test.js +0 -172
- package/lib/commonjs/rp/__test__/index.test.js.map +0 -1
- package/lib/commonjs/rp/index.js +0 -239
- package/lib/commonjs/rp/index.js.map +0 -1
- package/lib/commonjs/rp/types.js.map +0 -1
- package/lib/module/pid/issuing.js +0 -266
- package/lib/module/pid/issuing.js.map +0 -1
- package/lib/module/rp/__test__/index.test.js +0 -168
- package/lib/module/rp/__test__/index.test.js.map +0 -1
- package/lib/module/rp/index.js +0 -228
- package/lib/module/rp/index.js.map +0 -1
- package/lib/module/rp/types.js +0 -36
- package/lib/module/rp/types.js.map +0 -1
- package/lib/typescript/pid/issuing.d.ts +0 -57
- package/lib/typescript/pid/issuing.d.ts.map +0 -1
- package/lib/typescript/rp/__test__/index.test.d.ts +0 -2
- package/lib/typescript/rp/__test__/index.test.d.ts.map +0 -1
- package/lib/typescript/rp/index.d.ts +0 -43
- package/lib/typescript/rp/index.d.ts.map +0 -1
- package/lib/typescript/rp/types.d.ts +0 -122
- package/lib/typescript/rp/types.d.ts.map +0 -1
- package/src/pid/issuing.ts +0 -405
- package/src/rp/__test__/index.test.ts +0 -250
- package/src/rp/index.ts +0 -287
- package/src/rp/types.ts +0 -42
@@ -5,6 +5,16 @@ export const TrustMark = z.object({
|
|
5
5
|
id: z.string(),
|
6
6
|
trust_mark: z.string()
|
7
7
|
});
|
8
|
+
const RelyingPartyMetadata = z.object({
|
9
|
+
application_type: z.string().optional(),
|
10
|
+
client_id: z.string().optional(),
|
11
|
+
client_name: z.string().optional(),
|
12
|
+
jwks: z.object({
|
13
|
+
keys: z.array(JWK)
|
14
|
+
}),
|
15
|
+
contacts: z.array(z.string()).optional()
|
16
|
+
});
|
17
|
+
//.passthrough();
|
8
18
|
|
9
19
|
// Display metadata for a credential, used by the issuer to
|
10
20
|
// instruct the Wallet Solution on how to render the credential correctly
|
@@ -18,14 +28,26 @@ const CredentialDisplayMetadata = z.object({
|
|
18
28
|
background_color: z.string(),
|
19
29
|
text_color: z.string()
|
20
30
|
});
|
31
|
+
const CredentialDefinitionMetadata = z.object({
|
32
|
+
type: z.array(z.string()),
|
33
|
+
credentialSubject: z.record(z.object({
|
34
|
+
mandatory: z.boolean(),
|
35
|
+
display: z.array(z.object({
|
36
|
+
name: z.string(),
|
37
|
+
locale: z.string()
|
38
|
+
}))
|
39
|
+
}))
|
40
|
+
});
|
21
41
|
|
22
42
|
// Metadata for a credentia which i supported by a Issuer
|
23
43
|
|
24
44
|
const SupportedCredentialMetadata = z.object({
|
45
|
+
id: z.string(),
|
25
46
|
format: z.literal("vc+sd-jwt"),
|
26
47
|
cryptographic_binding_methods_supported: z.array(z.string()),
|
27
48
|
cryptographic_suites_supported: z.array(z.string()),
|
28
|
-
display: z.array(CredentialDisplayMetadata)
|
49
|
+
display: z.array(CredentialDisplayMetadata),
|
50
|
+
credential_definition: CredentialDefinitionMetadata
|
29
51
|
});
|
30
52
|
export const EntityStatement = z.object({
|
31
53
|
header: z.object({
|
@@ -49,6 +71,17 @@ export const EntityConfigurationHeader = z.object({
|
|
49
71
|
alg: z.string(),
|
50
72
|
kid: z.string()
|
51
73
|
});
|
74
|
+
const FederationEntityMetadata = z.object({
|
75
|
+
federation_fetch_endpoint: z.string().optional(),
|
76
|
+
federation_list_endpoint: z.string().optional(),
|
77
|
+
federation_resolve_endpoint: z.string().optional(),
|
78
|
+
federation_trust_mark_status_endpoint: z.string().optional(),
|
79
|
+
federation_trust_mark_list_endpoint: z.string().optional(),
|
80
|
+
homepage_uri: z.string().optional(),
|
81
|
+
policy_uri: z.string().optional(),
|
82
|
+
logo_uri: z.string().optional(),
|
83
|
+
contacts: z.array(z.string()).optional()
|
84
|
+
}).passthrough();
|
52
85
|
|
53
86
|
// Structuire common to every Entity Configuration document
|
54
87
|
const BaseEntityConfiguration = z.object({
|
@@ -62,17 +95,7 @@ const BaseEntityConfiguration = z.object({
|
|
62
95
|
keys: z.array(JWK)
|
63
96
|
}),
|
64
97
|
metadata: z.object({
|
65
|
-
federation_entity:
|
66
|
-
federation_fetch_endpoint: z.string().optional(),
|
67
|
-
federation_list_endpoint: z.string().optional(),
|
68
|
-
federation_resolve_endpoint: z.string().optional(),
|
69
|
-
federation_trust_mark_status_endpoint: z.string().optional(),
|
70
|
-
federation_trust_mark_list_endpoint: z.string().optional(),
|
71
|
-
homepage_uri: z.string().optional(),
|
72
|
-
policy_uri: z.string().optional(),
|
73
|
-
logo_uri: z.string().optional(),
|
74
|
-
contacts: z.array(z.string()).optional()
|
75
|
-
}).passthrough()
|
98
|
+
federation_entity: FederationEntityMetadata
|
76
99
|
}).passthrough(),
|
77
100
|
authority_hints: z.array(z.string()).optional()
|
78
101
|
}).passthrough()
|
@@ -101,7 +124,21 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z
|
|
101
124
|
jwks: z.object({
|
102
125
|
keys: z.array(JWK)
|
103
126
|
})
|
104
|
-
})
|
127
|
+
}),
|
128
|
+
/** Credential Issuers act as Relying Party
|
129
|
+
when they require the presentation of other credentials.
|
130
|
+
This does not apply for PID issuance, which requires CIE authz. */
|
131
|
+
wallet_relying_party: RelyingPartyMetadata.optional()
|
132
|
+
})
|
133
|
+
})
|
134
|
+
}));
|
135
|
+
|
136
|
+
// Entity configuration for a Relying Party
|
137
|
+
|
138
|
+
export const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(z.object({
|
139
|
+
payload: z.object({
|
140
|
+
metadata: z.object({
|
141
|
+
wallet_relying_party: RelyingPartyMetadata
|
105
142
|
})
|
106
143
|
})
|
107
144
|
}));
|
@@ -125,24 +162,6 @@ export const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(z.o
|
|
125
162
|
})
|
126
163
|
}));
|
127
164
|
|
128
|
-
// Entity configuration for a Relying Party
|
129
|
-
|
130
|
-
export const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(z.object({
|
131
|
-
payload: z.object({
|
132
|
-
metadata: z.object({
|
133
|
-
wallet_relying_party: z.object({
|
134
|
-
application_type: z.string().optional(),
|
135
|
-
client_id: z.string().optional(),
|
136
|
-
client_name: z.string().optional(),
|
137
|
-
jwks: z.object({
|
138
|
-
keys: z.array(JWK)
|
139
|
-
}),
|
140
|
-
contacts: z.array(z.string()).optional()
|
141
|
-
}).passthrough()
|
142
|
-
})
|
143
|
-
})
|
144
|
-
}));
|
145
|
-
|
146
165
|
// Maps any entity configuration by the union of every possible shapes
|
147
166
|
|
148
167
|
export const EntityConfiguration = z.union([WalletProviderEntityConfiguration, CredentialIssuerEntityConfiguration, TrustAnchorEntityConfiguration, RelyingPartyEntityConfiguration], {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnixTime","JWK","z","TrustMark","object","id","string","trust_mark","CredentialDisplayMetadata","name","locale","logo","url","alt_text","background_color","text_color","SupportedCredentialMetadata","format","literal","cryptographic_binding_methods_supported","
|
1
|
+
{"version":3,"names":["UnixTime","JWK","z","TrustMark","object","id","string","trust_mark","RelyingPartyMetadata","application_type","optional","client_id","client_name","jwks","keys","array","contacts","CredentialDisplayMetadata","name","locale","logo","url","alt_text","background_color","text_color","CredentialDefinitionMetadata","type","credentialSubject","record","mandatory","boolean","display","SupportedCredentialMetadata","format","literal","cryptographic_binding_methods_supported","cryptographic_suites_supported","credential_definition","EntityStatement","header","typ","alg","kid","payload","iss","sub","trust_marks","iat","number","exp","EntityConfigurationHeader","FederationEntityMetadata","federation_fetch_endpoint","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","homepage_uri","policy_uri","logo_uri","passthrough","BaseEntityConfiguration","metadata","federation_entity","authority_hints","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","and","openid_credential_issuer","credential_issuer","authorization_endpoint","token_endpoint","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","credential_endpoint","credentials_supported","wallet_relying_party","RelyingPartyEntityConfiguration","WalletProviderEntityConfiguration","wallet_provider","attested_security_context_values_supported","grant_types_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","EntityConfiguration","union","description"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB,OAAO,MAAMC,SAAS,GAAGD,CAAC,CAACE,MAAM,CAAC;EAAEC,EAAE,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAAEC,UAAU,EAAEL,CAAC,CAACI,MAAM,CAAC;AAAE,CAAC,CAAC;AAG7E,MAAME,oBAAoB,GAAGN,CAAC,CAACE,MAAM,CAAC;EACpCK,gBAAgB,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACI,QAAQ,CAAC,CAAC;EACvCC,SAAS,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC,CAACI,QAAQ,CAAC,CAAC;EAChCE,WAAW,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACI,QAAQ,CAAC,CAAC;EAClCG,IAAI,EAAEX,CAAC,CAACE,MAAM,CAAC;IAAEU,IAAI,EAAEZ,CAAC,CAACa,KAAK,CAACd,GAAG;EAAE,CAAC,CAAC;EACtCe,QAAQ,EAAEd,C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ACH,CAAC;;AAED;;AAEA,OAAO,MAAMwB,mBAAmB,GAAGlF,CAAC,CAACmF,KAAK,CACxC,CACEP,iCAAiC,EACjCZ,mCAAmC,EACnCD,8BAA8B,EAC9BY,+BAA+B,CAChC,EACD;EACES,WAAW,EAAE;AACf,CACF,CAAC"}
|
@@ -39,19 +39,6 @@ export const createCryptoContextFor = keytag => {
|
|
39
39
|
};
|
40
40
|
};
|
41
41
|
|
42
|
-
// Wraps finally for async expressions
|
43
|
-
const asyncFinally = (fn, onFinally) => async function () {
|
44
|
-
try {
|
45
|
-
return await fn(...arguments);
|
46
|
-
// ^^^^^ return await is usually to be avoided,
|
47
|
-
// in this case is needed for the finally{} statement to be executed correctly
|
48
|
-
} catch (error) {
|
49
|
-
throw error;
|
50
|
-
} finally {
|
51
|
-
await onFinally();
|
52
|
-
}
|
53
|
-
};
|
54
|
-
|
55
42
|
/**
|
56
43
|
* Executes the input function injecting an ephemeral crypto context.
|
57
44
|
* An ephemeral crypto context is a context which is bound to a key
|
@@ -60,11 +47,11 @@ const asyncFinally = (fn, onFinally) => async function () {
|
|
60
47
|
* @param fn The procedure to be executed
|
61
48
|
* @returns The returned value of the input procedure.
|
62
49
|
*/
|
63
|
-
export const
|
50
|
+
export const withEphemeralKey = async fn => {
|
64
51
|
// Use an ephemeral key to be destroyed after use
|
65
52
|
const keytag = `ephemeral-${uuid.v4()}`;
|
66
53
|
await generate(keytag);
|
67
54
|
const ephemeralContext = createCryptoContextFor(keytag);
|
68
|
-
return
|
55
|
+
return fn(ephemeralContext).finally(() => deleteKey(keytag));
|
69
56
|
};
|
70
57
|
//# sourceMappingURL=crypto.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getPublicKey","sign","generate","deleteKey","uuid","thumbprint","fixBase64EncodingOnKey","createCryptoContextFor","keytag","then","jwk","kid","getSignature","value","
|
1
|
+
{"version":3,"names":["getPublicKey","sign","generate","deleteKey","uuid","thumbprint","fixBase64EncodingOnKey","createCryptoContextFor","keytag","then","jwk","kid","getSignature","value","withEphemeralKey","fn","v4","ephemeralContext","finally"],"sourceRoot":"../../../src","sources":["utils/crypto.ts"],"mappings":"AAAA,SACEA,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,SAAS,QACJ,gCAAgC;AACvC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,UAAU,QAA4B,6BAA6B;AAC5E,SAASC,sBAAsB,QAAQ,OAAO;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAIC,MAAc,IAAoB;EACvE,OAAO;IACL;AACJ;AACA;AACA;AACA;IACI,MAAMR,YAAYA,CAAA,EAAG;MACnB,OAAOA,YAAY,CAACQ,MAAM,CAAC,CACxBC,IAAI,CAACH,sBAAsB,CAAC,CAC5BG,IAAI,CAAC,MAAOC,GAAG,KAAM;QACpB,GAAGA,GAAG;QACN;QACA;QACA;QACA;QACAC,GAAG,EAAE,MAAMN,UAAU,CAACK,GAAG;MAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACI,MAAME,YAAYA,CAACC,KAAa,EAAE;MAChC,OAAOZ,IAAI,CAACY,KAAK,EAAEL,MAAM,CAAC;IAC5B;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,gBAAgB,GAAG,MAC9BC,EAAmD,IACpC;EACf;EACA,MAAMP,MAAM,GAAI,aAAYJ,IAAI,CAACY,EAAE,CAAC,CAAE,EAAC;EACvC,MAAMd,QAAQ,CAACM,MAAM,CAAC;EACtB,MAAMS,gBAAgB,GAAGV,sBAAsB,CAACC,MAAM,CAAC;EACvD,OAAOO,EAAE,CAACE,gBAAgB,CAAC,CAACC,OAAO,CAAC,MAAMf,SAAS,CAACK,MAAM,CAAC,CAAC;AAC9D,CAAC"}
|
@@ -1,3 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* utility to format a set of attributes into an error message string
|
3
|
+
*
|
4
|
+
* @example
|
5
|
+
* // returns "foo=value bar=(list, item)"
|
6
|
+
* serializeAttrs({ foo: "value", bar: ["list", "item"] })
|
7
|
+
*
|
8
|
+
* @param attrs A key value record set
|
9
|
+
* @returns a human-readable serialization of the set
|
10
|
+
*/
|
11
|
+
const serializeAttrs = attrs => Object.entries(attrs).map(_ref => {
|
12
|
+
let [k, v] = _ref;
|
13
|
+
return [k, Array.isArray(v) ? `(${v.join(", ")})` : v];
|
14
|
+
}).map(_ => _.join("=")).join(" ");
|
15
|
+
|
1
16
|
/**
|
2
17
|
* A generic Error that all other io-wallet specific Error subclasses extend.
|
3
18
|
*
|
@@ -42,7 +57,11 @@ export class ValidationFailed extends IoWalletError {
|
|
42
57
|
constructor(message) {
|
43
58
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
44
59
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
45
|
-
super(
|
60
|
+
super(serializeAttrs({
|
61
|
+
message,
|
62
|
+
claim,
|
63
|
+
reason
|
64
|
+
}));
|
46
65
|
this.claim = claim;
|
47
66
|
this.reason = reason;
|
48
67
|
}
|
@@ -65,7 +84,11 @@ export class WalletInstanceAttestationIssuingError extends IoWalletError {
|
|
65
84
|
constructor(message) {
|
66
85
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
67
86
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
68
|
-
super(
|
87
|
+
super(serializeAttrs({
|
88
|
+
message,
|
89
|
+
claim,
|
90
|
+
reason
|
91
|
+
}));
|
69
92
|
this.claim = claim;
|
70
93
|
this.reason = reason;
|
71
94
|
}
|
@@ -88,7 +111,11 @@ export class AuthRequestDecodeError extends IoWalletError {
|
|
88
111
|
constructor(message) {
|
89
112
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
90
113
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
91
|
-
super(
|
114
|
+
super(serializeAttrs({
|
115
|
+
message,
|
116
|
+
claim,
|
117
|
+
reason
|
118
|
+
}));
|
92
119
|
this.claim = claim;
|
93
120
|
this.reason = reason;
|
94
121
|
}
|
@@ -111,7 +138,11 @@ export class PidIssuingError extends IoWalletError {
|
|
111
138
|
constructor(message) {
|
112
139
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
113
140
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
114
|
-
super(
|
141
|
+
super(serializeAttrs({
|
142
|
+
message,
|
143
|
+
claim,
|
144
|
+
reason
|
145
|
+
}));
|
115
146
|
this.claim = claim;
|
116
147
|
this.reason = reason;
|
117
148
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","
|
1
|
+
{"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA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EAGAC,WAAWA,CAACgB,MAAyB,EAAE;IACrC,MAAMC,CAAC,GAAGxB,KAAK,CAACC,OAAO,CAACsB,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IACnD,MAAMf,OAAO,GAAI,yDAAwDgB,CAAC,CAACtB,IAAI,CAC7E,IACF,CAAE,EAAC;IACH,KAAK,CAACM,OAAO,CAAC;IACd,IAAI,CAACe,MAAM,GAAGC,CAAC;EACjB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAME,wCAAwC,SAASrB,KAAK,CAAC;EAClE,WAAWC,IAAIA,CAAA,EAAqC;IAClD,OAAO,gCAAgC;EACzC;EAEAA,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACoB,QAAgB,EAAE;IAC5B,MAAMnB,OAAO,GAAI,0DAAyDmB,QAAS,IAAG;IACtF,KAAK,CAACnB,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,gBAAgB,SAASvB,KAAK,CAAC;EAC1C,WAAWC,IAAIA,CAAA,EAAyB;IACtC,OAAO,oBAAoB;EAC7B;EAEAC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { IoWalletError } from "./errors";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Check if a response is in the expected status, other
|
5
|
+
* @param status The expected status
|
6
|
+
* @returns The given response object
|
7
|
+
*/
|
8
|
+
export const hasStatus = status => res => {
|
9
|
+
if (res.status !== status) {
|
10
|
+
throw new IoWalletError(`Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`);
|
11
|
+
}
|
12
|
+
return res;
|
13
|
+
};
|
14
|
+
|
15
|
+
// extract a type from an async function output
|
16
|
+
// helpful to bind the input of a function to the output of another
|
17
|
+
//# sourceMappingURL=misc.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["IoWalletError","hasStatus","status","res","url"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GACnBC,MAAc,IACdC,GAAa,IAAe;EAC3B,IAAIA,GAAG,CAACD,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAM,IAAIF,aAAa,CACpB,iCAAgCE,MAAO,SAAQC,GAAG,CAACD,MAAO,UAASC,GAAG,CAACC,GAAI,EAC9E,CAAC;EACH;EACA,OAAOD,GAAG;AACZ,CAAC;;AAEH;AACA"}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { sha256ToBase64, SignJWT } from "@pagopa/io-react-native-jwt";
|
2
|
+
import uuid from "react-native-uuid";
|
3
|
+
import * as z from "zod";
|
4
|
+
import * as WalletInstanceAttestation from "../wallet-instance-attestation";
|
5
|
+
import { hasStatus } from "./misc";
|
6
|
+
export const AuthorizationDetail = z.object({
|
7
|
+
credential_definition: z.object({
|
8
|
+
type: z.string()
|
9
|
+
}),
|
10
|
+
format: z.literal("vc+sd-jwt"),
|
11
|
+
type: z.literal("openid_credential")
|
12
|
+
});
|
13
|
+
export const AuthorizationDetails = z.array(AuthorizationDetail);
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Make a PAR request to the issuer and return the response url
|
17
|
+
*/
|
18
|
+
export const makeParRequest = _ref => {
|
19
|
+
let {
|
20
|
+
wiaCryptoContext,
|
21
|
+
appFetch = fetch
|
22
|
+
} = _ref;
|
23
|
+
return async (clientId, codeVerifier, walletProviderBaseUrl, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
|
24
|
+
const wiaPublicKey = await wiaCryptoContext.getPublicKey();
|
25
|
+
const parUrl = new URL(parEndpoint);
|
26
|
+
const aud = `${parUrl.protocol}//${parUrl.hostname}`;
|
27
|
+
const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
|
28
|
+
|
29
|
+
/** A code challenge is provided so that the PAR is bound
|
30
|
+
to the subsequent authorization code request
|
31
|
+
@see https://datatracker.ietf.org/doc/html/rfc9126#name-request */
|
32
|
+
const codeChallengeMethod = "s256";
|
33
|
+
const codeChallenge = await sha256ToBase64(codeVerifier);
|
34
|
+
|
35
|
+
/** The PAR request token is signed used the Wallet Instance Attestation key.
|
36
|
+
The signature can be verified by reading the public key from the key set shippet
|
37
|
+
with the it will ship the Wallet Instance Attestation.
|
38
|
+
The key is matched by its kid */
|
39
|
+
const signedJwtForPar = await new SignJWT(wiaCryptoContext).setProtectedHeader({
|
40
|
+
kid: wiaPublicKey.kid
|
41
|
+
}).setPayload({
|
42
|
+
iss,
|
43
|
+
aud,
|
44
|
+
jti: `${uuid.v4()}`,
|
45
|
+
client_assertion_type: assertionType,
|
46
|
+
authorization_details: authorizationDetails,
|
47
|
+
response_type: "code",
|
48
|
+
redirect_uri: walletProviderBaseUrl,
|
49
|
+
state: `${uuid.v4()}`,
|
50
|
+
client_id: clientId,
|
51
|
+
code_challenge_method: codeChallengeMethod,
|
52
|
+
code_challenge: codeChallenge
|
53
|
+
}).setIssuedAt().setExpirationTime("1h").sign();
|
54
|
+
|
55
|
+
/** The request body for the Pushed Authorization Request */
|
56
|
+
var formBody = new URLSearchParams({
|
57
|
+
response_type: "code",
|
58
|
+
client_id: clientId,
|
59
|
+
code_challenge: codeChallenge,
|
60
|
+
code_challenge_method: "S256",
|
61
|
+
client_assertion_type: assertionType,
|
62
|
+
client_assertion: walletInstanceAttestation,
|
63
|
+
request: signedJwtForPar
|
64
|
+
});
|
65
|
+
return await appFetch(parEndpoint, {
|
66
|
+
method: "POST",
|
67
|
+
headers: {
|
68
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
69
|
+
},
|
70
|
+
body: formBody.toString()
|
71
|
+
}).then(hasStatus(201)).then(res => res.json()).then(result => result.request_uri);
|
72
|
+
};
|
73
|
+
};
|
74
|
+
//# sourceMappingURL=par.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["sha256ToBase64","SignJWT","uuid","z","WalletInstanceAttestation","hasStatus","AuthorizationDetail","object","credential_definition","type","string","format","literal","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","fetch","clientId","codeVerifier","walletProviderBaseUrl","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","setPayload","jti","v4","client_assertion_type","authorization_details","response_type","redirect_uri","state","client_id","code_challenge_method","code_challenge","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","client_assertion","request","method","headers","body","toString","then","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;AAC3E,SAASC,SAAS,QAAQ,QAAQ;AAGlC,OAAO,MAAMC,mBAAmB,GAAGH,CAAC,CAACI,MAAM,CAAC;EAC1CC,qBAAqB,EAAEL,CAAC,CAACI,MAAM,CAAC;IAC9BE,IAAI,EAAEN,CAAC,CAACO,MAAM,CAAC;EACjB,CAAC,CAAC;EACFC,MAAM,EAAER,CAAC,CAACS,OAAO,CAAC,WAAW,CAAC;EAC9BH,IAAI,EAAEN,CAAC,CAACS,OAAO,CAAC,mBAAmB;AACrC,CAAC,CAAC;AAGF,OAAO,MAAMC,oBAAoB,GAAGV,CAAC,CAACW,KAAK,CAACR,mBAAmB,CAAC;;AAEhE;AACA;AACA;AACA,OAAO,MAAMS,cAAc,GACzBC,IAAA;EAAA,IAAC;IACCC,gBAAgB;IAChBC,QAAQ,GAAGC;EAIb,CAAC,GAAAH,IAAA;EAAA,OAC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C,eAAe,CAAC;MACjCV,aAAa,EAAE,MAAM;MACrBG,SAAS,EAAEhC,QAAQ;MACnBkC,cAAc,EAAEb,aAAa;MAC7BY,qBAAqB,EAAE,MAAM;MAC7BN,qBAAqB,EAAErB,aAAa;MACpCkC,gBAAgB,EAAEpC,yBAAyB;MAC3CqC,OAAO,EAAEnB;IACX,CAAC,CAAC;IAEF,OAAO,MAAMxB,QAAQ,CAACK,WAAW,EAAE;MACjCuC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEN,QAAQ,CAACO,QAAQ,CAAC;IAC1B,CAAC,CAAC,CACCC,IAAI,CAAC7D,SAAS,CAAC,GAAG,CAAC,CAAC,CACpB6D,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEG,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credential/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* The beginning of the issuing flow.
|
3
|
+
* To be implemented accordind to the user touchpoint
|
4
|
+
*
|
5
|
+
* @returns The type of the Credential to be issued and the url of the Issuer
|
6
|
+
*/
|
7
|
+
export type StartFlow = () => Promise<{
|
8
|
+
issuerUrl: string;
|
9
|
+
credentialType: string;
|
10
|
+
}>;
|
11
|
+
//# sourceMappingURL=01-start-flow.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"01-start-flow.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/01-start-flow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { CredentialIssuerEntityConfiguration } from "../../trust/types";
|
2
|
+
import type { StartFlow } from "./01-start-flow";
|
3
|
+
import type { Out } from "../../utils/misc";
|
4
|
+
export type EvaluateIssuerTrust = (issuerUrl: Out<StartFlow>["issuerUrl"], context?: {
|
5
|
+
appFetch?: GlobalFetch["fetch"];
|
6
|
+
}) => Promise<{
|
7
|
+
issuerConf: CredentialIssuerEntityConfiguration["payload"]["metadata"];
|
8
|
+
}>;
|
9
|
+
/**
|
10
|
+
* The Issuer trust evaluation phase.
|
11
|
+
* Fetch the Issuer's configuration and verify trust.
|
12
|
+
*
|
13
|
+
* @param issuerUrl The base url of the Issuer
|
14
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
15
|
+
* @returns The Issuer's configuration
|
16
|
+
*/
|
17
|
+
export declare const evaluateIssuerTrust: EvaluateIssuerTrust;
|
18
|
+
//# sourceMappingURL=02-evaluate-issuer-trust.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"02-evaluate-issuer-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/02-evaluate-issuer-trust.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EACtC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,UAAU,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;CACxE,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAQjC,CAAC"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import type { CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
|
+
import { type Out } from "../../utils/misc";
|
3
|
+
import type { StartFlow } from "./01-start-flow";
|
4
|
+
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
5
|
+
export type StartUserAuthorization = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], credentialType: Out<StartFlow>["credentialType"], context: {
|
6
|
+
wiaCryptoContext: CryptoContext;
|
7
|
+
walletInstanceAttestation: string;
|
8
|
+
walletProviderBaseUrl: string;
|
9
|
+
additionalParams?: Record<string, string>;
|
10
|
+
appFetch?: GlobalFetch["fetch"];
|
11
|
+
}) => Promise<{
|
12
|
+
requestUri: string;
|
13
|
+
clientId: string;
|
14
|
+
}>;
|
15
|
+
/**
|
16
|
+
* Start the User authorization phase.
|
17
|
+
* Perform the Pushed Authorization Request as defined in OAuth 2.0 protocol.
|
18
|
+
*
|
19
|
+
* @param issuerConf The Issuer configuration
|
20
|
+
* @param credentialType The type of the credential to be requested
|
21
|
+
* @param context.wiaCryptoContext The context to access the key associated with the Wallet Instance Attestation
|
22
|
+
* @param context.walletInstanceAttestation The Wallet Instance Attestation token
|
23
|
+
* @param context.walletProviderBaseUrl The base url of the Wallet Provider
|
24
|
+
* @param context.additionalParams Hash set of parameters to be passed to the authorization endpoint
|
25
|
+
* (used as a temporary fix until we have a proper User identity in the PID token provider)
|
26
|
+
* TODO: [SIW-630]
|
27
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
28
|
+
* @returns The request uri to continue the authorization to
|
29
|
+
*/
|
30
|
+
export declare const startUserAuthorization: StartUserAuthorization;
|
31
|
+
//# sourceMappingURL=03-start-user-authorization.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"03-start-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/03-start-user-authorization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AA4DtE,MAAM,MAAM,sBAAsB,GAAG,CACnC,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,EAChD,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBA2CpC,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { Out } from "../../utils/misc";
|
2
|
+
import type { StartUserAuthorization } from "./03-start-user-authorization";
|
3
|
+
/**
|
4
|
+
* The interface of the phase to complete User authorization.
|
5
|
+
* It may be implemented as a Credential presentation
|
6
|
+
* or with a strong User identification
|
7
|
+
*
|
8
|
+
* @param requestUri The url to reach to complete the user authorization.
|
9
|
+
* @param cliendId Identifies the current client across all the requests of the issuing flow
|
10
|
+
*
|
11
|
+
* @returns the access code to use to request the credental
|
12
|
+
*/
|
13
|
+
export type CompleteUserAuthorization = (requestUri: Out<StartUserAuthorization>["requestUri"], clientId: Out<StartUserAuthorization>["clientId"]) => Promise<{
|
14
|
+
code: string;
|
15
|
+
}>;
|
16
|
+
//# sourceMappingURL=04-complete-user-authorization.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,UAAU,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,YAAY,CAAC,EACrD,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,KAC9C,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { StartUserAuthorization } from "./03-start-user-authorization";
|
2
|
+
import { type Out } from "../../utils/misc";
|
3
|
+
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
4
|
+
import type { CompleteUserAuthorization } from "./04-complete-user-authorization";
|
5
|
+
export type AuthorizeAccess = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], code: Out<CompleteUserAuthorization>["code"], clientId: Out<StartUserAuthorization>["clientId"], context: {
|
6
|
+
walletInstanceAttestation: string;
|
7
|
+
walletProviderBaseUrl: string;
|
8
|
+
appFetch?: GlobalFetch["fetch"];
|
9
|
+
}) => Promise<{
|
10
|
+
accessToken: string;
|
11
|
+
nonce: string;
|
12
|
+
clientId: string;
|
13
|
+
}>;
|
14
|
+
/**
|
15
|
+
* Obtain the access token to finally request the credential
|
16
|
+
*
|
17
|
+
* @param issuerConf The Issuer configuration
|
18
|
+
* @param code The access code from the User authorization phase
|
19
|
+
* @param clientId Identifies the current client across all the requests of the issuing flow
|
20
|
+
* @param context.walletInstanceAttestation The Wallet Instance Attestation token
|
21
|
+
* @param context.walletProviderBaseUrl The base url of the Wallet Provider
|
22
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
23
|
+
* @returns
|
24
|
+
*/
|
25
|
+
export declare const authorizeAccess: AuthorizeAccess;
|
26
|
+
//# sourceMappingURL=05-authorize-access.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"05-authorize-access.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/05-authorize-access.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,IAAI,EAAE,GAAG,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,EAC5C,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,OAAO,EAAE;IACP,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IAEX,WAAW,EAAE,MAAM,CAAC;IAEpB,KAAK,EAAE,MAAM,CAAC;IAEd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,eAqD7B,CAAC"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
|
+
import type { StartFlow } from "./01-start-flow";
|
3
|
+
import { type Out } from "../../utils/misc";
|
4
|
+
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
5
|
+
import type { AuthorizeAccess } from "./05-authorize-access";
|
6
|
+
/**
|
7
|
+
* Return the signed jwt for nonce proof of possession
|
8
|
+
*/
|
9
|
+
export declare const createNonceProof: (nonce: string, issuer: string, audience: string, ctx: CryptoContext) => Promise<string>;
|
10
|
+
export type ObtainCredential = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], accessToken: Out<AuthorizeAccess>["accessToken"], nonce: Out<AuthorizeAccess>["nonce"], clientId: Out<AuthorizeAccess>["clientId"], credentialType: Out<StartFlow>["credentialType"], context: {
|
11
|
+
credentialCryptoContext: CryptoContext;
|
12
|
+
walletProviderBaseUrl: string;
|
13
|
+
appFetch?: GlobalFetch["fetch"];
|
14
|
+
}) => Promise<{
|
15
|
+
credential: string;
|
16
|
+
format: string;
|
17
|
+
}>;
|
18
|
+
/**
|
19
|
+
* Fetch a credential from the issuer
|
20
|
+
*
|
21
|
+
* @param issuerConf The Issuer configuration
|
22
|
+
* @param accessToken The access token to grant access to the credential, obtained with the access authorization step
|
23
|
+
* @param nonce The nonce value to prevent reply attacks, obtained with the access authorization step
|
24
|
+
* @param clientId Identifies the current client across all the requests of the issuing flow
|
25
|
+
* @param credentialType The type of the credential to be requested
|
26
|
+
* @param context.credentialCryptoContext The context to access the key the Credential will be bound to
|
27
|
+
* @param context.walletProviderBaseUrl The base url of the Wallet Provider
|
28
|
+
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
29
|
+
* @returns The signed credential token
|
30
|
+
*/
|
31
|
+
export declare const obtainCredential: ObtainCredential;
|
32
|
+
//# sourceMappingURL=06-obtain-credential.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"06-obtain-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/06-obtain-credential.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,UACpB,MAAM,UACL,MAAM,YACJ,MAAM,OACX,aAAa,KACjB,QAAQ,MAAM,CAchB,CAAC;AA4CF,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,WAAW,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,EAChD,KAAK,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EACpC,QAAQ,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC,EAC1C,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,EAChD,OAAO,EAAE;IACP,uBAAuB,EAAE,aAAa,CAAC;IACvC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAwE9B,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { ObtainCredential } from "./06-obtain-credential";
|
2
|
+
import type { Out } from "../../utils/misc";
|
3
|
+
/**
|
4
|
+
* The end of the issuing flow.
|
5
|
+
* The User accepted the Credential and it can be stored in the device according to the app implementation preferences.
|
6
|
+
* To be implemented.
|
7
|
+
*
|
8
|
+
* @returns The type of the Credential to be issued and the url of the Issuer
|
9
|
+
*/
|
10
|
+
export type ConfirmCredential = (credential: Out<ObtainCredential>["credential"], format: Out<ObtainCredential>["format"]) => Promise<void>;
|
11
|
+
//# sourceMappingURL=07-confirm-credential.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"07-confirm-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/07-confirm-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,EAC/C,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,KACpC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|