VGS Show - is a product suite that allows customers to reveal and show information securely without possession of it. VGSShow iOS SDK allows you to securely reveal data from VGS and display it via forms without having to have that data pass through your systems. The form UI Elements behave like traditional labels while securing access to the unsecured data.
You should have your organization registered at the VGS Dashboard. Sandbox vault will be pre-created for you. You should use your and have already created aliases to start revealing data. If you need to create aliases, you can use VGSCollecSDK with same to create some, or try one of the methods described in our docs.
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate VGSShowSDK into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'VGSShowSDK'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, add VGSShowSDK dependency.
dependencies: [
.package(url: "https://github.com/verygoodsecurity/vgs-show-ios", .upToNextMajor(from: "1.0.0"))
]
import VGSShowSDK
Use your <vaultId>
to initialize VGSShow instance. You can get it in your organisation dashboard.
/// VGSShow instance.
let vgsShow = VGSShow(id: "<VAULT_ID>", environment: .sandbox)
/// VGSShow views.
let cardNumberLabel = VGSLabel()
let expDateLabel = VGSLabel()
override func viewDidLoad() {
super.viewDidLoad()
/// ...
// Setup content path in reveal response
cardNumberLabel.contentPath = "cardData.cardNumber"
expDateLabel.contentPath = "cardData.expDate"
// Register VGSShow views in vgsShow instance.
vgsShow.subscribe(cardNumberLabel)
vgsShow.subscribe(expDateLabel)
// Configure UI.
configureUI()
/// ...
}
// Configure VGS Show UI Elements.
private func configureUI() {
let paddings = UIEdgeInsets.init(top: 8, left: 8, bottom: 8, right: 8)
let textColor = UIColor.white
let borderColor = UIColor.clear
let font = UIFont.systemFont(ofSize: 20)
let backgroundColor = UIColor.systemBlue
let cornerRadius: CGFloat = 0
cardNumberLabel.textColor = textColor
cardNumberLabel.paddings = paddings
cardNumberLabel.borderColor = borderColor
cardNumberLabel.font = font
cardNumberLabel.backgroundColor = backgroundColor
cardNumberLabel.layer.cornerRadius = cornerRadius
expDateLabel.textColor = textColor
expDateLabel.paddings = paddings
expDateLabel.borderColor = borderColor
expDateLabel.font = font
expDateLabel.backgroundColor = backgroundColor
expDateLabel.layer.cornerRadius = cornerRadius
expDateLabel.characterSpacing = 0.83
}
...
In order to change aliases to the real data, you need to make reveal request. The aliases data will be revealed when the response goes through VGS proxy. If the request is success, revealed data will be automatically displayed in subscribed VGS Show UI Elements. You also can send any additional data in the request payload.
func revealData() {
/// set custom headers
vgsShow.customHeaders = [
"custom-header": "custom data"
]
/// send any additional data to your backend
let customPayload = ["CustomKey" : "CustomValue"]()
/// make a reveal request
vgsShow.request(path: "post",
method: .post,
payload: customPayload) { (requestResult) in
switch requestResult {
case .success(let code):
self.copyCardNumberButton.isEnabled = true
print("vgsshow success, code: \(code)")
case .failure(let code, let error):
print("vgsshow failed, code: \(code), error: \(error)")
}
}
}
Demo application for collecting card data on iOS is here.
Also you can reveal PDF files with VGShow iOS SDK. Check our demo with redact and reveal pdf file use case.
To follow VGSShowSDK
updates and changes check the releases page.
VGSShow tracks a few key metrics to understand SDK features usage help us know what areas need improvement. No personal/sensitive information is collected.
You can easily opt-out of metrics collection in VGSAnalyticsClient
:
VGSAnalyticsClient.shared.shouldCollectAnalytics = false
- iOS 13+
- Swift 5
VGSShow iOS SDK is released under the MIT license. See LICENSE for details.