@pagopa/io-react-native-iso18013 0.2.0 → 0.4.0

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.
Files changed (95) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeCborModule.kt +67 -164
  3. package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeIso18013Module.kt +102 -146
  4. package/ios/Base64Utils.swift +10 -3
  5. package/ios/IoReactNativeCbor.swift +55 -125
  6. package/ios/IoReactNativeIso18013.swift +88 -117
  7. package/lib/module/cbor/cbor/README.md +37 -5
  8. package/lib/module/cbor/cbor/error.js +15 -0
  9. package/lib/module/cbor/cbor/error.js.map +1 -0
  10. package/lib/module/cbor/cbor/index.js +1 -0
  11. package/lib/module/cbor/cbor/index.js.map +1 -1
  12. package/lib/module/cbor/cose/README.md +39 -9
  13. package/lib/module/cbor/cose/error.js +17 -0
  14. package/lib/module/cbor/cose/error.js.map +1 -0
  15. package/lib/module/cbor/cose/index.js +1 -0
  16. package/lib/module/cbor/cose/index.js.map +1 -1
  17. package/lib/module/cbor/index.js +1 -1
  18. package/lib/module/cbor/index.js.map +1 -1
  19. package/lib/module/iso18013/index.js +2 -3
  20. package/lib/module/iso18013/index.js.map +1 -1
  21. package/lib/module/iso18013/iso18013-5/README.md +52 -16
  22. package/lib/module/iso18013/iso18013-5/error.js +25 -0
  23. package/lib/module/iso18013/iso18013-5/error.js.map +1 -0
  24. package/lib/module/iso18013/iso18013-5/index.js +3 -2
  25. package/lib/module/iso18013/iso18013-5/index.js.map +1 -1
  26. package/lib/module/iso18013/iso18013-5/proximity.js +10 -18
  27. package/lib/module/iso18013/iso18013-5/proximity.js.map +1 -1
  28. package/lib/module/iso18013/iso18013-5/{schema.js → request.js} +1 -20
  29. package/lib/module/iso18013/iso18013-5/request.js.map +1 -0
  30. package/lib/module/iso18013/iso18013-7/README.md +38 -9
  31. package/lib/module/iso18013/iso18013-7/error.js +15 -0
  32. package/lib/module/iso18013/iso18013-7/error.js.map +1 -0
  33. package/lib/module/iso18013/iso18013-7/index.js +1 -0
  34. package/lib/module/iso18013/iso18013-7/index.js.map +1 -1
  35. package/lib/module/iso18013/iso18013-7/remote.js +2 -14
  36. package/lib/module/iso18013/iso18013-7/remote.js.map +1 -1
  37. package/lib/module/schema.js +46 -0
  38. package/lib/module/schema.js.map +1 -0
  39. package/lib/typescript/src/cbor/cbor/error.d.ts +68 -0
  40. package/lib/typescript/src/cbor/cbor/error.d.ts.map +1 -0
  41. package/lib/typescript/src/cbor/cbor/index.d.ts +1 -1
  42. package/lib/typescript/src/cbor/cbor/index.d.ts.map +1 -1
  43. package/lib/typescript/src/cbor/cose/error.d.ts +68 -0
  44. package/lib/typescript/src/cbor/cose/error.d.ts.map +1 -0
  45. package/lib/typescript/src/cbor/cose/index.d.ts +1 -1
  46. package/lib/typescript/src/cbor/cose/index.d.ts.map +1 -1
  47. package/lib/typescript/src/iso18013/index.d.ts +1 -2
  48. package/lib/typescript/src/iso18013/index.d.ts.map +1 -1
  49. package/lib/typescript/src/iso18013/iso18013-5/error.d.ts +73 -0
  50. package/lib/typescript/src/iso18013/iso18013-5/error.d.ts.map +1 -0
  51. package/lib/typescript/src/iso18013/iso18013-5/index.d.ts +3 -2
  52. package/lib/typescript/src/iso18013/iso18013-5/index.d.ts.map +1 -1
  53. package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts +2 -7
  54. package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts.map +1 -1
  55. package/lib/typescript/src/iso18013/iso18013-5/{schema.d.ts → request.d.ts} +1 -16
  56. package/lib/typescript/src/iso18013/iso18013-5/request.d.ts.map +1 -0
  57. package/lib/typescript/src/iso18013/iso18013-7/error.d.ts +68 -0
  58. package/lib/typescript/src/iso18013/iso18013-7/error.d.ts.map +1 -0
  59. package/lib/typescript/src/iso18013/iso18013-7/index.d.ts +2 -1
  60. package/lib/typescript/src/iso18013/iso18013-7/index.d.ts.map +1 -1
  61. package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts +0 -14
  62. package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts.map +1 -1
  63. package/lib/typescript/src/schema.d.ts +76 -0
  64. package/lib/typescript/src/schema.d.ts.map +1 -0
  65. package/package.json +1 -1
  66. package/src/cbor/cbor/README.md +37 -5
  67. package/src/cbor/cbor/error.ts +23 -0
  68. package/src/cbor/cbor/index.ts +5 -1
  69. package/src/cbor/cose/README.md +39 -9
  70. package/src/cbor/cose/error.ts +23 -0
  71. package/src/cbor/cose/index.ts +5 -1
  72. package/src/cbor/index.ts +1 -1
  73. package/src/iso18013/index.ts +2 -9
  74. package/src/iso18013/iso18013-5/README.md +52 -16
  75. package/src/iso18013/iso18013-5/error.ts +35 -0
  76. package/src/iso18013/iso18013-5/index.ts +9 -4
  77. package/src/iso18013/iso18013-5/proximity.ts +11 -19
  78. package/src/iso18013/iso18013-5/{schema.ts → request.ts} +0 -20
  79. package/src/iso18013/iso18013-7/README.md +38 -9
  80. package/src/iso18013/iso18013-7/error.ts +21 -0
  81. package/src/iso18013/iso18013-7/index.ts +5 -4
  82. package/src/iso18013/iso18013-7/remote.ts +2 -22
  83. package/src/schema.ts +55 -0
  84. package/lib/module/cbor/cbor/failure.js +0 -2
  85. package/lib/module/cbor/cbor/failure.js.map +0 -1
  86. package/lib/module/cbor/cose/failure.js +0 -2
  87. package/lib/module/cbor/cose/failure.js.map +0 -1
  88. package/lib/module/iso18013/iso18013-5/schema.js.map +0 -1
  89. package/lib/typescript/src/cbor/cbor/failure.d.ts +0 -15
  90. package/lib/typescript/src/cbor/cbor/failure.d.ts.map +0 -1
  91. package/lib/typescript/src/cbor/cose/failure.d.ts +0 -15
  92. package/lib/typescript/src/cbor/cose/failure.d.ts.map +0 -1
  93. package/lib/typescript/src/iso18013/iso18013-5/schema.d.ts.map +0 -1
  94. package/src/cbor/cbor/failure.ts +0 -18
  95. package/src/cbor/cose/failure.ts +0 -20
