@pagopa/io-react-native-wallet 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/pid/issuing.js +28 -0
- package/lib/commonjs/pid/issuing.js.map +1 -1
- package/lib/commonjs/pid/metadata.js +51 -0
- package/lib/commonjs/pid/metadata.js.map +1 -0
- package/lib/commonjs/pid/sd-jwt/index.js +2 -1
- package/lib/commonjs/pid/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/rp/index.js +148 -3
- package/lib/commonjs/rp/index.js.map +1 -1
- package/lib/commonjs/rp/types.js +4 -0
- package/lib/commonjs/rp/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +119 -0
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -0
- package/lib/commonjs/sd-jwt/index.js +84 -4
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +9 -0
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/verifier.js +7 -5
- package/lib/commonjs/sd-jwt/verifier.js.map +1 -1
- package/lib/commonjs/utils/errors.js +76 -1
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/module/pid/issuing.js +30 -2
- package/lib/module/pid/issuing.js.map +1 -1
- package/lib/module/pid/metadata.js +43 -0
- package/lib/module/pid/metadata.js.map +1 -0
- package/lib/module/pid/sd-jwt/index.js +3 -3
- package/lib/module/pid/sd-jwt/index.js.map +1 -1
- package/lib/module/rp/index.js +150 -5
- package/lib/module/rp/index.js.map +1 -1
- package/lib/module/rp/types.js +4 -0
- package/lib/module/rp/types.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +118 -0
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -0
- package/lib/module/sd-jwt/index.js +83 -3
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +10 -0
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/verifier.js +8 -6
- package/lib/module/sd-jwt/verifier.js.map +1 -1
- package/lib/module/utils/errors.js +71 -0
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/pid/index.d.ts.map +1 -0
- package/lib/typescript/{pid → src/pid}/issuing.d.ts +9 -0
- package/lib/typescript/src/pid/issuing.d.ts.map +1 -0
- package/lib/typescript/src/pid/metadata.d.ts +528 -0
- package/lib/typescript/src/pid/metadata.d.ts.map +1 -0
- package/lib/typescript/src/pid/sd-jwt/converters.d.ts.map +1 -0
- package/lib/typescript/src/pid/sd-jwt/index.d.ts.map +1 -0
- package/lib/typescript/src/pid/sd-jwt/types.d.ts.map +1 -0
- package/lib/typescript/src/rp/__test__/index.test.d.ts.map +1 -0
- package/lib/typescript/src/rp/index.d.ts +89 -0
- package/lib/typescript/src/rp/index.d.ts.map +1 -0
- package/lib/typescript/{rp → src/rp}/types.d.ts +54 -47
- package/lib/typescript/{rp → src/rp}/types.d.ts.map +1 -1
- package/lib/typescript/src/sd-jwt/__test__/converters.test.d.ts.map +1 -0
- package/lib/typescript/src/sd-jwt/__test__/index.test.d.ts +2 -0
- package/lib/typescript/src/sd-jwt/__test__/index.test.d.ts.map +1 -0
- package/lib/typescript/src/sd-jwt/__test__/types.test.d.ts.map +1 -0
- package/lib/typescript/src/sd-jwt/converters.d.ts.map +1 -0
- package/lib/typescript/{sd-jwt → src/sd-jwt}/index.d.ts +22 -2
- package/lib/typescript/src/sd-jwt/index.d.ts.map +1 -0
- package/lib/typescript/{sd-jwt → src/sd-jwt}/types.d.ts +12 -0
- package/lib/typescript/src/sd-jwt/types.d.ts.map +1 -0
- package/lib/typescript/src/sd-jwt/verifier.d.ts +3 -0
- package/lib/typescript/src/sd-jwt/verifier.d.ts.map +1 -0
- package/lib/typescript/src/utils/dpop.d.ts.map +1 -0
- package/lib/typescript/{utils → src/utils}/errors.d.ts +41 -0
- package/lib/typescript/src/utils/errors.d.ts.map +1 -0
- package/lib/typescript/src/utils/jwk.d.ts.map +1 -0
- package/lib/typescript/src/wallet-instance-attestation/index.d.ts.map +1 -0
- package/lib/typescript/src/wallet-instance-attestation/issuing.d.ts.map +1 -0
- package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/types.d.ts +8 -8
- package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/pid/issuing.ts +38 -1
- package/src/pid/metadata.ts +46 -0
- package/src/pid/sd-jwt/index.ts +6 -3
- package/src/rp/index.ts +189 -5
- package/src/rp/types.ts +8 -0
- package/src/sd-jwt/__test__/index.test.ts +171 -0
- package/src/sd-jwt/index.ts +84 -7
- package/src/sd-jwt/types.ts +13 -0
- package/src/sd-jwt/verifier.ts +5 -7
- package/src/utils/errors.ts +81 -0
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/pid/index.d.ts.map +0 -1
- package/lib/typescript/pid/issuing.d.ts.map +0 -1
- package/lib/typescript/pid/sd-jwt/converters.d.ts.map +0 -1
- package/lib/typescript/pid/sd-jwt/index.d.ts.map +0 -1
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +0 -1
- 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/sd-jwt/__test__/converters.test.d.ts.map +0 -1
- package/lib/typescript/sd-jwt/__test__/types.test.d.ts.map +0 -1
- package/lib/typescript/sd-jwt/converters.d.ts.map +0 -1
- package/lib/typescript/sd-jwt/index.d.ts.map +0 -1
- package/lib/typescript/sd-jwt/types.d.ts.map +0 -1
- package/lib/typescript/sd-jwt/verifier.d.ts +0 -3
- package/lib/typescript/sd-jwt/verifier.d.ts.map +0 -1
- package/lib/typescript/utils/dpop.d.ts.map +0 -1
- package/lib/typescript/utils/errors.d.ts.map +0 -1
- package/lib/typescript/utils/jwk.d.ts.map +0 -1
- package/lib/typescript/wallet-instance-attestation/index.d.ts.map +0 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +0 -1
- /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/typescript/{pid → src/pid}/index.d.ts +0 -0
- /package/lib/typescript/{pid → src/pid}/sd-jwt/converters.d.ts +0 -0
- /package/lib/typescript/{pid → src/pid}/sd-jwt/index.d.ts +0 -0
- /package/lib/typescript/{pid → src/pid}/sd-jwt/types.d.ts +0 -0
- /package/lib/typescript/{rp → src/rp}/__test__/index.test.d.ts +0 -0
- /package/lib/typescript/{sd-jwt → src/sd-jwt}/__test__/converters.test.d.ts +0 -0
- /package/lib/typescript/{sd-jwt → src/sd-jwt}/__test__/types.test.d.ts +0 -0
- /package/lib/typescript/{sd-jwt → src/sd-jwt}/converters.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/dpop.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/jwk.d.ts +0 -0
- /package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/index.d.ts +0 -0
- /package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/issuing.d.ts +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { QRCodePayload, RequestObject, RpEntityConfiguration, type Presentation } from "./types";
|
|
2
|
+
import type { JWK } from "@pagopa/io-react-native-jwt/lib/typescript/types";
|
|
3
|
+
export declare class RelyingPartySolution {
|
|
4
|
+
relyingPartyBaseUrl: string;
|
|
5
|
+
walletInstanceAttestation: string;
|
|
6
|
+
appFetch: GlobalFetch["fetch"];
|
|
7
|
+
constructor(relyingPartyBaseUrl: string, walletInstanceAttestation: string, appFetch?: GlobalFetch["fetch"]);
|
|
8
|
+
/**
|
|
9
|
+
* Decode a QR code content to an authentication request url.
|
|
10
|
+
* @function
|
|
11
|
+
* @param qrcode QR code content
|
|
12
|
+
*
|
|
13
|
+
* @returns The authentication request url
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
static decodeAuthRequestQR(qrcode: string): QRCodePayload;
|
|
17
|
+
/**
|
|
18
|
+
* Obtain the unsigned wallet instance DPoP for authentication request
|
|
19
|
+
*
|
|
20
|
+
* @function
|
|
21
|
+
* @param walletInstanceAttestationJwk JWT of the Wallet Instance Attestation
|
|
22
|
+
* @param authRequestUrl authentication request url
|
|
23
|
+
*
|
|
24
|
+
* @returns The unsigned wallet instance DPoP
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
getUnsignedWalletInstanceDPoP(walletInstanceAttestationJwk: JWK, authRequestUrl: string): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Obtain the Request Object for RP authentication
|
|
30
|
+
* @see https://italia.github.io/eudi-wallet-it-docs/versione-corrente/en/relying-party-solution.html
|
|
31
|
+
*
|
|
32
|
+
* @async @function
|
|
33
|
+
* @param signedWalletInstanceDPoP JWT of the Wallet Instance Attestation DPoP
|
|
34
|
+
*
|
|
35
|
+
* @returns The Request Object JWT
|
|
36
|
+
* @throws {NoSuitableKeysFoundInEntityConfiguration} When the Request Object is signed with a key not listed in RP's entity configuration
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
getRequestObject(signedWalletInstanceDPoP: string, entity: RpEntityConfiguration): Promise<RequestObject>;
|
|
40
|
+
/**
|
|
41
|
+
* Prepare the Verified Presentation token for a received request object in the context of an authorization request flow.
|
|
42
|
+
* The presentation is prepared by disclosing data from provided credentials, according to requested claims
|
|
43
|
+
* Each Verified Credential come along with the claims the user accepts to disclose from it.
|
|
44
|
+
*
|
|
45
|
+
* The returned token is unsigned (sign should be apply by the caller).
|
|
46
|
+
*
|
|
47
|
+
* @todo accept more than a Verified Credential
|
|
48
|
+
*
|
|
49
|
+
* @param requestObj The incoming request object, which the requirements for the requested authorization
|
|
50
|
+
* @param presentation The Verified Credential containing user data along with the list of claims to be disclosed.
|
|
51
|
+
* @returns The unsigned Verified Presentation token
|
|
52
|
+
* @throws {ClaimsNotFoundBetweenDislosures} If the Verified Credential does not contain one or more requested claims.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
prepareVpToken(requestObj: RequestObject, [vc, claims]: Presentation): Promise<{
|
|
56
|
+
vp_token: string;
|
|
57
|
+
presentation_submission: Record<string, unknown>;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Compose and send an Authorization Response in the context of an authorization request flow.
|
|
61
|
+
*
|
|
62
|
+
* @todo MUST add presentation_submission
|
|
63
|
+
*
|
|
64
|
+
* @param requestObj The incoming request object, which the requirements for the requested authorization
|
|
65
|
+
* @param vp_token The signed Verified Presentation token with data to send.
|
|
66
|
+
* @param presentation_submission
|
|
67
|
+
* @param entity The RP entity configuration
|
|
68
|
+
* @returns The response from the RP
|
|
69
|
+
* @throws {IoWalletError} if the submission fails.
|
|
70
|
+
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
sendAuthorizationResponse(requestObj: RequestObject, vp_token: string, presentation_submission: Record<string, unknown>, entity: RpEntityConfiguration): Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Select a public key from those provided by the RP.
|
|
76
|
+
* Keys with algorithm "RSA-OAEP-256" or "RSA-OAEP" are expected, the firsts to be preferred.
|
|
77
|
+
*
|
|
78
|
+
* @param entity The RP entity configuration
|
|
79
|
+
* @returns A suitable public key with its compatible encryption algorithm
|
|
80
|
+
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
|
|
81
|
+
*/
|
|
82
|
+
private choosePublicKeyToEncrypt;
|
|
83
|
+
private getEncryptionAlgByJwk;
|
|
84
|
+
/**
|
|
85
|
+
* Obtain the relying party entity configuration.
|
|
86
|
+
*/
|
|
87
|
+
getEntityConfiguration(): Promise<RpEntityConfiguration>;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=index.d.ts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OAAO,CAAC,MAAM,CAAC;IAkClB;;;;;;;OAOG;IACH,OAAO,CAAC,wBAAwB;IA6BhC,OAAO,CAAC,qBAAqB;IAY7B;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAuB/D"}
|
|
@@ -366,7 +366,6 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
366
366
|
}>;
|
|
367
367
|
contacts: z.ZodArray<z.ZodString, "many">;
|
|
368
368
|
}, "strip", z.ZodTypeAny, {
|
|
369
|
-
client_id: string;
|
|
370
369
|
jwks: {
|
|
371
370
|
keys: {
|
|
372
371
|
kty: "RSA" | "EC";
|
|
@@ -393,11 +392,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
393
392
|
x5u?: string | undefined;
|
|
394
393
|
}[];
|
|
395
394
|
};
|
|
395
|
+
client_id: string;
|
|
396
396
|
application_type: string;
|
|
397
397
|
client_name: string;
|
|
398
398
|
contacts: string[];
|
|
399
399
|
}, {
|
|
400
|
-
client_id: string;
|
|
401
400
|
jwks: {
|
|
402
401
|
keys: {
|
|
403
402
|
kty: "RSA" | "EC";
|
|
@@ -424,6 +423,7 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
424
423
|
x5u?: string | undefined;
|
|
425
424
|
}[];
|
|
426
425
|
};
|
|
426
|
+
client_id: string;
|
|
427
427
|
application_type: string;
|
|
428
428
|
client_name: string;
|
|
429
429
|
contacts: string[];
|
|
@@ -436,20 +436,26 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
436
436
|
contacts: z.ZodArray<z.ZodString, "many">;
|
|
437
437
|
}, "strip", z.ZodTypeAny, {
|
|
438
438
|
organization_name: string;
|
|
439
|
-
contacts: string[];
|
|
440
439
|
homepage_uri: string;
|
|
441
440
|
policy_uri: string;
|
|
442
441
|
logo_uri: string;
|
|
442
|
+
contacts: string[];
|
|
443
443
|
}, {
|
|
444
444
|
organization_name: string;
|
|
445
|
-
contacts: string[];
|
|
446
445
|
homepage_uri: string;
|
|
447
446
|
policy_uri: string;
|
|
448
447
|
logo_uri: string;
|
|
448
|
+
contacts: string[];
|
|
449
449
|
}>;
|
|
450
450
|
}, "strip", z.ZodTypeAny, {
|
|
451
|
+
federation_entity: {
|
|
452
|
+
organization_name: string;
|
|
453
|
+
homepage_uri: string;
|
|
454
|
+
policy_uri: string;
|
|
455
|
+
logo_uri: string;
|
|
456
|
+
contacts: string[];
|
|
457
|
+
};
|
|
451
458
|
wallet_relying_party: {
|
|
452
|
-
client_id: string;
|
|
453
459
|
jwks: {
|
|
454
460
|
keys: {
|
|
455
461
|
kty: "RSA" | "EC";
|
|
@@ -476,20 +482,20 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
476
482
|
x5u?: string | undefined;
|
|
477
483
|
}[];
|
|
478
484
|
};
|
|
485
|
+
client_id: string;
|
|
479
486
|
application_type: string;
|
|
480
487
|
client_name: string;
|
|
481
488
|
contacts: string[];
|
|
482
489
|
};
|
|
490
|
+
}, {
|
|
483
491
|
federation_entity: {
|
|
484
492
|
organization_name: string;
|
|
485
|
-
contacts: string[];
|
|
486
493
|
homepage_uri: string;
|
|
487
494
|
policy_uri: string;
|
|
488
495
|
logo_uri: string;
|
|
496
|
+
contacts: string[];
|
|
489
497
|
};
|
|
490
|
-
}, {
|
|
491
498
|
wallet_relying_party: {
|
|
492
|
-
client_id: string;
|
|
493
499
|
jwks: {
|
|
494
500
|
keys: {
|
|
495
501
|
kty: "RSA" | "EC";
|
|
@@ -516,17 +522,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
516
522
|
x5u?: string | undefined;
|
|
517
523
|
}[];
|
|
518
524
|
};
|
|
525
|
+
client_id: string;
|
|
519
526
|
application_type: string;
|
|
520
527
|
client_name: string;
|
|
521
528
|
contacts: string[];
|
|
522
529
|
};
|
|
523
|
-
federation_entity: {
|
|
524
|
-
organization_name: string;
|
|
525
|
-
contacts: string[];
|
|
526
|
-
homepage_uri: string;
|
|
527
|
-
policy_uri: string;
|
|
528
|
-
logo_uri: string;
|
|
529
|
-
};
|
|
530
530
|
}>;
|
|
531
531
|
authority_hints: z.ZodArray<z.ZodString, "many">;
|
|
532
532
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -561,8 +561,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
561
561
|
}[];
|
|
562
562
|
};
|
|
563
563
|
metadata: {
|
|
564
|
+
federation_entity: {
|
|
565
|
+
organization_name: string;
|
|
566
|
+
homepage_uri: string;
|
|
567
|
+
policy_uri: string;
|
|
568
|
+
logo_uri: string;
|
|
569
|
+
contacts: string[];
|
|
570
|
+
};
|
|
564
571
|
wallet_relying_party: {
|
|
565
|
-
client_id: string;
|
|
566
572
|
jwks: {
|
|
567
573
|
keys: {
|
|
568
574
|
kty: "RSA" | "EC";
|
|
@@ -589,17 +595,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
589
595
|
x5u?: string | undefined;
|
|
590
596
|
}[];
|
|
591
597
|
};
|
|
598
|
+
client_id: string;
|
|
592
599
|
application_type: string;
|
|
593
600
|
client_name: string;
|
|
594
601
|
contacts: string[];
|
|
595
602
|
};
|
|
596
|
-
federation_entity: {
|
|
597
|
-
organization_name: string;
|
|
598
|
-
contacts: string[];
|
|
599
|
-
homepage_uri: string;
|
|
600
|
-
policy_uri: string;
|
|
601
|
-
logo_uri: string;
|
|
602
|
-
};
|
|
603
603
|
};
|
|
604
604
|
authority_hints: string[];
|
|
605
605
|
}, {
|
|
@@ -634,8 +634,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
634
634
|
}[];
|
|
635
635
|
};
|
|
636
636
|
metadata: {
|
|
637
|
+
federation_entity: {
|
|
638
|
+
organization_name: string;
|
|
639
|
+
homepage_uri: string;
|
|
640
|
+
policy_uri: string;
|
|
641
|
+
logo_uri: string;
|
|
642
|
+
contacts: string[];
|
|
643
|
+
};
|
|
637
644
|
wallet_relying_party: {
|
|
638
|
-
client_id: string;
|
|
639
645
|
jwks: {
|
|
640
646
|
keys: {
|
|
641
647
|
kty: "RSA" | "EC";
|
|
@@ -662,17 +668,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
662
668
|
x5u?: string | undefined;
|
|
663
669
|
}[];
|
|
664
670
|
};
|
|
671
|
+
client_id: string;
|
|
665
672
|
application_type: string;
|
|
666
673
|
client_name: string;
|
|
667
674
|
contacts: string[];
|
|
668
675
|
};
|
|
669
|
-
federation_entity: {
|
|
670
|
-
organization_name: string;
|
|
671
|
-
contacts: string[];
|
|
672
|
-
homepage_uri: string;
|
|
673
|
-
policy_uri: string;
|
|
674
|
-
logo_uri: string;
|
|
675
|
-
};
|
|
676
676
|
};
|
|
677
677
|
authority_hints: string[];
|
|
678
678
|
}>;
|
|
@@ -714,8 +714,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
714
714
|
}[];
|
|
715
715
|
};
|
|
716
716
|
metadata: {
|
|
717
|
+
federation_entity: {
|
|
718
|
+
organization_name: string;
|
|
719
|
+
homepage_uri: string;
|
|
720
|
+
policy_uri: string;
|
|
721
|
+
logo_uri: string;
|
|
722
|
+
contacts: string[];
|
|
723
|
+
};
|
|
717
724
|
wallet_relying_party: {
|
|
718
|
-
client_id: string;
|
|
719
725
|
jwks: {
|
|
720
726
|
keys: {
|
|
721
727
|
kty: "RSA" | "EC";
|
|
@@ -742,17 +748,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
742
748
|
x5u?: string | undefined;
|
|
743
749
|
}[];
|
|
744
750
|
};
|
|
751
|
+
client_id: string;
|
|
745
752
|
application_type: string;
|
|
746
753
|
client_name: string;
|
|
747
754
|
contacts: string[];
|
|
748
755
|
};
|
|
749
|
-
federation_entity: {
|
|
750
|
-
organization_name: string;
|
|
751
|
-
contacts: string[];
|
|
752
|
-
homepage_uri: string;
|
|
753
|
-
policy_uri: string;
|
|
754
|
-
logo_uri: string;
|
|
755
|
-
};
|
|
756
756
|
};
|
|
757
757
|
authority_hints: string[];
|
|
758
758
|
};
|
|
@@ -794,8 +794,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
794
794
|
}[];
|
|
795
795
|
};
|
|
796
796
|
metadata: {
|
|
797
|
+
federation_entity: {
|
|
798
|
+
organization_name: string;
|
|
799
|
+
homepage_uri: string;
|
|
800
|
+
policy_uri: string;
|
|
801
|
+
logo_uri: string;
|
|
802
|
+
contacts: string[];
|
|
803
|
+
};
|
|
797
804
|
wallet_relying_party: {
|
|
798
|
-
client_id: string;
|
|
799
805
|
jwks: {
|
|
800
806
|
keys: {
|
|
801
807
|
kty: "RSA" | "EC";
|
|
@@ -822,17 +828,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
|
|
|
822
828
|
x5u?: string | undefined;
|
|
823
829
|
}[];
|
|
824
830
|
};
|
|
831
|
+
client_id: string;
|
|
825
832
|
application_type: string;
|
|
826
833
|
client_name: string;
|
|
827
834
|
contacts: string[];
|
|
828
835
|
};
|
|
829
|
-
federation_entity: {
|
|
830
|
-
organization_name: string;
|
|
831
|
-
contacts: string[];
|
|
832
|
-
homepage_uri: string;
|
|
833
|
-
policy_uri: string;
|
|
834
|
-
logo_uri: string;
|
|
835
|
-
};
|
|
836
836
|
};
|
|
837
837
|
authority_hints: string[];
|
|
838
838
|
};
|
|
@@ -854,4 +854,11 @@ export declare const QRCodePayload: z.ZodObject<{
|
|
|
854
854
|
clientId: string;
|
|
855
855
|
requestURI: string;
|
|
856
856
|
}>;
|
|
857
|
+
/**
|
|
858
|
+
* A pair that associate a tokenized Verified Credential with the claims presented or requested to present.
|
|
859
|
+
*/
|
|
860
|
+
export type Presentation = [
|
|
861
|
+
string,
|
|
862
|
+
string[]
|
|
863
|
+
];
|
|
857
864
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRo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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkChC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAKxB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACO,MAAM;IACzB,MAAM,EAAE;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.test.d.ts","sourceRoot":"","sources":["../../../../../src/sd-jwt/__test__/converters.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../../src/sd-jwt/__test__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../../../../src/sd-jwt/__test__/types.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../../src/sd-jwt/converters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,UAAU,EAAE,EACzB,SAAS,EAAE,MAAM,OAmBlB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { Disclosure } from "./types";
|
|
2
|
+
import { Disclosure, type DisclosureWithEncoded } from "./types";
|
|
3
3
|
import type { JWK } from "src/utils/jwk";
|
|
4
4
|
/**
|
|
5
5
|
* Decode a given SD-JWT with Disclosures to get the parsed SD-JWT object they define.
|
|
@@ -17,8 +17,28 @@ import type { JWK } from "src/utils/jwk";
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const decode: <S extends z.AnyZodObject>(token: string, schema: S) => {
|
|
19
19
|
sdJwt: z.TypeOf<S>;
|
|
20
|
-
disclosures:
|
|
20
|
+
disclosures: DisclosureWithEncoded[];
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Select disclosures from a given SD-JWT with Disclosures.
|
|
24
|
+
* Claims relate with disclosures by their name.
|
|
25
|
+
*
|
|
26
|
+
* @function
|
|
27
|
+
* @param token The encoded token that represents a valid sd-jwt for verifiable credentials
|
|
28
|
+
* @param claims The list of claims to be disclosed
|
|
29
|
+
*
|
|
30
|
+
* @throws {ClaimsNotFoundBetweenDislosures} When one or more claims does not relate to any discloure.
|
|
31
|
+
* @throws {ClaimsNotFoundInToken} When one or more claims are not contained in the SD-JWT token.
|
|
32
|
+
* @returns The encoded token with only the requested disclosures, along with the path each claim can be found on the SD-JWT token
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export declare const disclose: (token: string, claims: string[]) => Promise<{
|
|
36
|
+
token: string;
|
|
37
|
+
paths: {
|
|
38
|
+
claim: string;
|
|
39
|
+
path: string;
|
|
40
|
+
}[];
|
|
41
|
+
}>;
|
|
22
42
|
/**
|
|
23
43
|
* Verify a given SD-JWT with Disclosures
|
|
24
44
|
* Same as {@link decode} plus:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sd-jwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EAAE,UAAU,EAAY,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAWzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM;;iBAIA,qBAAqB,EAAE;CAsBrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,UACZ,MAAM,UACL,MAAM,EAAE;WACE,MAAM;WAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;EA8CnE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM,aACF,GAAG;;iBAE6B,UAAU,EAAE;EAwBxD,CAAC"}
|
|
@@ -17,6 +17,18 @@ export declare const ObfuscatedDisclosures: z.ZodObject<{
|
|
|
17
17
|
*/
|
|
18
18
|
export type Disclosure = z.infer<typeof Disclosure>;
|
|
19
19
|
export declare const Disclosure: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodUnknown], null>;
|
|
20
|
+
/**
|
|
21
|
+
* Encoding depends on the serialization algorithm used when generating the disclosure tokens.
|
|
22
|
+
* The SD-JWT reference itself take no decision about how to handle whitespaces in serialized objects.
|
|
23
|
+
* For such reason, we may find conveninent to have encoded and decode values stored explicitly in the same structure.
|
|
24
|
+
* Please note that `encoded` can always decode into `decode`, but `decode` may or may not be encoded with the same value of `encoded`
|
|
25
|
+
*
|
|
26
|
+
* @see https://www.ietf.org/id/draft-ietf-oauth-selective-disclosure-jwt-05.html#name-disclosures-for-object-prop
|
|
27
|
+
*/
|
|
28
|
+
export type DisclosureWithEncoded = {
|
|
29
|
+
decoded: Disclosure;
|
|
30
|
+
encoded: string;
|
|
31
|
+
};
|
|
20
32
|
export type SdJwt4VC = z.infer<typeof SdJwt4VC>;
|
|
21
33
|
export declare const SdJwt4VC: z.ZodObject<{
|
|
22
34
|
header: z.ZodObject<{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/sd-jwt/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,QAAQ,aAAuC,CAAC;AAC7D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,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qBAAqB,UACnC,qBAAqB,CAAC,KAAK,CAAC,kBAUrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dpop.d.ts","sourceRoot":"","sources":["../../../../src/utils/dpop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,eAAO,MAAM,eAAe,QAAS,GAAG,WAAW,WAAW,KAAG,MAWhE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC"}
|
|
@@ -68,4 +68,45 @@ export declare class PidIssuingError extends IoWalletError {
|
|
|
68
68
|
reason: string;
|
|
69
69
|
constructor(message: string, claim?: string, reason?: string);
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* When claims are requested but not found in the credential
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
export declare class ClaimsNotFoundBetweenDislosures extends Error {
|
|
76
|
+
static get code(): "ERR_CLAIMS_NOT_FOUND";
|
|
77
|
+
code: string;
|
|
78
|
+
/** The Claims not found */
|
|
79
|
+
claims: string[];
|
|
80
|
+
constructor(claims: string | string[]);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* When the SD-JWT does not contain an hashed reference to a given set of claims
|
|
84
|
+
*/
|
|
85
|
+
export declare class ClaimsNotFoundInToken extends Error {
|
|
86
|
+
static get code(): "ERR_CLAIMS_NOT_FOUND_IN_TOKEN";
|
|
87
|
+
code: string;
|
|
88
|
+
/** The Claims not found */
|
|
89
|
+
claims: string[];
|
|
90
|
+
constructor(claims: string | string[]);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* When selecting a public key from an entity configuration, and no one meets the requirements for the scenario
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
export declare class NoSuitableKeysFoundInEntityConfiguration extends Error {
|
|
97
|
+
static get code(): "ERR_NO_SUITABLE_KEYS_NOT_FOUND";
|
|
98
|
+
code: string;
|
|
99
|
+
/**
|
|
100
|
+
* @param scenario describe the scenario in which the error arise
|
|
101
|
+
*/
|
|
102
|
+
constructor(scenario: string);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* When selecting a public key from an entity configuration, and no one meets the requirements for the scenario
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
export declare class PidMetadataError extends Error {
|
|
109
|
+
static get code(): "PID_METADATA_ERROR";
|
|
110
|
+
constructor(message: string);
|
|
111
|
+
}
|
|
71
112
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,6DAA6D;IAC7D,MAAM,KAAK,IAAI,IAAI,MAAM,CAExB;IAED,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAA2B;gBAE3B,OAAO,CAAC,EAAE,MAAM;CAM7B;AACD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,MAAM,KAAK,IAAI,IAAI,iCAAiC,CAEnD;IAED,IAAI,SAAqC;IAEzC,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;gBAEH,OAAO,EAAE,MAAM,EAAE,KAAK,SAAgB,EAAE,MAAM,SAAgB;CAK3E;AAED;;;GAGG;AACH,qBAAa,qCAAsC,SAAQ,aAAa;IACtE,MAAM,KAAK,IAAI,IAAI,mDAAmD,CAErE;IAED,IAAI,SAAuD;IAE3D,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,MAAM,EAAE,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Aa,gBAAiB,SAAQ,KAAK;IACzC,MAAM,KAAK,IAAI,IAAI,oBAAoB,CAEtC;gBAEW,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwk.d.ts","sourceRoot":"","sources":["../../../../src/utils/jwk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;AACtC,eAAO,MAAM,GAAG;IACd,uCAAuC;;;;;;;IAOvC,yCAAyC;;;IAGzC,gDAAgD;;IAEhD,oCAAoC;;IAEpC;;kCAE8B;;;;;;IAM9B,4CAA4C;;;;IAI5C,qDAAqD;;IAErD,gEAAgE;;IAEhE,mEAAmE;;IAEnE,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAIvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,4BAA4B,CAQlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,4BAA4B,CAAC,CAOvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,qBAAa,OAAO;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;gBAE7B,qBAAqB,EAAE,MAAM,EAC7B,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS;IAMxC;;;;;;;;;OASG;IACG,2BAA2B,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IA0B5D;;;;;;;;;;;;OAYG;IACG,cAAc,CAClB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CAqCnB"}
|
package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/types.d.ts
RENAMED
|
@@ -574,11 +574,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
|
574
574
|
presentation_definition_uri_supported: z.ZodBoolean;
|
|
575
575
|
}, "strip", z.ZodTypeAny, {
|
|
576
576
|
type: "WalletInstanceAttestation";
|
|
577
|
+
authorization_endpoint: string;
|
|
577
578
|
policy_uri: string;
|
|
578
|
-
logo_uri: string;
|
|
579
579
|
tos_uri: string;
|
|
580
|
+
logo_uri: string;
|
|
580
581
|
asc: string;
|
|
581
|
-
authorization_endpoint: string;
|
|
582
582
|
response_types_supported: string[];
|
|
583
583
|
vp_formats_supported: {
|
|
584
584
|
jwt_vp_json: {
|
|
@@ -592,11 +592,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
|
592
592
|
presentation_definition_uri_supported: boolean;
|
|
593
593
|
}, {
|
|
594
594
|
type: "WalletInstanceAttestation";
|
|
595
|
+
authorization_endpoint: string;
|
|
595
596
|
policy_uri: string;
|
|
596
|
-
logo_uri: string;
|
|
597
597
|
tos_uri: string;
|
|
598
|
+
logo_uri: string;
|
|
598
599
|
asc: string;
|
|
599
|
-
authorization_endpoint: string;
|
|
600
600
|
response_types_supported: string[];
|
|
601
601
|
vp_formats_supported: {
|
|
602
602
|
jwt_vp_json: {
|
|
@@ -652,11 +652,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
|
652
652
|
};
|
|
653
653
|
} & {
|
|
654
654
|
type: "WalletInstanceAttestation";
|
|
655
|
+
authorization_endpoint: string;
|
|
655
656
|
policy_uri: string;
|
|
656
|
-
logo_uri: string;
|
|
657
657
|
tos_uri: string;
|
|
658
|
+
logo_uri: string;
|
|
658
659
|
asc: string;
|
|
659
|
-
authorization_endpoint: string;
|
|
660
660
|
response_types_supported: string[];
|
|
661
661
|
vp_formats_supported: {
|
|
662
662
|
jwt_vp_json: {
|
|
@@ -712,11 +712,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
|
712
712
|
};
|
|
713
713
|
} & {
|
|
714
714
|
type: "WalletInstanceAttestation";
|
|
715
|
+
authorization_endpoint: string;
|
|
715
716
|
policy_uri: string;
|
|
716
|
-
logo_uri: string;
|
|
717
717
|
tos_uri: string;
|
|
718
|
+
logo_uri: string;
|
|
718
719
|
asc: string;
|
|
719
|
-
authorization_endpoint: string;
|
|
720
720
|
response_types_supported: string[];
|
|
721
721
|
vp_formats_supported: {
|
|
722
722
|
jwt_vp_json: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAwBzB,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAC;AACF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc9C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAC;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Provide data structures, helpers and API for IO Wallet",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@pagopa/eslint-config": "^3.0.0",
|
|
55
55
|
"@pagopa/io-react-native-crypto": "^0.2.3",
|
|
56
|
-
"@pagopa/io-react-native-jwt": "^0.
|
|
56
|
+
"@pagopa/io-react-native-jwt": "^0.6.0",
|
|
57
57
|
"@react-native-community/eslint-config": "^3.2.0",
|
|
58
58
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
59
59
|
"@types/jest": "^28.1.2",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"del-cli": "^5.0.0",
|
|
63
63
|
"eslint": "^8.4.1",
|
|
64
64
|
"jest": "^28.1.1",
|
|
65
|
+
"js-sha256": "^0.9.0",
|
|
65
66
|
"pod-install": "^0.1.0",
|
|
66
67
|
"prettier": "^2.0.5",
|
|
67
68
|
"react": "18.2.0",
|
package/src/pid/issuing.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decode as decodeJwt,
|
|
3
|
+
verify as verifyJwt,
|
|
3
4
|
sha256ToBase64,
|
|
4
5
|
} from "@pagopa/io-react-native-jwt";
|
|
5
6
|
|
|
6
7
|
import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
|
|
7
8
|
import { JWK } from "../utils/jwk";
|
|
8
9
|
import uuid from "react-native-uuid";
|
|
9
|
-
import { PidIssuingError } from "../utils/errors";
|
|
10
|
+
import { PidIssuingError, PidMetadataError } from "../utils/errors";
|
|
10
11
|
import { getUnsignedDPop } from "../utils/dpop";
|
|
11
12
|
import { sign, generate, deleteKey } from "@pagopa/io-react-native-crypto";
|
|
13
|
+
import { PidIssuerEntityConfiguration } from "./metadata";
|
|
12
14
|
|
|
13
15
|
// This is a temporary type that will be used for demo purposes only
|
|
14
16
|
export type CieData = {
|
|
@@ -302,4 +304,39 @@ export class Issuing {
|
|
|
302
304
|
|
|
303
305
|
throw new PidIssuingError(`Unable to obtain credential!`);
|
|
304
306
|
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Obtain the PID issuer metadata
|
|
310
|
+
*
|
|
311
|
+
* @function
|
|
312
|
+
* @returns PID issuer metadata
|
|
313
|
+
*
|
|
314
|
+
*/
|
|
315
|
+
async getEntityConfiguration(): Promise<PidIssuerEntityConfiguration> {
|
|
316
|
+
const metadataUrl = new URL(
|
|
317
|
+
".well-known/openid-federation",
|
|
318
|
+
this.pidProviderBaseUrl
|
|
319
|
+
).href;
|
|
320
|
+
|
|
321
|
+
const response = await this.appFetch(metadataUrl);
|
|
322
|
+
|
|
323
|
+
if (response.status === 200) {
|
|
324
|
+
const jwtMetadata = await response.text();
|
|
325
|
+
const { payload } = decodeJwt(jwtMetadata);
|
|
326
|
+
const result = PidIssuerEntityConfiguration.safeParse(payload);
|
|
327
|
+
if (result.success) {
|
|
328
|
+
const parsedMetadata = result.data;
|
|
329
|
+
await verifyJwt(jwtMetadata, parsedMetadata.jwks.keys);
|
|
330
|
+
return parsedMetadata;
|
|
331
|
+
} else {
|
|
332
|
+
throw new PidMetadataError(result.error.message);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
throw new PidMetadataError(
|
|
337
|
+
`Unable to obtain PID metadata. Response: ${await response.text()} with status: ${
|
|
338
|
+
response.status
|
|
339
|
+
}`
|
|
340
|
+
);
|
|
341
|
+
}
|
|
305
342
|
}
|