@pagopa/io-react-native-iso18013 0.3.0 → 0.5.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 (110) hide show
  1. package/README.md +10 -5
  2. package/android/build.gradle +7 -1
  3. package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeCborModule.kt +69 -134
  4. package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeIso18013Module.kt +254 -183
  5. package/android/src/test/java/com/ioreactnativeiso18013/Base64UtilsTest.kt +66 -0
  6. package/android/src/test/java/com/ioreactnativeiso18013/IoReactNativeIso18013Test.kt +508 -0
  7. package/ios/Base64Utils.swift +10 -3
  8. package/ios/IoReactNativeCbor.mm +21 -21
  9. package/ios/IoReactNativeCbor.swift +116 -138
  10. package/ios/IoReactNativeIso18013.mm +10 -10
  11. package/ios/IoReactNativeIso18013.swift +172 -193
  12. package/lib/module/cbor/cbor/README.md +39 -59
  13. package/lib/module/cbor/cbor/decoder.js +13 -23
  14. package/lib/module/cbor/cbor/decoder.js.map +1 -1
  15. package/lib/module/cbor/cbor/error.js +15 -0
  16. package/lib/module/cbor/cbor/error.js.map +1 -0
  17. package/lib/module/cbor/cbor/index.js +1 -0
  18. package/lib/module/cbor/cbor/index.js.map +1 -1
  19. package/lib/module/cbor/cose/README.md +39 -9
  20. package/lib/module/cbor/cose/error.js +17 -0
  21. package/lib/module/cbor/cose/error.js.map +1 -0
  22. package/lib/module/cbor/cose/index.js +1 -0
  23. package/lib/module/cbor/cose/index.js.map +1 -1
  24. package/lib/module/cbor/cose/sign.js +4 -3
  25. package/lib/module/cbor/cose/sign.js.map +1 -1
  26. package/lib/module/iso18013/index.js +0 -1
  27. package/lib/module/iso18013/index.js.map +1 -1
  28. package/lib/module/iso18013/iso18013-5/README.md +120 -44
  29. package/lib/module/iso18013/iso18013-5/error.js +25 -0
  30. package/lib/module/iso18013/iso18013-5/error.js.map +1 -0
  31. package/lib/module/iso18013/iso18013-5/index.js +3 -2
  32. package/lib/module/iso18013/iso18013-5/index.js.map +1 -1
  33. package/lib/module/iso18013/iso18013-5/proximity.js +20 -15
  34. package/lib/module/iso18013/iso18013-5/proximity.js.map +1 -1
  35. package/lib/module/iso18013/iso18013-5/{schema.js → request.js} +1 -37
  36. package/lib/module/iso18013/iso18013-5/request.js.map +1 -0
  37. package/lib/module/iso18013/iso18013-7/README.md +66 -41
  38. package/lib/module/iso18013/iso18013-7/error.js +15 -0
  39. package/lib/module/iso18013/iso18013-7/error.js.map +1 -0
  40. package/lib/module/iso18013/iso18013-7/index.js +1 -0
  41. package/lib/module/iso18013/iso18013-7/index.js.map +1 -1
  42. package/lib/module/iso18013/iso18013-7/remote.js +11 -24
  43. package/lib/module/iso18013/iso18013-7/remote.js.map +1 -1
  44. package/lib/module/schema.js +46 -0
  45. package/lib/module/schema.js.map +1 -0
  46. package/lib/typescript/src/cbor/cbor/decoder.d.ts +12 -22
  47. package/lib/typescript/src/cbor/cbor/decoder.d.ts.map +1 -1
  48. package/lib/typescript/src/cbor/cbor/error.d.ts +68 -0
  49. package/lib/typescript/src/cbor/cbor/error.d.ts.map +1 -0
  50. package/lib/typescript/src/cbor/cbor/index.d.ts +1 -1
  51. package/lib/typescript/src/cbor/cbor/index.d.ts.map +1 -1
  52. package/lib/typescript/src/cbor/cose/error.d.ts +68 -0
  53. package/lib/typescript/src/cbor/cose/error.d.ts.map +1 -0
  54. package/lib/typescript/src/cbor/cose/index.d.ts +1 -1
  55. package/lib/typescript/src/cbor/cose/index.d.ts.map +1 -1
  56. package/lib/typescript/src/cbor/cose/sign.d.ts +4 -3
  57. package/lib/typescript/src/cbor/cose/sign.d.ts.map +1 -1
  58. package/lib/typescript/src/iso18013/index.d.ts +0 -1
  59. package/lib/typescript/src/iso18013/index.d.ts.map +1 -1
  60. package/lib/typescript/src/iso18013/iso18013-5/error.d.ts +73 -0
  61. package/lib/typescript/src/iso18013/iso18013-5/error.d.ts.map +1 -0
  62. package/lib/typescript/src/iso18013/iso18013-5/index.d.ts +4 -3
  63. package/lib/typescript/src/iso18013/iso18013-5/index.d.ts.map +1 -1
  64. package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts +21 -14
  65. package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts.map +1 -1
  66. package/lib/typescript/src/iso18013/iso18013-5/{schema.d.ts → request.d.ts} +1 -39
  67. package/lib/typescript/src/iso18013/iso18013-5/request.d.ts.map +1 -0
  68. package/lib/typescript/src/iso18013/iso18013-7/error.d.ts +68 -0
  69. package/lib/typescript/src/iso18013/iso18013-7/error.d.ts.map +1 -0
  70. package/lib/typescript/src/iso18013/iso18013-7/index.d.ts +3 -2
  71. package/lib/typescript/src/iso18013/iso18013-7/index.d.ts.map +1 -1
  72. package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts +11 -25
  73. package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts.map +1 -1
  74. package/lib/typescript/src/iso18013/types.d.ts +25 -0
  75. package/lib/typescript/src/iso18013/types.d.ts.map +1 -1
  76. package/lib/typescript/src/schema.d.ts +76 -0
  77. package/lib/typescript/src/schema.d.ts.map +1 -0
  78. package/package.json +1 -1
  79. package/src/cbor/cbor/README.md +39 -59
  80. package/src/cbor/cbor/decoder.ts +13 -23
  81. package/src/cbor/cbor/error.ts +23 -0
  82. package/src/cbor/cbor/index.ts +5 -1
  83. package/src/cbor/cose/README.md +39 -9
  84. package/src/cbor/cose/error.ts +23 -0
  85. package/src/cbor/cose/index.ts +5 -1
  86. package/src/cbor/cose/sign.ts +5 -4
  87. package/src/iso18013/index.ts +0 -7
  88. package/src/iso18013/iso18013-5/README.md +120 -44
  89. package/src/iso18013/iso18013-5/error.ts +35 -0
  90. package/src/iso18013/iso18013-5/index.ts +9 -8
  91. package/src/iso18013/iso18013-5/proximity.ts +21 -17
  92. package/src/iso18013/iso18013-5/{schema.ts → request.ts} +0 -42
  93. package/src/iso18013/iso18013-7/README.md +66 -41
  94. package/src/iso18013/iso18013-7/error.ts +21 -0
  95. package/src/iso18013/iso18013-7/index.ts +6 -5
  96. package/src/iso18013/iso18013-7/remote.ts +12 -34
  97. package/src/iso18013/types.ts +24 -0
  98. package/src/schema.ts +55 -0
  99. package/lib/module/cbor/cbor/failure.js +0 -2
  100. package/lib/module/cbor/cbor/failure.js.map +0 -1
  101. package/lib/module/cbor/cose/failure.js +0 -2
  102. package/lib/module/cbor/cose/failure.js.map +0 -1
  103. package/lib/module/iso18013/iso18013-5/schema.js.map +0 -1
  104. package/lib/typescript/src/cbor/cbor/failure.d.ts +0 -15
  105. package/lib/typescript/src/cbor/cbor/failure.d.ts.map +0 -1
  106. package/lib/typescript/src/cbor/cose/failure.d.ts +0 -15
  107. package/lib/typescript/src/cbor/cose/failure.d.ts.map +0 -1
  108. package/lib/typescript/src/iso18013/iso18013-5/schema.d.ts.map +0 -1
  109. package/src/cbor/cbor/failure.ts +0 -18
  110. package/src/cbor/cose/failure.ts +0 -20