@@ -0,0 +1,68 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Error codes which the CBOR module uses to reject a promise.
4
+ */
5
+ declare const ModuleErrorCodesSchema: z.ZodEnum<["DECODE_ERROR", "DECODE_DOCUMENTS_ERROR", "DECODE_ISSUER_SIGNED_ERROR", "EUNSPECIFIED"]>;
6
+ export type ModuleErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
7
+ /**
8
+ * Schema which can be used to parse a rejected promise error by the CBOR module.
9
+ */
10
+ export declare const ModuleErrorSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
11
+ code: z.ZodEnum<["DECODE_ERROR", "DECODE_DOCUMENTS_ERROR", "DECODE_ISSUER_SIGNED_ERROR", "EUNSPECIFIED"]>;
12
+ message: z.ZodString;
13
+ name: z.ZodString;
14
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ code: "DECODE_ERROR" | "DECODE_DOCUMENTS_ERROR" | "DECODE_ISSUER_SIGNED_ERROR" | "EUNSPECIFIED";
17
+ message: string;
18
+ name: string;
19
+ userInfo?: Record<string, any> | null | undefined;
20
+ }, {
21
+ code: "DECODE_ERROR" | "DECODE_DOCUMENTS_ERROR" | "DECODE_ISSUER_SIGNED_ERROR" | "EUNSPECIFIED";
22
+ message: string;
23
+ name: string;
24
+ userInfo?: Record<string, any> | null | undefined;
25
+ }>, z.ZodObject<{
26
+ nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ lineNumber: z.ZodNumber;
28
+ file: z.ZodString;
29
+ methodName: z.ZodString;
30
+ class: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ lineNumber: number;
33
+ file: string;
34
+ methodName: string;
35
+ class: string;
36
+ }, {
37
+ lineNumber: number;
38
+ file: string;
39
+ methodName: string;
40
+ class: string;
41
+ }>, "many">>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ nativeStackAndroid?: {
44
+ lineNumber: number;
45
+ file: string;
46
+ methodName: string;
47
+ class: string;
48
+ }[] | undefined;
49
+ }, {
50
+ nativeStackAndroid?: {
51
+ lineNumber: number;
52
+ file: string;
53
+ methodName: string;
54
+ class: string;
55
+ }[] | undefined;
56
+ }>>, z.ZodObject<{
57
+ domain: z.ZodOptional<z.ZodString>;
58
+ nativeStackIOS: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ domain?: string | undefined;
61
+ nativeStackIOS?: string[] | undefined;
62
+ }, {
63
+ domain?: string | undefined;
64
+ nativeStackIOS?: string[] | undefined;
65
+ }>>;
66
+ export type ModuleError = z.infer<typeof ModuleErrorSchema>;
67
+ export {};
68
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cbor/error.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB;;GAEG;AACH,QAAA,MAAM,sBAAsB,qGAK1B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { decode, decodeDocuments, decodeIssuerSigned } from './decoder';
2
2
  export { DocumentValue, Documents, DocumentsFromString, IssuerSigned, MDOC, } from './schema';
