@pagopa/io-react-native-wallet 0.7.4 → 0.9.0
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/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/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/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/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
@@ -1,168 +0,0 @@
|
|
1
|
-
import { RelyingPartyEntityConfiguration } from "../../trust/types";
|
2
|
-
import * as RelyingPartySolution from "..";
|
3
|
-
import { AuthRequestDecodeError } from "../../utils/errors";
|
4
|
-
describe("decodeAuthRequestQR", () => {
|
5
|
-
it("should return authentication request URL", async () => {
|
6
|
-
const qrcode = "ZXVkaXc6Ly9hdXRob3JpemU/Y2xpZW50X2lkPWh0dHBzOi8vdmVyaWZpZXIuZXhhbXBsZS5vcmcmcmVxdWVzdF91cmk9aHR0cHM6Ly92ZXJpZmllci5leGFtcGxlLm9yZy9yZXF1ZXN0X3VyaQ==";
|
7
|
-
const result = RelyingPartySolution.decodeAuthRequestQR(qrcode);
|
8
|
-
expect(result.requestURI).toEqual("https://verifier.example.org/request_uri");
|
9
|
-
});
|
10
|
-
it("should throw exception with invalid QR", async () => {
|
11
|
-
const qrcode = "aHR0cDovL2dvb2dsZS5pdA==";
|
12
|
-
expect(() => RelyingPartySolution.decodeAuthRequestQR(qrcode)).toThrowError(AuthRequestDecodeError);
|
13
|
-
});
|
14
|
-
});
|
15
|
-
describe("RpEntityConfiguration", () => {
|
16
|
-
it("should parse a valid conf", async () => {
|
17
|
-
const pp = {
|
18
|
-
header: {
|
19
|
-
alg: "RS256",
|
20
|
-
kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
|
21
|
-
typ: "entity-statement+jwt"
|
22
|
-
},
|
23
|
-
payload: {
|
24
|
-
exp: 1692625747,
|
25
|
-
iat: 1692625387,
|
26
|
-
iss: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
|
27
|
-
sub: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
|
28
|
-
jwks: {
|
29
|
-
keys: [{
|
30
|
-
kty: "RSA",
|
31
|
-
kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
|
32
|
-
e: "AQAB",
|
33
|
-
n: "utqtxbs-jnK0cPsV7aRkkZKA9t4S-WSZa3nCZtYIKDpgLnR_qcpeF0diJZvKOqXmj2cXaKFUE-8uHKAHo7BL7T-Rj2x3vGESh7SG1pE0thDGlXj4yNsg0qNvCXtk703L2H3i1UXwx6nq1uFxD2EcOE4a6qDYBI16Zl71TUZktJwmOejoHl16CPWqDLGo9GUSk_MmHOV20m4wXWkB4qbvpWVY8H6b2a0rB1B1YPOs5ZLYarSYZgjDEg6DMtZ4NgiwZ-4N1aaLwyO-GLwt9Vf-NBKwoxeRyD3zWE2FXRFBbhKGksMrCGnFDsNl5JTlPjaM3kYyImE941ggcuc495m-Fw"
|
34
|
-
}]
|
35
|
-
},
|
36
|
-
metadata: {
|
37
|
-
federation_entity: {
|
38
|
-
organization_name: "wallet-provider",
|
39
|
-
homepage_uri: "https://wallet-provider.example",
|
40
|
-
policy_uri: "https://wallet-provider.example",
|
41
|
-
logo_uri: "https://wallet-provider.example",
|
42
|
-
contacts: ["https://wallet-provider.example"]
|
43
|
-
},
|
44
|
-
wallet_relying_party: {
|
45
|
-
application_type: "web",
|
46
|
-
authorization_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
|
47
|
-
authorization_encrypted_response_enc: ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"],
|
48
|
-
authorization_signed_response_alg: ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512"],
|
49
|
-
client_id: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
|
50
|
-
client_name: "Name of an example organization",
|
51
|
-
contacts: ["ops@verifier.example.org"],
|
52
|
-
default_acr_values: ["https://www.spid.gov.it/SpidL2", "https://www.spid.gov.it/SpidL3"],
|
53
|
-
default_max_age: 1111,
|
54
|
-
id_token_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
|
55
|
-
id_token_encrypted_response_enc: ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"],
|
56
|
-
id_token_signed_response_alg: ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512"],
|
57
|
-
presentation_definitions: [{
|
58
|
-
id: "pid-sd-jwt:unique_id+given_name+family_name",
|
59
|
-
input_descriptors: [{
|
60
|
-
id: "pid-sd-jwt:unique_id+given_name+family_name",
|
61
|
-
format: {
|
62
|
-
constraints: {
|
63
|
-
fields: [{
|
64
|
-
filter: {
|
65
|
-
const: "PersonIdentificationData",
|
66
|
-
type: "string"
|
67
|
-
},
|
68
|
-
path: ["$.sd-jwt.type"]
|
69
|
-
}, {
|
70
|
-
filter: {
|
71
|
-
type: "object"
|
72
|
-
},
|
73
|
-
path: ["$.sd-jwt.cnf"]
|
74
|
-
}, {
|
75
|
-
intent_to_retain: "true",
|
76
|
-
path: ["$.sd-jwt.family_name"]
|
77
|
-
}, {
|
78
|
-
intent_to_retain: "true",
|
79
|
-
path: ["$.sd-jwt.given_name"]
|
80
|
-
}, {
|
81
|
-
intent_to_retain: "true",
|
82
|
-
path: ["$.sd-jwt.unique_id"]
|
83
|
-
}],
|
84
|
-
limit_disclosure: "required"
|
85
|
-
},
|
86
|
-
jwt: {
|
87
|
-
alg: ["EdDSA", "ES256"]
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}]
|
91
|
-
}, {
|
92
|
-
id: "mDL-sample-req",
|
93
|
-
input_descriptors: [{
|
94
|
-
format: {
|
95
|
-
constraints: {
|
96
|
-
fields: [{
|
97
|
-
filter: {
|
98
|
-
const: "org.iso.18013.5.1.mDL",
|
99
|
-
type: "string"
|
100
|
-
},
|
101
|
-
path: ["$.mdoc.doctype"]
|
102
|
-
}, {
|
103
|
-
filter: {
|
104
|
-
const: "org.iso.18013.5.1",
|
105
|
-
type: "string"
|
106
|
-
},
|
107
|
-
path: ["$.mdoc.namespace"]
|
108
|
-
}, {
|
109
|
-
intent_to_retain: "false",
|
110
|
-
path: ["$.mdoc.family_name"]
|
111
|
-
}, {
|
112
|
-
intent_to_retain: "false",
|
113
|
-
path: ["$.mdoc.portrait"]
|
114
|
-
}, {
|
115
|
-
intent_to_retain: "false",
|
116
|
-
path: ["$.mdoc.driving_privileges"]
|
117
|
-
}],
|
118
|
-
limit_disclosure: "required"
|
119
|
-
},
|
120
|
-
mso_mdoc: {
|
121
|
-
alg: ["EdDSA", "ES256"]
|
122
|
-
}
|
123
|
-
},
|
124
|
-
id: "mDL"
|
125
|
-
}]
|
126
|
-
}],
|
127
|
-
redirect_uris: ["https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP/redirect-uri"],
|
128
|
-
request_uris: ["https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP/request-uri"],
|
129
|
-
require_auth_time: true,
|
130
|
-
subject_type: "pairwise",
|
131
|
-
vp_formats: {
|
132
|
-
jwt_vp_json: {
|
133
|
-
alg: ["EdDSA", "ES256K"]
|
134
|
-
}
|
135
|
-
},
|
136
|
-
jwks: {
|
137
|
-
keys: [{
|
138
|
-
crv: "P-256",
|
139
|
-
d: "KzQBowMMoPmSZe7G8QsdEWc1IvR2nsgE8qTOYmMcLtc",
|
140
|
-
kid: "dDwPWXz5sCtczj7CJbqgPGJ2qQ83gZ9Sfs-tJyULi6s",
|
141
|
-
use: "sig",
|
142
|
-
kty: "EC",
|
143
|
-
x: "TSO-KOqdnUj5SUuasdlRB2VVFSqtJOxuR5GftUTuBdk",
|
144
|
-
y: "ByWgQt1wGBSnF56jQqLdoO1xKUynMY-BHIDB3eXlR7"
|
145
|
-
}, {
|
146
|
-
kty: "RSA",
|
147
|
-
d: "QUZsh1NqvpueootsdSjFQz-BUvxwd3Qnzm5qNb-WeOsvt3rWMEv0Q8CZrla2tndHTJhwioo1U4NuQey7znijhZ177bUwPPxSW1r68dEnL2U74nKwwoYeeMdEXnUfZSPxzs7nY6b7vtyCoA-AjiVYFOlgKNAItspv1HxeyGCLhLYhKvS_YoTdAeLuegETU5D6K1xGQIuw0nS13Icjz79Y8jC10TX4FdZwdX-NmuIEDP5-s95V9DMENtVqJAVE3L-wO-NdDilyjyOmAbntgsCzYVGH9U3W_djh4t3qVFCv3r0S-DA2FD3THvlrFi655L0QHR3gu_Fbj3b9Ybtajpue_Q",
|
148
|
-
e: "AQAB",
|
149
|
-
use: "enc",
|
150
|
-
kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
|
151
|
-
n: "utqtxbs-jnK0cPsV7aRkkZKA9t4S-WSZa3nCZtYIKDpgLnR_qcpeF0diJZvKOqXmj2cXaKFUE-8uHKAHo7BL7T-Rj2x3vGESh7SG1pE0thDGlXj4yNsg0qNvCXtk703L2H3i1UXwx6nq1uFxD2EcOE4a6qDYBI16Zl71TUZktJwmOejoHl16CPWqDLGo9GUSk_MmHOV20m4wXWkB4qbvpWVY8H6b2a0rB1B1YPOs5ZLYarSYZgjDEg6DMtZ4NgiwZ-4N1aaLwyO-GLwt9Vf-NBKwoxeRyD3zWE2FXRFBbhKGksMrCGnFDsNl5JTlPjaM3kYyImE941ggcuc495m-Fw",
|
152
|
-
p: "2zmGXIMCEHPphw778YjVTar1eycih6fFSJ4I4bl1iq167GqO0PjlOx6CZ1-OdBTVU7HfrYRiUK_BnGRdPDn-DQghwwkB79ZdHWL14wXnpB5y-boHz_LxvjsEqXtuQYcIkidOGaMG68XNT1nM4F9a8UKFr5hHYT5_UIQSwsxlRQ0",
|
153
|
-
q: "2jMFt2iFrdaYabdXuB4QMboVjPvbLA-IVb6_0hSG_-EueGBvgcBxdFGIZaG6kqHqlB7qMsSzdptU0vn6IgmCZnX-Hlt6c5X7JB_q91PZMLTO01pbZ2Bk58GloalCHnw_mjPh0YPviH5jGoWM5RHyl_HDDMI-UeLkzP7ImxGizrM"
|
154
|
-
}]
|
155
|
-
}
|
156
|
-
}
|
157
|
-
},
|
158
|
-
authority_hints: ["https://demo.federation.eudi.wallet.developers.italia.it"]
|
159
|
-
}
|
160
|
-
};
|
161
|
-
const result = RelyingPartyEntityConfiguration.safeParse(pp);
|
162
|
-
if (result.success === false) {
|
163
|
-
throw result.error;
|
164
|
-
}
|
165
|
-
expect(result.success).toBe(true);
|
166
|
-
});
|
167
|
-
});
|
168
|
-
//# sourceMappingURL=index.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["RelyingPartyEntityConfiguration","RelyingPartySolution","AuthRequestDecodeError","describe","it","qrcode","result","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError","pp","header","alg","kid","typ","payload","exp","iat","iss","sub","jwks","keys","kty","e","n","metadata","federation_entity","organization_name","homepage_uri","policy_uri","logo_uri","contacts","wallet_relying_party","application_type","authorization_encrypted_response_alg","authorization_encrypted_response_enc","authorization_signed_response_alg","client_id","client_name","default_acr_values","default_max_age","id_token_encrypted_response_alg","id_token_encrypted_response_enc","id_token_signed_response_alg","presentation_definitions","id","input_descriptors","format","constraints","fields","filter","const","type","path","intent_to_retain","limit_disclosure","jwt","mso_mdoc","redirect_uris","request_uris","require_auth_time","subject_type","vp_formats","jwt_vp_json","crv","d","use","x","y","p","q","authority_hints","safeParse","success","error","toBe"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":"AAAA,SAASA,+BAA+B,QAAQ,mBAAmB;AACnE,OAAO,KAAKC,oBAAoB,MAAM,IAAI;AAC1C,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3DC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGL,oBAAoB,CAACM,mBAAmB,CAACF,MAAM,CAAC;IAC/DG,MAAM,CAACF,MAAM,CAACG,UAAU,CAAC,CAACC,OAAO,CAC/B,0CACF,CAAC;EACH,CAAC,CAAC;EACFN,EAAE,CAAC,wCAAwC,EAAE,YAAY;IACvD,MAAMC,MAAM,GAAG,0BAA0B;IACzCG,MAAM,CAAC,MAAMP,oBAAoB,CAACM,mBAAmB,CAACF,MAAM,CAAC,CAAC,CAACM,YAAY,CACzET,sBACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC;AA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CAAC,EAAE,wVAAwV;gBAC3V6C,CAAC,EAAE,6KAA6K;gBAChLC,CAAC,EAAE;cACL,CAAC;YAEL;UACF;QACF,CAAC;QACDC,eAAe,EAAE,CACf,0DAA0D;MAE9D;IACF,CAAC;IACD,MAAMnE,MAAM,GAAGN,+BAA+B,CAAC0E,SAAS,CAAC9D,EAAE,CAAC;IAC5D,IAAIN,MAAM,CAACqE,OAAO,KAAK,KAAK,EAAE;MAC5B,MAAMrE,MAAM,CAACsE,KAAK;IACpB;IACApE,MAAM,CAACF,MAAM,CAACqE,OAAO,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;EACnC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/module/rp/index.js
DELETED
@@ -1,228 +0,0 @@
|
|
1
|
-
import { AuthRequestDecodeError, IoWalletError, NoSuitableKeysFoundInEntityConfiguration } from "../utils/errors";
|
2
|
-
import { decode as decodeJwt, decodeBase64, sha256ToBase64, SignJWT, EncryptJwe, verify } from "@pagopa/io-react-native-jwt";
|
3
|
-
import { QRCodePayload, RequestObject } from "./types";
|
4
|
-
import uuid from "react-native-uuid";
|
5
|
-
import { disclose } from "../sd-jwt";
|
6
|
-
import { createDPopToken } from "../utils/dpop";
|
7
|
-
import * as WalletInstanceAttestation from "../wallet-instance-attestation";
|
8
|
-
|
9
|
-
/**
|
10
|
-
* Select a RSA public key from those provided by the RP to encrypt.
|
11
|
-
*
|
12
|
-
* @param entity The RP entity configuration
|
13
|
-
* @returns A suitable public key with its compatible encryption algorithm
|
14
|
-
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
|
15
|
-
*/
|
16
|
-
const chooseRSAPublicKeyToEncrypt = entity => {
|
17
|
-
const [usingRsa256] = entity.payload.metadata.wallet_relying_party.jwks.keys.filter(jwk => jwk.use === "enc" && jwk.kty === "RSA");
|
18
|
-
if (usingRsa256) {
|
19
|
-
return usingRsa256;
|
20
|
-
}
|
21
|
-
|
22
|
-
// No suitable key has been found
|
23
|
-
throw new NoSuitableKeysFoundInEntityConfiguration("Encrypt with RP public key");
|
24
|
-
};
|
25
|
-
|
26
|
-
/**
|
27
|
-
* Decode a QR code content to an authentication request url.
|
28
|
-
* @function
|
29
|
-
* @param qrcode QR code content
|
30
|
-
*
|
31
|
-
* @returns The authentication request url
|
32
|
-
*
|
33
|
-
*/
|
34
|
-
export const decodeAuthRequestQR = qrcode => {
|
35
|
-
const decoded = decodeBase64(qrcode);
|
36
|
-
const decodedUrl = new URL(decoded);
|
37
|
-
const protocol = decodedUrl.protocol;
|
38
|
-
const resource = decodedUrl.hostname;
|
39
|
-
const requestURI = decodedUrl.searchParams.get("request_uri");
|
40
|
-
const clientId = decodedUrl.searchParams.get("client_id");
|
41
|
-
const result = QRCodePayload.safeParse({
|
42
|
-
protocol,
|
43
|
-
resource,
|
44
|
-
requestURI,
|
45
|
-
clientId
|
46
|
-
});
|
47
|
-
if (result.success) {
|
48
|
-
return result.data;
|
49
|
-
} else {
|
50
|
-
throw new AuthRequestDecodeError(result.error.message, `${decodedUrl}`);
|
51
|
-
}
|
52
|
-
};
|
53
|
-
/**
|
54
|
-
* Obtain the Request Object for RP authentication
|
55
|
-
* @see https://italia.github.io/eudi-wallet-it-docs/versione-corrente/en/relying-party-solution.html
|
56
|
-
*/
|
57
|
-
export const getRequestObject = _ref => {
|
58
|
-
let {
|
59
|
-
wiaCryptoContext,
|
60
|
-
appFetch = fetch
|
61
|
-
} = _ref;
|
62
|
-
return async (walletInstanceAttestation, requestUri, rpEntityConfiguration) => {
|
63
|
-
const signedWalletInstanceDPoP = await createDPopToken({
|
64
|
-
jti: `${uuid.v4()}`,
|
65
|
-
htm: "GET",
|
66
|
-
htu: requestUri,
|
67
|
-
ath: await sha256ToBase64(walletInstanceAttestation)
|
68
|
-
}, wiaCryptoContext);
|
69
|
-
const response = await appFetch(requestUri, {
|
70
|
-
method: "GET",
|
71
|
-
headers: {
|
72
|
-
Authorization: `DPoP ${walletInstanceAttestation}`,
|
73
|
-
DPoP: signedWalletInstanceDPoP
|
74
|
-
}
|
75
|
-
});
|
76
|
-
if (response.status === 200) {
|
77
|
-
const responseJson = await response.json();
|
78
|
-
const responseEncodedJwt = responseJson.response;
|
79
|
-
const responseJwt = decodeJwt(responseEncodedJwt);
|
80
|
-
|
81
|
-
// verify token signature according to RP's entity configuration
|
82
|
-
// to ensure the request object is authentic
|
83
|
-
{
|
84
|
-
const pubKey = rpEntityConfiguration.payload.metadata.wallet_relying_party.jwks.keys.find(_ref2 => {
|
85
|
-
let {
|
86
|
-
kid
|
87
|
-
} = _ref2;
|
88
|
-
return kid === responseJwt.protectedHeader.kid;
|
89
|
-
});
|
90
|
-
if (!pubKey) {
|
91
|
-
throw new NoSuitableKeysFoundInEntityConfiguration("Request Object signature verification");
|
92
|
-
}
|
93
|
-
await verify(responseEncodedJwt, pubKey);
|
94
|
-
}
|
95
|
-
|
96
|
-
// parse request object it has the expected shape by specification
|
97
|
-
const requestObject = RequestObject.parse({
|
98
|
-
header: responseJwt.protectedHeader,
|
99
|
-
payload: responseJwt.payload
|
100
|
-
});
|
101
|
-
return {
|
102
|
-
requestObject,
|
103
|
-
rpEntityConfiguration,
|
104
|
-
walletInstanceAttestation
|
105
|
-
};
|
106
|
-
}
|
107
|
-
throw new IoWalletError(`Unable to obtain Request Object. Response code: ${response.status}
|
108
|
-
${await response.text()}`);
|
109
|
-
};
|
110
|
-
};
|
111
|
-
|
112
|
-
/**
|
113
|
-
* Prepare the Verified Presentation token for a received request object in the context of an authorization request flow.
|
114
|
-
* The presentation is prepared by disclosing data from provided credentials, according to requested claims
|
115
|
-
* Each Verified Credential come along with the claims the user accepts to disclose from it.
|
116
|
-
*
|
117
|
-
* @todo accept more than a Verified Credential
|
118
|
-
*/
|
119
|
-
const prepareVpToken = _ref3 => {
|
120
|
-
let {
|
121
|
-
pidCryptoContext
|
122
|
-
} = _ref3;
|
123
|
-
return async (_ref4, _ref5) => {
|
124
|
-
let {
|
125
|
-
requestObject,
|
126
|
-
walletInstanceAttestation
|
127
|
-
} = _ref4;
|
128
|
-
let [vc, claims] = _ref5;
|
129
|
-
// this throws if vc cannot satisfy all the requested claims
|
130
|
-
const {
|
131
|
-
token: vp,
|
132
|
-
paths
|
133
|
-
} = await disclose(vc, claims);
|
134
|
-
|
135
|
-
// obtain issuer from Wallet Instance
|
136
|
-
const {
|
137
|
-
payload: {
|
138
|
-
iss
|
139
|
-
}
|
140
|
-
} = WalletInstanceAttestation.decode(walletInstanceAttestation);
|
141
|
-
const pidKid = await pidCryptoContext.getPublicKey().then(_ => _.kid);
|
142
|
-
|
143
|
-
// TODO: [SIW-359] check all requeste claims of the requestedObj are satisfied
|
144
|
-
const vp_token = await new SignJWT(pidCryptoContext).setProtectedHeader({
|
145
|
-
typ: "JWT",
|
146
|
-
kid: pidKid
|
147
|
-
}).setPayload({
|
148
|
-
vp: vp,
|
149
|
-
jti: `${uuid.v4()}`,
|
150
|
-
iss,
|
151
|
-
nonce: requestObject.payload.nonce
|
152
|
-
}).setAudience(requestObject.payload.response_uri).setIssuedAt().setExpirationTime("1h").sign();
|
153
|
-
const vc_scope = requestObject.payload.scope;
|
154
|
-
const presentation_submission = {
|
155
|
-
definition_id: `${uuid.v4()}`,
|
156
|
-
id: `${uuid.v4()}`,
|
157
|
-
descriptor_map: paths.map(p => ({
|
158
|
-
id: vc_scope,
|
159
|
-
path: `$.vp_token.${p.path}`,
|
160
|
-
format: "vc+sd-jwt"
|
161
|
-
}))
|
162
|
-
};
|
163
|
-
return {
|
164
|
-
vp_token,
|
165
|
-
presentation_submission
|
166
|
-
};
|
167
|
-
};
|
168
|
-
};
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Compose and send an Authorization Response in the context of an authorization request flow.
|
172
|
-
*
|
173
|
-
* @todo MUST add presentation_submission
|
174
|
-
*
|
175
|
-
*/
|
176
|
-
export const sendAuthorizationResponse = _ref6 => {
|
177
|
-
let {
|
178
|
-
pidCryptoContext,
|
179
|
-
appFetch = fetch
|
180
|
-
} = _ref6;
|
181
|
-
return async (_ref7, presentation) => {
|
182
|
-
let {
|
183
|
-
requestObject,
|
184
|
-
rpEntityConfiguration,
|
185
|
-
walletInstanceAttestation
|
186
|
-
} = _ref7;
|
187
|
-
// the request is an unsigned jws without iss, aud, exp
|
188
|
-
// https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-signed-and-encrypted-respon
|
189
|
-
const jwk = chooseRSAPublicKeyToEncrypt(rpEntityConfiguration);
|
190
|
-
const {
|
191
|
-
vp_token,
|
192
|
-
presentation_submission
|
193
|
-
} = await prepareVpToken({
|
194
|
-
pidCryptoContext
|
195
|
-
})({
|
196
|
-
requestObject,
|
197
|
-
rpEntityConfiguration,
|
198
|
-
walletInstanceAttestation
|
199
|
-
}, presentation);
|
200
|
-
const authzResponsePayload = JSON.stringify({
|
201
|
-
state: requestObject.payload.state,
|
202
|
-
presentation_submission,
|
203
|
-
nonce: requestObject.payload.nonce,
|
204
|
-
vp_token
|
205
|
-
});
|
206
|
-
const encrypted = await new EncryptJwe(authzResponsePayload, {
|
207
|
-
alg: "RSA-OAEP-256",
|
208
|
-
enc: "A256CBC-HS512",
|
209
|
-
kid: jwk.kid
|
210
|
-
}).encrypt(jwk);
|
211
|
-
const formBody = new URLSearchParams({
|
212
|
-
response: encrypted
|
213
|
-
});
|
214
|
-
const body = formBody.toString();
|
215
|
-
const response = await appFetch(requestObject.payload.response_uri, {
|
216
|
-
method: "POST",
|
217
|
-
headers: {
|
218
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
219
|
-
},
|
220
|
-
body
|
221
|
-
});
|
222
|
-
if (response.status === 200) {
|
223
|
-
return await response.json();
|
224
|
-
}
|
225
|
-
throw new IoWalletError(`Unable to send Authorization Response. Response: ${await response.text()} with code: ${response.status}`);
|
226
|
-
};
|
227
|
-
};
|
228
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AuthRequestDecodeError","IoWalletError","NoSuitableKeysFoundInEntityConfiguration","decode","decodeJwt","decodeBase64","sha256ToBase64","SignJWT","EncryptJwe","verify","QRCodePayload","RequestObject","uuid","disclose","createDPopToken","WalletInstanceAttestation","chooseRSAPublicKeyToEncrypt","entity","usingRsa256","payload","metadata","wallet_relying_party","jwks","keys","filter","jwk","use","kty","decodeAuthRequestQR","qrcode","decoded","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","safeParse","success","data","error","message","getRequestObject","_ref","wiaCryptoContext","appFetch","fetch","walletInstanceAttestation","requestUri","rpEntityConfiguration","signedWalletInstanceDPoP","jti","v4","htm","htu","ath","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","pubKey","find","_ref2","kid","protectedHeader","requestObject","parse","header","text","prepareVpToken","_ref3","pidCryptoContext","_ref4","_ref5","vc","claims","token","vp","paths","iss","pidKid","getPublicKey","then","_","vp_token","setProtectedHeader","typ","setPayload","nonce","setAudience","response_uri","setIssuedAt","setExpirationTime","sign","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","_ref6","_ref7","presentation","authzResponsePayload","JSON","stringify","state","encrypted","alg","enc","encrypt","formBody","URLSearchParams","body","toString"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,aAAa,EACbC,wCAAwC,QACnC,iBAAiB;AACxB,SACEC,MAAM,IAAIC,SAAS,EACnBC,YAAY,EACZC,cAAc,EACdC,OAAO,EACPC,UAAU,EACVC,MAAM,QAED,6BAA6B;AACpC,SAASC,aAAa,EAAEC,aAAa,QAA2B,SAAS;AAEzE,OAAOC,IAAI,MAAM,mBAAmB;AAEpC,SAASC,QAAQ,QAAQ,WAAW;AACpC,SAASC,eAAe,QAAQ,eAAe;AAE/C,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAC/BC,MA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MAClCf,uBAAuB;MACvBR,KAAK,EAAEvB,aAAa,CAACxD,OAAO,CAAC+E,KAAK;MAClCJ;IACF,CAAC,CAAC;IAEF,MAAM4B,SAAS,GAAG,MAAM,IAAIlH,UAAU,CAAC8G,oBAAoB,EAAE;MAC3DK,GAAG,EAAE,cAAc;MACnBC,GAAG,EAAE,eAAe;MACpBnD,GAAG,EAAEhD,GAAG,CAACgD;IACX,CAAC,CAAC,CAACoD,OAAO,CAACpG,GAAG,CAAC;IAEf,MAAMqG,QAAQ,GAAG,IAAIC,eAAe,CAAC;MAAEnE,QAAQ,EAAE8D;IAAU,CAAC,CAAC;IAC7D,MAAMM,IAAI,GAAGF,QAAQ,CAACG,QAAQ,CAAC,CAAC;IAEhC,MAAMrE,QAAQ,GAAG,MAAMX,QAAQ,CAAC0B,aAAa,CAACxD,OAAO,CAACiF,YAAY,EAAE;MAClEvC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDkE;IACF,CAAC,CAAC;IAEF,IAAIpE,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,OAAO,MAAML,QAAQ,CAACO,IAAI,CAAC,CAAC;IAC9B;IAEA,MAAM,IAAIlE,aAAa,CACpB,oDAAmD,MAAM2D,QAAQ,CAACkB,IAAI,CAAC,CAAE,eACxElB,QAAQ,CAACK,MACV,EACH,CAAC;EACH,CAAC;AAAA"}
|
package/lib/module/rp/types.js
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
import { UnixTime } from "../sd-jwt/types";
|
2
|
-
import * as z from "zod";
|
3
|
-
export const RequestObject = z.object({
|
4
|
-
header: z.object({
|
5
|
-
// FIXME: SIW-421 type field must be either required or omitted, optional isn't useful
|
6
|
-
typ: z.literal("JWT").optional(),
|
7
|
-
alg: z.string(),
|
8
|
-
kid: z.string(),
|
9
|
-
trust_chain: z.array(z.string())
|
10
|
-
}),
|
11
|
-
payload: z.object({
|
12
|
-
iss: z.string(),
|
13
|
-
iat: UnixTime,
|
14
|
-
exp: UnixTime,
|
15
|
-
state: z.string(),
|
16
|
-
nonce: z.string(),
|
17
|
-
response_uri: z.string(),
|
18
|
-
response_type: z.literal("vp_token"),
|
19
|
-
response_mode: z.literal("direct_post.jwt"),
|
20
|
-
client_id: z.string(),
|
21
|
-
client_id_scheme: z.literal("entity_id"),
|
22
|
-
scope: z.string()
|
23
|
-
})
|
24
|
-
});
|
25
|
-
export const QRCodePayload = z.object({
|
26
|
-
protocol: z.string(),
|
27
|
-
resource: z.string(),
|
28
|
-
// TODO: refine to known paths using literals
|
29
|
-
clientId: z.string(),
|
30
|
-
requestURI: z.string()
|
31
|
-
});
|
32
|
-
|
33
|
-
/**
|
34
|
-
* A pair that associate a tokenized Verified Credential with the claims presented or requested to present.
|
35
|
-
*/
|
36
|
-
//# sourceMappingURL=types.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["UnixTime","z","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,CAAC,MAAM,KAAK;AAGxB,OAAO,MAAMC,aAAa,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,MAAM,EAAEH,CAAC,CAACE,MAAM,CAAC;IACf;IACAE,GAAG,EAAEJ,CAAC,CAACK,OAAO,CAAC,KAAK,CAAC,CAACC,QAAQ,CAAC,CAAC;IAChCC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfC,GAAG,EAAET,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfE,WAAW,EAAEV,CAAC,CAACW,KAAK,CAACX,CAAC,CAACQ,MAAM,CAAC,CAAC;EACjC,CAAC,CAAC;EACFI,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,GAAG,EAAEb,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEf,QAAQ;IACbgB,GAAG,EAAEhB,QAAQ;IACbiB,KAAK,EAAEhB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACjBS,KAAK,EAAEjB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACjBU,YAAY,EAAElB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACxBW,aAAa,EAAEnB,CAAC,CAACK,OAAO,CAAC,UAAU,CAAC;IACpCe,aAAa,EAAEpB,CAAC,CAACK,OAAO,CAAC,iBAAiB,CAAC;IAC3CgB,SAAS,EAAErB,CAAC,CAACQ,MAAM,CAAC,CAAC;IACrBc,gBAAgB,EAAEtB,CAAC,CAACK,OAAO,CAAC,WAAW,CAAC;IACxCkB,KAAK,EAAEvB,CAAC,CAACQ,MAAM,CAAC;EAClB,CAAC;AACH,CAAC,CAAC;AAGF,OAAO,MAAMgB,aAAa,GAAGxB,CAAC,CAACE,MAAM,CAAC;EACpCuB,QAAQ,EAAEzB,CAAC,CAACQ,MAAM,CAAC,CAAC;EACpBkB,QAAQ,EAAE1B,CAAC,CAACQ,MAAM,CAAC,CAAC;EAAE;EACtBmB,QAAQ,EAAE3B,CAAC,CAACQ,MAAM,CAAC,CAAC;EACpBoB,UAAU,EAAE5B,CAAC,CAACQ,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA"}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
/// <reference types="react-native" />
|
2
|
-
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
3
|
-
import { CredentialIssuerEntityConfiguration } from "../trust/types";
|
4
|
-
export type CieData = {
|
5
|
-
birthDate: string;
|
6
|
-
fiscalCode: string;
|
7
|
-
name: string;
|
8
|
-
surname: string;
|
9
|
-
};
|
10
|
-
export type AuthorizationConf = {
|
11
|
-
accessToken: string;
|
12
|
-
nonce: string;
|
13
|
-
clientId: string;
|
14
|
-
authorizationCode: string;
|
15
|
-
codeVerifier: string;
|
16
|
-
walletProviderBaseUrl: string;
|
17
|
-
};
|
18
|
-
export type PidResponse = {
|
19
|
-
credential: string;
|
20
|
-
c_nonce: string;
|
21
|
-
c_nonce_expires_in: number;
|
22
|
-
format: string;
|
23
|
-
};
|
24
|
-
/**
|
25
|
-
* Start the issuing flow by generating an authorization request to the PID Provider. Obtain from the PID Provider an access token to be used to complete the issuing flow.
|
26
|
-
*
|
27
|
-
* @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
28
|
-
* @param params.appFetch (optional) Http client
|
29
|
-
* @param walletInstanceAttestation Wallet Instance Attestation token.
|
30
|
-
* @param walletProviderBaseUrl Base url for the Wallet Provider.
|
31
|
-
* @param pidProviderEntityConfiguration The Entity Configuration of the PID Provider, from which discover public endooints.
|
32
|
-
* @param cieData Data red from the CIE login process
|
33
|
-
* @returns The access token along with the values that identify the issuing session.
|
34
|
-
*/
|
35
|
-
export declare const authorizeIssuing: ({ wiaCryptoContext, appFetch, }: {
|
36
|
-
wiaCryptoContext: CryptoContext;
|
37
|
-
appFetch?: {
|
38
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
39
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
40
|
-
} | undefined;
|
41
|
-
}) => (walletInstanceAttestation: string, walletProviderBaseUrl: string, pidProviderEntityConfiguration: CredentialIssuerEntityConfiguration, cieData: CieData) => Promise<AuthorizationConf>;
|
42
|
-
/**
|
43
|
-
* Complete the issuing flow and get the PID credential.
|
44
|
-
*
|
45
|
-
* @param params.pidCryptoContext The key pair associated with the PID. Will be use to prove the ownership of the credential.
|
46
|
-
* @param params.appFetch (optional) Http client
|
47
|
-
* @param authConf The authorization configuration retrieved with the access token
|
48
|
-
* @returns The PID credential token
|
49
|
-
*/
|
50
|
-
export declare const getCredential: ({ pidCryptoContext, appFetch, }: {
|
51
|
-
pidCryptoContext: CryptoContext;
|
52
|
-
appFetch?: {
|
53
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
54
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
55
|
-
} | undefined;
|
56
|
-
}) => ({ nonce, accessToken, clientId, walletProviderBaseUrl }: AuthorizationConf, pidProviderEntityConfiguration: CredentialIssuerEntityConfiguration) => Promise<PidResponse>;
|
57
|
-
//# sourceMappingURL=issuing.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/pid/issuing.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,mCAAmC,EAAE,MAAM,gBAAgB,CAAC;AASrE,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0JF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;sBAKP,aAAa;;;;;kCAIJ,MAAM,yBACV,MAAM,kCACG,mCAAmC,WAC1D,OAAO,KACf,QAAQ,iBAAiB,CAwE3B,CAAC;AA0BJ;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;sBAKJ,aAAa;;;;;gEAI0B,iBAAiB,kCAC1C,mCAAmC,KAClE,QAAQ,WAAW,CAsDrB,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/rp/__test__/index.test.ts"],"names":[],"mappings":""}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
/// <reference types="react-native" />
|
2
|
-
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
3
|
-
import { QRCodePayload, RequestObject, type Presentation } from "./types";
|
4
|
-
import { RelyingPartyEntityConfiguration } from "../trust/types";
|
5
|
-
/**
|
6
|
-
* Decode a QR code content to an authentication request url.
|
7
|
-
* @function
|
8
|
-
* @param qrcode QR code content
|
9
|
-
*
|
10
|
-
* @returns The authentication request url
|
11
|
-
*
|
12
|
-
*/
|
13
|
-
export declare const decodeAuthRequestQR: (qrcode: string) => QRCodePayload;
|
14
|
-
export type RequestObjectConf = {
|
15
|
-
requestObject: RequestObject;
|
16
|
-
rpEntityConfiguration: RelyingPartyEntityConfiguration;
|
17
|
-
walletInstanceAttestation: string;
|
18
|
-
};
|
19
|
-
/**
|
20
|
-
* Obtain the Request Object for RP authentication
|
21
|
-
* @see https://italia.github.io/eudi-wallet-it-docs/versione-corrente/en/relying-party-solution.html
|
22
|
-
*/
|
23
|
-
export declare const getRequestObject: ({ wiaCryptoContext, appFetch, }: {
|
24
|
-
wiaCryptoContext: CryptoContext;
|
25
|
-
appFetch?: {
|
26
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
27
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
28
|
-
} | undefined;
|
29
|
-
}) => (walletInstanceAttestation: string, requestUri: string, rpEntityConfiguration: RelyingPartyEntityConfiguration) => Promise<RequestObjectConf>;
|
30
|
-
/**
|
31
|
-
* Compose and send an Authorization Response in the context of an authorization request flow.
|
32
|
-
*
|
33
|
-
* @todo MUST add presentation_submission
|
34
|
-
*
|
35
|
-
*/
|
36
|
-
export declare const sendAuthorizationResponse: ({ pidCryptoContext, appFetch, }: {
|
37
|
-
pidCryptoContext: CryptoContext;
|
38
|
-
appFetch?: {
|
39
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
40
|
-
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
41
|
-
} | undefined;
|
42
|
-
}) => ({ requestObject, rpEntityConfiguration, walletInstanceAttestation, }: RequestObjectConf, presentation: Presentation) => Promise<string>;
|
43
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rp/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAM1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AA4BjE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,WAAY,MAAM,KAAG,aAoBpD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,aAAa,CAAC;IAC7B,qBAAqB,EAAE,+BAA+B,CAAC;IACvD,yBAAyB,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;sBAKP,aAAa;;;;;kCAIJ,MAAM,cACrB,MAAM,yBACK,+BAA+B,KACrD,QAAQ,iBAAiB,CAyD3B,CAAC;AA2DJ;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;sBAKhB,aAAa;;;;;6EAQ5B,iBAAiB,iCAEnB,QAAQ,MAAM,CAiDhB,CAAC"}
|