skyflow-js 1.8.0 → 1.11.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/CHANGELOG.md +20 -0
- package/README.md +177 -2
- package/dist/sdkNodeBuild/index.js +1 -1
- package/dist/sdkNodeBuild/index.js.LICENSE.txt +27 -0
- package/dist/sdkNodeBuild/index.js.LICENSE.txt.gz +0 -0
- package/dist/sdkNodeBuild/index.js.gz +0 -0
- package/package.json +7 -4
- package/types/Skyflow.d.ts +6 -5
- package/types/{container → core}/constants.d.ts +13 -123
- package/types/{container/external/PureJsController.d.ts → core/external/SkyflowContainer.d.ts} +4 -3
- package/types/{container/external → core/external/collect}/CollectContainer.d.ts +7 -6
- package/types/{container/external/element/index.d.ts → core/external/collect/CollectElement.d.ts} +5 -3
- package/types/core/external/common/Container.d.ts +3 -0
- package/types/{container/external/element → core/external/common}/IFrame.d.ts +0 -0
- package/types/core/external/common/SkyflowElement.d.ts +9 -0
- package/types/core/external/reveal/RevealContainer.d.ts +23 -0
- package/types/{container → core}/external/reveal/RevealElement.d.ts +5 -3
- package/types/{container → core}/internal/FrameElements.d.ts +0 -0
- package/types/core/internal/SkyflowFrame/SkyflowFrameController.d.ts +10 -0
- package/types/{container → core}/internal/iFrameForm/index.d.ts +0 -0
- package/types/{container → core}/internal/index.d.ts +0 -0
- package/types/{container → core}/internal/reveal/RevealFrame.d.ts +0 -0
- package/types/{container → core}/internal/reveal/RevealFrameController.d.ts +0 -0
- package/types/{core → core-utils}/collect.d.ts +0 -0
- package/types/{core → core-utils}/reveal.d.ts +1 -0
- package/types/libs/element-options.d.ts +1 -1
- package/types/libs/objectParse.d.ts +5 -1
- package/types/utils/busEvents/index.d.ts +1 -1
- package/types/utils/common/index.d.ts +6 -0
- package/types/utils/constants.d.ts +84 -0
- package/types/utils/helpers/index.d.ts +5 -0
- package/types/utils/logs.d.ts +26 -0
- package/types/utils/validators/index.d.ts +9 -5
- package/types/container/external/RevealContainer.d.ts +0 -18
- package/types/container/internal/pureJs/PureJsFrameController.d.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.11.0] - 2022-01-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- `replaceText` option for `RevealElement`
|
|
9
|
+
|
|
10
|
+
## [1.10.0] - 2022-01-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `formatRegex` option for `RevealElement`
|
|
14
|
+
|
|
15
|
+
## [1.9.1] - 2022-01-11
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Fixes in `invokeSoapConnection` method
|
|
19
|
+
|
|
20
|
+
## [1.9.0] - 2022-01-11
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `Soap protocol` support for connections
|
|
24
|
+
|
|
5
25
|
## [1.8.0] - 2021-12-07
|
|
6
26
|
|
|
7
27
|
### Added
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Skyflow’s Javascript SDK can be used to securely collect, tokenize, and reveal
|
|
|
9
9
|
- [**Securely collecting data client-side**](#Securely-collecting-data-client-side)
|
|
10
10
|
- [**Securely revealing data client-side**](#Securely-revealing-data-client-side)
|
|
11
11
|
- [**Securely invoking Connections client-side**](#Securely-invoking-Connections-client-side)
|
|
12
|
+
- [**Securely invoking Connections client-side using SOAP**](#Securely-invoking-Connections-client-side-using-soap)
|
|
12
13
|
|
|
13
14
|
---
|
|
14
15
|
|
|
@@ -870,6 +871,7 @@ const revealElement = {
|
|
|
870
871
|
label: "string", //optional, label for the form element
|
|
871
872
|
altText: "string" //optional, string that is shown before reveal, will show token if altText is not provided
|
|
872
873
|
}
|
|
874
|
+
|
|
873
875
|
```
|
|
874
876
|
`Note`:
|
|
875
877
|
- `token` is optional only if it is being used in invokeConnection()
|
|
@@ -1097,7 +1099,7 @@ const response = skyflowClient.invokeConnection(connectionConfig);
|
|
|
1097
1099
|
The values in the above parameters can contain collect elements, reveal elements or actual values. When elements are provided inplace of values, they get replaced with the value entered in the collect elements or value present in the reveal elements
|
|
1098
1100
|
|
|
1099
1101
|
**responseBody**:
|
|
1100
|
-
It is a JSON object that specifies where to render the response in the UI. The values in the responseBody can contain collect elements or reveal elements.
|
|
1102
|
+
It is a JSON object that specifies where to render the response in the UI. The values in the responseBody can contain collect elements or reveal elements. The actual values corresponding to these elements will be stripped out from the actual response, which is then forwarded from the SDK to the client application.
|
|
1101
1103
|
|
|
1102
1104
|
Sample use-cases on using invokeConnection():
|
|
1103
1105
|
|
|
@@ -1206,4 +1208,177 @@ Sample Response:
|
|
|
1206
1208
|
|
|
1207
1209
|
`Note`:
|
|
1208
1210
|
- `token` is optional for creating reveal element, if it is used for invokeConnection
|
|
1209
|
-
- responseBody contains collect or reveal elements to render the response from the Connection on UI
|
|
1211
|
+
- responseBody contains collect or reveal elements to render the response from the Connection on UI
|
|
1212
|
+
|
|
1213
|
+
# Securely invoking Connections client-side using SOAP
|
|
1214
|
+
|
|
1215
|
+
To invoke Connections using SOAP, use the `invokeSoapConnection(connectionConfig)` method of the Skyflow client as shown below:
|
|
1216
|
+
|
|
1217
|
+
```javascript
|
|
1218
|
+
const connectionConfig = {
|
|
1219
|
+
connectionURL: string, // connection url received when creating a Skyflow Connection
|
|
1220
|
+
httpHeaders: any, // optional
|
|
1221
|
+
requestXML: string,
|
|
1222
|
+
responseXML: string, // optional
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
const response = skyflowClient.invokeSoapConnection(connectionConfig);
|
|
1226
|
+
```
|
|
1227
|
+
|
|
1228
|
+
**httpHeaders** is the JSON object containing key-value pairs that are sent as request headers.
|
|
1229
|
+
|
|
1230
|
+
`Note:` "X-Skyflow-Authorization" key is added in headers by SDK internally. If user specifies it again, it overrides.
|
|
1231
|
+
|
|
1232
|
+
**requestXML** accepts the entire XML request as a string.
|
|
1233
|
+
|
|
1234
|
+
The values in the **requestXML** can contain collect element IDs or reveal element IDs or actual values. When the IDs are provided in place of values, they get replaced with the value entered in the collect elements or value present in the reveal elements.
|
|
1235
|
+
|
|
1236
|
+
**responseXML** accepts the entire XML request as a string. It specifies where to render the response in the UI. The values in the responseXML can contain collect element IDs or reveal element IDs. The actual values corresponding to these IDs will be stripped out from the actual response, which is then forwarded from the SDK to the client application.
|
|
1237
|
+
|
|
1238
|
+
`Note:` If the user needs to use Skyflow Elements in place of values in the requestXML or responseXML, they will pass in an additional tag **Skyflow** containing the ID of the particular element.
|
|
1239
|
+
|
|
1240
|
+
Please ensure that the paths configured in the responseXML are present in the actual response. In case of a misconfigured path, the response from the server will be discarded and an error will be thrown.
|
|
1241
|
+
|
|
1242
|
+
```javascript
|
|
1243
|
+
|
|
1244
|
+
// step 1
|
|
1245
|
+
const skyflowClient = skyflow.init({
|
|
1246
|
+
vaultID: '<vault_ID>', // optional
|
|
1247
|
+
vaultURL: '<vault_URL>', // optional
|
|
1248
|
+
getBearerToken: '<helperFunc>'
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
// step 2
|
|
1252
|
+
const revealContainer = skyflowClient.container(Skyflow.ContainerType.REVEAL)
|
|
1253
|
+
const collectContainer = skyflowClient.container(Skyflow.ContainerType.COLLECT)
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
// step 3
|
|
1257
|
+
const cardNumberElement = collectContainer.create({
|
|
1258
|
+
type: skyflow.ElementType.CARD_NUMBER
|
|
1259
|
+
})
|
|
1260
|
+
cardNumberElement.mount("#cardNumber")
|
|
1261
|
+
|
|
1262
|
+
const expiryMonthElement = revealContainer.create({
|
|
1263
|
+
token: "<expiry_month_token>"
|
|
1264
|
+
})
|
|
1265
|
+
expiryMonthElement.mount("#expirationMonth")
|
|
1266
|
+
|
|
1267
|
+
const expiryYearElement = revealContainer.create({
|
|
1268
|
+
token: "<expiry_year_token>"
|
|
1269
|
+
})
|
|
1270
|
+
expiryYearElement.mount("#expirationYear")
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
const cvvElement = revealContainer.create({
|
|
1274
|
+
altText: "###",
|
|
1275
|
+
})
|
|
1276
|
+
cvvElement.mount("#cvv")
|
|
1277
|
+
|
|
1278
|
+
//step 4
|
|
1279
|
+
const cardNumberID = cardNumberElement.getID() // to get element ID
|
|
1280
|
+
const expiryMonthID = expiryDateElement.getID()
|
|
1281
|
+
const expiryYearID = expiryYearElement.getID()
|
|
1282
|
+
const cvvElementID = cvvElement.getID()
|
|
1283
|
+
|
|
1284
|
+
// step 5
|
|
1285
|
+
const requestXML = `<soapenv:Envelope>
|
|
1286
|
+
<soapenv:Header>
|
|
1287
|
+
<ClientID>1234</ClientID>
|
|
1288
|
+
</soapenv:Header>
|
|
1289
|
+
<soapenv:Body>
|
|
1290
|
+
<GenerateCVV>
|
|
1291
|
+
<CardNumber>
|
|
1292
|
+
<Skyflow>${cardNumberID}</Skyflow>
|
|
1293
|
+
</CardNumber>
|
|
1294
|
+
<ExpiryMonth>
|
|
1295
|
+
<Skyflow>${expiryMonthID}</Skyflow>
|
|
1296
|
+
</ExpiryMonth>
|
|
1297
|
+
<ExpiryYear>
|
|
1298
|
+
<Skyflow>${expiryYearID}</Skyflow>
|
|
1299
|
+
</ExpiryYear>
|
|
1300
|
+
</GenerateCVV>
|
|
1301
|
+
</soapenv:Body>
|
|
1302
|
+
</soapenv:Envelope>`
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
const responseXML = `<soapenv:Envelope>
|
|
1306
|
+
<soapenv:Header>
|
|
1307
|
+
<HeaderList>
|
|
1308
|
+
<HeaderItem>
|
|
1309
|
+
<Name>NodeId</Name>
|
|
1310
|
+
<Value>
|
|
1311
|
+
<Skyflow>${revealNodeId}</Skyflow>
|
|
1312
|
+
</Value>
|
|
1313
|
+
</HeaderItem>
|
|
1314
|
+
<HeaderItem>
|
|
1315
|
+
<Name>ProgramId</Name>
|
|
1316
|
+
<Value>
|
|
1317
|
+
<Skyflow>${revealProgramId}</Skyflow>
|
|
1318
|
+
</Value>
|
|
1319
|
+
</HeaderItem>
|
|
1320
|
+
</HeaderList>
|
|
1321
|
+
<ClientID>1234</ClientID>
|
|
1322
|
+
</soapenv:Header>
|
|
1323
|
+
<soapenv:Body>
|
|
1324
|
+
<GenerateCVV>
|
|
1325
|
+
<CVV>
|
|
1326
|
+
<Skyflow>${cvvElementID}</Skyflow>
|
|
1327
|
+
</CVV>
|
|
1328
|
+
</GenerateCVV>
|
|
1329
|
+
</soapenv:Body>
|
|
1330
|
+
</soapenv:Envelope>`
|
|
1331
|
+
|
|
1332
|
+
const headers = {
|
|
1333
|
+
soapAction: '<soap_action>', // any http headers can be added here
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
const connectionConfig = {
|
|
1337
|
+
connectionURL: '<connection_url>',
|
|
1338
|
+
httpHeaders: headers,
|
|
1339
|
+
requestXML: requestXML,
|
|
1340
|
+
responseXML: responseXML,
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
const response = skyflowClient.invokeSoapConnection(connectionConfig);
|
|
1344
|
+
|
|
1345
|
+
```
|
|
1346
|
+
|
|
1347
|
+
Sample Response on success:
|
|
1348
|
+
|
|
1349
|
+
```xml
|
|
1350
|
+
<soapenv:Envelope>
|
|
1351
|
+
<soapenv:Header>
|
|
1352
|
+
<HeaderList>
|
|
1353
|
+
<HeaderItem>
|
|
1354
|
+
<Name>NodeId</Name>
|
|
1355
|
+
</HeaderItem>
|
|
1356
|
+
<HeaderItem>
|
|
1357
|
+
<Name>ProgramId</Name>
|
|
1358
|
+
</HeaderItem>
|
|
1359
|
+
</HeaderList>
|
|
1360
|
+
</soapenv:Header>
|
|
1361
|
+
<soapenv:Body>
|
|
1362
|
+
<GenerateCVV>
|
|
1363
|
+
<ReceivedTimestamp>2019-05-29 21:49:56.625</ReceivedTimestamp>
|
|
1364
|
+
</GenerateCVV>
|
|
1365
|
+
</soapenv:Body>
|
|
1366
|
+
</soapenv:Envelope>
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
Sample Response on failure:
|
|
1370
|
+
|
|
1371
|
+
```javascript
|
|
1372
|
+
{
|
|
1373
|
+
code: '<error_code>',
|
|
1374
|
+
description: '<error_description>',
|
|
1375
|
+
xml: '<xml_received_from_server>'
|
|
1376
|
+
}
|
|
1377
|
+
```
|
|
1378
|
+
|
|
1379
|
+
`Note`:
|
|
1380
|
+
- In responseXML we provide the tags that needs to be rendered in UI and stripped out from the actual response.
|
|
1381
|
+
1. For uniquely identifiable tag, we can give the elementID within a skyflow tag directly corresponding to the actual value.
|
|
1382
|
+
Please refer to the CVV tag in the above example. Here, we wish to strip the actual value present within the CVV tag.
|
|
1383
|
+
2. For arrays, since we have multiple tags with the same name, we will need to provide identifiers to uniquely identify the required tag.
|
|
1384
|
+
Please refer to HeaderItem tag. Here, we have provided NodeId within the Name tag which acts as an identifier and we wish to strip the actual value present in the Value tag.
|