3
- export { type CborFailure, type CborFailureCodes } from './failure';
3
+ export { type ModuleError, type ModuleErrorCodes, ModuleErrorSchema, } from './error';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cbor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACL,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cbor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACL,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,iBAAiB,GAClB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,68 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Error codes which the COSE module uses to reject a promise.
4
+ */
5
+ declare const ModuleErrorCodesSchema: z.ZodEnum<["SIGN_ERROR", "VERIFY_ERROR", "THREADING_ERROR", "EUNSPECIFIED"]>;
6
+ export type ModuleErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
7
+ /**
8
+ * Schema which can be used to parse a rejected promise error by the COSE module.
9
+ */
10
+ export declare const ModuleErrorSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
11
+ code: z.ZodEnum<["SIGN_ERROR", "VERIFY_ERROR", "THREADING_ERROR", "EUNSPECIFIED"]>;
12
+ message: z.ZodString;
13
+ name: z.ZodString;
14
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ code: "EUNSPECIFIED" | "SIGN_ERROR" | "VERIFY_ERROR" | "THREADING_ERROR";
17
+ message: string;
18
+ name: string;
19
+ userInfo?: Record<string, any> | null | undefined;
20
+ }, {
21
+ code: "EUNSPECIFIED" | "SIGN_ERROR" | "VERIFY_ERROR" | "THREADING_ERROR";
22
+ message: string;
23
+ name: string;
24
+ userInfo?: Record<string, any> | null | undefined;
25
+ }>, z.ZodObject<{
26
+ nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ lineNumber: z.ZodNumber;
28
+ file: z.ZodString;
29
+ methodName: z.ZodString;
30
+ class: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ lineNumber: number;
33
+ file: string;
34
+ methodName: string;
35
+ class: string;
36
+ }, {
37
+ lineNumber: number;
38
+ file: string;
39
+ methodName: string;
40
+ class: string;
41
+ }>, "many">>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ nativeStackAndroid?: {
44
+ lineNumber: number;
45
+ file: string;
46
+ methodName: string;
47
+ class: string;
48
+ }[] | undefined;
49
+ }, {
50
+ nativeStackAndroid?: {
51
+ lineNumber: number;
52
+ file: string;
53
+ methodName: string;
54
+ class: string;
55
+ }[] | undefined;
56
+ }>>, z.ZodObject<{
57
+ domain: z.ZodOptional<z.ZodString>;
58
+ nativeStackIOS: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ domain?: string | undefined;
61
+ nativeStackIOS?: string[] | undefined;
62
+ }, {
63
+ domain?: string | undefined;
64
+ nativeStackIOS?: string[] | undefined;
65
+ }>>;
66
+ export type ModuleError = z.infer<typeof ModuleErrorSchema>;
67
+ export {};
68
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cose/error.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB;;GAEG;AACH,QAAA,MAAM,sBAAsB,8EAK1B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export { sign, verify } from './sign';
2
- export { type CoseFailure, type CoseFailureCodes } from './failure';
2
+ export { type ModuleErrorCodes, type ModuleError, ModuleErrorSchema, } from './error';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cose/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cose/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,SAAS,CAAC"}
@@ -1,3 +1,2 @@
1
- export { type AcceptedFields, type EventError, type VerifierRequest, parseEventError, parseVerifierRequest, } from './iso18013-5/schema';
2
- export declare const IoReactNativeProximity: any;
1
+ export declare const IoReactNativeIso18013: any;
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/iso18013/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,eAAe,EACf,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAQ7B,eAAO,MAAM,sBAAsB,KAS9B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/iso18013/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,qBAAqB,KAS7B,CAAC"}
@@ -0,0 +1,73 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Schema for parsing the payload returned by the `onError` event in Proximity `Events`, along with its type definition.
4
+ */
5
+ export declare const OnErrorPayloadSchema: z.ZodCatch<z.ZodString>;
6
+ export type OnErrorPayload = z.infer<typeof OnErrorPayloadSchema>;
7
+ /**
8
+ * Error codes which the ISO18013_5 module uses to reject a promise.
9
+ */
10
+ declare const ModuleErrorCodesSchema: z.ZodEnum<["DRH_NOT_DEFINED", "QR_ENGAGEMENT_NOT_DEFINED", "START_ERROR", "GET_QR_CODE_ERROR", "SEND_RESPONSE_ERROR", "SEND_ERROR_RESPONSE_ERROR", "GENERATE_RESPONSE_ERROR", "CLOSE_ERROR", "EUNSPECIFIED"]>;
11
+ export type ModuleErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
12
+ /**
13
+ * Schema which can be used to parse a rejected promise error by the ISO18013_5 module.
14
+ */
15
+ export declare const ModuleErrorSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
16
+ code: z.ZodEnum<["DRH_NOT_DEFINED", "QR_ENGAGEMENT_NOT_DEFINED", "START_ERROR", "GET_QR_CODE_ERROR", "SEND_RESPONSE_ERROR", "SEND_ERROR_RESPONSE_ERROR", "GENERATE_RESPONSE_ERROR", "CLOSE_ERROR", "EUNSPECIFIED"]>;
17
+ message: z.ZodString;
18
+ name: z.ZodString;
19
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ code: "EUNSPECIFIED" | "DRH_NOT_DEFINED" | "QR_ENGAGEMENT_NOT_DEFINED" | "START_ERROR" | "GET_QR_CODE_ERROR" | "SEND_RESPONSE_ERROR" | "SEND_ERROR_RESPONSE_ERROR" | "GENERATE_RESPONSE_ERROR" | "CLOSE_ERROR";
22
+ message: string;
23
+ name: string;
24
+ userInfo?: Record<string, any> | null | undefined;
25
+ }, {
26
+ code: "EUNSPECIFIED" | "DRH_NOT_DEFINED" | "QR_ENGAGEMENT_NOT_DEFINED" | "START_ERROR" | "GET_QR_CODE_ERROR" | "SEND_RESPONSE_ERROR" | "SEND_ERROR_RESPONSE_ERROR" | "GENERATE_RESPONSE_ERROR" | "CLOSE_ERROR";
27
+ message: string;
28
+ name: string;
29
+ userInfo?: Record<string, any> | null | undefined;
30
+ }>, z.ZodObject<{
31
+ nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
32
+ lineNumber: z.ZodNumber;
33
+ file: z.ZodString;
34
+ methodName: z.ZodString;
35
+ class: z.ZodString;
36
+ }, "strip", z.ZodTypeAny, {
37
+ lineNumber: number;
38
+ file: string;
39
+ methodName: string;
40
+ class: string;
41
+ }, {
42
+ lineNumber: number;
43
+ file: string;
44
+ methodName: string;
45
+ class: string;
46
+ }>, "many">>;
47
+ }, "strip", z.ZodTypeAny, {
48
+ nativeStackAndroid?: {
49
+ lineNumber: number;
50
+ file: string;
51
+ methodName: string;
52
+ class: string;
53
+ }[] | undefined;
54
+ }, {
55
+ nativeStackAndroid?: {
56
+ lineNumber: number;
57
+ file: string;
58
+ methodName: string;
59
+ class: string;
60
+ }[] | undefined;
61
+ }>>, z.ZodObject<{
62
+ domain: z.ZodOptional<z.ZodString>;
63
+ nativeStackIOS: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ domain?: string | undefined;
66
+ nativeStackIOS?: string[] | undefined;
67
+ }, {
68
+ domain?: string | undefined;
69
+ nativeStackIOS?: string[] | undefined;
70
+ }>>;
71
+ export type ModuleError = z.infer<typeof ModuleErrorSchema>;
72
+ export {};
73
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/error.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB;;GAEG;AACH,eAAO,MAAM,oBAAoB,yBAAoC,CAAC;AAEtE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,QAAA,MAAM,sBAAsB,+MAU1B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
- export { type AcceptedFields, type EventError, type VerifierRequest, parseEventError, parseVerifierRequest, } from './schema';
2
- export { ErrorCode, type Events, type EventsPayload, addListener, close, generateResponse, getQrCodeString, removeListener, sendErrorResponse, sendResponse, start, } from './proximity';
1
+ export { type AcceptedFields, type VerifierRequest, parseVerifierRequest, } from './request';
2
+ export { type OnErrorPayload, OnErrorPayloadSchema, ModuleErrorSchema, type ModuleErrorCodes, type ModuleError, } from './error';
3
+ export { ErrorCode, type Events, type EventsPayload, addListener, close, generateResponse, getQrCodeString, sendErrorResponse, sendResponse, start, } from './proximity';
3
4
  export { type RequestedDocument } from '../types';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,eAAe,EACf,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,SAAS,EACT,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,KAAK,GACN,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,SAAS,EACT,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,KAAK,GACN,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { AcceptedFields } from './schema';
