@pagopa/io-react-native-iso18013 0.4.0 → 0.6.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 +8 -2
- package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeCborModule.kt +90 -58
- package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeIso18013Module.kt +216 -100
- package/android/src/test/java/com/ioreactnativeiso18013/Base64UtilsTest.kt +66 -0
- package/android/src/test/java/com/ioreactnativeiso18013/IoReactNativeIso18013Test.kt +508 -0
- package/ios/IoReactNativeCbor.mm +21 -21
- package/ios/IoReactNativeCbor.swift +70 -22
- package/ios/IoReactNativeIso18013.mm +10 -10
- package/ios/IoReactNativeIso18013.swift +89 -81
- package/lib/module/cbor/cbor/README.md +11 -63
- package/lib/module/cbor/cbor/decoder.js +13 -23
- package/lib/module/cbor/cbor/decoder.js.map +1 -1
- package/lib/module/cbor/cose/README.md +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/iso18013-5/README.md +66 -26
- package/lib/module/iso18013/iso18013-5/index.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/proximity.js +19 -6
- package/lib/module/iso18013/iso18013-5/proximity.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/request.js +0 -17
- package/lib/module/iso18013/iso18013-5/request.js.map +1 -1
- package/lib/module/iso18013/iso18013-7/README.md +32 -36
- package/lib/module/iso18013/iso18013-7/remote.js +11 -12
- package/lib/module/iso18013/iso18013-7/remote.js.map +1 -1
- 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/cose/sign.d.ts +4 -3
- package/lib/typescript/src/cbor/cose/sign.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/index.d.ts +2 -2
- package/lib/typescript/src/iso18013/iso18013-5/index.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts +20 -8
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/request.d.ts +0 -23
- package/lib/typescript/src/iso18013/iso18013-5/request.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-7/index.d.ts +1 -1
- package/lib/typescript/src/iso18013/iso18013-7/index.d.ts.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-7/remote.d.ts +11 -11
- 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/package.json +1 -1
- package/src/cbor/cbor/README.md +11 -63
- package/src/cbor/cbor/decoder.ts +13 -23
- package/src/cbor/cose/README.md +1 -1
- package/src/cbor/cose/sign.ts +5 -4
- package/src/iso18013/iso18013-5/README.md +66 -26
- package/src/iso18013/iso18013-5/index.ts +2 -6
- package/src/iso18013/iso18013-5/proximity.ts +20 -8
- package/src/iso18013/iso18013-5/request.ts +0 -22
- package/src/iso18013/iso18013-7/README.md +32 -36
- package/src/iso18013/iso18013-7/index.ts +1 -1
- package/src/iso18013/iso18013-7/remote.ts +12 -14
- package/src/iso18013/types.ts +24 -0
|
@@ -5,15 +5,11 @@ import { DocumentsFromString, IssuerSignedFromString } from "./schema.js";
|
|
|
5
5
|
import { coerceToJSON } from "./schema.utils.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Decode base64 encoded CBOR data to JSON object.
|
|
8
|
+
* Decode base64 or base64url encoded CBOR data to JSON object.
|
|
9
|
+
* This method does not handle nested CBOR data, which will need additional parsing.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* **NOTE**: this method does not handle nested CBOR data, which will need additional
|
|
14
|
-
* parsing.
|
|
15
|
-
*
|
|
16
|
-
* @param data - The base64 or base64url encoded CBOR data
|
|
11
|
+
* @param data - The base64 or base64url encoded CBOR string
|
|
12
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
17
13
|
* @returns The decoded data as JSON object
|
|
18
14
|
*/
|
|
19
15
|
export const decode = async data => {
|
|
@@ -22,12 +18,9 @@ export const decode = async data => {
|
|
|
22
18
|
};
|
|
23
19
|
|
|
24
20
|
/**
|
|
25
|
-
* Decode base64 or base64url encoded CBOR data to
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* an instance of {@link CborFailure}.
|
|
29
|
-
*
|
|
30
|
-
* @param data - The base64 encoded MDOC data
|
|
21
|
+
* Decode base64 or base64url encoded mDOC-CBOR data to a JSON object
|
|
22
|
+
* @param data - The base64 or base64url encoded mDOC-CBOR string
|
|
23
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
31
24
|
* @returns The decoded data as mDOC object
|
|
32
25
|
*/
|
|
33
26
|
export const decodeDocuments = async data => {
|
|
@@ -36,16 +29,13 @@ export const decodeDocuments = async data => {
|
|
|
36
29
|
};
|
|
37
30
|
|
|
38
31
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @param issuerSigned - The base64 or base64url encoded MDOC data
|
|
45
|
-
* @returns The decoded {@link IssuerSigned} contained in the mDOC object
|
|
32
|
+
* Decode base64 or base64url encoded issuerSigned attribute part of an mDOC-CBOR.
|
|
33
|
+
* @param data - The base64 or base64url encoded mDOC-CBOR containing the issuerSigned
|
|
34
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
35
|
+
* @returns The decoded {@link IssuerSigned}
|
|
46
36
|
*/
|
|
47
|
-
export const decodeIssuerSigned = async
|
|
48
|
-
const decodedIssuerSignedString = await IoReactNativeCbor.decodeIssuerSigned(
|
|
37
|
+
export const decodeIssuerSigned = async data => {
|
|
38
|
+
const decodedIssuerSignedString = await IoReactNativeCbor.decodeIssuerSigned(data);
|
|
49
39
|
return await IssuerSignedFromString.parseAsync(decodedIssuerSignedString);
|
|
50
40
|
};
|
|
51
41
|
//# sourceMappingURL=decoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IoReactNativeCbor","DocumentsFromString","IssuerSignedFromString","coerceToJSON","decode","data","jsonString","parseAsync","decodeDocuments","documentsString","decodeIssuerSigned","
|
|
1
|
+
{"version":3,"names":["IoReactNativeCbor","DocumentsFromString","IssuerSignedFromString","coerceToJSON","decode","data","jsonString","parseAsync","decodeDocuments","documentsString","decodeIssuerSigned","decodedIssuerSignedString"],"sourceRoot":"../../../../src","sources":["cbor/cbor/decoder.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,aAAI;AACtC,SAEEC,mBAAmB,EAEnBC,sBAAsB,QACjB,aAAU;AACjB,SAASC,YAAY,QAAQ,mBAAgB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAG,MAAOC,IAAY,IAAmB;EAC1D,MAAMC,UAAU,GAAG,MAAMN,iBAAiB,CAACI,MAAM,CAACC,IAAI,CAAC;EACvD,OAAO,MAAMF,YAAY,CAACI,UAAU,CAACD,UAAU,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,eAAe,GAAG,MAAOH,IAAY,IAAyB;EACzE,MAAMI,eAAe,GAAG,MAAMT,iBAAiB,CAACQ,eAAe,CAACH,IAAI,CAAC;EACrE,OAAO,MAAMJ,mBAAmB,CAACM,UAAU,CAACE,eAAe,CAAC;AAC9D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,MAChCL,IAAY,IACc;EAC1B,MAAMM,yBAAyB,GAC7B,MAAMX,iBAAiB,CAACU,kBAAkB,CAACL,IAAI,CAAC;EAClD,OAAO,MAAMH,sBAAsB,CAACK,UAAU,CAACI,yBAAyB,CAAC;AAC3E,CAAC","ignoreList":[]}
|
|
@@ -5,18 +5,19 @@ import { IoReactNativeCbor } from "../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Sign base64 encoded data with COSE and return the COSE-Sign1 object in base64 encoding
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
8
|
+
* @param data - The base64 or base64url encoded payload to sign
|
|
9
9
|
* @param keyTag - The alias of the key to use for signing.
|
|
10
|
-
* @throws {
|
|
10
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
11
11
|
* @returns The COSE-Sign1 object in base64 encoding
|
|
12
12
|
*/
|
|
13
|
-
export const sign = async (
|
|
13
|
+
export const sign = async (data, keyTag) => await IoReactNativeCbor.sign(data, keyTag);
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Verifies a COSE-Sign1 object with the provided public key
|
|
17
17
|
*
|
|
18
18
|
* @param data - The COSE-Sign1 object in base64 or base64url encoding
|
|
19
19
|
* @param publicKey - The public key in JWK format
|
|
20
|
+
* @throws {ModuleError} in case of failure which can be parsed with {@link ModuleErrorSchema}
|
|
20
21
|
* @returns true if the signature is valid, false otherwise
|
|
21
22
|
*/
|
|
22
23
|
export const verify = async (data, publicKey) => await IoReactNativeCbor.verify(data, publicKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IoReactNativeCbor","sign","
|
|
1
|
+
{"version":3,"names":["IoReactNativeCbor","sign","data","keyTag","verify","publicKey"],"sourceRoot":"../../../../src","sources":["cbor/cose/sign.ts"],"mappings":";;AACA,SAASA,iBAAiB,QAAQ,aAAI;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,GAAG,MAAAA,CAAOC,IAAY,EAAEC,MAAc,KACrD,MAAMH,iBAAiB,CAACC,IAAI,CAACC,IAAI,EAAEC,MAAM,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAG,MAAAA,CACpBF,IAAY,EACZG,SAAoB,KACC,MAAML,iBAAiB,CAACI,MAAM,CAACF,IAAI,EAAEG,SAAS,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# ISO18013-5
|
|
2
2
|
|
|
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 proximity presentation according to the
|
|
4
|
-
ISO 18013-5 standard and remote presentation according to the ISO 18013-7 standard.
|
|
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 proximity presentation according to the ISO 18013-5 standard.
|
|
5
4
|
|
|
6
5
|
## Installation
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
```
|
|
8
|
+
yarn add @pagopa/io-react-native-iso18013
|
|
9
|
+
cd ios && bundle exec pod install && cd ..
|
|
10
|
+
```
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## Events
|
|
11
13
|
|
|
12
14
|
This library emits the following events:
|
|
13
15
|
| Event | Payload | Description |
|
|
@@ -15,9 +17,29 @@ This library emits the following events:
|
|
|
15
17
|
| onDeviceConnecting (iOS only) | `undefined` | Event dispatched when the verifier app is connecting |
|
|
16
18
|
| onDeviceConnected | `undefined` | Event dispatched when the verifier app is connected. |
|
|
17
19
|
| onDocumentRequestReceived | `{ data: string } \| undefined` | Event dispatched when the consumer app receives a new request, contained in the data payload. It can be parsed via the `parseVerifierRequest` provided [here](src/schema.ts). |
|
|
18
|
-
| onDeviceDisconnected | `undefined` | Event dispatched when the verifier app disconnects. |
|
|
20
|
+
| onDeviceDisconnected | `undefined` | Event dispatched when the verifier app disconnects by sending the END (0x02) flag. |
|
|
19
21
|
| onError | `{ error: string } \| undefined` | Event dispatched when an error occurs which is contained in the error payload. It can be parsed via the `parseError` provided [here](src/schema.ts). |
|
|
20
22
|
|
|
23
|
+
The events flow is described in the following diagram:
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
flowchart LR
|
|
27
|
+
onDeviceConnecting["onDeviceConnecting *(iOS only)*"]
|
|
28
|
+
onDeviceConnected["onDeviceConnected"]
|
|
29
|
+
onDocumentRequestReceived["onDocumentRequestReceived"]
|
|
30
|
+
onDeviceDisconnected["onDeviceDisconnected"]
|
|
31
|
+
onError["onError"]
|
|
32
|
+
|
|
33
|
+
onDeviceConnecting -- "Verifier app connects" --> onDeviceConnected
|
|
34
|
+
|
|
35
|
+
onDeviceConnected -- "Verifier app sends request" --> onDocumentRequestReceived
|
|
36
|
+
onDeviceConnected -- "Verifier sends END (0x02)" --> onDeviceDisconnected
|
|
37
|
+
onDeviceConnected -- "Error status or abrupt disconnection" --> onError
|
|
38
|
+
|
|
39
|
+
onDocumentRequestReceived -- "Verifier sends END (0x02)" --> onDeviceDisconnected
|
|
40
|
+
onDocumentRequestReceived -- "Error status or abrupt disconnection" --> onError
|
|
41
|
+
```
|
|
42
|
+
|
|
21
43
|
Listeners can be added using the `addListener` method and removed by using the returned reference by calling the `remove` method.
|
|
22
44
|
|
|
23
45
|
```typescript
|
|
@@ -107,7 +129,9 @@ ISO18013_5.addListener(
|
|
|
107
129
|
);
|
|
108
130
|
```
|
|
109
131
|
|
|
110
|
-
|
|
132
|
+
## Methods
|
|
133
|
+
|
|
134
|
+
#### `start`
|
|
111
135
|
|
|
112
136
|
Starts the proximity flow and starts the bluetooth service. This method also accepts optional parameters to configure the initialization on Android, along with the possibility
|
|
113
137
|
to specify a certificates of array to verify the reader app.
|
|
@@ -118,7 +142,7 @@ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
|
|
|
118
142
|
await ISO18013_5.start();
|
|
119
143
|
```
|
|
120
144
|
|
|
121
|
-
|
|
145
|
+
#### `getQrCodeString`
|
|
122
146
|
|
|
123
147
|
Returns the QR code string which contains a base64url encoded CBOR object which encodes the bluetooth engagement data.
|
|
124
148
|
It can be used to display the QR code in the UI which will be scanned by the verifier app.
|
|
@@ -130,25 +154,37 @@ const qrCodeString = await ISO18013_5.getQrCodeString();
|
|
|
130
154
|
console.log(qrCodeString);
|
|
131
155
|
```
|
|
132
156
|
|
|
133
|
-
|
|
157
|
+
#### `generateResponse`
|
|
134
158
|
|
|
135
159
|
Generates a response that will be sent to the verifier app containing the requested documents.
|
|
136
160
|
|
|
137
161
|
```typescript
|
|
138
162
|
import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
|
|
139
163
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
164
|
+
const documents = [
|
|
165
|
+
{
|
|
166
|
+
issuerSignedContent: 'base64url-or-base64-encoded-content',
|
|
167
|
+
alias: 'key-alias',
|
|
168
|
+
docType: 'docType',
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
const acceptedFields = {
|
|
173
|
+
'org.iso.18013.5.1.mDL': {
|
|
174
|
+
'org.iso.18013.5.1': {
|
|
175
|
+
hair_colour: true,
|
|
176
|
+
given_name_national_character: true,
|
|
177
|
+
family_name_national_character: true,
|
|
178
|
+
given_name: true,
|
|
145
179
|
},
|
|
146
|
-
|
|
147
|
-
}
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const response = await ISO18013_5.generateResponse(documents, acceptedFields);
|
|
148
184
|
console.log(response);
|
|
149
185
|
```
|
|
150
186
|
|
|
151
|
-
|
|
187
|
+
#### `sendResponse`
|
|
152
188
|
|
|
153
189
|
Sends the response generate by `generateResponse` to the verifier app.
|
|
154
190
|
|
|
@@ -158,20 +194,17 @@ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
|
|
|
158
194
|
await ISO18013_5.sendResponse(response);
|
|
159
195
|
```
|
|
160
196
|
|
|
161
|
-
|
|
197
|
+
#### `sendErrorResponse`
|
|
162
198
|
|
|
163
199
|
Sends an error response to the verifier app. The supported error codes are defined in the Table 20 of the ISO 18013-5 standard and are coded in the `ErrorCode` enum.
|
|
164
200
|
|
|
165
201
|
```typescript
|
|
166
202
|
import { ISO18013_5, ErrorCode } from '@pagopa/io-react-native-iso18013';
|
|
167
203
|
|
|
168
|
-
await ISO18013_5.sendErrorResponse(
|
|
169
|
-
errorCode: ErrorCode.SESSION_ENCRYPTION,
|
|
170
|
-
errorMessage: 'An error occurred while encrypting the session',
|
|
171
|
-
});
|
|
204
|
+
await ISO18013_5.sendErrorResponse(ErrorCode.SESSION_ENCRYPTION);
|
|
172
205
|
```
|
|
173
206
|
|
|
174
|
-
|
|
207
|
+
#### `close`
|
|
175
208
|
|
|
176
209
|
Closes the QR engagement by releasing the resources allocated during the `start` method.
|
|
177
210
|
Before starting a new flow, it is necessary to call this method to ensure that the previous flow is properly closed.
|
|
@@ -183,9 +216,9 @@ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
|
|
|
183
216
|
await ISO18013_5.close();
|
|
184
217
|
```
|
|
185
218
|
|
|
186
|
-
## Proximity
|
|
219
|
+
## Proximity Sequence Diagram
|
|
187
220
|
|
|
188
|
-
This section describes a high level overview of the interactions between an app implementing the `io-react-native-proximity` library and a verifier app.
|
|
221
|
+
This section describes a high level overview of the happy flow interactions between an app implementing the `io-react-native-proximity` library and a verifier app.
|
|
189
222
|
|
|
190
223
|
```mermaid
|
|
191
224
|
sequenceDiagram
|
|
@@ -218,8 +251,15 @@ sequenceDiagram
|
|
|
218
251
|
proximity->>+verifier: Sends the error response code
|
|
219
252
|
verifier->>+verifier: Shows the received error response code
|
|
220
253
|
end
|
|
221
|
-
verifier
|
|
222
|
-
|
|
254
|
+
alt The verifier sends the END (0x02) termination flag
|
|
255
|
+
verifier->>+app: Closes the connection
|
|
256
|
+
proximity->>+app: Calls the onDeviceDisconnected callback
|
|
257
|
+
app->>+proximity: Calls close()
|
|
258
|
+
else The verifier app closes the connection without the END (0x02) termination flag
|
|
259
|
+
verifier->>+app: Closes the connection
|
|
260
|
+
proximity->>+app: Calls the onError callback
|
|
261
|
+
app->>+proximity: Calls close()
|
|
262
|
+
end
|
|
223
263
|
```
|
|
224
264
|
|
|
225
265
|
## Errors
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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);
|
|
@@ -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"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/proximity.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;
|
|
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,21 +40,4 @@ const VerifierRequest = z.object({
|
|
|
40
40
|
export const parseVerifierRequest = input => {
|
|
41
41
|
return VerifierRequest.parse(input);
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* This is the type definition for the accepted fields that will be presented to the verifier app.
|
|
46
|
-
* It contains of a nested object structure, where the outermost key represents the credential doctype.
|
|
47
|
-
* The inner dictionary contains namespaces, and for each namespace, there is another dictionary mapping requested claims to a boolean value,
|
|
48
|
-
* which indicates whether the user is willing to present the corresponding claim. Example:
|
|
49
|
-
* `{
|
|
50
|
-
* "org.iso.18013.5.1.mDL": {
|
|
51
|
-
* "org.iso.18013.5.1": {
|
|
52
|
-
* "hair_colour": true, // Indicates the user is willing to present this claim
|
|
53
|
-
* "given_name_national_character": true,
|
|
54
|
-
* "family_name_national_character": true,
|
|
55
|
-
* "given_name": true,
|
|
56
|
-
* }
|
|
57
|
-
* }
|
|
58
|
-
* }`
|
|
59
|
-
**/
|
|
60
43
|
//# sourceMappingURL=request.js.map
|
|
@@ -1 +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
|
|
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,51 +1,47 @@
|
|
|
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
|
-
const result = await ISO18013_7.generateOID4VPDeviceResponse(
|
|
20
|
-
clientId,
|
|
21
|
-
responseUri,
|
|
22
|
-
authorizationRequestNonce,
|
|
23
|
-
mdocGeneratedNonce,
|
|
24
|
-
documents,
|
|
25
|
-
fieldRequestedAndAccepted
|
|
26
|
-
);
|
|
27
|
-
} catch (error: any) {
|
|
28
|
-
const { message, userInfo } = e as CoseFailure;
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
#### Signature
|
|
16
|
+
import { ISO18013_7 } from '@pagopa/io-react-native-iso18013';
|
|
33
17
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
issuerSignedContent
|
|
37
|
-
alias
|
|
38
|
-
docType
|
|
39
|
-
}
|
|
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
|
+
};
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
clientId
|
|
43
|
-
responseUri
|
|
44
|
-
authorizationRequestNonce
|
|
45
|
-
mdocGeneratedNonce
|
|
46
|
-
documents
|
|
47
|
-
|
|
48
|
-
)
|
|
37
|
+
const result = await ISO18013_7.generateOID4VPDeviceResponse(
|
|
38
|
+
clientId,
|
|
39
|
+
responseUri,
|
|
40
|
+
authorizationRequestNonce,
|
|
41
|
+
mdocGeneratedNonce,
|
|
42
|
+
documents,
|
|
43
|
+
acceptedFields
|
|
44
|
+
);
|
|
49
45
|
```
|
|
50
46
|
|
|
51
47
|
## Errors
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import { IoReactNativeIso18013 } from "../index.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param clientId extracted from OID4VP session
|
|
7
|
-
* @param responseUri extracted from OID4VP session
|
|
8
|
-
* @param authorizationRequestNonce extracted from OID4VP session
|
|
9
|
-
* @param mdocGeneratedNonce
|
|
10
|
-
* @param documents
|
|
11
|
-
* @param
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
* @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
|
|
15
14
|
*/
|
|
16
|
-
export const generateOID4VPDeviceResponse = async (clientId, responseUri, authorizationRequestNonce, mdocGeneratedNonce, documents,
|
|
17
|
-
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);
|
|
18
17
|
};
|
|
19
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":[]}
|
|
@@ -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"}
|
|
@@ -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
|
|
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 {
|
|
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: (
|
|
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,
|
|
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,5 +1,5 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type VerifierRequest, parseVerifierRequest } from './request';
|
|
2
2
|
export { type OnErrorPayload, OnErrorPayloadSchema, ModuleErrorSchema, type ModuleErrorCodes, type ModuleError, } from './error';
|
|
3
3
|
export { ErrorCode, type Events, type EventsPayload, addListener, close, generateResponse, getQrCodeString, sendErrorResponse, sendResponse, start, } from './proximity';
|
|
4
|
-
export { type RequestedDocument } from '../types';
|
|
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,
|
|
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"}
|