Git Product home page Git Product logo

vgs-show-android's Introduction

UT license

VGS Show Android SDK allows you to securely reveal data for your users without having to have that data pass through your systems. It provides customizable UI elements for showing users' sensitive data securely on Android devices.

Table of contents

Dependencies

Dependency Version
Min SDK 21
Target SDK 34
org.jetbrains.kotlin:kotlin-gradle-plugin 1.9.22
androidx.appcompat:appcompat 1.6.1
com.squareup.okhttp3:okhttp 4.12.0

Structure

  • VGSShow SDK - provides an API for interacting with the VGS Vault
  • app - sample application to act as the host app for testing the SDK during development

Integration

For integration you need to install the Android Studio and a JDK on your machine.

Integrate the VGS Show SDK to your project.
If you are using Maven, add the following to your build.gradle file.
dependencies {
    implementation "androidx.appcompat:appcompat:<version>"
    implementation "com.google.android.material:material:<version>"

    implementation "com.verygoodsecurity:vgsshow:<version>"
}
Add input fields to R.layout.activity_main layout file .
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
  
    <com.verygoodsecurity.vgsshow.widget.VGSTextView
        android:id="@+id/infoField"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:contentPath="<CONTENT_PATH>"
        app:gravity="center"
        app:textColor="@android:color/black"
        app:textStyle="bold" 

//Other fields..

</LinearLayout>
To initialize VGSShow you have to set your vault id and Environment type.
Use subscribe(VGSView) to attach view to VGSShow.
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.verygoodsecurity.demoshow.R
import com.verygoodsecurity.vgsshow.VGSShow
import com.verygoodsecurity.vgsshow.widget.VGSTextView
import com.verygoodsecurity.vgsshow.core.VGSEnvironment

class MainActivity : AppCompatActivity() {
    private lateinit var vgsShow: VGSShow
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        vgsShow = VGSShow(this, "<VAULT_ID>", VGSEnvironment.Sandbox())

        val view = findViewById<VGSTextView>(R.id.infoField)
        vgsShow.subscribe(view)
    }
}
Revealing Sensitive Data.
Call requestAsync to reveal and send data on VGS Server.
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.verygoodsecurity.demoshow.R
import com.verygoodsecurity.vgsshow.VGSShow
import com.verygoodsecurity.vgsshow.widget.VGSTextView
import com.verygoodsecurity.vgsshow.core.VGSEnvironment

class MainActivity : AppCompatActivity() {

    private lateinit var vgsShow: VGSShow
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        
        vgsShow = VGSShow(this, "<VAULT_ID>", VGSEnvironment.Sandbox())
        vgsShow.subscribe(findViewById(R.id.infoField))

        findViewById<Button>(R.id.revealButton)?.setOnClickListener {
            vgsShow.requestAsync("/post",
                VGSHttpMethod.POST,
                mapOf("<FIELD_NAME>" to "<REVEAL_ALIAS>")
            )
        }
    }
}
Receive responses.
To retrieve response you need to implement VGSOnResponseListener.
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.verygoodsecurity.demoshow.R
import com.verygoodsecurity.vgsshow.VGSShow
import com.verygoodsecurity.vgsshow.widget.VGSTextView
import com.verygoodsecurity.vgsshow.core.VGSEnvironment
import com.verygoodsecurity.vgsshow.core.network.model.VGSResponse
import com.verygoodsecurity.vgsshow.core.listener.VGSOnResponseListener

class MainActivity : AppCompatActivity() {

    private lateinit var vgsShow: VGSShow

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        vgsShow = VGSShow(this, "<VAULT_ID>", VGSEnvironment.Sandbox())
        vgsShow.subscribe(findViewById(R.id.infoField))

        findViewById<Button>(R.id.revealButton)?.setOnClickListener {
            vgsShow.requestAsync("/post",
                VGSHttpMethod.POST,
                mapOf("<FIELD_NAME>" to "<REVEAL_ALIAS>")
            )
        }

        showVgs.addOnResponseListeners(object : VGSOnResponseListener {
            override fun onResponse(response: VGSResponse) {
                when(response) {
                    is VGSResponse.Success -> {
                        val code = response.code
                    }
                    is VGSResponse.Error -> {
                        val code = response.code
                        val message = response.message
                    }
                }
            }
        })
    }
}

Releases

To follow VGS Show SDK updates and changes check the releases page.

License

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

vgs-show-android's People

Contributors

dmytrodm avatar dmytrokhl avatar flor-master avatar raj-balaebail avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.