1
+ import type { AcceptedFields } from './request';
2
2
  import type { RequestedDocument } from '../types';
3
3
  /**
4
4
  * Events emitted by the native module:
@@ -79,10 +79,5 @@ export declare function sendResponse(response: string): Promise<boolean>;
79
79
  * @param event - The event to listen for. The available events are defined in the `QrEngagementEvents` type.
80
80
  * @param callback - The callback to be called when the event is emitted. The callback will receive the event payload as an argument.
81
81
  */
82
- export declare function addListener<E extends Events>(event: E, callback: (data: EventsPayload[E]) => void): void;
83
- /**
84
- * Removes a listener for a `QrEngagementEvents` event.
85
- * @param event - The event to remove the listener for. The available events are defined in the `QrEngagementEvents` type.
86
- */
87
- export declare function removeListener(event: Events): void;
82
+ export declare function addListener<E extends Events>(event: E, callback: (data: EventsPayload[E]) => void): import("react-native").EmitterSubscription;
88
83
  //# sourceMappingURL=proximity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proximity.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/proximity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kBAAkB,EAAE,SAAS,CAAC;IAC9B,iBAAiB,EAAE,SAAS,CAAC;IAE7B,yBAAyB,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACzD,oBAAoB,EAAE,SAAS,CAAC;IAChC,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AACH,oBAAY,SAAS;IACnB,kBAAkB,KAAK;IACvB,aAAa,KAAK;IAClB,kBAAkB,KAAK;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,MAAM,GAAE;IACN,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAChC,GACL,OAAO,CAAC,OAAO,CAAC,CAalB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAExC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,EACnC,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,QAG3C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,QAE3C"}
