@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.
- package/README.md +10 -5
- package/android/build.gradle +7 -1
- package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeCborModule.kt +69 -134
- package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeIso18013Module.kt +254 -183
- package/android/src/test/java/com/ioreactnativeiso18013/Base64UtilsTest.kt +66 -0
- package/android/src/test/java/com/ioreactnativeiso18013/IoReactNativeIso18013Test.kt +508 -0
- package/ios/Base64Utils.swift +10 -3
- package/ios/IoReactNativeCbor.mm +21 -21
- package/ios/IoReactNativeCbor.swift +116 -138
- package/ios/IoReactNativeIso18013.mm +10 -10
- package/ios/IoReactNativeIso18013.swift +172 -193
- package/lib/module/cbor/cbor/README.md +39 -59
- package/lib/module/cbor/cbor/decoder.js +13 -23
- package/lib/module/cbor/cbor/decoder.js.map +1 -1
- package/lib/module/cbor/cbor/error.js +15 -0
- package/lib/module/cbor/cbor/error.js.map +1 -0
- package/lib/module/cbor/cbor/index.js +1 -0
- package/lib/module/cbor/cbor/index.js.map +1 -1
- package/lib/module/cbor/cose/README.md +39 -9
- package/lib/module/cbor/cose/error.js +17 -0
- package/lib/module/cbor/cose/error.js.map +1 -0
- package/lib/module/cbor/cose/index.js +1 -0
- package/lib/module/cbor/cose/index.js.map +1 -1
- package/lib/module/cbor/cose/sign.js +4 -3
- package/lib/module/cbor/cose/sign.js.map +1 -1
- package/lib/module/iso18013/index.js +0 -1
- package/lib/module/iso18013/index.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/README.md +120 -44
- package/lib/module/iso18013/iso18013-5/error.js +25 -0
- package/lib/module/iso18013/iso18013-5/error.js.map +1 -0
- package/lib/module/iso18013/iso18013-5/index.js +3 -2
- package/lib/module/iso18013/iso18013-5/index.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/proximity.js +20 -15
- package/lib/module/iso18013/iso18013-5/proximity.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/{schema.js → request.js} +1 -37
- package/lib/module/iso18013/iso18013-5/request.js.map +1 -0
- package/lib/module/iso18013/iso18013-7/README.md +66 -41
- package/lib/module/iso18013/iso18013-7/error.js +15 -0
- package/lib/module/iso18013/iso18013-7/error.js.map +1 -0
- package/lib/module/iso18013/iso18013-7/index.js +1 -0
- package/lib/module/iso18013/iso18013-7/index.js.map +1 -1
- package/lib/module/iso18013/iso18013-7/remote.js +11 -24
- package/lib/module/iso18013/iso18013-7/remote.js.map +1 -1
- package/lib/module/schema.js +46 -0
- package/lib/module/schema.js.map +1 -0
- package/lib/typescript/src/cbor/cbor/decoder.d.ts +12 -22
- package/lib/typescript/src/cbor/cbor/decoder.d.ts.map +1 -1
- package/lib/typescript/src/cbor/cbor/error.d.ts +68 -0
- package/lib/typescript/src/cbor/cbor/error.d.ts.map +1 -0
- package/lib/typescript/src/cbor/cbor/index.d.ts +1 -1
- package/lib/typescript/src/cbor/cbor/index.d.ts.map +1 -1
- package/lib/typescript/src/cbor/cose/error.d.ts +68 -0
- package/lib/typescript/src/cbor/cose/error.d.ts.map +1 -0
- package/lib/typescript/src/cbor/cose/index.d.ts +1 -1
- package/lib/typescript/src/cbor/cose/index.d.ts.map +1 -1
- package/lib/typescript/src/cbor/cose/sign.d.ts +4 -3
- package/lib/typescript/src/cbor/cose/sign.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/index.d.ts +0 -1
- package/lib/typescript/src/iso18013/index.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/error.d.ts +73 -0
- package/lib/typescript/src/iso18013/iso18013-5/error.d.ts.map +1 -0
- package/lib/typescript/src/iso18013/iso18013-5/index.d.ts +4 -3
- package/lib/typescript/src/iso18013/iso18013-5/index.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts +21 -14
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/{schema.d.ts → request.d.ts} +1 -39
- package/lib/typescript/src/iso18013/iso18013-5/request.d.ts.map +1 -0
- package/lib/typescript/src/iso18013/iso18013-7/error.d.ts +68 -0
- package/lib/typescript/src/iso18013/iso18013-7/error.d.ts.map +1 -0
- package/lib/typescript/src/iso18013/iso18013-7/index.d.ts +3 -2
- package/lib/typescript/src/iso18013/iso18013-7/index.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts +11 -25
- package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/types.d.ts +25 -0
- package/lib/typescript/src/iso18013/types.d.ts.map +1 -1
- package/lib/typescript/src/schema.d.ts +76 -0
- package/lib/typescript/src/schema.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/cbor/cbor/README.md +39 -59
- package/src/cbor/cbor/decoder.ts +13 -23
- package/src/cbor/cbor/error.ts +23 -0
- package/src/cbor/cbor/index.ts +5 -1
- package/src/cbor/cose/README.md +39 -9
- package/src/cbor/cose/error.ts +23 -0
- package/src/cbor/cose/index.ts +5 -1
- package/src/cbor/cose/sign.ts +5 -4
- package/src/iso18013/index.ts +0 -7
- package/src/iso18013/iso18013-5/README.md +120 -44
- package/src/iso18013/iso18013-5/error.ts +35 -0
- package/src/iso18013/iso18013-5/index.ts +9 -8
- package/src/iso18013/iso18013-5/proximity.ts +21 -17
- package/src/iso18013/iso18013-5/{schema.ts → request.ts} +0 -42
- package/src/iso18013/iso18013-7/README.md +66 -41
- package/src/iso18013/iso18013-7/error.ts +21 -0
- package/src/iso18013/iso18013-7/index.ts +6 -5
- package/src/iso18013/iso18013-7/remote.ts +12 -34
- package/src/iso18013/types.ts +24 -0
- package/src/schema.ts +55 -0
- package/lib/module/cbor/cbor/failure.js +0 -2
- package/lib/module/cbor/cbor/failure.js.map +0 -1
- package/lib/module/cbor/cose/failure.js +0 -2
- package/lib/module/cbor/cose/failure.js.map +0 -1
- package/lib/module/iso18013/iso18013-5/schema.js.map +0 -1
- package/lib/typescript/src/cbor/cbor/failure.d.ts +0 -15
- package/lib/typescript/src/cbor/cbor/failure.d.ts.map +0 -1
- package/lib/typescript/src/cbor/cose/failure.d.ts +0 -15
- package/lib/typescript/src/cbor/cose/failure.d.ts.map +0 -1
- package/lib/typescript/src/iso18013/iso18013-5/schema.d.ts.map +0 -1
- package/src/cbor/cbor/failure.ts +0 -18
- package/src/cbor/cose/failure.ts +0 -20
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
import { GenericModuleErrorSchema } from "../../schema.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Schema for parsing the payload returned by the `onError` event in Proximity `Events`, along with its type definition.
|
|
8
|
+
*/
|
|
9
|
+
export const OnErrorPayloadSchema = z.string().catch('Unknown error');
|
|
10
|
+
/**
|
|
11
|
+
* Error codes which the ISO18013_5 module uses to reject a promise.
|
|
12
|
+
*/
|
|
13
|
+
const ModuleErrorCodesSchema = z.enum(['DRH_NOT_DEFINED',
|
|
14
|
+
// Android only
|
|
15
|
+
'QR_ENGAGEMENT_NOT_DEFINED',
|
|
16
|
+
// Android only
|
|
17
|
+
'START_ERROR', 'GET_QR_CODE_ERROR', 'SEND_RESPONSE_ERROR', 'SEND_ERROR_RESPONSE_ERROR', 'GENERATE_RESPONSE_ERROR', 'CLOSE_ERROR',
|
|
18
|
+
// Android only
|
|
19
|
+
'EUNSPECIFIED' // Android only default when no other error is specified
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* Schema which can be used to parse a rejected promise error by the ISO18013_5 module.
|
|
23
|
+
*/
|
|
24
|
+
export const ModuleErrorSchema = GenericModuleErrorSchema(ModuleErrorCodesSchema);
|
|
25
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","GenericModuleErrorSchema","OnErrorPayloadSchema","string","catch","ModuleErrorCodesSchema","enum","ModuleErrorSchema"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/error.ts"],"mappings":";;AAAA,OAAOA,CAAC,MAAM,KAAK;AACnB,SAASC,wBAAwB,QAAQ,iBAAc;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGF,CAAC,CAACG,MAAM,CAAC,CAAC,CAACC,KAAK,CAAC,eAAe,CAAC;AAIrE;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGL,CAAC,CAACM,IAAI,CAAC,CACpC,iBAAiB;AAAE;AACnB,2BAA2B;AAAE;AAC7B,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,aAAa;AAAE;AACf,cAAc,CAAE;AAAA,CACjB,CAAC;AAIF;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGN,wBAAwB,CACvDI,sBACF,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { parseVerifierRequest } from "./request.js";
|
|
4
|
+
export { OnErrorPayloadSchema, ModuleErrorSchema } from "./error.js";
|
|
5
|
+
export { ErrorCode, addListener, close, generateResponse, getQrCodeString, sendErrorResponse, sendResponse, start } from "./proximity.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["parseVerifierRequest","OnErrorPayloadSchema","ModuleErrorSchema","ErrorCode","addListener","close","generateResponse","getQrCodeString","sendErrorResponse","sendResponse","start"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/index.ts"],"mappings":";;AAAA,SAA+BA,oBAAoB,QAAQ,cAAW;AAEtE,SAEEC,oBAAoB,EACpBC,iBAAiB,QAGZ,YAAS;AAEhB,SACEC,SAAS,EAGTC,WAAW,EACXC,KAAK,EACLC,gBAAgB,EAChBC,eAAe,EACfC,iBAAiB,EACjBC,YAAY,EACZC,KAAK,QACA,gBAAa","ignoreList":[]}
|
|
@@ -31,10 +31,12 @@ export let ErrorCode = /*#__PURE__*/function (ErrorCode) {
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Starts the proximity flow by allocating the necessary resources and initializing the Bluetooth stack.
|
|
34
|
+
* Resolves to true or rejects in case of error.
|
|
34
35
|
* @param config.peripheralMode (Android only) - Whether the device is in peripheral mode. Defaults to true
|
|
35
36
|
* @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
|
|
36
37
|
* @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
|
|
37
38
|
* @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
|
|
39
|
+
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
38
40
|
*/
|
|
39
41
|
export function start(config = {}) {
|
|
40
42
|
const {
|
|
@@ -51,32 +53,41 @@ export function start(config = {}) {
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
/**
|
|
54
|
-
*
|
|
56
|
+
* Creates a QR code to be scanned in order to initialize the presentation.
|
|
57
|
+
* Resolves with a string containing the QR code or rejects in case of error.
|
|
58
|
+
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
55
59
|
*/
|
|
56
60
|
export function getQrCodeString() {
|
|
57
61
|
return IoReactNativeIso18013.getQrCodeString();
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
|
-
* Closes the
|
|
65
|
+
* Closes the bluetooth connection and clears any resource.
|
|
66
|
+
* Resolves to true after closing the connection or rejects in case of error.
|
|
67
|
+
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
62
68
|
*/
|
|
63
69
|
export function close() {
|
|
64
70
|
return IoReactNativeIso18013.close();
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
|
-
* Sends an error response to the
|
|
74
|
+
* Sends an error response during the presentation according to the SessionData status codes
|
|
75
|
+
* defined in table 20 of the ISO18013-5 standard.
|
|
76
|
+
* Resolves to true or rejects in case of error.
|
|
69
77
|
* The error code must be one of the `ErrorCode` enum values.
|
|
70
78
|
* @param code - The error code to be sent to the verifier app.
|
|
79
|
+
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
71
80
|
*/
|
|
72
81
|
export function sendErrorResponse(code) {
|
|
73
82
|
return IoReactNativeIso18013.sendErrorResponse(code);
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
/**
|
|
77
|
-
* Generates a response
|
|
78
|
-
*
|
|
86
|
+
* Generates a response which can later be sent with {sendResponse} with the provided CBOR documents and the requested attributes.
|
|
87
|
+
* Resolves with a base64 encoded response or rejects in case of error.
|
|
88
|
+
* @param documents - An array of `RequestedDocument` which contains the requested data received from the `onDocumentRequestReceived` event
|
|
79
89
|
* @param acceptedFields - The accepted fields which will be presented to the verifier app. See the type definition for more details.
|
|
90
|
+
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
80
91
|
* @returns A base64 encoded response to be sent to the verifier app via `sendResponse`
|
|
81
92
|
*/
|
|
82
93
|
export function generateResponse(documents, acceptedFields) {
|
|
@@ -84,9 +95,11 @@ export function generateResponse(documents, acceptedFields) {
|
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
/**
|
|
87
|
-
* Sends
|
|
98
|
+
* Sends a response containing the documents and the fields which the user decided to present generated by {@link generateResponse}.
|
|
88
99
|
* Currently there's not evidence of the verifier app responding to this request, thus we don't handle the response.
|
|
100
|
+
* Resolves with a true boolean in case of success or rejects in case of error.
|
|
89
101
|
* @param response - The base64 encoded response to be sent to the verifier app.
|
|
102
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
90
103
|
*/
|
|
91
104
|
export function sendResponse(response) {
|
|
92
105
|
return IoReactNativeIso18013.sendResponse(response);
|
|
@@ -99,14 +112,6 @@ export function sendResponse(response) {
|
|
|
99
112
|
* @param callback - The callback to be called when the event is emitted. The callback will receive the event payload as an argument.
|
|
100
113
|
*/
|
|
101
114
|
export function addListener(event, callback) {
|
|
102
|
-
eventEmitter.addListener(event, callback);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Removes a listener for a `QrEngagementEvents` event.
|
|
107
|
-
* @param event - The event to remove the listener for. The available events are defined in the `QrEngagementEvents` type.
|
|
108
|
-
*/
|
|
109
|
-
export function removeListener(event) {
|
|
110
|
-
eventEmitter.removeAllListeners(event);
|
|
115
|
+
return eventEmitter.addListener(event, callback);
|
|
111
116
|
}
|
|
112
117
|
//# sourceMappingURL=proximity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","Platform","IoReactNativeIso18013","eventEmitter","ErrorCode","start","config","peripheralMode","centralClientMode","clearBleCache","certificates","OS","getQrCodeString","close","sendErrorResponse","code","generateResponse","documents","acceptedFields","sendResponse","response","addListener","event","callback"
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","Platform","IoReactNativeIso18013","eventEmitter","ErrorCode","start","config","peripheralMode","centralClientMode","clearBleCache","certificates","OS","getQrCodeString","close","sendErrorResponse","code","generateResponse","documents","acceptedFields","sendResponse","response","addListener","event","callback"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/proximity.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,qBAAqB,QAAQ,aAAI;AAG1C,MAAMC,YAAY,GAAG,IAAIH,kBAAkB,CAACE,qBAAqB,CAAC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,WAAYE,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAMrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CACnBC,MAKC,GAAG,CAAC,CAAC,EACY;EAClB,MAAM;IAAEC,cAAc;IAAEC,iBAAiB;IAAEC,aAAa;IAAEC;EAAa,CAAC,GACtEJ,MAAM;EACR,IAAIL,QAAQ,CAACU,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOT,qBAAqB,CAACG,KAAK,CAACK,YAAY,GAAGA,YAAY,GAAG,EAAE,CAAC;EACtE,CAAC,MAAM;IACL,OAAOR,qBAAqB,CAACG,KAAK,CAChCE,cAAc,GAAGA,cAAc,GAAG,IAAI,EACtCC,iBAAiB,GAAGA,iBAAiB,GAAG,KAAK,EAC7CC,aAAa,GAAGA,aAAa,GAAG,IAAI,EACpCC,YAAY,GAAGA,YAAY,GAAG,EAChC,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAAA,EAAoB;EACjD,OAAOV,qBAAqB,CAACU,eAAe,CAAC,CAAC;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAAA,EAAqB;EACxC,OAAOX,qBAAqB,CAACW,KAAK,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,IAAe,EAAoB;EACnE,OAAOb,qBAAqB,CAACY,iBAAiB,CAACC,IAAI,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,SAAmC,EACnCC,cAA8B,EACb;EACjB,OAAOhB,qBAAqB,CAACc,gBAAgB,CAACC,SAAS,EAAEC,cAAc,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,QAAgB,EAAoB;EAC/D,OAAOlB,qBAAqB,CAACiB,YAAY,CAACC,QAAQ,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,KAAQ,EACRC,QAA0C,EAC1C;EACA,OAAOpB,YAAY,CAACkB,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;AAClD","ignoreList":[]}
|
|
@@ -40,40 +40,4 @@ const VerifierRequest = z.object({
|
|
|
40
40
|
export const parseVerifierRequest = input => {
|
|
41
41
|
return VerifierRequest.parse(input);
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Zod schema for the type returned by the `onError` event in Proximity `Events`.
|
|
46
|
-
*/
|
|
47
|
-
const EventError = z.string().catch('Unknown error');
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Error type returned by the `onError` event in Proximity `Events`.
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Parses the input to an Error object.
|
|
55
|
-
* This function is used to parse the error received from the verifier app via the `onError` event.
|
|
56
|
-
* @param input - The input to be parsed
|
|
57
|
-
* @returns The parsed Error object or a default error message if parsing fails
|
|
58
|
-
*/
|
|
59
|
-
export const parseEventError = input => {
|
|
60
|
-
return EventError.parse(input);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* This is the type definition for the accepted fields that will be presented to the verifier app.
|
|
65
|
-
* It contains of a nested object structure, where the outermost key represents the credential doctype.
|
|
66
|
-
* The inner dictionary contains namespaces, and for each namespace, there is another dictionary mapping requested claims to a boolean value,
|
|
67
|
-
* which indicates whether the user is willing to present the corresponding claim. Example:
|
|
68
|
-
* `{
|
|
69
|
-
* "org.iso.18013.5.1.mDL": {
|
|
70
|
-
* "org.iso.18013.5.1": {
|
|
71
|
-
* "hair_colour": true, // Indicates the user is willing to present this claim
|
|
72
|
-
* "given_name_national_character": true,
|
|
73
|
-
* "family_name_national_character": true,
|
|
74
|
-
* "given_name": true,
|
|
75
|
-
* }
|
|
76
|
-
* }
|
|
77
|
-
* }`
|
|
78
|
-
**/
|
|
79
|
-
//# sourceMappingURL=schema.js.map
|
|
43
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","booleanFieldGroup","record","boolean","credentialEntrySchema","object","isAuthenticated","catchall","VerifierRequest","request","parseVerifierRequest","input","parse"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/request.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA,MAAMC,iBAAiB,GAAGD,CAAC,CAACE,MAAM,CAACF,CAAC,CAACG,OAAO,CAAC,CAAC,CAAC;AAE/C,MAAMC,qBAAqB,GAAGJ,CAAC,CAC5BK,MAAM,CAAC;EACNC,eAAe,EAAEN,CAAC,CAACG,OAAO,CAAC;AAC7B,CAAC,CAAC,CACDI,QAAQ,CAACN,iBAAiB,CAAC;AAE9B,MAAMO,eAAe,GAAGR,CAAC,CAACK,MAAM,CAAC;EAC/BI,OAAO,EAAET,CAAC,CAACE,MAAM,CAACE,qBAAqB;AACzC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,oBAAoB,GAAIC,KAAc,IAAsB;EACvE,OAAOH,eAAe,CAACI,KAAK,CAACD,KAAK,CAAC;AACrC,CAAC","ignoreList":[]}
|
|
@@ -1,59 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
# ISO18013-7
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This library provides a React Native module based on [iso18013-android](https://github.com/pagopa/iso18013-android) and [iso18013-ios](https://github.com/pagopa/iso18013-ios) which allows mDL remote presentation according to the ISO 18013-7 standard.
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
|
-
import { ISO18013_7 } from '@pagopa/io-react-native-
|
|
6
|
+
import { ISO18013_7 } from '@pagopa/io-react-native-iso18013';
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Methods
|
|
10
10
|
|
|
11
11
|
#### `generateOID4VPDeviceResponse`
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Returns a `Promise` which resolves to a `string` containing the CBOR of the **Device Response** object or rejects with an instance of `CoseFailure` in case of failures.
|
|
13
|
+
Returns a string containing the CBOR of the **Device Response** object.
|
|
16
14
|
|
|
17
15
|
```typescript
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
import { ISO18013_7 } from '@pagopa/io-react-native-iso18013';
|
|
17
|
+
|
|
18
|
+
const documents = [
|
|
19
|
+
{
|
|
20
|
+
issuerSignedContent: 'base64url-or-base64-encoded-content',
|
|
21
|
+
alias: 'key-alias',
|
|
22
|
+
docType: 'docType',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const acceptedFields = {
|
|
27
|
+
'org.iso.18013.5.1.mDL': {
|
|
28
|
+
'org.iso.18013.5.1': {
|
|
29
|
+
hair_colour: true,
|
|
30
|
+
given_name_national_character: true,
|
|
31
|
+
family_name_national_character: true,
|
|
32
|
+
given_name: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const result = await ISO18013_7.generateOID4VPDeviceResponse(
|
|
38
|
+
clientId,
|
|
39
|
+
responseUri,
|
|
40
|
+
authorizationRequestNonce,
|
|
41
|
+
mdocGeneratedNonce,
|
|
42
|
+
documents,
|
|
43
|
+
acceptedFields
|
|
44
|
+
);
|
|
30
45
|
```
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
## Errors
|
|
48
|
+
|
|
49
|
+
This table contains the list of error codes that can be thrown by the `ISO18013_7` module which are mapped via the `ModuleErrorCodes` type:
|
|
50
|
+
|
|
51
|
+
| Type | Platform | Description |
|
|
52
|
+
| ------------------------------ | ----------- | ----------------------------------------------- |
|
|
53
|
+
| GENERATE_OID4VP_RESPONSE_ERROR | Android/iOS | An error occurred while generating the response |
|
|
54
|
+
|
|
55
|
+
An error can be parsed using the `ModuleErrorSchema` with type `ModuleErrorCodes` exposed by the `ISO18013_5` module. The error can be parsed as follows:
|
|
33
56
|
|
|
34
57
|
```typescript
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
import { ISO18013_7 } from '@pagopa/io-react-native-iso18013';
|
|
59
|
+
try {
|
|
60
|
+
await ISO18013_7.func();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
const parsedError = ISO18013_7.ModuleErrorSchema.parse(error); // Or ModuleErrorSchema.safeParse(error) for safe parsing
|
|
63
|
+
console.log(JSON.stringify(parsedError, null, 2));
|
|
39
64
|
}
|
|
40
|
-
|
|
41
|
-
export const generateOID4VPDeviceResponse = async (
|
|
42
|
-
clientId: string,
|
|
43
|
-
responseUri: string,
|
|
44
|
-
authorizationRequestNonce: string,
|
|
45
|
-
mdocGeneratedNonce: string,
|
|
46
|
-
documents: Array<RequestedDocument>,
|
|
47
|
-
fieldRequestedAndAccepted: Record<string, any> | string
|
|
48
|
-
) : Promise<string> => {...};
|
|
49
65
|
```
|
|
50
66
|
|
|
51
|
-
|
|
67
|
+
The parsed object will contain properties from both iOS and Android platforms:
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
```typescript
|
|
70
|
+
{
|
|
71
|
+
code: string; // Defined in ModuleErrorCodes
|
|
72
|
+
message: string;
|
|
73
|
+
name: string;
|
|
74
|
+
userInfo?: Record<string, any> | null;
|
|
75
|
+
nativeStackAndroid?: Array<{
|
|
76
|
+
lineNumber: number;
|
|
77
|
+
file: string;
|
|
78
|
+
methodName: string;
|
|
79
|
+
class: string;
|
|
80
|
+
}>;
|
|
81
|
+
domain?: string;
|
|
82
|
+
nativeStackIOS?: Array<string>;
|
|
83
|
+
};
|
|
84
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
import { GenericModuleErrorSchema } from "../../schema.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error codes which the ISO18013_7 module uses to reject a promise.
|
|
8
|
+
*/
|
|
9
|
+
const ModuleErrorCodesSchema = z.enum(['GENERATE_OID4VP_RESPONSE_ERROR', 'EUNSPECIFIED' // Android only default when no other error is specified
|
|
10
|
+
]);
|
|
11
|
+
/**
|
|
12
|
+
* Schema which can be used to parse a rejected promise error by the ISO18013_7 module.
|
|
13
|
+
*/
|
|
14
|
+
export const ModuleErrorSchema = GenericModuleErrorSchema(ModuleErrorCodesSchema);
|
|
15
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","GenericModuleErrorSchema","ModuleErrorCodesSchema","enum","ModuleErrorSchema"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-7/error.ts"],"mappings":";;AAAA,OAAOA,CAAC,MAAM,KAAK;AACnB,SAASC,wBAAwB,QAAQ,iBAAc;;AAEvD;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGF,CAAC,CAACG,IAAI,CAAC,CACpC,gCAAgC,EAChC,cAAc,CAAE;AAAA,CACjB,CAAC;AAIF;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGH,wBAAwB,CACvDC,sBACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["generateOID4VPDeviceResponse"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-7/index.ts"],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"names":["generateOID4VPDeviceResponse","ModuleErrorSchema"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-7/index.ts"],"mappings":";;AAAA,SAASA,4BAA4B,QAAQ,aAAU;AACvD,SACEC,iBAAiB,QAGZ,YAAS","ignoreList":[]}
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { IoReactNativeIso18013 } from "../index.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* All error codes that the module could return.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Error type returned by a rejected promise.
|
|
11
|
-
*
|
|
12
|
-
* If additional error information are available,
|
|
13
|
-
* they are stored in the {@link OID4VPFailure["userInfo"]} field.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
4
|
/**
|
|
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
|
|
22
|
-
* @param documents
|
|
23
|
-
* @param
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
* @returns the Device Response in CBOR format
|
|
5
|
+
* Generates a CBOR device response for ISO 18013-7 mDL remote presentation using OID4VP.
|
|
6
|
+
* @param clientId - the client id extracted from OID4VP session
|
|
7
|
+
* @param responseUri - the response URI extracted from OID4VP session
|
|
8
|
+
* @param authorizationRequestNonce - the authorization request nonce extracted from OID4VP session
|
|
9
|
+
* @param mdocGeneratedNonce - the mdoc generated nonce to be generated
|
|
10
|
+
* @param documents - an array of {@link RequestedDocument}
|
|
11
|
+
* @param acceptedFields - a record of claims accepted for disclosure or its stringification extracted from OID4VP session
|
|
12
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
13
|
+
* @returns a base64 encoded device response
|
|
27
14
|
*/
|
|
28
|
-
export const generateOID4VPDeviceResponse = async (clientId, responseUri, authorizationRequestNonce, mdocGeneratedNonce, documents,
|
|
29
|
-
return await IoReactNativeIso18013.generateOID4VPDeviceResponse(clientId, responseUri, authorizationRequestNonce, mdocGeneratedNonce, documents,
|
|
15
|
+
export const generateOID4VPDeviceResponse = async (clientId, responseUri, authorizationRequestNonce, mdocGeneratedNonce, documents, acceptedFields) => {
|
|
16
|
+
return await IoReactNativeIso18013.generateOID4VPDeviceResponse(clientId, responseUri, authorizationRequestNonce, mdocGeneratedNonce, documents, acceptedFields);
|
|
30
17
|
};
|
|
31
18
|
//# sourceMappingURL=remote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IoReactNativeIso18013","generateOID4VPDeviceResponse","clientId","responseUri","authorizationRequestNonce","mdocGeneratedNonce","documents","
|
|
1
|
+
{"version":3,"names":["IoReactNativeIso18013","generateOID4VPDeviceResponse","clientId","responseUri","authorizationRequestNonce","mdocGeneratedNonce","documents","acceptedFields"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-7/remote.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,aAAI;AAI1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GAAG,MAAAA,CAC1CC,QAAgB,EAChBC,WAAmB,EACnBC,yBAAiC,EACjCC,kBAA0B,EAC1BC,SAAmC,EACnCC,cAA8B,KACV;EACpB,OAAO,MAAMP,qBAAqB,CAACC,4BAA4B,CAC7DC,QAAQ,EACRC,WAAW,EACXC,yBAAyB,EACzBC,kBAAkB,EAClBC,SAAS,EACTC,cACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema for parsing a nativeStackAndroid object of a rejected promise error in an Android native module.
|
|
7
|
+
*/
|
|
8
|
+
const StackTraceElementSchema = z.object({
|
|
9
|
+
lineNumber: z.number(),
|
|
10
|
+
file: z.string(),
|
|
11
|
+
methodName: z.string(),
|
|
12
|
+
class: z.string()
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Schema for parsing specific parameters of a rejected promise error in an Android native module.
|
|
17
|
+
* It's defined as partial to allow merging with the common schema and it must be checked at runtime.
|
|
18
|
+
*/
|
|
19
|
+
const ModuleErrorAndroidSchema = z.object({
|
|
20
|
+
nativeStackAndroid: z.array(StackTraceElementSchema)
|
|
21
|
+
}).partial();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Schema for parsing specific parameters of a rejected promise error in an iOS native module.
|
|
25
|
+
* It's defined as partial to allow merging with the common schema and it must be checked at runtime.
|
|
26
|
+
*/
|
|
27
|
+
const ModuleErrorIosSchema = z.object({
|
|
28
|
+
domain: z.string(),
|
|
29
|
+
nativeStackIOS: z.array(z.string())
|
|
30
|
+
}).partial();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Schema for parsing common parameters of a rejected promise error in a native module.
|
|
34
|
+
* This schema contains the common parameters that are shared across both Android and iOS native modules.
|
|
35
|
+
* Parameters which are platform specific are defined as optional and must be checked at runtime.
|
|
36
|
+
* It accepts a generic code schema to allow for different error codes which can be defined in each module.
|
|
37
|
+
* @param codeSchema - The Zod schema for the error codes used by the module.
|
|
38
|
+
* @returns A schema for the common parameters of a rejected promise error in a native module.
|
|
39
|
+
*/
|
|
40
|
+
export const GenericModuleErrorSchema = codeSchema => z.object({
|
|
41
|
+
code: codeSchema,
|
|
42
|
+
message: z.string(),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
userInfo: z.record(z.string(), z.any()).optional().or(z.null())
|
|
45
|
+
}).and(ModuleErrorAndroidSchema).and(ModuleErrorIosSchema);
|
|
46
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","StackTraceElementSchema","object","lineNumber","number","file","string","methodName","class","ModuleErrorAndroidSchema","nativeStackAndroid","array","partial","ModuleErrorIosSchema","domain","nativeStackIOS","GenericModuleErrorSchema","codeSchema","code","message","name","userInfo","record","any","optional","or","null","and"],"sourceRoot":"../../src","sources":["schema.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,UAAU,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACtBC,IAAI,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBC,UAAU,EAAEP,CAAC,CAACM,MAAM,CAAC,CAAC;EACtBE,KAAK,EAAER,CAAC,CAACM,MAAM,CAAC;AAClB,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,MAAMG,wBAAwB,GAAGT,CAAC,CAC/BE,MAAM,CAAC;EACNQ,kBAAkB,EAAEV,CAAC,CAACW,KAAK,CAACV,uBAAuB;AACrD,CAAC,CAAC,CACDW,OAAO,CAAC,CAAC;;AAEZ;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGb,CAAC,CAC3BE,MAAM,CAAC;EACNY,MAAM,EAAEd,CAAC,CAACM,MAAM,CAAC,CAAC;EAClBS,cAAc,EAAEf,CAAC,CAACW,KAAK,CAACX,CAAC,CAACM,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC,CACDM,OAAO,CAAC,CAAC;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,wBAAwB,GAGnCC,UAAoB,IAEpBjB,CAAC,CACEE,MAAM,CAAC;EACNgB,IAAI,EAAED,UAAU;EAChBE,OAAO,EAAEnB,CAAC,CAACM,MAAM,CAAC,CAAC;EACnBc,IAAI,EAAEpB,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBe,QAAQ,EAAErB,CAAC,CAACsB,MAAM,CAACtB,CAAC,CAACM,MAAM,CAAC,CAAC,EAAEN,CAAC,CAACuB,GAAG,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,EAAE,CAACzB,CAAC,CAAC0B,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC,CACDC,GAAG,CAAClB,wBAAwB,CAAC,CAC7BkB,GAAG,CAACd,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -1,35 +1,25 @@
|
|
|
1
1
|
import { Documents, IssuerSigned } from './schema';
|
|
2
2
|
/**
|
|
3
|
-
* Decode base64 encoded CBOR data to JSON object.
|
|
3
|
+
* Decode base64 or base64url encoded CBOR data to JSON object.
|
|
4
|
+
* This method does not handle nested CBOR data, which will need additional parsing.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* **NOTE**: this method does not handle nested CBOR data, which will need additional
|
|
9
|
-
* parsing.
|
|
10
|
-
*
|
|
11
|
-
* @param data - The base64 or base64url encoded CBOR data
|
|
6
|
+
* @param data - The base64 or base64url encoded CBOR string
|
|
7
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
12
8
|
* @returns The decoded data as JSON object
|
|
13
9
|
*/
|
|
14
10
|
export declare const decode: (data: string) => Promise<any>;
|
|
15
11
|
/**
|
|
16
|
-
* Decode base64 or base64url encoded CBOR data to
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* an instance of {@link CborFailure}.
|
|
20
|
-
*
|
|
21
|
-
* @param data - The base64 encoded MDOC data
|
|
12
|
+
* Decode base64 or base64url encoded mDOC-CBOR data to a JSON object
|
|
13
|
+
* @param data - The base64 or base64url encoded mDOC-CBOR string
|
|
14
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
22
15
|
* @returns The decoded data as mDOC object
|
|
23
16
|
*/
|
|
24
17
|
export declare const decodeDocuments: (data: string) => Promise<Documents>;
|
|
25
18
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @param issuerSigned - The base64 or base64url encoded MDOC data
|
|
32
|
-
* @returns The decoded {@link IssuerSigned} contained in the mDOC object
|
|
19
|
+
* Decode base64 or base64url encoded issuerSigned attribute part of an mDOC-CBOR.
|
|
20
|
+
* @param data - The base64 or base64url encoded mDOC-CBOR containing the issuerSigned
|
|
21
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
22
|
+
* @returns The decoded {@link IssuerSigned}
|
|
33
23
|
*/
|
|
34
|
-
export declare const decodeIssuerSigned: (
|
|
24
|
+
export declare const decodeIssuerSigned: (data: string) => Promise<IssuerSigned>;
|
|
35
25
|
//# sourceMappingURL=decoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cbor/decoder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EAET,YAAY,EAEb,MAAM,UAAU,CAAC;AAGlB
|
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../../../src/cbor/cbor/decoder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EAET,YAAY,EAEb,MAAM,UAAU,CAAC;AAGlB;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,GAAG,CAGtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,SAAS,CAGrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,KACX,OAAO,CAAC,YAAY,CAItB,CAAC"}
|
|
@@ -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
|
|
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,
|
|
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"}
|