Git Product home page Git Product logo

verygoodsecurity / vgs-show-ios Goto Github PK

View Code? Open in Web Editor NEW
6.0 11.0 6.0 9.65 MB

Securely reveal data from VGS and display it via forms without having to have that data pass through your systems

Home Page: https://www.verygoodsecurity.com/docs/vgs-show

License: MIT License

Objective-C 0.13% Swift 99.28% Ruby 0.46% Shell 0.14%
ios pci pci-dss swift sdk sensitive-data vgs credit-card zerodata team-developer-experience

vgs-show-ios's Introduction

UT license swift

VGS Show iOS SDK

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.

VGS Show iOS SDK Aliases VGS Show iOS SDK Revealed Data

Table of contents

Before you start

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.

Integration

CocoaPods

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'

Swift Package Manager, Xcode 12+

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"))
]

Usage

Import SDK

import VGSShowSDK

Create VGSShow instance and VGS UI Elements

Use your <vaultId> to initialize VGSShow instance. You can get it in your organisation dashboard.

Code example

/// 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
}
...

Make reveal data request

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

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.

Releases

To follow VGSShowSDK updates and changes check the releases page.

Metrics

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

Dependencies

  • iOS 13+
  • Swift 5

License

VGSShow iOS SDK is released under the MIT license. See LICENSE for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.