1
+ {"version":3,"file":"proximity.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/proximity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kBAAkB,EAAE,SAAS,CAAC;IAC9B,iBAAiB,EAAE,SAAS,CAAC;IAE7B,yBAAyB,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACzD,oBAAoB,EAAE,SAAS,CAAC;IAChC,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AACH,oBAAY,SAAS;IACnB,kBAAkB,KAAK;IACvB,aAAa,KAAK;IAClB,kBAAkB,KAAK;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,MAAM,GAAE;IACN,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAChC,GACL,OAAO,CAAC,OAAO,CAAC,CAalB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAExC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,EACnC,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,8CAG3C"}
@@ -43,21 +43,6 @@ export type VerifierRequest = z.infer<typeof VerifierRequest>;
43
43
  * @returns The parsed VerifierRequest object
44
44
  */
45
45
  export declare const parseVerifierRequest: (input: unknown) => VerifierRequest;
46
- /**
47
- * Zod schema for the type returned by the `onError` event in Proximity `Events`.
48
- */
49
- declare const EventError: z.ZodCatch<z.ZodString>;
50
- /**
51
- * Error type returned by the `onError` event in Proximity `Events`.
52
- */
53
- export type EventError = z.infer<typeof EventError>;
54
- /**
55
- * Parses the input to an Error object.
56
- * This function is used to parse the error received from the verifier app via the `onError` event.
57
- * @param input - The input to be parsed
58
- * @returns The parsed Error object or a default error message if parsing fails
59
- */
60
- export declare const parseEventError: (input: unknown) => EventError;
61
46
  /**
62
47
  * This is the type definition for the accepted fields that will be presented to the verifier app.
63
48
  * It contains of a nested object structure, where the outermost key represents the credential doctype.
@@ -82,4 +67,4 @@ export type AcceptedFields = {
82
67
  };
83
68
  };
84
69
  export {};
85
- //# sourceMappingURL=schema.d.ts.map
70
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;EAEnB,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,eAErD,CAAC;AAEF;;;;;;;;;;;;;;;IAeI;AACJ,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,UAAU,EAAE,MAAM,GAAG;QACpB,CAAC,SAAS,EAAE,MAAM,GAAG;YAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KACnD,CAAC;CACH,CAAC"}
@@ -0,0 +1,68 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Error codes which the ISO18013_7 module uses to reject a promise.
4
+ */
5
+ declare const ModuleErrorCodesSchema: z.ZodEnum<["GENERATE_OID4VP_RESPONSE_ERROR", "EUNSPECIFIED"]>;
6
+ export type ModuleErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
7
+ /**
8
+ * Schema which can be used to parse a rejected promise error by the ISO18013_7 module.
9
+ */
10
+ export declare const ModuleErrorSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
11
+ code: z.ZodEnum<["GENERATE_OID4VP_RESPONSE_ERROR", "EUNSPECIFIED"]>;
12
+ message: z.ZodString;
13
+ name: z.ZodString;
14
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ code: "EUNSPECIFIED" | "GENERATE_OID4VP_RESPONSE_ERROR";
17
+ message: string;
18
+ name: string;
19
+ userInfo?: Record<string, any> | null | undefined;
20
+ }, {
21
+ code: "EUNSPECIFIED" | "GENERATE_OID4VP_RESPONSE_ERROR";
22
+ message: string;
23
+ name: string;
24
+ userInfo?: Record<string, any> | null | undefined;
25
+ }>, z.ZodObject<{
26
+ nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ lineNumber: z.ZodNumber;
28
+ file: z.ZodString;
29
+ methodName: z.ZodString;
30
+ class: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ lineNumber: number;
33
+ file: string;
34
+ methodName: string;
35
+ class: string;
36
+ }, {
37
+ lineNumber: number;
38
+ file: string;
39
+ methodName: string;
40
+ class: string;
41
+ }>, "many">>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ nativeStackAndroid?: {
44
+ lineNumber: number;
45
+ file: string;
46
+ methodName: string;
47
+ class: string;
48
+ }[] | undefined;
49
+ }, {
50
+ nativeStackAndroid?: {
51
+ lineNumber: number;
52
+ file: string;
53
+ methodName: string;
54
+ class: string;
55
+ }[] | undefined;
56
+ }>>, z.ZodObject<{
57
+ domain: z.ZodOptional<z.ZodString>;
58
+ nativeStackIOS: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ domain?: string | undefined;
61
+ nativeStackIOS?: string[] | undefined;
62
+ }, {
63
+ domain?: string | undefined;
64
+ nativeStackIOS?: string[] | undefined;
65
+ }>>;
66
+ export type ModuleError = z.infer<typeof ModuleErrorSchema>;
67
+ export {};
68
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-7/error.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB;;GAEG;AACH,QAAA,MAAM,sBAAsB,+DAG1B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
- export { generateOID4VPDeviceResponse, type OID4VPFailure, type OID4VPFailureCodes, } from './remote';
1
+ export { generateOID4VPDeviceResponse } from './remote';
2
+ export { ModuleErrorSchema, type ModuleError, type ModuleErrorCodes, } from './error';
2
3
  export { type RequestedDocument } from '../types';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-7/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-7/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
