@pagopa/io-react-native-iso18013 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/IoReactNativeIso18013.podspec +1 -1
- package/README.md +1 -1
- package/android/build.gradle +3 -2
- package/android/gradle.properties +3 -3
- package/android/src/main/AndroidManifest.xml +17 -0
- package/android/src/main/AndroidManifestNew.xml +17 -0
- package/android/src/main/java/com/ioreactnativeiso18013/Enums.kt +42 -0
- package/android/src/main/java/com/ioreactnativeiso18013/IoNfcEngagementService.kt +17 -0
- package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeIso18013Module.kt +326 -132
- package/android/src/main/res/values/strings.xml +5 -0
- package/android/src/main/res/xml/nfc_engagement_apdu_service.xml +9 -0
- package/ios/IoReactNativeIso18013.mm +8 -9
- package/ios/IoReactNativeIso18013.swift +264 -191
- package/lib/module/cbor/cbor/README.md +3 -2
- package/lib/module/cbor/cose/README.md +7 -5
- package/lib/module/iso18013/iso18013-5/README.md +162 -42
- package/lib/module/iso18013/iso18013-5/error.js +1 -3
- package/lib/module/iso18013/iso18013-5/error.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/index.js +1 -1
- package/lib/module/iso18013/iso18013-5/index.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/proximity.js +29 -19
- package/lib/module/iso18013/iso18013-5/proximity.js.map +1 -1
- package/lib/module/iso18013/iso18013-7/README.md +2 -2
- package/lib/module/schema.js +1 -1
- package/lib/module/schema.js.map +1 -1
- package/lib/typescript/src/cbor/cbor/error.d.ts +5 -5
- package/lib/typescript/src/cbor/cose/error.d.ts +5 -5
- package/lib/typescript/src/iso18013/iso18013-5/error.d.ts +9 -9
- package/lib/typescript/src/iso18013/iso18013-5/error.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/index.d.ts +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/index.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts +32 -13
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-7/error.d.ts +5 -5
- package/lib/typescript/src/schema.d.ts +7 -17
- package/lib/typescript/src/schema.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/cbor/cbor/README.md +3 -2
- package/src/cbor/cose/README.md +7 -5
- package/src/iso18013/iso18013-5/README.md +162 -42
- package/src/iso18013/iso18013-5/error.ts +0 -2
- package/src/iso18013/iso18013-5/index.ts +3 -2
- package/src/iso18013/iso18013-5/proximity.ts +52 -23
- package/src/iso18013/iso18013-7/README.md +2 -2
- package/src/schema.ts +1 -1
|
@@ -7,54 +7,54 @@ export type OnErrorPayload = z.infer<typeof OnErrorPayloadSchema>;
|
|
|
7
7
|
/**
|
|
8
8
|
* Error codes which the ISO18013_5 module uses to reject a promise.
|
|
9
9
|
*/
|
|
10
|
-
declare const ModuleErrorCodesSchema: z.ZodEnum<["DRH_NOT_DEFINED", "
|
|
10
|
+
declare const ModuleErrorCodesSchema: z.ZodEnum<["DRH_NOT_DEFINED", "START_ERROR", "SEND_RESPONSE_ERROR", "SEND_ERROR_RESPONSE_ERROR", "GENERATE_RESPONSE_ERROR", "CLOSE_ERROR", "EUNSPECIFIED"]>;
|
|
11
11
|
export type ModuleErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
|
|
12
12
|
/**
|
|
13
13
|
* Schema which can be used to parse a rejected promise error by the ISO18013_5 module.
|
|
14
14
|
*/
|
|
15
15
|
export declare const ModuleErrorSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
|
|
16
|
-
code: z.ZodEnum<["DRH_NOT_DEFINED", "
|
|
16
|
+
code: z.ZodEnum<["DRH_NOT_DEFINED", "START_ERROR", "SEND_RESPONSE_ERROR", "SEND_ERROR_RESPONSE_ERROR", "GENERATE_RESPONSE_ERROR", "CLOSE_ERROR", "EUNSPECIFIED"]>;
|
|
17
17
|
message: z.ZodString;
|
|
18
18
|
name: z.ZodString;
|
|
19
19
|
userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
code: "EUNSPECIFIED" | "DRH_NOT_DEFINED" | "
|
|
21
|
+
code: "EUNSPECIFIED" | "DRH_NOT_DEFINED" | "START_ERROR" | "SEND_RESPONSE_ERROR" | "SEND_ERROR_RESPONSE_ERROR" | "GENERATE_RESPONSE_ERROR" | "CLOSE_ERROR";
|
|
22
22
|
message: string;
|
|
23
23
|
name: string;
|
|
24
24
|
userInfo?: Record<string, any> | null | undefined;
|
|
25
25
|
}, {
|
|
26
|
-
code: "EUNSPECIFIED" | "DRH_NOT_DEFINED" | "
|
|
26
|
+
code: "EUNSPECIFIED" | "DRH_NOT_DEFINED" | "START_ERROR" | "SEND_RESPONSE_ERROR" | "SEND_ERROR_RESPONSE_ERROR" | "GENERATE_RESPONSE_ERROR" | "CLOSE_ERROR";
|
|
27
27
|
message: string;
|
|
28
28
|
name: string;
|
|
29
29
|
userInfo?: Record<string, any> | null | undefined;
|
|
30
30
|
}>, z.ZodObject<{
|
|
31
31
|
nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
32
|
lineNumber: z.ZodNumber;
|
|
33
|
-
file: z.ZodString
|
|
33
|
+
file: z.ZodNullable<z.ZodString>;
|
|
34
34
|
methodName: z.ZodString;
|
|
35
35
|
class: z.ZodString;
|
|
36
36
|
}, "strip", z.ZodTypeAny, {
|
|
37
37
|
lineNumber: number;
|
|
38
|
-
file: string;
|
|
38
|
+
file: string | null;
|
|
39
39
|
methodName: string;
|
|
40
40
|
class: string;
|
|
41
41
|
}, {
|
|
42
42
|
lineNumber: number;
|
|
43
|
-
file: string;
|
|
43
|
+
file: string | null;
|
|
44
44
|
methodName: string;
|
|
45
45
|
class: string;
|
|
46
46
|
}>, "many">>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
48
|
nativeStackAndroid?: {
|
|
49
49
|
lineNumber: number;
|
|
50
|
-
file: string;
|
|
50
|
+
file: string | null;
|
|
51
51
|
methodName: string;
|
|
52
52
|
class: string;
|
|
53
53
|
}[] | undefined;
|
|
54
54
|
}, {
|
|
55
55
|
nativeStackAndroid?: {
|
|
56
56
|
lineNumber: number;
|
|
57
|
-
file: string;
|
|
57
|
+
file: string | null;
|
|
58
58
|
methodName: string;
|
|
59
59
|
class: string;
|
|
60
60
|
}[] | undefined;
|
|
@@ -1 +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
|
|
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,6JAQ1B,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,5 +1,5 @@
|
|
|
1
1
|
export { type VerifierRequest, parseVerifierRequest } from './request';
|
|
2
2
|
export { type OnErrorPayload, OnErrorPayloadSchema, ModuleErrorSchema, type ModuleErrorCodes, type ModuleError, } from './error';
|
|
3
|
-
export { ErrorCode, type Events, type EventsPayload, addListener, close, generateResponse,
|
|
3
|
+
export { ErrorCode, type Events, type EventsPayload, type EngagementMode, type RetrievalMethod, addListener, startEngagement, close, generateResponse, sendErrorResponse, sendResponse, } from './proximity';
|
|
4
4
|
export { type RequestedDocument, type AcceptedFields } from '../types';
|
|
5
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,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,
|
|
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,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,WAAW,EACX,eAAe,EACf,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import type { AcceptedFields, RequestedDocument } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Events emitted by the native module:
|
|
4
|
-
* - `
|
|
4
|
+
* - `onQrCodeString`: Emitted when the QR Code payload is generated.
|
|
5
|
+
* - `onNfcStarted`: Emitted when NFC starts successfully.
|
|
6
|
+
* - `onNfcStopped`: Emitted when NFC stops successfully.
|
|
7
|
+
* - `onDeviceConnecting`: Emitted when the device is connecting to the verifier app (QR and NFC flows on both iOS and Android).
|
|
5
8
|
* - `onDeviceConnected`: Emitted when the device is connected to the verifier app.
|
|
6
|
-
* - `onDocumentRequestReceived`: Emitted when a document request is received from the verifier app. Carries a payload containing the request data.
|
|
9
|
+
* - `onDocumentRequestReceived`: Emitted when a document request is received from the verifier app. Carries a payload containing the request data and the retrieval method.
|
|
7
10
|
* - `onDeviceDisconnected`: Emitted when the device is disconnected from the verifier app.
|
|
8
11
|
* - `onError`: Emitted when an error occurs. Carries a payload containing the error data.
|
|
9
12
|
*/
|
|
10
13
|
export type EventsPayload = {
|
|
14
|
+
onQrCodeString: {
|
|
15
|
+
data: string;
|
|
16
|
+
};
|
|
17
|
+
onNfcStarted: undefined;
|
|
18
|
+
onNfcStopped: undefined;
|
|
11
19
|
onDeviceConnecting: undefined;
|
|
12
20
|
onDeviceConnected: undefined;
|
|
13
21
|
onDocumentRequestReceived: {
|
|
14
|
-
data
|
|
15
|
-
|
|
22
|
+
data: string;
|
|
23
|
+
retrievalMethod: RetrievalMethod;
|
|
24
|
+
};
|
|
16
25
|
onDeviceDisconnected: undefined;
|
|
17
26
|
onError: {
|
|
18
27
|
error?: string;
|
|
@@ -33,26 +42,36 @@ export declare enum ErrorCode {
|
|
|
33
42
|
SESSION_TERMINATED = 20
|
|
34
43
|
}
|
|
35
44
|
/**
|
|
36
|
-
*
|
|
45
|
+
* Supported engagement modes for initiating the presentation session.
|
|
46
|
+
* - qrcode: the presentation session is initiated by scanning a QR code generated by the verifier app. The requested data is then retrieved via BLE communication between the user device and the verifier app.
|
|
47
|
+
* - nfc: the presentation session is initiated by tapping the user device on an NFC tag of the verifier app. The requested data is then retrieved via NFC or BLE communication between the user device and the verifier app.
|
|
48
|
+
*/
|
|
49
|
+
export type EngagementMode = 'qrcode' | 'nfc';
|
|
50
|
+
/**
|
|
51
|
+
* Supported methods for retrieving the requested data from the user device.
|
|
52
|
+
* - ble: the requested data is retrieved via Bluetooth Low Energy communication between the user device and the verifier app.
|
|
53
|
+
* - nfc: the requested data is retrieved via NFC communication between the user device and the verifier app.
|
|
54
|
+
*/
|
|
55
|
+
export type RetrievalMethod = 'ble' | 'nfc';
|
|
56
|
+
/**
|
|
57
|
+
* Starts proximity engagement with caller-controlled retrieval methods.
|
|
37
58
|
* Resolves to true or rejects in case of error.
|
|
38
59
|
* @param config.peripheralMode (Android only) - Whether the device is in peripheral mode. Defaults to true
|
|
39
60
|
* @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
|
|
40
61
|
* @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
|
|
41
62
|
* @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
|
|
63
|
+
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr', 'nfc']
|
|
64
|
+
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble', 'nfc']
|
|
42
65
|
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
43
66
|
*/
|
|
44
|
-
export declare function
|
|
67
|
+
export declare function startEngagement(config?: {
|
|
45
68
|
peripheralMode?: boolean;
|
|
46
69
|
centralClientMode?: boolean;
|
|
47
70
|
clearBleCache?: boolean;
|
|
48
|
-
certificates?:
|
|
71
|
+
certificates?: ReadonlyArray<ReadonlyArray<string>>;
|
|
72
|
+
engagementModes?: ReadonlyArray<EngagementMode>;
|
|
73
|
+
retrievalMethods?: ReadonlyArray<RetrievalMethod>;
|
|
49
74
|
}): Promise<boolean>;
|
|
50
|
-
/**
|
|
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}
|
|
54
|
-
*/
|
|
55
|
-
export declare function getQrCodeString(): Promise<string>;
|
|
56
75
|
/**
|
|
57
76
|
* Closes the bluetooth connection and clears any resource.
|
|
58
77
|
* Resolves to true after closing the connection or rejects in case of error.
|
|
@@ -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,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlE
|
|
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;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,YAAY,EAAE,SAAS,CAAC;IACxB,YAAY,EAAE,SAAS,CAAC;IACxB,kBAAkB,EAAE,SAAS,CAAC;IAC9B,iBAAiB,EAAE,SAAS,CAAC;IAG7B,yBAAyB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,eAAe,CAAA;KAAE,CAAC;IAC9E,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;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,GAAE;IACN,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAChD,gBAAgB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CAC9C,GACL,OAAO,CAAC,OAAO,CAAC,CA0BlB;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"}
|
|
@@ -25,31 +25,31 @@ export declare const ModuleErrorSchema: z.ZodIntersection<z.ZodIntersection<z.Zo
|
|
|
25
25
|
}>, z.ZodObject<{
|
|
26
26
|
nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
27
|
lineNumber: z.ZodNumber;
|
|
28
|
-
file: z.ZodString
|
|
28
|
+
file: z.ZodNullable<z.ZodString>;
|
|
29
29
|
methodName: z.ZodString;
|
|
30
30
|
class: z.ZodString;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
32
|
lineNumber: number;
|
|
33
|
-
file: string;
|
|
33
|
+
file: string | null;
|
|
34
34
|
methodName: string;
|
|
35
35
|
class: string;
|
|
36
36
|
}, {
|
|
37
37
|
lineNumber: number;
|
|
38
|
-
file: string;
|
|
38
|
+
file: string | null;
|
|
39
39
|
methodName: string;
|
|
40
40
|
class: string;
|
|
41
41
|
}>, "many">>;
|
|
42
42
|
}, "strip", z.ZodTypeAny, {
|
|
43
43
|
nativeStackAndroid?: {
|
|
44
44
|
lineNumber: number;
|
|
45
|
-
file: string;
|
|
45
|
+
file: string | null;
|
|
46
46
|
methodName: string;
|
|
47
47
|
class: string;
|
|
48
48
|
}[] | undefined;
|
|
49
49
|
}, {
|
|
50
50
|
nativeStackAndroid?: {
|
|
51
51
|
lineNumber: number;
|
|
52
|
-
file: string;
|
|
52
|
+
file: string | null;
|
|
53
53
|
methodName: string;
|
|
54
54
|
class: string;
|
|
55
55
|
}[] | undefined;
|
|
@@ -17,49 +17,39 @@ export declare const GenericModuleErrorSchema: <CodeType extends z.ZodEnum<[stri
|
|
|
17
17
|
message: z.ZodString;
|
|
18
18
|
name: z.ZodString;
|
|
19
19
|
userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
|
|
20
|
-
}>, any> extends infer T ? { [k in keyof T]: z.
|
|
20
|
+
}>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
|
|
21
21
|
code: CodeType;
|
|
22
22
|
message: z.ZodString;
|
|
23
23
|
name: z.ZodString;
|
|
24
24
|
userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
|
|
25
|
-
}
|
|
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<{
|
|
25
|
+
}> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>, z.ZodObject<{
|
|
36
26
|
nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
27
|
lineNumber: z.ZodNumber;
|
|
38
|
-
file: z.ZodString
|
|
28
|
+
file: z.ZodNullable<z.ZodString>;
|
|
39
29
|
methodName: z.ZodString;
|
|
40
30
|
class: z.ZodString;
|
|
41
31
|
}, "strip", z.ZodTypeAny, {
|
|
42
32
|
lineNumber: number;
|
|
43
|
-
file: string;
|
|
33
|
+
file: string | null;
|
|
44
34
|
methodName: string;
|
|
45
35
|
class: string;
|
|
46
36
|
}, {
|
|
47
37
|
lineNumber: number;
|
|
48
|
-
file: string;
|
|
38
|
+
file: string | null;
|
|
49
39
|
methodName: string;
|
|
50
40
|
class: string;
|
|
51
41
|
}>, "many">>;
|
|
52
42
|
}, "strip", z.ZodTypeAny, {
|
|
53
43
|
nativeStackAndroid?: {
|
|
54
44
|
lineNumber: number;
|
|
55
|
-
file: string;
|
|
45
|
+
file: string | null;
|
|
56
46
|
methodName: string;
|
|
57
47
|
class: string;
|
|
58
48
|
}[] | undefined;
|
|
59
49
|
}, {
|
|
60
50
|
nativeStackAndroid?: {
|
|
61
51
|
lineNumber: number;
|
|
62
|
-
file: string;
|
|
52
|
+
file: string | null;
|
|
63
53
|
methodName: string;
|
|
64
54
|
class: string;
|
|
65
55
|
}[] | undefined;
|
|
@@ -1 +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
|
|
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
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "React Native bridge for iso18013 methods",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"@eslint/eslintrc": "^3.3.0",
|
|
65
65
|
"@eslint/js": "^9.22.0",
|
|
66
66
|
"@evilmartians/lefthook": "^1.5.0",
|
|
67
|
-
"@pagopa/io-react-native-crypto": "1.
|
|
68
|
-
"@react-native/eslint-config": "^0.
|
|
67
|
+
"@pagopa/io-react-native-crypto": "1.2.4",
|
|
68
|
+
"@react-native/eslint-config": "^0.81.5",
|
|
69
69
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
70
70
|
"@types/jest": "^29.5.5",
|
|
71
|
-
"@types/react": "^19.
|
|
71
|
+
"@types/react": "^19.1.0",
|
|
72
72
|
"commitlint": "^19.6.1",
|
|
73
73
|
"del-cli": "^5.1.0",
|
|
74
74
|
"eslint": "^9.22.0",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"eslint-plugin-prettier": "^5.2.3",
|
|
77
77
|
"jest": "^29.7.0",
|
|
78
78
|
"prettier": "^3.0.3",
|
|
79
|
-
"react": "19.
|
|
80
|
-
"react-native": "0.
|
|
79
|
+
"react": "19.1.0",
|
|
80
|
+
"react-native": "0.81.5",
|
|
81
81
|
"react-native-builder-bob": "^0.40.12",
|
|
82
82
|
"release-it": "^17.10.0",
|
|
83
83
|
"turbo": "^1.10.7",
|
|
84
|
-
"typescript": "^5.
|
|
84
|
+
"typescript": "^5.8.3"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"react": "*",
|
package/src/cbor/cbor/README.md
CHANGED
|
@@ -42,8 +42,9 @@ This table contains the list of error codes that can be thrown by the `CBOR` mod
|
|
|
42
42
|
| DECODE_ERROR | Android/iOS | An error occurred while decoding the CBOR |
|
|
43
43
|
| DECODE_DOCUMENTS_ERROR | Android/iOS | An error occurred while decoding a CBOR mDOC |
|
|
44
44
|
| DECODE_ISSUER_SIGNED_ERROR | Android/iOS | An error occurred while decoding a CBOR Issuer Signed object |
|
|
45
|
+
| EUNSPECIFIED | Android | Default error when no other error is specified |
|
|
45
46
|
|
|
46
|
-
An error can be parsed using the `ModuleErrorSchema` with type `ModuleErrorCodes` exposed by the `
|
|
47
|
+
An error can be parsed using the `ModuleErrorSchema` with type `ModuleErrorCodes` exposed by the `CBOR` module. The error can be parsed as follows:
|
|
47
48
|
|
|
48
49
|
```typescript
|
|
49
50
|
import { CBOR } from '@pagopa/io-react-native-iso18013';
|
|
@@ -65,7 +66,7 @@ The parsed object will contain properties from both iOS and Android platforms:
|
|
|
65
66
|
userInfo?: Record<string, any> | null;
|
|
66
67
|
nativeStackAndroid?: Array<{
|
|
67
68
|
lineNumber: number;
|
|
68
|
-
file: string
|
|
69
|
+
file: string | null
|
|
69
70
|
methodName: string;
|
|
70
71
|
class: string;
|
|
71
72
|
}>;
|
package/src/cbor/cose/README.md
CHANGED
|
@@ -11,20 +11,21 @@ import { COSE } from '@pagopa/io-react-native-iso18013';
|
|
|
11
11
|
#### `sign`
|
|
12
12
|
|
|
13
13
|
Signs base64 encoded data using COSE (CBOR Object Signing and Encryption).
|
|
14
|
-
Returns a `Promise` which resolves to a `string` containing the COSE-Sign1 object in base64 encoding or rejects with
|
|
14
|
+
Returns a `Promise` which resolves to a `string` containing the COSE-Sign1 object in base64 encoding or rejects with a `ModuleError` in case of failures.
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
17
|
try {
|
|
18
18
|
const coseSign1 = await COSE.sign('base64EncodedData', 'keyTag');
|
|
19
19
|
} catch (e) {
|
|
20
|
-
const
|
|
20
|
+
const parsedError = COSE.ModuleErrorSchema.parse(e);
|
|
21
|
+
console.log(parsedError.code, parsedError.message);
|
|
21
22
|
}
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
#### `verify`
|
|
25
26
|
|
|
26
27
|
Verifies a COSE-Sign1 object using the provided public key.
|
|
27
|
-
Returns a `Promise` which resolves to a `boolean` indicating if the signature is valid or rejects with
|
|
28
|
+
Returns a `Promise` which resolves to a `boolean` indicating if the signature is valid or rejects with a `ModuleError` in case of failures.
|
|
28
29
|
|
|
29
30
|
```typescript
|
|
30
31
|
// public key in JWK format
|
|
@@ -38,7 +39,8 @@ const publicKey = {
|
|
|
38
39
|
try {
|
|
39
40
|
const isValid = await COSE.verify('coseSign1Base64Data', publicKey);
|
|
40
41
|
} catch (e) {
|
|
41
|
-
const
|
|
42
|
+
const parsedError = COSE.ModuleErrorSchema.parse(e);
|
|
43
|
+
console.log(parsedError.code, parsedError.message);
|
|
42
44
|
}
|
|
43
45
|
```
|
|
44
46
|
|
|
@@ -73,7 +75,7 @@ The parsed object will contain properties from both iOS and Android platforms:
|
|
|
73
75
|
userInfo?: Record<string, any> | null;
|
|
74
76
|
nativeStackAndroid?: Array<{
|
|
75
77
|
lineNumber: number;
|
|
76
|
-
file: string
|
|
78
|
+
file: string | null
|
|
77
79
|
methodName: string;
|
|
78
80
|
class: string;
|
|
79
81
|
}>;
|