Skip to content

Commit 90e26cf

Browse files
skyflow-puneetskyflow-bharti
authored andcommitted
[SDK-753] Fixed typo in sample readme
1 parent 54f5116 commit 90e26cf

File tree

1 file changed

+52
-64
lines changed

1 file changed

+52
-64
lines changed

Samples/README.md

Lines changed: 52 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -35,98 +35,86 @@ Test the SDK by adding `VAULT-ID`, `VAULT-URL`, and `SERVICE-ACCOUNT` details in
3535
4. Install `skyflow-node`
3636

3737
npm i skyflow-node
38-
5. Create `index.js` file
39-
6. Open `index.js` file
40-
7. populate `index.js` file with below code snippet
38+
5. Move the downloaded “credentials.json” file #Create a service account account into the bearer-token-generator directory.
39+
6. Create `index.js` file
40+
7. Open `index.js` file
41+
8. populate `index.js` file with below code snippet
4142
```javascript
42-
const express = require('express')
43-
const app = express()
44-
var cors = require('cors')
45-
const port = 3000
43+
const express = require("express");
44+
const app = express();
45+
const cors = require("cors");
46+
const port = 3000;
4647
const {
47-
generateBearerToken,
48-
isExpired
49-
} = require('skyflow-node');
48+
generateBearerToken,
49+
isExpired
50+
} = require("skyflow-node");
5051

51-
app.use(cors())
52+
app.use(cors());
5253

53-
let filepath = 'cred.json';
54+
let filepath = "credentials.json";
5455
let bearerToken = "";
5556

56-
function getSkyflowBearerToken() {
57-
return new Promise(async (resolve, reject) => {
58-
try {
59-
if (!isExpired(bearerToken)) resolve(bearerToken)
60-
else {
61-
let response = await generateBearerToken(filepath);
62-
bearerToken = response.accessToken;
63-
resolve(bearerToken);
64-
}
65-
} catch (e) {
66-
reject(e);
67-
}
68-
});
57+
const getSkyflowBearerToken = () => {
58+
return new Promise(async (resolve, reject) => {
59+
try {
60+
if (!isExpired(bearerToken)) {
61+
resolve(bearerToken);
62+
}
63+
else {
64+
let response = await generateBearerToken(filepath);
65+
bearerToken = response.accessToken;
66+
resolve(bearerToken);
67+
}
68+
} catch (e) {
69+
reject(e);
70+
}
71+
});
6972
}
70-
71-
app.get('/', async (req, res) => {
72-
let bearerToken = await getSkyflowBearerToken();
73-
res.json({"accessToken" : bearerToken});
74-
})
73+
app.get("/", async (req, res) => {
74+
let bearerToken = await getSkyflowBearerToken();
75+
res.json({"accessToken" : bearerToken});
76+
});
7577

7678
app.listen(port, () => {
77-
console.log(`Server is listening on port ${port}`)
79+
console.log(`Server is listening on port ${port}`);
7880
})
7981
```
80-
8. Start the server
82+
9. Start the server
8183

8284
node index.js
8385
server will start at `localhost:3000`
84-
9. Your **<TOKEN_END_POINT_URL>** with `http://localhost:3000/`
86+
10. Your **<TOKEN_END_POINT_URL>** with `http://localhost:3000/`
8587

8688
## The samples
8789
### Collect and reveal
88-
This sample illustrates how to use secure Skyflow elements to collect sensitive user information and reveal it to the user via tokens.
90+
This sample demonstrates how to use Skyflow Elements to collect sensitive user information and reveal it to a user.
8991
#### Configure
9092
1. In `Skyflow.Configuration()` of [ViewController.swift](CollectAndRevealSample/CollectAndRevealSample/ViewController.swift), replace with the following fields:
91-
- Replace the placeholder "<VAULT_ID>" with the correct vaultId you want to connect
92-
- Replace the placeholder "<VAULT_URL>" with the correct vaultURL
93-
2. Update `Fields` struct in [ResponseStructs.swift](CollectAndRevealSample/CollectAndRevealSample/ResponseStructs.swift) with field name of used vault. For ex:
94-
95-
```swift
96-
struct Fields: Codable {
97-
let name: NameField
98-
let cvv: String
99-
let cardExpiration: String
100-
let cardNumber: String
101-
let skyflow_id: String
102-
}
103-
```
104-
105-
The fields can be different depending upon the vault.
106-
3. Update
107-
4. Replace the placeholder "<TOKEN_END_POINT_URL>" of [ExampleTokenProvider.swift](CollectAndRevealSample/CollectAndRevealSample/ExampleTokenProvider.swift) with the bearer token endpoint which gives the bearerToken, implemented at your backend or `http://localhost:3000/`.
93+
- The placeholder "<VAULT_ID>" with the vault ID you noted previously.
94+
- The placeholder "<VAULT_URL>" with the vault URL you noted previously.
95+
2. Replace the placeholder "<TOKEN_END_POINT_URL>" in [ExampleTokenProvider.swift](https://github.com/skyflowapi/skyflow-iOS/blob/SDK-753-update-sample-app-readme/Samples/CollectAndRevealSample/CollectAndRevealSample/ExampleTokenProvider.swift) with the service account bearer token endpoint.
10896

10997
#### Running the sample
11098
1. Open CMD
111-
2. Navigate to `CollectAndRevealSample`
99+
2. Navigate to CollectAndRevealSample
112100
3. Run
113101

114102
pod install
115-
4. Open the `CollectAndRevealSample.xcworkspace` file using xcode
116-
5. click on build and run
117-
118-
### Validations
119-
This sample illustrates how to apply custom validation rules on secure Skyflow Collect elements to restrict the type of input a user can provide.
103+
4. Open the CollectAndRevealSample.xcworkspace file using xcode.
104+
5. Build and run using command + R.
105+
106+
### Custom validation
107+
This sample demonstrates how to apply custom validation rules to Skyflow elements to restrict the type of input a user can provide.
120108
#### Configure
121-
1. In `Skyflow.Configuration()` of [ViewController.swift](Validations/Validations/ViewController.swift), replace with the following fields:
122-
2. Replace the placeholder "<VAULT_ID>" in the configuration with the correct vaultId you want to connect
123-
3. Replace the placeholder "<VAULT_URL>" with the correct vaultURL
124-
4. Replace the placeholder "<TOKEN_END_POINT_URL>" in [ExampleTokenProvider.swift](Validations/Validations/ExampleTokenProvider.swift) with the bearer token endpoint which gives the bearerToken, implemented at your backend or `http://localhost:3000/`.
109+
In `Skyflow.Configuration()` of [ViewController.swift](Validations/Validations/ViewController.swift), replace with the following fields:
110+
1. Replace the placeholder "<VAULT_ID>" in the configuration with the vault ID previously noted. Replace the placeholder "<VAULT_URL>" with the vault URL previously noted.
111+
2. Replace the placeholder "<TOKEN_END_POINT_URL>" in [ExampleTokenProvider.swift](https://github.com/skyflowapi/skyflow-iOS/blob/SDK-753-update-sample-app-readme/Samples/Validations/Validations/ExampleTokenProvider.swift) with the service account bearer token endpoint.
112+
125113
#### Running the sample
126114
1. Open CMD
127-
2. Navigate to `Validations`
115+
2. Navigate to Validations
128116
3. Run
129117
130118
pod install
131-
4. Open the `Validations.xcworkspace` file using xcode
132-
5. click on build and run
119+
4. Open the Validations.xcworkspace file using xcode
120+
5. Build and run using command + R.

0 commit comments

Comments
 (0)