@@ -1,18 +1,4 @@
1
1
  import type { RequestedDocument } from '../types';
2
- /**
3
- * All error codes that the module could return.
4
- */
5
- export type OID4VPFailureCodes = 'UNABLE_TO_GENERATE_RESPONSE' | 'UNABLE_TO_GENERATE_TRANSCRIPT' | 'INVALID_DOC_REQUESTED' | 'GENERATE_OID4VP_DEVICE_RESPONSE_FAILED';
6
- /**
7
- * Error type returned by a rejected promise.
8
- *
9
- * If additional error information are available,
10
- * they are stored in the {@link OID4VPFailure["userInfo"]} field.
11
- */
12
- export type OID4VPFailure = {
13
- message: OID4VPFailureCodes;
14
- userInfo: Record<string, string>;
15
- };
16
2
  /**
17
3
  *
18
4
  * @param clientId extracted from OID4VP session
@@ -1 +1 @@
1
- {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-7/remote.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,6BAA6B,GAC7B,+BAA+B,GAC/B,uBAAuB,GACvB,wCAAwC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,2BAA2B,MAAM,EACjC,oBAAoB,MAAM,EAC1B,WAAW,KAAK,CAAC,iBAAiB,CAAC,EACnC,2BAA2B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,KACtD,OAAO,CAAC,MAAM,CAWhB,CAAC"}
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-7/remote.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,2BAA2B,MAAM,EACjC,oBAAoB,MAAM,EAC1B,WAAW,KAAK,CAAC,iBAAiB,CAAC,EACnC,2BAA2B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,KACtD,OAAO,CAAC,MAAM,CAWhB,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Schema for parsing common parameters of a rejected promise error in a native module.
4
+ * This schema contains the common parameters that are shared across both Android and iOS native modules.
5
+ * Parameters which are platform specific are defined as optional and must be checked at runtime.
6
+ * It accepts a generic code schema to allow for different error codes which can be defined in each module.
7
+ * @param codeSchema - The Zod schema for the error codes used by the module.
8
+ * @returns A schema for the common parameters of a rejected promise error in a native module.
9
+ */
10
+ export declare const GenericModuleErrorSchema: <CodeType extends z.ZodEnum<[string, ...string[]]>>(codeSchema: CodeType) => z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
11
+ code: CodeType;
12
+ message: z.ZodString;
13
+ name: z.ZodString;
14
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
15
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
16
+ code: CodeType;
17
+ message: z.ZodString;
18
+ name: z.ZodString;
19
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
20
+ }>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
21
+ code: CodeType;
22
+ message: z.ZodString;
23
+ name: z.ZodString;
24
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
25
+ }>, any>[k]; } : never, z.baseObjectInputType<{
26
+ code: CodeType;
27
+ message: z.ZodString;
28
+ name: z.ZodString;
29
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
30
+ }> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<{
31
+ code: CodeType;
32
+ message: z.ZodString;
33
+ name: z.ZodString;
34
+ userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
35
+ }>[k_1]; } : never>, z.ZodObject<{
36
+ nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ lineNumber: z.ZodNumber;
38
+ file: z.ZodString;
39
+ methodName: z.ZodString;
40
+ class: z.ZodString;
41
+ }, "strip", z.ZodTypeAny, {
42
+ lineNumber: number;
43
+ file: string;
44
+ methodName: string;
45
+ class: string;
46
+ }, {
47
+ lineNumber: number;
48
+ file: string;
49
+ methodName: string;
50
+ class: string;
51
+ }>, "many">>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ nativeStackAndroid?: {
54
+ lineNumber: number;
55
+ file: string;
56
+ methodName: string;
57
+ class: string;
58
+ }[] | undefined;
59
+ }, {
60
+ nativeStackAndroid?: {
61
+ lineNumber: number;
62
+ file: string;
63
+ methodName: string;
64
+ class: string;
65
+ }[] | undefined;
66
+ }>>, z.ZodObject<{
67
+ domain: z.ZodOptional<z.ZodString>;
68
+ nativeStackIOS: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ domain?: string | undefined;
71
+ nativeStackIOS?: string[] | undefined;
72
+ }, {
73
+ domain?: string | undefined;
74
+ nativeStackIOS?: string[] | undefined;
75
+ }>>;
76
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,EAEjD,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-iso18013",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "React Native bridge for iso18013 methods",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -88,8 +88,40 @@ enum DocumentTypeEnum {
88
88
 