@@ -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"}
@@ -2,17 +2,18 @@ import type { PublicKey } from '@pagopa/io-react-native-crypto';
2
2
  /**
3
3
  * Sign base64 encoded data with COSE and return the COSE-Sign1 object in base64 encoding
4
4
  *
5
- * @param payload - The base64 or base64url encoded payload to sign
5
+ * @param data - The base64 or base64url encoded payload to sign
6
6
  * @param keyTag - The alias of the key to use for signing.
7
- * @throws {CoseFailure} If the key does not exist
7
+ * @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
8
8
  * @returns The COSE-Sign1 object in base64 encoding
9
9
  */
10
- export declare const sign: (payload: string, keyTag: string) => Promise<string>;
10
+ export declare const sign: (data: string, keyTag: string) => Promise<string>;
11
11
  /**
12
12
  * Verifies a COSE-Sign1 object with the provided public key
13
13
  *
14
14
  * @param data - The COSE-Sign1 object in base64 or base64url encoding
15
15
  * @param publicKey - The public key in JWK format
16
+ * @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
16
17
  * @returns true if the signature is valid, false otherwise
17
18
  */
18
19
  export declare const verify: (data: string, publicKey: PublicKey) => Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cose/sign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAGhE;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAU,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,CAC5B,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GACjB,MAAM,MAAM,EACZ,WAAW,SAAS,KACnB,OAAO,CAAC,OAAO,CAAoD,CAAC"}
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cose/sign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAGhE;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAU,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,CAC5B,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GACjB,MAAM,MAAM,EACZ,WAAW,SAAS,KACnB,OAAO,CAAC,OAAO,CAAoD,CAAC"}
@@ -1,3 +1,2 @@
1
- export { type AcceptedFields, type EventError, type VerifierRequest, parseEventError, parseVerifierRequest, } from './iso18013-5/schema';
2
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,qBAAqB,KAS7B,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';
3
- export { type RequestedDocument } from '../types';
1
+ export { 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';
4
+ export { type RequestedDocument, type AcceptedFields } 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,EAAE,KAAK,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEvE,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,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -1,5 +1,4 @@
1
- import type { AcceptedFields } from './schema';
2
- import type { RequestedDocument } from '../types';
1
+ import type { AcceptedFields, RequestedDocument } from '../types';
3
2
  /**
4
3
  * Events emitted by the native module:
5
4
  * - `onDeviceConnecting`: (iOS only) Emitted when the device is connecting to the verifier app.
@@ -35,10 +34,12 @@ export declare enum ErrorCode {
35
34
  }
36
35
  /**
37
36
  * Starts the proximity flow by allocating the necessary resources and initializing the Bluetooth stack.
37
+ * Resolves to true or rejects in case of error.
38
38
  * @param config.peripheralMode (Android only) - Whether the device is in peripheral mode. Defaults to true
39
39
  * @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
40
40
  * @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
41
41
  * @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
42
+ * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
42
43
  */
43
44
  export declare function start(config?: {
44
45
  peripheralMode?: boolean;
@@ -47,30 +48,41 @@ export declare function start(config?: {
47
48
  certificates?: Array<Array<String>>;
48
49
  }): Promise<boolean>;
49
50
  /**
50
- * Gets the QR code string this method is responsible for initializing the connection and retrieving the QR code string
51
+ * Creates a QR code to be scanned in order to initialize the presentation.
52
+ * Resolves with a string containing the QR code or rejects in case of error.
53
+ * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
51
54
  */
52
55
  export declare function getQrCodeString(): Promise<string>;
53
56
  /**
54
- * Closes the QR engagement
57
+ * Closes the bluetooth connection and clears any resource.
58
+ * Resolves to true after closing the connection or rejects in case of error.
59
+ * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
55
60
  */
56
61
  export declare function close(): Promise<boolean>;
57
62
  /**
58
- * Sends an error response to the verifier app.
63
+ * Sends an error response during the presentation according to the SessionData status codes
64
+ * defined in table 20 of the ISO18013-5 standard.
65
+ * Resolves to true or rejects in case of error.
59
66
  * The error code must be one of the `ErrorCode` enum values.
60
67
  * @param code - The error code to be sent to the verifier app.
68
+ * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
61
69
  */
62
70
  export declare function sendErrorResponse(code: ErrorCode): Promise<boolean>;
63
71
  /**
64
- * Generates a response that will be sent to the verifier app containing the requested data
65
- * @param documents - An array of `Document` which contains the requested data received from the `onDocumentRequestReceived` event
72
+ * Generates a response which can later be sent with {sendResponse} with the provided CBOR documents and the requested attributes.
73
+ * Resolves with a base64 encoded response or rejects in case of error.
74
+ * @param documents - An array of `RequestedDocument` which contains the requested data received from the `onDocumentRequestReceived` event
66
75
  * @param acceptedFields - The accepted fields which will be presented to the verifier app. See the type definition for more details.
76
+ * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
67
77
  * @returns A base64 encoded response to be sent to the verifier app via `sendResponse`
68
78
  */
69
79
  export declare function generateResponse(documents: Array<RequestedDocument>, acceptedFields: AcceptedFields): Promise<string>;
70
80
  /**
71
- * Sends the response generated through the `generateResponse` method to the verifier app.
81
+ * Sends a response containing the documents and the fields which the user decided to present generated by {@link generateResponse}.
72
82
  * Currently there's not evidence of the verifier app responding to this request, thus we don't handle the response.
83
+ * Resolves with a true boolean in case of success or rejects in case of error.
73
84
  * @param response - The base64 encoded response to be sent to the verifier app.
85
+ * @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
74
86
  */
75
87
  export declare function sendResponse(response: string): Promise<boolean>;
76
88
  /**
@@ -79,10 +91,5 @@ export declare function sendResponse(response: string): Promise<boolean>;
79
91
  * @param event - The event to listen for. The available events are defined in the `QrEngagementEvents` type.
80
92
  * @param callback - The callback to be called when the event is emitted. The callback will receive the event payload as an argument.
81
93
  */
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;
94
+ export declare function addListener<E extends Events>(event: E, callback: (data: EventsPayload[E]) => void): import("react-native").EmitterSubscription;
88
95
  //# 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":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;;;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;;;;;;;;GAQG;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;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAExC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,EACnC,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;GAMG;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,43 +43,5 @@ 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
- /**
62
- * This is the type definition for the accepted fields that will be presented to the verifier app.
63
- * It contains of a nested object structure, where the outermost key represents the credential doctype.
64
- * The inner dictionary contains namespaces, and for each namespace, there is another dictionary mapping requested claims to a boolean value,
65
- * which indicates whether the user is willing to present the corresponding claim. Example:
66
- * `{
67
- * "org.iso.18013.5.1.mDL": {
68
- * "org.iso.18013.5.1": {
69
- * "hair_colour": true, // Indicates the user is willing to present this claim
70
- * "given_name_national_character": true,
71
- * "family_name_national_character": true,
72
- * "given_name": true,
73
- * }
74
- * }
75
- * }`
76
- **/
77
- export type AcceptedFields = {
78
- [credential: string]: {
79
- [namespace: string]: {
80
- [field: string]: boolean;
81
- };
82
- };
83
- };
84
46
  export {};
85
- //# sourceMappingURL=schema.d.ts.map
47
+ //# 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"}
@@ -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';
2
- export { type RequestedDocument } from '../types';
1
+ export { generateOID4VPDeviceResponse } from './remote';
2
+ export { ModuleErrorSchema, type ModuleError, type ModuleErrorCodes, } from './error';
3
+ export { type RequestedDocument, type AcceptedFields } 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,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -1,29 +1,15 @@
1
+ import type { AcceptedFields } from '../iso18013-5';
1
2
  import type { RequestedDocument } from '../types';
2
3
  /**
3
- * All error codes that the module could return.
4
+ * Generates a CBOR device response for ISO 18013-7 mDL remote presentation using OID4VP.
5
+ * @param clientId - the client id extracted from OID4VP session
6
+ * @param responseUri - the response URI extracted from OID4VP session
7
+ * @param authorizationRequestNonce - the authorization request nonce extracted from OID4VP session
8
+ * @param mdocGeneratedNonce - the mdoc generated nonce to be generated
9
+ * @param documents - an array of {@link RequestedDocument}
10
+ * @param acceptedFields - a record of claims accepted for disclosure or its stringification extracted from OID4VP session
11
+ * @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
12
+ * @returns a base64 encoded device response
4
13
  */
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
- /**
17
- *
18
- * @param clientId extracted from OID4VP session
19
- * @param responseUri extracted from OID4VP session
20
- * @param authorizationRequestNonce extracted from OID4VP session
21
- * @param mdocGeneratedNonce To be generated
22
- * @param documents An Array of {@link DocRequested}
23
- * @param fieldRequestedAndAccepted extracted from OID4VP session, it's a record of claims
24
- * accepted for disclosure or its stringification
25
- * @throws {OID4VPFailure} in case of failure
26
- * @returns the Device Response in CBOR format
27
- */
28
- export declare const generateOID4VPDeviceResponse: (clientId: string, responseUri: string, authorizationRequestNonce: string, mdocGeneratedNonce: string, documents: Array<RequestedDocument>, fieldRequestedAndAccepted: Record<string, any> | string) => Promise<string>;
14
+ export declare const generateOID4VPDeviceResponse: (clientId: string, responseUri: string, authorizationRequestNonce: string, mdocGeneratedNonce: string, documents: Array<RequestedDocument>, acceptedFields: AcceptedFields) => Promise<string>;
29
15
  //# sourceMappingURL=remote.d.ts.map
@@ -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,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,2BAA2B,MAAM,EACjC,oBAAoB,MAAM,EAC1B,WAAW,KAAK,CAAC,iBAAiB,CAAC,EACnC,gBAAgB,cAAc,KAC7B,OAAO,CAAC,MAAM,CAShB,CAAC"}
@@ -13,4 +13,29 @@ export type RequestedDocument = {
13
13
  alias: string;
14
14
  docType: string;
15
15
  };
16
+ /**
17
+ * This is the type definition for the accepted fields that will be presented to the verifier app.
18
+ * It contains of a nested object structure, where the outermost key represents the credential doctype.
19
+ * The inner dictionary contains namespaces, and for each namespace, there is another dictionary mapping requested claims to a boolean value,
20
+ * which indicates whether the user is willing to present the corresponding claim. Example:
21
+ * `{
22
+ * "org.iso.18013.5.1.mDL": {
23
+ * "org.iso.18013.5.1": {
24
+ * "hair_colour": true, // Indicates the user is willing to present this claim
25
+ * "given_name_national_character": true,
26
+ * "family_name_national_character": true,
27
+ * "given_name": true,
28
+ * },
29
+ * {...}
30
+ * },
31
+ * {...}
32
+ * }`
33
+ **/
34
+ export type AcceptedFields = {
35
+ [credential: string]: {
36
+ [namespace: string]: {
37
+ [field: string]: boolean;
38
+ };
39
+ };
40
+ };
16
41
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/iso18013/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/iso18013/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;IAiBI;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,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.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "React Native bridge for iso18013 methods",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",