@pagopa/io-react-native-wallet 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +3 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/presentation/01-start-flow.js +12 -28
- package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +96 -24
- package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js +7 -2
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +9 -5
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +20 -16
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/README.md +4 -4
- package/lib/commonjs/credential/presentation/errors.js +2 -19
- package/lib/commonjs/credential/presentation/errors.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +9 -1
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/entity/trust/chain.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +41 -1
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/decoder.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +3 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/presentation/01-start-flow.js +12 -28
- package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +96 -24
- package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js +7 -2
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +9 -5
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +18 -14
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/README.md +4 -4
- package/lib/module/credential/presentation/errors.js +0 -16
- package/lib/module/credential/presentation/errors.js.map +1 -1
- package/lib/module/credential/presentation/types.js +9 -1
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/entity/trust/chain.js.map +1 -1
- package/lib/module/utils/crypto.js +38 -0
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/decoder.js +0 -1
- package/lib/module/utils/decoder.js.map +1 -1
- package/lib/module/utils/jwk.js.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +3 -3
- package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/03-get-request-object.d.ts +1 -1
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +15 -8
- package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +3 -2
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +5 -5
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/errors.d.ts +0 -11
- package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +252 -3
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/entity/trust/chain.d.ts +1 -1
- package/lib/typescript/entity/trust/chain.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +24 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -1
- package/lib/typescript/utils/decoder.d.ts +1 -1
- package/lib/typescript/utils/decoder.d.ts.map +1 -1
- package/lib/typescript/utils/jwk.d.ts +2 -0
- package/lib/typescript/utils/jwk.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/credential/issuance/03-start-user-authorization.ts +3 -0
- package/src/credential/presentation/01-start-flow.ts +16 -32
- package/src/credential/presentation/03-get-request-object.ts +1 -1
- package/src/credential/presentation/04-retrieve-rp-jwks.ts +122 -34
- package/src/credential/presentation/05-verify-request-object.ts +4 -3
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +20 -6
- package/src/credential/presentation/08-send-authorization-response.ts +25 -17
- package/src/credential/presentation/README.md +4 -4
- package/src/credential/presentation/errors.ts +0 -16
- package/src/credential/presentation/types.ts +10 -1
- package/src/entity/trust/chain.ts +1 -2
- package/src/utils/crypto.ts +43 -0
- package/src/utils/decoder.ts +1 -1
- package/src/utils/jwk.ts +3 -1
@@ -331,7 +331,194 @@ export declare const RequestObject: z.ZodObject<{
|
|
331
331
|
response_type: z.ZodLiteral<"vp_token">;
|
332
332
|
response_mode: z.ZodEnum<["direct_post.jwt", "direct_post"]>;
|
333
333
|
client_id: z.ZodString;
|
334
|
-
client_id_scheme: z.ZodString
|
334
|
+
client_id_scheme: z.ZodOptional<z.ZodString>;
|
335
|
+
client_metadata: z.ZodOptional<z.ZodObject<{
|
336
|
+
authorization_encrypted_response_alg: z.ZodOptional<z.ZodString>;
|
337
|
+
authorization_encrypted_response_enc: z.ZodOptional<z.ZodString>;
|
338
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
339
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
340
|
+
keys: z.ZodArray<z.ZodObject<{
|
341
|
+
alg: z.ZodOptional<z.ZodString>;
|
342
|
+
crv: z.ZodOptional<z.ZodString>;
|
343
|
+
d: z.ZodOptional<z.ZodString>;
|
344
|
+
dp: z.ZodOptional<z.ZodString>;
|
345
|
+
dq: z.ZodOptional<z.ZodString>;
|
346
|
+
e: z.ZodOptional<z.ZodString>;
|
347
|
+
ext: z.ZodOptional<z.ZodBoolean>;
|
348
|
+
k: z.ZodOptional<z.ZodString>;
|
349
|
+
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
350
|
+
kid: z.ZodOptional<z.ZodString>;
|
351
|
+
kty: z.ZodUnion<[z.ZodLiteral<"RSA">, z.ZodLiteral<"EC">]>;
|
352
|
+
n: z.ZodOptional<z.ZodString>;
|
353
|
+
p: z.ZodOptional<z.ZodString>;
|
354
|
+
q: z.ZodOptional<z.ZodString>;
|
355
|
+
qi: z.ZodOptional<z.ZodString>;
|
356
|
+
use: z.ZodOptional<z.ZodString>;
|
357
|
+
x: z.ZodOptional<z.ZodString>;
|
358
|
+
y: z.ZodOptional<z.ZodString>;
|
359
|
+
x5c: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
360
|
+
x5t: z.ZodOptional<z.ZodString>;
|
361
|
+
"x5t#S256": z.ZodOptional<z.ZodString>;
|
362
|
+
x5u: z.ZodOptional<z.ZodString>;
|
363
|
+
}, "strip", z.ZodTypeAny, {
|
364
|
+
kty: "RSA" | "EC";
|
365
|
+
alg?: string | undefined;
|
366
|
+
crv?: string | undefined;
|
367
|
+
d?: string | undefined;
|
368
|
+
dp?: string | undefined;
|
369
|
+
dq?: string | undefined;
|
370
|
+
e?: string | undefined;
|
371
|
+
ext?: boolean | undefined;
|
372
|
+
k?: string | undefined;
|
373
|
+
key_ops?: string[] | undefined;
|
374
|
+
kid?: string | undefined;
|
375
|
+
n?: string | undefined;
|
376
|
+
p?: string | undefined;
|
377
|
+
q?: string | undefined;
|
378
|
+
qi?: string | undefined;
|
379
|
+
use?: string | undefined;
|
380
|
+
x?: string | undefined;
|
381
|
+
y?: string | undefined;
|
382
|
+
x5c?: string[] | undefined;
|
383
|
+
x5t?: string | undefined;
|
384
|
+
"x5t#S256"?: string | undefined;
|
385
|
+
x5u?: string | undefined;
|
386
|
+
}, {
|
387
|
+
kty: "RSA" | "EC";
|
388
|
+
alg?: string | undefined;
|
389
|
+
crv?: string | undefined;
|
390
|
+
d?: string | undefined;
|
391
|
+
dp?: string | undefined;
|
392
|
+
dq?: string | undefined;
|
393
|
+
e?: string | undefined;
|
394
|
+
ext?: boolean | undefined;
|
395
|
+
k?: string | undefined;
|
396
|
+
key_ops?: string[] | undefined;
|
397
|
+
kid?: string | undefined;
|
398
|
+
n?: string | undefined;
|
399
|
+
p?: string | undefined;
|
400
|
+
q?: string | undefined;
|
401
|
+
qi?: string | undefined;
|
402
|
+
use?: string | undefined;
|
403
|
+
x?: string | undefined;
|
404
|
+
y?: string | undefined;
|
405
|
+
x5c?: string[] | undefined;
|
406
|
+
x5t?: string | undefined;
|
407
|
+
"x5t#S256"?: string | undefined;
|
408
|
+
x5u?: string | undefined;
|
409
|
+
}>, "many">;
|
410
|
+
}, "strip", z.ZodTypeAny, {
|
411
|
+
keys: {
|
412
|
+
kty: "RSA" | "EC";
|
413
|
+
alg?: string | undefined;
|
414
|
+
crv?: string | undefined;
|
415
|
+
d?: string | undefined;
|
416
|
+
dp?: string | undefined;
|
417
|
+
dq?: string | undefined;
|
418
|
+
e?: string | undefined;
|
419
|
+
ext?: boolean | undefined;
|
420
|
+
k?: string | undefined;
|
421
|
+
key_ops?: string[] | undefined;
|
422
|
+
kid?: string | undefined;
|
423
|
+
n?: string | undefined;
|
424
|
+
p?: string | undefined;
|
425
|
+
q?: string | undefined;
|
426
|
+
qi?: string | undefined;
|
427
|
+
use?: string | undefined;
|
428
|
+
x?: string | undefined;
|
429
|
+
y?: string | undefined;
|
430
|
+
x5c?: string[] | undefined;
|
431
|
+
x5t?: string | undefined;
|
432
|
+
"x5t#S256"?: string | undefined;
|
433
|
+
x5u?: string | undefined;
|
434
|
+
}[];
|
435
|
+
}, {
|
436
|
+
keys: {
|
437
|
+
kty: "RSA" | "EC";
|
438
|
+
alg?: string | undefined;
|
439
|
+
crv?: string | undefined;
|
440
|
+
d?: string | undefined;
|
441
|
+
dp?: string | undefined;
|
442
|
+
dq?: string | undefined;
|
443
|
+
e?: string | undefined;
|
444
|
+
ext?: boolean | undefined;
|
445
|
+
k?: string | undefined;
|
446
|
+
key_ops?: string[] | undefined;
|
447
|
+
kid?: string | undefined;
|
448
|
+
n?: string | undefined;
|
449
|
+
p?: string | undefined;
|
450
|
+
q?: string | undefined;
|
451
|
+
qi?: string | undefined;
|
452
|
+
use?: string | undefined;
|
453
|
+
x?: string | undefined;
|
454
|
+
y?: string | undefined;
|
455
|
+
x5c?: string[] | undefined;
|
456
|
+
x5t?: string | undefined;
|
457
|
+
"x5t#S256"?: string | undefined;
|
458
|
+
x5u?: string | undefined;
|
459
|
+
}[];
|
460
|
+
}>>;
|
461
|
+
}, "strip", z.ZodTypeAny, {
|
462
|
+
authorization_encrypted_response_alg?: string | undefined;
|
463
|
+
authorization_encrypted_response_enc?: string | undefined;
|
464
|
+
jwks_uri?: string | undefined;
|
465
|
+
jwks?: {
|
466
|
+
keys: {
|
467
|
+
kty: "RSA" | "EC";
|
468
|
+
alg?: string | undefined;
|
469
|
+
crv?: string | undefined;
|
470
|
+
d?: string | undefined;
|
471
|
+
dp?: string | undefined;
|
472
|
+
dq?: string | undefined;
|
473
|
+
e?: string | undefined;
|
474
|
+
ext?: boolean | undefined;
|
475
|
+
k?: string | undefined;
|
476
|
+
key_ops?: string[] | undefined;
|
477
|
+
kid?: string | undefined;
|
478
|
+
n?: string | undefined;
|
479
|
+
p?: string | undefined;
|
480
|
+
q?: string | undefined;
|
481
|
+
qi?: string | undefined;
|
482
|
+
use?: string | undefined;
|
483
|
+
x?: string | undefined;
|
484
|
+
y?: string | undefined;
|
485
|
+
x5c?: string[] | undefined;
|
486
|
+
x5t?: string | undefined;
|
487
|
+
"x5t#S256"?: string | undefined;
|
488
|
+
x5u?: string | undefined;
|
489
|
+
}[];
|
490
|
+
} | undefined;
|
491
|
+
}, {
|
492
|
+
authorization_encrypted_response_alg?: string | undefined;
|
493
|
+
authorization_encrypted_response_enc?: string | undefined;
|
494
|
+
jwks_uri?: string | undefined;
|
495
|
+
jwks?: {
|
496
|
+
keys: {
|
497
|
+
kty: "RSA" | "EC";
|
498
|
+
alg?: string | undefined;
|
499
|
+
crv?: string | undefined;
|
500
|
+
d?: string | undefined;
|
501
|
+
dp?: string | undefined;
|
502
|
+
dq?: string | undefined;
|
503
|
+
e?: string | undefined;
|
504
|
+
ext?: boolean | undefined;
|
505
|
+
k?: string | undefined;
|
506
|
+
key_ops?: string[] | undefined;
|
507
|
+
kid?: string | undefined;
|
508
|
+
n?: string | undefined;
|
509
|
+
p?: string | undefined;
|
510
|
+
q?: string | undefined;
|
511
|
+
qi?: string | undefined;
|
512
|
+
use?: string | undefined;
|
513
|
+
x?: string | undefined;
|
514
|
+
y?: string | undefined;
|
515
|
+
x5c?: string[] | undefined;
|
516
|
+
x5t?: string | undefined;
|
517
|
+
"x5t#S256"?: string | undefined;
|
518
|
+
x5u?: string | undefined;
|
519
|
+
}[];
|
520
|
+
} | undefined;
|
521
|
+
}>>;
|
335
522
|
scope: z.ZodOptional<z.ZodString>;
|
336
523
|
presentation_definition: z.ZodOptional<z.ZodObject<{
|
337
524
|
id: z.ZodString;
|
@@ -557,10 +744,41 @@ export declare const RequestObject: z.ZodObject<{
|
|
557
744
|
response_mode: "direct_post.jwt" | "direct_post";
|
558
745
|
client_id: string;
|
559
746
|
response_uri: string;
|
560
|
-
client_id_scheme: string;
|
561
747
|
iss?: string | undefined;
|
562
748
|
iat?: number | undefined;
|
563
749
|
exp?: number | undefined;
|
750
|
+
client_id_scheme?: string | undefined;
|
751
|
+
client_metadata?: {
|
752
|
+
authorization_encrypted_response_alg?: string | undefined;
|
753
|
+
authorization_encrypted_response_enc?: string | undefined;
|
754
|
+
jwks_uri?: string | undefined;
|
755
|
+
jwks?: {
|
756
|
+
keys: {
|
757
|
+
kty: "RSA" | "EC";
|
758
|
+
alg?: string | undefined;
|
759
|
+
crv?: string | undefined;
|
760
|
+
d?: string | undefined;
|
761
|
+
dp?: string | undefined;
|
762
|
+
dq?: string | undefined;
|
763
|
+
e?: string | undefined;
|
764
|
+
ext?: boolean | undefined;
|
765
|
+
k?: string | undefined;
|
766
|
+
key_ops?: string[] | undefined;
|
767
|
+
kid?: string | undefined;
|
768
|
+
n?: string | undefined;
|
769
|
+
p?: string | undefined;
|
770
|
+
q?: string | undefined;
|
771
|
+
qi?: string | undefined;
|
772
|
+
use?: string | undefined;
|
773
|
+
x?: string | undefined;
|
774
|
+
y?: string | undefined;
|
775
|
+
x5c?: string[] | undefined;
|
776
|
+
x5t?: string | undefined;
|
777
|
+
"x5t#S256"?: string | undefined;
|
778
|
+
x5u?: string | undefined;
|
779
|
+
}[];
|
780
|
+
} | undefined;
|
781
|
+
} | undefined;
|
564
782
|
scope?: string | undefined;
|
565
783
|
presentation_definition?: {
|
566
784
|
id: string;
|
@@ -606,10 +824,41 @@ export declare const RequestObject: z.ZodObject<{
|
|
606
824
|
response_mode: "direct_post.jwt" | "direct_post";
|
607
825
|
client_id: string;
|
608
826
|
response_uri: string;
|
609
|
-
client_id_scheme: string;
|
610
827
|
iss?: string | undefined;
|
611
828
|
iat?: number | undefined;
|
612
829
|
exp?: number | undefined;
|
830
|
+
client_id_scheme?: string | undefined;
|
831
|
+
client_metadata?: {
|
832
|
+
authorization_encrypted_response_alg?: string | undefined;
|
833
|
+
authorization_encrypted_response_enc?: string | undefined;
|
834
|
+
jwks_uri?: string | undefined;
|
835
|
+
jwks?: {
|
836
|
+
keys: {
|
837
|
+
kty: "RSA" | "EC";
|
838
|
+
alg?: string | undefined;
|
839
|
+
crv?: string | undefined;
|
840
|
+
d?: string | undefined;
|
841
|
+
dp?: string | undefined;
|
842
|
+
dq?: string | undefined;
|
843
|
+
e?: string | undefined;
|
844
|
+
ext?: boolean | undefined;
|
845
|
+
k?: string | undefined;
|
846
|
+
key_ops?: string[] | undefined;
|
847
|
+
kid?: string | undefined;
|
848
|
+
n?: string | undefined;
|
849
|
+
p?: string | undefined;
|
850
|
+
q?: string | undefined;
|
851
|
+
qi?: string | undefined;
|
852
|
+
use?: string | undefined;
|
853
|
+
x?: string | undefined;
|
854
|
+
y?: string | undefined;
|
855
|
+
x5c?: string[] | undefined;
|
856
|
+
x5t?: string | undefined;
|
857
|
+
"x5t#S256"?: string | undefined;
|
858
|
+
x5u?: string | undefined;
|
859
|
+
}[];
|
860
|
+
} | undefined;
|
861
|
+
} | undefined;
|
613
862
|
scope?: string | undefined;
|
614
863
|
presentation_definition?: {
|
615
864
|
id: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACO,MAAM;IACzB,MAAM,EAAE;IACsC,aAAa;CACzE,CAAC;AAmBF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO1B,CAAC;AAqBH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBxB,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TrustAnchorEntityConfiguration } from "./types";
|
2
|
-
import type
|
2
|
+
import { type JWTDecodeResult } from "../../utils/jwk";
|
3
3
|
type ParsedToken = {
|
4
4
|
header: JWTDecodeResult["protectedHeader"];
|
5
5
|
payload: JWTDecodeResult["payload"];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAO,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAiCF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,qBA6BvC"}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
|
+
import { RSAKey, KJUR } from "jsrsasign";
|
3
|
+
import { JWK } from "./jwk";
|
2
4
|
/**
|
3
5
|
* Create a CryptoContext bound to a key pair.
|
4
6
|
* Key pair is supposed to exist already in the device's keychain.
|
@@ -16,4 +18,26 @@ export declare const createCryptoContextFor: (keytag: string) => CryptoContext;
|
|
16
18
|
* @returns The returned value of the input procedure.
|
17
19
|
*/
|
18
20
|
export declare const withEphemeralKey: <R>(fn: (ephemeralContext: CryptoContext) => Promise<R>) => Promise<R>;
|
21
|
+
/**
|
22
|
+
* Converts a certificate string to PEM format.
|
23
|
+
*
|
24
|
+
* @param certificate - The certificate string.
|
25
|
+
* @returns The PEM-formatted certificate.
|
26
|
+
*/
|
27
|
+
export declare const convertCertToPem: (certificate: string) => string;
|
28
|
+
/**
|
29
|
+
* Parses the public key from a PEM-formatted certificate.
|
30
|
+
*
|
31
|
+
* @param pemCert - The PEM-formatted certificate.
|
32
|
+
* @returns The public key object.
|
33
|
+
* @throws Will throw an error if the public key is unsupported.
|
34
|
+
*/
|
35
|
+
export declare const parsePublicKey: (pemCert: string) => RSAKey | KJUR.crypto.ECDSA | undefined;
|
36
|
+
/**
|
37
|
+
* Retrieves the signing JWK from the public key.
|
38
|
+
*
|
39
|
+
* @param publicKey - The public key object.
|
40
|
+
* @returns The signing JWK.
|
41
|
+
*/
|
42
|
+
export declare const getSigningJwk: (publicKey: RSAKey | KJUR.crypto.ECDSA) => JWK;
|
19
43
|
//# sourceMappingURL=crypto.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAiB,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,WAAY,MAAM,KAAG,aA6BvD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,6BACJ,aAAa,8BAOrC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,KAAG,MACmB,CAAC;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,YAChB,MAAM,KACd,MAAM,GAAG,KAAK,MAAM,CAAC,KAAK,GAAG,SAU/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,cAAe,MAAM,GAAG,KAAK,MAAM,CAAC,KAAK,KAAG,GAGpE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../src/utils/decoder.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../src/utils/decoder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AA8B7C,eAAO,MAAM,kBAAkB,aACnB,MAAM,KACf,QAAQ;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,eAAe,CAAA;CAAE,CAkBtD,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { decode } from "@pagopa/io-react-native-jwt";
|
1
2
|
import { z } from "zod";
|
2
3
|
export type JWK = z.infer<typeof JWK>;
|
3
4
|
export declare const JWK: z.ZodObject<{
|
@@ -226,4 +227,5 @@ export declare const JWKS: z.ZodObject<{
|
|
226
227
|
x5u?: string | undefined;
|
227
228
|
}[];
|
228
229
|
}>;
|
230
|
+
export type JWTDecodeResult = ReturnType<typeof decode>;
|
229
231
|
//# sourceMappingURL=jwk.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jwk.d.ts","sourceRoot":"","sources":["../../../src/utils/jwk.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"jwk.d.ts","sourceRoot":"","sources":["../../../src/utils/jwk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,MAAM,6BAA6B,CAAC;AACpE,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;AAEH;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAUpD;AAED,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,eAAO,MAAM,IAAI;;QAzDf,uCAAuC;;;;;;;QAOvC,yCAAyC;;;QAGzC,gDAAgD;;QAEhD,oCAAoC;;QAEpC;;sCAE8B;;;;;;QAM9B,4CAA4C;;;;QAI5C,qDAAqD;;QAErD,gEAAgE;;QAEhE,mEAAmE;;QAEnE,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BvC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.3.0",
|
4
4
|
"description": "Provide data structures, helpers and API for IO Wallet",
|
5
5
|
"main": "lib/commonjs/index",
|
6
6
|
"module": "lib/module/index",
|
@@ -55,7 +55,7 @@
|
|
55
55
|
"devDependencies": {
|
56
56
|
"@pagopa/eslint-config": "^3.0.0",
|
57
57
|
"@pagopa/io-react-native-crypto": "^0.2.3",
|
58
|
-
"@pagopa/io-react-native-jwt": "^
|
58
|
+
"@pagopa/io-react-native-jwt": "^2.0.0",
|
59
59
|
"@react-native/eslint-config": "^0.72.2",
|
60
60
|
"@rushstack/eslint-patch": "^1.3.2",
|
61
61
|
"@types/jest": "^28.1.2",
|
@@ -108,10 +108,12 @@
|
|
108
108
|
]
|
109
109
|
},
|
110
110
|
"dependencies": {
|
111
|
+
"@types/jsrsasign": "^10.5.15",
|
111
112
|
"ajv": "^8.17.1",
|
112
113
|
"js-base64": "^3.7.7",
|
113
114
|
"js-sha256": "^0.9.0",
|
114
115
|
"jsonpath-plus": "^10.2.0",
|
116
|
+
"jsrsasign": "^11.1.0",
|
115
117
|
"parse-url": "^9.2.0",
|
116
118
|
"react-native-url-polyfill": "^2.0.0",
|
117
119
|
"react-native-uuid": "^2.0.1",
|
@@ -102,6 +102,9 @@ export const startUserAuthorization: StartUserAuthorization = async (
|
|
102
102
|
} = ctx;
|
103
103
|
|
104
104
|
const clientId = await wiaCryptoContext.getPublicKey().then((_) => _.kid);
|
105
|
+
if (!clientId) {
|
106
|
+
throw new Error("No public key found");
|
107
|
+
}
|
105
108
|
const codeVerifier = generateRandomAlphaNumericString(64);
|
106
109
|
const parEndpoint = issuerConf.pushed_authorization_request_endpoint;
|
107
110
|
const credentialDefinition = selectCredentialDefinition(
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import * as z from "zod";
|
2
|
-
import {
|
2
|
+
import { ValidationFailed } from "../../utils/errors";
|
3
3
|
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
clientId: z.string(),
|
8
|
-
requestURI: z.string(),
|
4
|
+
const PresentationParams = z.object({
|
5
|
+
clientId: z.string().nonempty(),
|
6
|
+
requestUri: z.string().url(),
|
9
7
|
});
|
10
8
|
|
11
9
|
/**
|
@@ -16,46 +14,32 @@ const QRCodePayload = z.object({
|
|
16
14
|
* @returns The url for the Relying Party to connect with
|
17
15
|
*/
|
18
16
|
export type StartFlow<T extends Array<unknown> = []> = (...args: T) => {
|
19
|
-
|
17
|
+
requestUri: string;
|
20
18
|
clientId: string;
|
21
19
|
};
|
22
20
|
|
23
21
|
/**
|
24
|
-
* Start a presentation flow by decoding
|
22
|
+
* Start a presentation flow by decoding the parameters needed to start the presentation flow.
|
25
23
|
*
|
26
24
|
* @param qrcode The encoded QR-code content
|
27
25
|
* @returns The url for the Relying Party to connect with
|
28
26
|
* @throws If the provided qr code fails to be decoded
|
29
27
|
*/
|
30
|
-
export const startFlowFromQR: StartFlow<[string]> = (
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
? qrcode.replace(`${originalQrCode[0]}://`, "https://wallet.example/")
|
37
|
-
: qrcode;
|
38
|
-
|
39
|
-
decodedUrl = new URL(replacedQrcode);
|
40
|
-
} catch (error) {
|
41
|
-
throw new InvalidQRCodeError(`Failed to decode QR code: ${qrcode}`);
|
42
|
-
}
|
43
|
-
|
44
|
-
const protocol = decodedUrl.protocol;
|
45
|
-
const resource = decodedUrl.hostname;
|
46
|
-
const requestURI = decodedUrl.searchParams.get("request_uri");
|
47
|
-
const clientId = decodedUrl.searchParams.get("client_id");
|
48
|
-
|
49
|
-
const result = QRCodePayload.safeParse({
|
50
|
-
protocol,
|
51
|
-
resource,
|
52
|
-
requestURI,
|
28
|
+
export const startFlowFromQR: StartFlow<[string, string]> = (
|
29
|
+
requestUri: string,
|
30
|
+
clientId: string
|
31
|
+
) => {
|
32
|
+
const result = PresentationParams.safeParse({
|
33
|
+
requestUri,
|
53
34
|
clientId,
|
54
35
|
});
|
55
36
|
|
56
37
|
if (result.success) {
|
57
38
|
return result.data;
|
58
39
|
} else {
|
59
|
-
throw new
|
40
|
+
throw new ValidationFailed({
|
41
|
+
message: "Invalid parameters provided",
|
42
|
+
reason: result.error.message,
|
43
|
+
});
|
60
44
|
}
|
61
45
|
};
|
@@ -9,7 +9,7 @@ import { hasStatusOrThrow, type Out } from "../../utils/misc";
|
|
9
9
|
import type { StartFlow } from "./01-start-flow";
|
10
10
|
|
11
11
|
export type GetRequestObject = (
|
12
|
-
requestUri: Out<StartFlow>["
|
12
|
+
requestUri: Out<StartFlow>["requestUri"],
|
13
13
|
context: {
|
14
14
|
wiaCryptoContext: CryptoContext;
|
15
15
|
appFetch?: GlobalFetch["fetch"];
|