89
89
  ### Error Codes
90
90
 
91
- | Type | Platform | Description |
92
- | ----------------- | ----------- | --------------------------------------------- |
93
- | INVALID_ENCODING | Android/iOS | Provided payload has incorrect encoding |
94
- | UNABLE_TO_DECODE | Android/iOS | The data does not contain a valid CBOR object |
95
- | UNKNOWN_EXCEPTION | Android/iOS | Unexpected failure |
91
+ This table contains the list of error codes that can be thrown by the `CBOR` module which are mapped via the `ModuleErrorCodes` type:
92
+ | Type | Platform | Description |
93
+ | -------------------------- | ----------- | ------------------------------------------------------------ |
94
+ | DECODE_ERROR | Android/iOS | An error occurred while decoding the CBOR |
95
+ | DECODE_DOCUMENTS_ERROR | Android/iOS | An error occurred while decoding a CBOR mDOC |
96
+ | DECODE_ISSUER_SIGNED_ERROR | Android/iOS | An error occurred while decoding a CBOR Issuer Signed object |
97
+
98
+ An error can be parsed using the `ModuleErrorSchema` with type `ModuleErrorCodes` exposed by the `ISO18013_5` module. The error can be parsed as follows:
99
+
100
+ ```typescript
101
+ import { CBOR } from '@pagopa/io-react-native-iso18013';
102
+ try {
103
+ await CBOR.func();
104
+ } catch (error) {
105
+ const parsedError = CBOR.ModuleErrorSchema.parse(error); // Or ModuleErrorSchema.safeParse(error) for safe parsing
106
+ console.log(JSON.stringify(parsedError, null, 2));
107
+ }
108
+ ```
109
+
110
+ The parsed object will contain properties from both iOS and Android platforms:
111
+
112
+ ```typescript
113
+ {
114
+ code: string; // Defined in ModuleErrorCodes
115
+ message: string;
116
+ name: string;
117
+ userInfo?: Record<string, any> | null;
118
+ nativeStackAndroid?: Array<{
119
+ lineNumber: number;
120
+ file: string;
121
+ methodName: string;
122
+ class: string;
123
+ }>;
124
+ domain?: string;
125
+ nativeStackIOS?: Array<string>;
126
+ };
127
+ ```
@@ -0,0 +1,23 @@
1
+ import z from 'zod';
2
+ import { GenericModuleErrorSchema } from '../../schema';
3
+
4
+ /**
5
+ * Error codes which the CBOR module uses to reject a promise.
6
+ */
7
+ const ModuleErrorCodesSchema = z.enum([
8
+ 'DECODE_ERROR',
9
+ 'DECODE_DOCUMENTS_ERROR',
10
+ 'DECODE_ISSUER_SIGNED_ERROR',
11
+ 'EUNSPECIFIED', // Android only default when no other error is specified
12
+ ]);
13
+
14
+ export type ModuleErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
15
+
16
+ /**
17
+ * Schema which can be used to parse a rejected promise error by the CBOR module.
18
+ */
19
+ export const ModuleErrorSchema = GenericModuleErrorSchema(
20
+ ModuleErrorCodesSchema
21
+ );
22
+
23
+ export type ModuleError = z.infer<typeof ModuleErrorSchema>;
@@ -6,4 +6,8 @@ export {
6
6
  IssuerSigned,
7
7
  MDOC,
8
8
  } from './schema';
9
- export { type CborFailure, type CborFailureCodes } from './failure';
9
+ export {
10
+ type ModuleError,
11
+ type ModuleErrorCodes,
12
+ ModuleErrorSchema,
13
+ } from './error';